Archive for the ‘Programming’ Category

Things I can’t remember—bless

Saturday, February 2nd, 2013

When making .dmg’s or CDs I often want a folder to be open when the .dmg or CD is opened. To do this you use this command.

bless --folder /Volumes/FolderName/ --openfolder /Volumes/FolderName/

Rename a bunch of files

Saturday, June 30th, 2012

Photoshop mangles file names when you run batch saves on them, so I’ve had to rename a bunch of files after processing. Here’s what I do from the shell prompt to rename a bunch of files in a PictsFolder.

Create a file called

cd /Users/gmiller/Desktop/PictsFolder
mv 1.png a.png
mv 2.png b.png

chmod it to be executable. I use chmod 777 because I’m lazy. Then run it from the command line.

jscarry$ /Users/gmiller/Files/
Be sure to escape special characters like spaces in your file names.

e.g. File\ Name\ With\ Spaces.png

Hybrid Disc Problems with Toast and Director

Tuesday, September 20th, 2011

We’ve been using Toast to burn Hybrid CDs since 1994. When I first purchased the new version I was a bit upset that they took out the ability to burn old-style hybrid CDs. However, they didn’t remove the functionality, they just turned it off. Go into the preferences and enable “Show legacy formats and settings” and it will behave just like it did before. Well, almost. Now it has some really annoying animation, but otherwise it works the same. One other difference was a bit harder to track down and fix.

All of our software current software titles were made with Macromedia Director and with the introduction of OSX Lion they no longer work. The transition to Adobe Director 11.5 has been relatively painless except for some old Flash code in Actionscript 1.0 that hasn’t updated nicely to ActionScript 2.0.

However, when we gave the discs to some people in the office to test they got two errors. When they tried to run program from the disc, an application alert came up telling them “This application requires Adobe Shockwave 11, which can not be found. Click to download it.” If they try to copy it to the hard drive, they get a different error. “The alias “Gamename” cannot be copied to the destination, perhaps because the destination does not support this type of alias.” Our development machines don’t give any errors—even the alias one.

It turns out that the problem is in the way Toast handles (or rather doesn’t handle) aliases in the app bundle.

The app bundle looks like this

Hybrid CD Error

If you follow the aliases you’ll find that
DPLib ==> /Contents/Frameworks/DPLib.framework/Versions/A/DPLib
Resources ==> /Contents/Frameworks/DPLib.framework/Versions/A/Resources

Replace the aliases with the source files, and do the same thing in IMLLib.framework and ProjLib.framework. As near as we can tell the Current alias isn’t necessary and can be deleted from all three locations.

Once you have all your aliases replaces and successfully burned a test CD, make a copy of the Frameworks folder. You can replace the Frameworks folder in new apps with the one that you have working.

The solution was tested on OSX 10.3.9, 10.4.11, 10.5.8, and 10.6.8. We haven’t had access to a Lion machine yet.

Color Depth

Saturday, September 17th, 2011

We started out making games with Director 4 back when Windows only supported 8 bit palettes and monitors were 640×480. We chose a background color from the Mac Palette that is hex #0066FF. About 5 years ago we updated our movies so that they would fill the whole screen on larger monitors. Most of the backgrounds and menus Flash .swf files. They scale nicely at all resolutions. We had a bunch of backgrounds masks that are solid colors so we just transformed them to 16 bit bitmaps.

We’re updating a bunch of Director movies to D11.5 so that they will run on OSX Lion and our graphic designer noticed that the backgrounds weren’t exactly the right color. It turns out that Director, for its usual inscrutable reasons, didn’t map the Mac Palette color to #0066FF and they ended up being #0063FF instead. Transforming them back to 8 bit and then to 32 bit fixed the problem.

Cleaning Up Addresses-Capitalization

Friday, April 23rd, 2010

Capitalizing words using BBEdit catches everything you want to change in the address field, but also picks up Carrier Route (Cr), Rural Route (Rr), Mail Stop (Ms), and PO Box (Po Box) so you need to manually change them back when you are done. There are also some Cb’s in my database but I don’t know what it stands for. You should be safe if you do a case sensitive search and replace for all but Cr. I only have a few Cr’s in my database so I looked at them and changed them manually. Look for [space]Cr[[space] and [beginning of line]Cr. Then you need to replace Ne, Se, Nw, Sw when they are at the end of a line or when they have a space after them. For highways, need to change Us to US. You’re going to miss a bunch of states as well.

Well Golly

Atheism Plus

Buy from Amazon