Brasero Disk Burner Gets Stuck Creating Image Checksum

When I was trying to burn a new copy of the latest version of Ubuntu, Brasero was getting stuck on the “Creating Image Checksum”. My first thought was to disable the check-sum feature (which you can do via the edit > plugins), but that did no good. Then Brasero got stuck on “preparing to write”. Finally, I tried running Brasero from the command line using “brasero -g”. This spits out lots of debug info. It turns out brasero was waiting for the cd drive to be ready. Apparently some other program was holding some sort of lock on it. However, a simple restart fixed the problem.

Posted in Linux, System Administration | Tagged , , , , , , | 1 Comment

Ubuntu 12.04 Released!

Woot!
Ubuntu Logo
Today Ubuntu 12.04 will be available for download. I am quite excited about a number of new features, most significantly HUD (Heads Up Display). This is an innovative system for interacting with menus via the keyboard with search. Not to mention a new kernel version and numerous bug fixes.

I know what I will be doing tonight…

Posted in Linux | Tagged , | Leave a comment

Internet Explorer 8 and event.preventDefault() Problem

ie-logo

I was trying to use event.preventDefault in a function called by an onclick method of an anchor tag. Although this worked fine in Firefox and chrome, naturally, I.E. would find it necessary to treat this differently. IE 8 sadly does not support event.preventDefault() (I.E. 9 however, does add support for preventDefault). However, this can easily be gotten around by using a simple test:

(event.preventDefault) ? event.preventDefault() : event.returnValue = false;

This will check if preventDefault is defined, and if not, it will use IE’s event.returnValue instead. As far as I can tell, event.returnValue=false will achieve the same goal in most cases.

Posted in Html, JavaScript | Tagged , , , , , | Leave a comment

javascript-common & mantis 404 problem on Ubuntu

Although my mantis install seemed to be working, I noticed that whenever I loaded the page, I recieved a number of 404 errors on the javascripts. ( 404 – /javascript/min/common.js). What really confused me is that the file was in the right spot. However, it turns out that the problem is caused by a package called javascript-common which creates a global alais on the system for /javascript. As long as you don’t need this global alais, the problem is easy to fix. Simply do the following:
1.

sudo gedit /etc/apache2/conf.d/javascript-common.conf

2. Comment out the following line of code:

Alias /javascript /usr/share/javascript/
#Alias /javascript /usr/share/javascript/

3. Restart apache

sudo service apache2 restart
Posted in Linux, System Administration | Tagged , , , , , , , | Leave a comment

Using and Installing Greasemonkey Scripts

greasemonkey logo
As a programmer, I often have need to tweak or examine little bits of a page’s HTML. Although firebug is a great tool and incredibly flexible, sometime it just doesn’t quite fit the bill. When such cases arise, greasemonkey is a great tool. It allows you to write small bits of javascript to run when a given page loads. One example of where this can be very useful is the following. I wanted to check the meta data on several pages on a website. Although I could easily do this with firebug, it would involve opening firebug for every site and then searching for the meta inside the html tab. It would work, but takes more time than I want to spend on ever page. However, with a quick greasemonkey script, I can have my browser display a small div in the bottom corner that prints out the meta info for any site I visit.

To create your own greasemonkey script, simply install greasemonkey, click on the icon and select New User Script. Then you will be prompted for some info about the script.
Name: what ever you want
Namespace: some unique identifier. A domain name you own is a good option
Description: What ever you want
Includes: http://www.mysite.com/*
Excludes: http://www.mysite.com/boring/*

After you enter this information, it will prompt you to select your editor and you can start writing your script. After you save, your script will be available in your browser when you refresh the page.

Finally, if you wish to copy your user script to another computer, simply save the script as a .user.js file and then drop and drag it into Firefox. Firefox will then prompt you to install the script and you can use it on the new computer.

Posted in JavaScript | Tagged , , | Leave a comment

Netbeans PHPUnit Code Completion

By default, Netbeans dosen’t do code completion for PHPUnit classes even though it includes support for PHPUnit. Thankfully, adding in the code completion support is very easy. Simply go to Tools>Options>PHP>General and then click “Add Folder” under the Global Include Path section. Then navigate to where your PHPUnit install is located. (on my system, /usr/share/php/PHPUnit). By adding this folder, the PHPUnit classes will be included on all projects. Naturally, if you just wanted this to apply to a single project, you could do something similar by clicking on the project and choosing “properties”.

Posted in PHP | Tagged , , , , | Leave a comment

PHPUnit require_once(PHP/CodeCoverage… Error on Ubuntu

PHP Logo
When trying to install PHPUnit on Ubuntu 11.10, I received the following error:

PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
PHP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/bin/phpunit on line 38

After some serching, I found the answer was to upgrade my version of pear and then reinstall phpUnit using the Pear installer.

The following commands should fix the problem:
1. Upgrade Pear:

sudo pear upgrade PEAR

2. Install PHPUnit:

sudo pear config-set auto discover 1;
sudo pear install pear.phpunit.de/PHPUnit

Thanks to the PHPUnit website for the answer.

Posted in PHP | Tagged , , , , , | Leave a comment

Apache /icons directory Index

Apache Website
Generally I like to add Options -Indexes to my apache config files. Naturally I was surprised to find that www.mydomain.com/icons/ was returning a standard apache index. I checked my config files and all the files remove the Index options, so where was this coming from? Finally, I tried greping* the entire /etc/apache2 folder instead of just the “sites-enabled” folder. It turns out that the “mods-enabled/alias.conf” had a reference to it and contained the culprit Options Indexes. Removing this reference fixed the problem.

*I reserve the right to turn unix commands into gerunds.

Posted in Linux, System Administration | Tagged , , , , | Leave a comment

Why I like Firefox Better Than Google Chrome

Download: Fast, Fun, Awesome

Being a web developer, I use all the common web browsers quite heavily. I have long been a Firefox fan for many reasons, however, Google Chrome has offered some steep competition. Chrome typically launches faster, renders pages faster, and freezes less often. For purely functionality, Chrome wins in my book. However, there is another aspect that I have a hard time getting past. Although Chrome may out perform Firefox, Google is profit driven, where as the Mozilla Foundation is not. Yes, the Mozilla Foundation needs to make money to employee its developers, but many of the decisions that are made by the Firefox development team demonstrate a strong commitment to their users. Take, for example, Firefox’s online bookmark syncing program they launched a while back. Although Firefox could have chosen to store all the users bookmarks in plain text, they chose to encrypt them instead. Not only that, but they encrypted the data before uploading it to their servers. This means that there is no way for Mozilla to access your data. They have protected user’s information so well that even they can’t view it. Although this means if you lose your sync key, your out of luck, it means that you are the only person in the world that can view your information; Mozilla cannot access it. That’s a far cry from Google’s privacy policies. Google already knows far too much about me; I would much rather browse the web with a company that I know will protect my privacy, even against themselves.

Additionally, while Google Chrome is built upon open source software like webkit, Google Chrome itself is not open source. Its free, but not open source. Firefox, on the other hand, is a long time supporter of open source and continues to release all of its source code to the public.

Although Chrome may be the better technical performer, Firefox’s philosophy and design choices still win the day in my book.

Posted in Web Browsers | Tagged , , , , , , | 1 Comment

Changing Symfony Routing Requirements

One of my favorite features of Symfony is the routing sub-system.  It allows for very flexible routing rules.  On a project I have been working on, I have been tweaking the routing requirements in Symfony.  One really nice feature is the ability to define your own routing classes.


homepage:
url:   /
class: sfRequestHostRoute
param: { module: static, action: show, content: index }
requirements:
  sf_method: [get]
  sf_host: www.example.com

The above route will only match if the HTTP method is GET and the host is www.example.com.

To see how sfRequestHostRoute works, see this post.

However, I wanted to take it a step farther. I wanted to change the default class from sfRoute to sfRequestRoute (or some similar custom class). Sadly, factories.yml has no such option. Nevertheless, prodigitalson from stackoverflow.com pointed out a good second class solution. By using YML references, you can achieve something quite similar:

homepage:
 url: /
 class: &defRouteClass 'sfRequestHostRoute'
 param: { module: static, action: show, content: index }
 requirements:
   sf_method: [get]
   sf_host: www.example.com
routeTwo:
  url: /someurl
  class: *defRouteClass
  param: {module: mymod, action: myaction}
  requirements:
   sf_method: [post]
   sf_host: sub.example.com

Posted in 1.4, PHP, Symfony | Tagged , , , , , , | Leave a comment