Computers: November 2007 Archives

Leopard, CoreFoundation, and exec()

| | Comments (0)
Under Leopard, using Mac::Carbon:

[pudge@bourque ~]$ happening
Running background process /Users/pudge/bin/happening (983)
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().

Apparently, fork-without-exec with CoreFoundation has always been bad. But it is now an exception.

So in the happening program, I had:

$pid = fork;
exit if $pid;

Now I have:

if (!$nofork) {
    $pid = fork;
    exit if $pid;
    exec($0, '-nofork');



| | Comments (0)
Many people on YouTube are commenting on my beard.

For what it's worth, I've had this beard for 16 years, and it's not coming off any time soon. (I've had *a* beard for about 18 years, but I periodically shaved it until first semester of my freshman year of college. It's existed ever since.)
It thinks I am Japanese. Tiger Front Row did not.

It does not show cover art for shared sources. Tiger Front Row did.

When I am fast-scrolling down a list of items, and I see the item I want, and so I let go of the button to stop scrolling, I go way past that item as the list slows to a stop. Tiger Front Row stopped pretty much immediately, on or near the thing I wanted.

It does not have any way to repeat. At least with Tiger Front Row, I could use my (non-Apple) remote to tell iTunes make the currently playing playlist to repeat. I'd hit play in Front Row, then hit the button to call my "Repeat" AppleScript.

I preferred the Tiger Front Row.

pudge posted a photo:

Leopard Front Row Ignores Shared Source Cover Art

pudge posted a photo:

Leopard Front Row Thinks I Am Japanese

Incidentally, the top two videos in Japan are apparently both by Avril Lavigne.

So a lot of times when using Spaces under Leopard, windows just ... disappear. They are not visible in any space. So I have to open up the System Preferences and turn Spaces off, and then back on, which fixes it.

Here's a script that I put in my Script Menu (~/Library/Scripts/Reset Spaces.scpt) so I have quick access to it.

tell application "System Events"
    set (spaces enabled of spaces preferences of expose preferences) to false
    set (spaces enabled of spaces preferences of expose preferences) to true
end tell

Oh. You want a Perl version, do you?


use warnings;
use strict;
use Mac::Glue;
my $sysevt = new Mac::Glue 'System Events';
my $enabled = $sysevt->prop('spaces enabled',
    of => 'spaces preferences',
    of => 'expose preferences'
$enabled->set(to => 0);
$enabled->set(to => 1);

I prefer AppleScript for stuff like this, since it's quicker to execute and I have to use AppleScript to figure out how to do it in Perl anyway, since AppleScript is sometimes easier to prototype with when you don't know what properties and objects you're working with. But it took only a minute to convert it to Perl, so no biggie.

System Events in Leopard has a lot of new junk in it for scripting preferences. Pretty neat, you can script many difference preferences now. Here's a list.

        A collection of appearance preferences
            appearance: the overall look of buttons, menus and windows
            double_click_minimizes: Does double clicking the title bar minimize a window?
            font_smoothing_limit: the font size at or below which font smoothing is turned off
            font_smoothing_style: the method used for smoothing fonts
            highlight_color: color used for hightlighting selected text and lists
            inheritance: All of the properties of the superclass. (read-only)
            recent_applications_limit: the number of recent applications to track
            recent_documents_limit: the number of recent documents to track
            recent_servers_limit: the number of recent servers to track
            scroll_arrow_placement: the placement of the scroll arrows
            scroll_bar_action: the action performed by clicking the scroll bar
            smooth_scrolling: Is smooth scrolling used?
        user's CD and DVD insertion preferences
            blank_cd: the blank CD insertion preference (read-only)
            blank_dvd: the blank DVD insertion preference (read-only)
            inheritance: All of the properties of the superclass. (read-only)
            music_cd: the music CD insertion preference (read-only)
            picture_cd: the picture CD insertion preference (read-only)
            video_dvd: the video DVD insertion preference (read-only)
        user's dock preferences
            animate: is the animation of opening applications on or off?
            autohide: is autohiding the dock on or off?
            dock_size: size/height of the items (between 0.0 (minimum) and 1.0 (maximum))
            inheritance: All of the properties of the superclass. (read-only)
            location: location on screen
            magnification: is magnification on or off?
            magnification_size: maximum magnification size when magnification is on (between 0.0 (minimum) and 1.0 (maximum))
            minimize_effect: minimization effect
        user's expose and dashboard mouse and key preferences
            all_windows_shortcut: the key and mouse binding shortcuts for showing the all application windows (read-only)
            application_windows_shortcut: the key and mouse binding shortcuts for showing the current application windows (read-only)
            bottom_left_screen_corner: the bottom left screen corner (read-only)
            bottom_right_screen_corner: the bottom right screen corner (read-only)
            dashboard_shortcut: the key and mouse binding shortcuts for showing the dashboard (read-only)
            inheritance: All of the properties of the superclass. (read-only)
            show_desktop_shortcut: the key and mouse binding shortcuts for showing the desktop (read-only)
            show_spaces_shortcut: the key and mouse binding shortcuts for showing spaces (read-only)
            spaces_preferences: the spaces preferences (read-only)
            top_left_screen_corner: the top left screen corner (read-only)
            top_right_screen_corner: the top right screen corner (read-only)
        the preferences for the current user's network
            current_location: the current location
            inheritance: All of the properties of the superclass. (read-only)
            interface, location, service
        a collection of security preferences
            automatic_login: Is automatic login allowed?
            inheritance: All of the properties of the superclass. (read-only)
            log_out_when_inactive: Will the computer log out when inactive?
            log_out_when_inactive_interval: The interval of inactivity after which the computer will log out
            require_password_to_unlock: Is a password required to unlock secure preferences?
            require_password_to_wake: Is a password required to wake the computer from sleep or screen saver?
            secure_virtual_memory: Is secure virtual memory being used?
        user's spaces application bindings and navigation preferences
            application_bindings: binding of applications to specific spaces
            arrow_key_modifiers: keyboard modifiers used controlling the arrow key navigation through spaces (read-only)
            inheritance: All of the properties of the superclass. (read-only)
            numbers_key_modifiers: keyboard modifiers used controlling the number key navigation through spaces (read-only)
            spaces_columns: number of columns of spaces
            spaces_enabled: is spaces enabled?
            spaces_rows: number of rows of spaces

That Is Not An Available Option

| | Comments (0)
Playing MLB 07 The Show on PS3. Doing a season. Simulating most of the games, playing a few.

On September 22, with a solid lead on the wild card, and having won 10 games in a row, including sweeping the Yankees at home, we lose a simulated to Tampa Bay, with Josh Beckett starting.

The computer tells me upon game completion, "Josh Beckett sustained an injury (shoulder separation) during today's game. It appears he will be out for about 2 to 3 months. What would you like to do?"

The options are Keep Active, 15-day DL, or 60-day DL. None of the options are "kill myself," so I'm stumped!
So my memory usage in Leopard is WAY down. I have Safari, DragThing, SSHKeychain, perl daemons, MySQL, Apache, MacCvsX, Eudora, BBEdit, iChat, Terminal ... a lot of things running. Before this would put me into swap. Now, it does not. Not even close: with 2GB total, I have about 700MB unused.

It's ... just wow. HUGE performance increases in Leopard for me, just by not going into swap. I think some memory leak was fixed, or something. I dunno. But I like.

The biggest new memory pig is "helpdatad." Open Activity Monitor, sort by RSIZE, go into the Help menu of Activity Monitor, type into the new "Search" field, hit return, and watch helpdatad climb to the top. 180MB without breaking a sweat.

I killed the process and vowed to never type into that field again.
<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Archive

This page is a archive of entries in the Computers category from November 2007.

Computers: October 2007 is the previous archive.

Computers: December 2007 is the next archive.

Find recent content on the main index or look in the archives to find all content.