Category Archives: Musings

Overriding TMPDIR when you don’t have enough space on /tmp

Sometimes you might not have enough disk space on the /tmp directory but need it badly. For example when creating a deb package from a Java tarball in Debian using make-jpkg, there’s no command line parameter or any other apparent means to specify an alternative working directory for temporary files.

Check-mate? Luckily, no! I could force a different directory using the TMPDIR environment variable like this:

TMPDIR=/some/where make-jpkg  jdk-7u45-linux-x64.tar.gz

Solaris got goood (version 5.11)

Looking through my old drafts in this blog, posts I never published, I found this piece.


I recently installed the new OpenSolaris, version 5.11, released in 2008 December, I think. From the live CD. On my laptop. Earlier versions used to be quite painful, and I would definitely not consider putting on a laptop. (Ah, that’s a lie. I did actually install 5.10 on my ThinkPad X31…)

5.10 used to require a LOT of disk space. I remember failed installations on a virtual machine with a 10G virtual disk, running out of space. The new 5.11 system installed from the Live CD is only 2.4G now, much better!

But enough talking, let’s get to technical stuff. What compelled me to post this entry is the ease at which I could do things that used to be difficult, such as:

  1. Setup sudo. In the past I had to install sudo and visudo myself. Now, they are included in the system by default.
  2. Install vim. This used to be tricky too, now it’s installed by default, with all the modern features such as syntax highlighting. Oh joy.
  3. Setup sudoers. In the default configuration users in group “wheel” can execute all commands. Solaris doesn’t have a group called “wheel”, but it has a group called “staff” with GID 10, which is the usual GID for “wheel”. After making this change I was going to add my user to this group, but then, I found it was already member of this group, which makes perfect sense, as this is the first user I created during installation.

And so on and so on. These are little things, but it’s great to see real UNIX systems becoming free and so much more usable than in the past.


I don’t know why I didn’t post, back in 2009. I guess I wanted to write more cool things. I’m posting now, because it made me want to install OpenSolaris again 🙂

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: http://stackoverflow.com/help/whats-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 stackoverflow.com, take a look around the many other Stack Exchange sites. If you’re a programmer, check out http://programmers.stackexchange.com/. If you’re more of a sysadmin dude, head over to http://serverfault.com/ or http://askubuntu.com/. If you’re a UNIX/Linux expert, you will enjoy http://unix.stackexchange.com/. 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 http://stackexchange.com/filters/new 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: http://stackoverflow.com/users/641955/janos/flair

2. Check out the Stack Overflow “leagues”:
http://stackexchange.com/leagues/1/alltime/stackoverflow

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 stackexchange.com (different from stackoverflow.com) is the reputation tab shows a graph of your reputation score changes, for example:
http://stackexchange.com/users/322516/janos?tab=reputation

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.

rep-top-info

3. See what privileges you can unlock by earning higher reputation:
http://stackoverflow.com/privileges. 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 http://careers.stackoverflow.com/. 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: http://careers.stackoverflow.com/janosgyerik)

Conclusion?

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!

Practical tips & tricks in the Linux shell

I put together this simple presentation about a few simple but very effective practical tips that should make you lightning fast on the command line. I use these literally every minute I spend in the shell. All the tips should work in Linux, UNIX, BSD and similar.

  • I used many tips from Zach Holman’s blog to “design” the slides.
  • I created the presentation using Google Docs, but it was not really a great experience:
    • The dotted green line you see under headings is not intentional, it appears only after exporting to PDF. I don’t know why. I would prefer it without the line as shown correctly in Google’s viewer, but I want to use Speaker Deck as it is not blocked at my workplace and has a better WordPress plugin.
    • The JavaScript seems to go crazy in the presentation editor. The longer I use it, the heavier it gets, until I do a clean fresh reload.
  • I used the Speaker Deck Embed plugin to embed the presentation here. Oh and Speaker Deck is really awesome.

Computer and IT Quiz

Recently I started contributing to this fun Computer and IT Quiz app on Android:

Android app on Google Play

Mike Heyworth created the original app, I contributed mocks and elements for the new design, which Mike incorporated in the latest version of the app released just a few days ago. If you are in IT, do try it out, challenge yourself, test your skills, and just have fun with it!

If you like this FREE app please do buy the PRO version and support us!

More usability and design improvements will be coming soon (1-2 months), so stay tuned!

 

Capture the Flag 2.0

Another nicely put together hacking challenge by @stripe.

https://stripe.com/blog/capture-the-flag-20

Flex your hacking muscles in 8 increasingly difficult challenges. This time the challenge is more web oriented. What? You think just because you’re not a web programmer you don’t need to know this stuff? Oh I think you do mister! Now get your ass over there and put some effort in it. The contest ends on August 29, 2012.

You can skip the intro and dive right in on this page:

https://stripe-ctf.com/account

How to get involved in an open-source project?

Obviously everybody has a different approach to this. Mine involves these main elements:

  1. Find a project you like
  2. Find a project that needs you
  3. Jump in

How to find a project you are interested in?

Ask yourself:

  • Is there a particular open-source software that you just love so much?
  • Is there an open-source software that is almost what you want but just almost?
  • Is there an open-source software where somebody you admire is involved in?

How to find a suitable project that needs you?

Based on your answers above, get on Google and find the website of a suitable project. Some additional factors to look for:

  • When was the last commit? (i.e. recent enough?)
  • How many active committers are there? (i.e. more than one, less than 10?)
  • Which VCS do they use and how can you submit branches? (i.e. a VCS you don’t mind using)

How you evaluate these factors is entire up to you. Personally I prefer small-ish projects where my work will be noticeable, but not too small where the developers might not be too welcoming to new faces.

How to get involved?

Please, please suppress your inexplicable desire of sending an introductory mail saying “hey I’m here I want to work on X”. Do NOT send such rubbish. Also do NOT brag about your past projects either.

The only meaningful introduction is contributing code, period! Just pick something you can improve in the project. Anything! Preferably something small, and indisputably an improvement. Your first commits should not be about showing off your genius. Your first commits should NOT be a big refactoring that makes more sense to you. Your first commits should be small, rock solid and easy to accept. In the beginning keep doing small things, gradually bigger and bigger.

Coding style: in the beginning you just have to adopt the coding style used by the others. Make sure to spend some time on observing the coding style of the core contributors, and adopt the same style in your own contributions. If you disagree with it you can propose an alternative later after you are already a recognized member.

Caution!!!

Be patient. Don’t get your hopes high early. It takes time to get to know the members, and it is impossible to know in advance if your personalities will be compatible or not.

If for some reason things don’t work out with the project you picked, don’t let that bring you down. There are plenty of fish in the ocean of open-source projects, don’t expect you’ll find the right one for the first try. Be patient and keep looking. As long as you learn something from the experience, your efforts will never be wasted.

From zero to Django: get Django going in windows within minutes

My 5-step banana ice cream recipe got more reaction in one hour than my usual geeky posts in years. Maybe I should combine the two concepts! Or maybe not. Heck, I already like this title so here’s the geeky recipe: a decidedly imperfect recipe for getting my django project up and running on a fresh new install of windows.

Preparation time

minutes!

Ingredients

Preparation

  1. (optional) Install putty, create ssh key with puttygen, save private and public keys, add to authorized_keys on repository server, start pagent, add the key to it.

  2. Install python, install setuptools

  3. Edit environmental variables:
    1. Append to PATH: c:\python27;c:\python27\scripts
    2. Set BZR_SSH=c:\program files\putty\plink.exe
  4. (optional) Install git

  5. Fire up the bash terminal (git bash or DOS command prompt)

  6. easy_install pip

  7. (optional) Install Bazaar, bzr co bzr+ssh://myserver/~/repos/project

  8. Install Django using pip: pip install django==1.4 (use the version you need!)

  9. Install dependencies of the Django project, typically listed in a file: pip install -r requirements.txt

  10. Run in Django’s local server: python manage.py runserver

Best served in a modern browser like Chrome at http://localhost:7000/ Enjoy!

Variations for the more adventurous

  • Screw putty, use the openssh that comes with git bash
  • pip install virtualenv, create a virtual env and run Django inside it.

How can I decide which permissions to allow or disallow to an Android application?

As far as I know, I cannot. When you install an Android application you get a list of “permissions” the app wants to use, but you have only two choices, all or nothing: allow all permissions and install the app, or don’t install at all.

A few days ago I needed a random number generator, basically to simulate a dice. Sounds simple enough, I thought there must be an app for that. So I tried a couple, but they all require some permissions I really don’t want to give, for example:

  • Random Number Generator #1
    • Network communication – full internet access
  • Quick Random Number Generator
    • Network communication – full internet access
    • System tools – prevent phone from sleeping
  • Random Number Generator #2
    • Network communication – full internet access
    • Your location – coarse (network-based) location
  • Random Number Generator #3
    • Network communication – full internet access
  • Dice
    • Network communication – full internet access
  • Dice Me Online Free
    • Network communication – full internet access
    • Phone calls – Read phone state and identity
  • Simple Dice (Free)
    • Network communication – full internet access
    • Storage – modify/delete SD card contents
    • Your location – coarse (network-based) location, fine (GPS) location
    • Phone calls – read phone state and identity

At this point I give up. It’s too hard to find an app that just generates random numbers without requiring any permissions. I get it, many of the above apps are free, and probably it’s because of the in-app advertisements that they require internet access.

Wouldn’t it be great if instead of just getting a list of permissions an app wants, I could select with checkboxes the permissions I’m willing to allow? Apps could query if they have some permission and handle it gracefully if not. That would be great. Wonder why they didn’t make it work like that in the first place. Advanced search where I can specify permissions I’m willing to allow would be nice too.