cocoa

Read plist data into a NSArray but get null

I got same warning here “local declaration hides instance variable” warning but I got more problems... Here is my code - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.someaddress.php"] cach...

Showing text in selected row in NSTableView as white

Hi all, In my application I have taken a table view and displaying some NSString objects within it. User can also edit any row within it. When I do not change color of NSTextFieldCell in NSTableColumn in IB, it shows default display property of table view ie. when a row is selected, text of selected row starts appearing white, but whe...

Get notified when something is added to NSPasteboard

In my application I want to get notified if something is added into the NSPasteboard. If I copy an text from any other program I want my application to know about it. Somewhere I read it can't be done that way. I should create a timer and check the content of the NSPasteboard myself. Is this the way to do? Or are there any kind of not...

How to test for valid file name in Mac OS X

Anyone know how to test if a string is a valid file name in Mac OS X, other than trying to create file with that name? The issue I'm having is that sometimes, a file name can be too large. OSX has a byte limit for filenames and with unicode characters you can't just check the length of the string since they can be more than 1 byte. ...

Can I leave logging in Release builds?

I've read this question which advocates taking NSLog statements out of Release builds. Is it acceptable to, instead of cluttering the main log up with junk, write it to Apple System Log instead, then it'd be hidden from the main log? Or am I just overcomplicating things? Are there any instances where logging has been useful to you in p...

Does QTMovie handle URL redirects?

I was just wondering if the QTMovie class does handle URL redirects, because I'm streaming audio files with it and the stream URLs can contain redirects. Sometimes the movie won't start playing but doesn't throw an error (i always operate on the main thread, i know this class is not thread safe). Any ideas why QTMovie might not start pl...

Getting a Value from NSXMLDocument

I'm using an API to upload an image and I need to get the uploaded image URL (image_link) from the XML output shown below <?xml version="1.0" encoding="iso-8859-1"?><imginfo xmlns="http://ns.imageshack.us/imginfo/7/" version="7" timestamp="1283286280"> <rating> <ratings>0</ratings> <avg>0.0</avg> </rating> <files server="8...

How do I count the objects in an NSArray that have a certain value?

I have an NSArray populated with 0's and 1's. How can I return the number of 0's in the array? Thanks! ...

Cocoa - NSDictionary objectForKey - memory management clarification

[I have read the Cocoa memory management rules, but still want to be certain, and would like to know if this is good form.] My class has a mutable dictionary ivar: NSMutableDictionary *m_Dict; ... m_Dict = [NSMutableDictionary dictionaryWithCapacity:10]; [m_Dict retain]; At some point I'll add a mutable array to the dictionary: NS...

Highlighting only image over button when it is clicked

Hi all, Right now when I set an image over a button and make it border-less and try to click it, it always shows a rectangular portion highlighted along with the image, which is the actual dimension of button clicked. My requirement is: I want to highlight only the image over it, not the whole rectangular portion. Can anyone suggest m...

showing webview with transparent background

Hi all, I am displaying some graph from a link in webview. My requirement is : I want to show graph with changed background color. One way is to change the color in html/php code. The other way I thought is to take the web view within NSBox and fill NSBox with required color, but it is not working as I require. It is showing graph wi...

Is it possible to know referrer for GURL call received via AppleScript event?

I have a protocol handler associated with my Cocoa application. [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(getUrl:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; ... - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDesc...

how to break string into array in cocoa?

i need to break a string into an array, as "2 + 3" should be as "2","+","3" even "2+3" should be "2","+","3" ...

How do I wait until an NSOperationQueue has finished in a Unit Test?

The Problem I have an NSOperationQueue called logEntryGeneratorQueue I want to wait until all operations on the queue have completed If I use: [logEntryGeneratorQueue waitUntilAllOperationsAreFinished]; it works fine if the thread adding to the queue is in the background itself. However, if I'm running this code via a unit test,...

Should I use variables or arrays, or an nsdictionary in Objective c

Hi everyone, I was wondering if I should use an nsdictionary to hold all of the values that my program uses. Or, I could stick with using many variables for each value. If I use an NSDictionary/array I could release it all at once, rather than a bunch of variables. Unfortunately I am dealing with many memory leaks, so I thought that u...

RC2 decryption using CCCrypt

I'm trying to decrypt RC2 data with only 64 effective bits. Since I can only have 64-bits, it's my understanding that before calling CCCrypt I must use a method to reduce the key down to this many bits. Since I couldn't find any such method in Apple's CommonCrypto library, I am using this keyschedule method I found. These are the metho...

Detect if user presses button on a Wacom tablet

Hi, I was wondering if it is possible in Cocoa/Carbon to detect whether a key combination (e. g. Ctrl + Z) comes from a Wacom button or the keyboard itself. Thanks best xonic ...

Parsing NSString to get data out

Hey all, I have this code... NSData* myData = producedData; NSLog(@"Contents of myData: %@", myData); The log prints { "id" = ""; "level" = "level_1"; "handle" = test; } How do I get the values for id and level and handle out of this? The original data is a NSString*. Thanks! ...

Masking NsImageView

How would I be able to mask an nsimageview in objective c? For example, having an nsimageview with rounded corners. ...

Core Data : Post migration, additional migration code.

I wish to migrate from my version1 data model to version2, but once the migration is complete I wish to perform some custom migration code. How will I know if/when the migration occurs? Is there a migrationHasCompleed delegate method or notification? For interests sake: The custom migration code I wish to perform resizes png's in the da...