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.

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
 }

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.



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/

I mentioned this in passing some time ago, but I joined the Cult and now have a nice 15″ Powerbook.

It’s been about three months, and I have to say: I don’t really miss windows much (see below though).

The screen is bright and clean, and I really like the “pretty” factor– didn’t think I would, but it really does cheer things up. The widescreen display also means that there’s a completely full size keyboard with room to rest your hands, so typing while mobile is excellent.

The applications are in general at least as good; word and excel are there for the mac, I use Thunderbird for email and Firefox for web stuff. For instant messaging, iChat isn’t horrible, but I use Adium, which is nice and cross-server capable. And configurable.

Which leads me to probably my biggest beef with the Mac experience: configuration. If Apple thought it was a good idea to be flexible, it’s super configurable, and awesome. If not… “These are our defaults. We put a lot of thought into them, and we like them. Think of them as mandatory”.

Which includes the freaking mouse button. Sure, I can (and usually do) have an external logitech 5 button mouse connected. Forward and Back buttons make the web browsing much better, and there’s support for those buttons in a lot of places (for example, in quicktime, the back button plays your movie clip sdrawkcab). But if you’re mobile with no mouse, you have only the one default mouse button (”We like one mouse button”). Very frustrating.

Still, as a serious platform for working, all the stuff I need for work is here. It also runs unix underneath, which means I can actually program while roving, which is a huge advantage for me (cvs support, perl w/o having to recode to support both unix AND windows, native emacs, etc).

But I do have virtual PC on here. I only use it for two things:

  1. visio (OmniGraffle is excellent, and can read Visio XML documents, but most of our existing docs are not xml, so I have to open and convert. And HOLY COW does visio run slow on in an emulated computer on a relatively slow cpu…
  2. Games. Hey, I like games. My poker client (pokerstars) runs nicely in Virtual PC, and it’s practically seemless. I play Civ 3 Conquests in that window, and Galactic Civilizations.

But I really have to say: As much as I like OS/x, and the mac, I am REALLY looking forward to the intel platforms. Partly for speed, and partly because I’m looking forward to projects like DarWINE, native windows emulation for the mac. It’s not really that I want to replace Virtual PC, or run every app, but I miss my games.

Some other things I like:

  • MaxMenus Put small menus right at the very corner of your screen. one has an application menu, another is all my control panels, a third is my filesystem. Quick and easy to get to no matter what you’re doing.
  • Usb Overdrive Highly recommended if you’re using a mouse with more than one button. Not everything supports 3, let alone 5 (forward and back, anyone?) If your applications don’t suppor the mouse wheel, create a per-application profile that sends some special code for mousewheel-up and mousewheel down. Or whatever. Awesome.
  • The Mega Man Effect. Completely useless, totally hilarious. If you have a mac, download it, run it, then run some other application. And laugh.
  • OhPhoneX and the rest of XMeeting. If you did any video conferencing under windows, this will likely fit the bill for you on your Mac. I use it regularly to Video into a meeting.

All in all, I find the experience very satisfying. Unix on my desktop with a smart, capable interface on top. I’ve got some annoyances, but fewer than with Windows, I think. And while I will never give up my Windows Game Machine, the powerbook does everything I need for work.

May 30 2005

Firefox Redux

notarus | Open Source, Software | 0 Comments

An update to extensions:

  • Tab browsing: I’m now using Tab Mix to handle my tab settings, replacing all the other tab extensions. The author has been cherry picking good features and putting them in a nice extension that doesn’t crash firefox.
  • Sort Extensions Just adds a sort button to the extensions list.
  • Show Failed URL. In combination with about:config and turning on browser.xul.error_pages.enabled, this leaves the actual url in your location bar, rather than a gooey XUL error path.

Why do I keep blogging about extensions? Two reasons. First, I can refer someone to the “make firefox great(er) imo” list of extensions . Second, I seem to have to celebrate Windows Reinstall Day fairly often, and this simplifies the process.

This week, I lost a hard drive. It was as annoying as ever, because even though my data’s backed up, configuration info isn’t, and it takes forever to tweak everything back into a semblence of where you were before the crash.

But since this was a complete “RMA the hard drive” crash, I pulled out my spare laptop hard drive, popped it in, and installed Fedora Core 3. I’ve been on and off flirting with Linux on the laptop for some time– running a unix on my laptop would be excellent, because more and more my job involves writing code that runs under unixes. And being able to do that locally (which means i don’t need to block for a day+ on the system admin every time I need a new perl module installed) is not only a plus, but it makes things like Eclipse work nicer– you should see the amount of hackery required to get Eclipse to even RUN a perl CGI script under windows.

The good news: Linux is getting sweeter and sweeter all the time. As a desktop install, i think it’s entirely there. It installs cleanly, and while you need to tweak some things you wouldn’t under windows (a little extra configuring to get the fwd and back buttons to work) but it’s nothing bad.

It’s the laptop support that isn’t quite right in my opinion. Now, I say this as someone who’s done the “tweak the system to death” thing already, and I’m getting too old for that– I want to be able to fully use my computer, not beat it arround. And please, mind you, I’m a very happy linux-as-server user. I just want “everything” to work on my laptop with no fuss.

But here’s a short list of things I would like for someone’s distribution to fix nicely so that I don’t need to muck with it:

1. There are nice control panels for ethernet devices. Make a really nice control panel for wireless, and integrate it with the network settings. I don’t want to run iwconfig myself. I want a simple panel, with easy to find boxes to fill in. And please, someone fix kwifinetwork so it’s not limited to 4 configs.

2. I know x.org has a lot of work in front of it. I’m already very impressed with their progress. But here’s something that I think is critical to continued expansion of Linux: Make the screen & device input stuff smoother, easier. Call me old fashioned or call me a lazy ass, i don’t care. But when I hook up an 8 button Logitech mx500 mouse, i want it to have something like 8 buttons. I don’t want the thumb buttons to repeat buttons 1 and 2.

And if my computer comes with a built in pointing device, like all laptops do, don’t limit the external mouse to the capabilities of the least capable configured mouse.

Similarly, and I know this is hard given the architecture, but guys: If I open up my laptop, i want the screen to change to my laptop screen.

3. There is no third thing.

Oh, sure, there are other things out there. But fix those two and I can be uber portable and uber linuxed up. That’s how close you are.

So, I’m back under windows. And I’m asking for a powerbook. I hate the freaking one button thing but I think I’ll win that back in spades by being able to program locally and just push to the server.

But Microsoft take note: 99% of desktops can have a default Fedora Core 3 install with KDE, and the non technical users will be almost as productive as they are under windows. And if you were to violate all sorts of copyrights and trademarks and replace the icons for OpenOffice with icons from Excel and Word…. I don’t think they’d even know they weren’t running Windows.

And, I have to echo darn near everything stated here

Dec 01 2004

Firefox

notarus | Software | 0 Comments

I’m a huge Firefox fan. As shipped, it’s an excellent browser. Add extensions, and it’s, imo, the perfect Open Source product– useful, extendable, well documented, easy to use, and still flexible and easily updated.

If you’re looking for more extensions than are on the built in link to extensions, check out www.extensionsmirror.nl– not only do they have a well updated list, but members of that community repackage some older ones to work with newer releases. There’s a few old friends I miss when I upgrade, and that’s super useful.

Here’s what I’m using for an extension list

  • Show Old Extensions — enables display of some of your older favorites useful so you can get
    • Next Image adds a context “next image” and “previous image” item, super useful when browsing image gallerys.
  • Bookmarks Synchronizer — super handy to keep your bookmarks right between the desktop and the laptop
  • I love Tabbrowser Extensions, but unfortunately, there’s so much good stuff in there that your browser crashes. Instead, I use the following replacements which give me what I need to make tabbed browsing super again:
    • Tabbrowser Preferences lighter weight control of what tabs (bookmarks, searches, etc) open where
    • FLST Focus Last Selected Tab– when you close a tab, return to the last one you saw.
    • MiniT– lets you open tabs with middle mouse, close with middle mouse,, plus other small but useful stuff
    • UndoCloseTab allows you to undo a closed tab. Keeps that tab’s history, too!
    • One of those, I’m not sure which, also enables mouse-wheel scrolling through your tabs, which I also use constantly.
  • Image zoom
  • AdBlock HIGHLY recommended. Strip out anything annoying, including flash.
  • HTML Validator Based on the tidy program, this is great if you do web devel stuff. Shows you errors, suggests fixes even. Super useful if you have OS/X users, because safari is much pickier than Mozilla/Firefox/IE about HTML
  • DownloadThemAll! An _swesome_ tool– fetches all links you care about from a page quickly and easily. Select by pattern match and more
  • TextZoom — for those of you with small fonts or bad eyes, lets you override the default font zoom.
  • Allow Right Click — re-enables the right mouse context menu when a web site tries to disable it.
  • Disable Targets for Download This one is also nice. You know those web pages that pop up a blank window and then start downloading a file? This prevents the blank window and just lets you grab the file.