I create bugs for living!

Yup, that’s what I do for living, and I get paid quite decently for doing that… As the experts in the field of software development rightly say, the biggest reason for a bug to be present in a piece of code is the code itself. If there was no code in the first place, there would not have been that freakin bug. I remember while I was watching the California Wild fire coverage on the news channel back in 2008, there was a couple shown, who lost their home in the California wildfires put up a humorous sign that reads, "Finally! No Termites." No Home, no damn termites.

14445579_120X90

Well that’s common sense I know. Although I find it pretty fascinating that underneath my title of a software developer, I am actually developing ingenious ways to create bugs!

Happy Programming!

Abhang Rane


How important is your website design for your business…

I think this is a no-brainer for a successful for startup company. As the world is getting shrinking due to internet, gradually each of your family members would get the taste of it (if they haven’t got it yet). That means as people search for stuff they need, they would use Google (Bing for those who like to search for porn), click on the link and hopefully land on one of your site pages. This makes your website literally the starting point of your business whatever it may be. And what if your website is a real cheap job. Well.. for those who hardly care about these things might give it a shot, but frankly almost all like to see something aesthetically  good design. Something which is less complicated and highly usable.

Lately I was rummaging several websites here in India to buy a new house, precisely in Pune. I do realize that India is not at a stage where every new business that comes in the market makes sure to have their own website. But businessman are getting aware of this mistake and taking baby steps towards changing this. Look at these sites I visited,

http://www.pscl.in/

http://www.adityabuilders.com/

http://www.goelganga.com/

Cheap ain’t  it? For a web developer such a website creates quite a bit of negative impact, believe it or not. Now look at one of Puranik builders site http://www.spaininindia.com/. When you have something cool, flashhy to sell, why not make your website feel the same? 

P.S. – I hope I can instigate this feeling in the company I work!!! http://www.synechron.com/.

Happy Programming!

Abhang Rane


Man I love these books!

Every time I visit a bookstore, my mind starts jumping around like that of a tiny tot in a Toy store (or like Glenn Quagmire in an adult store, whichever sounds correct here). I just wish I had the whole amazon book store in my room for use anytime! Sigh! Cannot have that. Anyways, I have a whole lot of ebooks on my machine, but I own some of them. Few of the books in my ebook collection are not available in India. Below is a snapshot of my book collection as shown by the Delicious library.

Picture 1.png 21-52-17-836

Each of these books are worth every friggin buck you spend on them.

Happy Programming!

Abhang Rane


IE8 compatibility mode, UserAgent, wrong CSS.. you got my point huh!

I am running IE8 on my Windows XP machine. I am building a website for one my clients, the project is going really well. I am working on adding browser specific CSS to my site using the Request.Browser class in ASP.NET. Things are looking absolutely beautiful in Firefox, Safari, Chrome ….. you name it. Opened IE8.. wonderful as usual. Clicked compatibility mode in IE8, so running IE7 technically, looks good again. Closed the IE8 instance, opened IE8 just to make sure things were ok, YAIEEEEEEEEEEEEEEEEEEE KARAMBAAAAAAAAAAAAA!!! Someone unleashed hell on my webpage. What happened!

They way I added browser specific CSS is in my code, detect the browser name and version and add css reference in the Head tag of the page. Now there is a situation where IE8 is in compatibility mode, but the UserAgent still has browser version of 8.0 in it, due to which in my case, the IE8 css was added in an IE7 scenario. The problem with my approach was I was trying to do everything on the server side. It happens so that to detect if a user has turned on Compatibility mode, we have to have some kind of client side scripting done. The magic property is document.documentMode, this value is probably only available in IE8 browser. For IE8, the value is “8”, for compatibility mode it is “7”. So one way would be to disable to IE8 css which is already added and add the IE7 css when the browser is in compatibility mode, like so,

 $(document).ready(function() {
if(document.documentMode == "7")
{
var head = document.getElementById('pageHead');
var linktg = document.createElement('link');
linktg.type = 'text/css';
linktg.rel = 'stylesheet';
linktg.href = 'MyStyle-IE7.css';
linktg.media = 'all';
head.appendChild(linktg);
$("link[href='MyStyle-IE8.css']").attr('disabled','true');
}
}

I read an article somewhere about “Letting Internet Explorer 6 die down for the Web to move on” or something like that. I wonder why not kill this whole Internet Explorer thing once in for all?

Happy Programming!

Abhang Rane


Do you get paid right?

Salary is always a slightly weird if not uncomfortable topic to talk about during HR interviews at least for me. What should I say, would it be so much that I might be taken as a R-tard, or so less that I might be laughed at. Well believe it or not, very few folks know how much they should get paid depending on their experience, location, interview performance and other factors. When I was a fresher, it was pretty much a category in which all of us were put in when hired by a big firm. Everyone had the same amount on their paychecks. But as experience level rises, we get smarter and bolder (at least that is how it is supposed to be), we start thinking about our salary more seriously. I am yet to find a tool/website which would honestly provide a figure that would be very close to what I can ask for in an offer. Services like PayScale, Salary.com seem to be bullshitting us for quite long. Every time I checked my worth on these sites with my experience and other factors, I used to get a figure way less than my colleagues were getting. May be that could be a business tactics used by these services to entice us in getting their paid service to provide more information and get a better salary figure. 

Recently a famous job site in India Naukri.com launched a service called PayCheck. This service basically gives a graphical representation of where you stand among other people with similar profile as yours. A little bit of digging into this and you would realize that the data these guys are using is from the salaries reported by active profiles on Naukri.com. The problem here? Well, if we are talking about folks who have their current salary on Naukri, and are actively searching for new openings, there is a high probability that the salary they have posted is less than what they expect. Using such figures for calculating our expected salary seems a little dubious. Nevertheless, not all are searching for just a better pay, so there is some amount of good data which has helped in this analysis. I wish Naukri ties up with some kind of parallel service wherein they allow anonymous users to post their salaries alongside the companies and their satisfaction rates, something on the lines of Glassdoor, mouthshut etc. This way we really have a better dataset to calculate our expected salary.

Abhang Rane


An interview with Synechron

Its been about 3 weeks I had been in a “job search” mode here in Pune, India. I got a call from Synechron asking me about scheduling an interview with me for a .NET position. Well, the company looked good to me, honestly the only thing we have to hang on to is the website. A quick search in the cloud did return some results about the reviews for this company. They were not show stoppers really. So I decided, heck why not, lets do this! Basically it is going to be the same thing all over, some US based clients, an offshore development center in India, and rest of the story goes on and on…(I know I sound really bored of this profession :))).

So how was the interview, 2 technical rounds, 2 HR rounds and then the offer! (No free lunch, dammit).

1st interview

The manager certainly was heavily technical and knew what he was talking. I really felt good about that, since I have been interviewed by retards before. The questions pretty much summed up like these –:

- C# programming language features

- .NET underlying working.

- Garbage collection working

- Dispose method usage

- Lots of OOPS questions like abstract classes, interfaces, inheritance, composition etc.

- SQL queries, WITH NO LOCK usage, nested transactions.

Done.

2nd interview

This guy asked my about things that were discussed with the earlier guy so that things do not get mixed. Questions were pretty tricky in some cases so it was fun,

- use of usercontrols, CauseValidation usage in ASP.NET

- DataRelation object in ADO.NET

- Optimize an SQL query for better performance

- Dispose vs Finalize method

- Polymorphism and some other basic OOPS concepts.

- Casting vs Unboxing.

Done.

Then were 2 HR rounds which, for some, are mere formalities in India. I take these interviews very seriously, probably due to my stint in US. I think HR interviews are meant for a smartness check and overall personality of an individual, good companies certainly reject candidates if these interviews do not go as per their standards. Well.. I do think in India most of the HR interviews are just a formality :(. I do not know if you guys would be interested in knowing what we discussed in these interviews, but let me know if you need some hints on these as well.

Anyways, I got an offer from them,uummmm... a decent one, so lets see where things go from here. Best of luck to all you job hunters!

Happy Programming!

Abhang Rane


iPhone Developer jobs in India

Howdy guys! Its been less than 2 weeks I started looking for a new job as a developer here in India. My resume has the usual stuff what a .NET developer (sensible one!) might have. One extra thing was added by me regarding my personal projects, iPhone sdk. Since the last 2 weeks, guess what kind of requirements I saw the most, from several companies here. Yup, iPhone development. iPhone is being considered as The Mobile Platform of the future and every company, whether a gallactico or a minion, are hiring iPhone developers.

So, you job hunters, if you intend to switch for a iPhone developer position, there cannot be a better time than this. Post your resume with your iPhone projects and see requirements flooding your mailbox.

Happy Programming!

Abhang Rane


ASP.NET MVC – Validation of viewstate MAC failed error!

If you are just kick starting with ASP.NET MVC like me, you might have stumbled across this error :). This might have caused may be due to

  • more than one form tag
  • postback on a page containing a ViewUserControl

There are several other reasons for this error to pop up, but in ASP.NET MVC these 2 are the major ones. I was using RenderPartial to render one of my MVC usercontrols in one of my views on which when I did a postback I got this error.

I do not want to belabor too much on this topic since there are lots of discussions on this bug in ASP.NET, here are some,

http://stackoverflow.com/questions/230014/postback-not-working-with-asp-net-routing-validation-of-viewstate-mac-failed

http://stackoverflow.com/questions/121579/im-getting-a-strange-unhandled-exception-from-my-asp-net-application-validatio

In fact, this issue needs to be resolved within the ASP.NET MVC source code. Although, since we need not do that, I found a HttpModule which can be used to get rid of this error nicely.

Here is the link for the same, http://mvcfriendlymodule.codeplex.com/. This HttpModule certainly resolved my issue, for the time being!

I realized that adding this module did some funny stuff with the external files I had in my project, like CSS and JavaScript. Somehow these files were not added to my pages while the page was rendered.

So, the final solution, I used an extended class of ViewUserControl. Here is a link by Mauricio http://bugsquash.blogspot.com/2009/02/aspnet-mvc-postback-support.html which explains this in detail. Basically, in the ASP.NET MVC source code, the ViewUserControl is actually rendered within a fake view page, due to which our settings in web.config do not apply to usercontrols. Finally everything works now, phew!

Happy Programming!

Abhang Rane


"jQuery.support.opacity is null or not an object"

So you are one of those jQuery newbies who get baffled with such maddening errors :). Me too! One thing to remember while working with jQuery in Visual Studio, the vsdoc.js file is solely built for jQuery intellisense at design time for we intellisense-ridden folks. It should not be used at runtime because doing so might result in unexpected errors as the one mentioned in the title. So the solution for the above mentioned error.. remove the reference to the vsdoc.js file from your page and run it.

Also just for sanity check, if you happen to use ASP.NET MVC, by default, when you drag the jquery files onto the Master Page for example, they are added as below

<script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>


The ../../ prefix might create problems for the child pages. The child pages would not be able to refer to the script files referenced like this. Get rid of the ../.. so that it looks as below



<script src="/Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>


Happy Programming!

Abhang Rane


Just a sanity check : ViewState vs PostBackData

Surprisingly, I have come across quite a few ASP.NET developers who misjudge the exact concept of a ViewState. So here is a really simple and stupid scenario. You have the following things on a ASP.NET page –:

- ASP.NET Textbox

- ASP.NET Button (which just does a postback)

So you load the page, enter some value in the textbox and click the  Button. Of course, that value in the textbox persists after postback. Now disable the ViewState of the textbox. Enter some value in the textbox again and click the Button. I have heard many folks confidently saying that there would be no text in that textbox, which is freggggginnn WRONG! The text will be there.

Explanation –:

ViewState has nothing to do with what you enter in an ASP.NET page while it is running. ViewState stores only the following 2 things –:

- Programmatic change to the properties of a control

- Dictionary storage for any value to be persisted across postbacks i.e. in ViewState[“key”].

The stuff entered in a textbox is persisted due to something called as the LoadPostBackData event during a Page life cycle. As a matter of fact, the data entered inside that textbox is stored within that page like the ViewState but is not a part of the ViewState. During the LoadPostBackData event, this value is picked up and assigned to the textbox.

If I am sounding nuts, please visit this detailed and point accurate explanation here http://www.codeproject.com/KB/aspnet/aspnetviewstatepagecycle.aspx.

Abhang Rane


Order of classes in CSS file matter to jQuery?

Its no surprise that jQuery is becoming the latest poison for all Web Developers these days. I am no JavaScript expert, but jQuery makes even a scripting chimp like me to do some cool stuff without writing too much script! I had been playing with this library for some time and came across this small issue which took about an hour of head scratching. In my jQuery, I was adding a hover class to a <div> element. Here is the <div> as in the markup.

<div id="myDiv" class="Sample">
Stuff
</div>

Here is the Sample class


.Sample
{
background-position: 0px -141px;
}
Here is another class which I am going to add with jQuery.

.Sample-hover
{
background-position: 0px -218px;
}

And finally, here is my jQuery,


$('#myDiv').addClass('Sample-hover');

This did not work until I figured out why!!!! In my CSS file the Sample-hover class was declared before Sample class. Due to this, the CSS properties were not being overridden as expected. Phew!! I wished I was a good at these things. Sigh!!

Abhang Rane


Silverlight z-index not working!

Hahhahaha, I know the answer to this :)). Ok, enough being a jerk. Basically Silverlight would not entertain z-index parameter which is assigned to the object tag until it has a parameter Windowless set to true. Here is a typical object tag which works with z-index as –1 on it.

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%" style="z-index:-1;">
<param name="source" value="ClientBin/SilverlightApplication4.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="2.0.31005.0" />
<param name="autoUpgrade" value="true" />
<param name="Windowless" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
</a>
</object>

Although there is one caveat here, while creating a Silverlight object using the createObject method, be sure to use the parameter name isWindowless and not Windowless.

Peace!

Abhang Rane


Sleek JavaScript search box for Live Search

May be I am a little late in talking about this :), but Live Search provides a really elegant solution for embedding search functionality on your site. Here is the link http://www.bing.com/siteowner . Here is a snapshot taken on my Vista.

search

 

It allows you to search sites you mention. You can add your own sites which you have created and Live Search would crawl them. It is just few lines of JavaScript and some markup which can be customized to change the look and feel of the box.

Happy Programming!

Abhang Rane


Google Wave – The way Email should be.

Google has unveiled yet another cool idea for communication in the cloud. Google wave allows communication across email, blogs, social networks seamlessly. The fact that email being considered as a bulletin board application gives a different face to the traditional email system we have accustomed to until now. Although it is much more than just email and scraps.

And yes, it is Open Source!

Check out the awesome Developer Preview video here http://www.youtube.com/watch?v=v_UyVmITiYQ.

Happy Programming!

Abhang Rane


Facebook Connect on iPhone

Yup. This is just another attempt to showcase Facebook Connect stuff in an iPhone application. I was working since last few days (taking time from my office) to get some Facebook Connect stuff working on an iPhone. As a summary of what this app does –:

  • Detects your current location using the iPhone Core Location framework.
  • Gets the closest Zip Code using GeoNames webservice. 
  • Allows to search for a place/thing near you, using the Google Local Search API.
  • Allows to publish a story onto your Facebook home page.

Thats all my app does. Here are some snap shots. The app is very much functional but might not look awesome like those sexy apps on www.apple.com. Sigh!, I can never be a designer.

 

Picture 2 Picture 1  Picture 10 Picture 4

Picture 8 Picture 5 Picture 6 Picture 7

So here is a quick summary of the tools I used to put this functionalities in an iPhone.

iPhone Core Location Framework – This is an inbuilt SDK component which is available for all iPhone developers. Its pretty straight forward to use this framework to get the current longitude and latitude of the place where you are with your iPhone. Here is a link which explains a step by step details for the same http://iappdevs.blog.co.in/2008/12/06/get-current-location-sample-example-iphone-programming/.

GeoNames – Once you have the geo positions, you can use Google Api’s directly to get different kinds of places around you. Although I intend to have a small weather widget and the name of the city/state you are in right now. So I used the GeoNames webservices which provide a list of probably zipcodes for a given longitude and latitude combination. Here is a link for more information about different services provided by GeoNames http://www.geonames.org/export/.

Google API’s – Now since I know your correct location (as per the webservice), I would be using google Local search API to get the nearby results for the search term entered. Google Ajax API for Local Search accepts longitude/latitude combination and a search query which returns the result in a JSON format. Here is the link for the Google API’s for local search http://code.google.com/apis/ajaxsearch/documentation/reference.html#_intro_fonje.

Of course this arises a question about how to parse the JSON result on the iPhone. Chill out! You are not alone in this world. You will find several results for JSON parsing on iPhone when searched on the net, but here is a link which helped me a lot http://iphonedevelopertips.com/cocoa/json-framework-for-iphone-part-2.html.

Facebook Connect – By now, everyone knows that Facebook has shown interests in the iPhone a lot. Facebook connect is awesome and on iPhone is even better. It is a bit flaky in some cases but most of the time, it works as it should. I am sure it ain’t difficult to get a link for this topic :), but what the heck(lazy bums), here is the link http://developers.facebook.com/connect.php?tab=iphone. Do check out the video on Facebook implementation on iPhone and you are good to go.

 

Happy Programming!

Abhang Rane


The project type is not supported by this installation Error – VS 2008 and SilverLight

If you have installed some version of VS 2008 and then discovered that the existing SilverLight projects do not open, you are not alone. Here are 2 things one can try –:

  • Close VS. Open the Visual Studio 2008 command prompt. Give the command devenv /setup. This command takes some time to complete. This command actually resets the VS environment. Once complete, open VS and check if SilverLight projects open.
  • Try out this MSDN blog which suggests installing a patch for SilverLight Tools for VS 2008.

 

Best of Luck :).

Abhang Rane


jquery 1.3.2 intellisense problem

I was scratching my head for about an hour figuring out where the hell did the intellisense go for jquery 1.3.2. For those who have got an error or are able to get VS 2008 intellisense whatsoeever, you need to do the following –:

  • Download jquery-1.3.2.js file
  • Download jquery-1.3.2-vsdoc2.js file
  • Rename the vsdoc file to jquery-1.3.2-vsdoc.js :)

That worked for me. Let me know if you are still scratching!

 

Happy Programming!

Abhang Rane


Facebook Connect App for localhost domain.

I am sure there are lots of guys out there are basking in the Facebook Connect API these days. I saw quite a few people trying out the Facebook Connect with a http://localhost domain on their machine and having difficulties getting it work correctly. I got it right after a couple of tries, so I thought of sharing that simple app to display a Connect button on your site.

Here is the xd_receiver.htm file. I have placed it under C:\inetpub\wwwroot. Although I believe you can place it under a specific web application root too. In Facebook, I have http://localhost as the Connect Url for my application.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript">
</script>
</body>
</html>


Here is the htm file which actually displays the facebook button.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<body>
<script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"></script>
<div id="comments_post"> <h3>Leave a comment:</h3>
<form method="POST">
<div id="user"> Name: <input name="name" size="27"><br />
<fb:login-button></fb:login-button>
</div>
<textarea name="comment" rows="5" cols="30"></textarea>
<br />
<input type="submit" value="Submit Comment">
</form>
</div>
<script type="text/javascript">
FB.init("29af44916c9284d774abfdf84ba2da486", "http://localhost/xd_receiver.htm");
</script>
</body>
</html>


Observe that the script reference for the FeatureLoader.js.php has to be before you use any FB functions, also the xd_receiver.htm path should be the one where you have kept that file under your IIS. I have tried the same kind of settings for displaying a facebook connect button on a ASP.NET usercontrol too.


Let me know if this blows for you.

Happy Programming!

Abhang Rane


PageMethods is undefined error!

Welcome to the club of “wht the fuck is this” group! I believe you are using a ASP.NET master page or a user control ( something other than a normal ASP.NET page). This stuff works just fine on a ASP.NET Page with a ScriptManager but gives itches in other scenarios. Rather than wasting time, Ill show how it works in a Master page.

Here is a Master Page. Nothing but a ScriptManager with EnablePageMethods=”true”.

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="WebApplication2.Site1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>


<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" >


</asp:ScriptManager>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>

</form>
</body>
</html>


Here is a sample Content Page.



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" MasterPageFile="~/Site1.Master" Inherits="WebApplication2.Default" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script runat="server">

[System.Web.Services.WebMethod]
// Get session state value.
public static string GetSessionValue(string key)
{
return (string)HttpContext.Current.Session[key];
}

[System.Web.Services.WebMethod]
// Set session state value.
public static string SetSessionValue(string key, string value)
{
HttpContext.Current.Session[key] = value;
return (string)HttpContext.Current.Session[key];
}

</script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server" >
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Scripts>
<asp:ScriptReference Path="PageMethod.js"/>
</Scripts>
</asp:ScriptManagerProxy>
<input type="Button"
onclick="SetSessionValue('SessionValue', Date())"
value="Write" />
<br />
<br />
<input type="Button"
onclick="GetSessionValue('SessionValue')"
value="Read" />

<span style="background-color:Aqua" id="ResultId"></span>

</asp:content>

And here is the PageMethod.js file, if anyone needs to see whats in it, it has the javascript functions for my button events and other functions for callback, nothing special here!

var displayElement;

// Initializes global variables and session state.
function pageLoad() {
displayElement = $get("ResultId");

PageMethods.SetSessionValue("SessionValue", Date(),
OnSucceeded, OnFailed);
}

// Gets the session state value.
function GetSessionValue(key) {
PageMethods.GetSessionValue(key,
OnSucceeded, OnFailed);
}

//Sets the session state value.
function SetSessionValue(key, value) {
PageMethods.SetSessionValue(key, value,
OnSucceeded, OnFailed);
}

// Callback function invoked on successful
// completion of the page method.
function OnSucceeded(result, userContext, methodName) {
if (methodName == "GetSessionValue") {
displayElement.innerHTML = "Current session state value: " +
result;
}
}

// Callback function invoked on failure
// of the page method.
function OnFailed(error, userContext, methodName) {
if (error !== null) {
displayElement.innerHTML = "An error occurred: " +
error.get_message();
}
}

if (typeof (Sys) !== "undefined") Sys.Application.notifyScriptLoaded();


There, thats it. Astalavista!

Abhang Rane


Looking for a job in recession!

Yes its bad time to talk about the job scene not just in the US, but all over the globe. Most of the bigger companies are laying off her employees or cutting down their pay. Its truly a situation which was never seen by me in my lifetime and will be talked upon for decades, may be centuries, from now. Well I am not here to belabor on what is already a world fact. I intend to know what can a typical software developer here in India needs to think about his/her career during these horrible times.

A major portion of the Indian IT industry depends directly or indirectly on the US clients which is by the way a common sense statement. They go down, we go down. Well… not sure though. Following is an approximate rate structure of different roles employees have in a software firm in US and in India.

Role USA based firm India based firm
Developer $90 - $100 $25 - $30
Sr. Developer $100 - $110 $28 - $35
Team Lead $115 - $120 $30 - $38
Project Leader $120 - $130 $35 - $40

Above figures show a price range which a consulting firm ( a services firm) would charge to a client based in US. I am not sure about the rates for a product based firm.

Looking at the above figures an entrepreneur in US would certainly rethink her options about “offshore”ing her development tasks. They can have a strong quality assurance module based in US but the expensive job of development can be passed to the cheaper places. Of course this has its own risks and problems of having a “bad product” due to lack of communication and eventually not succeding in the business. But it is a much viable option in these times if carefully planned for. Since these thoughts are on my mind all the time, I feel that the Indian services firms should expect more projects coming from overseas.

Where to place yourself?

Now that’s a million dollar question. I can categorize the software firms in 4 major types –:

Small Product based firms ( start ups)

Large Product Based firms (may be someone like BMC, Symantec)

Small Services firms (Small consulting firms, which are in millions in India :))

Large Services firms (someone like, Cap Gemini, Accenture, Satyam!!)

These times specifically hit the first category the most since startups require them to generate enthusiasm among the general public to buy their product. In such times, people resist most of the new spending ideas and see at how they can reduce the daily costs by adjusting in what they already have. So if you are looking for a job in a product based startup in India, rethink your option considering the product value.

Large product based firms would not be hiring now as per my observation, although some of them might come up with an awesome product which they think would bring up some good revenue. In that case they might be looking for experience candidates mostly with probably a little stripped down pay.

Small services firms are the largest in number in India. These firms are, in some cases, 3rd or 4th in line from the client.  What I mean is a client X would give the project to a firm Y, which would hire some firm Z to may be find a right resource and finally some developer from firm A would work on it! This is not new in Indian consulting firms. I guess these firms are getting the most of  projects due to their lesser development costs. Although this category might be the most tempting and easy to get in option, the work environment could be highly compromised. I’ve know people working like crazy as support teams in such firms for a meager salary while they could do much better somewhere else. I strongly suggest to find some more information about the work culture followed in such a firm. I do not recommend this option to someone just returning from a wonderful work culture like that in US. Although this is just my thought, if one enjoys his/her job, so be it.

Alright, the large services firms are the ones I feel are certainly hit by the crisis tsunami, but have their seat belts fastened. What I mean is these firms would continue to get almost same treatment from the overseas clients due to their relative lesser rates compared to their counterparts in US. These firms I believe have a reasonable work culture in India, and also provide intermittent onsite opportunities for those interested. Salary might also be better than the small firms in some cases. Thus looks like the next pits stop for me :)).

These are just my observations on the Indian software industry, although I am not a hugely experienced person to give a perfect insight on what is best for you, I believe you have the  right inner sense to see what is best for you and act accordingly. After all, if you have good qualifications and a reasonable amount of experience in the industry, I think you are good to go in any part of the world, isn’t it?

Best of Luck!!

Abhang Rane


Online market in India

It sucks! Ya that’s right, it sucks. Try find a site to buy something really common place like a good desktop, may be a technical book or may be a cell phone. Does anyone know if there is something like Amazon or eBay in India. There is eBay (formerly known as bazee) but try finding things that you need out there. There is barely 20-30% chance of finding it there. Why? Because there is hardly anyone selling it there. Consider this scenario, I have never been in India before, I land here and need to get a computer for myself. It could be a desktop or a laptop. Where should I go? I do not know anyone here, although I have internet in my house. The most sensible thing to do would be to get out of the house, ask some sane looking person about the whereabouts of such a store. If lucky, there might be one close by, if not get back to your room.

Next, may be try Google maps to locate an electronic store near your current location. As far as my experience goes, you would end up with nothing really useful. Businesses here are not really harnessing the power of Google. The stationery store near by apartment can be found in the map but a bank adjacent to that store is nowhere to be seen on the map. The main reason is people still heavily rely on “word of mouth” information rather than looking for it online. That is the main reason why there is nothing like Amazon here. I myself used to visit the Amazon website at least once a day to check out the recommendations of books and other stuff. Well, its true that a website becomes famous when it is useful to her users in the region. India does not have that internet savvy population as it is in the US, but I firmly believe that the percentage of the population getting interested in owning a nice flat screen TV, a sleek laptop or may be a gaming console is increasing at a rapid rate. It certainly makes sense for a customer to closely look at the item or even touch it before buying it, a well organized and well thought website arouses her interests to go for a product. Right now this interest building activity is loyally performed by the TV and friends. I am no comScore analyst, but the difference between the online transactions for home usage products in US is huge compared to that in India. And that is why we need something like Amazon for India. I do not know how it would look, for sure it would require a shift in minds of the retailers and buyers. Retailers should somehow be interested in the online business which would eventually drive the interests of the buyers. Let me tell you there are a large number of buyers out here who don’t mind spending lakhs of rupees on a TV.

I gave some thought on what the website should have to make it a success in a an upcoming economy like India.

  • Really easy and intuitive interface for the users. (may be something like www.jagore.com ).
  • Multilingual, the site should be able to change the culture to English, Hindi and other major languages.
  • Powerful search functionality. Since people are so “Googlelized” these days, everything they need to find is searched on Google and things move on after that.
  • A recommendation system that works, like that of Amazon or Netflix. People would just love stuff being recommended to them which they might be interested in.
  • Flexible payment options. India is predominantly still a “Cash based” market. People mostly buy all kinds of stuff, from an orange to a house, just by paying hard cash/check. Online options need to be there, but there must be a system in place for the customer to pay cash on delivery or something on that lines.
  • Free or nominal delivery charge.

These are the major features which the site must have to capture the Indian public interests. I hope there is something in the making like this, since there certainly are several other folks out in the wild thinking about getting a customer friendly experience on the internet.

 

Happy Programming!

Abhang Rane


An iPhone app that knows your mood!

While getting my hands dirty with Microsoft technologies all day in the office, I though of doing some more of that cool thing called iPhone development. I had built a RSS reader which I use to follow blogs on my iPhone. Well, I thought of creating something more useful and fun to use. I think creativity comes out of a need. I needed an application which

  • would be with me all the time ( so on my phone)
  • would know where the hell I am.
  • would suggest some nice places nearby my current location. Although it should be smart enough to know that if it is 750 degrees where I am, I am really not in a mood to get in a spa or may be have a hot cup of soup.
  • Also if necessary I should be able to change the settings which would affect the search results, like if I change my mood to say mischievous, the app include search items like an adult store or a strip club. Awweeeeeeerightttt!!!!!! (Not sure how practical this is in India, but would certainly give lots of results anywhere in US).

May be there are apps already created with such intentions, but nothing is more fun than using your own app to do day to day things. So I am in the process of designing the screens and collecting information considering the requirements of the app. Following are my companions during this development process -:

  • Use the iPhone Core Location framework.
  • Use Google Ajax API
  • Use Google Weather webservice

I hope to get this done as soon as possible, kind of having a tight schedule at my office these days. Here are a couple of screenshots which might just scrap the surface of what I have in mind, although these screens might change as I dig deep in my thoughts.

Picture 1 Picture 2

Happy programming!

Abhang Rane


Broadband in India

After living in US for a while, returning back to your home is something that can only be experienced rather than talked about. But things do change after living away. Before moving to US I was ok with a mediocre Internet connection which had a speed of, I don’t know may be 10 Kbps. But after using Comcast High speed internet with  6Mbps lightning speed, Yeh Dil Mange More!! So I planned to switch to broadband connection here in Pune. Pardon me for my language because I am pretty frustrated how things work here.

Options available – TATA Indicom, Reliance, BSNL. (There is Airtel too but I thought they were a little expensive so I never called them, and others like Hathway and Sify, they are just there to suck blood).

They share one verb in common. They all suck, right from getting the connection to using it. I intend to use internet as much as possible so I needed an unlimited data plan. Now if anyone is new to this broadband connection mania in India, let me tell  you what are the typical steps the service provider would follow before you get your damn connection.

  • First call the service center in your city and ask for a connection.
  • The person would ask your address details etc and put a request to check for fucking feasibility of providing the service at your address.
  • For the next 2-3 days there would be some damn feasibility check to verify the service can be given. I was called by Tata  times to verify where exactly my building was, I mean exactly where respective to a landmark may be.
  • If that goes well, you need to select a plan. Overall I have seen that for home usage, 256 Kbps seems to be the most widely used speed here. Unlimited plan with 256 Kbps speed costs from about 750 – 1000 Rs/month.
  • Once the plan is conveyed in the next 2-3 days you might have your connection if everything goes well.

Now honestly speaking for someone who has spent quite some time abroad may be the price of broadband would seem cheap, but for residents here, unlimited plans seems pretty expensive compared to what we paid in US. Well I have to agree that internet is like having a TV in US, but in India, in a good locality, I think there would be 3/10 ratio of internet wired homes.

Here is a table which shows the bird’s eye comparison between these fuckin ISP’s.

 

  TATA Reliance BSNL
Price 1000 799 + 50(phone needed) 750(phone needed)
Customer Service Best Ok (Until now) Sucks rat’s ass
Speed (Kbps) 256 300 256
Time to get the service in days 2-4 1 week > 1 month

Please do not draw conclusions just by looking at the figures.

BSNL is a government service, and for those who do not know, in general, a government service in India is dreaded by everyone unless you have someone high up the ladder to pull some strings in their office. For BSNL, you need to apply for a landline phone, it took me almost a month to get that. Once that is in place and working, we need to apply for broadband which might take another month who knows.

I have chosed Reliance for now, its been almost a week and I do not have a connection yet. There is wiring being done in my house today and hopefully Ill be surfing 2 days from now. I always smell something fishy with Reliance since their service is much cheaper than TATA and the speed they promise to give is 300 Kbps. Lets see how that goes in the coming days. Please let me know if you need more information about any of the above mentioned services since I spent some time researching on them.

Finally a special note for those planning to come back after a long time or those who are coming for the first time and need a broadband connection.

Getting a connection is the easier part of the equation, but getting good service once you have the connection is really important. I would recommend TATA Indicom for all of you since they really take customer service seriously, atleast that was my experience with TATA sky which is their cable TV service. Although their service is a little on the higher price side but I am sure you won’t mind that :).

Happy Programming!

Abhang Rane


Typed Datasets vs Normal Datasets

I know there are gazillions of posts explaining about the difference between these 2 data interaction approaches in .NET, but I still would like to contribute a bit. I spent couple of days analyzing the performance of typed vs normal datasets using ASP.NET and SQL Server 2005. Since typed datasets gives so much ease of development and of course, compile time type safety, it is pretty obvious that there is a performance price. I wanted to observe the one to one comparison of these 2 candidates.

Following is the environment in which I did this analysis –:

Database – AdventureWorks in SQL Server 2005

Dev environment – Visual Studio 2008, ASP.NET Web Application

Profiler – Redgate ANTS profiler.

I created a data access layer for each type of dataset, so for typed dataset it consisted of the xml schema and other designer files generated and for the normal dataset, I created classes which essentially did the same thing as some of the classes generated by typed datasets, but with less code. (By less I means the designer generated code has lots of things which are unnecessary for simple operations but nevertheless they are good programming practices, I omitted them). I created a simple, complex and very complex queries in the database so that I see their performance at different levels. Also I analyzed the results for small number of rows, medium and large number of rows in the each of the query result. To explain the kind of queries I wrote, simple query was just a normal select statement, complex query had couple of joins and very complex query had couple of inserts and then a select with couple of joins.

Following are the results of the experiment –:

Small data set (about 100 rows in final result set)

Type of query

Normal Dataset

(sec.)

Typed Dataset

(sec.)

Simple Query/Procedure

0.012/0.0005

0.0144/0.0008

Complex Query/procedure

0.0197/0.004

1.923/0.007

Very Complex Procedure

0.041

0.072

Medium data set (about 7000 rows in final result set)

Type of query

Normal Dataset

(sec.)

Typed Dataset

(sec.)

Simple Query/Procedure

0.194/0.164

4.19/0.44

Complex Query/procedure

0.48/0.54

4.96/0.76

Very Complex Procedure

0.64

0.79

Large Data set (> 500000 rows in final result set)

Type of query

Normal Dataset

(sec.)

Typed Dataset

(sec.)

Simple Query/procedure

1.675/1.44

4.62/4.27

Complex Query/procedure

8.46/7.61

18.19/17.98

Very Complex Query/procedure

7.921

19.935

From the data collected, it is not surprising that typed datasets take a performance hit compared to normal datasets. As you can observe, for simple queries, typed datasets create quite a bit of overhead. The major reason is, in this case, the table which was used for this simple query was pretty big (about 30 columns) hence the typed data table created was a large object.

Although typed datasets cannot outperform normal datasets in terms of execution time, they were introduced for a reason right! That reason is to reduce the development time and generate good quality code. Following table shows the development time needed to build the same functionality with these 2 approaches.

Development Time (same for all size of datasets)

These values show the coding time required to create the actual functions which retrieve values from the database and return to the calling client.

Type of query

Normal Dataset

Typed Dataset

Simple Query/Procedure

2.8/2.5 min

2/1.5 min

Complex Query/procedure (not parameters for the procedure)

3.5/2.5 min

2.4/1.5 min

Very Complex Procedure (About 30 parameters)

14.5 min

4 min

 

To sum up this discussion, following are the pros and cons of Typed Datasets. Since Typed Datasets are just wrapper classes over normal datasets, their pros and cons are pretty much the same.

Pros:

· Visual Studio intellisense available to access the individual table fields. Compared to normal dataset code, typed dataset code is shorter making it more readable, maintainable and more intuitive.

· Compile time type checking is achieved for individual fields for tables. Since the columns of a typed dataset are strongly typed, there is no explicit casting required while retrieving the values from the dataset unlike in normal dataset.

· The dataset provides a replica of the underlying database including the relationships between the tables and their indices. This gives the developer the ability to check constraints within the code itself.

Cons:

· In order to achieve the type safety, typed datasets need to have the underlying information of the table schema. Creating a typed dataset or a typed DataTable is an expensive operation. For simple operations, you might end up having lots of unnecessary code in the designer file of the typed dataset. For example, to perform a simple read of say 3 columns from a table with 30 columns, the designer would still create a DataTable consisting of 30 properties and 30 type safe columns. One can certainly delete unwanted columns but that becomes an extra task as schema changes frequently.

Although one can store this datatable in a Session or some other place where he could just do DataTable.Clear() and return it after it has been created once. I implemented this method and saw about 40 – 50% improvement. Please visit this link to read more about it.

· Every time the database schema changes, one has to refresh the .xsd file to generate the class again.

· Using the typed adapter could be an overhead for simple operations. The typed adapter consists of table mappings, transaction support which might not be what you want for a simple operation like select.

Happy Programming!

Abhang Rane


Task Scheduler vs Windows Service

It is not uncommon in a project where in we need to schedule some operation. It might be some database call or a webservice call or some simple call to a dll. There are several options one might consider in such a situation.

  • Create a Windows Service (background process) with a Timer which would initiate the operation at regular intervals as specified to the Timer.
  • Create a task in the Windows Task Scheduler which would initiate the application.
  • Create a timer in the global.asax file which would fire at regular intervals to initiate the required operation.
  • If the operation is about reading and writing to a SQL database, then SQL CLR integration can also be considered. Here SQL jobs could be used to call a procedure which calls the managed dll.

The project which I worked on required a similar functionality where a scheduler needed to call my dll which in turn would do the required webservice calls and some database operations. Me and my team went through several discussions about which option suits the best for our needs. Following were the highlights of the discussion –:

  • Windows Service is a nice option since it has inbuilt logging features and can gracefully handle failures. They are really easy to write ( We were working with .NET). The biggest constraint is writing a scheduler. We needed the operation to occur on a specific day at a specific time. Now we could have written a scheduler with lots of efforts, but if we needed to change the schedule we would have had to change the scheduler parameters somehow. Well a config file can help here but again, it is a technical task and certainly some normal Windows User (non technical) would not know these things by default.
  • Windows has a well tested Task Scheduler which can be used to schedule applications to be run at specific intervals. The scheduler is very usable and has pretty good granular control. Although to schedule tasks within seconds once would require to do some trick but we did not want that level of granularity. After rummaging in the cloud we found that once a password of the user Windows account changes, the task needs to be updated with the new credentials. This is kind of an admin task but pretty irritating. Although since with the task scheduler we would be running the application only when needed and not causing a resource hog like a Windows Service. Just to mention though, Windows Task Scheduler is actually implemented as a Service in Windows OS. There are some reports saying that the scheduler is a poorly written application and causes to fail several times.
  • A timer in the global.asax file also has the same problem of writing our scheduler. It also causes a needless dependency on the IIS server.
  • SQL CLR is a pretty compact option, but me and my team were not completely familiar with writing managed code in SQL and we had to come up with a cheap option in a small time frame.

We finally decided to go with the Windows Task Scheduler. Our application was really simple, it just had few function calls to our core engine which in turn took care of the webservice and database calls. So we did not have much worry about the logging features absent since we could write our own. In turn we got a well tested and easily usable scheduler and an application which ran only when needed.

You can try to find information about such a situation, you would stumble over lots of blogs stating one is better than the other and vice versa. Mostly people have chosen between a Service and the Windows Scheduler, but honestly it depends on the requirements of your application. For few hours I was hanging in limbo, between Service and Windows Scheduler but some of the blogs like Jon Galloway’s blog post helped me make my decision. I state again that our decision of Windows Task Scheduler was based on the information we could gather and our requirements more importantly.

Happy Programming!

Abhang Rane


Stackpanel scrollbar visibility issue

It is not new for someone playing around with Silverlight to realize that the ScrollViewer class does not behave as it should when used with a container control like StackPanel.  I spent an hour scratching my head over this issue until finally I got it right ( that is what I think!). All I wanted to do was dynamically add my usercontrols as children to a StackPanel, and the StackPanel needs to display the scrollbars once the child controls go beyond the view of the StackPanel. If you do the following you would not achieve what I said earlier –:

<StackPanel Height="228" x:Name="stackStores" Width="380" Orientation="Vertical" 

ScrollViewer.HorizontalScrollBarVisibility="Auto"

ScrollViewer.VerticalScrollBarVisibility="Auto">

</StackPanel>

The key here is the scrollviewer must move a container as a whole and not its individual children. What I mean is if we add all the usercontrols inside a stackpanel and put this stackpanel inside a scrollviewer, the scrollbars would be visible provided the stackpanel dimensions goes beyond the scrollviewer dimensions. Below is the snippet illustrating the same –:

<StackPanel>

<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Width="500" Height="400">

<StackPanel Height="Auto" x:Name="stackStores" Width="300" Orientation="Vertical"

//Add the children here.

</StackPanel>

</ScrollViewer>

</StackPanel>

The above snippet works for me. I have seen quite a few blogs explaining stuff about this but none had solved my issue.


Happy Programming!

Abhang Rane


Is your object oriented design SOLID?

I believe object oriented design is the most widely used technique to develop applications in most of the industries today. It is a great concept of modeling real world objects into software paradigm. But not all object oriented designs are good designs. Just because your design uses the important concepts of object orientation does not make it a robust, scalable and extensible design. Experts in this field have, over the years studied various aspects of object oriented design and have come up with some guidelines or principles to create a good design. For us mortals, following these principles could, probably not guarantee, but certainly increase the probability of developing high quality software.

Following are the principles which form an acronym of SOLID as laid out by Robert C Martin.

Single responsibility principle – Each class (or a method) must have one and only one reason to change.

Open closed principle – A class (or a method) must be open for extension but closed for change.

Liskov substitution principle – Derived classes must be substitutable with their base class.

Interface segregation principle – Make more granular interfaces which are client specific.

Dependency inversion principle – Depend upon abstractions, not on concrete classes.

Scott Hanselman has posted a great great podcast with the Uncle Bob ( Robert C Martin) where he talks about each and every principle listed above in a very lucid manner. Here is the link to that podcast http://www.hanselman.com/blog/HanselminutesPodcast145SOLIDPrinciplesWithUncleBobRobertCMartin.aspx.

Abhang Rane