Food, Inc.

December 4th, 2009

I watched Food, Inc. last night. Was not impressed. Yes, we mass-produce food. Yes, it’s gross in parts. But so was the small-scale chicken slaughtering the film touted. Why is a smaller, open-air assembly line better than a larger, more environmentally controlled one?

Plus they played with the stats too much. “There used to be X thousand meat processing plants, but now 13 produce 80% of the meat in this country.” This doesn’t tell me anything. That last 20%, is that 2,000 smaller plants? Or 3 other really huge ones? What percentage did the top 13 used to produce? Apples-to-oranges statistical comparisons make me distrust the source.

Not to say it was all bad. The patenting of GMOs and the strong-arm tactics of their producers are definitively abusive, which I have ranted about before.

But overall, it seemed more anti-corporate, anti-science and hippy-ish than anything resembling a reasonable collection of recommendations on how to better our food production system.

XiMpLode

July 29th, 2009

It has been said before, but it deserves repeating: XML is overused. And often, made unnecessarily over-complicated for the task. Take for instance the example “A Simple Soap Client“.

Here is the request:

<?xml version="1.0"?>
<SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  <SOAP-ENV:Body>
    <calculateFibonacci
      xmlns="http://namespaces.cafeconleche.org/xmljava/ch3/"
      type="xsi:positiveInteger">10</calculateFibonacci>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Here is the response:

<?xml version="1.0"?>
<SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" />
  <SOAP-ENV:Body>
    <Fibonacci_Numbers
      xmlns="http://namespaces.cafeconleche.org/xmljava/ch3/">
      <fibonacci index="1">1</fibonacci>
      <fibonacci index="2">1</fibonacci>
      <fibonacci index="3">2</fibonacci>
      <fibonacci index="4">3</fibonacci>
      <fibonacci index="5">5</fibonacci>
      <fibonacci index="6">8</fibonacci>
      <fibonacci index="7">13</fibonacci>
      <fibonacci index="8">21</fibonacci>
      <fibonacci index="9">34</fibonacci>
      <fibonacci index="10">55</fibonacci>
    </Fibonacci_Numbers>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Dear $DEITY, why do we need to define a new data type to hold a list of integers? And what in the world is that “index” attribute doing there? IT’S A FUCKING LIST. This is like a real-life example of the old XML binary encoding joke:

<data>
  <binary>
    <bit index="0">0</bit>
    <bit index="1">0</bit>
    <bit index="2">1</bit>
    ...
    <bit index="n">1</bit>
  </binary>
</data>

It’s just sad…

For the sake of it, let’s compare to a JSON-RPC version: (not the epitome of efficiency mind you, but an order of magnitude better)

--> { "method": "calculateFibonacci", "params": [10,], "id": 1}
<-- { "result": [1,1,2,3,5,8,13,21,34,55], "error": null, "id": 1}

Which would you rather use? :)

Touchstone

July 21st, 2009

I was originally quite sceptical about the value of the Palm Pre’s Touchstone wireless charger accessory, esp. at its ridiculously high advertised price. However, now that I’ve had it for a week, I’m a total convert. It’s so nice to be able to just plunk the thing down at night and pick it up again in the morning without having to fumble with cords or those crappy plastic covers every cell phone manufacturer seems to love these days. Thanks Palm for coming back from the dead and giving Apple a good run for their money. :)

Tent Stakes in Sand

July 2nd, 2009

My bivy tent is so low profile, I’ve never had a problem with wind when beach camping as long as I’ve had some oversized steel stakes ($2 for 4 at Walmart). But my dome tent is more problematic, as Lingyan and I learned in South Padre over memorial day.

So a little googling led me to “deadman anchors”, which are basically anything buried in the ground. A basic design is some angle iron and steel cable. So a trip to Lowes and a few minutes assembly, and I have the following:

deadman anchors

1 4ft piece of aluminium angle iron, cut into 4 6″ sections. 4 3ft sections of 1/16″ steel braded cable. 4 eye loops, and 4 pairs of cable crimps. <$15 total.

We’re beaching camping again this weekend at Mustang Island. Will update with how well they worked.

Ubuntu 9.04 finally supports the UTDALLAS network!

April 17th, 2009

Well, Ubuntu has supported it for a while via the wpa_supplicant tool, but finally the GUI network manager works without a hitch. Here’s what you need to select from the GUI:

Security: Dynamic WEP (802.1x)
Authentication: Protected EAP (PEAP)
PEAP Version: Automatic
Inner Authentication: MSCHAPv2

Plus your UTD username/password.

To upgrade, hit Alt-F2 and type in “update-manager -d”.

Easy Python/Numpy CUDA/CUBLAS Integration

April 13th, 2009

CUDA is Nvidia’s C-like API for non-graphic number crunching on their 8xxx level and above video cards. For certain operations, it is amazingly fast. Unfortunately, it is painful in the extreme to use, especially when compared to Numpy, Python’s wonderful scientific computing package.

So, to marry the two, I wrote for myself some wrapper code. It’s pretty much only good for one thing: multiplying large matrices together really fast. But it’s really good at it. (and it’s really easy to use) For example:

import numpy
from pycublas import CUBLASMatrix
A = CUBLASMatrix( numpy.mat([[1,2,3],[4,5,6]],numpy.float32) )
B = CUBLASMatrix( numpy.mat([[2,3],[4,5],[6,7]],numpy.float32) )
C = A*B
print C.np_mat()

All CUBLAS alloc and free calls are mapped to the CUBLASMatrix object’s life in Python, so you don’t have to worry about memory management. (other than filling up the card, or course)

Here are some performance numbers: (includes memory transfer times)
(4160×4160)*(4160×4160) = 43.0X faster than numpy
(4096×4096)*(4096×4096) = 34.0X
(3900×3900)*(3900×3900) = 47.3X
(2048×2048)*(2048×2048) = 28.2X
(1024×1024)*(1024×1024) = 58.8X
(512×512)*(512×512) = 24.1X
(256×256)*(256×256) = 6.3X
(128×128)*(128×128) = 1.1X
CPU: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz stepping 06
GPU: nVidia Corporation GeForce 8800 GT (rev a2)

Note: This version only supports float32.
Note: CUBLAS limits matrix dims to (65536×65536).

Source code available here: pycublas.py (rename download to pycublas.py to use)

Wedding

December 30th, 2008

Marrying Lingyan has been the most wonderful, exciting experience of my life. :)

Here are some wedding photos.

Don't Register at Target

December 19th, 2008

My fiancĂ©e and I registered at Target a few days ago, and after spending more than a little time wandering the store with the special scanner gun they give you, we handed it back to them and they said “Thank you very much! Your items will be viewable online within 1-2 hours.” We said great, went home, and went to bed.

The next day I tried to look it up online, and low and behold we have an empty registry. I call up the local store, and they explain the syncing happens automatically, wirelessly through the unit. They assured me it wasn’t sitting around unsynced somewhere, forgotten. They then transfer me to some regional office, they transfer me to general customer support, who transfers me to the bridal registry, who assures me (quite curtly) it’s in the system, just that it takes up to two days to display on the website. She said there was nothing to do but to wait another day, and call back if it didn’t appear.

Well, today, it’s still an empty registry. I go through the same series of phone calls again, and I’m told there are no items registered in either system, and that we need to return to the store to select the items again. Or, “we have convenient registry access online! You can pick out what you want there without having to go back again!” Gee, thanks lady. I’m astonished by the ease and convenience of the options you have presented me, and and eternally thankful for the care and level of professional support Target has provided me so far. Would you please delete my registry from your system?

Grrr. Argh.

Google's N-gram Corpus LDC2006T13

December 9th, 2008

Google’s LDC2006T13 corpus is organized in an understandable but slightly annoying way; as a tar of split gzipped files. To avoid having to untar it repeatedly, (in fact, at all, as it’s >100GB extracted), I wrote a small Python generator that let’s you iterate over them in their compressed state. Usage is something like this:

corpus = LDC2006T13()
for ngram, count in corpus.ngrams(3):
  print ngram, count

Code is here: LDC2006T13.py

*BOOM*

November 24th, 2008

I’ve been a home-brewer for I suppose a year and a 1/2 now. (My friend John got me interested several years ago in AL) And I made another batch last night. Here’s the recipe:

  • 1 can Cooper’s Stout extract
  • 6 lbs DME
  • 2 tsp premium vanilla extract
  • 1 lbs uncooked oats
  • small handful of 88% cocoa bitter chocolate

On a side note, some people look down pretty hard on those of us who use the canned extracts, but they taste great to me. And they’re easy to work with, you get a consistent flavor, etc. Maybe years from now I’ll laugh at my current naivetĂ© while cooking over a $200 10-gallon stainless steel mash pot next to a $500 immersion chiller, but I currently suspect that will be more post-hoc expense rationalization and less about the actual flavor of the beer.

But anyway, 6 lbs of dried malt is a lot. My last batch was 4.5 lbs. Usually 3 is used, if making an all-malt batch and you want 6% ABV, or 1.5 if you’re making an 50% batch (malt+dextrose) The 4.5 batch bubbled over out of the fermenter and all over the floor, which I had forgotten. So my surprise was pure stupidity seeing the same this morning.

So I cleaned it all up, mopped, and marveled at the non-trivial breeze coming from the air-lock at the top of the bucket. (not to mention that amazingly delicious yeast-orgy smell) And then sat down to call around for a new clutch for my washing machine. (I didn’t even know they had clutches until last night…another story) I was on hold for what seemed like forever waiting for someone to check their stock, when *BOOM*. I run into the kitchen, and beer is everywhere. Walls, floors, papers, you name it. The air lock had gotten plugged, and the carbon dioxide buildup had blown the lid of the fermenter clear across the room. Fuck.

So I cleaned up again. :)

Fortunately I was here and could re-sanitize the lid and get it back on before it was spoiled. And it’s still bubbling away like no tomorrow. I guess we’ll find out how it tastes in another 2 months or so…


<Kered.org>   © Copyright 2000-2005 by Derek Anderson
Get Firefox