osx

C++ Debug builds broke in Snow Leopard X-Code

After upgrading to XCode 3.2 and Snow Leopard, my debug builds are broken and fail at runtime. Stringstreams do not seem to work. They work in Release mode. I've narrowed it down to a combination of GCC 4.2, OSX SDK 10.6 and the _GLIBCXX_DEBUG pre-processor symbol. These are the defaults for new XCode projects' Debug configurations. ...

expand title bars into documents in Adobe Reader on OS X

Hi, Adobe Reader tends to turn all of my open pdf documents into title bars after my laptop computer (OS X) goes to sleep or switch screens. I wonder if there is a way to either suppress this behavior, or expand all of them to display the full documents without having to do this for them individually (for some reason I find myself having...

NSTableView Troubles

Hey everyone, I'm working on learning Objective-C/Coaoa, but I've seem to have gotten a bit stuck with getting the NSTableView object to work for me. I've followed all the directions, but for some reason I still get this error: Class 'RobotManager' does not implement the 'NSTableViewDataSource' protocol Here's my source, tell me what...

Step through Ruby code at runtime on OS X

I would like to step through Ruby code at runtime, but it seems difficult to find a decent Ruby IDE for OS X which allows you to do this. I would prefer one which uses the native look and feel of the OS (Cocoa). Can anyone make a suggestion? The main feature I am looking for is the ability to step through the code, not really much else...

Intercept Copy and Paste with AppleScript

Is it possible to intercept global copy and paste in OS X with an AppleScript? Or would I have to have some intermediary step that would trigger the AppleScript to read the clipboard? ...

Is "English" or "en" the preferred .lproj folder name now?

In Apple's documentation and example code, I see lproj folders both named with the name of the language, such as "English", and with an ISO 639 code, such as "en". What is the definitive naming requirement? I have not been able to find it. If there isn't one, what are the advantages and disadvantages of each type of name? ...

Differences between Foundation frameworks on Mac OS X and iPhone

Curious: Why is it that Foundation on OS X contains a wrapper for CFHost (NSHost) but not CFSocket, and Foundation on iPhone OS doesn't even have NSHost? And as an aside, are there any libraries or has any written any wrappers for CFHost and CFSocket on the iPhone? ...

how do you display an NSMenu programatically?

I wrote a little app that lives in the NSStatusBar. I want to have a global shortcut that when hit, the menu bar's content is displayed, exactly like the behavior of spotlight. I have added a global key shortcut to my application, but I am unable to get the meun bar to display. How can I do this? I tried with "popUpContextMenu" , but th...

How to deploy a Phonon-dependant Qt4/PyQt4/python application on Mac OS X?

I have written a crossplatform Qt4/PyQt4/python application, namely MyGreatApp, whose last version requires the Phonon module. MyGreatApp runs just fine on my own machine under Mac OS X 10.6 Snow Leopard, and more generally on any mac where Qt4.4 happens to be installed. However, innocent machines miserably fail to load Phonon: WARNING:...

Compiling JVMTI agent (using GCC, on OSX Snow Leopard)

I am trying to build a JVMTI agent using the g++ command on Snow Leopard and I get the following error: $ g++ -o agent.so -I `/usr/libexec/java_home`/include agent.cpp Undefined symbols: "_main", referenced from: start in crt1.10.6.o ld: symbol(s) not found collect2: ld returned 1 exit status I am a total novice when it comes to gcc...

apple mail adds \n about every 72 characters or so - how do I strip these and preserve actual \n

Looking at the raw, generated email generated from AppleMail, it doesn't appear that I can tell the difference between the \n characters generated by the application, and \n characters created by the user. The ones generated by the program do not have a consistent occurrence but it seems that it's in the range of 70-73. I would like to ...

Has anyone setup tomcat to run virtual hosts using mod_jk

I work in OSX primarily with mostly PHP. Normally I work locally using MAMP and virtual hosts setup in my httpd.conf so that I can point a browser to http://some-project and have as many projects as I need setup. We have a project coming up where we need to serve JSP pages and I would like to set up my local apache server to serve only...

How to remove the session start code from XCode 3.2

I recently updated to the new version of XCode and the session start code is very long and appears every time I run the program. Is there any way to shorten it to what it was like in previous versions? (Just the first line) Here's what it says now... [Session started at 2009-09-14 18:49:17 -0400.] GNU gdb 6.3.50-20050815 (Apple version...

Junit and Java classpath woes - OS X

I'm trying to run the sample tests that come with junit4.7 and having some difficulty. java is respecting my CLASSPATH: me@dinosaurhunter ~/Desktop> export CLASSPATH= me@dinosaurhunter ~/Desktop> echo $CLASSPATH me@dinosaurhunter ~/Desktop> java junit.textui.TestRunner junit.samples.AllTests Exception in thread "main" java.lang.NoClas...

Getting CPU time in OS X

I have an objective-c application for OS X that compares two sqlite DB's and produces a diff in json format. The db are quite large (10,000 items with many fields). Sometimes this applications runs in about 55 sec(using 95% of the cpu). Sometimes it takes around 8 min (using 12% of the cpu). This is with the same DB's. When it is only us...

How to run gdb with -quiet in xcode

I'm a newbie, so you'll have to explain this pretty clearly. I'm looking for a way for Xcode to automatically run gdb with the -quiet command so that it doesn't show startup text. I tried to edit the /Developer/usr/bin/gdb executable by adding -q to the exec lines at the end after "$gdb" in this code (somebody mentioned doing that elsew...

Is it possible to load a NPAPI plugin in Safari (Mac OS X)?

Hi, I've got some code that lies in a browser, and wrote C++ plugins for both IE (COM/ActiveX) and firefox (NPAPI). I now have to get this code work on Mac OS X. I found some input on apple's site, but it's written in Objective C. I also read about SIMBL, but it seems to deal with Objective C code only, isn't it? So here are my quest...

Creating directory hard links in MacOS X?

How can I create a hard link to a directory in OSX? This feature has been added to their file system in 10.5 (for time machine), but I could not find any information on actually using it from the command line. ...

How to get the battery life of mac os x macbooks programatically?

What I wanted to do is take a log on battery percentage. I know the equivalent in linux is sysctl(hw.acpi.battery.life). However when I went through the man of sysctl in mac os x I did not find the equivalent code to find it. Can some one point out how to do this using objective c. I can call sysctlbyname but that doesn't have this as in...

Monodevelop on OS X - "Could not find respack" error when building Moonlight project

Hi everyone, I have just downloaded MonoDevelop 2.2 Beta 1 for OS X and I'm getting the error "Could not find respack" when building a Moonlight project. I have created it by using the Moonlight Application Project template, and it fails without making changes. Besides, the template adds some references which MonoDevelop can't resolve -...