Nov 14 2008

Refreshing your iTunes list

notarus | mac | 0 Comments

Perhaps I am the only person that this applies to, but in case not:

I store all my music, mp3s and m4us, on a network share. We do this because my wife and I share an iTunes account, the server’s backed up, etc, etc. Now we both can get to our tunes.

For some reason, though, my mac will eventually time out the SMB share to my fileserver. When iTunes starts up, it will look for the music in my library, and it won’t be there, and 99.5% of my music is unavailable, and iTunes puts an exclamation mark next to it.

I used to man up, mount the share, and tell iTunes to play every song on the share. Apparently, this is not required, and the solution is obvious–

Quit iTunes. Mount share. Start iTunes. All your music is “back”.

I’m a doofus for not thinking of that.

I tend to prefer unix-like environments, which means I love mac as a desktop and linux as a server os.

But I’m at a new job, and my desktop and laptop are Windows. Here’s a short list of things I’ve done to make windows more unixy for me. Apologies in advance to the people who wrote these programs– I’m not comparing your awesome programs to someone else’s because I think you’re derivitive, I’m doing it because it quickly helps a Mac user understand the value.

  • Cygwin is a unix-like environment that runs inside of windows. Under there, you can compile most unix applications, run (native) perl, python, whatever. It’s good. It’s free. Once you have this, you have native open ssh, etc.
  • While you’re at it, change the default cygwin shortcut to point to a batch file that contains the following, it’s a much nicer shell than the default windows dosbox
  • Rocketdock is a nice mac-like dock. Just like on the mac, it supports things like minimize-to-dock, cute hover animiations, etc. It also has “live” images of what minimized windows look like. Nicer in many respects than the XP taskbar, and similar to the Vista one.
  • Launchy is a quicksilver-like hotkey launcher. It’s very, very nice. Hit alt-space and type “word” to launch Microsoft Word, etc. Speeds up application launching immensely.

Tonight, for some reason, I couldn’t sync my iphone on my macbook pro. There were a lot of upgrades recently for me (latest itunes, finally got arround to installing 10.5.5, etc) which could have been the issue, but the error itself was wildly unhelpful.

Fortunately, on the apple support forums, someone named neil had the quick fix: itunes apparently barfs if ANY file it wants to look at is locked (an old apple-ism that should be removed from the filesystem, post haste).

Anyway, the fix is a snap. Open the Script Editor in the /Applications/AppleScript/ folder and run the following:

[-]View Code APPLESCRIPT
tell application "Finder"
set locked of every item of entire contents of folder "Music:iTunes" of home to false
end tell

Once that’s pasted in, click the run button. If you still have troubles syncing, replace the Music:iTunes path with Music, and perhaps also Photos.

The original thread on the apple support forums is here.

The network printer component of the MFC-7820N is easy in leopard– it’s detected by the mDNS (bonjour), and the drivers are preinstalled. Everything there should be smooth sailing.

However, we wanted this printer partly because it’s a network scanner, as well. Getting the network scanner component working under Leopard turned out to have a slight trick.

First, install the drivers:

  1. Go to the brother download site
  2. choose Drivers -> Mac OS/X 10.5 -> English then hit submit
  3. Install this driver, it’s the scanner TWAIN driver. It’s universal too
  4. This driver will make you reboot. Whee.
  5. Go back to the download site, and this time, do Utilities -> Mac OS/X 10.5 -> English
  6. Install the provided “Remote Setup Software”

Now, here’s the fun trick. Open your hard drive, and go to the folder /Library/Printers/Brother/Utilities/DeviceSelector. In this dir is a program called DeviceSelector . Run it.

Tell the DeviceSelector (and the scanner driver) to “Specify your machine by address”, and enter the IP address of your printer. (Mine was preset to specify by ‘name’, which is using mDNS).

From there, I could now scan through the control center applet or in a standard Twain app, like Image Capture in the /Applications folder.

Jul 11 2007

Keyboard Wedges

notarus | General | 0 Comments

I type a lot, so not hurty wrists is a big thing for me. I’ve been very very happy with the Microsoft Natural Ergonomic 4000 Keyboard (available for as low as $30 from time to time, and sometimes on sale that low at Staples or whatever). And it works awesome with the Mac, too.

The best part of it is not just the split design, but that it’s also tilted backwards at a negative angle, which is perfect for people like me who are lazy and have never learned to keep your palms UP, but instead put them on the rest.

One drawback though is that the plastic piece that keeps it at that wedge eventually breaks, it’s got three small plastic spots where it attaches and those have snapped over time (nearly 2 years now, I think). The keyboard still works awesomely, it’s just the slope that was gone.

So, rather than dump the keyboard, I did some digging and found the VersaTech Keyboard Wedge, which is a piece of thick, tough foam cut at a 10degree angle, and big enough for the keyboard. It’s a little pricy ($40 bucks shipped, more than a replacement keyboard) but this foam isn’t going anywhere, and my keyboard is nice and negatively sloped again.

This wedge would also work well with your existing keyboard, giving it a perfect negative slope, if you don’t want to buy the MS product for some reason.

For reasons I don’t understand, if you’re running linux inside of Parallels on a mac, you can’t just add a usb flash drive and have it recognized.

However, you CAN make it work, you just have to work at it.

Here’s what works for me:

  1. Create a new vm, point it at a knoppix cd.
  2. Edit the USB controller settings and make sure it is NOT autocapturing devices
  3. WITHOUT Parallels running, insert the usb stick.
  4. Open the finder. If the usb stick is mounted, unmount it. It won’t work with it mounted.
  5. Start your VM. At the knoppix prompt, enter “knoppix irqpoll”. You can add other settings, like “lang=us 2″
  6. Let it boot
  7. Now, pull down the devices menu, go to the usb sub menu, and capture your memory stick
  8. Wait. Linux will auto discover the stick. it will throw out some errors about irq9 being ignored, and then capture the stick as a scsi device
  9. Now you can use it as you want.

We use NoCat extensively, and we have peak usages of > 1100 users actively logged in at the same time, with another good 3000 or so people actively using wireless and holding a dhcp lease.

We recently started experiencing slowdowns, where it would take minutes for NoCat gateways to actually return a page (status, capture, actually authenticate and redirect, etc). This was caused by a simple mistake in their child reaping, documented below.

It’s important to note that in a captive portal solution, the gateway is MUCH busier than the number of authenticated users suggests; authenticated users usually don’t impact the cpu much (they’re just permit rules in the underlying firewall). It’s unauthenticated users who hammer the system. Every weather widget, RSS request, twitter status update, etc, etc that’s happening automatically on port 80 is being captured (silently) by the gateway. So we need to be sure our forking is smart.

The root cause of the slowdown was that it was reaping children using the wait() call. wait() is a blocking call. This means that the software, if it had any children forked out, would block until a child (any child) exited, and then processing would continue. The server would fork off enough threads to handle any children waiting, and then come back and block again for a child to exit. This is ok at low loads, but not good when you’re at high loads (or there’s a packet loss problem, common in wireless, causing a thread to run slow, etc).

The fix: Change wait() to waitpid(-1,NOHANG). Now, it’s non blocking. Performance is much, much better.

--- Gateway.pm  (revision 667)
+++ Gateway.pm  (working copy)
@@ -3,6 +3,7 @@
 use IO::Socket;
 use IO::Select;
 use IO::Pipe;
+use POSIX ":sys_wait_h";
 use NoCat qw( PERMIT DENY PUBLIC MEMBER OWNER LOGIN ANY );
 use vars qw( @ISA @REQUIRED @EXPORT_OK *FILE );
 use strict;
@@ -93,6 +94,7 @@
     my $self   = shift;
     my $kids   = 0;
     my $hup = 0;
+    my $childPid;
 
     return unless $self->bind_socket;
 
@@ -143,10 +145,10 @@
         }
 
        # See if any kids have expired, reap zombies
-       if ( $kids ) {
-           1 until ( wait == -1 );
-           $kids = 0;
-       }
+        do {
+            $childPid = waitpid(-1, WNOHANG);
+           $kids-- if $childPid>0;
+        } until $childPid<=0;
 
     } # loop forever
 }

It’s that time again for me, where I upgrade the home file server and re-purpose some old hard drives. And with the upcoming Time Machine backup program in the upcoming MacOS X 10.5, an external 300GB drive makes a lot of sense here.

But, oddly, Disk Utility won’t format the darn thing. The drive was on a linux server, and it sees it, lets me configure the partition, but then it hangs forever, not apparently doing anything.

Some searching turned up this excellent article , or actually, the second comment. It describes the exact problem, and points out that you can format the drive nearly instantly in windows with the MacDrive tool from MediaFour .

Download the trial version and install it, it does the trick (limited to 5 days though). I did this in Parallels, actually. If you want to do it this way, force-quit your hung Disk Utility window, then remove and reconnect the drive. Start Parrallels, install the software, then click on the little usb icon in the bottom left corner of your window and capture your external drive (listed as “PATA IDE Bridge” for me). Then run MacDrive, format it (took 60s), release the drive from the usb tab and it should be mounted in your finder already.

The price is not even unreasonable, $50 or $20 for an upgrade. I see old versions on ebay for as low as $1 if you want to be legal.

For the longest time, I depended on .zshrc on the target machine to set the title in my (xterm|iTerm) window title. This has one drawback– if the target host doesn’t have my .zshrc (or support zsh), no title. And this bit me nastily the other day when I did something in the wrong window.

Enter this new .zshrc function, which works by setting the xterm title sequence:



Combine this with the following code to set your title to user@host before and after each command and you should always know who you are in a window.



Oct 18 2006

the power of parsley!

notarus | General | 1 Comment

And to think I’ve been cleaning with crazy stuff like chemicals and oranges when I could have been using parsley.

The power of Parsley!

Update 12/15/06: You might check out the new Parallels Transporter beta, http://forum.parallels.com/thread5999.html It looks like this will do all the below, but without the ftp
server in the middle?


For those of you who have a Virtual PC image that you just can’t live without, and upgraded from a PPC mac to an Intel mac (and thus Virtual PC to Parallels),
here’s a relatively quick way to convert the images.More information on how to use G4u is available at their home site.

Please note that you absolutely require at least Parallels build 1940 to run G4U.

  1. On your new mac, go to the Accounts control panel and create a user named “install”. Give it a password. You’ll need this account later.
  2. While you’re in the control panels, go to Sharing and enable the FTP server.
  3. On your OLD mac:
  4. download the g4u (”ghost for unix”) iso at http://www.feyrer.de/g4u/g4u-1.17.iso.zip . Unzip
  5. Fire up your Virtual PC, and capture the above ISO in your CDrom. Reboot if neccessary so that you boot off of it.
  6. Make a note of how large this disk image is.
  7. When you get a prompt, you want to copy your disk to your new server. Assuming you have one disk and one partition on this disk, use something like uploaddisk yournewmacip diskimage.gz wd0 .
  8. wd0 is the name that g4u knows your first disk as.
  9. diskimage.gz is the name your disk will be saved as on your new mac
  10. Wait until the disk is entirely copied. At this point you can close your virtual pc program.
  11. Now, go to your NEW mac
  12. Download the g4u (”ghost for unix”) iso at http://www.feyrer.de/g4u/g4u-1.17.iso.zip . Unzip
  13. Fire up Parallels and create a new guest OS. Give it a hard drive at least as large as what the Virutal PC guest had
  14. Boot your new GuestOS. Capture the G4U iso, and reboot the guest if necessary to boot it.
  15. When it’s finished booting, run the following command to download and unpack your disk image: slurpdisk localhost diskimage.gz
  16. Wait for this to finish.
  17. Uncapture the cd rom, and reboot your GuestOS.
  18. Go to your sharing control panel, and turn off FTP
  19. Go to your accounts panel, and delete the install account

At this point, you should have a working copy of your original Guest OS.

For more information, please see the G4U home page at http://www.feyrer.de/g4u/

So, we bought a (small) entertainment center, just 39″ wide, exactly as wide as our 42″ diagonal tv. It’s similar to this but less wide.
So, when we set it up, it has enough room for the big AV reciever, and for the Comcast moto 6412 DVR (and the soon-to-be-ours tivo series 3), dvd player, and everything else. It fits in the corner. It’s nice. But it’s very poorly venelated (read: none. Two small holes in back for cables, and not even holes in the center support/divider for cables left to right.

So when we set things up, our awesome (not) Moto DVR, which doesn’t even have a fan, immediately started overheating, which caused it to start mis-digitizing shows. When watching, the output would be screwy, and worse the audio would drop out for 3-5 seconds at a time. Very not cool.
So here’s the fix, and it’s not very expensive. Buy some very quiet 120mm case fans, a dc power adapter, rewire slightly, cut some holes, and you have a super silent but cool entertainment center.

  1. Aquire 2 quiet PC case fans. I bought a pair of these nexus 120mm fans (22db) and they are QUIET. The only move about 30CFM, but if you have one blowing in and one blowing out you’re silent and replacing “all” the air in your EC every minute. $28
  2. Buy 4 120mm cast fan grills. two for each fan, inside and out. Frys has them or buy them from any pc supply joint, including the above. $10
  3. You’ll need bolts and nuts. Make sure they’re at least 2″ long and fit through the fan. Get some washers too. $3 at Lowes.
  4. Buy a 12V power supply that puts out at least .6a. I went with this one from radio shack, which already has an adaptaplug end. I picked the adjustable voltage because I was worried about possible noise, but this turned out not to be an issue. Much cheaper online than in the stores. $18
  5. 2 Adaptaplug ends, 2 extension cords, and a Y splitter (which I only found on ebay). Actually, buy all of this on ebay you can. Ebay got me parts for $2 ea, as opposed to 7 or 8ea at the store or online. ~~$15 total

Installing

  1. When you get all of this, strip the ends off the fan and wire in the adaptaplug ends (you want the red and black wires, ignore the yellow and cut it short). Test that the fan works before you try to install it. Use the Y and the extension cords to run the cable into your entertainment center. Wrap the connections up well with electrical tape or even better, heat shrink tubing.
  2. Cut two holes in the back of your entertainment center, up high (or high and low), about 4.2″ in diameter, using a fan cover as a template. Be careful to make sure there’s enough cardboard arround the sides to hold the screws up!
  3. Drill holes through the carboard at the four corners using your 120mm fan grill as the guide again. Make sure the bit is larger than your bolts! You’ll need it to work the bolts arround a little to get into the fans.
  4. Mounting:
  5.  outside                                 cardboard back        inside
    (bolt) (washer) (fan grill)               |                 (fan) (fan grill) (bolt)
  6. Tighten everything as tight as possible to prevent noise. Be sure you install one fan to blow in, and one fan to blow out.
  7. Then, if you have a partition in your entertainment center, drill 2.5″ holes (using a hole driller) in 4 appropriate places (in mine, 2 up top, 2 below) so that there is airflow left and right without compromising the structural integrity. You can also use these holes for cabling from side to side w/o going out the back. Paint the wood black (or color with a sharpie!) so that the holes aren’t obvious from outside the cabinet.
  8. Plug in the fans, they should both spin. You won’t notice a lot of airflow, but there should be some. Some is all you need.
  9. Put your entertainment hardware back, close the doors, and enjoy. My entertainment center with doors closed is cool, and the DVR is barely warmer than room temp now.

To give you an idea of how quiet it was, with the tv off, my wife didn’t know I installed the fans until I told her.
Note: I initially tried to buy AC powered fans which supposedly were only 32db. When I got them, they were loud. When I installed them, they were LOUD LOUD, way too loud to keep installed. I think part of the problem was not only that they’re louder than 32db (manufacturer exaggeration?) but also if you’re putting too much air into a small area, the cardboard back on most modern diy furniture will act like a speaker diagphram. And these were 70cfm fans! I’d suggest skipping the AC

Sep 19 2006

Day -14

notarus | General | 0 Comments

Ok, i’ve been bad, and haven’t updated.

Short version is: Cast is off. Kara is ultra happy, crawling and sitting and playing. Parents are still playing catchup on sleep and work.

Everyone, though, is much happier. Thanks to everyone who supported us last for the last month!

Found in a comment on version tracker that will (finally) let you set your delete key on your mac to send backspace (important to me because routers don’t do terminal types as well as they should) and reposting it here to share:


End your delete-should-backspace woes when using Vim remotely with iTerm by adding one simple keyboard mapping. Go to iTerm preferences, Profiles, Keyboard, choose Profile=Global, add this mapping…

Key: delete
Action: send hex code
Hex code: 0×08

Tell your bookmarks to use the Global keyboard setting.

Aug 10 2006

Day 27

notarus | Kids | 0 Comments

In addition to the whole cast thing, kara has a cold. I’m sure she got it either at her naming party or at my cousin’s daughter’s birthday party, but in any case, sniffles and caughing up phlegm.

On the good side, today was the first day of full time help. Shanyee is the sister of a friend of Leah’s, and a friend in her own right. Between Shanyee’s help, and her daughter’s (kara LOVES kids, and was just enthralled) today wasn’t so bad.

Until bedtime. We started the bedtime ritual a little early, because she was much more tired than usual, with the short naps due to the cold. This went well until she suddenly started inconsolably. And I mean inconsolably. For almost 40 minutes, she was screaming and screaming and crying, and we’d try something, and she’d suck her fingers for a moment and then return to crying.

We even called the peds right before they called and all they could suggest is sending us an ambulance to ride to the hospital. We decided to wait a half hour and if she hadn’t settled down by the time the tylenol had kicked in, we’d call back and do it.
Fortunately, we had left the bedroom by this time, and leah was outside bouncing kara arround and singing, and she finally after 15 minutes let out a string of burps. Gas. We were afraid we’d have go to the hospital to crack the cast off because we thought she was in pain from pinching or something and it was “just” gas.

As always, Leah’s the hero.

No matter how hard we try, we can’t seem to remember that because she can’t MOVE none of her body processes are working again. It’s like having a newborn again except you can’t put her on her back.

sigh.

Aug 10 2006

Day 30

notarus | Kids | 0 Comments

Saturday morning, my wife fell down on the stairs while carrying Kara down after a nap. Leah is fine, but while she was able to mostly cushion Kara, the wierd angle everyone toppled at caused kara to bang her knee on the stairs.

After some initial crying, we thought everything was ok, and peds visits both sat and sunday gave us doctors opinions of “probably everything is ok, but let’s be careful and take an xray”. Kara was a little sensitive if we bent the leg, and she was definitely not taking weight on it, and she was kinda crawling without using that leg, but the toes and feet were moving and stuff and so everyone involved including doctors said it was probably just a painful bruise of some kind.,

Unfortunately, the xray monday showed that her femur is broken. It’s a very “small” break, close to hairline, but femur breaks are bad.

Kara is now in a half body cast, starting at above her waist and covering both her legs, the ok one halfway and the not ok one down and covering everything but her toes. We haven’t even figured out how to prop her upright, and that’ll be fun.

The “good” news is that at Kara’s age, it usually only takes about 30 days for this type of fracture to heal. The bad news is that, really, this is going to be an unpleasant month for Kara and thus for us. She’s effectively as helpless as a newborn, except she’s as advanced as a 8mo old, just started crawling last weekend (!) and needs to be kept involved, active, and happy.
So 30 days started monday, aug 7. If we’re lucky, our anniversary present this year will be a daughter who can sit in a chair again.

Apr 30 2006

Making the Tea

notarus | General | 0 Comments

I enjoy a national brand of tea, but it costs about $1/bottle. Very very yummy, but that gets expensive. And since one of my techniques for managing hyperactivity is a non stop stream of flavor (pop right now) I’d like to stop buying and drinking so much soda, it’s not great for you, and I don’t relish explaining to my daughter some day why mom and dad drink a lot of pop but she can’t have any.
So, here, below, I present the following recipie (cribbed and modified from various sources online, and tested for my tastes) for a nice strong diet lemon tea.

Ahead of time: buy one bag of granular splenda (the big bag cost me $8.99 at jewel), and one large container of Lemon juice from concentrate (the generic 1 qt at Jewel cost $2.99). Also buy a box of Lipton tea bags (the yellow box black tea, the one that’s “orange pekoe and pekoe cut black tea”).
Bring 3 quarts of water to a high boil in a covered pan then take it off the fire and move to another burner. Put 5 Lipton tea bags (use 7 if decaf) in the water, and re cover. Let sit for an hour.

After 1 hour, pour into a large pitcher. Add 3/4 cup of splenda, and 1/2 cup lemon juice. Mix well and chill.

After it’s chilled, taste.

By my count (I forgot to note the cost of the tea), this works out to about $1.15 per 3 quarts of tea, or roughly .14 c per 12 oz container. Given that I drink about 6-8 12 oz cans of soda a work day, that’s a savings of almost $9/day for me over switching to pre packaged tea.

Arstechnica.com has a great write up of a panel debate held at the University of Chicago, called “Defending Democracy: Balancing the Fight for Civil Liberties with the Fight Against Terrorism” . It’s interesting, because this is a very serious problem. (Incidentally, you should read the late Rhenquist’s All the Laws but One . Same topic, extremely well written.)

I thought there were a few points worth highlighting. First, Geoffery Stone made what is probably the most important point to keep in mind during any of these discussions (and particularly relevent since this week, most of the provisions of the Patriot Act are now permanent) — the “Global War On Terror” isn’t a war in the traditional sense, with a specific enemy and once we defeat him, the war is over. It’s a war on anyone who wants to hurt us, and taken that way, it’s never going to end. This doesn’t mean we shouldn’t fight them, but it does mean that when we talk about what to do to make it easier to fight them we need to keep asking ourselves first “is this a characteristic of America we want to give up forever?”

Second, I thought this passage was particularly troubling:

“At some point in his talk, Posner confided in the audience that he believes that Osama Bin Laden is “actually winning.” In support of this proposition, he cited the election of a religious fanatic as the head of Iran, the Hamas electoral victory, the cartoon controversy, the Paris riots, and other recent examples of the rise of Islamic anti-Western sentiment. I don’t quite recall where he went after making this point, because I sort of tuned out, lost as I was in the seeming contradiction of declaring OBL the “winner” during the course of a sustained defense of the Bush administration’s post-9/11 antiterror policies.”

Weither one likes it or not, religious fundamentalists are there the world round. In America, religious fundamentalists carry out election (and other) crusades against abortion, gay “rights”, the death penalty, you name it. We’re not immune to the result.

But to define as winning (even merely as a straw man so that you can grab even more power)

  • the fact that in five years, everything “bad” about the world hasn’t simply gone away
  • the fact that when you present an TRUE opportunity for the palestinians to vote they unsuprisingly vote for the party who is most vocal about stamping out the boogieman they blame everything from poverty to hangnails on (Isreal)
  • the fact that muslims are a growing percentage of European nations and frequently on the receiving end of racism
  • some extremist Islamic leaders actually encourage rioting of the sort that happened after the danish cartoons

to define all that as “winning” at the same time as you support the Saudis, with their state run islamic schools that literally preech hatred of the west and American ideals, that’s just too much to absorb.

What I want to know is when will the doublethink end? When will the american people stop believing anything they hear because the believe the talking head they’re listening to is always right and actually THINK about what they’re hearing?

Sadly, I expect that’s about the same time the GWOT has no more enemies.

Maybe

Mar 03 2006

zsh title changing

notarus | Open Source | 0 Comments

Changing the title of your (xterm compatable) terminal window is old news .

Still, here’s a handy set of .zshrc stuff that lets you change it on the fly. For example, I have a dozen windows open, and size of them go to different routers. Each window (tab, really, iterm is excellent ) has the name of the router.

This code will make your default title user@host. Change your title with “title new-window-title”. Enter title with no options to just put it back when you’re done.

Feb 16 2006

Totally Free!

notarus | General | 0 Comments

<ring ring>
<silence>
Me: Hello?pause
Hello?pause
Last chance for the computer to connect me to the caller?

Them:
“Sir! We’d like to upgrade your Chicago Tribune delivery service TOTALLY FREE to include the saturday edition of the tribune! Free!”

Forever?
Yes
No change in my price? Ever?
Never! Same price!
May we record this call?
this isn’t right. noone’s ever needed to record that they gave away something free Uh, Sure.
We just want you to understand that in 24 weeks, you will get a renewal notice, and if you want to discontinue sat service, just note that on the renwal.
Wouldn’t that mean it’s not free forever?”
No sir! It’s totally free!
Why would it require me to change my service at renewal time?
Well, the price might have changed.
Isn’t that a change in price? Didn’t I just ask if the price would change?”
Your price won’t change. If you want to discontinue saturday service, just note it on the form.
If discontinuing service is what i need to do to keep the price the same, doesn’t that mean the price is changing?
No, sir! The price is the same as you’re paying now.
Ok, I withdraw my consent.

And all this just because we don’t want to drive out every sat to get the sunday ads.

Page 1 of 2