programming

Flex stops building the foo.html and foo-debug.html files

I've been trying to get up to speed on Adobe Flex for my CS Capstone project. I should mention, by some surprisingly enlightened decision, Adobe offers a free Flex license to students.

Everything was going great until I it suddenly stopped building the foo.html and foo-debug.html files that launch the foo.swf and foo-debug.swf files. Apparently other people ran into this too. I didn't figure out the proper fix for this but I developed a workaround based on a blog post by one of the Flex developers.

Basically, just rename the index.template.html to ${swf}.template.html and then do a clean rebuild. You should end up with bar.html and foo-test.html and be able to get back to work.

Replacing tabs with spaces in files

I've got a bunch of source code that I'd written with 4-character wide tabs. I needed to replace them with spaces. I'm ashamed to admit how long it took me to figure out.

#!/bin/sh
for i in *.[c,h]
do
    expand -t4 $i > tabfree.txt && mv tabfree.txt "$i"
done

Hopefully by posting this I'll save someone (read: me in six months) some time.

PHP One-liners

I'm starting a collection of one-line PHP programs that I've used on the command line.

This removes trailing white space from a DOS file:

C:\>php -r "foreach (file($argv[1]) as $l) {print rtrim($l).chr(13).chr(10);}" user.module > user.module.trimed

This little gem escapes code for inclusion in HTML. The invocation uses UNIX's cat utility, on Widows you could use type:

$ cat test.php | php -r "print htmlentities(file_get_contents('php://stdin'));"

Running multiple versions of Drupal on Windows

Once you've been developing Drupal modules for any length of time you find that you need to test code on multiple versions of Drupal. The easiest way to do this is have separate Drupal releases running as virtual hosts. In this guide I'll walk though setting up Apache virtual hosts for Drupal 5 and Drupal HEAD. I'm assuming you're running Windows 2000 or greater and that you've already gotten Apache, MySQL and PHP setup and running on your local machine.

for you, a photo

robin

ads

User login

Syndicate content