There is No Excuse for Not Having GC

Published at 10:45 on 1 January 2013

About five years ago, I set out to learn C++. I gave up after a few days when I ended up going down the rabbit hole of what’s on the heap, what’s on the stack, and what can be freed when. It was an enormous headache, and nowhere was it clearly and succinctly explained.

And it wasn’t even necessary to worry about. Modern languages like Java, Python, and C# all have garbage collection. Program in one of those and you don’t ever have to care much about memory management. The language subsystem that runs your programs does it all for you.

Given that memory leaks are one of the most common, and one of the most difficult to track down and resolve, classes of bugs, this is a win of simply monumental proportions. It is unfathomable why one would wish to voluntarily relinquish such a boon.

The standard answer to this observation is to point out that there are certain timing-dependent programs (typically ones that access raw devices), where GC gets in the way and can cause lost data.

I don’t think this argument has much validity when it comes to arguing in favor or not providing GC. Rather, it is an argument in favor of providing the programmer with control over GC. All one needs are four basic operations:

  1. Turn automatic GC off.
  2. Turn it back on again.
  3. Perform a GC cycle manually.
  4. GC a single datum manually.

With those, one can do timing-critical programming and not have GC get in the way one bit.

By turning GC off and reclaiming things on a case-by-case basis as needed, one can even use the same memory-management paradigm that primitive, functionally obsolete languages like C++ mandate you to use. Even if you do that, you can still perform occasional invocations of manual GC cycles, and log error messages if anything got garbage collected, and your program will detect its own memory leaks.

About the only rationale I can think of for not having GC at all is that one is writing some sort of embedded code on hardware so limited that there is not memory or CPU cycles available for it. That’s almost certainly a tiny fraction of all programming tasks.

Fscking Spammers

Published at 20:54 on 20 August 2012

It seems as if one of my recent posts has attracted the attention of search engines, probably because in relating how I solved a Macintosh frustration, the information has proved helpful to others.

So far, so good. The bad news is that’s attracted the attention of spammers. No, they’re not getting any spam posted: I have several lines of defense against that. But they are getting through the first line of defense: the captcha on the comments form.

They’re probably doing that with the free porn scam, in which one writes some back-end software to impersonate a browser (not hard to do; I’ve done so many times for legitimate purposes), and presents the captcha image to someone who wants to be rewarded by viewing some porn for free if they solve it. The front-end that displays the porn then passes on the solution to the back-end, which uses the information to send back a form response containing the spam.

It’s a pretty minor irritation, but an irritation nonetheless. Maybe I’ll get motivated to go through my server logs and start reporting them to those responsible for the IP addresses the requests are coming from.

iTunes Video: A Complete Ripoff

Published at 09:23 on 18 August 2012

Note to all: avoid iTunes videos that you must pay for like the plague.

I had been wanting to watch some Portlandia episodes , and last night tried to with iTunes video. Big, big mistake. After charging me $2.99 and commencing the download, iTunes sneeringly informed me that I could not watch said video on my computer, and then launched into a paragraph of arcane technobabble that even I could not understand at first.

Apparently, some lame copy-protection scheme mandated by the Hollywood studios considers all but a select few Macs a piracy threat, presumably because the digital video signal going between the system unit and the monitor could be used to create a decrypted, free copy of the video.

Of course, that’s no excuse for iTunes’ bait-and-switch behavior. iTunes could obviously tell if the system it was running on was unacceptable to Hollywood (hence the message); there’s no reason whatsoever for not sending it before you pay for a video and start the download. None except pure greed on Apple’s part, that is.

While researching the issue, I came across a comment in passing that mentioned BitTorrent and pirated copies of videos. A light went on. I downloaded BitTorrent, downloaded an AVI video player, typed in a few Google keywords, and within a matter of minutes BitTorrent was merrily downloading the content Apple had previously defrauded me for. Content which actually played.

And the BitTorrent download proceeded far faster than the iTunes download had. Just for yucks, I tried it again with another episode and that one arrived promptly and without issue, too.

Way to go Apple and Hollywood: you’ve successfully made it so difficult and risky for customers to pay for content that they opt for the easier option of pirating it instead.

An Executive Summary of Ruby

Published at 10:06 on 15 June 2012

I’m having to learn it for work purposes, and have already studied the language enough to be able to offer the following brief executive summary:

Ruby is a merger of an elegant, Scheme-like language which offers functional programming and metaprogramming with an ugly Perl-like syntax and design philosophy.

Avoid the Motorola SBG901

Published at 15:16 on 20 May 2012

If you’re in the market for a DOCSIS 2.0 cable modem, I suggest you avoid the Motorola SBG901. Based on my experience, they’re pieces of unreliable junk.

I’ve now tried two, and they both exhibit the same symptom of continually rebooting themselves (causing a lost connection) every few minutes. The modem I’m presently renting from my broadband provider, the Ambit U10C018, almost never does this, so it’s not an issue of my signal from the cable company being weak or unreliable.

Given that two completely different samples have behaved in the same way, I would also have to say that the odds of this being two random defects are pretty low. It appears to be a design defect of this product. A Google search on “motorola sbg901 keeps rebooting” comes up with more than a few matches of others who have run into my problem, which provides further  evidence of a design defect.

It’s a pity, as the Motorola product has the desirable feature of combining a wireless access point with a cable modem in one box.

What’s the iPad Good For?

Published at 00:13 on 7 April 2012

Having just received one as a generous and unexpected gift (witness previous entry), I’m trying to puzzle that out for myself.

It’s significantly bulkier and heavier than my Slingshot Organizer or the scraps of paper I write shopping lists on, so I cannot see it replacing either.

It’s also significantly heavier than my paper journal book, though it ties it in bulk. However, typing on a “keyboard” that appears on a touch screen is every bit as slow and error-prone as it always seemed to me it would be, so it’s of limited utility as a journal-entering device. A keyboard would rectify this (and they are available), but then the result would be both heavier and bulkier than what it replaces.

It’s also much heavier and bulkier than my MP3 player, and it’s an awkward form factor to use as a camera.

That leaves a device suited primarily to the consumption of information in digital form, be it in the form of Web pages or e-books, one which can be pressed into service for entering text if that need should arise. It is definitely less heavy and bulky than the alternative of a laptop computer.

If you purchase an adapter, it also possible to download images from a digital camera into an iPad. The same advantages of less weight and bulk (compared to a laptop) apply in this case, too.

So, it’s a nice gift that will at times come in handy, but I also don’t expect to be carrying it with me routinely; the things it does better than the existing alternatives tend not to be things I do all that frequently away from home.

Test

Published at 14:50 on 6 April 2012

Test of creating a post from new iPad. Well, this confirms what I’ve always thought about touchscreen “keyboards”: they won’t ever put mechanical ones out of business.

Bad Web Design Example of the Day

Published at 12:08 on 3 February 2012

Just what is that fourth character, anyhow? A lower-case letter O that’s been stretched and distorted to the size of an upper-case one? An upper-case letter O? The numeral zero?

There’s no way to tell, of course, save to take a wild guess. A guess where you have 67% odds of guessing wrong (yes, it’s case-sensitive, so “O” is not recognized as “o”). And if you guess wrong, guess what? That’s right: you get presented with brand new CAPTCHA! Which, given the number of characters in it, odds say will probably contain at least one “C”, “c”, “O”, “o”, “P”, “p”, “V”, “v”, “W”, “w”, “X”, “x”, “Z”, “z”, or “0” character.

Charming. Simply charming.

What’s the Deal with Wireless Keyboards and Mice, Anyhow?

Published at 21:43 on 28 January 2012

Really, what’s the point?

It’s not as if having a cable on my keyboard limits its usefulness in any way. Maybe the cable on my mouse does — a little. Most of the time, though, I’m completely unaware of it, too. It’s only a thin cable, not a ship’s anchor chain or anything.

Meanwhile, having a wired connection to the CPU means both keyboard and mouse have electric power whenever my computer does. Wireless devices must perforce depend on batteries. Batteries that can (and do) go dead. Batteries which Murphy’s Law states will go dead at the most inconvenient times imaginable. Such as late at night when you’re out of batteries an important project is due next morning. Plus the cable keeps the mouse conveniently tethered to my computer, so I can’t inadvertently take it elsewhere and lose it.

So to sum up: for keyboards and mice, Bluetooth offers little or no real advantage while imposing a very real disadvantage. I suppose there’s the odd specialized application where wires are a very real disadvantage, to the point where it’s worth putting up with the disadvantages of wireless technology for such devices. But that does nothing to explain how common wireless keyboards and mice are; it seemed that wireless mice outnumbered wired ones at Fry’s.

Which begs the question: why do so many people purchase and use such obviously inferior products? The only answer I can come up with is one of technology for technology’s sake: simply because we can use wireless keyboards and mice, many people apparently think that we should.

Though I must confess this rush to embrace a new technology for mice still strikes me as extremely odd, given how long those horrible trackball mice (perpetually getting dirty and needing cleaning) lingered on the market in the face of far superior optical mouse technology. Even the old-fashioned optical mice that required a special mouse pad still beat trackball mice (which tracked so poorly that virtually everyone bought a pad for them, anyhow) hands down. And even after the pad-free optical mice appeared on the scene, it still took nearly a decade for trackball mice to finally end up in the dustbin of history where they belong.

99% of Keyboards Suck

Published at 20:50 on 28 January 2012

Really, it’s amazing how crappy computer keyboards generally are. I was just at Fry’s getting the capacitor I’m going to try replacing, and had a chance to try out their keyboard selection.

The dominant “rubber dome” technology provides absolutely horrible tactile feedback: the electrical action takes place after the main mechanical action that one feels. Therefore, the only recourse if you want to type quickly is to bang on the keyboard like crazy, to ensure each key stroke hits home and causes a character to be entered. This causes fingers to get much more tired than they need to, because one is exerting on average far more force than one needs.

The only keyboard technologies that provided proper tactile feedback were ones made using IBM’s “buckling spring” technology (which I think is the best), and some mechanical keyswitches (which can get pretty darn good, too). Every subsequent technology has had no advantages for the user whatsoever: the only advantages newer keyboard technologies have has been for the manufacturer’s drive to cut costs.

What astounds me is not that the cheapest keyboards feel like crap (one would expect that, you’re getting pure “dollar engineering”), but how many keyboards with $100-and-up price tags (even ones advertised as “ergonomic”) also felt like complete crap when I tried them. Making a fancy curving layout so one’s hands can be held at a natural angle but using a technology that forces (at the cost of failing to enter the random character) users to use unnecessary force is like having a restaurant that serves a turd as dessert, but frosts it elegantly in icing and serves it on a sterling plate.

The only keyboards that weren’t absolute crap were two models by Razer geared towards the gamer crowd. While spendy, they were still less expensive than many of the crappy ones.