Skip to main content

General technology.

The UI Thread

Submitted by Xenoveritas on
Topics

Dear Developers,

The UI thread is not the appropriate place to be running long-running tasks. Setting the cursor to the "wait" cursor doesn't make running something in the UI thread OK - it just means that the cursor will let you know that the application is supposed to be completely unresponsive.

Don't forget, if you run a long-running task in the UI thread, Windows will think your application is "Not Responding."

Why I Hate PHP

Submitted by Xenoveritas on
Topics

Someone recently posted a very good comment on Slashdot detailing common PHP problems. Several of the replies give solutions to the various issues raised. However most of them involve editting php.ini to use safer options. (Why isn't php-recommended.ini the default config?)

Yes, there are ways around the problems listed. (Drupal, a PHP-based CMS which this site uses, provides quite a few helper-functions designed to make handling those errors much easier.)

However the point remains: when using PHP - be careful.

My iPod Won't Turn Off

Submitted by Xenoveritas on
Topics

My iPod won't shut off. Holding down the Play button does nothing. It just won't turn off. A quick Google reveals that this isn't exactly a new thing, and comes up with several articles that explain how to fix it: reboot the thing.

How do you reboot an iPod? Well, Apple has the answer. Toggle the Hold switch to Hold and then back off again, and then hold down Menu and Select (the center button) for six to ten seconds, until the Apple logo appears. The Apple logo displays while the iPod is booting.

"What exception? La-la-la-la-la, I can't hear you! LA-LA-LA-LA-LA!"

Submitted by Xenoveritas on
Topics

I'm really getting tired of the "I did this to shut up the compiler" anti-pattern, where something gets done simply to surpress a warning without any thought going into why the warning was generated.

The most annoying one has to be the "La-la-la, I can't hear you!" anti-pattern. It's simply:

try {
    doSomething();
} catch (Exception e) {
    //
}

Most frequently this gets done to avoid having to listen to the compiler complain about unchecked exceptions. But it totally screws up later code that really does need to know when attempting to connect to the database didn't succeed due to that annoying SQLException that you're ignoring.

Weird Unicode Math Symbols

Submitted by Xenoveritas on
Topics

So I was looking for the "not-equals to" symbol in the UNICODE table, and I wound up looking at the other various mathematical operators, and some of them are just - weird.

The all-caps text after the characters are the UNICODE character name - every UNICODE character (all 16,000+ of them) have official names.

≦ - LESS-THAN OVER EQUAL TO - Not sure why you'd want this over ≤, but why not?
≧ - GREATER-THAN OVER EQUAL TO - the opposite, of course
≪ - MUCH LESS-THAN - there's a "much less-than" sign?
≫ - MUCH GREATER-THAN - well, of course
≰ - NEITHER LESS-THAN NOR EQUAL TO - and this differs from ">" how?

java.text.DecimalFormat is broken...

Submitted by Xenoveritas on
Topics

From the Java 1.5 documentation:

If there is an explicit negative subpattern, it serves only to specify the negative prefix and suffix; the number of digits, minimal digits, and other characteristics are all the same as the positive pattern. That means that "#,##0.0#;(#)" produces precisely the same behavior as "#,##0.0#;(#,##0.0#)".

This is wrong. The negative pattern is, indeed, ignored - but it must be the exact same number of characters as the positive pattern.

On Overloading Operators...

Submitted by Xenoveritas on

I've never really like the concept of operator overloading. I mean, it can make sense in certain cases, but in other cases *cough*iostream*cough* it's just ugly. "<<" should always be "shift left" and shouldn't randomly change to "send to stream."

But, anyway, one of the more annoying instances of "operator overloading" is Mozilla's (or, specifically, Firefox's) use of the middle mouse button. I've previously posted instructions on how to make Firefox under Linux behave more like Firefox under Windows by setting the middle mouse to act the way it does under Windows.

Comcast: We Suck and We Know It!

Submitted by Xenoveritas on
Topics

I'm beginning to think that someone in Comcast's advertising department doesn't like Comcast that much.

First, there was the "Comcast Highspeed Internet: Humiliate yourself faster!" ad. It showed how with Comcast Highspeed Internet, you could make a fool of yourself through your webcam at higher resolution and faster download speeds than normal dialup.

Then, we have the "monkey with a sledgehammer" ad, which tells you that their anti-spyware and scam protection software is like a monkey with a sledgehammer, complete with video of a monkey running around with a (rubber) sledgehammer.

How to Fix the PDE's Extension Manager

Submitted by Xenoveritas on
Topics

I'm using the Web Toolkit (WTP) version of Eclipse, since I'm working on a web service. Well, another project wants to try creating a client using the Rich Client Platform (RCP), so I start messing around with that, too. Start following the instructions in Eclipse Rich Client Platform and get up to the point where you're supposed to add a view to an extension point.

Whoops. No view on the context menu. Wha? Search the web for a reason, searching, searching, nothing. Arg.

Finally discover that essentially, if you want the PDE to work, you must use the SDK versions of the packages. Yay. So it's off to download Eclipse itself, the EMF (use the emf-sdo-xsd-SDK bundle, BTW), the GEF, something called JEM from the Visual Editor site, and finally, the Web Standard Tools themselves. Fun, huh?

This Is Why C++ Is Better Than JavaScript

Submitted by Xenoveritas on

I think I've mentioned that JavaScript sucks before. This is why C++ is better:

d:/Firefox\mozilla\extensions\firetorrent\src\FTorrent.cpp(159) : error C2065: 'm_incompletePeers' : undeclared identifier

Hm? Oh, I accidently wrote "m_uncompletePeers" in the class header.

In JavaScript, this would have compiled, and I'd have to wait until something referenced m_incompletePeers to discover that I'd made a typo.

I like typed languages.