2008 September (3)

Browse Month: September 2008

Useful Language-Changing JavaScript

Recently I had to quickly make a copy of the same web site iin a different language. Instead of coming up with complicated solutions (the web site isn’t that big and the second language was long overdue) I decided to copy the contents into a subdirectory and just substitute the contents in English with the same in Spanish.

The thought behind was that I can alternate between each page using simple javascript routine. So there I have example.com in English, example.com/sp/ same thing in Spanish. Same pages are named the same, so it’s example.com/about_us.html and example.com/sp/about_us.html – otherwise the script it useless.

The function is fairly simple:

function langChange() {
var pt = location.pathname;
var hs = location.host;

if (pt.length < 4) {
newloc = ‘http://’ + hs + ‘/sp/’;
} else {
if (pt.substring(0, 4) == ‘/sp/’) {
newloc = ‘http://’ + hs + ‘/’ + pt.substring(4);
} else {
newloc = ‘http://’ + hs + ‘/sp’ + pt;

Pretty universal, works everywhere. Set in as an onclick() event for your language changing butn and you’re good to go.

P.S. If you have much faith in Javascript – feel free to add ajax call to database for current page to figure out the counterpart in a different language.

Version or Revision Control Software

It has just occured to me that I don’t know any single small web development suite (from UltraEdit all the way to Dreamweaver) that would have a simple version or revision control. Of course, there are SVN, CVS, Visual SourceSafe and that monstrous Team Foundation Server, but they are not the solution.

But what a small business owner to do? Or a freelancer? Or a team of less then ten-twelve people? All these creatures seem a bit… overpowered. It’s like purchasing a freight truck instead of a van. For a team of ten hardcore programmers – it’s a great tool. For web designer, couple of coders, technical writer and their project manager – it’s the common pain in their individual necks.

So what I want to see is the tool that can:

  • integrate into popular HTML editors, like Dreamweaver, UltraEdit or others
  • act as a standalone application
  • take “snapshots” of selected folders
  • produce list of new/altered/deleted files between any two snapshots or current files
  • export full or partial set of files based on selected snapshot and provided criteria
  • produce delta between various file revisions (at least plain text files and documents)
  • produce various simple reports based on criteria selected
  • work on both Windows and Mac OS X platforms
  • be integrated into client-server environment

This, the way I see it, is a huge potential niche for someone who can throw such software into it. Traditionally, small businesses or freelancers relied either on multiple copies of files or backups. Another culprit is that most of version control systems designed by programmers and for programmers, so average person would have a hard time figuring things out (which is why it isn’t worth it).

The Apple Isn’t Green

Apple Headphones Yesterday I bought the shiny new iPhone for my girlfriend. Aside from that, I bought her an extra pair of headphones, as we figured a set lasts for about 4 months of heavy use. So instead of grabbing the ones from the original iPhone box, she went to unbox the extra set. I was surpised how thoroughly it was packed. Well, the “thoroughly” isn’t exactly the word.

First there’s a carton box. Pretty thick, but that’s understandable, since it’s the external cover. Then there’s a small paper envelope, that actually holds the head phones wrapped into some plastic tape. So you have two huge pieces of paper and some plastic – for small merchandise that could be wrapped in plastic only… something along the lines of “saving the trees” and so on, you know.

Does it look nice? No doubt. Does it make sense? Hardly.

Oh, and the whole thing costs $39.99, which is about 5 times overpriced. Guess half of the money goes to bribe those “ecology experts” to approve Apple’s packaging.