Replace OBX to NTE

I had a situation where in, all the OBX segments in a HL7 message is supposed to change to NTE. I am not sure why, but this was the requirement.

I have used various techniques to do so but most of them failed.

Then one of the finest clue I could get from

Loop for each OBX
  Loop foe each fields in OBX
    start copying them into NTE

But you know this trick has an headache that no. of fields were not constant in my case. Sometimes OBX|1 has just 20 fields, somtiems may be the 25th field will be present. Hence copying each segment-field to NTE stopped me to do so.

Finally the outcome which I found, seems to be the easiest solution ever:

     channelMap.put('originalHL7msg', messageObject.getRawData());
    var originalHL7msg = channelMap.get('originalHL7msg');
    var customHL7msg = originalHL7msg.replaceAll("OBX\\|", "NTE\\|").toString(); // Listen you cant replace the msg neither converted msg to xml.toString or anything will not work.
    channelMap.put("customHL7msg", customHL7msg);

And finally at the output end, just use “customHL7msg” as the final output message instead encoded data.

What is web 2.0?

When I Googled for web2.0 ?

This article is totally borrowed from number of resources over the net, plus people around me and finally canvassed using my ideas. The intention to write this article is that till this time, I was unable to find the exact meaning of web2.0. Talks from my friends and colleagues and results from Google have made my mind in a fuzzy state. So finally I made myself to sit and extract what is required and hence my article.

From web to web2.0

Before the www has come into existence, there were very few things in an interactive computer world; might be some OS build around some computing technologies, decorated with few packaged software applications enhanced from some APIs.

Days have gone; client-server methodology has introduced with a hyper linking concept. Sir Timothy John Berners-Lee: the one who invented the World Wide Web in March 1989. Going in the age of WWW rediff, geociites, Yahoo etc made a mark in past. The earlier version of sites worked with lot many limitations and drawbacks. For example sites were very specific to the browser.

Then suddenly a new term became notable after the first O’Reilly Media Web conference in 2004 and that’s nothing but “Web2.0″.

What says our geeks?

Tim O’Reilly says:
“Web 2.0 is the business revolution in the computer industry caused by the move to the Internet as platform, and an attempt to understand the rules for success on that new platform.”

Troy Angrignon says:
“Web 2.0 is a group of economically, socially, and technologically driven changes in attitudes, tools, and applications that are allowing the Web to become the next platform for communication, collaboration, community, and cumulative learning.”

Jon Udell says:
“Don’t think of the Web as a client-server system that simply delivers web pages to web servers. Think of it as a distributed services architecture, with the URL as a first generation “API” for calling those services.”

Oh common!!!, why can’t they speak a simple language so that a dumb like me can understand it. Cool down I have concluded for you that a web2.0 could be said as:

  • A business revolution towards change in Internet.
  • A modified or advanced version of www (but still not exactly).
  • A concept or philosophy where users maximizing collective intelligence over the Internet.
  • An enhanced idea of doing more in terms of interaction of people for web.
  • It’s about sharing; code, content, ideas.
  • It says freeing of data, allowing it to be exposed, discovered and manipulated in a variety of ways. Permits the building of virtual applications, drawing data and functionality from a number of different sources.

Jargons that is likely inherited from web2.0:

Web Services; Syndication (RSS); decentralization; open; distributed services architecture; API; The Web as Platform; innovation; media and devices; infrastructure; Agile; utility/usefulness; simplicity and flexibility; connectivity; web browser etc.

Ideas behind web2.0:
Collaboration: Sharing your codes to the world.
Conversation: Join Facebook.
Community: My orkut community is: Amazing Links
Connection: You are connected through my LinkedIn network.
Content Creation: Let me post to my blog, you may comment it after reading it.
Commutative Learning: Scribd is hosting your learning materials for others.
Collective Intelligence: Believe in a group rather than your individual intelligence.
Core Values: Openness, Transparency, Respecting users
Cheap and fast: Make an application of few dollars and sale it to hundred users.

The term confused me “The Web As Platform

And I will confuse you more by asking a Q

“The Web As Platform” Vs “The Web As Platform… “

In web2.0 there is very common phrase i.e. “The web as a platform”, but here I have mentioned something more: that is the phrase with some dots…

Why are those dots?
“The Web As Platform” is just a heading tag in a definition of web2.0. Actually this heading title does not have a complete meaning until you try to finish it. Means your web should know with whom are you talking, i.e. platform for what? For train/bus/autos or dancers or what?

. Web is a platform [for business] for [corporate people].
. Web is a platform [for communication] for [marketers].
. Web is a platform [for new media] for [journalists].
. Web is a platform [for software development] for [geeks].
. Web is a platform [for YOUR STUFF] for [YOU]

Makes sense!!!!! Good.

The collective intelligence in web2.0: You are not alone here.

Wikipedia: You read/write/edit and serve to all I liked your stuff & hence bookmarked it.
Flickr: wanna see my barcamp pics?
Cloudmark: Your spam filter.
Linux,PHP,MySQL, RoR,Perl – take home for free of cost and run any web applications.
Blogging: She publishes and you comment.
Ebay: A platform, grows as you grows.
Amazon – Before you purchase, lets check the reviews.

Web applications voting for web2.0:

Zopa: Taking money lending to the masses
Zimbra: Messaging and collaboration
Tictrac: Online time tracking
World66: A wiki on Travel
NetworthIQ: Track your networth online
OpenID: Single identity across all applications
Foldershare: Keep your files online
HousingMaps: Craigslist + GoogleMaps: A mashup

Whatever is it (as still experts are expecting a better name rather than web2.0),

In short, Web 2.0 is about making computing SOCIALLY RICH.
So the philosophy of Web 2.0 is to let go of control, share ideas and code, build on what others have built, free your data. And this freedom is not limited to a fixed release version. You release it today, tomorrow a new bug; fix it and again a new release. You got something to add, one more release. And what we say the web2.0 products are always in BETA version. Great!!!
Think about the beauty here, you have only bread-slices today, Amit told that you may use his kitchen but need to pay Rs10 per day, Milind tells you don’t worry I will get you my stove, Aashish gets tomato sauce for free, Srinoo brings omelet, and as a result you are going to have a nice breakfast. Meanwhile Abhishek comes and asking – Yaar I am hungry. Later when Himanshu heard this, he said – next time I’ll place an order to have bread-omelet from you. From next week entire v2 has ordered for this breakfast.
So what is there in the breakfast? Huh!!!!!!

Breakfast => Main Application.
Kitchen => Platform for hosting application.
Stove => API, use it from the vendor.
Sauce => An open source product, 100% free
Omelet => May be a third party tool
Abhishek => A free user
Himanshu => Your first customer
Entire v2 => Awaiting for a Beta version release.

Business view:
You had just bread- But still you could have a nice breakfast. Resources you could arrange on fly. And once you supplied free, later beta version has got a huge customer of your product. Makes money. MMMMuaaaah.

Articulated and complied by,

String to Integer

In JAVA programming it is very frequent demand of converting an int/Integer to String.

Below snapshot shows how this is done. Easy to remember.
Integer to String

public class DataTypeCoversionDemo {
            private static String strVar = "11";
            private static int intVar = 22;
            private static Integer integerVar = 222;
      public static void main(String[] args) {      

      public static void convertInt_String(){
            // ********* Integer to int ********** //
            Integer tInteger = Integer.valueOf(intVar);
            int tSimpleIntValue = tInteger.intValue();

            System.out.println("Simple Int to Integer  :- " + tInteger); //22      
            System.out.println("Integer to Simple int :- " + tSimpleIntValue); //22

            // ********* int to String ********* //
            String tString = String.valueOf(intVar);
            int tInt = Integer.parseInt(strVar);

            System.out.println("Simple Int to String :- " + tString); //22
            System.out.println("String to Simple Int :- " + tInt); //11

            // ******* Integer to String ******* //  
            String tString2 = integerVar.toString();
            Integer tInteger2 = Integer.parseInt(strVar);        

            System.out.println("Integer to String :- " + tString2); //222
            System.out.println("String to Integer :- " + tInteger2); //11