Thursday, September 8, 2011

Moved blog to mackiemathew.com

This is to notify that I have moved my blog to http://mackiemathew.com. This blog will be inactive from now on.

Cheers!

Sunday, August 28, 2011

Building Apache Hadoop from source

Please find the content at http://mackiemathew.com/2011/08/28/building-apache-hadoop-from-source/

Sorry for the inconvenience!

Sunday, August 14, 2011

Making Soap UI work on a mac

Soap UI is a great tool. There are no two words about that. But, they have really bad problems on the mac. I just downloaded 4.0.0 and the UI doesn't even load to send out a request. Looks like they've ignored the Mac, although they have gotten a flashy (totally unnecessary) installer for Mac. The only program I've seen who goes and does that.

So how to make it work. Download Soap UI 3.6 (or 3.6 beta 2), and it will work fine until you find out this nasty bug. You can't change the address of the endpoint of a request you are trying to change! Very Annoying! But there's a work around I came across looking at this forum post - http://www.soapui.org/forum/viewtopic.php?t=2293

The work around is - Click on the drop down, click your mouse somewhere else and release it on the option you actually want to click and that should do it. I would've never figured this out for myself. Hope soap UI can iron out the mac issues, as it's a great, great tool.

Friday, August 12, 2011

iTerm2 - The must have terminal for Mac OS

I'm used to splitting panes horizontally and vertically in Ubuntu. So for me, I needed something that does the same for mac.



iTerm2 was the answer. It's a brilliant terminal for Mac that's extremely smooth. Similar to Terminator for Ubuntu/Linux.

What's best is that it's the perfect answer for the 'opening new tab in same directory I was working in for mac' problem. This is must have feature for anyone who's used to working on a *nix platform. Here's how to enable it - http://code.google.com/p/iterm2/issues/detail?id=1217

Tuesday, August 9, 2011

Color theory

I'm using this page to keep track of resources in color matching and color theory:

  1. http://www.worqx.com/color/index.htm - Comprehensive coverage on color theory
  2. http://colortheory.liquisoft.com/ - One page cheat sheet
  3. http://www.tutorial9.net/articles/design/simple-practical-color-theory/ - Simple guide, good beginner stuff
  4. http://www.conceptart.org/forums/showthread.php?t=17837 - A simple guide done on a forum
  5. http://colorschemedesigner.com/  - Brilliant site to check out how your color scheme will look in real web pages

Sunday, August 7, 2011

5 things Usability is NOT

Thursday, August 4, 2011

[Caution] Don't change schemas in Cassandra

I came across this when I was executing the following segment of code. It main checks whether a column family is existent, and if not it creates one. Notice the synchronized block which doesn't allow multiple threads to execute this.


private boolean createCF(String CFName) { 
        BasicColumnFamilyDefinition columnFamilyDefinition = new 
BasicColumnFamilyDefinition(); 
        columnFamilyDefinition.setColumnType(ColumnType.STANDARD); 
        columnFamilyDefinition.setName(CFName); 
columnFamilyDefinition.setKeyspaceName(ReceiverConstants.BAM_KEYSPACE); 
        synchronized (this) { 
            boolean cfDefFound = false; 
            for (ColumnFamilyDefinition cfDef : 
bamKeyspaceDefinition.getCfDefs()) { 
                log.info("CF found : " + cfDef.getName()); 
                if (cfDef.getName().equals(CFName)) { 
                    cfDefFound = true; 
                    break; 
                } 
            } 
            // Column Family not found, so create it 
            if (!cfDefFound) { 
                ThriftCfDef cfDef = new 
ThriftCfDef(columnFamilyDefinition); 
                cluster.addColumnFamily(cfDef); 
            } 
            cfList.add(CFName); 
        } 
        return true; 
    } 

Problem is in a loaded scenario where multiple threads go through this code, it results in the following exception.

[2011-08-02 22:46:44,892]  INFO 
{me.prettyprint.cassandra.hector.TimingLogger} -  start[1312305404883] 
time[9] tag[META_WRITE.fail_] 
me.prettyprint.hector.api.exceptions.HInvalidRequestException: 
InvalidRequestException(why:CF is already defined in that keyspace.) 
        at 
me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(Excepti onsTranslatorImpl.java: 
42) 
        at me.prettyprint.cassandra.service.ThriftCluster 
$3.execute(ThriftCluster.java:68) 
        at me.prettyprint.cassandra.service.ThriftCluster 
$3.execute(ThriftCluster.java:62) 
        at 
me.prettyprint.cassandra.service.Operation.executeAndSetResult(Operation.ja va: 
101) 
        at 
me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover( HConnectionManager.java: 
156) 
        at 
me.prettyprint.cassandra.service.ThriftCluster.addColumnFamily(ThriftCluste r.java: 
72) 
        at 
org.wso2.carbon.bam.receiver.persistence.NoSQLDataStore.createCF(NoSQLDataS tore.java: 
168) 
        at 
org.wso2.carbon.bam.receiver.persistence.NoSQLDataStore.persistData(NoSQLDa taStore.java: 
124) 
        at 
org.wso2.carbon.bam.receiver.persistence.PersistenceManager.persistEvent(Pe rsistenceManager.java: 
55) 
        at 
org.wso2.carbon.bam.receiver.internal.QueueWorker.run(QueueWorker.java: 
69) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java: 
441) 
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
        at java.util.concurrent.ThreadPoolExecutor 
$Worker.runTask(ThreadPoolExecutor.java:886) 
        at java.util.concurrent.ThreadPoolExecutor 
$Worker.run(ThreadPoolExecutor.java:908) 
        at java.lang.Thread.run(Thread.java:619) 
Caused by: InvalidRequestException(why:CF is already defined in that 
keyspace.) 
        at org.apache.cassandra.thrift.Cassandra 
$system_add_column_family_result.read(Cassandra.java:23375) 
        at org.apache.cassandra.thrift.Cassandra 
$Client.recv_system_add_column_family(Cassandra.java:1333) 
        at org.apache.cassandra.thrift.Cassandra 
$Client.system_add_column_family(Cassandra.java:1308) 
        at me.prettyprint.cassandra.service.ThriftCluster 
$3.execute(ThriftCluster.java:66) 


This happens because, schema change methods such as cluster.addColumnFamily(cfDef) does not block. Cassandra takes time to propagate this schema change across it's nodes. Then the next thread that enters the synchronized block, fails the check to see that this column family already exists and tries to add it again. This results in the above exception.

Workaround: When you are doing schema changes such as this, try to do it in in your initialization code. Then as data is getting stored these changes will already get propagated without hitting this sort of exceptions. Or of course, if you have a static configuration, just make the changes in the Cassandra yaml file.