Archive for the ‘Software and Technology’ Category
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 pear.phpunit.de/PHPUnit
4) Locate the PHP PEAR bin(ary) directory
pear config-get bin_dir
Mine shows:
tohir@tohir-MS-7759:~$ pear config-get bin_dir
/usr/local/zend/bin
If you then list the files in that directory, you’ll see:
tohir@tohir-MS-7759:~$ ls /usr/local/zend/bin
apachectl extract_meta_data.sh jqd.sh monitor-node.sh pecl phpize scd setup_sc.sh uninstall.sh zdd.sh ZManifest zs-setup
clean_semaphores.sh gui_passwd.sh lighttpdctl.sh pear php phpunit scd.sh shell_functions.rc watchdog zdpack zmd
create_cert.sh jqd MonitorNode peardev php-config rulemerge setup_jq.sh support_tool.sh zdd zendctl.sh 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
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!
Take the following HTML file with CSS. How will div2 look?
<html lang="en">
<head>
<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;
}
</style>
</head>
<body>
<div class="div1">
Div 1
<div class="div2">
Div 2
</div>
</div>
</body>
</html>
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.
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 find it quite annoying that when ever I do a search related to ExtJS, two sites (codeweblog.com and defafe.com) are on the first page of results. These two sites simply aggregate ExtJS forum posts, and then present them in a SEO friendly page.
Given this, I took to finding a way that can block search results. Officially, there’s no way you can do that from within Google settings (which would have preserved that as you moved from machine to machine), but there are extensions for Firefox. Still looking for a Chrome one!
For Firefox, there are a few extensions. One is CustomizeGoogle, but it doesnt work in the latest version of Firefox.
The one that does work is SurfClarity. It allows you to list of a sites that should be filtered out. It doesn’t do it from the server-side which would save a 1kb of traffic, but nonetheless is good enough.
for (var key in object) {
alert('value of '+key+' is '+object[key]);
}
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.