TheJach.com

Jach's personal blog

(Largely containing a mind-dump to myselves: past, present, and future)
Current favorite quote: "Supposedly smart people are weirdly ignorant of Bayes' Rule." William B Vogt, 2010

Can your SQL database do this?

New to LucidDB-dev (and soon 0.9.4) are a handful of scripting modules that support many different languages, such as Jython. Writing code in Java and loading it as a JAR in LucidDB is fun, but cumbersome; thanks to the standards in Java 6 though one can use JavaScript (bundled with Java) or, my preference, Python. As a fun example, let's grab a list of tweets to insert!

There's a Python twitter client here: http://code.google.com/p/python-twitter/ whose dependencies are easy to satisfy. (For Jython, see http://old.nabble.com/Easy_install-on-jython-2.5-td23525500.html for getting an "easy_install" on Jython to get the dependencies.) Just run the Jython's easy_install with "oauth2" and "simplejson" as arguments, and then run jython build.py install inside the twitter client's download folder. If you're good to go with Jython, go get a dev version of LucidDB. Make sure you add your Jython JAR to the classpath.gen file before starting it! For me, that's /home/kevin/jython2.5.2/jython.jar.

There is a caveat here: because we're relying on packages in Jython's site-packages folder, and because we're using the jython.jar in a ScriptEngine behind the scenes, we have to load the sys path ourselves. Fortunately this is done by adding the code import site to our Python, which the standard Jython does behind the scenes by itself.

See Full Post and Comments

Hello Unicode!

I introduce you to a cross product of A×B! Or something.

Anyway, my blog now officially supports unicode. That was fun! Or not. My blog is programmed in PHP, and as anyone who's done much PHP knows, nice Unicode handling is a far-off dream in the magical PHP 6. Python handles unicode so much nicer... To convert a code base in PHP to unicode, there are a bunch of functions you have to change and watch out for. Luckily this isn't too tedious as most of them are string functions, and with some clever scripting we can find all the spots in the code that need fixing up. (I also thought about some scripting to do the replacing for me, but I didn't have that many and I like to verify things manually sometimes.)

First up is a helpful guide: http://www.phpwact.org/php/i18n/utf-8 You should definitely skim through that before starting any unicode conversion project, as there are quite a few things you have to worry about. For now, let's get a list of all the string functions we need to change.

See Full Post and Comments

Against explaining to grandmothers

The phrase "explain it so that my grandmother could understand" is horrible. Did your grandmother spend the last decade thinking about Fermat's Last Theorem too? (Mine didn't.) If not, then sorry, I don't think Andrew Wiles could explain his 100-page proof to her--he'd be lucky to explain it to a graduate student of mathematics.

The use of the phrase always seems so condescending, as if all complicated topics are so easy to understand that they can be explained to a random grandmother in a few minutes. When someone says this phrase, it's frequently code for "I don't understand the words coming out of your mouth--could you use less jargon?" But saying it flatly admits ignorance, and we monkeys can't have that--it'll lower our status! Especially if we're interviewing someone who is supposed to become a good subordinate if accepted into a position--we can't have someone smarter than us!

It's a weird exchange when the inferior (in the immediate sense) member of a pair is the one being condescending. It's a proud display of ignorance, a rude display of ignorance. Personally, I think rudeness should be restricted to those who have something to be rude about--e.g. the person who is trying to explain something while avoiding all the jargon-words that he's taken for granted 8 hours a day in his school or work. Phrases like "My grandmother could understand this!" or "My grandmother's dog already understands this and has moved on." are used by those in the knowledgeable position trying to teach, as a way of being rude as well as trying to say that the topic isn't so hard--any fool can learn it given the time.

See Full Post and Comments

The FFP Machine Implemented With An FPGA

Edit: If you're interested in reduction machines for functional programs in general, especially ones that work and have had three years of development as opposed to three weeks, checkout these guys: The Reduceron.
Edit 2: Also check out this Non-Von Neumann computer!

As I previously hinted, I worked on an FFP Machine recently for a school project. Unfortunately I only had about three weeks to work on it (along with everything else going on), so that time was largely spent just understanding the FFP Machine, and I didn't get very far in the code. (The code referenced in the paper to download doesn't even compile to Verilog yet, and I've actually scrapped what's there in a new project that I'll share if I work more on it. Also, the school won't have copyright over the new project.)

So my paper is largely a summarization of what the FFP Machine is and does, along with a collection of the best resources I found out there in case you want to learn more. I also may convert parts of it into a Wikipedia page since once does not currently exist for the FFP Machine. If you have any questions (or want any of the papers in the sources) feel free to email me (see the About page at the top), though I can't guarantee I'll be able to help. Anyway, below is my Paper in HTML form, for the benefit of Google and for my own word-count tracker. If you want to read on, I highly recommend reading the PDF version outputted from LaTeX. It is uploaded here.

See Full Post and Comments