Nothing like a MVP award on April Fools day!

johnWeeGo.jpgWith mixed emoticons I opened an email from support@mvpaward.com today, here we go I thought, someone is having an april fools day prank, but as I read the email, clicked on the link, agreed to the NDA and received my MSDN subscription it sank in that I’m a new MVP for Windows Live!
I am totally wrapped that my contributions to the Virtual Earth community have been recognised by Microsoft.

If you have ever wanted to work with the latest in website technology and apply some location awareness to your business then go check out Virtual Earth, if your in Brisbane on the 17th come to my next presentation.

Have a look at my MVP profile here.

Cool 1/3 photo option on JASJAM

johnWeeGo.jpgYes camera phones take pretty aweful photos but i stumbled onto a cool 1/3 effect on the JASJAM while scrabling to take a photo of Darren mountain biking today.

The setting merges 3 quick photos into a single long one blending much of the photo. Since a tiny lense is never going to take pro photos i think ideas like this are great.

mtb 014.jpg

My new toy – LED Tap light

BronwenWeeGo.jpgPicked myself up one of these from Think Geek.  Fitting that goes on the end of a tap that lights up when water goes through it…and temperature sensitive to give red / blue light.

Was a bit worried about the “Not recommended outside the USA”…but it works on my Aussie tap.  YAY.  Will have to wait till night time to get some good pics of it in action.

Cancel the form being submitted in javascript

johnWeeGo.jpgI come across this trick every so often so thought it best to write it down. In the AJAX world it seems this is more and more common, why would i ever want to post back again?

If you have a textbox in a form and when the user presses enter you don’t want them submitting that form you can cancel the event in javascript.

Within your MS AJAX js class set a flag to indicate if this object was the one that submitted, then we hook the form submit event and cancel if so.

 


//in your init
this._keyPressHandler = Function.createDelegate(this, this._onKeyPress);
this._VerifySubmitHandler = Function.createDelegate(this, this.VerifySubmit);
        
$addHandler(this._Textbox, 'keypress', this._keyPressHandler);           
$addHandler($get("Form"),"submit", this._VerifySubmitHandler);
////

//two events handlers
    _onKeyPress : function(e) {
        if (e.charCode==13)
        {
            this._submitted = true;
            //do whatever you need to do on enter
        }
    }, 

    VerifySubmit: function(e)
    {
        if (this._submitted)
        {
            this._submitted = false;
            if (e && e.preventDefault) //FF
            {
                e.preventDefault();
            }
            return false; //IE
        }
    },

Setting the cache expiry on a single file using IIS

BronwenWeeGo.jpgI needed to turn on content expiration for a single file and wanted to do it through IIS so i didn’t have to write code (lazy me).  Cause i’m blind took me a while to find.

To set a single file/directory/website content expiry…

  1. Navigate to the file
  2. Right click and choose properties
  3. Choose HTTP Headers Tab
  4. Click “Enable Content Expiration”
  5. Choose the expiry you want and save

iiscache.JPG

To check it works, run a program like Fiddler, run up the site and navigate to whatever content you turned the caching on for.  Find the item and the Caching should now display something like “Expires, Sun 24 Mar etc”

I’ve installed Team Suite…how do i get to Team Foundation Server

BronwenWeeGo.jpgI installed Visual Studio Team Suite awhile back and haven’t had to use TFS yet.  So now I want to use TFS, there’s no “Connect to TeamFoundation Server” option under tools.  After looking at MSDN I discover you have to install Team Explorer.

So first, go download Team Explorer.  You’ll quickly discover it’s an IMG file.  So if you don’t have anything to extract from IMG files, go download something like ISO Buster. Extract and install away.  You should now have Visual Studio Team Foundation Server in the list of source control plug-in’s under Tools->Options->Source Control->Plug-in Selection AND a “Connect to Team Foundation Server…” option under Tools.

I found this an odd set of steps to have to do.  Anyone know why you not only have to do an extra download but have to do the weird img extraction process aswell?

SQL Server – ANSI_NULLS, null and IS NOT NULL fun

BronwenWeeGo.jpgI had a problem where i had a UDF on 2 databases with the same data that were returning different results.

The query that was running was basically:

SELECT COUNT(*) FROM Comment WHERE Date <> NULL

DB1 would give me a results of 3 and DB2 would give me a result of 0. If i ran that SQL in QA on either database i’d get 0.

It drove me nuts for ages, till I realised that the 2 databases had 1 slight difference..the UDF on DB1 had ANSI_NULLS OFF while DB2 had ANSI_NULLS ON.

So in summary, ANSI_NULLS OFF allows you to use the <> null form of a query as above, but ANSI_NULLS ON means the query should be written as follows:

SELECT COUNT(*) FROM Comment WHERE Date IS NOT NULL

As I don’t mess with the ANSI settings this one caugt me as I NEVER attempt to use the <> null version.

How to fix the video mode change for UAC

johnWeeGo.jpgI’m not going to debate the merits and flaws in UAC but here is a tip for those people that use UAC and hate the video mode change that causes that annoying flicker.

In group policy editor – gpedit.msc there is a setting to switch to secure desktop for UAC prompt. Simply disable this. Maybe UAC isn’t so bad after all

gpeditUACvideomodes.jpg

QLD MSDN User Group April presentation on Virtual Earth

johnWeeGo.jpgI am pleased to announce that I will be presenting an evening of Virtual Earth at the April meeting of the QLD MSDN user group.

If you would like to attend please come along.

So does anyone have any specific questions or topics they would covered?

Currently I’m planning to cover the following:

  • Introduction and quick demo of Virtual Earth version 4.
  • How to build a really simple VE site in 10min.
  • The limitations of the 10min site and the architecture of an enterprise Virtual Earth site.
  • ASP.NET AJAX web services and JSON for communication with server side code.
  • Clustering Virtual Earth.
  • OO JavaScript and AJAX.
  • New JavaScript features in the upcoming Visual Studio codenamed “Orcas”.

Visit http://www.qmsdnug.org/ for more information.

5:30pm for 6pm, Tuesday April 17th at Microsoft’s Brisbane Office, Level 9, Waterfront Place, 1 Eagle St, Brisbane

 

ASP.Net 2.0 Membership providers and setting the application name

BronwenWeeGo.jpgWas playing around with ASP.Net membership providers and I’d created a few users and roles and everything looked happy.  Then i ran my application and I just couldn’t log in.  Upon investigation the app thought that there were 0 users available.  What had i done wrong?

I hadn’t set the applicationName property for the provider.  So when i used the configuration tool it was adding users to the “/MyProject” application, but when i ran the app it was just using the virtual directory and looking for users in the “/” project.

So make sure you set the applicationName property when you put your provider in the web.config.

 

<providers>
    <add name="CustomizedRoleProvider"
        type="System.Web.Security.SqlRoleProvider"
        connectionStringName="SoulSolutionsDB" 
        applicationName="/SoulSolutions.TestApp.Admin"/>
</providers>