Tuesday, March 9, 2010

MODI @ Semantic Web Meetup!

The Semantic Web Meetup folks were nice enough to let me talk about Open Data a bit tonight. Had a great time--I'll talk about that in another post, but here's the slide deck for now.

Thursday, January 28, 2010

Oracle XE swap space workaround (a dpkg -X adventure!)

First off, if you must work with Oracle databases (and many of us must) Oracle XE comes in awfully handy sometimes. I've installed Oracle XE on every platform available. I need a dev install of
Oracle 10g more often than I'd care to admit.

Having run RH distros for years, I favor Debian these days. Usually, installing Oracle XE from the repo is trivial:

Add deb http://oss.oracle.com/debian unstable main non-free to /etc/apt/sources.list
Add Oracle's public signing key to the keychain and then install Oracle XE
    Get the key:
    # wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle
    # apt-key add RPM-GPG-KEY-oracle ...
    and install: # aptitude update # aptitude install oracle-xe
    # wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle
    # apt-key add RPM-GPG-KEY-oracle
    ... and install:
    # aptitude update
    # aptitude install oracle-xe

    (I use aptitude, sub apt-get or whatever floats your boat.)

    This time, it failed! The installer requires a certain amount of swap, which you may not have if you're running in a VM. Note that anything Oracle does require significant hardware resources, so be ready for performance issues. But for experimental and dev type use I usually don't care.

    If you get the swap error, try installing manually. The following works for me.

    XE does depend on libaio, so make sure you have it:
    # aptitude install libaio
    It also depends on libc6. You should already have that ;)

    Unless you've aptitude clean'ed, the deb that failed to install should be in /var/cache/apt/archives/. The deb is also downloadable from the Oracle website. You'll need a login for that.

    Copy/move the deb to a temp directory & unpack
    To do this you can use the dpkg -X command.
    $ dpkg -X oracle-xe-universal_10.2.0.1-1.1_i386.deb temp_directory
    will unpack a bunch of files.

    Copy the content of the deb archive to the right place. Note the #, you must su/sudo su to root or sudo these commands:

    # cd temp_directory
    # cp -R ./usr /
    # cp -R ./etc /

    Create a new user and a new group:

    # groupadd dba
    # useradd oracle -g dba

    Give the ownership of the /user/lib/oracle to this user :
    # chown -R oracle:dba /usr/lib/oracle

    Edit the nls_lang.sh and replace #!/bin/sh by #!/bin/bash:
    # nano /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh

    Run the oracle_env.sh to simplify the process:
    # cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/
    # chmod +x oracle_env.sh
    # ./oracle_env.sh

    Change the user rights on the oracle binary :
    # chmod u+s $ORACLE_HOME/bin/oracle; chmod g+s $ORACLE_HOME/bin/oracle

    You'll need to set two Oracle  settings.  Hat tip to Le Blog de Dun!
    Search for the variables:
    # cd /usr/lib/oracle
    # find . -exec grep "%sga_" '{}' \; -print

    I suggest searching. I found init.ora and initXETemp.ora (I'm betting the latter isn't used) but I'd rather be safe. Save a copy while you're at it. :)

    Grep should turn up two .ora files, you have to search for the %sga_target% variable and %pga_aggregate_target% and set them. In nano find is ^W.


    I suggest the following, but this will depend on how much memory you have.


    sga_target=146800640
    pga_aggregate_target=42205184

    Last step: execute the configuration script :
    # /etc/init.d/oracle-xe configure

    I suggest using a different port for the webserver (default is 8080), since you likely have or will have other apps on your machine who also want 8080. I usually take 4080.

    The other port is an Oracle default, you may need to change this if you have other Oracle installs on your machine.

    Sunday, November 29, 2009

    In praise of modern sewing machines

    I have seen heaps of praise for older sewing machines. I used to drive an old car, so I can sympathize. When it was running well it was great--good gas mileage, reliable, and really cheap. So if I had an older, workhorse sewing machine, I just know I'd love it too.

    I would like to heap praise on my new-ish, low end Kenmore sewing machine.

    But when I was a kid, my Nana had one of those 70s models, a Kenmore. It was lost in the selling or her house. But I can tell you, it never ran well. In fact, I was never allowed to touch it, since the timing seemed to go screwy if you looked at it funny. Maybe all it needed was the right tune up, but I don't quite believe it. Sewing machines, like cars, can just be lemons, after all. The right older car is a marvel, but plenty of them suck, too.

    When I wanted a sewing machine, I read the message boards and reviews. An older, metal machine from the 70s, seemed to be the consensus. So I looked at secondhand shops and on Craigslist and whatnot. I can tell you this--people selling some old machine in the basement still want a minimum of $100. No cabinet, no manual, just an old machine that has been sitting unused in a damp basement or hot attic or cold garage. Then I thought of my Nana's machine. Which is more likely: that the machine ran like a top before it fell into disuse, or that it fell into disuse because it was crappy?

    So I think of it this way--absolutely, a car that is over a decade old and runs like a top is a great purchase. So too an older, well-maintained sewing machine. Both are great finds. But like a car, sometimes you want to buy a sewing machine this weekend, or even this month. You can, in fact, just walk into a sewing or department store and buy a nice machine. Unlike cars, new sewing machines for light-duty, hobbyist sewers like me are comparable in price to used machines.

    A few years ago, I paid about $100 for a Kenmore 385. It's fantastic. It sews though most fabrics and isn't fussy. I'd buy it again and again (although thankfully I haven't needed to!).

    Don't be intimidated by the advice that you have to have an older model, like I was. I spent way too much time looking for a machine, that I wish I had spent sewing. If you want a new-to-you sewing machine, especially your first machine, take a second look at the new machines. They are not all junk. I just love mine. If it's a dud, just return it. No hand-wringing necessary. Look at the reviews--I'm very fond of my Kenmore, which was well reviewed. I'm glad I gave up the quest for an old machine. I'd rather get up early on the weekends to work on my projects than cruise yard sales and second-hand shops.

    Sunday, November 22, 2009

    Wang's in Somerville

    Fantastic meal at Wang's in Magoun Square last night. I hadn't been in probably a year, so I turned to this old Chowhound thread for advice.

    We ordered:

    sweet and sour shredded turnip
    cucumber with garlic sauce
    Peking style shredded pork with plum sauce
    spicy shredded beef with hot peppers
    Singapore rice sticks (shrimp and pork)

    The turnip (My Wang's staple, always fantastic) and cucumber are cold appetizer dishes, and a great start to the meal. I didn't get the famous dumplings but will likely get some of those for the holidays soon. (They sell them frozen in packages of 50.)

    The pork, beef and noodles turned out to be a great combination. The rice noodles were surprizingly gingery and a great foil to the beef with peppers and sweet pork. The noodles were a bit spicy too, and we finished the plate. I'm still thinking about it 12 hours later!

    Saturday, November 21, 2009

    Corn Chowder, Clam Linguine, and a cup of coffee

    We had a lovely time at the Harvest Moon Fair at the Arlington First Parish Unitarian Universalist Church. We wandered the booths and didn't buy much, seeing as my house could reasonably pass as a giant white elephant table at some fair. But no matter, the main attraction for me has always been the Harvest Café.

    Amongst the offerings this year was Jasper White's Corn Chowder, which I excerpt below, courtesy of What Did You Eat? and Kitchen Confit, not to mention the book 50 Chowders, which sounds like my kind of cookbook. Hmm, I think I need a trip to the Summer Shack.

    Corn Chowder (Jasper White, 50 Chowders)

    3 medium ears fresh yellow or bicolor corn (or white)

    4 ounces slab (unsliced) bacon, rind removed and cut into 1/3-inch dice (or use some diced thick cut, sliced bacon)

    2 tablespoons unsalted butter

    1 medium onion (7 to 8 ounces), cut into 1/2-inch dice

    1/2 large red bell pepper (6 to 8 ounces), cut into 1/2-inch dice

    1 to 2 sprigs fresh thyme, leaves removed and chopped (1/2 teaspoon)

    1/2 teaspoon ground cumin

    1/8 teaspoon turmeric

    1 pound Yukon Gold, Maine, PEI, or other all-purpose potatoes, peeled and cut into 1/2-inch dice

    3 cups chicken stock or chicken broth

    Kosher or sea salt and freshly ground black pepper

    2 teaspoons cornstarch, dissolved in 2 tablespoons water

    1 cup heavy cream--or 3/4 cup 1% milk and 1/4 cup heavy cream

    Garnish: 2 tablespoons minced fresh chives or thinly sliced scallions

    Method

    1. Husk the corn. Carefully remove most of the silk by hand and then rub the ears with a towel to finish the job. Cut the kernels from the cobs and place in a bowl. You should have about 2 cups. Using the back of your knife, scrape down the cobs and add the milky substance that oozes out to the corn kernels.

    2. Heat a 3- to 4-quart heavy pot over low heat and add the diced bacon. Once it has rendered a few tablespoons of fat, increase the heat to medium and cook until the bacon is crisp and golden brown. Pour off all but 1 tablespoon of the bacon fat, leaving the bacon in the pot.

    3. Add the butter, onion, bell pepper, thyme, cumin, and turmeric and sauté, stirring occasionally with a wooden spoon, for about 8 minutes, until the onion and pepper are tender but not browned.

    4. Add the corn kernels, potatoes, and stock, turn up the heat, cover, and boil vigorously for about 10 minutes. Some of the potatoes will have broken up, but most should retain their shape. Use the back of your spoon to smash a bit of the corn and potatoes against the side of the pot. Reduce the heat to medium and season the chowder with salt and pepper.

    5. Stir the cornstarch mixture and slowly pour it into the pot, stirring constantly. As soon as the chowder has come back to a boil and thickened slightly, remove from the heat and Stir in the cream. Adjust the seasoning if necessary. If you are not serving the chowder within the hour, let it cool a bit, then refrigerate; cover the chowder after it has chilled completely. Otherwise, let it sit at room temperature for up to an hour, allowing the flavors to meld.

    6. When ready to serve, reheat the chowder over low heat; don't let it boil. Ladle into cups or bowls and sprinkle with the chopped chives. Serves 4, as a first course.

    Picking up the gauntlet? again?

    Creative Knitting (ravelry link) just came in the mail. I haven't picked up needles or hooks in months. So of course I just queued Drop the Gauntlet. Maybe they would be a good get-back-into-it project. Not that I have *ever* produced 2 wristlets that matched enough in size to wear. Maybe the scarf is where I start!

    Thursday, November 12, 2009

    POI, bringer of HSSF and XSSF

    I can't say enough good things about Apache POI. Just fantastic--I'm using it to parse xls files, but it can read and write many MS formats. I plan on posting a writeup this weekend.