Interview Questions Headline Animator

Wednesday, December 17, 2008

It's all there in the cloud...!!

So what's this new buzz word... everyone has been talking about it...

Essentially what we are doing is taking our applications and putting them in a cloud. Cloud meaning highly available servers which are provided by huge service providers such as Microsoft, Amazon, etc. Now since I strongly believe that it is business that drives technology, it is the business side that we need to understand first. why do we need it. I have my servers in house, I deploy my apps on my servers, I control and maintain them then why would I want it to be on servers that others control? It is like the analogy that my valuables are in my house, how can it be a better idea to go and put them somewhere else. Well the answer to that question is another question. Do you put all your money under your mattress in your house? Or is it a better idea to go and put them in the bank?

There are many benefits in building the applications from the cloud. Let's take cost for example. The cost of hosting an application on the cloud is just a fraction of what you will have to incur in deploying the application on one of your in-house servers. Along with it comes the maintenance cost. Employing people to maintain the Servers, business continuity planning, and so on and so forth. The list goes on. The Cloud providers on the other hand can provide you all the same services at a fraction of the cost. They work on much much larger scales. So it makes sense for them too.

Another interesting perspective is that, let's say you are an application vendor. You go and talk to a customer to sell your app. Let's say you convince the customer in buying the app. That means you have convinced one person. The person who takes the decisions. Let's say he consults a team before he takes the decision. Even in that case you have convinced that team. And most usually, the people who make the decisions are not the people who end up using your app. And there is no way for them, yet, to find out whether or not the app is good enough for them in their context. So then you go ahead and deploy the app and then start using it. Then the users, find out how much the application was worth in their context and they may or may not like it. Although this is the model we have been working on all these years, it doesn't look like a very effective model does it?

Let's change the scenario. Same application vendor, but this time, he has his application as a software as a service, deployed on the cloud. He just has to go and say, "Well you don't have to guess, I don't have to convince you. Why don't you use the application yourself for a few days and find out?" The users use the app, they like it fine; if they don't, well they don't have to buy it. And of course there is the "pay as you go" model in Software as a service. Just stop paying when you stop using the software.

And the best part is you don't have to go fight it out with your IT for deployment. It's all there in the cloud...!!

Saturday, December 13, 2008

Hot fix for the Entity Framework Bug

I had recently posted about a bug on SQL CE Entity Framework. Please note that the links mentioned in there for the bug and the hot fix are internal to Microsoft. The hot fix shall be released as a KB article in a couple of weeks.

Wednesday, November 26, 2008

SQL Server Compact Edition / Entity Framework bug

I am working on this really smart, smart client application installer. Which smartly installs other pieces of another smart client application as and when required.

It makes sure that only those bits are downloaded that are not already installed. So it takes care of upgrades on its own. So basically we are writing our own "ClickOnce" functionality.
Why are we not using ClickOnce out of the box? Well that would require another post, but let's say we require much more granularity than what "ClickOnce" provides us, on this "Installation Manager", and put it at that.

Anyways, I am doing some book keeping using SQL Server CE on the client machine to maintain account of upgrades and installations. For this I am querying the SQL Server CE database and in the process and I encounter an error that says:

"The ntext and image data types cannot be used in WHERE, HAVING, GROUP BY, ON, or IN clauses, except when these data types are used with the LIKE or IS NULL predicates."

I am not even working on ntext data type. The select query goes something like this:

IQueryable files = entities.FileInfo.Where(fileInfo => fileInfo.FileName.Equals(fileName));

And "FileName" is not an ntext datatype in the entity "fileInfo". It is an nvarchar.
Interestingly, if you fire the same query on the Management Studio (SQL Version of the query of course), it works fine. It only breaks when you use LINQ to SQL or EF.

After a little research I find out that there is a bug in SQL Server 3.5 RTM which was incidentally not resolved even in the "SQL Server Compact 3.5 SP1 English". And later there was an out of the bag release that was made to resolve this issue. So the Hotfix, cannot be installed directly. You need to uninstall "Microsoft SQL Server Compact 3.5 SP1 English" from Add Remove Programs before you install this hotfix.

Once the Hotfix is installed, your query will just work...!

In case if you are wondering whether you need to re-install "Microsoft SQL Server Compact 3.5 SP1 English"? Well, installing it back will remove the hotfix. So DO NOT DO THAT.

Sunday, November 23, 2008

Best RSS Feed Reader

My wife is a writer, and a pretty good one for that matter. Recently she went for a job interview, where she was asked a lot of questions about current affairs, and she doesn't exactly read the news regularly. So I told her she should. But she doesn't like reading the news paper, and I told her about online news. About RSS Feeds and Feed Readers.

So which feed reader do you use. Of course every developer uses one. So what else does a developer use? Internet Explorer and Microsoft Outlook. Post Internet Explorer 7, you can subscribe to RSS Feeds using IE. you can read the posts online on IE. But the beautiful thing is every time you subscribe to a feed on IE, it nicely goes and adds itself on the RSS Feeds folder in Microsoft Outlook. This gives you the offline reading facility of course it also depends on what you are subscribing to. Some of the stuff is just not available offline. Like MSDN Magazine, which just has a one liner and a link to the actual article.

Speaking of which, MSDN Magazine is available online since January 2008. The MSDN Magazine is a fantastic read and is on top of my reading list every month. Some of the articles are just too good. Like for instance, this month my favorites are: The editor's note (which is always a pleasure to read), Thread Management in the CLR, Design for testability, Static Analysis tools for .Net.

Other favorites on my feed reader are:

  1. Ann-Dee's Tic-Tacs (My wife's weblog)
  2. Stack Overflow
  3. Threads watched by Channel 9 Team
  4. Business Week Online - Tech Beat

Wednesday, November 19, 2008

Downloading and installing AdventureWorks Database

I am assuming that you want to write a prototype of some sort for which you want a sample database to work with. And I am assuming that you don't have AdventureWorks on your machine. Putting down quick set of steps:

  1. Go to http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004
  2. Click on AdventureWorksDB.mdi, in case you are looking for the AdventureWorks Database for SQL Server 2005. there are also other sample databases available. This post is specifically for the AdventureWorks database for SQL Server 2005
  3. Accept the Agreement
  4. Download and run the installable.
  5. Open Visual Studio Command Prompt.
  6. Type in SQLCMD and press enter
  7. Type in the command
    "exec sp_attach_db @dbname=N'AdventureWorks', @filename1=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf', @filename2=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_log.ldf'"



  8. Please note that the Drive could be either C:\ or D:\ depending upon where you have installed the AdventureWorks Database MSI.



 



This will attach the AdventureWorks database. Fire up SQL Server Management Studio and confirm whether Adventure Works exists or not.

Saturday, November 15, 2008

The Sleeping Giant...

I am going to talk about the experience that I went through recently, when I met with a quite dangerous accident. It could have been quite fatal, fortunately, it wasn't. This post is going to be starting from around 2 seconds before I met with the accident to about 5 minutes after the accident. photo

on the 14th of November 2008, around 11.45 AM, I was going to work on my motorcycle. You see there are these lorries that haul huge stones from the stone quarries to wherever they take them, and the lorry drivers are very careless. They never abide the traffic rules. One such lorry driver was driving on the opposite direction and he suddenly decided that he needs to take a 'U' turn, and he did, just 10 or so meters ahead of me. I was driving around 80 Kilometers an hour and didn't have enough reaction time. I applied both the brakes simultaneously, bringing the bike down to around 60 kilometers an hour, and had a head on collision with the lorry. The bikes front went under the lorry I collided with the lorry head on. This is what happened.

The things that went through my mind during those 2 seconds before the collision and 5 minutes after, were quite profound. Now that I reflect upon it, it tells me about the stupendous processing power of the brain, when it is under stress. If only we could channel this power in a productive way. There were important things, and then the silliest things too. I cannot remember the exact sequence of things that my brain ran through, but I will try to list them down, at least as many as I remember (of course I don't remember everything).

So first when I see the lorry coming in, I think.

photo1"What's this guy doing? Is he crazy?"

"Should I just brake or should I turn left? Oh but there is this car and a bike on my left, I can't turn."

"Good I have disk brakes in the front. I won't fall and go under"

"Thank God I am wearing a helmet. I think it should be able to reduce the impact"

"Should I consider turning right?"

"I can't see what's coming from the opposite side."

"Dang... the driver is getting off to run already...!!!"

So that's when I realize that nothing can be done and that the collision is going to happen at a very high speed. That's when I give up and think,

"This month the finances were already down... How am I going to repair the bike..."

"My bike is not registered in Hyderabad. If I launch a complaint with the police, they will confiscate the bike and I would have to pay the road tax to get my bike back."

"I hope my laptop doesn't break, I will have to wait 2 or 3 weeks to get a new one. And I have my external hard drive in the bag. All the data is in it."

"I don't want to be perennially injured. Dang... that would be bad."

"I just got married I have to save myself."

"I had to finish the Click Once API Prototype today. Gone...!!!"

"Shit...! I wish I hadn't sold my car...!"

Now the collision happens...!!! And this is the most interesting part... the bike collides, I fall off and after that the bike goes under. Since the driver has already jumped off the lorry before the collision and run, the lorry slowly climbs over my bike and crushes it. The pictures are after the lorry climbs over the bike. Now the collision was at, at least 60 kilometers an hour so it is hard. I have hit the lorry with my head and chest. You can't imagine the power of the impact. After I fall off, the first thing I do, instinctively is get up. On standing up, I realize that I can't breathe. I feel my lungs are pushed deep into my chest and it pains when I laboriously try to pull in dear oxygen. It takes me around 7 to 10 breaths to pull in oxygen and get my breathing back to normal. During this time my head is going bonkers.

"My wife is going to really scream at me. I better not tell her before I reach home."

"Nothing is going to happen to me. I belong to the demonic tribes of Banasur, Narakasur and Babrubahan. And they were wicked difficult to kill."

"Heck I have been pushing weights in the gym for over 15 years now. This impact isn't going to do me nothing."

"I have to start breathing and then turn around and look at my bike. I have to analyze the damage and the expense this is going to cause me."

"Dang... I tore my jeans... Will have to buy a new one..."

"Oh but the oxygen first... breathe... breathe..."photo2

About 10 seconds later I breathe normally, turn around and look at my bike... I am standing on my legs, firm and strong. I can feel pain in my chest, my shoulder and my right upper thigh, very very close to my genitals. Heck I  just got married, I have to think about everything. I press my chest and see if I feel any sting, to find out if there are any bones broken. Nothing broken. I turn my neck around and check for my spine. No pain there. I take a little jab at my groin. The skin burns, but no internal pain... thankfully. All this time my 10 kg heavy laptop bag is on my back. I offload it carefully. People have started gathering all around me. I cannot see my bike any more because of the crowd. Someone gets me water and 3 people are asking me to sit down on a rock nearby. One local fellow with black clothes on comes to me and gives me an IPhone. He says some "Reddy" wants to talk to me. I take the phone and find out it is Koti. He asks me how I am. dang...! it wasn't more than a minute or perhaps a minute and a half after the collision. How did he find out? I see Pavan from the mailroom. He takes control of the situation. He calls the Ambulance, the police, and picks up my laptop bag. While all this is happening, I am thinking.

"How do I take out my bike before the police arrives?"

"I don't want the police to confiscate my bike."

"I don't think I have the strength to pull my bike out from under the lorry."

"I have to go home to my wife before she comes to know about this whole thing from someone else."

"But I can't leave the bike here. I have to get out of here with the bike."

"Nothing has happened to my hands. I think I will be able to code from home."

"Thank God Ma isn't here. She would have gotten awfully worried looking at me limp."

"Where's my phone? I hope my phone isn't broken."

That's when a guy comes to me and gives me my phone. And I am relieved to see that it isn't broken. Pavan tells me that he will take care of the bike. I get on to the ambulance and they suggest I go to Apollo Hospital and do at the checks.

At Apollo, all the checks are done later and I find out that no bones are broken, and that my diaphragm and liver, which were just under the point of impact are fine. The doctor tells me that I am a strong man and my gym workouts saved me. My friends Vikas and Rajesh come over to the hospital and take me home later in the evening.

Thursday, September 18, 2008

Marriage and the movie maker

I am getting married. That's right. Well I don't know about the other parts of the world, but 32 is a little late to get married for people resident in India. All my friends are married and have children of age ranging from 4 months to 8 years. Most of them started thinking that I am not ever going to get married. But well it is happening. But this blog post is not about that.

A couple of months back, my girl friend (the girl with whom I am getting married silly...!!) received a marriage invite from her friend which was quite innovative. They had made a nice write up with the Shrek Movie poster in the back ground. Sweet nothings about their relationship, about their attitude and chemistry. Being a girl, she was moved and said she wanted something equally innovative for our marriage.  I told her if a picture is worth a thousand words, we make a movie. And we did.

Now to stick the clips together, and to do the editing, I really didn't know what to do. So a friend of mine suggested that I download the ULead Video Studio, which I did, and installed it and used it to create the movie. Dainty little tool it is. The only thing that was left in the movie was the sub titles. Yes I made a movie and the subtitles would describe how the movie relates to our lives. That's when the trial period for Video Studio got over. Now I was in a fix. I didn't want to upload the movie with no subtitles. Talking about it around the cafeteria, Dhananjay, reminded me of the Microsoft Windows Movie Maker.

That's what this blog is all about. I did upload the movie without the subtitles, but as we speak, or rather as I write this, the Movie Maker is publishing the movie with the subtitles. I am going to upload the movie once I reach my workplace. The whole point is Movie Maker is a nice tool, that comes free with Windows since Windows ME. When it was released initially, it faced some poor reviews. But it has come out pretty well it seems.

As Wikipedia quotes it, "Windows Movie Maker in Windows Vista includes new effects and transitions, and support for the DVR-MS file format which Windows Media Center records television in. The HD version in Premium and Ultimate editions of Windows Vista adds support for capturing from HDV camcorders. The capture wizard will create DVR-MS type files from HDV tapes."

Just giving Windows Movie Maker the credit it deserves...

Hosting a WCF Service on IIS

Look for this topic on the Internet. The first thing that you will see is the implementation of the service. I really wouldn't fathom why that is usually done. If I am looking for the subject Hosting a service on IIS, I would assume that the service has already been written and ready, and it is the hosting that I really need the help with. But still I will also follow the standard and go and and tell you the details of how to create a WCF Service.

  1. File -> New -> Website
  2. WCF Service

This will create Service1.svc and IService1.cs. The IService1.cs is the Service Contract, that you need to implement on your Service. Prepare the contract, prepare the Service and then build. Once it builds, you are done with the service.

Now when you are writing an application which requires a WCF Service, you don't really start off with a WCF Service. Just like you don't start writing a Windows Service, with a Windows Service, you don't start a WCF Service application with a WCF Service application. Confused...? What I am trying to say is, in case of a windows service, what I usually do is write the entire application in a Windows Application. Once I am done writing the application, I move the code to a Windows Service, simply because it is much easier to debug a windows application than a windows service. Similarly, I would write a normal multi-layered application, and then once I am done (at least up to a logical completion), I would Create a WCF Service and move the Service Layer (which was not a service layer until now) into the new Service. Of course with it goes all the other layers, which were supposed to be on the database side. Like the Data Access Layer or perhaps the Entities Layer, if you happen to use one.

So coming back to the point how do you really host your service? This article is not really about hosting the service. I would like to write more about the glitches and the obstacles that you have to face when you are hosting the service. In theory, the process of hosting the service is quite simple:

  1. Publish the Service
  2. Open Internet Information Services (IIS) Manager
  3. Create a new application and provide the physical path to the directory into which you published the service

That's it.

Now the glitches:

Server Error in Application “Default Web Site/CallService”

HTTP Error 404.3 - Not Found:

Incase of this error the possible reasons are:

  1. The current version of WCF has not been registered
  2. IIS Scriptmaps are not updated at the IIS Metabase Roots
  3. Existing Scriptmaps are of a lower version

To resolve this issue, you need to take the following steps:

1. Run a command prompt window as administrator. Start, cmd as normal then press CTRL+SHIFT+ENTER
2. Navigate to c:\windows\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\
3. Run the command ‘ServiceModelReg -i’ - You should receive the results below.
4. Exit

Another error that you most commonly see is this:

"There is no compatible TransportManager found for URI 'http://<your URI>.svc This may be because that you have used an absolute address which points outside of the virtual application. Please use a relative address instead."

The error message might misguide you. There is a possibility that you might have specified an absolute address in the configuration file. But if you go there and check and find that the address is not absolute, then perhaps the error isn't there. For this what you should do is, check if all your IIS Components are installed or not. In my case I discovered that I didn't have 2 things installed. "IIS Metabase and IIS 6 Configuration Compatibility" under Web Management Tools -> IIS 6 Management Compatibility and "Windows Authentication" under World Wide Web Services -> Security.

Last but not the least. If you see any other issues, which you are not able to figure out just by reading the error message on the IE, where you are trying to browse to the service, publish the website once again, using an http:// URI from your Visual Studio project. If the publish fails, even though you might not see any errors on the error window, go to the output window and check. You will see the source of the problem, which is much more clear and easy to understand. This idea was given to my by my good friend Koti who sits next to me.

Friday, August 29, 2008

How much are you worth after all...?

Well It has been a really long time since I blogged about anything. Lots of things happened in the last couple of days...? or should I say Months...? So let me start by telling you about a sweet little discussion that I had with my girlfriend the other day. Well she is quite a proponent of the company that we all know so well... the company that does searches really well, gives away all its services for free, encourages all its users to waste a whole lot of time on the Internet and the company that uses the oldest Internet business model in the books... Ad Business...

Ok don't get me wrong. I really have nothing against Google. Its a nice company. All its products are quite thought over, dandy, simple and very very effective. I have been using Google for all my search requirements for quite some time, until last weekend. I was having a discussion regarding the latest releases of Live search and a friend, whom we closely call "Jeels" or "Jeelani" told me that Google is more like a habit. If you really want to appreciate Live Search, you have to kick the habit. So he asked me to go to \\Jeels\NoGoog\install.cmd or some such location and asked me to install a small utility that he had written, that would redirect all IE searches from http://www.google.com to http://www.live.com. Even the Google toolbar ones, if you have one installed. The first few days were pain. Google is quite a habit I realized.

But then I started noticing that about 80% of the times, I found what I wanted on Live Search. You see I also have Firefox installed and this dandy utility isn't written for Firefox. So I go to Google as the last resort, using Firefox. about 75% of the times, if I didn't find it on Live Search I didn't find it on Google either. I did the math and on a rough order of magnitude Google was only 5% more effective for me than live is. Of course this data is based on my search topic preferences and on a very un-systematic algorithm. But my conclusion, Live may very soon be as good a search engine as Google if it isn't already, and Google may only be the best search engine in the minds of its users.

So why is it that Google gives away all its services for free? In my humble opinion, Google products do not have much business value. The calculation of business value can be based on the amount of money that a user is willing to pay for a service. So let me ask you. How much are you willing to pay for Google Search, Google mail, Google Talk, Orkut or Picasaweb for that matter? Fine Google does huge business but if you look at it from an Engineering perspective, is it such a big deal to manage a few simple, low featured, no frills, web sites? Writing a small low featured chat application and integrating them together?

Google products do not have a return of investment on them and hence free. Besides I prefer a company that makes products that solve some business problem or assist in some chore. Do not mean to make a direct comparison, but there are companies that make pornographic material and spam and make money out of that. Products that waste time and that wouldn't be considered respectable by any user, even if he uses it himself, privately.

Writing applications with the excellence and usability that it sells is quite a job. As an engineer, I also take it to the personal level. No matter how good a job an engineer does, if he doesn't get a good hike, a level rise and a bonus in his annual appraisal, he really hasn't done a good job. How much money do you require, you would ask? well its not the money, I must remind you. I am quite happy financially you know. It is the appreciation. Giving appreciation in emails is quite easy. It is only when you are appreciated monetarily, that you really know your work's worth.

The meaning is two phase. Good appraisal tells you 2 things.

  1. You have performed well
  2. Your performance was truly appreciated by your managers

Which also means that a bad appraisal tells you 2 things.

  1. You could have performed better.
  2. No matter what your managers tell you to pacify you, no matter how many sweet emails they send you, they are not happy with your performance. You may give a 100 excuses to yourself or to your managers, doesn't mean a thing. It didn't work out this year, work for it next year. Period.

Yeah, sounds harsh, But if you fall in that category, if you are not happy with your hike, this really is bad news.

Friday, July 11, 2008

Is Code Folding that bad...?

I am a huge fan of Jeff Atwood and Coding Horror. I usually like his stuff. But I somehow didn't agree too much to his post where he talks about Code Folding (#region). I mean of course I also agree with a few things that he says, so let me put them down here:

 

Things that I do not agree with:

  • "Folding directives are Glorified Comments": We don't fold code to accommodate the editor, we do it to accommodate ourselves. Code folding is more like indexing. I index my code so I know exactly where to go when I am reading it. It is like creating folders for files. I go to a specific file and know I want to check an event handler for example. so I open the Event Handlers Region and reach the exact event handler I require. Besides, I agree that traditional comments are better and more descriptive, but they have a different purpose than #region.
  • "Folding is used to sweep code under the rug": Perspective, perspective... I would call it, "neatly arranging it in a nice closet and closing the doors instead of keeping everything out on an open shelf".
  • "Folding is used to mask excessive length": Nuclear power could cause a nuclear holocaust or it could assist in the creation of an alternative source of power to keep cars running, Air conditioner fans turning and perhaps to achieve warp speed, who knows. Writing short and clean code is a matter of personal discipline just like checking in code into your repository before leaving for home. Even when there were no regions, people did write excessively long and convoluted source code. And #regions wouldn't hide code during inspection or code reviews. Everything would be reviewed when it is reviewed; folded or otherwise. In fact, it might make reviews more convenient. The reviewer unfolds everything and then systematically folds everything that has been reviewed.
  • "Folding can hide deficiencies in your editor": This "scutwork" really helps good programmers to read code. And as I have read somewhere, good programmers read more code than they write. Code folding enables that.

Things that I agree with:

  • "The editor should automatically offer to fold up these common structural blocks to you"
  • "#region is criminally overused"
  • "Code should be written that doesn't need folding to be readable, clear and concise"

 

So Jeff, I love your writing, no questions... And you have a right to your opinions and to what you publish... But be gentle at times man...!

Friday, July 04, 2008

Do it smart: Shortcut Keys

Most interesting short cut keys on Visual Studio 2008:

  • Ctrl + R + R: Rename whatever is selected (Refactoring).
  • Ctrl + K + M: This is to create a new method stub. just call the method as it already exists and then hit the shortcut.
  • Ctrl + ".": Opens the smart tag window and allows you to add Using statements. you can also use it to add a non-existent method into a class. Just call the method as it already exists, click Ctrl + "." and select "Generate Method stub..."

image

  • Alt + Ctrl + E: Most useful. This will open the Exceptions window and let you stop or allow a few exceptions while debugging.

image

  • Ctrl + K + F and Ctrl + K + D: Indents the code properly. so "F" will format the selected code and "D" will indent the entire document.
  • Ctrl + - and Shift + -: Works like the back and forward buttons on the web browser. So if you navigate into a new place using F12 or Shift + F12, you can go back to the original location using this.
  • Ctrl + Tab and then use Arrow Keys: Ctrl + Arrow Keys allow you to take a look at all the windows, tool windows, panels and let you navigate through them. So once you press Ctrl + Tab, it shows you the navigation window. Then you can use the arrow keys to navigate through all the panels windows, etc. You can go up, Down, Left, Right, and you can even see what's in focus.

image

  • F8 and Shift F8: These help you navigate through your search results. Hit it and get surprised.
  • Alt + F6: Moves to the next tool window.
  • Ctrl + F6: Cycles through the MDI child windows one window at a time.

Thursday, July 03, 2008

Funny Behavior of Google Talk

I was booting up my machine. I had just logged in and all the apps were firing up one by one. So I must have fired up something and might be typing into it, when Google Talk fired up in between. So everything that I had imagejust written went into the google talk sign in textbox.

Now, I usually save my user id and password on google talk so it automatically signs in. So, since i had typed in something by mistake into the User ID textbox, the user ID changed. So instead of my real id I had "my" typed into the user id input box. Ideally in a scenario like this, what should happen is it should try to log in and then once it fails, it should quit trying.

What Google talk did instead, is it kept on trying with the same user id and password over and over again, automatically. Now at this point in time, I don't even know something like this is happening in the back ground. So eventually when I come around to Google Talk, I see that the User ID is wrong and the status is "Account Locked". So I type in the correct UserID and I see a CAPTCHA to unlock my account. And interestingly the CAPTCHA doesn't give me an image, but it gives me a long message saying something like, "The service is unavailable at the moment, please try again later". So I wonder what would happen if I type in the entire message as a CAPTCHA input. So I did and interestingly, it solved the CAPTCHA.

Unfortunately all this happened so fast, I didn't take a screen print. Anyways, Now I tried it again. I signed out, typed in "my" into the user id input and tried to log in again. The status showed "Account Locked" which means they had locked out an account whose user id is "my" for trying to sign in with the wrong password more than the specified no. of times. Now I changed the user id to my real user id again and I see the CAPTCHA again, only this time it was a working real CAPTCHA with the image. Now I really wanted to check if this CAPTCHA is a real one or a fake one. Without putting in any input I just clicked Ok and it didn't give me an error message of any sort. It just logged me in.

So there are a no. of issues here:

  1. Log in shouldn't be tried multiple times automatically if the password is wrong. It should wait for User Input
  2. The user id that was locked was "my". After I change the User ID, it shouldn't give me a CAPTCHA because it not my user id that is locked that needs unlocking.
  3. The CAPTCHA should be potent. So the input I give should be properly validated which is not being done in this case. Now this is a special case. but if the CAPTCHA is given it should be validated or it shouldn't be given at all.
  4. In case there are errors and if the CAPTCHA Service is down, it should not show me the error message as a CAPTCHA.

 

So my question is how much would you really pay for a software like Google Talk? Yes I know, there is great power in simplicity. And even though Google talk doesn't provide features like great smileys and stuff, it lets you talk. For free, this is good enough. But how much would you really pay for it? Another question that pops in is would you use a software like this for business communication?

As mentioned in one of the posts, Google gives a lot of importance to the cool factor. Would you really pay for a cool software or a software that could be used for business application? Where's the ROI...? People talk a lot about Google being in competition with Microsoft. I don't really think it stands tall enough.

Wednesday, July 02, 2008

Planning to join Google...? Think again.

Sarang just posted on his blog about this post. And it really impressed me. So I thought it has to be mentioned about on my blog too. I specially like the part where he says that Google's idea of business is to amuse and attract people. And that most of Google's product promote wasted online time.

So this post is about a post that was posted on a Sarang's Blog Post :). Anyways, you should read it yourself.

Thursday, May 22, 2008

Copying the Address on Team Explorer

You go to Team Explorer bar and double click on "Source Control". This fires up the Source Control Explorer. Now you double click a few thousand times to reach the directory that you wanted to reach and you do something that you couldn't have perhaps done from outside the Source Control Explorer, like a file check out perhaps. Now you want to do something with that file which perhaps you can't do from inside the source control explorer like copy pasting some other files in and out of this directory, perhaps. So basically you require the location of the file that you just checked out. so you see this:

 

 image

you will see the thin red marking that marks the location of the file. you want to copy this. Surprisingly it doesn't allow you to select the path and copy paste it into your windows explorer. so how do you Get the path. I asked my good friend who sits next to my cubicle and he says, "Right click on the folder, go to properties, and you get the path there. And this, obviously, is selectable:

image                             image

Now I didn't ask him this question because I didn't know this. That was the first thing that I did. But then there is a splinter inside every programmer's head that doesn't let him rest when things like this happen. I am a Microsoft Technologies Programmer. For so many years I have used Microsoft tools, I know how "they" think. And there has to be a better way. I clicked around like crazy combining it with random Ctrl + C and right clicks. And every few clicks I went to the notepad and Ctrl + V 'ed. That's when I discovered. you double click on the bar that shows the local path and the path gets loaded into the clipboard.

Now there is a pattern that is quite familiar among all Microsoft software. If you find something difficult to work with, you are probably not doing it right. There has to be an easier way that is much more intuitive. A programmer will intuitively double click an area if he wants to select it for copying. Of course that is only if he cannot reach that area with his keyboard (oh we so loathe to take our hands of the keyboard!!!).

Thinking about usability to such excruciating details... I wonder how they do it...!!

Microsoft Rocks...!

Monday, April 28, 2008

If Microsoft Goes Hostile on Yahoo... Amazing Read...

http://blog.pmarca.com/2008/04/if-microsoft-go.html

Joins in LINQ... What do I return?

I want to write a select query that returns all the data in a table? this is how it would go:

IQueryable<Session> sessions = from session in dataContext.Sessions

where (session.EventID.Equals(eventID))

select session;

Now I want to write a select query that joins two tables. This is how it would go:

var x = from s in dataContext.Sessions

from e in dataContext.Events

select new

{

s.SessionName,

s.SessionDescription,

e.EventName

};

So this is the easy part. we just learnt how to write the query. Now consider this. I have a separate data access layer that does all the basic query generation and works as a data interface. I generate the first query here and then in my engine or the middle tier, I refine my query depending on what the UI layer requires. So in a situation like that I have a function in my Data Access Layer that does a table join... what would this function return. I can't return IQueryable<Session> or whatever is the Table Name because I am making a join and so it is no specific table. I am supposed to be returning an anonymous class. How do I return an Anonymous Class from a function. The whole idea of the anonymous class is that the class name is anonymous. So this is what I do.

public object GetSessionAndEventData()

{

if (string.IsNullOrEmpty(this.connectionString))

{

this.connectionString = ConfigurationManager.ConnectionStrings[MADConstants.CONNECTIONSTRING].ToString();

}

if (this.dataContext == null)

{

this.dataContext = new EntitiesDataContext(this.connectionString);

}

var x = from s in dataContext.Sessions

from e in dataContext.Events

select new

{

s.SessionName,

s.SessionDescription,

e.EventName

};

return x;

}

Yes. I just return an object. While I was thinking about this, I did some reading and discovered something quite interesting in the C# 3.0 specification. "Within the same program, two anonymous object initializers, that specify a same sequence of properties of the same names and types, in the same order, will produce the instance of the same anonymous type". The compiler uses the same generated class if there are two object initializers of the same type. This actually makes it possible to cast it back to the original type.

Then what I did was, I just returned an object type from my data access layer, passed it through the middle tier engine, and all the way to UI. here I just bound my datagrid with the object type and voila...! The Datagrid was actually able to bring out the properties and put them in tabular format without requiring any casting.

Don't you just love it when it just works...!

Update on future plans on my career... Just a reminder...

So what do you feel like when you first board the mother ship. Death...! yeah... for someone who has been growing and dreaming and aiming high all his life (only such a person usually boards the mother ship)... where do you go once you join Microsoft...

There are goals like achieving targets, promotions, accolades; growing the ladder... But is that it...? Does life have nothing that big left...? Big enough like the ambition of joining Microsoft...? This is what I went through the first 3 months of my career...

I had to come up with something... So I did... A lot of people had been telling me that I write good... Specially my girl... who happens to be a huge inspiration... So I decided I would write a book... after a lot of thought and pondering... I decided  I would write something on Engineering Excellence... A subject that never goes out of scope. Number of reasons why I decided that... Since this is my first book it would take a lot of time... to even start it... Anyways coming back... spent 5 more months in all this pondering... and I still haven't written a single word or done nothing towards writing... Hell I am too stuck with my stretch initiatives at work and my mundane responsibilities...

So I decided I would start the book in December. Till then I will prepare. Build a monster machine that I have been planning for some time, read, read, read and read...

And then it happened. Ray Ozzie came to Hyderabad Campus... Short talk he gave and I got my next big thing. Joining the Microsoft India Development Center (IDC), which happens to be the products division in India. I will start preparing today itself and it is a one year target... I should be in IDC before 2009 December... I am giving myself enough time because I have to get married somewhere towards the end of 2008, and a honeymoon follows, and then the initial distractions of marriage and setting up a house and so on and so forth.

I also have to work on the monster machine, the book... although working on the book pretty much goes hand in hand with preparing myself for IDC... But still... I am sure IDC would require something more than just Engineering Excellence.

Wednesday, April 09, 2008

Command Copy exited with Code 1

If you get that error message, it is usually because you have configured your application to run some batch copy commands either just before the build of the app or after it. So go to Project Properties -> Build Events and check if there are any pre-build events or post-build events with any copy command. This usually happens when you get a version of legacy code that some other developer has written and are working on some fixes.

First check if there are any discrepancies with the copy command syntax or the directory path mentioned therein. If you can't resolve the error because of constraints such as not being able to change the directory structure, just get rid of the commands for the time-being and continue with your dev. You can later on figure out what the original intent of the previous developer was and go for the solution.

Tuesday, April 08, 2008

login failed for user (Microsoft SQL Server error: 18456)

So you had some problems with your installation of the SQL Server 2005 installation on your machine and now that you have un-installed and installed it, you can't seem to log on to your own machine using basic windows authentication. You can log into other servers but you just can't seem to log on to localhost. So you search the internet for the error message and after going through a whole lot of issues that are vaguely related, like changing authentication type from windows to sql and so on and so forth, you land on my blog.

The Solution: Install Visual Studio 2005 SP2

This was a bug in SQL Server 2005 that was fixed in SP2.