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