osx

Callbacks with Scripting Bridge?

I'm using Ruby to check the position of videos I'm playing in Quicktime via Scripting Bridge. At the moment I'm just checking the position like so every n seconds: require 'osx/cocoa' include OSX OSX.require_framework 'ScriptingBridge' app = SBApplication.applicationWithBundleIdentifier_("com.apple.QuickTimePlayerX") while true ap...

How can i use NSSavePanel to select a directory?

I need the user select an existing or a new directory where my app can save a few files. Can i do this with NSSavePanel or is there another directory selector class? ...

NSMenuDelegate questions

I have an NSMenu which contains both static and dynamically created NSMenuItem's (static meaning NSMenuItem's created in Interface Builder, dynamic meaning NSMenuItem's created at run-time). Although I'm developing on 10.6, my application also offers 10.5 support. My menu consists of a number of dynamic NSMenuItem's which contain subme...

Getting a CGImageRef out of a PDFDocument.

I have a PDFDocument (made up of PDFPages ofcourse) and I need a CGImageRef to stick into my IKImageView. Currently, I get the datarepresentation from the PDFPage, put it into an NSImage, then get the TIFFRepresentation of the NSImage, put it into a CGImageSource, and then get the CGImage out of the source. That seemsneedlessly complic...

Script to logout user and perform background task

I'm trying to find a way when a user logs in the system to automatically log off and perform a background script. Specifically I will need to remove the local user account but keep the home folder in place. This will only need to be done once but I'm not sure of the best approach. The purpose of logging in once is to capture the accoun...

Why can't I use webrick with git instaweb on Mac OS X?

I'm trying to use git instaweb with Ruby' webrick (which I have installed) on Mac OS X, but every time I fire up $ git instaweb --httpd=webrick I get the following error: webrick not found. Install webrick or use --httpd to specify another httpd daemon. Like I said, I do have webrick, so I don't know why git instaweb won't use i...

"Tab" between controls without tab key

I have a window which happily tabs between its controls using the tab and and shift-tab keys. However, I also want to be able to move between controls with the up and down arrow keys (in this case). How can this be achieved? ...

Same C code producing different results on Mac OS X than Windows and Linux

I'm working with an older version of OpenSSL, and I'm running into some behavior that has stumped me for days when trying to work with cross-platform code. I have code that calls OpenSSL to sign something. My code is modeled after the code in ASN1_sign, which is found in a_sign.c in OpenSSL, which exhibits the same issues when I use it....

Objective-C Pasting

Hi, I want to write a copy and paste function, however I'd like to know how to paste something. I don't want to paste from the clipboard, I want to paste a string. Any idea how to do this? Help is much appreciated ...

how do I find where a executable is present in macosx?

I have a command called youtube-dl .. but dont know where it is installed.. i can run it from shell.. how do i find where it is installed ? which youtube-dl doesnt say anything.. ...

Low level hotkey kext to kill WindowServer?

I need to make a kext which does a very simple function. Whenever a key combination is pressed the kext should kill a process which happens to be "WindowServer" It has to be a kext due to the nature of the problem. It has to be independent from system's UI so if it hangs up, I can press this combination and restart it. Can someone pr...

Program causes OSX (Snow Leopard 10.6.4) window server to spontaneously crash.

I have a program that uses OpenGL combined with Cocoa and Python using PyObjC. I've recently expanded on my menu making code to show menu selections for maps including map information. When using the new code, the window server will spontaneously crash at some random point (Not random but it appears that way). The new code uses nothing ...

Rsync bash script and hard linking files.

I am creating a bash script to backup my files with rsync. Backups all come from a single directory. I only want new or modified files to be backed up. Currently, I am telling rsync to backup the dir, and to check the files compared to the last backup. The way I am doing this is THE_TIME=`date "+%Y-%m-%dT%H:%M:%S"` rsync -aP --link...

Varnish + Rails causes invalid authenticity tokens in development

Here is my situation. I am testing out Varnish on my local box (I'm doing some stuff related to page caching that would be a big pain to push to staging every time). Everything works fine, except whenever I submit a form, I get an ActionController::InvalidAuthenticityToken exception. Varnish is running on localhost at port 6081, and Thi...

Which mode is XNU (OS X kernel) K32 in?

I know XNU K32 is running in 32-bit. But which 32-bit mode is it in, protect-mode or IA32e-compatibility-mode? In the protect-mode, the MMU takes 32-bit cr3 and using two-level page directories. In the compatibilty-mode, MMU takes 64-bit cr3 and using four-level page directories. I know the kernel has its own cr3 setting separated from a...

Is there any way to create an app for python3 script?

Py2app will create the app for python2. But for python3? Has anyone succeeded in creating an app for python3 script? Any clue would be helpful for my script in creating that. ...

Error: cross-thread violation on rb_gc()

I'm new to Ruby on Rails. I ran the following in a terminal when I was going through creating a blog tutorial with Rails: $ rails blog [BUG] cross-thread violation on rb_gc() (null) Abort trap How do I determine what this error message means and how to fix it? $ gem env RubyGems Environment: - RUBYGEMS VERSION: 1.3.7 - RUBY V...

Trying to get GetPrimaryMACAddress to stop printing verbose

Okay, this one seems to me a bit weird. Any help would be greatly appreciated. I recently implemented code that I found here to get the MAC address. The funny thing is that is prints to the console (in addition to the MAC address) something like the following: <CFData 0x317df0 [0xa03e9ee0]>{length = 6, capacity = 6, bytes = 0x001f5bd...

How to run a win32 native application that requires sql server native client on MacOSX with winebottler?

I am experimenting with WineBottler and I would like to try to run my win32 native application written in Delphi on OSX. The application runs, but I stop at login screen since I cannot connect to SQL Server. Does anyonw know how to install and configure SQL Server native client on OSX so that it is usable with WineBottler? Note: I put...

Debugging a crash when a library is opened via dlopen on OSX

Hello there, I have a problem with a C++ application I've developed which uses dlopen to load user-developed libraries. The application has been used by a variety of people on a variety of linux distros and versions of OSX over the last couple of years and so I'm assuming my usage of dlopen is OK and so is the code that depends on it (y...