« May 2007 | Main | July 2007 »

June 2007 Archives

June 13, 2007

Stupid Rez Hang and its fix

In Xcode the build of my little AudioUnit project hang at the Rez step. The Rez step ? Yeah, MacOS 9 is alive and well in the CoreAudio/QuickTime parts of Mac OS X. You define little four character constants, that are rezzed into your component, because - I don't know - plists are too cumbersome ?

Anyway for unfathomable reasons Rez didn't want to compile my resource file anymore. It entered a death loop of lseek and read and never returned.

nat$ cd /Volumes/Source/srcI/TestAU
aden:/Volumes/Source/srcI/TestAU nat$ /Developer/Tools/Rez -o /Library/Developer/BuildArea/TestAU.build/Development/TestAU.build/ResourceManagerResources/Objects/TestAU-2BC77829.rsrc -d SystemSevenOrLater=1 -useDF -script Roman -progress -d ppc_YES -d i386_$i386 -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers -I /Developer/Examples/CoreAudio/AudioUnits/AUPublic/AUBase -arch ppc -i /Volumes/Source/srcI/TestAU/build/Development -i /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers -i /Developer/Examples/CoreAudio/AudioUnits/AUPublic/AUBase -i /Developer/Examples/CoreAudio/AudioUnits/AUPublic/AUBase -i /Developer/Examples/CoreAudio/AudioUnits/AUPublic/Utility -i /Volumes/Source/srcI/TestAU/Crude\ Effects -i /Developer/Examples/CoreAudio/AudioUnits/AUPublic/OtherBases -i /Volumes/Source/srcI/TestAU/Foo -i /Developer/Examples/CoreAudio/PublicUtility -i /Volumes/Source/srcI/TestAU/Crude\ Effects/Tests -i /Volumes/Source/srcI/TestAU/build/Development -i /Volumes/Source/srcI/TestAU/build/Development/include /Volumes/Source/srcI/TestAU/TestAU.r
/Developer/Tools/Rez V3.6B1
Copyright Apple Computer, Inc. 1986-2000

looking for /Volumes/Source/srcI/TestAU/TestAU.r
looking for /System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.r
...reading from /System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.r
looking for /System/Library/Frameworks/AudioUnit.framework/Headers/AUComponent.r
...reading from /System/Library/Frameworks/AudioUnit.framework/Headers/AUComponent.r
looking for /Volumes/Source/srcI/TestAU/ConditionalMacros.r
looking for /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/ConditionalMacros.r
...reading from /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/ConditionalMacros.r
^C
And then there it just hangs This has happened before exactly the same way and in a similiar way to others , but there was no good solution for my problem in those mail threads.

The way I "fixed" it , was to run the command with sudo. Yeah that's voodoo, but it worked.

aden:/Volumes/Source/srcI/TestAU nat$ sudo /Developer/Tools/Rez -o /Library/Developer/BuildArea/TestAU.build/Development/TestAU.build/ResourceManagerResources/Objects/TestAU-2BC77829.rsrc -d SystemSevenOrLater=1 -useDF -script Roman -progress -d ppc_YES -d i386_$i386 -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers -I /Developer/Examples/CoreAudio/AudioUnits/AUPublic/AUBase -arch ppc -i /Volumes/Source/srcI/TestAU/build/Development -i /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers -i /Developer/Examples/CoreAudio/AudioUnits/AUPublic/AUBase -i /Developer/Examples/CoreAudio/AudioUnits/AUPublic/AUBase -i /Developer/Examples/CoreAudio/AudioUnits/AUPublic/Utility -i /Volumes/Source/srcI/TestAU/Crude\ Effects -i /Developer/Examples/CoreAudio/AudioUnits/AUPublic/OtherBases -i /Volumes/Source/srcI/TestAU/Foo -i /Developer/Examples/CoreAudio/PublicUtility -i /Volumes/Source/srcI/TestAU/Crude\ Effects/Tests -i /Volumes/Source/srcI/TestAU/build/Development -i /Volumes/Source/srcI/TestAU/build/Development/include /Volumes/Source/srcI/TestAU/TestAU.r
/Developer/Tools/Rez V3.6B1
Copyright Apple Computer, Inc. 1986-2000

looking for /Volumes/Source/srcI/TestAU/TestAU.r
looking for /System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.r
...reading from /System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.r
looking for /System/Library/Frameworks/AudioUnit.framework/Headers/AUComponent.r
...reading from /System/Library/Frameworks/AudioUnit.framework/Headers/AUComponent.r
looking for /Volumes/Source/srcI/TestAU/ConditionalMacros.r
looking for /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/ConditionalMacros.r
...reading from /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/ConditionalMacros.r
...returning to /System/Library/Frameworks/AudioUnit.framework/Headers/AUComponent.r
etc.

June 14, 2007

Bug in NSDateFormatter. Not looking forward to ObjC 2.0...

There is a problem with the way NSDateFormatter treats natural language strings or rather how it treats non-natural language strings. Or maybe it's a mix of the two.

Today is the 14.6.2007. If you enter "today" or "heute" into a NSTextField that is formatted with @"%d.%h.%Y you get a NSCalendarDate object with the time of noon today. If you enter 14.6.2007 you get a date for midnight.

These two aren't equal.


#import <Foundation/Foundation.h>


int main (int argc, const char * argv[]) 
{
   NSAutoreleasePool *pool;
   NSDateFormatter   *formatter;
   NSString          *today;
   NSCalendarDate    *date1;
   NSCalendarDate    *date2;
   
   pool = [NSAutoreleasePool new];
   
   formatter = [[[NSDateFormatter alloc] initWithDateFormat:@"%d.%m.%Y"
                                          allowNaturalLanguage:YES] autorelease];
   
   today = [formatter stringFromDate:[NSCalendarDate date]];
   date1 = [formatter dateFromString:today];
   date2 = [formatter dateFromString:@"today"];
   
   NSLog( @"A1: %@ (%d:%d)", date1, [date1 hourOfDay], [date1 minuteOfHour]);
   NSLog( @"A2: %@ (%d:%d)", date2, [date2 hourOfDay], [date2 minuteOfHour]);
   
   [pool release];
   return 0;
}
Output:
2007-06-14 16:34:19.460 CalendarFormatterTest[10708] A1: 14.06.2007 (0:0)
2007-06-14 16:34:19.461 CalendarFormatterTest[10708] A2: 2007-06-14 12:00:00 +0200 (12:0)
Why does that faze me ? Because I replaced the formatters in a few windows, where the hour and minute information should not be shown anymore. Now suddenly my customers don't find their records in the database anymore.

The solution for me was to write a subclass of NSDateFormatter that posed as it and hacks the dates to 12:00, if the formatter is indeed @"%d.%m.%Y".

I read on a mailing list, that poseAs: isn't supported anymore in Objective-C 2.0. The tendency to make language more noob friendly, but less powerful is not something I like to see.

June 29, 2007

Test your shell scripting prowess

Can you tell the output of this shell script without running it ?
#!/bin/sh

echo "VfL Bochum 1848" | while read x 
do
    echo "$x" 
    rc=$?
done

if [ $rc -ne 0 ]
then
   echo "echo reported an error"
fi

About June 2007

This page contains all entries posted to Nat!'s Web Journal in June 2007. They are listed from oldest to newest.

May 2007 is the previous archive.

July 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.34