Hello everyone.

I have been away for a while however I have thought that I like to come back to write again. And hopefully this time, I will be writing more frequently than last time.

Watch this space.




Flash player not working in firefox

If you are having trouble with flash player not working in firefox on your 32bit ubuntu, here is some thing that may help.

1./ purge all flash related package
$sudo apt-get purge flashplugin-nonfree flashplugin-installer gnash gnash-common mozilla-plugin-gnash swfdec-mozilla

2./ remove files from
$sudo rm -f /usr/lib/firefox/plugins/*flash*
$sudo rm -f /usr/lib/firefox-addons/plugins/*flash*
$sudo rm -f /usr/lib/mozilla/plugins/*flash*
$sudo rm -f ~/.mozilla/plugins/*flash*so
$sudo rm -rfd /usr/lib/nspluginwrapper

3./ download flash player .tar.gz file

4./ decompress .tar.gz
$tar xvfz install_flash_player_11_linux.i386.tar.gz

5./ make directory
$mkdir ~/.mozilla/plugins

6./ mv libflashplayer.so
$mv -f libflashplayer.so ~/.mozilla/plugins/

7./ create links
$sudo ln -s /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/firefox-addons/plugins/
$sudo ln -s /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/xulrunner-addons/plugins/

8./ test flash player

Directory bookmarking for bash

I created this bookmark bash script to help me move around from on project folder another faster on the commnand line

function cdb() {
    USAGE="Usage: cdb [-c|-g|-d|-l] [bookmark]" ;
    if  [ ! -e ~/.cd_bookmarks ] ; then
        mkdir ~/.cd_bookmarks

    case $1 in
        # create bookmark
        -c) shift
            if [ ! -f ~/.cd_bookmarks/$1 ] ; then
                cd `pwd` > ~/.cd_bookmarks/"$1" ;
                echo "Try again! Looks like there is already a bookmark '$1'"
        # goto bookmark
        -g) shift
            if [ -f ~/.cd_bookmarks/$1 ] ; then 
                source ~/.cd_bookmarks/"$1"
                echo "Mmm...looks like your bookmark has spontaneously combusted. What I mean to say is that your bookmark does not exist." ;
        # delete bookmark
        -d) shift
            if [ -f ~/.cd_bookmarks/$1 ] ; then 
                rm ~/.cd_bookmarks/"$1" ;
                echo "Oops, forgot to specify the bookmark" ;
        # list bookmarks
        -l) shift
            ls -l ~/.cd_bookmarks/ ;
         *) echo "$USAGE" ;

1./ create a file ~/.cdb and copy the above script into it.
2./ in your ~/.basrc add the following

if [ -f ~/.cdb ]; then
    source ~/.cdb

3./ restart your bash session

1./ to create a bookmark

$cd my_project
$cdb -c project1

2./ to goto a bookmark

$cdb -g project1

3./ to list bookmarks

$cdb -l

4./ to delete a bookmark

$cdb -d project1

5./ where are all my bookmarks stored?

$cd ~/.cd_bookmarks

Setting up Git (Linux) with your Beanstalk or GitHub account

This is a simple topic taking you through how to set up git with your Beanstalk or GitHub account

1./ Setting up GIT
1.1/ Download the latest git-core package using aptitude or synaptic

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git-core git-gui git-doc

2./ Setting up SSH key
2.1/ change directory to ~/.ssh

$ cd ~/.ssh

2.2/ create SSH key. Keeping things simple, just enter an empty passphrase

$ ssh-keygen -t rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/your_user_directory/.ssh/id_rsa.
Your public key has been saved in /Users/your_user_directory/.ssh/id_rsa.pub.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db user_name@username.com
The key's randomart image is:
+--[ RSA 2048]----+
| .+ + |
| = o O . |
| = * * |
| o = + |
| o S . |
| o o = |
| o . E |
| |
| |

2.3/ Add your SSH key to Beanstalk or GitHub

Copy id_rsa.pub content and …

On the Beanstalk site go to “Profile & Settings” > Click “Keys” > Click “Add public key”

beanstalk public key

On the GitHub site go to “Account Settings” > Click “SSH Public Keys” > Click “Add another public key”

github public key

Share keyboard and mouse between multiple Windows and Linux

I love my (Ubuntu) Linux box however time to time I have to switch to Windows box, this involves having two keyboards and mouses which can get very confusing. I know you can ssh into Linux box using putty from windows however I want to be able to switch from both using single keyboard and mouse. Enter Synergy, this app helps you to do just that. So here are the steps

1./ Install Synergy: On your Ubuntu machine type ‘apt-get install synergy’ and on windows, download synergy .exe file.
2./ On your Ubuntu create /etc/synergy.conf

section: screens

section: aliases

section: links
right = windows-desktop
left = ubuntu-desktop

ubuntu-desktop and windows-desktop are your hostname for your linux and windows box respectively.

option aliases, allows you to specify ip addresses incase you do not have dns name.

option links, specifies which computer to go to when the mouse is off screen. On this occasion, if the mouse goes far right of the ubuntu-desktop screen, it only then jumps on to windows-desktop. if the mouse goes far left of the windows-desktop screen, it only then jumps on to ubuntu-desktop screen.

Now, save your config file and execute using ‘synergys -f –config /etc/synergy.conf’. option -f tells synergy to run in the forground so that you can see what is happening.

3./ On Windows run synergy and type in your host name ip adress (in this case ip address of ubuntu-desktop).

…and then test if it is connecting to your Ubuntu machine. Once it connects, then click on start.

(Putty) Pageant autoload private key

If you are remotely connecting to your linux desktop using putty and you want to avoid typing your password then pageant is your answer however pageant has a memory of a gold fish. It cannot remember your private key once you have exited from the application. So to get pageant to remember, here is a little trick.

Lets say your private keys are located at “C:\putty\cert”, create a batch file autoloader.cmd and add the following lines

— start here —

if exist "C:\putty\cert\your-linux1.ppk" (set KEYS="C:\putty\cert\your-linux1.ppk")

if exist "C:\putty\cert\your-linux2.ppk" (set KEYS=%KEYS% "C:\putty\cert\your-linux2.ppk")

if not defined KEYS exit
start /d"c:\putty" pageant.exe %KEYS%

— end here —

An Introduction to IIS: WWW Service Setup

You have setup WWW Services so what now. In this section we are going to get familiar with some of the functionality in Microsoft Management Console which allows us to configure our WWW Service. Okay enough chat lets get started…

There are two options to configure WWW Service either using Internet Information Service Manager (under Control Panel -> Administrative Tools) or Microsoft Management Console. You can access these tools through command line by either typing inetmgr for IIS Manger or mmc for Microsoft Management Console. It really does not matter which one of these tools you use, they both “have same functionality” however Microsoft prefers you to use MMC ’cause it is moving towards that direction to configure all your services. Do not worry, if you do not know how to use MMC, I have created a tutorial for that which you can find under IIS category.

Here is a screen snap of my MMC in action.
Microsoft Management Console

…Again do not worry if you are not familiar with MMC, there is a tutorial for it.

Topics we are going to be covering are

  • Web Site Tab
  • Home Directory Tab
  • Security Tab
  • Custom Errors Tab
  • HTTP Headers Tab
  • Documents and Operators Tab
  • ISAPI Tab
  • Making Virtual Directory

Web Site Tab

1./ In your Scope Pane right click on “Default Web Site” for Properties

Default website properties

Default website properties dialog

On this tab we are going to take a look at some of the items.
1.1./ Web Site Identification
1.1.1./ Description: This field displays the description of the website that appears on our MMC. On this occasion it is set to “Default Web Site”, if we change it to… lets say “Website 1″… and then press “Apply”, the website description changes on our MMC.

Website description

1.1.2./ IP Address: This list the IP addresses of your net cards. One my machine, I have one net card so it lists just the one. At this time, I have set it to my IP address, so yours may be different

Web site identification ip-address

1.1.3./ Advanced: This button give us further configuration options to change IP addresses and default ports for browser and ssl socket

Web site identification advanced options

1.1.4./ TCP Port: this specifies which port to connect to during a browser request by default it is port 80 however you can specify it to some thing other than 80 which you then have to specify on your web browser. For this instance we are going to leave it as it is.

Web site identification TCP port

1.2./ Connections
1.2.1./ Connection Timeout: suppose the user is connected however they are not doing anything, you can specify how long to keep the connection open. In this case after 900 sec of idle time, it cuts the user connection.

Connections - Connection timeout

1.2.3./ Unlimited (Option available to Windows 2003 Server) : does what it says. It allow as many users to connect to your website.
1.2.4./ Limited To (Option available to Windows 2003 Server): If your web server resources are limited and you want to restrict the number of users connecting then this option is for you.

1.3./Enable Logging
1.3.1./ Enable Logging: you can have this option switched on or off depending if you want logging information. In this option you have several items they are Microsoft IIS Log File Format: Microsoft IIS log format is fixed ASCII text-based format which cannot be customised set by Microsoft NCSA Common Log File Format: It is another fixed ASCII text-based format which cannot be customised set by National Center for Suppercomputing Applications (NCSA) W3C Extended Log File Format: This is customisable ASCII text-based log format which is the default IIS log format. For our tutorial we are going to select this option.

1.3.2./ Properties: Pressing this button gives us options of when and where to create new log file. General Properties tab: you can specify when a new log file can be created hourly, daily, weekly, monthly, unlimited file size and when file size reaches a specified size. In our tutorial we are selecting daily.

Extended logging properties Log File Directory: this field allows us to specify a different directory other than the default directory. We are going to leave this on the default directory Extended Properties tab: This gives us list of items that we can have on our log file. Some of this options are selected for you by default however you can add more by checking the checkbox.

Extended properties tab

Home Directory Tab

2./ Specifies the location of your website directory.
2.1./ A directory located in this computer: this option tells IIS that the the website files are located on this computer.

Home directory tab - connecting to resources on this computer

2.1.1./ Local path: under local path you can define where your web site folder is. your web folder does not need to be Inetpub/wwwroot directory, you can have it any where in your computer as long as you tell IIS where to look for it. On this occasion we are going to leave it on its default settings.
2.1.2./ Permission settings: you have many options here; you can decide to give the client read, write, log visits, directory browsing and indexing. we are going talk about index later so do not worry about it at this instance. Read: this option gives the client, who is visiting your website to read the files on your website. we need this checked ’cause this is what we want the clients to be able to do. Write: this option gives the client to edit your script and we do not want that. It is useful to have if you are sharing files over the intranet however not over the internet. Directory browsing: this option allows clients to browse your server directory. This option needs to be switched off Log visits: this option logs client visits, we are going to talk about its importance later, for now we are going have this option checked Index this resource: this option we are going to talk about further later, for now have it checked.

2.2./ A shared located on another computer: if the website files are located on another computer then we can use this option.

Home Directory tab: connecting to resources in another computer

2.3./ A redirection to a URL: this allows to send the client to specified URL where you can select to send the client to the exact URL, directory within the specified URL and a permanent redirection to the URL specified.

Home Directory tab: redirecting to an URL

Directory Security Tab

3./ We need setup our directory security by selecting “Directory Security” on website properties
Directory Security tab: securing directory

3.1./ click on Edit under “Anonymous access and authentication control” and have anonymous access checked. This allows anonymous access which is the default setting on the internet and this is why you are not prompted for authentication when you try to access the website. That is that for now

Custom Error Tab

4./ In this session we are going to look at custom error tab which allows us to display our own message when an error occurs.
4.1./ In website properties, select “Custom Error” tab and select HTTP 404 error.

Directory Security tab: securing directory

4.2./ To edit HTTP error message select an error and click “Edit Properties”. In the new dialog box you can chose to display an alternative message file using the “Browse” button

Directory Security tab: securing directory

… continued