Blog moved and summit bitesize

I’ve moved my blog from wordpress.com to nigelb.me. I originally planned to run wordpress here too and export my posts from the old blog here. Unfortunately, that ran into problems. My VPS wouldn’t run nginx + php-cgi + mysql at the same time. Every time I tried, I would run out of memory. My first instinct was to increase the RAM, which I did. But, I looked for a better solution. My friend suggested Jekyll. In Jekyll, basically, the posts are written in markup and then converted to HTML files. That got me interested, I could eleminate php and mysql out of the picture. That’s a lot of memory saved to do other things. It took me a fair few number of hours to set everything up. But I’m very happy with the security (no admin panel really) and I’ve used git hooks so I write a blog post on my computer and push to the repository, which updates the live site. Awesome and geeky. With a bit of effort, I’ve gotten RSS feeds and comments working too.

Now, the other thing about summit. If you’ve ever participated in a UDS, you probably know summit. You’ve probably griped about it a couple of times, haven’t you? 😉 Well, you should also know that summit is open-source and built on Python/Django. Right now, we’re looking for fresh blood to come and join us. We’ve fixed a bunch of bugs post-UDS and we’re looking for more people to join us in the fun. I’ve tagged a few bugs as bitesize. They are quite easy and if you need help setting up the environment and actually going about fixing the bug, please feel free to ping me (nigelb), Michael Hall (mhall119), or Chris Johnston (cjohnston) in #ubuntu-website on irc.freenode.net. If you’re a web developer who wants to contribute to community projects other than summit, please take a look at the Community Web Projects. I believe we have enough for everyone 🙂

Fixing Launchpad Bugs

At UDS, I met the Launchpad folks, who encouraged contributions to Launchpad itself in a couple of sessions. I’ve tried twice before and always get stuck with the getting a virtual machine set up stage. This time, I decided that I’m going to skip that step and go ahead and install it on my lucid laptop. As soon as I got back, I looked at getting the launchpad source code. rocketfuel-setup is a 400-line shell script that does the heavy lifting of the installation for the user. After having written such a script at work, I have huge respect for the author of this script 🙂

After installing, I looked around for a simple bug to fix and picked [bug1][bug 645825]. The bug appeared easy enough to fix and I had a fix ready in a few minutes. I proposed a merge and was told that it needs work. It needs test cases! Another day I spend with poolie, jml, and gmband a few hours of learning to write test cases for Launchpad. Gmb and I used etherpad to collaboratively write the test and I’ll be honest, that was great fun and very productive. Multiple tries and we finally got it right and he landed it in ec2 for the entire set of tests to run. The tests failed.

I quickly popped by #launchpad-dev and wgrant and mwhudson helped me fix and wgrant landed it into ec2 for me. It passed and I did a qa on qastaging.launchpad.net! I’ll be honest that it was an extremely proud moment. This kind of made me want to fix another bug and I found bug 203478. This was something that did irk me before UDS. This time, [deryck][deryck] helped me with writing the test cases correctly first, watching it fail, fixing the bug, and then watch the test succeed. Did something hugely silly this time. I was running the test in a new branch and writing code in the devel branch, which would lead to test not being found, fix not being effective and a bunch of problems. Lesson learned is to use only my branch never the devel branch.

Overall, I liked fixing LP bugs though I’ve been told that its a brave move. The Launchpad developers have been extremely friendly and welcoming for new community developers. I think I’ll take more time to figure out the more complex bugs, but its fun helping fix the ones I can.

Edit: I missed mentioning – Launchpad can’t take a patch until you’ve signed the contributor agreement.

Ubuntu Developer Day!

A long awaited blog post about the Ubuntu Developer Day. [Jorge][jorge] has been saying ‘PICS OR IT DIDNT HAPPEN!’for a while now. Anyway, I got all the pictures today morning finally. I don’t remember how I first heard of Ubuntu Developer Day, but I remember registering within minutes of it being announced. I got a text the previous night reminding me that the registrationswould start at 8:15 am and the sessions would start at 9 am. The area where the conference was happening was quite close to my place, but with the morning traffic, it took almost 30 minutes for me to get there. I went along with 3 of my colleagues who’d also signed up.

Once we got our ID cards, we had a cup of coffee (the daily caffeine dose 😉 ), and moved into the conference hall to get good seats. I’m guessing there were enough chairs for at least 450 people there. I’m guessing there were a few people backing out, because later we saw a ID cards that weren’t claimed. Still the crowd was BIG!

John Bernard from Canonical acted as the MC for the event and we started with Prakash Advani welcoming us. We learned that people had come from Sri Lanka and Himachal Pradesh (that’s 2400 km away!) to be here. After the welcome was John Bernard’s where we are. He started with the Discover Ubuntu commercial. I’m guessing a lot of people have already seen it. It set the mood for the rest of the day I guess.

Then came Jon Melamut’s keynote. He talked about the chasm among other things. The talk was mostly things I’d heard of before and for my colleagues it was very interesting to hear about it. I don’t remember a lot of the talks. I should perhaps have taken notes. The talks were too interesting to take notes and I’m hoping the slides will be up some time today.

After Jon, Dipankar Sarma from IBM’s Linux Technology Center talked about the work IBM has been doing in the Linux space. His talk was at the kernel level and perhaps went a bit over my head. After his talk, I saw Ritesh, a Debian Developer I know, standing up and asking a few questions. We broke for coffee and I chatted with Ritesh for a minute or two before getting back in.

After the break, Chase Douglas talked about the work on touch support in Ubuntu. This was a talk I was looking forward to. I had demo’d the touch devices there and it was really cool to try it out. Chase did a really nice session and kept things interesting.

Nick Barcet took over for the next 2 sessions. He took the pre-lunch and post-lunch session. Now those are the traditionally more difficult sessions to keep people interested. I have to say, he did a marvelous job of it. It was great to see the work Canonical has been doing in the cloud and server and how things are going.

After Nick, we had a talk from Freescale and then another talk by Chase about Launchpad and Bazaar. I had fond memories of doctormo teaching me about Launchpad and bzr about 2 years back or so. During lunch earlier, I’d met Hardik and he showed me the multi touch demo. I got to see a number of computer manufacturer’s in India selling with Ubuntu pre-installed. Now, I know how which laptop to buy if I buy a new one. We also got goodies! Everyone got a bag which had a T-shirt, a pen, a CD, a sticker, a notebook, and a few of the handouts about Unity.

Then came the Marvel Keynote. It was mostly talking about products that Marvel has developed and how its used in a lot of places. Then came the session perhaps everyone where looking forward to, ‘Getting commercial applications to Ubuntu users’ by Randy Linnell. Most of the talk wasn’t something new to me, but the audience was quite interested in the talk. I was tweeting quite a bit during a few of the talks. We didn’t have access to the hotel wifi, so I was using my colleague’s internet connection to tweet.

Finally, we had a wrap up from Prakash and the audience started trickling out. I stayed back a bit and talked to the Canonical team who’d come down. Later, I grabbed a cup of coffee down at Barista and probably left the hotel at closer to 7 pm 😉

Noname.unconf Report

This post has been long pending to be honest. We had a Noname.unconf planned in Bangalore on 18th and 19th December. The venue we planned was Jaaga. It was meant to be a fun place to meet a bunch of hackers with some talks planned. I met lifeeth, neena, and Hobbes` the previous night when they were setting the place up.

On Saturday when I walked in, I sat at the registrations table, signing up people who came. We had about 40 people come in. Interestingly, it was tazz’ and lut4rp’s birthday. There was cake and candles and a lot of fun ensued. I met with a small subsection of the hacker scene that day and it was awesome. Lot of geeks. Geeks are different things. Geeks at networking, web design, sys admin, mathematics, and more. We were planning on a conf app that day and decided to write it general purpose so it could be adopted any day. Later that night, we went for dinner together recounting the experience of the day. Again, good fun.

I went in to day 2 in the afternoon. The talks were going on when I walked in. They were quite interesting including the talk about UID in India, Debian and Ubuntu BoF, to name a few. A few more new people to meet that day and then we packed up. It was a fun weekend of hacking, meeting new friends, and talking to people about stuff.

Working with Google Maps

There used to be a time when there was this huge maps craze, it has since passed, but Google Maps remains the most recognized map applications seen on the Internet. Recently, I worked on Google Maps API for a client. This post is a retrospect look at how it went. I’ve not worked with other map systems, so I cannot compare my experience.

My task at hand was to create a store locater that would take an address as input and plot all the points on a map that was within 100 miles of the given location. A fairly simple map application, except I decided to innovate. My first stop was the articles page on the Google Maps API Reference page. I found a very handy tutorial which was exactly about creating a store, wow that made my work much easier. What I found very helpful from that tutorial was the formula. this formula.

SELECT id, ( 3959 * acos ( cos ( radians (37) ) * cos ( radians ( lat ) ) * cos ( radians ( lng ) - radians (–122) ) + sin ( radians (37) ) * sin ( radians ( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20; 

That is the heart of the entire module. That formula returns coordinates that are within 25 miles of a point with coordinates (37, –122). The complexity (if at all) of the application is to pass data from a database using PHP or other server-side language and passing into a JavaScript function. The tutorial that I was looking at used xml to pass data to the JavaScript function. This of course is nice, but I was a bit lazy and a bit innovative.

In my quest for something better, I discovered JSON. Now, this seemed simple enough since is 2010 and most languages have JSON support including PHP. So, I put all the results into a hidden textbox as JSON and wrote a JavaScript function that would execute on window load. Using that information, I could then loop through it and mark points on the map from that.

jQuery being an awesome library provided a means for me to do exactly that. I could loop through each of them and plot points on the map quite painlessly.

function markOnMap (x, y) {     geocoder = new google.maps.Geocoder ();     //center the map to the coordinates of the searched address     latlng = new google.maps.LatLng (x, y);     var myOptions = {         center: latlng,         zoom: 8,         mapTypeId: google.maps.MapTypeId.ROADMAP,         mapTypeControl: false     }     map = new google.maps.Map (document.getElementById ('map_canvas'), myOptions);     var markers = document.getElementById ('marker').value;     var mapPoints = $.parseJSON (markers);     var marker = new Array ();     i = 0;     $.each (mapPoints, function () {         var latlng = new google.maps.LatLng (this.lat, this.lng);         marker[i] = new google.maps.Marker ({             map: map,             draggable: true,             position: latlng,             content: '<b>Name : </b>' + this.name,         });         google.maps.event.addListener (marker[i], 'click', function () {             infowind = new google.maps.InfoWindow ({ content: this.content });             infowind.open (map, this);         });         i++;     }); } 

When using infowindows, its very important that the content is stored inside the marker and then used to pop out the infowindow, that’s the only way that works. I spend about 5 hours trying to figure that one out.