Count number of newlines in a file
Hi, What is the smallest code I can use to count the number of occurrences of the newline character in a file with objective-c / cocoa touch? Thanks! ...
Hi, What is the smallest code I can use to count the number of occurrences of the newline character in a file with objective-c / cocoa touch? Thanks! ...
Hello. I am parsing a text (css) file using fscanf. The basic goal is simple; I want to pull out anything that matches this pattern: @import "some/file/somewhere.css"; So I'm using fscanf, telling it to read and discard everything up to a '@' character and then store everything until it reaches a ';' character. Here's the function that...
I'm using CoreData backed by SQLite and I'm trying to find the fastest way to exclude rows where the field AirDate ends with -00-00 I've noticed that [NSPredicate predicateWithFormat:@"NOT AirDate CONTAINS %@", @"-00-00"] is much faster than [NSPredicate predicateWithFormat:@"NOT AirDate LIKE %@", @"*-00-00"] Are there any other o...
I'd like to override the default system control tint for my app to be always NSGraphiteControlTint. The following code doesn't seem to work though. Any suggestions? NSButton *button = [window standardWindowButton:NSWindowCloseButton]; [[button cell] setControlTint:NSGraphiteControlTint]; Regards, Erik ...
Hi, I’m trying to upload a video of size 100MB through Asset Library. But when i try to use "- (NSUInteger)getBytes:(uint8_t )buffer fromOffset:(long long)offset length:(NSUInteger)length error:(NSError *)error” of ALAssetRepresentation i get memory full error. I also need to put the data in buffer to NSData. How can i achieve that? ...
Guys, I am a newbee for iOS. I need to create dynamic layout since the GUI will be generated according to the data. I checked the UIView references, it seems the standard way to add subview is like: CGRect rect = CGRectMake(0, 0, width, height); UILabel *label = [[UILabel alloc] initWithFrame: rect]; [someView addSubView: label]; But...
I have a list view class that just like NSCollectionView requires an additional prototype item and a prototype view to be of any use. When dropping an NSCollectionView from the library in Interface Builder those two helper items are automatically created. However I couldn't find a single official Apple document dealing with this use case...
How can I get album artwork, song name, album name and artist name from an audio file? I need to display this without the use of iTunes. Thanks. ...
I'm having some trouble using the RegexKit.framework. I've properly integrated it into my project and I want to use the NSString category methods to get an array of matches from a string. Though I have imported the the framework Xcode keeps complaining that "NSString may not respond to '-stringByMatching:'". Do I miss something when work...
Hi all, I am trying to figure out how to take a given NSString and convert it to camel case. I have seen lots of code samples out there for going back and forth between underscores_ and camel-case, but I am dealing with strings that are capitalized. So if I had the string: 12345 SAMPLE STREET #12 or 789 N HASKELL STREET, how would I ...
Hi!, I have 5 NSTableView's instances that have the same contextual menu. When I get the message that the menu has been clicked I need to know which table sent it. I've checked the NSMenu documentation but I don't seem to find a way to check which of the tables opened the menu.. I'm thinking of subclassing NSTableView and send a message...
When reading Apple's Cocoa tutorial, the window controller is just a regular class and while understand that this is perfectly fine I suppose, wouldn't it be better to subclass NSWindowController? If I get this right, NSWindowController is a convenience class which already has a lot of the functionality required by a window controller i...
Given a string and a number, this function will produce all possible combinations of n letters from that string. i.e. If I pass "abcd" and 3, then I should get the following output: abc abd acd bcd This is the code - (void)viewDidLoad { [super viewDidLoad]; [self expand_combinations:@"abcd" arg2:@"" arg3:3]; } -(void) expan...
In case the answer is obvious, please don't be hard on me, i'm still new to Cocoa. I recompiled the iMedia framework to make use of garbage collection, which it officially supports, according to their issue tracker (tracker entry). iMedia parses iTunes' XML library file and loads everything into an NSDictionary (i call it "monster dicti...
The following code works perfectly and shows the correct output: - (void)viewDidLoad { [super viewDidLoad]; [self expand_combinations:@"abcd" arg2:@"" arg3:3]; } -(void) expand_combinations: (NSString *) remaining_string arg2:(NSString *)s arg3:(int) remain_depth { if(remain_depth==0) { printf("%s\n",[s UTF8Stri...
I am making a little application with three NSButtons with an image set. These buttons have no border nor background. However, when I click a button it turns into a gray rectangle. How can I fix this? Thanks. ...
When Looking at the inheritance hierarchy trees in OOP when two objects are side by side in the diagram what is their relationship to each other? For example: NSWindow and NSView both inherit from NSResponder, so are they siblings? How do their respective methods relate? ...
I'm taking my first steps toward learning to write desktop code for the Mac and, thinking it would be a baby step, I decided to write an Address Book plugin to "fix" something that's annoyed me for a long time. Embarrassingly, I can't even get the boilerplate plugin to work the way I think it's supposed to work. My understanding from th...
Hello all, This is a follow-up to a previous post regarding the CHCSVParser from Dave DeLong. In short, I am using the CHCSVParser to work with an extremely large CSV file and parse the lines into Core Data entities (on an iPhone). I've got the parser hooked up and working, and am now trying to display a progress indicator to the user...
Hello, I am thinking about modifying my NSTextView to look like an A4 sheet. So basically a line drawn around the textContainer, but I don't know how this could be done... Just in case no one understands what I mean, I've attached a screenshot :P http://web.me.com/david.schiefer/a4.png Thanks :) ...