RSS 2.0
Sign In
# Tuesday, July 28, 2009
A week ago my brothers had returned from their journey to France. They have brought a reproduction of one of remarkable and meaningful images. The title on it can be used as our motto.
Tuesday, July 28, 2009 8:23:28 AM UTC  #    Comments [0] -

# Thursday, July 23, 2009

Interestingly enough that a google search for "coolgen java bean generation" leads to our site.

That's a good starting point, as we support such conversions. We, however, suggest to follow to BluePhoenix location. That's where the bosses live. :-)

Thursday, July 23, 2009 6:22:12 PM UTC  #    Comments [0] -

# Monday, July 20, 2009

Generics in C# look inferior to templates (especially to concepts) in C++, however now and then you can build a wonderful pieces the way a C++ profi would envy.

Consider a generic converter method: T Convert<T>(object value).

In C++ I would create several template specializations for all supported conversions. Well, to make things harder, think of converter provider supporting conversion:

public interface IConverterProvider
{
  Converter<object, T> Get<T>();
}

That begins to be a puzzle in C++, but C# handles it easily!

My first C#'s implementation was too naive, and spent too many cycles in provider, resolving which converter to use. So, I went on, and have created a sofisticated implementation like this:

  private IConverterProvider provider = ...

  public T Convert<T>(object value)
  {
    var converter = provider.Get<T>();

    return converter(value);
  }

...

public class ConverterProvider: IConverterProvider
{
  public Converter<object, T> Get<T>()
  {
    return Impl<T>.converter;
  }

  private static class Impl<T>
  {
    static Impl()
    {
      // Heavy implementation initializing converters.
      converter = ...
    }

    public static readonly Converter<object, T> converter;
  }
}

Go, and do something close in C++!

Monday, July 20, 2009 7:18:51 AM UTC  #    Comments [0] -
Tips and tricks
# Friday, July 10, 2009

Living in Israel, moving almost exclusively in a car I would not experience what I've seen today in metro of Paris.

On the Ranelagh station an old woman has entered the train. She's in her mid seventies. Once, she was beautiful. She still is! Colors and features are faded but her dressing and posture are still elegant. But what's struck me most are her eyes. Well, they ain't beautiful anymore. I've read a sadness there.

I think she will probably live ten or even twenty years more, but she would give them up just for one year to be younger.

Friday, July 10, 2009 1:58:27 PM UTC  #    Comments [0] -

# Monday, June 29, 2009

If you have a string variable $value as xs:string, and want to know whether it starts from a digit, then what's the best way to do it in the xpath?

Our answer is: ($value ge '0') and ($value lt ':').

Looks a little funny (and disturbing).

Monday, June 29, 2009 6:00:28 AM UTC  #    Comments [0] -
Tips and tricks | xslt
# Wednesday, June 24, 2009

In our project we're generating a lot of xml files, which are subjects of manual changes, and repeated generations (often with slightly different generation options). This way a life flow of such an xml can be described as following:

  1. generate original xml (version 1)
  2. manual changes (version 2)
  3. next generation (version 3)
  4. manual changes integrated into the new generation (version 4)

If it were a regular text files we could use diff utility to prepare patch between versions 1 and 2, and apply it with patch utility to a version 3. Unfortunately xml has additional semantics compared to a plain text. What's an invariant or a simple modification in xml is often a drastic change in text. diff/patch does not work well for us. We need xml diff and patch.

The first guess is to google it! Not so simple. We have failed to find a tool or an API that can be used from ant. There are a lot of GUIs to show xml differences and to perform manual merge, or doing similar but different things to what we need (like MS's xmldiffpatch).

Please point us to such a program!

Meantime, we need to proceed. We don't believe that such a tool can be done on the knees, as it's a heuristical and mathematical at the same time task requiring a careful design and good statistics for the use cases. Our idea is to exploit diff/patch. To achieve the goals we're going to perform some normalization of xmls before diff to remove redundant invariants, and normalization after the patch to return it into a readable form. This includes:

  • ordering attributes by their names;
  • replacing unsignificant whitespaces with line breaks;
  • entering line breaks after element names and before attributes, after attribute name and before it's value, and after an attribute value.

This way we expect to recieve files reacting to modifications similarly to text files.

Wednesday, June 24, 2009 11:40:32 AM UTC  #    Comments [0] -
Tips and tricks | xslt
# Thursday, June 18, 2009

Ladies and gentlemen of the jury, exhibit number one is what the seraphs, the misinformed, simple, noble-winged seraphs, envied. Look at this the most ancient program:

most ancient program

See origin

:-)

Thursday, June 18, 2009 4:01:46 PM UTC  #    Comments [0] -

At present C# serializer knows how to print comments and do some formatting (we had to create micro xml serializer within xslt to serialize xml comments). C#'s formatting is not as advanced as java's one, but it should not be such in the first place, as C# text tends to be more neat due to properties and events. Compare:

Java: instance.getItems().get(10).setValue(value);

vs

C#: instance.Items[10].Value = value;

TODO: implement API existing in jxom and missing in C# xom. This includes:

  • name normalization - rewriting tree to make names unique (duplicate names are often appear during generation from code templates);
  • namespaces normalization - rewriting tree to elevate type namespaces (during generation, types are usually fully qualified);
  • unreachable code detection - optional feature (in java it's required, as unreachable code is an error, while in C# it's only a warning);
  • compile time expression evaluation - optional feature used in code optimization and in reachability checks;
  • state machine refactoring - not sure, as C# has yield statement that does the similar thing.

Update can be found at: jxom/C# xom.

June, 24 update: name and namespace normalizations are implemented.

Thursday, June 18, 2009 3:11:53 PM UTC  #    Comments [0] -
Announce | xslt
# Monday, June 15, 2009

Writing a language serializer is an as easy task, as riding a bicycle. Once you learned it, you won't apply a mental force anymore to create a new one.

This still requires essential mechanical efforts to write and test things.

Well, this is the first draft of the C# xslt serializer. Archive contains both C# xom and jxom.

Note: no comments are still supported; nothing is done to format code except line wrapping.

Monday, June 15, 2009 2:51:11 PM UTC  #    Comments [0] -
Announce | xslt
# Tuesday, June 9, 2009

Today an old book was extracted by my son on the light of God. The book was immediatly opened on this verse:

Any trifle can become
a main business of your life.
You just need be a firmly believed
that there is nothing more important that can be achieved.
And then nothing won't prevent you gasp out from delight to engage with this nonsense.

Unfortunatelly too often these facetious verses of Gregory Oster becoming a true.

Tuesday, June 9, 2009 7:12:25 PM UTC  #    Comments [0] -

# Tuesday, June 2, 2009

I've read a popular scientific stuff about DNA, RNA, proteins, cells, prokaryotes and eukaryotes their structures, roles, operational principles, evolution.

All the computer technologies and robotics seem like a childish babbling comparing to microbiology and molecular biology.

I would wish to be so open minded, and have so capable brain with infinite work capacity (and live so long life :-)) to push, to break through the borders of knowledge of the humanity.

Ah, I envy to the Renaissance people who were capble to hold and drive the science and art, this contrasts so much with contemporary specializations.

Tuesday, June 2, 2009 6:50:38 AM UTC  #    Comments [0] -

# Thursday, May 28, 2009

Well, it's jxom no more but also csharpxom!

A project concerns demanded us to create a C# 3.0 xml schema.

Shortly we expect to create an xslt serializing an xml document in this schema into a text. Thankfully to the original design we can reuse java streamer almost without changes.

A fact: C# schema more than twice bigger than the java's.

Thursday, May 28, 2009 9:57:02 AM UTC  #    Comments [4] -
Announce | xslt
# Tuesday, May 26, 2009

Today, I've found a C++0x FAQ by Bjarne Stroustrup reviewing most of the new features that we shall see in the next version.

A good insight for those who don't track the WG progress.

But what attracts me is a passage:

What do you think of C++0x?

...My ideal is to use programming language facilities to ...

In other words, I'm still an optimist.

Sounds rather pessimistic to my taste. :-)

Tuesday, May 26, 2009 12:46:37 PM UTC  #    Comments [0] -

# Saturday, May 16, 2009

There is a nice ServiceLoader API in java 6 implementing a service provider idiom. It's good (good because it's standard) class resolving interface implementation using META-INF/service location.

Unfortunately, there is even no JSR implementation for this class in java 5. This makes it impossible for us to use it.

What a nuisance!

Saturday, May 16, 2009 9:30:51 AM UTC  #    Comments [0] -

# Saturday, May 9, 2009

We honour the memory of our grandfathers and grandmothers who battled that cruel war. Our grandfather has fallen in that war, other grandfather and grandmothers have survived and lived long lives.

Time is relentless, they have left this world but we shall keep them and their deeds in memory.

Георгиевская лента
Saturday, May 9, 2009 9:06:54 AM UTC  #    Comments [0] -

Archive
<July 2009>
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
Statistics
Total Posts: 366
This Year: 2
This Month: 0
This Week: 0
Comments: 252
Locations of visitors to this page
Disclaimer
The opinions expressed herein are our own personal opinions and do not represent our employer's view in anyway.

© 2019, Nesterovsky bros
All Content © 2019, Nesterovsky bros
DasBlog theme 'Business' created by Christoph De Baene (delarou)