Pages

Monday, April 22, 2013

Set UpdateCheck to Never programatically for LINQ Data Contexts

By default when you generate a LINQ Data Context in Visual Studio, every column of every table has the UpdateCheck property set to Always. The implication of this is that the UPDATE sql statements issued by LINQ will include all the fields in the WHERE clause in order to match the exact copy of the record that was initially read and prevent overwriting changes made by other users/threads between the last time we read the record and the moment we try to update it. And that's fine in many scenarios but sometimes you want all the UPDATE statements to find the record to update and change it regardless of changes sent by others (a "last commit wins" type of policy) and for that you'd need LINQ's UPDATE statements to only include the table's primary key fields in the WHERE clause. That is, you need the UpdateCheck property set to Never for all the columns that are not primary keys.

Sunday, October 21, 2012

Visual Studio poor performance issue

Over the last two weeks my Visual Studio has been behaving strangely. Launching a simple console application in debug mode would take about 5 minutes for it to come up. Same thing happened when launching other projects in the solution in debug mode.

Today I cleaned up my Visual Studio configuration, rebooted my PC and the debugger launches instantly as expected. In case any of you are experiencing a similar issue, you can clean your visual studio by performing the following:

Tools -> Import and Export Settings…
Select “Reset all settings”, and click next.
Select “No, just reset settings”, and click next.
Choose your default collection of settings (Visual C# Development Settings)
Click Finish.

Wednesday, September 5, 2012

How to post a complex object via AJAX to an MVC Action

I needed to post an object from Javascript to an Action using Asp.Net Mvc, and realized it is not as straitghforward as I thought it would be. So, I put together a little example which can be used for reference in the future.

Monday, August 13, 2012

A sample JQuery Carousel

I recently had to display pages of commercial flyers on a Carousel, where they could be flipped over. After some research I found Chris Coyier's blog and his excellent JQuery plugin that allowed me to implement my own carousel. He baptized his JQuery plugin as Moving Boxes and you can find his introductory article here and a live running sample here.

Thursday, July 12, 2012

HRESULT: 0x80070057 (E_INVALIDARG)

Very annoying problem for a good while today. I happened to be reverting my code back to a previous version of the repository on SVN. We needed to roll back some changes, and to my surprise after going back to the previous version I wasn't able to build the solution anymore, showing me a weird error:
"Could not load file or assembly … The parameter is incorrect … HRESULT: 0x80070057 (E_INVALIDARG)".

Tuesday, June 5, 2012

Delving into Android Apps Development

I always had this frustration with native mobile apps, of never having had the opportunity to develop one. Maybe it was the lack of a real chance in my company or maybe lack of free time to do it. Anyways, Last week I decided to get through with something basic for Android and publish it on the Google Play market.

Friday, May 4, 2012

How to solve Http 401 error for Http Put and Delete with WCF Rest

With the popularity of WCF Rest services, it is now a bit more common to issue HTTP PUT and HTTP DELETE requests. I don't remember using those verbs before in my career. Whenever I needed to delete something or update something, I would use HTTP POST and then handle the data in the back end. But times have changed, and with WCF Rest embracing the HTTP protocol, you are more likely to work with those two verbs more often.