Impala blog post - Thread Context Class Loader
Java World - Class Loader article
On Java - Internals of Java Class Loading
Advanced JBoss Class Loading
Equinox OSGi Context Class Loader Enhancements
Wednesday, April 1, 2009
Tuesday, March 3, 2009
My resume - EDUCATION
Charles University Prague, Czech Republic
- MS in Computer Science (data engineering specialization) - 1997
- BS in Computer Science - 1994
Labels:
career,
resume-admin,
resume-developer
Saturday, February 14, 2009
Using CINT - C/C++ Interpreter - An experiment with vector
Let do something with vector
cint.exe> L vector
cint.exe> {vector<int> temps;}
cint.exe> {temps.push_back(6);}
cint.exe> {temps.push_back(4);}
cint.exe> {temps.push_back(5);}
cint.exe> {temps.size();}
(const unsigned int)3
cint.exe> {temps[0];}
(int)6
cint.exe> {temps[1];}
(int)4
cint.exe> {temps[2];}
(int)5
cint.exe>
So it works well, now there is time to try some algorithm
cint.exe> L algorithm
cint.exe> {sort(temps.begin(),temps.end());}
Error: Template Function value_type(first) is not defined in current scope algo.h(735)
!!!Dictionary position rewound... !!!Error recovered!!!
cint.exe>
It seems that there is some problem with STL lib coming with CINT in Windows. Looking at STL header files, I found that Function value_type is declared in _iterator.h surrounded by a condition for whatever reason
#if (G__GNUC>=3) #if (G__GNUC_VER>=3001) ... templateTo fix it is fairly simpleinline T* value_type(const vector ::iterator&) {return (T*)(0);} .. #endif #endif
d:\cint-5.16.19\cint.exe
cint : C/C++ interpreter (mailing list 'cint@root.cern.ch')
Copyright(c) : 1995~2005 Masaharu Goto (gotom@hanno.jp)
revision : 5.16.19, March 16, 2007 by M.Goto
No main() function found in given source file. Interactive interface started.
'h':help, 'q':quit, '{statements;}' or 'p [expr]' to evaluate
cint.exe> {#define G__GNUC 4}
cint.exe> {#define G__GNUC_VER 4001}
cint.exe> L vector
cint.exe> L algorithm
cint.exe> {vector<int> temps;}
cint.exe> {temps.push_back(6);}
cint.exe> {temps.push_back(4);}
cint.exe> {temps.push_back(5);}
cint.exe> {temps.size();}
(const unsigned int)3
cint.exe> {temps[0];}
(int)6
cint.exe> {temps[1];}
(int)4
cint.exe> {temps[2];}
(int)5
cint.exe> {sort(temps.begin(),temps.end());}
cint.exe> {temps[0];}
(int)4
cint.exe> {temps[1];}
(int)5
cint.exe> {temps[2];}
(int)6
cint.exe>
Using CINT - C/C++ Interpreter - Basic Commands
Load,Unload,files
L that load files into interpreter, and file that list these loaded files.
cint.exe> L iostream cint.exe> files 0 fp=0x781c1bd0 lines=13 file="iostream" 1 fp=0x781c1bf0 lines=479 file="iostream.h" 2 fp=0x781c1c10 lines=11 *file="iosenum.h" 3 fp=0x781c1c30 lines=34 file="bool.h" 4 fp=0x781c1c50 lines=173 *file="_iostream"If we use
#include in curly bracket, we will get the same result
cint.exe> {#include <iostream>}
cint.exe> files
0 fp=0x781c1bf0 lines=13 file="iostream"
1 fp=0x781c1c10 lines=479 file="iostream.h"
2 fp=0x781c1c30 lines=11 *file="iosenum.h"
3 fp=0x781c1c50 lines=34 file="bool.h"
4 fp=0x781c1c70 lines=173 *file="_iostream"
U command unload a file, a C/C++ header file can include other header files, which in turn can include additional header files and so all. CINT is good enough and maintain this dependencies so if we unload one file, others referenced files may get unloaded also.
cint.exe> L string cint.exe> files 0 fp=0x781c1bd0 lines=11 file="string" 1 fp=0x781c1bf0 lines=72 file="_string" 2 fp=0x 0 lines=0 file="string.dll" 3 fp=0x781c1c10 lines=13 file="iostream" 4 fp=0x781c1c30 lines=479 file="iostream.h" 5 fp=0x781c1c50 lines=11 *file="iosenum.h" 6 fp=0x781c1c70 lines=34 file="bool.h" 7 fp=0x781c1c90 lines=173 *file="_iostream" cint.exe> U string cint.exe> filesreset
reset reset interpreter environment and unload all files
cint.exe> {int a=1;}
cint.exe> {a;}
(int)1
cint.exe> reset
cint.exe> {a;}
Error: Symbol a is not defined in current scope (tmpfile)(1)
!!!Dictionary position rewound... !!!Error recovered!!!
cint.exe> L vector
cint.exe> files
0 fp=0x781c1bd0 lines=11 file="vector"
1 fp=0x781c1bf0 lines=18 file="_vector"
2 fp=0x 0 lines=0 file="vector.dll"
3 fp=0x 0 lines=0 file="vectorbool.dll"
4 fp=0x781c1c10 lines=313 file="_vector.h"
5 fp=0x781c1c30 lines=282 file="function.h"
6 fp=0x781c1c50 lines=34 file="bool.h"
7 fp=0x781c1c70 lines=235 file="algobase.h"
8 fp=0x781c1c90 lines=55 file="_pair.h"
9 fp=0x781c1cb0 lines=17 file="_iterator"
10 fp=0x781c1cd0 lines=668 file="_iterator.h"
11 fp=0x781c1cf0 lines=6 file="stddef.h"
12 fp=0x781c1d10 lines=479 file="iostream.h"
13 fp=0x781c1d30 lines=11 *file="iosenum.h"
14 fp=0x781c1d50 lines=173 *file="_iostream"
15 fp=0x781c1d70 lines=177 file="defalloc.h"
16 fp=0x781c1d90 lines=34 file="new.h"
17 fp=0x781c1db0 lines=34 file="stdio.h"
18 fp=0x 0 lines=0 file="stdfunc.dll"
19 fp=0x781c1dd0 lines=14 file="stdlib.h"
20 fp=0x 476800 lines=19 file="limits.h"
-- Press return for more -- (input [number] of lines, Cont,Step,More)
cint.exe> reset
cint.exe> files
cint.exe>
Wednesday, February 11, 2009
Using CINT - C/C++ Interpreter - Getting Started
One of things I favor scripting languages (Ruby, Python) over none scripting (JAVA, C/C++) is there is no need to follow time consuming cycle of write-compile-run. Even with the best IDE, I still feels the pain of typing command, hit key combination, waiting for computer doing. This is especially true when I need to explore some API, test some ideas.
So when I discovered CINT, a C/C++ Interpreter, I gave it a try. With CINT, we can type C/C++ code directly in it's interactive CINT console and get the result. CINT is available for Windows and many UNIX platform(s) some LINUX clone has CINT pre-installed.
We start CINT console by type e.g. (on Windows)
d:\cint-5.16.19\cint.exe
cint.exe>{#include <iostream>
cint.exe>{cout << "Hello World\n";}
Hello World (class ostream)2085223112
C/C++ code shall be type inside curly bracket {...}, CINT doesn't allow to define function in interactive console
> { int func999() {return 999;} }
Limitation: Function can not be defined in a command line or a tempfile
You need to write it in a source file (tmpfile)(1)
!!!Dictionary position rewound... !!!Error recovered!!!
So we have to create separate file e.g.
# func999.cpp
int func999() {
return 999;
}
,load it in the console and call a function inside
cint.exe>L func999.cpp
cint.exe>{func999();}
Some of the most frequently used commands includes
L- load file in to the console U - unload the file file - show which files are currently loaded reset - reset memory of CINT console to initial state,unload all files q - quit CINT console
Monday, January 12, 2009
Retrospective 2008
Year 2008 was marked by an important event of my life and my career. I have joined ING Direct Japan (INGDJ) and moved to Tokyo in September. So far I feel OK. Within last 4 months, I have done a couple of things. Technically
1. Learned how to manage WebSphere Application Server and MQ infrastructure in a complex IT environment for banking business.
2. Write a bundle of ruby scripts to perform administrative activities related to WebSphere including system monitoring, log management and application deployment.
3. Learned JVM internal stuff like GC, heap dump, core dump analysis tools, JAVA decompiler and JVM assembler language
4. Use VIM (as primary editor) and GIT
5. Learned Python and it's Java implementation Jython primarily and use it for WebSphere Application Server scripting
1. Learned how to manage WebSphere Application Server and MQ infrastructure in a complex IT environment for banking business.
2. Write a bundle of ruby scripts to perform administrative activities related to WebSphere including system monitoring, log management and application deployment.
3. Learned JVM internal stuff like GC, heap dump, core dump analysis tools, JAVA decompiler and JVM assembler language
4. Use VIM (as primary editor) and GIT
5. Learned Python and it's Java implementation Jython primarily and use it for WebSphere Application Server scripting
Labels:
career
Friday, November 28, 2008
Using VIM in troubleshooting JAVA application
After trying many Text Editor available on Windows as TexPad, UltraEdit, Wordpad, Notepad, etc. , finally I decided to use vim, an enhanced version of unix vi. Vim is never been an easy choice but once you master it, it is wonderful, it give you high productivity. Also it is free.
Some basic vi commands can be found in http://www.cs.uiuc.edu/class/fa07/cs225/calendar/vim.pdf.
During my daily work, I often have to troubleshoot complex JAVA application. Sometime I get exception with full JAVA stack printout, but the application is provided by vendor without source code so there is very difficult to find a root cause.
There is a tool called JAD that can decompile JAVA classes. Because my primary editor is VIM so I decided to integrate the JAD into VIM. Googling a while, I found vim JAD plugin, that display decompiled java class whenever we open the class file. However JAVA application(s) are mostly provided in form of several jar, zip, ear package so it is not so convenient.
There is luckily zip plugin that is part of vim installation and can browse zip, jar, ear package and display content of selected file inside the package when we hit enter. Modify just few lines of this plugin, I am able to browse content of jar, zip file and view a decompiled inside JAVA class.
The steps is as follows (for version 7.2, that was installed in D:\Vim\)
1. open D:\Vim\vim72\autoload\zip.vim and change
3. start vim and open a jar file, a list of files inside the jar file will be displayed
4. select one class file and hit ENTER
The '-lnc' option of JAD display line number of original source code as comment on the left side of decompiled code so it can be used to identify which part of code cause an exception.
Some basic vi commands can be found in http://www.cs.uiuc.edu/class/fa07/cs225/calendar/vim.pdf.
During my daily work, I often have to troubleshoot complex JAVA application. Sometime I get exception with full JAVA stack printout, but the application is provided by vendor without source code so there is very difficult to find a root cause.
There is a tool called JAD that can decompile JAVA classes. Because my primary editor is VIM so I decided to integrate the JAD into VIM. Googling a while, I found vim JAD plugin, that display decompiled java class whenever we open the class file. However JAVA application(s) are mostly provided in form of several jar, zip, ear package so it is not so convenient.
There is luckily zip plugin that is part of vim installation and can browse zip, jar, ear package and display content of selected file inside the package when we hit enter. Modify just few lines of this plugin, I am able to browse content of jar, zip file and view a decompiled inside JAVA class.
The steps is as follows (for version 7.2, that was installed in D:\Vim\)
1. open D:\Vim\vim72\autoload\zip.vim and change
fun! zip#Read(fname,mode) ... exe "silent r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1) ... endfunto
fun! zip#Read(fname,mode) ... if fname =~ '.class$' exe "silent r! ".g:zip_unzipcmd." -o -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1) exe "silent r! jad -lnc -p ".s:Escape(fname,1) else exe "silent r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1) endif ... endfun2. download unzip.exe, jad.exe and put them in the PATH
3. start vim and open a jar file, a list of files inside the jar file will be displayed
4. select one class file and hit ENTER
Saturday, November 8, 2008
Simple Python Syntax
Start interpreter and print out something then exit
To run a script within Python interpreter use execfile(path), it is useful for people who use Jython, because startup time of JVM is horrible . e.g
This is one of my most frequently used statement, Python follow style of C printf function
Python has nice methods get a substring from string
Unlike Ruby, Python string can not be changed directly
List and tuple
Python has tuple and list for representation of variable size array of items. Tuple is immutable array while list is mutable. People think that list is intended for homogeneous while tuple is for non-homogeneous, but this is convention only is not enforced by the language. However some api accept only tuple as argument e.g. String format %, that sometime lead to a confusion. In contras Ruby has only Array.
example of tuple
Python has hash structure called dictionary
Class, Object, method
Class is defined using class keyword, name of a class can start lower case or upper case character, which is different from Ruby. Ruby requires name of class start with upper case character.
However the convention is that, name of built-in class as string, unicode, list, tuple start with lower case character while user-defined class starts with upper case.
example of built-in class
Every Python script store in a file is a module, the name of the file is module name.
Beside normal position based parameters, Python has two extra forms of passing parameters to a function
The first form is argument list, in which caller pass a list parameters and calling function receives them in form of an array.
Closures
Python closures
C:\python ActivePython 2.5.2.2 (ActiveState Software Inc.) based on Python 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print 'hello world' hello world >>> print 1+2+3 6 >>> exit()Run a script in the interpreter
To run a script within Python interpreter use execfile(path), it is useful for people who use Jython, because startup time of JVM is horrible . e.g
>>execfile('sample.py')
Create string from a template
This is one of my most frequently used statement, Python follow style of C printf function
>>> "my name is %s, my age is %d" % ("Goto",30)
'my name is Goto, my age is 30'
>>>
Ruby has the same function
irb(main):004:0> "my name is %s, my age is %d" % ["Goto",30] => "my name is Goto, my age is 30" irb(main):005:0>but there is nicer way to do it
irb(main):005:0> name,age = "Goto",31
=> ["Goto", 31]
irb(main):006:0> "my name is #{name}, my age is #{age}"
=> "my name is Goto, my age is 31"
Create a substring from a string
Python has nice methods get a substring from string
>>> s='hello world' >>> s[0] 'h' >>> s[0:10] #substring from a position(inclusive) until other (non inclusive) 'hello worl' >>> s[2:] #substring to end of string 'llo world' >>> s[:2] #substring from start until other (non inclusive) 'he' >>> s[-2:] #negative position indicates position from end of the string 'ld'The equivalent in Ruby would be
$ irb >> s="hello world" => "hello world" >> s[0] => 104 >> s[0..0] => "h" >> s[0..(10-1)] #unlike Python, Ruby includes the end position => "hello worl" >> s[2..-1] # -1 indicate relative position from end => "llo world" >> s[0..(2-1)] => "he" >> s[-2..-1] => "ld"Unlike Ruby, Python still throw
out of range exception for single indice operation
>>> s[20] Traceback (most recent call last): File "String is immutable", line 1, in IndexError: string index out of range >>> s[20:30] # this is OK as it consider as slice operation ''
Unlike Ruby, Python string can not be changed directly
>>> s[0:5] 'hello' >>> s[0:5]="bye" Traceback (most recent call last): File "In Ruby we can do", line 1, in TypeError: 'str' object does not support item assignment >>> s1 = "bye" + s[5:] # to achieve the same goal we need create string from other string >>> print s1 bye world
>> s[0..4]="bye" => "bye" >> print s bye world=> nilAs string is considered value object, create new string instead of changing an existing express that concept more clearly.
List and tuple
Python has tuple and list for representation of variable size array of items. Tuple is immutable array while list is mutable. People think that list is intended for homogeneous while tuple is for non-homogeneous, but this is convention only is not enforced by the language. However some api accept only tuple as argument e.g. String format %, that sometime lead to a confusion. In contras Ruby has only Array.
example of tuple
>>> y=('a',2)
>>> y[1]=1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
>>> y
('a', 2)
example of list
>>> x=['a',2] >>> x[1]=1 >>> x ['a', 1]iterate over list or tuple
>>> items = ('a','b',2)
>>> for e in items:
... print e
...
a
b
2
Hash aka dictionary
Python has hash structure called dictionary
>>> h = {1:'a',2:'b',3:'c'}
>>> h.__class__
<type 'dict'>
>>> h[3] = 'z'
>>> h
{1: 'a', 2: 'b', 3: 'z'}
>>>
iterate over dictionary
>>> for k,v in h.iteritems(): ... print "%d=>%s" % (k,v) ... 1=>a 2=>b 3=>z
h.items() also works well
Class, Object, method
Class is defined using class keyword, name of a class can start lower case or upper case character, which is different from Ruby. Ruby requires name of class start with upper case character.
However the convention is that, name of built-in class as string, unicode, list, tuple start with lower case character while user-defined class starts with upper case.
example of built-in class
>>> y = ('a',2)
>>> y.__class__
<type 'tuple'>
>>> y.__class__ == tuple
True
>>> z = tuple(y)
>>> z
('a', 2)
example of user defined class
>>> class Foo: ... def m(self): ... print self.__class__ ... >>> >>> Foo().m() __main__.Foo >>>Module
Every Python script store in a file is a module, the name of the file is module name.
$ cat hello.py def say(whom): return "hello %s" % whomTo use method defined in a module, just import the module and call the function preceding by the module name plus '.'
>>> import hello
>>> hello.say('world')
'hello world'
It is also common to mix module methods into current name space, so we can call method without typing module name
>>> from hello import *
>>> say('moon')
'hello moon'
>>>
Parameters
Beside normal position based parameters, Python has two extra forms of passing parameters to a function
*params and **params.
The first form is argument list, in which caller pass a list parameters and calling function receives them in form of an array.
def foo(*numbers):
return sum(numbers)
print foo(23, 42) # prints: 65
The second form is name based, in which caller pass a list name,value pairs and calling function receives then as a hash map.
def bar(**options):
if "verbose" in options and options["verbose"]:
print "verbose is ON"
else:
print "verbose is OFF"
bar(verbose=True) # print: "verbose is ON"
bar(verbose=False) # print: "verbose is OFF"
bar(force=True) # print: "verbose is OFF"
Closures
Python closures
Thursday, October 30, 2008
Where to download RPM package(s) for RedHat Linux
If you are looking for RPM package(s) for LINUX, then you should look at this site http://linuxsoft.cern.ch/. The binary rpm package are built from source SRPM available in http://ftp.redhat.com/pub/redhat/linux/enterprise/. They are well organized, complete and updated. The slc4X directory is equivalent to RedHat ES/AS 4 while slc5X to RedHat ES/AS 5.
If you have not RedHat Linux media in hand for what ever reason, this is definitely a good help.
If you have not RedHat Linux media in hand for what ever reason, this is definitely a good help.
Subscribe to:
Posts (Atom)