Javascript Ajax

<script type="text/javascript">
		function getHTTPObject(){
			var xmlhttp;
			// Attempt to initialize xmlhttp object
			try {
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			catch (e) {
				// Try to use different activex object
				try {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				catch (E) {
					xmlhttp = false;
			// If not initialized, create XMLHttpRequest object
			if (!xmlhttp) {
				if (typeof XMLHttpRequest != 'undefined') {
					xmlhttp = new XMLHttpRequest();
				else {
					alert("This browser does not support AJAX.");
					return null;
			return xmlhttp;
		function loadTask (id,list) {
			httpObject = getHTTPObject();
			if (httpObject != null) {"GET", "<?php echo base_url(); ?>project/timesheet/task/"+id, true);
				httpObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				httpObject.setRequestHeader("Connection", "close");
				httpObject.onreadystatechange = function() {
						if (httpObject.readyState == 4) {
							if (httpObject.responseText == "") {
								document.getElementById('task'+list).innerHTML = 'No Task';
							else {
								document.getElementById('task'+list).innerHTML = httpObject.responseText;
						else {
							document.getElementById('task'+list).innerHTML = 'Loading Task...';


Curl Grep Function

function curl_grap($Url){
    // is cURL installed yet?
    if (!function_exists('curl_init')){
        die('Sorry cURL is not installed!');
    // OK cool - then let's create a new cURL resource handle
    $ch = curl_init();
    // Now set some options (most are optional)
    // Set URL to download
    curl_setopt($ch, CURLOPT_URL, $Url);
    // Set a referer
    curl_setopt($ch, CURLOPT_REFERER, "");
    // User agent
    curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
    // Include header in result? (0 = yes, 1 = no)
    curl_setopt($ch, CURLOPT_HEADER, 0);
    // Should cURL return or print out the data? (true = return, false = print)
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    // Timeout in seconds
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    // Download the given URL, and return output
    $output = curl_exec($ch);
    // Close the cURL resource, and free system resources
    return $output;

Yum Repo Command



To list only enabled repos, enter:

# yum repolist enabled

To list only disabled repos, enter:

# yum repolist disabled

To list all repos (default), enter:

# yum repolist all

To list available packages under a repo called ksplice-uptrack, enter:

# yum --disablerepo="<repo name>" --enablerepo="<repo name>" list available

Install PHPUnit in Xampp


First off I’m assuming xampp is installed to C:\xampp
1. Open a command prompt and go to C:\xampp\php
2. Type “pear update-channels” (updates channel definitions)
3. Type “pear upgrade” (upgrades all existing packages and pear)
4. Type “pear channel-discover” (this is needed for PHPUnit)
5. Type “pear channel-discover” (also needed by PHPUnit)
6. Type “pear channel-discover” (This IS phpunit)
7. Type “pear install –alldeps phpunit/PHPUnit” (installs PHPUnit and all dependencies)

Mysql Export Import through terminal


Mysql Export Import through terminal


mysqldump -p -u username from_mydb > to_mydb.sql


tar -zcvf mydb.tar.gz mydb.sql


tar -zxvf mydb.tar.gz


mysql -p -u username db_target < from_mydb.sql