Category Archives: Web Development

Enabling SSH (https) for Apache 2 in Ubuntu/Mint/Possibly other Debian distro

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051# Intall apache $ sudo apt-get install apache2   # Enable SSL module $ sudo a2enmod ssl # Restart Apache $ sudo service apache2 restart # Create a directory to store the SSLCertificateFile and SSLCertificateKeyFile $ mkdir  /etc/apache2/ssl # Generate … Continue reading

Posted in Linux, Ubuntu, Web Development | Leave a comment

PHP and CURL

1234567891011121314151617181920212223242526function browse($url, $postData = null) {     $fields = ”;     if(is_array($postData) && sizeof($postData) >= 1){         $fields = http_build_query($postData);     }     $ch = curl_init();     curl_setopt($ch, CURLOPT_URL, $url);     … Continue reading

Posted in php, Web Development | Leave a comment

Adding New VirtualHost in Apache2

On linux Ubuntu 1. If your apache has /etc/apache2/sites-available directory then just create a new file “dev.newwebsite.com.conf” with the following content: 12345678910111213<VirtualHost *:80>     ServerName dev.newwebsite.com     DocumentRoot "/var/www/www.newwebsite.com"     # Error handlers     ErrorDocument 500 … Continue reading

Posted in Operating System, php, Ubuntu | Leave a comment

Memcache test connection script

12345678910111213<?php error_reporting(E_ALL); $memcache = new Memcache; // Connect to memcached server $memcache->connect(’127.0.0.1′, 11211) or die ("Could not connect"); // Add it to memcached server // The parameters are: KEY, VALUE, USE COMPRESSION, EXPIRY IN SECONDS $memcache->set(’MyKey1′, ‘The value of My … Continue reading

Posted in php, Web Development | Leave a comment

Redis connection test script

1234567891011121314151617181920212223242526<?php require "../predis/autoload.php";  // Update with your location to predis Predis\Autoloader::register(); try {     $redis = new Predis\Client();     // Uncomment the following lines and adjust them accordingly if you have a non-default redis configuration /*     … Continue reading

Posted in php, Web Development | Leave a comment

Introduction to Logging and Tracing in PHP

If you still tracing variable in php using print_r() or var_dump() then you’ll see them directly in the screen or the web page that you’re working on. This is easy to see, but also prone to problems: What if visitors … Continue reading

Posted in php, Web Development | Leave a comment

Internet Explorer (IE) friendly table DOM manipulation

Occasionaly we can manipulate HTML DOM easily by accessing the innerHTML of an element. In IE however, the following elements’ innerHTML are read only: COL, COLGROUP, FRAMESET, HEAD, HTML, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR. This code will fail … Continue reading

Posted in javascript, Web Development | Leave a comment

Extjs – Ext.apply

1234567891011121314151617181920console.clear(); var a = {     abc : 1,     def : 2 }; var b = {     abc : 1.1,     def : 2.2 }; var c = Ext.apply( a , b ); //Ext.apply … Continue reading

Posted in Ext Js, javascript, Web Development | Leave a comment

JSON Jumpstart

1234567891011121314151617181920212223242526272829303132333435363738394041424344/**  * In JSON curly braket is a sign of a new object ({ or })  * Any variable inside the object, also known as object’s attribute, is accessible using a period sign (.) object.attribute  * or you can also … Continue reading

Posted in javascript, Web Development | Leave a comment

Check For Loaded PHP Extensions

Sometimes you want to make sure a certain php extension is loaded or not. These extension can be curl, xmlrpc, or ldap. After all when you move your application from one server to another the configuration not necessarily the same. … Continue reading

Posted in php, Web Development | Leave a comment