Archive for August, 2007

Serious MagSafe Bug

Monday, August 27th, 2007
Catastrophic MagSafe Failure

I grabbed my laptop out of my bag this AM and tried to connect the magsafe connector. It just wouldn’t stick. Huh.

Python: di

Friday, August 24th, 2007

The id() function doesn’t have an inverse1. Now it does.

>>> k = object()
>>> print k
<object object at 0x9a3b8>
>>> id(k)
>>> from di import di
>>> j = di(631736)
>>> j
<object object at 0x9a3b8>
>>> id(j)

Stupid simple module available in my SVN repository.

1 For good reason. An object’s id() is just its address in memory. This hack is effectively exposing a pointer — a fragile, prone to disappear out from under you, nasty, C-ism — into Python. It is like running on marbles with scissors. No stability and potential for loss of precious runtime fluids.

In a debugging context, though, being able to turn an id() back into an object reference allows interrogation of objects where identification of “objects of interest” and the actual interrogation of said objects does not have to happen within a contiguous set of expressions.

Chris says:

I wish people wouldn’t post stuff like this. There is never any case where this is a useful operation – the only time it works is when the object you want to retrieve is still around anyway – and there’s never any reason to store the id of an object instead of the object reference (or a weakref) instead.

People asking how to do this isn’t uncommon, and being able to google for it will just lead people to doing it instead of being told that they need to fix the problem that leads to them wanting to do it instead.

“Never any case”? That is a bit unimaginative and could even be construed as arrogant. The only safe “never” is in the statement “never assume you know everything”.

Sure — if you pass a random number or the id of a no longer existing object to di(), your process is going to crash. Totally true and I have added some emphasis on exactly why this feature is not a part of python, nor should it be.

As for this tool and the dangers therein: So what? Don’t do that. Tools can be misused. If something hurts, don’t do it.

This tool has saved me hours and hours of engineering time, several hundred lines of fairly complex code, and having to make some fairly nasty & intrusive changes to several relatively complex client/server focused codebases. More subtly, it allowed me to vastly reduce memory leaks without having to instrument the code in ways that would have very likely changed the lifespan of objects.

Lame. Python’s weakrefs don’t support weak references to Dictionaries, Lists, Tuples, Strings, or None. Four out of five of these types are very often exactly the kind of thing I need to figure out why there are tons of ’em floating around that shouldn’t be. Bogus.

“Application for job of Software Engineer”

Sunday, August 19th, 2007

Or: How not to apply for a job via email.

It was an unsolicited “application for job of software engineer” email. Sent to my .mac account. Without a To: field or any other uniquely targeting information in the message.

Likely, a fairly wide dispersal and normally something that’d I would delete without a second thought. But this one stood out for a couple of reasons.

Kindly consider my resume for the post of Software Engineer available in your esteemed organization. I am a competent professional seeking excellence. Your company is renowned and provides excellent opportunities for professionals to groom in their respective fields and I would like the honor of being part of such a pronounced institution.

Which organization was that, exactly? What fields? At least this mystery organization is very conspicuous.

Hint: When writing a cover letter, try to indicate that you know the name of the person to whom you are writing (or, at least, something a bit more specific than “The Human Resource Manager”). At the least, demonstrate even a smidgen of domain specific knowledge about the company, technology, or job that you are interested. Even a clue would help.

(Already had 2 phone screens with GOOGLE).

Well, good for you! Yay! Phone screens with GOOGLE! WHEE!

If they went so terribly well, why are you spamming the world for a job?

The included CV — a Word document that I was willing to open in that the AppKit does not emulate Word’s susceptibility to Macro viruses — opens with the traditional career objectives:

My career objective is to be one of the top technical leaders (research and development) in enterprise software architecture, development, and design. (Already had 2 phone screens with GOOGLE).

If having 2 phone screens with GOOGLE was a career objective, then it has been met and shouldn’t be listed in the objectives, should it?

Outside of that, the CV wasn’t bad.

However, the real gem was in the second document attached to the email. It is called gaming.txt. Cool! Maybe “Dude or Dudette” [D-or-D] has some experience writing games or testing them or something and has attached a short document — only 0.8KB — indicating projects D-or-D has worked on.

Uh, no…

A brief excerpt from gaming.txt:

Games ended by Dude or Dudette:
Alone in the dark The New Nightmare (PC)
Dino Crisis (PC)
Dino Crisis 2 (PC)
…22 more lines completed…
2006 Fifa World Cup (PC)
Need for Speed Carbon (PC)

Yup. That’s right. D-or-D appears to believe that a list of games successfully completed is a competitive advantage in the job market.

No, I’m not kidding. Had me laughing out loud for a few minutes on that one.

I’m tempted to write back to see if I can get some 1337 phints for NfS.

(No — didn’t appear to be a Phishing kind of thing. D-or-D was found via Google and seems ot have a legitimate ‘net fingerprint. I’m not going to out the individual, but I am not surprised that someone did. D-or-D will do well with a little bit of repackaging and better presentation.)

AT&T Bill

Monday, August 13th, 2007

I’m disappointed. My first month iPhone AT&T bill is only 14 pages; 9 pages of $0.00 data “calls”.

I guess that is the “price” I pay for having so many WiFi networks available to me. And I was thinking I’d found a good source for free packing materials…

Update: And that’ll be my only stupid huge bill. AT&T just spammed me a text message telling me that they were “… simplifying your paper bill, removing itemized detail.”

RantWhy do companies feel the need to use awkward sentence structure when text messaging? I could understand it if doing so drove the character count under the limit. But that does not apply in this case. One extra character would make it read… well.. like a sentence! “… simplifying your paper bill by removing itemized detail.”

Stupid Simple Grilled Pork Chops

Sunday, August 5th, 2007

I made pork chops last night and they were worthy of entry into the Google Brain Cache.

Christine brought home 4 beautiful thick cut pork chops with a request that I grill ’em. They were of a quality that I didn’t want to mask their porky goodness with too much goo.

So, I mixed up a sauce…

  • Soy Sauce
  • Honey
  • Dried Powdered Ginger
  • Apple Cider
  • Salt
  • Pepper

… in a bowl. It should be slightly thick, but not goopy. Drizzle over pork chops and let sit for at least an hour, flipping them periodically to make sure both sides are coated.

Toss chops on a medium hot grill. Simultaneously, set extra sauce in a sauce pan on low heat on the stove. You want it to bubble, but not boil.

Whenever you need to flip the chops — I flip them 3 times so I can make that classic criss-cross sear makrs on the outside — baste the chops with some more of the now-simmering sauce.

Grill to an internal temperature of 140 degrees.

Ridiculously good chops are the result.

Update: Scott recommends a simple brine. Totally agree. If you have excellent quality meat and want an overall Very Meaty Experience, brining is totally the way to go. I simply wanted something with a bit more flavor.

Between the soy sauce and the salt, my sauce is very brine-like in that it has quite a bit of moisture and a whole lot of salt. No, the end result is not salty.

I’m thinking the same sauce would go brilliantly on salmon bellies or hamachi (yellowtail) collars/heads. Maybe with a little lemon juice.