Thursday, December 23, 2010

Merry Christmas everybody!

Hi all,

Merry Christmas 2010!
Wish you a joyous Christmas, happy holiday!

Ubuntu Maverick Meerkat 10.10 on my laptop

Today I am doing a clean install of latest Ubuntu Maverick Meerkat 10.10 (the perfect ten!). This time I'm doing it from a USB drive, on Dell Inspiron 1420 (which unfortunately has always had problem for the WiFi device driver).

This time I won't get fooled around by installing the 32-bit version. This time it has to be the 64-bit kernel!
I followed the instruction given by PendriveLinux.com.

 It's quite straightforward and easy to install.

Tuesday, December 7, 2010

My wishlist for my blogger site

Now that I have my blog at Blogger/Blogspot, my wish list are:

  • a good syntax highlighter, at least similar to SyntaxHighlighter by Alex Gorbatchev; I know at certain time people managed to have it run on their blogger sites, but most of the links I found in Google is a very old links that seems to no longer working at all.
  • customize my own blog template
  • put links to my other blogs (I think this one should be very easy)

Sunday, December 5, 2010

Converting Wordpress Blog to Blogger / Blogspot

Today I am trying to consolidate my Java blog posts and separate some of my posts on Python, and also other stuffs here. All were previously in my Wordpress blog sites.
When I search in Google, there is a hope in wordpress2blogger tool. It is a hosted tool at Google App Engine. Google App Engine put the limitation of the upload to 1Mb, so you can only upload blog less than 1Mb in size. Of course we can work around the limitation by importing the blog bit by bit.
For my case, I divided into 4 chunks.

This is how I did it:

1. Login to your Wordpress account, and navigate to the Dashboard for the blog that you want to transfer to Blogger/Blogspot. I was using Wordpress 3.0 which had slightly different configuration and menu from the one described on the appengine hosted tool.
2. Click on Tools (left accordion menu section) > Export (link)
3. Download the Wordpress XML file.
4. Upload to the wordpress2blogger.appspot.com website, click [Convert] (button).
5. You will automatically download from the site, a new format that is importable by blogger. The file normally will be named blogger-export.xml
6. Open your Blogger account, create a blog if you haven't got one, or you can import to your existing blog. Go to this link: Dashboard > Settings (tab) > Basic (tab) > Import blog (link). Choose the file.

That's it! Done.

Saturday, December 4, 2010

Installing Go language on Mac OS X

I have tried the Go language from Google on Ubuntu few months ago. Now I tried it on my Mac OS X box and see whether it works on machines other than Linux box. Mac OS X is based on BSD, so I guess the difference won't be that much. Mac OS X runs on intel x86_64 architecture, and Go language supports that.
Go supposes to run well on machine with GCC, Mercurial, and Bash. Mac OS X has them all. To my surprise, I already have Mercurial on my Mac OS X box!

I created the /swdevel/golang/hgco. Then checkout from the Mercurial repository from Google Code.

I am following the instruction given here http://golang.org/doc/install.html

$ hg clone -r release https://go.googlecode.com/hg/ go
requesting all changes
adding changesets
adding manifests
adding file changes
added 6822 changesets with 26893 changes to 3944 files
updating to branch default
2435 fles updated, 0 files merged, 0 files removed, 0 files unresolved

It succeeded checking out from the Mercurial repository!

$ cd go/src/
$ ./all.bash
...
...
--- cd ../test
1 known bugs; 0 unexpected bugs

---
Installed Go for darwin/amd64 in /swdevel/golang/hgco/go.
Installed command in /swdevel/golang/hgco/go/bin.
*** You need to add /swdevel/golang/hgco/go/bin to your $PATH. ***
The compiler is 6g.

On OS X the debuggers must be installed setgrp procmod.
Read and run ./sudo.bash to install the debuggers.

Well, they warned me for a known bug!
The system doesn't seem to get the processor correctly, AFAIK my Mac Mini supposed to be Intel Core2 Duo while it detects amd64?!?

It displays a bunch of compilation messages. It took somewhere around 8 minutes on my Mac OS X box.
The 6g denotes that your architectures is x64, while 8g is for x86.

Then I need to do this:
$ echo 'export PATH=/swdevel/golang/hgco/go/bin:$PATH'>> ~/.profile

$ cat ~/.profile
Check whether you have exactly code below in the last line of your ~/.profile
export PATH=/swdevel/golang/hgco/go/bin:$PATH

Close your shell window, and open a new one (this is an important step so that your ~/.profile will be executed!).

Test on the new shell window:
$ 6g
It should displays something like this:
gc: usage: 6g [flags] file.go...
flags:
-I DIR search for packages in DIR
-d print declarations
...
...
-x print lex tokens

Done installation!
Next post will be showing the hello.go (hello world of Go language) on the Mac OS X box.

Wednesday, November 24, 2010

Back to go -blog

(reminds me of this picture below)

[caption id="" align="aligncenter" width="450" caption="Guru Go Blog"]Guru GO Blog[/caption]

For those who don't understand Bahasa Indonesia, "goblog" means "stupid". "guru" here means "teacher". A university or academy tried to increase the awareness of impact of blogging, and spread through the national seminar and workshop for teachers. But the title "guru go blog" means "stupid teacher". They should (as teachers should) pay attention to the English grammar. "Guru go blogging" instead of "Guru go blog" (which may also reflect the truth, by the way).

The lost of my blog settings in this domain, coupled with the coming of our newborn baby 2 months ago, has made me too lazy to post something on my blog. I did wrote some half completed blog entries, but didn't manage to finish it.

Now I began to realize that it was too long. This is not what I really want. I want to be able to update my blog regularly!

I managed to get my blog up again 3 months ago, and now the baby has been sleeping more and more regularly. I think it's time to come back to my blog.

Currently I am trying to compose a mini site on IT Career, and it is bilingual, in English and Bahasa Indonesia. The target market is of course the people beginning to enter career in IT and people in the middle of IT career (which is just like me).

Saturday, July 10, 2010

Again about Google DevFest 2010

Yesterday I had to leave an hour earlier from the Google DevFest 2010 event, as I have to  catch up with my wife, she was waiting for me for the second Antenatal Class. I missed the Code Lab, the Maps and Buzz T-shirts. Ouch. 5:30pm I had to leave while they ended the event on 6:30pm.

Flash back: After lunch time, there were some presentations on Google Apps, by Patrick Chanezon, followed by success story of people who developed applications for Google Apps. One from creately.com (http://www.creately.com). Another round from SingPath (http://singpath.appspot.com).

One thing that was missed a lot is the power points (aka power plugs). It was awful so many people carrying laptop and no power plug on the Connexis Theater. Almost everyone were running out of battery.

I just don't know why the crowd was kinda lacking enthusiasm to verbally respond to the speaker on stage with 'ooo's, 'aaaa's, 'yeah's, 'alright's and stuffs. Most of the time the crowd was silent.

Nevertheless it was a must-attend event of this year. I will attend the next event for sure.

 

Friday, July 9, 2010

In Google DevFest 2010

Currently I am attending the Google DevFest 2010. Timothy Jordan and Bob Aman in their presentation on Open Social.

Today the registration was pretty crowded, and they differentiate based on the first letter of your first name. I was in the "A-F queue". The queue was long and the registration process was draggy.

They changed the schedule a bit, Daniel Lee presented the Google Maps as opposed to the initial schedule on the web site: Google DevFest 2010 in Singapore. He showed us how to create a coffee shop location based informative web site as an example.

After the first session, Jeremy Orlow, an engineer working on the Chrome team, explained the HTML5 and the Chrome. They skipped the Q&A for HTML5 and Chrome. May be they pushed forward because we're late because of the registration, so in order to finish during the lunch time, the organizer advised to ask in person to Jeremy during lunch time for anyone who want to ask questions.

Then here comes the third session, and its about  Open Social.  Tim was of more lively presenter than others I think. More like MC may be? Google Buzz API stuffs, atom, OAuth, Salmon, Pubsubhubbub etc.

Wednesday, June 23, 2010

Chicken Pau Objective-C

Just like local saying: "If you can't buy a Big Mac, you may still settle with Chicken Pau".

Or we might as well call it "Objective C para gente pobre" (Spanish, thanks to Claudio) above title translates to "poor man's Objective-C".

What I mean by poor man's Objective-C is the development using the language which pre-dominantly using the Apple hardware and the latest Apple compiler. That the rich man's version of Objective-C.

But if you are just like me, who is still saving to buy an Apple hardware, may be this approach will be a short term cure for your addiction. We will start with something as simple as an Ubuntu 10.04 Lucid Lynx Linux box, which is far more affordable than Mac boxes. My objective was to be able to have a hands on experience with the Objective-C language, before moving to the platform where you need to invest more bucks. Practically I decided to learn the language using "poor man's Objective-C" (it's "Objective C para gente pobre" -- thanks to Claudio).

Luckily enough, the Objective-C compiler that we use are from the GNU family of compilers (gcc, cc10bj), which by far the most widely used and widely ported compiler family. It's available everywhere for free. Those guys at Apple also uses GNU compilers, which make it easier for us -- that we don't have to install another proprietary tools.

One sad thing though, the GNU compiler set doesn't fully support the Objective-C version 2 which is the case with latest Cocoa platform. But as I said, my objective was to have a hands on experience on the language, you get the feel, familiarize with it, then you can move one when you piggy bank accumulate enough to produce a bang on the fruity stuff.

Let's start. I assume you already have your Ubuntu box installed.

[sourcecode lang="shell"]
$ sudo apt-get install gcc
$ sudo apt-get install gnustep-base-runtime
$ sudo apt-get install gnustep-core-devel
$ sudo apt-get install gobjc
$ sudo apt-get install gnustep-gui-runtime
$ sudo apt-get install libgnustep-gui-dev
[/sourcecode]

Most of the time you just need to answer "Y" for the questions raised.

Let's make it official by writing a hello world application.
[sourcecode lang="c"]
#import <stdio.h>

int main(int argc, char** argv) {
printf("Hello, world!\n\n");
}
[/sourcecode]
Save the file as hello.m

Compile it using our gcc tool:
[sourcecode lang="shell"]
$ gcc hello.m -o test.out
[/sourcecode]

If it compiles successfully, try to run ti.
[sourcecode lang="shell"]
$ ./test.out
Hello, world!

[/sourcecode]

Here we go, a hello world in Objective-C!
Ok, it's a bit cheating, the only difference from the C language in the source code was only the use of import instead of the usual include

[sourcecode lang="c"]
#import <Foundation/Foundation.h>

int main(int argc, char** argv) {
NSLog(@"Hello, world!\n\n");
}
[/sourcecode]

Now, it's a bit hairy to set the compile right, but for now, just follow this:
Compile it using our gcc tool:
[sourcecode lang="shell"]
$ gcc hello.m -I /usr/include/GNUstep -fconstant-string-class=NSConstantString -lobjc -lgnustep-base -o test.out
[/sourcecode]

If it compiles successfully, try to run it.
[sourcecode lang="shell"]
$ ./test.out
2010-06-23 18:25:06.816 test.out[4981] Hello, world!
[/sourcecode]

Hooray, now we have the development environment that runs the Cocoa Foundation framework!

A glimpse of the Objective-C langauge

The Objective-C language has had history almost as long as C++. The languages was developed in roughly the same time (Stroustrup came with the C++ idea first, but the first implementation roughly emerged at the same period). The Objective-C has long seemed to be hidden somewhere in the secluded community while its cousin has made it to a whole bunch of commercial compilers and IDEs.

Only until recently the Objective-C shows back its teeth. Now with Apple Macbooks, Macbook Pros, Mac Minis, iMacs, iPhones, iPads, iPods devices around everywhere, the Objective-C is enjoying popularity as it has never before -- to the extent that now Apple is the largest technology company in term of market cap.

The language has been with the NeXT, a company founded by Steve Jobs after leaving Apple, and the company that brought back Steve Jobs to Apple. Having its popularity at its peak, it brought about the whole tools it's been using all those time.

I have always wanted to learn this language. I remembered it's been there for very long. I saw things comp.lang.objective-c group in the Usenet. But those day when my campus' bandwidth was still very limited, and the only few NeXT workstations are out of reach, it's difficult to get access to this language and platform.

A short look at the code revealed that it is a derivative of C language that one to make sure that the message passing between objects are very clear. I heard this was an influenced by Smalltalk, which I think make senses. I often encounter a lot with people who started learning and developing C++ applications; when they talk about object's "methods", they still call them "functions". They still ask "how to call this object's function" when the correct question is "how to invoke this object's method". That's not the case when you learn the Objective-C language. "invoking a method" also called "sending message" in Object Oriented paradigm (I think it's from Message Sequence Chart, the predecessor of UML's Sequence Diagram). The Objective-C is stressing more on the latter. It must also has been influenced by Mach micro kernel design and MPI which uses message passing instead of passing a shared memory location.

The good thing about thinking in a way of "sending message" or "passing message" from one object to another is, it applies well to a fine degree of parallelism. When you are running on a lot of core (as it is now), it's good to see the objects as sending messages to each other, and not invoking methods. "sending message" across objects are safe meanwhile "invoking object's methods" must consider all the thread related stuffs.

I know that in order to become a good Cocoa (the framework for Mac OS X and iPhone apps) application developers, we'll need to learn the language well. The language is used by most of the GUI frameworks in Apple platforms. While some of the syntax is just resemble what we have in C language, the Objective-C has also departed from C language in so many ways. Some of the syntax looks very weird, especially when you are from C++ and Java background like me.
It must also has been influenced by Mach microkernel design which uses message passing instead of passing a shared memory location.


[sourcecode lang="c"]
NSString *myStr = [[NSString alloc] init];
[/sourcecode]

I don't know how weird it is for you, but this is the syntax of allocating memory for the NSString object (simply by sending "alloc" message), then sending "init" message to the newly allocated object.

Friday, June 18, 2010

Now running on Wordpress 3.0

When I was editing one of the posts, I got a notification to upgrade to Wordpress 3.0. The upgrade was seamless (at least I didn't notice any glitches).

I wish some other application will be able to do the same thing when upgrading.

Great job, Wordpress team!

Wednesday, June 16, 2010

Twitter overloaded again...

Yesterday evening I opened Twitter site after not checking it for quite some time. It was over loaded... It says "Twitter is over capacity."

Some friend says last time they notice this happens when the Dow Jones Industrial Average (DJIA) dropped for a while.The market dip. It seems that the stock market users like to tweet.

What was causing yesterday's over capacity?

World Cup match?

Monday, June 14, 2010

Mercurial Server 1.0.1 Installation on Ubuntu

When we are working using Subversion, we can expose the Subversion repository using svnserve (open the default port 3690 and svn:// protocol) or leverage the Apache WebDav to expose your Subversion service in HTTP (the web protocol -- I've always tempted to write it as HTTP Protocol which is incorrect as the last P letter stands for 'protocol').

And of course if you are just as lazy as I, you will use the CollabNet Subversion or Edgewall Trac.

Mercurial Server from Lshift is one way to achieve similar thing. Though it is named Mercurial Server, it is not a server in traditional client/server perspective. It leverages the SSH authentication to make it like a central repository where multiple user can access and serves the same purpose.

Surprisingly, it is very easy to install in an Ubuntu box.

[sourcecode lang="shell"]
$ sudo apt-get install mercurial-server
[/sourcecode]

Gotcha! You have it now.
With this Mercurial Server, you can access the server using:
hg clone ssh://<ssh-user>@<host-name-or-ip-address>[:<ssh-port-num>]/<folder>

[sourcecode lang="shell"]
$ hg clone ssh://mercurial@192.168.0.1/projects
[/sourcecode]

Saturday, June 12, 2010

Attending Singapore Google Technology Group Meetup

 

Today I attended this Singapore Google Technology User Group Meeting. It's my first time to attend such a Google meetings. Some of previous meet ups had always fallen on the wrong days -- on the day that I have something else to do. Today I am glad to be able to make it, attended the meeting, and Wesley Chun, was the speaker. He presented 2 sessions, one about Python and the other one about Google App Engine.

This guy's a hardcore Python guy, wrote the Core Python series of book, and was a presenter in the PyCon Asia Pacific 2010, Singapore -- an event that has been held last 3 days. Awesome in depth knowledge, vast industrial experiences, and keep the talk flows fluent.

The rest about the meeting can be found here: http://www.sg-gtug.org/2010/05/sg-gtug-special-tutorial-session-june.html

Monday, May 31, 2010

VirtualBox now downloadable as "Oracle VM VirtualBox 3.2"

I just opened the Oracle Technology Network (OTN) website today and noticed that VirtualBox now listed on the new download as "Oracle VM VirtualBox 3.2". The link points to Oracle VM download link.

The crowd is still waiting what will happen next with this product as Oracle has already had its own VM before the Sun Microsystems acquisition.

Wednesday, May 26, 2010

NTLM authentication is no longer supported by Spring Security 3.0.x

I am exploring the way to automatically authenticated on Windows platforms on Spring Security. The older way of doing this is by using the NTLM_FILTER which works with Spring Security 2.0.x.

I just realised that the NTLM filter is no longer supported in Spring Security 3.0.x. The preferred way to do authentication is using the Kerberos.

http://blog.springsource.com/2009/09/28/spring-security-kerberos/

I have stumbled upon this Kerberos authentication has since my freshmen year at university back in 1995. It should then be  I remember when using the yellow page tools on SunOS in SPARCstation  boxes; the ypbind, yppasswd, etc (renamed NIS) are Kerberos based. It's been around for years, yet I haven't had much experience in setting the configuration on the server from scratch.

Now that I have to explore this, it's time to go in depth with this Kerberos stuffs.

The Windows NT which formerly has its own authentication system, that time, began to adopting standards such as LDAP, Kerberos, etc. NTLM -- which stands for NT LAN Manager, hum, sounds very very oldies kind of stuff -- has been superseded by Kerberos based authentication. Windows 2000 started providing Kerberos authentication as an alternative. Of course since the introduction of Kerberos based system, the transition has been slow, suggesting the new user to use Kerberos by default, and only supporting NTLM when they need backward compatibility with old systems (such as Windows 98). Nevertheless there are some people is still using the NTLM on their legacy systems.

The Spring Security team has deprecated the NTLM integration and move to Kerberos based authentication (for Windows systems) instead.

Sunday, May 2, 2010

Cost of not testing your solution will propagate and snow ball

Today I've a got a bit of relief at work, as we will have some free time for the next two days.

Today I will settle some things after the house moving. One of them is exchanging bulb. We need to replace 10 bulbs on the old rented house that has been damaged during our 2 years tenancy. The store didn't provide a testing platform for the bulbs, yet they provided one-to-one replacement guarantee. I bought 6 x SL twisted neon bulb, 2 x square-based SL neon bulb, 1 x 32w round TL neon bulb, and 1 spot light. From the 10 replacement bulbs I bought, one of them didn't really worked (defect). The store promised me for replacement when some of them are defect products. "Just don't throw the boxes, they said". Today is Monday, I bought the replacement last  Friday. Because I don't come to office on weekends, I have to postpone visiting the store to reduce cost (while losing time).

Hmm, even though I have one-to-one replacement guarantee, I still have to go down town to the store I bought from, and it's only just for this one bulb! For the replacement of this single bulb I have to go down town to the store near my office on off working day, pay the MRT (train) fare there, waste some time there, and then pay the fare for returning home again.

This event reminded the cost of not testing your solution thoroughly. Once it's rolled out, the impact wouldn't be just what you will feel at your coding room where you can simply fix, compile, and run again. The cost of replacement stuffs in production will create a huge snowball as it goes down hill. The issues, the delays, the lags will be propagated far.

Where as:

  • we are not perfect -- we produce bugs
  • the requirement guys are not perfect -- they produce defective or incomplete or inconsistent requirements
  • our customers are not perfect -- they might ask us to do some impossible or contradicting stuffs

I believe it still better when we do test the right way before we roll out to production.

Friday, April 30, 2010

LDAP Browser Applications

Recently I have to deal with connection Apache HTTPD (Web) Server to ActiveDirectory. Running authentication against an LDAP-based directory server, sounds trivial, but I found it, not really! There are a lot resources in the Internet, but most of them I still need some adaptation. Even more, because ActiveDirectory is not just a simple directory server, but it has multi-facets, and of course you are required to understand some of the details of Windows based authentication system.
I run my configuration on the latest Apache HTTP 2.2.14, while most of the samples were still using Apache 2.0, or even 1.3.
This task requires me to be able to browser my existing ActiveDirectory server, to see what is actually inside the directory server. My previous experience with ActiveDirectory servers was revolving around setting Windows servers and workstations users and group. Connecting a third party (I mean non-Microsoft) application using non-Microsoft technology (it's not VB6, it's not .NET, it's not COM application) posed some challenges for me.

I realize that in order to be successful, I need to be able to browse the directory server (LDAP server is not a correct term, directory server is the correct term), so I came into conclusion that:

  • I need a good client tool to test the connection first
  • I need to figure out the correct settings on the ActiveDirectory
  • I need to figure out the correct settings on the Apache HTTPD 2.2 configuration file (httpd.conf)

I found a few free and good client tools that works for my requirement:

I found out that Softerra's LDAP Browser 2.6 to be lightweight and very useful when you are using Windows system as the client. The cons is, it's a Windows application, means that you can't run it from other platform. I use the older version of this tool -- version 2.5 -- and discovered a lot of things about the ActiveDirectory server, before moving into the latest(version 2.6.

JXplorer download is the smallest! Currently JXplorer has the limitation of only displaying the first 1,000 items, which I found to be very annoying. It throws exception whenever bumping into this limitation (which you would for certain when browsing ActiveDirectory!).

Apache Directory Studio is based on Eclipse platform, and it's a big download (92MB), compared to JXplorer (3.2MB), and LDAP Browser 2.6 (5.6MB). It was built for Apache Directory Server (ApacheDS) project, but should work with any directory servers (at least it claims to be!). The benefit of Eclipse platform of course, we suppose to be able to update components without reinstalling the Eclipse platform. It's OSGi platform under the hood, so in case the provider maintain well the update site, we could update OSGi components as required.

Wednesday, April 28, 2010

How to go to Perhentian Islands from Singapore

I found out that some people wanted to go to Perhentian Islands from Singapore. Perhentian Islands is such a nice place in Malaysia, reachable by half an hour boat from Peninsula Malaysia's east coast - which means it is easily reachable from Singapore through land transport.

I have been there in two trips, both are really memorable! One trip was for snorkeling with church friends from Kuala Lumpur (KL). The other trip I went there with group of friends from Singapore for some scuba dives. While geographically KL seemed to be nearer to nearest city (Jertih) than from Singapore, the road from KL to Jertih is not as nice as west coast expressway. My first trip which was from KL took around 8 hours bus ride (KL - Jertih). My second trip was direct from Larkin Bus Station (Johorbahru - JB) to Jertih.

If you are cost conscious like me and wants to take bus from Singapore, I would suggest that you take the bus from Larkin Bus Station (JB) to Jertih instead of travelling down by bus to KL followed by another bus trip to Jertih. From Larkin to Jertih took about 10 hours as I can recall.

From Jertih you can take cab to Kuala Besut, where the jetty to Perhentian Islands are.

Shifting house

Recently it has been quite hectic at work and at home. Especially when you have to do it at once.

We are shifting house these 1.5 weeks, got many things to shift over, including one digital piano plus stand, one keyboard (66-keys, not 104 keyboard) and one MIDI controller, one rack sound module. Oh, forgot that one baby cots. Lucky it's now near the end of house shifting. The same suitcases have been moving back and fro around times. It's just 2-3 blocks away movement but once a while in a year or two, I regret why I accumulate so much things. Carrying two persons' things alone took more than just courage and strength, it took perseverance as well.

Nevertheless it's almost over now! Today's evening will be the hand over time for the old house. A lot of things had happened in our rented house these 2 years. A lot of memories. There's a certain kind of sad feeling when you have to leave the place you have been living with for years. But it's time to leave... Time to move on with life.

It's interesting how you can find a lot of things you have in your cache when shifting house. I found my 2 small ocarinas I bought in Harbourfront some times ago. I missed their voices.

 

Thursday, April 22, 2010

PyCon Asia Pacific 2010 has been firmly announced

Now they announce the PyCon Asia Pacific 2010.

http://apac.pycon.org/

9-11 June 2010, at Ngee Ann Kongsi Auditorium, Singapore Management University.

SGD 250 for corporate.
SGD 200 for early bird individuals.

Highlights:

  • Steve Holden, Chairman of the Python Software Foundation (PSF) will be coming  as one of the keynotes
  • Mark Hammond, author of "Python Programming on Win32"
  • Wesley J. Chun, author of "Python Core Programming", now software architect at Google
  • Martijn Faassen, a long standing member of the Zope Foundation

Friday, April 16, 2010

Missed PUG monthly meeting, exploring Java byte code and BCEL

I missed yesterday's Python User Group Singapore monthly meeting. I had to finish certain document before leaving office yesterday, I couldn't make it.

Last night I was exploring this Byte Code Engineering Library (BCEL) from Apache. This library gives us a way to analyse, create and manipulate binary Java class file. This library has been used by a lot of Java frameworks and containers, as those frameworks need to add some instrumentation when deploying those components in those frameworks and/or containers.

Well, this is considered an advanced thing in Java. Java classes are stored as Java byte codes. When you compile a Java source code, you will have .class file which is a Java byte code file. Java byte code is a form of machine instruction (in this case Java Virtual Machine or JVM). So it's executable binaries for JVM. Java byte code also have opcode like assembly language.

There are 2 type of instruction sets:

  1. stack machine
  2. register machine

Stack machine operates on stack. Operands are the stack only. The first programmable scientific calculators released by Hewlett-Packard are stack machines (http://www.hpmuseum.org/). They operate in a Reverse Polish Notation. I remembered that my first one of my first Java programming assignment was to implement GUI application for a Reverse Polish Notation calculator. My Dad has his own story of owning one of these calculators and he used to be very proud of the magnetic stripe stored Moon Lander game. It's just a number only Moon Lander, but it's a game running on programmable HP calculator!

Other sample of stack machines that most of us still use is the Intel x86 math coprocessor instructions set. It uses registers that are organised as stack, which will rotate back when overflowing the boundary (of 8 registers).

Stack machines, because it's only operate on stack and usually only the last few data in stack, may have shorter instruction bits. Unlike register machines which usually take some of the bits to specify from which and which register the data is from, and to which register the result goes, stack machines enjoy the benefit of default operands, that is top 1 or top 2 of the stack. The result is always in the stack.

I think one of the main considerations why JVM uses stack machine is to pack as few numbers of bits in the opcode. As most JVM runs as virtual machine, there will be no performance advantages of having a lot of register which anyway stored in RAM by the virtual machines.

Ok, enough for the stack machine, now back to the BCEL it's exciting to touch back the assembly language, byte code, opcode, operand, and stuffs if you are really into  it. I try to code a bit and will share the code later.

Sunday, April 4, 2010

What to do when you don't have locate tool

What to do when you want to find certain file(s) and you don't have the locate tool? Probably you are in Solaris, AIX, or other variants of UNIX that doesn't have the locate tool. Probably your Linux sysadmin just don't like the locate tool to be there?
May be you are in the support team and now that there is no fancy locate tool you still need to find where the file is located.

Someone at the mailing list asked about the question, so I will write it here so that everybody can benefit from it.

What we can do depends on the frequency of locating such files. If we are to mimic the slocate / mlocate (ubuntu) background process, this what I would suggest (assuming you have /root folder and have root equivalent access):

[sourcecode lang="shell"]<br /># find / -print &gt; /root/locations.txt &amp;<br />[1] 30851<br />[/sourcecode]



The number "30851" is the process number for the background process. You need to wait for a while until the background process completed. When it completes, it should display something like:

[sourcecode lang="shell"]<br />[1] Done        find / - print &gt; /root/locations.txt<br />[/sourcecode]


Whenever you want to search file name containing "tomcat-6.0", just run this command:

[sourcecode lang="shell"]<br /># grep "tomcat-6.0" /root/locations.txt<br />/home/dbaktiar/Downloads/apache-tomcat-6.0.24.zip<br />/home/dbaktiar/Downloads/apache-tomcat-6.0.26.tar.gz<br />[/sourcecode]


If you are using Ubuntu or sudo based tools, we can modify:

[sourcecode lang="shell"]<br /># sudo find / -print &gt; /root/locations.txt &amp;<br />[1] 30851<br />[/sourcecode]



Wait until the background process complete (you can do something else if the task take quite long).
Then to find files with "tomcat-6.0" string in its filename:

 

[sourcecode lang="shell"]<br /># sudo grep "tomcat" /root/locations.txt<br />[/sourcecode]


If you want to locate certain file(s) once you can run this (as suggested by Mr Budi Rahardjo):

[sourcecode lang="shell"]<br /># find . -name &lt;pattern&gt; -print<br />[/sourcecode]


Replace <pattern> with the full name or partial name of the file. When wespecify the name of the file, we can use wildcards, but don't forget to quote the name when needed.

Friday, April 2, 2010

COTD: a Chinatown's Starbucks?!?

In UNIX systems, we have motd tool, which is "message of the day", usually a short announcement or greetings from the system administrator. Sometimes it's also "match of the day" when we are talking about sports. I'll have my version called cotd "cup of the day", probably writing these messages while taking a sip of coffee.

On my way to gym at OneGeorge Street from Chinatown MRT, I usually take this route: Chinatown Point - Hong Lim Complex - Fook Hai Building - Hong Lim Park - OneGeorge Street.

Somewhere at the Hong Lim Complex, something always catch my attention.

I decided to take a picture of it.

 

Wednesday, March 31, 2010

My blog on domain danielbaktiar.com launches today

Today I have finally made a successful copy of my dbaktiar.wordpress.com. Now that I run wordpress blog on my own domain danielbaktiar.com.

There is some minor glitches, such as the exported than imported Wordpress now produces "&gt"s where it should display ">". Right now I just simply edit them one by one as there's not so much such occurrence. Overall I am highly satisfied with the smooth migration. The Wordpress team had done a great job to make it very easy to migrate and move Wordpress blogs around!

I decided to setup my own domain and hosted site because I need some degree of freedom in customizing my website, CSS, javascript, and also to put AdSense as well, too name a few.

Wednesday, March 17, 2010

Installation of Hudson in Karmic Koala (Ubuntu 9.10)

We are implementing Hudson continuous integration server heavily. Initially we are running all our Hudson jobs on a Windows box.

Hudson is an open source continuous integration tool. It gains popularity very fast and based on my experience in production, it is one of the most active open source project component I have been using. It is pretty common to get Hudson updates more than once a week.

With support from Debian community which setup the Hudson installer which updates easily through the apt tools, I became enticed to move to Ubuntu. I was following the instructions from the Hudson CI site.

These steps show how easy it is to deploy Hudson in an Ubuntu box.

[sourcecode lang="shell"]<br />$ wget -O - http://hudson-ci.org/debian/hudson-ci.org.key | sudo apt-key add -<br />[/sourcecode]


Add this entry to your /etc/apt/sources.list using your favorite editor.

[sourcecode lang="shell"]<br />$ sudo vi /etc/apt/sources.list<br />[/sourcecode]



Add this line at the end:

[sourcecode lang="shell"]<br />deb http://hudson-ci.org/debian binary/<br />[/sourcecode]


Then run the apt tool to update your Debian packages.

[sourcecode lang="shell"]<br />$ sudo apt-get update<br />$ sudo apt-get install hudson<br />[/sourcecode]


Upon finishing the whole thing, I popped out a browser and hit the URL: http://localhost:8080/, and YES! it works!

Friday, January 29, 2010

Oracle Announced the Outline Strategy on Integration of Sun

Oracle has announced  the outline strategy and its commitment  on Sun Microsystems integration into Oracle. It was in a Webcast and for those who missed it, could get it from the website.

This is the link from Oracle website.

We already noticed some additions on links in the Oracle Technology Website (http://otn.oracle.com) which includes newly added Sun's technology portfolios.

Friday, January 22, 2010

EU Commission Approval of Sun Microsystems Acquisition by Oracle: Lesson Learned

Yesterday James A. Goosling, the founder of Java platform, put a picture in his blog: "So long, old friend...".
After the EU Commission approved Sun Microsystems (NASDAQ: JAVA) acquisition by Oracle Corp (NASDAQ: ORCL), Oracle expects that Russia and China will also accept it. The main foreseen obstacle to the agreement was the EU Commission approval. Now that it has been approved, the acquisition is expected to go smoothly.

Some people began speculating on the fate of open source projects, which nurtured by Sun, yet they don't believe that Oracle will give enough support for those open source projects. One high profile fear was from Monty Widenius, the founder of MySQL, which after selling the company to Sun left MySQL (the company), and forked a new database project: MariaDB. He campaigned to prevent the acquisition of MySQL by Oracle. Now we see the result, it seems that he lose the campaign. Some voices also speculate about the fate of OpenOffice, Glassfish, etc after the acquisition.

This matter once again prove: "a technology is good, but we also need to make money". Of course Sun Microsystems is not the first to go down, there were a lot of dead carcasses of open source companies ended up acquired by profitable commercial companies that sell their proprietary products.

Sun is highly respectable company, which produced a lot of very good products. All hail respect to the company that bred the Java technology and platform, which took over the world. Yet, after this high profile achievement, the company still need to make money to bring value to the shareholders.

Lesson Learned: Companies Need To Make Money In Order To Sustain the Business

I guess this serves as reminder for those people (including me) who wants to make a company based on sophisticated technology, either open source or closed source; take note, when we start a company, we also need to make money.

Now that Wikipedia site had grown that big, the non-profit model required it to campaign for more money to sustain its operation.