June 2006 Entries

What... you don't know what AWWDC is? Well, make sure you're sitting down because this may come as a shock. It's the Apple Worldwide Developers Conference. *insert record scratching/squealing tires sound here*

Seeing as how I'm like Mr. Microsoft when it comes to software the most common reaction to this is probably "Woahhhhhhhhhhh, what the...?!?" Well... it's for the good of the company. Basically MacOSX has become attractive to us over the past couple of years for two reasons:

First, from the server perspective, the platform has a much richer set of APIs for working with PDF content than are available for the Windows platform. Today Mimeo's workflow is entirely PostScript today. PostScript is great for printers, but sucks for everything else we need to do. So we end up having to cobble together a bunch of third party and open source libraries to solve all kinds of problems because none of them do everything we need. Therefore we're planning on moving to a PDF workflow instead. OSX's native graphics API, Quartz, is fundamentally tied to PDF. We know that they have done (and will continue to do) a lot of work to make sure they support every possible facet of the PDF specification. Personally, nothing would make me happier than to move to an XPS workflow, and we are engaged with Microsoft to investigate the possibilities of that, but I just don't think it's going to happen because the industry support just isn't there fore the types of hardware we're using. Timing is everything and XPS just doesn't seem mature enough for Mimeo to adopt at this point... I guess we'll see.

Second, as a client platform, there's no denying that OSX usage is growing. As a small company with limited resources we kinda had to shrug it off in the past because from a business perspective we were trying to be the best at a very specific portion of the printing business: 81/2x11" business documents. The people using OSX usually have different printing needs because it is typically a much more creative crowd. :) Well with all the growth OSX has had, clearly it's not just the artist types anymore and we need to do what we can to give them the power of Mimeo.

What does this mean for me? Well, in the approximately 20hrs I've spent working with it I've learned...

  • ... more about OSX than I've ever known about any Apple platform in my life - technically it's just another *nix machine under the covers so I can use all those fundamentals, still just not a fan of the way the windowing UI works generally, but then again a lot of other facets of the UI work better than Windows
  • ... the basics of Objective-C - it's a fun language, has a lot of "funkyness" to it, very similar to COM in terms of memory management, but they have this interesting concept of an auto-release pool which is a stack based automatic memory management
  • ... the fundamentals of Cocoa - Cocoa is basically the MFC or WinForms of OSX. I know what a NIB is, what outlets and actions are, learned some of the basic patterns used in Cocoa and I've put together a working application
  • ... how to work with XCode - this is the Apple supplied IDE for OSX development which I guess is the equivalent of Microsoft's Visual Studio, but no where near as nice
  • ... how to work with Mono on OSX - I use my favorite language (C# of course ), get all the benefits of the BCL and for UI I just use Cocoa#. This has enabled me to do rapid prototyping because I avoid having to code in Objective-C right now.

In the end though I probably won't be writing the actual software that gets delivered to the desktop, since I believe we're going to outsource the work to an OSX specialist shop. However, as Chief Software Architect, I consider it my responsibility to understand and talk intelligently about the technologies involved and, ultimately know what is possible and what isn't.

From what I've learned so far, OSX is a pretty nice platform to develop for. Granted I haven't gotten down and dirty with lower level concepts like threading or IO yet, but, I'm impressed thus far.

posted Wednesday, June 28, 2006 5:29 PM | Comments | Filed Under [ Personal Apple/MacOSX ]

Marketing at it's finest (assuming you have a sense of humor). The ads around NYC were the inspiration for checking out the site. Well worth the 10 minutes of laughing you'll do. Well done.

posted Tuesday, June 27, 2006 9:26 PM | Comments | Filed Under [ Personal ]

WinFX June CTP was released recently and Tim Sneath put up a post with some details on some changes you can expect to deal with in this release. Nothing major thus far. Personally I'm all for breaking changes during the beta phase if they improve the API in the long run. :)

The coolest thing in this release isn't even an API change, but rather the addition of a visual tree view to XAMLPad! Totally cool and really helps you understand the difference between the logical and the visual trees.

Note: If you use Expression Interactive Designer religiously you probably don't want to upgrade just yet as there hasn't been a June CTP of EID release yet.

posted Tuesday, June 27, 2006 7:00 PM | Comments | Filed Under [ WinFx/Vista ]
Inspired by Craig's MSDNMan, Ian has created an MSDN browser with WPF. If, like me, you read a ton of MSDN content every day, both of these tools are extreeeemely welcome additions to browsing the online content or using the installed version of the content.
posted Wednesday, June 21, 2006 3:03 PM | Comments | Filed Under [ .NET WinFx/Vista Web Services Web Development Windows PowerShell Team System ]

Just noticed via Dare's blog that Adobe has officially responded to Microsoft's announcement that PDF will be pulled due to fears of Adobe lawsuits. Then Microsoft comes back with a reassurance that all they're trying to do is offer the best possible experience for the users that want PDFs from their Office documents and not trying to "extend" PDF.

I am embarassed for whomever at Adobe is causing this whole debacle. Microsoft is in no way trying to muck with the PDF spec. It doesn't take a lot to check the output and see that they're simply trying to offer PDF capabilities from the most popular Office Suite on the planet. Why can't Adobe just make their intentions clear? Either give it a thumbs up or a thumbs down. If thumbs down, spell out clearly why and then Microsoft can fix whatever it is you perceive as a violation of the PDF specification.

Now, people probably think I'm all pro-Microsoft on this (because I usually am :P), but really that's not the case here. I just believe it's the best thing for the users. Technically my company, Mimeo, actually loses a certain edge over the competition when Microsoft's products/platform starts outputting new print ready formats like PDF or XPS. Then again, we can also gain from it in other ways because these technologies are much richer and easier to work with than PostScript, which is what we deal with today.

posted Tuesday, June 20, 2006 2:49 PM | Comments | Filed Under [ Personal ]

Just noticed, thanks to this post over on MSDN Weblogs, that the ADO.NET vNext Documentation is back online. There's two articles to check out:

posted Sunday, June 18, 2006 6:50 PM | Comments | Filed Under [ .NET ]
Here's a really great post from Tim Cahill "WPF Performance Guy". It's Q&A style with some answers to some of the more common questions about, what else, WPF performance. Definitely worth a read if you are (or are going to be) working on graphics intensive WPF apps.
posted Friday, June 16, 2006 10:31 PM | Comments | Filed Under [ WinFx/Vista ]

I mentioned ADO.NET v3 a little while back, but all the info that leaked out was pulled. Now there's a video up on Channel9 with Anders Hejlsberg and Sam Druker on the entity features that are coming with the next version of ADO.NET. The driving technology for all of this is of course LINQ. Exciting times ahead!

posted Tuesday, June 13, 2006 1:29 AM | Comments | Filed Under [ .NET ]

Here's a great Channel9 screencast that just came out demo'ing how the typical interaction between developer and designer will work with Visual Studio and Expression Interactive Designer.

One thing about EID that I love which is demo'd here is the fact that control behavior is live in EID. That is, any behavior you've built into your controls will function, real-time, inside of the IDE. This really helps the designer visualize exactly what they're going to see/experience without necessarily having to compile and run the project.

posted Monday, June 12, 2006 10:58 PM | Comments | Filed Under [ .NET WinFx/Vista ]

Heads up on a silent breaking change that I just came across with FormsAuthentication's RedirectFromLoginPage method when migrating from ASP.NET 1.1 to 2.0. The exact message you get will be (with top of callstack):

System.Web.HttpException: The return URL specified for request redirection is invalid.
  at System.Web.Security.FormsAuthentication.GetReturnUrl(Boolean useDefaultIfAbsent)
  at System.Web.Security.FormsAuthentication.RedirectFromLoginPage(String userName, Boolean createPersistentCookie, String strCookiePath)
  at System.Web.Security.FormsAuthentication.RedirectFromLoginPage(String userName, Boolean createPersistentCookie)
... your method would be here ...

There problem here is that some part of your return URL contained invalid characters. In my case, someone was creating a return URL where the query string was not properly encoded and it contained : and / which need to be encoded as %3a and %2F respectively.

Some how we had gotten lucky all this time in 1.1 with it not being encoded properly. Guess it goes to show just how flakey URL parsing really is in general... either that or how resiliant it is. :)

posted Friday, June 09, 2006 6:03 PM | Comments | Filed Under [ .NET Web Development ]

There are a couple ways to approach structuring your Team Projects depending on what you want to accomplish (see the answer to the "Should I create a team project per application or per release?" in the FAQ). Consider the per application scenario, where you have a single Team Project with multiple trunks per-version:

$/My Project
    |- Main
    |- Version 1.1
    |- Version 1.2
    |- ... etc ...



A Team Build, by default, will apply the build label at the Team Project level (in this case $/My Project). Then, in order to gather changeset and work item details for the build report, it looks at the history of everything that has been given that label. Well, as you can imagine, this is a bit of a problem if there is concurrent development being done in the Version 1.1 and 1.2 branches since a build of one will label and gather changesets for the other.

We realized this problem today as we started a new version branch and, initially, we weren't sure if we'd be able to prevent it. Then I dug around in the team build files for about five minutes looking for a way to control this and found a solution that might work, but was reluctant to change the Team Foundation MSBuild file since I don't want to have to support changes to that on multiple build machines, dev workstations that do desktop builds, etc. So I did a search real quick and, what do you know, there is a way to fix this by only having to modify the build type's proj file. It has to do with changing where the label is applied. Instead of applying it to the Team Project level, you can actually have it apply the label to a specific subdirectory and then the report will only reflect the changes to that subdirectory. You can get the details on how to achieve this behavior with Team Build over on Manish Agarwal's blog.

posted Wednesday, June 07, 2006 6:00 PM | Comments | Filed Under [ Team System ]

Dean Edwards, a well-known name in the HTML/CSS/JavaScript world, has whipped up a little test to gauge someone's level of expertise in JavaScript. How knowledgable are you?

This got me thinking about Atlas a little. Initially I was ready to say you need to be a level 6 to even think about working with Atlas, but then I realized that the coolest thing about Atlas is that you can work purely at the server control level which requires you to know nothing about JavaScript to get a lot of work done. Of course if you intend to write your own controls or do any kind of advanced client side logic you definitely need to be a level 6 or better.

posted Friday, June 02, 2006 4:24 PM | Comments | Filed Under [ Web Development ]

Looks like Microsot is expecting Adobe to seek legal action against it based on a "break down in talks" about Office 2007's built in PDF generation. From the way the article makes it sound, Microsoft has basically already decided to pull the feature. PDF is an open standard, so I dunnuh how much of this is reality yet. This post that I read a couple of weeks ago made it sound like Adobe wasn't too concerned about it.

The story is  being discussed over on /. too. Naturally you have to peel through the layers of anti-MS bs there, but there are still some valid points being made. What specifically burns my ass about this whole thing though is the following alleged BS play by Adobe:

"Adobe wants Microsoft to remove the feature and offer Adobe's technology separately for a fee. Microsoft has agreed to remove the feature, but is unwilling to charge for it, the Journal reported."

Now, maybe MS is making a pre-emptive FUD strike, but I don't think they would blatently make something like that up. Guess we'll have to wait and see how the story develops...

Update 6/2 5:15PM:
Scoble has some more details on this story.

posted Friday, June 02, 2006 2:17 PM | Comments | Filed Under [ Personal ]

I just spent the majority of the day fixing some code that was migrated from .NET 1.1 to 2.0. The code in question does a lot of DateTime conversion with respect to timezones. The existing code would basically take the UTC date it was given and adjust it by some arbitrary number of hours representing the timezone offset for a particular facility. It also must take into account that lovely concept known as daylight savings time.

We have a class called ProductionFacility and one of the things we need to know about it is what its timezone offset is from UTC on a particular date to be able to do things like production scheduling and shipping calculations for that facility. Our logic basically looked like this:

public DateTime GetHoursOffsetFromUtc(DateTime utcDateTime)
{
// note: standardTimezoneOffset would be -5 for a facility
// on the east code
  int facilityTimezoneOffset = this.standardTimezoneOffset;
  DateTime facilityLocalStandardTime = utcDateTime.AddHours(facilityTimeZoneOffset);
  DaylightTime facilityDaylightTime = this.GetDaylightTime();
  if(TimeZone.IsDaylightSavingsTime(facilityLocalStandardTime, facilityDaylightTime))
{
facilityTimezoneOffset = this.daylightsSavingsTimezoneOffset;
  }
  return facilityTimezoneOffset;
}

The part highlighted in red is the initial problem spot in .NET 2.0 with the part highlight in orange being the piece that feels a side-effect. You see, with DateTime::Kind you can now actually tell what someone's intention was with respect to the time aspects of the instance. This is actually great! However, not so great from a conversion aspect because it can easily break existing code. In my example above the DateTime passed into the function originally comes from DateTime::UtcNow which automatically (and correctly) sets its Kind to DateTimeKind.Utc. Once you've got a date with a specific Kind, using any of the AddXXX methods results in a DateTime of the same kind. Again, this is a good thing, but something you need to watch out for when converting. The ultimate problem with the above code now though is, guess what happens when you pass a UTC DateTime to TimeZone::IsDaylightSavingsTime? Answer: You get an instant result of false.

So, to work around this, we have to convert the time to a DateTimeKind.Local. Here's the easiest way I've found to do it:

new DateTime(someUtcTime.Ticks, DateTimeKind.Local);

This will give you the same exact date and time, but now it's considered local to a specific timezone. Now if we replace the red line in the above function with the following logic instead it will fix the problem:

DateTime facilityLocalStandardTime = 
new DateTime(utcDateTime, DateTimeKind.Local).AddHours(facilityTimeZoneOffset);

Hopefully this will save someone else some time. ;)

Note: In case anyone comments without reading everything, keep in mind, I can't just use DateTime::ToLocalTime here because I'm not trying to convert to the machine's local time, I'm trying to convert to a facility's local timezone which isn't necessarily in the same timezone as the server running the code.

Update 6/1 9:50PM:
I had a feeling there had to be a better way to change a DateTime's Kind other than constructing a new instance, so I took a look at the SDK and sure enough there is in the form of a static SpecifyKind method on the DateTime structure. Really weird that it's not an instance method like all the other mutating methods, but uhh... ok. So, the red logic above can now be more easily replaced with the following:

DateTime facilityLocalStandardTime = 
DateTime.SpecifyKind(utcDateTime, DateTimeKind.Local)
.AddHours(facilityTimeZoneOffset);
posted Thursday, June 01, 2006 12:12 AM | Comments | Filed Under [ .NET ]