khslinky's Journal
[Most Recent Entries]
[Calendar View]
[Friends]
Below are the 20 most recent journal entries recorded in
khslinky's LiveJournal:
[ << Previous 20 ]
| Tuesday, January 27th, 2009 | | 10:39 pm |
Check Please?
Tonight, Elizabeth loudly said "Check" to me in the sense of checking something off. Along the lines of "Don't believe in God--Check!" As soon as she said it, Zoƫ looked up from her coloring and said "peas". "What?" we asked. "Please," she repeated. "Shrek, please." As far as we know, Shrek is the only thing for which she will voluntarily say please. We explained that Mommy had said "check" not "Shrek," and that we weren't planning to watch Shrek tonight. She took it fairly well, but I was a little torn. I mean, we don't want her sitting in front of the TV all the time, and I certainly don't want to sit in front of Shrek any more than I have to (why couldn't she prefer Nemo--it's clearly the better film), but we do want to encourage her to say "please" when she wants things instead of demanding "Shrek! More Shrek!" | | Saturday, June 28th, 2008 | | 1:25 pm |
Biking
I road my bike to work yesterday. It was the first time I'd ridden a
bike in about 15 years, but it went okay. It took about 40 minutes to
go a little over seven miles. I'm pretty sure that I can get that
down under a half hour once I'm more used to biking. (I'm still
getting the hang of gears—every bike I'd ever been on before had
exactly two gears: sitting and standing.)
| | Tuesday, January 1st, 2008 | | 11:23 pm |
Resolutions
I don't normally go in for new year's resolutions—I figure if
you want to do something, why wait for a new calendar year. On the
other hand, I have a number of non-urgent things that I've been
thinking I need to do eventually, and I really need to just pick a day
to start doing them (lest “eventually” never come). Today
seems like as good a day as any other.
My resolutions are pretty concrete, and I'm going to list them
here so that ohioana (and anyone else who happens to be
around) can help me stick with them.
( Resolutions ) | | Friday, December 14th, 2007 | | 11:22 pm |
Volatile Function Pointers I was nearly blown away by Visual C++ this week. In the end, I was
merely pleased with it, but for the space of about a half-hour, I
thought Visual C++ was working magic.
At work recently, one of our co-ops (for privacy's sake, we'll call
him Alonzo Church) was working on printing out nice stack traces from
C++ code when we throw an exception. He was testing it with something
like this:
f() { g(); }
g() { h(); }
h() { stack_trace(); }
int main() { f(); }
Unfortunately, the stack trace only showed h and
main. Alonzo figured that f and g were
missing because they'd been inlined, so he asked me if I knew of a way
to turn off the inlining for just those functions without turning off
optimizations altogether. I suggested that he change the calls to
f() and g into indirect calls through global
function pointers. There was absolutely no way, I assured him, that a
compiler would inline such a call.
But it did! Both f and g were still missing from
the stack trace. We even declared the function pointers
volatile, and defined them in separate files, and it
still inlined them. (The syntax is void (* volatile
f_ptr)(), by the way—it took me a couple tries to figure
that out.) Now, obviously no compiler is inlining indirect calls
through volatile function pointers. So what's going on? Why aren't
f and g in Alonzo's stack trace?
( Answer ) | | Monday, November 19th, 2007 | | 10:18 pm |
Gelfand does Basic Algebra
So I was browsing through math books on Amazon the other day, and it recommended a basic trigonometry book. I clicked on it thinking it might be the weird Australian trig book with quadrance and spread, but it turned out to be a traditional trig book. I almost closed the page, but then I saw the author's name and did a double take: Gelfand. (If you don't recognize the name immediately, it's because you haven't studied enough functional analysis.) It turns out he's written an entire series of high-school level math textbooks. How cool! | | Saturday, November 17th, 2007 | | 8:16 pm |
Hiring Programmers Some tips for anyone attempting to secure employment as a software engineer:
- You should know how to write a for-loop. Especially if your
current title is “Principal Software Engineer.”
- If you claim to have worked on numerous C++ projects over the past
fifteen years, you should know both (1) what a template is, and (2)
what a virtual function is. And you should be able to write a for-loop.
- When asked to write code on a whiteboard, it's acceptable to say
“A whiteboard is a less-than-ideal development environment. It
will be difficult to write and debug code without my editor and
compiler.” It's probably not a good idea to say “Oh man,
it's been so long since I had to write code!”
- If asked to read a bunch of numbers from a file, your first
impulse should not be to store them in a fixed-size array.
- Don't try to convince your interviewer that frequently copying your
source code to a network location is an acceptable substitute for a
revision control system.
- You really need to know how to write a for-loop. Now, I'm
all for eliminating for-loops from your code—it's been months
since I wrote my last for-loop at home. But loops are still
common in professional settings, and frankly, nobody's going to
believe that you're a professional programmer if you can't write
one.
It's harder to find good programmers than I expected. In the end, though,
we did hire someone that I'm pretty excited about. | | Monday, November 12th, 2007 | | 5:53 pm |
Porn I was looking at some porn on the internet the other day. I don't
think I quite understand the appeal of porn. I mean, I think of sex as
touching someone that I like—looking at a stranger that I can't
touch just doesn't cut it. And what's with all the shaved crotches?
Half the time, I felt like I was watching middle-school girls have sex. | | Sunday, October 28th, 2007 | | 1:20 am |
Marshmallows About a year ago, I overheard someone chastising a child for
(intentionally) burning a marshmallow in a fire instead of eating it,
because she couldn't stand to see food go to waste. I think this is
silly for a number of reasons, chief among them that it's a bit of a
stretch to call marshmallows “food”. Kroger apparently
agrees with me.
For reasons I won't get into, I was looking for marshmallows at the
grocery store tonight. My first thought was that they were a baking
good, but all I could find in that aisle was marshmallow
fluff. Then I thought that maybe they were an ice cream
topping, but that section only had some sort of “process
marshmallow food topping”—no real marshmallows. My next
stop, the tea/coffee aisle, had marshmallows, but I would have had to
rip open packages of hot chocolate to get them. I finally asked an
employee, who told me that marshmallows were in aisle twelve. That
aisle contained only baby food and toys, with marshmallows at
the boundary. Since I can't imagine that Kroger thinks of
marshmallows as baby food, I have to assume that they agree with me: a
marshmallow is really more of a toy than a food. | | Tuesday, October 2nd, 2007 | | 9:03 pm |
Exhaustion You know how sometimes when you're sick your joints ache and your
skin feels super sensitive and you don't want anything to touch you?
I felt like that last night, from about four in the afternoon until I
woke up this morning. Except I wasn't sick. I think Zoë has
introduced me to a level of exhaustion I've never experienced before,
even when I pulled all-nighters in college. | | Tuesday, September 25th, 2007 | | 9:00 pm |
Hurray for Layoffs One of the best things about working where I do is the people I
work with. The development team is small, but everyone is friendly,
helpful, and extremely competent. When I've thought about this in the
past, I've always chalked this up to good hiring practices, but I
recently started to wonder if it might have to do with layoffs.
Before I joined the company, but after most of the people I work with
did, there were several significant rounds of layoffs. Could it be
that this left only the top talent? Once this is accomplished, it
might be self-sustaining, since really good people will hire other
really good people (that's what I like to think, anyway).
I've always heard that it works the other way around—that
once you start making cuts, everybody starts looking for other work
and the best people have plenty of opportunities, so you end up losing
them. But perhaps if you provide enough equity-based compensation and
give your employees some reason to believe that the company is in good
hands, you can avoid this. You'd have to do lots of other stuff
right, too, such as figuring out who to get rid of. And of course it
doesn't work at all unless you've got good people to begin with.
Linguistic side note: I almost wrote “figuring out
whom to get rid of,” but I just couldn't bring myself to
do it. I'm not sure I know anybody personally who would find that
construction natural. It sounds like something a non-native speaker
might come up with. | | Monday, September 24th, 2007 | | 8:04 pm |
Wow, Ruby is slow I'd always heard that ruby's interpreter was remarkably slow, but I
never really gave it much thought. I mean, people are always
complaining about high-level languages being slow even when they're
not, and I'd been using ruby for small projects here and there
(basically as a perl replacement) since 2002 with no trouble. And
when I say small projects, I don't necessarily mean that Ruby wasn't
doing much work. I've processed some large chunks of text with it,
but those were mostly with regular expressions that call some C
library routine in the background. I recently wrote a ruby program
that had to parse about five thousand lines (148KB) of XML, and I used
REXML, which is written entirely in Ruby, because I was hoping this
would simplify porting the program to Windows for my wife's use. Just
creating a list of objects to represent all the entries in the file
took eight seconds.
So I did a re-write in Haskell last week. The Haskell version
requires about half as many lines of code and runs in under a second.
I'd avoided Haskell initially because I didn't realize there was a
good Windows implementation. It's not like one of the primary authors
of GHC works for Microsoft or something. | | Sunday, August 19th, 2007 | | 11:52 am |
Democratic Debate I finally got to see a presidential primary debate. (It sucks that
many of the debates are only available on cable now, but that's a
whole different topic.)
( My Reactions )
Linguistic side notes: Obama consistently uses a double
copula. I've heard him do it before, and he did it again during
today's debate. Also, several different candidates made use of the
word troop
to mean a single person.
My (absurdly premature) prediction: Edwards will start losing ground because he's less
impressive, both in presentation and (to me, at least) in substance, than Obama and
Clinton. He'll then throw his support to Obama, who will take the nomination. | | Tuesday, August 7th, 2007 | | 11:40 pm |
Inheriting Points I ran into an interesting problem at work. Part of our in-house
libraries is a class that represents a point in 3-space. It's nothing
special: just three numbers with no other context. The problem is
that the application I'm currently working on uses points in two
different coordinate systems, and I occasionally found myself using
the wrong kind of point in the wrong place. I'm not going to get into my eventual
solution, but I didn't quite manage to solve it the way I wanted
to.
What I really wanted was for the type system to handle it. This is
what type systems are supposed to do, right? I have two different
types of things, and I want to make sure that I'm using the right one.
Unfortunately, I still want to do point-like things with both of these
types, and the only way to really get that behavior is to make them
both subclasses of point. Which means that if I have defined
point operator+( point, point ), and I do something like
subclass_A + subclass_B, both types get promoted to point,
and everything works just fine, which is exactly what I wanted to
avoid.
There are a couple different options, all unpleasant. I could go
forward with subclassing point and provide overloads for any operation
involving a combination of the subclasses that throws an exception (I
could probably even find a way to get a compile-time error with
BOOST_STATIC_ASSERT). Or I could make new classes that contain a
private point member and then go through and expose by hand all of the
point functionality that I want. Both of these options involve a lot
of annoyingly redundant code. I could also make a very thin wrapper class
with, say, a public point member, but then any code involving that
class will have lots of unwrapping and re-wrapping mixed in with the
actual computation.
I briefly thought that I'd come up with a brilliant solution in
which user-defined type conversions would allow implicit conversion
from my classes into points but confuse the compiler in expressions
involving points from both coordinate systems. But it didn't work
because point is actually a class template, and user-defined
conversion operators are applied during overload resolution, which
comes after template instantiation. So when passing one of my classes
to a function template that expects a point, the template can't figure
out what kind of point it's looking at because the argument hasn't yet
been converted to a point at all. As a side note, I think C++ is the
only language I've ever used where I've made (on more than one
occasion, in fact) a serious effort to confuse the compiler or trick
it into doing what I wanted. Not coincidentally, it's also the only
language I'm aware of where many of the standard idioms are referred
to as “tricks” (e.g., the Barton-Nackman Trick and the
Colvin-Gibbons Trick). | | Sunday, August 5th, 2007 | | 6:11 pm |
Baby on Board We went up to Cleveland this weekend for a wedding. According to
Google, the trip from our house to the Holiday Inn Cleveland South
takes three hours and seventeen minutes. When you factor in a
Zoë who is slightly constipated and not at all happy about being
strapped into a car seat, however, it takes closer to five hours. So
we missed the actual wedding portion of the wedding. The reception
was fun, but we didn't get to talk to people as much as we would have
liked because we were constantly struggling to keep Zoë happy
despite all the noise, the people, and the residual anger over being
strapped into a car seat.
The return trip also took about five hours, so the Zoë factor is
at least somewhat predictable. She slept all the way to Pittsburgh
when we went there over the Fourth of July. Maybe it's only
North-South travel that bothers her? I'll be curious to see how she
reacts to our next Pittsburgh trip.
In other news, I apparently look just like someone named Austin. I
was coming back to the hotel room after putting some stuff in the car
this morning, and when I walked out of the elevator, a young
(college-age) man said, "Hey--oh, I'm sorry. I thought you were
someone else." Then his mother came around the corner, looked
straight at me and said, "Are you guys downstairs?" To which her son
said, "No, Mom. That's not Austin." She was shocked: "Good Lord!
They could be brothers." | | Wednesday, June 27th, 2007 | | 11:10 pm |
Numbers and Factorials There's a lengthy discussion of factorial
functions over at Reddit. It was inspired by a Daily
WTF article in which an interviewer asked a potential employee to
write a “quick function” to compute the factorial of
“any given number”. The candidate failed miserably, and
the entire programming Reddit is howling at the sadness of it. The
problem I have with this is that, assuming the interviewer expected an
answer in Java, the question is designed to produce failure.
Producing a Java function to compute the factorial of “any given
number” is simply not a quick or easy thing to do, especially if the candidate didn't remember the details of java.lang.Bignum.
An int in Java can correctly represent the factorials of
numbers from zero through (wait for it...) twelve. Java's
long fares a bit better, going all the way up to 20!. This
is actually a case where using floating-point numbers to represent
integers is not a bad idea. With Java's double, you can
represent integers exactly up to 53 bits, which is enough for 18!, and
beyond that, you'll probably at least get the right order of magnitude
for a while. Best of all, when the floating-point numbers finally
give up on computing factorials, they'll give you infinity, which for
many applications is probably a perfectly good approximation (and will
almost always be better than the factorial mod 32 or 64).
What I really wish, of course, is that some mainstream programming
language would start giving people actual integers when all they ask
for is an int. I realize that 32- and 64-bit integers have
their place, but unless I ask specifically for one of those, what I
really want is an integer. The integers have some wonderful properties
that I've grown really quite fond of, like
x < x + 1
x ≠ 0 and y ≠ 0 → xy ≠ 0
x > 0 and y > 0 → xy > 0
∀ x, ∃ y such that y > x
and, of course,
n ≥ 0 → n! > 0
| | Monday, June 18th, 2007 | | 11:30 pm |
Emacs/Keyboard Trivia That stupid Windows right-click-menu key is mapped to M-x in emacs (at
least on the most recent Ubuntu). If anything needs a dedicated key,
that does. Almost makes me wish that I had one in a convenient location. | | Saturday, June 16th, 2007 | | 4:45 pm |
Parable of the Sower I finally read Parable of the Sower recently, and it was
fantastic. I should have read it years ago when wynndom
first recommended it to me (happy belated birthday, by the way), but I
was avoiding it because I hadn't enjoyed Butler's Wild Seed
very much. This isn't the first time that I've done something like
that: I avoided watching Buffy for years because I'd seen the
(truly awful) movie. There's probably a lesson I should be learning
here.
Anyway, both Parable and its sequel were excellent, and they
were built around some ideas that appealed to me quite a bit (like the
notion that we need to get off this planet). But they were also
frightening. Parts of the story made me feel like I ought to keep
some military-grade weapons around to defend my family in the event of
an extended economic downturn.
If you're looking for a gripping story with extremely well-drawn
characters, and you're not already terrified that your home will be
overrun by angry mobs and/or Christians, take a look at Parable of
the Sower | | Friday, June 15th, 2007 | | 12:18 am |
Not too long ago, it occurred to me that I could recite the title
of every Buffy episode in order, but I couldn't name all the
U.S. presidents (in any order at all). I've finally started using the
Nordic Track again (we both took a break from exercising for a while
after Zoë was born), which means I've got some spare time now
during which I can't really do anything useful, but my mind is basically
unoccupied. I intend to use this time to memorize the Presidents of
the United States along with the year each of them started to serve.
Then I'm going to move on to the naturally occurring elements and
their atomic numbers. Further suggestions are welcome. | | Thursday, June 7th, 2007 | | 11:57 pm |
Elizabeth has apparently been to busy to tell the latest bunny
story, so I guess I'll do it. While she was mowing the lawn the other
day, Elizabeth discovered that a bunny had made a nest in our yard,
inside the cat fence. This bunny has been inside the fence before,
and every time she comes in, she gets harassed by our cats. What
would make her think it was a good idea to put a nest in our yard is
beyond our limited human understanding.
So Elizabeth mowed around the nest, and then went out to collect
the (eight!) baby bunnies and put them outside the fence. Of course,
we can't stop them from coming back inside the fence, and last night
the cats had a baby bunny cornered in our bedroom in the middle of the
night. Elizabeth grabbed the poor thing, put it outside the fence,
and locked the cats inside the house, thereby saving the bunny.
So tonight, I was going to lock the cats in before going to bed.
Unfortunately, I didn't go to bed early enough, and about an hour ago
Tiger was chasing a bunny around our dining room. I chased them both
outside but didn't escort the baby bunny out of the fence. I figured
some of those bunnies are just doomed to die on account of their
mother's stupidity no matter what I do. But I just brought the cats
in for the night, and Tiger seemed hungry, so maybe the little guy got
away | | Monday, June 4th, 2007 | | 9:27 pm |
Programming Language Education I recently witnessed a discussion about what programming languages
should be taught to impressionable young CS students. Not for the
first time, I got to hear about how important it is to teach a
practical language like Java in introductory programming courses. I
never find the arguments in favor of Java especially convincing: it
isn't actually possible to teach the average freshman enough of Java
to make it a useful practical tool, and anecdotal
evidence suggests that teaching students Scheme first helps them
learn C++ better later on. But I can at least understand how an
otherwise reasonable person could come to the erroneous conclusion
that Java should be taught as a first language. What really bothers
me is something I discovered today.
I was talking to one of our co-ops about the classes he'd taken
this quarter when he mentioned Comparative Languages. Being a PL
geek, I asked him what languages they'd studied. His answer: C++,
Java, C#, and a little bit of Scheme at the end. Did they cover
hygienic macros or continuations or any of the really cool stuff in
Scheme? Of course not. I get the feeling they just tossed
enough cars and cdrs around to give the impression
that Scheme is “weird” and left it at that. This is like
offering a comparative religions class that focuses primarily on
Catholics, Anglicans, and Episcopalians, with a little Zoroastrianism
at the end to provide an example of a goofy minority faith. How do
you make a 10 week long class out of that?
Note to schools: If you really want to give your students a
practical skill, tell them about revision control systems. I'm amazed
by the number of new graduates we've interviewed that seem to have
gotten all through school (sometimes even grad school) without ever
encountering the concept. |
[ << Previous 20 ]
|