Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

How to perform an action on change of network System
I have a PowerBook that I move between various networks. Some of these networks have different proxy settings -- see this hint for how that can be handled.

I also had the problem that I wanted NTP to be working, and some of these networks were filtering the ntp packets. It is possible to set /etc/ntp.conf, just like a standard unix ntp daemon. Unfortunately, ntpd will decide that a bunch of the time servers are unreachable, and will stop trying. When you wake your Mac on another network, ntp will lose contact with its last servers, decide it can't do anything, and shut itself down. So I wanted to kick ntpd when I connected to a new network.

The first step was to add iburst commands to the ntp setup, and to decide that SystemStarter restart "Network Time", when run as root, would restart ntpd. I then needed a way to get ntp to be kicked when my network config changed. I found the solution to that in this blog posting: Apple's System Configuration framework keeps track of network connections and when they change. This can be accessed through the scutil command.

Initially I found scutil difficult to use. The man page is horrible, but if you run scuti and then type help at its prompt, then you get a better list of commands.
read more (242 words)   Post a comment  •  Comments (7)  
  • Currently 3.25 / 5
  You rated: 4 / 5 (4 votes cast)
 
[24,830 views] Email Article To a Friend View Printable Version
Drag and drop text in background windows System
Now most of you probably know about holding down the Command (Apple) key to drag a background window without bringing that window to the foreground. But you might not know about this...

I was waiting for a copy process to run one day and had Terminal open in the background, so I started fiddling as some would. I discovered that the Command key trick extends to selecting (at least text) and drag-and-dropping as well.

[robg adds: This hint describes some of the other things you can with the Command key and objects in background windows. I tested today's tip and found that it worked as described as long as the background app (where you start dragging the text) was a Cocoa app. I could, for instance, hold Command and drag a selection in a background Terminal window, then Command-drag that text to either a Cocoa or Carbon app, and drop it. At no point would either of the background apps come to the foreground. I had no luck with a Carbon app (using BBEdit and Word) as the frontmost background app -- they both came to the foreground as soon as I Command-clicked within their windows.]
  Post a comment  •  Comments (3)  
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[6,116 views] Email Article To a Friend View Printable Version
Auto-sync Windows XP's clock more often System
Even after trying this hint, I was still unable to get Windows XP to keep the right time. I could sync it over the internet using the Internet Time sync feature, which would fix it, but after a few hours, it would mysteriously go wrong again.

Then I found this page, which has some neat tips about adding new time servers, and (more importantly) making the automatic syncing more frequent. After changing the registry value (it mentions to a smaller value like 60; make sure you aren't in base Hexadecimal), and logging out or restarting, Windows will sync the time more frequently, correcting it when it goes wrong.

It's not the best solution, and the problem still occurs, but it shouldn't be noticeable anymore.

[robg adds: No, we won't regularly run Windows hints, but as noted on the linked tip, if they seem general enough and relate to the basic system, we will -- there are a fair number of Mac users who do run Windows on their Intel Macs, and this information can be of use to them. Note that we've only run a handful of such hints since the Intel Macs shipped, so there's no fear of the site's focus changing! :) ]
  Post a comment  •  Comments (7)  
  • Currently 1.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[13,479 views] Email Article To a Friend View Printable Version
Revert to standard printing presets without printing System
Often, a user may set up a preset via the Print dialog box, for example, to use when printing a photo with high quality settings. If the user forgets to reset the preset to defaults, the OS does not do this for him. One way to reset this, of course, is to go to File » Print, select the default preset, and then print the document. This wastes ink, paper, and time. But if one selects the default and then clicks Cancel, the previously-selected preset will still be in effect.

The workaround is to go to File » Print, select the default preset, but then click Preview instead of Print. Once the Preview window is open, simply click Cancel; the default preset is now selected for subsequent print jobs.
  Post a comment  •  Comments (2)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[5,988 views] Email Article To a Friend View Printable Version
Of fuzzy monitors and the zoom feature System
I've been a Mac user since the 512, yet this took me by surprise. Suddenly the type on just about everything on my desktop seemed a bit darker and a little blurry. I was convinced that my monitor was going ... or worse, the computer was not sending it the correct voltages anymore. I was minutes from getting it ready for repair, then I decided to look around a bit.

Somehow I had hit a keystroke combination which barely engaged a zoom feature -- just about 1% or so, barely off of zero. I didn't even know I had a zoom feature! I went to the System Preferences » System » Universal Access, and turned Zoom off (how did it get turned on?). This immediately brought my monitor back to the razor-sharp images I had been looking at for years. Whew! A close call, based on a very simple thing that many of us forget is even there.

[robg adds: The keyboard combo is Command-Option-Equals, and I think Zoom is enabled by default.]
  Post a comment  •  Comments (13)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[13,094 views] Email Article To a Friend View Printable Version
Store Developer docs on a compressed disk image System
I just got done re-installing OS-X (an old Microsoft habit, I guess), and was installing XCode when I realized that almost half of the installation size of XCode is the documentation. I need that documentation, but hate to see 1.3 Gb of my hard drive gobbled up by something that is:
  1. Very compressible
  2. Not demanding on resources
  3. Only rarely used
So I hatched the hare-brained idea to compress it -- and it worked! I've cleaned up the code, so fire up Terminal and do this:
 $ cd /Developer
 $ sudo hdiutil create -srcfolder "ADC Reference Library" 
   -format UDBZ DevLibrary.dmg
That will build the compressed reference library in the Developer folder. Once you are done, delete the "old" reference folder, and make an empty placeholder for later:
 $ sudo rm -rf "ADC Reference Library"
 $ mkdir "ADC Reference Library"
Note: I didn't sudo the mkdir command on purpose, to keep the following Folder Action from prompting me for a password just to open the Developer documentation.
read more (280 words)   Post a comment  •  Comments (29)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[19,745 views] Email Article To a Friend View Printable Version
Add words to the spelling dictionary via AppleScript System
If you have a number of words to add to Apple's spelling dictionary, it can get cumbersome; you have to type the words into a document, then spell check and add them one at a time. Or, as detailed in this previous hint, you can open the "en" file (for English) and type them there, copying and pasting a non-printable character (represented by an upside-down question mark in the file). Until now, that is.

Now you can simply run this Applescript that I wrote. You type each word, press Enter after each word, and then click the Finished button after you're, well, finished. Then click on the dictionary file you wish to update (normally the "en" file for English), and it's done.

[robg adds: I couldn't get this one to work in my testing, but it's working for the author and others, so here it is -- please post your experiences, especially if it won't work for you and you can figure out why :). On my machine, the script works, and I can apparently add words, but they continue to show up as misspelled in my documents.]
  Post a comment  •  Comments (8)  
  • Currently 2.75 / 5
  You rated: 5 / 5 (4 votes cast)
 
[11,975 views] Email Article To a Friend View Printable Version
A scriptable solution to flush Access Control List entries System
If you create many access control lists (ACLs), you might want at some point to flush them all. Unfortunately, there's no single command that allows you to remove all the Access Contrll Entries (ACEs) on a file at once, you have to remove them one at a time until there's no more left. There is no elegant solution, but this one-liner will remove all ACEs for you:
until ! { /bin/chmod -a# 0 filename 2> /dev/null; } do echo -n;  done
Using the above, you could also create a small script that will recursively remove all the ACEs on a given directory:
#!/bin/bash
for file in $(find $1)
do
  until ! { /bin/chmod -a# 0 ${file} 2> /dev/null; } do echo -n;  done
done
This hint was emailed to me by Alexandre B. I haven't tested it, as I don't use ACLs. If you do test it, please leave a comment on your experiences.
  Post a comment  •  Comments (7)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[12,627 views] Email Article To a Friend View Printable Version
Show which processes are listening to which ports System
I had the recent unforunate occurence of having my machine hacked into. And no, it wasn't a security hole, but simply a really weak password that was compromised through a brute-force ssh attack. During my audit/clean-up, I was trying to figure out what all the attacker may have installed, since I initially found a shellbot perl script running under the compromised account.

When a machine is compromised, you want to see what servers it may have installed, listening on your system. To do this, you need to "identify" all of the processes running servers. Normally you do this with fuser or netstat -nlp. Unfortunately, neither work on OS X.

I finally figured out how to do this, and just wanted to post it online so others searching could find it. In Terminal, just run this command:
lsof -i | grep LISTEN
This will list all processes that are listening on your machine. That's it!
  Post a comment  •  Comments (31)  
  • Currently 3.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[94,473 views] Email Article To a Friend View Printable Version
View a sample of all installed fonts System
I remember at one time being excited to find a "Create Font Sample" script -- it's in the AppleScript menu, under Font Book » Create Font Sample. I remember being disapointed to find out that it only worked on certain fonts. The only way I would be able to make it work would be to add all the fonts to the script.

Today I wished I had a sample of the couple thousand fonts I have on my system, so I decided to look at the "Create Font Sample" script again. Much to my delight, I found that, at some point, Apple fixed this potentially handy script and it now works. I don't know when they fixed it, but I'm glad they did.

[robg adds: I found that, on my machine at least, this script only samples the selected font families in Font Book. The first time I ran it, it printed exactly one sample font. When I looked at Font Book, that font was selected in the Font column. So I clicked on it (to make sure the Font column was active), then pressed Command-A (to select all), then re-ran the script. The script then created a new TextEdit document with a sample of every font on my machine. So if you don't get the results you expect, check the Font column selection in Font Book.]
  Post a comment  •  Comments (14)  
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[17,496 views] Email Article To a Friend View Printable Version