Saturday, July 30, 2011

IT Booze Meetup #2: Scala, Clojure, Groovy

Today, I had a chance to attend local user group IT Booze. It was the second meetup and it was very interesting, because of topics which were under discussion: Scala, Clojure And Groovy. I love such events especially in my town. :-)

I'd like to share my reflections regarding these cool languages.

As you know these languages are very popular on JVM (of cause not so popular as Java :-). And I'm sure every passionate Java/JVM developer has been thinking "what's the Next Big Language". It's really hard to choose the next one.

So, here is a short "brain snapshot":
  1. Scala and Clojure are great languages with huge amount of interesting features, but to master them we need to use Scala (or Clojure) on daily basis.
  2. Scala appeared as complex language. I think it requires a steeper learning curve then Clojure or Groovy. It means we must invest much, much more.
  3. Clojure has lisp syntax, but innovative concurrency concept is worth to look into. I say lisp, because it might be a stopper for someone to evaluate it as a next big language.
  4. Clojure and functional programming require to "patch" our way of thinking. And it can be difficult.
  5. Groovy is agile language. We (Java developers) can start using it right away. I think we should invest more in Groovy just to boost our productivity in: scripting, testing, automation routine work, etc. It doesn't require big investments and we can learn as we go.
So, here is outcome from this meetup:
  • start using Groovy
  • look into Clojure concepts
  • postpone Scala for now
Could you please share your thoughts regarding this?

Wednesday, July 20, 2011

How to disable System.out?

I have a legacy code base with tons of System.out.println(). Actually, I don't need this in production, but during development it's cool enough to have. So, I've decided to disable System.out:
package org.halyph;


public class DisableMain {
	public static void main(String[] args) {
		PrintStream printStreamOriginal = System.out;

		boolean DEBUG = true;
		if (!DEBUG) {
			System.setOut(new PrintStream(new OutputStream() {
				public void close() {}
				public void flush() {}
				public void write(byte[] b) {}
				public void write(byte[] b, int off, int len) {}
				public void write(int b) {

		long a = System.currentTimeMillis();
		for (int i = 0; i < 1000000; i++) {

		long b = System.currentTimeMillis() - a;


So, plain looped println required ~10 seconds on my laptop, and only ~1 second with null output stream.

Tuesday, July 19, 2011

Ubuntu Server 10.04.2 VM Basic Configuration

 + +
Required tools:
  • VMware Worstation
  • Ubuntu Server 10.04.2
  • Kitty (Putty ssh client fork)
I suppose that You know how to setup plain VM via VMware.
And here is my basic Ubuntu VM configuration:
  1. Ubuntu Server 10.04.2 doesn't include SSH server by default. That's why you have to install it:
  2. sudo apt-get install ssh
  3. Check your Ubuntu VM IP:
  4. $ ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:0c:29:04:55:d6
              inet addr:  Bcast:  Mask:
              inet6 addr: fe80::20c:29ff:fe04:55d6/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:50 errors:0 dropped:0 overruns:0 frame:0
              TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:6303 (6.3 KB)  TX bytes:7366 (7.3 KB)
              Interrupt:19 Base address:0x2000
  5. Configure Kitty connection host name: 
  6. Create two scripts for:
    • startup VM in background (start_vm.bat)
    • set MYVM="F:\VMs\ubuntu-10.04.2-server\Ubuntu Server 10.04.2.vmx"
      set VMRUN="E:\Program Files\VMware\VMware Workstation\vmrun"
      %VMRUN% -T ws start %MYVM% nogui
    • shutdown VM (stop_vm.bat)
    • set MYVM="F:\VMs\ubuntu-10.04.2-server\Ubuntu Server 10.04.2.vmx"
      set VMRUN="E:\Program Files\VMware\VMware Workstation\vmrun"
      %VMRUN% stop %MYVM% soft
  7. Configure Kitty for auto-login:
  8. VM startup and Kitty run can be combined into one script

Monday, July 11, 2011

Clojure Books


Books which aren't fully dedicated to Clojure

Coming Soon (in progress)