Showing posts with label commentary. Show all posts
Showing posts with label commentary. Show all posts

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 :(

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+.