Archive for April, 2008

BMW M3 head machined and cleaned

Sunday, April 27th, 2008

BMW M3 cam case cleaned
More photos: BMW M3 head photo set

The M3 head just came back from the machinist about a week ago and it looks wonderful but unfortunately I didnt send off the cam case and other parts to be media blasted along with the head. So this Saturday I spent the day with the parts cleaner at my friends shop A1 Imports Autoworks in San Rafael. It saved me a little bit of money and I had to inventory anyway. I cant wait to put it together!

Photography from Mount Tamalpais

Tuesday, April 22nd, 2008

Rrecently I took one of my favorite drives up towards Mt Tamalpais and eventually ended up at Point Reyes where we drove through the farms. Here are some of the photos from the trip, as well as some random ones from my various trips over the years. You can see the rest of these photos on the new flickr site for John Clarke Mills!


A rock climber up on the top



Here is one of the 2002 I really liked. This was a beautiful back road leading down Mt Tamalpais toward Stinson Beach. Fern-covered forests down redwood lined streets for miles and miles. The farm roads in Point Reyes are just as enjoyable.

The BMW 2002 near a stream

PipedInputStream and PipedOutputStream with Java

Thursday, April 10th, 2008

Today I came across an interesting concurrency problem while deleting objects from the Social Graph (Semantic Web remember?). I have been tasked with mass deletes throughout our system, including exporting the objects in case they ever need to be reassembled again. Since our graph is so large, and we could potentially be deleting 10’s of thousands of triples at a time, the serialized XML would be about 10 times that many lines per triple represented in a file. In order to write the output to a file as fast as can be there was no need to store the serialized XML in memory. The best thing to do was to pipe the output stream to our binary store.


Now in order to do this, I need two threads, one to write and one to read. If you were to do this with one thread you would most likely run into a nasty deadlock situation. Anyway, here’s what I came up with:


public InputStream openStream() throws IOException {
    final PipedOutputStream out = new PipedOutputStream();

    Runnable exporter = new Runnable() {
        public void run() {
            tupleTransformer.asXML( tuples, out );
            IOUtils.closeQuietly( out );
        }
    };

    executor.submit( exporter );

    return new PipedInputStream( out );
}


Can anyone see the problem? Well unfortunately I couldnt either for over an hour. My unit tests would pass sometimes and fail others which led me to believe I was dealing with a timing issue. Turns out, sometimes the PipedOutputStream was completed before the PipedInputStream was even instantiated, completely missing the stream of the out.close(). The trick was to instantiate the two streams, in and out, at the same time then start the output with another thread. Problem solved. Here is what the finished product looks like:


public InputStream openStream() throws IOException {
    final PipedOutputStream out = new PipedOutputStream();
    PipedInputStream in = new PipedInputStream( out );

    Runnable exporter = new Runnable() {
        public void run() {
            tupleTransformer.asXML( tuples, out );
            IOUtils.closeQuietly( out );
        }
    };

    executor.submit( exporter );

    return in;
}

My first vacuum tube amplifier

Tuesday, April 1st, 2008

Cary SLI-80 vacuum tube amplifierFor a long time now I have been interested in vacuum tubes. I love their simplicity, sound, and the fact that the design hasnt changed since the early 1900’s. They also were used as transistors in early computers before the solid state transistor was invented. 50 years ago it would take an entire room of these to power a computer with less memory than a Casio wristwatch.


Anyway, this is a beautifully hand made oil-filled-cap integrated amplifier than runs in 80-watt Class A/B ultra-linear mode and 40-watt triode mode. I have it fitted with a set of Russian Electro-Harmonix tubes, the power coming from two sets of KT88’s. The sound is quite crisp with little to no hum or background noise which is surprising considering tubes are known for these issues. This paired with a set of Kef iQ5 floor standing speakers are wonderfully crisp and clean, especially with vocals. Now, to fix the weak link, the 5 dollar garage-sale bought record player. More to come on the DIY record player later.