Wednesday, December 03, 2008

Absolute Best Way to Embed Flash in HTML

*update- doesn't seem to work with Google browser... not sure about safari. i'll update if i get a fix

This is the best way to embed flash into a webpage without javascript. It is a Markup Only solution and because it does not use the embed tag, it will validate.

The HTML object method (nested objects + IE conditional comments):

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="smix" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" height="30" width="100">
<param name="movie" value="file.swf">
<param name="wmode" value="transparent">
<param name="allowScriptAccess" value="sameDomain">
<!--[if !IE]>-->
<object name="smix" type="application/x-shockwave-flash" data="file.swf" height="30" width="100">
<param name="wmode" value="transparent">
<param name="allowScriptAccess" value="sameDomain">
</object>
<!--<![endif]-->
</object>


Here is a compatability chart for this method from the flash test suite by Bobby van der Sluis.

BrowserIE 5, 5.5, 6IE 7, 8b2FF 1*, 2*, 3*Moz 1.7*Saf 1.3, 2, 3*Chrome 0.2Opera 9*, 9.5*
Basicyesyesyesyesyes
Streamingyesyesyesyesyes
Paramsyesyesyesyesyes
Communicationyesyesyesno fscommandno fscommand




Since I require javascript communication, I was a little worried about Safari support but then realized that I use ExternalInterface instead of the old flash way to communicate with javascript called fscommand.

Flash 8 uses ExternalInterface to do javascript communication without using SWLiveConnect. This was a always a problem with Safari using the Object code above but no more with Flash 8 and up.

Recommendations to use SWFObject are all over the forums and is well promoted but it is too much overhead for my taste. Just remember that IE7 and under will require an extra click from the users unless you use one of the javascript methods. This is due to the stupid Ebola patent that claimed rights to HTML embed technology.

Wednesday, April 09, 2008

ImageMagick - How to shrink images in batch mode

find . -size +1000k -name \*.png awk '{print $1,$1}' | xargs -n2 convert -scale 1024x\>

Friday, February 01, 2008

Setup a Future Rescue with the 'at' Comand

With a leased server, you never want to lock yourself out of your box. If you do get locked out, KVM style console access can save you but it's not cheap. It usually costs $30 per use. And that's if your ISP even supports it.

There are 3 risky things that can get you locked out of your server.
1) service iptables restart
2) service network restart
3) changing etc files like /etc/sudoers ... and then rebooting

For me, iptables is the riskiest to edit because one bad rule can lock you out of ssh on port 22.

To protect yourself, use 'at' to revert the file change 5 minutes in the future:
echo 'mv ifcfg-eth0.save ifcfg-eth0' at now + 5 minute

*this will work even if you are kicked out (as long as the server is running).


--update-- here is another way to prevent getting locked out by iptables during testing:

*/10 * * * * iptables -P INPUT ACCEPT; iptables -P OUTPUT ACCEPT; iptables -P FORWARD ACCEPT; /sbin/iptables -F

This will flush all the rules every 10 minutes, just in case you lock yourself out. When you're happy with the results of your work, remove the line from your crontab, and you're in business.