Gypsy女郎的大秘密











Presebted by Rodney Lake (Spectra Data Solutions)

Date: 20/02/2008
Gather at 5:45, starting at 6:00
Catering: Pizza & Drinks
Venue: Olympic Software, 10 Cawley Street, Ellerslie, Auckland
Regiester here: Ellerslie DNUG or Dot Net NZ(we really want to have an idea of the number)

Are you curious about .Net programming? This presentation is a back-to-basics introduction to programming in the .Net Framework.

Topics will include:
• An brief introduction to Visual Studio
• The difference between VB.Net and C#
• The difference between ASP.Net and Windows Forms
• Introduction to the Base Class Library
• Introduction to the Common Language Runtime
• Emerging and future technologies
• Your questions, no matter how dumb… :)



A sales guy forwarded this to me, haha. Good introduction to everything.

Silverlight 1.1 Fun and Games



Both WebResource.axd and ScriptResource.axd give an error at System.Web.HttpCachePolicy.UtcSetLastModified(DateTime utcDate) method, as shown below:

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.

Parameter name: utcDate]

System.Web.HttpCachePolicy.UtcSetLastModified(DateTime utcDate) +3258643
System.Web.HttpCachePolicy.SetLastModified(DateTime date) +47
System.Web.Handlers.ScriptResourceHandler.PrepareResponseCache(HttpResponse response, Assembly assembly) +194
System.Web.Handlers.ScriptResourceHandler.ProcessRequest(HttpContext context) +1154
System.Web.Handlers.ScriptResourceHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

First, look for the simple. If it’s your machine’s date time is in the past (or the future), then it is easy to fix. Just change your system clock.

In our case, it is not that straight forward. We have moved the time forward for a while, and ASP .NET 2.0 SP1 was installed while the time is in the future. So basically the assemblies and GAC modified date time is in the future. AJAX does not like it. I guess it is a bug.

We wanted to uninstall and reinstall SP1, but windows does not allow us to remove it. So we click “change” instead of “remove” in Add/Remove programs. Not sure what did windows do, but magically it works. It probably update all the installed dlls, so the modified date times are corrected.

Otherwise, we may have to “touch” all the files… :(



{十二月 19, 2007}   Ellerslie .NET User Group Website

http://www.ellerslieusergroup.net.nz/
Here is our Silverlight 1.0 DNUG website!



Yesterday we have deployed a Silverlight 1.0 application onto a Window Server 2003 machine. The deployment seems very easy (well you only need to create an application in IIS), however when we try to load the application, the screen was blank.

We need to add new MIME type for the application to recognize XAML:

Properties > HTTP Headers Tab

Clicks “MIME Types…”, and click “New”
Add extension “.xaml” with type “application/xaml+xml”



{十二月 11, 2007}   2008 Summer Road Trip – Auckland

Date and time:
Monday, 4 February 2008 at 1:00 p.m.

Hosted by:
Jacqui Chow (ya apparently that’s me!)

Location:
Auckland Institute of Technology, Ground Floor, Wright Stevenson House 585 Great South Road, Penrose, Auckland

Summer is here! And with it is coming new technology from Microsoft that will affect how we design and build infrastructure and applications.

Come and join Chris Auld and Jeremy Boyd along with local, Alex Henderson, as they set up a solution entirely on Windows Server 2008, SQL Server 2008 and host an application built in Visual Studio 2008 and .Net 3.5 over a two hour period.

The application show cases all the latest features of these products including Virtualization, IIS, Spatial data, web and HTTP programing, and much more to demonstrate how these products will affect technology professionals (both infrastructure and developers) in the next couple of years.

There will be some very cool spot prizes and give aways on the day, and by registering and turning up on the day you will go into the draw to win one of three Windows Home Servers (to be drawn at the end of the road trip on Feb 21).

To register for the road trip, click here, enter your details (plus any friends you want to invite) and click register.

Doors open at 1pm, presentation starts at 1:30pm and the presentation will be done by 3:30pm.

Come along and meet your peers and learn about the latest technology and maybe even win a (very cool) prize – for free!

Dont forget to register at http://www.dot.net.nz/Default.aspx?tabid=113!

See you there!



{十一月 29, 2007}   .NET AJAX fail in FireFox

In short, if the following line exists in your web.config, REMOVE IT!!!

<xhtmlConformance mode="Legacy" />

It is in confiugration\system.web.

By default when you convert a VS2003 web project to VS3005, the legacy switch is added to your web.config automatically. I have found some background information about this magical line (click here).



{十一月 27, 2007}   Javascript Hashtable

I can’t remember where did I find this so I cannot put the reference here.

function Hashtable(){    this.clear = hashtable_clear;    this.containsKey = hashtable_containsKey;    this.containsValue = hashtable_containsValue;    this.get = hashtable_get;    this.isEmpty = hashtable_isEmpty;    this.keys = hashtable_keys;    this.put = hashtable_put;    this.remove = hashtable_remove;    this.size = hashtable_size;    this.toString = hashtable_toString;    this.values = hashtable_values;    this.hashtable = new Array();}                /*=======Private methods for internal use only========*/

function hashtable_clear(){    this.hashtable = new Array();}

function hashtable_containsKey(key){    var exists = false;    for (var i in this.hashtable) {        if (i == key && this.hashtable[i] != null) {            exists = true;            break;        }    }    return exists;}

function hashtable_containsValue(value){    var contains = false;    if (value != null) {        for (var i in this.hashtable) {            if (this.hashtable[i] == value) {                contains = true;                break;            }        }    }    return contains;}

function hashtable_get(key){    return this.hashtable[key];}

function hashtable_isEmpty(){    return (this.size == 0) ? true : false;}

function hashtable_keys(){    var keys = new Array();    for (var i in this.hashtable) {        if (this.hashtable[i] != null)             keys.push(i);    }    return keys;}

function hashtable_put(key, value){    if (key == null || value == null) {        throw 'NullPointerException {' + key + '},{' + value + '}';    }else{        this.hashtable[key] = value;    }}

function hashtable_remove(key){    var rtn = this.hashtable[key];    this.hashtable[key] = null;    return rtn;}

function hashtable_size(){    var size = 0;    for (var i in this.hashtable) {        if (this.hashtable[i] != null)             size ++;    }    return size;}

function hashtable_toString(){    var result = '';    for (var i in this.hashtable)    {              if (this.hashtable[i] != null)             result += '{' + i + '},{' + this.hashtable[i] + '}\n';       }    return result;}

function hashtable_values(){    var values = new Array();    for (var i in this.hashtable) {        if (this.hashtable[i] != null)             values.push(this.hashtable[i]);    }    return values;}

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }



I keep things simple in this blog, because when I search on web, I would like to find simple explanations and examples, not a sophisticated one. I can write a sophisticated one once I know the basic.

It is easy to load another xaml onto the existing one -  if you have not use 1.1 before 1.0. Since I have developed 1.1 first, I actually found it confusing in the first place, anyway.

Here is a simple Page.xaml, named “Page”, have a canvas, and a TextBlock:

<Canvas    xmlns="http://schemas.microsoft.com/client/2007"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    Width="970" Height="616"    Background="White"    x:Name="Page"    > <TextBlock x:Name="RandomButton" Width="36.258" Height="14.1" TextWrapping="Wrap" Canvas.Left="19.639" Canvas.Top="110.283">    <Run FontFamily="Arial" FontSize="12" FontWeight="Bold" Foreground="#FFFFFFFF" Text="Random"/>  </TextBlock></Canvas>

In the javascript “code behind” I add an event listener to the RandomButton textblock. I want to load Random.xaml onto this page when I click on RandomButton.

if (!window.Trash)    window.Trash = {};

Trash.Page = function() {}

Trash.Page.prototype ={    handleLoad: function(control, userContext, rootElement)     {            this.control = control;            this.root = control.content.findName("Page");            this.RandomButton = control.content.findName("HomeButton");            this.RandomButton.addEventListene("MouseLeftButtonUp", this.Random_onMouseLeftButtonUp);    }}

We are going to send request for the xaml, and add it to the page asynchronously after it is loaded.

Trash.Page.prototype.Random_onMouseLeftButtonUp = function(sender, e){    Control_Send(sender.getHost(), "Random.xaml");}

function Control_Send(host, control_path){    var downloader = host.createObject("downloader");            downloader.addEventListener("completed", Control_DownloaderCompleted);    downloader.open("GET", control_path);    downloader.send();}

function Control_DownloaderCompleted(sender, e){    var xamlItem = sender.getResponseText("");

    var host = sender.getHost();    var page = host.content.findName("Page");       var control = host.content.createFromXaml(xamlItem, true);

    page.children.Add(control); }

That’s it!



I found my year IV project final report online. I looked through it, and it’s very funny. As usual, my project partner implemented the back end C++ logic – decoding a strange string into a tree, and I do the front end GUI.

The hardest part was drawing tree correctly on the screen. Branch lengths have to visually tell the distant between the nodes. It requires quite a bit of Maths to calculate the drawing branch length, and have to fit them all on the screen. It was also quite interesting implementing tree traversal, i.e. moving up (towards the root) and down (towards the bottom). 

Anyway, if anyone interested, here’s the link:

http://www.ece.auckland.ac.nz/~PIVprojects/archive/reports2004/pdfs/ccho096.pdf



et cetera