Programming is really addictive, especially when you are bad at it. Whilst the proficient programmer can deal with their problems in a matter of minutes, bad programmers can spend hours on the simplest of problems. Today I decided to start messing about with some server-side programming for the first time; now I find myself wondering what happened to my Sunday.
This particular form allows anyone to post to your Twitter account (and then displays the comments that have already been posted):
Way back in April I wrote that the answer to Bill Thompson’s “Who will write tomorrow’s code?” may be found amongst the Eee PC generation of users. However, after having my programming interest piqued once again by last week’s Python workshop, I discovered I had regularly been carrying another device around that could have Python easily installed: my N95. Whereas the Eee PC takes programming out of the bedroom into the community, programming on the mobile phone takes portability and sharing to a whole new level. Even more importantly, mobile phone programming would instantly grab the attention of the younger generation. Mobile phones are filled with their music, their videos, and their friends. Enabling users to create applications that use the data they already have (and more that they can download) can’t help but be popular.
Python is easy to install directly onto the mobile phone (nb. you need to install the PythonScriptShell as well as PythonForS60), and by installing simple text software (such as Light Notepad) you can program directly on the mobile (albeit rather clunkily) rather than having to send it across from a PC.
Whilst Python for the S60 has now been available for a couple of years, you get the distinct impression that it is only really popular amongst those people who would be programming anyway. Surely its time that it went mainstream and introduced more people to programming. The solution to the perceived programmer shortage would seem to be in people’s pockets.
Python is a really simple programming language for the novice programmer. As such I held an afternoon’s “workshop” for a couple of PhD students in my front room: The aim of the workshop was to provide sufficient information about programming in Python so that at the end of the afternoon the user could: -Install Python libraries -Download information through various APIs -Manipulate the downloaded information. As it was necessary to create an extensive slide show, covering everything from installing Python to getting data from the Yahoo API, I thought it may potentially be of interest to other novice users who don’t know where to start.
It doesn’t necessarily include the quickest or most efficient way of doing things, but it is simple and does the job.
If you have any questions about specific points, feel free to ask…the questions can’t be more stupid than the questions the PhD students asked…and some of the slides could probably benefit from further explanation.
67% of Flickr members have no photos! Whilst Lotka’s law teaches us that the majority of contributors to a community make very few contributions, I was still surprised at the number of members with no photos; after all, I am not talking visitors to the site, but those who have taken the trouble to join. What is the point of joining Flickr if you are not going to put photos on the site?
Data was collected about the number of photos for 324 randomly selected users. 216 had no photos, an additional 58 had less than 20, with only 50 having over 20: Really I should have a look at whether these missing users are active in other ways, (e.g., members of groups, leavers of comments), but this was little more than an aside as I spend my time messing about with Python. I have now loaded Python on my main computer as well as my Eee PC, and can barely believe how easy it is!
Already I have been writing codes in python that use the Twitter, Flickr and Digg API, programs that can form the basis of numerous articles that I will never get around to writing…it’s SO easy (with the possible exception of installing the simplejson library that the Twitter library relies on). Just wish some other sites would roll out APIs (e.g., Stumbleupon and Reddit).
So, do we all need to become top-class programmers? No. But if you can program, even to a basic level, the web becomes a lot more exciting and interactive place.
Until yesterday I hadn’t really thought about programming on the Eee PC, but once I started looking I was surprised how easy it was: Unbeknown to me, it has had Python 2.4 and 2.5 sitting there the whole time! Despite not being a particularly competent programmer, I found Python to be very user friendly, and look forward to programming on the Eee PC in a variety of settings in the future. My first Python program was used to find random Flickr users:
> import flickrapi > import random > api_key = ‘XXXXXXXXXXXXXXX’ > for counter in range (1,1000): >>> flickr = flickrapi.FlickrAPI(api_key, fail_on_error=False) >>> a=random.randint(1, 99999999) >>> b=random.randint(0,1) >>> c=random.randint(0,9) >>> d=str(a)+”@N”+str(b)+str(c) >>> photos = flickr.photos_search(user_id=d) >>> if photos['stat'] == “ok”: >>>>>> print d > print ‘done’
Webometric studies are always searching for ways of finding random users, unfortunately I have no idea how Flickr assigns its user_ids. O’Reilly’s “Flickr Hacks’ says:
“…a string of numbers, followed by an at sign (@), an N, and two more numbers (often 00 or 01)…”
Not exactly specific. The program calculates a number up to eight digits long before the ‘@N’ and from 00 to 19 after the ‘@N’. Whilst most may be 00 or 01, I found them as high as 08. If anyone knows of any user_ids not included in these parameters, please let me know.
Sending 1,000 queries, 10 random users were identified. Not exactly efficient.