PHP 5.6 New Features
PHP 5.6 was released on August 28th 2014. This post overviews the main new features this new version introduces. Arguments Unpacking We can use the ‘…’ operator for passing over an array of values to a function we call and have the array values unpacked and assigned into the function parameters. The following code sample […]
JavaScript API Documentation using JSDoc
When developing a new library in JavaScript it would make things simpler for others if we also create a document that explains how to use the library we developed and how to use each and every function it includes. Such document, also known as API Documentation, can be easily created using the JSDoc tool. The […]
Cross-site HTTP requests
Cross-site HTTP requests are HTTP requests at URL addresses other than the domain of the resource making the request. The CORS specification allows the server side (that returns the resource we try to retrieve using the XHR object) to serve the resource to requests coming from resources that were served from other domains. According to the CORS specification the server side […]
The JSONP Technique
When using the XHR object in order to send an HTTP request to specific URL address we are limited. We cannot initiate this HTTP request to servers other than the one from which the web page (in which the code in JavaScript that uses the XHR object is running) arrived. The JSONP technique allows us […]
HttpOnly Cookies Overview PRO
When the server side sends back to the client HTTP headers that instructs the client to create a new cookie (or update a cookie that already exists), the cookie on the client side can be accessed using code written in JavaScript. HttpOnly cookies cannot be accessed using code written in JavaScript. In order to create a […]
Using PHPStorm, MAMP & Xdebug PRO
I have recently noticed that many PHP developers avoid using a proper debugger due to the hassle involved with its settings. In order to assist my PHP students I chose to create a short video clip that explains how to config PHPStorm, MAMP and Xdebug to work together inorder to assist us debugging the code […]
The Pixastic.js JavaScript Library PRO
The Pixastic JavaScript library allows us to perform various operations on images we use in our code. The following code sample shows how simple it is to use this JavaScript library in our code. <!DOCTYPE html> <html> <head> <title>pixastic.js demo</title> <script src=”pixastic.core.js”></script> <script src=”glow.js”></script> <script type=”text/javascript”> function changepix(img) { var newpix = Pixastic.process(img, “glow”, {amount:0.2}); newpix.onmouseout […]
The List.js JavaScript Library PRO
The List.js JavaScript library allows us to manipulate lists, tables and other similar structures in our code. Using this library we can easily filter, sort and allow the user to perform the basic CRUD operations. The following code sample shows how simple it is to use this JavaScript library. <!DOCTYPE html> <html> <head> <title>pixastic.js demo</title> […]
Debugging in Slim Framework PRO
The Slim framework allows us to enable a debugging mode. Once doing it, each time an exception is thrown the Slim framework will generate a detailed debugging message. The following code sample shows how to do it. <?php namespace Com\LifeMichael\Samples; require ‘Slim/Slim.php’; \Slim\Slim::registerAutoloader(); $application = new \Slim\Slim(array(‘debug’ => false)); $application->get( ‘/dbg’, function () { $temp […]
Logging Messages in Slim Framework PRO
The Slim Framework provides us with the Log object. Writing logging messages involves with calling various functions on that object. <?php namespace Com\LifeMichael\Samples; require ‘Slim/Slim.php’; \Slim\Slim::registerAutoloader(); $application = new \Slim\Slim(); $logger = $application->log; $logger->setEnabled(true); $logger->setLevel(\Slim\Log::DEBUG); $environment = \Slim\Environment::getInstance(); $application->get( ‘/simplelogs’, function () { GLOBAL $logger; $logger->info(“i m now starting the get handling function”); echo “<data>response</data>”; […]