a week long summary of my experience with vista …

… it hasn’t crashed yet.

Honestly, I don’t think much more need be said. Programs run; the stuff I need to do any work I have runs. But overall, this isn’t the Windows I remember: crashing at least once a day, and always giving me that “omg, I’d better save this document lest the computer freeze”-feeling.

id29 :: how to be a better client

oh, those silly designers and their ad campaigns

http://www.id29.com/how

… but really, the campaign is kind of funny

Functional Programming Frenzy

My journey into the world of Erlang is progressing nicely. I’m really excited by the possibilities the language offers.

Haskell: the Craft of Functional Programming

I wanted to get more perspective on functional programming by learning another functional language as well. Since my forays into LISP over the years never amounted to much, I decided to try out Haskell. I’ve been concerned about the buzz surrounding Erlang — buzz always seems to mask why something really is good or useful, because some are clamoring that it’s good and useful for everything.

So, I ordered a copy of “Haskell: the Craft of Functional Programming” — I mean heck, how do you spend your Fridays?

Terminal.app v. erlang and Latin-1 characters

On pages 29-30 of “Programming Erlang” by Joe Armstrong, the author goes over character strings. Erlang uses Latin-1 as it’s character set. At first, Terminal.app wasn’t showing the non-US / ASCII characters.

There’s a two-step process to solve this:

  1. Terminal->Window Settings…->Display->”Character Set Encoding” set to “Western (ISO Latin 1)”
  2. Set the environment variable LC_ALL to “en_US” before you run erl. Also, see the next paragraph for explanations.

Terminal.app Erlang Latin 1Terminal.app Latin 1 Settings

The above steps are for U.S. English — something similar is available for most locales, but I don’t know the specifics. Of note, is the 2nd step; firstly, LC_CTYPE is the specific value to set, but LC_ALL sets LC_* to the assigned value, so one usually wants LC_ALL, unless you have a very unique locale configuration. Secondly, I’m using Gentoo Prefix Portage environment on OSX, so while I feel that these directions are applicable to most OSX installs, my setup is slightly different, so your mileage may vary. Thirdly, for those that need UTF-8, they can set LC_ALL to “en_US.UTF-8″, and then they only have to toggle Terminal.app’s character set encoding. Why en_US.UTF-8 works, I do not know — Latin 1 is not a subset of UTF-8, so I’ll leave that to more inquiring minds.

After you find settings that you are happy with, consider adding export LC_ALL="en_US.UTF-8" to your ~/.bash_profile if you’d like it to load with every terminal window that opens. My ~/.bash_profile sources my ~/.bashrc, because ~/.bashrc is supposed to be safe for scripts that run as your user, but non-interactively; so, ~/.bash_profile tends to get a lot of my environment look and feel code.

Wha-wha-what?! You can make your own control structures?

programaticprogammer-programmingerlang.jpg
I’m working through the Programming Erlang book that my friend zuzu recommended to me. Forty-six pages in, and so far, so good.

I did, however, just have my mind blown. I was going through an example for creating a for-loop-like function, because erlang doesn’t have a for-loop. “Well,” I thought, “that’s interesting that you have to create your own control structures.” But then the book spelled it out straightly: you can create any control structure you want — you are not limited by the control structures that the language offers.

Result? Mind is blown.

T-Mobile Dash, OS X, and Internet Sharing

UPDATE: everyone at my workplace knows that I love to iPhone-hate, but I would just like to compare the annoying but simple PAN tethering steps for OSX to Dash with the steps described here. Suffice to say, you need to hack the iPhone’s OS — a terrible only-option, in my opinion, but a well documented one. I used to hack on homebrew software for my PSP, so I can appreciate these efforts, but I also don’t take having to use homebrew seriously, especially for high-end phones. Laughable.

I recently upgraded my aging Treo 650. I really do like the Palm OS — I’ve been using it for years and years — but the phone was starting to drop calls frequently after one too many drops straight on it’s antenna. *whoops*

So, I got a T-Mobile Dash. As a phone, I like it. As a OSX user that likes having internet connectivity, as well as a business person that likes syncing my calender, tasks, etceteras, I knew I was going to be in for some fun.

Say what you will about how awesome the iPhone is, but for feature-set and “bang for buck,” the Dash is a clear winner. Considering I work for a media-centric company, not being able to record videos on the iPhone made it a non-option almost immediately.

I installed the Windows Mobile 6 upgrade (link). You’re going to have to do this from a Windows box, or from within Parallels or VMware. I didn’t use WM5 for long, but WM6 is stable, and honestly, a lot more pretty.

I’m using Mark/Space Missing Sync for Windows Mobile 4.0 (link). The pre-lease worked pretty well, but I’ve been having some issues with the current release. I have a good feeling from the Mark/Space people, however, so I think that it will be resolved soon.

There is some really good news, as well. Since 10.4.9, OSX supports PAN bluetooth profile, so I can use my Dash as a modem! On the Dash, you can turn this feature on by going to Start->Accessories->Internet Sharing, then make sure “PC Connection” is “Bluetooth PAN”, “Network Connection” is “T-Mobile Data”, and click “Connect”. On the OSX side, if the Bluetooth menu is in your menubar, just click on it, and select “Join Network on XXXX,” where XXXX is your device name.

erlang TextMate Bundle

I found this post containing a script that svn checkouts a fairly functional erlang TextMate bundle. Neat-o!

I edited the bundle to allow it to update itself, using a slightly modified form of the original script.

  • Bundles->Bundle Editor->Show Bundle Editor
  • Click on the menu entry text “erlang”
  • Drag a new separator to the bottom of the erlang bundle menu structure
  • Expand the erlang bundle menu
  • Use the drop-down + to create a new command
    • Save: Nothing
    • Command(s):

      1. #!/bin/bash
      2.          
      3. if [ -z "${TM_SVN}" ]; then
      4.   echo "You must define the location of your svn client in the variable TM_SVN."
      5.   exit 1
      6. fi
      7.  
      8. echo "Changing to Bundles directory…"
      9. mkdir -p /Library/Application\ Support/TextMate/Bundles
      10. cd /Library/Application\ Support/TextMate/Bundles
      11.  
      12. if [ -d /Library/Application\ Support/TextMate/Bundles/Erlang.tmbundle ]; then
      13.   echo Erlang bundle already exists – updating…
      14.   $TM_SVN up Erlang.tmbundle
      15. else
      16.   echo Checking out Erlang bundle…
      17.   $TM_SVN –username anon –password anon co http://macromates.com/svn/Bundles/trunk/Bundles/Erlang.tmbundle/
      18. fi
      19.  
      20. echo "Reloading bundles in TextMate…"
      21. osascript -e ‘tell app "TextMate" to reload bundles’
      22.  
      23. exit 0

      as downloadble file

    • Input: None
    • Output: Show as Tool Tip

Now you can update the bundle from it’s own menu option!

erlang

I believe erlang is quickly becoming that “language I always should’ve learned” language — and all this time, I thought that language was LISP.

SSL support for Apache in my prefix-portage overlay

I’m working on getting our Rails-based app, at work (OBT – obtech.net), working with SSL.

Since we all use OSX as our main dev boxen here, as well as Gentoo Linux machines, I long ago started hacking and helping on the Gentoo-Alt Prefix Portage project, so that I could help create one software repository we all use here. I found it very time consuming, before hand, to help other devs install and configure pieces of software every time they needed something — they’re not n00bs or anything, just UNIX CLI stuff isn’t their usual cup of tea.

I’m in the process of (re-)becoming an official Gentoo developer, focusing on Prefix Portage this time (last time was GNUstep). Until that goes through, I have a prefix-portage overlay, which is accessible through layman, or you can use SVN to check it out at http://www.dicianno.org/svn/PrefixPortage/branches/overlay-fafhrd/.

So, to summarize the point of this post, shortly, I got SSL support working in the Apache ebuild that was already in my overlay, at least on OSX. So, get to it!

Creating stream-able video

I spent much to much time trying to figure out the right combination of video/audio encodings that would would from an RTSP streaming server (went with a RealServer demo, for now) to a variety of clients (QuickTime Player, VLC, various phones, etceteras.)

First, VLC is a champ. Every time I tried a new streaming server, VLC could play the stream with video and audio. QuickTime Player was not so kind. Even the phone we were streaming to — the Nokia N95 (tech specs) — could play streams that QuickTime Player could not.

I tried a variety of tools, from the venerable ffmpeg to QuickTime Player’s export functionality to create stream-able videos (mainly for QuickTime, since it was being very picky). The tools I used were the following:

Here is a simple bash loop I made to iterate over .mov’s in the current directory and create MPEG4 video, MPEG4 audio (AAC LC), in an MPEG4 container that was hinted. You should set FRAMERATE and SIZE (as “WxH”) as environment variables. Note that the first line has -ac 1 which sets the audio to mono. Also, edit the -qscale to your liking (or remove it).

  1. for i in `ls *mov –color=never`; do
  2.   ffmpeg -i $i -ac 1 -vn "$i.wav"
  3.   faac –mpeg-vers 4 –tns -o "$i.aac" "$i.wav"
  4.   ffmpeg -re -i "$i" -pass 1 -passlogfile "${i}pass" -vcodec mpeg4 -r $FRAMERATE -s $SIZE -qscale 8 -an "$i.m4v"
  5.   rm -f "$i.m4v"
  6.   ffmpeg -re -i "$i" -pass 2 -passlogfile "${i}pass" -vcodec mpeg4 -r $FRAMERATE -s $SIZE -qscale 8 -an "$i.m4v"
  7.   mp4creator -c "$i.m4v" -optimize -rate=$FRAMERATE "$i.mp4"
  8.   mp4creator -hint=1 "$i.mp4"
  9.   mp4creator -c "$i.aac" -interleave -optimize "$i.mp4"
  10.   mp4creator -hint=3 "$i.mp4"
  11.   mp4creator -list "$i.mp4"
  12. done
notes about computers and lifestyle