Thursday, March 27, 2008

IE8 length property not implemented - Follow up

As I said on an earlier post on IE8 the length property of the attributes object throws an "Not Implemented" exception.

After sending a message to the IE8 newsgroup on the 11th someone posted the bug on the IE8 Feedback site.

Please, vote for it, so it can get fixed soon.

Wednesday, March 26, 2008

SQL Server 2000 Rounding Errors

As I told in another article, the company I work for is installing an ERP software and I was given the task of migrating the invoice data from the old database to the new one.

Although both databases are SQL Server 2000 I got stuck with a rounding problem because the datatypes used by the databases are different.

On our old database we use the money datatype while the new database uses the float datatype.

I don't know how the ERP software deals with the values internally because they use yet another layer between the software and the database server, but the rounding problem remains.

I did some testing and came up with the table below.

As you can see there are some roundings that the float datatype does not handle very well.

So, I think that float should not be used when precision and robustness are required.

Edited to Add: On SQL Server 2005 the rounding problems with float apparently does not exist, as I did the same test that produced this table in SQL Server 2000 and I could not find any weirdness.

nmoneyfloat
0.00000.0
1.01000.01
2.02000.02
3.03002.9999999999999999E-2
4.04004.0000000000000001E-2
5.05005.0000000000000003E-2
6.06005.9999999999999998E-2
7.07007.0000000000000007E-2
8.08008.0000000000000002E-2
9.09008.9999999999999997E-2
10.10000.10000000000000001
11.11000.11
12.12000.12
13.13000.13
14.14000.14000000000000001
15.15000.14999999999999999
16.16000.16
17.17000.17000000000000001
18.18000.17999999999999999
19.19000.19
20.20000.20000000000000001
21.21000.20999999999999999
22.22000.22
23.23000.23000000000000001
24.24000.23999999999999999
25.25000.25
26.26000.26000000000000001
27.27000.27000000000000002
28.28000.28000000000000003
29.29000.28999999999999998
30.30000.29999999999999999
31.31000.31
32.32000.32000000000000001
33.33000.33000000000000002
34.34000.34000000000000002
35.35000.34999999999999998
36.36000.35999999999999999
37.37000.37
38.38000.38
39.39000.39000000000000001
40.40000.40000000000000002
41.41000.40999999999999998
42.42000.41999999999999998
43.43000.42999999999999999
44.44000.44
45.45000.45000000000000001
46.46000.46000000000000002
47.47000.46999999999999997
48.48000.47999999999999998
49.49000.48999999999999999
50.50000.5
51.51000.51000000000000001
52.52000.52000000000000002
53.53000.53000000000000003
54.54000.54000000000000004
55.55000.55000000000000004
56.56000.56000000000000005
57.57000.56999999999999995
58.58000.57999999999999996
59.59000.58999999999999997
60.60000.59999999999999998
61.61000.60999999999999999
62.62000.62
63.63000.63
64.64000.64000000000000001
65.65000.65000000000000002
66.66000.66000000000000003
67.67000.67000000000000004
68.68000.68000000000000005
69.69000.68999999999999995
70.70000.69999999999999996
71.71000.70999999999999996
72.72000.71999999999999997
73.73000.72999999999999998
74.74000.73999999999999999
75.75000.75
76.76000.76000000000000001
77.77000.77000000000000002
78.78000.78000000000000003
79.79000.79000000000000004
80.80000.80000000000000004
81.81000.81000000000000005
82.82000.81999999999999995
83.83000.82999999999999996
84.84000.83999999999999997
85.85000.84999999999999998
86.86000.85999999999999999
87.87000.87
88.88000.88
89.89000.89000000000000001
90.90000.90000000000000002
91.91000.91000000000000003
92.92000.92000000000000004
93.93000.93000000000000005
94.94000.93999999999999995
95.95000.94999999999999996
96.96000.95999999999999996
97.97000.96999999999999997
98.98000.97999999999999998
99.99000.98999999999999999

Tuesday, March 25, 2008

Computus

This week I got involved on a small discussion about a system at office that would require a holidays' database, in order to calculate the next available date to establish pay dates for invoices.

There were several talks about the proper ways to do this, and because I had other projects on my task list now I could not implement the agreed solution (which I don't quite remember now).

But...

During this discussions I did a little research about holidays.

Most holidays are a fixed event, i.e., they don't move around on the calendar. For instance, everybody knows that December 25th is Christmas Day.

However, there are several other holidays that are not so simple to nail down.

Take Easter Sunday for instance. It can be any Sunday between March 22nd and April 25th.

A quick look at Wikipedia gives us a plethora of methods to calculate the Easter Sunday. Using tables, adjusts and several calculations.

The function below uses one of this methods. Called the Butcher's Algorithm.

In my little research I found that this algorithm, according to some sources, was devised in 1876 (they tend to agree that it was first published on Butcher's Ecclesiastical Calendar).

With the date of Easter established with a few more additions and subtractions we can calculate most of the movable holidays.

DayAdd
Ash Wednesday -46
Palm Sunday-7
Good Friday-2
Corpus Christi+60

Public Function GetEaster(ByVal year As Integer) As Date

If (year < 1583) Then
Throw New _
ArgumentOutOfRangeException("year", _
"Year must be after 1583")
End If

Dim a As Integer = year Mod 19
Dim b As Integer = year \ 100
Dim c As Integer = year Mod 100
Dim d As Integer = b \ 4
Dim e As Integer = b Mod 4
Dim f As Integer = (b + 8) \ 25
Dim g As Integer = (b - f + 1) \ 3
Dim h As Integer = (19 * a + b - d - g + 15) Mod 30
Dim i As Integer = c \ 4
Dim k As Integer = c Mod 4
Dim L As Integer = (32 + 2 * e + 2 * i - h - k) Mod 7
Dim m As Integer = (a + 11 * h + 22 * L) \ 451
Dim p As Integer = (h + L - 7 * m + 114)

Return (New Date(year, p \ 31, (p Mod 31) + 1))

End Function

Friday, March 21, 2008

Joel about IE8

[...]
Here’s what I think is going to happen. The IE8 team going to tell everyone that IE8 will use web standards by default, and run a nice long beta during which they beg people to test their pages with IE8 and get them to work. And when they get closer to shipping, and only 32% of the web pages in the world render properly, they’ll say, “look guys, we’re really sorry, we really wanted IE8 standards mode to be the default, but we can’t ship a browser that doesn’t work,” and they’ll revert to the pragmatic decision. Or maybe they won’t, because the pragmatists at Microsoft have been out of power for a long time. In which case, IE is going to lose a lot of market share, which would please the idealists to no end.
[...]

What can I say about it?

Amen, Joel, Amen...

Tuesday, March 11, 2008

IE8 length property not implemented.

As I've reported earlier, I've come across a "Not Implemeted" exception while working with IE8.

After probing here and there I finally got hold of whas was "Not Implemented".

The length property of the attributes collection.

I've just sent a message to the IE8 newsgroup about this, as well as, setting up a test page.

You can find it here.

Monday, March 10, 2008

IE8 and Acid 2 Test

Well, looks like the folks at Redmond were not kidding when they say that IE8 passed the Acid Test.



Yes. It passes the test. But using Standards Mode it will likely break every single website out in the wild.

Once again, I catch myself wondering why the folks in the open source community hates the guts of Microsoft.

What I think is that if you have a good software platform and a HUGE market share you're deemed the bad guy, no matter what.

Wait a minute! Wait just a freaking minute!

By that standard the guys at Google are the new bad guys in town!

Doesn't it mean they must start hating those guys too?

IE8 beta 1 - Fisrt Impressions

I've just installed the Internet Explorer 8 beta 1.

My first thought after the installation, was: "WOW!"

During the setup I was presented with some new features I'll sure try, and a better, much better, version of the Developer Tools.

One thing I've noted was the address bar have changed a bit. It now displays the domain in black, while the rest of the address is greyed out. Although it displays ONLY the domain part of the URL in black, regardles if the first part is not www.



But not everything were as smooth as it should.

Just as I've opened the blogger.com to edit this post, I was greeted with a "Not implemented" error. I had to switch back to IE7 emulation mode to write this post.



When I clicked on the Add image button I was promptly greeted with an illegal operation. The exception code was 0xC0000005.

OK, OK, I know it's a beta, and I hope they fix this before shipping out.

Internet Explorer 8 beta Setup

I've just installed the Internet Explorer 8 beta 1.

Below are the setup screens I've captured duting installation.

Thursday, March 06, 2008

Internet Explorer 8 beta is out.

Once more Microsoft releases another version of its browser: Internet Explorer 8.

Although it is still in beta apparently it adheres better to web standards - it passes the (in)famous ACID2 test, among other things.

I've just downloaded the installation, but I have no time right now to install it.

As soon as I install it I'll give it a try.