Xcode is creating a MainMenu.nib file instead of a MainMenu.xib file when you select File | New Project. Your Xcode version is 3.2.5 (more or less). This should not be happening. It should be creating XIB files so you can check in Interface Builder files into SCM.
Why is it doing this? You probably upgraded from some old version of Xcode from some old version of OS X. I originally started on Tiger (10.4), and have upgraded straight into Snow Leopard (10.6). There is cruft left from the old installation from years back. Delete these files under /Developer/Library/Xcode/Project Templates/Application/Cocoa Application/Cocoa Application. Notice the dates!
UPDATE: Oops! Except for TemplateChooser.plist, which has a date in the year 2010. Don't delete that!
This thread on Apple support discussions is what lead me to this solution.
I search the Internet for answers to computer technical problems that I encounter. When the Internet does not supply me with an answer, I research one on my own. Then, I document the answer here so others can find it. Also, for your benefit, this stupid blog name makes a great mnemonic.
2010-12-18
Cocoa: +keyPathsForValuesAffecting<Key> lowercase letter mistake.
When you use KVO and create your class method with a name matching the pattern +keyPathsForValuesAffecting<Key> don't forget to capitalize the first letter of the "Key" part.
It might seem obvious to me now, especially with that uppercase "K" in "Key", but all my keys start with a lowercase letter, not uppercase (in keeping with Apple style guidelines), and the KVO Protocol Reference documentation does not call out the uppercase letter requirement. This particular warning is buried within the KVO Programming Guide, instead.
Good:
Bad:
Yes, the bad version even looks bad, so I guess I should have figured that out faster.
It might seem obvious to me now, especially with that uppercase "K" in "Key", but all my keys start with a lowercase letter, not uppercase (in keeping with Apple style guidelines), and the KVO Protocol Reference documentation does not call out the uppercase letter requirement. This particular warning is buried within the KVO Programming Guide, instead.
Good:
+ (NSSet *)keyPathsForValuesAffectingAmountInOtherCurrency {
return [NSSet setWithObjects: @"dollarsToConvert", @"exchangeRate", nil];
}
Bad:
+ (NSSet *)keyPathsForValuesAffectingamountInOtherCurrency {
return [NSSet setWithObjects: @"dollarsToConvert", @"exchangeRate", nil];
}
Yes, the bad version even looks bad, so I guess I should have figured that out faster.
2010-12-15
Perl throw-away script: netstat report on a certain port.
SYN* means a connection is opening. *WAIT means a connection is closing.
Example of running it:
#!/usr/bin/perl -w
use strict;
use warnings;
use Getopt::Std;
our %opt;
getopt('p', \%opt);
my $port = 80;
if (exists $opt{'p'}) {
$port = $opt{'p'};
}
my @lines = qx{ /usr/bin/netstat -an };
my %status;
for my $line (@lines) {
my @fields = split /\s+/, $line;
next if !exists $fields[3];
next unless $fields[0] =~ /^tcp/;
if ($fields[3] =~ /\.$port$/) {
$status{$fields[-1]}++;
}
}
my $total;
for my $key (keys %status) {
print "$key = $status{$key}\n";
$total += $status{$key};
}
print '-' x 15 . "\n";
print "total = $total\n";
Example of running it:
me@mybox:/~
$ ./netstat_port_report.pl -p 8054
CLOSE_WAIT = 1
FIN_WAIT_2 = 166
ESTABLISHED = 148
LISTEN = 1
---------------
total = 316
Subscribe to:
Posts (Atom)
