cocoa

Basic cocoa application using dock in Python, but not Xcode and all that extras

It seems that if I want to create a very basic Cocoa application with a dock icon and the like, I would have to use Xcode and the GUI builder (w/ PyObjC). The application I am intending to write is largely concerned with algorithms and basic IO - and thus, not mostly related to Apple specific stuff. Basically the application is suppose...

Using otool (recursively) to find shared libraries needed by an app

I have a Cocoa app that uses otool to find required shared libraries that an app needs to function properly. For example, say I run otool -L on an app that uses QTKit.framework. I get a list of the shared libraries used by the program (including the basic frameworks like Cocoa.framework and AppKit.framework): /System/Library/Frameworks/...

Making NSScroller larger

I'm making a Cocoa application optimized for external touch sensitive screens, so I want to make a large scollbar in an NSScrollView. I've tried just to resize the scrollers frame, but both drawing and mouse events only happens in the scroll area, it doesn't get wider (it's the vertical scroller). This is the code I'm using (from the sub...

how to create a global variable(linked list) in Cocoa?

please give me some examples.thanks a lot ...

Initialize NSArray with floats?

Is this a valid way to initalize an NSArray with float objects? NSArray *fatArray = [NSArray arrayWithObjects: [NSNumber numberWithFloat:6.9], [NSNumber numberWithFloat:4.7], [NSNumber numberWithFloat:6.6], [NSNumber numberWithFloat:6.9],nil]; It works and...

Web application programming using objective-c?

Just say you have a quite large and complicated desktop application written in objective-c/cocoa written properly in MVC. You then wish to replace the V and C so that it is a web application? Is there anything like Tomcat but for objective c? The closest thing I can think of is somehow convert the Model code into an apache module to lo...

Closing child windows in Cocoa when the main window is closed

I'm a Cocoa newbie so it is likely that my approach is wrong but .. I have an app which opens several child windows (after the main/parent window has been loaded) using NSWindowController and InitNibWIthName. This works fine. But when I close the parent window (using the red x) these remain open and prevent the app from closing until t...

NSMutableArray, alloc or capacity?

Is there any reason to go with either of these, other than one returning an autoreleased object and the other needing a manual release? NSMutableDictionary *drink = [[NSMutableDictionary alloc] init]; // do things ... [drink release]; OR NSMutableDictionary *drink = [NSMutableDictionary dictionaryWithCapacity:10]; gary ...

Accessing an Array of Dictionarys?

I have a couple of questions regarding the code below: (1) Is "newItem" an autoreleased object? Its getting a returned dictionary from the specified array index? (2) Is there a simple way to access an array of dictionarys in one hit, or am I doing it the way you would expect? #import <Foundation/Foundation.h> int main (int argc, cons...

Get the current working directory of process with a pid programmatically on OS X

Is there a way to get the current working directory of a process using it's PID programmatically on OS X? Cocoa, Carbon, or AppleScript are all acceptable. It is not acceptable to send "pwd" to the current terminal window/tab (Do not want to affect the workspace). The linux command "pwdx" also is also unacceptable (just in case you re...

RubyCocoa: Thumbnail Images in NSTableView

I'm trying to display an NSTableView of: | thumbnail | filename | I created the NSTableView in IB and delegated it to a class. In the class, I bypassed a model just to get a POC implementation and created the data source delegate methods. They populate the text cells just fine. However, now I'm at the step where the first cell needs to...

Cocoa: pasting formatted text in the current font?

When I put formatted text into the pasteboard (NSRTFPboardType), it pastes with all formatting preserved. But what I'd really like is to discard the font face and size information, while preserving the weight, color, etc. According to the docs, an NSAttributedString with no font information will default to Helvetica 12, so that seems l...

Managing inverse relationships without CoreData

This is a question for Objective-J/Cappuccino, but I added the cocoa tag since the frameworks are so similar. One of the downsides of Cappuccino is that CoreData hasn't been ported over yet, so you have to make all your model objects manually. In CoreData, your inverse relationships get managed automatically for you... if you add an ob...

[NSLocale currentLocale] always returns "en_US" not user's current language

I'm in the processes of internationalizing an iPhone app - I need to make programmatic changes to certain views based on what the user's current locale is. I'm going nuts because no matter what the language preference on the iPhone simulator or actual hardware are, locale always evaluates to "en_US": NSString *locale = [[NSLocale curre...

Performance of math functions?

I'm working with graphing accelerometer data here, and I'm trying to correct for gravity. To do this, I get the acceleration vector in spherical coordinates, decrease the radius by 1g, and convert back to cartesian. This method is called on a timer every 0.03 seconds: //poll accleration ThreeAxisAcceleration current = self.accelerationD...

Google Search Engine - Cocoa

Hey all, Would it be possible to make a google search engine in Xcode, cocoa? If so, how? I want the user to type in a phrase in a textfield called inputBox, and the button to be sendButton. When the button is pressed it will open your default browser to the searched phrase. Thanks, KeViN ...

Presenting a tree of data with NSOutlineView?

I have a tree of data that I would like to present to the user in a top-down manner, the way you see parse trees presented. Conceptually, the data have a lot in common with what an NSOutlineView would present: hierarchical structure, tree nodes can be be expanded and reordered, etc. I'm trying to figure out how I might be able to manip...

Can I use NSSpeechSynthesizer from JavaScript?

Hi, I have a short and simple question: Can I use NSSpeechSynthesizer or Mac OS's Text-to-Speech engine from JavaScript (if I'm on a Mac using Safari)? And if so: how? Thanks! Johannes ...

Changing the desktop image in 10.6.x

I have an application that changes the desktop background for users based on files they specify. It worked quite well in 10.4 and 10.5, but Apple seems to have changed some system notifications which means the code I had written no longer works. I was wondering if anyone has seen any examples, or have worked out how to change the image...

Objective-C: High-level language?

I have managed to avoid C and C++ up until now (except for a few HelloWorlds), and have instead worked in higher-level languages. I've worked and lived in VB6, then Java, then C#, then ActionScript, and now Ruby. I've recently become curious about programming for the IPod Touch/IPhone. Though I've seen some possibilities for avoiding Ob...