Tag Archives: Flash

The Monolithic Procrastination Post

Yes, I’m aware that I’m a bastard for not posting for a whole two months despite not having any work obligations. I was honestly going to post last month following the release of the new Cursor Lock version, but got sidetracked with other projects. The story of my life really–project ADD.

news270

Cursor Lock 2.5 alpha

However, for anyone yearning for a new version of Cursor Lock, I can assure you that I will finish it soon as it’s practically complete already (as the screenshot at right will show). I’ve already completed a majority of the testing and just have a few more issues to resolve and documentation to update. I’ve also found a game that puts the new features to use: DX-Ball 2. The new window locking mode works perfectly in the game’s windowed mode to keep the paddle’s responsiveness from drifting out of the window with the mouse.

Another project that I wanted to post about alongside Cursor Lock last month is my newest Age of Empires 3 mod, Banner Army Reforms. It’s a relatively simple tweak that makes a big difference to the manageability of the Chinese civilization. It allows the player to train units individually instead of in unique groupings (Banner Armies). While a key facet of the Chinese, Banner Armies were just a strategic annoyance to me. Too bad the Chinese still suck.

Last post, I mentioned a PHP script that used PEAR’s Text_Highlighter package, but which I had some concerns about and thus wasn’t ready to go live with. Since then, I’ve been racking my brains trying to come up with a way to securely show external source code files (that have been parsed with Text_Highlighter) embedded inside a formatted page. My second implementation idea was to use my inflatable wrapper technique that places a formatting script inside the target source code file; however, that would force me to make the source code files have .php extensions. I also considered a database of IDs and associated code files, which would be secure but also a hassle and it would obfuscate the underlying source code files.

After much googling and frustration, I finally found a way to make certain file extensions be passed to a handler script. This obscure Apache manual page shows how to add an action to extension handlers. If the target of the action is a script, it will receive the originally called file as some sort of CGI parameter; in PHP, it’s placed in the ENV variable $PHP_SELF (don’t use $PATH_INFO, it can be spoofed).

Once I had all that snazzy handler business figured out and implemented in the script, I noticed a glaring oversight in the Text_Highlighter package. Since they place all the source code in a <pre> tag, no word-wrapping is done. Quite frankly, I never care enough to bother with manually line-breaking code and just let it run off as far as I need. However, on a webpage, horizontal scrolling is a cardinal sin. So, I spent more time than I’d like to admit rewriting the output module of Text_Highlighter to put the source code in a table which would allow it to wrap effectively while preserving line numbering and line indentations. I ended up actually having to put the indentation whitespace in a cell by itself. The script still needs a bit more polish, but can be seen in action on the files in this parallel program directory.

Those source code files are actually part of a column I’ve been working on lately to show off the parallel program I wrote for my final college project. Besides having beautified code, the column is also to have a web-based version of the Powerpoint slideshow I gave during my results presentation. I had originally made a simple PHP script that took a page number as a parameter and showed the appropriate slide image with all the formatting and such. I had two problems with this, however: there was no ability to copy the slide’s text and it was a bit underwhelming in this Web 2.0-hyped world. So, on a whim, I decided to have a go at making a Flash movie with all the typical play controls as well as Fullscreen and Copy Text buttons, which could load in an external SWF file with one slide per frame. Of course, it has all sorts of delicious alpha effects, too. The parallel presentation slideshow isn’t quite live yet, but you can see the new Flash in action on the lovable old Tony the Worm column. It still needs a smidgen of work yet, though, such as tooltips. I find Flash a decidedly quirky and frustrating format; finishing one button is enough for celebration.

Posted in Modding, Programming, Website | Tagged , , | Leave a comment