Monday 31 March 2008

Python hacks: Traceback error solutions via Bug.gd

Wow.

My favorite programmer(s) has just released a cool little python tool to search for your traceback errors on their site. For those of you not familiar with Bug.gd it is a free error / problem troubleshooting site that encourages you to share fixes with other people (if you have them).

When you have a traceback error you can't figure out, rather than fire up FireFox (or whatever) to search Bug.gd, you can now use this tool and type "error_help()". It dumps out a list of all the solutions (if any) into the prompt. If there are no solutions the site gently prods you by email a couple of days later to see if you found a fix: an then to share it!

I have to say this is the kind of thing that will get me using Bug.gd - I liked the idea of the site up till now but never really used it. I generally found Google gave me quicker answers than Bug.gd - and then I clean forget to upload that content to the site (lazy 'ol me). However this ace tool will probably get me using it more often, because it means people will be searching for more errors on the site and so more content.

On top of that the idea just gets me excited - I love integration (especially Web2.0 style integration and sharing) and this is a fine example. What other language gets you user generated error solutions & content from the prompt / IDE!

Plus think of all the tools - theoretically you could put together an auto-fixer to try and fix common errors on the fly (just an idea).

I hope this tool carries on developing: I'd love the ability to send back my solution from the command prompt, inline editing of the error line, sending feedback on errors and so on. Imagine doing this:

# !python <test.py>
0/0

Then run it in IDLE:

>>> import test

Traceback (most recent call last):
File "<pyshell#14>", line 2, in <module>
import test
File "C:/Python25/Lib/site-packages\test.py", line 1, in <module>
0/0
ZeroDivisionError: integer division or modulo by zero

>>> error_help()
========== 1 of 8 ==========
Error: Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

Solution: I divided by zero as a test. Maybe you did the same thing?
The trick is not to divide by zero!
========== 2 of 8 ==========
Error: Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named shinynewmodule

Solution: (Example error and solutions)
I didn't have the shinynewmodule installed.
You can install it via fake_easy_install shinynewmodule

>>> used_solution(1) # gives feedback to the site
>>> edit_error_file(2) # quick edit the line number
Enter the new line: 0/1
>>> import test
0
>>> add_solution("Do not divide by zero - this solution added from IDLE itself!") # and if there were no answers? let me upload one!

Umm yeh, so it's a bit long winded but why not!

This certainly made me feel good:

This is a bit of a hint of some of our long-term plans with our technology. You should give it a whirl and let us know what you think.

Here's hoping for MORE good stuff from the guys.

PS: I really need to sort out my formatting / layout options on this blog.. hand colouring the code there was NOT fun and Blogger doesn't seem to have "code" style blocks :(

Oh How I hate Design

Today I am frustrated, which is annoying.

Let me set the scene. It's a beautiful sunny day, I'm sat in the garden on my laptop casually getting some work done (the frickin birds are tweeting - it's lovely). Nice ice cold drink and no one in the house to disturb me.

So why frustrated? Because the work I'm supposedly trying to get done is the worst kind (for me): design and layout. I'm trying to work on a refreshed Web 2.0 style layout for www.tomnrob.com (which is currently still not built 2 years after we launched it). I hate doing this stuff.

The problem is I am a programmer, and applications developer; art and design is pretty much beyond me. Sadly because I (we) can't afford to hire a top notch designer into the team I have to make the best of it - mostly by cutting, pasting and cropping bought stock images.

I've been at this for about 3 or 4 hrs now (on and off) and it's just annoying!

As you can see it's going to be a cross between "hip" web 2.0 and stylish corporate - at least I hope so!

Despite my (temporary) mood all is not lost! I did find a few awesome resources to help people create web 2.0 style sites and designs. Some of the stuff is well worth a read.

This guy in particular has an amazing amount of content and commentary. I especially like his assessment of the future of the Internet, it has really got me thinking too about how I could develop sites in the future.

He even has created a totally open source "developers" CMS: which seems to be able to let you develop amazing sites really really quickly and roll them out to consumers in record time. I'm definitely seriously considering switching from my usual framework and custom CMS (hah!) to using this simple (but effective) approach.

On top of all that I think I have changed my mind about OpenID again (after the initial excitement stage I went through), thinking it through (and reading up) the security implications are insane! That said the idea is nice and I've been toying with possible ways to make a new form of OpenID that DID have a basis in trust and security - more on that later I think.

I did have a half started posts of some links to things I like to read day-to-day on the net: but I think I'll leave that for another time :)

Sunday 30 March 2008

OpenID: A developers view

I've been looking at putting together an OpenID enabled site (or even making it an OpenID server) - it's quite an interesting idea, if a little complex (from a developers perspective) to get ones head round.

The big problem is that I really am not a fan of long complicated specification documents, or rather I don't mind writing them but reading is just another matter! I will probably have to fall back on hacking around with other peoples code to work out how to do it!

I found a couple of reasonably good examples that I could probably use:

PHPMyId: which is sort of halfway to what I want - it's a single user OpenID system (I'm going to set it up over at errant.livemeta.net and see how it goes). Looking through the code the actual "ask me for data and I reply" system looks fairly simple - just requires trawling through.

Clamshell: which is a full on multi-user OpenID system. This one is a bit more complex but based loosely on PHPMyId. More importantly it has long-term storage and multi-user storage examples that PHPMyId doesn't.

A bit more searching brought up a couple of handy links (OID wiki intro, A pic of the process) looking into the whole process (including one from the surprisingly useful AOL developers network)

Reading through it all the OpenID idea seems clever and logical. You set up a domain name (such as errant.livemeta.net) and provide in the page certain tags linking it to an OpenID provider. Websites making an ID request then talk to the provider (which can theoretically be anyone) and let that work out if the user at the keyboard is the user to whom that domain belongs to (i.e. with a username and password) - returning all this auth info to the original site. Clever eh?

Some people do turn round and say "that's just silly: you still have no idea who they really are", but the fact is would you anyway; it is just a valid (surely) as requiring sign-up using an email address (which can be got anywhere for free). The OpenID wiki intro puts it best (although in obscure terms: Alice is the user at her keyboard and Carol is the ID server/provider she is using):

All we know is that, according to Carol, Alice is who she says she is. If we don't trust Carol, then we really can't trust what she has to say about Alice, can we? But that's OK. What we DO know is that Alice is the same Alice that Carol always says she is, assuming Carol is consistent about this kind of thing. Further, Alice can't pretend to be someone she isn't, at least not without Carol's help. And *even then*, she can only pretend to be someone that also claims Carol as their official identity server. If things ever got this bad, we'd probably just stop paying attention to Carol altogether, as well as anyone who tried to use her as their identity server.

So with a bit of maintenance and thought you should be able to maintain a fairly secure auth system that supports thousands of people that have never actually "registered" on (or even probably visited) your site!

When I first heard of OpenID I was a bit unsure: I really wanted to create my own system. But looking at it that approach is just silly, why not build on an already well established system which will ultimately let me tap into thousands of users.

Creating a provider service seems fairly easy to do. I'm thinking an external address to my main LiveMeta website, maybe something like openid.livemeta.net OR better yet <user>.mymetaid.net, because that means LiveMeta doesn't feel "tied" to my own OpenID system (although obviously it would be closely affiliated :D)

Now after all that I'd better get to it and write some bloody code!

BT & FON are annoying me (Yes, yet more WiFi)

I didn't know BT where doing this but they seem to have teamed up with FON (www.fon.com) to open up their users broadband routers into hotspots (I'll tell you the reason I discovered they were doing this in a sec). I took a bit of a better look into it and on the surface things look GOOD!

Basically the premise is that the routers have 2 networks: a public one and a private one. The private one acts as a normal secured network would do whilst the public one acts as an Internet only access hotspot for other FON users (security - according to them - seems to be OK).

I kinda like this idea, any BT Broadband user (or FON user) can now open themselves up as a hotspot to let other Foneros (the silly name FON gives its users) surf the net as they pass. In fact I just checked it out on the BT site and it seems there are over 10 hotspots within a couple of miles of home - a trend which seems to be mirrored across the country. The really nice thing that FON offers is global surfing: with the same free hotspots service across the globe (well most of the EU and US anyway) - for travelers (something I will be doing in the next few years) and the like it could be a handy service.

As far as I can tell there are 2 ways to get access to this cool global network:

  • Get BT broadband and use their home hub router
  • Buy a FON Fonera (or Fonera+) wireless router

I probably would go with the second one - for freedom. The Fonera+ goes for £39 which is a decent price for the specs and reviews of it seem to be positive. It even seems to update automatically, a great feature I would love to see in all routers!

One of the suggestions I did like was the Skype phone they also do: theoretically meaning you can keep your Skype going anywhere with a hotspot (in practice I guess I wouldn't trail around with it like a mobile but it could mean it is possible to take your phone on holiday etc.), no more need for a landline! The drawback is the phone costs £109 at the moment.

So all in all it seems a brilliant idea: everyone within the FON community can share and share alike.

With all of that said I have 3 major gripes, the last of which is just me being really bitchy ;)

(Yay a list!)

  1. First off they claim the Fonera router is all custom built / coded. Excellent. It occurs to me that they could have then changed the way the hotspots work. Currently you can just connect straight off and have to enter user details to continue. To me a better way would be to implement a new security system: where each Fonero has their own private key, they then connect to the hotspots using this key (the same as a private WEP key for example) and voila. This would mean I could easily get my new phone (that N81 I was going on about before) to use these spots. Not only would this make things cleaner all round it provides some important levels of encryption/security for everyone using the system!
  2. Bandwidth uses: what happens if people abuse your hotspots by streaming crap loads of content and destroying your bandwidth allowance - I can see it happening. I?m not sure if there is some cap or setting to stop this (I haven't dug around enough) but if there isn't it is a big concern.
  3. Why oh why is the whole WiFi standard so crap.. my Laptop keeps trying to connect to the nice BT/FON hotspot near me (which is how I found out about this) rather than my local router; I assume because it requires no passkey to get access, or whatever. As a result whenever I try to load a new web page it keeps loading the BT openzone login page. Grrrr. Implementing my first point would soon sort this out! Yes I know I could spend a little time stopping it from connecting but most users wont be able to and as more spots appear it would quickly become and annoying chore.


It does seem like a good idea: especially considering my comments from yesterday, about needing more hotspots, and that it takes the craze of web2.0/user generated content to the next level. I'm definitely going to look into it and maybe invest in a Fonera+.

Saturday 29 March 2008

Skegvegas

Welcome to my new blog, lets hope I keep this one up a bit more.

Todays post comes live from SKEG-VEGAS: aka Skegness (on the East Coast). What a wonderfully dead place; lots of old people and tired looking shops. I'm stuck here because my brother's playing in some jazz orchestra tonight and my support is apparently essential, not totally sure whether it's going to be decent music but we shall see.

Anyway slightly more interesting is the new phone I got today (O2 love me again and so I got me an upgrade); a Nokia N81 8GB.

The first thing that impressed me is the amount of onboard memory, 8GB. When I got my last phone (A Motorola RAZR) 18 months ago it came with a 512MB upgraded memory: which at the time was really advanced. However I've been trying to work out what I might use it for, and the answer is very little. It does have an inbuilt music player - but I also have an 8GB Ipod (which I prefer for music), so just photos then? How many photo's can I fit on 8GB.. (it's a 2MP camera) ..I'd imagine quite a few; but then I hardly take photo's.

However all may not be lost. The N81 also has WiFi connectivity: which means when Im at home and in public WiFi spots I can browse and check emails (or blog!) for free. This is definitely my favourite feature so far because it means that I can avoid lots of expensive bandwidth bills when I fancy grabbing my emails, my university has free WiFi so that will work out really cheap!

I especially like the idea of picking up my emails 24/7 because it seems an obsession of mine at the moment. 8GB of memory means I can store all my emails and other data on the go really easily. Plus the phone has a PDF reader (admittedly a crappy Adobe one) so I can open documents and what not as well (lecture notes on your phone ftw!). Im hoping the phone's memory will double as a "pen drive" too because that cuts down on something else I need to have in my pocket!

So a big thumbs up so far for this phone: I usually don't like Nokia's that much but it is such a huge improvement on my current phone (an old old old one that used to be my dads) that I can forgive it. I don't have a good run with phones (the RAZR lasted 10 months at most) but this feels a bit more rugged.

Going back slightly to WiFi on phones: this is an interesting subject. At the moment it is limited use - likely most people wont be able to use it in work etc. or have many public access points round about. Really only home use (which kinda defeats the object) is viable at the moment. But, what about a couple of years down the line when the governments plans of public WiFi all over the country may actually happen? At that point it becomes an amazingly useful feature; especially as you can browse / email for free on something you usually have with you 24/7. What about calendar syncing (easily done over the net) to give you instant updates - you could probably get a dentists appointment online and add it to your calendar in no time, all for free.

This is all very well and good but will phone manufacturers carry on bundling WiFi not phones? The N81 proves it is easily possible but will the network providers want it? They must make quite a bit of dosh from web access on phones, so if people can do it for free all the time it is a massive loss of revenue.

Just a thought :D