Geek stuff

Git Introduction

Difference between SVN and GIT

The usual answer: SVN is to GIT what revision control is to distributed versioning system. What in the crack pot is that supposed to mean? The answer is pretty simple: a revision control system keeps the whole revision meta-data in ‘one place’. A _distributed_ versioning system allows different developers/users/programmers/organizations create different repositories of their own and merge them to a central server as they see fit. They can even keep the changes to themselves (but that’s not the point of it). So, there you go. If you get code off Android’s git repo and make changes as you see fit. You can commit changes to your local repo, have revisions, do whatever and keep the changes to yourself. If Android was using SVN and you used that, you’d have to go through a lot of trouble trying to keep the changes to yourself while still using the revisions of Android team.

Some important concepts


When you clone a repo, you take the whole metadata of a remote git repository and store it locally. For example, when you get clone the Android repo from git, you get the meta-data of the whole source in a local repo. (You have to pull the changes to get the actual source, though.)


When you make a change, you can ‘commit’ the change and that change gets stored as a revision. A commit in git is recognized by a SHA-1 hash.


A branch is a specific sequence of commits. An example: The source code is at A, you make some changes and commit to B, then to C and then to D. Afterwards, you create a new branch, switch to this branch, make some changes and commit to P, make some more changes and commit to Q. The revision history would look like so:

                    P --- Q
A --- B --- C --- D

See why it’s called a ‘branch’?


A basic pull is simple. It gets the files from the remote git repo and puts them in the local repo. Things get messy when you’ve actually pulled once, made changes and committed them in the local repo. Let’s see how this goes: Taking the previous example of branch further: You cloned a repo at D. You made some changes and now, you’re at Q. However, while you were busy making changes upto Q, the rest of the world wasn’t asleep. They worked too and they got upto G. Of course, you didn’t tell them what you were doing. So, their repo looks like so:

A --- B --- C --- D --- E --- F --- G

Now, you’re in trouble because you have old copies of some files. You need to get to G without losing changes of Q. You ‘pull’ and git sees that you’ve made some changes and upates the repo to look like this:

                                      P' --- Q'
A --- B --- C --- D --- E --- F --- G

Notice that P and Q are now P’ and Q’. That’s because P was based off D and P’ is branching off G. So, they’re not the same. Any-hoo, now you have the latest code _and_ your changes.

Oh, and read these two tutorials. They’re really good. They explain a lot of basic concepts. I’ll try to write more when I understand more of git.

You can see a wiki’fied version here.


End of an Era Coming Up

With Bill Gates already out of Microsoft and Steve Jobs taking a sick leave from Apple, I believe it’s the end of an era for consumer computing. It is my opinion that Jobs is about to leave Apple for good. They just wanted to soften the blow by letting him take a small leave instead of announcing the big departure. Stocks fell even as a result of this and even a rumour of a departure may have been catastrophic. Anyway, it seems that Steve Jobs will be gone and so will the era of desktop computing. Google’s often termed as the new Microsoft. The position for the new Apple is open and Android seems to be putting Google in that position as well. Is this going to be a single super-power situation?


GPS Functional on Openmoko

Today, we (actually, Shaz and Sanaullah) got GPS working in the Openmoko phone. We couldn’t get a fix inside the lab but we got one within a minute on the roof. The values didn’t seem to make sense at first but after a little thinking and tinkling, we got the map pointing towards the exact building, within feet of our actual location. A technical description of the procedure will follow soon on the group’s blog (inshaallah).

We’re still working on using the data inside our access decision engine. More on this (much) later.

Articles, research

A Brief Intro to Security in Java

Disclaimer: This is not a how-to for implementing security frameworks. It will focus on the research aspects of Java Security Managers. If you need to find out how to implement the code, follow some of the references.

The Java SE platform provides a solid security framework. Aside from the cryptography libraries and Java Cryptography Extension (JCE) specification, it includes an important feature — called Security Managers — which enable a program writer (or the user) to specify the security constraints for a program.

Every call to the system resources goes through the Java Virtual Machine (JVM). The VM includes hooks, which call a Security Manager and request a decision regarding system resource calls. These calls include reading and writing files, opening sockets and listening to ports. The assigned security manager reads the security policy and decides whether the system call should be allowed. If the call is to be granted, the security manager simply returns a value (the nature of which is not important). If it is not to be allowed, a security exception is thrown, which signifies the denial of the call.

Continue reading “A Brief Intro to Security in Java”


Inside assisted GPS

A nice article from arsTechnica which explains the basics of assisted GPS. Take a look:

The Global Positioning Satellite (GPS) system can help you find yourself, or the nearest drycleaner, or a missing Christmas manger, or a hidden geocache. But our expectations of GPS are that it works accurately, instantly, and reliably on all our devices. That’s asking a bit much from what is fundamentally 1990s-era technology.

via Inside assisted GPS: helping GPS help you.

Geek stuff

Setting up Ubuntu

I’ve just finished setting up my Ubuntu desktop just the way I like it — uncluttered and usable. Here is a list of programs I’m currently using:

  1. Gnome-do:  A launcher like QuickSilver (mac) and Launchy (win)
  2. Avant-Window-Manager: A dock and very usable taskbar (plus all the awn-* extra packages)
  3. Stalonetray: A system tray replacement so that I can get rid of the gnome panels
  4. GDesklet for the analog clock

Here’s the script to get stalonetray to sit at the top of the screen and look nice and transparent.

stalonetray -geometry 100×25+900+0  –sticky -t –skip-taskbar –window-type dock –grow-gravity W –icon-gravity SE –ignore-icon-resize TRUE –respect-icon-hints false –max-height 48 –icon-size 24 -i 24 –window-layer top

And here’s the final look: (larger version)

Pretty Ubuntu Desktop
Pretty Ubuntu Desktop