“Unlicensed Product” error when you open an Office Professional Plus 2010 application

Some times, when open any MS Office application like outlook, excel etc, i keep get following error irrespective of my license expired or not.

“Unlicensed Product” error when you open an Office Professional Plus 2010 application”

To fix the issue, i followed following steps.

Easy fix 51006

  1. Determine whether the computer has the 32-bit or 64-bit version of Office 2010 installed. To do this, open any Office 2010 program, click File, and then click Help. The Office version is displayed next to the Version number.
  2. Close all Office 2010 programs.
  3. Click Start, type cmd in the Start Search box, and then press Enter.
  4. At the command prompt, type one of the following commands, and then press Enter:
    • If you’re running 64-bit Windows with 32-bit Office:
    • If you’re running 32-bit Windows, or running 64-bit Office with 64-bit Windows:

You can can find more help or ways to fix this issue from this MSDN help link.

Introduction to basic ODBC programming

Sample program to write basic odbc program to connect/ query/ disconnect with unicode data.

For more help we can refer to MSDN doc link and get more sample code as well.

TCPDUMP – Packet size limited during capture HTTP truncated

In Linux environment, if you want to use command base to capture network packets, you can use the following command with TCPDUMP.

The above command will dump network packet for network interface eth0 to a file call out.pcap. This file is a pcap format which you can open by Wireshark.

The above command will use a default capture size of 96 bytes and the benefit of this is to create a small output file. However, the downside is that certain large packet information will be lost and you may not see a complete picture of network communication. Especially in Wireshark, such situation will display with a message “Packet size limited during capture HTTP truncated” for large packet.

To solve this issue, use the following command.

-s 0 flag tell tcpdump to capture packet at original size (65535 bytes). And, this will create much larger output file.

Force a windows desktop application to run in 32bit process on 64bit OS

Recently, I faced an issue with a downloaded windows application binary/executable. When I double clicked, it throws error popup saying that wrong architecture mismatch. Then my target is to run that age old application to run on my latest x64 bit windows machine in seamless manner.

Some of the suggestions i got from searching net are – changing the application target platform as x86 and re-compile, generate binary. But, am not the creator of that application. Next suggestion is to change the platform to 32-bit environment in IIS settings, if that application runs in IIS context. This option as well not suited me well as my application don’t depend on IIS.

Then, I finally came to know about this particular utility called CorFlags.exe to flip the 32-bit flag on the assembly. I don’t know this is the optimal way of making this works, but for me it solved the issue. This utility mostly comes with default windows OS i guess. But, for me i found in my visual studio installation. To know more about this utility, you can refer this link. I used followed commands to flip 32-bit flag on my application which in turn forces to run as 32-bit process on a 64-bit machine.

To set the 32Bit flag, run following command in command prompt.

CorFlags.exe MyAssembly.exe /32Bit+

To turn off the 32Bit flag,

CorFlags.exe MyAssembly.exe /32Bit-

This solved my problem without much effort. But there is another solution as well – that is to write a wrapper launcher application to your target application. This can be more controlled approach and at the same time, needs to write our own code to launch this application. Anyways, I just wanted to introduce this wonderful utility called CorFlags.exe which resolved my issue in no time.

Monty Hall Puzzle

You’re on a game show and there are three doors in front of you. The host, Monty Hall, says, “Behind one door is a brand new car. Behind the other two doors are goats. Pick a door!” You think, “Well, it doesn’t matter which door I choose, every door has a 1/3 chance of having the car behind it.” So, you choose door number 1. Now it gets interesting. Monty, the host, who knows where the car is, opens door number 2 and reveals a goat. The host always opens a door to reveal a goat. The host says, “If you want, you can switch to door number 3.” What should you do? Stay with your original choice or switch to the other door? All right, so what are you going to do? Stay or switch? Well, it’s a fifty-fifty chance of winning the car in either door. Right? [Wrong!] You actually double your chances of winning the car by switching doors. And that is why the Monty Hall Problem is so evasive!

Choose an explanation to the Monty Hall Problem:

1/3 vs 2/3 – Solution #1 to the Monty Hall Problem

There is a 1/3 chance of the car being behind door number 1 and a 2/3 chance that the car isn’t behind door number 1. After Monty Hall opens door number 2 to reveal a goat, there’s still a 1/3 chance that the car is behind door number 1 and a 2/3 chance that the car isn’t behind door number 1. A 2/3 chance that the car isn’t behind door number 1 is a 2/3 chance that the car is behind door number 3.

100 Doors! – Solution #2 to the Monty Hall Problem

Imagine that instead of 3 doors, there are 100. All of them have goats except one, which has the car. You choose a door, say, door number 23. At this point, Monty Hall opens all of the other doors except one and gives you the offer to switch to the other door. Would you switch? Now you may arrogantly think, “Well, maybe I actually picked the correct door on my first guess.” But what’s the probability that that happened? 1/100. There’s a 99% chance that the car isn’t behind the door that you picked. And if it’s not behind the door that you picked, it must be behind the last door that Monty left for you. In other words, Monty has helped you by leaving one door for you to switch to, that has a 99% chance of having the car behind it. So in this case, if you were to switch, you would have a 99% chance of winning the car.

Pick a Goat – Solution #3 to the Monty Hall Problem

To win using the stay strategy, you need to choose the car on your first pick because you’re planning to stay with your initial choice. The chance of picking the car on your first pick is clearly one out of three. But, in order to win using the switch strategy, you only need to pick a goat on your first pick because the host will reveal the other goat and you’ll end up switching to the car. So you want to use the strategy that lets you win if you choose a goat initially because you’re twice as likely to start by picking a goat.

Scenarios – Solution #4 to the Monty Hall Problem

To understand why it’s better to switch doors, let’s play out a few scenarios. Let’s see what will happen if you were to always stay with your original choice. We’ll play out three scenarios, one for each door that the car could be behind (door number 1, door number 2, or door number 3). And it doesn’t matter which door you start out with, so, to keep it simple, we’ll always start by choosing door number 1.

Stay strategy, scenario 1: the car is behind door number 1. You choose door number 1, then the host reveals a goat behind door number 2 and because you always stay, you stay with door number 1. You win the car! Stay strategy, scenario 2: the car is behind door number 2. You start by picking door number 1, the host reveals a goat behind door number 3, and you’re using the stay strategy so you stay with door number 1. You get a goat and don’t win the car. Stay strategy, scenario 3: the car is behind door number 3. You pick door number 1, the host opens door number 2 to reveal a goat, you stay with door number 1, and you get a goat. So, using the stay strategy, you won the car one out of three times. That means that in any one instance of playing the game, your chance of winning the car if you choose to stay is 1/3 or about 33%.

Now let’s try switching doors. Again, we’ll always start by picking door number 1. Switch strategy, scenario 1: the car is behind door number 1. You choose door number 1, the host opens door number 2 to reveal a goat, you are using the switch strategy so you switch to door number 3. You get a goat. Switch strategy, scenario 2: the car is behind door number 2. You start by picking door number 1, the host opens door number 3 to reveal a goat, you switch to door number 2 and win the car! Switch strategy, scenario 3: the car is behind door number 3. You pick door number 1, the host opens door number 2 to reveal a goat, you switch to door number 3 and win the car again! So, with the switch strategy you won the car 2 out of 3 times. That means, that in any one instance of the game, your chance of winning the car if you choose to switch doors is 2/3 or about 67%.

Therefore, if you play the game three times and stay, on average you’ll win the car once. But if you play the game three times and switch each time, on average you’ll win the car twice. That’s twice as many cars!

ORA-01658: unable to create INITIAL extent for segment in tablespace SYSTEM

Recently I’m stuck with this error suddenly while writing data to this Oracle XE edition. Of course, it’s kind of frustrating to see this kind of errors in the middle of our tasks without even knowing the origin of these. I did few searches on the web, and able to cross the issue with below fix.

Root cause of the error:

Failed to find sufficient contiguous space to allocate INITIAL extent for segment being created.

Fix:

1. Create and add a datafile to the database, for additional space to the tablespace.

2. Since, over the period the given size may gets filled as well, so what i did is to extend the size automatically as below.

After doing the above, i finally avoided this bugging issue and continue to use Oracle XE edition for project use.

Number of comparisons to find second minimum element in an Array

Given an array of numbers, we need to find the second min element with optimal number of comparisons.

Let’s compare two elements (side by side) and get next set of min element list. Recursively, we end up with lowest number in the last iteration as mentioned below.

Finding Min Using Tournament Method

Now, how many comparisons we took to find least number here are:

n/2 + n/4 + n/8 + …. = a/(1-r) = n/2*1/(1-1/2) = n

So, it took n comparisons to find the least number. Now, to find the 2nd least number, can we reuse the previous states we used to find 1st least number ? If you observe the below figure, rectangle numbers will definitely contain the 2nd least number. And, identifying these numbers is easy, each recursive iteration we are comparing side by side numbers.

The reason why we went the tournament way (as opposed to serial comparison) is that we can leverage the reverse tree to find the second minimum value with log(n) comparisons (asymptotic), hence the solution represents marked improvements over 2n (ignoring constant) comparisons as required by trivial method.

Here is the logic to find second minimum value.

The logic is that at some point the minimum element (root element) must have knocked out the second minimum element. So, by backtracking from the root element (minimum) all the way to the top and checking all the adjacent elements to the root element (for each row) we can find the second minimum. The key point to note is that at any level (above root level), the adjacent elements can be obtained by the index of root element at this level. Therefore, you don’t need to scan complete sub-array (of recursion tree at any level). The adjacent elements for n-1 level is obtained as follows:

Adjacent Left (n-1 level) : 2 * (root index for nth level)
Adjacent Right(n-1 level): 2 * (root index for nth level) + 1

Therefore, for each row of the recursion tree, you just need to perform two comparisons to find the root element index to obtain the adjacent elements of row above. Refer to Figure 3 below. One of the elements marked in green box must be second minimum.

Finding 2nd Minimum using optimized back-tracking

So, how many comparisons we make using this method. Let’s calculate (ignoring constants): 

Comparisons for finding minimum: n
Comparisons for finding 2nd minimum: log(n)
Total: n + log(n)

Thus this method offers marked improvement over crude method.

Poodle fix for all the users of libcurl

As you know, SSLv3, most popular TLS protocol, is announced as victim of this Poodle vulnerability. After this announcement, all the enterprise community rushed to disable SSLv3 & SSLv2 protocols as part of their security enforcements. This page explains the similar fix for libcurl users and particularly for those who are still users of old libcurl versions like 7.15.x etc.

This page explains the fix for libcurl 7.15.x version.

Solution to Poodle vulnerability is to disable SSLv3 & SSLv2 protocols in TLS communication. libcurl by default uses SSLv3 for TLS. Now there is another option to enforce libcurl to use TLS 1.0 as SSL protocol using following code.

The above code tells libcurl to use only TLS 1.x protocol and respective cipher suites for SSL communication. For those, who can afford for libcurl version upgrade, you can directly go to libcurl home page and get the latest with the Poodle fix.

Without this fix, and your server not supporting SSLv3 or SSLv2 protocol stack, your curl client ends into following error.

This error tells that server unable to provide handshake to client hello as server not supporting SSLv3.

For any issues/queries, you can mail/comment in this page. Thanks :) .