Traceroute command not working on Ubuntu

By | August 4, 2012

The traceroute utility can be installed from synaptic : $ sudo apt-get install traceroute Some Information : $ traceroute -V Modern traceroute for Linux, version 2.0.15, Oct 17 2010 Copyright (c) 2008 Dmitry Butskoy, License: GPL v2 or any later Doing some test runs $ traceroute www.google.com traceroute to www.google.com (74.125.235.20), 30 hops max, 60… Read More »

Get ip address from hostname in C with Linux sockets

By | July 31, 2020

Socket applications often need to convert hostnames like google.com to their corresponding ip address. This is done through dns requests. The socket api in linux provides functions like gethostbyname and getaddrinfo that can be used to perform the dns requests and get the ip address. 1. gethostbyname The first method uses the traditional gethostbyname function… Read More »

Run Apache as a specific user with mpm itk on Ubuntu Linux

By | December 8, 2011

Install mpm itk On ubuntu mpm itk can be installed from synaptic. Look for the package called apache2-mpm-itk sudo apt-get install apache2-mpm-itk Configure Configuration for mpm itk can be done in the file sites-enabled/000-default $ gksudo gedit /etc/apache2/sites-enabled/000-default In the VirtualHost *:80 section add this just before the end of the VirtualHost tag [xml] <IfModule… Read More »

Convert simplexml object to array in php

By | December 6, 2011

The simplexml extension of php is quite simple and easy to use when it comes to parsing “well-formatted” xml files. Well formatted means , xml that is not broken or does not have too many errors. One of the most handy functions of this extension is simplexml_load_string. Here is an example : &lt;?php $xml =… Read More »

Php get zip error message from error number

By | November 24, 2011

Php functions like zip_open return an error number if they fail. To get the corresponding error message from the error number , use the following function. function zip_error_message($errno) { // using constant name as a string to make this function PHP4 compatible $zipFileFunctionsErrors = array( 'ZIPARCHIVE::ER_MULTIDISK' =&gt; 'Multi-disk zip archives not supported.', 'ZIPARCHIVE::ER_RENAME' =&gt; 'Renaming… Read More »

Get http request headers in php

By | November 22, 2011

When a browser makes a request to a php script, the browser sends some http headers which can look like this : Host: localhost Connection: keep-alive User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: UTF-8,*;q=0.5 Cookie: username=admin; password=21232ffc3; PHPSESSID=o5m4e2td1m66c4pkjdag9vs0u2 The php script under request ,… Read More »

PHP get adsense earnings and reports

By | November 9, 2011

In this article we are going to login into Google Adsense and retrieve earnings. Google Adsense now has a new interface and so needs a different kind of coding. In this example we shall fetch “yesterday’s” earnings sitewise. Create a Report to be fetched : First open the sitewise report in the Performance Tab in… Read More »