Join us on freenode.net channel #utah, the IRC channel for all LUGs in Utah. View channel stats.
fugalh
Bald
Well, the time finally came and so my hair went. Involuntarily, this time.
Now, these pictures aren't very high resolution so you may not be able to tell, but this first shave isn't particularly close. Even then it took awhile to do. I'm going to shave it every day until I get a reasonably close shave (I'm thinking tomorrow I should get pretty close), then I'll take some higher-resolution pictures and wear something more tough-looking, so you can all feel properly intimidated.
I mostly used a 2-blade cartridge razor, but I was getting annoyed with it doing basically nothing and tried switching to the safety razor a few times. This worked well on the parts I could see in the mirror, but it would take some practice to be able to shave the back with a safety razor because you have to get the angle right and some foresight on the upcoming curves helps a lot.
The HeadBlade seems to be popular for getting a good and quick shave. It's only $13 and my local WalGreens has it, so if I decide to stick with it I may not be able to resist trying it out (it's called Brush/Soap/Razor Acquisition Disorder). The downside would of course be that it uses expensive cartridges and there's something like 3x as much hair on your pate as your face. DE blades are much cheaper in the long haul. I wonder if there is a HeadBlade DE adapter…
Feed Me
Our first frost should come any time now, and I want to have warning of it so we can rescue our tomatoes. Well, I have a link to the NWS Area Forecast Discussion in my bookmarks which I try to read every day, but some days I forget. What I need is a feed. But as far as I can tell only Honolulu is cool enough to get a feed for AFDs. Weird. So what I needed was to create a feed from an existing web page.
I thought I would find a website that offers a service like this but I didn't (in a few short minutes of searching). I found websites that came halfway, but they were very complicated to set up and/or they didn't display the body of the page, only a link. The whole point is that I want to read it in my feed reader!
So I whipped up this Ruby code (standard libs only, no gems required):
#! /usr/bin/ruby
require 'erb'
require 'open-uri'
require 'ostruct'
# configuration
channel = OpenStruct.new(:url => "http://www.srh.noaa.gov/data/EPZ/AFDEPZ",
:title => "EPZAFD",
:description => "National Weather Service Area Forecast Discussion, El Paso TX/Santa Teresa NM")
item = OpenStruct.new(:url => channel.url,
:title => "Area Forecast Discussion",
:date => Time.now)
# fetch the page
afd = open(item.url)
item.date = afd.last_modified unless afd.last_modified.nil?
item.body = "" + afd.read + ""
# emit
include ERB::Util
template = ERB.new
feedme
EOF
puts template.result(binding)
Nothing overly fancy here. I use open-uri to fetch the page, extract the Last-Modified header (if it exists) and shoehorn it into an ERB template for the RSS.
In this case I just made it executable and slapped a Content-Header before the output and call it as a CGI. You could just as well run a cron job to update a file on disk (In which case remove the Content-Header from the template).
Once I found the pure text version of the AFD, it was just a matter of slapping it between tags, but if you had some actual screen scraping to do you might want to look at Hpricot which makes that really easy. In particular, I could have used the URL http://www.crh.noaa.gov/product.php?site=NWS&issuedby=EPZ&product=AFD&format=txt&version=1&glossary=1 and done
...
require 'hpricot'
...
item.body = (doc/"#content").to_html
which is in fact how I started out. But this page doesn't have a Last-Modified header which means my feed reader would always show it as a new item (every time the cron job updated, or every time I hit the CGI script, either way). Luckily I found the text-only URL that doesn't have this problem.
Clojure DSP Longing
I often find myself longing to be able to use Clojure, a very enticing lispy language that runs on the JVM.
I could possibly be using it right now in my dissertation research. It has the promise of dynamic languages, functional programming, almost-as-cool-as-Erlang concurrency, JVM performance, and Java library soup. It could be so awesome. A few months ago I started briefly down this road, unaware that…
Clojure sucks. Not generally, but it sucks for DSP. More specifically, Java and therefore Clojure has no real support for complex numbers. In order to do serious DSP, you need native syntactic, semantic, and performance support for complex numbers. Java has none of the above. Older versions of C didn't have syntactic or semantic support, but the performance of using arrays was plenty fast. Not so in Java, at least not to the extent necessary to override the lack of syntactic and semantic.
So someday, when I'm writing general purpose code again and not high performance DSP code, I will have an opportunity to use Clojure, and I think that will make me very happy. By then the book will be out of beta. The community will be in full swing. There will be awesome libraries. Children will play in pristine parks with formerly-ravenous ravens.
In the meantime, if anyone sees the scene change, do let me know.
FFTW Wisdom
The Fastest Fourier Transform in the West has some internal parameters for fine tuning exactly how it performs the FFT. For optimal results, you measure the effect of these parameters directly to find the absolutely optimal way to do that transform, but this is overhead that usually takes longer than just doing the transform the "slow" way, so it is only worth doing when you will be doing a whole bunch of similar transforms (e.g. in a spectrogram, filter, etc.).
So FFTW uses different planners, e.g. "patient" and "estimate", the latter being the default. No matter which planner you use, FFTW gathers "wisdom" about plans and doesn't have to recalculate them in the same session. Additionally, this wisdom can be saved to disk (in /etc/fftw/wisdom).
FFTW ships with fftw-wisdom, a program to generate wisdom which you can save to disk for the benefit of all FFTW-using programs. You run it something like fftw-wisdom -c -v -o /etc/fftw/wisdom, which takes several hours. I did this, and I found that the generated wisdom refused to be read. Oops. So I have done something almost as good (and which takes much less time).
In my case, I usually use FFTW within Octave. I'm sure it's in use many other places (video and audio encoders/decoders, etc.) but when I care about the marginal speed gains it's usually in Octave. Octave gives you access to the wisdom and planners, so you can save the wisdom to disk. Set the planner to "patient" (or "exhaustive" even):
octave:1> fftw('planner','exhaustive');
Then we need to perform an FFT for each plan that we care to optimize. Octave (and MATLAB) only seem to do complex-to-complex transforms, first transforming real data to complex, so all we need to do is generate a vector and perform the FFT for the various sizes we care about. In my case (audio) this does the trick:
octave:2> x = rand(2^15,1);
octave:3> for i=1:15; fft(x,2^i); end
octave:4> fftw('dwisdom')
ans = (fftw-3.1.3 fftw_wisdom
...
)
Copy that answer string and stick it in /etc/fftw/wisdom. Test it by running fftw-wisdom from the command line. If you do transforms that aren't powers of 2, or are 2-dimensional, etc., the idea is the same. In the future, Octave will read and add to the wisdom already there, so you can build on it over time. If anyone knows a way to automatically save wisdom on exit from Octave (really, a way to automatically do arbitrary code on exit—the code to save the wisdom is simple enough), that would be a neat trick that I'd love to have.
Oh, and if anyone wants to write a patch for Octave to get it to use a real-to-complex transform when applicable that would be approximately a factor of 2 speedup. I might dive in someday, if the need arises.
Nearly Bald
Here we are at the final step before total shine, 1/8 inch, a.k.a. a #1 guard (and a couple days growth). Note the goatee which is the same length as the pate hair.
git-push is worse than worthless
Ugh
Let's say you are a web developer, and you do development on your laptop, then when things are nice and shiny you want to push those changes to the webserver. Seems natural enough, right?
git clone server:/var/www/foo
# ...
git pull
# edit stuff
git commit -a -m 'i edited stuff'
Now, let's say you're a (possibly former) darcs/bzr/mercurial user and this time you're using git. Git has git-push. You read the man page like a good little code monkey, and it seems like it does the same or similar thing to darcs push or hg push. It seems like if you want to push your changes to the server, you'd do this:
git push
Am I off in left field or does this not seem 100% rational? But wo be unto the code monkey that utters this unfortunate incantation. Observe:
$ mkdir foo
$ cd foo
$ git init
Initialized empty Git repository in /private/tmp/foo/.git/
$ echo hello > foo.txt
$ git add foo.txt
$ git commit -m 'hello'
Created initial commit bee50da: hello
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 foo.txt
$ cd ..
$ git clone foo bar
Initialized empty Git repository in /private/tmp/bar/.git/
$ cd bar
$ echo goodbye >> foo.txt
$ git commit -a -m goodbye
Created commit 99c13c1: goodbye
1 files changed, 1 insertions(+), 0 deletions(-)
$ git push ../foo
Counting objects: 5, done.
Writing objects: 100% (3/3), 248 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To ../foo
bee50da..99c13c1 master -> master
$ cd ../foo
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
#
# modified: foo.txt
#
$ git diff
$ git diff --cache
error: invalid option: --cache
$ git diff --cached
diff --git a/foo.txt b/foo.txt
index a32119c..ce01362 100644
--- a/foo.txt
+++ b/foo.txt
@@ -1,2 +1 @@
hello
-goodbye
$ git log
commit 99c13c1e60888ae2c0e221898411e1cd52ad3815
Author: Hans Fugal
Date: Mon Nov 10 17:11:57 2008 -0700
goodbye
commit bee50da72798edc47ddc36dbc4f559f141b1e28b
Author: Hans Fugal
Date: Mon Nov 10 17:11:34 2008 -0700
hello
I promise I didn't fake that. Yes, you saw that correctly—git wants to undo the changes you just committed. If you happen to have a clean working directory, all you need to do to return to sanity is git reset HEAD. If not, heaven help you.
This is totally unacceptable. It's unforgivable on so many levels. At the very least, the manpage should warn you to not push to repositories with working copies. Git should warn you before you push and screw up your repo that it has a working copy checked out. Ideally, git would behave like darcs and update the working copy. Suboptimally, it would behave like mercurial and make it a new revision that you have to manually checkout. But this is simply ridiculous.
So what is the solution? They tell you to use pull. Hello! Is anyone home? My laptop is roving. It's often behind a NATing firewall. I'm supposed to find my public IP address and figure out how to subvert the evil firewalls of the world every time I want to push my changes to the server?
A workaround, and probably the best real-world workflow, is to have a second bare repository or a second branch on the server, push into that, then ssh into the server and pull the changes. I think this page describes how to do that with a second branch, though I'm short on time to actually try it out at the moment.
More of this sickening story in this thread, where you will learn that at least one other person out there has his head screwed on properly, that the developers are more interested in how hooks work (and fail to allow you to do this even if you grok them), and that they've discussed the problem before and decided the correct response is to RTFM (M for minds this time, since the manual was completely unhelpful).
Update: Some of you have been quick to defend git and the design choice of how push behaves. I want to clarify that I don't care so much that push updates the repository but not the working directory. Mercurial works this way too. Not the way I'd do it but it's a valid approach. The problem here is that git push seems like a natural thing to do but screws up your working directory on the remote side. Mercurial doesn't change the working directory, but neither does it silently rebase it and set you up to undo your changes if you're not careful. The problem here is a lack of safety and a lack of warning. They know it's a problem, they've fielded enough "morons". A few words of warning in the man page is all it would take to make me happy.
And now, I have had time to work out a more specific workaround. Here's what I did, and it seems to work well:
# Server setup (set up incoming branch)
server$ git branch incoming
server$ git branch
incoming
* master
origin
# Laptop setup (local master to remote incoming)
laptop$ git config remote.origin.push master:incoming
# Everyday usage
laptop$ git push
Counting objects: 5, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 279 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To server:/tmp/foo
b108a07..a9d3282 master -> incoming
server$ git status
# On branch master
nothing to commit (working directory clean)
server$ git pull . incoming
From .
* branch incoming -> FETCH_HEAD
Updating b108a07..a9d3282
Fast forward
foo.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
You could use hooks to automatically do that git pull . incoming if you liked, making it more like darcs than mercurial.
Updated update: On further thought, the cleanest solution is probably to have a separate master (bare) repository, e.g.
$ mkdir master
$ cd master
$ git init
Initialized empty Git repository in /private/tmp/foo/master/.git/
$ git commit --allow-empty -m initial
Created initial commit 999755e: initial
$ cd ..
$ git clone master live
Initialized empty Git repository in /private/tmp/foo/live/.git/
$ cd live
$ git branch
* master
$ cd ..
$ git clone master laptop
Initialized empty Git repository in /private/tmp/foo/laptop/.git/
$ cd laptop
$ echo hello > foo.txt
$ git add foo.txt
$ git commit -m hello
Created commit 2297bcf: hello
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 foo.txt
$ git push
Counting objects: 4, done.
Writing objects: 100% (3/3), 239 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /tmp/foo/master/.git
999755e..2297bcf master -> master
$ cd ../live
$ ls
$ git pull
remote: Counting objects: 4, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /tmp/foo/master/
999755e..2297bcf master -> origin/master
Updating 999755e..2297bcf
Fast forward
foo.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 foo.txt
$ echo goodbye >> foo.txt
$ git commit -a -m goodbye
Created commit 04f6702: goodbye
1 files changed, 1 insertions(+), 0 deletions(-)
$ git push
Counting objects: 5, done.
Writing objects: 100% (3/3), 248 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /tmp/foo/master/.git
2297bcf..04f6702 master -> master
$ cd ../laptop
$ git pull
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /tmp/foo/master/
2297bcf..04f6702 master -> origin/master
Updating 2297bcf..04f6702
Fast forward
foo.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
1/4 inch
These pictures are actually a few days late—it's a quarter inch and about 5 days growth. So probably somewhere between a quarter inch and 3/8 inch. It was a number 2 guard. In a few days we'll go to 1/8 inch!
Irssi on a Laptop
I love irssi, but it has laptop issues. It's really unintelligent about network disconnects and waking up from sleep. It usually either takes forever to time out and try to reconnect, or tries to reconnect immediately upon wake before the wireless connection is established and then takes forever to time out and try to reconnect. So I tried it in screen on my server, and that works fine, but it lacks some usability features. Plus, it lacks some niceties that I've come to need on OS X from chat clients. I need my chat client to use growl to tell me when someone talks to me (directly to me, in the case of IRC). Then I can read the message quickly and decide whether I need to stop what I'm doing right then to respond, or if it can wait a few seconds while I complete my thought, or if it can wait a few minutes while I complete my thought. Plus, with the right theme, growl notifications can be easy to tune out as well (but your mind still registers that something happened and wants your attention, when you can give it). Second, it's really nice to have IRC in a different application, so it can be hidden without affecting the rest of the Terminal.app windows. I use the terminal too heavily for productive work for IRC to insert itself on a terminal tab or in a terminal window. But, I could work with this by starting irssi in its own window and getting used to minimizing IRC. Not a deal-breaker.
I've been using Colloquy, and before that X-Chat Aqua, and while both meet the essential needs listed above (smart reconnect after sleep and growl), the both have the same problem: they're not irssi (plus they don't get much attention from the developers, and X-Chat Aqua is all but officially abandoned). Colloquy in particular crashes more frequently than a demolition derby car. So I find myself yearning for irssi. There are a couple wrap-irssi-in-cocoa apps, but they are also abandoned and incomplete.
In one last stab of hope, has anyone discovered a way for irssi to be intelligent about reconnecting? This is just as applicable in linux as in osx, and I know a lot of you linux users have laptops and use irssi—do you all just punt and use it in screen on a server? Has anyone found/written an irssi plugin for growl? (I assume someone probably has, or that it would be easy to whip up, but I haven't bothered to look because I haven't found the solution to the first problem yet.) Or, has anyone found an IRC client that actually comes close to being as awesome as irssi, reconnects intelligently, uses growl, and doesn't crash frequently?
Go Vote!
It's actually still election day eve here, but by the time most of you read this it will be November 4. I don't care who you are or how you want to vote, it's important that we all vote. I don't care if you know your candidate(s) will lose. I don't even care if you want to vote for SUPERDELL! Get out and vote, if you haven't already.
Then if you have geek tendencies you might enjoy doing what I'll be doing tomorrow night: compare the excellent statistical predictions from fivethirtyeight.com with how things actually play out. He has an hour-by-hour guide to election night at Newsweek.
Half Inch
So here's my hair buzzed to 1/2 inch:
How low can he go?
One Inch Hair
So I decided to cut my hair progressively shorter and take pictures for the benefit of DIY hairstylists everywhere. These pictures are with a number 8 clipper guard (one inch).
More pictures here.
This style could work pretty well, actually, with the sides and back shorter. But
tomorrow (or soon), we'll go shorter.
Baldness Genetics
Coincidentally, less than an hour after I cut my hair to one inch all around because of androgenic alopecia, a link to this article came up in my feed reader this morning. Apparently they have found the genetics that cause it. As I understand the article, there are two genetic variants (which they just discovered) on chromosome 20, which when combined with the one they already knew about on the X chromosome (which you get from your mother), increases your chances of going bald sevenfold.
If you have both the risk variants we discovered on chromosome 20 and the unrelated known variant on the X chromosome, your risk of becoming bald increases sevenfold."
Does this mean you have to get genes from both parents to be bald? What if you don't have the one on the X chromosome but you get the ones on chromosome 20 from your dad? Well, as you can see this report of the findings isn't very enlightening, but it does tell us that yes if your mom's dad and brothers are bald you have increased "risk" (so no, contrary to what you might have read (but probably haven't), it's not a myth), but just because your mom's dad isn't bald doesn't mean you might not be.
How Short?
My hair on top has thinned to the point that my old standby hairstyle is now dysfunctional. So now I have to decide what to do. Should I shave it? Buzz it? Grow it long? Short but not quite buzzed? If you have any idea (as if anyone cares) now is the time to weigh in.
Pictures of the situation are here.
DPMS Triggers
I'm sitting here having a really hard time figuring out whether I most dislike mosquitos or GNOME's screensaver and power management.
All I want is:
Standard screensaver/power management stuff: you know, pretty pictures and/or turn off the monitor after a certain amount of time.
Allow me (user and/or script) to easily disable it, so that e.g. the screensaver doesn't come on in the middle of a video.
Allow me (user and/or script) to easily enable the screensaver and/or power management instantly.
Don't frickin' lock the screen!!!1!!
Having found GNOME screensaver and power management completely incapable of doing the latter 3, even after installing and configuring Brightside, and digging through gconf-edit for the lock settings (hint: they're there but don't seem to work), I decided to resort to disabling them and using trusty old xset.
Now, Brightside will try to use GNOME's power management and/or screensaver, so if you want to avoid locking as I do you have to bypass that by using custom actions. The custom action for instant DPMS standby is xset dpms force standby. The custom action for DPMS disable is xset -dpms and then when leaving that corner do xset dpms 600 1800 3600. xset, or some GNOME monster, has a bug where xset +dpms doesn't work. It appears to work, i.e. xset q reports that DPMS was enabled, but it doesn't actually come on unless you explicitly set them (or force standby mode).
Now, you'll also want to run that same command at the beginning of your session, so what you probably want to do is script that (so you only have to change the timeouts in one place) and call that script from Brightside as well as put it in your session startup.
Being paranoid as I am, I took gnome power management out of my session (couldn't find gnome-screensaver in the session—maybe it's launched by the power manager?). But just telling them to never come on, and bypassing them in Brightside, should be sufficient.
Debates
I'm neither a republican nor a democrat, and I like to refrain from delving into politics on my blog (except perhaps in the case that it's tech-related).
I have indeed formed an opinion about the candidates, though I'm still pondering some of the issues and third parties. Get Fuzzy today just about sums it up.
So while I'm talking politics I might as well enumerate the issues on my mind.
Privacy and Freedom, particularly of the flavor that has being stripped from us like mad since 9/11. Airplane "security", the Patriot Act, terrorism in the name of fighting terrorism, etc. Nobody's talking about this, I'll have to research their records, but I'm guessing McCain at least will fail this test.
Technology savvy, or at least technology humility. Technology plays a huge and increasing role in the world, the economy, and the lives of many of us (especially me). Lawmakers and presidents have shown an amazing inability to grasp what is possible and impossible with technology, let alone what is wise.
Intelligence and Wisdom. Frankly, things are just complicated. No set of ideals, even the ones I hold, are going to work if blindly adhered to. Ideals must be guidelines, and in the end any public official has to make lots of judgement calls. I want someone who will weigh the issues, consider alternatives that fall outside his idealogy, and listen to the smart and wise (and often contradictory) people that he (hopefully) surrounds himself with.
Be a good neighbor. The rest of the world pretty much hates us by now. I could care less if people hate us for irrational reasons, and don't believe we're in any sort of popularity contest, but I believe it's important to our economy, livelihood, and very existence to be a peaceable, approachable, respectable, intelligent country instead of a warring, arrogant, ignorant, laughing stock country. It's not entirely fair, but people do judge the whole lot of us by who we elect to be our leader. This also affects me directly, since I interact with people from other countries regularly.
Fix the bits of the system that are broken, e.g. Change Congress. McCain likes to tout himself as a maverick and reformer, but I'm far from convinced. I doubt either candidate will take us very far here, but if this issue comes into play it will be part of my decision, and may influence my local selections more.
The economy, the war(s) and foreign policy, health care, education, pronunciation of "nuclear", grandmas, babies, and world peace.
In case you couldn't tell, McCain has already dug himself into a pit in my mind. I get a much clearer picture of where Obama stands, and sense more intelligence and willingness to ponder from him, although I don't necessarily agree with some of the policies on his platform.
I think it's important to realize that we are voting for people not issues. We live in a republic, which means we elect people to take care of stuff for us. We want them to represent our interests and ideals, but I think it's more important to want them to have integrity and be smarter than most of us when it comes to solving the problems that they are asked to solve. Because of the wide spectrum of things that come to the table (technology, justice, foreign policy, etc.) we can't really expect to find one person really good at all of them. So we need to find a person that will surround himself with smart people and be able to discern good ideas from bad. In short, we're voting for a leader, not a set of policies or anti-policies for the next 4 years.
autotools
I've been known to knock autotools (autoconf and automake and friends), but let it not be forgotten that I have also been known to say that alternative pickings are pretty slim.
Part of the problem with autotools is that it's easy to make an unmaintainable and unusable mess, and one that is essentially opaque to the uninitiated.
But, on the other hand, it's equally easy to use autotools in a sane way which is just as easy or easier than writing makefiles and whatnot by hand. Once you get over the initial learning curve. That has been a big caveat. I've climbed that curve a few times and it goes in one ear and out the other.
Well, a friend pointed out an excellent tutorial on autotools which demystifies autotools. It also makes a good reference for next week when you've forgotten everything.
If you're writing code to distribute, you should consider using autotools (and doing so sanely), and this is a good starting point. But that's not the only reason to check it out. You may just be curious, or you may wish to learn how this works so you can contribute patches and bring sanity to your favorite project's build system.
But whatever you do, never ever just copy someone else's autotools configuration into yours and apply "shotgun debugging" to shoehorn it into your project. That is the wrong approach and the primary cause of so many broken autotools setups.



:: Recent comments :.
23 weeks 2 days ago
28 weeks 1 day ago
28 weeks 1 day ago
28 weeks 1 day ago
28 weeks 1 day ago