<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?>

<feed xmlns="http://purl.org/atom/ns#" version="0.3" xml:lang="en-US">
<link href="https://www.blogger.com/atom/7237050" rel="service.post" title="Rex Roof dot Com" type="application/atom+xml"/>
<link href="https://www.blogger.com/atom/7237050" rel="service.feed" title="Rex Roof dot Com" type="application/atom+xml"/>
<title mode="escaped" type="text/html">Rex Roof dot Com</title>
<tagline mode="escaped" type="text/html">I'm Rex.  this is some news for my website.  not my real blog.  thats hidden away elsewhere.&#13;
</tagline>
<link href="http://www.rexroof.com/blog/" rel="alternate" title="Rex Roof dot Com" type="text/html"/>
<id>tag:blogger.com,1999:blog-7237050</id>
<modified>2006-05-02T15:33:28Z</modified>
<generator url="http://www.blogger.com/" version="6.72">Blogger</generator>
<info mode="xml" type="text/html">
<div xmlns="http://www.w3.org/1999/xhtml">This is an Atom formatted XML site feed. It is intended to be viewed in a Newsreader or syndicated to another site. Please visit the <a href="http://help.blogger.com/bin/answer.py?answer=697">Blogger Help</a> for more info.</div>
</info>
<convertLineBreaks xmlns="http://www.blogger.com/atom/ns#">true</convertLineBreaks>
<entry xmlns="http://purl.org/atom/ns#">
<link href="https://www.blogger.com/atom/7237050/114658400780511290" rel="service.edit" title="missing eject button" type="application/atom+xml"/>
<author>
<name>Rex</name>
</author>
<issued>2006-05-02T11:30:00-04:00</issued>
<modified>2006-05-02T15:33:27Z</modified>
<created>2006-05-02T15:33:27Z</created>
<link href="http://www.rexroof.com/blog/2006/05/missing-eject-button.php" rel="alternate" title="missing eject button" type="text/html"/>
<id>tag:blogger.com,1999:blog-7237050.post-114658400780511290</id>
<title mode="escaped" type="text/html">missing eject button</title>
<content type="application/xhtml+xml" xml:base="http://www.rexroof.com/blog/" xml:space="preserve">
<div xmlns="http://www.w3.org/1999/xhtml">I was missing my eject button in the menu bar for my mac.   This was causing me problems because I don't have a mac keyboard on it and so, if theres no cd in the drive, I had limited options for getting the drive open.  Then I found out how to return the eject icon to my finder toolbar:<br/>
<br/>
<pre>
<br/>open /System/Library/CoreServices/Menu\ Extras/Eject.menu<br/>
</pre>
<br/>
<br/>or, if you want to use the finder, open a finder window, click cmd-shift-g and type <br/>
<pre>
<br/>/System/Library/CoreServices/Menu Extras/<br/>
</pre>
<br/>hit enter, and then double-click the Eject icon.<br/>
<br/>sweet!</div>
</content>
<draft xmlns="http://purl.org/atom-blog/ns#">false</draft>
</entry>
<entry xmlns="http://purl.org/atom/ns#">
<link href="https://www.blogger.com/atom/7237050/114599339022354113" rel="service.edit" title="flickr and unix is awesome" type="application/atom+xml"/>
<author>
<name>Rex</name>
</author>
<issued>2006-04-25T15:26:00-04:00</issued>
<modified>2006-04-25T19:29:50Z</modified>
<created>2006-04-25T19:29:50Z</created>
<link href="http://www.rexroof.com/blog/2006/04/flickr-and-unix-is-awesome.php" rel="alternate" title="flickr and unix is awesome" type="text/html"/>
<id>tag:blogger.com,1999:blog-7237050.post-114599339022354113</id>
<title mode="escaped" type="text/html">flickr and unix is awesome</title>
<content type="application/xhtml+xml" xml:base="http://www.rexroof.com/blog/" xml:space="preserve">
<div xmlns="http://www.w3.org/1999/xhtml">I've been toying around with flickr and downloading random images based on tags.   I just wrote a one-liner that grabs a random popular flickr tag, it looks like this:<br/>
<br/>
<pre>
<br/>GET http://flickr.com/photos/tags/ | grep '/photos/tags/[a-z]' | cut -f4 -d/ | random -f - | head -1<br/>
</pre>
<br/>
<br/>note:  the random command is something I've only found in FreeBSD.  it could easily be replaced with a perl one-liner to shuffle.<br/>
<br/>this prints out a single, random, popular tag from flickr.  used in combination with my perl script that picks a random picture based on tag, I can get some randomly awesome pictures:<br/>
<br/>
<pre>
<br/>slather -t `randomtag`<br/>
</pre>
<br/>
<br/>perhaps soon I'll post slather.</div>
</content>
<draft xmlns="http://purl.org/atom-blog/ns#">false</draft>
</entry>
<entry xmlns="http://purl.org/atom/ns#">
<link href="https://www.blogger.com/atom/7237050/112716139109997279" rel="service.edit" title="Unix Domain Sockets in Perl" type="application/atom+xml"/>
<author>
<name>Rex</name>
</author>
<issued>2005-09-19T16:18:00-04:00</issued>
<modified>2005-09-19T20:23:11Z</modified>
<created>2005-09-19T20:23:11Z</created>
<link href="http://www.rexroof.com/blog/2005/09/unix-domain-sockets-in-perl.php" rel="alternate" title="Unix Domain Sockets in Perl" type="text/html"/>
<id>tag:blogger.com,1999:blog-7237050.post-112716139109997279</id>
<title mode="escaped" type="text/html">Unix Domain Sockets in Perl</title>
<content type="application/xhtml+xml" xml:base="http://www.rexroof.com/blog/" xml:space="preserve">
<div xmlns="http://www.w3.org/1999/xhtml">I know this has been done dozens of times before, but it's been a real headache for me lately.   A full example of how to use  IO::Socket::UNIX is not really available anywhere on the web.  All of the socket info for perl seems to assume you've been doing socket programming in C for years, and theres very limited info on doing Unix Domain Sockets.  it all seems to be about inet sockets.   which, of course, relates a lot to Unix Sockets, but there are some differences.<br/>
<br/>okay, here is my working example.   Its meant to be run twice, the first time it's the server, the second time it's the client.<br/>
<br/>
<br/>
<pre>
<br/>
<font color="#444444">#!/usr/bin/perl<br/>
</font>
<strong>use</strong> strict; <font color="#2040a0">$|</font>++;<br/>
<strong>use</strong> IO::Socket;<br/>
<br/>
<strong>my</strong> <font color="#2040a0">$socketfile</font> = <font color="#2040a0">$ENV</font>
<font color="4444FF">
<strong>{</strong>
</font>HOME<font color="4444FF">
<strong>}</strong>
</font> . <font color="#008000">"/.sockettest"</font>;<br/>
<br/>
<strong>if</strong> <font color="4444FF">
<strong>(</strong>
</font> -S <font color="#2040a0">$socketfile</font> <font color="4444FF">
<strong>)</strong>
</font> <font color="4444FF">
<strong>{</strong>
</font>
<br/> <font color="#444444"># client!<br/> </font>
<strong>my</strong> <font color="#2040a0">$client</font> = IO::Socket::UNIX-&gt;<strong>new</strong>
<font color="4444FF">
<strong>(</strong>
</font>Peer  =&gt; <font color="#2040a0">$socketfile</font>,<br/>                                    Type      =&gt; SOCK_STREAM <font color="4444FF">
<strong>)</strong>
</font> <strong>or</strong> <strong>die</strong> <font color="#2040a0">$!</font>;<br/> <strong>my</strong> <font color="#2040a0">$string</font> = <font color="#008000">"this is some sent garbage.<font color="#77dd77">\n</font>"</font>;<br/> <font color="a52a2a">
<strong>print</strong>
</font> <font color="#2040a0">$client</font> <font color="#2040a0">$string</font>;<br/> <font color="#2040a0">$client</font>-&gt;flush;<br/> <font color="#2040a0">$client</font>-&gt;<font color="a52a2a">
<strong>close</strong>
</font>;<br/> <strong>exit</strong>;<br/>
<br/>
<font color="4444FF">
<strong>}</strong>
</font> <strong>else</strong> <font color="4444FF">
<strong>{</strong>
</font>
<br/> <font color="#444444"># server!<br/> </font>
<font color="a52a2a">
<strong>unlink</strong>
</font> <font color="#2040a0">$socketfile</font>;<br/> <strong>my</strong> <font color="#2040a0">$data</font>;<br/> <strong>my</strong> <font color="#2040a0">$server</font> = IO::Socket::UNIX-&gt;<strong>new</strong>
<font color="4444FF">
<strong>(</strong>
</font>Local =&gt; <font color="#2040a0">$socketfile</font>,<br/>                                    Type      =&gt; SOCK_STREAM,<br/>                                    Listen    =&gt; 32 <font color="4444FF">
<strong>)</strong>
</font> <strong>or</strong> <strong>die</strong> <font color="#2040a0">$!</font>;<br/> <font color="#2040a0">$server</font>-&gt;autoflush<font color="4444FF">
<strong>(</strong>
</font>1<font color="4444FF">
<strong>)</strong>
</font>;<br/> <strong>while</strong> <font color="4444FF">
<strong>(</strong>
</font> <strong>my</strong> <font color="#2040a0">$connection</font> = <font color="#2040a0">$server</font>-&gt;<font color="a52a2a">
<strong>accept</strong>
</font>
<font color="4444FF">
<strong>(</strong>
</font>
<font color="4444FF">
<strong>)</strong>
</font> <font color="4444FF">
<strong>)</strong>
</font> <font color="4444FF">
<strong>{</strong>
</font>
<br/>   <strong>my</strong> <font color="#2040a0">$data</font>= &lt;<font color="#2040a0">$connection</font>&gt;;<br/>   <font color="a52a2a">
<strong>print</strong>
</font> <font color="#2040a0">$data</font>, <font color="#2040a0">$</font>/;<br/>
<br/>   <font color="a52a2a">
<strong>sleep</strong>
</font> 5;<br/> <font color="4444FF">
<strong>}</strong>
</font>
<br/>
<font color="4444FF">
<strong>}</strong>
</font>
<br/>
<br/>
</pre>
</div>
</content>
<draft xmlns="http://purl.org/atom-blog/ns#">false</draft>
</entry>
<entry xmlns="http://purl.org/atom/ns#">
<link href="https://www.blogger.com/atom/7237050/111100833691782578" rel="service.edit" title="iTunes share on FreeBSD" type="application/atom+xml"/>
<author>
<name>Rex</name>
</author>
<issued>2005-03-16T14:23:00-05:00</issued>
<modified>2005-03-16T21:39:18Z</modified>
<created>2005-03-16T21:25:36Z</created>
<link href="http://www.rexroof.com/blog/2005/03/itunes-share-on-freebsd.php" rel="alternate" title="iTunes share on FreeBSD" type="text/html"/>
<id>tag:blogger.com,1999:blog-7237050.post-111100833691782578</id>
<title mode="escaped" type="text/html">iTunes share on FreeBSD</title>
<content type="application/xhtml+xml" xml:base="http://www.rexroof.com/blog/" xml:space="preserve">
<div xmlns="http://www.w3.org/1999/xhtml">With over 33,000 songs in my library, my iTunes share here at work is very popular.  iTunes has a built in connection limit that people often complain to me about hitting.  So this is why I started looking into running a duplicate share on my FreeBSD server.<br/>
<br/>first thing I did was set up nfs on my Mac OS X box to share to my mac, handily if you just write an /etc/exports file and reboot, the NFS server just starts. here's my /etc/exports file:<br/>
<pre>
<br/>/Volumes/Music -mapall=rex shaolin<br/>
</pre>
<br/>/Volumes/Music is where my music is, rex is my user's shortname, and shaolin is the machine hostname for my FreeBSD server that will want to mount the share.<br/>
<br/>then, on my FreeBSD box I put this in my /etc/fstab:<br/>
<br/>
<pre>
<br/>mogu:/Volumes/Music     /music          nfs     ro,intr,noauto  0       0<br/>
</pre>
<br/>intr is nice so that when nfs goes down my df commands don't hang.  I'll probably take out the noauto once I figure out if this setup is working right.  <br/>after that I just did:   mkdir /music ; mount /music , as root, of course.<br/>
<br/>all of this I did after I found this handy site:<br/>
<br/>
<a href="http://home.introweb.nl/%7Edodger/itunesserver.html">Setting up an iTunes server in FreeBSD</a>
<br/>
<br/>This page was very helpful, but I found some of the info out of date and some dependancies broken.  so here's my rundown (read that page before continuing)<br/>
<br/>First, install daapd.  it's in /usr/ports/audio/daapd. <br/>
<br/>In the above instructions the info on <b>daapd</b> is correct, but I had many issues getting the port to build.    The dependancies didn't seem to work out of the box, the error it gave me lead me to build  <i>multimedia/mpeg4ip</i> manually.  do this:<br/>
<pre>
<br/># cd /usr/ports/multimedia/mpeg4ip-libmp4v2<br/># make install clean<br/># cd /usr/ports/multimedia/mpeg4ip<br/># make install<br/>
</pre>
<br/>then, it gets tedious.  to get the mpeg4ip port to build, I had to edit some makefiles.  I kept running that last command over and over, editing files as I went. The first errors were about mp4.h not found.  this happened about 3 times; when it did, I noted from the error what directory it was in, then edited the Makefile in that directory and added  <pre>-I$(src_topdir)/lib/mp4v2</pre> to the INCLUDES= line.  for some reason this was omitted someplace. I'll e-mail the maintainer, hopefully it'll be fixed when you go to build the port.<br/>
<br/>After that I got some errors that were warnings treated as errors because -Wall was in the Makefile.  The errors looked rather harmless, so I went into the directories in question and edited the Makefile to remove every instance of <pre>-Wall</pre>
<br/>I think this only happened once.<br/>
<br/>The next batch of errors I had was some errors that said something along the lines of "undefined reference to `MP4IsIsmaCrypMediaTrack'", those were solved by manually rebuilding mpeg4ip-libmp4v2, which you already did, because I mentioned it above.<br/>
<br/>After mpeg4ip was installed, I went and built daapd, which rebuilt a bunch of stuff on my machine in my xlibraries.  most of these things were upgrades, so I had to rebuild them by hand using cd /usr/port/dir ; make deinstall ; make reinstall. I had to do this for at least 3 ports; including pango, gtk and glib.  I also got an error from /usr/ports/x11-fonts/XFree86-4-fontScalable that required me to build the port manually, that is, after manually installing a new version of make and imake.  I did both of these with  <pre>portupgrade imake make</pre>.  Hopefully anyone reading this won't have ports as old as mine and won't have issues with these.<br/>
<br/>once daapd is installed you'll want to put <i>daapd_enable="YES"</i> in your /etc/rc.conf. and don't forget to edit your /usr/local/etc/daapd.conf, a sample is provided, and an example is shown on the page I linked above.<br/>
<br/>
<b> setting up mdnsresponder/rendezvous </b>
<br/>
<br/>the information on this in that above page is outdated.   I found that I already had a mDNSResponder port, so I installed that.  in fact, it's part of the dependancies of howl, which is part of the daapd dependancies.  but I installed /usr/ports/net/mDNSResponder, and /usr/ports/net/howl by hand; I believe they went fairly painless.  Finally I created /usr/local/etc/howl and created an mDNSResponder.conf there with these contents:<br/>
<pre>
<br/>FREEBSD SERVERNAME<br/>_daap._tcp.<br/>
<br/>3689<br/>
</pre>
<br/>(note that blank line in there).<br/>
<br/>also, don't forget to add <i>mdnsresponder_enable="YES"</i> to your /etc/rc.conf<br/>
<br/>after that I ran<br/>
<pre>
<br/># /usr/local/etc/rc.d/mdnsresponder.sh start<br/># /usr/local/etc/rc.d/daapd.sh start<br/>
</pre>
<br/>if you haven't changed your rc.conf these commands won't start the servers, so make sure you do that first.<br/>
<br/>this took over 10 minutes to start up the first time, I'm guessing because it had to parse my almost 160GB of music.  but after that it started up rather quickly.  you can watch /var/log/daapd.log to see what the server is doing.<br/>
<br/>one note, the first time I ran this, it crashed after I played with it a bit.  hopefully this doesn't continue to happen.</div>
</content>
<draft xmlns="http://purl.org/atom-blog/ns#">false</draft>
</entry>
<entry xmlns="http://purl.org/atom/ns#">
<link href="https://www.blogger.com/atom/7237050/110807278688444363" rel="service.edit" title="pladd" type="application/atom+xml"/>
<author>
<name>Rex</name>
</author>
<issued>2005-02-10T16:48:40-05:00</issued>
<modified>2005-02-10T22:04:40Z</modified>
<created>2005-02-10T21:59:46Z</created>
<link href="http://www.rexroof.com/blog/2005/02/pladd.php" rel="alternate" title="pladd" type="text/html"/>
<id>tag:blogger.com,1999:blog-7237050.post-110807278688444363</id>
<title mode="escaped" type="text/html">pladd</title>
<content mode="escaped" type="text/html" xml:base="http://www.rexroof.com/blog/" xml:space="preserve">I've written this script a half-dozen times at least, but this is the first one that doesn't use Mac::iTunes to create the playlist.  I needed something that would add a directory of mp3s to a playlist in itunes with the same name as the directory, so I wrote this:&#13;&lt;br /&gt;&#13;&lt;br /&gt;&lt;font color=white&gt;&#13;&lt;br /&gt;#!/usr/bin/perl&#13;&lt;br /&gt;use strict;  $|++;&#13;&lt;br /&gt;use warnings;&#13;&lt;br /&gt;use Mac::Glue qw(:all);&#13;&lt;br /&gt;my $itunes = Mac::Glue-&gt;new("iTunes");&#13;&lt;br /&gt;&#13;&lt;br /&gt;my $dir = shift;&#13;&lt;br /&gt;die "specify directory on command line\n" unless ( $dir and -d $dir );&#13;&lt;br /&gt;my $playlist = $dir;&#13;&lt;br /&gt;$playlist =~ s/\///g;&#13;&lt;br /&gt;$playlist =~ s/\s+/_/g;&#13;&lt;br /&gt;&#13;&lt;br /&gt;die "no playlist found\n" unless ($playlist =~ m/[a-zA-Z]/);&#13;&lt;br /&gt;&#13;&lt;br /&gt;# check the playlist total time to see if the playlist exists already.&#13;&lt;br /&gt;#   $pl_time will be null if playlist doesn't exist, "0:00" for empty playlist&#13;&lt;br /&gt;my $pl_time = $itunes-&gt;obj(playlist=&gt;$playlist)-&gt;prop('time')-&gt;get;&#13;&lt;br /&gt;if ($pl_time) { &#13;&lt;br /&gt;  print "playlist exists!\n";&#13;&lt;br /&gt;} else { &#13;&lt;br /&gt;  $itunes-&gt;make(new =&gt; 'playlist', with_properties =&gt; { name =&gt; $playlist });&#13;&lt;br /&gt;}&#13;&lt;br /&gt;&#13;&lt;br /&gt;opendir DIR, $dir or die $!;&#13;&lt;br /&gt;# only adding songs m4a, m4b, and mp3s.&#13;&lt;br /&gt;my @file_list = grep { /(mp3|m4[ab])$/i } readdir (DIR);&#13;&lt;br /&gt;&#13;&lt;br /&gt;foreach my $file (@file_list) {&#13;&lt;br /&gt;  print $file, $/;&#13;&lt;br /&gt;  # add files to playlist.&#13;&lt;br /&gt;  $itunes-&gt;add("$dir/$file", to =&gt; $itunes-&gt;obj(playlist=&gt;$playlist));&#13;&lt;br /&gt;  # remove original&#13;&lt;br /&gt;  unlink "$dir/$file" or warn $!;&#13;&lt;br /&gt;}&#13;&lt;br /&gt;&lt;/font&gt;&#13;&lt;br /&gt;&#13;&lt;br /&gt;&#13;&lt;br /&gt;you can also find it on the code section of my webpage &lt;a href=http://rexroof.com/code&gt;here&lt;/a&gt;.</content>
<draft xmlns="http://purl.org/atom-blog/ns#">false</draft>
</entry>
<entry xmlns="http://purl.org/atom/ns#">
<link href="https://www.blogger.com/atom/7237050/110745480427411730" rel="service.edit" title="imunge roxorz!" type="application/atom+xml"/>
<author>
<name>Rex</name>
</author>
<issued>2005-02-03T13:18:04-05:00</issued>
<modified>2005-02-03T18:20:04Z</modified>
<created>2005-02-03T18:20:04Z</created>
<link href="http://www.rexroof.com/blog/2005/02/imunge-roxorz.php" rel="alternate" title="imunge roxorz!" type="text/html"/>
<id>tag:blogger.com,1999:blog-7237050.post-110745480427411730</id>
<title mode="escaped" type="text/html">imunge roxorz!</title>
<content mode="escaped" type="text/html" xml:base="http://www.rexroof.com/blog/" xml:space="preserve">I love &lt;a href=http://rexroof.com/blog/2004/10/imunge.php&gt;imunge&lt;/a&gt;!&#13;&lt;br /&gt;I had some songs with annoying song names in all caps, with the help of &lt;a href=http://ernie.org&gt;ernie&lt;/a&gt; I wrote this imunge command:&#13;&lt;br /&gt;&#13;&lt;br /&gt;imunge -s -r '.+' -P '\L$&amp;'&#13;&lt;br /&gt;&#13;&lt;br /&gt;beautiful!&#13;&lt;br /&gt;</content>
<draft xmlns="http://purl.org/atom-blog/ns#">false</draft>
</entry>
<entry xmlns="http://purl.org/atom/ns#">
<link href="https://www.blogger.com/atom/7237050/110730480094499603" rel="service.edit" title="Rip and Burn DVDs" type="application/atom+xml"/>
<author>
<name>Rex</name>
</author>
<issued>2005-02-01T18:44:45-05:00</issued>
<modified>2005-02-02T00:45:45Z</modified>
<created>2005-02-02T00:40:00Z</created>
<link href="http://www.rexroof.com/blog/2005/02/rip-and-burn-dvds.php" rel="alternate" title="Rip and Burn DVDs" type="text/html"/>
<id>tag:blogger.com,1999:blog-7237050.post-110730480094499603</id>
<title mode="escaped" type="text/html">Rip and Burn DVDs</title>
<content type="application/xhtml+xml" xml:base="http://www.rexroof.com/blog/" xml:space="preserve">
<div xmlns="http://www.w3.org/1999/xhtml">How to copy a dvd and burn it to DVD on my mac powerbook:
<br/>
<br/>
<ol>
<br/>
<li> Rip the DVD using MacTheRipper.  this copies it to the hard drive and removes DSS.</li>
<br/>
<li>Open VirtualPC </li>
<br/> <ul>
<br/>   <li>mount home directory as samba share drive (for some reason the virtual PC built in file sharing won't work with most XP progams I've tried. it makes things crash.)</li>
<br/>    <li>use DVDShrink to reencode files to fit on one burned DVD</li>
<br/>    <ul>
<br/>        <li>click Open Files, pick where you saved with MacTheRipper, turn off video preview.</li>
<br/>        <li>Set save to folder and choose the Desktop on the share.</li>
<br/>        <li>Make sure you're saving Region Free and turn on Deep Analysis and Smooth high quality error correction.</li>
<br/>        <li>Click OK and make sure video preview is off again.  wait 2 hours.  I suggest sleeping.</li>
<br/>    </ul>
<br/>    <li>Close Virtual PC</li>
<br/>  </ul>
<br/>
<li> Burn the resulting directories with Toast 6 to a DVD.  Just drag the folder on the desktop into Toast with the DVD Data Disc option chosen.</li>
<br/>
<li>Delete the files that MacTheRipper and DVDShrink made.  should be about 5-6 gigs total.</li>
<br/>
</ol>
<br/>
<br/>
</div>
</content>
<draft xmlns="http://purl.org/atom-blog/ns#">false</draft>
</entry>
</feed>
