Geek


I have been playing with Flex a bit, to write an Flash application for my masters degree (I find the flex environment much better for programming than flash), and like most people working with flash I have come up against the cross domain issue (where the player won’t pull data from a domain which doesn’t have a cross domain policy allowing them to do so). This is a problem for the application I am working with, because I want to pull RSS feeds.

The obvious answer, a php proxy. In a way that makes it sound grander than it is because all it really is is a script to pull data from a remote source to get around the cross domain issue.

here is the script (simplified):

<?php
	header("Content-Type: application/xml; charset=UTF-8");
	$url = $_GET['url'];
	readfile($url);
?>

Now the code pulls back the feed as expected, but prepends this:

67c0

immediately before the content. Where does that come from, any ideas? Wherever it comes from it obviously means the feed won’t parse!

In the end, I used curl like this (simplified):

<?php
	header("Content-Type: application/xml; charset=UTF-8");

	// note that this will not follow redirects

	$url = $_GET['url'];

	// create a new curl resource
	$ch = curl_init();

	// set URL and other appropriate options
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_HEADER, 0);

	// grab URL and pass it to the browser
	curl_exec($ch);

	// close curl resource, and free up system resources
	curl_close($ch);
?>

Technorati Tags:
, , , ,

As a web developer, I love the fact that my work machine can run apache, mysql and php. It makes my working life so much easier than all that ftp’ing then testing. It becomes even more important when you are working with Subversion; I think it good practice to work on a particular bit of a project until it is basically working, before those changes are committed. So my set up is that my SVN working copies become my apache docroots.

So, I usually have Apache 2 set up (along with MySQL, and PHP), via MacPorts, and using ‘dynamically configured mass virtual hosting‘.

This basically means that any calls to my local apache server will look in my sites folder for a directory with the same name as the requested domain name. In order to get the domains working under Mac OS X Tiger, I would just edit /etc/hosts pointing each domain to 127.0.0.1, then restart lookupd, and the whole system would work.

Great … except when Apple developed Leopard, they removed lookupd and thus, my means of pointing my local domains to my local server. Read on for the answer …

Technorati Tags:
, , , , , , ,

(more…)

A while back, I was doing some work with Arduino, passing serial data to the mac to a small application written with Processing which converted the serial data into MIDI data and pushed it out into other apps. Now Processing is a Java thing; and the standalone applications it creates are Java applications.

All fine, but a mere few days before an assessment, I couldn’t get the Serial to Midi application to work; I recalled an article on createdigitalmotion.com which I admit, I didn’t read fully, which said the following:

On the music side, Apple dumped its com.apple.audio.midi java package with 10.4.8. Result: not only do you lose all the features that make the Mac great for MIDI, like the IAC bus for inter-application MIDI routing, but your external devices also spontaneously disappear. Nice.

Now at this point, I put 2 + 2 together and got 5 … Apple have broken my app… Ahh what to do - revert my entire computer to 10.4.7?

So, I sat down and over the next few days and with much help, I managed to build (read: hack together) a serial to midi converter in Objective-C and Cocoa. Works perfectly (now!).

So, no more problem. Indeed. And not 1 day later, I remembered that I had bought an Java extension from Mandolane, which was needed for my original app. I reinstalled that and bingo, that worked too. Doh. Doh. Doh.

Oh well; I wanted to start learning Cocoa etc!

SteamSHIFT out.

Technorati Tags:
, , , , , ,

DOH DOH DOH

How did I never notice the Add User / Edit User / Permissions in CocoaMySQL????

I was trying to hide it away; hit command-m and there the permissions box was! Now aside from the fact that command-m is a stoopid shortcut key to use (normally is for minimise), this is a great find; apparently it’s only been there since Beta 0.7b5 … so upgrade if you’re not using that version.

SteamSHIFT out.

Technorati Tags:
,

I recently wanted to create an application to allow uploads to a website, in the simplest possible way; so I made a little BASH script which used cURL to post the files to the server. Then with a little Platypus (mixed up with CocoaDialog) magic, I ended up with a droplet style application. If you’re a scripter, and want some application magic then do check it out.

SteamSHIFT out.

Technorati Tags:
, ,

It was certainly an experience! And not one that I have any desire to repeat …

I decided that it would be a good idea to upgrade my web and email server to OS X Server 10.4. Partly because I was struggling to get spam filtering working as well as I wanted, and partly because I wanted to upgrade to PHP 5.1.4 and the excellent packages for PHP produced by Marc Liyanage no longer support 10.3. Also, I figured that by 10.4.6, the OS is stable enough for a production environment. It also helped that I was able to procure a cheap copy via ebay!

Technorati Tags:
, , ,


(more…)

My (fairly new) MacBook Pro had developed some rather tedious behaviours such as sometimes not going to sleep when the lid is shut or not waking up when asked to. Also wireless networking performance had been rubbish…

So, figuring they were hardware problems (a friend had many hardware problems with his first revision MBP), I backed up the whole machine, ready to go off to Apple for repair … I thought I’d also reinstall the OS whilst I was at it.

Hey Presto, sleep problems solved. Wireless networking problems solved. Bonus. I’m just going to have to be very careful about what software I put on in the future … I’m guessing it was a 3rd party app, that wouldn’t shut down properly or something.

Technorati Tags:
, ,

I finally tried out the Firebug extension for Firefox; man it’s good. Almost enough to make me switch to FF full time. As a web developer, it’s simply indispensable once you’ve started using it …

Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.

Combined with the GrApple (Eos Pro) theme, Firebug is making a good case for me to switch … if it wasn’t for the very un-mac behaviours like not using the keychain.

So, for now I’ll keep playing the dual browser game; Safari still rocks (apart from being a bit of a resource hog).

SteamSHIFT out.

Technorati Tags:
, , , , ,

Custom USB Keyboard for Controlling Ableton Live

I just finished reworking an old USB QWERTY keyboard to serve as a custom keyboard for controlling Ableton Live, and thought you might like a look. The whole thing is well-documented with photos and comments at my Flickr site:

flickr set: Custom keyboard for Ableton Live

The basic idea: instead of buying an expensive controller to expand my tactile control of Ableton Live (or building something custom with MIDI controllers), I decided to use an old USB QWERTY keyboard and custom-paint it to enhance its use as a live performance device.

The big idea behind the keyboard is that the humble QWERTY keyboard offers a ton of control possibilities, thanks to the flexible keymapping capabilities of Ableton Live. I’ve been using the built-in keyboard on my Powerbook for a while now to trigger clips in performance, but it’s tough for a couple reasons. First, it looks like you’re writing e-mail during a show, and that’s kinda boring. Second, all the keys look the same (minus the markings, of course) - there’s not much that lets you navigate easily in low-light conditions and in the heat of the moment on stage.

You can see a full write-up here:

custom USB QWERTY keyboard for Ableton Live [Ableton forum]

Simple and yet effective!!

(Via createdigitalmusic.com.)

Change the Screen Properties from the CLI

What syntax would I use to change the color depth of the display/monitor either in an Applescript on OS 10.4 OR via command line (defaults write maybe) ?

Read the answer…

(it’s a simple CLI app called cscreen, but read the rest of the article for the longer answer!).

(Via Mac Geekery - Get your geek on..)

Next Page »