I recently went to the state GoldenTee championship. It was a lot of fun, and I look forward to next year to improve on my finishes (I took 2nd in doubles and 4th in the open singles bracket). You can find a pretty good summary of what happened here. If anyone wants to inquire about the 3rd/4th place match, I'd be happy to relive the horror story for you in person - over a beer.
We now return to your regulary scheduled blogging lineup.
I wanted a way to name threads to make it easier to debug, but since I'm still using Delphi 6 for the next month or so, I don't have access to the named thread object wizard in the Delphi IDE (as can be found in Delphi 2005). The code that is generated in Delphi 2005 when adding a named thread uses the technique found here:
MSDN article on naming threads
There are some other options, too. See this Google thread for a link to a CodeCentral entry and a technique for making setting the name more flexible.
I came across this post today, talking about names as viewed from an intercultural perspective. It was a good read, but it triggered something in me that I knew I had to blog about, namely a quote that bites me time and again: "Writing the code is easy. Naming it properly is hard.".
I'd say this problem is pervasive, based on my experience. How many times have you seen code that does "for i:=0 to Count-1 do"? OK, maybe that's a stretch. Counter variables don't exactly require great names. But still, the point remains. Badly named variables, methods, components, etc. are very common. I find that when this happens in my code, it's due to a failure in my understanding of exactly what the code is meant to do. In the old days, you just had to change things around until they make sense. Today, it's called Refactoring.
My advice is that when you find yourself starting to have to do mental gymnastics to keep track of what a variable/method/etc. is used for, it's time to immediately change either the purpose or name of the variable (or both). It may be a minor inconvenience now, but it will pay major dividends the next time that code is looked at.
I just put the Delphi 2005 version of MIDAS.DLL up on my web site.
I kept both the D7 and D2005 versions up on that page. If you have any problems using this newer version, please post a report to QC.
Sorry to do this, but the spam was getting to be too much (at least 7-10 per day), so I went ahead and password protected the ability to post comments. It seems pretty unobtrusive to me, but if you have major complaints with it, please let me know, and I'll keep digging for a better solution. I really value the feedback I get here, and I don't want to lose it, but I also have to balance that out with making my life easier by not having to delete a deluge of spam.
For those of you that are interested, I ended up using Miguel Jimenez's approach to solve this. I had some initial problems viewing my blog in a browser after implementing this, but it sounds like my ISP fixed that by adding specific permissions to that DLL. One other note: add the httpHandler section BEFORE the .Text entry where they try to take over verb="*" and path="*", otherwise you will never let the HIP generator get processed.
All in all, I would say that the entire upgrade was rather easy. Now let's see if my spam problem goes away.
2 interviews on BDNradio interviews with Ramesh Theivendran are now available. If you use Borland tools to access databases, you should definitely listen to these interviews.
It's been a while since I blogged a "pet peeve", and I know you're all anxiously awaiting the next entry in the series.
When you see code like this, run like mad!
try
DoSomething;
except
end;
Note: You can have the same bad code in C#, and other languages, too.
The problem with this code is that you are swallowing ALL exceptions in this code block. For example, you now won't be notified of Access Violations, Out of Memory conditions, Invalid Pointer operations, or other system-level problems. If DoSomething is throwing an exception of a known type, handle it in the except block explicitly. If you don't know what exceptions can come back, don't handle them. It's really that simple. You can't count on your program working correctly from this point forward if you use this type of construct.
Now, I can think of some very rare places where you need this type of logic (e.g. if an exception leaks out, it will crash a poorly written host process, like IIS and ISAPI). But even then, it would be best to at least log the error somewhere (e.g. file, EventLog, whatever).
I'm almost done writing a very exhaustive paper on exception handling that I titled "Hitch Hiker's Guide To Exceptions". With any luck, I'll publish it to BDN. Stay tuned, and I'll certainly blog about that when/if it gets submitted and accepted.
The problem I described earlier about w.bloggar not handling Edit Post/Publish cycles was not accurate. The problem was a .Text problem, where the editpost method for the MetaWeblog API was returning an Invalid TypeCast exception.
After posting a message on the w.bloggar forums, someone responded with a link to the solution. From there, I followed some more links, and found exactly what I was looking for. At the end of the day, I'm irritated with myself for not finding this earlier. Scott had a fix out for this problem since at *least* July, 2004. Live and learn.
Fixes for the editpost exception in .Text 0.95.2004.102:
If you're not using .Text 0.95.2004.102, or if you've modified .Text in some way, then you'll need to take a look at the source fixes and figure out how you want to handle things. I tested the binary fix, and things work fine for me.
OK, so my blog is turning into a bunch of upgrade announcements.  However, this is the much anticipated release of w.bloggar 4.0.
I blogged about w.bloggar before, and it's only gotten better. It even has .Text support right out of the box now. Plus, the upgrade was extremely painless, as it kept all of my old settings. The one bad thing is that the bug with getting Last Posts from .Text is still there. I'll work with the people at w.bloggar to resolve that.
Update: It looks like the Last Posts bug has been fixed in w.bloggar 4.0. Perhaps you need to post first with 4.0 in order to get things working, because last night - before I posted this blog entry - I was still getting the error. Today, I can retrieve all of the posts that I want without problem. However, you can't actually edit a post and publish it back. (I'll update this entry again if I get it working!)
Updated 1/11/05: I think I have the fix for the Edit Post problem. New blog entry to follow.
Trillian just released a new version of their software. If you follow the link, you'll see that it's an IM client that works with all of the major IM vendors (AOL, MSN, Yahoo, etc.). The new version definitely feels slicker and faster. I also love that they insert wikipedia links right into the text. I may get annoyed with that later, but right now, that's awfully cool.
I used Trillian .74 off and on for a while, so with the release of version 3.0, I decided it was time to use it full-time and get the Pro version. $25 is rather cheap for the utility it provides. And yes, I looked at GAIM before, but I just wasn't impressed.
|