I've updated this codebase to now include the database data EMBEDDED into the dll.

Mar 20, 2009 at 2:17 PM
Edited Mar 20, 2009 at 2:20 PM
Hi folks,

now that i'm using OpenID in my ASP.NET MVC projects, I now need to use this project :) It's pretty damn good, except that it requires users to have the files in a single directory / some place, etc.

Screw that - this .dll needs to be a single dll with all the data in it.

So, instead of procrastinating, I've grabbed the code and extended it to include
  • GZipped each tz file and then embedded it to the assembly.
  • Load the database data from an embedded resource inside the dll, as default.
here's some sample code i have

ViewData[

"TimeZones"] = new SelectList(Database.GetZoneNames(), "Australia/Melbourne");

 

 

 

 

 

That's right! I do _NOT_ need to call Database.LoadFiles before i do anything. I can still call that method and it will load the data from a file or directory. Also, by default, it does not load the following files (cause i think they take up wasted space in the drop downs): backwards, etcetera, solar87, solar88, solar89, systemv.

The trick is, internally, when you try to access either the Links, Rules or Zones data (from any method or property), i auto load the embedded data if those data structures are empty.

The code has been cleaned up a lot -> i'm using reflector to do lots of the heavy-cleaning. Refactored properties to be auto-properties. Also the project is in VS2008 format.
 
Full code has been zipped and uploaded to this link here (http://www.megafileupload.com/en/file/91057/ZoneInfo-zip.html) . You guy(s) can grab it there do what u want/need. I hope it can be compared and patched into this project. I didn't upload it to the Patch tab of this projects Source Control section because i didn't know if non-project members (read: the community) can get access to it.

I based the idea of embedding the data and gzipping it (to save space in the dll -> it's 1/6th smaller than it would be if i didn't compress each file) from my previous IpAddressExtensions codeplex project (http://ipaddressextensions.codeplex.com/).

Hope this helps anyone :)
May 18, 2009 at 4:01 AM

In vb I have the code:

        Dim zone1 As PublicDomain.ZoneInfo.Zone
        zone1 = PublicDomain.ZoneInfo.Database.GetZone("America/Montreal")

        Dim d As Date = zone1.Now

        Dim ts As New TimeSpan

        ts = zone1.GetUtcOffset(d)

        Dim dates As List(Of DateTime)

        dates = zone1.GetCutoverWindows(New DateTime(1954, 1, 1, 0, 0, 0, DateTimeKind.Local), New DateTime(2009, 12, 31, 23, 59, 59, DateTimeKind.Local))

1)Why does it return in "dates"  dates startin at 04/28/1974 while in the database (at least in the compressed files) the rule start at year 1917 ?

2) How can I know which zone applies for an unknown visitor since there is no relation with TZ database Zone name and standard time zone name used in windows ?

 

Thanks

May 18, 2009 at 4:38 AM

Hi FRouleou,

1)Why does it return in "dates"  dates startin at 04/28/1974 while in the database (at least in the compressed files) the rule start at year 1917 ?

Hmm, not sure about that. Will need to check it out in a little more detail when I get a chance.

2) How can I know which zone applies for an unknown visitor since there is no relation with TZ database Zone name and standard time zone name used in windows ?

This is either really hard or impossible to do based on how you look at it.

I don't know of a windows timezone to TZ database zone name converter.

Sorry to not be too helpful on both questions.

Mark

May 18, 2009 at 5:08 AM
Thanks for a quick reply... if you can find a solution for the year 1917 problem this dll will become part of my solution.
Thanks 

On Sun, May 17, 2009 at 11:38 PM, markjrodrigues <notifications@codeplex.com> wrote:

From: markjrodrigues

Hi FRouleou,

1)Why does it return in "dates"  dates startin at 04/28/1974 while in the database (at least in the compressed files) the rule start at year 1917 ?

Hmm, not sure about that. Will need to check it out in a little more detail when I get a chance.

2) How can I know which zone applies for an unknown visitor since there is no relation with TZ database Zone name and standard time zone name used in windows ?

This is either really hard or impossible to do based on how you look at it.

I don't know of a windows timezone to TZ database zone name converter.

Sorry to not be too helpful on both questions.

Mark

Read the full discussion online.

To add a post to this discussion, reply to this email (zoneinfo@discussions.codeplex.com)

To start a new discussion for this project, email zoneinfo@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Aug 22, 2009 at 2:38 AM

@markjrodrigues Will purekrome's changes get checked in at any point? Is there still any development happening on this at all?

Aug 22, 2009 at 3:36 AM
I never received updates on this. I developed my own solution since that time.

On Fri, Aug 21, 2009 at 9:38 PM, coldacid<notifications@codeplex.com> wrote:
> From: coldacid
>
> @markjrodrigues Will purekrome's changes get checked in at any point? Is
> there still any development happening on this at all?
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com
Aug 22, 2009 at 3:50 AM

@ColdAcid : yeah :) I'm curious also! seems silly not to embed the resource and compress / uncompress it :)

Aug 24, 2009 at 2:05 AM

Hi everyone,

Sorry I have been a little inactive with this.

I am not convinced that embedding the resource file in to the DLL is the right thing.

One of the original inspirations for this project was http://www.codeplex.com/publicdomain but one of the flaws I felt it has was that every time the TZ file was updated (which was about once a month) it had to be regenerated, recompiled  and redeployed. purekrome's suggestion removes the regeneration but not the recompilation and redeployment as I understand it.

Also some people (including me) are unfortunately still on VS2005 so the 2008 project format is (selfishly) not something which is going to happen soon.

There is still the open issue from FRouleau which I dropped the ball on so sorry about that.

Mark

Aug 24, 2009 at 2:10 AM

Mark, then you should offer TWO downloads, IMO.

1) For those people who wish to be able to 'drop' in the latest file.
2) For the other people who don't care and are happy with a relatively recent version of the file.

VS2010 is nearly upon us .. so maybe now is a good time to think about upgrading. That said, it's easy to read my code and patch it into your downgraded version.

Anyways, at least my patch exists somewhere on the interwebs so for those people who DO find it a solution, it's there as an option.

/me is still shocked someone is still using VS2005. poor thing :(

Aug 24, 2009 at 2:27 AM

Hi purekrome,

Yes have pity on me. Would like nice to be a position to be using VS2008 believe me :)

As for the 2 downloads, it is a good idea. I think ideally it would be good for it to use an embedded resource but to be able to LoadFiles to pick up new ones if you were so inclined.

Let me see if I can squeeze in some time to make this happen.

Thanks again for your input.

Mark

 

Aug 24, 2009 at 2:29 AM

It's been a while since i looked at the patch I did, but I thought i had that ability (if u have a file somewhere, it would load that instead). I know it can definately be done, so that way you get the both of best worlds.

If i didn't do that .. then awesome idea! +1.

Also, u can't use VS2008 express?