Archive for July, 2007

For loops in Erlang

Tuesday, July 31st, 2007

lib_misc.erl:
-module(lib_misc).
-export([for/3]).


for(Max, Max, F) -> [F(Max)];
for(I, Max, F) -> [F(I)|for(I+1, Max, F)].

then in erl:


5> lib_misc:for(1,10,fun(I) -> I end).
[1,2,3,4,5,6,7,8,9,10]
6> lib_misc:for(1,10,fun(I) -> I*I end).
[1,4,9,16,25,36,49,64,81,100]

Weird. But check this out:

1> Fruit = [apple,pear,orange].
[apple,pear,orange]
2> MakeTest = fun(L) -> (fun(X) -> lists:member(X, L) end) end.
#Fun<erl_eval.6.56006484>
3> IsFruit = MakeTest(Fruit).
#Fun<erl_eval.6.56006484>
4> IsFruit(pear).
true
5> IsFruit(apple).
true
6> IsFruit(dog).
false
7> lists:filter(IsFruit, [dog,orange,cat,apple,bear]).
[orange,apple]

That is extremely cool. I’ve got to make this a higher priority, so that I can get past the baby talk.

Salmon with Rosemary

Monday, July 30th, 2007

From TSBD, p. 162. We’ve made this one a zillion times… It’s quick, simple, and tasty. D picked up some Scottish salmon at Whole Paycheck. It tasted richer and oilier than the farm-raised salmon that we usually get… Not unpleasantly so, but the whole downstairs still smells like salmon.

We also made Broiled Tomato with Pesto, from p. 173. I like green pesto, and I like tomato. I’m not so sure that this combination works particularly well, which is surprising (basil & tomatoes… how could that be wrong?). It wasn’t bad — it just wasn’t particularly interesting. Oh, well.

Ribeye Steaks with Arugula, Blue Cheese, and Grilled Red Onions

Sunday, July 29th, 2007

Again. Why mess with success? These steaks were quite a bit fattier than the last ones… Not so crazy about that. Otherwise tasty as expected.

Garlicky Chicken Breasts

Wednesday, July 25th, 2007

From CSSFRWC, p. 176. I love this one, so much so that we’re in danger of getting burnt out on it. Really simple — get some boneless, skinless chicken breasts, trim them, score them, and toss them in a ziploc bag with garlic powder, sliced green onions, salt, and olive oil. Let them marinate for a bit, then chuck ‘em on the grill.

It goes really well with an orzo/tomato/mint salad, but no carbs this week. :/ Instead, we had roasted eggplant with peppers & onions. It’s an OK side, but I don’t love it.

Programming Erlang

Wednesday, July 25th, 2007

I ordered the pragprog book on Erlang last week, and I found it stuffed in the mailbox this morning. I read a bit of the first chapter over lunch. I’ll probably have to wait until this weekend to do much with it, though.

Why am I messing with Erlang? I hear that all the cool kids are doing it, and I hate to be left out. Actually, I am really interested in distributed computing. I’ve been playing around with Rinda (Ruby’s implementation of TupleSpaces)… It’s cool in theory, but I’m having a hard time making the leap from thought games to useful code.

Grilled Stuffed Chicken Breasts with Prosciutto, Taleggio and Pesto

Tuesday, July 24th, 2007

From CSSFRWC, p. 183. The stupid Hannaford didn’t have any Taleggio, so I used Fontina instead. I don’t think the dish suffered, though. We made this once before with Taleggio, and I remember that it had a stronger taste. This is a nice dish… Wish we’d had a good bottle of Pinot Grigio to go with it.

D made Zucchini in Padella from JI, p. 259. Very tasty. Those wacky Italians… Zucchini, marjoram and anchovies? Delicious.

Ground Lamb with Peas (Mutter Kheemen)

Monday, July 23rd, 2007

From BCIHC, p. 96. An oldie but goodie. I love the richness of lamb (baa!), combined with garlic, cinnamon, red onion, and mustard seed. It was a little greasier than I like, because we didn’t have the usual rice (stupid diet!) to sop up the mess. Still quite tasty. I made some haricots verts w/shallots, too. Not Indian, but we needed to use them before they went sideways.

Asterisk for fun and non-profit

Monday, July 23rd, 2007

My dad lives in Africa. Botswana, to be precise. He is mostly retired, but still dedicates himself to helping others via drug & alcohol outreach and counseling. He and his wife have started or been instrumental in building several AA groups within the region, and they run a small non-profit called Safe Haven Counseling.

Enough with the backstory. When I went to Africa with my dad, I spent a week at his home and decided to overhaul his home network. One of the items on my list was to get a reliable Asterisk installation running there, so that he could easily (and cheaply) talk to folks back in the States.

I had a few options with regard to how I should do things, and ultimately what I wound up with was an Asterisk installation on his Linksys WRT54G (running openwrt). The tricky part was that Asterisk 1.4 is too big to completely fit in the WAP’s root filesystem. Rather than fooling around with paring the installation down, I decided to create a share on his Buffalo LinkStation and did the install to the share. Then I created symlinks from the WAP’s rootfs to the stuff on the LinkStation share, and voila, a full Asterisk installation on the WAP.

It’s not as clean as I’d like, because of the dependency on the LinkStation. At some point, I may try to reduce the Asterisk footprint by removing unnecessary modules (many don’t work or are useless on the wimpy CPU). It works, though, and I’m still pretty proud of it.

He’s got a Grandstream BudgeTone 101 for his VoIP phone, and I’ve got his * server configured to register directly with my * at home. This way we can dial directly via 3-digit extension between sites. I also got him set up with a VoicePulse Connect! account so that he can do cheap calls to/from the States. Even though I’ve been messing with * for almost 4 years now, it still amazes/tickles me that I can dial a Philadelphia number and ring a phone in Botswana.

One annoyance about the solution is that VPC only supports ulaw/alaw/gsm. Because of the high latency of Dad’s Internet connection, the *law codecs are completely unusable. GSM sounds OK, but it still tends to drop packets. While I was there, I played around with G.723.1 between his BudgeTone and my home system (my * server transcoded from G.723.1 to ulaw for the cisco ATA). It sounded really great… Much better than even GSM. Unfortunately, it’s hard to find any good VoIP termination providers who support G.723.1. I guess it’s that whole licensing issue.

What I can’t work out is if there is some way to make the BudgeTone do codec negotiation. I’d love to be able to specify that it use G.723.1 when certain extensions are dialed, and GSM for anything else. I don’t think the phone has that capability, though. I’m not even sure I could do it within *, even if that were an option (it’s not; the WRT54G has barely enough oomph to handle a single SIP call, much less transcode).

dyndns for dad’s router

Monday, July 23rd, 2007

Finally got Dad’s router to auto-update dyndns. I wrote a little script (based on something I found in a forum) to handle these updates. I’d meant to do this before I left Africa, but I didn’t get to it.

Ribeye Steaks with Arugula, Blue Cheese, and Grilled Red Onions

Sunday, July 22nd, 2007

Hot damn, this one was good. From CSSFRWC, p. 228.

I made this once before, but I don’t remember it as being this spectacular. We got the meat and produce from Whole Paycheck… Maybe that made the difference.

The steak was awesome… Ribeye is fattier than tenderloin, and very flavorful. I put the cheese in the freezer for a little bit to make it easier to crumble, and I really liked the juxtaposition of hot/cold, and of course the flavors went together incredibly well.

The salad was really good, too. Arugula is hands-down my favorite green. The grilled onions and balsamic vinegar went together very nicely with the bitterness of the leaves.

We shared a glass of 2004 Lancatay Malbec. Stood up well to the blue cheese. Not an excellent wine, but for $10 I’m not going to complain (thanks Bob!).