-
Setting up IMAP with Yahoo! Mail
I’m a long time Yahoo Mail user. Just to illustrate how long I’ve been with them: when I joined the space available was a couple of MBs! I staid with them because I was mostly satisfied (never really caught the GMail bug), however recently I started looking for options to consolidate the different email accounts…
-
Manually enabling IP routing in Windows XP
While Internet Connection Sharing is a nifty tool, there are some cases where you would like to do the steps manually. One such case would be if the “primary” network is already using the 192.168.0.1/24 address space, since ICS is hardcoded (as far as I can tell) to use the same network. One concrete case…
-
Is hand-writing assembly still necessary these days?
Some time ago I came over the following article: Fast CRC32 in Assembly. It claimed that the assembly implementation was faster than the one implemented in C. Performance was always something I’m interested in, so I repeated and extended the experiment. Here are the numbers I got. This is on a Core 2 Duo T5500…
-
How to quickly start up a webserver with Python
Sometimes you need to quickly start up a webserver that serves up static files (I will describe such a case in the next post). Python to the rescue (works on both Linux and Windows if you have Python installed): For Python 2.x (this is what most sites show you): python -m SimpleHTTPServer 9914 For Python…
-
Why you should use 0.0.0.0 in your hosts file – redux
Some time ago I (wow, time files!) I suggested that using 0.0.0.0 for host-file based blocklists would be faster than using 127.0.0.1. Above you can see an other reason for using 0.0.0.0: some applications take up port 80 on the localhost and accessing it can (potentially) create havoc. In the example above TeamViewer (which is…
-
Augmenting Log4J stack traces with class versions
If you have multiple versions of your code in production, it is extremely useful for the log to include the version of the classes when producing a stacktrace, otherwise it is very hard to match the lines in the stacktrace with the lines of the source code (sidenote: there is an optimization in the Sun…
-
Remote debugging with Java
Sometimes you have the situation that an issue is only occurring on certain machines or only at a certain time of day. There are a couple of possible methods to investigate such an issue (like: adding extra logging), however I would like to add an other one: remote debugging trough TCP/IP. To do this, start…
-
Navigating (Searching) Collections
Update: this article has been crossposted to the Transylvania JUG blog. The Java collections framework includes the concept of NavigableSets / NavigableMaps. The principle behind these interfaces is that taking a SortedSet/SortedMap you can use a subset of it. Some examples: Given the following set: @Before public void setUp() { set = new TreeSet(); set.addAll(Arrays.asList(1,…
-
How to test for the implementation of toString()
Update: This entry has been crossposted to the transylvania-jug blog. Problem statement: you have some value objects for which you implemented toString() (for debugging purposes) and now you would like to test using a unit test that these implementations exist. Possible solutions: Use reflection to detect the existence of the method: boolean hasToStringViaReflection(Class clazz) {…
-
Non-buffered processor in Perl
Lets say that you have the following problem: you want to write a script which processes the output of a program and writes out the modified somewere, with as little buffering as possible. One concrete example (for which I needed the script) is log rotation: you want to save the output of a program (which…