preload
Apr 27

Scala is pretty damn neat.  I’ve only just started learning the language (an earlier attempt had to be sidelined because “real” work interfered), but I’m back to it now. Continue reading »

  • Share/Bookmark
Tagged with:
Nov 12

One of the things I have in my Scala startup file is the following.

def show[T](implicit thetype:scala.reflect.Manifest[T]) {
  thetype.erasure.getMethods() foreach println
}
def help(x:AnyRef) {
  x.getClass().getMethods() foreach println
}

These silly little functions are useful – at least, to me. Now when I can’t remember the name of a method I can type something like the following at the Scala prompt. Continue reading »

  • Share/Bookmark
Tagged with:
Sep 30

java_logo_2Just a short note on an item that bugs me about Java.  In C++, I tend to use exactly three kinds of method parameters.

  • A const reference.  I don’t want to copy it, but I promise not to modify it, either.
  • A reference.  I might modify it.
  • A copy.  I might modify my local copy, but not the original.  I’m getting a copy, after all.

Easy peasy in C++.  In Java?  Uh, I pass all objects by reference. Continue reading »

  • Share/Bookmark
Tagged with:
Aug 21
Programming

Programming

I spend my time (recently) writing a mishmash of Python, C++, and Java. It’s interesting to switch back and forth.

What’s a good idea and what’s a bad (or dangerous) idea in computer language design? We’ve got a lot of candidates, and a lot of opinions.

I’ll list a few here, along with a few places where they show up. Continue reading »

  • Share/Bookmark
Tagged with:
Jun 14
Programming

Programming

I recently heard about a Car Talk puzzler.  I don’t listen to Car Talk as much as I used to.  Anyway, you can read about the puzzler and the fellow who solved it here.  This is an excerpt.

During Christmas week on the popular National Public Radio show Car Talk, the weekly puzzler required listeners to find the longest English word that remains a valid English word as you remove its letters one at a time, but without rearranging any of the letters. For example: sprite, spit, pit, it, I. There are many such words, but, as Barr discovered, only one with 11 letters.

So, only one word with eleven letters: complecting.  Maybe.  I’m not convinced, but finding out is easy.
Continue reading »

  • Share/Bookmark
Tagged with:
May 29
Programming

Programming

I need to generate multipart/form-data (see here) messages from Python. Never mind why. I dug around in the documentation for httplib, urllib, and urllib2, but it seems this is not currently supported (it’s Issue 3244). I didn’t like the code I found on the web to do it, because I needed to set additional headers on each piece. So… I wrote something. Here it is. If it’s useful to you, great! If you find bugs in it, please let me know. I think this is pretty easy to use.
Continue reading »

  • Share/Bookmark
Tagged with:
May 25

In “Embracing Change with Extreme Programming” (IEEE Computer, 1999), Kent Beck writes:

Some methodologies, like Cleanroom, prohibit programmers testing or in some cases even compiling their own programs.

As evidence of this he cites the text Cleanroom Software Engineering: Technology and Process, by, among others, yours truly.  I for one have never said that people should not run unit tests, nor does the above text say that.  I emailed Mr. Beck about it, and he confirmed that he did not get this from the cited text.  Whew!

Just to be clear, here is my position.  I would never tell anyone not to run a test they felt was necessary. I may personally believe there are efficient and inefficient ways to test, but I’m not an expert in every domain.  The people who create a product are responsible for the consequences of release of that product, and should act accordingly. Continue reading »

  • Share/Bookmark
Tagged with:
Apr 14

java_logo_21Grrr.  I really wish Java had either:

  • Reified generics or
  • Closures

In the interim, I offer the following Java code to the world.  Does it help?  Use at your own risk.

Continue reading »

  • Share/Bookmark
Tagged with:
Mar 30

1ebeb1d2f212046a4e47fcd414dbad9b1I’ve been doing some nasty database work with Python and MySQL.  Specifically, I’ve got long programs that run eight to ten hours, and sometimes I need to kill them and restart them later.

So… I wanted a way to trap CTRL+C and clean up.  That is, I wanted to have transactions without actually having to use transactions.  I’m funny that way.  (In other news, I’m probably moving to PostgreSQL at some point.)

Anyway, here’s what I came up with.  You might find it useful, too. Continue reading »

  • Share/Bookmark
Tagged with:
Mar 17

computer science: n. a study akin to numerology and astrology, but lacking the precision of the former and the success of the latter.

– Stan Kelly-Bootle, The Devil’s DP Dictionary

I’d say the above is no longer true: computer science is successful.  But it really isn’t very precise.

The field of computer science is probably the area of knowledge that is closest to pure gibberish. Continue reading »

  • Share/Bookmark
Tagged with: