Tips, Journal, UnixNovember 6, 2009 3:35 pm

Two pieces of advice on FreeRADIUS.

  1. Keep up with new versions. There are improvements in each version, so don’t just copy over the same config files: make those changes in the new files so you keep up with the times.
  2. If you’re starting with a fresh install, don’t jump in and make changes right away. Test the freshly installed server first to be sure it works. Make a change, then restart the server to be sure it still works. Another change, another restart, another test. Debug mode -XXX is your friend.

And I finally eliminated a FreeRADIUS warning I saw while in debug mode. This warning is very common now because FreeRADIUS has been upgraded internally but not all of the sample files have been tidied up to reflect the improvement (see my recommendations above!). In debug mode, you might see Info: [ldap] WARNING: Deprecated conditional expansion ":-". See "man unlang" for details and man unlang wasn’t particularly enlightening on first pass since it wasn’t obvious until I read this post by Mr. FreeRADIUS himself where he explains why this change is A Good Thing. The key is to use more percents and more braces. The line that causes the error for ldap is in the modules/ldap file:
filter = "(uid=%{Stripped-User-Name:-%{User-Name}})"
It needs to updated like so:
filter = "(uid=%{%{Stripped-User-Name}:-%{User-Name}})"

This worked to eliminate the warning before I ditched LDAP because it wasn’t matching what I needed.

Tips, Child, Toddler, JournalOctober 24, 2009 1:26 pm

At Karston’s preschool, the teachers carefully dash out the name for each child to trace on the daily artwork. Tedious! Karston is learning to write his name, and I’d love to build on that at home, but I know I’m not going to draft all this tracing for him when I’m sure there’s a font for it … I found free trace fonts @ fontspace.com with the Print Clearly and Trace fonts. Much better!

Tips, Journal, CodeOctober 15, 2009 2:38 pm

Today I learned two tricks for the replace() function in Javascript.

  1. Use $? for the found pattern, and
  2. use (parentheses) within your regular expression if you want to refer to what it matched by $number in the replacement.

I needed the sub-string ‘.A.‘ to be zero-padded into ‘.0A.‘ instead. However, I wasn’t positive enough that the only character that needed zero-padding would be an A, so I wanted to match the general case of any single character between dots.

So that means I could match any single character between dots and give a long-winded message: output = input.replace(/\.(.)\./g, "replace> $& <replace "); or more to the point: output = input.replace(/\.(\w)\./g, ".0$1.");

I can use either ‘.‘ (traditional Unix regexp for a single character) or ‘\w‘ (PCRE for any non-whitespace character) to match A with my expected input.

Macintosh, TipsOctober 12, 2009 11:33 am

The Drag a link to Tagger into the Finder toolbar screenshot was driving me nuts because it’s not that simple. I dragged, and the link just bounced back to the application. So I tried some keyboard combinations (since the screenshot indicates that it’s possible), and sure enough, COMMAND-OPTION is the magic pre-drop key combination! Of course, now I’m used to it in my Finder sidebar, so I don’t need it in my toolbar, but it’s nice to know I can do that when I want.

Tips, Cooking, Recipe, AllergiesOctober 9, 2009 12:11 pm

So I had some Bob’s Red Mill garbanzo flour that includes a recipe for hummus on the back. Starting with finely ground garbanzo flour seems a lot easier than grinding my own chickpeas to the properly smooth texture! I was also tempted by this hummus cracker recipe so something had to happen eventually.

The first time, I scaled down the hummus recipe to make only the 1/2 cup needed for the crackers, and I left out the tahini because I didn’t have (or want!) any. What I learned from this batch of hummus answers one of those little mysteries: why is some hummus so amazingly good, and why does the rest taste horrible like dirt? The answer is that cooked garbanzos are tasty, and raw garbanzos are ick ptooey. Cook the mixture again after adding the garbanzo flour, and it improves greatly!

On to the crackers, first time! I used olive oil instead of canola oil. Even adding extra flour, the crackers still were too wet to roll out, but after baking, the clumps tasted pretty good! Worth making again.

The second time I made 1/2 cup hummus from the Bob’s recipe much as before, except I put all the liquids (lemon juice and texas pete) in the 1/2 cup measuring cup, and topped it off to 1/2 cup total. I also skipped the olive oil in the hummus this time around (it still tasted mostly ok, suggesting I can skip the tahini and cut back on the olive oil, and still get enjoyable lower-fat hummus), and just added the olive oil for the crackers part of the recipe. This time I had crackers that I could roll out to a uniform thinness before baking on a silicon baking sheet.

The report is still yummy crackers, and more cracker-like with the much drier hummus. I’m inspired to try this with refried beans! I had never considered making my own crackers until Cale had allergies to most commercial crackers, but it’s not hard to make these crackers and they taste great! The one drawback (ahem) is that I get some remarkable gas from just two small crackers, so I probably need to cook the garbanzo beans even longer to tone down that effect. Or perhaps this is inherent in the garbanzo flour, although I suspect not since I don’t remember gas from the vegan calzones made with it.

1 Tbs lemon juice
1 tsp hot sauce
1/2 cup water less 4 tsp
add lemon juice and Texas Pete to a half-cup measuring cup,
then fill to 1/2-cup with water
2 shakes onion powder
2 shakes adobo seasoning
4 shakes garlic powder
1/4 tsp ground cumin
mix in a bowl, then microwave 1 minute
preheat oven to 325 °F
2 1/2 Tbs garbanzo flour stir in, then microwave 2 minutes
1/2 cup whole wheat flour
2 Tbs garbanzo flour
mix in
1 1/2 Tbs olive oil add just enough oil to get mixture to stick together like a dry dough
roll out to 1/8-inch thickness onto a silicon baking sheet
(if too moist to roll, just spread thin, but without holes, with your fingers;
may need to increase cooking time for extra thickness)
gently cut (or dent) crackers with pizza roller
place silicon baking sheet on a cookie sheet for stability
bake in oven until edges look toasted, about 20-25 minutes at 325 °F
when cool enough to handle, snap crackers apart
cool completely, and store in an air-tight container
Tips, Project, JournalOctober 5, 2009 10:08 am

So we’ve been thinking that, for as little as we watch TV, the cable bill is rather high. However, we want HD (but now there’s significantly more free HD available), and we need a DVR. I might miss some of the cable channels if I’m sick and at home, but that doesn’t happen often enough to plan for it. I think we could watch over-the-air with a side of Netflix and be perfectly happy. However, I’ll have to roll a DVR replacement because the children expect their shows now, with fast forward and rewind. (Bill Cosby said parents don’t want justice, they want quiet, and we’ve learned how right he is! If we want to eat breakfast without children climbing all over us, that episode of Super Why or Imagination Movers or Mickey Mouse Clubhouse sounds pretty tempting. If they don’t talk to the TV, we turn it off as soon as we inhale our food. Usually, however, they interact with the show and we’re not disappointed with the educational opportunity while we eat in peace and quiet.) Super Why is on PBS so we can watch it over-the-air, and Disney has episodes online and seasons on Netflix. It will take some juggling, but I think we can go without cable. I’m planning a gentle, gradual, slow transition, though.

So that means the first piece of hardware is something to send HD signals to a home-grown DVR. I thought this would be very confusing, a wide field of choices, blah blah blah. Well, it isn’t. After reading bronzefinger, there’s only one choice: the Hauppauge HD PVR. The usual dithering of checking online reviews and trying to imagine which feature set I want is unnecessary without choices. Newegg had the best price, and a rebate that ended that weekend (2 weekends ago), so I just ordered it. We’re still getting the hang of using this box, but so far this glacial move away from the glassy medusa has been surprisingly, disturbingly (as in, why didn’t we do this sooner?) easy.

Tips, Project, JournalOctober 3, 2009 9:31 pm

I happened across the Telematics Freedom Foundation PDF on FLOSS Media Centers, and the chart in the middle was great! For as little as we watch TV, the cable TV bill is gigantic! So we’re considering ditching it (keeping the cable modem of course, but that portion of the bill doesn’t feel as outrageous unless you compare it to most of the rest of the developed world where the US loses on bandwidth to households and price per bandwidth), but we like the DVR feature. So we need to replace it with something like TiVo. From the chart, I eliminated Neuros (don’t want another set-top box, although it does look cool) and MediaPortal (I don’t run servers on Windows). The next filter was that I want to watch and record TV, so that knocked out all but MythTV and Freevo. (Shame; XBMC and its derivatives Plex and Boxee look nice.) Those two have about the same feature sets, but I noticed that Feevo didn’t have keyword search in media library; if I go to the trouble of adding keywords (and I do), I want to be able to search those. So it’s MythTV.

The easy path is probably one of the bundled versions. Of those, Google search results seem to agree that if you can stand the longer up-front install time, MythDora is the easiest. I shouldn’t have to install it too often, and I don’t mind walking away from an installer either, so I think I should burn a copy of MythDora to try it out. Bonus is using RHEL at work might transfer to some comfort with RH’s Fedora Core too (I hope). I’m keeping LinuxMCE in mind too, in case we want to add that home automation. Since LinuxMCE uses MythTV as well, I don’t think it would be a painful transition for us after I install the same libraries and skins, but I suspect that starting there would be unnecessarily complicated.

Finding the right online reference comparing our choices has made all the difference so far. Yay for online!

Tips, Journal, CodeOctober 1, 2009 1:00 pm

I ran across a nice piece of CSS to add numbered subitems in an ordered list.

ol { counter-reset: item }
li { display: block }
li:before { content: counters(item, ".") " "; counter-increment: item }

That’s pretty simple! You can play around with HTML lists here.

There’s also the jQuery route (with example), but it isn’t as simple or lightweight, and it isn’t recursive.

Macintosh, Favorite Software, Tips, Journal 10:44 am

Well, I really want my notes to be accessible, and that means available to Spotlight more and more now, so with some sadness and some help from touch -r, I just migrated the first document from Alepin to Journler.

Alepin’s export preserves the hierarchy (the way I wish the document package’s internal structure did, #3 on my wishlist), but it doesn’t preserve timestamps. So the package structure is flat but with the timestamps I want, and the export structure is hierarchical with a ‘now’ timestamp. I believe I can fix this!

cd ~/Desktop/Notes\ Exported
find . -name \"*.rtf\" | grep -v TXT.rtf | tee adjustTimes.txt
find . -name \"*.rtfd\" | tee -a adjustTimes.txt
ORIG=~/Documents/stuff/Notes.alpn
while read FILENAME; do echo \"${FILENAME}\"; ls -l \"${FILENAME}\"; BASENAME=${FILENAME##*/}; ls -ld \"${ORIG}\"/\"${BASENAME}\"*; echo; done < adjustTimes.txt
while read FILENAME; do echo \"${FILENAME}\"; ls -l \"${FILENAME}\"; BASENAME=${FILENAME##*/}; ls -ld \"${ORIG}\"/\"${BASENAME}\"*; touch -r \"${ORIG}\"/\"${BASENAME}\"* \"${FILENAME}\"; ls -l \"${FILENAME}\"; echo; done < adjustTimes.txt
rm adjustTimes.txt

Let’s decompose that last long while loop. (And take out the touch command the first time you try this yourself!!! Make sure the right files show up, to make sure you won’t mind the results!)

while read FILENAME; do (stuff); done < adjustTimes.txt

This is a while loop that puts the entire line, one line at a time from that text file, into the variable FILENAME. This is the iterative engine!

First, display the filename (make sure spaces come through properly escaped) with echo "${FILENAME}". Then show the directory listing with timestamp via ls -l "${FILENAME}": too new.

Since Alepin’s package structure is flat, strip off everything in front the last slash; ## is greedy match removal, */ is anything before and including a slash. This should be the rtfd filename inside the Alepin document. However, rich-text-only exports from Alepin are sensibly just RTF. So to look at that timestamp, I need to convert *.rtf to *.rtfd … or just tack on * to match zero or more characters for ls -ld ~/Documents/stuff/Notes.alpn/"${BASENAME}"*.

If all that checks out when you test it, it’s time to move the Alepin timestamps to the Alepin export with touch -r ~/Documents/stuff/Notes.alpn/"${BASENAME}"* "${FILENAME}"! Admire the results with a final directory listing with updated timestamps: ls -l "${FILENAME}" (and a final echo for visual space).Ta-da!

Tips, Unix, Code 8:36 am

I wrote a quick bash script about a month ago to do my daily rsync, but I had a problem that took the quick and easy fun out of the script for several days. What worked on the command line to handle spaces didn’t work in the script! The answer was buried in the rsync FAQ:

The [rsync] command line is interpreted by the remote shell and thus the spaces need to arrive on the remote system escaped so that the shell doesn’t split such filenames into multiple arguments.

That’s the core of the problem, but backslashes didn’t seem to help. I went for the ? solution, to match one character that happens to be a space, instead.

Today I discovered that I probably could have stayed with what worked on the command line (but not in the script) if I had used eval on the scripted rsync command.