Archive for September, 2008

Playing with Mercurial styles

As a sort of “Hello World” type of exercise jorendorff recommended that I play around with the styles in hgweb. I had 2 goals to achieve

  1. My mission is to get the gitweb_mozilla style working on my computer
  2. Then edit the templates to make the whole page orange

I downloaded a repository provided by bsmeberg called hgpoller. This would be my development playground. Now, I thought that my next step would be to make changes to hgpoller\.hg\hgrc to change the style. I tried that by adding

[web]
style=gitweb_mozilla

This didn’t work as planned. The style reverted to the default. What I didn’t realize is that Mercurial gets its style specifications from the Mercurial.ini file (in Windows). The style must be adjusted from there. When I added style=gitweb_mozilla to that file the change worked and I got the appropriate result. To make Mercurial take its style information from the hgpoller\.hg\hgrc file I added the following line with some help from jorendorff

[web]
templates=<template-dir>

Now, I can easily make changes to the hgrc file which will be reflected on hgpoller. You may be wondering how do I see the repo in a browser? To do that one needs to use the hg serve command which will start a hgweb server on port 8000 on your machine. Then one can just visit http://localhost:8000/

My objective was to get the gitweb_mozilla style working on my machine but I couldn’t find that style listed in my templates directory. The reason being that I needed to clone that style from hg.mozilla.org (thanks for pointing that out djc).

After getting the style operating the next step involved getting the bugzilla links working. The key to that is the hgpoller\buglink.py file. It has to be enabled by entering the following in hgpoller\.hg\hgrc

[extensions]
buglink=<path-to-buglink.py>

After doing all that I was finally able to achieve my first goal which gave me this result http://sidkalra.com/files/mercurial/my_gitweb_mozilla.png

The next step was to alter the style, in this case change the whole page to orange. To do this one has to alter the <your-template-folde>\static\styles-gitweb.css file. I added the background-color attribute to the body area and set it to orange like so…

body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; background-color:Orange; }

which gave this result http://sidkalra.com/files/mercurial/my_gitweb_mozilla_orange.png

Mission Accomplished!

, , ,

No Comments

Mercurial - Installation and beyond

I had a chat with the jorendorff today about what I need to do to get my Mercurial (aka hg) project rolling. He outlined the steps we should look to take…

  1. We have to make sure you understand hg
  2. We have to decide on some very small thing that you can get running very soon
  3. We should talk it over and make sure it’s clear how to do it
  4. We should plan to meet up later and brainstorm some, once you’ve had a chance to play around with hg

I can add another point to this. I need to decide what exactly I will be doing for my 0.1 version release. Right now I don’t have a clue. But first things first, I need to install and play around with hg. Here goes…

Installation

I will be installing on Vista (yeah, I know what you’re thinking but seriously, it works fine) so I need to find a windows installation. The installing Mercurial guide recommends just installing MozillaBuild since hg comes packaged with it. But I rather not do that at the moment because I don’t need the rest of the tools from MozillaBuild. Well, I was in luck since there are binary packages for Windows here and even Mac. So I downloaded the binary and went through the installation.

Now to check if hg installed properly just head to the dir where you installed it (using cmd) and run hg.exe. Then type hg version to get the version info. You should get something like this…

Version Check

Now, I needed to make some changes to a config file. All the guides I read were telling me to make changes to a hgrc file but I couldn’t really find any config file with that name. It turns out you need to make changes to Mercurial.ini file for windows and the hgrc file is for UNIX systems. Here you need to tell hg what merge program to use. I decided to go with TortoiseMerge since I am already familiar with TortoiseSVN.

Downloading Mozilla Source

Now to get to the real part. All the preliminary work leads up to the moment of truth! Downloading the Mozilla trunk source! Now to do this you need to use the hg clone command and pull from http://hg.mozilla.org/mozilla-central/

One thing that hg desperately needs is a way to know your download progress. If you haven’t ever downloaded the Mozilla source then let me just tell you that it is HUMONGOUS! I’m not kidding. It took forever to download it. Ah, command line tools, you win some and you loose some.

Beyond

What’s next after downloading the source? Well you can do many things i.e. pull a file and make changes to it then push it back in and much much more. Since I will be working with everything related to history I decided to try out the hg log feature. This command, by default prints each change recorded to the project. Each of these recorded events are known as changesets because they can contain records of changes to several files.

I will continue to play around with hg and hopefully make progress. Meanwhile jorendorff has a post on his blog about hgweb in which he’s calling for ideas to improve it (this will be my job) so go over there and contribute!

, , ,

No Comments

Mozilla Developer Days Toronto

Last week Mozilla held a Developer Day conference at Seneca College. This brought various Mozilla developers from its Toronto and California offices to Seneca to talk about all things Mozilla. The conference lasted for the entirety of two days with various people presenting different types of Mozilla technologies.

I got to sit in during one of ctalbert’s presentations. To be frank a lot of what he said went straight over my head. I wish I had better understanding of what he was talking about but that would have required me to do some preparatory work. I even got to talk to ctalbert for a bit about the Private Browsing Tests project during the BBQ lunch because at the time I was thinking about choosing that as my project. In the end I picked the Mercurial project but still it was interesting to learn a bit more about this upcoming Firefox feature.

The presentations were divided into two tracks, the desktop and web track. The presenters talked about XUL, XPCShell testing, Mochitest testing, memory leak testing and much more. Unfortunately I couldn’t attend many of the presentations because of class. I wish the conference could have been held on a weekend but I’m sure many people would object to that, which I totally understand. Surely many other people that wanted to attend couldn’t do so for various reasons but not to worry since videos of all the presenations will be coming very soon. Keep checking the wiki page for further details.

, ,

No Comments

Mercurial, A Distributed Version Control System

Well, I’ve finally decided on my project for this open source course. I am happy to report that I will be working on Mercurial. For anyone that doesn’t know it is a Distributed Version Control Sytem (DVCS). Now if you are like me you’re probably wondering what in the world that is? Is it like subversion or CVS, if not then whats the difference? Let me explain…

Centralized Version Control System (CVCS) vs Distributed Version Control System (DVCS)

  • CVCS focuses on synchronizing, tracking and backing up files
  • DVCS is for sharing changes. Every change has a GUID
  • Downloading or Recording  and applying changes are all separate steps while in a CVCS the happen together
  • DVCS would be suitable for larger projects with many developers

Mercurial is now used to house all Mozilla source. One of the advantages of a DVCS like Mercurial is that it frequently has branches and merges. The downside of this is that the history can become complicated and confusing very fast. For the project my job will be create a hopefully awesome browser-based UI for navigating Mercurial repository history. But before we can get to that it is important to understand how Mercurial iteself works. One can find a great getting started guide to Mercurial here. Have a read if you are interested.

Now my next task is to quickly get in touch with people who can guide me in the right direction and get me started on this project. But first I’m going to try to download Mercurial and pull the Firefox source with my own two hands. I hope to have my experiences on here in the coming week…

, , ,

No Comments

Picking an Open Source Project

Well the time to choose my project for the open source class is approaching very quickly. I’ve narrowed my choice down to 3 now. But I’m still in a dilemma. Which one should I go with? Well, lets look at my choices first…

I find all three to be interesting and would love to do all of them in fact. However, I need to choose one (Must follow the rules, am I right?). Lets have a closer look at each of them…

Contribute to Private Browsing Tests

Firefox is implementing a new private browsing feature that will allow users to conduct their activities on the Internet without leaving any traces behind. Chrome and IE 8 Beta have already implemented this feature and Firefox doesn’t want to be left behind. I would love to be part of this effort. Privacy is something that every user craves on the Internet and at the moment there is very little of it. Implementing this feature would definitely put Firefox in the same league as its competitors in terms of user privacy. Contributing to such a pivotal feature definitely interests me.

Create Self Serve Symbol Upload System

Mozilla has a symbol server that developers use to debug issues in release builds that don’t have debug information.  Many crashes are related to third party plugins or add-ons. This project would involve setting up some way by which plugin or add-on developers could upload their symbols. It apparently involves web development, which I am very fond of. I don’t know much about symbols so that has me a bit perturbed. Nonetheless I wouldn’t mind in the least bit to work on this project.

Help Calendar Integration on Trunk

To be honest I don’t know much about this project. I definitely prefer the other 2 projects above. This is more of a backup project for me. As far as I know trunk is the main Mozilla source tree and this project mandates that a calendar be setup to integrate with trunk. I’m not exactly sure how this would be useful or how it would be implemented but I’m willing to find out.

To be perfectly honest right now I’m leaning heavily towards the private browising tests project. I’ve contacted the main resources, Ehsan and Marcia and they’ve given me further details about the project. I’m hoping to meet couple of the QA guys coming to the Mozilla Developer Conference here at Seneca to have a chat so that I can get more details about the project. Hopefully by Monday I will have decided which project I will persue so be on the look out.

, , ,

No Comments

Ubiquity, a Firefox Extension

In our last open source class Dave asked us to work through a lab where we worked with Ubiquity, a Firefox extension. So, I had a go at it. I installed it and read the articles that introduce the add-on to a new user. I have to say that it it quite useful and intuitive. Although the extension is not yet at version 1.0 I think I will still use it. I have to say I’m a bit eccentric about extensions. I love using them and playing around with them. I can’t live without them, to be honest. Ubiquity is just another addition to my ever growing add-on list.

Ubiquity adds great convenience to your browser. It’s basically a command line tool for performing browser tasks. Anybody that likes working with an easily accessible command line will greatly enjoy this extension. All one has to do is press ctrl-space (on Windows) and ubiquity will appear in the top left corner of your browser, ready to use. Now, all you have to do is enter the right command and it will do your bidding.

One feature that I’m particularly impressed with is the ability to email your selection. This can include links, pictures and anything else. To do this all one has to do is select whatever you desire, press ctrl-space and then type “email this to [recipient's email]” or “email selection to [recipient's email]” or “email it to [recipient's email]“. Very useful if you ask me.

Ubiquity has many built-in commands that come with the add-on but it also allows users to put on their programming hats and do a bit of coding themselves to create their own commands. This feature is great since the users are no longer limited by what the developers put into ubiquity. If you feel that there should be some command in ubiquity that isn’t there currently, then you can code it yourself. This is a great example of how open source works. Users can very easily become developers and hats off to the Ubiquity development team for making this transition as seamless as possible.

I tried my hand at making my own commands. I began by coding a simple user search for our zenit/wiki.

1
2
3
4
5
6
7
8
9
10
11
12
13
CmdUtils.CreateCommand({
name: "zenit/wiki user search:",
takes: {"search zenit/wiki user": noun_arb_text},
preview: function( pblock, wikiquery ) {
pblock.innerHTML = "Searching For: " + wikiquery.text;
},
execute: function( wikiquery ) {
var url = "http://zenit.senecac.on.ca/wiki/index.php/Special:Search?ns2=1&amp;search={QUERY}&amp;searchx=Search";
var query = wikiquery.text;
var urlString = url.replace("{QUERY}", query);
Utils.openUrlInBrowser(urlString);
}
})

The Ubiquity development team has made it quite easy for the users to create new commands. All we have to do is follow the command structure. So as you can see here for example in the name section you type the name of the command, in the execute section you code what the command is exactly suppose to do. So in this case the function receives the name of the user and performs some URL manipulation and opens the new URL in a new tab. Very simple stuff. Other students also created their on commands. You can have a peak at them here.

I also tried to create another command for jslint. Basically the idea was to select any text (hopefully JavaScript code) and then type jslint into the Ubiquity command line. This should open up jslint in a new tab with the selected text being displayed in the main textarea of jslint (where one is suppose to paste the JavaScript code). Unfortunately, after a few hours of struggle I couldn’t get it to work. One of things that make it quite hard is that jslint is coded in Ajax and it’s URL doesn’t change, which means that I cannot perform any URL manipulation. I attempted to use html.replace and even looked into using jQuery’s append function but all in vain. Eventually I gave up. I’m sure I could have figured it out given more time. Just a shout out to Tiago for spending the time with me to try to figure this out, he was very helpful.

Below is the code we came up with, which obviously does not work but if anybody wants to take this as a starting point and go from there please be my guest. Just make sure to post your results on here good or bad. I would love to know.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CmdUtils.CreateCommand({
 name: "jslint",
 takes: {"word": noun_arb_text},
 execute: function(directObj) {
  var selectedCode = directObj.text;
  var urlString = "http://www.jslint.com";
  Utils.openUrlInBrowser(urlString);
  var params = {
  };      
 
  jQuery.post( urlString, params, function( html ) {
   var old = "<textarea id=\"input\"><\/textarea>";
   var newHtml = "<textarea id=\"input\">" + $selectedCode + "<\/textarea>";
   html = html.replace( old, newHtml );
 });
 },
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
CmdUtils.CreateCommand({
 name: "jslint",
 takes: {"word": noun_arb_text},
 execute: function(directObj) {
  var selectedCode = directObj.text;
  var urlString = "http://www.jslint.com";
  Utils.openUrlInBrowser(urlString);
  var params = {
  };      
 
  jQuery.post( urlString, params, function( html ) {
   ("textarea").append(selectedCode);
 });
 },
})

, , , , ,

1 Comment

Google’s Chrome Enters the Web Browser Race

I’m sure by now that everybody has heard of Google’s sudden entry into the browser market. This has raised many new questions for Google’s competitors. Will Chrome be able to eat into the marketshare of IE? Will Google continue to support Mozilla? Only time will be able to answer some of these questions.

Chrome has made a good start and has already made an impact in the browser market. I’m sure placing the download link for Chrome at google.com has definately helped boost that number. Things can only go up from here as more and more people hear about this new application and are willing to try it. Offcourse, it also depends what people actually hear. If the consensus is positive more people are likely to adopt it. Unfortunately, Chrome’s reputation has already taken a slight hit with security vulnerabilities already being detected. On the other hand Chrome’s design and features must have caught the eye of many.

One thing that is definately certain with the release of Chrome is that the era of isolated desktop applications is coming to an end. Some of the best programs these days are web based and they work perfectly fine while providing the added functionality of the Internet. Google has designed Chrome to work efficiently with these web applications, taking full advantage of technologies such as Ajax. It will be interesting to see the results when developers start to optimize their applications for Chrome. In fact NetSuite has already done so and the results are apparently very positive.

As many of you must be aware Chrome is an open source browser. This can only have positive implications for the open source culture. When such a well known and respected company like Google releases an application like a web browse and makes it open source it really sends a message to everyone. It is ok for things to be open source. Applications can be open source and still thrive and compete with proprietary software. Firefox has already proven that to us and hopefully Chrome will take it one step further.

I want to leave you with this video titled “The Story Behind Google Chrome”…

, , , , ,

1 Comment

My Gym Adventure - Day 2

Well, I’m finally back at the gym for the 2nd time this week. I was supposed to go on Friday but my gym buddy picked up some kind of foot strain so we delayed our trip to today. Unfortunately, I had to end up going by myself because he wasn’t able to pull himself out of bed. The following are my results for the day…

squats 5×5 Completed with moderate difficulty.
overhead press 5×5 Completed with great difficulty
Deadlift 1×5 Added 4.5kg on both sides. Completed with ease
Pull-ups/Chin-ups 3xFail Too advanced. Did not attempt

Good progress so far. I feel that I can add a bit of weight onto the squats now. On the other hand the overhead press is too advanced for me even without any weights at this point so I will go another week and see how it goes. The deadlift was quite easy and I think I can up the weight on that definately. The pull ups and chin ups are beyond me right now and I will have to wait and see if I can do them or not.

Excellent start too my training. I want to get in 3 days of this every week, unfortunately I could only get in 2 this week. All in all I am satisfied with the start.

, ,

No Comments

My Gym Adventure - Day 1

After years of procrastinating I’ve finally decided its time to get my body in shape. I want to rid myself of my “healthy”, cough overweight appearance. So yesterday I made my first trip to the gym with my house buddy. He and I are are on opposite sides of the spectrum when it comes to physical appearance. He’s as skinny as someone can be while I’m definitely not. Nonetheless both our goals are the same, to sculpt a better body and develop a healthier life style. Now I know that things will change slowly and miracles will not happen overnight. I’m hoping for steady progress. I think I am mentally prepared for this journey. We shall see…

I intend to write my experiences on here, good or bad. Here goes…

We dragged ourselves out of bed this morning, the most difficult task of all in my opinion. I’ll share a little secret with you, I am surely not a morning person. I hate it getting up early to the core! But if I am to improve things I have to bite the bullet and get my rear end out of bed at 6:45 in morning as I did yesterday. We took the long walk to the University gym, a giant structure with any sporting facility that you might desire.

I am trying to follow the stronglifts beginners strength training guide. I hope that it is a good guide. The site looks popular but as a beginner to strength training I am not really sure if it is adequate or not. We shall see I suppose…

So on the first day I tried Workout A involving squats, bench press, barbell rows and dips. I did almost all of the exercises without any weights. As the site suggests it is first important to get your form correct and then add weight later on. Even without any extra weights I found the exercises daunting

Squats 5×5 Completed without any extra weights (intermediate)
Bench Press 5×5 Completed without any extra weights (advanced)
Barbell Row Did not complete. I didn’t know what the exercise entailed
Dips 3xF Did not try. Too advanced

All in all not a bad start. I need to make improvements though. For example what actually I need to do for the exercises. I had looked up what a barbell row entailed but unfortunately I had forgotten it by the time I made my way to the gym. As far as dips go they are too far advanced for me right now so I will not even try them at this point. I will have to find another exercise as a substitute for now.

Tomorrow is my 2nd trip to the gym. Hopefully things will go smoother.

1 Comment

Open Source (Bazaar) vs Proprietary (Cathedral)

As part of the open source course I’m taking at Seneca our professor, David Humphery asked the students to read an article, watch a video and listen to an audio file as the very first assignment for the course.

I found all of them to be quite interesting and informative, although I had already watched the aforementioned video in the past. Nonetheless they sculpt an intriguing perspective concerning the rivlary between the open source and proprietary ideologies.  At the forefront of this war are the two Operating Systems, Linux and Windows.

The author of the previously mentioned article talks about how linux development is like a bazaar with different parties who have differing priorities and agendas fighting with eachother. I have to agree with him when he says that it is simply a miracle that a coherent and stable OS can result from such a mess. Here in lies the weakness and, in my opinion, the strength of open source development. Open source is meant to be chaotic and unorganized. When many people are working together from different locations with the internet as their only communication it is only normal for problems to develop. Many times there is no collective vision for open source projects which leads to arguments. However, this can also be considered a strength because this openess allows everyone to contribute their ideas and suggestions. The whole concept of open source software is that anyone that wants to, can add their contribution to the project in anyway possible. This is what makes open source development different and in a way, better than proprietary development methods.

The video takes an in depth look into the early years of open source development. I have to say that, like others I am quite disappointed in how Linux has failed to scale the Microsoft wall. In the early years there was so much promise but so far Microsoft seems to be indestructible even after considering the relative failures of Vista. In fact I would that think the people disillusioned by Vista have made the Jump to Mac instead of going over to Linux. Now why is this happening? There are many answers to this question. It could be because the average user doesn’t know much about Linux or how the abundance of Linux flavors confuses non-techies. Fact is that what we are doing is not working. Something needs to change for Linux to enter the main stream. I am sad to report that even I don’t use Linux at the moment.

Overall, this course is looking very promising. It is different and more realistic. I think I am going to enjoy it very much. I know its going to take a lot of hard work and dedication, hopefully I am up to the task.

1 Comment