Wednesday, May 16, 2012

Visual Studio Lightswitch v2 issue

If you import a datasource with a table named Systems, it will not complain until compile time, when it says "no such object System.CodeDom...". Basically it is a name collision.

Saturday, April 21, 2012

"Can not insert NULL into column" when SaveChanges in Entity Framework

It is a strange error as the value is obviously set in the POCO used. The reason is the model created marked the column as 'Identity', which causes EF to insert a NULL and try to get the value back from database. If you use SQL Profiler, you can see the behavior clearly.

Thursday, January 26, 2012

Wednesday, August 31, 2011

IBM DB2 .NET Data Provider 9.7

The IBM DB2 .NET Data Provider 9.7 has both the data provider for .NET 4.0 AND Add-in for Visual Studio 2010. But you need to install the FP4. I installed the original and upgraded to FP3a and then FP4, and it didn't work properly (can not see IBM driver in the list, testconn20 and testconn40 both are not working). So a clean install of FP4 is the most reliable way.
Another thing is the tools needs admin priviledges. If you don't run VS under admin or (most of) the tools under admin, they just disappear or report reason code 10.

Thursday, June 30, 2011

WeatherLive Windows Phone 7 application Privacy Policy

WeatherLive is a client application designed for displaying current weather forecast with Live Tile support on your Windows Phone. In order for providing weather information for you, we may need to access your location information as a convience feature. As such, we are providing the following privacy policy.
This Privacy Policy may be updated and you can receive information about updates through the web site or the service. The latest version of the privacy policy is available to you at http://laorient.blogspot.com/2011/06/weatherlive-windows-phone-7-application.html.

Information Collected

When you chose to enable location service for weather information, we collect the location of your phone and send it over the internet to get the weather information. If the application is in Trial mode, we may use this location information to deliver ads appropriate to your location. We only store the current location information for Live Tile support and not use it for other purposes. You can turn off the feature in the settings and still use the weather feature by entering the worldwide city and state.

Sunday, June 26, 2011

Tips encoding bytes for REST services (or any Uris)

Use Base64Url to encode any bytes as part of a url. It replaces the normal "/" and "+" with "-" and "_", makes it url safe.

Windows Azure: WebRole.cs is NOT running in the same process as the website

WebRole.cs is running in WaIISHost.exe in local dev, and website is in w3wp.exe. This causes code running in the WebRole.cs having no access to the website's in memory classes/code, thus several confusing issues:
1. If you initialized something in Run/OnStart, it is actually not effective for the website.
2. The code running in WebRole.cs can not access the web.config file, as it is not run as a website.
When I tried to start a Quartz.NET scheduler, such an architecture caused many mysterious behaviors and issues for me. E.g., the scheduled job has a EF object that can not get its connection string (because it is in the web.config). And trying to run a scheduled job code in the website ondemand can not access the main scheduler (because it is in another process!). After I moved the initialization code for the scheduler into the Global.asax.cs, everthing starts working.