December 18th, 2009 — Tech
If you’re reading a lot of code you may get to the point where you’d like it to be clean, so it’s easier for you to read. There’re a lot of resources about the beauty of code around and in this post I’d like to share some ideas about writing concise if statements.
Although these ideas may apply to a lot of different programming languages I chose to give examples written in Java, PHP or Python. There should be no problem to translate this into other, similar languages.
Continue reading →
December 14th, 2009 — Tech
Just recently I discovered that there’s something called sexy prime numbers. I read about twin primes but hadn’t heard the other term before. The concept is pretty simple: take a prime number and check whether the next prime minus the first one results in a certain number, e.g. 2 for twin primes or 6 for sexy primes. This post presents a simple solution to calculate arbitrary combinations of prime number pairs, triplets, etc.
The Eclipse project with the code for this post can be downloaded as tar.gz or zip. You can browse the code online here.
Continue reading →
December 8th, 2009 — Tech
I’ve always wanted to try Joda Time and in this post I’d like to present some code that finds Friday the 13th dates. Wouldn’t it be interesting to know when the next Friday the 13th is or which year has got the most occurrences of this particular day?
The Eclipse project with the code for this post can be downloaded as tar.gz or zip. You can browse the code online here.
Continue reading →