Thursday, June 9, 2011

Write a program to find the max and second max


This is little tricky, but not difficult. easiest way to do this is to sort the array and then find the answer. But that not expected out of you.

The algorithm here is take thefirst element as the max and second max. Then loop through all elements

  1. If the number is larger than max then make it max, and make old max to second max.
  2. Else if it is more than second max then make it the second max.
  3. In all other cases drop that number
Here goes the code for your reference.

/*
** Write a program for finding the max and second max 
** of an array of given size */

#define SIZE 10

int main(void)
{
    int array[SIZE] = {10, 5, 16, 2, 1, 2, 3, 18, 21, 4};
    int i, max, sec_max;

    max  = sec_max = array[0];

    for(i=0; i< SIZE; i++)
    {
        if(array[i] > max) {
            sec_max = max;
            max = array[i];
        }
        else if(array[i] > sec_max)
            sec_max = array[i];
    }

    printf("max =  %d, sec max = %d", max, sec_max);
}

Saturday, June 4, 2011

Error message when you click a hyperlink in Outlook

Today morning, When I open my outlook for joining a meeting, I was not able to click the link for meeting, it was working when I pasted the same on browser,  When you click a hyper link in Microsoft Outlook, you may receive the following error message: "This operation has been cancelled due to restrictions in effect on this computer. Please contact your system administrator." I was clueless as everything was working fine a day before. Did some search on google and found that microsoft has published a solution for the same.

This was said to be a problem due to some corrupted registry keys after the internet explorer upgrade, and there is patch executable released by microsoft which would fix the problem for you, check this link

If you find any issues after this, do let me now :)

Wednesday, June 1, 2011

Fix for Scroll Issue with Picasa 3.8 on Windows 7

Recently I faced a strange issue with picasa, the photo organizer/editor from Google. The scroll does not work !!, It was working perfectly fine on my personal laptop, but was not working on my office laptop, and scroll works fine in rest of the applications. I was thinking there is something to do with the installation, but reinstall also did not solve the problem,

Later I found that, Most (almost all) mouse drivers cause mouse wheel events with a "delta" of ±120. This is an arbitrary value that has been choosen by Microsoft in the past to allow finer control.

Since then, several programs use that value directly to test whether the mouse has been scrolled down or up (delta / 120 == 1 -> down, delta / 120 == -1 -> up, or something like that).

However, the Intellipoint software causes mouse wheel events with smaller "delta" value (the expected finer grain control), and programs which use the 120 value that way just fail to register the wheel movement, because in integral values, 30 / 120 = 0...

Let's hope Picasa developers would fix this issue soon, by modifying the mouse wheel handling method.

There are ways you can fix this issue temporarily, one is by using the Autohotkey. Autohotkey is a program you run in the background, which loads simple or complex scripts controlling the mouse and keyboard inputs, as well as other wanted behaviors in your Windows system. You can intercept the mouse wheel event and change the delta value before passing to a particular program, so if you make it 120 again, you would solve the issue.
  1. Download and install AutoHotkey (http://www.autohotkey.com)
  2. Right-click an empty spot on your desktop or in a folder of your choice.
  3. In the menu that appears, select New -> AutoHotkey Script. (Alternatively, select New -> Text Document.)
  4. Type a name for the file, ensuring that it ends in .ahk. For example: Test.ahk
  5. Right-click the file and choose Edit Script.

In the window that appears (likely Notepad), copy the lines of the script above. Save your document.

AutoHotkey does not run by itself, it runs a script. So you need to put the script file you just created in Startup, and it will start automatically when Windows start. This should fix your mousewheel problems with Picasa.

I have found that the latest IntelliPoint 8.0 software (released August 2010) fixes the scrolling issue. It also does the same thing, it detects that the picasa is running and changes the delta value to 120 and things would work just perfct

You can download the latest version of Intellipoint software for your mouse from here,

Saturday, January 22, 2011

How to Activate Windows XP without Product Key


Here is a simple trick to activate windows without any product key  .

When you have installed windows xp and try to activate you get messages like “your product key is not genuine or the number of activation has been exceeded” and then it tells you to call MIcrosoft to get the key, Instead of Going to this trouble, or instead of spending Hundred of dollars, to get a new genuine product, let us solve this problem by following way:

STEPS:-

  1. Click on Start
  2. Find and Click “Run”
  3. Type regedit
  4. Click the plus next to “HKEY_LOCAL_MACHINE”
  5. Click the plus next to “SOFTWARE”
  6. Click the plus next to “Microsoft”
  7. Click the plus next to “Windows NT”
  8. Click the plus next to “CurrentVersion”
  9. Click “WPAEvents”
  10. On the right panel, find “OOBETimer” then double click it.
  11. Now, Delete all the Values by highlighting it, then delete it
  12. Then type in this value without the quotation mark “FF D5 71 D6 8B 6A 8D 6F D5 33 93 FD”
  13. Then after that click OK,
  14. Then on the left panel right click WPAEvents, then click on permissions
  15. Then click System or SYSTEM, then Deny Full Control, then Click OK.
  16. Then Exit Registry Editor by Click the X or the red X on the Upper Right of the Title Bar or press ALT and F4 at the same time.
  17. To Very that it works, go to start, then “activate windows”, or go to start, then all programs, then “activate windows”
  18. If it says that Windows has been activated.
I got this info from this website, thanks a ton to him


XP Mode for Windows 7 Ultimate

XP mode is nothing but, a virtual machine inside windows 7 running windows xp. The best part I can think about this is everything is provided by Microsoft, the virtual machine and the guest operating system, and hence we assume the operating system to be tuned for virtual machine and hence the performance is much better. Last year  I had run windows xp on Ubuntu, and this time on Windows 7. The main motive for me to try this is I wanted to run Need for speed Special Edition, it was one of my favorite game of the past.


You need to have a genuine windows 7 for you to be able to install xp mode, but then you can download the torrent version of the same files as it by pass the genuine validation check. I downloaded one from a torrent, which has Windows Xp mode installer, and Vitual PC and Virtual PC update. I installed Windows Xp mode, which basically is a VHD (Virtual Hard Disk) file, which can be booted from Virtual PC. I could not install Virtual PC as it was meant for a 64 bit machine and mine was 32 bit machine, so I downloaded Virtual PC 2007, and it works just fine with the VHD Image installed by the Xp mode.

I think the Virtual PC provides additional functionality which allows you to run Xp installed applications directly from windows 7, which you cannot do here directly, but you can always go inside xp and run the applications. Things seem to be working very fine for me. I also installed the guest additions which allows you to share folders between the operating systems and also allows pointer integration.