Monday 10 May 2010

Moving again

Well, so much for sticking with Wordpress.com! I've stumped up for paid hosting and set up a new Wordpress blog at here, on the domain name I bought earlier this year. Please subscribe to my new blog! I'm hoping this will be a much more interesting blog than this one has been, and I look forward to seeing you all there!

Monday 3 May 2010

Switching from Blogger to Wordpress

I've decided that Blogger no longer meets my needs for this blog, so I've made the decision to switch to a hosted Wordpress account. My new blog is at http://matthewdaly.wordpress.com/ and I hope those of you who have enjoyed this blog will follow me to the new blog. I'm also very fed up with the comment spam, and I'm hopeful this will mean I get less of it. I've exported the content to the new blog (with only limited succes, I have to add) and will make more of an effort to keep adding new content.

I plan for the new blog to be mostly about programming and web development, making it considerably more focused than this blog has been. I'm considering upgrading my free hosting account to paid hosting in the next few months and making my website into a self-hosted Wordpress blog, in which case I will again be exporting the existing content to a new home, but for now I will be giving my hosted Wordpress account a good try.

Wednesday 21 April 2010

Passed!

Today I took the exam for my CIW Database Design Specialist course, and I'm pleased to say that I passed with flying colours! I find it hard to believe that I've managed to actually accumulate that much information about relational databases, but somehow I did it!

Now to actually get out of my existing customer services role and into the IT industry! I'm still studying as I've got a lot more work to do for the rest of my CIW Master Enterprise Developer certification, but this means I've got a lot more options open to me - database administration's a possibility but really I'm more interested in web development. I've got to study JavaScript next, then Perl, then PHP and classic ASP before moving on to Java.

Sunday 18 April 2010

Election time

As you may be aware, election time is looming in the UK. As someone who considers themselves old-school Labour (as opposed to Tony Blair's New Labour) there isn't really a party I feel I can align myself with anymore, so I tend to vote more based on issues than habit. I have, however, always felt that if you don't vote you can't complain about the government so I make a point of always doing so.

Like many others, I was appalled by the way the Digital Economy Act was pushed through by a Parliament that clearly didn't understand its full implications. Its primary architect, Peter Mandelson, clearly didn't understand a thing about how the digital economy works. This piece of legislation is ill-conceived at best and downright scandalous at worst.

So I'm very pleased to learn that the Liberal Democrats are calling for it to be repealed. I'm even more pleased to learn that the Lib Dems have experienced a significant surge in support. Realistically I don't think they are likely to win the election, but there is a fair chance that they may gain sufficient votes to force the majority party to enter into a coalition with them, meaning they may well get the opportunity to repeal the Digital Economy Act. Plus, there's the possibility of the extremely capable Vince Cable (who unlike many other politicians actually realised that people taking on unprecedented levels of personal debt was a bad idea) being Chancellor of the Exchequer.

I have a strong dislike of Tories in general, and David Cameron doesn't actually appear to stand for anything much - he's one of the most superficial politicians in government at the moment. I still remember the shambles of the last Tory government and there's no way I'd want to repeat that.

While I would love the Pirate Party to be standing for election in South Norfolk, sadly they aren't. While the Green Party have also said they are opposed to the DEA, they remain a fringe party. I feel that the Labour Party have had their own way for too long and it would be good to either get rid of them or make them share power so they don't have the opportunity to force objectionable legislation through.

I'm therefore throwing my support behind the Liberal Democrats. I intend to vote for them, and if you're concerned about the consequences of the Digital Economy Act too, I recommend you vote for them as well. They're the only major party who actually seem to understand the issues at hand. Hamstringing the digital economy to benefit the analogue one is not the way to guarantee this country's future, and only the Lib Dems seem to have grasped this.

Comments policy

As you may be aware, I recently started moderating comments as I've had problems with spammers in the past. I felt it might be helpful to set out a more formal set of guidelines for comments so people know what I'm willing to accept. I've posted them to the right.

Essentially they boil down to the following:
  1. English language only (this is an English-language blog, after all, and I've had a lot of Chinese spam comments on here). I don't care how bad your English is (seriously, I have seen some terrible written English from native speakers, so don't worry too much if you're not good).
  2. If you're clearly just spamming and quite blatantly have nothing to contribute to the discussion I will not approve your comment.
  3. Finally, I will not accept any comments that are hateful. I've got no problem with colourful language but anything I consider genuinely nasty or unpleasant will not be approved.
As long as you obey those rules, I'm happy to accept your comments here, so please don't be dissuaded from commenting by the fact that comments are moderated.

Saturday 20 March 2010

My new website

For a while now I've been considering setting up a website on my own domain name, as this would provide an excellent way of showcasing my abilities with HTML, CSS and JavaScript, and provide a URL I can put on my CV when applying for jobs. I've had my eye on the domain name matthewdaly.co.uk, and last night I bought the bullet and paid for it (bargain at about £6 for 2 years, including VAT).

I've wanted to put a blog on there, but I couldn't find a blogging engine that I could easily integrate into it. I was thinking that the way to go would be to write a custom blogging app using Django, but right now I really don't have time to sit down and learn Django properly, what with doing an unrelated day job and studying in my spare time. So, I thought rather than put it off, I'll get some free web hosting and put something on there now, even if it's fairly basic.

And here it is! Please feel free to have a play around with it and let me know what you think, or any problems you've had with it. I've used a little CSS3 in making it, partly because it was by far the easiest way to implement drop shadows and rounded corners, but it degrades fairly gracefully in browsers that don't support CSS3 yet. I didn't have too many problems with adjusting for IE6 thanks to the reset style sheet I used, and the PNG fix.

In future I will expand upon this fairly basic site (and naturally I'm going to have to stump up for paid hosting in future) but for now this is my first hand-coded website!

Sunday 14 March 2010

Switching to Slackware

I've had my Dell Inspiron since 2004, and it's worked very, very well for me (it's still going strong), but I can't deny that it's too slow and old for many modern operating systems. I've been running Kubuntu Hardy on it for a while as that was the last version which shipped with KDE3.x but I was feeling the pain of running an older release, so I started hunting around for a replacement. KDE4 is just too heavy for this computer, so that wasn't an option.

I've tried a number of Ubuntu derivatives, including CrunchBang Linux and Xubuntu, but Xubuntu was too slow and I didn't really get on too well with CrunchBang (too basic for my liking). What I really wanted was a fairly default XFCE desktop (I really like the base XFCE desktop and it's not as bloated as Gnome or KDE).

Unable to find an Ubuntu derivative that really met my requirements, I decided to look elsewhere. I was considering Debian with XFCE as I have had a lot of good experiences with Debian-based distros outside Ubuntu, including sidux and SimplyMEPIS, but I felt like a little distro-hopping as I haven't done that for a while (since my trusty Philips X58 died at Christmas time I've only had one Linux machine, that being the old Dell, so I've relied on my MacBook a lot). I've always been interested in the sound of Slackware, and I had a copy of Slackware 13 that came with Linux Magazine, so I thought I'd give that a go. I'm familiar with the installer so the only issues I was likely to have were with configuring my wireless network. Fortunately, Slackware nowadays ships with wicd included on the disc, and I'm familiar with this. Once I'd finished the install (not hard by any means, just more involved than, for example, Ubuntu's installer), I booted it up and installed wicd from the DVD, and it worked straight away.

I've heard that Slackware has a lot less bloat than most other Linux distros, and my experience certainly bears that out. Compared to Xubuntu, my new Slackware install with XFCE is lightning-fast. As of right now I'm running slackpkg to update my system and while it may not be as flexible and powerful as apt, and not have a nice graphical front-end, it's perfectly usable
and I'm happy with it. I'm used to sudo from both Ubuntu and OS X so I've set that up, and all in all I'm very pleased with my new system.

I'll let you know how I get on with it over time, but for now I think Slackware is a great distro for what I want on this machine, and one that'll help me learn more about Linux. Don't get me wrong, I still love Ubuntu, but Slack has its place too, and I have my own reasons for liking both.

Thursday 18 February 2010

The great IE6 switchover

OK, this subject has been done to death, but Internet Explorer 6 needs to die. It's old, it's dated, it's insecure, it's not standards compliant, it requires web designers and developers to spend countless hours adjusting perfectly standards-compliant websites to render correctly in IE6 when they could be adding cool new features. You know the drill by now!

So, how do we get people to dump IE6? I think Microsoft have probably done everything reasonable to get people to move to IE7 or IE8, but a hard core of users just won't budge. By and large these users fall into the following groups:
  1. Corporate users - that is, people using IE6 on their desktops at work. It's well known that IE6 usage drops substantially at weekends so this probably represents a lot of people. Where I work we're still on Internet Explorer 6, but the reason for that is that we use a lot of custom web applications which were designed specifically for IE6, and if they changed browsers they'd have to convert these web apps to be standards-compliant. One day they'll have to update them, but there's no sign of that happening anytime soon. It's not the user's fault (there are many, many posts on the intranet forums at work bemoaning the fact we're still stuck with IE6) and most of them would rather use a better browser at work since there are a number of very useful web applications which IE6 works terribly with (Google Maps is a good example).
  2. People who don't know any better and don't see the need to upgrade - this might include the elderly or other non-computer savvy people who've disabled Windows updates for some reason (maybe because they find it makes things slower).
But why are we letting these groups hold the whole future of the web back? By bending over backwards to support these people, we're prolonging IE6's shelf life, and making it easy for people to continue IE6 when we really don't want them to! It's simple to upgrade your browser or switch to a new one, so why are we propping up a minority who can't be bothered?

I'm beginning to think that we ought to draw a parallel with digital television. In many countries, the digital and analogue signals have been coexisting for some time, and now we've begun switching off the analogue signal. We aren't bending over backwards to support people who haven't got a digital television or Freeview box yet - if you haven't got one when they switch off the signal, you're going to be watching a blank screen. With web browsers, we don't expect people to make any financial outlay - we just want them to click on a link, so I think it's much more reasonable to cut them off from our content unless they switch browsers.

Ultimately, it's the decision of the person who wants to make a website whether or not to support IE6, but I think we need to be a little harsher than we have in the past. Google are beginning to drop IE6 support, and I'm sure more people will follow. By catering for the remaining IE6 users, we may well be prolonging its usage, and perhaps we need a big stick to encourage users to switch to a newer browser. Of course it's a difficult decision to make if you're hoping to attract customers to a commercial website since if website A and website B both sell the same product but the customer's browser doesn't work on website A, he's going to go to website B instead.

Thursday 11 February 2010

Moderation on

Due to spamming, I've reluctantly decided to start moderating comments on this blog. I don't want to do so, and regret having to take this step, but it was getting really annoying.

Don't let this put you off commenting - feel free to do so as long as your post is not spam.

Tuesday 19 January 2010

The rise and rise of Unix

It's weird that Unix is often regarded as something old and dated, often by consultants trying to sell you on Windows. Often they'll try and make out that it's too hard to use, too arcane, and generally a pain, and that you should be using something more modern. But modern Unixes are powerful, flexible and higly mature operating systems that are less bloated than operating systems half their age and can be turned to virtually any task.

Put it this way - can you name any other software that has been around as long as Unix and is still in heavy use today? I can think of one, and that's the C programming language, which was to a large extent developed alongside Unix, and in which most Unixes are now written. But I can't think of any others.

(Note: I'm going to be slightly controversial here and in this context, I'm treating all Unix-like operating systems as Unix. Dennis Ritchie, one of the creators of Unix, has said that he regards Unix-like OS's such as Linux as de-facto Unixes, and I'm going with that here.)

If you consider the desktop market, then it's only really the OS with the largest market share (Windows, which I'm treating as one OS for all the versions) which isn't Unix-like. The number two, Mac OS X, is a certified Unix, and then all the Linux distros are Unix-like, as are the BSD's and OpenSolaris. In fact, you have to go pretty far down the list to get to one that isn't Unix-like - probablyReactOS, FreeDOS, or Syllable.

The various Linux distros are generally doing OK at winning market share away from Windows, as is OS X, partly because people just didn't like Vista. Now Windows 7 is out this may stall for a bit, but the release of ChromeOS later this year should mean a few more Unix devices get sold.

Unix also has a majority of the server market, and always has done - it's well suited to use as a server OS, and has an enviable security record. It's also very useful as an embedded OS - many routers use Linux or one of the BSD's for this purpose.

Finally, Unix has been breaking into the mobile OS market for some time now. Embedded Linux-based OS's were used on a few high-end mobile phones for years, and now Palm have developed webOS, which is also Linux-based. Android is shaping up to be a huge force in mobile OS's, and of course the iPhone uses a cut-down version of Mac OS X.

So, for a crusty old OS, Unix seems to be in remarkably good health. It's well-placed to grab a huge piece of the mobile OS market, and has a respectable slice of the desktop. Anyone tells you Unix is old-fashioned, they couldn't be more wrong. Unix has stood the test of time, probably better than Windows has.

Sunday 3 January 2010

Self-appointed guardians of the English language beware!

One thing that really bugs me is how anal many people are about the English language. Last year I had to deal with a case at work where someone told us that he couldn't find a word we were using in his dictionary, and told us we therefore should not be using it, in spite of the fact that it had not been coined by us, but by the industry regulator! I've encountered this kind of petty, small-minded attitude too many times, and it drives me up the wall.

People like that seem to think they're the self-appointed guardians of the Queen's English (that probably covers the entire of the Commonwealth as well as the UK, don't know what people in the US would interpret as being correct English in the same way - any suggestions?) and that they're single-handedly preventing the language from sliding into the gutter. Usually scared by endless Daily Mail articles (along the lines of "Children using text speak in schoolwork/exams! End of civilization imminent!"), these people seem to think that the way people speak or write is an affront to the whole English language. I find this sort of attitude incredibly stupid and ignorant.

Thinking that something is not English because it's not in the dictionary is putting the cart before the horse. The English language predates dictionaries by many centuries, although naturally it has mutated over its lifetime. Although there were other dictionaries beforehand, the first really popular and reliable dictionary was A Dictionary of the English Language by Samuel Johnson, published in 1755. Until dictionaries became popular, words generally had no fixed spelling.

A dictionary is not a definition of the English language, as some people seem to think. It's actually a record of the English language as generally spoken at a specific point in time. The Oxford English Dictionary styles itself as "The definitive record of the English language". A word does not come about by being added to the dictionary (otherwise the publishers of the OED would have to invent them - "Hey, what word shall we invent today? Snungfurbdle? It's going in!"), but by passing into common usage. Once a word is commonplace enough it may be included in the dictionary, but the dictionaries are not the arbiters of what the English language is by choosing what words to include, any more than newspapers are the arbiters of what is going on in the world by choosing whether or not to report it. If a dictionary does not include a number of words that many people use, it does not mean those people are in any way mistreating the English language, it means that by not having a record of those words the dictionary does not paint an accurate picture of the language in its present state and is thus deficient.

Furthermore, many technical terms will never be used by the great majority of people and thus will never gain sufficient currency to be worthy of consideration for inclusion in a dictionary. That doesn't make these terms wrong, they're just not in common enough usage to be worth including.

English is a highly fluid, flexible and ever-changing language, and in practical terms it's almost impossible to pin it down. It's spoken as a first or second language in the UK, US, Canada, Australia, New Zealand, South Africa, India, Pakistan, Kenya, and many other places the world over. With so many different speakers with different dialects constantly influencing each other, and a fast-moving world where new terms are being coined all the time, and others being imported from other languages, then in practical terms it's unreasonable to expect the language to remain static. If you don't like it, tough!

Wednesday 30 December 2009

A sad day...at least for me

On Sunday I decided to boot up my two-and-a-half year old Philips X58, which came originally with Windows Vista, but now dual-boots the trial version of Windows 7 and Ubuntu 9.10. It had just booted Windows up when, all of a sudden, it died. At first I thought maybe the power had gone, as the power supply was pretty worn out, but it had the battery in and as far as a I knew it had some charge in it. I tried pressing the power button, which did nothing, and that's when I started worrying because even if power wasn't reaching it from the power supply and the battery was discharged, there would be enough power left to get the battery warning light to flash, but nothing whatsoever was happening.

I noticed that the light on the power supply was flickering, rather than being steady, so I googled it, and apparently that normally means power is reaching the adapter, but can't be passed on to the computer. A bit more research led me to believe there were several possibilities:
  1. The power supply was broken.
  2. The connection from the power socked on the computer to the motherboard was broken.
  3. The fuse in the power supply had blown.
  4. The motherboard had been fried by a power surge.
Ominously, there was a faint whiff of burning from inside the computer. I took the back off to have a look and couldn't see anything obviously wrong with it, so I figured I had to eliminate the power supply as an option. So I ordered a new power supply for it.

This came yesterday, so I tried it with the laptop, but it was the same story - flickering green. So it looks like the motherboard on this machine is gone. Humph, just the Christmas present I want...

This is frustrating because the machine isn't actually that old (half as old as my Dell Inspiron). I have also noticed one of the hinges has a crack in it. I'm looking into how much it might cost to repair it, but it's a rather awkwardly-designed laptop and I'm really not convinced it's going to be a worthwhile proposition repairing it. So it's likely I'm going to have to replace it.

I was actually considering the possibility of buying a new one with Windows 7 anyway (even though I last bought one only in October, a Dell Mini Inspiron with Windows XP), so this does at least come as a valid excuse to buy a new machine. Despite my preference for Unix-like OS's, I do still like having the option of using Windows around.

I'm thinking probably another Dell - despite what so many people seem to say about Dell, all my Dell's have been great computers. My Inspiron I bought in 2004 is still going strong, and my Axim PDA works well too. The Mini Inspiron has also proven to be a good machine in the short time I've had it. My dad's Dell desktop was hit by a power surge last year which damaged the motherboard but would still power on (it just had regular BSOD's) so it was more resilient than my Philips, and it was easy to repair. I've found Dell's to be simple, reliable, efficient machines, and that suits me fine. The only issue I've had with them is the crapware they install, and even Apple do that (cough...iWeb...cough).

Maybe I should branch out into getting a desktop as I've always had laptops in the past?

Friday 18 December 2009

RATM for the Xmas number one!

Just wanted to voice my support for the campaign to get 'Killing In The Name' by Rage Against The Machine to the 2009 Christmas number one slot in the UK! I harbour no illusions about it changing the face of the music industry or getting The X Factor off our screens or anything like that, but it'll be worth it just to piss off Simon Cowell! I already have the album, but I bought a copy for precisely that purpose!

If you're in the UK and haven't bought it yet, here's a link to buy it on Amazon. At 29 pence, it's an absolute steal!

Thursday 17 December 2009

Validation

It can be quite hard to tell whether your programming skills are up to scratch if you're not doing so professionally or otherwise producing code that will be scrutinised by others, such as for an open-source project, or being taught in a classroom environment. You can't help but think "Am I doing a good job?", and it's difficult to get outside validation.

So today, when I came across a blog post referring to the FizzBuzz Test I thought I'd have a go. I decided to use Python as that's the language I know best, but I was a bit concerned about being a bit rusty as I haven't done much Python coding for a while due to concentrating on other things. As it turns out I needn't have worried. Here's the code I came up with:

def fizzBuzz():
for i in range(1,101):
if i % 3 == 0 and i % 5 == 0:
print "FizzBuzz"
else:
if i % 3 == 0:
print "Fizz"
elif i % 5 == 0:
print "Buzz"
else:
print i

fizzBuzz()

Not too shabby, and if this blog post is correct, it puts me ahead of a few people who are already working as full-time programmers! After doing that, I felt a bit better about my skills.

I wrote a Python script a few months back when at work we had to use one Excel spreadsheet among many, many people to update some details. If you've used Excel a lot, you may know that this can be a recipe for disaster - if you have sharing disabled, only one person can use it at once (and inevitably someone will go to lunch with it open), and if it's enabled you run the risk of someone overwriting what you've just entered. In frustration I wrote the following Python script to allow me to update the file without going into it. Please note that it requires the xlrd and xlwt modules:

# Spreadsheet Updater
# Written to allow an Excel spreadsheet to be updated automatically without opening it manually

from Tkinter import *
import xlrd, xlwt, datetime, tkMessageBox

class Application(Frame):
"""GUI application that takes data to be input into a spreadsheet. """
def __init__(self, master):
""" Initialize Frame. """
Frame.__init__(self, master)
self.grid()
self.create_widgets()

def create_widgets(self):
""" Create widgets to get information to enter into spreadsheet. """
# create instruction label
Label(self, text = "Enter details for a new entry in the current spreadsheet (saved as Current Month)").grid(row = 0, column = 0, columnspan = 4, sticky = W)

# Policy Number
Label(self, text = "Policy/Scheme Number").grid(row = 1, column = 0, sticky = W)
self.policy_no = Entry(self)
self.policy_no.grid(row = 1, column = 1, sticky = W)

# System
Label(self, text = "System Number").grid(row = 2, column = 0, sticky = W)
self.system = Entry(self)
self.system.grid(row = 2, column = 1, sticky = W)

# Log Ref
Label(self, text = "Log Number").grid(row = 3, column = 0, sticky = W)
self.log_ref = Entry(self)
self.log_ref.grid(row = 3, column = 1, sticky = W)

# Name
Label(self, text = "Name").grid(row = 4, column = 0, sticky = W)
self.ph_name = Entry(self)
self.ph_name.grid(row = 4, column = 1, sticky = W)

# Reason for Change
Label(self, text = "Justification for change").grid(row = 5, column = 0, sticky = W)
self.reason = Entry(self)
self.reason.grid(row = 5, column = 1, sticky = W)

# Incorrect Data
Label(self, text = "Incorrect Data").grid(row = 6, column = 0, sticky = W)
self.incorrect = Entry(self)
self.incorrect.grid(row = 6, column = 1, sticky = W)

# Correct Data
Label(self, text = "Correct Data").grid(row = 7, column = 0, sticky = W)
self.correct = Entry(self)
self.correct.grid(row = 7, column = 1, sticky = W)

# Spacer to separate Correct Data from Validated
Label(self, text = "").grid(row = 8, column = 0, sticky = W)

# Admin Validated
Label(self, text = "Have Admin validated change?").grid(row = 9, column = 0, sticky = W)
self.validated = StringVar()
admin_validate = ["Yes", "No"]
admin_column = 1
for entry in admin_validate:
Radiobutton(self, text = entry, variable = self.validated, value = entry).grid(row = 9, column = admin_column, sticky = W)
admin_column += 1

# Admin Informed
Label(self, text = "If not validated, Hand off to Admin method done?").grid(row = 10, column = 0, sticky = W)
self.informed = StringVar()
admin_inform = ["Yes", "No", "N/A"]
admin_inform_column = 1
for entry in admin_inform:
Radiobutton(self, text = entry, variable = self.informed, value = entry).grid(row = 10, column = admin_inform_column, sticky = W)
admin_inform_column += 1

# Admin details
Label(self, text = "Admin Details").grid(row = 11, column = 0, sticky = W)
self.admin_details = Entry(self)
self.admin_details.grid(row = 11, column = 1, sticky = W)

# Processor
Label(self, text = "Owner").grid(row = 12, column = 0, sticky = W)
self.processor = Entry(self)
self.processor.grid(row = 12, column = 1, sticky = W)

# Create a submit button
Button(self, text = "Click to submit", command = self.update_spreadsheet).grid(row = 13, column = 0, sticky = W)

def update_spreadsheet(self):
""" Create a Python list containing all the values from the application, plus the date, and append it to the spreadsheet. """
# get the date
raw_date = str(datetime.date.today())
year = raw_date[0:4]
month = raw_date[5:7]
day = raw_date[8:10]
date = str(day + "/" + month + "/" + year)

# get policy number
policy_no = self.policy_no.get()

# get system
system = self.system.get()

# get log ref
log_ref = self.log_ref.get()

# get name
ph_name = self.ph_name.get()

# get reason for change
reason = self.reason.get()

# get incorrect data
incorrect = self.incorrect.get()

# get correct data
correct = self.correct.get()

# get Admin Validated
validated = self.validated.get()

# get Admin Informed
informed = self.informed.get()

# get Admin details
admin_details = self.admin_details.get()

# get processor
processor = self.processor.get()

# create a Python list to hold the elements for adding to the form
new_entry = [date, policy_no, system, log_ref, ph_name, reason, incorrect, correct, validated, informed, admin_details, processor]

# If an element is empty, bring up a warning and break out
all_complete = True

for entry in new_entry:
if entry == "":
all_complete = False
break

if all_complete == True:
try:
self.write_to_spreadsheet(new_entry)
self.confirm_message()
except:
self.fail_message()
else:
self.incomplete_message()

def write_to_spreadsheet(self, new_entry):
""" Method to import the contents of the spreadsheet to memory, then save it again, overwriting the original. """
# Import the spreadsheet as a Python list with a nested list for each individual row
book = xlrd.open_workbook("Current_Month.xls")
sheet = book.sheet_by_name("Sheet1")

entries = []

for i in range(50000):
# if the first cell of the current row is empty, break out of the loop
try:
entry = []
for cell in sheet.row_values(i):
entry.append(cell)

entries.append(entry)

except(IndexError):
break

entries.append(new_entry) # Add the new entry to the spreadsheet

# Write the resulting list back to the spreadsheet
new_book = xlwt.Workbook(encoding="utf-8")
new_sheet = new_book.add_sheet("Sheet1", cell_overwrite_ok = True)
i = 0
for entry in entries:
j = 0
for item in entry:
new_sheet.write(i, j, item)
j += 1
i += 1

new_book.save("Current_Month.xls")

def confirm_message(self):
# Display a message confirming input processed
tkMessageBox.showinfo("Confirmed!", "New entry confirmed!")

def fail_message(self):
# Display a message warning input failed
tkMessageBox.showerror("Error!", "Error in writing to spreadsheet!")

def incomplete_message(self):
# Display a message if not all fields are completed
tkMessageBox.showwarning("Incomplete!", "Warning! Form not completed in full!")

# main
root = Tk()
root.title("Spreadsheet Updater")
app = Application(root)
root.mainloop()


Sadly, it doesn't show up well in Blogger - the ends of some lines are chopped off. I was quite proud of it - it does the job I wrote it for, which is all I can ask, and it looks fairly elegant to me. Sadly, I wasn't able to use it at work as it would have required everyone who needed to access the spreadsheet to have Python installed, and I was not able to get this (I won't go into why, but I do understand the reasons I was given, and they were pretty good, and potentially I could have done the same thing in VBA, if I knew it, without needing to install any software).

This put a damper on what I would like to have done next - written a second script to export the contents of the Excel spreadsheet to an SQLite database, then created an amended version of the updater to update the database instead of the spreadsheet, then finally written another script to export the contents of the database to another spreadsheet, thus enabling us to use a database to record the data in the first place (a much better solution!) while still retaining the option of getting it in spreadsheet form if necessary.

So I had this code just lying around, without a use. I've therefore submitted it to Useless Python - as at right now it hasn't been accepted yet, but hopefully it will be. I'm looking forward to people's feedback about it - for that matter, please feel free to comment here! I would welcome any constructive feedback.

In the last couple of years I've learned HTML, and a fair bit of Python. Earlier this year I finished my CIW Foundation course, and then spent a couple of months studying C. Even though I kind of got stuck on pointers, I learned quite a bit, and now any programming language whose syntax is based on C is a lot easier.

I'm also beginning to understand why so many experienced programmers say that they can learn a new language in a week or so. I'm now studying JavaScript and much of the syntax is almost identical to that of C, so it's very easy to pick up the core language itself. Also, a lot of concepts are common to virtually all programming languages - if/then statements, while and for loops are near-universal, for example, so you only have to learn them once.

I've now bought the books for the CIW Master Enterprise Developer certification, and it means I'm going to have to learn JavaScript, Perl, PHP and Java, as well as classic ASP and SQL. Assuming I complete it, I will have qualifications to validate my abilities, but for my money that's not what makes a great programmer.

A great programmer is someone who writes code that does the job efficiently, but is also elegant and easy to understand. Qualifications can't tell you how elegant or efficient your code is, nor how readable it is. And this is where it gets really hard to get validation - you can know your code works, but it's very difficult to know if it's good code if you don't have a wealth of experience.

Wednesday 25 November 2009

Google Wave invites

The other day I signed up for Google Wave, and I've now been sent a load of invites. I've tried to give them away on Twitter but no-one seems to be interested right now!

I've still got 13 left as at right now, so if you'd like one, please leave your email address in the comments below and I'll send you one, subject to availability. Naturally, for your own sake I'd urge you to obscure it in some way, such as bob(AT)example(DOT)com instead of bob@example.com, to help stop it being harvested by spammers.