My bzr Workflow

January 25th, 2009

Michael Ivey recently wrote about his git work flow over at My Git Workflow and it turned out to be a pretty useful article and was just the encouragement that i needed to blog about my own experience. Although I’ve used git before, I much rather use bzr whenever possible. I’m not into religious wars about tools, so use whatever you like.

I work as an independent programmer(freelance programmer if you prefer) and so I am often working on several projects at the same time, mostly on my own, but sometimes with 1 or 2 more people involved.

Feature branches

I use standalone branches in bzr so they will have their own directories. I create a parent folder with the name of the project, say KillerIdeaX. And inside it, i would have the project’s branches. One called KillerIdeaXtrunk which is the stable version of the project. And other branches called feature branches for…well, features.


mkdir KillerIdeaX
cd KillerIdeaX
bzr init KillerIdeaXtrunk
bzr branch KillerIdeaXtrunk KillerIdeaXFeatureA
...hack....
bzr merge KillerIdeaXFeatureA KillerIdeaXtrunk

If the project is small enough, i would just have the trunk folder and i work on that. But usually, the project will have a number of distinct features. So i create feature branches and work on those and merge them back into trunk after testing. The trunk branch is also where i take snapshots from to deliver to the client. So i always know that what i am delivering is a stable build.

If i am working with other people, i use an approach that is similar to feature branches. Whenever i receive code from the client(or co-worker), i create a standalone branch such as KillerIdeaXWithFooFeature and thus be able to quickly see what is different using bzr commands(such as diff and others).

Say Cheese! Tag!

I mentioned taking snapshots from the trunk to deliver to the client for testing but i didn’t explain how. What i usually do is simply export the code from trunk(which would always give me a stable build) and then tag that version so that i know which version the client is talking about when i get the inevitable email telling me that the whole thing is broken.


...receive angry email from client demanding a prototype...
bzr export KillerIdeaXtrunk KillerIdeaX.zip
....email KillerIdeaX.zip to client with usual warnings about software prototypes...
bzr tag "0.1"
....now we can both argue about same codebase....

I need more shelf space

When you begin using any version control system, it might be somewhat challenging to learn to code via separate changes as entities. So one feature would be one change, one bug fix would be another change and so on. Changes are grouped logically. As in, what are the modifications that logically fit together. That way, it becomes much easier to roll back certain changes or to chase down bugs or retrieve an earlier version of the codebase…etc.

While this is a proper programming practice, it sometimes can be hard to follow. So let’s say you’re working on some feature and while testing it, discover an unrelated bug. The proper thing to do would be to branch out from your last revision, work on that branch to fix the bug and then merge the changes back in and then go on working on your feature. This makes sense, though, only if the bug fix is significant enough. Often, fixes are one liner changes and so it will be much faster to simply fix in place. Of course, doing that would ruin your ability to separate changes and so rolling back your feature for what ever reason also means losing that bug fix.

This scenario is excellent for the shelve command in the bzrtools plugin(recent versions of bzr have this command built-in in a slightly modified way). The shelve command interactively asks you about the changes in the source code(by hunk) and asks you if you want to keep it or shelve it. Shelving changes simply removes them and stores them in a temporary location until they’re un-shelved.


....working in KillerIdeaXFeatureA branch, discover unrelated bug....
bzr shelve
....choose to shelve all changes related to feature...
....introduce one liner fix for bug...
bzr commit -m "fixed silly bug related to foobar problem"
bzr unshelve
...continue working on feature....
bzr commit -m "implemented awesome feature zazzle"

Note that using the shelve command, you can shelve and un-shelve any change you want. So you could’ve introduced the one line fix and then before committing the feature shelved that instead for example.

Can you see it?

As you can see, there’s a lot that you can do to optimize your process and using a distributed version control system means that the administration overhead of a centralized one is no longer there. So you really have no excuse not to make use of its power…even if you’re a solo programmer.

(I tried to stay away from bzr terminology in this article to give you a general idea of the tool. But do check out the great documentation that comes with it.)

On Wikipedia and freedom of access to information

December 28th, 2008

Wikipedia has been a vital source of information for me and hardly a day goes by where i don’t use it to read up on something. Amazingly, topics covered on it range from the down right silly to the most advanced technical topic. All reviewed and scrutinized by the mass public.

I just donated today as part of the “put your money where your mouth is” campaign. Although my donation is small and something i should have done a long time ago, I think that every bit helps and its always better late than never. This urge to donate came after reading up today on such topics as I2C and SPI and realizing that a regular medium(ie encyclopedias in the form of books) can never accommodate such knowledge especially now that human knowledge is moving at an incredible pace of change.

Speaking of human knowledge; there is one other organization that claims to want to do the same thing; albeit in a different manner. Google officially states that it has a mission to “organize the world’s information and make it universally accessible and useful.” So i believe that the world will be a much better place if Google and the WikiMedia foundation worked together.

In summary, I can not imagine living in a world without Wikipedia and look forward to the day where “every single person on the planet is given free access to the sum of all human knowledge.”(quote from Jimmy Wales, Founder of Wikipedia) I urge you to consider supporting this organiztion through a donation, if possible. I am doing my part, are you?

Wikipedia Affiliate Button

On Licensing Terms

December 24th, 2008

Last week, i sat through a demo of a certain document management system provided by a vendor. The system in itself is pretty good. Although if it was up to me, I would never choose a proprietary system for a vital project. Since you essentially would be putting yourself and your data at the mercy of the provider.

What was interesting though was their licensing terms. Aside from the system itself, you have to buy “modules”. A module in their case is a set of grouped functions. And their selling point was that this would actually be much cheaper for the client than any alternative since the client would only buy what he needed. And at this is music to a manager’s ears.

Among the “modules” that a client has to buy is something called “storage module” and a “retrieval module” which basically means you’re paying for the right to write and read from the database. Now, if you’re thinking that this sounds silly, then you’d be right. It does. And it is. Of course, from the vendor’s perspective it makes total sense since all their licensing is per user.

I don’t know about you, but i prefer the approach taken by the free/open source software world. That approach basically eliminates the idea of selling licenses and instead gives you ownership over the product but offers support contracts for people that need them.

When you buy something like Microsoft(MS) Windows, for example,  you’re not actually buying Microsoft Windows. What you’re buying is the right to install and use MS Windows on one machine. And even your use of MS Windows is governed by the EULA that you agree to before installing it. You know which one…that 100 page legalese document that nobody reads.

However, when you buy free/open source software such as Ubuntu, you get a completely different experience(Ubuntu happens to be free, but this isn’t always the case). What you get is the product along with source code. You also get the right to change that product anyway you see fit or pay someone to do that for you. You can even redistribute or sell those changes. The only requirement is that you pass on the same freedom that you got when you first acquired the product.

For my own products, i much rather go the free software route. So you’d pay a one-time fee to buy the application and then there would be support contracts for people who need it. Even from a pure business point of view that sounds like a much better approach and one that clients would appreciate more.

What do you think readers? Am i way off base? Don’t people mind when vendors have ridiculous licensing terms? Or does it depend on the vendor?

A letter to ATI/AMD

October 11th, 2008

Dear Ati and Ati’s daddy AMD,

A week ago, i needed to replace my graphics card and so after being an Nvidia customer for several years, i decided to go with an Ati card this time to support the company for choosing to open source their graphic drivers. I am a GNU/Linux user, and although Nvidia has worked great on this platform in the past, it has not kept up with the times and still chooses to withhold specs from the free software community trying to help them implement open source drivers for their cards.

Now, i realize that the open source driver for your cards is still not ready, and that’s ok. Just making the jump is a great effort on your part. However, your 



proprietary
driver sucks. And hence, under Linux, your cards suck too.

You want some details? Here goes.

- The “Catalyst Control Center” is a joke. I mean i used to write interfaces like that too…when i first started programming… Ok, so maybe aesthetics in interfaces is not your thing(although you do manufacture graphics cards!), even in terms of functionality it hardly works. Trying to change any configuration using the control center produces an xorg file that messes everything up. I had to manually re-write it myself. Either implement a proper “control center”, or ask the community for help.

- Switching between virtual terminals produces transient weird graphic artifacts using driver 8.53.4. Using an earlier driver, X just locks up.

- Hibernating or suspending the computer causes X to also lockup. This seems to still be a problem even in the latest driver(8.53.4).

- Performance wise, the driver is terrible. I mean absolutely horrible. World of Warcraft runs with 10-15 fps on this thing. Definitely not what i would expect from a midrange sub-$200 card(i actually paid $160). Luckily, i still dual boot for when a windows VM does not do the job and under windows xp sp2, the performance is pretty good. So please, please fix your driver. I do not wish to change platforms just to get your stuff to work.

- The Ati bugzilla appears to be abandoned with tens(hundreds?) of unanswered bug reports. That is simply not acceptable, even if it is an unofficial bug database. You either want the community to help you, or you don’t. This just looks like you’re taking advantage of us.

- Oh, and this one is for Sahpire. Have you ever actually used one of
your products? It sounds like you’re sitting next to a blender…

I have a lot more, but i think you got my point. I want to support you, i want to give you my hard earned dollars. But you’re making it very difficult. So please start acting like a good citizen or ask for help. Spend more time on your products, and less time on pretty PowerPoint presentations. Those do not impress us.

Firemote project is finally public

September 10th, 2008

A couple of months ago, we started working on a project, code named firemote, to help in the detection and prevention of forest fires in Lebanon. I didn’t say anything about it because i was waiting for it to be announced, and the announcement was finally done a few days ago. The press coverage(in english) is at The Daily Star – Politics – AUB team invents new tool to help battle forest fires

Sadly, the coverage doesn’t really do justice to the project and its potential impact on the devastating forest fires that eat up a substantial amount of forests each year. But i think this will be addressed when the pilot is under way and we have some results to show.

The project was a collaboration between the American University of Beirut (AUB) and the Association for Forests, Development&Conversation(AFDC). I was one of the researchers at AUB.

On Producitivity and running your own business

September 8th, 2008

It just occurred to me today. Running your own business, you try to optimize the hell out of everything to make as much use of your time as possible. Employees on the other hand, wish to be as unproductive as possible.

But i have to say, I still don’t understand how people think. Its one thing to have a lazy day, but to turn laziness into a habit is just plain wrong. Recently, I’ve been observing this behavior and wondering why do the employees act as if they don’t care anymore. And it just dawned on me. Its very simple; They never did care.

When your compensation is relative to how much time you spend sitting in a chair looking busy instead of how much units of “output” you generate, for whatever output means in your situation, then its obvious that the loophole is to just stretch everything out. The task that is supposed to take 5 mins now takes 15. The task that should take a week now takes a minimum of 3. Why? “Oh, because its how we do things around here.”

Instead of trying to analyze the hell out of the situation, I’ll instead ask a few questions. What ever happened to people doing their jobs to make a difference? What ever happened to taking pride in your work? When did it become alright for people to stop caring? When did it become unusual if you wanted to make a difference in this world?

I used to have a low tolerate rate towards lazy people. Now i have none.

Let me share a little story with you. Once i was in the hospital for some medical exam. And i needed to have it approved for coverage by the insurance company. No biggie, they have an office there for such cases. So in i went with my usually nice attitude and a hearty “Good Morning”. Only to find the insurance guy angry and yelling at everybody. So i asked him why he was angry. He said that he has been working since 8am. Hospital shifts start at 8 and end at 5, so i really couldn’t quite reply with anything except “So am I”. I couldn’t really tell him that it was his job to work from 8 till 5. I couldn’t tell him that since he works directly with people, he should at least remain civil if not nice. I couldn’t tell him that i work for 16 hours a day. I also couldn’t tell him that if he minds working from 8 till 5, to quit and let any of the thousands of other qualified but unemployed graduates take his place. I usually don’t hold back, but he had “the power to push a button”. And i needed that button pushed.

Don’t understand what this blog post is about? Don’t worry, I’ll explain more later.

On being funny

August 28th, 2008

I just heard about a project that uses WhatsUp, which is sort of an uptime server or network monitoring service. I couldn’t help but imagine how the SMS alerts would go.
“You wanna know what’s up? Not your server that’s what’s up.”

Weak, i know…Some more meaty posts on the way.

On NDAs and My NDA Policy

July 6th, 2008

My NDA Policy ~ I have decided to starting signing them! : Texas Startup Blog discusses Non-Disclosure Agreements and how the author has decided to react to it.

I think it is brilliant.

Also of interest are the other linked articles such as To NDA or Not to NDA? That is the question.

My stance on NDAs is that i only sign specific ones that actually relate to confidential information. And i only do that to make newer clients feel more at ease. Frankly, i have turned down some projects before because of this.

Honestly, if the strength of your business idea relies on the assumption that people won’t find out about it. Then I don’t think you have much of an idea. Certainly not one to base a business on.

I often brought in Gary Hoover, founder of Hoovers, BookStop, and TravelFest as well as author of Hoover’s Vision as a guest speaker. He says he talks to so many businesses and students that when someone asks him to sign an NDA he proceeds to ask them ‘Why?’ and immediately wonders about the viaObility of the concept.

This quote from the linked article shows that i am not the only one who thinks this way. And this quote comes from a serial entrepreneur!

One designer i was working with, after telling him that the project is funded by an angel investor, expressed interest in meeting the investor to tell him about all his “great ideas.” He pitched his greatest idea to me, and it was neither original nor did it have any revenue model(or even a future one). I do agree with the “1% inspiration and 99% perspiration” saying, and it is often the case that people who choose not to do the 99% part are the ones with the most “great ideas.”

Now, i didn’t even talk about the legal aspects of an NDA. But even with those issues aside, NDAs are no protection whatsoever. They are just plain stupid(using Linus’s term). I won’t go as far as saying “ideas are worthless,” but i will say that an idea without a proper implementation plan is.

Recently, a new client decided against using an NDA after i expressed that i am uncomfortable with generic NDAs. Certainly, a smart decision. I am very fortunate to have such clients.

Bomb Maker Gnome Applet Released

June 20th, 2008

I finally got around to releasing the BombMaker Gnome applet that i blogged about. I’ll share with you a little secret, I’ve actually been using it for the past 6 months or so. I even learned to package debian packages just so that i can release it.(manually installing gnome applets is a bit too much)

There were a couple of snags along the way, mainly in the packaging part and specifically in using autotools for that. I didn’t use autotools because i think they’re way too complex for something that should be relatively simple. Sadly, the complexity is necessary for autotools because it has to work on some many systems. Whether that complexity is still needed today, especially that the whole world has converged on a few key systems, is a question that is asked often.

So, I’ll blog about it sometime. But for now, you can visit the project page on the main site here. And as always, if anybody would like to work with me on this project, I’m just an email away.

Quietly working on my Bomb Maker

June 20th, 2008

Strange title, isn’t? I don’t actually make bombs :) although during the last war, a lot of people probably thought i did.

In my KDE days, i used to make a lot of use of an applet called KTeaTime(http://docs.kde.org/stable/en/kdetoys/kteatime/introduction.html#whats-kteatime). Its a nice little applet that tells you when your tea is ready after you select what type of tea you want. So if you select extra black tea for example, it will remind you that your tea is done after 10 mins for example. I used this when i wanted to make some hot drink for my coding sessions. So i would setup the drink and i will let it cool and use that to remind me when it would be done. Or when i would run a long compilation process that takes several minutes to finish, i just put it on another workspace and set this to remind me after a few minutes.

Bomb Maker is a gnome applet that tries to clone this with a twist. It is a reminder applet in which you choose a certain bomb type and it goes off after its time period elapses. You can also choose to manufacture a custom bomb type which has a custom time period till explosion and includes a custom message. Did you ever tell yourself that you will attend to a certain task in 10 mins and then forgot? Well, try this….

ScreenShot of Bomb Maker Gnome Applet

Some features include:
-Multiple notifications
-Multiple Time Periods
-Custom Message for Custom Bomb Type
-Custom Time for Custom Bomb Type
-Unlimited persistence of notifications until you dismiss them

The code is not yet ready for release, this is just to wet your appetite. As you can see from the screenshot, some paths still reference my machine and so it is not yet ready for distribution. But i will soon release it for debian based systems as a deb package.

Update: I released the applet, and you can get it here.