Author Archives: David

Epic 4G USB tethering with Ubuntu Oneiric 11.10

It’s been a long time since I had to patch kernel code, to get a popular device to work with Linux. I was having an issue tethering a Samsung Epic 4G to an Ubuntu 11.10 netbook over the USB cable. When I plug things to Ubuntu, they just work most of the time. So this […]

Posted in Ubuntu Linux | Tagged , | Leave a comment

Delete old log files

Logrotate is an utility in Ubuntu that allows package maintainers and admins to regulate how logfiles are stored, compressed and rolled for backups. When creating lean virtual machine images, I found that I didn’t want to keep any logs. I also didn’t want to go an reconfigure logrotate. You can use the find command to […]

Posted in Bash | Tagged | Leave a comment

Blog your status to a file using Bash

I wanted to take notes about what I’m currently doing at work, but I didn’t want to upload this info to Twitter or Facebook. I also wasn’t in the mood to put MySQL and Tomcat to work hard on my laptop. I just wanted something off-line and local for security. I wrote this bash script […]

Posted in Bash | Tagged , , | 2 Comments

Run a System Process from Scala

Here’s an example on how to run a System process from Scala. + ProcessBuilder simplifies the creation of the Process object + A Scala Actor reads the console output buffer concurrently + reactWithin allows us to timeout if the process hangs + receiveWithin in the main thread, guards us in case the Actor gets stuck […]

Posted in Scala | Tagged | 2 Comments

Test private methods in C# .Net

I was writing Unit Tests for a module that has many private methods. With these tricks, my UnitTest assembly is allowed to access all methods and properties as if they were declared Internal, rather than private, without changing the production code modifiers to internal. When creating the Unit Tests, Visual Studio 2008 suggested I added […]

Posted in C# | Tagged , , | Leave a comment

Format and Indent XML in Ubuntu Linux

While playing with Castor, I used one of their tools to generate an XML file. The problem is that the XML file was one line. It was pretty hard to read with the text wrapping. Here’s how to turn ugly.xml into pretty.xml in Ubuntu Linux Install tidy: sudo apt-get install tidy Parse the ugly xml […]

Posted in XML | Tagged , , | 2 Comments

Find the full Path of a Resource File in the Classpath

Hardcoding the filesystem location of a file in your tests, can become a maintenance problem. If the resource file changes location, you’ll have to update and re-compile your code to match the new path. One way to solve this problem is to add the file to the Classpath and get it as a Resource. import […]

Posted in Java | Tagged , | Leave a comment