Archive for the ‘Mac’ Category

And the “Best Tool For del.icio.us Award” goes to… Spotlight!

Thursday, March 13th, 2008

Well, not quite. It really goes to Ian Henderson's delimport. Simply put, it imports all your del.icio.us bookmarks to (Mac OS X) Spotlight.

I already tried that before with Quicksilver, but it ended up getting in my way by polluting my search results: even if I wanted to just quickly launch some application (Firefox, for example), it would search through all my 2000+ bookmarks and show me all the Firefox-related ones.

delimport has some advantages:

  1. It tries not to pollute your results by updating the dates only when your reopen some URL; i.e.: as it doesn't re-import everything every time it runs, old items are really seen as old items and are not shown in the results (they can be shown, but only if there's nothing new).
  2. It sits in the background and imports only your new bookmarks every 30 minutes, consuming almost no CPU (you can confirm this by watching the logs in Console).
  3. It lets you search only in your del.icio.us bookmarks, through Leopard's advanced search: if you type in Spotlight "ldap kind:del." (without quotes), it will show you any saved bookmarks that have LDAP in their names or in their tags. You can use "kind:book" to include all your del.icio.us and Safari's bookmarks.

You can even create Saved Searches like this:
delimport - small
And if you got interested in any of the themes in the above screenshot, you can find them and much more here. :)

strace on Mac OS X Leopard

Monday, February 25th, 2008

One of the most important tools for sysadmins and programmers working in the Linux/BSD environment is called strace. As it took me some time to find out where is "strace for Mac", I thought it would be worth documenting here...

Making a long story short: in Tiger it was called ktrace, in Leopard it's called dtrace, but it's simpler if you just call dtruss.

Here are some examples directly from the dtruss man page:

dtruss df -h     # run and examine the "df -h" command

dtruss -p 1871   # examine PID 1871

dtruss -n tar    # examine all processes called "tar"

For a more "real-life" example, please see this article: Why DTrace Makes Leopard a Must-Have Upgrade -- you'll even learn how to prevent Time Machine from consuming all your CPU.

UPDATE: Just after posting this I discovered that:

1. There's a really cool GUI for DTrace called Instruments. After playing with it for just a few minutes I was able to detect that it was psyco that was causing Python 2.4 to segfault when running web2ldap. Now back to a little more tinkering to discover why...

2. Leopard/DTrace provides one command that I always wanted: iotop, to show which processes are responsible for the disk I/O (more dtrace commands here). Now to the question: is there a Linux version? The answer is: yes, and it's written in Python (and requires a kernel >= 2.6.20).

OmniOutliner Styles

Wednesday, August 15th, 2007

I'm sure I'm not the only person to get confused with OmniOutliner auto-styles - like when it decides that all fonts for some level are now going to be red, just because you said that once.

You may have noticed that choosing "Clear Styles" or disabling "Automatic Styles" just don't work as expected, neither choosing a different color in the font menu (⌘T).

So, here's the tip: open "Utilities" (⌃⌘T), choose a level (eg.: "All level 1 rows"), then open "Styles Inspector" (⌘5). There you can remove that red color you couldn't get rid of...

One of the advantages of OmniOutliner Pro is exactly more control over styles (ie: creating your own styles), but I think I don't really need that.

P.S.: Yes, I'm really going to post entries in random languages. :) If you prefer to see posts in only one language, just select it in the "Categories" menu.

iMac novo

Wednesday, August 8th, 2007

(Ou: pra não ter que fazer a festinha de aniversário do último post publicado aqui... :D)

Eu poderia falar várias coisas sobre os lançamentos de hoje da Apple mas, como dizem por aí, uma imagem vale mais que mil palavras.

P.S.: Eu até queria copiar a imagem aqui, mas pelo que eu vi rapidamente na seção de copyright da Apple eles não permitem (e eu também não vou fazer hotlink). Ah, e a lista é: iMac, iLife '08 e iWork '08 (com planilha!).

Wake on Lan

Tuesday, October 31st, 2006

I knew from a long time that there existed something called "Wake on Lan", and was always a little curious for how it would work. "In which situations would the machine decide to wake up? Obviously not on broadcasts, but would it wake up on any traffic directed to it?" As I've never had a network card which supported it, I never went beyond mere curiosity...

Well, it just happened that Gustavo bought a Mac and it supports Wake on Lan. As we noticed this, we tried it just like everyone else sure does: we put the computer to sleep, then tried to ssh to it.

"Did it work?" No. At least, it's one less doubt: it won't wake up on any traffic...

After a couple days and a visit to Wikipedia, I discovered that a WoL-enabled machine will only wake up if it receives a Magic Packet, which must contain its own MAC address ("Aha! Here's the 'authentication'!" :D)

So, all you need to remotely bring to life a machine that's "sleeping" is its IP and MAC addresses and some program capable of sending magic packets, like WakeUp for Macs (the wikipedia article has links to clients for other platforms, even cell phones!).

And what's all this Wake on Lan stuff useful for? Well, let's say you have a Mac Mini plugged to your big flat screen TV at home and - what? You don't have a Mac Mini? Nor a big flat screen TV? Me neither. Let me try again: let's say you have a machine at work with some files that you may want to access from home (easier, ahn?). Well, you got the picture...

As every other Mac article here, this one wouldn't be complete without a keyboard shortcut: hold ⌘−⌥−Eject for two seconds to put your Mac to sleep.

Note: if have a laptop with Mac OS X it has a great chance of supporting Wake on Lan, even if it was not made by Apple... ;)

Lock your Mac screen without clicking

Tuesday, October 31st, 2006

UPDATE: SizzlingKeys is really a better alternative.
... 

(more...)

Mac OS X Keyboard Shortcuts

Monday, September 25th, 2006

Here are some not so obvious Mac OS X shortcuts that I think are useful:

⌘−H to hide an application
⌘−⌥-H to hide all applications except the current one
⌘−Tab−Q to close applications
Shift-Volume keys: silently change volume
Spacebar on dialogs to select highlighted/secondary option. Eg.: power key then enter corresponds to shutdown, power key then spacebar is restart. Only works if you have “All Controls” set in the “Keyboard shortcuts” preferences (you can enable it by pressing Ctrl-F7)
⌘−⌥−Esc to Force Quit any application
Force the computer to restart (when locked): ⌘-Control-Power key
⌘-Drag’nDrop file forces an application to open it. Also useful to move toolbar buttons and menu bar icons.
⌥-Arrow keys Jump words (same as Ctrl in Windows)
Ctrl-Spacebar: only works if you install Quicksilver, but you will do that, won’t you? ;)
Shift-F9 Just try it :) (Shift-Minimize works too)

If you’re feeling brave, I recommend swapping your Caps Lock with your Command key. It may take one day or two to get used to it, but I think it’s worth the effort. Go to “System Preferences - Keyboard & Mouse - Modifier Keys” to do that.

Finder

⌘-O Open files
⌘-Backspace Delete file
⌘−Click on title bar: show/open parent folders
⌘-Shift-G Go To Folder (tab to autocomplete)

You may want to install DoubleCommand too, as it enables you to use PC-style home / end keys.

Be sure to read this howto for some great tips.

Blogged with TextMate in MarkDown mode