Hidden binary message on coyote creek trail

I came across this while I was out running today. Its on coyote creek trail next to Metcalf road. Its a binary message engraved into a piece of granite on the right side of the trail when heading south. I have been running on this trail for 4 years and I have never seen it before, however the county came through and cleared out the brush and it caught my eye while I was out.

Coyote Creek Trail Binary Message

The message isn’t anything fantastic, but just the fact that someone from the county (I presume) had the gumption to put this on a bike path heading through Santa Clara County is really quite cool.

The GPS Coordinates for this are N 37° 13.66′, W 121° 44.67′

I found this on Google …. http://www.sjparks.org/Trails/coyote/index.asp, however the binary does NOT decode to “Silicon Valley” 🙂

I emailed San Jose city who owns the website above, we’ll see if they fix the 2 typos (its not etched in 2 languages)

Posted in Uncategorized | Comments Off on Hidden binary message on coyote creek trail

Chocolate Stout

Chocolate StoutI brewed this once, this now includes pictures and some adjustments which will be my next brew attempt. I don’t have a good name for it yet, but I usually do that after I play with the recipe and make a couple batches. Even though this was my first batch, I feel it came out really clean with a really great taste. The chocolate wasn’t over powering, but on the next batch I think I will add some carapils for better head retention.

Ingredients

  • 6 pounds Briess Sparkling Amber DME
  • 1 pound Briess Caramel 80L
  • 1 pound Briess Organic Roast Barley
  • 1 pound Briess Organic Chocolate
  • 1/4 pound Briess Carapils
  • 2 oz Tettnang Whole Leaf Hops
  • 2 Packages Safale US-05 Yeast
  • 1 teaspon Irish Moss
  1. Mash grains in 4 quarts of water @ 165 dgrs for 30 minutes
  2. Rinse grains with additional 4 quarts of water at 155 dgrs
  3. Bring 10 quarts of water to a boil, add grain extract
  4. Add 3 pounds DME
  5. Boil 15 minutes
  6. Add 1 oz Tettnang hops
  7. Boil 30 minutes
  8. Add remaining 3 pounds DME
  9. Boil 10 Minutes
  10. Add remaining 1 oz Tettnang hops
  11. Add 1 teaspoon of Irish Moss
  12. Boil 15 minutes
  13. Cool off to about 70 dgrs, and fill water level to 5.5 gallons
  14. Pitch yeast!
Stout 12 hours after yeast pitched

Stout 12 hours after yeast pitched

  • OG: 1.063
  • FG: 1.020
  • ABV: 5.64%
  • IBU: 29
  • SRM: 50
Posted in Home Brewing | Comments Off on Chocolate Stout

Creating a threaded QObject in QT

There are times when you need a worker thread in QT, that is more then just fired off to do work and forget. In the past, I have derived from QThread, implemented Run() and did the work I needed to do and exit. But there are times where you want to create a thread that can interact with QT like the main thread, handling events and slots, and do so asynchronously without being blocked or blocking the main thread. The process to do this is really not obvious, but its a pretty slick setup that is new to QT 4.4, and from I can tell the documentation is lacking and still showing common practice in having the user derive from QThread.

The steps I usually take to do this is create my object (QObject or QWidget derivitive) that I want to thread, and make the QThread a member of that class.

class CWorker : public QObject
{
Q_OBJECT
public:
    explicit CWorker(QObject *parent = 0);
    virtual ~CWorker();
private:
    QThread    * m_pThread;
};

My intention, is that I want my Worker object, that is going to be receiving events is going to live in the context of its member thread.

In the CTOR of CWorker, I setup the thread, and change the context of CWorker to this new thread.

CWorker::CWorker(QObject *parent) :
    QObject(parent)
{
    m_pThread = new QThread;
    m_pThread->start();
    moveToThread( m_pThread );
}

In the DTOR, I allow it to exit the thread, join it back and then delete it entirely. The premise is that QThread, without overriding Run(),  calls exec() and allows for normal typical execution of the object and slots its monitoring. Calling moveToThread() moves the event handling from the global event loop into the event loop within the new QThread.
CWorker::~CWorker()
{
    m_pThread->exit( 0 );
    m_pThread->wait();
    delete m_pThread;
}

So now, If I add a slot to CWorker, any code executed to that object will be executed on that objects thread. For example ….

CWorker

class CWorker : public QObject
{
Q_OBJECT
public:
    explicit CWorker(QObject *parent = 0);
    virtual ~CWorker();
public slots:
    void SayHello();
private:
    QThread        * m_pThread;
};

void CWorker::SayHello()
{
    qDebug() << "Er, Hello. My ThreadId is: ";
    qDebug() << QThread::currentThreadId();
}

MainWindow

void MainWindow::on_pushButton_clicked()
{
    qDebug() << "MainWindow ThreadId: ";
    qDebug() << QThread::currentThreadId();
    if( !m_pWorker )
        m_pWorker = new CWorker;
     QMetaObject::invokeMethod( m_pWorker, "SayHello", Qt::QueuedConnection );
}

I created a button on my mainwindow, that when pushed creates the worker thread on the first call (Lazy Instantiation). It then executes the method in its thread space via invokeMethod. The net result is code executing in two separate threads.


Starting /home/jimster/Foo/Foo...
MainWindow ThreadId:  3057285904
Er, Hello. My ThreadId is:  3055655792
MainWindow ThreadId:  3057285904
Er, Hello. My ThreadId is:  3055655792
/home/jimster/Foo/Foo exited with code 0

There I started the application, pressed my button twice, and then closed the application. I should refer to people who wish to read more on this subject to start at this blog entry from a QT author.

http://labs.qt.nokia.com/2010/06/17/youre-doing-it-wrong/

Posted in Software | Comments Off on Creating a threaded QObject in QT

limbgomp causing cerr to segfault in perlxs

I was messing around with swig, its really a quite nifty. I wanted to see how simple it was to make a C++ library available to language of your choice, and really it is indeed quite simple. Everything was beautiful, until …

I hit a snag …

Whenever I sent data out cerr my application would segfault. Whenever I did _anything_ with cerr, my application would segfault. I googled like a mad man ….

http://groups.google.com/group/hugin-ptx/browse_thread/thread/51bd6ca9ced92fc8

Damn near identical, except with python. I did the _exact_ same work around with vaccine.i, and sure as shit that worked! WTF!

I started stripping off libraries (I have quite a few in my code), and killing ImageMagick did the trick. My segfault disappeared. So I started debugging what libraries ImageMagick was bringing in …

imaginos@rosebud /home/work/tools $ Magick++-config --libs
-L/usr/lib -lMagick++ -lMagickWand -lMagickCore -ltiff -ljpeg -lbz2 -lz -lm -lgomp -lpthread -lltdl
imaginos@rosebud /home/work/tools $

And I noticed libgomp, that bastard. Putting all that back except libgomp, and everything ran perfectly. Dropping libgomp back in, and segfault returned.

I googled some more ….

http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=16453

I tried the “solution” at the bottom …

imaginos@rosebud /home/work/tools $ LD_PRELOAD=/usr/lib/gcc/i486-pc-linux-gnu/4.4.4/libgomp.so ./Unf.pl
some data from cerr
imaginos@rosebud /home/work/tools $

Damn, so It really is libgomp.

Unfortunately, as of right now, I have no fix for this. My only workaround is to compile ImageMagick without openmp support. I don’t need it, I don’t need ImageMagick to need it. I don’t need libgomp for anything else. The weird thing, is my laptop has a slightly more up-to-date installation of Gentoo, and its fine. Even with libgomp enabled. So there must be some other additional underlying issue that is causing this.

 

Posted in Gentoo, Software | Comments Off on limbgomp causing cerr to segfault in perlxs

OBD II Code P-0441 on my 2003 Dodge Ram 2500

While giving a coworker a ride home from work the other day, the check engine on my truck came on. I bought this truck new in 2003 and up until now I have had no issues with it whatsoever. My previous truck was a 1987 Chevy 1Ton, and I recalled being able to get the error codes by cycling the ignition 3 times. Fortunately for me, this worked as well on my Dodge. The trick is to turn the ignition from on to off three times. On the third cycle, leave the ignition on and the odometer will display a code, if any, and then display “none” after  a short pause.

P0441 Code displayed in the dash

P0441 Code displayed in the dash

In my case, the code that came up was P0441. A quick google search brought up “P0441 Evaporative Emission Control System Incorrect Purge Flow“. On this page the common problems for Chrysler is the Leak Detection Pump. LDP’s run for about $40 on froogle, so its not a very expensive. More importantly, the information I gleaned off of froogle was what the damn thing looks like. I found the LPD attached to the rear of the gas tank, and to my delight I saw that one of the plastic hose clamps was broken! A quick rigging with some wire and resetting the computer by disconnecting the battery and the error code went away. This weekend I plan on going to the parts store and getting a proper hose clamp, but this quick fix will get me through the rest of the week.

Broken hose clamp on the LDP

Temporary hose clamp

Posted in Automotive | Comments Off on OBD II Code P-0441 on my 2003 Dodge Ram 2500

How I setup a 2TB raid on my Linux box

I currently have a server at home that has 10 250GB drives in a raid 5 configuration. The original install on it was Gentoo 2008.0, that over time and multiple updates is now using the profile of 10.0. Things have changed since the last time I setup raid on this machine, and upgrading is going to be fun. To begin with, Grub can only boot raid level 0 and 1. This has always been the case, so no change there. However, newer mdadm now uses metadata version 1.2 which grub doesn’t recognize, and raid autodetect is deprecated now, favoring initramfs. I have decided to use 3 1TB drives in a raid 5 configuration on my setup to replace my 10 250GB drives in an effort to save electricity. This article is not really a HOWTO, but more of an aggregation of notes and links to real HOWTO’s and something of a journal on how I proceeded.

Things to read before proceeding

Setting up Raid

I created 2 partitions on each drive, one was a 100MB partition for /boot that grub can read my kernel, and my initramfs image. The second partition is for my raid 5.

Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      206847      102400   fd  Linux raid autodetect
/dev/sda2          206848  1953525167   976659160   fd  Linux raid autodetect

I made sure to use metadata 1.0 for my boot partition, this is necessary as I point out above so that grub can read that superblock. To avoid some confusion, in the event you reboot into a System Rescue CD or something similar you may notice the raid devices coming up as /dev/md126, /dev/md127. Don’t freak out, this is normal. If you look in /dev/md/ you’ll see a convention like sysresccd:0 which is fine and completely normal.
mdadm -C /dev/md0 -l 1 -n 2 -x 1 --metadata=1.0 /dev/sda1 /dev/sdb1 /dev/sdc1

I let the default metadata be used here, and created the raid 5 drive
mdadm -C /dev/md1 -c 128 -l 5 -n 3 /dev/sda2 /dev/sdb2 /dev/sdc2

Setting up Grub

Fairly simple and straight forward, just need to be sure that all files are referenced in the root directory since this is the reference point for grub in its partition.

default 0
timeout 5
splashimage=(hd0,0)/grub/splash.xpm.gz

title 2.6.34-gentoo-r12
root (hd0,0)
kernel /vmlinuz-2.6.34-gentoo-r12
initrd /initramfs.cpio.gz

/etc/fstab

About as simple as you can get.

/dev/md1               /               ext3            noatime         0 1
/dev/md0               /boot           ext3            noatime         0 1

initramfs

I followed the instructions on http://en.gentoo-wiki.com/wiki/Initramfs, which are really quite well done.

  • I chose to use busybox, it makes life a piece of cake
  • I re-emerged mdadm with USE=”static” flag
  • I didn’t bother with setting up mdadm.conf, rather I just did the assemble straight up. IMHO its same amount of work, and at least only 1 file to modify

Quick initramfs construction

mkdir /usr/src/initramfs
cd /usr/src/initramfs
mkdir -p bin lib dev etc mnt/root proc root sbin sys
cp -a /dev/* /usr/src/initramfs/dev/
USE="static" emerge -av busybox mdadm
cp -a /bin/busybox /usr/src/initramfs/bin/busybox
cp -a /sbin/mdadm /usr/src/initramfs/sbin/mdadm
touch /usr/src/initramfs/init # grab the init script below
chmod +x /usr/src/initramfs/init
find . -print0 | cpio --null -ov --format=newc | gzip -9 > /boot/initramfs.cpio.gz

This is my init script for busybox

For the record, https://raid.wiki.kernel.org/index.php/RAID_Boot has a much better init script example, but for my purposes the following is all I needed.

#!/bin/busybox sh

rescue_shell() {
 echo "$1"
 busybox --install -s
 exec /bin/sh
}

# Mount the /proc and /sys filesystems.
mount -t proc none /proc || rescue_shell "failed to mount proc"
mount -t sysfs none /sys || rescue_shell "failed to mount sysfs"
mount -t devtmpfs none /dev || rescue_shell "failed to mount dev"

# Do your stuff here.
mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1 || rescue_shell "failed to assemble /dev/md0"
mdadm --assemble /dev/md1 /dev/sda2 /dev/sdb2 /dev/sdc2 || rescue_shell "failed to assemble /dev/md1"

# Mount the root filesystem.
mount -o ro /dev/md1 /mnt/root || rescue_shell "failed to mount root"

# Clean up.
umount /proc
umount /sys
umount /dev

# Boot the real thing.
exec switch_root /mnt/root /sbin/init

Make the necessary kernel changes (namely adding initramfs support, and devtmpfs support) and you should be good. At this point everything *should* work.

Good Luck!

Posted in Gentoo | Comments Off on How I setup a 2TB raid on my Linux box