Navigation

Search

Categories

On this page

MindTree lecture series
RelaxNG Vs XSD
Out of Transaction Counters

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Sign In

 Friday, August 20, 2004
Friday, August 20, 2004 5:10:53 PM (Central Standard Time, UTC-06:00) ( )

http://www.mindtree.com/ping_me.html

MindTree, a great consulting firm based in Banglore,India is running this seminar where lectures will be delivered by its founder & COO, Surbroto Bagchi. The first one in the series is posted at the site. Title of this lecture is : 9 Key Factors behind a successful technical career.

The lecture is really good and must say I did learn from the experience and guidance of Mr. Surbroto and specially loved the notion of Followership which I must say I have never heard before (although have followed it time and again :) ).

Regards to Mr. Surbroto Bagchi and thanks to MindTree for such a great effort.

Friday, August 20, 2004 4:55:47 PM (Central Standard Time, UTC-06:00) ( )

I had been avoiding to look into details of Relax NG thinking it to be just another schema proposal until saw some good posts from Tim Ewald and Aaron Skonnard. A good introduction of RelaxNG can be found here at http://relaxng.org but the articles (1, 2, 3) which really throw an insight as far as comparisons are concerned are ones from David Mertz at IBM developerWorks. I found part 1 & part 2 very interesting. David provides the code fragments to assert the differences and way both (RelaxNG & XSD) express the same XML instance.

RelaxNG syntax is definitely way simpler than XSD & provide uniformity in describing elements and attributes. I would definitely agree with its creators when they say you need 30 minutes to understand it.

David mentioned a valid case where XSD scores is that of specifying number of occurrences of elements. RelaxNG is limited to <zeroOrMore>, <OneOrMore>  & <optional> where as XSD can use any range for cardinality. In part 2, David mention about infoset augmentation, siting an example of how in DTD and XSD, default values are inserted in XML instance and James Clark thinks it to be a bug in DTD and XSD specifications rather than a feature. RelaxNG does not support infoset augmentation. Well, in my opinion its definitely a feature and do not buy the argument of consequences of schema document being not available because of network. Network argument can be used on all parts of schema documents.

Except for 2 features described above (cardinality & infoset augmentation) RelaxNG is better than XSD in almost all ways for eg. Uniform treatment for Elements & attributes, modular & extensible data type system etc

 Wednesday, August 04, 2004
Wednesday, August 04, 2004 12:58:52 PM (Central Standard Time, UTC-06:00) ( )

Transactions and roll back of data form the core feature of smartcards. These features implied that if tearing or exception occurs during execution of method which was under a transaction then all the modifications made to the application data are discarded or contents should be rolled back to old values. This is all good and fine but sometimes need arise when you would want a particular method to be under transaction & some field/value to be updated irrespective of the fact that tearing occurred or not. The one famous example is that of PIN verification and try counter. PIN verification is under transaction and since this method plays with the try counter decrementation you want that try counter updates to be out of transaction else if card is pulled out during PIN verification, try counter won't decrement and thereby giving the hacker infinite chances to break your card. Mostly (I hope it should be the implementation in other vendor cards) PIN specific libraries take care of this.

In .NET SmartCard we expose this feature ie Out of Transaction counters as an API as we feel that there would be many places where such kind of counters will be required. The class is called TryCounter and have a look at its usage.

public class MyClass
{
  // counter which should be out of
  // transaction
  TryCounter _myOutOfTranCounter;

  MyClass(){
     // 0 here is the initial value
     _myOutOfTranCounter = new TryCounter(0);
  }

  // MyMethod which is under transaction
  [Transaction]
  void MyMethod(int paramA,int paramB){

    // Update the counter reflecting how
    // many times i am called whether or
    // not tearing occurs during execution
    myOutOfTranCounter.Value++;

  }
}

Other methods/properties available in this class are :

Reset() : Reset the counter value to the initial value (value specified as param to the TryCounter ctor).

InitialValue [property] : Get or Set the initial value of the TryCounter.