mac

QuickLook plugin displaying an image and some infos.

Hey there, I'm currently writing a QuickLook plugin, and I wondering how I can display an image and some information about that image at the same time, similar to http://www.code-line.com/software/sneakpeekphoto/ . ...

How to run an AppleScript from within a Python script?

The questions says it all.. (On a Mac obviously) ...

Qt - accessing the bundle path

The Qt documentation "Mac Differences" page provides the following code for accessing an application's bundle path: CFURLRef appUrlRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle); const char *pathPtr = CFStringGetCStringPtr(macPath,CFStringGetSystemEnco...

Showing Hand Cursor on a Window on Mac

I have an HIViewRef created using HIObjectCreate. This is basically a window in which I draw something. I want a hand cursor on this Window. I am working on a legacy code and use Carbon, so please no Cocoa. Any ideas on how can I associate a hand cursor on the window. ...

Writing to a HOSTS file in Mac?

How do you programmatically add a new entry to the Hosts file in Mac? For example on Windows, you just open up a StreamWriter and output to the Hosts file. How do you do this on a Mac? ...

Calling python script on MAC/Linux from Command line - passing arguments

Consider this setup and folder structure: c:\foo \bin\foo.bat \lib\foo.py I have foo.bat path added to my environment PATH, so I can call it from anywhere passing in some arguments: c:/>foo.bat -v foo.bat contains this code: @ECHO OFF "c:\foo\lib\foo.py" %1 %2 %3 %4 %5 %6 %7 %8 %9 This works fine in Windows. Now I ...

Can't write TIFF files using Libtiff on Mac

I use libtiff3.9.4 for reading and writing TIFF files in c++ on my mac. My project is written to be portable and runs without any issues on both Windows 32-bit og Ubuntu 64-bit. But on the mac the Libtiff function TIFFWriteScanline always fails (it returns != 1). The TIFF file is created, but it does not have any contents. I have tried ...

Using a different MySQL database engine

Hello, I am having problems trying to use a different MySQL database engine. (I want to change from MyISAM to InnoDB) /etc/my.cnf [mysqld] bind-address = 127.0.0.1 default-storage-engine=InnoDB It appears that it is not installed? If that is true, how can I install InnoDB? mysql> show engines; +------------+---------+-------------...

Cocoa Bindings: Binding an NSSlider to a single value in an array

I'm working on a Cocoa application that requires several sliders that will control the values for several "channels" of data. I would like to create the the app so that all of the channel data is stored as integers in a single array. Each slider would then be bound to a single element in the array. Is this possible at all? If so do I nee...

.php extension not being parsed by apache on mac os x 10.6

I wanted to use postgres with php, and the default install of mac os x, doesn't have the postgres php modules installed. I tried using the entropy.ch install not realizing that it was incompatible with mac os x 10.6. After removing the entropy code, attempts to render php files responded with a textual representation of the php file. ...

Banning MAC address from accessing certain port - C++

Hello, I want to stop someone with a certain MAC address from accessing a certain port on my server, I'm using this as a sort of hardware ban for a private server a friend of mine runs. I am looking to do this in C++, and would like to know what I would need to research in order to do it. The server runs Windows. Also, how would I fin...

How to trigger from Python playing of a WAV or MP3 audio file on a Mac?

I'm looking for an elegant way, without a ton of dependencies as in some of the solutions I googled up. Thanks for any ideas. ...

Convert Hexadecimal MAC address to user readable formating (Python)

Hi, I'm receiving from the socket a MAC address in this format: 0024e865a023 (hex converted from binary with received-string.encode("hex")) I would like to convert it to a user readable format like this : 00-24-e8-65-a0-23 Any easy way to do so ? Thanks ...

Quickest way to convert Cairo Surface to Pygame on OS-X

I'm looking for a way to draw smooth animations in Python. I want to use cairo, partly because I like the sub-pixel filtering and partly because I'm familiar with the API. My first approach was to use a GTK.DrawingArea as the target for a cairo surface. While the drawing was quick I couldn't find any reliable way to tie the display / buf...

How to set the Don't Fragment (IP_DF) flag in C

I want to set the Don't Fragment flag on a IP packet. Is there a way to do so via the setsockopt() function or via the flags of the sendto() function? Can I do this with "normal" sockets or do i have to use raw sockets and build the entire IP header myself, setting it's offset-field to IP_DF (which is defined in ip.h)? ...

Place information in Mac Menu Bar Item

I hope this isn't too general. I'm a beginner and I'm trying to learn how to make a Status Bar (menu on the right side) for Mac in Objective-C. I've managed to create the basic outline, but I don't know what the method to use for a particular action: I would like when the drop-down menu appears for it to call a method that will return t...

Timeout Command on Max OS X?

Is there an alternative for the timeout command on the Mac OSx. The basic requirement is I am able to run a command for a specified amount of time. e.g: timeout 10 ping google.com This program runs ping for 10s on Linux. ...

Getting CPU info from Process ID

If anyone could please help me out, that would be great :) This seems to be a tough one. Starting from the process ID, I need to be able to grab: How much CPU the process is taking up in % How long the process has been using the CPU This needs to be written in Cocoa/ Objective-C or C. It also needs to work on Tiger through Snow Leop...

emacs on OS X 10.6

I am a new iMac user. I have extensive experience with Linux on a PC. I downloaded latest version of emacs to the Applications folder. I want to invoke emacs from the command line. However, the default path for emacs is /usr/bin/emacs. what is the best practice for adding the new emacs to the path? I am tempted to create a ~/bin director...

Problems installing libxml2 on Mac OS X

I'm trying to install libxml2 on my Mac (OS 10.6.4). I'm actually trying to just run a Scrapy script in Python, which has required me to install Twisted, Zope, and now libxml2. I've downloaded the latest version (2.7.7, from xmlsoft.org) and tried following these instructions here. To summarize, I tried this command (in the python sub...