03
Jul

What I’d like to see in Snow Leopard

The word is out that Snow Leopard will be about trimming down Leopard – likely Apple’s effort to switch to lower-capacity solid-storage such as found in the MacBook Air and perhaps future iPhones and maybe a tablet.

Mac OS X binaries have always been on the large size containing as they do multiple human languages and processor code (PPC, X86, X64) and it will be good that you don’t need to keep running TrimTheFat or XSlimmer to get them down.

Given this is such a system-oriented release, here’s what I want to see:

  • More detailed system information such as RAM SPD details, processor revision etc. (Manufacturers are offering faster RAM but you have to boot into Windows & run a tool to find out what you have)
  • Option for ZFS system-partition with intelligent fast compression.
  • Support for flash memory as a cache/page-file – 32GB ExpressCard’s cheap but useless on OS X.
  • Uninstaller to clean up installed/created files squirreled away in /Library etc. (Present in NextStep but had disappeared by OS X now space is a priority it’s time to bring it back.)
  • System notification API with standard responder that can be replaced by Growl for more customisation.
  • Show package contents to work on ZIP files and other supported archives. Ability to drag files in/out.
  • Core compression API to complement core video and core data API’s with plug-in ability for extra compression algorithms and archive formats.
  • Optimization of the OpenGL drivers and API to get frame-rates for Mac games on par with their Windows equivalents.
  • Smart play-lists in Font Book – come on I want a list of English fonts… or monospaced ones. Why should I have to manage them?

I’d be very surprised if Blu Ray support doesn’t show up too and it might be time for DVD Player to just become Movie Player and gain some features from QuickTime which would then become just an API and the missing authoring features exposed to CoreVideo or iMovie.

[)amien

Share with others These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • DotNetKicks
  • StumbleUpon
  • DZone
  • Reddit
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • e-mail
25
Jun

Experimental LINQ to SQL template

Whilst SqlMetal does a good job of turning your SQL schema into a set of classes for you it doesn't let you customize the code generation process.

Usefully there is now a templating system built into Visual Studio 2008 called Text Templates (T4 for short).

Here is a short (369 line) experimental proof-of-concept T4 template I wrote last night that will generate a data context and associated entity classes as a starting point similar to that produced by SqlMetal.

Download LINQ to SQL template for T4 v0.1 (ZIP) (3 KB)

Once downloaded unzip and drop the DataContext.cs.tt into your project and edit line 17 to set the connection string. You can also edit lines 18 and 19 to set the namespace and class name. The lightweight wrappers around database, table and column can be found at the end of the file - they simply wrap the SQL Server Information_Schema views as briefly as possible.

Within seconds Visual Studio should have created a code-behind file for the DataContext named DataContext.cs.cs with your generated code ready to use :) If you don't like the way the template generates your context you can change it :)

There are limitations with this experimental proof-of-concept including:

  • Processes all and only tables in the database (no views or SP's)
  • Foreign-key relationships are not implemented
  • Column attributes for IsDbGenerated, UpdateCheck and AutoSync not implemented
  • C# only (sorry Julie)
  • Plural and singular naming rules are incomplete
  • Can't modify schema as you could with a designer stage
To learn more about T4:

[)amien

Share with others These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • DotNetKicks
  • StumbleUpon
  • DZone
  • Reddit
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • e-mail
02
Jun

DamienG.com rises from the ashes

On Saturday an explosion at ISP ThePlanet took this site offline and it remained like that for 48 hours whilst power and structure were restored to the 4,000+ affected servers.

It's unfortunate it happened when the site got some DotNetKicks and StumbleUpon love for Envy Code R but at least this isn't a commercial venture losing money to such an incident - if it was I'd have a warm standby somewhere else - something many of ThePlanet's commercial customers didn't.

If downloads and images aren't working for you then you'll need to clear your DNS cache which may help the problem depending on the cache at your forwarder.

Windows ipconfig /flushdns
OS X Tiger lookupd -flushcache 
OS X Leopard dscacheutil -flushdns

This has skewed the FeedBurner stats so if you're new here and take that as any measure of popularity it was 500+ last week :)

[)amien

Share with others These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • DotNetKicks
  • StumbleUpon
  • DZone
  • Reddit
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • e-mail
26
May

Envy Code R preview #7 (scalable coding font)

Animated chart of Envy Code R styles at 10 point in Windows

It's been a struggle but finally after countless hours here it is, the next release of my Envy Code R monospaced (fixed-width) font designed for programmers.

Many glyphs have been redrawn since preview #6 including braces, lower-case y, 6 & 9, ampersand, dollar-sign, hash etc. One pixel was removed vertically height to make the box drawing balanced and allow more lines per screen.

These new box-drawing, shading and symbols make Envy Code R a great font for the command-prompt (Consolas and Lucida Console lack box-drawing completely). To use them you will need to run the included registry file and reboot to operate correctly from a command prompt's properties dialog.

This typeface contains over 550 glyphs providing full complements for DOS, Windows and Mac versions of the US, Western, Central Europe, Turkish, Baltic, Icelandic and Nordic code-pages. This hits several Unicode ranges including Basic Latin, Latin-1 Supplement, Latin Extended A & B, Box Drawing, Block Elements, Letterlike Symbols, Number Forms, Arrows... although not all of these ranges are complete yet.

As well as regular and bold variants this version includes a full italic version too and the obligatory italic-as-bold hack to get italic syntax highlighting in Visual Studio as shown here in my favourite 10 point with my Humane theme.

Envy Code R in Visual Studio at 10 point with Humane theme using ClearType

And for those of you that like the font a little larger it now looks good and the odd sizing issues are all gone!

Envy Code R in Visual Studio at 18 point with Humane theme using ClearType

Okay, enough with the teasing, you've waited far too long...

Download Envy Code R Preview #7.2 (TrueType) (178 KB)

How does Envy Code R look with your favourite scheme and IDE?

Show the world with a screenshot on your blog (linking here, thanks!)

[)amien

Share with others These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • DotNetKicks
  • StumbleUpon
  • DZone
  • Reddit
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • e-mail
23
May

Apple Store Vancouver opens tomorrow

Apple are opening an Apple Store here in Vancouver, BC tomorrow at 10:00am.

It is located in the upper level of the Pacific Center mall on the corner of West Georgia and Granville.

I'll be there tomorrow morning grabbing a DVI to Video Adapter so I can watch the small collection of English Region-2 DVD's I brought with me on a decent sized TV.

Of course if it wasn't for region coding I could use the DVD player already in the lounge... and buy a US Xbox 360 to play my 20+ existing games...

[)amien

Share with others These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • DotNetKicks
  • StumbleUpon
  • DZone
  • Reddit
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • e-mail
21
May

May 2008 checkpoint

I am now settled into my new, albeit temporary, apartment here in Vancouver, BC working for Microsoft!

Joining Microsoft

For those who haven't been following my blog long I took a job at Microsoft Canada Development Centre as a developer on LINQ to SQL. It turns out my H-1B Visa has been approved and I will be moving down to Redmond in October.

Joining a company of Microsoft's size is a daunting experience. The sheer number of people, departments, systems, procedures and intranet sites to navigate and learn plus of course the actual job of jumping into the product and seeing where we go from here. I've also been helping out a little on the forums and internal lists and getting involved in the regular scheduled update meetings.

Of course you also hear all sorts of interesting news just before it becomes public knowledge such as publishing XNA apps to Xbox Live! and Office getting ODF and PDF support.

On the personal front...

A whirlwind couple of weeks full of new employee orientation, relocating, getting lost, filling in forms, exploring, meeting a couple of hundred people and catching up with a few old friends including one from Guernsey all of which lead to a quiet blog.

There have been some personal stories of getting lost, baby sharks and falling in lakes which will be kept to email now - there's no way those 500+ subscribers are here for my personal bits! I'll be sending out an email this week so if you haven't seen something by the weekend and we're friends ping me and I'll forward you on a copy.

Some photos are up on Facebook with a few more to follow.

Envy Code R

Of course what everybody really wants to know (according to my inbox) is where Envy Code R preview #7 is.

It is coming, but every time I think I'm close to a release I find another annoying glitch all related to hinting.

Hinting is the process whereby you tell the rendering system how to shape the characters to better fit into a pixel grid. It consists of a table saying at which sizes to smooth and apply instruction plus a program that adjusts the font as a whole for a given size and then a program per-glyph that tells it how to adjust the points in relation to each other with delta hints providing modifications for specific point sizes.

It's a complicated process if you're doing it at the lowest level with a tool such as Microsoft's Visual TrueType but is made easier with a tool like FontLab Studio 5 which has an autohinter that often gets things wrong but is a lot easier to work with and works with hints at a higher level of abstraction.

Which is why I parted with $999 on FontLab and I'm going to investigate a donate option to try and recoup some of those costs.

The bold variant is the only one now requiring hinting and I'm hoping to have it done in the next 24-48 hours. The regular variant looks just great... as does italics.

[)amien

Share with others These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • DotNetKicks
  • StumbleUpon
  • DZone
  • Reddit
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • e-mail
27
Apr

Localizing MVC for ASP.NET views and master pages

Microsoft's MVC for ASP.NET is still under serious development but at the moment support for localization is a little weak. Here's one approach that works with the 04/16 source-drop.

LocalizingWebFormViewLocator class

This class helps by trying to identify language-specific versions of views, user controls and master-pages where they exist, falling back to the generic one where necessary.

public class LocalizingWebFormViewLocator : ViewLocator
{
	public LocalizingWebFormViewLocator() : base()
	{
		ViewLocationFormats = new[] { "~/Views/{1}/{0}.{2}aspx", "~/Views/{1}/{0}.{2}ascx",
			"~/Views/Shared/{0}.{2}aspx", "~/Views/Shared/{0}.{2}ascx" };
		MasterLocationFormats = new[] { "~/Views/{1}/{0}.{2}master", "~/Views/Shared/{0}.{2}master" };
	}

	protected override string GetPath(RequestContext requestContext, string[] locationFormats, string name)
	{
		string foundView = FindViewLocation(locationFormats, requestContext, name, CultureInfo.CurrentUICulture.Name + ".");
		if (String.IsNullOrEmpty(foundView))
			foundView = FindViewLocation(locationFormats, requestContext, name, "");
		return foundView;
	}

	protected string FindViewLocation(string[] locationFormats, RequestContext requestContext, string name, string cultureSuffix)
	{
		string controllerName = requestContext.RouteData.GetRequiredString("controller");
		foreach (string locationFormat in locationFormats) {
			string viewFile = string.Format(CultureInfo.InvariantCulture, locationFormat, name, controllerName, cultureSuffix);
			if (HostingEnvironment.VirtualPathProvider.FileExists(viewFile))
				return viewFile;
		}
		return null;
	}
}

Using the class

To use the class you must set the ViewLocator on the WebFormViewEngine to a new instance of LocalizingWebFormViewLocator (either in the constructor or in your common controller subclass) and ensure that any master pages are specified on the RenderView calls to ensure the localized version is detected.

public class HomeController : Controller
{
	public HomeController() {
		((WebFormViewEngine)ViewEngine).ViewLocator = new LocalizingWebFormViewLocator();
	}

	public ActionResult Index() {
		return RenderView("Index", "Site");
	}

	public ActionResult About() {
		return RenderView("About", "Site");
	}
}

You must also ensure the thread's current UI culture is set. The easiest way to do this is to specify the following in your web.config file's system.web section which will pick it up automatically from the user's browser settings via the HTTP language-accept header.

<globalization responseEncoding="UTF-8" requestEncoding="UTF-8" culture="auto" uiCulture ="auto" />

MVC for ASP.NET default page in pseudo-Japanese via the Babelfish
Then all you need to do is create views and master pages that have the culture name appended between the name and .aspx, e.g:

/Views/Home/Index.aspx (common fall-back for this view)
/Views/Home/Index.ja.aspx (Japanese view)
/Views/Home/Index.en-GB.aspx (British English view)

/Views/Shared/Site.Master (common fall-back for this masterpage)
/Views/Shared/Site.ja.Master (Japanese masterpage)

Caveats

There are some limitations to this solution:

Only primary language is attempted

Only the user's primary language specified in their browser is attempted despite browsers having a complete list in order of preference. Ideally we would scan down this entire list before giving up but that would need more code and there is the issue of whether scanning for several languages across several folders could be too much of a performance hit.

Specifying the masterpage on RenderView

It would be nice if you didn't have to specify the masterpage on renderview but if you do not then the ViewLocator never gets called to resolve the actual masterpage address. This may be for backward compatibility within MVC.

Creating files in Visual Studio

Visual Studio 2008 seems to get a little confused if you create a Index.ja.aspx or Site.ja.aspx - whilst the files are created okay the names are not and you will need to adjust the class names to ensure they don't conflict and make sure the opening declaration on the .aspx file points to the right code-behind page and inherits from the correct name.

Of course the beauty of this approach is you can mix-and-match using dedicated views where required and localising labels in the fall-back view when it isn't.

[)amien

Share with others These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • DotNetKicks
  • StumbleUpon
  • DZone
  • Reddit
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • e-mail
24
Apr

Boot Camp 2.1, VMware Fusion 1.1.2 and MacBook Pro firmware

Boot Camp 2.1

Apple have released Boot Camp 2.1 which finally includes official 64-bit support on Vista and support for Windows XP Service Pack 3.

This update may mean that 3D games will play without locking up or installing NVidia's own drivers and that the trackpad functions correctly again (broken since Boot Camp 1.x)

MacBook Pro Firmware 1.5.1

Apple's MacBook Pro Firmware Update 1.5.1 applies to all recent MacBook Pro's including the ones with MBP31.0070.B05 firmware that the 1.5 update failed to upgrade leaving 17" owners on MBP31.0070.B07.

The new firmware does not fix a problem where trackpad input would become jerky after suspending/sleeping and turning Airport off would make matters worse. 10.5.3 has fixes for Airport after sleeping which might solve the issue...

VMware Fusion 1.1.2

VMware Fusion 1.1.2 is just out and includes a host of fixes and improvements including:

  • Windows XP Service Pack 3
  • Network and USB compatibility
  • Time Machine compatibility

Now that VMware lets Time Machine backup the VM image file and that Time Machine backs up modified files in their entirety you might want to exclude ~/Documents/Virtual Machines it unless you fancy loosing several gigabytes per hour whilst using a VM. Of course if you have your VM running off it's own partition to allow Boot Camp too then that's not an issue.

With any luck VMware will figure out a way of Time Machine backing up changed individual files within the Windows filesystem...

[)amien

Share with others These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • DotNetKicks
  • StumbleUpon
  • DZone
  • Reddit
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • e-mail