Released Programming Quiz on Android

I just released the first version of Programming Quiz LITE.

It’s a simple multiple-choice quiz to test your programming skills. It aims to be interesting, fun and educational. You could even use it to prepare for programming job interviews, regardless of whether you are an interviewee or an interviewer.

Questions are spread out across multiple categories and difficulty levels:

  • Hobbyist level: 51 questions
  • Professional level: 116 questions
  • Expert level: 61 questions

Question categories are designed along the lines of the “programmer competency matrix” There are 228 questions in total for now, I plan to more soon, making it at least 100 on all levels. The questions are 100% original I create them together with my programmer friends.

You can “play” in two modes: normal mode and sudden death mode. In normal mode you can postpone answering a question and you can navigate back and forth in the questions. In sudden death mode you have to answer N questions in a row. You can customize the number of questions in both modes.

To report problems or feature requests, you can either email me directly or use this page:

Project homepage:

This is the LITE version: it is FREE with NO ADS. There will be a paid version soon, which will be identical to this one, but it will have a price of 1 euro just to give you a way to say “thank you” and support my efforts if you want. If you like the app, please remember to rate it, +1 it, tweet it, review it, and spread the word. Thank you!

HabitRPG is helping me live healthier and balance my activities better

I started using HabitRPG last weekend. At first it was just fun, but after one week I’m actually seeing some positive effects already:

  • I take the stairs more
  • I do more exercises at home
  • I go to the gym more
  • I floss more
  • I go to bed earlier
  • I eat less snacks after dinner
  • I spend less time in front of the computer

I find that the following elements of gamification work the best on me:

  • “Dailies” are recurring daily tasks. You lose hit points of you fail to do them. You gain increasingly more bonus if you keep doing on consecutive days. These two features give an added incentive to keep doing your “dailies”. Examples:
    • Floss
    • Do 20 pushups
  • “Habits” are things you should be doing, or shouldn’t be doing. So habits can have a positive or negative meaning, respectively. You lose hit points if you do a negative habit, and you gain bonus if you do something positive. Colors indicate how much you’ve been doing or not doing something. In case of positive tasks green means you’ve done enough, in case of negative tasks red means you’ve done too much. These features give incentive to keep doing positive habits and avoid negative habits. Examples:
    • Positive: Take the stairs instead of elevator
    • Positive: Go to the gym
    • Negative: Awake at midnight
    • Negative: Snack after dinner

Sounds interesting? Check out the tutorial to see how it works. This is a screenshot from my page just to give you an idea:


A surprising effect of the dailies was that now I spend much less time on answering questions on Stack Overflow compared to before. Recently it’s been kind of an addiction/obsession for me to collect reputation points on I was aware that I was spending more time than I should, but it was hard to resist. There, a simple daily task on HabitRPG seems to have cured that addiction. The task says: “Answer 1 question on Stack Overflow”. As a result, after I already answered one question on a given day, I have no more incentive to do more. In fact that would risk missing my other dailies.

In other words, if you think you are doing X too much, add a daily that says: “Do X for 1 hour”. After you’ve done that a day, you will get no extra benefit from it. The incentive to do more will be taken away. At least in terms of HabitRPG.

Sure, this might not work for everyone. In any case here are some extra tips for beginners:

  • The site is extremely buggy at the moment. Be careful. Maybe don’t gamify your entire life just yet. Start slow, and see as it goes, discovering the bugs and learning how to deal with them.
  • Don’t bother creating your own Rewards. From level 2 you can see the many built-in rewards, which are too good and hard enough to earn.
  • Don’t bother about the tags and advanced options. If you want to avoid hitting bugs, try to use the site the simplest possible way.
  • Don’t bother entering Todos. Install the Chrome Extension and link it to your other todo applications, such as Google Tasks, Asana or Workflowy.
  • Don’t add more Dailies than you can actually maintain. Start slow, add more later.
  • Prefer to add the small tasks that you always want to do but somehow you just never do… In my case these were things like flossing, pushups, sit-ups, taking stairs, etc. Things that don’t really take time, but somehow normally I just really don’t do them.
  • Whatever you do, do NOT become a HabitRPG addict! That would defeat the purpose!

Oh and by the way it’s open-source, here’s the main repository:

Released jQuery Upvote plugin

Published my first ever jQuery plugin just now: jQuery Upvote

The plugin simply generates a voting widget like the one used on Stack Exchange sites:

  • You can either upvote or downvote, not both at the same time
  • You can cancel an upvote or downvote by clicking again
  • The count is update accordingly
  • You can star (= favorite) and unstar
  • A callback method is fired on any update (upvote, downvote, star, and their reverse)

See it in action:


I’ve been needing this BADLY to add voting features on Hopefully that’s coming soon too 😉

Learning history expansion tricks in bash

Have you ever read the full man bash? Me: nah-uh… It’s way too much! Deep deep deep stuff.

In any tool, I tend to focus on a small set of tricks with very high practical value. For example these bash features:

  • Backward search command history with C-r
  • Delete words backwards with C-w or forward with ESC-d and paste them later with C-y
  • Jump around on the command line with C-a, C-e, ESC-b, ESC-f, or actually use C-w as a form of jumping back fast, or C-c to cancel and re-type

And so on. I use these in literally every single minute I spend in the shell, so they were really well worth memorizing! (See my slides on these and similar time-saving tricks on SpeakerDeck.)

I rarely memorize new tricks. There’s a sweet spot on the effort-benefit curve, beyond which the benefits are not that great. But from time to time I discover something new that might be worth learning and adding to my arsenal. Right now some history expansion tricks look pretty damn handy.

The event designator !!

!! is a type of so-called event designator: it refers to the previous command. I use this to save complex commands for later use, for example this operation on an Apache log file (get the number of requests per user agent):

cat access.log | cut -d\" -f6 | sort | uniq -c | sort -n
echo "!!" >>

This is not a perfect solution in this case, because the backslash there will disappear in the output, and in general it won’t work if there are unescaped double quotes in the command. However, there are many use cases when it can simplify my typing.

The word designators !$ and !^

As the man page says: Word designators are used to select desired words from the event. These two are expanded to the last argument and the first argument, respectively. They are relatively easy to remember if you consider the meaning of $ and ^ in regular expressions.

A typical example situation:

less /path/to/some/file
rm /path/to/some/file

Doing this and similar actions involves a bit too many key strokes: up + C-a + ESC-d + [type “rm”]. Easier to do like this:

less /path/to/some/file
rm !$

A similar feature is ESC-. which pastes the last argument while editing, so you can make changes before running the next command.

You can read more about these and similar tricks in man bash, under “HISTORY EXPANSION”.

Building reputation on Stack Exchange sites

Gamification… is ADDICTIVE! I got hooked on basically “collecting meaningless points” on the Stack Exchange sites. As I was building up a “know-how” of doing this, I started drafting this post. Then I gave up actually posting it, thinking “what the hell do I know about this stuff anyway with my puny reputation”?

But then, what do you know, @DuncanLock who has similar reputation as me has posted his own take on the subject, and guess what, he got literally hundreds of good reactions, including high-profile Stack Exchange users, moderators, and even @codinghorror himself:

The Smart Guide to Stack Overflow: Zero to Hero

I commented on his blog a few extra tips of my own, but later I realized I still have some more to say. So here we go, my follow-up tips for building reputation on the Stack Exchange sites, on top of what Duncan already covered nicely.

Get the basics down first

informed1. Do read the entire About page. Carefully. It’s really important to understand the site. Plus you get the Informed badge as a reward! This page is also important to understand the counting of reputation: (especially the daily max 200 limit!)

2. Be patient. It takes time to build reputation. If this was easy within a matter of days the system would be meaningless.

3. Be civil and professional. Don’t lash out on poor quality questions/answers/comments. Vote down if you don’t like something and move on. Don’t take anything personal, be cool.

4. Be a good sportsman. If somebody else posted a better answer than yours, admit defeat and move on. If somebody answered first something just as good as yours, vote it up and move on.

Finding questions to answer

1. Look for questions in your favorite areas of expertise. There’s much more than, take a look around the many other Stack Exchange sites. If you’re a programmer, check out If you’re more of a sysadmin dude, head over to or If you’re a UNIX/Linux expert, you will enjoy There’s probably something for everyone.

2. Be selective when you pick a question to answer. Figuring out what the heck a poorly written question is supposed to mean might not be worth your time and effort. And if you are not 100% sure you have a great answer immediately, then somebody else will probably beat you to it. It’s often better to just move on.

3. Devise question hunting strategies and combine them efficiently. I use the following basic strategies:

  • Fast-read the newest tab (click on Questions if you don’t see it), fishing for easy questions and try to be the first to answer. New questions are very visible because they are on the front page. That also means you don’t have much time to research to give a good answer.
  • Search by tags to find questions in your strongest subjects. Sometimes there are easy questions that dropped off the front page of newest questions. This can be very lucrative, as you are looking at questions in your strong area, and you have more time to research and give a good answer.
  • Only open questions with 0 or 1 answer. Often the first answer is not that great, and it’s quite possible that you can do better. When there are 2 or more answers it becomes less and less likely that you can give a better answer.
  • If you are tired of one site, or while waiting for a new set of questions to accumulate, switch to another site.
  • Setup filters on and email notifications of new questions in your favorite areas. This is most useful for tags with only a few questions per day or less. This is not useful at all for highly active tags with many questions per hour.

Typically I quickly scan the new questions. Usually I find a few I might be able to answer, read them properly, and if enough time passed, then if I reload the page I see a completely new set of questions. If I don’t see anything suitable, then I check on my favorite tags for a few minutes, and switch back again to the first strategy. Or instead of checking on favorite tags, I can switch to another stack exchange site.

4. Something that helps me a lot answering questions well (= actually getting rewarded for it) is to hunt questions when I’m deeply into something. For example, after about a week of Android hacking, suddenly I can answer many questions well and fast, because I’m just really right in the middle of it. Not to mention that when deep into something I usually have my own questions, and very often find answers that almost work but not quite, which is another good opportunity to post my own.

Drawing attention

Sometimes your otherwise great answer might not be getting the attention it deserves… Luckily there are quite a few things you can do to improve that.

1. If you intend to answer or already answered a question, don’t vote it up immediately. After answering, give it a few days, and if there is no reaction on it, then come back to it and vote it up. Such activity will bring the question up to the front page again, becoming more visible again, especially to the poster who will receive a notification in his Inbox. And if your answer is accepted, then be a good citizen and vote up the question. (You should not answer questions you don’t like anyway.)

2. Share your answer (or question) on your social networks. It’s very easy to use the [share] link right under the question/answer. Same with voting up the question, do this after a few days if the question is inactive.

3. Improve your answers. From time to time review your answers with zero upvotes and see how they can be better. Perhaps they were not clear enough, or maybe you answered too quickly and misunderstood the question. If the answer is not something you can proudly show to your friends, then maybe it’s better to delete it.

Collecting badges

Badges are cool goodies, but they don’t get you any reputation. They sure look good in your profile though 🙂

civic-duty1. Personally I don’t hunt badges. I think you can just let them come to you naturally. For example, you get the Civic Duty badge if you voted 300 times. That’s so cool, I didn’t even know it existed, and one day I just got this in my Inbox, yeay!

electorate2. Some badges reward you for using the site in a sort of “balanced” way. For example, you get the Electorate badge if you voted on 600 questions and 25% or more of total votes are on questions. The site also warns you if you vote mostly on answers only, saying that questions need loving too 🙂

Becoming a seasoned veteran

profile for janos on Stack Exchange, a network of free, community-driven Q&A sites

1. Once you have built up some reputation, embed “a piece of valuable flair” on your website, for example:

2. Check out the Stack Overflow “leagues”:

You can see the heaviest hitters by week/month/quarter/year/all-time on all Stack Exchange sites, as well as your own rank.

Another interesting thing on your profile page on (different from is the reputation tab shows a graph of your reputation score changes, for example:

By the way, on your Stack Overflow profile homepage (not Stack Exchange), in the Reputation section you can see a link to the leagues, in a format like “top 3% this quarter”. The value shown can be about the quarter, week, month or year, depending on whichever is highest for you, and it takes you right to your position in the leagues.


3. See what privileges you can unlock by earning higher reputation: It’s really cool how more and more interesting features of the site start opening up gradually. In a way it’s like going deeper down in the rabbit hole. For example, after about 2000 you can start moderating various types of posts (new users, low quality, etc), which reward you with new badges.

4. It seems that if you are active on a Stack Exchange site, sooner or later you get invited to It’s a very cool site where you can list your competencies much better than on LinkedIn, for example. Not only you can showcase selected high-scoring questions and answers from Stack Exchange, you can also highlight your most interesting open-source projects on GitHub or other code hosting sites. (You can check out mine here for example:


At the end of the day, I’m not sure how much effort is worth investing in reputation building, so I leave that up to you 🙂 Answering questions is probably similar to teaching: you always learn something even while you teach, so if nothing else, at least you have that!

Add Disqus to your WordPress or other blog

I’ve seen a couple of blogs using Disqus to show comments, but never really cared enough to check it out. Until now, and it looks like a pretty good idea!

  • Readers can “login” to comment using their Twitter or other social accounts. They don’t need to enter the usual boring stuff like name, email, website address anymore.
  • It gives you much more granular control for managing your comments compared to native WordPress, and in general it’s jam-packed with features.

Mainly I’m counting on that switching to Disqus will attract more comments. I myself feel it off-putting when a website is asking my name and email instead of letting me authenticate with an OpenID provider or Twitter. Sadly this blog was doing that too… Not anymore! This is definitely a good improvement.

I’m still discovering this thing, but it looks really useful. I might post more details later to highlight the best features that really work for me.

To get started using Disqus on your blog:

  1. Create an account if you don’t have one already
  2. Register your site on and follow the steps for WordPress or whichever other publishing platform you use. At least with WordPress, the steps were very accurate and easy to follow, a smooth process. Disqus gives you a pretty cool dashboard with many interesting settings.
  3. You can import your existing comments, Disqus reminds you of this during setup

By default Disqus shows ads, supposedly for your benefit, which is not so cool. Luckily it’s easy enough to switch it off on the Disqus admin. In case Disqus doesn’t really work out, you can export comments and import to something else later (or back to your WordPress).

Cool features of GitHub

I put together a simple presentation about some of the amazing features of GitHub. I focus on stuff that can be very useful even for folks who might not know Git and GitHub very well, or not at all. The idea is that by starting to use GitHub, they just might actually get on the fast track to becoming full-time Git users, who knows…

It’s a presentation, so the slides are not really designed for reading, but here they are anyway:

Once again, I used many tips from Zach Holman’s blog to “design” the slides. I also shamelessly borrowed colors and fonts from his other fantastic slides, especially this one. (I hope he wouldn’t mind…)

I created the slides using Google Docs, and since it looks like the links didn’t come out right in the PDF export, here they are:

My book Bazaar Version Control is now published

I am happy to announce that my book “Bazaar Version Control” has been released, and it is now available in online stores:

The sample chapter (Chapter 2: Diving into Bazaar) is a FREE download. It includes the preface, which is a nice, short and sweet introduction of the book. The chapter reveals quite a lot: it explains all the basic operations of Bazaar using both the command line client and Bazaar Explorer. It is a good sample of the overall writing style in the book, and you should definitely read this first before buying.

If you find the cover familiar, it is based on Gource, a truly awesome VCS visualization tool that works transparently with Bazaar. I wanted to include a proper section featuring Gource somewhere in the book, unfortunately due to time and space constraints I was not able to do so in the end. So here goes my very special thanks to the author, Andrew Caudwell, of this fantastic open-source project.

ImproperlyConfigured: The SECRET_KEY setting must not be empty

I hit by a strange issue with Django. If I try to use a local configuration with

./ shell --settings=myproject.local_settings

I got the error:

ImproperlyConfigured: The SECRET_KEY setting must not be empty

Strange because SECRET_KEY is certainly set. No stack trace, just a single line of error.

The cause turned out to be that in the main file I imported a method from one of my apps like this:

from accounts.views import render_failure
OPENID_RENDER_FAILURE = render_failure

I don’t understand why exactly this is a problem, but removing the import solved the issue. On the other hand, I needed that import as the OPENID_RENDER_FAILURE setting of the django-openid-auth package takes a callable, giving it the absolute function name accounts.views.render_failure as a string doesn’t cut it. I worked around that like this:

def render_failure(*args, **kwargs):
    from accounts.views import render_failure
    return render_failure(*args, **kwargs)
OPENID_RENDER_FAILURE = render_failure

Now everything works fine.

Deploying new releases using Git and the post-receive hook

I used to deploy new versions of my websites like this:

  1. ssh to the server
  2. cd to the website project directory (under version control)
  3. Update from VCS to the latest version

Doing this a few times is ok, but if you want to release frequently it’s better to automate these steps. One way to do that is using the post-receive hook of Git like this:

  1. Setup a mirror repository on the server called “releases”, with a branch called “beta”
  2. Make the deployment directory track the “beta” branch of the “releases” repository
  3. Setup a post-receive hook in the “releases” repository to trigger a script that updates the deployment directory (perform a git pull or git checkout -f)

The goal of this setup is to simplify the deployment steps to a single git push command from my local development/test environment to the releases repository. Then thanks to the post-receive hook, the pushed changes will be automatically propagated to the deployment directory, without manually logging in to the server.

First I created the releases repository from my deployment directory:

Next I created the post-commit hook:

(Hook scripts are in the hooks/ directory of a Git repository, and must be executable.)

I typically use two branches: “beta” and “prod”, and reuse the same “releases” repository for these. The above hook script checks the branch that is being pushed to, and checks if an upgrade script exists with the filename in the format “”. The real upgrade scripts exist in my deployment directories, because I don’t want to have too much logic inside the Git repository directory, I prefer that to be together with the project itself. In the Git repository root I put only symlinks to the real upgrade scripts.

Writing an upgrade script depends on your project. Here’s an example from one of my Django sites:

The script is written in a way to be reusable in multiple of my Django sites, but you may need to adjust to match your typical deployment. The unset GIT_DIR is necessary, because it seems the variable is automatically set when the hook is executed, otherwise the git pull operation would result in the error:

remote: fatal: Not a git repository: '.'

Finally, I setup the releases remote in my local Git project:

# go to the directory of my local project
cd ~/project/dir

# add the "releases" remote
git remote add releases ssh://

With this setup in place, deploying a new version is as simple as:

git push releases master:beta

To make it even easier, I created aliases in my .gitconfig:

deploy-beta = push releases master:beta
deploy-prod = push releases master:prod