Updated: 4/29/2003; 9:28:23 AM.
Java Morning/C# Afternoon
Practical living with two modern languages


by Michael Isbell
        

Tuesday, December 17, 2002

Hashtable Issue Resolved, I Guess

Okay, the function returns an XmlRpcStruct which contains a hashtable. Apparently this struct has methods which extract data from the underlying hashtable, because the C# code is as follows:

XmlRpcStruct xrs = secureclient.versionInfoIntent();
Array a = new object[xrs.Count];
Array b = new object[xrs.Count];
xrs.Values.CopyTo(a,0);
xrs.Keys.CopyTo(b,0);


I haven't even displayed the data yet, and I haven't even concatenated the keys and values for listbox display!

This is waaaaaaaaaaay more complicated than in Java, which looks like this:


Hashtable h = SecureClient.versionInfoIntent();
jTextPane4.setText(h.toString());

These two lines get the hashtable AND display it nicely in a textbox on screen.

I'm going to adapt the color scheme here as a standard for this weblog: C# source will be in red and Java source will be in blue.
2:08:45 AM    comment []


XML-RPC Hashtable Issue

For the Java - to - C# conversion effort, I'm using an open-source XML-RPC library written by Cook Computing (http://cookcomputing.com/).

The library has worked well so far. It comes as a .DLL which you include in your C# assembly. Seems to be well-written, highly aware of the idiomatic use of Attributes in C# (meta-data about classes, methods, enumerations, structs etc).

Just ran into a problem, though. I'm writing a function that makes an XML-RPC call and returns a Hashtable. BUT, the hashtable returns in a corrupted format: i.e., the Count property lists the number of DictionaryEntry objects in the hash as 0, but I can clearly see many of them in the debugger. So the Count is out of sync; therefore, none of the Hashtable's methods can find anything in the hash.

Talked to bbum, Mad Mac Developer King, and according to him the XML being returned is just a struct, so maybe returning a struct will fix things. So I can:

1. try the struct, see if that works (but I think when I return an object and examine it in the debugger, the implicit type is a System.Collection.Hashtable)/.

2. try another XML-RPC library

3. get Cook to fix his library

The problem is, I'm a little pressed for time here...

WELSHMAN JOHN

I found out today that his title is Deputy High Commissioner for Uganda (he's been moved to another country). Apparently, Commissioner is a title left over from Colonial days, used for post-Colonial countries of the British Empire. It's equivalent title for non-Colonial countries is "Ambassador." So, in other words, John is Deputy Ambassador. His career path is to move towards an Ambassadorship in the next seven years or so, and thereafter to spend the twenty years remaining in his career in senior management.

Interesting seeing NYC through John's eyes. Last time he was here:

    * Guiliani's iron fist hadn't transformed the city
    * Times Square was the Forty-Deuce of Travis Bickle and Joe Buck
    * we were in an economic recession
    * a 1 bedroom on the East side was 800-900 a month
    * the WTC was standing, of course
    * the Web hadn't happened
    * my laptop was a Toshiba 8086 monochrome DOS machine
    * Mac people had just discovered Flying Toasters

1:21:08 AM    comment []

© Copyright 2003 Michael Isbell.
 
December 2002
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Nov   Jan


Click here to visit the Radio UserLand website.

Subscribe to "Java Morning/C# Afternoon" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.