Senator John McCain is an Idiot

General Interest, Miscellaneous, Rants, Uncategorized No Comments

Apparently John McCain thinks it’s pork to control Mormon Crickets in Utah.  So much so, it seems, that he’s marked it the #6 piece of pork in a trillion dollar spending bill, despite that it’s less than one one thousandth of one percent of the cost.  Given that he’s biblically old, I would have thought he’d understand how important it is to stop SWARMING LOCUSTS.  I shit you not, the quote:

$1 million for mormon cricket control in Utah – is that the species of cricket or a game played by the brits?

I mean seriously, that’s so fundamentally uninformed that I can’t even mock it.  A million dollars is a bargain for statewide pest control that costs hundreds of millions of dollars in structural and crop damage annually.  He’s old enough that, statistically speaking, he should have seen every living thing at least twice by now (including brontosaurus); one is tempted to remind him of that crawly sandwich he had with Joseph Smith.

“I have no idea what they’re even talking about, so surely I’m qualified to think it’s pork!  Who needs locust control anyway?”

Asshat.

Link: Programmer Competency Matrix

Miscellaneous, Programming No Comments

I originally found the PCM through Starling Software’s copy, but it turns out to originally be by Sijin Joseph.  As both sites have lots of other interesting content, I’m linking both.

The Programmer Competency Matrix is a surprisingly realistic grid of capabilities sorted by topic, which gives an extremely rough but in my opinion basically valid idea of an engineer’s gumption.  Starling republished it as part of their standard set of tools to be used during a hire.

Regardless of whether you agree with the grid or its data, it’s fun.  Have a look, and try scoring yourself.

Math only shows some countries the love

General Interest, Miscellaneous No Comments

It turns out that time() is going to report 1234567890 on Valentine’s Day this year for about 1/3 of the planet.  Anyone on the wrong side of Greenwich Mean Time gets the joke.

Adware Scumbag Self Justification

General Interest, Programming, Rants No Comments

One of the most amazing things to me about the typical adware scumbag is their desperation to justify their own behavior.  An interview with such a person just went onto slashdot, in which in the site afterword, he attempts to compare his choices to the Millgram Experiment.

Of course, anyone with half a clue will remember three things:

  1. He was not being instructed by an authority figure that adware was in the victim’s best interest
  2. His goal was making money
  3. He had months, including time away from the authority figure, in which to think it over

The dirtbag goes on to talk about how difficult it was to ignore a challenging occupation when one doesn’t have many other options.  Thing is, I could be making tons of money as a pirate, or writing malware, and I manage to get through my day without doing it.  I’m also willing to bet that Drew Peters wasn’t actually looking for other jobs at the time.

“It’s even harder if the bad starts out small and slowly gets bigger.”

Horseshit.  The second you do something bad, you object, and if they try to force you, you walk away.  That’s why when I found out my old boss Russell was triple- or more billing his clients in my name, I told him that he stopped tomorrow, or I walked.  Did I get fired?  Sure, but I told the client what happened, so so did Russell, and I ended up getting the job back with a different boss and a much larger hourly billable.

Oh, and I had my honesty and decency intact.

Go to hell, Matt Knox.  It’s not that hard to not write malware.  It’s just hard for people like you.  I hope that eventually you find yourself the victim of the things you’ve done to others; you’ve almost certainly caused far more damage than you’ll ever understand, during a time where it was extremely easy to get other work.

Disgusting.

WebKit overflow:hidden and clear:none clipping failure

Programming, Web and Web Standards No Comments

There is a failure in WebKit to honor overflow:hidden with clear:none on child elements.  This prevents several cheesy no-table space filling strategies which have worked portably since IE3 from working in WebKit derived browsers (safari, chrome, etc.)

Test case with screen shots and examples.

I have submitted this as Bug 23221.

A Better Erlang TCP listening pattern: addressing the fast packet loss problem

Erlang, Programming, Tools and Libraries, Tutorials 11 Comments

[digg-reddit-me]I’ve had mixed reactions to this when I’ve discussed it with people on IRC.  This may be well known to oldbear Erlang programmers.  I suppose it’s also possible that I’m wrong, though I’ve talked to several people I respect, and more than one of them have suggested that they were already aware of this problem.  If I’m wrong, please let me know; I’m open to the possibility that there’s a better answer that I just don’t know about.  I’ve never seen it discussed on the web, at least. Update: Serge Aleynikov points out that this TrapExit tutorial documents this approach.

I think this is probably real.

I believe there is a significant defect in the idiomatic listener pattern as discussed by most Erlang websites and as provided by most Erlang example code, and which is found in many Erlang applications.  This defect is relatively easily repaired once noticed without significant impact on surrounding code, and I have added functionality to my ScUtil Library to handle this automatically under the name standard_listener.

The fundamental problem is essentially a form of race condition.  The idiomatic listener is, roughly:

do_listen(Port, Opts, Handler) ->

    case gen_tcp:listen(Port, Opts) of

        { ok, ListeningSocket } ->
            listen_loop(ListeningSocket, Handler);

        { error, E } ->
            { error, E }

    end.

listen_loop(ListeningSocket, Handler) ->

    case gen_tcp:accept(ListeningSocket) of

        { ok, ConnectedSocket } ->
            spawn(node(), Handler, [ConnectedSocket]),
            listen_loop(ListeningSocket);

        { error, E } ->
            { error, E }

    end.

Now consider the case of a server under very heavy load.  Further, consider that the listening socket is opened either {active,true} or {active,once}, which is true in the vast bulk of Erlang network applications, meaning that packets are delivered automatically to the socket owner.  The general pattern is that the listening socket accepts a connection, spawns a handling process, passes the connected socket to that handling process, and the handling process takes ownership of the socket.

The problem is that it takes time for that all to happen, and Erlang doesn’t specify or allow you to control its timeslicing behavior (as well it should not).  As active sockets are managed by a standalone process, this means that if the connecting client is fast and the network is fast, the first packet (even the first several under extreme circumstances) could be delivered before the socket has been taken over by the handling PID, meaning that its contents would be dispatched to the wrong process, with no indication of where they were meant to go.  This invalidates connections and fills a non-discarding mailbox, which is a potentially serious memory leak (especially given that erlang’s response to out of memory conditions is to abort an entire VM.)

Obviously, this is intolerable.  There are better answers, though, than to switch to {active,false}.  One suggestion I heard was to pre-spawn handlers in order to reduce the gap time, but that doesn’t solve the problem, it just makes it less likely.

The approach that I took is to lie.  standard_listener takes the following steps to resolve the problem:

  1. Add the default {active,true} to the inet options list, if it isn’t already present.
  2. Strip out the {active,Foo} from the inet options list, and store it as ActiveStatus.
  3. Add {active,false} to the inet options list, and use that options list to open the listener.
  4. When spawning handler processes, pass a shunt as the starting function, taking the real handling function and the real ActiveStatus as arguments
  5. The shunt sets the real ActiveStatus from inside the handler process, at which point the socket begins delivering messages

This neatly closes the problem.  A free, MIT license implementation can be found in ScUtil beginning in version 96.  A simplified, corrected example follows for immediate reference; the thing in ScUtil is more feature complete.

do_listen(Port, Opts) ->

    ActiveStatus = case proplists:get_value(active, SocketOptions) of
        undefined -> true;
        Other     -> Other
    end,

    FixedOpts = proplists:delete(active, SocketOptions)
             ++ [{active, false}],

    case gen_tcp:listen(Port, FixedOpts) of

        { ok, ListeningSocket } ->
            listen_loop(ActiveStatus, ListeningSocket);

        { error, E } ->
            { error, E }

    end.

listen_loop(ActiveStatus, ListeningSocket, Handler) ->

    case gen_tcp:accept(ListeningSocket) of

        { ok, ConnectedSocket } ->
            spawn(?MODULE, shunt, [ActiveStatus,ConnectedSocket,Handler]),
            listen_loop(ActiveStatus, ListeningSocket, Handler);

        { error, E } ->
            { error, E }

    end.

shunt(ActiveStatus, ConnectedSocket, Handler) ->

    controlling_process(ConnectedSocket, self()),
    inet:setopts(ConnectedSocket, [{active, ActiveStatus}]),
    Handler(ConnectedSocket).

A Happy New Year’s into 2009 to All

Miscellaneous No Comments

A happy, healthy and safe 2009 to everyone.  Remember the best parts in people you know, help the less fortunate, and help make 2009 better than 2008 in your part of the world.

Best Buy is into phone spam too, now?

Rants 4 Comments

Best Buy just illegally called my cellular phone to make announcements about rewards.  No option to speak to a human was given, which is also illegal.  And, of course, the number’s on the do not call list.

Pity the Boise police show so little interest in corporate illegal behavior – I’ve already reported three of these to them, and they don’t even open reports.

Unsurprisingly, this has ended my being a Best Buy customer permanently.  They were, previously, taking in about $1500 per month from me.  Wonder if it was worth it.

Why is nobody suing Classmates.com for SPAM?

General Interest, Rants 6 Comments

[digg-reddit-me]I put an email address on usenet which I created solely as a test, using a name that I’m pretty sure nobody on Earth has.  Within four days, it was getting Classmates reunion notices, and emails saying that my friends were trying to contact me, and that all I had to do was sign up for an account to find out who, and about what.

Unsolicited commercial email, and fraud to boot.  Pretty much the definition of SPAM, isn’t it?  So why isn’t anyone going after them like they are for the other spammers?  Aren’t there vast sums of money involved?

God I love the Boise post office

Rants 4 Comments

The post office has mislaid a package containing more than half of the christmas presents I was going to give out, which were supposed to be here a week ago.  It’s 4:30 christmas eve, and they have no idea where it is.  Time to find out what last minute shopping is like, and also, giving presents that aren’t awesome.  Failboat; all aboard.

I’ve lost more packages in the year since I’ve moved here than in the rest of my life put together, and the ones I do get are usually in piss poor condition.  It’s a wonder they pass quality control.

« Previous Entries Next Entries »