April 2004 - Posts
Stan Lippman talks about Destructor Semantics and as someone puts it: C# finally caught up with Delphi. Isn't it a coincidence that Microsoft also recently hired Borland's lead software engineer? It seems that there is just no competition for Microsoft, since they can just buy it out. This is not the first time it happens, and in my opinion not necessarily a bad thing either. For the world's most popular (whether it's the world's best is certainly debatable) OS can certainly do with the world's leading experts!
Anaways, back to the new semantics. What it boils down to, is that your class's destructor will, instead of abstracting a call to Finalize(), be abstracted by your Dispose() method. A class implements IDispose, which has one member: Dispose(). The Dispose method is now also your destructor.
An explicit definition of a finalizer is implied with the bang operator:
public ref class R
{
public: !R() { Console::WriteLine( "I am the R::finalizer()!" ); }
};
Read more on Stan's post - it's pretty interesting stuff.
[UPDATE] - As senkwe points out, this is Managed C++, not C# :)
Today is my last day working for the South African Sugar Association. The IS department had a braai on Wednesday to say “cheers”, and this morning in our meeting I got gifts. I'm going to miss this place and its people, even though many of them might believe otherwise... Since it was my first “real job” (I've had many others - none of them real) I feel quite mushy about the whole affair!
Let's put tax cuts in terms everyone can understand. Suppose that every day, ten men go out for dinner. The bill for all ten comes to $100. If they paid their bill the way we pay our taxes, it would go something like this:
The first four men (the poorest) would pay nothing.
The fifth would pay $1.
The sixth would pay $3.
The seventh $7.
The eighth $12.
The ninth $18.
The tenth man (the richest) would pay $59.
So, that's what they decided to do.
The ten men ate dinner in the restaurant every day and seemed quite happy with the arrangement, until one day, the owner threw them a curve. "Since you are all such good customers," he said; "I'm going to reduce the cost of your daily meal by $20."
So, now dinner for the ten only cost $80.
The group still wanted to pay their bill the way we pay our taxes. So, the first four men were unaffected. They would still eat for free. But what about the other six, the paying customers? How could they divvy up the $20 windfall so that everyone would get his 'fair share'?
The six men realized that $20 divided by six is $3.33. But if they subtracted that from everybody's share, then the fifth man and the sixth man would each end up being 'PAID' to eat their meal. So, the restaurant owner suggested that it would be fair to reduce each man's bill by roughly the same amount, and he proceeded to work out the amounts each should pay.
And so:
The fifth man, like the first four, now paid nothing (100% savings).
The sixth now paid $2 instead of $3 (33% savings).
The seventh now paid $5 instead of $7 (28% savings).
The eighth now paid $9 instead of $12 (25% savings).
The ninth now paid $14 instead of $18 (22% savings).
The tenth now paid $49 instead of $59 (16% savings).
Each of the six was better off than before. And the first four continued to eat for free.
But once outside the restaurant, the men began to compare their savings.
"I only got a dollar out of the $20," declared the sixth man. He pointed to the tenth man "but he got $10!"
“Yeah, that's right," exclaimed the fifth man. "I only saved a dollar, too. It's unfair that he got ten times more than me!"
"That's true!!" shouted the seventh man. "Why should he get $10 back when I got only $2? The wealthy get all the breaks!"
“Wait a minute," yelled the first four men in unison. "We didn't get anything at all. The system exploits the poor!"
The nine men surrounded the tenth and beat him up.
The next night the tenth man didn't show up for dinner, so the nine sat down and ate without him. But when it came time to pay the bill, they discovered something important. They didn't have enough money between all of them for even half of the bill!
And that, boys and girls, journalists and college professors, is how our tax system works. The people who pay the highest taxes get the most benefit from a tax reduction. Tax them too much, attack them for being wealthy, and they just may not show up at the table anymore. There are lots of good restaurants in Europe and the Caribbean.
A lesson from distinguished Professor of Economics, David R. Kamerschen.
From CodeGuru's newsletter:
2006 is only a year and a half away. At VSLive! last month, Bill Gates mentioned the personal computer of 2006. Do you know what the projected specification is for a PC in 2006? The CPU isn't surprising with a speed expected to be in the 4-6 GHz range (with two cores). Some of the other specs, however, may surprise you. Expected memory is 2 GB or more. Hard drives should be breaking the 1 Terabyte mark. Most importantly, graphics processors on PCs should be three times the speed and power they are today. Finally, and least surprising, network access should be 1 GB or 54 Mb wirelessly.
That is a lot of power. With Microsoft listing this as the expected PC for 2006, it makes me wonder if this is also going to be close to the specification for running Windows Longhorn.....
Impressive as it sounds, I believe it's pretty spot-on. In our beautiful South Africa we sit with internet access problems though, and until our government makes a radical change to their network operator policy, this will not change. Not by 2006, not ever.
I started a reply on a question someone asked about the internals of strings, and it ended up in me writing a whole lot about it.
Brad Abrams lists the mscorlib.dll members that will become obsolete in .NET 2.0.
(Interesting that Thread.Suspend() and Thread.Resume() are listed - it *always* deadlocks when trying to abort a suspended thread - but in my opinion this is a loss in functionality of the Thread class, isn't it?!)
I have a friend that used to tell us how she's going to sing one day - sing big. Of course we'd reply with a “Go for it! Don't let go!”, but we never really envisioned anything big happening. Well, she's the support act for Enrique Iglesias' South African Tour!
This girl rocks - Tamara Dey !!!
Similar to the C# FAQ (which has been brilliant!) a VB.NET FAQ has launched yesterday. Subscribed.
Some people should just not be allowed on the net - just read these responses to a simple blog entry by some poor bloke! It really cracked me up this morning!!!!
<extract>
HELLO,
I WONDERING IF BILL WILL INVEST IN MY PATENT/APPLYED,PENDING INVENTION.IT WILL BE THE HOTEST THING SINCE THE HOULA HOOP! AND ALL 287,000,000 PEOPLE CAN USE IT! TEGU160@AOL.COM
</extract>
hehehe... :))
I know that after reading the post's heading, some folks might get a bit excited. I did! Don't. This “Wold Tour“ takes place entirely in the US!!!
My newly exposed globe is now remiscent of a jar of strawberry jam. Yep, I had way to much sun this weekend!
Stepping back into the office though quickly...ehrm, immediately converts all of the bouncy-happy feelings of “no worries!” into *distant* memories :) I resigned last week, which resulted in my deadlines all crawling up closer to today!! I got a good old friend visiting for a few days so I'm going home at 12:00 today. And I have so many emails to read, blogging to catch up on, blogs to read, and then of course, my latest favourite distractor: Channel 9. It simply rocks. Hard.
Off to work.
Totally baffled by this: something I wrote has somehow, by someone, been translated into some language (I suspect Chinese) and posted on the web.
?!?!!
If only I knew this a few years ago:
a = b
a² = ab
a² - b² = ab - b²
(a + b)(a - b) = b(a - b)
a + b = b
a + a = a
2a = a
2 = 1
Can you find a flaw in my logic? :))
Early on Saturday morning I awoke looking like this, but after what took about 5 minutes, I went home looking like this! Some SADev members and myself did the shave at Gateway.
It's all for a good cause :)
More Posts
Next page »