Rich Rodecker’s blog on flash, flex, actionscript, javascript, and php, with a dash of randomness
flashape
This user hasn't shared any biographical information
Posts by flashape
PHP Designer – multi-language freeware IDE
Sep 21st
I was searching around for something to unrelaed to this, but what I found was this pretty sweet freeware app called PHP Designer, an IDE to code your PHP, XML, CSS, JS, SQL, etc. files in. It’s pretty surprisingly full-featured for a freeware app (free for both private and commercial use!): multipl language support, built in FTP support, a project manager, snippets, built-in debugger, class browser, TODO manager and more. It’s not a WYSIWYG editor, but it does have button toolbars for adding your code. This is pretty much what I feel like SEPY would be with multi-language support.
The one thing that stops me from giving this two thumbs way up (besides the lack of ActionScript support)…and this is a big one for me…is that lack of custom syntax coloring support. Oddly enough, you can change the editor’s background color…but not the language syntax coloring. After doing some searching around in the product’s support forums, I found that it looks like this may be possible, but now without getting dirty with the app’s config files, something I really don’t even want to mess with.
But if you are ok with the default syntax coloring of the app, and you’re interested in trying an app that offeres many of the features of Dreamweaver (and some DW doesn’t offer), then I suggest you give this one a try.
PHPMailer — its so freaking awesome
Jun 24th
I love php…most of the time. Trying to deal with sending emails with it is another story. Especially html emails. There’s a lot of headers and crap to set, and if you mess some up the email mgiht not get sent, or caught in a spam filter or something like that.
Enter PHPMailer,easily one of the sickest tools I’ve come across in web developement, even if it’s just for the amount of dev time saved alone.
Here a feature list from the website:
Features
-Can send emails with multiple TOs, CCs, BCCs and REPLY-TOs
-Redundant SMTP servers
-Multipart/alternative emails for mail clients that do not read HTML email
-Support for 8bit, base64, binary, and quoted-printable encoding
-Uses the same methods as the very popular AspEmail active server (COM) component
-SMTP authentication
-Word wrap
-Address reset functions
-HTML email
-Tested on multiple SMTP servers: Sendmail, qmail, Postfix, Imail, Exchange, Mercury, Courier
-Works on any win32 or *nix platform
-Flexible debugging
-Custom mail headers
-Multiple fs, string, and binary attachments (those from database, string, etc)
-Embedded image support
I havent tried any other php-mailing solutions, but I’m not even going to. If you are still sending mail from php script, start using this class today.
Criticize My Class Diagram
Jun 2nd
first off, gModeler kicks major ass. Now that that’s out of the way, I want everybody to criticise the crap out of my class diagram for this app I’m building. Here’s the layout, click the thumbnail for the larger image:
The layout may look a little funky becasue i was trying to squeeze everything into the screenshot, but here’s the rundown:
I have a SiteManager class that acts as a psuedo-controller, all the requests go through that.
I have two main superclasses, DynamicOutputter and RecordHandler. Each section of the web site has a corresponding “outputter” class of its own…so for news it would be News_Outputter, and that inherits from DynamicOutputter. The outputters return the formatted output for the page. Each outputter is composed with its corresponding RecordHandler(same deal for the RecordHandlers, each site section has its corresponding record handler that handles communication with the database, and inherits from the RecordHandler superclass). Each RecordHandler’s sublcass overrides one method, setValueArray(), which sets its values, which are the names of the rows in the table it will be dealing with.
When the SiteManager recieves a request, it uses a factory (either DynamicContentFactory or RecordHandlerFactory) to determine which sections class to instantiate, bases on a given id parameter.
If anything else isnt clear, just ask, otherwise, fire away, as long as its constructive criticism.
LoadVars for Javascript updated
May 9th
I just updated my LoadVars object for javascript…you can now use either GET or POST with your send or sendAndLoad requsts. It defaults to POST. Also fixed a little bug in the onData method that would output two equals signs if one was sent back as part of the response.
You can get the source files here
View a demo here.
See my previous post for some more notes.
actionscript
createElement and events, and iframe borders
Apr 22nd
A couple more things i learned today about using the DOM: First, when you are creating elements using createElement, you can usually set your attributes by using myElement.setAttribute(attributeName, “attributeValue”). Well, I had a bitch of a time today trying to figure out why nothing was happening in IE with the onclick attribute for an ‘A’ element I was creating. In all the mozillas everything worked fine…the onclick function i was assigning was firing correctly.
It turns out, IE expects you a function, not a string value for the onclick reference. Mozilla browsers will parse the string for the function so you dont get an error. There’s a couple of different ways to reconcile this, but the easiest and most cross-browser compatible I found was to just directly assign the onclick handler a function literal:
myNewElement.onclick = function(){
//dostuff
}
Even more of a pain in the ass was when i was dynamically generating a ‘IFRAME’ using createElement. again, IE was giving me problems…this time i could NOT get the border around the new iframe to go away for anything…i was setting both the frameborder and border properties to “0″ (and even tried “no”), and it would work in mozilla, but not IE. I tried some CSS stuff, that didnt work either. Finally i tried using frameBorder=0 instead….and it worked. Damn platform-dependent case sensitivity.
javascripting still SUCKS, even with the DOM and its methods.
Posted by flashape at 05:02 PM | Comments (4)
Create New Element function
Apr 22nd
creating new elements and adding their attrubtes can be a little bit of a pain using the DOM…here’s a function that creates a new element, adds it’s attributes, and appends the new element to the given node:
function addNewElem (parentNode, newNodeName, attObj){
var node = document.createElement(newNodeName);
for(var p in attObj){
node.setAttribute( p “className” ? “class” : p, attObj[p]);
}
for(var i = 3; i
LoadVars for Javascript
Apr 22nd
I put together this LoadVars class for javascript for users who would rather deal with the flash LoadVars object than the XMLHttpRequest object (this LoadVars class is pretty much just a wrapper for that object). It’s quick and dirty but it works.
A few notes about the class:
¥ all requests use GET. the send and sendAndLoad methods will automatically convert the properties of the LV object to a query string and append it to the URL.
¥ You dont need to escape the return value coming back to the LV object. You can send a plain string if you like. However, you can set the LoadVars.parseVarString to true, and you can pass in a string like “myVar=This is the ver&myvar2=This is the secondvar.” You don’t need to encode the string, but if you do it will decode it.
¥ the return value is always accepted by the same LV object. In flash, you can specify a target object..that is not used here.
¥ only string or number datatypes may be used.
¥ getBytesLoaded/getBytesTotal aren’t implemented.
¥ there is a LoadVars.onLoadError method you can use to handle situations such as document not found.
You can test it out here.
You can grab the source files here.
Posted by flashape at 05:05 PM | Comments (1)
DOM-scripting
Apr 22nd
been starting to get into some javascripting lately (seems to make more sense to call it DOM-scripting, since you are pretty much always working with the Document Object Model, or DOM for short). It’s pretty cool the way you can dynamiclly add and remove content easily from the html page. And since javascript and Actionscript are so closely related, anyone comfortable with AS should easily be able to pick it up quickly. While looking around to find some info about it, I found a great little resource site: QuirksMode has some awesome info on javascript, the DOM, CSS and more. It’s mostly geared toward the the novice and those seeking more information on the basics and background of js, the dom, and css.
I know there’s a lot more like this out there, if anyone cares to share just drop a comment.
Posted by flashape at 11:10 AM | Comments (7)
Cake PHP framework
Apr 20th
Just saw this post over at Digital Media Minute about something called Cake, a PHP web application framework. I have to say after checking it out I’m really excited about it…I hope this sticks around and matures. I wonder how/if this would relate to using AMFPHP?
–update: After reading this post again, i realized how much of a TOTAL FREAKING GEEK i am for getting “really excited” about a php application framework…i love it though!!
Posted by flashape at 01:53 PM | Comments (2)
April 05, 2005
copy directory in php
While trying to figure out how to copy an entire directory to a new location (on the same web server) in php, I came across this function. I took that as a base and modified it to handle premissons better:
function copyr($source, $dest){
// Simple copy for a file
if (is_file($source)) {
$c = copy($source, $dest);
chmod($dest, 0777);
return $c;
}
// Make destination directory
if (!is_dir($dest)) {
$oldumask = umask(0);
mkdir($dest, 0777);
umask($oldumask);
}
// Loop through the folder
$dir = dir($source);
while (false !== $entry = $dir->read()) {
// Skip pointers
if ($entry ‘.’ || $entry ‘..’) {
continue;
}
// Deep copy directories
if ($dest !== “$source/$entry”) {
copyr(“$source/$entry”, “$dest/$entry”);
}
}
// Clean up
$dir->close();
return true;
}
PHP XPath
Apr 4th
Many flash developers are now using XPath in AS2, which is cool. I was working on a project the other day that was going to require some server-side manipulating of an XML document…so I did a searcha nd lo and behold, XPath in PHP does exist! (and already on version 3.5!)