Introduction About Site Map

XML
RSS 2 Feed RSS 2 Feed
Navigation

Main Page | Blog Index

Archive for the ‘Programming’ Category

Fixing the Bugs for Browser Developers

Internet Explorer

Modern browsers are among the more complex pieces of software in existence. Because browsers are expected to treat similar data (the World Wide Web) and behave consistently, there is plenty of room for bugs to crop up. Big trouble lies ahead if a browser is re-released infrequently or no updates are made available, apart from the critical. This is probably the main catalyst to the “Don’t click on the blue E” campaign.

Web developers spend extra time trying to compensate for Internet Explorer bugs. In css-discuss, for example, almost half of all questions (if not more) concern browser compatibility, fixes and hacks. Internet Explorer is often the culprit. Rather than fixing/hacking around IE bugs, perhaps we should all upgrade to a browser that is actively maintained and released to the public. There is no doubt as to how fed up development communities have become with IE, which for most users ships by default.

Server-side Software Turns Evil

It was only a few months ago that my colleague’s forum got hijacked and vandalised, never to come back on-line again. Over the weekend, my host came under a denial of service (DoS) attack because of outdated, non-secure installations of phpBB (not worthy linking to), which proved to be far from reliable. Several sites including mine were suspended for hours in order to avoid another such attack, which brought the server down and crippled it for 40 minutes. I was possibly among the culprits as my phpBB installation was not patched up properly.

hacker buttonWordPress 1.5 likewise. Security flaws are continuously discovered and about 4 fixes have been released in the past few months. If you install software, make sure it is secure, patched up and avoid installing it whenever unnecessary. More installations lead to more maintenance and potential loopholes.
 

Syndicating Static Pages

Computer shell
Getting just the valuable data from pages

Feeds have definitely revolutionised the way we use the Internet. We can efficiently seek and exploit content without having to undertake laborious navigations in sites. The content is delivered to the user so there is no need to actively obtain it or ever spend time re-reading segments of text.

I have just finished brushing up the script I developed for syndicating static pages that do not offer feeds. Windows users can use it under Cygwin; Mac and Linux user can use it at much great ease. All details and code are contained in the more comprehensive page.

POVCOMP 2004

POV-Ray, an Open Source 3-D rendering package that could compete with the commercial Maya, was mentioned a while back. Some months ago a competition was run which involved POV-Ray artists and a submissions gallery has been put up.

These images serve as excellent wallpapers. Several images are of very high resolution, which works well on dual-head displays.

Kitchen
Might be hard notice that the kitchen is computer-generated
Work by Jaime Vives Piqueres

Music Log Files

Ever wondered how much you listened to a particular song?

XMMS possesses a great extent of flexibility. It provides facilities which, when customised appropriately, can dump complete song descriptions. XMMS can then progressively, accumulatively add song data to log files. Timestamps imply the duration of listening, which lead to possible future extensions, e.g.:

  • Automatically parse (scan, hash, then analyse) the log file/s
  • Compute an average listening time — that is before skipping to another track — for each individual song
  • Erase music that is frequently skipped or just output a ‘prospective deletion list’ to another file

Input/output operations are made quite simple. These can be invoked as command-line strings whenever a new track begins. It is a built-in XMMS plug-in, which can be found under Preferences » Song Change » Configure (see illustration below)

XMMS menu

Add the following line to the “Song change” Command field:

(date; echo %s) >> ~/My_playlists/playlist.log

XMMS KDEI am providing an example log file, assembled naturally (not artificially. Honest!) over 20 minutes or so. I still need to get rid of the doubly appearances, apparently caused by xmms-kde in my dock (screenshot on the right). As well as giving a minimal user interface, xmms-kde enables control of the player with CTRL+SHIFT+keypad even if the player is neither visible nor in focus.

A music log file results in even more redundant data to store. According to a rough calculations, I will see it growing by 1 megabyte every month or so. Compression, however, should make it only 10-20% of its original size.

UPDATE 26/06/2005: The following command, which can be set to become a nightly cron job, will slice the large log file so that it is composed of daily ‘chunks’:

mv ~/[Path]/playlist.log ~/[Path]/playlist-`date +%Y-%m-%d`.log

This can be extended to form an annual and monthly hierarchy of directories.

See the later extension: producing history spreadsheets

Open Source Problem

Sharing

One issue is particularly detrimental to OSS: the issue is branching. Implementation takes different directions (often due to third-parties involved) and compatibility begins to break. Linux and its distros are one valid example. Here is an example taken from skinning (AKA themes) to support the argument.

Different unique ‘skins’ for an application get distributed or different stylesheets written for a Web-based application. This gives a rich variety to choose from, but here is the snag:

  • The user gets accustomed to the new interface
  • A new version of the application comes out
  • The user might have to re-install a new ‘skin’
  • The user relies on the ‘skinners’ to carry on maintaining the project

Some may have heard of GIMPshop, which wraps the GIMP in a Photoshop-like environment. It can serve as a practical example for the pitfall.

The take home: it is safer not to be ‘distracted’ by minor components or release variants of main-stream systems.

One-Click Backups

Servers

There are fast and automated ways of backing up *NIX servers. Backups should include databases as well as home directories, of which there can be many.

Compressed Archives

If backups can be downloaded via links (e.g. under cPanel), a browser can have its default action for .gz files set to “save in home directory”. A little script can then timestamp all the archives and put them ‘in storage’:

    # Once back-ups have been put in home directory, move all
    # to a time-stamped directory in the back-up area
cd /home/user/
mkdir `date +%Y-%m-%d`
mv backup* /home/user/backup/Home_Directories
    # move home directories
mv *.gz `date +%Y-%m-%d`
    # move databases to the new directory
cp -rf `date +%Y-%m-%d` /home/user/backup/Databases/Recent
    # merge if required
rm -r `date +%Y-%m-%d`
    # clean up, NOTE: mv cannot merge

FTP

If your webspace host offers FTP access alone, there is no simple solution. Command-line ftp might be of use though.

SCP

Copy files from the server to your local machine. This step must be invoked from the server’s side. The form of the command resembles the following:

scp -r ~/public_html your_user_name@machine.domain.suffix:/home/user/backup

mySQL Dumps

Set up cron jobs on the server, e.g.:

0 23 * * 1,4 mysqldump --user [DB_username] --password=[DB_password] [DB_name]> ~/tmp/mydatabase1.dump
0 23 * * 2,5 mysqldump --user [DB_username] --password=[DB_password] [DB_name]> ~/tmp/mydatabase2.dump
0 23 * * 0,3,6 mysqldump --user [DB_username] --password=[DB_password] [DB_name]> ~/tmp/mydatabase3.dump

The code above keeps a stack of 3 databases, which can be used to rollback data shall something catastrophic happen. Databases can then be snatched along with home directories. The above code can be extended so that dumps are compressed and file destinations are remote.

Retrieval statistics: 21 queries taking a total of 0.139 seconds • Please report low bandwidth using the feedback form
Original styles created by Ian Main (all acknowledgements) • PHP scripts and styles later modified by Roy Schestowitz • Help yourself to a GPL'd copy
|— Proudly powered by W o r d P r e s s — based on a heavily-hacked version 1.2.1 (Mingus) installation —|