TweetFollow Us on Twitter

May 98 - Tips

Volume Number: 14 (1998)
Issue Number: 5
Column Tag: Tips & Tidbits

May 98 - Tips & Tidbits

by Steve Sisak

Reducing CodeWarrior Disk Usage

Codewarrior is a product of many thousands of tiny files.

On a 2GB disk, each individual file will take up a minimum of 62k (even if it only contains a few bytes) because of the way HFS breaks up a disk. (HFS+ solves this problem, but until then...)

You could reformat your hard drive and create a smaller partition just for Codewarrior, but there is an easier way: Use Disk Copy 6.1.3 to make a 200 MB read/write disk image of an empty folder. (Actual size will need to be varied depending on what features you are installing.)

Mount the image to the desktop, install Codewarrior to the virtual volume, and then put the resulting image (or an alias to it) in your startup items folder. Because you are working with a smaller 'virtual volume' your block size will be reduced to around 6k per file, saving you tonnes of disk space.

Colin Foster,
cfoster@pobox.com


Wrapper for ParamText

Many people don't seem to realize that you can't pass nil arguments to ParamText. Here's a wrapper routine that lets you forget about this inconvenience, as well as about having to convert between Pascal- and C-string formats:

void ParamCText
 (
  char *Param0,
  char *Param1,
  char *Param2,
  char *Param3
 )
 {
  static Str255 Param[4];
#define CopyArg(n) \
  if (Param##n != nil) \
   { \
    strncpy((char *) Param[n], Param##n, 255); \
    Param[n][255] = 0; \
    c2pstr((char *) Param[n]); \
   } \
  else \
   { \
    Param[n][0] = 0; \
   } /*if*/
  CopyArg(0)
  CopyArg(1)
  CopyArg(2)
  CopyArg(3)
  ParamText(Param[0], Param[1], Param[2], Param[3]);
 } /*ParamCText*/

Just a couple of notes about the code:

  1. The local "Param" is declared static to minimize stack usage. But feel free to change this if you don't like it.
  2. The strings are copied using strncpy, instead of strcpy. This way, if you pass a string longer than 255 bytes, it will be truncated, rather than inadvertently writing over random memory. strcpy should probably be banned -- did you know that something like 90% of of the Unix security bugs that people keep finding on the Internet are caused by buffer overruns?

Lawrence D'Oliveiro,
ldo@geek-central.gen.nz


TCL SetItem Gotcha

Because of an obscure gotcha in the MenuManager routine SetItem, TCL users implementing 'Other Size..." support must beware. The traditional approach reserves one item on the size menu to dynamically display the 'other' size, but this item has no logical initial value, so the temptation is to leave it empty. In a TCL application one uses "#-1" as the text, and the #-1 is stripped by the CBartender before it calls SetItem to install the text, which in that case would be void, with dire 'unpredictable' results. Instead you can use a blank as a placeholder, ie " #-1".

Dana S Emery,
demery@ieaccess.net

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Grab it now: Game Craft’s Legend of War...
The real time strategy game is now available for you to sink your teeth into, through the App Store and Google Play. Combining elements of skill, strategy and empire building, Legend of War is a real gamers’ game. [Read more] | Read more »
Skateboard Party 3 ft. Greg Lutzka (Gam...
Skateboard Party 3 ft. Greg Lutzka 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Skateboard Party is back! This third edition of the popular sports franchise features professional skater... | Read more »
Cubious (Games)
Cubious 1.0 Device: iOS Universal Category: Games Price: $.99, Version: 1.0 (iTunes) Description: Cubious – How smart are you? How high is your IQube? Solve the impossible puzzles to find out, and help a lost little cube find his... | Read more »
Goat Simulator Waste of Space (Games)
Goat Simulator Waste of Space 1.1 Device: iOS Universal Category: Games Price: $4.99, Version: 1.1 (iTunes) Description: ** IMPORTANT - SUPPORTED DEVICESiPhone 4S, iPad 2, iPod Touch 5 or better.** | Read more »
Wildfulness - Unwind in nature and calm...
Wildfulness - Unwind in nature and calm your mind with nature sounds and illustrations 1.0 Device: iOS Universal Category: Healthcare & Fitness Price: $1.99, Version: 1.0 (iTunes) Description: Spending time in nature helps you to... | Read more »
Dr. Panda Racers (Education)
Dr. Panda Racers 1.0 Device: iOS Universal Category: Education Price: $2.99, Version: 1.0 (iTunes) Description: STEP ON THE GAS, RACE AND WIN!Fasten your seat belts and get ready to race! Speed your way to the finish line while doing... | Read more »
ROMANCING SAGA 2 (Games)
ROMANCING SAGA 2 1.0.0 Device: iOS Universal Category: Games Price: $17.99, Version: 1.0.0 (iTunes) Description: Romancing SaGa 2, originally released only in Japan in 1993, has been completely remastered and now receives its first... | Read more »
WRIO Keyboard (Utilities)
WRIO Keyboard 1.0 Device: iOS iPhone Category: Utilities Price: $2.99, Version: 1.0 (iTunes) Description: 40% OFF DURING LIMITED INTRODUCTORY OFFER | Read more »
Hatoful Boyfriend (Games)
Hatoful Boyfriend 1.0 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0 (iTunes) Description: The hit PC game that everybirdie loves has now migrated to your mobile device! Now you are free to explore the wonders of St... | Read more »
Warp Shift (Games)
Warp Shift 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: [ CHECK YOUR HARDWARE: Warp Shift does NOT run on iPhone 4, iPad 1 and iPod touch 4G or older devices! It requires at least iOS8... | Read more »

Price Scanner via MacPrices.net

Goal Zero and OtterBox Partner to Expand iPh...
Goal Zero, specialists in portable power, have announced a partnership with OtterBox, brand smartphone case protection, to offer the Slide and Slide Plus Batteries as modules compatible with the new... Read more
15-inch Retina MacBook Pros on sale for up to...
B&H Photo has 15″ Retina MacBook Pros on sale for up to $210 off MSRP. Shipping is free, and B&H charges NY tax only: - 15″ 2.2GHz Retina MacBook Pro: $1799 $200 off MSRP - 15″ 2.5GHz Retina... Read more
Clearance 2015 13-inch MacBook Airs available...
B&H Photo has clearance 2015 13″ MacBook Airs available for $250 off original MSRP. Shipping is free, and B&H charges NY sales tax only: - 13″ 1.6GHz/4GB/128GB MacBook Air (MJVE2LL/A): $799... Read more
Apple refurbished Apple TVs available for up...
Apple has Certified Refurbished 32GB and 64GB Apple TVs available for up to $30 off the cost of new models. Apple’s standard one-year warranty is included with each model, and shipping is free: -... Read more
21-inch iMacs on sale for up to $120 off MSRP
B&H Photo has 21″ iMacs on sale for up to $120 off MSRP including free shipping plus NY sales tax only: - 21″ 3.1GHz iMac 4K: $1379.99 $120 off MSRP - 21″ 2.8GHz iMac: $1189 $110 off MSRP - 21″ 1... Read more
Kanex Introduces GoPower USB-C Rechargeable B...
Kanex has announced its GoPower USB-C portable battery for the USB-C MacBook, featuring the new industry standard connector and cable used for connectivity and power. Providing users with a new... Read more
Convertible and Detachable Devices Winning Ov...
According to the latest figures published by International Data Corporation (IDC), Western European shipments of ultraslim convertibles and detachables posted positive growth (44.7%) to account for... Read more
New MacBook Pros And Will MacBook Air Be Upgr...
With my mid-2013 13-inch MacBook Air closing on its third anniversary come November, I’m in system upgrade mode. Actually the Haswell CPU equipped Air is still doing a fine job, but my good wife is... Read more
Apple’s Education discount saves up to $300 o...
Purchase a new Mac or iPad using Apple’s Education Store and take up to $300 off MSRP. All teachers, students, and staff of any educational institution qualify for the discount. Shipping is free, and... Read more
13-inch 2.5GHz MacBook Pro on sale for $999,...
B&H Photo has the 13″ 2.5GHz MacBook Pro on sale for $999 including free shipping plus NY sales tax only. Their price is $100 off MSRP. Read more

Jobs Board

Service Assistant - *Apple* Chevrolet *App...
Apple Automotive is one of the fastest growing dealer...and it shows. Consider making the switch to the Apple Automotive Group today! At Apple Automotive, we Read more
Editor, *Apple* News - APPLE (United States...
Job Summary The Apple News team is looking for a passionate and knowledgeable editor with experience covering entertainment/pop culture and experience running social Read more
*Apple* Nissan Service Technicians - Apple A...
Apple Automotive is one of the fastest growing dealer...and it shows. Consider making the switch to the Apple Automotive Group today! At Apple Automotive , Read more
ISCS *Apple* ID Site Support Engineer - APP...
…position, we are looking for an individual who has experience supporting customers with Apple ID issues and enjoys this area of support. This person should be Read more
Automotive Sales Consultant - Apple Ford Linc...
…you. The best candidates are smart, technologically savvy and are customer focused. Apple Ford Lincoln Apple Valley is different, because: $30,000 annual salary Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.