Welcome to my site, where I share my thoughts on Open Source software, Computer Science, and various bits from my life and the web.
Feel free to navigate through blog posts, or explore sidebar links. The site's RSS feed is also available.
Enjoy your stay!
This article covers several techniques for debugging Python programs. The applicability of these techniques ranges from simple scripts to complex applications. The topics that are covered include launching an interactive console from within your program, using the Python debugger, and implementing robust logging. Various tips are included along the way to help you debug and fix problems quickly and efficiently.
Read more
Submitted by Ayman on Mon, 2009/08/31 - 8:54am
Bash is the default scripting language in most Linux systems. Its usage ranges from an interactive command interpreter to a scripting language for writing complex programs. Debugging facilities are a standard feature of compilers and interpreters, and bash is no different in this regard. In this article, I will explain various techniques and tips for debugging Bash scripts.
Read more
Submitted by Ayman on Mon, 2009/08/24 - 10:48pm
Keeping a version history of files under /etc is essential for maintaining a healthy system. The benefits of tracking changes to /etc include:
- Documentation: The log messages that are attached to configuration changes serve as documentation. These log messages record who made the change, when and why. Understanding the contents of a config file becomes much easier if you have a full history of the changes that were made to this file.
- Troubleshooting: Misconfiguration can result in a variety of problems. When a service starts to misbehave, one of the things you can do to troubleshoot the issue is to check the version history of its config file. There, you can see if any changes were made around the time frame in which the problem happened. If you spot a change that may be causing the issue, you can easily revert it to fix the problem.
You can set up your own repository to track changes to /etc, or you can use a tool called etckeeper to handle the setup for you. This tool supports multiple version control systems, including Git, Mercurial and Bazaar. It integrates with the package management systems of a number of Linux distros, including APT (used by Debian, Ubuntu), YUM (RedHat, CentOS, Fedora), Pacman (Arch Linux). Using etckeeper instead of rolling your own has some advantages:
- etckeeper integration with package managers means than you don't need to manually commit changes in
/etc after installing packages.
- etckeeper comes pre-configured with a list of files that live in
/etc but usually do not benefit from version control (like some cache files).
Read on to learn how to install, configure and use etckeeper.
Read more
Submitted by Ayman on Sun, 2009/08/16 - 6:01pm
My author copies of "Django 1.0 Website Development" have arrived. This is the second edition of my Django book. Django is a framework for building web applications in Python. This book explains how to assemble Django's features and take advantage of its power to design, develop, and deploy a fully-featured web site.

The new edition has been updated to Django 1.0. The key topics that the reader will learn from the book are:
- Register users through a user authentication system and manage them efficiently.
- Restrict user access to certain pages and protect against malicious input.
- Create tags to allow site visitors to classify, view, and share content easily.
- Create own administration interface for proper monitoring of the web site.
- Enhance user interface with AJAX.
- Enable voting and commenting on content, and display popular content to site visitors.
- Build user networks; add friend management and invitation features for social networking.
- Create unit tests to automate the testing of code.
The full table of contents is available.
The book is available in paper and PDF formats at Packt Publishing. It is also available from all major book sellers like Amazon.
Writing the book and revising it have been an enjoyable experience for me. The feeling of accomplishment when my copies arrived is satisfying. I sincerely hope that readers find the book interesting and useful. If you have questions or comments, don't hesitate to email me!
More photos of the book are available at my Picasa web albums.
Read more
Submitted by Ayman on Mon, 2009/03/23 - 12:14am
The main piece of news for day 2 in the Firefox Summit 2008 is that everyone is now trapped in the small town of Whistler after a rock slide cut off the highway that connects Whistler to Vancouver. Fortunately, nobody was injured because of this. However, clearing the massive boulders that are blocking the highway will take 5 days according to official sources. Since the summit ends this Thursday, most attendants need to go to the Vancouver Airport on Friday to catch flights to their home countries. The cause of this rock slide is unclear at the moment, but there are people in the summit who are speculating whether a company whose name starts with an 'M' is behind all of this. A bug was filed in Bugzilla to track the issue, and some of the currently-proposed solutions involve riding bears, taking boats, or taking helicopters. In reality however, we will most likely end up going through a different route that takes around 8 hours in bus.
Read more
Submitted by Ayman on Thu, 2008/07/31 - 3:13pm
The Firefox Summit 2008 started today in the city of Whistler, BC, Canada. Around 400 contributors to the Mozilla project gathered to meet, share thoughts and discuss the 3.0 release of Firefox and plan for the next releases. I'm attending the summit as the Arabic localizer. I will post a daily highlight of the summit on my blog, so let's start with day one.

Read more
Submitted by Ayman on Wed, 2008/07/30 - 7:54am
The Apache/PHP/MySQL stack is immensely popular for web application development. Its components are powerful, versatile and Free. Unfortunately however, PHP comes with a default configuration that is not suitable for production mode, and may cause developers to use insecure techniques during the development phase. Inside is a check list of settings that are intended to harden the default PHP installation.
Read more
Submitted by Ayman on Thu, 2006/10/05 - 10:18pm
A couple of weeks ago I posted an article on creating a drag/drop portal interface with Drupal and Script.aculo.us. Many comments were interested in a jQuery port for Drupal 5.0, and Mark recommended building such a module on top of the brilliant Panels module. I finally had time to continue working on this, so I created an initial drag/drop module built on top of jQuery and Panels. It's far from complete (doesn't save user settings for example), but it's step in the right direction. I also posted an issue to Panels' tracker, pinging merlinofchaos (author of panels), so let's take the discussion there.
I really am looking forward to polishing this module, as I believe it'll be a timely addition to Drupal's arsenal of modules, now that jQuery is part of Core and Drupal 5.0 is around the corner.
You may download the module here. It's only meant to demonstrate functionality. It's for Drupal 4.7 (because Panels hasn't been ported to 5.0 yet), and requires Panels module. To use it, try to add a new panel and you will find a new type called "three column with drag-and-drop". I tested it with bluemarine; it may not work with other themes for reasons outlined in the issue I posted.
Read more
Submitted by Ayman on Mon, 2006/10/02 - 10:32pm
JavaScript is a fully-featured Object-Oriented programming language. On the surface, it shares syntactical similarities with Java and C, but the mentality is quite different. At its core, JavaScript is more similar to functional languages. Inside is a list of JavaScript tips, some offer techniques to simulate features found in C-like languages (such as assertions or static variables). Others are meant to improve performance and explore some of the more obscure parts of the web scripting language.
Read more
Submitted by Ayman on Wed, 2006/09/27 - 5:26pm
screen is one of my favorite GNU utilities; it provides a quick and easy way to have several open terminals and do multiple things at once. Another cool feature about screen is that it stays running even if the user logs out or disconnects. This enables the user to detach from their session and resume it later. This feature is a life saver when working on a remote machine through SSH. If I was disconnected for some reason, I can easily reconnect and resume my session.
screen is very easy to use. Below is a list of its main commands. Read on, experiment with them, and you will become proficient in screen in minutes. Believe me you will appreciate it.
Read more
Submitted by Ayman on Sun, 2006/09/17 - 8:03pm