Ubuntu Housekeeping

I’m a Linux nerd that spends some time in Vista. I tend to be a bit obsessive-compulsive, so I’ve found that I enjoy running CCleaner, defragging, and so forth.

The problem is that Linux isn’t as crazy about accumulating cruft (at least, most things aren’t; if you set up custom log files and don’t set up logrotate to match, then you might… But that’s a problem of your making.) And ext3 doesn’t get fragmented*. (* That’s not entirely true, it’s just that fragmentation isn’t a big issue.)

So if you’re like me and have come to miss the housekeeping, here are some things you might want to do:

  • Empty the trash. It used to be ~/.Trash, but newer versions (Hardy and on, apparently) keep it in ~/.local/share/Trash, with a “files” and “info” subdirectory. Always be careful with rm -rf, but rm -rf ~/.Trash/* or rm -rf ~/.local/share/Trash/info/* && rm -rf ~/.local/share/Trash/files/* ought to do the trick.
  • Some apt-get housekeeping:
    • Check everything over (e.g., for errors): sudo apt-get check
    • Remove old packages not used by anything: sudo apt-get autoremove
    • Clean out your local repository of package files:
      • The soft way, just removing “package files that can no longer be downloaded, and are largely useless.”: sudo apt-get autoclean
      • The hard way, removing most everything from /var/cache/apt/archives: sudo apt-get clean
  • Figure out where your disk space is going: du -sh ~/*. This isn’t super-easy to interpret, though. (And it can take a while, since it looks at all of your home directory.) Applications / Accessories / Disk Usage Analyzer is way cooler.) It makes it easier for me to realize that, for example, the reason I have very little disk space is that I have my old 55GB Windows partition backed up. Since that’s copied to another disk, I can pretty safely blow that away, and have 50GB of disk to spare. It also turns up a few DVD ISOs (CentOS 5.1?!) that I definitely don’t need.

The good news is that this did clean up some junk. It saved about 200MB of disk. (Not counting the ~50GB of backups I had created that I don’t need.) The bad news is that this really doesn’t do much that doesn’t get run when dealing with packages anyway. But it makes me feel good.

Neat Compiz Effects

Compiz is a fairly generic ‘desktop effects’ package for Linux. Ubuntu (and maybe others?) users can enable with System / Preferences / Appearance / Visual Effects, or you can be hardcore and type compiz --replace in a command prompt. (Be warned that it’ll kill your window manager and replace it with Compiz, so don’t do this if you have a lot of stuff open, in case anything goes wrong. Be further warned that if you do this and foolishly Ctrl+Z it hoping to then bg it, you’re going to lock up your desktop, since you just suspended your window manager.)

About all that you’ll notice with Compiz at first is drop shadows. It’s nice, but it’s kind of like buying a Ferrari and savoring the fact that it’s a stick-shift. What you really want is to customize it. System / Preferences / Advanced Desktop Effects Settings is how you do this. If you’re like me and this wasn’t installed with Compiz for some strange reason, you can use Synaptics (or apt-get) to install compizconfig-settings-manager.

Here are some things I do and don’t like:

  • Cube, and Rotate Cube. (See my previous post on how to make it work if it does nothing for you.) This lets you juggle four virtual desktops by free-spinning a 3D cube. Once you do it, you realize it’s really intuitive. And insanely awesome. Ctrl + Alt + left-click enables this. (Ctrl+Alt+Right flips it.)
  • Expo will “zoom out,” showing all your virtual desktops at once. Handy for an overview, or if you have your mail client full-screen and forget what desktop it’s on, I suppose. Not something I’d use a lot, though. Super-E does this. If you’re thinking that the Super key is perhaps next to the Any key… It’s actually the Windows key.
  • Scale does what Mac users probably thought Expo does: shrinks down all your open windows to be simultaneously visible on one screen. You can map this to a corner of the screen, but Shift+Alt+Up is the official key combination. (Let up on the “Up” key and you can use the arrow keys to pan around, or you can just click on what you want.) I find this key combination really awkward, so this is a good place to mention that you can remap any of the key combinations it replaces.
  • Shift Switch is a Cover Flow-inspired Alt-Tab window switcher. Shift+Super+S pulls it up, and then you can use right and left arrows to navigate. (Note that the windows loop.)
  • Ring Switch lets you “go in a circle” around the open windows, and is Super-Tab, a slightly less-awkward key combination.
  • Shelf is bizarre but cool. It shrinks a window down. There are three sizes. Press Super-L once to make it maybe half-size, and press it again to make it about a tiny little window. Press it a third time to restore it. You cannot interact with a “shelved” window, other than moving it around. The window will update, though, so if you have something running and are waiting for it to finish, you can shrink it down.

I doubt I’m going to use all of these, but I’ve enabled all of them right now, and I wrote myself a cheat-sheet. I think after a few days I’ll have a good idea of what’s eye candy and what actually makes my life easier. I think they all have the potential to do so, though.

Oh, a bonus tip? Gnome users, check out System / Preferences / Keyboard Shortcuts. It’s nothing revolutionary, but it’s something any power user ought to tweak to their liking.  (I set F1 up to launch a terminal, a task I must do 50 times a day. It masks the “Help” feature programs love to pop up when I overshoot the ~ key, too.)

Compiz Cube Not Working?

I just set up Compiz on my machine at work, hoping to be able to take better advantage of virtual desktops given my limited screen real estate. (“Limited” meaning “only two monitors.”)

One of the most oft-discussed effects is the “Cube,” in which you have four desktops and can spin around them like a cube. It was enabled, but didn’t work. I vaguely recalled having this problem when I set it up at least a year ago here at home, but couldn’t remember what it was.

I’ll need to wait until Monday morning to confirm, but I think it’s something silly: enabling the Compiz Cube effect doesn’t give you 4 virtual desktops, or even check if they exist.

gconftool-2 --type int --set /apps/compiz/general/screen0/options/hsize 4
gconftool-2 --type int --set /apps/compiz/general/screen0/options/number_of_desktops 1

That’s being recommend, and seems to work. Both of mine are currently set at 1, so there’s nothing to spin. (BTW: if you set it two, it’s a flat 2D object that spins instead of a cube.)

Yet to be tested is what happens when you do this with dual monitors. Do you get an awesomely-huge cube?

Also: if you’re looking for the Mac Expose equivalent, and are confused when the “Expose” plug-in for Compiz just shows you a zoomed-out view of all your desktops… You really want the Scale plugin, it seems. Shift Switcher gives something somewhere in between Cover Flow what Vista can do; something else to check out.

Really, though, I “lose” windows a lot, when they become buried under others, so I think this is going to be a boost to my productivity.

“Accidents”

It seems that in Ohio, water supply officials accidentally dumped 40 pounds of hydrochloric acid into the city’s water supply. How do you do that accidentally, you might ask?

Apparently, you buy 40 pounds of fluoride, but the vendor instead gives you 40 pounds of hydrochloric acid. This raises a few questions, though:

  • Is the supplier actually so careless in handling 40 pounds of hydrochloric acid that they were able to confuse it with fluoride?
  • As the worker dumped what he thought was fluoride into the water system, he didn’t think, “Man, this really burns my hands?” Or did he just get dissolved by the acid and slowly dissolve into the water supply?
  • We didn’t really get to play with hydrochloric acid in science class, but don’t you get some fairly nasty reactions if you just dump acid into water? Again, no one thought it was strange that the fluoride began hissing furiously?
  • Does this vendor also supply “fluoride” to my dentist?”

25 Things About Other People

I never got into the “25 Things About Me” Facebook meme. I brainstormed maybe half a dozen things, but really didn’t feel like doing it anyway. But instead, I got a great idea: pull in a bunch of other people’s “25 Things About Me” lists and let a Markov chain script munge them a bit. Without further ado, 25 probably-not-true things about other people:

  1. I grew up in a weird mood.
  2. I have a strong knowledge of French and I have chips from about 20 places in 9 different states.
  3. I’m obsessed with managing money and credit… along with all my favorite alcoholic beverages.
  4. I don’t have many regrets, but I love Paula Abdul.
  5. I’m on the floor or in bags. My dresser is empty.
  6. I feel so tingly thinking about Harry. Harry’s my bff.
  7. My Blackberry is my Nana Barbara. She’s like a best friend almost.
  8. I like to throw up all over myself and then get laughed at when I could live without my sister.
  9. I’m so glad I gave up crack.
  10. I have not lived in East Hampton, NY since I was 5 but I get the extended warranty with it.
  11. When I sing, generally I am a raging liberal and believe pot should be legalized.
  12. I miss the BG drama club and all the sushi ladies. Not seeing them frequently makes me want to own 3 dogs, 2 cats, 2 mice, 1 parrot, and 4 parakeets when I buy electronics.
  13. I’m a fat kid, and I’m going to the seminary.
  14. I’ve only dated one person more than a few seconds.
  15. My motivation for doing homework is starving myself.
  16. Whenever I eat cinnamon sticks raw. They are delicious and flavorful.
  17. I cry at the 5th largest public accounting firm.
  18. I have a 5’x3.5′ bookcase in my music folder with the simple fact that there are an awful lot of big city fires.
  19. Three summers ago I sold off my entire life.
  20. I don’t really want kids I could be potentially dying. Its so fun!!!
  21. My parents are terrified that someday I’m going to the beach. The ocean reeks of death…
  22. I have a breakdown. I pretend to be an actuary.
  23. Myspace is wicked creepy but I still choose a version of BASIC as my programming language.
  24. Until I realized that Barack was who I wanted to be deathly afraid of bees and most other bugs.
  25. I make sure people eat their veggies, wear a coat, and watch TLC 24/7.

WPMU and APC Error

One of the worst types of errors to track down, I think, is one that happens in a blue moon and doesn’t seem to happen in response to anything particular. Here, I’ve been trying to hunt down why, every month or two, WordPress starts serving nothing but blank pages, yet not logging any errors, and why restarting Apache fixes the problem.

The main page isn’t affected, since it doesn’t use WordPress or APC (it’s some custom code I wrote that goes right to the database), but every other page on the site comes up blank. Server-wise, everything is fine: no parameters at all are different. The load’s low, nothing’s been changed, memory usage is fine, and so on. The logs seem to suggest that pages are being served just fine.

I just made a small bit of progress: logging into the APC (Alternative PHP Cache, not the UPS company) console and flushing the opcode cache fixes the problem. I always had a hunch it involved a cache somewhere, but I looked more at WP Super Cache than at APC. I still haven’t solved the problem, but now I know where to look.

Checklists

I came across this article in the New Yorker’s Annals of Medicine column, and found the conclusion to be pretty amazing. The article reminds me a lot of a Malcolm Gladwell piece, in that it’s a bunch of fascinating statistics about a subject that most writers would struggle to make sound interesting, supported by a handful of equally-interesting stories.

It makes the case for checklists in hospitals. I initially assumed that it was like most medical terms, in that the name intuitively elicits imagery of something entirely unrelated to what the term actually describes. But that’s not the case here. It talks about having a five-item checklist for the steps to take while installing a “central line” on a patient, something that’s a cakewalk for trained surgeons. Many doctors protested, finding it demeaning. But the results?

The results were so dramatic that they weren’t sure whether to believe them: the ten-day line-infection rate went from eleven per cent to zero. So they followed patients for fifteen more months. Only two line infections occurred during the entire period. They calculated that, in this one hospital, the checklist had prevented forty-three infections and eight deaths, and saved two million dollars in costs.

I haven’t stolen the article’s thunder, either: it gets better. Maybe it’s just for people like me, who find boring things fascinating, but I can’t help but be struck by how something so ridiculously simple that doctors are offended by it can save so many lives and so many millions in costs.

By the way, this all comes from a silly Ask MetaFilter thread, What are innovative ideas for healthcare to save money, increase efficiency and improve outcomes?

Bad Blogs

When I started blogging many years ago, I started by posting mundane crap. “Today was boring and I had a quiz in Algebra.” I soon realized something, though: no one cares. Heck, even I didn’t care. Yet I still find blogs that are personal journals on the Web, making no effort to be interesting, or even explain who Sally and Freddy are when discussing the drama between them at lunch.

But what I find myself noticing increasingly often is people who share their opinions on evertyhing. I haven’t been shy about my opinion on who was more qualified to govern us, or on what websites are worth visiting. But how about the lady who just had octuplets on top of already having six kids? Yeah, she sounds crazy. But who cares about my opinion about some lady having babies? If she can raise them, great. If not, well, shame on her, but that holds true for any person having any quantity of babies, anywhere. Does anyone care about my opinion on that? For that matter, isn’t it creepy for me to have an opinion about the parenting prowess of a women I’ve never met, and whose name I don’t know, or even care to know?

STORIES BY DAVE SECRETARY

I’m really at a loss to describe the what or how, or the why they’re funny, but these stories by davesecretary are oddly hilarious. The all caps is annoying for a minute, but then you start to get used to it, and it becomes just another entertaining aspect of the stories. I happen to think the first few are so-so, but they quickly get better. I guess you have to be in the right mood to appreciate them.

Maybe not quite as innately hilarious as David Sedaris’ Six to Eight Black Men story, but still, an entertaining read if you’ve got some time to kill.