Tuesday, April 19, 2011

you R - so beautiful to me :)

Need to do statistical analysis of your data, plot a graph, etc:

http://www.r-project.org/

[Update 3/12/2012]: I am using RStudio  and it's a great tool!

Monday, January 17, 2011

Binary to Decimal conversation

I've been fiddling with bits and needed to convert a set of large  binary string to decimal. In my first attempt, I applied Excel formula BIN2DEC  - worked great, but for some reason it didn't with more than 12 bits. I am not sure whether there is some sort of limitation or perhaps I missed something, but I've started to look for other ways to do the same thing.

I've found answer on this  post, in particular in one the comments that suggested to use dc - an arbitrary precision calculator:

Here is how you would convert binary to decimal it in linux:

echo "2 i BINARY BITS p" | dc

example:
echo "2 i 11000000111001 p" | dc

and decimal to binary
echo "2 o DECIMAL NUMBER p" | dc
example
echo "2 o 12345 p" | dc

That's it! Thanks to Vocho Amerillo






Wednesday, December 1, 2010

Commonly used patterns for designing Scalable System

Designing a scalable system can be a tricky thing, before you jump into action check out a great post by Ricky Ho where he describes the eight common design patterns:
  1. Load Balancer
  2. Scatter and Gather
  3. Result Cache
  4. Share Space
  5. Pipe and Filter
  6. Map Reduce
  7. Bulk Synchronous parallel 
  8. Execution Orchestrator
I think Rick done a wonderful job. Thanks ! Can you think of anything else?

Wednesday, August 11, 2010

Adventures with ØMQ and Java : Installation

ZeroMQ - "fastest. Messaging. Ever." - well we'll see about that :)

Anyway, first thing first...we need to install ZeroMQ and ZeroMQ Java bindings in my case.

I am using Ubuntu 10.4:


First. install  ZeroMQ ( follow the instruction from the webiste http://www.zeromq.org/area:download#toc1)

Next, install Java Bindings (read this http://www.zeromq.org/bindings:java) - 
Important, make sure your JAVA_HOME is set to JDK location before you run autogen.sh script run ldconfig -v  at the end if you get:
"...cannot open shared object file: No such file or directory" 
when you trying to run your application  (thanks to this post)
Don't forget to include :
java -Djava.library.path=/usr/local/lib


That's it - Happy messaging!



Thursday, August 5, 2010

Tip: Akka 0.9.1 release (Scala 2.8) with Netbeans 6.9 (scala plugin)

I love Scala, for many different reasons - Scala actors is one of them.

However, it seems that Scala does not have a built in support for alternative serialisation (e.g., Google Protocol Buffers)

So I've decide to try Akka:
Akka supports using Google Protocol Buffers to serialize your objects. Protobuf is a very efficient network serialization protocol which is also used internally by Akka. The remote actors understand Protobuf messages so if you just send them as they are they will be correctly serialized and unserialized.  - from Akka website
Sounded good to me, so I've tried to compile some Akka sample code with Netbeans 6.9 IDE (did I mention that I also love Netbeans? well I do). Akka website gives you instructions how to set-up your developing environment. Basically you have several options:
  1. MVN option (maybe next post)
  2. Simple Build Tool (SBT)
  3. Add Akka jars to classpath

Personally, I think SBT is awesome, really do but it doesn't help me when I want to work with Netbeans IDE, not by much anyway (in my opinion).

Anyway, so back to the tip part: If you want to include Akka jars to your Netbeans project you need to follow the list of Akka's core jar files:

These are used in the core of Akka, so you need these.

  • configgy-X.jar
  • netty-X.jar
  • protobuf-java-X.jar
  • multiverse-alpha-X.jar
  • jsr166x-1.0.jar
  • geronimo-jta_1.1_spec-1.1.1.jar
  • jgroups-2.9.0.GA.jar

This didn't work for me until I've also included akka-jta-X.jar and akka-core-X.jar.

Hope it helps and saves you some valuable coding time :)

If you had  better luck or other experiences compiling Akka based project on Netbeans 6.9, please do comment.

Monday, July 19, 2010

myregexpr - regular expression just got easier

I am working on parsing a large set of linked data. It is tricky as you end up trying to find the right regex pattern to fit them all - sounds impossible!? Well, we'll see about that :)

Anyway, I would like to point you to a great tool that comes as a Java applet and as an Eclipse plug-in

http://myregexp.com/eclipsePlugin.html

It allows you to specify a regex pattern and enter a sample text that highlights the matched sections - cool!


Well, back to parsing now...