May 252015
 

Just to remind myself in case I get lost again:

  • Install Oracle JRE 7, at least for now JRE 8 is not recommended
    • Editย /etc/apt/sources.list.d/webupd8team-java.list with these lines:
      deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main               
      deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
    • Import GPG
      sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
    • Install
      sudo apt-get update
      sudo apt-get install oracle-java7-installer
  • Install Cassandra
    • Edit /etc/apt/sources.list.d/cassandra.source.list with these lines
      deb http://debian.datastax.com/community 2.1 main
      deb-src http://debian.datastax.com/community 2.1 main
    • Import keys
      curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add -
    • Install
      sudo apt-get update
      sudo apt-get install cassandra
Feb 072012
 

I hit this problem in my project which is hadoop-based:

Cannot run program "chmod": java.io.IOException: error=12, Cannot allocate memory

Did some research but found nothing useful – everybody mentioned it’s JDK’s problem not using fork()+exec() which caused excessive memory allocated during spawning new process for running shell command. However, it’s weird that I hit this problem on my AWS micro instance only, not on my MacBook, so I moved on to check some more –

It turned out swap is a problem, my micro instance in AWS does not have swap enabled (i.e. zero swap space), after add 1G swap everything’s fine now.

I’m a Java newbie, so my question is, though it got solved, did I do something properly?

Jul 212011
 

It seems to me it’s my Java time again – several things are pushing to try out Java although the company is still moving forward to C/C++ and PHP.

First problem is Android, this is a platform that EVERY application needs to think about, and obviously Java is the only way to get things done (I heard of NDK, but it seems it is not a full function development kit).

The next one is migration, I’m seriously thinking about migrating all my Java Web sites to PHP so that we can leverage resources within the company, such as resource pool. I need to dig into some sample applications to see how much effort we need to get this done, but since Java developers won’t like this idea (although they know about it), I don’t expect they are going to give me reasonable evaluation, so I have to be hands-on.

Nothing else, I still don’t believe Java is a good choice for any applications other than e-commerce, and this makes me sick as it does sound like “COBOL is the excellent choice for business system” …

Yes, Java is heavy and fat, it does not fit into my world :).

Jul 132010
 

Time to get hands dirty in Java mud ๐Ÿ˜€

Lots of projects here are Java based, plus something like Struts, Spring, Hibernate, etc.ย I don’ t like the structure much but I have to understand how to get things done, or at least I need to be able to read those codes and configurations (I hate so many configuration files in Java world).

I was trying to setup Eclipse with Struts2 and Tomcat, I was so amazed by memory management in Java VM, want to know my impression? In one world, MESS. >:) After dealing with this and that kind of all sort of “MaxXXXSize” configuration directives (or command line parameters), I finally figured out “-XX:MaxNewSize=128m” and “-XX:MaxPermSize=128m” are two of the most important parameter to make Eclipse stop reporting “PermGen Space” error.

Thinking of setting up such an IDE really takes time, I was thinking maybe I should go back to my vim time …

BTW, people here developing software on local machine (I mean desktop), Java is cute in this case – write once and run everywhere.

Nov 132009
 

I’ve deployed Cassandra to my development environment, running on 4 servers with replica 2. I picked the number 4 and 2 because it’s more like a real world thing, and it is the requirement from my friend. I can test fail-over etc later on.

I’ve also composed some scripts to do service stuffs – the script I composed can start/stop/restart Cassandra gracefully, it can also tell status of the node and the cluster, it’s a simple Shell script, I will make it a service under Fedora, and a init.d script under Ubuntu (I’m running only these two platform now). Cassandra was upgrade from 0.4.1 to 0.4.2 days ago, and I used that as a chance to test my deployment stuffs, seems pretty good. I think I just need to be careful with 0.4.x => 0.5.x upgrade since it may break compatibility on configuration and command line.

I’ve converted my PowerBook to a dedicated client machine running Fedora … it’s a pretty old machine and seems Apple does not want to roll out new software (such as JDK 1.6) for it, so I did some survey around and picked Fedora (Ubuntu is not ppc friendly – the support is community based).

And finally I have Thrift/PHP up and running. At the very beginning I was thinking I should use Java as the client but later one found that I have no idea how to develop Java based web application, and since Thrift mentioned it supports all C/C++, Java, Perl, PHP, Ruby, Python pretty well, I should just pick my favorite language to do the test and then let real clients pick what theyย  want to use (where is my client, BTW? ๐Ÿ™ ).

And yes, I confirmed the schema (though Cassandra is schema-less thing), I’m going to test the schema with PHP client today. After that I will have to find a place to hold all my codes/configuration, etc, in a subversion, and based on what I found so far, github.com is the best candidate.

Will update here today or tomorrow.

Time to Java again

 Triviality  Comments Off on Time to Java again
Aug 072009
 

It seems time to do some Java stuff again.

The new project may have to support both C/C++ and Java thinking of the popularity of (stupid) Java in the company.

So, let’s have some fun with Java.

May 212009
 

I don’t quite understand application types under Mac (OS X), I remember I stopped trying out XCode just because I cannot determine which one to use, and I also made wrong assumption that Java is the way to go as I can share (some) source codes cross platforms.

Now I got a book talking about how to build Mac applications with XCode, and it clearly stated:

For Carbon:

The Carbon template defines a pure Carbon application. Carbon is the C interfaces to Aqua and the legacy support for applications written using the APIs in Mac OS 9 and earlier. Use this template if you are porting an application from OS 9 to OS X, or you want to create native applications using only C or C++. The main.c file includes a skeletal application that loads the main.nib file, creates the application’s window, and starts the main event loop. See http://developer.apple.com/carbon/ for more information about Carbon applications.

For Java/Cocoa:

Mac OS X includes an extensive bridge between the Java programming language and the Objective-C APIs defined in the Cocoa framework. These Java proxy objects make it possible to use most of the Cocoa and Foundation frameworks as though they had been written in Java. If you need to create a native Cocoa application and prefer, or require, the Java programming language, create a Cocoa-Java application. The template sets up a Cocoa application whose native executable is the Cocoa-Java stub. This stub application creates a Java runtime, that loads and starts the Java classes which constitute the application. Read more about mixing Java and Cocoa at http://developer.apple.com/documentation/Cocoa/Java-date.html. Apple has recently announced that it will no longer be updating in the Cocoa-Java bridge beyond Mac OS X 10.3, so the future of this technology is murky.

For Cocoa:

Cocoa is the preferred application development technology for Mac OS X. It is based on the Objective-C programming language. The Cocoa framework is the Objective-C interfaces to Aqua and most other Apple technologies. If OS X has a “native” development environment, Objective-C and Cocoa are it. A few technologies are only available using Cocoa interfaces. The Cocoa template creates a minimal Cocoa application. The only functional part of the project is the main.m file which does nothing but create and start the generic NSApplication object. It does provide generic handling of the About This Program menu item, but it does not include a Credits.rtf file.

From three paragraphs above, it is clearly Java is NOT the way to go, it will be dropped by Apple sometime in the future, also Carbon is for legacy applications.

So, the right way is indeed doing Cocoa application with Objective-C, I get to read around to see if I can get some tests done.

I’ve upgraded my PowerBook months back with latest OS X (Leopard), plus makek it 2G memory, so that I’ve been able to install XCode, however, the machine had been idle since the upgrade, I should do something so not to waste my money (I have enough time now, not using my time is just a waste).

May 202009
 

Boss asked me check out Google’s App Engine, and said that’s cool and could be the direction that we are going to move to, though we may only serve internal customers.

I’m still playing with it – I’m not familiar with Python no Java, and I don’t like them too much, but I can try.

Is grid/cloud the right thing to go? Doubt, but since there are so many experts take it seriously as future, let’s assume it is the direction. It may like “open system”, or “client servr”, or “3-tiers achitect”, or “go web”, or “virtualization” – all these words used to be fancy or cool, but later on they just become our daily life in development. ๐Ÿ™‚