[comp.sys.mac] New Macintosh One-Liners

pepke@loligo.cc.fsu.edu (Eric Pepke) (11/01/89)

Here is the latest version of the Macintosh One-Liners.

The Macintosh One-Liners are intended to condense onto a single sheet of paper
information about some of the most common Macintosh problems and programming
pitfalls.  Each one-liner is a single line of text, shorter than 80 characters,
which informs about one aspect of Macintosh use or programming.  

The one-liners are brief and do not give complete information about their 
topics.  This is intentional.  Detailed documentation exists elsewhere, mostly
in Inside Macintosh and in the Technical Notes.  If you need more information
than is provided in a one-liner, you should be able to determine it by a little
experimentation or by looking it up using the words in the one-liner as hints.  
The one-liners are short so that they can be consulted quickly and easily.

One-liners give either facts or advice.  The facts may be obvious to some 
people and obscure to others, but are important for all.  The advice is 
intended to help keep people from running into the most common nontrivial 
problems.  Like proverbs, the advice may not be absolute and may sometimes be 
more conservative than is strictly neccessary.  However, I have found that a 
little constructive paranoia can go a long way toward avoiding problems, and
more than once I have taken a precaution which seemed extreme at the time but
which saved my skin later on.

The one-liners started off as a list I made for myself of things to remember
while writing programs.  I have augmented them with my condensed records of
several years of Info-Mac, Usenet, and Delphi digests and one year of Usenet 
reading.  People who have contributed to the list since its first release are 
mentioned at the end.  The result is very much a gestalt of the Macintosh lore 
I have seen and depends on the wisdom and efforts of many people.  If I have
forgotten to include your name, I apologize.

I would be gratified if every Macintosh user and programmer kept a copy of 
this list and consulted it before asking questions of the network at large.
Many of the most commonly asked questions are addressed in the list.

Send suggestions for additional one-liners to pepke@gw.scri.fsu.edu on the
Internet, or PEPKE@FSU on BITNET.  Have fun.

Users' One-Liners
A beep on trying to open a desk accessory may mean the DA Handler is missing.
A beep on trying to open a desk accessory may mean there is not enough memory.
If opening a document from Finder doesn't work, open it within the application.
A flashing Apple menu means the alarm clock is ringing.
A U-shaped icon at the right of the menu bar means Easy Access is activated.
HyperCard visual effects won't work on monitors set to more than 2 colors.
Hold down the F key and click OK in the print dialog to make a PostScript file.
Hold down the K key instead to make a PostScript file which contains LaserPrep.
Turn background printing off before trying to make a PostScript file.
Remove the paper tray during LaserWriter power-up to avoid the startup page.
Hold down the mouse while powering on to eject any disk in the computer.
Don't put disks on the left side of a small Macintosh or near loudspeakers.
Don't rotate a hard disk drive while it's running.
It is safer to rebuild the desktop under Finder than under Multifinder.
Finder's default memory size is a bare minimum.  Increase it with Get Info.
Never put more than one System file on a disk.
If the cursor is surrounded by a big black rectangle, Close View is activated.

Programmers' One-Liners
The maximum number of windows in Finder is stored in LAYO resource 128.
Don't use SetEventMask to disable mouseUp events.
SetPort to a known good grafPort once every time through the event loop.
Calling WaitNextEvent with more than 50 ticks will fail on some systems.
Set the cursor on suspend and resume.
Use SetItem to include meta characters literally in menus.
GetResource never produces resNotFound.  Check for a NIL handle instead.
Lock handles before passing their dereferenced pointers to any routine.
Lock handles before setting referenced data to expressions containing functions
Move and size windows to the bounding box of GetGrayRgn.
Hide scroll bars when deactivating a window.
Call DrawGrowIcon when activating or deactivating a window with a grow region.
DrawGrowIcon does not check to see if the window has a grow region.
Call PenNormal before calling DrawGrowIcon.
itemHit will not be set when a dialog filter is called.
Use a disabled UserItem to draw the roundrect outline around the OK button.
Call IsDialogEvents and DialogSelect even if GetNextEvent returns false.
ModalDialog assumes the dialog is already visible and in the front.
Always set the VisRgn and ClipRgn of offscreen ports.
Set the ClipRgn first when making a picture.
Don't make rowBytes in bitMaps greater than 8191.
To dim text, draw a rectangle with penPat=gray and penMode=patBic over it.
To draw rotated text, draw to an offscreen bitmap, rotate it, and CopyBits it.
Don't use picSize to determine the size of a picture.  Check the handle size.
Don't write in the application file.  This will fail with read-only devices.  
Save application preferences in a folder named Preferences in the System Folder
Truncate and reallocate files before overwriting to reduce fragmentation.
Check/change the creator and type of Save As... files before overwriting.
If you rewrite files by deleting and creating, copy all Finder information.
Delete uses the Poor Man's Search Path, so don't delete blindly.
Directory ID's are longs, not shorts.  Shorts work ALMOST all the time.
Call GetDblTime to get the maximum time for a double click.
Measure double click time from mouse up to mouse down.
Use SysEnvirons to find the System (Blessed) Folder.
Use GetAppParms to get the name of the application.
The high bit of SysParam . volClik enables the alarm clock.
Check the application name at $910 before exiting with ES within MacsBug.
To exit to shell in the mini-debugger, enter SM 0 A9 F4 and then G 0.
Use HT in MacsBug to estimate how many times to call MoreMasters.
Put an odd long at location zero on a 68000 to help find NIL references.
To make a TeachText file read-only, change its file type from 'TEXT' to 'ttro'
Always use unsigned characters within text and Pascal-format strings.

Compiled by Eric Pepke
Additional material by Keith Rollin, Gregory Dudek, Brian Bechtel, Henry 
Minsky, Carl C. Hewitt, Jim Lyons, Alex Lau, Kent Borg, Peter W. Poorman,
Ross Yahnke.

Eric Pepke                                     INTERNET: pepke@gw.scri.fsu.edu
Supercomputer Computations Research Institute  MFENET:   pepke@fsu
Florida State University                       SPAN:     scri::pepke
Tallahassee, FL 32306-4052                     BITNET:   pepke@fsu

Disclaimer: My employers seldom even LISTEN to my opinions.
Meta-disclaimer: Any society that needs disclaimers has too many lawyers.