Redhatter (VK4MSL)

Small request regarding IM contact…

Hi,

A number of people prefer IM contacts over more traditional means such as IRC or email, which is fine. I’m flexible, and happy to accommodate such modes of contact. But if you send me a message — please ensure your client is “Online” and not set to “Invisible” or similar settings when you message me. I ignore messages received from “offline” clients.

The best protocol to use for IM when contacting me is Jabber/XMPP — everything else I use via a gateway on XMPP.  Likewise, the best protocol for voice chat is SIP (I use Ekiga at my end) as that works on both the MIPS boxes I use, and the x86 boxes — but I can accommodate Skype if desired.  MSN works, but due to the fact I access it via XMPP, I’m not able to use any of the advanced features (file transfer or voice chat) offered by MSN.

For those who are wondering how to contact me via instant messengers and/or VoIP, contact details are listed on my devspace homepage.

ObsoleteToo: Gentoo for obsolete computers

I had a bit of a crazy idea today. Some would think I had a little too much spare time on my hands … but maybe there’s a point to this insanity.

Many of us have old computers laying about. Now, “old” is a subjective term. As goes the Weird Al song, “All About the Pentiums”…

You say you’ve had your PC for over a week?
Throw it away man — it’s an antique!

(Well, that’s how I remeber it… I might be paraphrasing a little.)

Not everybody needs a fancy box to do simple tasks. Pentium-class systems, and high-end i486 systems make quite decent X-terminals. As slow as early 486s and 386s are, they still are useful in situations where you just need a router or DHCP server (for example) to service a small home network.

I’m planning to put my 386 into active service. My Qube2 sits in my laundry, which is great. It’s cool, it’s a headless box with no need for direct interaction.

But interacting with the serial console is a pain, I have to get my laptop out, and plug it in. Thus I probably don’t do as much kernel testing as I should.

The 386 should be fast enough for this task — all it needs to run, is sshd and minicom. For a single user. Gentoo using uClibc sounds like an ideal platform. Why?

  • Minimum bloat: I merge what I need, and nothing more
  • uClibc is targetted at low-memory, low-processing-power computers
  • Gentoo gives me fine-grained control regarding what features I enable and disable.

Now the box is rather slow booting Gentoo. If I boot root-over-NFS, it takes about 30-35 minutes. I can reduce this to about 20 minutes when loading from a local HDD (narrow SCSI, as it happens), but I haven’t got far installing it due to problems with flakey disks. The kernel reports a BogoMIPS reading of about 3.9~4.2 when running at full-speed (33MHz), and about 1.6 with the “turbo” feature disabled.

Once I get it going however, it should simply be a matter of re-merging dropbear sshd (the default one in the Gentoo/uClibc stages dies with a SIGILL), merging minicom and a bootloader, and voila.

Any updates can be done via a chroot on a faster box, then the binaries shipped to the 386. Bootup time isn’t an issue, since the box can just sit there running — 386s don’t chew that much power.

This is quite low down in my priorities, at the moment I’m concentrating more on getting Gentoo/MIPS 2007.1 out the door, hopefully with some newer netboot images for Cobalt, and maybe some first ever boot images for Loongson.

But after that, I may look at what the Gentoo/Embedded people have (particularly GNAP) and see if that can be adapted to suit the needs of older computers.

I see no reason why this can’t be done — I’d much rather see the code in Gentoo streamlined to work better on older computers, than to see the specs increased, as this streamlining benefits all — not just those with few CPU cycles to spare. 😉

Microsoft Works … no it bloody doesn’t!

The following is a bit of a rant, involving my beef with one of Microsoft’s lesser known products, the “Works” productivity suite. More specifically, its interactions with a certain HP DeskJet 2360 (IIRC) printer.

A friend of ours does treasury work for a small business. The business owns a Dell laptop (reasonable spec machine) running Windows XP, and they’ve recently bought a HP Deskjet 2360 printer to go with it. The accounts are done in Microsoft Works 8 Databases. The business sells home-made goods such as knitted rugs, various forms of artwork and other hand-made products.

The accounts database basically stores each sale made — linking that back to the individual who produced the article being sold. The database produces invoices to be sent to each of these people, listing the items sold, the total revenue generated from their goods, and the amount they get (less the commission). Pretty simple stuff.

For reasons unknown, this decided to break a few weeks ago. The machine stays disconnected from the internet almost 100% of the time. Here’s the symptoms:

  • When we try to print via the HP printer on the laptop in Microsoft Works, the application crashes, sending a crash report to Microsoft.

  • The HP printer, works flawlessly in every other application.

  • If we install Microsoft Works on a second PC with its own printer — we can print successfully.

  • If we then connect the HP printer up to the second PC, install the drivers, then try to print, Microsoft Works crashes in the same manner as on the laptop.

Microsoft Works, when using the HP printer, crashes regardless of the content of the document. Create a new spreadsheet, type some random gibberish in two adjacent cells, select File->Print, and bang, down she goes. This is ludicrous, as the printer works with everything else, and Works works with any other printer. But this combination of printer and application causes problems.

We’ve tried installing updated drivers from HP’s site, with no success. We’re downloading updates for Microsoft Works, in the hope that may fix the problems, but I’m not holding my breath. This product would have to be one of the few products whose name is an oxymoron.

Microsoft Windows is such a soup of proprietary code mingling about, I’m amased anything works. Why they don’t dump their antiquated print system and use CUPS like everyone else (even Apple uses it) is a mystery. (I’m sure it’s doable on Win32.) There’s no excuse for these peculiar interactions — I’ve never had these ridiculous problems under CUPS.

In the meantime, I have OpenOffice 2.3 downloading for Windows and Linux. I had a play with OpenOffice Base (version 2.0 and 2.1) and it seems that should be able to do the same thing as good, if not, better than their present suite. It’s worth noting that the database is used much like a spreadsheet presently, thus doing a proper relational DB design will be beneficial.

I can’t quite figure out how to get the reports generated by OpenOffice.org to work the way I want… I can customise them to a certain degree, but once I try to do anything fancy, the whole lot breaks. Maybe the Sun Report Builder is the answer here — I’ve got it downloaded, but I need OpenOffice 2.3 to use it (and that’ll be another hour or so).

I’ve never done this sort of thing with OpenOffice in the past — I’m very new to this. Ordinarily, I’d just make a Perl script to connect to a DB of some form (or parse CSV data), take a LaTeX template, substitute the necessary data in, compile each LaTeX document as PostScript, then use GhostScript to whack them all together in a single document. I can’t however, do this under Win32, and especially can’t expect computer novices to do that. Hence why I’m looking at doing this in OpenOffice. In short though, this is going to be an interesting challenge.

Update:

I’m pleased to report, that OpenOffice 2.3.0 (I realise 2.3.1 is just out) is doing the job nicely. The comment that the OpenOffice Base application I had set up, was easier to use, and I feel, will be more scalable than the system they previously used. OpenOffice Base+Sun Report Builder, is definitely a worthy consideration when you wish to set up a database-driven report generator that’s to be used by computer novices.

Gentoo/MIPS: Little Endian MIPS 4 stages ready for testing

Hi All…

After much waiting, the MIPS4 stages for little-endian MIPS systems are finally built. These are targeted at Cobalt users, but may also work for users of other MIPS4 and MIPS64 systems. The 2007.1 snapshot has seen a few changes in the time it’s taken me to compile this, so I may upload some updated stages later, but in the meantime, I’d appreciate any feedback on how well these stages work.

I plan to use them to rebuild my Qube2, whose root fs has accumulated many cobwebs over the years.

You’ll find the stages on my devspace for now.

Making the internet messaging accessible — Facimile over IP

Atomic MPC forum user, freakonaleash, asked an interesting question regarding sending faxes over IP. This got me thinking.

We’ve got solutions for an internal LAN such as Hylafax for an intranet-based fax-over-IP solution. But nothing exists that could be considered similar to Voice-over-IP. I can’t use the internet for instance, to send a fax overseas — and sometimes just like the telephone, one needs to fax a document.

There’s also the situation of inexperienced people. People like my grandparents, wouldn’t have a clue how to use a computer to send an email, or maintain a PC. Linux distributions have gotten to the point where I’d be quite comfortable setting up a minimalist Gentoo or Ubuntu installation on an old PIII box — to allow basic email and web browsing, but I still need to be around to keep it updated and maintained. Even if I were to go throw Windows XP on the same machine — I’d still have to maintain it.

Email offers some very useful options for such people — e.g. the ability to send letters and other correspondence and have it arrive at the other end within a day or so. (and that’s if the mail servers are having a bad day!) These days, one can buy a hardware device that provides VoIP capability, one can purchase devices that offer limited web-browsing capability without the need of a full-blown desktop computer, why not an internet appliance for sending and receiving email?

Well, I don’t see the need for a whole new protocol. SMTP and POP3/IMAP will do just fine for the actual FoIP capability. The issue is the interface to these protocols. I’m thinking an internet facimile would offer the following:

  • Ethernet interface for connection to the internet via a router.
  • Internal ADSL and/or PSTN modem for stand-alone internet access without other hardware, and standard fax capability
  • LCD Display and keyboard for reading/composing mail and user interface (touchscreen)
  • Onboard scanner and printer
  • Handset/headset jack for voice communications (either VoIP or standard land-line)

The idea, is that someone who doesn’t have a proper understanding of computers, could send a message over the internet using this device. They would simply hit the “Compose” button, fill in the recipient’s fax number (standard fax) or email address (FoIP), a subject for the message and cover letter, then scan in whatever attached pages they wish to add (these would appear as PDF, JPEG or PNG attachments). Some models may include USB ports and card readers, to allow attaching arbitrary files from USB drives and flash cards. Once they’re happy, they get the option of either sending it right then and there, or storing it to send in a batch run.

For privacy, perhaps something like PGP could be incorporated, thus allowing messages to be encrypted. There’s scope for this device to act as an internet router, networked printer/scanner, and VoIP ATA box too, which could be add-on features.

In essence though, the box could just sit in the corner… and say, overnight, connect to the internet, download any new messages, send any unsent messages out.

I might look into something like this, as it seems in the open source world, we have pretty much all the necessary pieces — just a matter of piling the right software on a standard PC and we’ll have a proof-of-concept prototype.

National/Liberal Opposition Front Bench

Tony Abbott has become opposition leader and is now announcing his front bench. We cross now to Parliament House in Canberra…

Abbott: Welcome everyone. As newly appointed opposition leader, I have decided on the following people for my front bench. I have chosen, Who for Shadow Treasurer, What for Shadow Industrial Relations Minister, and No Idea for Shadow Environment Minister.
Rudd: It’s nice to see we have new leadership in the opposition, but working families would like to know who the shadow ministry is.
Abbott: Well, as I’ve just told you, we have Who for Shadow Treasurer, What for Shadow Industrial Relations Minister, and No Idea for Shadow Environment Minister.
Rudd:I’m sure you’re a very clever politician, but the bottom line is this … Who is Shadow Treasurer?
Abbott: That’s correct
Rudd: Pardon?
Abbott: Who is the Shadow Treasurer.
Rudd: On the question of Shadow Treasurer, working families would dearly like to know who is in this role.
Abbott: Yes, Who IS the Shadow Treasurer.
Rudd: Okay, if the opposition leader wishes to get hairy-chested about telling us the Shadow Treasurer, perhaps he’d like to answer another question. Who is the Industrial Relations minister?
Abbott: No, Who is the Shadow Treasurer.
Rudd: Not Interested in the Shadow Treasurer…
Abbott: No no no, Not Interested is our Shadow Foreign Affairs minister.
Rudd: … Right, so who takes the position of Shadow Defense minister then?
Abbott: Why do you insist on taking Who away from Shadow Treasurer?
Rudd: I’m not trying to take anyone out of any role — in due season, we’d all like to know who the opposition front bench is. Okay, let’s go role-by-role here. Please tell us who you have selected for these roles. Shadow Treasurer…
Abbott: Who
Rudd: Sorry?
Abbott: Who is our Shadow Treasurer.
Rudd: That’s what I’m asking you. Never mind we’ll come back to that… Shadow Industrial Relations minister?
Abbott: What
Rudd: Who is the Shadow Industrial Relations minister?
Abbott: What
Rudd: Is this microphone working or has the Opposition Leader gone deaf?
Abbott: I can hear you fine. I’m telling you our Shadow Industrial Relations minister is What.
Rudd: (sighs) Okay, Shadow Environment minister?
Abbott: No Idea
Rudd: You don’t know?
Abbott: Yes, I do know…
Rudd: You’ve lost touch with your own party?
Abbott: …No, No Idea is our Shadow Environment minister.
Rudd: Fine, how about Shadow Communications minister?
Abbott: Tomorrow
Rudd: What’s wrong with today?
Abbott: No, we put Today on the backbench
Rudd: I’m sorry, I don’t follow.
Abbott: Today used to have the role of Health minister but after the reshuffle following the election, we have placed him on the back bench.
Rudd: Well it seems we’ve come to a fork in the road. My challenge to the Opposition Leader is this… It’s time to end the blame game, and decide who you wish to select for your front bench.

(Thanks go to Abbott & Costello for writing the Who’s On First skit that this is based on, and to the Liberals for collating a useful table of Rudd quotes.)

Gentoo/MIPS: Little Endian MIPS 1 stages ready for testing

Hi All…

Well, it seems I’m done building the MIPS1 stages for little-endian MIPS well ahead of time. I used one of the Lemote Fulong systems to build these, and had stage 1, 2 and 3 done in about a day and a half — which is a record for me — the Qube2 normally takes about a week, and it’s still chugging away at stage 1.

You’ll find all the generic stages on my devspace for now. I’d greatly appreciate it if some brave users could give them a try and let me know how they go. I’m doing some tests now, and things look promising, apart from guile failing a “make check”, everything seems to be going fine. These will work on any MMU-equipped little-endian MIPS box with sufficient RAM (~128MB… 64MB if you’re absolutely desperate, but you won’t be able to rebuild system packages like gcc and glibc).

The MIPS4 builds will be a little while, since the Lemote boxes only implement up to MIPS3, I can’t use them to directly build the Cobalt stages, thus they’re being done on the Qube2. I’ll let you know as things progress, but I expect it’ll be tomorrow before I have a stage1 tarball available for MIPS4.

Interface Hall Of Shame: LG’s IP Operator

LG IP Operator main dialogueI discovered an interesting example of poor UI design today whilst checking the wireless configuration on my father’s laptop. The machine runs a factory installation of Microsoft Windows XP Professional (along side Gentoo Linux/x86) , and came with a little network configuration utility called IP Operator.

IP Operator exhibits several interface abnormalities and issues. The main dialogue is pictured left (click to enlarge). Firstly, it’s full of geekspeak, with acronyms even an experienced user like myself would get confused by. Some of the tooltips and UI elements mention terms like SSID (which I understand is the network name), RSSI (what on earth is that? presumably signal strength…), Link speed: 11Mbps (Is that good?!)… Indeed, the very name of the application is geek-speak. IP? Is that Intellectual Property? My father thought it was… (and that’s someone who does have a strong IT background).

The layout of the dialogue isn’t bad per-se, although it’d be nice if it respected the user’s choice of colour sheme. That said — notice the two little arrows just above the Disconnect button? Guess what they do — change the colour of the dialogue. Totally pointless — Windows XP already provides a means of doing that in its Display control panel.

As for keyboard navigation, most applications stick to underlining the mnemonic letter to indicate keyboard shortcuts. I’ve seen examples of this under Linux/Unix (Motif, X/Athena, Qt, GTK+, WxGTK and numerous other UI toolkits), Microsoft Windows, IBM OS/2, Apple MacOS and Mac OS X, SGI Irix … even DOS applications often displayed the mnemonic character using a different colour. As an example, the Firefox web browser I’m using now, does this…

File Edit View History Bookmarks Tools Help

Now, for a user like myself, I know that hitting ALT+F will get me the File menu, or ALT+H will get me Help. It works the same in every other platform I’ve used. Clearly for LG, this isn’t good enough, instead they opted to explicitly show the mnemonic character separately.

The only time I’ve seen this done legitimately, is when the interface is in a language other than English — and even here, I’m not keen on the idea — I recognise that in that situation, it is done because the keyboards are often designed with English in mind, and thus don’t provide a convenient means of entering in foreign-language characters. OpenOffice 2.0 as factory-installed on a Lemote Loongson, shows its menus like this:

OpenOffice 2.0 in Traditional Chinese

LG even do this in the context menu for the system tray icon, as seen below.

IP Operator System Tray Context Menu

Now here, it’s completely pointless. The system tray is quite difficult to reach via the keyboard — at least for me anyway (there may be some other shortcut for it). The way I reach it, is to tap the Logo key (or CTRL+ESC) switch focus to the “Start” button, then hit tab a few times to reach the system tray where one can use the arrows to move around (or it may be TAB/Shift+TAB… not sure). Most users would just use the mouse — much less stuffing around.

Indeed, LG probably want to have a think about how they present things to the user. I’m happy that I don’t have to deal with it 90% of the time — since it isn’t my computer. I’d have uninstalled it by now if it was (in fact, I’d have completely reloaded the box myself — I don’t trust factory installs). These days I look back to the days when the Interface Hall of Shame was online (there’s an archive of it here) — they’d have a field day with applications like Office 2007 and OSes like Windows Vista (with it’s totally new and fresh UI) … and probably have a dig at us too. But perfection is a journey, not a destination, so this is to be expected. 😉

PHP and templating engines

Update: Seems I should have read this page first… we were thinking on the same wavelength afterall. I’ll leave the post here, since I think my (and Brian Lozier’s) argument is still valid with respect to the overheads in various templating engines…


It has always fascinated me, with large-scale PHP projects, how people seem to flock to overly complicated templating engines. I’ve worked on a couple of such projects, and it got me thinking about why we do it.

My first real contact with a site that uses templating engines was the Asperger Services Australia site. Originally, it was a static-HTML site done in FrontPage, but after looking at a number of CMS systems, we finally chose TikiWiki to run the site. TikiWiki utilises the Smarty templating engine — a behemoth weighing in at just over 1MB.

Smarty wields a lot of power, able to do numerous transformations with strings — but it’s a big package, and takes quite a while to master. It also seems to occupy a lot of memory, and requires write access to directories to store “compiled” templates.

This year, we built a web application called Teamworker. Our implementation was written in PHP using MySQL, and basically it was a ground-up re-write of an internal QUT webapp of the same name (many QUT students probably know it well). For this project, we wound up using the bTemplate engine, a far simpler engine than Smarty, it uses simple string replacement of XML-like tags. It has quite a few limitations however — for instance, one cannot have two loops of the same name — it’ll substitute one, but not the other. It isn’t difficult to pick up, but some aspects of its syntax are … awkward.

I dare say if I look hard enough, there’s probably some poor sadistic sod trying to do it with XML and XSLTs. Yes, they have their place, but they’re massive overkill. If your data is already in XML to begin with (i.e. Gentoo’s site) then sure, go for it, but otherwise it seems to be (to me anyway) a really messy way to do things.

PHP, believe it or not, actually is a templating engine. It has all the features one needs. All the code I need goes inside tags like this: <?php ?>, and outside of these, I can have just about anything I want. I can also use conditional statements inside PHP tags, to control what gets displayed outside… e.g. suppose I define the variable $logged_in, a boolean, and the string $user… a webapp might have:

... random HTML code...
<?php if ($logged_in) { ?>
Hello <?= htmlentities($user) ?>.
<a href="profile.php">Profile</a>
<a href="logout.php">Logout</a>
<?php } else { ?>
Hello guest. Please <a href="login.php">log in</a>
<?php } ?>
... more code ...

Voila… done. To whistle up this template, a script only needs to initialise $logged_in and $user, then include("template_file.php");, and it’ll appear as they expect.

However, this requires that your templates be structured a particular way. You’re more-or-less generating things on-the-fly, rather than constructing everything in a buffer, then sending it later. This can lead to display code getting mixed up with computation code, which isn’t terrific. So in these situations, PHP needs a little helping hand. Enter, the 8-line templating engine.

PHP since version 4 supports output buffering. These allow the programmer to control when and how, data is released to the browser. In addition, it is also possible to fetch the rendered output from the buffer as a string then clear the slate. This gives us great power to create a very simple but flexible templating engine, in 8 lines of PHP code:

function doTemplate($templateFile, $data) {
extract($data);
ob_start();
include($templateFile);
$_out = ob_get_contents();
ob_end_clean();
return $_out;
}

It’s crude, but it works. A site can then be easily put together using this method. No files need to get written at runtime, there’s no special syntax required. The idea is the template files are just very trivial PHP scripts — one uses as few functions as possible to achieve the desired page output. So built-in functions such as if, foreach and similar constructs, and maybe the odd include(). A site might use an overall template like the following:

<html>
<head>
<title><?= htmlentities($page_title) ?></title>
</head>
<body>
<h1><?= htmlentities($page_title) ?></h1>
<hr />
Navigation: <?php foreach($navlinks as $link) { ?>
<a href="<= $link["target"]; ?>"><?= htmlentities($link["title"]) ?></a>
<?php } ?>
... other header stuff ...
<?= $content ?>
... rest of page

They may, for instance, have some form widgets. Suppose they wanted all these boolean values to use radio buttons with some sort of tick/cross image beside them? They can define the HTML code for them in one place…

<input type="radio" value="no" name="<?= $name ?>" id="<?= $name ?>_no" /><label for="<?= $name ?>_no"><img src="/images/cross.png" alt="No" /></label>
<input type="radio" value="yes" name="<?= $name ?>" id="<?= $name ?>_yes" /><label for="<?= $name ?>_yes"><img src="/images/tick.png" alt="Yes" /></label>

Then use that widget repeatedly in a document by simply defining some place holders (using <?= $placeholder_name >) and generating the page…

$my_page["show_email"] = doTemplate("templates/yesno.tpl.php",array( "name" => "show_email" ));
$my_page["subscribe_annouce"] = doTemplate("templates/yesno.tpl.php",array( "name" => "subscribe_announce" ));
//
// ... other definitions ...
//
$page_content = doTemplate("templates/register.tpl.php", $my_page);
echo doTemplate("templates/overall.tpl.php", array(
"page_title" => "Register for our forum!",
"content" => $page_content,
"navlinks" => $navigation // <-- This may be a global array that's manipulated in various places as needed.
));

Already, that works in much the way bTemplate does, but doesn’t have nearly as many limitations. There are some manipulations that it can’t do as easily as Smarty does them, such as inline manipulations of text, but then again, it’s a heck of a lot more lightweight. Sure, RAM is cheap these days… but still, why waste the resources if you don’t have to? What I’ve done above, could be viewed as wasteful — even the very act of using PHP in the eyes of some, but sometimes we don’t get a say in that matter, we work with the tools we have at hand. (Heck, I’ve been known to use C and Busybox ash to construct webapps — which works surprisingly well too.) But even in this age of cheap computing power, I think striving for minimalism is still worthwhile.