Archive for the ‘Computer Science’ Category

Microsoft Bing: Much better than expected | Webware – CNET

Google Unlocks it’s Server Design

April 2, 2009 2 comments

Google revealed one of their server design. Google posses one of the most efficient, reliable and secure data centers and has revealed it’s server design to help increasing problems of huge Data Centers. For details please read the detailed article at here.

Top 10 Traits of a Rockstar Software Engineer

March 25, 2009 Leave a comment

I came across this excellent post on ReadWriteWeb about 10 traits of a Rockstar Software Engineer and I could not agree more. In 10 traits every thing about a software engineer is sufficed. It is a true analysis of what a software engineer must equip of. The traits are,

  1. Loves To Code
  2. Gets Things Done
  3. Continuously Refactors Code
  4. Uses Design Patterns
  5. Writes Tests
  6. Leverages Existing Code
  7. Focuses on Usability
  8. Writes Maintainable Code
  9. Can Code in Any Language
  10. Knows Basic Computer Science

Read them, analyze them and if you are a software engineer find how many you have from these. For more details read the complete post with description of each trait at here.

Demo – The Sixth Sense

March 11, 2009 Leave a comment

TED continues to prove to be the best meeting place for innovators and geniuses. Here is another brilliant video on Sixth Sense. Well though naming it sixth sense sounds a bit odd but video is superb!

Wonderful posts at TED

February 17, 2009 Leave a comment

Today I am going to write about three wonderful talks on TED (Technology, Entertainment, Design).

Number 1: Bill Gates unplugged at here on solving biggest problems of world and these are not technical btw :).

Number 2: Barry Schwartz’ passionate plea for practical wisdom, a standing ovation talk best in 2009.

Number 3: Technological wonderous :) in nature. Digital blocks with computational ability. MIT grad student David Merrill demos Siftables — cookie-sized, computerized tiles at here.

The last one is specially awesome to watch.

Find the complexity of code.

October 29, 2008 13 comments

I came across measuring complexity of a piece of code, which is really tricky one. Following is the code,

void function( int n)
while(n > 1)
n = sqrt (n); // assume sqrt returns square root of any number and ignore the complexity of square root

If any one wants to try this do try :) and post your answers.

Launching Executables (showing GUI) from Web Services deployed in IIS

October 16, 2008 6 comments

Recently one of my senior colleague was faced with a problem of launching executables from Web Services hosted in IIS. Following is the problem he was faced with (as is email),

“I am working on a dotNet web service that needs to launch an executable (.exe). I have used System.Diagnostics.Process to launch the process. When I run through VS2005 test environment, web service triggers the executable and its UI is displayed (e.g., launching notepad). But when I deploy the web service under IIS, the web service does launch the process but UI does not appear.

Can someone shed some light on what is happening and suggest a solution to this”

After searching on the internet I found the following solution and it worked fine.

According to Microsoft following are the reasons for this

1.    By default, ASP.NET runs its worker process (Aspnet_wp.exe) with a weak account (the local machine account, which is named ASPNET) which don’t have permission to interact with desktop.
2.    By default, IIS Admin Service won’t allow its application to interact with desktop.

These can be resolved by:

1.    Allowing worker process(ASP.NET) to run in SYSTEM account.
This can be done by editing the machine.config file which is located at (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG. Open the machine.config and find the ProcessModel tag and add the following attributes to it,

userName=”SYSTEM” password=”AutoGenerate”

2.    Enable IIS Admin Service to interact with desktop. To configure this, follow this steps.

a)    Open Control Panel and follow these steps:
For Windows NT: click Services.

For Windows 2000, Windows XP, and .NET Server: click Administrative Tools, and then click Services.
b)    Double-click IIS Admin Service.

c)     On the Log On tab, select the Allow Service to Interact with Desktop check box.

d)    Stop and restart the IIS Admin Service.

3.    Sometimes ASP.NET account does not have enough privileges to access certain WMI namespaces. So to resolve this do the following

a)    Open the Computer Management Microsoft Management Console (MMC) snap-in.
b)    Expand Services and Applications, and then select WMI Control.
c)    Right-click WMI Control, and then click Properties.
d)    In the WMI Control Properties dialog box, click the Security tab.
e)    Expand Root, select CIMV2, and then click Security.
f)    In the Security dialog box, click Advanced.
g)    In the Access Control Settings dialog box, click Add. Select localMachineName\ASPNET, and then click OK.
h)    In the Permission Entry dialog box, make sure that Apply Onto is set to This namespace and subnamespaces.
i)    Make sure that the Allow ‘Enable Account’ and Allow ‘Remote Enable’ check boxes are selected.
j)    Click OK in each dialog box until you return to the WMI Control Properties dialog box.
k)    Repeat steps 5 through 10 for other WMI namespaces that your application will access.
l)    Restart IIS. To do this, run IISRESET from the command line.

Information obtained from:;en-us;317012


Folder Options Diasbled, Task Manager Disabled, Registery Editor Disabled

October 16, 2008 2 comments

This post will be about enabling the folder options, taskmanger and registry editor after they are disabled/not visible. These kind of things are usually consequence of viruses specially “Brontok” trojan which can be deleted by anti-virus. I am writing the solutions, but chances are if these things are caused by virus
really then after restart, these options(folder options, task manager) will again be disabled so use a good anti virus like NOD32 (preferable) or AVG and remove the virus. And then enable
the options as I am telling.

For restoring the folder options do the following.

1. Write regedit at run and open the registery editor.
2. Now locate the following key,

HKEY_CURRENT_ USER\Software\ Microsoft\ Windows\CurrentV ersion\Policies\ Explorer


HKEY_LOCAL_MACHINE\ Software\ Microsoft\ Windows\CurrentV ersion\Policies\ Explorer

And in right-side pane, check whether a DWORD value named NoFolderOptions exists or not? If it exists then either change its value to 0 or delete it.

I hope this resolves your problem of Folder Options in tools menus.
Btw we can access it from Control Panel also.

-If registery editor is also disabled or locked do the following.

1. Write gpedit.msc at run and open the groups policy editor.
2. In the left side tree view locate the User Configuration node and expand it. Now locate the Administrative Templates and expand it also. Now locate System. Now don’t expand it and clicking on it look for the
options in the right view. Locate the item “Prevent access to registry editing tools”. Edit it’s properties and change it to disabled.

If task manager is disabled do the following.

1. Write gpedit.msc at run and open the groups policy editor.
2. In the left side tree view locate the User Configuration node and
expand it. Now locate the Administrative Templates and expand it also.
Now locate System and find Ctrl+Alt+Del Options in it. Left click it once and look for the options in the right side list view. Double Click the option Remove Task Manager and change it’s current setting to Disabled. If it’s already disabled you still have to change the setting to any other value and than change it to Disabled just to refresh it. Be sure to refresh the windows and task manager will be enabled.

I hope this much helps. But I will seriously recommend to scan and clean the system completely with some anti-virus.

World’s Largest Semantic Web announced – Web 3.0 Insight

September 19, 2008 Leave a comment

Cognition Technologies a Semantic Web company (wow Aleem Khan just think a ‘Semantic Web’ company – for those of you who don’t know Semantic Web was our final year project) is announcing the largest Semantic Map of English language. In simple words, they will be “enabling” search engines to understand what we have typed in the search box and retrieve contextually correct results.

The company is also going to fulfill one of my ambitions (to build a Semantic Web – Web 3.0 based search engine). So this is going to be advent of Web 3.0 hopefully.

References: on Cognition Technologies

ZDnet on the Topic

CNET News on the same

To view Semantic Web already in action check out: Cognitive Wikipedia

Just Another Programming Puzzle (Finding one non repeating element in list of pairs)

March 12, 2008 15 comments

So here is a programming question once again,

Consider a list of unsorted positive numbers in which each number has a pair except one of the number, the problem is to find that number in minimum complexity with O(1) extra space. The complexity in this case should not be more than O(n).

For instance, in the list {5,7,4,9,5,7,4} the answer should be 9. I will post my solution in the comments some time later.

Try your coding skills !

January 14, 2008 12 comments

Here is a small C/C++ code snippet,

int n = 20;

for( int i = 0; i < n ; i—) // i minus minus(in case of typo)

printf(“Hello World!”) ;

First try to find the answer to this program. It will obviously be an infinite loop or memory over flow or …

The question is to make this snippet work and print the “Hello World!” 20 times correctly as if the statement i— would have been i++.

The restriction however is to change only one ASCII character in this code. This means you can change, replace, move, introduce only one character to this program and the program still remains a valid C/C++ code.

There are three possible ways I know to do this. May be there are more. If you find two then you are good, if three you are brilliant and if more than extraordinary ;)

Have happy time solving this.

Measuring Complexity of an Executable!

December 31, 2007 4 comments

For the time being, I have an interesting question to share rather ask :)

When ever we do the Asymptotic Analysis, we are given the source code or algorithm of a problem and we measure the run time complexity in terms of Big O, Big Omega etc…by doing the line to line analysis of the code.

Now the question is, lets say we are given an executable containing the code of a given problem (lets assume a sorting or searching algorithm), now how will we find the complexity of the executable i.e the asymptotic complexity? means is it taking linear, quadratic or exponential time etc…

Do try to think on this, it’s small but interesting question..

C Traps and Pitfalls !

December 12, 2006 1 comment

I still believe that C was/is my oldest and first love :). And when I read this paper C Traps and Pitfalls By: Andrew Koenig of AT&T Bell Laboratories, this love was even consolidated ;). Specially the function call (*(void(*)())0)(); really made me believe that, “C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows your whole leg”.

For the curious readers the hint is enough that this is the function call to a function whose address is stored at 0(zero) location, rest of the details can be read in the beautiful article that I mentioned earlier.

Difference between two strings – Levenshtein Algorithm

September 22, 2006 4 comments

So now after a long time, I am going to write about an algorithm which I recently read, and found it very useful.

This algorithm is about, how different two strings are, and how many minimum operations are required to convert smaller string in length to larger (if their lengths are different). If the two string are of equal length then the number of charcaters that differ in two strings is the difference of strings. For example, in ‘computer’ and ‘computes’ the difference is 1 and in ‘test’ and ‘goat’ the difference is 3. Such distance is called as Hamming distance or edit distance simply put.

However if the strings are different in length then we use Levenshtein Algorithm or edit distance. Which works as follows.

For the two strings s1(cat) and s2(cots) of lengths m(3) and n(4), make an array of n*m and fill the each cell in 0th row with it’s corresponding column number and each cell in 0th column with it’s corresponding row number so our array ‘D’ will look like,

0 1 2 3





After this we compute a value in ‘temp’ which is 0 if s1[i] = s1[j] and 1 otherwise. And then find the minimum of D[i-1][j] + 1, D[i][j-1] +1 and D[i-1][j-1] + cost and assign it to D[i][j], where ‘i’ and ‘j’ are indeces while we compute. When we fill this array the last value in D[n][m] will give you the minimum number of moves required to convert str1(smaller) into str2(larger).

Here D[i-1][j] + 1, tell us if it is selected that we have to insert value in str1, if we select D[i][j-1] + 1 then we have to delete from str2 and if D[i-1][j-1] + cost is selected then we have to substitue in str1.

This is an interesting algorithm to try and then code, and is useful to find closest matches for a string and then can be used in many applications.

Interop – Managed C++ and C#

August 11, 2006 5 comments

I mentioned about writing some basic stuff for Managed C++ so here I am writing it.

I had to send C# strings to Managed C++ dll(class library). In MC++ the managed reference is represented by ‘^’, in MC++ function’s prototype will be;

String^ foo(String ^ pInputString);

and call from C# will be normal like, Console.WriteLine(foo(str));

for sending array of strings;

void foo(array<String ^>^ pInputAStrings); // yeah looks weird

for sending a string as reference;

void foo(String ^ % pInputRString);

Similarly XmlDocument xdoc = new XmlDocument(); in C# is equivalent to

XmlDocument ^ xdoc = gcnew XmlDocument(); when we initiliaze with ‘gcnew’ the garbage collector will run even if we have enabled mixed types option in Managed C++ in .NET 2005.

The magical API that helped me through out is,

Marshal.Copy Method (IntPtr, Byte[], Int32, Int32) which have a total of 16 overloads and is in,

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)

So using this method I convert a Base 64 Encoded string in bytes to native char * as follows.

array<Byte> ^ byteConvertedFromBase64 = nullptr;

String ^ string64bit = String::Empty;

byteConvertedFromBase64 = Convert::FromBase64String( string64bit );

char * bData = 0;

bData = new char[length];

Marshal::Copy(byteConvertedFromBase64, 0, IntPtr(bData), length);

It is a magical API which always worked when ever I needed to convert types from native char * to strings and vice versa and with other types.

Besides that I had to suppress the security checks that are incurred when calling native dlls from managed code, to save performance losses using PInvoke or COM Interop. This is done by SuppressUnmanagedCodeSecurityAttribute Class and applying /CLRUNMANAGEDCODECHECK in the linker settings. You can view MSDN for specific details.

Finding or detecting a loop/cycle in Link List.

July 27, 2006 1 comment

One of famous questions asked in programming technical interviews is “Finding a loop in a linear linked list”. Apparently this problem is easy, but if one has interest in Algorithms and Complexity Theory this is a very interesting problem also related to number theory.

The most famous method to solve this problem is to use Floyd’s algorithm to find cycle in lists also known as “The Hare and the Tortoise Algorithm”, intersting :). If a list has a cycle in it, it can be detected using this algorithm. This algorithm can also be used to find cycles in “Pseudo-Random Sequences”. The algorithm to find the cycle in linked list is as follows.

Take two pointers pointing to head. Now advance one pointer to one node and other pointer to two nodes each time while iterating. This is the simple algorithm, and that’s it. If the first pointer enters the loop (cycle part of algorithm) it is guaranteed that the second pointer will be at some node in the loop at the same time when other pointer is pointing to same node. The result may come out by some iteration, but it’s assured. That’s because one pointer is iterating each node in loop and other is iterating alternating nodes, so at first or second iteration while in the loop it will catch the first pointer at same node. This is indeed a very good find. I tried this with moving the second pointer to three nodes at one time and it worked also though I had to iterate many times. By using this approach we can also find the number of nodes in the loop which is an interesting thing to try.

Managed C++ – C++/CLI

July 25, 2006 1 comment

I am working on an interesting image processing and recognition project here in my office and it is a very wonderful work experience. Out of many things I have learnt, the most valuable thing is experience with Managed C++ (C++ for CLI). I have to write some core functionality classes and wrapper dll’s on calling Viisage SDK’s APIs which are written in native C++. To include these header files along with source code I had no other choice than to choose Visual C++.NET. In start I faced a lot of problems in dealing with managed and unmanaged code, conversion of native types to MS.NET types and vice versa and other issues of native C++. With time, extensive effort and lot of search now I am at ease with doing any thing in Managed C++ that I can do in C#. I will be writing some most valuable APIs that were no less than a blessing for me used in conversion of native to managed, managed to unmanaged code and other issues of handling .NET things in C++ the C++ way.

P.S: Having power of native C++ and Microsoft.NET in same language is beautiful.

My Google Interviews.

July 6, 2006 1 comment

In March and April 2006 I had good fortune to talk with Google Inc.’s folks and gave them phone interviews. I will soon write the synopsis of interviews as I have been planning to do so from a long time. I actually talked with a recruiter, had one pre-phone interview screen and 2 phone screens from USA and India. So I will write my experience with Google soon. Stay tuned.

Categories: Computer Science, General

About MS.NET 3.0 !

The Microsoft .NET Framework 3.0 (formerly known as WinFX), is the new managed-code programming model for Windows. It is the standard set of APIs for Windows Programming and .NET 2.0. I found this very useful artcile on use of MS.NET 3.0. Hope all enjoy readng it too.


WinFS will not be shipped seperately.

June 29, 2006 1 comment

WinFS which was initially planned to be part of Windows Vista along with Avalon ( Windows Presentation Foundation) and Indigo ( Windows Communication Foundation) as the new file system, promising new innovation and taking file system architecture to extremes will now not be shipped seperately. It will be part of SQL and ADO.NET in Orcas may be. This is a very strange news from Microsoft. WinFS was the most anticipated part of Windows Vista and was considered to be a mile stone. Any ways for further details check out the WinFS official blog site.


Categories: Computer Science

Get every new post delivered to your Inbox.