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.