Wednesday, January 1, 2014

Sunday, December 22, 2013

Shhh... Go ahead. You throttle that CPU.

Lately I got sucked into looking at methods to throttle CPUs on PowerPC. It started out as a good idea, but my compulsion for completeness made it take on a life of its own and I probably spent way more time reading about it than necessary. But I've come out the other side, and now I'm reading a 580 page book about the Crimean War! Totally useful knowledge. I know how to pick 'em. Anyway, the point of all this is I am now here to share the fruits of my labor and tell you exactly why Orthodox religion and rampant Russophobia in Western Europe led to... I mean, tell you all the ways you can throttle your Mac's CPU.

Throttling CPUs often gets confused with the nice/renice commands, but they aren't quite the same. Nice/renice only prioritizes processes eating your CPU, but all your idle CPU will still be used. CPU throttling actually limits the amount of CPU a process can use. For example, if you throttle Handbrake to 50% CPU, Handbrake won't rise above 50% usage even if there are no other processes running. The practical use for this is mostly for laptops. Let's say you're doing some compiling or video encoding, something CPU intensive that takes a long time, but your laptop easily overheats or you just don't want to hear the fan going. You can limit the heat by throttling the CPU. Sure, it'll take longer, but your laptop won't give you Toasted Skin Syndrome.

For our PowerPC Macs I found a few ways of doing this, all from the command line. First, on Linux there's a program called cpulimit which has you enter a process name or PID number and the percentage of maximum CPU you want to set it to. A typical command would look like this:

cpulimit -e iceweasel -l 50

The "-e" is used when you enter the name of the program (iceweasel). You use "-p" when entering the PID instead, and you can also use -P to enter the absolute path (/usr/bin/iceweasel). The "-l" is for limit, and the 50 is the max percentage of CPU allowed. To exit, just use the standard ctrl-C.

For OS X, I found a couple of ways that work in Tiger. First, there's cpulimitrob. This is a script that someone left on Mac OS X Hints and does essentially what cpulimit does. It uses SIGSTOP and SIGCONT to pause and restart, thereby limiting total CPU time. After you download it and give it the customary chmod kiss (755), you change directories to its current location with the cd command and fire it up as root:

~ dan$ cd Development

~/Development dan$ sudo ./cpulimitrob.sh
Password:
Which process ID (PID)?
297
Sleep time in seconds?
.5
Run time in seconds (e.g 0.5 or 1 ?)?
.5
.................


and the dots continue on and on until you exit with ctrl-C. It mostly works well. The only hitch I found was when testing with TenFourFox, where the browser froze whenever I exited cpulimitrob in the middle of a page loading.

The other tool I found for Tiger didn't have any such problems and appears to exit more gracefully. It's called cputhrottle. However, the binary available for download isn't compiled for PowerPC, and to compile requires Boost 1.33.1. So being the completist that I am, I installed Boost with Tigerbrew (about 3-4 hours to configure and make) and then compiled cputhrottle from source. Using cputhrottle is almost the same as cpulimit, though like cpulimitrob, you need to run it with the sudo command:

~ dan$ cd Development/cputhrottle

~/Development/cputhrottle dan$ sudo ./cputhrottle 1309 50


The 1309 is the PID which you can get from top or Activity Monitor, and the 50 is the max CPU percentage. And again, killing the limit is as simple as ctrl-C.

In case you don't want to compile Boost and cputhrottle, I uploaded the binary I made to my Mediafire folder. It should work on Tiger, though I'm not enough of a compiling expert to say definitively whether it'll work on Leopard. You may also need to run "chmod +x cputhrottle" to make it executable.

Finally, if you just want to prioritize your processes so web browsing or somesuch isn't super slow while something else hogs the CPU, you don't have to use nice/renice from the command line. There's a very old GUI application for OS X called ProcessWizard that still works. In Linux, you can do the same with Gnome System Monitor.

Sunday, December 8, 2013

Let's Play...

...let's link to other people's PowerPC Youtube channels! These are (more or less) PowerPC centric, though I don't vouch for the quality of each and every vid.

The iBookGuy - Not just iBooks!

The PowerPC Hub - Actually a mix of MacIntel, iOS and PowerPC.

Lmull3's Geekery Emporium - Macs and Mac clones.

ItsMyNaturalColour - The dude with the white hair.

BBISHOPPCM's World - Some really old vintage stuff.

gavinstubbs09 - A few PowerPC videos here.

Tuesday, December 3, 2013

My Stupid Mac Youtube Channel

So I went and made my own Youtube channel. I intend to populate it with mostly videos of old Mac games, at least the ones I liked. I might also throw in a Linux screencast. I've been meaning to do something like that for ages, so at my current pace I'll get around to it sometime in the next calendar year (don't hold me to it). Also, it looks like Youtube implemented their new comment policy just in time, so all of you who want to call me a booger snot will have to do it from your public Google+ profile :-P

Incidentally, did you know MPEG Steamclip is still around? I needed to edit some of these videos, which were .mov files with an odd audio codec, and Avidemux wouldn't play along. So I remembered MPEG Streamclip which I used a long time ago and went over to their site and saw they had an update from last year. Still runs on Jaguar (!). It's still as easy as ever to use and did exactly what I needed.

One last tidbit, if you upload a 640x480 video to Youtube in H.264 format, it will be horribly distorted when Youtube downscales it to 360p. If you upload as MPEG-4, you won't have that problem.

Sunday, November 24, 2013

Airdrop and Launchpad Clones for your Tiger and Leopard Desktop

Over the last few itinerations of OS X, Apple has included several new features that would seem to leave PowerPC users in the dust, but if you go looking you can definitely find alternatives that can get things done in much the same way. The two features I'm focusing on today are Airdrop and Launchpad.

Airdrop is a much-ballyhooed super simple way to share files with other Macs that are also Airdrop-capable. You basically just drag and drop what you want to transfer into a special Airdrop folder inside the Finder. Launchpad is a new application launcher that displays all your app icons onscreen in a way similar to Gnome 3 and Unity, but Apple would never steal from those basket cases, right?

It turns out Airdrop isn't so new after all, at least to those who have been using DropCopy. DropCopy is very similar in that it places a small transparent circle on your desktop, and you simply drag and drop what you want to send to another Mac that's on your LAN and running DropCopy as well. The newest version supports Intel only, but an older version is available for Tiger and Leopard. A mobile app is available, too. DropCopy also lets you transfer files long distance if you know the public IP address of the Mac you're sending to.

Bevy on Tiger

Launchpad's doppelgänger is called Bevy (above), and it too throws all your application icons in front of you, only in this instance they're organized by folder (Applications, Utilities, and Developer, etc.). A lot of people seem to be annoyed with Launchapd, or at least ignore it, but having a visual representation of all your applications is sometimes useful, and Bevy offers a good alternative to do that. It's nagware, but it's only $9.95.

Now if we could only get Mavericks' dual monitor support, we could...Oh, wait. Dual monitor support was originally effed up in Lion, so we don't need that fix. Glad to see Apple's finally catching up to the Tiger era.

Monday, November 18, 2013

Putting the Christmas Spirit on your Mac Desktop

It's about that time of year again. Time to buy buy buy, and hope you better get something out of your investment at least in the form of a carton of cigarettes or something useful. Too cynical? Right. There's what we say we want for Christmas and what we really want. Anyway, in case that sounds too transactional for your delicate sensibilities, here are a few ways you can put the spirit and cheer and decoratáge of Christmas onto your OS X desktops.

Nothing says Christmas like Christmas lights, so to get those on your desktop you can get MacLampsX. It works on Tiger PowerPC on up, and you can also check their page of custom bulbs to download if you want to add to the default.

Falling animated snow is also doable, with Snö. It can use a lot of CPU, so you'll probably want to dial back from the defaults.

And to round it all off, there's a PowerPC screen saver conveniently called SnowSaver. This one doesn't use a ton of CPU, while managing a somewhat impressive 3-D look.

Here's what MacLampsX and Snö look like together on a Tiger desktop. The Badlands wallpaper probably isn't entirely appropriate, but this is America (in my part of the world).



I looked for some of this stuff on Linux, too, and there's something really cool looking called XSnow, but it's not compiled on Debian for PowerPC and I didn't know how to build it. I'll just have to imagine it, like Santa Claus and his lair, or whatever all that business is.

UPDATE: Thanks to Charles in the comments for pointing out X-MasTree, a blinking light Christmas tree for you desktop (also features a days till Xmas badge). The only download left on the internet seems to be on this Tucows ftp archive. Direct download is here.

Sunday, November 10, 2013

Ladies and Gentlemen, Your iTunes Killer

As long time readers may know, I've been on a never-ending quest to find a music player that I like, or to put it another way, that I don't actively dislike. I mostly stuck it out with iTunes over the years, having found the alternatives lacking. This hasn't been a problem in Linux where there's much more choice, including the excellent Audacious, but in OS X things are a bit more constricted.

I did switch to Cog more recently, and I think I wrote about it, too. The deal breaker previously was its lack of an equalizer, but since I found how to enact a global equalizer, I switched. Still, though, Cog didn't support radio streaming and I had to rely on Mplayer from the command line or go back to iTunes for that feature.

Was this the end of the road? Was I to be forever denied local playback and internet streaming in one appealing package? Would I ever find audio nirvana?

Well, I have found my nirvana and it is called CMus.

CMus music player

That's right, CMus is a console player. No mouse, just key commands. It plays mp3, ogg vorbis, flac, aac, the works, and also streams internet radio. And for icing on the cake, it's cross platform. On both Linux and OS X, you just use your package manager to install, so if you're on OS X you'd use either Macports or Tigerbrew.

After installing, the easiest way to get started is by pressing 5 for the browser pane and navigating to your Music folder. Press "a" to add the songs to your library and then press 1 to go to your library in tree view (press 2 for your library in list view). Press return to start playing, or use the arrow keys to choose the artist, the spacebar to expand the albums tree, and then tab to switch the active cursor to the album pane.

To add a radio station to your library, type ":" without quotes to activate the command line section, then "add http://..." and press return. It should be the first item in your library, called "<Stream>". Alternately, you can use the browser pane to navigate to any .m3u files on your hard drive and add them with the aforementioned "a".

The resources CMus uses are practically nonexistent. It's also very fast to load libraries and playlists, and speed is the main advantage of console programs such as this. The downside is that they can be hard to master with many key commands to memorize, but music players aren't all that complex when you get down to it. Mostly, you play, stop, pause, skip, and shuffle, etc. After a quick read of the manual, I got the hang of it in about a minute.

I don't think I'll go full-on frugal computing and start using console apps for all my needs, but in case you're inclined to explore that option there are tons of console alternatives to your GUI apps. There's Alpine and Mutt for email, ELinks for web browsing, also Floodgap's more famous software title, TTYtter, as well as LFTP, SLRN, Pianobar, and more. If you use the functionality of any of these often, you should take a look. You might find yourself surprised.