Google Tech Talk: Java Puzzlers
June 26th, 2008
Tobias found this cool Google Tech Talk about Advanced Topics in Programming Languages: Java Puzzlers.
The puzzles are sometimes very non-intuitive, and is mostly results of bad API’s or other strange features. Some of the puzzles aren’t very useful, but it’s always nice to have a deep understanding of a programming language.
Watch the talk a YouTube:
Learn Python in 10 minutes
June 22nd, 2008
My friend He Yu provided me with a link where you can learn Python in 10 minutes. A nice introduction to Python assuming that you know general programming.
I’m looking into Python for two reasons. One; I want to expand my knowledge of programming languages. Two; Next term I’m taking the course Introduction to Algorithms where Python is the language we will be using. It’s always nice to have a head start.
Update:
It turns out that the professor teaching the course has written books about Python and also written a short tutorial. Click here for tutorial.
Christopher Langan, a very smart man
June 22nd, 2008
I just found a really fascinating documentary about Chris Michael Langan. He has an IQ between 190 and 210, had a very bad childhood, works in a bar and has many interesting views on the world we live in. Particularly the part where he talk about his experience with the school system is interesting. As he says in the documentary:
I found the whole experience of school to be highly annoying. I think I could wrapped the whole thing up in a couples of years. Instead they managed to keep me around for twelve. [...] My teachers just didn’t particularly care for me.
I totally agree with him. We have to realize that smart people need special attention. They should be inspired to learn more about fields they find interesting, and maybe one day make a breakthrough in their field or fields. We need more people like Newton, Einstein, Euler and so on.
The school system in Norway takes care of the people who are less fortunate than the average person, but they don’t seem to care about people who are more fortunate, i.e. people with high IQ. The politicians should really sit down and do some drastic changes to the school system. We need to get back to the basics of learning and get rid of all the pedagogical bullshit that’s being suggested.
See the documentary on YouTube:
Part 1:
Part 2:
Part 3:
Que pasa?!
June 20th, 2008
Mats has written a great post on the difference between being inspired by and outright copying. The two Norwegian geniuses Magnus Andersen and Thomas Skorpen has created this amazing new website for keeping you’re friends and family updated with that you’re doing. This revolutionary can be found at qpsa.no (Norwegian language).
Disappointed? So am I. The page is, like mats says, a outright copy of twitter (with a crappier design). Magnus and Thomas, you should be ashamed.
Read Mats’ post to see how non-revolutionary qpsa really is.
Bug when trying to edit existing snippets in gedit
June 18th, 2008
When trying to edit the existing snippets in gedit the changes was gone the next time I opened gedit. It turns out that the predefined snippets is located in /usr/share/gedit-2/plugins/snippets/ (I’m running Ubuntu 8.04). To edit these files you need root access, which gedit doesn’t have (unless you do “sudo gedit” or something). To fix this I moved the snippet files from /usr/share/gedit-2/plugins/snippets/ into ~/.gnome2/gedit/snippets/. Fix in terminal:
sudo cp /usr/share/gedit-2/plugins/snippets/* ~/.gnome2/gedit/snippets
It’s probably possible to change the permission of the files too.
How to use and write snippets
June 17th, 2008
In TextMate and in gedit (probably more editors too) you have the option to use snippets. I love snippets, and they make my day much easier.
To make a snippet you have to define a tab-trigger which is a word or a random sequence of characters that you will remember. Then you have to write the snippet body.
Easy example: If and else statements. When you write “ife” and press tab you want an if-else statement to pop up. We write the snippet:
-
{
-
$2
-
}
-
else
-
{
-
$0
-
}
$0, $1 and $2 are where the cursor will be placed. When you first type “ife” and press the tab button the cursor will be where the $1 is. If you hit tab again the cursor moves to $2 and so on, but you always ends up at $0. Now you can use this snippet whenever you need it. Just write “ife” press tab and fill inn the code you need.
More advanced example: Lets say you are getting tired of writing all the code for a for loop every time you need one. Make a snippet!. We set the tab-trigger to be the string “for” and write the snippet:
-
{
-
$0
-
}
What the ${1:i} does is that it sets the 1st cursor position and sets a default value (“i” in this case). The default value is marked, so when you tab to the position you can immediately overwrite the default text. And an other thing in this example worth mentioning is that we use ${1:i} more than once. This enables you to change the default at more than one place at once. Let’s say you don’t want your variable called “i”, but “index”. You still just write “for”, press tab, and “i” is marked. You now write “index”, and the “i” in all 3 places where it’s used will change to “index”. Then tab again to set the start value of the for loop, and yet again to set the max value for the loop. After choosing variable name, start value and max value you just have one tab left. The last tab brings to you $0 and you’re ready to write some code inside the for loop. If you tab one more time while the cursor is at $0 the tab sequence will start over.
gedit + plugins = \o/
June 17th, 2008
I’ve been looking for good editor for Ubuntu for a while, and I think I found it. After reading Micah Carrick’s post on Customizing gedit as a Web Developer’s IDE I was amazed how much gedit with plug-ins could do. It almost have anything I want in an editor. I don’t know if I would call it an IDE though. Missing debugging and CVS/SVN is kinda important in an IDE. There are debugging plug-ins for Perl and Python, but not for PHP, Java and JS (which is the languages I mostly use).
Personally I like the same preferences that Micah uses. I enable indent with 4 spaces, turn of line wrapping and enable line numbering. Read a more detailed description in Micah’s post.
Plug-ins I use:
- Gemini
A plug-in which auto-completes parenthesis, brackets and so on (the characters: < { [ ' " " ' ] } >) and nicely indents and places the cursor where you (me) want it. This plug-in is an absolute life saver!
Before return is pressed (notice that there is no “}”):
{//Cursor here
After return is pressed:
{
// Cursor here
}
- Symbol Browser
Shows a list of classes, functions, enums and class fields.
- Snippets
This plug-in allows you to define snippets of codes which appear when you use a tab-trigger. This one saves you a lot of time. Make a for-loop with a few keystrokes. See my post on how to use snippets.
Screenshot of my gedit (oblivion theme):

If you use an awesome plug-in or something for gedit please leave comment!
Amazing twelve year old talks about jQuery
June 16th, 2008
I just found this amazing clip with the wonder child Dmitri Gaskin. He’s twelve years old, contributes to dupral, involved in the google summer of code and attending 6th grade classes! This is something you don’t see everyday. He talks a bit fast, but that’s just because he’s nervous. Anyways, a twelve year old kid on Google Tech Talks is damn impressive!
I just realized how powerful jQuery library is, and I will definitely start using it.
See the clip on YouTube:
Wish I was that smart when I were twelve years old :-|.
Game bonanza
June 12th, 2008
Today I received GTA 4 in the mail. I also went to the nearest store that sells PlayStation 3 games and bought Metal Gear Solid 4 (released today!) and Skate. I’m looking forward to playing all these games, but mostly GTA and MGS.
My current game collection is now twice as large:
- Grand Theft Auto IV
- Metal Gear Solid 4
- Skate
- Assassins Creed
- Uncharted: Drake’s Fortune
- Ratchet & Clank Future: Tools of Destruction
I got a PS3, the 40gb edition. Game on!
Spam be gone!
June 11th, 2008
I’m logging in to the blog’s admin panel and I see this:
For a second I thought “Am I really THAT popular?!”, but of course, I’m not :-(. It turns out that I’ve been hit by spam bots (again).
Luckily for me word-press already got a plug-in to handle spam called akismet, you just have to activate it.
To do this you have to register an account at wordpress.com to get a API-key. I know I have an account there, but I couldn’t remember my password. You might think the “lost password”-function would fix the problem, but it didn’t. I got the “warning” mail with a site to visit if I wanted to reset my password. I pressed the link and a message tells me to wait for an email with my new password. After two days of waiting I decided to try again, but with the same result. Since the something obviously wasn’t the way it should be I had to register a new account to finally get my API-key and activate aksimet.
If aksimet keeps Mr. spambot away I would say that all the trouble was worth it.
