pitz prepares to rock my socks

Matt Wilson must be spying on my dialogs in sekrit IRC channels. After setting up Task this evening I mentioned there being several project ticketing systems, like Ditz, that store data in the RCS. I was lamenting the fact that there wasn’t any of these systems written in anything other than ruby that I was aware of.

Reading my RSS feeds before bed, I found “My new ticket tracking system is now vaporware” from Matt Wilson’s blog talking about Pitz, his soon to exist Python implementation of Ditz.

Please take a few moments to read over the feature set and example commands on the Pitz site and let Matt know about any ideas/suggestions you may have.

Posted in General | Tagged , , , , | Leave a comment

~/.bashrc Perl Module Version Tip

I often need to quickly check the version of a perl module currently installed. A while back I got tired of running:

$ perl -MPOE::Filter -E 'say $POE::Filter::VERSION'
1.2357

So I added a quick function to .bashrc:

pm-vers () {
    perl -M$1 -e "print \$$1::VERSION, \"\n\""
}

Now I just run:

$ pm-vers POE::Filter
1.2357
Posted in General | Tagged , , , | Leave a comment

git diff and white space

So I’m getting ready to make a commit to wxperl and I run a

git diff

to check on changes and git yelled at me that I had some trailing white space. Well it didn’t yell but it hi-lighted the white space in red. Way awesome!

git-diff-trailing-white-space

Posted in General | Tagged , | 2 Comments

Net::Abuse::Utils v0.10 Released

I just released Net::Abuse::Utils v0.10 to CPAN. If you can’t wait, grab it here.

If you haven’t heard of this module before, see this online example of some of the data that can be returned. Online docs are available as well at search.cpan.org.

From the Changes file:

  • New get_domain function that converts host name to domain name
  • Memoize support though commented out by default, enable by
    uncommenting the following two lines in lib/Net/Abuse/Utils.pm
    # use Memoize;
    # memoize(‘_return_rr’);
    A future version will likely allow Memoization via an export tag.

The get_domain function is fairly spiffy taking a host name like ‘michael.thegrebs.com’ and turning it into the domain name, ‘thegrebs.com’, but with proper recognition of second level zones like .co.uk.

The Memoization support is weak and I almost removed it but decided to leave it in but commented out for this release. It speeds up batch processing of large quantities of requests fairly well. Processing a days worth of spam used to take an average of 5 minutes and is now down to a minute and a half. This is quite a bit more increase than I expected as I am using bind with heavy local caching.

There were a few more changes mostly related to distribution related stuff, see git for the full gory details.

Not a horribly significant release but it’s been a while since the last one and I wanted to get get_domain out there.

Posted in General | Leave a comment

Geeky Weather Station Stuffs

wxperl
http://weather.thegrebs.com/

I recently received a nice Honeywell weather station. It turns out they are actually manufactured by a company called Irox which also sells stations under it’s own name but they seem to be more popular in Europe. Being a geek, one of the first things I did was check out Linux or OS X support. Unfortunately only one piece of software supports this weather station under Linux, Weather Display. There Linux software is freeware but not open source and leaves quite a bit to be desired but at least it would talk to the weather station and collect data from it.

With a bit of Googling I found Saratoga Weather which seems to be based on a template from Carter Lakes. Unfortunately the PHP code is a bit of a mess with 43 separate php files all in a top level directory and including each other. With a bit of work I was able to bend it to my will but every little change was a pain to accomplish.

I started slowly re-implementing things in Perl. I found an online WD data-file parser which greatly helped in figuring out what the fields in Weather Displays native log files meant. Fast-forward a couple of weeks and I think things are pretty much done feature wise. I lack NWS warning/watch/advisory notification, the thermometer image with today’s information is still PHP generated, and I don’t yet have a wind graph. These last few details shouldn’t take too much work when I get around to it. I also have a few features the original lacks, graphs, a daily tweet with today’s high/low, and sane code :p.

The information from my weather station is available online at http://weather.thegrebs.com/ and the source is available via git clone from http://git.thegrebs.com/git/wxperl. You may also browse the repo via Git Web at http://git.thegrebs.com/?p=wxperl.

Posted in General | Tagged , , , | 3 Comments

Join the FSF Today

The Free Software Foundation is having a year end fund drive. Go join today. Can you think of a better way to spend $10 per month? Tell them member 7097 sent you.

Support freedom
Posted in General | Tagged , | Leave a comment

Ruby’s not Ready

Was looking for a specific essay about some of the issues with Ruby to point my boss to and stumbled across this instead, still haven’t quite finished reading it yet but good stuff. Increases my desire to further my Python skillz.

Ruby’s not Ready at glyphobet

Posted in General | Tagged , | Leave a comment

Quick & Easy Temperature Logging with the Arduino

Basic Voltage Divider with a Thermistor:

Thermistor Voltage Divider Schematic

Typical voltage divider, matched would have made better sense but the thermistor was a random one salvaged from consumer electronics so I didn’t know the value in advance.

Would work just fine like this with TP1 connected to an Arduino analog input and Vcc and GND connected. Energy savings for the win though, connected the top of the divider (Vcc) to a digital pin on the Arduino. Set the pin HIGH when you want to take a reading, LOW the rest of the time. Now the divider is not consuming power when a reading isn’t being taken.

Arduino Code

int pinDivEn   = 4;
int pinDivRead = 1;
int pinLED     = 13;

void setup() {
    Serial.begin(9600);
    pinMode(pinLED, OUTPUT);
    pinMode(pinDivEn, OUTPUT);
    Serial.println("READY");
}

void loop() {
    if (Serial.available() > 0) {
        digitalWrite(pinDivEn, HIGH);
        digitalWrite(pinLED, HIGH);
        delay(100);
        while (Serial.available() > 0)
            int serByte = Serial.read();
        Serial.println(analogRead(pinDivRead));
        digitalWrite(pinDivEn, LOW);
        digitalWrite(pinLED, LOW);
    }
}

pinDivEn is the divider enable pin (Vcc), pinDivRead is the analog input connected to TP1 in the divider, pinLED is is a digital pin with an LED that is lit while a reading is taken.

Once the Arduino boots it sends READY on the serial port at 9600 bps. It then waits for any data to be available on the serial port, when bytes are available, the voltage divider is enabled, the LED is lit, the bytes on the serial port are consumed, the value of TP1 is read and then written to the serial port, the divider enable pin is brought back low and the led is extinguished.

Perl Code

#!/usr/bin/perl

use strict;
use warnings;

use IO::Handle;
use Device::SerialPort;

my $dev = tie (*FH, 'Device::SerialPort', "/dev/tty.usbserial-A4001JwW")
    || die "Can't tie: $!";

$dev->baudrate(9600);
$dev->databits(8);
$dev->parity("none");
$dev->stopbits(1);

open (my $log, '>>', 'ohms.log') || die "can't open: $!";
$log->autoflush(1);

# wait for arduino to boot
while (1) {
    my $val = <fh>;
    last if $val;
}

print FH "1\n";
while (1) {
    my $val = </fh><fh>;
    next unless $val;
    chomp $val;

    my $vR2 = $val / 1023 * 5;
    my $vR1 = 5 - $vR2;
    my $i   = $vR1 / 1_000 * 1_000;
    my $R2  = $vR2 / $i;

    print $log time . ' ' . $R2 . "\n";
    # printf("V_R2=%.2fV, i=%.2fmA  R2=%.2fK&#8486;\n", $vR2, $i, $R2);

    sleep 10;
    print FH "1\n";
}

Opens the serial port, waits for something (the Arduino sending ‘READY’ but it pays no attention to what) on the serial port then every 10 seconds sends a 1\n to the Arduino prompting it to send a value. The result of analogRead is an integer from 0 – 1023 so this is converted to a voltage. The current through the divider is found allowing the resistance of the thermistor to be solved for. The resistance and time are written to a space separated log file. If the thermistor wasn’t unknown it would make more sense to solve for the actual temp using the Steinhart–Hart equation or similar and logging that rather than the resistance.

Sample log file entries

1224349429 10.1195652173913
1224349439 10.3666666666667
1224349449 10.3666666666667
1224349459 10.3666666666667
1224349469 10.4943820224719
1224349479 10.3666666666667
1224349489 10.2417582417582

A few lines in a text file gets us a graph from the log file by way of GnuPlot:

set term png transparent nocrop enhanced font "./arial.ttf" 9 size 800, 600
set xdata time
set timefmt "%s"
set format x "%m/%d %H:%M"
set xtics  rotate by -45
set title "Thermistor Value"
set xlabel "Date/Time"
set ylabel "Resistance (kOhms)"
set grid
set output "ohms.png"
plot \
    "ohms.log" using 1:2 title "10 sec interval readings" linecolor 2, \
    "ohms.log" using 1:2 title "Bezier fit curve" smooth bezier linecolor 4 lw 2, \
    10 title "77 F" lw 2 linecolor 1

GnuPlot Graph of Time vs Resistance

Posted in General | Tagged , , , | 2 Comments

multi-multi-multi function office machines

Currently in a waiting room and CNN is on. There was just a commercial for a Sharp deep freezer sized copier/scanner/printer/sink. The business person googled for a restaurant to take a client to on the built in touch screen then presses a button to print a full-color map to the restaurant. What business person would go to the copy building (a room is not big enough) to google a restaurant?

Sorry check back later for pics, Steve Jobs says I don’t need copy & paste as I’m sending this from the wordpress app on my iPhone.

Update:

One note of clearification, as crazy as the feature set on these machines is, I still wouldn’t mind having one to use whenever I wanted, imagine what you could do with it! The commercial I saw is available in flash form at
http://www.sharpusa.com/files/workwithoutlimits.swf.

Posted in geek | Tagged , | 1 Comment

No upstart Docs + asshole Canonical Employees = Fail

I was in need of a means to disable upstart scripts in /etc/event.d via some means other than getting rid of the file. Since upstart has no documentation to speak of, I asked my buddy Google.

Google pointed me to the year old bug 94065 in launchpad. I added a quick ‘me too’ and subscribed to updates on the bug. This was back in March. Fast forward to last week and this arrives:

** Changed in: upstart
      Target: 0.5 => None

--
Add non-destructive means to disable a job

https://bugs.launchpad.net/bugs/94065

You received this bug notification because you are a direct subscriber
of the bug.

There is no mention of this change in bug meta-data on the launchpad site, or maybe I’m just not finding it since I lack the doctorate in navigating launchpad necessary to be able to use the site. This prompted an update from the original reporter on the bug asking for more information:

is there a disable method yet? i reported this initially over a year ago. (there may be, but since there’s no upstart manpage on hardy, it’s hard to know. :-)

Now for the asshole fail:

Scott James Remnant wrote on 2008-08-14: (permalink)

Does this bug report say that there is a disable method? Is it marked Fix Released?
No.

I’m not sure what Scott James Remnant <scott@canonical.com>’s roll at Canonical is but perhaps it should be modified to remove any tasks that involve interaction with the public?

Posted in General | Tagged , , , | 4 Comments