About Me

My photo
I am adept web developer and designer. I studied engineering at IET Bhaddal, Ropar under Punjab Technical University. I develop my interest in web development at an early stage of Computer diploma. After working with top Mohali-based IT companies since 2005, I am currently working at Global Pueblo Solutions. In my free time, I love to play various sports, traveling with friends or family.

Tuesday, January 17, 2017

Adding CTP extension in Netbeans

Recently I faced a problem while working in CakePHP framework using NetBeans 8+ version. When I was adding new .ctp file, Netbeans does not show it in a proper way as it displays for .php files. I mean by the display format of the code. To solve it, you can follow these steps:

1. Go to Files in Tools => Options => Miscellaneous
2. Then click on "New" => Type in "ctp" => Then Click "OK"
3. At last your have to  select (text/x-php5) in "Associated File Type (MIME)"
4. Click "OK"

Happy Coding :)

Wednesday, December 28, 2016

Useful component for taking Joomla Backup

Akeeba Backup Component in Joomla is a very useful extension for taking backup of your Joomla setup in a zipped format (.jpa), It's easy to restore your setup as well along with your database. Sometimes while restoring it on Linux or MAC machines it may ask for right permissions to /installation/tmp folder. Don't worry, Just change the folder permissions to 777 and you can restore your setup.

For more information, you can visit https://goo.gl/IWF1VZ
For documentation, please visit https://goo.gl/pEfNli

Function to get Operating System Information in PHP

Here is the function which you can use to get information about the operating system used by user agent.

echo returnOperatingSystemInfo();

/* Function to get operating system information */
    function returnOperatingSystemInfo() {
        $operatingsystems = array(
            'Open BSD' => 'OpenBSD',
            'Sun OS' => 'SunOS',
            'Linux' => '(Linux)|(X11)',
            'Macintosh' => '(Mac_PowerPC)|(Macintosh)',
            'QNX' => 'QNX',
            'BeOS' => 'BeOS',
            'OS/2' => 'OS/2',
            'Playstation' => '(playstation)|(PSP)',
            'Nintendo Wii' => '(Wii)',
            'Search Bot' => '(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)|(msnbot)|(ia_archiver)',       
            'iPhone' => '(iPhone)',
            'iPad' => '(iPad)',
            'Windows Phone' => '(Windows Phone)|(Windows CE)',
            'Android' => '(Android)',
            'BlackBerry' => '(BlackBerry)|(PlayBook)|(RIM Tablet)',
            'Windows 3.11' => 'Win16',
            'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)',
            'Windows 98' => '(Windows 98)|(Win98)',
            'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',
            'Windows XP' => '(Windows NT 5.1)|(Windows XP)',
            'Windows 2003' => '(Windows NT 5.2)',
            'Windows Vista' => '(Windows NT 6.0)|(Windows Vista)',
            'Windows 7' => '(Windows NT 6.1)|(Windows 7)',
            'Windows 8' => '(Windows NT 8.0)|(Windows NT 8.1)|(Windows 8)|(Windows NT 6.3)|(Windows NT 6.2)',
            'Windows 10' => '(Windows NT 10.0)|(Windows 10)',
            'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',
            'Windows ME' => 'Windows ME'
        );

        foreach ($operatingsystems as $operatingSystem => $pattern) {
            if (eregi($pattern, $_SERVER['HTTP_USER_AGENT'])) {
                return $operatingSystem;
            }
        }
        return 'Not Found Information';
    }


Cheers!

Thursday, December 22, 2016

Installing ROR on Windows 10 Machine

Installing ROR (Ruby on Rails) on windows machine
1.    Download Ruby from http://rubyinstaller.org/ and install
2.    Check Ruby version using command line : C:\>  ruby -v
3.    Check gem version using command line : C:\>  gem –version
4.    Install rails : C:\> gem install rails
5.    Then check rails version :  C:\> rails -v

Congratulations! You are now on Rails.

Let's create a new demo project
    C:\> rails new demo
    C:\> cd demo

   
Run rails server
    C:\demo> rails server

If all set well you will be able to see : Rails 5.0.1 application starting in development on http://localhost:3000
In case if you got some error then, you will need to install bundler from http://bundler.io/v1.2/
    C:\> gem install bundler
   
Install all of the required gems from your specified sources:
    C:\> bundle install

Have a nice start!

Wednesday, December 21, 2016

PHP IP address validation

we can validate an IP Address by using following code snippet:


PHP Email validation

Following code snippet which can use to validate an email with PHP.


Enjoy :)

Share code and use

Today, I am going to start this blog and share code snippets with all my coder friends. I like to share my logic and code snippets, which anyone can use and save time of development. I am also planning to share my other development experience.

Hope my experience will help and we together learn new things, re-use code.

Sharing code snippets will be useful to develop software and web applications.