Archive for the ‘Software and Technology’ Category

PHP Composer on a Hostgator Shared Account

Posted on the October 14th, 2013 under Internet,Linux by

If you were to try and install composer on a Hostgator Shared Account, you’ll likely get an error like below:

Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in – on line 399
#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The phar extension is missing.
Install it or recompile php without –disable-phar

Your PHP (5.2.17) is too old, you must upgrade to PHP 5.3.2 or higher.

The problem is that PHP 5.3 is not the default, but it is available. To install, run instead:

curl -sS | /opt/php53/bin/php

Which results in:

#!/usr/bin/env php
All settings correct for using Composer

Composer successfully installed to: /home/tohir/www/
Use it: php composer.phar

Lastly, when you are running composer install, the command needs to be:

/opt/php53/bin/php composer.phar install

Sample Output:

Installing dependencies (including require-dev) from lock file
– Installing respect/validation (dev-develop 3956203)
Cloning 39562034bd5cb692289f603bac8766f4d167426e

– Installing slim/slim (2.3.1)
Downloading: 100%

Generating autoload files



Starting a VNC from the command line

Posted on the July 18th, 2013 under Internet,Linux by

It’s great to remote desktop/VNC into another server and doing work via a visual desktop interface rather than the command line, but this often requires that the VNC be started from the desktop interface. Here’s how to start the remote desktop from the command line. This is with Ubuntu 10.04.

Instructions (Bold+Italic is for command):

1) SSH Into Machine

2) Become Root: sudo -s

3) export DISPLAY=:0.0

4) xhost +

5) Exit from root: exit

6) export DISPLAY=:0.0

7) nohup /usr/lib/vino/vino-server > /dev/null &


I know Ubuntu 10.04 is old, but that’s the context where the need for this arose in. Also, please note there is security implications when using remote desktop. Please Google that

Download a section of a website using wget

Posted on the July 18th, 2013 under Linux by

wget -r –mirror -p –convert-links -e robots=off –no-parent –random-wait

Where’s the PHPUnit command-line test runner?

Posted on the April 29th, 2013 under Linux,Productivity,Software and Technology by

After you have installed the PHPUnit via PEAR, how do you get access to the phpunit executable. Here’s the steps from the beginning on Ubuntu.

1) Install PHP Pear if you don’t have it installed

sudo apt-get install php-pear

2) Enable auto discovery

sudo pear config-set auto_discover 1

3) Install PHPUnit via PEAR

sudo pear install

4) Locate the PHP PEAR bin(ary) directory

 pear config-get bin_dir

Mine shows:

tohir@tohir-MS-7759:~$ pear config-get bin_dir

If you then list the files in that directory, you’ll see:

tohir@tohir-MS-7759:~$ ls /usr/local/zend/bin
apachectl pecl phpize scd ZManifest zs-setup pear php phpunit shell_functions.rc watchdog zdpack zmd jqd MonitorNode peardev php-config rulemerge zdd zs-manage

You can then create a symlink to make it easier to access:

sudo ln -s /usr/local/zend/bin/phpunit /usr/bin/phpunit

How to bring your mouse back to life in Ubuntu

Posted on the February 2nd, 2011 under Linux,Software and Technology by

Occasionally, I encounter the issue where my mouse moves around the screen, but I can’t left click. Right click does work. Instead of rebooting tonight, thought I’d try to find a solution tabbing away on the keyboard whilst I still had a browser open.


  • Press Ctrl+F1 to go to a terminal screen
  • Login with your username and password
  • sudo mobprobe -r psmouse
  • sudo modprobe psmouse
  • Ctrl+F7

This removes the mouse ‘driver’ from the kernel, and re-adds it. Wallaa!

Installing Zend Server CE on Ubuntu Maverick (10.10)

Posted on the January 24th, 2011 under Internet,Linux by

Spent the day trying to install Zend Server on Ubuntu (10.10), but ran into so much blockers, thought it would be worth a blog!

After following all the steps, I got hit with:

W: Failed to fetch
Unable to find expected entry  non-free/source/Sources in Meta-index file (malformed Release file?)

Kept trying sudo-apt-get update whilst cursing Zend, and still the same.

Solution: Disable the sources repository in /etc/apt/sources.list.

#deb-src ce non-free

Next, trying to install, and keep getting dependencies issues. There are two (old files) that need to be downloaded, and then everything works fine:

They were in older distributions, but no longer are!

Once those two files are manually installed (sudo dpkg -i), the rest is plain sailing.

Thunderbird + Correct Indentity Plugin

Posted on the January 5th, 2011 under Linux,Productivity,Software and Technology,Usability by

On both Ubuntu (and Windows if I ever had to use it), I prefer Thunderbird as my email client over Evolution or MS Outlook purely due to two reasons:

  1. I love the way it allows one to show an inbox for each account. I do not need to filter them, or create labels.
  2. The ability to set a limit on incoming mail. Once activated, it only downloads the first 50kb of each email giving an idea of what the email contains, and it saves the frustration of downloading emails with large attachments, particularly from people I don’t know.

However, the one mistake I often make is clicking “Write”, type in the email, and clicking send, without checking that I’m sending it from the right email address. Fortunately, another great thing with Firefox and Thunderbird is extensions, and there is one that fixes that called Correct Identity.

It allow one to set an alternative default email address for writing an email. Eg. The account is support@…, but whenever you send out email from that account, it should be from tohir@…, that’s the issue it solves!

Why CSS gets confusing and why you should use SASS

Posted on the September 30th, 2010 under HTML, CSS,Internet by

Take the following HTML file with CSS. How will div2 look?

<html lang="en">

<title>SASS Test</title>

<style type="text/css">
    div.div1 div {
        border: 4px solid yellow;
        background: yellow;
    div.div1 {
        background: red;
        border: 4px solid blue;
    div.div1 div.div2 {
        background: green;
    div.div2 {
        border: 10px solid orange;
        padding: 10px;
    <div class="div1">
        Div 1
        <div class="div2">
           Div 2

Based on the last definitions, you will expect div2 to have:

  • a green background color
  • a 10 pixel solid orange border
  • a padding of 10 pixels between the border and the text

Actually it will appear like this:

It does NOT have a 10 pixel solid orange border, but instead a four pixel solid yellow border. Even though CSS is cascading, it cascades by CSS rules, not by definitions. Even though an alternate definition is last, if it doesn’t cascade over an existing rule, it will not be applied.

Wireshark Filters – Ajax Example

Posted on the September 30th, 2010 under Internet,Linux,Software and Technology by

I’ve blogged about Wireshark before, and how to use it for Ajax. Next is a quick tip on how to use Wireshark’s filters feature to only watch for AJAX requests. In the filter tab, enter:

http.request.uri contains "php" ||  http.content_type == "text/html"

This effectively reads, only log items where:

  1. The HTTP request contains PHP, OR
  2. The HTTP response is “text/html”

Wireshark Filters

Useful, dont have to wade through whats an Ajax response, bypass images, etc. One thing that would be nice would be if the area that shows the filter expression was longer!

Installing SASS 3.0 on Ubuntu 10.4

Posted on the July 9th, 2010 under HTML, CSS,Linux,Software and Technology by

Currently, the HAML/Sass version on Ubuntu is 2.2.17. Version 3, also known as Classy Cassidy, includes new features. So how can you install it on Ubuntu.

Firstly, you need Ruby:

sudo apt-get install ruby

Thereafter (without sudo):

gem install haml-edge

This will install Haml and Sass into your directory, but at least you will have access to the latest version. Message that appears:

WARNING:  Installing to ~/.gem since /var/lib/gems/1.8 and
 /var/lib/gems/1.8/bin aren't both writable.
WARNING:  You don't have /home/tohir/.gem/ruby/1.8/bin in your PATH,
 gem executables will not run.
Successfully installed haml-edge-3.1.49
1 gem installed

You can test that it is the latest version by:

~/.gem/ruby/1.8/bin/sass -version

Which should return:

Haml/Sass 3.1.49 (Bleeding Edge)

Lastly, there is a nice command to watch files and auto generate an updated version:

~/.gem/ruby/1.8/bin/sass -t compact --watch [inputfile]:[outputfile]


~/.gem/ruby/1.8/bin/sass -t compact --watch browseView.scss:browseView.css