Tuesday, July 29, 2008

MSBuild Error with Web Application Project : errorMSB4019

On windows server 2003 I am using CruiseControl.net (CCNet) to create builds of my application. However, I experience an issue when compiling a web application project (WAP).

This is the reported error:

errorMSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Probably because with vs.net 2005 and vs.net 2008 you need the Web Application Project extension to get the web projects work just like vs.net 2003.

I fixed this error buy installing the Web Application Project Extension from Microsoft. You can download it here.
http://download.microsoft.com/download/9/0/6/906064ce-0bd1-4328-af40-49dca1aef87c/WebApplicationProjectSetup.msi

This msi takes care of putting the missing MSbuild files required for compile web application project files.

Friday, July 25, 2008

No 802.11g WIFI in Dallas, TX Suburns

With my current relocation to Lewisville, Texas relocation process, I have found myself stuck with WFI 80211b network everywhere I go. I can’t believe this NO G WIFI! I used jiwire.com to search for WIFI and HotSpots so that I can work. Until I with my placed setup with Internet I am stuck working from Starbucks, Panera Bread, Barnes & nobles etc. But all these places have 80211b networks. Some of them have G but requires an ATT account or pay for 2 hours of wifi. I have T-Mobile and I am having a really hard time getting fast connects.

See the results from jiwire.com

http://www.jiwire.com/search-wifi-hotspots-general.htm?radius=5.0&venue_group_id=0&radius_unit=mi&latitude=33.007591&longitude=-96.974252&address=2325+S+Stemmons+Frwy&city=Lewisville&city_id=131871&state_id=44&state=TX&country_id=1&country=US&zip=75067&hotspot_name=&location_type_id=0&technology_id=0&pay_free=&provider_id=0&ssid=&jump_letter=&wisp=&limit=&startnum=1&num_per_page=&tab=5&&result_display=list

I keep on asking and no one knows what I am talking about. I talked to someone at Starbucks and they are like “Yeah, we just got new equipment from ATT for the WIFI” and guess what? It’s a 80211b connection! What good of an upgrade, uh?

So if you are around the Lewisville, Texas or Flower Mound, Texas Area and you are in need of High speed WiFi, be prepare. Make sure you spend some time thinking of where you are going to be going for your HotSpot.

Tuesday, July 22, 2008

Time Ago in Words for .NET C#

I saw the need for a C# version of the time_ago_in_words function in Ruby. I translated the code below into C# from my existing post I published for Ruby.





static string TimeAgo(DateTime time)
{
DateTime startDate = DateTime.Now;
TimeSpan deltaMinutes = startDate.Subtract(time);
string distance = string.Empty;
if (deltaMinutes.TotalMinutes <= (8724 * 60))
{
distance = DistanceOfTimeInWords(deltaMinutes.TotalMinutes);
if (deltaMinutes.Minutes < 0)
{
return distance + " from now";
}
else
{
return distance + " ago";
}
}
else
{
return "on " + time.ToString();
}
}


static string DistanceOfTimeInWords(double minutes)
{
if (minutes < 1)
{
return "less than a minute";
}
else if (minutes < 50)
{
return minutes.ToString() + " minutes";
}
else if (minutes < 90)
{
return "about one hour";
}
else if (minutes < 1080)
{
return Math.Round(new decimal((minutes / 60))).ToString() + " hours";
}
else if (minutes < 1440)
{
return "one day";
}
else if (minutes < 2880)
{
return "about one day";
}
else
{
return Math.Round(new decimal((minutes / 1440))).ToString() + " days";
}
}




You can download the complete source here: http://www.box.net/shared/3fmhllxq8g

Tuesday, July 08, 2008

Hide Submit button to prevent double click using JavaScript in .NET

Here is snippet of JavaScript to hide the submit button to prevent users from double-clicking on the button multiple times causing several server requests.

What I like to do is hide the submit button and show a message to notify the user that the action is in progress.


This is my front-end code. I have an image button that OnClick is submits an order.

<asp:ImageButton ID="btnPlaceOrder" runat="server" Visible="False" OnClick="btnPlaceOrder_Click" />
<div id="process_message" style="display:none;">
<p> Processing your order...</p>
</div>




The code-behind looks like this:




btnPlaceOrder.Attributes.Add("onclick", "this.disabled = true;this.hide(); $('process_message').show();" + ClientScript.GetPostBackEventReference(btnPlaceOrder, null) + ";");