Author Archives: thameera

Zawinski’s Law

I was reading Finish your stuff by Martin Sustrik (creator of ZeroMQ) today and stumbled upon Zawinski’s Law from The Jargon File.

“Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.”

Emacs comes to mind (you know what they say, it’s “a great operating system, lacking only a decent editor”).

However, we see that a lot of bloated software being replaced by leaner and minimal products, which might seem to be in contrary to this rule. Lots of people moved from WordPress to much simpler Medium. But Medium, in turn, has become a bloated piece of JavaScript by now, which aligns with Zawinski’s Law.

Quoting the Wikipedia article on the subject:

Eric Raymond comments that while this law goes against the minimalist philosophy of Unix (a set of “small, sharp tools”), it actually addresses the real need of end users to keep together tools for interrelated tasks, even though for a coder implementation of these tools are clearly independent jobs.

Splitting a text file into two

Today I was trying to open a text file with a Node.js script and failed, apparently because it exceeded Node’s maximum buffer size. The most straight-forward solution was to split the file in half and open the two new files separately.

How do you split a text file by two, though? With a quick hack using head and tail of course.

head -n 1000 input-file > output1
tail -n +1001 input-file > output2

The + in the tail command tells it to count lines from the top, instead of from the bottom which is the usual case of tail.

Source: unix.stackexchange

Re: Tools are not the Answer

I quoted Uncle Bob’s post two days back and Hillel Wayne has written a much comprehensive response to the original post. In summary, it says:

Uncle Bob gives terrible advice. Following it will make your code worse.

I see nowhere in the original article where it says the tools are bad for you. In fact, it maintains that:

I have nothing against tools like this. I’ve even contributed money to the Light Table project. I think that good software tools make it easier to write good software. However, tools are not the answer to the “Apocalypse”.

There’s a very interesting discussion on Hacker News as well and I urge you to go read it. Uncle Bob Martin himself has left a few (albeit succinct) comments. It’s very interesting to listen to all parts of the story, especially from people who have far greater experience than you.

Tools are not the Answer

Uncle Bob responds to an article in The Atlantic titled “The Coming Software Apocalypse”. The Atlantic article apparently proposes better tooling to avoid software bugs.

I disagree. Tools are fine; but the solution to the software apocalypse is not more tools. The solution is better programming discipline.

We have fancy IDEs, sophisticated build systems and what not, but a sloppy programmer is a sloppy programmer. If tools can make her a good programmer, probably this is a field that robots can fill up easily.

You don’t need multiple cursors in Vim

MasteringVim tweeted an article by Christoph Hermann:

There is a plugin for vim (vim-multiple-cursors) which allows you to mimic that behaviour, but it has some problems.

After using it for quite some time I came to the conclusion that there is no situation which can’t be addressed (IMHO even better) with “native” vim features.

Editing text in a non-Vim environment is a pain, so multiple cursors might seem a good idea (in fact, it was one of the major selling features of Sublime Text). But with all the modal editing features in Vim, you don’t need to go into the trouble of manipulating multiple cursors. Check out the article for some cool tips, including the powerful visual-at function.

Links to revoke app permissions from your social accounts

Over time, you end up having granted access to a lot of apps from your social accounts. It’s a good idea to go over these periodically and clean up any apps you don’t need.

Some providers make it really difficult to find where to revoke these apps (I’m looking at you, Micro$oft). So here’s a list of direct links to different services I use to check the permissions every now and then:

[1] If you have signed in to multiple Google accounts, change 0 to 1, 2, etc for other accounts.

Git 1.8.5 is out

Git 1.8.5 is now out. The RC was available for more than a month, and now it’s gone stable. One interesting change is the new alias for HEAD. From the atlassian blog:

This had been cooking for a while and it’s finally in: HEAD has a new alias, instead of typing four capital letters you can say “@” now, e.g. “git log @“.

Which means you can now just type in @^ for HEAD^ and @~2 for HEAD~2 and so on.

Among other notable changes are that git-repack (which was a shell script previously) has been rewritten in C, cherry-pick shows the commits being cherry-picked and diff-filter has got an “all-but” option.

re: Why You Should Never Use MongoDB

Ayende Rahien (creator of RavenDB), replying to the post Why You Should Never Use MongoDB:

The actual details in the posts are fascinating, I’ve never heard about this Diaspora project. But to be perfectly honest, the problems that they run into has nothing to do with MongoDB or its features. They have a lot to do with a fundamental lack of understanding on how to model using a document database.

And then,

What I do know is that having a single document that large is something that I want to avoid. And yes, this is a somewhat relational model. That is because what you are looking at is a list of independent aggregates that have different reasons to change.

My knowledge of database models is too lacking to comment on who’s right. Perhaps there’s no ‘right’ way, like many things are in this field. All I can see is that with the separate-document method Ayende suggests, you can get the best of both worlds, even though it might seem like trying to make a NoSQL database relational.

But clearly I should read more. 😕

Calsen beats Anand to become the World Chess Champion

BBC News:

Norwegian chess prodigy Magnus Carlsen has become the world champion, beating Indian title holder Viswanathan Anand.

Carlsen, 22, secured a draw to win the World Chess Championship in 10 games, with two left to play.

Carlsen won the match in Chennai, India, with a score of 6.5-3.5. The win means that Carlsen achieves the record of having the highest new rating of all time.

He could’ve easily become the youngest to secure the title, but you can’t challenge and get into a championship just like that. Congratulations, Carlson!

Update: Here’s a comprehensive list of games, their summaries and other stuff.

Jenkins gets out of hot water

The Jenkins guys seem to have had a rough day.

yesterday something strange has happen to many Jenkins repositories on GitHub (more then 50 Repos)…
Luca Milanesio seems have pushed to many many repositories without really changing anything – at least I have not seen anything changed.

But the folks at github have helped by restoring the state prior to the force push into a separate branch. Good old git reflog to the rescue.

Typically recovering a force push is straightforward:
1. git reflog > look at the SHA-1 before the forced push
2. git branch -f <name> <sha-1>

As far as I know, bare repos don’t have reflog enabled by default. They might have turned on core.logAllRefUpdates for all the repos at github by default.