• Home
  • About
  • Who Am I?
  •  

    Mars : Life or No Life , But Interesting For Sure!

    March 13th, 2008

    Mars , The Red PlanetThe universe is so full of surprises , plenty of buzz around regarding the new photo released by NASA which shows a female like figure on the Red Planet. Brilliant!

    But on careful examination, its anyones guess really, it could just be like the faces of Mars we saw a few years ago. But i found really interesting were the ripple effects we see in the picture. Amazing , they just seem like there was a river flowing there. The curve in the surface indicates it as well. I have marked the interesting regions in red boxes , you should click on the thumbnail to see the interesting areas , i have reduced the size of the picture and then download the full picture to feel the full effect.

    Honestly , if I wasn’t told this was a picture from Mars, me the ignorant would have thought, this is a picture of the rocky mountains or something. :)
    You can download the full 44MB picture from NASA by clicking on this link.



    PHP Code Cleaner and Indenter

    December 19th, 2007

    Online Code Cleaner Demo

    With six years of experience with PHP , I have been ‘blessed’ with working with code written by really lazy people , who just didn’t think it was important at all to indent their code or comment it or make the opening and ending curly braces align.

    And sometimes our favorite FTP clients would add God knows why those silly annoying empty lines and the code would keep getting bigger and bigger.

    And I am sure that I am not alone in my frustrations.

    That is why is am writing this script which will try to take care of all that.

    Basically it will try to achieve the following goals:

    • Indent your code with tabs.
    • Put a comment block at the start of class definitions or functions.
    • Provide you with the facility to align curly brackets.
    • Remove unwanted lines from the code.
    • Put some spacing in blocks for improved readability.
    • Replaces short open tags with proper <?php tags
    • If a PHP block contains only one line , it will put the whole block in one line to improve readability.

    Please provide your valuable feedback to improve this script. I will be soon releasing a full script which will clean the code in all PHP files in a directory. Stay tuned!

    Online Code Cleaner Demo



    Web based FTP Sync Tool written in PHP

    December 4th, 2007

    FTP Sync Jobs ScreenFTP Sync 0.9

    PURPOSE:
    To upload files which have changed to your production server , automating the task of comparing which files have changed. You simply create a FTP job
    in the script , run the job and it will upload the changed files for you.

    REQUIREMENTS:
    FTP functions are required for this script to work.
    PHP 4 Or 5
    MySQL 4+

    INSTALL:
    Open dbinc.php and put in the database connection variables in there. Once done run installer.php from your browser and you are all set to go.
    Its advised to remove installer.php once you have finished installation.

    SECURITY:
    It if advised that the admin creates users and allocates jobs to them. Also the admin should block access to the database and script files
    from general staff.

    INFO:
    We made this script for our internal use , thought it might be useful for some of you out there. It was a tiring job to find which files needed to be uploaded
    to the main server after development on local server. Thus i created this script , where you can create jobs and upload folders and files which were changed.

    The decision to upload happens on 3 rules:

    1 : you can provide time and date in the job page , files which were created after that time will be uploaded.

    2 : you can ask the script to match the time against the server file , the script would calculate the time offset and calculate if the file has
    changed since last upload.

    3 : The script also keeps a log , if the file changed after last upload , it will upload the file.

    You can exclude the files you dont want to upload, for instance you wont want to upload and overwrite config.php or something like that. So you
    can create the skip list. The skip list is the path of the file from the source directory you have provided.

    For instance if you have a source directory called “/www/something/upload/” , and you dont want to upload the file “/www/something/upload/config.php”
    or the folder “/www/something/upload/users/images” then you would put in something like this:

    config.php
    users/images

    Remember no trailing slash for folders.

    You need to have writable permissions for the logs folder , also if you want to utlize the copy permissions feature you will need the BcMath library
    compiled with PHP.

    The admin can run any job , but if you want to have users which can run specific jobs only please utilize the users section , in which a user can
    run all jobs or only specific jobs.

    Same goes for the jobs , you can set an attribute to allow all users to run the job.

    This code has been tested on PHP 5 and PHP 4.4.

    You are free to modify the code as you please. The code is released in the public domain under the GPL license.

    Enjoy!



    WP Admin Switcher Plugin Updated

    December 4th, 2007

    WP Admin Switcher has been updated , please download the latest zip from the link on the right. This version has been tested on WP 2.3.1 If you are getting a file not found error , than it means you dont have the .htaccess rules set for mod_rewrite. WP Admin Switcher wont work without this.

    Thanks to all the users sending in feedback to make this plugin better.

    Soon i will be updating the plugin to handle blogs with no mod_rewrite (permalinks) .

    Keep checking!



    PHP :: Serialize and Unserialize Alternative

    November 17th, 2007

    For quite sometime now I have been really annoyed by the unreliability of serialize and unserialize , when you would have a large string or some some special characters in there that wouldnt turn back into variables. So finally after not finding a decent alternative by someone else ( maybe I am only one suffering from the problem????? ) , I decided to write my own two functions.

    These two are working great for me , hope they serve some purpose to someone else. I am sure there is room for improvement here, please send in any suggestions or ideas to incorporate.

    Code (php)
    1.  
    2.         /// Usage
    3.         ////– first parameter is the var name , second is the var itself
    4.         $string = makeXML(’somevarname’ , $somevarname);
    5.  
    6.         ////— extractVars takes the above string as parameter ,
    7.         ////— and returns an arrray with variable name as key and variable itself
    8.         ///—  as value , i have used extract() to take all vars into code.
    9.         extract(extractVars($string));
    10.  
    11.  
    12.         function extractVars($xml , $name= , $type=){
    13.                 $reg="!<xmlvar name=\’(.*?)\’ type=’(.*?)’>(.*?)</xmlvar name=\’\\1\’>!s";
    14.                 preg_match_all($reg , $xml , $matches);
    15.  
    16.                 foreach($matches[1] as $index=>$key){
    17.                         $optname = $key;
    18.                         $opttype = $matches[2][$index];
    19.                         $optval = $matches[3][$index];
    20.  
    21.                         $optxpl = explode("::" , $optname);
    22.                         $optname = $optxpl[count($optxpl)-1];
    23.  
    24.                         if($opttype == ‘object’){
    25.                                 $bigarr[$optname] = (object)extractVars($optval , $optname , $opttype);
    26.                         }elseif($opttype==‘array’){
    27.                                 $bigarr[$optname] = extractVars($optval , $optname , $opttype);
    28.                         }else{
    29.                                 $bigarr[$optname] = $optval;
    30.                         }
    31.                 }
    32.  
    33.                 return $bigarr;
    34.         }
    35.  
    36.  
    37.  
    38.         function makeXML($name , $var="" , $parent = NULL ){
    39.                 if(!is_null($parent)) $parent = $parent."::";
    40.  
    41.                 if(is_object($var)){
    42.                         $xml .= "<xmlvar name=’$parent$name’ type=’object’>";
    43.                         foreach($var as $key=>$val){
    44.                                 $xml .= makeXML($key , $val , $parent.$name);
    45.                         }
    46.                         $xml .= "</xmlvar name=’$parent$name’>\r\n";
    47.                 }elseif(is_array($var)){
    48.                         $xml .= "<xmlvar name=’$parent$name’ type=’array’>";
    49.                         foreach($var as $key=>$val){
    50.                                 $xml .= $tab.makeXML($key , $val , $parent.$name);
    51.                         }
    52.                         $xml .= "</xmlvar name=’$parent$name’>\r\n";
    53.                 }elseif(is_bool($var)){
    54.                         $xml .= "<xmlvar name=’$parent$name’ type=’bool’>";
    55.                         $xml .= "$var";
    56.                         $xml .= "</xmlvar name=’$parent$name’>\r\n";
    57.                 }else{
    58.                         $xml .= "<xmlvar name=’$parent$name’ type=’string’>";
    59.                         $xml .= "$var";
    60.                         $xml .= "</xmlvar name=’$parent$name’>\r\n";
    61.                 }
    62.                 return $xml;
    63.         }
    64.  


    Migrating From Windows To Fedora Core Linux : The Journey Begins

    September 12th, 2007

    My New DesktopI have always been a fan of the Linux community and always wanted to make Linux as my main Desktop OS , but things like Visual Studio .NET stopped that from happening. For 3 years I have been administrating Linux based servers as part of my job responsibility of being a Senior Web Developer, who doesnt really like to be dependent on sys admins , who take their time to even carry out simplest of operations. I always liked the stability and robustness of these servers and always wanted to have something similar on my desktop. ‘Boot and Forget’ has been something of a dream with Microsoft Windows. But on the other hand I was so used to the Windows desktop that i was afraid to move an inch , as I thought it would effect my performance. Here is the story of how I finally had the courage to make the leap.

    Last week our office network suffered a heavy blow cause of a silly virus/worm which kept on replicating itself to all computers on the network , though my system remained safe as I was using McAfee (which i consider the best anti-virus around) . One of my responsibilities includes network administration as well thus i was running between systems trying to fix one thing after the other. Some systems were damaged to the extent of needing a new XP install. That day I decided that it was time that we all moved to a less vulnerable system. The ground work was done , as we recently started to use OpenSuse 10.2 for our local testing server needs.

    So next day we first tested out Ubuntu 7 aka Feisty Fawn on a junior developers machine . It was pretty much plug and play and I love the live CD idea , Wireless networking went in pretty smoothly and so did all the other hardware. Perfect! BUT I just couldnt get used to the idea of a fake root … I mean root is root…. how can you fake it? . Does the logged in user have root rights or not …. well turns out the user does have root rights but to do anything really useful you have to use ’sudo’ . Nahhhh not for me .. I want control , I dont want to fake it!!! . See Ubuntu is for the really casual desktop user, like my wife , who just needs the check her emails and browse around a bit but for people who use the computer to its full extent Ubuntu is kinda limited.

    Then I installed Fedora Core 7 on an another machine and things started to fall in place. Fedora seemed to have all the answers I needed , and it also seemed to have better performance than Ubuntu. This gave me the courage and confidence to install on my own machine. So I installed FC 7 on a new hard drive on my own machine , keeping all the windows stuff on 2 seperate hard drives. The install process also proved seamless support for my SATA drive and RAID controller which while installing Windows required a driver to be installed via a floppy drive!! . As most would know Linux offers two popular desktop environments KDE and GNOME , I installed both , just to make sure I can experiment with both and find out which is best for me. After a few quick minutes on both KDE and GNOME , I decided to stick with KDE. The collection of applications provided in the install package is amazingly good , basically almost everything you might need is already in there. Ranging from Multimedia software to Server Administration tools.

    All of my hardware installed automatically , including my Creative Audigy Sound Card , which I thought might be left out. The only thing that FC 7 didnt pick up was my Wifi card . So the next step was to configure the Internet/LAN connectivity via my D-Link WIFI card , the driver for which i found at http://rt2×00.serialmonkey.com/ . To see the link activity in taskbar like we do in windows system tray (the two monitors blinking on and off) , I installed KNemo. and added it to my system tray panel. See now its about customizing your environment as close to what you are already used to , basically the Windows interface. and trust me there is no real limit to customization when you enter the linux world. It is only limited by your imagination.

    2 Very important sites to remember for KDE are kde-look.org and kde-apps.org . Browsing about I found a Set of XP icons which took care of the Icons part of the look and feel. Then I turned my attention towards the square “K” menu button ,I installed KBFX which allowed me to customize my “Start” button and make it rectangular or customize the icon , this app also allowed me to change the menu style and allowed templating of the K menu.

    Once the look and feel become something to which I was accustomed , Now I wanted to mount my other 2 hard drives and make my XP bootable as well from my Linux GRUB loader. So I searched around and found the answer for Duel botting , I edited to my /boot/grub/grub.conf and added this to the end.

    title Windows XP
    map (hd0) (hd1)
    map (hd1) (hd0)
    rootnoverify (hd1,0)
    chainloader +1

    to make my NTFS partitions on my other 2 hard drives mounted at boot time , i created folders in /mnt folder and added the below to my /etc/fstab file

    /dev/sdc1               /mnt/C-Drive             ntfs-3g  defaults      0 0
    /dev/sdc5               /mnt/D-Drive             ntfs-3g  defaults      0 0
    /dev/sdc6               /mnt/E-Drive             ntfs-3g  defaults      0 0

    You can find the /dev/xyz by typing fdisk -l at the terminal, this outputs the details of the hard drives and partitions. Upon next reboot , I was able to get to my XP boot loader via the GRUB menu and also I got the other partitions mounted just fine.

    Once this was out of the way I wanted to have something similar to “My Computer” , I once again found kde-apps to be my friend and found KIO Slave sysinfo:/ , i added a new link to URL on my desktop , named it My Computer and in the path to run I placed “sysinfo:/” , double clicking the icon brought me to a page which showed me my HD Partitions , CPU , RAM , VGA stats . pretty neat stuff!

    Once my environment was set i moved towards my IM needs , I found Pidgin (formerly known as gaim) pretty good , with messege archiving support and ability to connect to several IM networks at the same time , it made my day. I also found KMess to be a reasonable MSN clone. Got my skype working pretty soon as well.

    Wonderful , so far so good!!

    Now I moved towards the tools i needed for my professional needs. As a hard core web developer , my favorite browser remains FireFox BUT i do have to check my sites with IE as well , just to make sure everything is working well for both sides of the internet world. The best news came when I found IE for linux!!!! YES IE FOR LINUX!!! Check it out here , the install went perfect and now my linux was IE capable! .Another thing I must point out here is the fact that i copied my FireFox profile over from my XP install and replaced the profile folder on my linux box and on FireFox restart , everything was there including all the plugins! WOW … Kudus to the FireFox team!

    The next stage was to get my favorite WYSIWYG editor Macromedia Dreamweaver working , i had heard that it was possible . So I searched around and found how to run Macromedia Dreamweaver and Flash on Linux , wonderful resource , priceless!. Although that article is targeted at Ubuntu users but it fits perfectly fine into our Fedora distro as well. So after a bit my linux box was running Macromedia Dreamweaver as well. Though I still have to figure out how to associate PHP files with Dreamweaver , so that they would open in Dreamweaver automatically.

    I tried the same approach with my favorite FTP client CuteFTP and it worked out pretty good as well , a little buggy but tolerable for me!

    At the end of all this , I was pretty satisfied with how my Fedora box turned out. Now I turned towards some performance tweaks and found this really good series of articles. Part 1 , Part 2 and Part 3 , these articles surely helped me tweak a few things performance wise. The last but not the least was to go into services manager (just like I did on windows) and turn off un-needed services at run time. Like i didnt need the ISDN support , so I turned it off , I also didnt need bluetooth support , so i turned that service off , basically this will vary according to your needs , so turn off services carefully and wisely.

    I think this is enough for now , in the next article I will try to cover SAMBA and how I got my network computers (which include both Windows and Linux machines) to share files and printers with each other.

    Hope this info comes in handy for someone!



    Affordable PHP 5 and MySQL 5 Hosting Available

    August 25th, 2007

    Decode IT has announced PHP 5 and MySQL 5 hosting.  After signup customers will be given a choice between version 4 and 5. The servers are dual core servers with high uptime and reliability. Small packages are ideal for Wordpress installations which can be done with clicks via the Fantastico control panel. All accounts contain the all time great CPanel account manager.

    Here is the overview….
    50 MB Hosting - $2.00 pm
    100 MB Hosting - $4.00 pm
    200 MB Hosting - $8.00 pm
    500 MB Hosting - $20.00 pm
    1000 MB Hosting - $35.00 pm

    You can find the details of the packages here.

    Enjoy!!



    Minor But Important Update to Wp Admin Switcher

    August 25th, 2007

    Thanks to a user , i have just tracked down a minor bug which could cause the plugin to breakdown with certain urls .. please download the zip from the download link provided on top right and update both .php files inside your /wp-content/plugins/wp-admin-switcher/ folder.



    TCP Optimizer : Optimize Your Internet Connection Speed

    August 18th, 2007

    I switched my DSL provider lately and some people were kinda shocked at the download rates I was getting , I was getting atleast twice more than all of them. I was surprised as well , then after alot of thinking I remembered that a few months ago i was just surfing over the internet and downloaded TCP Optimizer and tried it out and noticed improvement in my download speeds, it wasnt much evident as i was using 256Kbps DSL back then , but the significance became evident when i switched to 1MBps. So I recommend all of you who want to get the most out of their downloads to try out this free software , which worked like a charm for me.

    TCP Optimizer is available free here



    Easily Switch Between Multiple Wordpress Admins - WP Admin Switcher V1

    August 1st, 2007

    WP Admin SwitcherJust finished my first plugin for wordpress called WP Admin Switcher. You can download this plugin here

    After you have installed this plugin you will be able to add information of multiple blogs you manage, the plugin will show you a drop down on top of all pages and let you switch between blogs. When you switch the plugin will attempt to show the same page of the other blogs administration panel. This plugin also works with free blogs from wordpress.com.

    The plugin requires CURL to be installed with PHP. Also please make sure to set the permission of the folder “tempfiles” to 777. Another point to keep in mind is that when you enter the URL of the administration panel in the WP Admin Switcher management page , please make sure you enter the correct URL. Some blogs are set to force www , so the page will keep redirecting to http://abc.com/wp-admin/ if you enter the URL like this http://www.abc.com/wp-admin/ . So make sure that enter the correct wp-admin URL.

    Have Fun!

    2nd Sept , 2007 : As someone pointed out there are several blogs out there that dont use mod_rewrite or permalinks , so thus plugin wont work out of the box for them , they need to create a mod_rewrite rule to point to the main index.php for wp-admin/virtual/ requests. If you dont have mod_rewrite available then this plugin is not going to work for you , maybe the next version will make it independent of mod_rewrite.


    24th Aug , 2007 : A bug was found which was leading to a breakdown in the plugins functionality , thanks to a user , this has been weeded out.


    5th Aug , 2007
    : Some adjustments were made to the script based on user feedback, if you are seeing messages which indicates that your request was blocked , please download the plugin again from the link above and see if it helps.