It's 2008. Where's my flying car? RSS 2.0
 Monday, September 01, 2003
Samples from TechEd Malaysia should be posted by the end of this week due to lack of Internet access.
Monday, September 01, 2003 2:35:21 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [1] - Trackback
TechEd Malaysia
 Thursday, August 28, 2003

With TechEd Malaysia done, Patricia and I now have a bit more than 2 weeks of vacation! Today we fly to Saigon (Vietnam) and tomorrow from there for 4 days to Siem Reap (Cambodia) to see the temples of the sunken capital of the Khmer empire in Angkor. Then we’ll fly back to Thailand to spend 1 ½ weeks in a beach resort and finally we fly home after another one night stop in Bangkok. This is going to be great fun.

Thursday, August 28, 2003 6:38:13 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [6] - Trackback
Other Stuff
 Wednesday, August 27, 2003

Although we had an excessive first night here in Kuala Lumpur (getting strangers drunk on arrival seems to be some sort of tradition around here), that wasn't the reason for me showing up 15 minutes late for my first talk about "Building Distributed .NET Applications" this morning at 9:00am (then 9:15am) here at TechEd Malaysia. The notification about session slot change somehow either just didn't find its way into my inbox or it fell victim to the Sobig.F mail sweeping. Whatever happened... it seems all people in a full room did indeed patiently wait for me while I rushed from the hotel to the session room. Thank you! Being late to a session at a conference was definitely a (bad) "first" for me and is doubleplusungood to happen to a German. The session ended up going really well and I will post the related samples tomorrow together with the sample for the session on aspects.

The second session was a fun chalk talk with Tim Huckaby about the same topic area. As the lead example for a loosely-coupled, distributed system I used dasBlog and its interactions with other blog engines and moved on to explain how the architectural mesaures taken there could be used for more "traditional" enterprise software scenarios. Core message: asynchronous is good!

Wednesday, August 27, 2003 2:05:49 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [1] - Trackback
TechEd Malaysia
 Thursday, August 21, 2003

The Sobig.F worm is hitting massively. My inbox. While we have all shields up at newtelligence for virus-protection, a bunch of people who have my email in their contacts obviously don't. Since yesterday evening I had to clean out at least 300-400 mails from my inbox that were generated by the worm. By average, I am currently getting a (formerly, pre-scan) infected email every 4-5 minutes. It's f***ing annoying.

Thursday, August 21, 2003 5:15:23 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [3] - Trackback
Other Stuff
 Wednesday, August 20, 2003

While I wasn't looking, Doug Purdy, who is the PM for the team in charge of the XmlSerializer has posted this little cryptic answer to my initial question:

String serializedDateTime = XmlConvert.ToString( someDateTime );

DateTime deserializedDateTime = XmlConvert.ToDateTime( serializedDateTime );

What Doug is showing is really what the serializer is doing with dates under the hood and that I am incorrectly blaming the XmlSerializer for the lack of UTC support. [XmlConvert.ToString() also does nothing more than calling DateTime.ToString() with the appropriate format string]. As I was already saying in yesterday's post, but what I want to make a bit clearer here again is that the actual problem is the lack of time-zone awareness in DateTime.

So the proper thing more me to do is to ask the base-class library team for time-zone support in the base-class library for Whidbey so that Doug can fix this for us ;)

Wednesday, August 20, 2003 6:43:30 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [2] - Trackback
XML | CLR
 Tuesday, August 19, 2003

I posted a little question here, just asking "Why?". For your reading convenience, I pull the code in here once more:

DateTime issued;

[XmlIgnore]
public DateTime IssuedUtc
{ get { return issued; } set { issued = value; } }

[XmlElement("issued")]
public DateTime IssuedLocalTime
{ get { return Issued.ToLocalTime(); } set { Issued = value.ToUniversalTime(); } }

So, indeed, why am I doing this? Well, when I decided to normalize all times handled by the backend engine of dasBlog into the UTC timezone, I really didn't think of the XML Serializer being a problem at first. It turned out to be one.

The reason why I wanted all times to be handled internally as UTC is quite simple: Too many time zones to deal with and I need to have a proper reference to do forward and backward time calculations. dasBlog deals with four time-zones:

  • "Reader Time": The "<%userWhen%> macro emits a block of script that will cause the browser to emit the time of a post local to the reader's time zone. That one is easy, because the calculation happens on the client, but I need to feed it UTC (GMT).
  • "Display Time": This is the time zone the blog owner selects for his/her blog. All times displayed on the weblog pages are shown in that time zone (complete with the TZ name and the GMT offset). This also applies to the "admin pages" such as referrals and events (which both roll over in synch with the display time zone). Display time is calculated dynamically and you will notice that it also automatically adjusts for daylight savings time. The display time zone is also by no means fixed. If the blog author travels (and you will see this on my blog starting next week), he/she can adjust the blog to his/her present time zone. When I am going to be at TechEd Malaysia, my blog will show UTC+0800. To make this time-zone shifting work, the absolute time must be stored in UTC.
  • "Engine Time": This is UTC. All of the dasBlog runtime handles everything in UTC.
  • "Server Time": Now were getting to the point. The engine runs on a server that has it's own local time zone setting: "server local time". That's something that the user who's running his engine at some ISP can't control and that's the one of all the time zones that really nobody is ever interested in. You shouldn't care whether your blog is hosted in Germany, the U.S. East Coast or Singapore. That's even more of an issue because one could expect that hosted sites may get moved around between ISP locations. The only little thing we're interested in is that the server knows its offset to UTC.

So ... I was thinking.... ask for DateTime.Now.ToUniversalTime(), handle everything in UTC from there on and everything's good. (Btw, I know about DateTime.UtcNow, but I like the expressiveness of this better).

What I wasn't considering is the way the XmlSerializer works, which I am using both for storage and for the various web services (including the Atom feed). What I also found is that the DateTime class in the framework isn't time-zone aware.

The workaround above is used because the XML Serialization infrastructure always assumes local time ("Server time") for serialization and will always emit ISO 8601 dates with a time-zone suffix like this: 2003-08-19T15:15:58.0781250+02:00. So when you are handling UTC times internally and use them blindly with XML serialization for both storage and web services, the serializer will assume you are using local time and throw you off by your own time-zone difference to UTC.

This isn't "too bad" when you store stuff in local XML files, because when you write something wrong from the same place you read it back into and your time-zones don't change you are in ok in memory, but you are nevertheless wrong on disk. What happened to me in dasBlog version 1.1 was that I was thinking that I stored UTC, but in fact I stored everything in local time. My UTC time 2003-08-19T15:15:58 always turned into 2003-08-19T15:15:58+02:00, because the DateTime class doesn't keep time-zone information around that the serializer could use. Therefore the serializer must always assume local time and that causes the offset to be emitted. That's of course much worse for UTC+12.

The fix:

The field  DateTime issued; holds the "engine time", which is always UTC. 

The property

[XmlIgnore]
public DateTime IssuedUtc
{ get { return issued; } set { issued = value; } }

wraps this value and is the property that the engine works with internally. The XmlSerializer is instructed to ignore this value in the serialization process by declaration of the [XmlIgnore] attribute. Instead, we tell the serializer to look at the following property, which is not used by the engine itself and also indicates that by its name suffix "LocalTime", which essentially declares it as "off limits" for direct access to everyone knowing the project:


[XmlElement("issued")]
public DateTime IssuedLocalTime
{ get { return Issued.ToLocalTime(); } set { Issued = value.ToUniversalTime(); } }

This property is the one that the serializer grabs and it does the proper conversion to and from server local time that the serializer requires. The actual dasBlog code is using a variant of this property that is a bit larger in code size because it also checks for DateTime.MinValue and DateTime.MaxValue occurrences, which, depending on the server time zone, would cause the time zone shifting to fail with an overflow/underflow exception (and no, I am not checking near MinValue and MaxValue):

[XmlElement("Date")]
public DateTime DateLocalTime
{
   
get
    {
      
return (DateUtc==DateTime.MinValue||DateUtc==DateTime.MaxValue)?
               DateUtc:DateUtc.ToLocalTime();
    }
   
set
    {
        DateUtc = (
value==DateTime.MinValue||value==DateTime.MaxValue)?
                  value
:value.Date.ToUniversalTime();
    }
}

So, that's why.

Be aware that all of this applies to ASP.NET Web Services, too, and if you are dealing with multiple time zones are you are using UTC normalized times in your app, you will have to deal with this. If "server time" makes you happy, you won't need to worry.

Tuesday, August 19, 2003 11:41:11 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [2] - Trackback
XML | CLR

Ok, I couldn't resist getting the Arabic support (mostly) right. Malek helped me and by what he tells me, we've succeeded mostly. There are a few things left to do around wildly wrapping symbol characters, but that'll be worked out eventually.

So, this little patch updates dasBlog with French, Russian and Arabic, including full right-to-left reading support, which the engine injects appropriately into the <body> tag (dir="RTL") based on a hint in the Arabic resource table.

Tuesday, August 19, 2003 6:15:58 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [3] - Trackback
dasBlog
 Monday, August 18, 2003

On the download site I posted add-on packs for French language support and the first steps toward Arabic language support, which are the string tables. My friend Malek Kemmou from Morocco wants to help me figuring out how we can make right-to-left reading work "magically" and without having to rework all the templates. He also did those two translations. Thanks!

Update: I added a first attempt at generic RTL support to my private build and installed it here. If the primary language is set to any of the Arabic language variants, the page will flip into RTL reading. There are some issues around formatting to be worked out, though.

Monday, August 18, 2003 3:28:42 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [1] - Trackback
dasBlog

The workspace is maxed out at the current 20 users. I already submitted the form to ask for more users (the largest decimal number it takes is 99 so I went for that) and I really hope that there's someone at the other end of that form. GDN team, are you listening?

Update: Fixed.

Monday, August 18, 2003 1:36:07 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [2] - Trackback
dasBlog

I just posted newtelligence dasBlog version 1.2.3230.0 to the GotDotNet workspace and to the download section on the dasBlog site.

With this drop, I now have a feature set that makes me happy for my own blog and which some of you out there hopefully find useful for your own blogs. It’s been 5 weeks that were a lot of fun and I learned a lot about other user’s requirements through the feedback that I’ve gotten in the three weeks that the code has been public now.

And with this drop, I will therefore also stop the feature rush and likely not post more than fixes or updates to the language files and templates. Don’t expect significant new features from me in the upcoming weeks. What that means is clearly that I expect that something happens in the GotDotNet workspace from people other than me. There’s been a lot of complaining in the BlogX workspace about BlogX being stalled in terms of features and that the code-base has been locked and checked out the whole time. So, there you go: dasBlog is not checked out and open for all workspace members to change. I am going to be on the road for 3 1/2 weeks starting Wednesday, so don’t expect me to organize anything in the workspace or watch it. It’s yours. I’ll delegate accepting new members and begging to Microsoft for more workspace resources to someone around here, but that’s about it.

That also means that my private copy I am carrying around on my notebook is now forked off from the main code base and is going to be my own private little playground for new things to try.

Even if you are not at all interested in running the software as-is, you may want to go and grab the code base, because I am sure there’s a lot of useful little things in there if you are developing ASP.NET apps. It turned out to be so much new code and so many new little utilities and tricks that I could hardly keep track of the “new new” things, let alone document them. There’s a lot of fodder for articles, tips and tricks columns or for highlighting aspects here on the blog.

One thing you’ll find digging into the code-base is that almost always when there’s something that doesn’t need to be done synchronously, I don’t do it synchronously. Every referral gets queued up in an in memory queue and is written to the referrer-log on a secondary thread. All mail notifications, pingbacks, trackbacks and the pining of weblogs.com and blo.gs are also done on secondary threads.

You’ll also find that the little drop-shadows on the configuration page for the content-filter are neither rendered by IE, not will you be able to find the displayed images anywhere in your site’s directories. Instead, the drop shadows are all dynamically rendered. The magic is done by the “ShadowBox” control that’s in the newtelligence.Web.UI.WebControls assembly. You can configure the shadow depth, the background color onto which the shadow is to be rendered, etc.

The DHTML editor is also a reusable component from that assembly. It loads its toolbar from an embedded resource using the same technique: The ControlImageHandler class is an IHttpHandler which is capable of redirecting requests for images back to the controls that rendered the image links. So, in essence, you get something similar to Windows Forms’ OnPaint() support for WebControls.

There’s a complete (and working) implementation of a class WindowsTimeZone, derived from System.TimeZone and a matching WindowsTimeZoneCollection that grabs all the time zone information known to Windows and exposes that in a .NET Framework compatible way, including daylight savings time and all that.

The UrlMapper is a generic component that lets you use regular expressions to filter incoming URLs and map them to internal URLs, which comes very handy if you change a site’s structure around, MailToWeblog contains a five-liner showing how to create thumbnails from images, …

…. many things to explain in more detail and so little time. Stay tuned. ;)

Monday, August 18, 2003 7:17:45 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [3] - Trackback
dasBlog
 Sunday, August 17, 2003

I am sure it's a coindicence, but every once in a while I get referrals from some invisible site inside www.iaea.org.

Therefore, I hereby declare that I support only "Atom the XML format" and not "Atom the bomb". My house is open for inspections, if you guys think that's necessary.

I hope that keeps me out of trouble. 

Sunday, August 17, 2003 5:48:57 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Other Stuff

The language list is growing; Tom Mertens and Bart Vermeersch both sent me Dutch string tables for inclusion in dasBlog 1.2. One is going to be the default for Dutch and Dutch (Netherlands) and the other is going to be the default for Dutch (Belgium).

Bedankt! Site updated.

Sunday, August 17, 2003 4:51:17 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
dasBlog
Stuff
About the author/Disclaimer

The content of this site are my own personal opinions and do not represent my employer's view in anyway. In addition, my thoughts and opinions often change, and as a weblog is intended to provide a semi-permanent point in time snapshot you should not consider out of date posts to reflect my current thoughts and opinions.

© Copyright 2008
Clemens Vasters
Sign In
Statistics
Total Posts: 717
This Year: 11
This Month: 2
This Week: 0
Comments: 1219
Themes
Pick a theme:
All Content © 2008, Clemens Vasters
DasBlog theme 'Business' created by Christoph De Baene (delarou)