Tuesday, January 6, 2009

GWT Exceptions

You need to declare RuntimeExceptions as throwable from GWT servlet if you want to be able to catch it in the javascript. Otherwise you will just get a StatusCodeRPC exception or whatever.

Saturday, January 3, 2009

change default python version

Doesn't sound very official, but apparently you change the /usr/bin/python symlink to point to /usr/bin/python2.5 and then change instances of python2.5 in /usr/share/python/debian_defaults

Static vs Dynamic Libraries

I always wanted to understand the mechanism by which your C program calls library code at runtime.

From http://stackoverflow.com/questions/311882/what-do-statically-linked-and-dynamically-linked-mean

When you compile some C code (for instance), it is translated to machine language. Just a sequence of bytes which when run causes the processor to add, subtract, compare, "goto", read memory, write memory, that sort of thing. This stuff is stored in object (.o) files.

Now, a long time ago, computer scientists invented this "subroutine" thing. Execute-this-chunk-of-code-and-return-here. It wasn't too long before they realised that the most useful subroutines could be stored in a special place and used by any program that needed them.

Now in the early days programmers would have to punch in the memory address that these subroutines were located at. Something like CALL 0x5A62. This was tedious and problematic should those memory addresses ever need to be changed.

So, the process was automated. You write a program that calls printf(), and the compiler doesn't know the memory address of printf. So the compiler just writes CALL 0x0000, and adds a note to the object file saying "must replace this 0x0000 with the memory location of printf".

Static linkage means that the linker program (the GNU one is called ld) adds printf's machine code directly to your executable file, and changes the 0x0000 to the address of printf. This happens when your executable is created.

Dynamic linkage means that the above step doesn't happen. The executable file still has a note that says "must replace 0x000 with the memory location of printf". The operating system's loader needs to find the printf code, load it into memory, and correct the CALL address, each time the program is run.

It's common for programs to call some functions which will be statically linked (standard library functions like printf are usually statically linked) and other functions which are dynamically linked. The static ones "become part" of the executable and the dynamic ones "join in" when the executable is run.


Also good:
http://www.learncpp.com/cpp-tutorial/a1-static-and-dynamic-libraries/

Thursday, December 18, 2008

Setting endpoint for JAXWS ws


TriprequestService service = new TriprequestService();
Triprequest port = service.getTriprequestPort();
BindingProvider bp = (BindingProvider) port;
Map map = bp.getRequestContext();
map.put(BindingProvider.USERNAME_PROPERTY, "shafiek1");
map.put(BindingProvider.PASSWORD_PROPERTY, "password");
map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://qapo:8888/trex-pn/triprequest");

Setting endpoint for JAX-RPC

stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,
username);
stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,
password);

Thursday, December 4, 2008

Not closing result set can cause leek?

John used http://www.jboss.org/community/docs/DOC-9255 which gave warnings about some result sets not being closed.

Wednesday, December 3, 2008

ContextMenuTablePanel

I created this panel that would show context menus whenever you clicked on a row. It requires that you add the table to the panel, which means the panel becomes the parent. This causes a problem when using the Scrolltable in incubator, as the Scrolltable is a panel which is the parent of the table.

If only there was a right-click listener.

Monday, December 1, 2008

Using Views for Unique Constraint

May not genereate a EntityExistsException, which seems to require with Sql server 2005 a unique key constraint.