Fun with JavaScript!

Hoping someone can help me with this JavaScript problem. I’m trying to pass an array to a getElementById with the purpose of making multiple cells in the table take the class. I can get it working with one array location but not with more than one. Please help!

<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<script>
function changecolors(redsarray,yellowsarray,greensarray,graysarray)
{

var redsarray = new Array();
redsarray[0]=’r1_c1′;
//redsarray[1]=’r1_c2′;

var yellowsarray = new Array();
yellowsarray[0]=’r2_c1′;
//yellowsarray[1]=’r2_c2′;

var greensarray = new Array();
greensarray[0]=’r3_c1′;
//greensarray[1]=’r3_c2′;

var graysarray = new Array();
graysarray[0]=’r4_c1′;
//graysarray[1]=’r4_c2′;

document.getElementById(redsarray).className=’red’;
document.getElementById(yellowsarray).className=’yellow’;
document.getElementById(greensarray).className=’green’;
document.getElementById(graysarray).className=’gray’;
}
</script>
<style type=”text/css”>
.red {background-color:red;}
.yellow {background-color:yellow;}
.green {background-color:green;}
.gray {background-color:gray;]
</style>
</head>
<body>
Content …
<table border=”1″>
<tr>
<td id=”r1_c1″>
r1_c1
</td>
<td id=”r1_c2″>
r1_c2
</td>
</tr>
<tr>
<td id=”r2_c1″>
r2_c1
</td>
<td id=”r2_c2″>
r2_c2
</td>
</tr>
<tr>
<td id=”r3_c1″>
r3_c1
</td>
<td id=”r3_c2″>
r3_c2
</td>
</tr>
<tr>
<td id=”r4_c1″>
r4_c1
</td>
<td id=”r4_c2″>
r4_c2
</td>
</table>

<button type=”button” onclick=”changecolors()”;>Button</button>

</body>

</html>

 

In an ideal world … how to change my address

Recently I moved house.

I  hate moving. Not just for the having to pack everything into boxes at one end then then unpack everything at the destination (which for this move I didn’t have to do!), but mostly because I have to go through the pain that is changing my address.

It turns out that I interact with a lot of organisations, from finance institutions (banks, credit card companies, car insurance, house insurance, health insurance, etc), to official organisations (driver licencing, Medicare, electoral, organ donor register, etc), to community (Red Cross blood donor, 3RRRFM, etc) and mundane organisations (Costco, etc). And that’s just a fraction of them.

I was thinking that, rather than having to fill in what feels like a million forms and waste time that could be spent being a productive public servant or dad for my kid, why isn’t there a central contact details database that I update once? I’m sure that smarter minds than mine have considered this, but I think an opportunity exists for some organisation (government or private) to do this. In the day and age of ‘over-sharing’, are people still averse to putting their address, phone number and email details into a central database? Login security could be addressed using two-factor authentication, such as used by Google Authenticator, or sending a one-time code via SMS or email.

Many services, such as Twitter and Facebook, are set up to authorise other apps to access them. An example of this is when I used my Facebook account to sign up for Freecycle which operates as a Yahoo Group.  I ‘authorised’ Facebook to talk to Yahoo. I’ve also authorised Twicca on my Android smartphone to talk to my Twitter account.

In the same way, in this theoretical single contact details database, I could let the various companies and organisations that I interact with, access my updated contact details. Maybe they could poll this database once a week to look for updated details. I understand they’d have many different backend CRM systems so there may be some manipulation required, but nothing that’s too hard to fix with a bit of scripting.

I could also remove their access when I cease using their services. If I’m not longer banking with Bank A, then I revoke their access so they can’t find out how to contact me.

Does this sound sensible or silly? If sensible why hasn’t Google or someone done this already?

Idea from BarCamp Canberra #barcampcbr

Yesterday I went to the second half of BarCamp Canberra 2012 (I was busy in the morning and couldn’t make it).

As per usual for a BarCamp there were many great ideas being discussed. Someone (Craig?) suggested that we all go home and write blog posts about our own great ideas.  So here goes …

My ideas is this: to build a website to facilitate the transfer of mobile phone credit from people who have a surplus to people who need it.

My wife and I are currently using Telstra pre-paid and every so often when it gets near the expiry date, if there’s any unused credit we transfer some (or all) of that to the other account. Telstra call this ‘CreditMe2U’ and my understanding is that it can be used on any post- or pre-paid accounts. There’s a few limitations, such a maximum of $10 per day and some limit per month.

I see the site facilitating someone posting up that they need, say $5 credit. Anyone should be able to do this for any reason. The request could be as little as just a phone number and an amount.

Someone else, who has surplus credit, would transfer them some credit from their account, and then mark that the transaction has happened. This ensures that the requester doesn’t get flooded with credit transfers and multiple people who have surplus credit don’t end up  helping just one person. The requester would also not be able to make another request for 24 hours (based on phone number).

I would be reluctant to require people to register for accounts, as I think that would kill it entirely. It should be able to be truly anonymous. I would also be really keen to see that the site is not indexed in any way (robots.txt, archive.org exclusions, etc), so that numbers can’t be linked with requests.

I’m not sure if carriers other than Telstra have this option, but it’s worth investigating.

While there would be obvious ways to ‘game’ this system, and it’s not a fully thought through idea, it could become so with some feedback. So, what do you all think?

Three Ubuntu 11.10 annoyances

A while back I posted up a few of the issues I was having with Ubuntu 10.04 “Lucid Lynx”.

I’m now using the latest version (for the next few weeks), Ubuntu 11.10 “Oneric Ocelot”. And while it works well on my new laptop, it suffers from three pretty annoying issues.

  1. IPv6 and Network Manager. I am experiencing regular wireless drop outs when I enable IPv6 on my router. When I disable IPv6 on Network Manager it is perfectly stable again.
  2. For most USB keys, write speeds are really slow. And I mean excruciatingly slow. USB HDDs seems to be OK. The issue seems to be in the way that Ubuntu deals with caching.
  3. Sandy Bridge power draining. This is a well known and documented issue, with fixes that have been issued (to be incorporated into the 3.3.x kernel). They are not being integrated into the current version of Ubuntu (which uses the 3.0.x kernel), but are being backported into the next version, 12.04 (which will use the 3.2.x kernel).

These things are quite frustrating, and while I am pretty confident that the power issues will be resolved, I really hope that the other problems are addressed for the next version which is due 26 April 2012. From those bug reports and blog posts, it looks like they will be, which is heartening.

My new laptop!

In May 2010, I posted about what I thought were some pretty underwhelming specifications for laptops.

I have bitten the bullet and upgraded to a laptop with 1366×768 display resolution anyway.

But on a 13.3 inch screen. So it actually works pretty well.

It is a system worth about $2500 that I got for around $700. And no, it didn’t fall off the back of a truck! It fell off the back of the Dell Outlet Store.

Specs:

  • Dell Latitude E6320
  • Core i5-2520M
  • 4GB RAM (although as an ‘Enterprise’ system, it came with Windows 7 32-bit, so only 3.2GB is visible to Windows. Fixed that by dual-booting Ubuntu 64-bit)
  • 250GB HDD
  • Wi-fi
  • Bluetooth (which I personally think is next to useless)
  • Backlit keyboard (which I think is the BEST thing ever!)
  • 6 cell battery

It’s also mil-spec hardened (or something) which means that it’s almost child-proof!

It does 1080p video and with 4 cores (2 physical and 2 virtual ‘hyper-threading’) video editing works well. Really well.

I want to post up a full review at some stage, but it may not be soon.

Follow up: The woeful state of communications in Australia’s capital city

In January 2011, I posted about my experiences in trying to get an internet connection provisioned at my new home

I am now posting from our Internode naked DSL connection. To be honest, this has been working for many months, I have been slack in posting this follow up!

The Telstra guy did come back and install the line. But only after we ordered a full phone line, dial tone and all, at around $30/month. Not to mention the $299 installation fee.

After that was installed, Internode activated the ADSL. Even that took multiple calls to get the technicians back to the exchange as things went wrong.

After that was all sorted out, it was then converted to a ‘naked ADSL’ service. Effectively cancelling the dial tone service.

The rampant stupidity of the Australian communications system is truly breathtaking. And expensive. What should have been a very simple thing to get going – a naked ADSL line – proved to be extremely difficult and expensive.

But now we have Internode naked ADSL and NodePhone. Finally.

(As an interesting side note, we retained our Melbourne based phone NodePhone (VoIP) number. When the Mitchell chemical fire occurred the other day and half of Canberra was on alert, we received a call on the VoIP number, as it is registered at this address. Both mine and my wife’s mobile phones are through Optus, also registered at this address and didn’t get an SMS or call. Either the emergency alerting system or Optus messed up there. I’d be guessing the latter.)

Unfortunately, we are so far away from the exchange that we only get around 500 KB a second (half a MB a second). Back in Melbourne, close to the exchange, I was getting 2.2 MB a second, so around four times faster).

But at least we have it 🙂

Stupidity with passwords

We all know and understand how important passwords are. We all know that we should be using strong passwords.

What’s a strong password? Something that uses:

  • lower case characters
  • UPPER CASE CHARACTERS
  • punctuation, such as !@#$%^&*()<>?”:{}+_
  • and should be 8 characters or longer

So, to put it mildly, it really annoys me when I come across services that don’t allow me to use strong passwords. If I possibly could, I’d boycott these services, but sometimes that’s just not possible.

For example, my internet banking is limited to a password of between 6-8 characters. WTF?! This is hardly a secure password policy!

Another financial service I use is limited to 15 characters and doesn’t allow most of the punctuation set. Why? Is it too difficult to extend your database validation rules to cover all of the character set?

Ironically, I didn’t have a problem with Posterous, Facebook or Twitter (and others) in using properly secure passwords. So, these free services give me a decent level of security, but Australian financial services companies can’t. It’s stupidity in the extreme.

The woeful state of communications in Australia’s capital city

For those who may not know, I recently moved from Melbourne, Victoria to Canberra, Australian Capital Territory (ACT) and am now living in a house in the inner north-west. Of course, being a geek, I wanted to get the internet connected as soon as possible! After such a smooth transition I’d expected some problems and this is where they all cropped up.

In Melbourne I had an Internode ADSL connection and before I moved I called them up to relocate this service. This, of course, relied on getting an active Telstra line at the new house. I knew it would take a bit of time to relocate the service, so in the interim I bought a Telstra wi-fi internet device. This is actually a ZTE MF30 and supports up to 5 connections via wi-fi, so I can get both my iPhone and laptop on at the same time. Quite simply, this device is brilliant at what it does and I couldn’t be happier with it.

So, at the moment I’m online via the Telstra device, which is just as well really, as I soon encounter communication issue number 1: Optus.

It appears that Optus have a woeful network in Canberra. I have an iPhone 3GS, which I know can only use 850MHz and 2100MHz 3G networks. Optus uses 900MHz and 2100MHz for their 3G, so the iPhone will only work in Optus 2100MHz coverage. In Melbourne I never had a problem getting on the internet at good speeds.

When I looked at the Optus overage maps for ACT and click on “3G Single band” (the 2100MHz network coverage), it shows the inner north-west being well covered. It really isn’t. Both from home and at work in Belconnen, I can barely get two bars of GSM phone signal. The connectivity is so bad that I can barely make phone calls and send SMSs. Occasionally, I get the “Searching…” message which tells me that it has completely lost GSM connectivity. This never happened in Melbourne, where I had 4-5 bars of signal pretty much all the time.

The 3G connection drops in and out so often that I have to be standing in exactly the right location to be able to access the internet on my iPhone. Even this afternoon in Kingston in the inner south, I wasn’t able to get onto the internet and post to Twitter. I had to use the Telstra device, which hasn’t missed a beat in any location for network connectivity, to establish a connection. This really isn’t good enough for the middle of Canberra. I am seriously considering calling Optus, lodging a complaint and trying to get out of my 2 year contract (which has another 10 months to run), so I can switch over to Telstra. I never thought I’d say this, but I actually want to use a Telstra service!!!

Communications issue number 2: TransACT. From what I can find out TransACT have a cable TV network which also has telephone and internet capabilities. When this network was established about a decade ago, it was revolutionary and competitive. Today the network has been expanded to support ADSL connections, but there is no ability to get a naked service as all connections require an active phone service. Additionally, as a quick look at some of the internet connectivity plans show, after factoring in the required phone service, it is a costly service for below average download allowances.

When I moved into the house, the process of relocating the Internode ADSL service from Melbourne to Canberra triggered a visit from a Telstra technician. However, he wasn’t able to find a physical Telstra line into the house. Being an older suburb of Canberra, this house will have a Telstra cable. Or rather will have had as apparently it is not unknown for TransACT installers to cut the Telstra cables out as “You won’t need THAT anymore!”

So now I have to pay for a new cable to be installed from the house to the “Telstra network boundary” (presumably the street or nearest light pole where it can be connected to Telstra’s infrastructure). Then we have to pay again for a new Telstra connection at a cost of $299. Considering that if the Telstra cable had been left in place, the connection cost would be $55, this is turning into quite an expensive proposition just to get a naked DSL service.

All in all I am not impressed with the state of communications in Australia’s capital city, Canberra. All I can say is please, please, please bring on the National Broadband Network (NBN)!

 

 

Software Freedom Day 2010

Software Freedom Day? What’s that I hear you ask!

Software Freedom Day, or “SFD” as it is sometimes referred to, is a day of celebration that there is some computer software that is not encumbered by copyrights and Patents which place limitations on the software.

Did you know that with most proprietary software you purchase a licence to use the software but you never actually own it? If you read the Terms and Conditions of sale, more commonly referred to as End User Licence Agreement (EULA), you’ll see the clause that states that the author (usually a company or corporation) retains ownership of the software. In fact, the hint is in the name “End User LICENCE Agreement”.

For example in the Microsoft Windows XP Home Edition EULA, paragraph 3 states that:

3. RESERVATION OF RIGHTS AND OWNERSHIP. Microsoft reserves all rights not expressly granted to you in this EULA. The Software is protected by copyright and other intellectual property laws and treaties. Microsoft or its suppliers own the title, copyright, and other intellectual property rights in the Software. The Software is licensed, not sold.

This, and other clauses in the End User Licence Agreements (EULA) place many, many, many restrictions on what you can and can’t do with the software. Seriously, how many people have actually read an EULA all the way through and understand it? Then think…I have how many pieces of proprietary software on my computer, all with EULAs? Have I read and understood all of them, or did I just hit the “Accept” button? What if the EULA stated:

“You agree to send your firstborn child to the company and they will be an indentured servant of the company for a term no less than 10 years, after which time you will be required to collect them, in person, from the Antarctic”.

Sounds (and is) ridiculous, but how may other contracts do you enter into without fully reading them and understanding them? Why is the EULA on a computer any different to say the warranty on your fridge or the contact of sale of a car or house?

Imagine that you have bought the use of a piece of software (you are licenced to use it), but you now find that you need it to do something slightly different with that software: maybe you have a payroll system that now needs to apply a different tax rate. You have one choice. You can wait for the manufacturer to come out with an update which fixes the issue. But how long will that take? And how will that delay affect your business? Will your employees begin to get annoyed that their pay is either wrong or being delayed? If the software company is responsive to your request, maybe not long, but what happens if they are no longer in business? Or their software company is based in Norway and they don’t get the Australian Tax updates and it takes them a while to get around to making the necessary change? What happens to your business reputation then? If you don’t think this will happen to you, think again, this has happened to many companies around the world!

Imagine again…if you had access to the code that made up the system, the code that made it run and function (that’s the “source code”, the human readable programming that makes the system work) and you could go into this code and change that tax rate and get your system functioning within minutes of knowing about the problem. Your employees would never know and you don’t have to wait on someone else to help you. With your proprietary system you don’t have the ability, or more importantly, the right to have a look at the source code and see if you can get it changed, with Free and Open Source Software, you do have those rights.

I have used the example of a company’s payroll system, but extend this out to all walks of life:

  • students having the ability to change software functionality to suit their assignment needs, quickly learning much needed skills. A friend of mine, during his PhD, extended an existing open programming language to layout his thesis exactly the way he required
  • artists being able to change a system to suit their artistic intent and creating new works, rather than being limited to the functionality that a software programmer thinks they might need

Use you imagination to think of other ways that someone could extend a piece of software or its functionality to achieve that little bit extra.

There are few things that stand in the way of this kind of innovation. Ironically these things were originally designed to promote innovation, but now they do the opposite. They are copyright and (software) Patents.

Copyright is the concept that once you have authored something you have ownership over it and you may decide to whom it gets distributed. This often involves a monetary transaction. This stifles innovation very simply: if the idea or work is a good, or even great, one and someone wants to extend upon it, for example use it on their own project to make that project truly spectacular, then they are not able to do so without permission or monetary exchange. This may sound fair, and often is, but in some cases, the original author is not the one who decides if their creation can be used for this purpose. This is especially the case when the author has been dead for a while, and their estate is “looking after their interests”. Requests to use something that has been created a while ago can take time and sometimes the impetus may be lost in the delay. Think of cases where a satirical artist wishes to use a substantial part of a literary work to highlight the comedic value of a political situation, but has to get permission to use the literary work before the artist can publish the satirical work. If there is a lengthy delay, the comedic situation may have moved on and the artist is stymied, potentially affecting their ability to generate revenue from their own good idea.

Copyright, as embodied in the “Statute of Anne”, was originally effective for fourteen years. Authors had that amount of time to make the most of their work. Say, for instance, a playwright had written a play, they had fourteen years of earnings from the performances and then the play went into the public domain. There was the ability, provided the author was still living, to extend the copyright for another 14 years. The general idea was that the artist could create something and have enough to survive on. But they’d have to keep creating every now and again in order to keep alive! It was a good incentive scheme for creation – they could earn a good living if the work was good, but they’d have to keep doing it.

Copyright in this day and age is almost endless (70 years in Australia), and even if the copyright has expired, there are other forces at work to prevent the “general public” being able to freely use a work. For example, Beethoven has been dead for 350+ years (so there’s no incentive for him to keep creating!) but there are no publicly available, freely playable copies of his symphonies. If I wanted to create a TV show and put in a Beethoven symphony I’d have to pay someone the privilege of using their recording. Why? Because each recording is “created” by an orchestra and that orchestra retains the right of distribution of the work. But, they didn’t create the original work, they just performed it! According to the original tenets of copyright, if they want to go on eating, they need to go on playing, rather than living off a 70 year old recording, where most of those players are probably well and truly retired (sometimes rather permanently!). Musopen is a group aiming to raise enough money to pay an orchestra to perform on an “all rights” basis and make their music freely available.

Patents in the software industry are even worse. Each country has a Patent Office where people and companies can register patents. These were originally set up to register inventions. Someone invented a new way of getting something done and they went to the Patent Office, registered it, and then sold the invention. An example is something like a toaster: when that was first thought up, someone may have put in a Patent application to say something like “the use of small electrical elements to create heat to toast bread”. This is a good system, as it ensures that the person who thought up a useful widget gets paid.

However, the Patent Office doesn’t really understand software; they don’t usually have the technical expertise. So when a large corporation goes to the Patent office and says “the use of a graphical user interface to manage a desktop” they tend to get these Patents. Once they have these Patents they can then sue every other company who uses a system that is even remotely similar, depending on how vague the Patent application was in the first place. This does nothing to promote innovation, in fact putting other companies under financial strain is generally regarded as being anti-innovation. If you want to know more about vague patent applications, you only have to look at the case of John Keogh, an Australian who successfully patented a “circular transportation facilitation device“, more commonly referred to as a wheel!

In it’s simplest form, say a company Patents “2 + 2” (yes, I know they can’t do this, but humour me and use this as an example). Now, no other company can use this in their software for fear that they’ll get sued. They now have to do something like “6 – 4” or “8 / 2” to generate the same result. Extend this out to slightly more complex things that really only have one way of calculation, such as the area of a square (length * width) and you begin to understand the massive headaches that can happen for computer programmers to find their way around. How would you calculate the area of a square if you are not able to use “length * width”? And extending on the example in the paragraph above, how do you make a computer system interactive with the user if you can’t use a Graphical User Interface (GUI)?

There are some computer programmers in the world who believe that software should be freely available to all users. They should have the freedom to:

  • The freedom to run the program, for any purpose (freedom 0)
  • The freedom to study how the program works, and change it to make it do what you wish (freedom 1). Access to the source code is a precondition for this
  • The freedom to redistribute copies so you can help your neighbour (freedom 2)
  • The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this

The idea is that with the ability to run, see and change the source code and freely distribute the original and your changes around, innovation will truly be able to occur, and with innovation comes improvement to people’s lives.

Interestingly, Free and Open Source Software does not necessarily mean no cost. Sometimes companies do charge for their software and that’s OK as long as they give you the four freedoms above. More often, FOSS companies give their software away for free (no cost, “gratis” or “free as in beer”) and then, as most people or organisations don’t have the programming expertise to make alterations, and really, the company that wrote it knows it best anyway, they charge for installation, customisations and extensions of functionality. This business model has been highly successful for companies such as (but by no means limited to) Red Hat.

I’d like to highlight one use of free software that has, in my opinion, achieved these aims every effectively: the Ushahidi project. I have recently found out about this project and I am very impressed that so much has been done so quickly. Set up to track violence during the 2008 Kenyan democratic elections, the project used many Free and Open Source Software (FOSS) components and hacked them together to create something that was greater than the sum of its parts.

This is only possible using Free and Open Source Software. Imagine trying to do something similar with proprietary software! Every time they came across a situation where they said “we want the project to do this function”, with FOSS they could just do it themselves, but with proprietary software they would have had to wait potentially for a long time, putting people’s lives at risk, for the proprietary software company to create the new function.

And that’s why Software Freedom is important.

Come to Software Freedom Day 2010 in your area. There are events being held all over the world. Have a look at the map here and find the closest one to you: http://cgi.softwarefreedomday.org/2010/map.shtml

I’ll be volunteering at the Melbourne event, which has some fantastic speakers, presentations and interactive displays for your enjoyment. Come along and if you go, leave and comment and let me know what you thought.

Linux: obscurity through omission?

A quick look around the Internet will reveal that the general consensus is that the desktop market share of GNU/Linux distributions is about 1-2%. I have a theory about why that percentage is not higher for desktop usage, which I term “obscurity through omission”.

I have come across a recent example that had the opportunity to mention Linux, but did not. This was an article in this months “PC Authority“, where author Jon Honeyball discusses Dropbox. He mentions that there are clients for Windows and Mac. He fails to mention that there are also clients for Ubuntu and Fedora, in both 32 and 64 bit versions, as well as the ability to compile from source. Dropbox releases updated client versions for Windows, Mac and Linux simultaneously, showing that, to them, Linux is equally valued. However “PC Authority” readers would not know that Dropbox can be used on Linux just as easily as on Windows and Mac.

This is but one example. I am sure that readers of this blog post could come up with many, many more examples of Linux just being forgotten about or actively ignored. Most hardware and peripherals work just as well on Linux as they do on Windows and Mac, but we’d never know from the manufacturers or the reviewers. I am convinced that if given wider coverage, then people might begin to question “what’s Linux?” This may lead to greater adoption of Linux, which I happen to think is a good thing.

I will readily admit that “obscurity through omission” is just one of potentially many reasons why the adoption of Linux is currently quite low, but I believe it to be a contributing factor. What do you think?