Are direct quotes better out of context?

It turns out that more AOL employees are blogging now. One of them happens to be Sree Kotay. Sree blogs about our recent AOL All-Hands meeting where Eric Schmidt of Google was present. He quotes a portion of it completely out of context (which gets picked up by Inside Google):

I don’t remember, verbatim, the question, but the gist of it was, “At AOL, we tend to have Programmers that offer our members a very managed experience that comforts them, whereas at Google, its much more automation and technology oriented – can you comment on this philosophy difference?”

And Eric replied, “When you say Programmer and we say Programmer, we mean very different things… Does that answer the question?”

Completely out of context like this, it might sound like Eric’s making a cheap dig at the quality of computer programmers at AOL vs. those at Google. However, the context of the question was one about the differing cultures at AOL, where our content is heavily “programmed” by our editorial staff which we refer to as “programmers” vs. Google’s highly automated and algorithmic presentation of content. In that context, Eric’s response is very clear and not as negative as the quote might sound out of context, as it were.

That isn’t to say that Google’s computer programmers aren’t of a completely different caliber than AOL’s computer programmers, but I don’t think that was necessarily the intent of his response. I could be wrong, but I at least wanted to put forth this attempt at a clarification in case I’m not.

Samantha Burns has got it going on

Samantha Burns

Four months ago, I blogged about Samantha Burns, who was then a new Canadian blogger and back then I knew she was going to make it big. Well, she’s kept it up and is now serving ads on her blog, so I hope she’s making some good money off her hard work.

She recently posted about Penn Jillette’s NPR essay, the same one I blogged about back in December. I started a conversation amongst a few of the readers there: I won’t reproduce them here. Instead, go check out her blog and the comments and leave your own thoughts on the matter there. Or, you can leave a comment for me here, if you like.

Tags:
blogging,
religion,
npr

Dear Lazyweb: FD passing on Win32? How?

There’s a technique in Unix where you can pass a file descriptor (FD) from one process to another through Unix domain sockets on BSD or pipes on SysV. However, how do you do it on Win32? The “Unix emulation” that Windows provides, called Interix, says in its UNIX Application Migration Guide:

The two sockets functions recvmsg and sendmsg appear in many network applications but are not supported by Interix. These functions are the only way to pass an open file descriptor from one running process to another running process.

This doesn’t make it sound very promising. Can you really not pass FD’s between processes on Win32? In the hopes that someone else out there who knows Win32 much better than I do has already solved this, I’m asking for help. If you know of a way to pass FDs on Win32, please leave me a note in the comments or send me an email. Remember, I know how to do it on Unix already. I’m asking specifically for how to do it on Win32, if it’s even possible. Thanks.

Tags:
lazyweb,
win32,
coding

What makes a website a blog? Are comments necessary?

Recently, I found some time to revamp the comments section of my own blog after being inspired by Christian Watson’s suggestions on how to improve the comment section of a blog. I implemented anonymous comments, added a CAPTCHA (you know, that image you’re asked to read the letters in and type in to try and stop spammers), styled the comments and provided permalinks to each comment, added Gravatars … I did a lot. Why? Because I wanted to encourage readers of my blog to leave comments. Why? Because I like to hear what people have to say.

I just wrote some thoughts about Russell Beattie’s recent removal of comments from his blog. Mobile Jones called the move “antisocial” (as a pun on “social media”), while Ben Metcalfe says, “[…] a blog isn’t a blog unless it has comments.” This got me thinking: exactly what is a blog, then?

Right now, the beginning of the Wikipedia entry for blog reads: “A blog is a website in which items are posted on a regular basis and displayed in reverse chronological order. […] A blog comprises text, hypertext, images, and links (to other web pages and to video, audio and other files).” Comments are only later described as a “feedback comment system.”

So, is Wikipedia wrong here? Exactly what is sufficient and necessary for a web site to be a blog? I really can’t believe that comments are necessary and it’s certainly not sufficient, because you can implement a comment system for any page on any web site and that doesn’t make that site a blog. More importantly, why do we even care what color the bikeshed is?

Where, oh where, have Russell’s comments all gone?

Oh where, oh where can they be?

Yesterday, Russell Beattie pulled the comments off his blog. Since I read his blog through an RSS aggregator called Bloglines, I normally didn’t see comments to his blog, anyway. I only noticed the comments were missing when I wanted to leave a comment on his recent entry about Opera Mini (which, I guess I’ll now do as a post to my own blog). Was I upset that he removed comments so that I couldn’t leave one on his blog? Sure — for all of about, 15 seconds, during which time I checked some other entries on his blog to make sure that it wasn’t just the one entry that he’d disabled comments on, but rather was a change across his whole blog. Then, I went back to Bloglines and kept reading the rest of my subscriptions.

Was I annoyed that I couldn’t leave a comment on his blog? Sure, as I said, for about 15 seconds, because I wanted to just pop in and leave my comment and move on with my day. Was I annoyed at Russell? Of course not, that would be silly. Why was I annoyed, then? Because I’m lazy and leaving comments is generally a fast and easy way to respond to someone’s blog entry. For some strange reason, I can leave a one-line comment in someone else’s blog, but have a hard time posting a one-line entry in my own. Maybe I just need to come up with a “format” for blog entries in my blog that serve as comments to other blog entries where I feel there’s enough context for my own reader where my one-liner comments won’t seem so out of place. I’m also partially afraid that if I comment on someone else’s entry by posting to my own blog, they won’t see it: part of the reason why I comment on people’s blogs is because I want them to read what I wrote.

Of course, Russell publishes an email contact address on his blog, so I could just send him an email. I could even post my comment to my blog and email him the link, if I wanted my comment to be public. It still doesn’t mean he’ll read my email, or if he does read my email, read my blog entry … but, how is that different than if he didn’t read my comment on his blog? None at all.

The irony of it all is that instead of thinking “Russell is evil, he won’t let me comment at his blog,” during my 15 seconds of annoyance, I thought, “He must have gotten overrun by comment spammers and got sick and tired of them, so he turned off comments. That sucks.” I know I was getting hit by comment spammers on my blog once I turned anonymous comments back on, thus my implementing the CAPTCHA, so I figured he was in the same boat. Why did so many other people decide he was evil, before he even made a public statement to his blog as to why he removed comments? I don’t know him personally, but I’ve been reading his blog for a few years now, and I’ve never gotten the feeling that he’s an evil kind of guy.

Russell, if you read this, I just want to say that I do wish you’d turn comments back on for lazy people like me, but that’s just a favor I’d be asking. You’re absolutely right that it’s your blog and you should do with it whatever makes you happy. As you pointed out, “being cluetrain” is about the open discussion which can happen either in comments or between blogs, and you have yet to prevent people from linking to your blog. (Maybe it’d be evil to refuse to serve content to people based on the HTTP referer, preventing bloggers from linking to you, but you wouldn’t do that, right?)

Maybe it’d be cool for you to post about what ego feeds you’re using so we can check to make sure we know how to tag our posts so that they’ll appear on them, to increase the chances that you’ll see responses? Just a thought.

Tags:
russell beattie,
cluetrain,
blogging

Job searching is like matchmaking? e-HR-mony?

I’ve been a member of the New Jersey Young Professionals (NJYP) Yahoo! Group for a while, and now and then some interesting conversations get started. However, the mailing list is heavily moderated and sometimes my posts get rejected or overlooked by the moderators, I assume, since when they’re rejected I usually get a courtesy email telling me so. I’m not a huge fan of moderated discussion lists, but it’s not my group and I don’t set its policies. But, that’s not the point … this is the point:

There was a post recently by Vee suggesting that since employers request salary requirements or salary histories as part of the candidate selection process, that companies should tell candidates what salary they are offering for the position. I wrote this as my response, which as far as I can tell, never made it out to the NJYP list:

I don’t think it’s necessary for employers to disclose a salary figure when
posting a position. What good would that do?

In my experience, I’ve always worried about negotiating salary last, regardless of what the posted salary for a position is, if it is at all. Business is all about negotiation, and if you’re not prepared to negotiate for your salary, then you probably don’t deserve it anyway.

If I do well in the interview, I feel totally comfortable “naming my price” for what I’d like to get paid to work there. If it’s outside the range for the position I was originally interviewing for, if they really like me as a candidate, I know they’ll work it out with HR to open a new position with the appropriate job title and grade level to pay me the salary I’m asking for, if I’ve made the necessary impression on them that makes them want to hire me. If the employer isn’t impressed with me, then it’s a bad fit and I shouldn’t work there regardless of how much or little salary I’m willing to accept.

I also realized: what’s stopping a candidate from asking the employer what salary range the position offers? At worst, they’ll refuse to tell you which is no different than when you started. At best, they’ll share the information with you and you can decide whether you want to continue pursuing the opportunity or not. I’d be afraid of hiring someone who doesn’t have the necessary spine to ask a simple question like, “So, what’s the salary range for this position?” It’s not like asking for someone’s hand in marriage, you know.

Employment is a lot like matchmaking. Exchanging salary requirements and ranges up front might serve to optimize the search a bit, but it’s how companies miss out on some good talent and also some good talent missing out on some opportunities. But, with so many companies to choose from and so many candidates to choose from, perhaps it’s not statistically significant. Maybe someone needs to launch an eHarmony-like matchmaking site for job seekers and employers. Someone want to form a start-up with me? :-)

Elliott Back on mathematics and theology

Elliott Back reasons that mathematics is not a science, but rather a kind of theology. I guess mathematicians have faith in axioms, worship equations and believe in immeasurable phenomena like the concept of infinity. They even describe a system of complex numbers which acknowledge an imaginary number exists. Sure sounds like a religion to me.

del.icio.us/dossy links since January 30, 2006 at 09:05 AM

del.icio.us/dossy (RSS) links since January 30, 2006 at 09:05 AM:

Storing binary data in MySQL with AOLserver

This week at work, Michael Andrews asked how to round-trip binary data into MySQL from AOLserver. Since AOLserver’s ns_db interface is still defined using Tcl_CreateCommand which isn’t Tcl_Obj’ified, it’s sensitive to embedded NULL bytes. In other words, values (such as SQL strings) with embedded NULLs (which can appear in binary data) will result in the value being truncated at the first NULL. So, we have to escape them, and luckily MySQL understand this.

Here’s a brief walk-through at the control port demonstrating AOLserver’s ability to safely round-trip binary data with embedded NULLs to and from MySQL. I’ve left out a lot of prerequisites such as installing MySQL, configuring a database pool in AOLserver, configuring and connecting to the control port, etc. Those kind of things should be documented elsewhere, already.

First, we get a database handle:

nscp 1> set db [ns_db gethandle mysqldb]
nsdb0

For the sake of this demonstration, lets show what version of MySQL I’m testing against:

nscp 2> ns_db select $db "show variables like 'version'"
t0

nscp 3> ns_db getrow $db t0
1

nscp 4> ns_set array t0
Variable_name version Value 4.1.11-Debian_4sarge2-log

nscp 5> ns_set free t0

Okay, so I’m using MySQL 4.1.11 as shipped with Debian Linux, which is what I’m using. YMMV if you’re using a different version of MySQL, of course. Next, lets set up our test data. We’ll create a test value with all possible 8-bit bytes from 0 through 255, repeated once. The resulting value should be 512 bytes long:

nscp 6> set value ""

nscp 7> for {set i 0} {$i <= 255} {incr i} { append value [format "%c" $i] }

nscp 8> append value $value; return

nscp 9> string length $value
512

That little “; return” on line 9 is there to prevent the control port from returning the result of the “append value $value” which would have new returned the new value, or 512 bytes of binary data, back to our terminal, which we really don’t care to see. I’ll use that little trick throughout this tutorial where it makes sense to squelch a noisy command’s output.

At this point, we’ve got a 512-byte long binary value in $value, with two NULLs in it, one at the very beginning, and one 257 bytes into it. Now, in order to send this through to MySQL, we’ll need to escape several bytes: the NULL (also expressed as “\0“), the single-quote or “'“, the Control-Z (byte 26 or 0x1A in hex representation) and the backspace itself. We have to escape the single quote because it will prematurely end the value we’re trying to pass in the SQL statement. This is how SQL injection attacks work, by taking advantage of sloppy programmers who don’t escape these single quotes when using dynamic SQL. Database APIs that use “prepared statements” and “bind variables” generally aren’t as susceptible to these injection attacks (but they still can be, if done improperly), but that’s a topic for another discussion. In the meantime, Tom Kyte wrote a great article in Oracle Magazine January/February 2005 on this.

Next, we’ll define two helper procs that will escape and unescape values suitable for using in our dynamic SQL statements. I’ve named the procs mysql.quotevalue and mysql.unquotevalue. They both use Tcl’s string map to perform the transformation. To quote a NULL byte we replace it with the string “\0” and to quote a single-quote we prepend a backslash so it gets replaced with the string “\'“. We do the same operation in reverse to unquote the values:

nscp 10> proc mysql.quotevalue {value} { string map {\0 \\0 ' \\' \x1A \\Z \\ \\\\} $value }

nscp 11> proc mysql.unquotevalue {value} { string map {\\0 \0 \\' ' \\Z \x1A \\\\ \\} $value }

Now that we have these two procs defined, we can create a temporary table for our test and start INSERT‘ing the 512-byte long binary value into it. I’ve named the table binarytest with just one BLOB column named value:

nscp 12> ns_db dml $db "CREATE TABLE binarytest (value BLOB)"

nscp 13> ns_db dml $db "INSERT INTO binarytest (value) VALUES (_utf8'[mysql.quotevalue $value]')"

Because Tcl stores its values inside of Tcl_Obj’s as UTF-8 encoded data but we’re pushing it naively through the ns_db interface, MySQL will unfortunately be receiving UTF-8 encoded data from us. So, we need to tell it that, in case it needs to do any behind-the-scenes transcoding based on the server or database’s default charsets. In MySQL, if you prefix a value with underscore followed by a character set name, it makes note that the value is encoded in that character set, which is exactly what you see above.

Now, lets retrieve the data back out, using the MySQL function QUOTE() to ask the DB to quote the response before returning it to us, so embedded NULLs in the response don’t cause premature truncation:

nscp 18> ns_db select $db "SELECT QUOTE(value) FROM binarytest"

nscp 19> ns_db getrow $db t0
1

nscp 20> set result [ns_set get t0 "QUOTE(value)"]; return

nscp 21> ns_set free t0

Now, if you read the documentation for QUOTE(), you’d notice that MySQL will surround the value with single-quotes unless the value is a NULL database value. Since Tcl has no explicit way of expressing a NULL value, we’ll reduce it to an empty string — while I don’t necessarily think this is the right thing to do, this is also a topic for another time. So, lets go to work:

nscp 22> set newvalue ""

nscp 23> if {[regexp {^'(.*)'} $result -> newvalue]} { set newvalue [mysql.unquotevalue $newvalue] }; return

So, now we should have our original data in $value and our newly retrieved and unescaped value in $newvalue. Lets ask Tcl to compare the two and tell us if they are indeed equal or not:

nscp 24> string length $newvalue
512

nscp 24> string equal $value $newvalue
1

Yay! We got back exactly what we put in. Perfect!

Some caveats with this approach include the fact that we end up storing our binary data encoded as UTF-8 in the database, not as actual binary. If you plan to connect to this database with another application other than AOLserver through the ns_db API, be very aware of this. Other applications will need to transcode the data from UTF-8 back to plain binary, and will need to transcode to UTF-8 before inserting/updating the values in the database so that AOLserver can pull them out correctly. Also, due to the storage in UTF-8, this also means that the storage requirement in the database will be close to two times the actual binary data being stored, so be aware of this when doing your capacity planning.

I hope this little walk-through tutorial has been helpful to you, or at least has given you some new things to think about with respect to how to use AOLserver, Tcl and MySQL. If you have any questions, don’t hesitate to leave a comment below or email me privately.

Bring out the gimp! You won’t see THIS on Court TV …

Earlier this month, I blogged about a Massachusetts witch hunt involving Barbara Asher (aka “Mistress Lauren M”). Yesterday, it turns out she was acquitted. Maybe there’s still hope for our justice system, after all.

Robert Nelson, prosecutor in the Barbara Asher trial.

One thing is for certain, though: Robert Nelson, the prosecutor, is a stupid gimp. See?

During his closing argument to the jury, prosecutor Robert Nelson put on a black leather mask with a zippered mouth opening and re-enacted the bondage session.

With both hands, he reached back and clutched the top of a blackboard as if strapped to the rack. Then he hung his head as if dead.

Asher’s lawyer objected, and the judge agreed.

“That’s enough Mr. Nelson,” Judge Charles Grabau said. “Thank you for your demonstration.”