Debugging Flash on Linux

February 27th, 2007

While the standalone Flash Player on Linux is pretty good, but it kept crashing on me the other day when I tried to use fdb with it. I thought up another solution, and it works surprisingly well. It uses wine with the Windows version of the standalone player as an alternative player for Linux.

First, make sure wine is installed. If you’re using Ubuntu, you’ll need to enable the community maintained (universe) repository in Synaptic in order for it to become available. You should already have the Flex SDK, if not I have more on this in my guide to Flash development on Linux. Create a file called gflashplayer in Flex’s bin folder unless it already exists. If that’s the case then it’s probably your regular debug player. Rename the old one flashplayer-debug and then create the empty file gflashplayer. Open gflashplayer as a text file and write this…

#!/bin/sh
USEWINE=true
if $USEWINE; then
wine $(dirname "$0")/../player/debug/SAFlashPlayer.exe $*
else
$(dirname "$0")/flashplayer-debug $*
fi

Now whenever gflashplayer is run, it will redirect it to the wine-powered instance of SAFlashPlayer.exe. It works for debugging too, at least on my computer (Ubuntu 6.10, wine 0.9.30-0). You may need to configure wine first, try typing winecfg in the terminal and adjust the settings.

I still like the Linux version better, but it’s good to have the alternative ready when you need it. If you want to switch back, change USEWINE=true to USEWINE=false. You’ll need to have the Linux debug player (available here) named flashplayer-debug and located in Flex’s bin folder.

Update: How strange, the wine-powered standalone player is the most stable Flash player I’ve used yet. On Windows it would occasionally be unable to connect to the debugger until I restarted Eclipse, usually related to having to many players open at the same time. On Linux it will crash unexpectedly. Now I can have a dozen debuggers open at the same time with no crashes yet.

I read an article today about a guy who doesn’t, like most developers, actually understand Flex’s purpose. Javascript + XHTML + CSS can’t do everything. I spent years of my life trying to make Javascript into something it wasn’t, it was only later I discovered Flash was what I was really after. I still see a place for Javascript, but it’s not in say, a 3D engine, and while someone could probably make 3D engine in Javascript, it would be inferior to one made in Flash. There’s no war between Flash and Javascript, there’s no need to pick sides, they’re just two different languages for generally different purposes. They’re opposites that together form a whole, I just heavily favor Flash because it suits my needs.

Flash isn’t really supposed to replace the back button, or make your website hidden to search engines. There’s a huge Flash blogger scene, but I can’t recall the last blog I’ve seen that was made in Flash. Javascript is in the end, an extension of HTML and it can’t escape the fact that HTML was always meant to display formatted text. It’s what Javascript + XHTML + CSS is good at and what Flash isn’t. Flash has HTML formatting capabilities, but they’re only a bonus, an extra feature, not a replacement for HTML.

There’s also the complaint that Flash is proprietary. While I agree that this is a flaw, Flash would not exist today if it wasn’t closed-source. Although Javascript is the most common platform available on computers, Flash is still second best and far more reliable. You can still flawlessly view Flash content made when Flash was little more than a vector-art plugin. People may trust it less because the player is closed-source but it’s far more constant and reliable than Javascript has ever been. Flash’s ubiquity will keep it going for years to come, so there’s no need to worry that it will be corrupted. The outrage would be deafening. One of the main reasons Flash is so popular and yet so closed-source is because it’s been handled so well over the years there’s little interest in alternatives.

Unoriginal Content

February 15th, 2007

I’ve seen two particularly strange examples of plagiarism recently. Actionscript Hero’s blog is being reproduced on several domains. I figured they were simply caching his site, but they’re actually listing his site’s IP address under their domain names. The only purpose I can see is to enhance the domain through quality content (which aSH provides) and then swap it out later with a spam site. This cannot stand.

I offer this advice to aSH and anybody else suffering from similar predicaments. There’s always ye olde .htaccess.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www.)?somedomain.com$ [NC]
RewriteCond %{HTTP_HOST} !^(127.0.0.1|localhost)$ [NC]
RewriteRule ^(.*)$ http://www.somedomain.com/$1 [R=Permanent]

I can’t personally test this (still on a shared host believe it or not) but unless I’m wrong this will redirect any request that is not from either somedomain.com or www.somedomain.com to www.somedomain.com. There’s also an extra condition for the standard localhost and 127.0.0.1 loopback addresses. You might want to add another condition for people who access your site directly from the IP address as well. This is what it will do…

http://www.plagiarist.com/blog/really-cool-post -> http://www.creator.com/blog/really-cool-post
http://www.shadycharacter.com/about-me -> http://www.coolperson.com/about-me

You could also make the page redirect to a special page which explains what’s going on to any confused readers, further depriving the content-stealing site of any credibility.

There’s another more old-fashioned form of plagiarism inflicted upon Aral Balkan. Some of his better posts were directly copied from his blog onto someone else’s blog. The offender was stupid enough to (it looks like he wasn’t aware of what he was doing, everybody makes mistakes) hotlink the images from Aral’s site so Aral replaced them with images of the plagiarist proclaiming his lack of original thought. I applaud Aral for the restraint shown and not replacing the images with something less… polite.

Simple referer-blocking will prevent most attempts at hotlinking, although I am personally aware that this isn’t foolproof. There are ways around it, although I’m not sure what they are, I’ve experienced extreme forms of this mysterious event. If anyone links to his blog, please make absolutely sure the rel=”nofollow” attribute is included so his page rank won’t be improved.

I have one last tip. If there’s a situation where a site is being cached on another site, find a way to include the IP address the person accessing your site on every page. When the content stealer updates the cache, his IP address will be included in the HTML on his site. Block that IP permanently with this .htaccess code…

order deny,allow
deny from <IP address>