Let there be job cuts

No Comments

So there has been another round of job cuts here, again. This is the
second one I’ve survived, and it’s said to be the 3rd or the 4th,
depending on who is telling the story.
No idea if this is connected to the ongoing crisis. Don’t we all use cash, uh?
That just reminds me of one line I should append to my last entry:
what good can you get from a company whose office somewhere does not
even have enough toilets?
That’s one bloody toilet with a single closet for over thirty men! Nuts?!?!

Strings

No Comments

What good could you get from a programmer who even cannot avoid
viruses/malwares?
What good could you get from a country whose people endure the most
messy road traffic?

Only some texts

No Comments

Long time no blog, again.
There’s simply no exciting things for me over this long period after returning from Germany. Ah, yes, except one thing: I’m now engaged, after 5 years:)
I’m back to Mylyn , and am developing the habit relying on it to organize my daily work. My company hosts an internal portal site using Share Point. Well, I’d say that I would like to use it if I’m someone who does not need to use anything other than the Microsoft Office suite, but I’m a poor coder, which means I don’t make a living using Microsoft Office but my IDE. I’ve been using Eclipse for 5 years also, meaning that I already had it in my last computer when I met my girlfriend (who has just been promoted lol). I’d tried other alternatives and eclipse still remains to be the best choice for me ever. I like the whole ecosystem built on the eclipse platform; there are not only plug-ins for developers, but a lot of decent desktop/RIA applications, either public available or proprietary.
I should suggest my friends and colleagues to give Mylyn a try. It really helps. And I’m also trying Tasktop Pro for Eclipse, which is available as a 30-day free trial and is at the price of 99.00 USD or 149.00 USD depending on the type of the license. There are simply more features in this Pro edition, such as integrations with Outlook, Gmail and Google Calendar, making them task repositories. I think I’ll buy one; the price is reasonable and it worths. One thing to mention is that seems key developers of the Mylyn project also work for Tasktop; I often see them in the Mylyn newsgroup. To me, Mylyn is the first Eclipse plug-in offered by eclipse.org that is not about development but is for development.
Well, and I tried developing a connector for TeamTrack, which is used by my company for tracking defects and something else. Having been googling and reading for 2 hours, I finally found the web service APIs that TeamTrack provides, yet I don’t think the operations it exposes can meet the need to build a complete connector. And also it seems one even needs to be familiar with the database tables to perform queries via TeamTrack’s web service! I currently have no technical information available so finally I decided to give up making such a connector, but to use the generic web connector to parse HTML pages with regular expressions… This is only one of the basic differences between proprietary products and their open source alternatives.
Moreover, there’s a bug with the Mylyn generic web connector and it fails to authenticate via HTTP Basic authentication method, whoa. It’s said to be a code migration/integration problem so I guess it’s easy to deal with, though.
Honestly, Office 2007 is good; I can use Visual Studio 2008 with VSTO to make a few simple add-ons for my Outlook. I’d agree there’s more value out of Microsoft’s products, because everyone can see that Microsoft’s products are engineered to be able to work with each other; this is something other companies need some years to develop.

Going to the UK

No Comments

by air next Monday.
The UK is actually my first stop. I’ll stay there up to maybe 20 days
or so, and then will move on to Germany. Everything regarding this
trip has been in such a hurry that I feel right like I’m dreaming.
Everything, the passport application, Schengen visa application and
the UK visa application, as well as other miscellaneous affairs and
exceptions.
I’m now packaging. The plane leaves at 11:35 a.m. that day, but I was
told I’d better be at the airport 3 hour earlier. Counting in the 2 or
3 hours by highway, that means I’ll leave home before dawn.
Wish there will be no other exceptions.

Lyrics of Bryan Adams’ (Everything I Do) I Do It For You

No Comments

I remembered this song while I was young and was a middle school pupil.

Look into my eyes – you will see
What you mean to me
Search your heart – search your soul
And when you find me there you’ll search no more

Don’t tell me it’s not worth tryin’ for
You can’t tell me it’s not worth dyin’ for
You know it’s true
Everything I do – I do it for you

Look into your heart – you will find
There’s nothin’ there to hide
Take me as I am – take my life
I would give it all – I would sacrifice

Don’t tell me it’s not worth fightin’ for
I can’t help it – there’s nothin’ I want more
Ya know it’s true
Everything I do – I do it for you

There’s no love – like your love
And no other – could give more love
There’s nowhere – unless you’re there
All the time – all the way

Oh – you can’t tell me it’s not worth tryin’ for
I can’t help it – there’s nothin’ I want more
I would fight for you – I’d lie for you
Walk the wire for you – ya I’d die for you

Ya know it’s true
Everything I do – I do it for you

Only 1 of These 8 “Girls” is Really a Girl

No Comments

Long time no blog, and I really feel embarrassed to paste a picture full of girls.
This is actually from a Japanese magazine showing autumn schoolwear for girls in the year 2007. Surprisingly, only 1 of these 8 “girls” is really a girl…
http://pl9u4g.tuk.livefilestore.com/y1psnH19IFgZeln-D6b29Z30T35kQqmM6qmJt1hOnKhYaHbeX18GwgxoJWNEyKQl-sxeGRucLFfyHI/33.jpg

Locating the Guilty Java Threads

6 Comments

A summary of my recent experience with resolving an 100% CPU utilization issue.

We know well that in Java 5 and above we have the mighty java.lang.management.ThreadMXBean which is able to give us almost all ordinary diagnostics information of a given thread, except more detailed information that only debuggers are able to tell. However, such information is implementation/vendor dependent and some information, like CPU time measurement, might be disabled by default, and moreover, in my humble opinion, these information may be not very accurate since they are reported by the JVM itself, not by the OS.

Luckily, almost every popular OS supports some means of measurements down to the threading level, and on the Java side, we have the thread dump (of course, also in popular JVM implementations). I’m here taking Ubuntu, Windows XP with SUN JVM (5.0 for Windows and 6.0 for Linux) as an example. This example demonstrates the process to find the thread that is utilizing unusual amount of CPU time in a Tomcat instance hosting a very simple web application.

When there’s something wrong caused by the JVM, say, similarly, it simply occupies all CPU time, you can always find the guilty threads by doing so:
1. Getting threading information from the OS.
In most Linux distros, a single ps command can handle this. For instance, ps H -eo user,pid,ppid,tid,time,%cpu,cmd –sort=-%cpu , will print out all the processes and their created threads, sorted by the percentage of overall CPU utilization. We can always RTFM for more information about *nix commands;)
ps H -eo user,pid,ppid,tid,time,%cpu,cmd --sort=-%cpu
In Windows, however, getting threading information for a process might be harder. I suggest using Process Explorer, which is the most easy to use tool amongst other equivalents.

First of all, open the “Properties” dialog of the JVM process.

See Process Properties

Next, click on the “Threads” tab to see threads of the process. You can see that they are sorted by CPU utilization by default.

Enumerating Process Threads
(I have a dual core CPU and this thread is occupying a whole core)
2. Getting a thread dump from JVM.
This task should be easier for us as Java developers;) In Linux we use kill -3 PID,
Producing Heap Dump in my Ubuntu Linux
(I was running less logs/catalina.out after the thread dump, because I wrongly started Tomcat by bin/catalina.sh start instead of bin/catalina.sh run. Never mind)
and in Windows we can simply hit Ctrl+Break in the console window that is running the JVM process.
Producing Heap Dump in Windows
3. Finding out the Java thread from
Usually the thread ID printed by the OS are in decimal format, and this value needs to be converted into a hexadecimal. And next, no other magic other than finding “nid=xxx” terms in the thread dump. See highlighted parts:

7772=0x1E5C

Thread ID 0x1e5c

2148=0×864
Thread ID 0x864
Yep, that’s it, test.Test.test();. I’m not going to amuse you by posting the source of test.Test.test(), since it’s no more than an infinite loop:D

Regards and hope this helps.

Bravo, Kaiyuan Wang

No Comments

It was quite a piece of shocking news produced by Kaiyuan Wang, a fully dedicated Open Source, um, should I say, evangelist. There’s no need for me to repeat what has happened. All I have to say is that, I AM ON HIS SIDE. I’ve never ever imagined that someday I can see such a brave Chinese, although in foreign countries there are a lot of such people who dare to even sacrifice for their undertaking. It’s too hard to realize one’s dream here.
Unfortunately, many Chinese people on the network have misunderstood his sincere and passionate activity to some kinds of show up. Well, I might have to understand their suspiciousness, because they have been cheated heavily, especially on the network and other medias. However, if one has read the news carefully enough, there should not have been such doubt and suspicions. Was Wang making a show for his employer, LPI, which is a non-profit organization giving Linux certifications? If he did make a show, he was making a show for the Open Source community, which is almost unknown in this giant country.
I saw many comments around doubting and even reviling Wang, and as usual, all of the comments have well reflected the ignorance of their poor authors, the ignorance about free software and Open Source. They even do not spend a little of their shitty life on researching for what on earth is free software and what the hell is Open Source, to add some knowledge to their m*****f***ing brain.
Forgive my rudeness towards such people.
For videos, see http://v.blog.sina.com.cn/b/2207514-1193866854.html and http://v.blog.sina.com.cn/b/2219402-1271664693.html

Paraskavedekatriaphobia

No Comments

I suppose you all have adverted. It’s another Friday at a 13th date.

The fear of Friday the 13th is called paraskavedekatriaphobia or paraskevidekatriaphobia, a specialized form of triskaidekaphobia, a phobia (fear) of the number thirteen.

— From CrystalLinks
However, I’m not a patient with such a disease:)

Start the Eclipse TPTP Profiling Agent under the Standalone Mode in a Linux Box

No Comments

I did this long ago. Since I’m not required to do it repeatedly, it took me another 15 minutes to get warmed up. This time I’m recording the procedures here as a preparation for tomorrow’s exploration on why the hell that tomcat instance was taking so long to start up.

  1. JVM arguments: -XrunpiAgent:server=standalone,file=/home/iusr/tc.trcxml,profile=/home/iusr/piAgent.options,filters=/home/iusr/piAgent.filters. It’s convenient to export all this twittering to JAVA_OPTS which is used by tomcat to pass to JVM;
  2. Adjust the LD_LIBRARY_PATH environment variable to include directory “<eclipse_install_or_ext_point>/plugins/org.eclipse.hyades.execution.<OS>.<CPU_ARCH>_<VERSION>”, e.g., in my Edgy box it’s “/usr/local/eclipse-extension/eclipse.org/tptp/eclipse/plugins/org.eclipse.hyades.execution.linux.x86_4.2.2.v200701141614″;
  3. Compose the profile configuration, filters configuration. Refer to http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.tptp.platform.doc.user/ref/rsaproffilt.htm and http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.tptp.platform.doc.user/tasks/teprofsa.htm for the proper format.
  4. Run the java class, of course:)

A profile configuration consists several entries, here’s an example (“^\*.*$” lines stand for comments):

* all | none
MONITOR_MODE = all
* true | false
FILTERS = true
* none | deletes | frees | moves | deletesAndMoves | movesAndFrees
TRACK_GC_EVENT_TYPES = movesAndFrees
* static | relocatable | staticAndRelocatable
ID_STYLE = staticAndRelocatable
* true | false
* OPTIONS = false
TIMESTAMPS = true
METHOD_COUNTS = true
OBJ_ALLOC_IS_ARRAY = true
* none | normal | boundary | contiguous | boundaryAndContiguous
STACK_INFORMATION = contiguous
* true | false
* TICKET = true
* full | none | noObjectCorrelation
TRACE_MODE = full
* true | false
* TRACE_ID_REFS = true

Apparently this configuration requires much work to do, so my CPU got 99% utilized just now:P.
The filters configuration is more straightforward, only a wildcard string indicating the desired packages or classes, another wildcard string indicating the methods, and a directive indicating the whether matching packages or classes are to be included or excluded. Here’s an example:

package = com.*
method = *
mode = INCLUDE

Since some subtle differences amongst different Linux distros and versions, the configuration above varies. I once saw a web page saying it’s necessary to add the directory “<eclipse_install_or_ext_point>/plugins/org.eclipse.hyades.execution.<OS>.<CPU_ARCH>_<VERSION>” not only to LD_LIBRARY_PATH but also to PATH. I haven’t tried this out yet, since adding it to LD_LIBRARY_PATH works every time and appears to be more reasonable. Particularly, if the piAgent failed to get loaded or started, take a look at the output of `ldd <eclipse_install_or_ext_point>/plugins/org.eclipse.hyades.execution.<OS>.<CPU_ARCH>_<VERSION>/libpiAgent.so` to check out if there’s anything dependent missing.
Whoa, I cannot help starting the agent on our main testing machine to find out what the hell contributed to the latencies.

Older Entries