I have been using unicode characters like ★, ✘, ✔, ⚠ to annotate my gmail labels. I used it today to mark the subject of one of my mails as a high-priority mail. Wonder if it’ll work.
So, I took my GRE …
… and scored pretty well. 1520, to be exact.
For most of the people I know, the biggest hurdle to getting a good score in the GRE was our vocabulary. Most of us have our own way of learning the various word lists available in the market. Mine involved a book, a software made in Visual Basic that kept track of difficult words, and a few spreadsheets.
Looking back, I feel there’s one basic rule to revising -
- revise that which you did not know the last time you revised
With this approach, each subsequent revision contains fewer words than the last one, you don’t waste time revising the easy words, and hopefully end up with very few difficult words. Of course, you need to keep doing a holistic revision every now and then, so that you don’t forget what you already knew.
Keeping this in mind, Pascal and I made “Shabd”1. For now, Shabd is hosted at http://wl.sandesh247.com/, and the source is hosted at http://code.google.com/p/shabd. All contributors are welcome.
For now, my deployment has around 5000 words, aggregated from various word lists. You can use the software without logging in. However, the true benefits can only be had if you’re logged in – the software keeps track of all the words you know, or don’t, and can present customized word lists later on. It allows you to go through your most difficult words, or the words you didn’t know the last time you saw them (in accordance with my basic rule to revising stuff).
Give it a try. Your password are salted and hashed, they aren’t going anywhere. There’s no way to change them as yet, so cling on to them while we add support. Also, we need a way to have custom word lists (tags?), and host more flash cards (say, of the French language). The user interface too, leaves a lot to be desired. And then there are things that you’ll find wrong with it. Please log all such ideas and problems at http://code.google.com/p/shabd/issues/list. You’ll need a Google account for that, however. In case you don’t have one, drop in a comment here, I’ll add them to the list myself.
A basic guide to using the software is perhaps in order. The slider on the top jumps through the word list. Press Hit for words you know, this will take you to the next word. Press Miss for the words you don’t – this will show the meaning of the word, and bring up the Next button. Click on it to advance to the next word.
In case you are not sure if the word is what you think it is, click on the word to reveal it’s meaning, and then click on either Hit or Miss depending on whether you were right. Don’t be tempted to simply press Hit now. There’s no point in cheating the software – it’s not a competition, and you’ll be hurting your own revision later on.
Have fun!
1In hindsight, this is a generic flash card software, which can be used to learn more than just words. You can perhaps suggest a better name for it.
Using javascript to avoid the mouse and page scrolling
Here’s the problem. It is not very easy to scroll a document when you’re inside an input element. Arrow keys don’t work, and Page Up/Page Down jump in big increments. What if you want to see just a few lines below the current element? Our clients hate to scroll. And they hate having to use the mouse. This just brings the two together.
FScroll is a JQuery plug-in which makes a page scroll to the currently focussed element, keeping it’s position centered with respect to the document. This helps keep a bit of “context” around the currently focussed element – since it is centered, you can see a few elements both above and below the currently focussed element.
Here are the sources. And here’s a page explaining it’s usage in some detail. And oh, it does nested centering too. But it requires that the ‘nesting’ container have a css styling of position : relative (in the demo page, the div enclosing the table is positioned relative). This was not strictly necessary, but it made the coding a bit easier. If you can’t live with the styling restriction, let me know. I’ll try to do what I can.
You may report issues here.
Importing git history into a new svn repository
So the management has finally approved your project, and has asked you to start working on it. Heh … little do they know that you’d already been working on it, and have a nice prototype working, and it’s all saved on your local git repository. But your company is not as cool as you are – it has it’s own svn repository, and now you have to import your code into it, history and all.
Here is the git tree, as you have developed it:

.. and your svn repository looks similar to this -
$ svn co <svn repo url> Checked out revision 0. $ cd <svnrepo> $ mkdir tags trunk branches $ svn add * A branches A tags A trunk $ svn commit -m "initial directory structure" Adding branches Adding tags Adding trunk Committed revision 1.
Now you could copy all the files from the git repository into trunk, and commit it. But that is really not the way it should be. For one – no one will know the reason for *anything* in this repository before the big bang. Also, there might have been legitimate reasons for people to branch out from some earlier state of the code, but now no one will even know.
Fortunately, a mail on the kerneltrap archives tells us how we can export a git repository, along with all it’s history, into an svn repository.
From: Björn <B.Steinbrink@…>
…
…
This should do and uses a graft to simplify the process a bit:
Initialize git-svn:
git svn init -s --prefix=svn/ https://svn/svn/SANDBOX/warren/test2
The –prefix gives you remote tracking branches like “svn/trunk” which
is nice because you don’t get ambiguous names if you call your local
branch just “trunk” then. And -s is a shortcut for the standard
trunk/tags/branches layout.
Fetch the initial stuff from svn:
git svn fetch
Now look up the hash of your root commit (should show a single commit):
git rev-list --parents master | grep '^.\{40\}$'
Then get the hash of the empty trunk commit:
git rev-parse svn/trunk
Create the graft:
echo <root-commit-hash> <svn-trunk-commit-hash> >> .git/info/grafts
Now, “gitk” should show svn/trunk as the first commit on which your
master branch is based.
Make the graft permanent:
git filter-branch -- ^svn/trunk --all
Drop the graft:
rm .git/info/grafts
gitk should still show svn/trunk in the ancestry of master
Linearize your history on top of trunk:
git svn rebase
And now git svn dcommit -n should tell you that it is going to commit
to trunk.
If you check your svn repository log, it will look like this.

All the history, nice and linearised for svn.
Keep in mind though, that this method is lossy. All the branches have been linearised, and you can no longer “check them out” in the original git repository. Apart from that, things work just fine, and you can continue to commit in your local git repository, and push to svn as and when needed.
Sights and sounds, in and around Vasai
This is what population growth, and the resulting competition, can do.
~
English is a foreign language to most Indians, and yet it seems to be preferred for dispensing information. It’s not uncommon to see a gaffe every now and then.
Do you see me?
Updating my profile picture isn’t an easy task anymore. There are many sites where I own a profile, and I have to look just right on each one of them.
As of now, these are the places you can see my shiny new profile picture:
- http://sandesh247.com
- http://www.google.com/profiles/sandesh247
- http://www.linkedin.com/in/sandesh247
- http://identi.ca/sandesh247/
- http://www.facebook.com/profile.php?id=543752933
- http://www.goodreads.com/sandesh247
- http://www.last.fm/user/sandesh247
- http://friendfeed.com/sandesh247
- http://www.orkut.co.in/Main#FullProfile.aspx?uid=6964782234814101571
- http://www.gravatar.com/avatar/f37a7393ce728b072aca55535f759e9f (all gravatar enabled websites)
- http://twitter.com/sandesh247
Phew. I hope that covers them all.
P.S. Last.fm and Twitter aren’t playing nice right now. I guess I have to keep trying.
Tuning LINQ performance with Mr. P and Mr. S
I thought I’d take a second look at the Mr. P and Mr. S problem, which I’d posted more than a couple of years ago. The last time I tried it, I wasn’t successful. I had a strategy to solve it, but somehow I just couldn’t translate it into code.
I’ve been programming a lot with C# lately, and decided to use LINQ to solve the puzzle. Although not very concise, compared to the Python and Haskell solutions out there, it does print out the right answer. After you’ve tried to solve it yourself, you can have a look at my solution here.
There’s something special about LINQ queries. All LINQ queries are deferred, which means that they aren’t executed until they are accessed. Also, they are re-executed when the execution context changes. Say we have a list of numbers, and a query on it like so :
var numbers = new List<int>(); var query = from i in numbers select i;
The query hasn’t been executed yet. We add a few numbers to the list, and compare the counts of the list and the query.
numbers.Add(0); numbers.Add(1); numbers.Add(2); // 3 elements in list, 3 in the query Assert.AreEqual(numbers.Count, localDeferredQuery.Count());
The test passes. LINQ queries are “live”, very much like functions. Usually, this is a good thing, as no operation is performed until it is actually needed. However, there are exceptions. For example, I used these three ranges -
public static IEnumerableOddRange(int stop) // returns odd numbers upto "stop" { for (int i = 1; i < stop; i+=2) yield return i; } public static IEnumerable EvenRange(int stop) // returns even numbers upto "stop" { for (int i = 2; i < stop; i+=2) yield return i; } public static IEnumerable Range(int stop) // returns all numbers upto "stop" { for (int i = 0; i < stop; ++i) yield return i; }
To define the Deferred() and Immediate() functions below:
public void Deferred()
{
var all = Range(limit);
var even = from e in EvenRange(limit) where all.Contains(e) select e;
var odd = from o in OddRange(limit) where !even.Contains(o) select o;
var query = from q in odd select q;
foreach(var i in query) { var j = i+1; }
}
public void Immediate()
{
var all = Range(limit);
var even = (from e in EvenRange(limit) where all.Contains(e) select e) .ToArray();
var odd = (from o in OddRange(limit) where !even.Contains(o) select o) .ToArray();
var query = (from q in odd select q).ToArray();
foreach(var i in query) { var j = i+1; }
}
all, even and odd are three sub queries, each using the previous one. The Immediate() function only differs from Differed() due it's forced execution of the subqueries with ToArray(). However, Immediate() performs much better than Deferred(). I knew LINQ operators are actually euphemism for functions, and that iterator blocks are actually exploded by the compiler into a lot of code. But Deferred() was waaaayy slower than Immediate(), and the time taken would increase exponentially with the value of limit. This couldn't be just some extra code.
I posted a query on stackoverflow, and it did not disappoint. It is quite obvious in hindsight. This statement -
var odd = (from o in OddRange(limit) where !even.Contains(o) select o).ToArray();
in deferred mode, turns out to be pretty expensive indeed. It contains a call to even.Contains(o). While in the immediate mode this is an O(n) operation, in deferred mode, the sequence of calls looks like this -
odd --> even -+-> EvenRange()
|
+-> all --> Range()
A simple O(n) operation is now O(n3). We can do better than O(n), however, by using a Hashset.
var evenSet = new HashSet(even);
var odd = from o in OddRange(limit)
where !evenSet.Contains(o) select o; // Contains() is now O(1)
It doesn't get much better than this.
Microblogging on identi.ca
If my journal template hasn’t changed since this post, you should see a µBlog roll on the sidebar. If you’ve clicked on any of the links, you’d now that those notices (or ‘dents’) come from identi.ca.
identi.ca is a website very similar to twitter, only better. It’s built with the open source laconi.ca project, and has tags and groups too. The killer feature for me is IM support, along with a decent command list. All you have to do is add their bot on google talk, and you can send/receive messages in real -time.
the commands currently supported by the IM bot are:
on - turn on notifications
off - turn off notifications
help - show this help
follow <nickname> - subscribe to user
leave <nickname> - unsubscribe from user
d <nickname> <text> - direct message to user
get <nickname> - get last notice from user
whois <nickname> - get profile info on user
fav <nickname> - add user's last notice as a 'fave'
stats - get your stats
stop - same as 'off'
quit - same as 'off'
sub <nickname> - same as 'follow'
unsub <nickname> - same as 'leave'
last <nickname> - same as 'get'
identi.ca also supports forwarding dents to twitter, so you wont completely alienate your fans on twitter. However, identi.ca doesn’t pull tweets, so you wont see any @replies from twitter on identi.ca. At least until you can convince your friends to move from twitter.
identi.ca belongs to a larger ecosystem of OpenMicroBlogging software, which have adapted a common standard so that messages between them may be shared. If you use a software that supports OMB, you wont alienate someone just because they happen to like something different (in contrast, the twitter community belongs only on twitter).
Another popular µBlogging site is jaiku, which will support OMB, and go open source soon. If identi.ca is not your cup of tea, or if you happen to like everything Google, jaiku may be for you.
Good intentions
There’s a video about Intentional Software over at MSDN, and it’s definitely one of the more brilliant things to have come out in a while. Most of the times, people who best know how a software should function, are not the ones writing it. That is how people who write software for money, make money – they pitch their ability to convert business requirements into “executables”. With intentional software, everyone does what they do best.
All the places I’ve worked at had tools that made it easy for domain experts to give their inputs, since turnaround time is extremely important for business. Even for personal projects, I’ve toyed with modeling tools and OR mapping frameworks to make my model somewhat independent of the implementation. Never have I seen a tool so comprehensive, though – watching an electrical circuit being modeled as a diagram, along with the impedance and voltages was amazing. This wasn’t just the model being abstracted – it was the whole program, editable as text, diagrams or XML, and easily converted into executable code.
Martin Fowler has quite a lot to say about it too, there isn’t much I can add to it. Open source junkies like me will look for an open source alternative for this, and will find JetBrains’ Meta Programming System. The next few days will be exciting, as I try to evaluate this beast and see whether it fits into any of my current work.




The weaker sex?
From http://esr.ibiblio.org/?p=2118:
More like the wiser one.