OSTD: Open Source Translation Database

December 8th, 2011 OSTD, Safe For Seneca

By Andrew Smith

I have an ideas list, a sort of todo list for when I have time to burn. One of the ideas on my list is a website that can help authors of open source software to translate their software into languages other than english. I have recently agreed to teach part time at Seneca and also I decided to take a break from looking for a full-time job for a couple of months. Which means I have time to burn :)

There are similar strings in many pieces of software, so theoretically if it’s translated in SoftwareA it should be easily translatable in SoftwareB. In practice however this is not the case. It is impractical for a project maintainer to find strings in other software that will look like his own. In fact in most cases it is difficult to even find the pot/po files in existing software because there are so many version control and release systems.

So the core of my idea is a database of existing translations that can be used to automatically translate some strings in new software. The open source maintainer would submit a .pot (template) file and get back partially translated .po files in a bunch of languages.

Over time this website can be expanded to provide general internationalization (i18n) advice, advice for which english strings to pick which the service will translate more easily, a network of translators who may be interested in volunteering to help a particular project, etc.

I’m going to try and record in this blog the issues that come up with designing, building, and marketing this website. That shouldn’t be much of a problem since I don’t have a hope in hell of ever making money from this project, it’s just community service :)

Designed a database recently?

November 29th, 2011 Safe For Seneca

By Andrew Smith

Today I got some news that tells me I’m going to have some spare time on my hands. So I figured I might as well find something to do with that spare time. One of the ideas in my list caught my attention and I started working on it.

Sort of the centre of that idea is a good data store. I need to store a lot of strings and be able to search them all. And manage the entire thing of course. So I figured I’d sketch a preliminary database design.

I could not believe what I found. I don’t remember anything about database design. I remember the normalisation rules, probably because the concept of “normalising” always seemed weird to me, my designs are usually normalised out of the box, but then.. I don’t remember anything else.

There are primary keys and.. what are they called.. I had to google it, foreign keys. And how do I search subtables of subtables? I don’t even remember such a concept, google confirms there is no such thing as a subtable. Head scratch.

Database stuff always seemed so benign to me I never gave it a second thought after I was done with my courses. I knew there are very complex queries and lots of issues with databases but the field didn’t interest me at all.

Now it turns out I spent so much time with other technologies I forgot even the simplest things about databases. That struck me as so bizarre I just had to write this blog post. I guess anything can be forgotten if it isn’t used, no matter how simple it is.

How I almost switched to Ubuntu

June 24th, 2011 Open Source, Safe For Seneca

By Andrew Smith

Lat week I got a fancy new printer. I was trying to find something that will work for years and years so I shopped around for a couple of days.

The shopping experience was pretty painful. It’s very difficult to find whether a printer is actually supported in Linux before buying it and trying it out. Still, at the end of the second day I picked an MFC-7860DW – a solid all-in-one with a good feature set and apparently (not clearly though) supported on Linux being a Postscript printer.

On Windows the thing worked pretty much out of the box – pop in CD, have it detect the printer on the network, click install, print. Not on Slackware :)

On Linux I quickly got confused by all the terminology. There on the Brother website for this printer is an LPR driver, a cupswrapper driver (both in rpm/deb formats only), and generic install instructions. Also here and there I found references to brscript, which made me suspect this isn’t actually a real postscript printer.

I extracted the files from the .debs, copied them manually to the destination, and looked at the post-install scripts and ran the commands manually. Printer driver was added successfully to CUPS and I could add the detected network printer, and I could even print a CUPS test page successfully, but nothing else would print. Everything else would come out as pages and pages of garbage.

After many hours of beating my head against the keyboard I installed Ubuntu in a VM and installed the brother deb packages in there and after a minute of fiddling with cups – printing worked, including two-sided (duplex) printing.

This was a particularly busy week for me and I snapped, I could no longer justify spending so much time installing a printer and I figured maybe it’s time to switch to Ubuntu, and I did.

Thankfully though it wasn’t long (less than a week) until I remembered why I was a Slackware user in the first place – it’s conservative, stable, and doesn’t modify upstream packages. Every day I found something in Ubuntu that would drive me crazy. Parts of the screen would be blacked out after resizing certain windows (crazy driver bug maybe, but it worked in Slackware), my USB mass storage phone (with worked in Slackware) would sort of mount when I clicked on it in Thunar but the contents would not be displayed, and the final straw was grub2.

Don’t get me wrong, I’m all for usability and also I appreciate that sometimes something old needs to be dropped so something new and better can take its place. But it seems to me that grub2 doesn’t fit either of those parameters. It is absolutely a monster to configure (just try to change something simple like the boot timeout if you don’t already know how to do it) and doesn’t give me any benefits as far as I can see. On the web someone suggested a GUI program to configure GRUB2 and that’s when I decided to hell with it. If you’re going to require a GUI program to configure a boot loader – you better bloody make sure it’s installed and accessible by default.

So I switched back to Slackware (Ubutnu was on a separate partition of course) and having a little more patience and a fresh mind I just used the generic postscript driver, which worked, which is why I bought a postscript printer in the first place :)

I wrote it up in case someone else will look for info about this printer on Linux, I will extend that guide when I find more about using this printer’s features on Slackware.

The end of an era

April 14th, 2011 Open Source

By Andrew Smith

Today I wanted to make some yummy apple puff pastry, so I turned my laptop on to put up a recipe and.. the screen blipped and went off. This machine (an IBM x40) was so old that I wasn’t at all surprised. The laptop went with me through school (when I rode bicycles and buses and subways), several jobs (more subways and driving), came with me on planes and Sudbury trips, has been used by my mother for about a year, and for the last year or two has been sitting on my desk, with a monster work laptop squashing it (which was probably what killed the screen).

With little hope and mostly our of boredom I took the keyboard off. To do this I used the skills I acquired in my last career as a computer technician, when for some time I worked for IBM fixing up used laptops. Like many IBM laptops this was a wonderful machine. Not only is it solid like a rock but it’s easy to take apart, and inside, after years of beatings.. it looked like new!

I am telling you I have never seen a used laptop this clean – both literally and in terms of design and construction. I was going to look for loose or damaged cables or mechanical pieces – yeah right! Everything was shiny, orderly, and in its place. Unfortunately I saw the image was still being displayed, just not backlit. Yep, laptops like this we sent straight to the scrap pile because the screen cost more than the rest of the parts put together. I felt a little bad at this point (what a nice computer) but whatever, it lived a good long life.

As a sign of respect for the machine and the engineers who built it I put it back together in preparation for the scrap yard, then I thought of giving it a burial (which obviously wouldn’t work), then I thought of getting it some flowers (I’m not kidding), and then I realised why I had such trouble letting go and I almost cried..

The problem was not letting go of that laptop! The problem was that I wasn’t going to get a replacement laptop, the problem was that those days are over. I have an Android phone which does almost all that the laptop used to do. There is this concept of a laptop dock (check out the Atrix) which would serve for the rest. I’m not going to go buy a new laptop, hell I don’t even want one for free.

This reminded me of the end of my last career. About eight years ago I decided that a computer technician is not a career with a future and I took a leap of faith, going back to school to become a software engineer. It was a good decision and I think it paid off but it has not been long enough, I am not yet ready to switch careers again!

Yes, computers are as common as ever and there is a new world of mobile devices that promises a few more years of prosperity for software engineers like me, but I wonder if I’m already seeing signs that software is becoming a commodity by default.. and then what? Will I end up like one of those guys I was laughing at in school, “maintaining” (pretending to do work on) a Cobol program on an IBM mainframe, but with slightly newer technologies? How ghastly..

And even if there are still going to be new and exciting things to do for software engineers – what about me? Will I be able to learn the new tools, or is my brain over full with things that no longer matter?

Life is sad.. but I guess that’s the cost of progress, older farts like me have to get off their asses and relearn everything or let the next generation take their place. Well, I’m not the type to give up without a fight so bring it on kids :)

ING Direct: “Planned temporary outage for maintenance”

February 5th, 2011 Uncategorized

By Andrew Smith

I don’t think it’s a great idea to blog about my finances but this one surprised me so much I’ll share this personal piece of info with the internet: on the 29th of January this year I had an ING Direct account.

Last saturday (in the middle of the night) I wanted to log in to ING Direct. I don’t remember why, but that doesn’t matter. The website would not allow me to log in, at all. It gave me the following message:

ING DIRECT – save your money
Sorry for the inconvenience…

ING DIRECT is currently undergoing a planned temporary outage for maintenance on our web site.

If you have an urgent issue, please call us at 1-800-464-3473. If it is more convenient, please return later today to complete your transaction.

Alternatively, if you have an ABM card and you require immediate funds, you can access your money at any of the 40,000 Interac® connected bank machines across Canada.

We value your business and apologize for any inconvenience. Thank you for your patience during this time.
Nous sommes désolés de cet inconvénient

ING DIRECT a interrompu temporairement son service afin de procéder à l’entretien de son site Internet.

En cas d’urgence, veuillez communiquer avec nous par téléphone à 1-800-464-3473. Si vous préférez faire vos transactions par Internet, nous vous invitons à revenir sur ce site un peu plus tard dans la journée.

De plus, si vous êtes détenteur d’une carte de guichet automatique et que vous avez un urgent besoin de liquidité, nous vous rappelons que vous avez accès à votre argent par le biais d’un réseau de quelques 40 000 guichets automatiques InteracMD répartis à travers le Canada.

Nous sommes fiers de vous compter parmi nos clients et nous nous excusons de tout désagrément qu’une telle situation peut engendrer. En vous remerciant de votre patience, nous vous prions d’accepter nos plus cordiales salutations.

And so you don’t think I’m kidding, here’s a screenshot:

I didn’t know what to think. There’s the green bar, so it was likely the real website. But surely “planned maintenance” was a bunch of bollocks. A branchless bank that has a single interface to its users (the web) cannot possibly have such an antiquated website that they need to take the whole thing down for maintenance?

It’s been down for hours at least. Can you imagine Google or Facebook or any other major internet website going completely offline for so long? And why should they? There are plenty of (now old and established) technologies and processes that allow live maintenance, upgrades, repairs, and even disaster recovery. How could it be that ING Direct does not use these?

And if it was planned, why did they not let me know in advance? It was not an emergency but I did call them to ask what the fuck is going on, the guy basically refused to tell me. He claimed this is common regular maintenance and it happens about once a month. Really? And if it’s planned, why did I not get any notice about it?

I googled several parts of the text in that error message. Found one reply to a thread in 2008 mentioning it. And that’s it. Does this really happen every month and noone bothered to mention it in a blog post or discuss it in a forum of some sort? Were they forced to take their posting down? They better not try such crap with me.

I suspect this was a major system failure, quite likely to do with security. It’s a bad idea to keep your users in the dark about major problems. I have savings there, and they may be CDIC insured, but I’m not looking forward to try and claim my savings from some agency I never had to deal with before. The last thing ING should want is me wondering (in public, on my blog) whether my savings are safe, whether the ING Direct website is secure, and whether their IT staff are completely incompetent.

I’m not even saying full disclosure was necessary. But don’t treat me like an idiot by claiming this was planned website maintenance. Shame on them. I can’t wait to get rid of my savings (buy a house maybe) so I don’t have to worry about such bullshit.

CreateProcess for Linux

January 20th, 2011 Open Source, Safe For Seneca

By Andrew Smith

Do you remember the first time someone told you about fork()/exec() for Linux? Do you remember beeing completely confused? I do, and it’s an ongoing pain in the ass for me – every time I want to call something simple without blocking and without worrying about pipes or the structure of exec()/execl()/execlp() parameters, or the return of the fork() call.

Finally I had enough and wrote my own CreateProcess function. It will seem trivial for any Linux C programmer, but in my experience it’s not simple enough. This or something like it should have been part of the standard library, just like printf() is.

Feel free to use it for whatever you want, minding the GPL v2 licence:

/******************************************************************************
*   CreateProcess
*
*   Copyright (C) 2010 Andrew Smith
*
*   This program is free software: you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation, version 2 of the License only, not
*   any earlier or later version.
*
*   You should have received a copy of the GNU General Public License
*   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/******************************************************************************
*  CreateProcess function: a simple way for Linux/Unix to call programs
* without blocking and without the complications of fork()/exec() which
* normal people shouldn't need to understand :)
*
*  Usage example:

#include "CreateProcess.h"

int main(void)
{
    // Call it like this:
    CreateProcess("ls", "-a -l --sort=size");

    // Or like this:
    CreateProcess("date", NULL);

    // Note that the second call does not wait for the first to finish
    // as system() would

    return 0;
}

* Enjoy!
* - Andrew Smith
*/

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>

pid_t CreateProcess(const char* command, const char* parametersIn)
{
    const int maxNumArgs = 1024;
    const char* args[maxNumArgs];
    char* parameters = NULL;

    memset(args, 0, (sizeof(char*) * maxNumArgs));
    args[0] = command;

    if(parametersIn != NULL)
    {
        parameters = strdup(parametersIn);
        int strLen = strlen(parameters);

        int numParameters = 1;
        bool expectNextParam = true;
        int i;
        for(i = 0; i < strLen; i++)
        {
            if(parameters[i] == ' ' || parameters[i] == '\t' ||
               parameters[i] == '\n')
            {
                expectNextParam = true;
                parameters[i] = '\0';
            }
            else if(expectNextParam)
            {
                args[numParameters] = &(parameters[i]);
                numParameters++;
                expectNextParam = false;
            }
        }
    }

    pid_t pid = fork();
    if(pid == 0)
    {
        execvp(command, (char**)args);
        _exit(1);
    }

    if(parameters != NULL)
        free(parameters);

    return pid;
}

How to save 10$ a month on the power bill

January 16th, 2011 Safe For Seneca

By Andrew Smith

Once a year or two ago they were lending out power meters at the Richmond Hill library, the sort of thing that you put in between an electrical device and the power plug in the wall to see how much power the device uses. Trying to find it again.. PowerStream’s Watt Reader Loan Program, could be that you can still borrow one at the library.

I’ve measured just about everything in the house where I lived at that time (here’s the spreadsheet) and some things were just stupid, like my speaker system that would suck up half of it’s maximum power even when powered off.

That project was left on hold for a while, until recently when I started paying my own bills and was wondering how much of the idle computer stuff I have is costing. I have a large desk with two desktops and one or two laptops, a laser printer, some external harddrives, speakers, and random other things. Instead of measuring them all separately I plugged them all into one power bar (I’m oversimplifying of course), had that power bar sit on the desk, and turned it off when I was done with my computers for a while.

Some things like the DSL modem and Wireless Router were not powered through this circuit, and would continue to stay on 24×7.

It may have been a coincidence but it’s been 3 months now and my electric bill has gone down by 10$. I’m pretty sure I haven’t done anything else, though I don’t really understand how air conditioning works in a condo, that may have used some power the few times we turned it on.

The system is not that complicated. Just look under your computer desk at home and you’re likely to find over ten things plugged in all the time. Most of these are using power even when you’re not doing anything with them, and all together using a good hundred watts. You leave all that plugged in and it’s the same as having a big room lit non-stop. It’s a shame and a damned waste of time.

It’s kind of fun too, though maybe that’s just me, I guess not everyone will build a power bar like I have, but if it’s not fun just think of the bragging rights you’ll get and the 120$/year you’ll save :)

Two years of uptime

January 9th, 2011 Open Source, Safe For Seneca

By Andrew Smith

Check this out:

andrew@littlesvr:~$ uptime
00:20:16 up 730 days, 15:13,  1 user,  load average: 0.57, 0.22, 0.11

At 4AM this morning it was 730 days, that’s exactly two years!

The server would have been up for about 6 years if I didn’t decide once to upgrade the hardware, once to upgrade Slackware, and once to be hacked :) Ok that last one wasn’t a conscious decision, and it may happen again since I haven’t ever figured out what the vulnerability was.

Yeah, this little box has been running for this long, and yes, it does have spiderwebs on it. I didn’t take them off when I saw them because that is so cool and since I have no fans they really don’t cause any trouble.

The server is sitting on a UPS that I bought years ago. Today I tested it by cutting the power, expecting that it will die immediately. I was pleasantly surprised to see that the server (and DSL modem and hub) were still on after the 5 minute battery test. I didn’t want to test it for longer than that because I remember the spec for the UPS said 8 minutes, and I wonder if maybe a year from now I’ll be celebrating a 3-year uptime anniversary :)

Maybe in a year or two I’ll replace it with a faster, fancier, even smaller Arm box like one of those Chris Tyler is playing with. But for now I have no need.

Unfortunately my Slackware upgrade came with an Apache upgrade which means the log formats are different between the two periods, so I can’t say how much data has been transferred, but this webaliser screenshot will give you an idea of what’s typical:

(for the observant ones: legrand-sw is the workstation where I ran webaliser on the littlesvr logs)

That’s roughly 240GB of data uploaded per year (caching is on by default), and 9600 unique visitors per year.

I think it’s pretty good for a tiny hobby web server on a residential ADSL connection serving hobby content :)

And of course this is not just a web server but also my email server, which I don’t have stats for but it’s the only email I really use. With any luck it will also become an LDAP server, if I can set it up so that it’s compatible with Thunderbird and easily updateable.

Long live Slackware!

What’s digital broadcasting got to do with animated images?

January 7th, 2011 Open Source, Safe For Seneca

By Andrew Smith

I just finished my master’s so I’m allowed to quote Wikipedia again :)

In 2008 WorldDMB adopted APNG as a backward compatible extension to enable animation as part of the MOT SlideShow user application for Digital Radio. “APNG 1.0 Specification – Animated Portable Network Graphics” is included as normative Annex A in the ETSI standard TS 101 499 V2.2.1 (2008-07). In 2010 Commercial Radio Broadcasters in Sydney began to include APNG animations in DAB+ digital radio broadcasts. These APNG animations are carried by the “MOT slideshow” application which accompanies the audio services. It is expected that other cities in Australia will follow in early 2011.

That’s noteworthy because as far as I know they are the first real users of APNG. Mozilla has been using it for a long time and there are several decent applications that work with APNGs, but there has not to date been a solid creator of Animated PNGs.

I don’t know what a DAB+ digital radio broadcast is (and I don’t really care), but this is really cool!

The people want APNG!

October 19th, 2010 Open Source

By Andrew Smith

APNG has very slowly (but steadily) gaining popularity. One of the recent things I was told about is the current list of most popular ideas Ubuntu Brainstorm: APNG Support.

I’ll put a screenshot here for posterity:

That’s pretty cool. The thing that makes me feel best is the overwhelming positive votes. Looking at the rest of the ideas on the website – most of them don’t have even 50% of the votes positive.

Neat! Maybe there will be APNG in Ubuntu. Not that it will make any difference to libpng proper, those guys are too stuck up. But maybe given enough forks they will reconsider.