Thoughtful, detailed coverage of the Mac, iPhone, and iPad, plus the best-selling Take Control ebooks.

 

 

Pick an apple! 
 
Avoid Naming Pear Note Files

If you create a lot of documents, coming up with a name for them can sometimes be a hassle. This is especially true now that search is becoming a more prevalent way to find documents. Pear Note provides a way to have the application automatically generate a filename so you can avoid this hassle. To use this:

  1. Open Saving under Pear Note's preferences.
  2. Select a default save location.
  3. Select a default save name template (Pear Note's help documents all the fields that can be automatically filled in).
  4. Check the box stating that Command-S saves without prompting.
  5. If you decide you want to name a particular note later, just use Save As... instead.

Visit Useful Fruit Software

 

 

Related Articles

 

 

Other articles in the series MacsBug!

 

 

MacsBug for the Merely Geeky, Part Three

Send Article to a Friend

Previous parts of this article explored MacsBug, Apple's free low-level debugger. First, we covered installing MacsBug and using it to recover from application crashes - we also established MacsBug as possibly the least friendly software you'll ever encounter on a Macintosh. Next, we discussed common MacsBug commands that reveal detailed information about your Mac, applications, and memory, and how to make logs of problems you encounter. Although MacsBug isn't for the faint of heart, it can be useful even for people who don't program for a living.

<http://db.tidbits.com/series/1057>

Now that you're familiar with MacsBug, you can put your knowledge to good use for automatically restarting crashed servers.

Poor Man's Server Restart -- You may have noticed the StdLog command discussed in the second part of this article contains output from several other MacsBug commands. That's because StdLog is actually a MacsBug macro, or a sequence of other commands separated by semicolons. You can use the help command to see what commands are in a macro: type "help stdlog" to see the full expansion of the StdLog macro.

Generally, non-programmers don't need to define macros. However, MacsBug has two reserved macro names - FirstTime and EveryTime - that can be useful for people running unattended servers. If they exist, the FirstTime macro is executed when MacsBug is loaded at startup, and the EveryTime macro is executed every other time MacsBug is invoked, whether by the user or as the result of a system error. Here are some common strategies for defining these macros:

Simple restart:
FirstTime: G
EveryTime: RS
Smarter restart:
FirstTime: DX OFF;G
EveryTime: STDLOG;RS

The first example tells MacsBug to resume execution when it's invoked at system startup, then has MacsBug restart the machine in the event of a system error. The second example is identical, except that it turns off user breaks in the FirstTime macro (see the DX command, in part two of this article), and tries to make a standard log and restart the machine in the event of a system error - that way there's a record that the machine is having problems. Note that commands are separated by semicolons.

<http://db.tidbits.com/article/05130>

You can use the RB command instead of RS in these macros, if you like. Be sure the last command in the FirstTime macro is G, or the Mac will never continue starting up. Also, don't end the EveryTime macro with G, or you'll never be able to get into MacsBug.

The FirstTime and EveryTime macros must be defined as permanent macros before you can use them to restart a machine. To do this, you use a resource editor like Apple's free ResEdit to define the macros and store them in a file.

<ftp://ftp.info.apple.com/Apple_Support_Area/ Apple_SW_Updates/US/Macintosh/Utilities/ ResEdit_2.1.3.sea.bin>

Although I can't give complete instructions about using ResEdit in this article, here are the steps for creating these macros:

  • Make a copy of MacsBug. (You can throw it away later.)

  • Using ResEdit, create a new, empty file, naming it clearly. (Mine is called "MacsBug Cheapo Restart".)

  • Leaving your new file open, use ResEdit to open the copy of MacsBug. Find and open the TMPL resources, select the mxbm resource (it should be the first one listed), then choose Copy from the Edit menu.

  • Paste the mxbm template into your empty file, then close the copy of MacsBug. The only file ResEdit should have open now is your new file.

  • Choose Create New Resource from the Resource menu. You can either type mxbm (all lowercase) or select mxbm from the scrolling list, then click OK. ResEdit creates the new resource and immediately opens it for editing.

  • Click the resource entry, 1) *****, then choose Insert New Field(s) from the Resource menu.

  • In the Macro name box, type FirstTime. In the Expansion box, type your FirstTime macro. (You can just type the letter G for now - you can always edit this later with ResEdit.)

  • Click the second entry, 2) *****, and choose Insert New Field(s) from the Resource menu.

  • In the Macro name box, type EveryTime. In the Expansion box, type your EveryTime macro. (Again, you can just type RS for now, and change it later if you like.)

  • Choose Save from the File menu, and quit ResEdit.

  • Move the file to the MacsBug Preferences folder inside your System Folder's Preferences folder. It will probably be the only file in that folder.

  • You're done! The macros will start working when you restart the machine. If you want to disable them, move the file out of the MacsBug Preferences folder and restart.

Beyond Merely Geeky -- I still won't pretend that using MacsBug is for everyone. However, I hope you can see that its utility isn't limited to code-heads who drink too many carbonated beverages. Knowing the basics of using MacsBug can help you understand and troubleshoot software problems, which in turn makes your Mac more stable and using you Mac more productive. In the end, that's what everyone wants.

 

An extra display for just ten bucks!
Air Display 2 lets you use your iPad, iPhone, or nearby Mac as
extra screen real estate for your main computer. Now smarter,
better, and 50 percent faster. <http://avatron.com/tidbits>