Thursday, July 17, 2008

BizTalk: Encryption within the MessageBox

I always try to attend the Twin Cities BizTalk User Group meetings at the Bloomington office. I have presented a topic there last year and will be presenting another one later this year. About last year, a Microsoft employee was discussing BizTalk with me and he mentioned that he was looking for a demo BizTalk application which he can use for his sales.

Unfortunately, all I could do was listen to him and could not provide him with a working demo. My manager had informed me that only certain people from my organization should be in contact with that particular Microsoft employee and asked me not to provide him with anything.

Well, its been about a year now and I feel he must have got the demo he was looking for from somewhere. I feel it is good if I can put up a working demo for the benefit of all BizTalk professionals, here in my blog. Lets look at the special requirement for the demo:

The Problem:

Companies dealing with financial data (like Credit Card, Banks,etc) usually need to ensure a very high level of security, especially when transferring data. From within one message, there may be certain fields which may be considered highly confidential - like SSN, Credit Card Number, Date Of Birth, etc. and security for these fields should be very high.

These companies regularly need to send and receive such data from other companies. In order to be interoperable, they usually send and receive data in XML format in clear text. Clear text is needed for speed and also to ensure that communications are not hindered due to incompatible encryption logic used by different companies.

When using BizTalk, any message data which comes into BizTalk via PipeLine, is first stored within the MessageBox Database, before it is sent to the Orchestrations and also before it is sent to the send pipelines. It is stored in the MessageBox Database without encryption to ensure proper speed and debugging functionality. Though this data is stored in here for a relatively really small time, it is very much possible that it can be it can be read by those who want to really get their dirty hands on the data.

This, on its own, is a very scary scenario for the companies mentioned above.

 

The Solution:

Lets now look into the solution for this problem mentioned above. The "High Level Overview" of the solution is really very simple - We need to ensure that the data is Encrypted before it reaches the MessageBox Database and then it is Decrypted while it is leaving the BizTalk Server.

Hmm....simple enough. But how?

Let us look into the details of such a solution:

  1. Receive Pipeline Component will encrypt data
  2. Send Pipeline Component will decrypt data
  3. Schema will determine which element(s) of the message should be encrypted.

Well, now that we have broken down the solution to a more developer understandable solution, let us deep dive into the solution.

Wednesday, April 9, 2008

Testing

Testing

Tuesday, March 18, 2008

Disposable Pattern in Microsoft .Net

Very often, I come across IT professionals who ask the same question again and again - how to effectively manage resources in .Net applications. All are very well aware of the .Net Garbage Collection mechanism. However, very few have heard or implemented the "Disposable Pattern" for managing memory.

.Net effectively manages memory for you. You do not need to worry about the Memory Leaks of yesteryears with .Net. This is accomplished by the .Net Garbage Collection mechanism. The Garbage Collector (GC) keeps a watch at the Memory heap for objects and once space is full, and more space is needed for new objects, the GC will jump into action. Its primary work is to go thru all the objects to find objects that can be removed form memory. We can have a deep discussion about how it works (reference-tracing) in detail, at a later time. For now, all you need to understand is that the GC will remove unrequired/unused objects from memory.

However, one thing to keep in mind is that GC will remove only "managed/.Net" objects from memory. Yes you are correct, the Memory Leaks of yesteryears have not been fully eliminated. The main reason is the use of "unmanaged/non.Net" objects. GC will not release the non .Net resources. It is here that we need to understand the Disposable Pattern. Remember, setting an object to null (C#) or Nothing (VB.Net) does not actually release the resources associated with the object in .Net.

I have been trying to get some good information about Disposable Pattern for my C# project. Scouting the Internet for this information is difficult due to the few sites which provide details about this pattern.

The pattern involves implementing the IDisposable interface's Dispose() method along with the class destructor. The class destructor is automatically called by the GC when it tries to finalize objects to be released.  Users cannot call the destructor directly. On the other hand, the Dispose() method is not called by GC but can be called by the users. In the Disposable Pattern, we need to release all resources used by our class in both these methods. Why from both?- you may ask.

The answer is simple: typically, when a class is no longer needed, it is always advisable to release, immediately, all resources associated with that object.  The user has control of when to release objects only when the class implements IDisposable interface's Dispose method. So, if this method is implemented, users using this class can then call the Dispose() method once they know that they no longer need this class object. On the other hand, if the user fails to call the Dispose() method, the GC will kick in to call the finalize destructor in any case. So, even if the user fails to release memory once the object is no longer required, we are still safe as GC will do the work, albeit later. Hence both.

The following code snippet shows how the Disposable Pattern is implemented in C#.

   1: using System;
   2:  
   3: namespace DisposablePatternNamespace
   4: {
   5:     class DisposablePatternClass : IDisposable
   6:     {
   7:         Boolean HasBeenDisposed = false;
   8:  
   9:         DisposablePatternClass()
  10:         {
  11:             //Constructor - Do what you want here;
  12:         }
  13:  
  14:         #region "Disposable Pattern Specific"
  15:         ~DisposablePatternClass()
  16:         {
  17:             //Destructor
  18:             //No need to change this code
  19:             //This is where you will implement Finalize code
  20:             ReleaseResources(false);
  21:         }
  22:  
  23:         //Dispose method to be called by user.
  24:         public void Dispose()
  25:         {
  26:             //No need to change this code
  27:             ReleaseResources(true);
  28:             //After call to ReleaseResources, no need for finalize.
  29:             GC.SuppressFinalize(this);
  30:         }
  31:  
  32:         void ReleaseResources(Boolean IsCalledFromDispose)
  33:         {
  34:             //Try to release resources only if they have not been previously released.
  35:             if (HasBeenDisposed == false)
  36:             {
  37:                 if (IsCalledFromDispose == true)
  38:                 {
  39:                     //TODO: Code to release managed resources
  40:                     //GC will automatically release Managed resources calling Destructor, 
  41:                     //but Dispose() will not.
  42:                 }
  43:                 //TODO: Code to release unmanaged resources
  44:                 //TODO: set large fields to null
  45:             }
  46:             HasBeenDisposed = true;
  47:         }
  48:         #endregion
  49:     }
  50: }




One may ask why to release Managed Resources as they will be released by GC automatically. A valid question. However, we must keep in mind one thing, if the managed component which we are using in our code, has a Dispose() method, the developer of that component must have placed it there for particularly releasing resources. The component developer is well aware of the resources which are used and needs to be released. Hence, it is always a very good idea to call the Dispose() method of objects we use, if they exist.

You can port the code to VB.Net very easily by just changing the destructor to Protected Overrides Sub Finalize().


I have created Visual Studio Item Templates for use with VS 2005 and 2008 for both VB.Net and C# for this pattern. Feel free to download the same and use it in your projects.

 

Download Item Templates for Visual Studio

Once downloaded, copy them to the following folder
(C# Item Template ZIP file in C# folder and VB ZIP file in VB folder)
Windows Vista:
C:\Users\UserID\Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#
C:\Users\UserID\Documents\Visual Studio 2008\Templates\ItemTemplates\Visual Basic

Windows XP:
C:\Documents and Settings\UserID\My Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#
C:\Documents and Settings\UserID\My Documents\Visual Studio 2008\Templates\ItemTemplates\Visual Basic

The folder location is same for Visual Studio 2005, except that the Visual Studio folder is named "Visual Studio 2005".

For more information on this topic, do refer to Microsoft MSDN site http://msdn2.microsoft.com/en-us/library/fs2xkftw.aspx

 


Thursday, March 13, 2008

Crisis Experience of Presidential Candidates

I was reading couple of blogs and one post caught my attention. It was a post on Reuters where the author raises a question of if Obama can lead the Country in a crisis. I find this question not convincing.

Who from the lot (Hillary Clinton, John McCain and Barack Obama) have had experience of dealing with any crisis as a President. All three of them will be first time presidents and all three of them are committed to lead the country for good. I bet, once elected, all of them will do their best for the country.

All three of them have different background experience. That experience does not equate to being a good president for the country. McCain and Clinton have experience ("to a certain degree") while Obama has the enthusiasm to change America and change the way the world looks at America today. I see McCain and Clinton lacking this enthusiasm.

Remember, if Clinton of McCain acts like President Bush - not consulting with required personnel and not considering their views, they will turn out like President Bush and the world will only frown more at America than they frown today. It was this reportedly flawed policy of Bush where some have reported that he never used to listen to or entertain those who opposed his views. He forgot he was  not running a business, but was running a large nation.

All three of them will have to consult top personnel (military and non-military) and take into consideration what they all say positive or negative, matching his views or opposing, before taking a decision.

Many leaders have led their country in the best way people have seen, without having the experience which Clinton and McCain talks of.

What is there to answering a 3AM call, when 100 percent they will have to call for an urgent meeting to discuss it further....unless some ignorant nation is attacking the white house and his life is in immediate danger.

I believe, while voting in this presidential election, not to look into the experience of the candidates as Clinton and McCain are trying to put it. I believe, they are bringing it out because they do not have anything bad to speak about Obama. I believe that it is best to look into what each of them did (good or bad) before deciding whom to vote for. That good and bad will give a full picture of the person he will be, once in the Oval Office. Not his experience.

 

Humor in Blog

Its not good to have just serious issues blogged. I would like to add a little humor to my blog so readers can enjoy. I have created a new Category called "Humor in Blog" where I will post jokes I come across and maybe funny incidents I come across.

So here is the first one. I received this joke via e-mail:

 

In a trial, a southern small-town prosecuting attorney called his first witness, a grandmotherly, elderly woman to the stand. He approached her and asked, 'Mrs. Jones, do you know me?'

She responded, 'Why, yes, I do know you, Mr. Williams. I've known you since you were a boy, and frankly, you've been a big disappointment to me. You lie, you cheat on your wife, and you manipulate people and talk about them behind their backs. You think you're a big shot when you haven't the brains to realize you'll never amount to anything more than a two-bit paper pusher. Yes, I know you.'

The lawyer was stunned. Not knowing what else to do, he pointed across the room and asked, 'Mrs. Jones, do you know the defense attorney?'

She again replied, 'Why yes, I do. I've known Mr. Bradley since he was a youngster, too. He's lazy, bigoted, and he has a drinking problem. He can't build a normal relationship with anyone, and his law practice is one of the worst in the entire state. Not to mention he cheated on his wife with three different women. One of them was your wife. Yes, I know him.' The defense attorney nearly died.

The judge then asked both counselors to approach the bench and, in a very quiet voice, said, 'If either of you idiots asks her if she knows me, I'll send you both to the electric chair.

LiveJournal Tags: ,,,

Thursday, March 6, 2008

Brink of recession?

Last year we saw the fall of the Mortgage business and with it we slid to the brink of recession. What caused this movement to the brink of recession? It is not just the subprime mortgage loans handed out. I believe it is more than that. Lets look into some major the reasons:

1. Subprime mortgage loans (most widely known reason)

I understand that all lenders want to get more customers. More the customers, more the business and hence more the profits. However, what happened here was that due to the rising Real Estate value, many banks and lenders started to lend money out to all people who wanted to purchase home. Banks adjusted for people's low income and bad credit with changes in the loan package. End result, many people with bad credit had received loans for huge amount. As business see profits rising, the costs will rise too. Its how economy works. Demand pushes the price. Here, in the lending business, price is the interest. As more people stated to take loans, Fed and bank interest rates started to rise.

Many subprime loans were not on Fixed interest. Result, the rise in interest rates, started to push their payments high, so high that many could no longer afford to pay the monthly payments. In some cases, it went higher that the individual's monthly income.

The moment people started to default in payments, banks started foreclose procedures. They had the number of active customers as a fuel to foreclose initial defaults (early 2007). Little did they realize that more people will follow suit and default in payments.

I was surprised why banks did not negotiate a lower fixed rate interest with those who were in danger of foreclosure. Only recently did they start active negotiations.

If banks and lenders had not given so many subprime loans, we may have been far away from recession than we are today.

2. Faulty American Credit System (lesser known culprit)

The American Credit System is to be partially blamed for this mess. I guess not just partially but to an equal level as the subprime Loans. Let me explain why I believe in blaming the Credit System.

American Credit System largely depends on the Credit Score of individuals to determine if an individual can be given credit/loans or not. This is very much acceptable. But the bad part of this is that if an individual has low credit score, his interest rate is high.

Be realistic, if a person has bad credit, it means he may or may not be able to replay the loan. If you give him a large loan at a high rate of interest, he mostly will not be in the mind to stick to the huge monthly payments.

I believe, instead of helping the individual move out of the bad credit, this credit system is pushing more people into bad credit.

If you look at many other countries (like India with a huge population), why is it that a higher percentage of people are not defaulting in payments, as compared to US. The reason is simple - the credit system. In those countries, they give loans at a single rate to all, irrespective of what their credit history is (they do not have credit score system). What changes based on the credit history is the amount of loan they will provide (also takes into consideration the current debt which also includes the credit card limits). So, if a person bad credit history, he may not get the amount of loan he is looking for even though he may have very good and capable income. This will force him to limit his present dream and be realistic on selecting what he can afford. He will be able to payback in time.

Be realistic, if a normal person has a credit card, and he uses more than 80% of his credit amount, due to which the card company raises his interest rate, he may not be able to fully pay the new monthly installment. That can then result in late payments and then in no payments. But he can get new credit card with a good credit limit if he has not defaulted in any payment, irrespective of how many credit cards he has with high credit limits.

The same is the case with mortgages. For subprime mortgages, banks gave the loan at a very high rate to the individuals, due to their credit score. And then, the interest rates started to climb and most people did not have enough leg room to adjust comfortably to the increase in the rate. To begin with, most had taken the loan at the maximum rate they could afford. They gave huge loans at high interest rate and then increased the rates only to see many could not afford to payback.

Now, the more low your credit score is, the more you will not be able to pay back debts due to the high interest rates which will climb more if you don't pay on time. This way, you will suddenly find you are not able to pay back money in time, even though you want to, because credit card companies and home interest rates are climbing every month.

In countries like India, if you default in paying one card, you will not get another card till you clear the first one off in good time, but the amount of debt will increase only marginally (at the original interest rate). This give him a good chance to pay back the debt faster.

It is time the Government and people stand up to change the credit system of America. Put a halt to the interest rate based on Credit Score. Force banks and lenders to change only the Loan amount based on the credit score and current debts. This way, America will soon see that many people are able to pay back their loans.

At the least, to move the country very far away from recession, government should ensure that credit card companies do not increase rates, but decrease them to a reasonable extent, thus helping many clear debts faster.

Right now, many are paying back credit card debts and have less to spend on regular food & clothing, due to the increasing credit card and loan interest rates.

Remember, faster the debts are cleared, more money people will spend on new goods. More the money people spends on goods, further the economy will be from recession. I wish the government would understand this and do this, instead of giving small tax amount for spending. It will have a better effect as nearly all families in America, have multiple credit cards.

 

Wednesday, March 5, 2008

Looking Back - Philips 755

I had just finished talking over my cell phone when my colleague asked me which phone was I using. I showed it to him and he was pretty surprised why he had not heard of the phone. I contacted couple of geeks who love mobile phones and they too did not remember having seen this one. This made me write this post.

Ladies and Gentlemen, presenting the Philips 755 which was released in 2004. Yes, I had purchased this GSM phone in back in 2004 in India, when touch screen phones were "virtually" new.Philips755

Though nowhere near a smartphone, what I like about this cool piece is that it has lasted me for more than 3 years (still running strong with no problem till date) and works very nicely in India and in US. It has a regular keypad with a joystick and touch screen (128x160) and stylus. It has also a built in Camera. You can record sounds and store them as ringtones. It bundles a slide show screen saver (from pictures you select) and software to mix audio, called "BeDJ".

One of the best functionality - which I love the most - is the on spot editing of pictures you take. It has a special button called "Tag It" which allows you to use the stylus or your finger to edit images and enter text on the picture you just took, which you can then save or send via SMS/MMS or Email to others.

The built-in camera has zoom functionality and at 640x480 pixels can take still pictures and videos. One nice touch is the camera lens cover on the rear of the phone that slides up and down shutter style.

The phone has 7MB dynamic memory in addition to storing 500 - 5 field Photo address book. Unfortunately, no memory expansion.

It has an infrared port and GPRS @ 32-48 Kbps and supports WAP 1.1

Games run on Java. Voice dial/command and built in handsfree. I had also heard that it sports an optional video out for viewing photos on TV, but I was not able to lay my hands on one.

All in all, I find this to be a really cool phone which I could lay my hands on in late 2004. And yes, to my Apple friends, iPhone was not the first phone with touch screen.

 

iPhone Copy - in Trouble

Couple of days back I had reported about the iPhone Copy. Just read at Engadget that there was a big move by the German Authorities. Authorities have reportedly shut down the Meizu booth and confiscated equipment and literature associated with Apple iPhone Meizu M8. It will be very interesting to see what happens next.

 

Vacant CeBit booth - Engadget

The above image is from Engadget, which shows the vacant Meizu booth at CeBit.

Read the full story @ http://www.engadget.com/2008/03/05/meizu-cebit-booth-shut-down-by-german-authorities/

 

Democrats Nomination race continues

This is getting better by the day. Political pundits are recalculating every day and learning from the race for Democratic nomination between Hillary Clinton and Barack Obma. It has been a tough race for them. When we see Hillary winning, Obama takes over. When we see Obama winning, Hillary takes over.

The whole focus is now on Wyoming on Saturday, Mississippi on Tuesday, and Pennsylvania on  April 22. The big fight will be on April 22.

Obama is still smiling as he has the lead with regards to pledged delegates. But I feel that smile will be short lived. With Hillary's wins in three states yesterday, delegates may start to thinking again. It is very possible that those who deflected to Obama, may now return to Hillary.

Though this is good and nice for the Democrats and the general public, where all are guessing who will win next, it is particularly good for the Republicans. John McCain can now concentrate for the November elections. He can build a good base in the time Democrats decide who among them will run for President. I would like to see how John McCain will cash in on this small opportunity.

Stay tuned to know more about what's happening in the US political world.

 

Tuesday, March 4, 2008

John McCain wins the nomination

Finally Mike Huckabee had to accept the mathematical facts for the presidential nomination race. This was long overdue. It was very well clear before today's polls, that even if he won all the remaining races, he will still be short and behind John McCain.

I heard his wonderful speech, yes it was really wonderful, no pun intended. I wish him all the best for the future and I wish he doesn't run for the president again. I don't believe he is ready to be the President. He needs to keep himself away from religion and talk more practical not impractical things like "removing IRS".

From all republican candidates, John McCain was the man who appeared to be most sincere and straightforward in the race. Likewise, he won the support of the people to move ahead in the Presidential race again the Democrats.

I am now trying to catch up (on CNN and Reuters) with what's happening on the democratic front. I just hope that the main race is between John McCain and Barak Obama, that will be very interesting and very tough to predict.

 

iPhone copy??

I was reading this one at engadget "Meizu M8 mini One vs. iPhone... fight!" and found it very interesting. Though I am not a fan of Apple, I find it to be very sad that manufacturers do not want to make something which looks different.

Agreed you want to make a touch screen phone, atleast make it look really different and not a rip off iPhone :-)

 

Monday, March 3, 2008

meebo.com

I have been using meebo.com for quite some time now. Have you tried it? You should. It allows you to connect to your multiple Yahoo, Live, ICQ and AIM messengers at the same time from within one browser window. It works via the web, using the web URL and so more convenient to use and no more pesky IM software to install......hmmm... unless you want the extras from those software.

The other great thing you can get with meebo.com is that it provides you with widgets which you can place on your web site pages. I have just placed one on this blog. You can see it on the left.With this widget, visitors to my blog can chat with me (when I'm online) and the visitors don't need to have an account with meebo.com to chat with me.

You can now be connected to all your web visitors and all contacts from your Yahoo, MSN, AIM and ICQ from one cool place which will not clutter your desktop. Well, what are you waiting for? Go to meebo.com

 

Friday, February 29, 2008

Microsoft cuts Vista prices to urge upgrades

Read it on that Microsoft is cutting its price for Vista. This is good news. However, don't jump with joy, the prices have just been cut a bit.

In the United States, Microsoft will reduce prices for Windows Vista Ultimate, the company's top-end operating system, to $319 from $399 for the full version and cut the price for an "upgrade" version to $219 from $259 for consumers who already run Windows XP or another edition of Vista.

It also cut prices for upgrade versions of Vista Home Premium, its mainstream product, to $129 from $159. The price cuts vary by country.

 

It appears this is the only way Microsoft has seen to bring Windows XP users to "upgrade" to Vista. I wish they had ensured more software and devices are supported before they try to rein in Windows XP users for upgrade.

They have already sold 100 million copies of Vista. With the profits earned, they could have cut prices more.....wait.....they will need that money to settle the battle about the "Vista Capable" branding of systems.

 

Thursday, February 21, 2008

Who will finally run for President?

The past couple of weeks have been very exciting in the Election run. We have seen, in both parties, candidate who is not popular within his party, is running ahead in the primaries....is more popular among the public - yes, I am talking of John McCain and Barack Obama.

Looking at the Republican party, we see Ron Paul, Mike Huckabee and John McCain fighting for the party nomination. In my view, John McCain is a better candidate then Mike Huckabee or Ron Paul. He is a determined fighter, does not easily give up on his views, separates his religious views with what is better for the country, conservative, experienced in Foreign Affairs and quite popular among voters.

And at the Democrats camp, we have Barack Obama and Hillary Clinton. Both are good orators, but Obama has the extra gift of attracting people with his words. Hillary Clinton has the experience behind her, as First Lady and as Senator for many years, while Barack Obama is a very fresh Senator. Obama knows what's going on in the world and that one of the most important thing a President should do now, is to improve the image of America in the eyes of the world population. But Clinton has not shown this sight. But its a tough fight between them. Obama has won more primaries and won more pledged delegates than Clinton, but Clinton has more superdelegates. Theirs is an interesting match - a fight between one who wants to be the first African-American President and the other who wants to be the first female President. From between both of them, as of now, I am leaning more towards Obama for President. But lets see what the public have to say.

I will soon give more details of whom, from each party, will I support and why. Till then, lets enjoy the debates and watch the primaries

.

Tuesday, February 19, 2008

The Guru's Views

This is my first post to my blog. I have created this blog to speak my mind out. My mind has many thoughts on various topics from Politics to Technology to Current Affairs. These thoughts are not mere thoughts from a mortal, but are thoughts handed down to me by the Gods.

 

Feel free to post your comments if you wish to. You can post your questions too and I will make every effort to reply to within the first 12 hours......maybe a little bit longer as I may have to ask the Gods the same.

Enjoy and Believe in Yourself. Hari Om.