I have an actor setup where I have two consecutive routers. The first router is the parent of the second router. I wanted to move the configuration of these routers to the configuration file. Setting up the first router was not hard. The second one was a little tricker as the parent is different for each router. Continue reading
Author: nidkil
Pretty printing Akka config
Akka makes use of HACON (Human-Optimized Config Object Notation) for configuration. Today I needed to check the config that was loaded. When printing the config to the terminal it is displayed in a compact format. I wanted to pretty print it so it was easier to read. I found a briljant blog post by marcinkubala.
I adapted a code snippet as follows: Continue reading
Deleting a remote tag in Git
Today I deleted a tag in Eclipse using EGit that was already pushed to the origin. I then discovered that once the tag is deleted in the local repository there is no way in EGit to delete it from the origin. I am using Github as remote repository. So I checked if the tag could be deleted there. Unfortunately I could not find a delete option there. Bummer what now? Command line git to the rescue. Continue reading
My favorite Eclipse shortcuts
This is a collection of Eclipse shortcuts I use often:
Mange Files and Projects
- Alt+Enter: Show file properties of file open in the editor.
- Ctrl+S: Save the current file.
- Ctrl+Shift+S: Save all open files.
- Ctrl+W: Close the current file.
- Ctrl+Shift+W: Close all open files.
- F5: Refresh selected workspace element with the local file system.
Error: ‘git’ is not recognized as an internal or external command, operable program or batch file.
Today I wanted to add one of my Github repositories to a sbt project. I was working on my Windows laptop. I setup the following Build.scala file and placed it in the project directory under the root directory of my sbt project: Continue reading
Generating a large test file with Scala like the Linux dd command
I was writing functionality to merge download chunks yesterday. This functionality takes a file that is downloaded in chunks and mergers these chunks back into a single file. Writing the test class I did not want my test to depend on downloading a file in chunks, so I needed a way to quickly generate a number of chunks that could be merged. Under Linux the dd command is available that generates a file of a given size that contains random contents. I wrote a small helper class that does exactly this, with the extra twist that it splits the file into a number of chunks. Continue reading
Composable behavior in Scala
I continue to be amazed by what can be done with Scala. Once you start to understand the simplicity and beauty of coding in Scala it is really easy and fun. As part of my learning exercise I am implementing a multi threaded downloader. One part of the solution is a splitter. It takes a file size and splits it up into a number of chunks that can be downloaded in parallel. I have implemented a Chunk, that holds information about a chunk, as a case class and created a trait ChunkDownload that can be bolted on to this case class at runtime. This is so called composable behavior which adds functionality to the case class. Continue reading
Which open source license to choose?
I am working on a few projects I would like to release as open source. One of the important things to consider when releasing code as open source is the license to release it under. I think the license should not be an after thought, but a careful consideration up front before you commit your first code. What if you release it on Github and someone likes it and decides to contribute. Changing a license after accepting contributions is not trivial. Continue reading
Is the HTTP header Last-Modified always in GMT?
I needed to parse the HTTP header Last-Modified to a Java Date. When I tried to parse the value of the header “Mon, 02 Jun 2008 15:30:42 GMT” it threw an exception java.text.ParseException: Unparseable date. After playing around with the code a bit I figured out I needed to add TimeZone and Locale to get the value to parse correctly. Continue reading
Calculating the MD5 checksum of a file under Windows
I was working on my Windows laptop and needed to calculate the MD5 checksum of a file. Under Linux no problem, but how do you do that under Windows? As always Google is your friend. I found the Microsoft File Checksum Integrity Verifier tool on the Microsoft website. Easy to install and use. Continue reading