Tuesday, August 4, 2009

Taking a dig at Android :)

Today, finally started to write something for mobile platform, should have done this long time back.. buts its never too late right ???

Since heard a lot about Android platform, I decided to go for it.

The good thing is that the SDK is available for Windows platform (unlike for IPhone). I already had a small app in mind which helped me in making sure I learn something, if at all.

Did some research and found that Eclipse IDE is the recommended one with ADT plugin. The great thing was.. it was all free :)

Downloaded the latest 1.5 toolkit from Android and started reading the online help. Is it only me who thinks that Android help layout very closely resembles MSDN? Well, I hate that the help has little to no screenshots which I felt would be very useful especially to explain role of TextAttributes.

Having a past experience with Java, Applets, Layout managers, C#.. it wasnt too difficult to understand the structure of code.. and with the famous copy and paste.. I was off to a good start.

I currently have an app where it emits information stored in the resource file.. I have to build upon it to accept that information from the user, persist data in form of dictionary (in resource file) and fetch data from there.

Monday, August 3, 2009

System.Data.Linq.ChangeConflictException: Row not found or changed

Issues with Data Update in Linq

System.Data.Linq.ChangeConflictException: Row not found or changed

This exception shows up if:

1. The row you are trying to update does not exist
2. If you are trying to use Attach statement without the use of TimeStamp field (this is used to keep track of current version of the record. Auto Concurrency implementation). The error message does not make at all sense in this scenario.
3. You made some minor change to the db and didnt feel like re-creating the SQL to LINQ class (DataContext) - even change in a fields attribute from Not Null to Null or vice versa. The error message does not make at all sense in this scenario.

Some good links:
http://sebastienlachance.com/2008/07/08/systemdatalinqchangeconflictexception-row-not-found-or-changed/

Good Practices for Updating in LINQ
http://borrell.parivedasolutions.com/2008/02/linq-to-sql-updating-in-aspnet-right.html

Wednesday, July 22, 2009

Binding Dropdownlist (User Id and User Name) using LINQ

The below query will pull all active users from a specific role ("administrator" in my example). The query is written on top of Membership and Authentication schema provided by ASP.NET.

My enviornment: VS2008 Beta 2.

LinqClasses.ServiceProviderDataContext context = new LNMT.LinqClasses.ServiceProviderDataContext();
var list = from s in context.aspnet_Users
join userMem in context.aspnet_Memberships on s.UserId equals userMem.UserId
join userRole in context.aspnet_UsersInRoles on s.UserId equals userRole.UserId
join roleMas in context.aspnet_Roles on userRole.RoleId equals roleMas.RoleId
where userMem.IsLockedOut == false && userMem.IsApproved == true && roleMas.LoweredRoleName == "administrator"
orderby s.UserName
select new { s.UserId, s.UserName };

//Binding to Dropdown list

DropDownList1.DataSource = list;
DropDownList1.DataValueField = "UserId";
DropDownList1.DataTextField = "UserName";
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, "All"); // will insert All at the top of the list.
DropDownList1.AutoPostBack = true; // this is if you need to reload the page on change.

This is based on join statement on standard tables provided by ASP.NET Role and Membership. Hope will be useful for some.

Thanks,
Chintu

Property Buying Tips

This is specially for NRIs thinking about investing in India :)

Customers can buy properties from multiple sources:

1. Direct from Builder
2. From Property Dealer
3. From an Individual

Generic Tips:

First come first.. make sure the property you are buying is genuine and it exists :) [no Khosla ka Ghosla trap.. remember.. that happens :)]

Cricket in Seattle, Redmond, Bellevue & Issaquah

Home away from home.. well.. this is what an ardent cricket fan feels in the state of WA.

Whether you play Hard Tennis Ball or Leather or Tape Tennis Ball.. whether you like to play in Snow or Rain or just Sun-shine.. whether you like to play on artificial turf, football ground with crazy boundaries.. you are kid or grown up.. guy or a girl... and did I ask??? Yes, whether you are a girl or a guy... you have cricket for everyone.

There are ~20 cricket teams playing leather ball cricket (http://www.nwcl.org) and about 80-90 (yes you read it correct) Hard Tennis Ball team (http://www.arcl.org). There are about 6 women cricket teams (www.arcl.org division W).

Its just fun to be a cricketer in the Northwest region :)

7th Year Extension

You hear about lots of people advising about how its easy to get 7th year H1B extension... well... its easy (in these days??? yeah ) provided you meet this condition:

1. PERM application pending for more than a year (approved/ RFE.. doesnt matter.. the application should be active) on the date when your 6 years expire.

2. You have PERM applition + I-140 approved (does matter if point 1 is satisfied or not).

Welcome to my blog

Well.. its been a while I have been thinking about writing.. not on a particular topic but just random topics, share some experience and stuff like that.

You will get totally random information.. some will be to your liking and some may not be..

Dont forget to provide feedback on my posts.. even if they are crappy :)