Thursday, July 29, 2010

Google maps - Part 2 - How to get current lat, lng and zoom level

Once a google map is initialized and when it is re-positioned, the latitude, longitude and zoom level can be determined using the following example.

Monday, July 26, 2010

Google maps API v3 - Part 1 - How to create a simple map?

Recently I worked on a project using Google maps. It was originally developed using Google maps API v2. I changed it to use v3 API.

Google maps v2 vs v3 API

Version 2 API requires you to register for an API key for every domain that uses google maps and must be inserted into the QueryString for the script reference. Version 3 API doesn't require an API key.

How to create a simple map?

1. First thing is to add the following script reference to your HTML page.

Note: sensor attribute is to specify whether your device has a sensor or not. (just to determine the user's location.

2. Create an object with the latitude and longitude co-ordinates. Simple map with NZ co-ordinates.

Sunday, July 18, 2010

DateTime MinValue in SQL SERVER and C#

I was trying to store C# DateTime.MinValue in SQL SERVER and got the following exception

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

In SQL Server the minimum date that can be stored in a datetime field (1753/1/1), is not equal to the MinValue of the DateTime .NET data type (0001/1/1).

Therefore if your datetime value is DateTime.MinValue then don't save it in SQL SERVER.

Tuesday, July 13, 2010

IIS6 Meta bas compatibility in IIS7.5 and windows 7

IIS7 has done away with the metabase, but some pre-IIS 7 applications rely on the metabase as part of their installation process. This is a Windows feature that you can turn on and off throught the control panel.

Note: This is not a separate install.

Monday, July 05, 2010

IIS 7.5 and Windows 7

HTTP Error 500.19 - Internal Server Error

This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".


The applicationHost.config had the handler section locked:



and it fixed the issue.

System.Data.SqlClient.SqlException: New transaction is not allowed because there are other threads running in the session.

I got this error when using Entity Framework with the following code.


The foreach loops were the culprits. I needed to call EF but return it into an IList of that target type then loop on the IList.

Yahoo Style Guide

The style guide for the Internet age

Anyone can publish on the Web, but not everyone is publishing material that's ideal for online reading. Enter "The Yahoo! Style Guide," your guide to writing and editing for the Web. People read online text differently, and they have different expectations when they read it -- most notably, they expect instant gratification, the ability to find what they want on a webpage fast

The Yahoo! Style Guide: The Ultimate Sourcebook for Writing, Editing, and Creating Content for the Digital World" will be in stores from July 6

Check the site for more information.