Apple


It’s not a new concept, but here is my take on it:

function man {
    # We can get the actual path to the man command here, so we can override
    # it with our function name.
    MAN=`which man`
    # Change these two if you are not on OS X.
    CACHE_DIR="${HOME}/Library/Caches/manpages"
    OPEN="open"

    # If we don't have any arguments, use the nice man error message
    if [ ! $1 ]; then
        $MAN
        return
    fi

    # If we have an argument that clashes with what we are wanting to be
    # able to do, pass the whole command through.
    for ARG in $*; do
        case $ARG in
            -[dfkKwtWP])
                $MAN $*
                return;;
        esac
    done

    # Make sure our cache directory exists.
    mkdir -p $CACHE_DIR
    # Get the man page(s) that match our query.
    MAN_FILES=`$MAN -w $*`
    for MAN_FILE in $MAN_FILES; do
        # Get the name of the man file, and the section.
        MAN_PAGE=`basename "$MAN_FILE" | cut -d \. -f 1-2 | sed 's/\./(/' | sed 's/$/)/'`
        # Our PDF will be in this location
        PDF_FILE="${CACHE_DIR}/${MAN_PAGE}"

        # If we actually have a man file that matches
        if [ -n "$MAN_FILE" ]; then
            # See if the man file is newer than our cached PDF, and if it is,
            # then generate a new PDF. This works even if $PDF_FILE does not
            # exist.
            if [ $MAN_FILE -nt $PDF_FILE ]; then
                $MAN -t $* | pstopdf -i -o "$PDF_FILE"
            fi
            # Then display the file.
            $OPEN "$PDF_FILE"
        fi
    done
}
View Comments (3)   RSS Feed for Comments on this Post

The active tab looks wrong.

Inactive tabs not so much.

Safari_Loading_icon.png

View Comments (0)   RSS Feed for Comments on this Post

I use the Terminal just as much as the Finder, and have tab-completion turned on in bash. To make it better, you can set it so that it will complete differently depending upon what you have already typed in.

The first one of these tips will autocomplete from the ~/.ssh/known_hosts file, so that when you type in:

$ ssh ma[tab]

complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh

it will autocomplete the servers you ssh to that start with "ma".

The next one is more complicated - it allows you to complete from all available applications when typing:

$ open -a [tab]

Code:

complete -W "$(/bin/lsregister -dump | /usr/bin/sed -E -n -e '/\/Applications/{s/^.+ ((\/Applications|\/Developer).+\.app)$/\1/p;}' | \/usr/bin/sed 's/ /\\ /g' | \/usr/bin/sed -e s/\'/\\\\\'/g | /usr/bin/xargs /usr/bin/basename -s '.app' | /usr/bin/sed 's/ /\\\\\\ /g')" open -a

These can be added to one of your bash startup files: mine live in ~/.bashrc.

View Comments (3)   RSS Feed for Comments on this Post

Dear Apple,

Please send me the battery that you said you would. I’m not really liking when I see this:

battery.png

That’s not much fun at all.

Regards,

Matt.

View Comments (0)   RSS Feed for Comments on this Post

A Note on Automounting MacFUSE File Systems

Mac OS X, like many other Unix-like operating systems, includes the “autofs” file system layer that make automatic on-demand mounting of remote resources possible. See the man page for automount(8) for more details.

[From Mac OS X Internals: The Blog » Blog Archive » A Note on Automounting MacFUSE File Systems]

Awesome. This might replace the need for ExpanDrive. And be even more automatic.

View Comments (0)   RSS Feed for Comments on this Post

I discovered, quite by accident the other day, that it is possible to use an NSSegmentedControl to control which Tab of an NSTabView is displayed. Here is how to do it.

First of all, it is much easier to change the selected tab if you leave the tabs on to begin with. So, I would suggest building all of the NSTabView’s tabs first. I’ve done five, each with a different control.

View1.png View2.png

Now, you can alter the NSTabView so it doesn’t show the Tabs:

View1Tabless.png TabViewInspector.png

You can now add the NSSegmentedControl, and style it as you wish. I really like the Small Square styling.

SmallSquareNSTabView.png

Now to hook up the connection. There is an outlet on NSTabView called takeSelectedTabViewFromSender:, which can be hooked up to an NSSegmentedControl.

Connection.png

You will need to ensure that your initially selected cell and view are the same index, which prohibits having it save the value between runs (or you might be able to, if you know more than me).

View Comment (1)   RSS Feed for Comments on this Post

I have a couple of licenses for 1Password to give away. Leave a comment with your name and email if you are interested.

Mac only!

Update: all have been given away. Got quite a few responses in Whirlpool, before my thread was shut down.

View Comments (0)   RSS Feed for Comments on this Post

iSyncMenu.png

This stupid menu keeps appearing. I’ve turned it off several times, but it reappears.

Doesn’t seem to be every time I reboot.

rdar://6384278

View Comments (0)   RSS Feed for Comments on this Post

My (replacement) battery capacity dropped today from 95% to below 75%.

I’m going to do the whole recalibration thing to see if that fixes it. I had noticed it was seeming to have a shorter battery life than before again, actually.

View Comment (1)   RSS Feed for Comments on this Post

Now that I’ve got my laptop back, and it’s all working fine, it occurred to me that for some time (maybe forever?) I had been getting a 0°C temperature reading when trying to see the temperature of the graphics related sensors.

I fired up TemperatureMonitor, and sure enough, it’s now got values in there.

I suspect this is the first sign that the graphics chip is on it’s way out.

View Comments (0)   RSS Feed for Comments on this Post

Next Page »