Monday, May 31, 2010

The Super Computing Race

        With the technology moving at a fast pace, countries especially the developed ones are on a stiff competition to catch up with the supercomputing  power they posses. While USA and China had taken the supercomputing to the Peta-flop level, with USA at the forefront achieving a landmark of 1.7 Peta-flops with their Jaguar(Cray) super computer, while China taking the second position with their 1.2 Peta-flop super computer.

       The research laboratories had reveled that, in near future the super computing speeds are going to be taken to Exa-flops level, which could crunch a whopping of one quintillion (one million trillion) calculations per second. The Exa-scale system is proposed to process tons of data sourced from SKA (Square Kilometer Array), which are a series of telescopes spread over hundreds of square kilometers.

    Here in a current release of the biannual supercomputing survey, you can find the Top 500 supercomputers grouped on the basis of Country, OS, Processor and many more parameters.


Friday, May 21, 2010

Business Objects - Crystal Reports

The other day while working with crystal reports for .NET, I was confronted with deployment issues, where "Business Objects - Crystal Reports"  merge modules and redistributable's were missing. After some search all the required components were available from the "SAP" site. You can find Hot fixes, Patches and more in the following URLs


http://resources.businessobjects.com/support/additional_downloads/runtime.asp 
(Packages along with documentation)



https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm
(Download Links)


Monday, May 17, 2010

Active Desktop Recovery

If you ever happened to encounter the "Active Desktop Recovery" screen on your desktop, which itself is annoying. To make matters worse clicking on "Restore Active Desktop Recovery" won't make any difference. As the issue started to pop up regularly, I thought of documenting the solution.


Before reading on, make sure you have registry access permissions, as most of the steps involves some registry tweaks here and there. So lets move on the solution. 


The following solution worked for me, which I believe should definitely work for you too. 


Step 1:
Delete "Desktop.htt"


1. Key in "." (period without quotes) to the "Start->Run" window.
2. The "Documents and Settings" folder of user login should open up.
3. From there navigate to "\Application Data\Microsoft\Internet Explorer"
4. Delete "Desktop.htt". If you couldn't find the file, make sure "Show hidden files" is turned on.
5. Refresh the desktop. If the error still persists, move on to Step 2.


Step 2: (Before proceeding, make a backup of the registry keys you are about to alter.)
Modify "SafeMode" registry key.
1. Open Registry.
2. Navigate to "HKCU\Software\Microsoft\Internet Explorer\Desktop\SafeMode\Components"
3. Change the DeskHTMLVersion key from 272 to 0 and reboot. The original desktop should now be back.
4. If the error still persists, move on to Step 3.


Step 3: (Before proceeding, make a backup of the registry keys you are about to alter.)






1. Open Registry.
2. Navigate to "HKCU\Software\Microsoft\Internet Explorer\Desktop\SafeMode\General"
3. Delete the value in "Wallpaper" key, which will be "%SystemRoot%\Web\SafeMode.htt".





2. Navigate to "HKCU\Software\Microsoft\Internet Explorer\Desktop\General"
3. Delete the value in "BackupWallpaper" key. 
4. If the error still persists, move on to Step 4.

Step 4:
1. I am out of options, please post your issue with Stackoverflow, Experts-Exchange or Windows forums or with Bytes.



Friday, May 14, 2010

World Time

If you are developer or accounts manager working for a remote client in a different timezone, definitely you need to know their local time before making a call or scheduling a meeting over the web. As a solution to this, most company's put up wall clocks, displaying local time of their clients, which is pretty elegant solution. 

But what if you want to know beforehand the local time of your acquaintances who are geographically located? The solution comes right to you desktop under the title QClock, a freeware desktop based application. The application lists timezones from cities all around the world, which itself is a pretty good list of major cities to choose from.


Here is a screenshot of QClock on my Desktop





Wednesday, May 12, 2010

Generic Delegates

With the introduction of Generics in .Net, the task of declaring delegates got much simplified. Before this we had to declare a pretty big list of delegates for every callback methods and thereafter creating instances of each delegate. This seems a bit dragging due to the repetitive nature of declaring and instantiating delegates. Here let me show you the usual way of declaring delegates.

    public class DelegateDilemma
    {
        private delegate void Delg_NotifyUser(string Message);
        private delegate void Delg_OpsComplete(int StatusCode,string Message);
        private delegate void Delg_BroadCast(string Message,bool Success);
        private delegate void Delg_OpsFailed(int StatusCode, string Message);
        private delegate void Delg_OpsCancelled(int StatusCode, string Message);
        private delegate void Delg_OpsStarted(int StatusCode, string Message);
        private delegate void Delg_OpsPaused(int StatusCode, string Message);

        // CB = callBack
        private Delg_NotifyUser CB_NotifyUser;
        private Delg_OpsComplete CB_OpsComplete;
        private Delg_BroadCast CB_BroadCast;
        private Delg_OpsFailed CB_OpsFailed;
        private Delg_OpsCancelled CB_OpsCancelled;
        private Delg_OpsStarted CB_OpsStarted;
        private Delg_OpsPaused CB_OpsPaused;

    }


Here you could find most delegates being declared and thereafter being instantiated. Lets cut-short this way of writing delegates with fewer lines of code.


I decided to write a generic utility class for handling delegates. This made the task of declaring delegates much simplified. Here is the code for the GenericDelegate utility class.

public static class GenericDelegate
{
    public delegate void Delg_Mthd();
    public delegate void Delg_Mthd<P1>(P1 Val1);
    public delegate void Delg_Mthd<P1, P2>(P1 Val1, P2 Val2);
    public delegate void Delg_Mthd<P1, P2, P3>(P1 Val1, P2 Val2, P3 Val3);
    public delegate void Delg_Mthd<P1, P2, P3, P4>(P1 Val1, P2 Val2, P3 Val3, P4 Val4);
    public delegate void Delg_Mthd<P1, P2, P3, P4, P5>(P1 Val1, P2 Val2, P3 Val3, P4 Val4, P5 Val5);

    public delegate R Delg_Proc<P1, R>(P1 Val1);
    public delegate R Delg_Proc<P1, P2, R>(P1 Val1, P2 Val2);
    public delegate R Delg_Proc<P1, P2, P3, R>(P1 Val1, P2 Val2, P3 Val3);
    public delegate R Delg_Proc<P1, P2, P3, P4, R>(P1 Val1, P2 Val2, P3 Val3, P4 Val4);
    public delegate R Delg_Proc<P1, P2, P3, P4, P5, R>(P1 Val1, P2 Val2, P3 Val3, P4 Val4, P5 Val5);
}


The only limitation I came to see with GenericDelegate class was that, the developer won't be able to call parameters with Ref and Out keywords in their parameters. While the params keyword can be used with the only limitation that, you need to pass values as an array instead of passing as individual parameters. 


In the following code snippet you can see how the GenericDelegate class is being put to use, in place of creating delegates for each and every callback methods.

namespace DelegatesGeneric
{
public static class GenericDelegate
{
    public delegate void Delg_Mthd();
    public delegate void Delg_Mthd<P1>(P1 Val1);
    public delegate void Delg_Mthd<P1, P2>(P1 Val1, P2 Val2);
    public delegate void Delg_Mthd<P1, P2, P3>(P1 Val1, P2 Val2, P3 Val3);
    public delegate void Delg_Mthd<P1, P2, P3, P4>(P1 Val1, P2 Val2, P3 Val3, P4 Val4);
    public delegate void Delg_Mthd<P1, P2, P3, P4, P5>(P1 Val1, P2 Val2, P3 Val3, P4 Val4, P5 Val5);

    public delegate R Delg_Proc<P1, R>(P1 Val1);
    public delegate R Delg_Proc<P1, P2, R>(P1 Val1, P2 Val2);
    public delegate R Delg_Proc<P1, P2, P3, R>(P1 Val1, P2 Val2, P3 Val3);
    public delegate R Delg_Proc<P1, P2, P3, P4, R>(P1 Val1, P2 Val2, P3 Val3, P4 Val4);
    public delegate R Delg_Proc<P1, P2, P3, P4, P5, R>(P1 Val1, P2 Val2, P3 Val3, P4 Val4, P5 Val5);
}

    public class GenericDelegateDemo
    {
        GenericDelegate.Delg_Mthd DlgProc0;
        GenericDelegate.Delg_Mthd<string[]> DlgProc1;
        GenericDelegate.Delg_Mthd<string> DlgProc2;
        GenericDelegate.Delg_Proc<string,string,string> DlgProc3;

        public GenericDelegateDemo()
        {
            DlgProc0 = DisplayNothing;
            DlgProc1 = DisplayParams;
            DlgProc2 = Display;
            DlgProc3 = GetFullName;
        }

        public void InvokeDelegates()
        {
            DlgProc0();
            DlgProc1(new []{"Alpha","Beta"});
            DlgProc2("Hello");
            Console.WriteLine(DlgProc3("George","Allen"));
        }

        private void Display(string Message)
        {
            Console.WriteLine(Message);
        }

        private void DisplayParams(params string[] Message)
        {
            foreach (var s in Message)
            {
                Console.Write(s + ", ");
            }
            Console.WriteLine("");
        }

        private void DisplayNothing()
        {
            Console.WriteLine("Nothing");
        }

        private string GetFullName(string FirstName,string SecondName)
        {
            return FirstName + " " + SecondName;
        }
    }
}

You can see the code now looks much leaner, while declaring and instating delegates, which made me quite satisfied with the solution.


Microsoft Solution for Generic Delegates
While browsing through the MSDN documentation, I happened to see a similar kind of solution for the very issue we had just discussed. The solution comes with two different types of inbuilt delegates namely Action and Func. The Func being for creating delegates with return types, while the Action for delegates with void return type and with a single parameter.

Lets see how to put to use the Func and Action keywords for implementing Generic Delegates.


public class MSFTGenericDelegates
{
    Action DlgProc0;
    Action<string[]> DlgProc1;
    Action<string> DlgProc2;
    Func<string,string,string> DlgProc3;
    Func<string, bool> DlgProc4;

    public MSFTGenericDelegates()
    {
        DlgProc0 = DisplayNothing;
        DlgProc1 = DisplayParams;
        DlgProc2 = Display;
        DlgProc3 = GetFullName;
        DlgProc4 = IsValidInt;
    }

    public void InvokeDelegates()
    {
        DlgProc0();
        DlgProc1(new []{"Alpha","Beta"});
        DlgProc2("Hello");
        Console.WriteLine(DlgProc3("George","Allen"));
        Console.WriteLine(DlgProc4("1"));
    }

    private void Display(string Message)
    {
        Console.WriteLine(Message);
    }

    private void DisplayParams(params string[] Message)
    {
        foreach (var s in Message)
        {
            Console.Write(s + ", ");
        }
        Console.WriteLine("");
    }

    private void DisplayNothing()
    {
        Console.WriteLine("Nothing");
    }

    private string GetFullName(string FirstName, string SecondName)
    {
        return FirstName + " " + SecondName;
    }

    private bool IsValidInt(string IntVal)
    {
        int Result;
        return int.TryParse(IntVal, out Result);
    }
}

In the above code snippet, the Action delegate is used to declare delegates with for containing methods with parameters of void return types while the Func delegate for holding methods with return types as well as parameters. 


The Action and Func delegates behind the scenes implements generic delegates with multiple parameters, here you can see a screenshot of disassembled code from the Red-Gate .NET Reflector.






I wish, if I knew this inbuilt delegates beforehand, I could have saved some time on more productive tasks. Anyway I am glad to find my generic delegate solution similar to what Microsoft had provided.

Tuesday, May 11, 2010

Online Storage Space

I always wished to have an online storage space which is free of Ads and obviously big enough to hold some Gigabytes and that too certainly free of cost. 

After some search I narrowed down to the best available option, which was Microsoft's SkyDrive online storage service. The Skydrive service allows up to 25 Gigabytes of online storage space for sharing files, images, music, videos and more. To Sign Up for the service you just need to have an Hotmail account and thats it. 

If you aren't impressed with Skydrive, there is handful of commercial services providing more features for a nominal fee, here you can get a comparison of different online storage solutions.

Tips on Remote Desktop

In the day to day life of a IT Professional, Remote Desktops has come up as an single window solution for managing multiple machines at the convince of without leaving your desk. I was pretty impressed with the features it had to offer. During the initial stages, I came to confront some trivial issues like how to Move files, Copy text, Restarting\Shutdowning Remote Desktops etc.

After some research, I got the solution to all those aforesaid issues, so lets move on to the solution part.

Moving Files
If you happen to be in a situation where, you need to copy files to or from a remote desktop. Enable resource sharing, and here's how its done.

1. Open Remote Desktop(enter mstsc in run window)
2. Click on "Options" Button.
3. Next, Click on "Local Resources" Tab.
4. Under "Local Resources" grouping, Check "Disk Drives".



5. Now after establishing a remote desktop session, you could see your local drives listed in the Remote machine under "My Computer", thats it.


Copying Text from Remote Desktop
1. If copying text from Remote desktop session to you local PC doesn't work, then possibly "rdpclip.exe" isn't running in Remote Desktop machine.

2. Well start the "rdpclip.exe" at the Remote Desktop. For this keyin rdpclip into the "Start->Run" window. After you enter this command, you wont see anything coming up on the desktop; thats perfectly fine. To ensure the rdpclip is running, open "Task Manager", and see the whether "rdpclip.exe" is listed under processes tab.

Restarting\Shutdown RemotePC
I was surprised to see the "Shutdown\Restart" option in start menu was missing when working on Remote machine. I believe this feature makes sense, as usually there won't be any one to turn on a remote PC, which may be either in a secured room or in a remote geographical office far away in a different time zone. But at times this could turn up into a nightmare for Developers, QA's and Release teams as well. Enough talking, lets come to the solution part.

To Restart the Remote Desktop, enter the following command in "Start->Run" window.
shutdown -r -f -t 0




Please note before trying out the shutdown command, make sure you have access to the machine physically or some one is available at the other end on call, to switch on. 


To Shutdown the Remote Desktop, enter the following command in "Start->Run" window. 
shutdown -s -f -t 0

The user with you had logged in should have privileges to execute the "shutdown" command.