Links: ASP.NET, ASP.NET AJAX, IIS7, Visual Studio, Silverlight, .NET

August 30, 2007 19:40 by MartinHN

Scott Guthrie, has posted some new and great links for some of his technologies. Scott always give a good introduction to new technology as well. He's doing some series on LINQ, and you can find a lot of great tips and tricks, in his ASP.NET 2.0 Tips, Tricks, Recipes and Gotchas series - don't hesitate to leave a comment - he works really hard to answer most of them. Great!


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Add to: Facebook Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Technorati

Content Aware Image Resizing

August 30, 2007 19:22 by MartinHN

We've all been there. You have an image which is too big to fit on the website, and it needs to be resized or cropped. Resizing can make your image look bad in quality, because of the pixels getting merged. This can make things impossible to see, and your image is damaged. Cropping on the other hand, removes the pixels completely, and sometimes you just don't want to remove things from an image - sometimes you need the entire content of the image.

Your solution is here. I found it at Channel 8 and there is a Youtube video referenced, where you can watch the algorith in action. It even enables you to enlarge an image beyond it's original size without dropping in quality. That is so cool.

Technorati Tags: ,

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Add to: Facebook Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Technorati

Brad Abrams' Silverlight speaking in SecondLife

August 30, 2007 08:14 by MartinHN

I just read Brad Abrams' blog post about his Visual Studio 2nd Life Speaker Series: Silverlight, which will take its place in SecondLife. So I just logged in to SecondLife and found the place, and it looks awesome. Here is a picture of the conference room as it look like now:

image

Great yer?

As you can see on the picture, the event takes place today at 3 pm SLT - so be there if possible. It's great fun!

Technorati Tags: ,

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Add to: Facebook Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Technorati

Fiddler2 and the ASP.NET Development server (Cassini)

August 29, 2007 23:33 by MartinHN

If you're debugging ASP.NET apps, it can sometimes be an advantage to be able to see the actual requests, and analyze file sizes, run-time rendered code and being able to 'fiddle' with the code on run-time. Well. Fiddler2 provides extremely useful features for doing so, but for people using the ASP.NET development server (Cassini) you have to do a few workarounds...

I'm running IE7 on Windows Vista (a great OS). IE7 automatically bypasses proxies for localhost, which is our main problem. When using the ASP.NET development server (Cassini), the URL looks like this one: http://localhost:49950/app/Default.aspx. When you open Fiddler2, you see that it hasn't monitored the traffic to the localhost address. This can be fixed by applying a period (.) after localhost. So change the URL to this:  http://localhost.:49950/app/Default.aspx

In my case, that wasn't enough. I got an error from Fiddler2 in my browser. If I disabled Fiddler2, it worked just fine. Then I added a rule to Fiddler2. To do this, in Fiddler2 go to Rules > Customize rules. (or hit CTRL + R). Find the OnBeforeRequest event-handler, and add the following code:

if (oSession.host.substr(0, 10)=="localhost.")
{
         oSession.host=oSession.host.replace("localhost.", "127.0.0.1");
}

Now - when you want to use Fiddler, just add a dot right after localhost in the URL, and Fiddler will start working!

That worked for me - hope it works for you too, if you're having problems.


Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Add to: Facebook Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Technorati
Tags:
Categories: ASP.NET | C# | Cassini | Fiddler2
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Set the DataTable.Locale property - or get weird sorting

August 29, 2007 21:02 by MartinHN

If you have a monster of an ASP.NET app, and your user come from different places in the world, they are most likely to have different locales as well. I'm danish, and we have three special characters in our alphabet - æ, ø, å. If I have a DataTable with - let's say firstname and lastname columns. I create my DataTable like this:

      DataTable dt = new DataTable();
      dt.Columns.Add(new DataColumn("Firstname", typeof(string)));
      dt.Columns.Add(new DataColumn("Lastname", typeof(string)));
      dt.Rows.Add(new object[] { "Øjvind", "Jensen" });
      dt.Rows.Add(new object[] { "John", "Nielsen" });
      dt.Rows.Add(new object[] { "Åse", "Østergaard" });

This is how I DataBind my GridView:

      if (!Page.IsPostBack)
      {
        GridView1.DataSource = dt.DefaultView;
        GridView1.DataBind();
      }

With my regional settings on my machine (which in this case is also the webserver) we get the correct sorting:

image
The GridView sorted by Firstname ascending.

But if I go ahead and change the settings of my machine, to English (United States), my GridView will look like this, when I sort it by Firstname ascending:

image

This is because the server compares the strings wrong. So if you're dealing with users from around the globe - you have to set the Locale property of the DataTable - this is done like this:

dt.Locale = System.Globalization.CultureInfo.CurrentCulture;

Now this I cannot test on a single machine. This is because the above code takes the CultureInfo of your machine, and since I just changed my regional settings, I get the GridView sorted wrong. So I fired up my old laptop, this time with FireFox the GridView looks like this:

image

From a user perspective, a GridView sorted incorrectly is very bad. So to add this single line of code is really not a big deal.

Technorati Tags: , , ,

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Add to: Facebook Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Technorati
Tags:
Categories: ASP.NET | C#
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

Some very cool project on CodePlex

August 9, 2007 23:41 by MartinHN

As a .NET developer, you must be familiar with CodePlex. There are some great projects there - I like to surf around and see what other developers are doing, and try some of the products. I've found a lot of things from CodePlex useful, so here are my top 3...

The patterns & practices team at Microsoft has several project on CodePlex. A lot of software factories - but the main one is the Enterprise Library which is a huge help, when you want something done without having to re-invent a lot of stuff... Also listen to this .NET Rocks podcast with David Hayden, explaining the Enterprise Library in more detail.


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Add to: Facebook Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Technorati
Tags: ,
Categories: C# | CodePlex
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Powered by BlogEngine.NET 1.4.0.0
Theme by Mads Kristensen

About the author

Martin Høst Normark

Senior Frontend Developer at TraceWorks.

View Martin Høst Normark's profile on LinkedIn

Recent comments

Comment RSS

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in  anyway.

© Copyright 2008