Archive for the ‘Linux’ Category
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.
Solution:
- 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!
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 http://repos.zend.com/deb/ce/dists/ce/Release
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 http://repos.zend.com/deb/ce 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.
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:
- I love the way it allows one to show an inbox for each account. I do not need to filter them, or create labels.
- 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!
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:
- The HTTP request contains PHP, OR
- The HTTP response is “text/html”

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!
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]
like:
~/.gem/ruby/1.8/bin/sass -t compact --watch browseView.scss:browseView.css
I’ve posted a tutorial on how to get wireshark up and running on Ubuntu. The one problem , though, is that sometimes (actually often) you get [truncated]. How can you untruncate or turn it off or increase its size.
This isn’t the answer, but a way of how to get access to the full response:
Right Click on the Packet in Line-based text data, then choose Copy > Bytes (Printable Text Only).
This will place the full response, and you can paste it in a text editor.
The one thing that horrified me in the latest version of Ubuntu was the ‘new’ toolbar for Nautilus or the file manager.

However, after reading Deconstructing Nautilus and rebuilding it better, I have to admit, I enjoy it. Why?
Even though I tend to browser elsewhere by typing in the path, the UP button is probably the most used button by myself. Switching to the location bar provides no alternative, but keeping the button bar allows one a form of up button.
Secondly, CTRL+L is probably something I can live with.
Given the whole debate around this, the lesson I believe is that don’t ignore your existing users. If you are going to change something, inform your users!
Given the opensource community spirit, it wont be long before someone does a quick script to bring back the old toolbar. If you are looking to do that today, have a look at: https://help.ubuntu.com/community/RestoreNautilusLocationBar
Fiddler is a useful tool for tracking http requests and responses. It’s similar to the Net tag in Firebug, except that it can be used to track all requests, not only browser-based ones.
For Ubuntu users, the recommended alternative is Wireshark. Wireshark is noted as being more powerful than Fiddler, but the focus will be on the features most commonly used by web developers for tracking.
Installation
Wireshark is found in the Ubuntu repositories, so simply search for wireshark in Synaptic, or enter sudo apt-get install wireshark
Usage
Under Applications > Internet, you will notice there are two options. Wireshark and Wireshark (as root). Run the second one (as root) as this gives you more data to track.

After wireshark has started, the process is straightforward:
- Choose which network interfaces to capture traffic from
- Start capturing
- Filter captured requests
1. Choosing which network interfaces to capture traffic from. From the menu, choose: Capture > Interfaces

This will bring up a list of network devices.
2. Since my work involves debugging work off my laptop (http://localhost etc), I only start device lo (127.0.0.1). This is useful as it immediately ignores all other traffic.
3. The one thing you will notice is that fiddler will log both the TCP and HTTP requests. For the purpose of debugging AJAX, etc., we are only interested in HTTP requests, TCP requests are not required. These can be hidden by adding a filter.

In the field next to Filter:, enter http and click on Apply.

The steps will now show all traffic coming on 127.0.0.1 via HTTP. The last step is picking up the AJAX parts for debugging. Notice that for each request, there is a response. Unlike Fiddler, Wireshark does not combine the request and the response. So click on the response line, and then expand the Line-based text data row. This will show the text of the AJAX response.

Conclusion
Wireshark takes more steps than Fiddler, and Fiddler is a more focussed program than Wireshark. Wireshark also captures traffic without having to install a plugin into firefox, etc., so it’s useful for debugging applications as well. The biggest improvement to make Wireshark truly replace Fiddler is to turn off truncation of the response text. Wish I knew how!
There are two ways to uninstall Adobe AIR apps on Ubuntu.
1) Access to original .air file
If you have access to the original .air file, run it and it will give you a screen with options to either Uninstall, Run Now or Cancel. Simply click on Uninstall.

2) Use Synaptic Package Manager
A second more easier approach (particularly if you lost the .air package) is to use Synaptic. From the sidebar, simply choose: Status > Installed (local or obsolete)

Discovering this makes me less hesitant to try our different AIR apps, trying to find out which one works best.
Getting a printer installed on Ubuntu is easy, plug-and-play generally works. Getting a PDF printer working is also easy. To install it, one has to open a terminal or Synaptic (System -> Administration -> Synaptic Package Manager).
In a terminal, enter:
sudo apt-get install cups-pdf
It will ask you for your password when you press enter. Or in Synaptic, do a search for: cups-pdf.
Now one step that has to be done manually otherwise it doesn’t work. In your home directory, create a folder called PDF (all in caps).
After this, you’ll see an option for PDF in the printer’s list, and printing to PDF.
