GUI for editing PHP live on the server

December 8th, 2011 OSTD, Safe For Seneca

By Andrew Smith

I have an aversion for vi. It’s present on every linux box so I had to learn how to use it but I very much dislike it, it’s a pain the the ass to use. (Emacs is no better by the way)

I found a brilliant solution for that problem though. In Linux there is a thing called FUSE and another thing called sshfs.

That lets you mount a directory from the server onto your workstation filesystem, without any changes to the server (assuming you have sshd running, which of course you are). Then you can use your favourite GUI editor (mine is Scite) to edit your php and css. Brilliant stuff.

It also helps that my server is on the same lan as my workstation, so I get LAN transfer speeds, so the mounted network filesystem acts as fast as a harddrive.

Now I can use a nice editor to make my changes, a nice file manager to work with files and folders, and after making a change I just go to the browser and hit reload. This is so much more efficient than the command line!

Potentially I can even run svn commands from the workstations but I don’t think I will try that because the svn on my workstation is much newer than that on my server, so I expect that would cause problems.

I do keep a terminal to the server running in case there’s a critical error in my php. Running php from the command line is sometimes an easier way to find the bug.

Version control for websites

December 8th, 2011 OSTD, Safe For Seneca

By Andrew Smith

I was always a fan of version control, even for binaries like word file for homework. This helps keep a history of stuff that may get deleted or changed, and helps a lot for working using multiple computers.

But I’ve never version controlled a website. Mostly because I never had one I was doing serious development on. In fact several of my websites were made using the Seamonkey editor once, uploaded to the server, and never touched again.

This project is different though, there will be a lot of serious code in it. Why not version control it? I decided to do it.

I had a Subversion repository for the project already, and in there I created a subdirectory for the stuff that will go on the server. On the server I checked out that subdirectory into the root of the webserver, as ‘ostd’. Then I added and committed all the php and css and images. Done!

Now I just have to remember to do commits when I’m done working on a feature or will be away from the project for a few days.

Making a good looking website

December 8th, 2011 OSTD, Safe For Seneca

By Andrew Smith

I am the first to admit that I’m almost completely incapable of making something look good. I’m reasonably good at making things functional and easy to use, but when it comes to looks.. not me.

At first I thought I would start with just plain black and white PHP output, but I felt that was going to be a significant problem when trying to attract interest, even early in the project. Also I wouldn’t want to find out two months in that I should have written a Wordpess skin rather than my own PHP.

So then what to do?

I quickly discounted WordPress. I have several Wodpress installations and the maintenance is a nightmare. New versions come out all the time, most of the time there have been security bugs fixed so an upgrade is required, but constantly upgrading a WordPress installation and making sure that the new version still works was too much.

Then I looked around for website templates. There are actually quite a few websites with free templates on. I chose one from http://www.webtemplateocean.com/ – it’s licenced Creative Commons Attribution, that worked for me.

Then the template (one html file, one CSS, and a bunch of images) needed to PHPified. Basically that means to split the body into three parts – top, body, and bottom. The top and bottom are the same for every page, so they can be printed from PHP functions. The body can be different for every page.

I was quite happy with the result. My index.php has basically nothing in it other than the content of the main page, and the same is true for all the other pages.

I will add a link to the website once it’s a little more cleaned up, in a later post.

Starting a Project

December 8th, 2011 OSTD, Safe For Seneca

By Andrew Smith

I have a long list of ideas. Why have I chosen OSTD? Well – it had to be something I was passionate about, and I am always proud to tell people that my software is translated into 40 languages. I would love to be able to say that with my help hundreds of other software was also translated into many languages.

Then I needed to make a balance between time/patience/skills required and those available. I know what I can do and I know what I can learn but how much time and patience I will have is a more complicated question.

To help me with that I made a list of use cases, which I’ll call ‘features’. With my understanding of the technology – given the list of use cases I could figure out whether this is doable in reasonable time. The feature list also helps when choosing what to do next and how to structure a database.

An overarching concern is – will people be interested in using this service? That question is just as relevant whether it’s an open source project or a commercial venture. I coulnd’t see the answer, so I had to take a leap of faith before finally deciding to go ahead. After all, if it were obvious that it would be a success, then someone would have probably done it already. I’m hoping that a leap of faith is necessary when taking on something new and exciting :)

Project Name

December 8th, 2011 OSTD, Safe For Seneca

By Andrew Smith

OSTD, the Open Source Translation Database – that’s the best I could come up with. The name and the acronym has to be unique enough that I can get to the top of search engine results relatively easily. But there’s so much more to the name.

At first I wanted to get the website a proper domain name, but then I counted how much it would cost and that discouraged me. Between the registration, the dynamic DNS, and the SSL keys I would have to spend over 100 dollars a year on it, which I’m not willing to shell out.

The name has to be memorable and guessable. What would people search for if they wanted a service like mine? If they found it once, would they remember what it was called?

It can’t sound geeky. I have a personal problem with 1337.

It shouldn’t sound too stupid either.

There shouldn’t be conflicts with things like sexually transmitted diseases. Frankly I have no idea why ostd.org exists, my best guess is that std.org was not available. But ostd is different enough from std, so I let that fly for now.

But hey – if you have a better name idea – please share, I’m quite open to changing it at this early stage.

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.