Archive

Author Archive

Eid again!

Reward, its what God has transcribed it in clear words in His message for humanity. The love the sacrifice the wellbeing of His creatures is what Ramadan has been set for all of us. In a world of total deception, reflecting a true self is one hell of a challenge for all of philanthropists like me though I will urge all to not put a stop to charity initiatives. We are few percent of those who fast for a month. On the contrary, a myriad of fellow humans have to fast around the year [thanks to our capitalist society]. When I was kid, I always end up arguing with my pop about this ignorance of God to those who can’t even earn one time meal for their kids and my pop relied, “God has given you enough both in terms of this awareness and ample resources so you should reach out to those who are needy!”.

Wish you and your family a happy Eid! While you be celebrating with your loved ones please spare few minutes and bring smiles back to those street kids around the house 🙂

Advertisements
Categories: Uncategorized

List the languages of each countries

October 18, 2010 Leave a comment

Below is a list of actions that I have took to extract the languages of each countries. I am sharing the procedure so If you can suggest some optimal procedure to carry out the same task.

Steps:

  1. Visit the CIA world fact book page as mentioned above
  2. Copy that html code while holds the required data using Firebug
  3. Browse the file and copy the fields using pointer
  4. Paste the fields in the text file named languages.txt
  5. Learn how to read the file line by line from php manual
  6. Apply the following PHP script to filter out the data in terms of Country and Native languages

<?php
$myfile = ‘languages.txt’;
$lines = file($myfile);
for($i=count($lines);$i>0;$i–){

$arr = explode(‘ ‘, $lines[$i], 2); // Seperate Country and Native languages
$native = $arr[1]; // Only native languages sperated by “,”
echo “<pre>”;
echo $arr[0];
print_r(explode(‘,’, $native));
echo “</pre>”;
}
?>

What’s left:
Populating the database with the above extracted data.

Categories: Web Services Tags:

IP to country conversion

October 18, 2010 1 comment

Though there are a lot of available solutions to tackle this problem but the one reside in the Google Code is the perfect one with simplicity and ease of use. Below is the work around to setup a test case; –

Explore the code:

Visit the project’s profile and read about the documentation.

Download the code;

Get the latest code from the repo and extract it to the root directory of the web server. Linux – /var/www/phpip2country Windows – C:\xampp\htdocs\phpip2country

Test the code:

Browse the directory in the browser. http://localhost/phpip2country/index.php

You need to upload the sql file which is actually a mapper for IP and Countries.

Results:

IP: 127.0.0.1
IP numerical Value: 2130706433
IP registry: IANA
IP assigned (Y-m-d H:i:s): 1983-01-01 05:00:00
IP country RIR (Regional Internet Registry) representation: ZZ
IP Country Abbreviation: ZZZ
IP country name: RESERVED
IP range: array (
‘FROM’ => ‘127.0.0.0’,
‘TO’ => ‘127.255.255.255’,
)
IP range numerical: array (
‘FROM’ => ‘2130706432’,
‘TO’ => ‘2147483647’,
)
full IP informations array: array (
‘IP_FROM’ => ‘2130706432’,
‘IP_TO’ => ‘2147483647’,
‘REGISTRY’ => ‘IANA’,
‘ASSIGNED’ => ‘410227200’,
‘CTRY’ => ‘ZZ’,
‘CNTRY’ => ‘ZZZ’,
‘COUNTRY’ => ‘RESERVED’,
‘IP_STR’ => ‘127.0.0.1’,
‘IP_VALUE’ => 2130706433,
‘IP_FROM_STR’ => ‘127.0.0.0’,
‘IP_TO_STR’ => ‘127.255.255.255’,
)

Below is the output when the code has been set on a live server.

IP: 116.58.42.211
IP numerical Value: 1949969107
IP registry: APNIC
IP assigned (Y-m-d H:i:s): 2007-03-27 19:00:00
IP country RIR (Regional Internet Registry) representation: PK
IP Country Abbreviation: PAK
IP country name: PAKISTAN
IP range: array (
‘FROM’ => ‘116.58.0.0’,
‘TO’ => ‘116.58.127.255’,
)
IP range numerical: array (
‘FROM’ => ‘1949958144’,
‘TO’ => ‘1949990911’,
)
full IP informations array: array (
‘IP_FROM’ => ‘1949958144’,
‘IP_TO’ => ‘1949990911’,
‘REGISTRY’ => ‘APNIC’,
‘ASSIGNED’ => ‘1175040000’,
‘CTRY’ => ‘PK’,
‘CNTRY’ => ‘PAK’,
‘COUNTRY’ => ‘PAKISTAN’,
‘IP_STR’ => ‘116.58.42.211’,
‘IP_VALUE’ => 1949969107,
‘IP_FROM_STR’ => ‘116.58.0.0’,
‘IP_TO_STR’ => ‘116.58.127.255’,
)

Categories: Web Tools Tags: , ,

OpenInviter let’s drag friends

September 3, 2010 1 comment

OpenInviter is a fantastic edition to the open source widget domain. The purpose is pretty simple and straight forward that is dragging friends instantly.

Below is my 15mins interaction with that widget.

  • Get yourself register with the service. This is mandatory because the widget will use the private key generated for a particular user.
  • Extract the compress file in webserver root directory

#sudo tar zxvf openinviter-*.tar.gz

  • Fullfill the dependencies like wget and curl packages

$sudo apt-get install wget curl

  • Navigate the postinstall.php and look for the following output;-

Checking username and private key… *OK*
Checking PHP version… *OK*
Checking DOMDocument support… *OK*
Checking transport method… libcurl is installed. Using cURL to handle requests
SQLite is NOT installed. Unable to keep stats. This will not affect the OpenInviter modules since they will run without keeping any stats.
Checking write permisions… /tmp is writable. Using /tmp to store cookie files and logs
Checking for new versions of OpenInviter… Your OpenInviter software is up-to-date
Checking Abv… *OK*
Checking AOL… *OK*
Checking Apropo… *OK*
Checking Atlas… *OK*
Checking Aussiemail… *OK*
Checking Azet… *OK*
Checking Bigstring… *OK*
Checking Bordermail… *OK*
Checking Canoe… *OK*
Checking Care2… *NOT OK* – This plugin might not work correctly on your system
Checking Clevergo… *OK*
Checking Doramail… *OK*
Checking Evite… *OK*
Checking FastMail… *OK*
Checking 5Fm… *NOT OK* – This plugin might not work correctly on your system
Checking Freemail… *OK*
Checking Gawab… *OK*
Checking GMail… *OK*

  • Once done either delete the postinstall.php file or rename it.

# sudo mv /var/www/jump4tmp/openinviter/postinstall.php /var/www/jump4tmp/openinviter/postinstallDONE.php

  • For detail install instructions look for the install.txt file.
  • Navigate the openinviter root directory and look for config.php file while will set the settings of the widget

# sudo gedit /var/www/jump4tmp/openinviter/config.php

<?php
$openinviter_settings=array(
‘username’=>”register_user”, ‘private_key’=>”801cb788f47075fd3cf57328b7948527″, ‘cookie_path’=>”/tmp”, ‘message_body’=>”You are invited to http://website.com&#8221;, ‘message_subject’=>” is inviting you to http://website.com&#8221;, ‘transport’=>”curl”, ‘local_debug’=>”on_error”, ‘remote_debug’=>””, ‘hosted’=>””, ‘proxies’=>array(),
‘stats’=>””, ‘plugins_cache_time’=>”1800″, ‘plugins_cache_file’=>”oi_plugins.php”, ‘update_files’=>”1″, ‘stats_user’=>””, ‘stats_password’=>””);
?>

  • Adjust the file content according to you need like stayed above.
  • Finally navigate to the example.php in the browser to play around with the widget LIVE!

http://localhost/jump4temp/openinviter/example.php

 

example.php

openinviter/example.php

 

Flex development on Linux

September 2, 2010 1 comment

Hey guys, I hope there are lot of guys who are relying on linux distro like Ubuntu, centos or fedora to name some. As far as the developers, geeks and machine fanatics are concerned. Aftyer such an addiction it’s quite difficult to work back on Windows system for some specific reasons like previous was the case as flash development is restricted to windows based machines. But now as adobe took a nice decision to move to bit to open source society with their new open source flexsdk the dream to develop flash based application on the linux island come true. Now with a handful of simple plugins our distro will be up and ready to develop application in flash and actionscript.

1. Download the eclipse euorpa with JEE support (v3.2 or higher)
Visit the following link http://www.eclipse.org/downloads/
Look for Eclipse IDE for Java EE Developers
32bit: http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/helios/R/eclipse-jee-helios-linux-gtk.tar.gz
64bit: http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/helios/R/eclipse-jee-helios-linux-gtk-x86_64.tar.gz

or get a torrent: http://build.eclipse.org/technology/phoenix/torrents/jee/eclipse-jee-helios-linux-gtk.tar.gz.torrent

Move the tar file into /opt dir
# sudo mv eclipse-*.tar /opt

Untar the eclipse compress file
# sudo tar zxvf eclipse-*.tar
# sudo cd eclipse
# ./eclipse &

2. Install the following plugins

In the menu, we choose Help -> Install new software…

Click on the “Add…” button, and type the following:

Name: Eclipse IMP
Location: http://download.eclipse.org/technology/imp/updates/

Name: AXDT
Location: http://update.axdt.org/

Choose (at least) the following packages:
Axdt AS3 Feature
Flex3SDK Feature

Then click on the “Next >” button, accept the licence and proceed to install the AXDT + Flex SDK framework.

Once installed, restart Eclipse

Go to the menu: Window -> Open perspective -> Other… -> AXDT

That’s all what you need to get started with Flas application development.

Coming soon

Tutorial: Write and compile you first flex application

USB networking on mobile platforms

April 25, 2010 3 comments

After the dot com bubble the new bubble is surely mobile platforms.  The same trend is getting the hype in ma university where now lot of guys are working on mobile platforms and related technologies. Two of the guys are tease me with a lot of questions accordingly including Mr. Hassaan Masud and Mr. Humanyun Ali Daud.

Symbian:

Nokia network bridge

Which is a J2ME based api and can be downloaded from here. For a complete set of IP related application scan here. If you are a Linux guy then you are well aware of the importance of doing ssh on other machines here you go with a putty (.sis) for you symbian device. GNUBox is an application that let’s you share your machine’s internet with the device using USB.

Other applications repos: [1]

Windows Mobile:

You can connect your Windows mobile 6.0 or higher with you machine by following the following steps. By using the Virtual Machine Network Driver you can enable TCP/IP Networking on the Device Emulator.

Google Android:

Wow! Android is ma love :p the fantastic platform as far as mobile eco-system is concerned. There is one application called ConnecBot an port of linux terminal and a perfect SSH client. here’s an other how-to guide with HTC set.

Apple’s iPhone:


RIM’s Blackbery:


Palm’s WebOS:


OpenMoko’s Freerunner:

This is the world’s first Open source mobile phone both in terms of software and hardware. The USB networking on Openmoko has been well explained on it’s wiki which gives you the real feel of linux in your hands.

Flash-player for Mozilla Firefox

April 25, 2010 Comments off

I thing firefox should struggle a bit to make a contract with adobe on this regards which will save our time but in the mean while see the below methods to do it yourself.

From the tar file:-

unpack anywhere (as a root user)

# tar -zxvf install_flash_player_10_linux.tar.gz

Run the script

# ./flashplayer-installer

Copyright(C) 2002-2006 Adobe Macromedia Software LLC.  All rights reserved.

Adobe Flash Player 10 for Linux

Adobe Flash Player 10 will be installed on this machine.

You are running the Adobe Flash Player installer as a non-root user.
Adobe Flash Player 10 will be installed in your home directory.

Support is available at http://www.adobe.com/support/flashplayer/

To install Adobe Flash Player 10 now, press ENTER.

To cancel the installation at any time, press Control-C.

NOTE: Please exit any browsers you may have running.

Press ENTER to continue…

———– Install Action Summary ———–

Adobe Flash Player 10 will be installed in the following directory:

Mozilla installation directory  = /home/username/.mozilla

Proceed with the installation? (y/n/q): y

NOTE: Please ask your administrator to remove the xpti.dat from the
components directory of the Mozilla or Netscape browser.

Installation complete.

Perform another installation? (y/n): n

The flash plugin is installed now!

Or if the tar file just have the lib proceed with the following

copy unpacked ‘libflashplayer.so’ to ‘/usr/lib64/browser-plugins’ directory

# cp libflashplayer.so /usr/lib/browser-plugins

set permissions: ‘chmod 755 /usr/lib64/browser-plugins/libflashplayer.so’

# chmod 755  /usr/lib/browser-plugins/libflashplayer.so

From the repository:-

In Redhat :

# up2date  flash-plugin

In Suse:

# zypper in flash-player

Retrieving repository ‘openSUSE-11.2-Non-Oss’ metadata [\]

Expected errors:

System management is locked by the application with pid 4399 (/usr/sbin/packagekitd).
Close this application before trying again.

Fix:

Kill the process and rerun the command

# kill -9 <PID>

In Ubuntu:

Just visit youtube.com and a pop=up will appear asking you to install the required flash plugin it’s that simple!

Confirmation:

To confirm successful installation launch your Firefox browser and in the address bar type “about:plugins” and press enter.

Caution:

To install the plugin successfully it is advised to close all the instances of the firefox before running the plugin

Categories: How to Tags: , ,
%d bloggers like this: