This week I had to come up with a temporary solution to convert a dita map inclusive it's topics into our currently used XML schema for Value Propositions. I just blog the query because it's a nice reference material. The only parameter I inject from Java is the mcvpId just in case you are wondering where that variable gets its value from.
If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!
Wednesday, February 23, 2011
Thursday, January 6, 2011
Tunneling parameters with XSLT2.0
As you can see the percentages in the xml snippet before transformation add up to 99.90%.
The customer wanted to make a correction on the first maximum percentage so that all percentages would add up to 100%.
So this means adding 0.10 to the "lead" material percentage. A little inquiry on the xslt mailinglist showed me how to solve this elegantly.
Special thanks go to David Carlisle for the feedback.
BEFORE:
AFTER:
The customer wanted to make a correction on the first maximum percentage so that all percentages would add up to 100%.
So this means adding 0.10 to the "lead" material percentage. A little inquiry on the xslt mailinglist showed me how to solve this elegantly.
Special thanks go to David Carlisle for the feedback.
BEFORE:
AFTER:
Labels:
xslt2.0
Wednesday, December 15, 2010
A new free troubleshooting tool: AppDynamics Lite
Today I received an email about a new tool called AppDynamics to track down performance issues for applications running on a production environment. Maybe nice to test this one out next time I run into slow performance.
Friday, December 10, 2010
Another example why we all love IE !!
Besides from the usual frustrations I encounter in my day to day live developing webapplications which SHOULD also work on Internet Explorer, I just found another little reason to drop IE from my support list.
Why? I just had a discussion with my customer explaining that the reason why some stuff failed to work was the trailing space in a @id attribute. Firefox for instance shows the data as it should.. untouched. The customer however was a bit frustrated because when he opened the xml file in IE, he did not see the trailing space so we ended up in a small yes-no discussion ;-)
Firefox:
----------

IE:
-----------

Lesson learned: Be carefull when debugging issues using Internet Explorer.
@Microsoft:
Do you really consider this a feature... or is this just one of many bugs?
Cheers,
Robby Pelssers
Why? I just had a discussion with my customer explaining that the reason why some stuff failed to work was the trailing space in a @id attribute. Firefox for instance shows the data as it should.. untouched. The customer however was a bit frustrated because when he opened the xml file in IE, he did not see the trailing space so we ended up in a small yes-no discussion ;-)
Firefox:
----------

IE:
-----------

Lesson learned: Be carefull when debugging issues using Internet Explorer.
@Microsoft:
Do you really consider this a feature... or is this just one of many bugs?
Cheers,
Robby Pelssers
Labels:
IE
Monday, November 22, 2010
Benchmark on Synchronization in Java
The article mentions several ways of synchronizing a method and shows performance vs. number of threads. So if the solution has to scale you are better off using semaphores or explicit locks.
Labels:
java
Saturday, November 13, 2010
Persevere, a NoSQL database
I've read quite a bit about client-server architecture but the fundamental problem seems like a scalability issue. Maintaining session state and generating not only the model(data) but also the view on the server side is asking for problems. And de(serialization) of your data between a relational database and your domain model sounds like a time consuming operation. Some databases like CouchDB and Persevere skip this tedious task and since the data is stored as JSON, it's immediately usable in the browser. So it's a matter of providing efficient ways to store and query the data from within the browser.
I was reading through Persevere and Pintura documentation and it's definitely worthwile to build a little sample app with these technologies to get a better understanding. To be continued real soon...
I was reading through Persevere and Pintura documentation and it's definitely worthwile to build a little sample app with these technologies to get a better understanding. To be continued real soon...
Wednesday, November 10, 2010
From XML to JSON using SAX
As a die hard Apache Cocoon user I deal with lots of XML data. And there is more then way to transform your data into another output format like xhtml.
One use case was where I needed to transform a large xml document describing some tree like structure and the customer wanted that tree to be displayed nicely as a tree.
I'd like to describe how you can generically convert any xml document into json.
Let's first start taking a quick look at what JSON is all about.
You basically have to deal with arrays, objects, dates, booleans, numbers and strings.
Based on the above we can come up with a generic XML way of describing the above:
So we can easily write a generic transformer for this use case:
Now you only need to convert your input xml file into the generic JSON xml structure and transform it with the above stylesheet.
- use xslt to transform directly into xhtml -> serialize to xhtml -> render page
- use xslt to transform to json -> serialize to text -> render the page template -> make an asynchronous request to fetch the json data -> preferably instantiate some javascript widget and populate it with the data
One use case was where I needed to transform a large xml document describing some tree like structure and the customer wanted that tree to be displayed nicely as a tree.
I'd like to describe how you can generically convert any xml document into json.
Let's first start taking a quick look at what JSON is all about.
You basically have to deal with arrays, objects, dates, booleans, numbers and strings.
Based on the above we can come up with a generic XML way of describing the above:
So we can easily write a generic transformer for this use case:
Now you only need to convert your input xml file into the generic JSON xml structure and transform it with the above stylesheet.
PDOM: Yet another XML parser
People keep being creative and xml is here to stay for a long time. So we already had SAX (not memory expensive but hard to program against) and (J)DOM which loads the complete document in memory but is easier to use.
Now they released a new parser somewhere in between: PDOM
Now they released a new parser somewhere in between: PDOM
Labels:
XML
Tuesday, November 9, 2010
Selectors API
I never really used the selectors API's untill my customer wanted to add some special behaviour on the first tree cells of all rows of a particular table body.
In combination with YUI this proves to be a really cool feature.
Some new specs for my TO-READ list:
http://www.w3.org/TR/selectors-api/
http://www.w3.org/TR/css3-selectors/
The snippet below selects the first 3 cells from all rows inside tbody[id='fileresults']
Below the macro which generates my table using jx-template (Apache Cocoon)
In combination with YUI this proves to be a really cool feature.
Some new specs for my TO-READ list:
http://www.w3.org/TR/selectors-api/
http://www.w3.org/TR/css3-selectors/
The snippet below selects the first 3 cells from all rows inside tbody[id='fileresults']
Below the macro which generates my table using jx-template (Apache Cocoon)
Labels:
javascript,
Selector API,
YUI
YUI3 using YUI2 TreeView
I was pleased to find out that the YUI team offers functionality to access YUI2 modules from within YUI3. Anyway... just sharing some code I wrote which offers me reusable Tree functionality:
Labels:
javascript,
YUI
Subscribe to:
Posts (Atom)