Dimuthuc’s Weblog

Just using what others shared..

living in Wireless

The first dates I was in the CSE department,  I remember  our  senior boarding mate sumith  ayya was installing wireless network on the department building, and asked us to see how it is configured. That should be hardware based wireless access points which are most probably configured using HyperTerminal. (Actually I can’t remember is that so, since they all seemed Greek to me by that time.) I remember when he said ‘You can connect to internet within any part of the buiding’ it didn’t mean anything to me. But today I have access to wireless network in my office, my boarding place and my home. Yea, I just installed a wireless router in my home without any trouble. It s really cool to have wireless, I hope I can watch tomorrow cricket match with my laptop aside surfing some internet, (hopefully writing some blogs) in breaks.

November 30, 2007 Posted by dimuthuc | Private | | 2 Comments

Ruby Extension Development in C

Ruby extension development in c is really easy, The designers of the languages have done a wonderful job on designing the C API. When I was writing the c code I felt like I m writing Ruby. If you want references, You may start with http://www.rubycentral.com/pickaxe/ext_ruby.html. I must thank Chinthaka to pointing out this tut. And next in ruby source there is a file called README.EXT which will be really useful as well.

November 22, 2007 Posted by dimuthuc | Ruby | , , | No Comments Yet

Professional Patrice

In the final semester of the university, we had a subject called Professional Patrice. And it s been few weeks, that I knew I had an A+ for the subject. Well When I first hear the result of that i did take time to believe it, because it was a subject I didn’t much like, and most importantly I m not much good at remembering those rules enforced to an IT Proffessional in their.

Is that what they told really important? May be I am still new to be a Professional, I will learn as time goes.

November 21, 2007 Posted by dimuthuc | Private | | No Comments Yet

Axis2/C Codegen new features

Well, I m right now looking in to fixing a very basic bug in the axis2/c codegen templates. I m wonder how it ran so much time without fixing this, Anyway thanks for the questions in the mailing list, I thought I should spend sometime on this in this weekend!!! Yea I remember I should prepare to do a RC on wsf/ruby next moday:).

The bug is, the tool is never handling nillable elements and optional attributes. And even worse! in serializing you can never generate a nil element, the code will set some default value at wherever you didn’t specify a value.

The fix is very simple, At deserializing, we can always check whether the element is nillable from the schema, if so at runtime, we check whether the wanted element is having the attribute xsi:type=’nil’. or simply just first child is NULL.

At serializing, we may keep another variable to track each inner element is valid or not. If a non-nillable element is not valid we can complain.

Next thing what are the functions we should provide to deal with nil things. For an example if we take the following schema component,

<xs:element name=”Book”>
<xs:complexType>
<xs:sequence>
<xs:element name=”Title” type=”xs:string”/>
<xs:element maxOccurs=”unbounded” name=”Authors” type=”xs:string”/>
<xs:element name=”Publisher” nillable=”true” type=”xs:string”/>
<xs:element name=”Price” nillable=”true” type=”xs:int”/>
</xs:sequence>
</xs:complexType>
</xs:element>

Here the function available to set/get publisher would be,

adb_Book_set_Publisher(.., axis2_char_t *publisher)

axis2_char_t* adb_Book_get_Publisher(..)

So whenever publisher need to be kept nil, you can pass NULL to the set_publisher function.

But this won’t work when it come to an int. So there will be additional two functions to set and get the nil value associated with the price.

adb_Book_set_Price(.., int price)

int adb_Book_get_Price(..)

adb_Book_set_Price_nil()

axis2_bool_t adb_Book_is_Price_nil(..)

I think for consistancy we should have set_nil and is nil for all the nillable properties (I m not sure should we need to have this for even non-nillables)

And how if the Publisher inner element is changed to something like this,

<xs:element maxOccurs=”unbounded” name=”Publishers” nillable=”true” type=”xs:string”/>

Then the the functions to be added will be,

adb_Book_add_Publishers_nil()

axis2_bool_t adb_Book_is_Publishers_nil_at(..)

Whenever adb_Book_set_Publishers_at is available, adb_Book_is_Publishers_nil_at will also be available hopefully.

Is this looks like a mess?, but unfortunately it is how this should be changed.

November 16, 2007 Posted by dimuthuc | WSDL2C/ Codegen, Web services, axis2/c | , , , , | No Comments Yet