March 2005 Archives

| No Comments | No TrackBacks
Macros with variable length arguments in C

I want to do a simple logging hack, so that I can turn on and off debug information in this app I'm working on by just adjusting the log level. log4c does this, but they don't claim Windows support and I'm too lazy to untar their source.

A simple solution for logging in C would be to just create my own printf basically that takes a log level as an argument and then passes the arguments onto printf based on the log level passed. I'm too lazy to implement anything tho..

An even simpler solution would be to just set up some #define'd macros that map debug calls to printf's based on the log level set at compile time. OK, this I can handle.

In order to call printf and retain printf's variable number of arguments stuff however, you need to be able to write macros that support a variable number of arguments. According to this page "variadic macros" weren't standardized until ISO '99 C. Since VS.NET uses some strange unknown variant of C, I would need to find a workaround that worked in VS.NET. (Truth: VS.NET might very well support ISO '99 C, but I'm too lazy to figure out how to enable it).

So here's how you do variable number of argument macros in VS.NET, taken from this post:

#define myprintf ::printf

This simply aliases the printf() function to myprintf(). To do log level debugging, I did something like this:

#define debug_fine ::printf
#define debug_fine 1 ? (void)0 : ::printf

This maps debugf to printf when LDEBUG_FINE is true, otherwise it removes calls to debug_fine.

I think. Anyways, it works, and, well, I'm too lazy to figure out why. I have real code to be writing. :-)

| 1 Comment | No TrackBacks
Monitor switching PC laptops

After using a Mac laptop for so long as my primary laptop, I have to complain about how my new PC laptop does monitor switching.

On a Mac laptop, monitor switching is extremely simple. You just plug in the new monitor, the Mac detects it automatically and does the right thing. If it's a VGA or DVI monitor it automatically extends your desktop to the new monitor. If it's a TV it automatically does video mirroring. If you don't like the defaults, you can easily change them using the monitor drop down in the menu bar.

What the Mac does even better here is it *remembers* your desktop configuration the next time you plug in the same monitor. If you plug in an HP LCD for example and set up video mirroring, it does video mirroring whenever you plug in that LCD. If you plug in a Sony CRT and set up an extended desktop, it rememebers that and goes back to that configuration whenever you plug in that monitor.

My PC laptop is completely braindead in this department. I've got two different environments I my PC laptop in: standalone, and docked to an LCD. Standalone I obviously want the built-in display to be the default and the external display disabled. Docked however I want the internal display turned off and the LCD to be the primary, and I want the resolution to change to match the LCD.

My Mac does this fine, but on the PC I have to go into the "Display -> Advanced" everytime I dock the thing. I finally figured out that the ATI driver allows you to set hotkeys to switch between monitor configurations, but I've found it doesn't always work. Some times it will switch the desktop configuration correctly, but then we I bounce into 3D mode the 3D graphics appear on the old monitor. Ooops. Plus, I shouldn't have to do the hotkeys. The PC knows when it gets docked, so why can't it do it for me.. like a Mac? :-)

Answer: It's not a Mac. :-) Sigh.

| No Comments | No TrackBacks
EverQuest 2 Trial

Sony and FilePlanet are running a deal right now where you can try out EverQuest 2 for free. Unlike other trials, there's no time limit--you're merely constrained to one location in the game and you can't take your character past level 6.

I downloaded the trial, and I have to laugh.

The code to run the trial was a 1.4GB download which took me about 3-4 hours from FilePlanet's junk servers. Extracting the zip file and installing the game took 15-20 minutes. Getting the game up to the latest version with all of the updates took another 15-20 minutes. Upgrading to DirectX 9.0c (I had 9.0b) took yet another 15-20 minutes. At the end of everything it took me about 5 hours to get the game running.

And then it took me about an hour to run through and play the entire trial before they wanted me to buy the full version.

I have to laugh. Ha. Jokes on me I suppose.

| No Comments | No TrackBacks
United Healthcare turned down my wife's annual exam?

Shouldn't health insurance cover a woman's annual exam? This is nuts. Here's what I wrote them:

I would like to request a review of claim ____ for my wife. The claim was denied with the reason given as, “your annual maximum benefit for preventative services and associated expenses has been paid,” however that was the first and only preventative services my wife received in 2004. After reviewing our insurance coverage in 2004 more carefully it appears to me that the claim should have been approved.

If it is your desire that my wife contract a serious preventative feminine illness, that’s fine... but it will cost your insurance company a lot more in the long run!

| No Comments | No TrackBacks
Spring graphs on GenieLab

I took the TouchGraph code and modified it so it would display artist associativity graphs for GenieLab artists. It's an open source license, I'm surprised more people don't use it.

Here's the graph for They Might Be Giants.

The hardest part of getting this working was actually figuring out how to display applets correctly across Navigator, IE, Firefox and Safari. I had no idea this was so complex. I still can't get it right in Firefox on MacOS. I finally gave up on "universal html" and just did some browser detection. eck.

| No Comments | No TrackBacks
University Venture Development Funds

Oregon Senator Frank Morse has proposed a bill in the state legislature that would allow Oregon's universities to create a venture development fund. This fund would be used to privatize technologies that are developed at our universities. The bill also includes hooks that give tax incentives to "taxpayers" (read: individuals and corporations) that contribue to the venture development fund.

On it's face, this sounds like a great idea to me. There's a lot of great technology that's developed at OSU that goes no where because it would be unethical/illegal for the faculty and students involved to do anything with it on their own. They could market the technology through the university, but there's no incentive (read: money) involved for them to do so.

However, that's the way universities are supposed to work. Universities and their faculty are supposed to be unselfish producers of a) research and b) new graduates, for purpose of bettering the state, the country, and mankind. Putting an extra burdon on universities to start spin-off companies I believe would severely damper those goals. Faculty would have to weigh not only the scientific value of their research, but also the financial value.

The strange part about this proposed bill is the tax incentives for individuals and coporations that contribute to this venture development fund. Imagine this scenario: A research lab at OSU is working on a patent for growing trees better. Warehouser finds out, and contacts the professor in charge of the project, telling him he could make millions if he spun the work from OSU and started his own company that manages the patent. The professor agrees, and starts applying for OSU venture dollars to privatize the research. Warehouser then contributes $2M to the venture fund, and gets to write-off half that from their taxes, saving Warehouser $400k that year. The $2M is then given by the OSU venture fund to the professor to spin the work off. Warehouser then buys out a large stake in the now private company. Warehouser now owns the patent and refuses to license it to anyone else until the patent expires in 20 years.

In this scenario Warehouser was able to obtain complete ownership of the patent, circumventing the university process. But not only that, they were able to write it off of their taxes. I can understand the arguement that they should be able to buy the company out... but being able to write it off their taxes for doing so? That seems... strange.

Another concern I have for this bill is the socialism factor. I'm all for socialism when it comes to health care and managing services that benefit all people in the state equally. This bill would create a system where the state owns large shares of private companies that only benefit small segments of the population. That doesn't seem right. The state should only get involved in businesses that benefit everyone equally, i.e., electricity, water, sewage, garbage, communications, health care, etc.

| No Comments | No TrackBacks
Interview with Dr. Dre

Dr. Dre is the man that made me appreciate rap. Before Dre, rap to me was just a poet with a beat. I enjoyed listening to it, but I didn't take it that seriously.

Dre's music is different. I think it was his Chronic 2001 album that was a turning point for me in my appreciation of hip hop. There are a couple tracks on that album that even today I'll listen to 2-3 times in a row, trying to disect the individual rhythms and melodies. He is truly a master of the art.

This interview has elevated my admiration of Dr. Dre even more. Sometimes, when you experience someone's art, you just get a sense about what kind of person they are. Before I read this interview I had already built a mental image of Dre as a very smart, articulate person that is passionate and meticulous about what he does. This article confirms that image, and even more so.

Interviewer: What’s your legacy? What do you want to be remembered by?

Dre: I don’t really think about that. My thing is just coming in here and making records, and hopefully people will go out and buy it and bump it. I’m just trying to come in and better myself when I’m in [the studio]. If I had to give an answer to that I’d say that I’d like to be remembered as a person who really cared about his music, and really entertained people with my talent. I just want to be remembered as being the shit.

Passionate people usually all have the same response: When they die, they want to be remembered as being passionate about what they did.

| No Comments | No TrackBacks
X-Sig for Postfix

I implemented my X-Sig email signature protocol in Postfix. If you're into this sorta thing, check it out!

| No Comments | No TrackBacks
Tips for Mastering E-mail Overload.

We all need to be reminded of good email skills every now and then.


To: Billy Franklin
From: Robert Payne
Subject: Re: Re: Re: Please bring contributions to the charity drive

Yes, apples are definitely the answer.


To: Billy Franklin
From: Robert Payne
Subject: Re: Re: Re: Please bring contributions to the charity drive.

You asked if we want apple pie. Yes, apples are definitely the answer.

Context is a big thing for me. I get probably 15-30 emails a week from HP corporate or site mailing lists that I just delete without even reading if the subject line doesn't make sense to me, or if they don't grab me in the first 1-2 sentances. It's not worth my time. Like the author of the article states, "if it's important, they'll email you about it again." My take on this is, "if it's important, my manager will bug me about it."

There was one time a few years ago where I received an email from some corporate spam list that was so cryptic I actually took the time to follow up with the person and inform them that I had no idea what the email was about. That was a mistake. I guess my tone was off, or they were having a bad day, as the person seemed to take offense that I didn't know what the "URGENT: TPR 2003 Process Integration Plan" was (or whatever, I made that up). I tried helping the person: "I have no idea what this email is about.. It contains no action items.. I read it 3 times and still don't understand it. What does this email have to do with me?" The person replied to me twice with equally cryptic emails so I finally just let it drop. Sigh... I was only trying to help.

One tip I'd like to add to the article is RE-READ your email before you send it. Read it in the tone of the person(s) receiving it. Read it 4, 5, 6 times. Pretend you are them and ask yourself, "does this make sense?" "this relates to me... how?" One thing I like to do when I'm proofing a big important email is to re-read it in a gruff tone, like I'm really pissed off from something that happened earlier in the day. Does the email come off offenseive if read in a different tone? You might be surprised how a little innocuous remark can sound offensive if read in a bad tone of voice.

| No Comments | No TrackBacks
Email your blog

I figured out how to set up an email address so you can post to your Blogger API compatible blog via email. This has probably been done before, but I couldn't find any references for it.

What's a Blogger API compatible blog? Any blog that supports the Blogger API like Moveable Type, Roller, etc.

My little email to blog bridge runs on Python using the PyBlogger software. To get my code running you'll need to download PyBlogger and have Python installed. Oh yeah... And you'll need to be running your own mail server. :-) I'm running sendmail on linux.

In the same directory as PyBlogger create a file "" (or whatever):

import sys
import getopt
import Blog

def main():
argv = sys.argv
username = argv[1]
password = argv[2]

line = sys.stdin.readline()
lines = ''
while line != '':
lines = lines + line
line = sys.stdin.readline()

header, body = lines.split('\n\n', 1)

body = body.strip()
body = body.replace('\n\n', '<br><br>')

user = Blog.User(username, password)
blogs = user.blogs

blog = blogs[0]
posts = blog.posts

if __name__ == "__main__":

This could probably be made 50x more elegant... Once you get this code in place, test it out on the command line:

prompt> python username password
Subject: blog entry

Hello, this is a blog entry I would like to put in my blog.

To enable the email to blog linkage, go into your .forward file (or in /etc/aliases if you're clever) and put the following:

roseblog, "|/usr/bin/python /private/pyblogger/ rose password"

Replace the parameters with the values that make sense for your environment.

If you want to not post to want to post to your own blog server--edit the file in the PyBlogger source and change "xmlrpcService" to point to the XMLRPC interface for your blog server.

If sendmail is not configured to trust python, add a symbolic link to python from the /etc/smrsh directory:

ln -s /usr/bin/python /etc/smrsh/python

If you have any issues be sure to look in /var/log/maillog for errors.



Monthly Archives


About this Archive

This page is an archive of entries from March 2005 listed from newest to oldest.

February 2005 is the previous archive.

April 2005 is the next archive.

Find recent content on the main index or look in the archives to find all content.