Archive

Archive for the ‘Computer Programming’ Category

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.

Find the complexity of code.

October 29, 2008 16 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:

http://support.microsoft.com/default.aspx?scid=kb;en-us;317012

http://support.microsoft.com/kb/555134

Regards,

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: ReadWriteWb.com 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.

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.

Follow

Get every new post delivered to your Inbox.