Custom Search

Monday, July 06, 2009

Table does not show up in Data-Compare (VSTS)

When performing a data-compare in VSTS Database Edition (aka Data Dude), if you do not see one of the tables in your source or target databases – the reason is most probably very simple:

It does not have a primary key!

Spent many hours trying to figure this one out!

Wednesday, July 01, 2009

OptiRoute has been updated

OptiRoute has been updated with tweaks to the UI and the algorithm. I have also added a help document and screen casts on using OptiRoute.

Using OptiRoute with Bing Maps

Using OptiRoute with Google Maps

Sunday, June 28, 2009

RegEx – Preventing matches based on specific characters

from: Finding lines not containing certain words

use the Prevent Match expression:

~(X) Prevents a match when X appears at this point in the expression. For example, real~(ity)matches the "real" in "realty" and "really," but not the "real" in "reality."

Eg: used in the blog post:

{public ~(const|event|delegate|readonly|static readonly|static extern|abstract).*};$ 
finds all public members in C# code.

ASP.Net – WebForms Page Life Cycle

The following useful graphic describing the a web-form page’s life-cycle is from Scott Mitchell’s article “Understanding ASP.Net ViewState” on MSDN.

ms972976.viewstate_fig02(en-us,MSDN.10).gif

 

And even before the life cycle hits the HTTP Handler, the following occurs within IIS and the ASP.Net engine:

Click here for larger image.

ASP.Net Resources – Building standards based websites

An excellent presentation on building standards based websites - “Building standards based website using ASP.Net (4.0) - ReMix Australia

Get Microsoft Silverlight

Tatham’s blog post to the above video - http://blog.tatham.oddie.com.au/2009/06/18/video-building-great-standards-based-websites-for-the-big-wide-world-with-asp-net-4-0/

And here are my notes I made while viewing this video that you might find useful:

Website created: http://www.graysonline.com/

Started off 9 years ago as an ASP site

the current ASP.net version started of as a project with 2 developers, and then ramped up to 12 developers and with an ops team at its peak.

Full time designer was dedicated to the project -> consistent look and feel

tech stack used
    Asp.Net 3.5
    Commerce Server 2007 (cart, profiles, etc)
    SqlServer 2005
    Endeca    (search - Java based)

Dev methodology: Scrum

Need to Define what done means on your project (do it early)
    XHTML compliance
    Unit tested
    Browser support
    WAVE test

FireBug - useful tool for FireFox (similar for IE dev toolbar)

Used XHTML 1.1 standard

XHTML 1.1 deprecates stuff like iframe, target, etc.
    Use XHTML 1.1 as base for most pages and XHTML 1.0 on the pages that require it.
    Why target is not supported by XHTML 1.1
http://www.w3.org/MarkUp/2004/xhtml-faq#target
    -ASP.Net pages by default target XHTML 1.0 transitional
    -XHTML 1.1 supported natively by VS 2008
    -To change your page use:
        Update the doctype in your aspx page:
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
        To the web.config
        set: xhtmlConformance mode="strict" (default is transitional)
    -use CSS friendly adapters
    -use ASP.Net themes & skin files
    -Do all of the above in one easy step while setting up your project using the "Visual Studio 2008 XHTML 1.1 Project"
http://www.codeplex.com/VSXHTML11Templates

The future - ASP.Net 4.0 – cool features coming:
    -allows you to control the ID that is used on controls
        sample options: static, predictable
        also allows you to add a row suffix
        makes it easier to use CSS to control design
    -disable viewstate at container level
        Panel disabled, means all contained controls have viewState disabled
        you can still enable it for each control individually

Useful tool:
    XHTML markup sanitizer: http://markupsanitizer.codeplex.com
    Cleans up HTML markup so as to be XHTML conformant

ASP.Net Accessibility:
    - its the law
    - WCAG 1.0 & 2.0
    - WebAim.org
        - WAVE accessibility evaluation tool
http://wave.webaim.org/

Make XHTML compliance part of development Cycle.
    - Uses a VSTS integration test
    - need to find out more
        AspNetDevelopmentServer
        Speaks to W3C validator to determine compliance

Controlling how some commonly used controls render to HTML
- panels sometimes render as fieldsets
    default rendering is as a div
    can render as fieldsets - very useful (done by setting the GroupingText attribute)
- labels will render as a HTML label when you use the associatedcontrolid attribute (which is the correct way to do it)    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.panel.groupingtext.aspx
- use radiobuttonlist instead of radiobutton http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.radiobuttonlist.aspx

Server Controls:
    - typically can be used only within a Form tag
    - can be hacked to be used outside the Form tag
        override - VerifyRenderingInServerForm to always return true for the page
http://msdn.microsoft.com/en-us/library/system.web.ui.page.verifyrenderinginserverform.aspx
    -using multiple forms in one page:
        only one server form allowed
        use action attribute to submit to a different page
            action="page.aspx"
        use it as a client.form
        need to test this

Support for multiple browsers (increasing reach)
    - dont target browsers
        instead target standards
        set the baseline standard (typically CSS3/extensions - which is FireFox 3, Safari 3 Opera 9.5 and IE8)
        CSS 2.1 for IE7 and FireFox 2 support

Think about users who might be on slow internet connections
- use YSlow
http://developer.yahoo.com/yslow/
- use GZip Compression
- CSS sprites - need to read up on this

Progressive enhancements
    -make basic site
    -add bells and whistles (javascript, etc) later.
    -eg: shoppingg cart drop down on same page
        *created as a simple link
        *used jquery to add behavior to link to show a div containing cart details

Testing
    -unit tests
        *tests the basic unit of code
    -integration
        *combines some of the units to test them together
    -functional
        * uses whatin - a wrapper around IE
    -performance
    Mocks - RhinoMocks
http://ayende.com/projects/rhino-mocks.aspx

Thursday, June 25, 2009

Cost of living comparison tool from CNN Money

A Cost of living comparison tool from CNN Money http://cgi.money.cnn.com/tools/costofliving/costofliving.html

Wednesday, June 24, 2009

Ads – Song in Axe Dark ad

The song in the new Axe dark ad (2009) is Allen Toussaint - Sweet Touch of Love

 

Tuesday, June 23, 2009

OptiRoute Example

I used the example of points used in Leniel Macaferi blog post, to create a Google MyMap. I then used the GeoRSS feed for the map in OptiRoute to determine an optimal route to visit all the points. Copy the following url (http://maps.google.com/maps/ms?ie=UTF8&hl=en&vps=1&jsv=163d&msa=0&output=georss&msid=114327217251696325968.00046d108b526d9ca7393) and try it in OptiRoute.

As I said before, OptiRoute in an approximation for the optimal route to visit a bunch of points. Its an approximation that runs in O(n), and can handle unlimited number of points, which is its uniqueness. But because it is an approximation – it might not be the best solution possible.

image

Original Google MyMaps showing all the points.

image

The route calculated by OptiRoute to visit all the points using the GeoRSS feed: http://maps.google.com/maps/ms?ie=UTF8&hl=en&vps=1&jsv=163d&msa=0&output=georss&msid=114327217251696325968.00046d108b526d9ca7393

Monday, June 22, 2009

iPhone GeoLocation in Safari

iPhone GeoLocation in Safari uses the Safari’s new geoLocation api to retrieve the current location and in turn gets address information using Google Maps geoCoding api.

photo

var geocoder;

function initialize()
{
geocoder = new GClientGeocoder();
findLocation();
}

function findLocation()
{
if (navigator.geolocation != null)
navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
else
document.getElementById("map_canvas").innerHTML = 'Browser does not support geoCoding';
}

function foundLocation(position)
{
getAddress(new GLatLng(position.coords.latitude,position.coords.longitude));
}

function noLocation()
{
document.getElementById("map_canvas").innerHTML = 'Could not find location';
}

function getAddress(latlng)
{
if (latlng != null)
{
geocoder.getLocations(latlng, showAddress);
}
}

function showAddress(response) {
if (!response || response.Status.code != 200) {
alert("Status Code:" + response.Status.code);
}
else
{
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
var locData =
'<b>latlng:</b>' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '<br>' +
'<b>Status Code:</b>' + response.Status.code + '<br>' +
'<b>Status Request:</b>' + response.Status.request + '<br>' +
'<b>Address:</b>' + place.address + '<br>' +
'<b>Accuracy:</b>' + place.AddressDetails.Accuracy + '<br>' +
'<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode;
document.getElementById("map_canvas").innerHTML = locData;
}
}

Fiddler – Tips & Tricks

Fiddler does not capture traffic to http://localhost/

The reason that this happens is that IE does not use the entire network stack when processing traffic from http://localhost/ or http://127.0.0.1/. And because the complete stack is not used, Fiddler does not see the traffic that is being sent to these addresses. The easiest work around for this is that you use your machine name instead of localhost.

How to modify the request data that is being sent to a web-site using Fiddler.

There are many ways to skin this cat. You can write custom script, you can write a plugin, etc.

But the easiest method is to enable breakpoints in Fiddler. Fiddler will break any request and allow you to inspect and modify the request before sending it along.

Here is how:

Turn on break points for before requests:

image

Hit the web-site that you wish to modify the request off.

The minute Fiddler detects the request, it will break the request and give you a chance to modify the request.

The red icon in the web-sessions panel represents a request that has hit a break point and is waiting for your input. If you select the entry, you will find that in the right pane, it will show you options to respond to the break point.

image

Before selecting “Run to Completion”, you can modify the response headers using the TextView of the Request headers (upper right pane).

If you select “Break on Response”, you will get a chance to modify the response headers using the TextView (lower right pane).