Archive for the 'Golden Nuggets' Category

Open online graphics directly in Illustrator and Photoshop

Illustrator and Photoshop can open files directly from the web

Did you know that it's possible to open a graphic file directly from the web using Illustrator and Photoshop?

Just to see what would happen, I put in a URL to an SVG file in the Open dialog in Illustrator CS2. Guess what? It just downloaded and displayed the darn thing! Sweet!

The same thing works in Photoshop CS2 with graphic files that it recognizes (jpg, png, gif, etc.) No more having to right-click and save files from the web.

The Open Clipart Library has public domain vector graphicsJust make sure you know what license a graphic is under before using it.

OpenClipArt.org, for example, has a nice selection of images that have all been released into the public domain via the Creative Commons Public Domain Dedication.

Skyp’s Lust for Port 80 Revealed

Up until recently, I had no trouble running Apache on my development machine. Then, one day, seemingly out-of-the-blue, Apache started complaining that it could not bind to port 80. This one almost drove me crazy until I found out Skype was grabbing the port and being very stingy with it. In case you have Skype running and Apache won't start, exit Skype, run Apache and then run Skype. (If Apache already has port 80, Skype doesn't complain.)

How to never lose any work ever again

We've all done it: Lost work. And as much as we'd like to blame the freak power cut at 1am, the "stupid application" for "crashing again" or the "heap of junk" that is our computer, the blame really rests with us: Quite possibly with our choice of software applications or hardware but, more than likely, with our work habits. Continue reading 'How to never lose any work ever again'

Utilizing your ActionScript knowledge to Script Windows (and backing up your sites while you’re at it!)

As part of reviving the What Is Flash Wiki, I restarted the scheduled automatic daily backups of the database from the web server to my local backup machine and thought it would be nice to share with you how I achieve this as it involves JScript for scripting Windows and JScript is a close cousin of ActionScript (they are both based on the latest ECMAScript specs.)

Update: If you're looking to do the same thing on OS X, Mike Chambers has a great post on Shell Scripting on OS X with ECMA / JavaScript

On a hugely dynamic site such as a Wiki or forum, it is very important to have constant backups of the database to protect against data loss. On a busy site with lots of updates, losing even a day of data is not good but it's worse if that becomes two or three days or a week! The way the What Is Flash server is set up, you can hit a certain URL (with proper authorization) to download backups of the site or of the various databases that it uses. What is needed is a script file that hits these URLs and does so on a daily basis, archiving the backups on the local machine. Enter the Scheduled Tasks scheduler and Windows Scripting.

If you're on Windows, there's very little you cannot automate using the Scheduled Tasks scheduler and Windows Scripting Host WSH).

Here are three of the best references I could find on them:

To download the backups, I've written a script in JSCript that creates a directory with the current date as its name (in the form YYYY-MM-DD). It then goes and gets the latest backups for that day from the site and saves them locally in the newly-created directory. In order to access the site, I use Lynx, a powerful text-only browser famous in the Linux/Unix world. You cannot use IE for this since IE doesn't support the type of command line arguments that Lynx does. (You can also use CURL and a Cron job for this and it may more sense for you to do so if you're on a Unix-based system.)

The following script illustrates how it works (you need to have the Lynx.bat file -- see the Lynx installation instructions to know what I'm talking about -- in the current directory and substitute your own URL in the script here.

If you save the script as some_script.js, you can run it from the command line using wscript some_script.js. If you now add this to the Scheduled Tasks (Start->Programs->Accesories->System Tools->Scheduled Tasks and then double-click to launch the Add Scheduled Task Wizard) you can have it execute automatically at a specified time interval (eg. every day.)

Scripting Windows using JScript is a piece of cake if you know ActionScript and can give you complete control over your system. Coupled with the Windows Task Scheduler, you can automate things too.

Goodbye CVS!

Ever had to manually go through a large project and delete all the CVS folders in it because you didn't export it and the module no longer exists in CVS? If all you have is a workspace copy and you want to add it back to CVS (perhaps a different CVS server), then you can either painstakingly delete the CVS folders manually or you can buy me a beer as thanks for this little nugget:

FOR /r /d %D in (CVS*) do @rmdir /q /s "%D"

In Windows, go to the root directory of your project, enter the line above into the command prompt and all your CVS directories will be gone :) (Disclaimer: Be careful with wildcard deletes like this -- double check that you've entered it correctly, that you're in the right directory and that you have no other directories that begin with "CVS". Don't come banging at my door if you accidentally wipe out your hard-drive!)

Of course, the best thing is never to get into these situations. You can easily use a tool like Tortoise CVS (or the command line) to Export a copy of your project without the CVS directories.

Using Macromedia’s AS1 Flash Remoting with Forms/AS2 in Flash MX 2004 Professional

There was a post on Flashcoders today by Craig Earls, wherein he states "I am having a very difficult time getting remoting to work in an AS 2.0 class."

Brian LeRoux responded that "it's because MM doesn't yet support ActionScript 2 for
Remoting. Only ActionScript 1 . . . You can download either Joey Lotts' [AS2] port of AS1 Remoting or Justin Watkins'. I've used both and both work just fine."

Additionally, there is a nice tutorial on flash-db on using Justin's Remoting Connector for Flash MX 2004 (the examples there use amfphp but are equally applicable to Flash Remoting and OpenAMF.)

Although, reportedly, the community AS2/connector solutions work well, we haven't had the time to test them out completely and are not currently using either of them at Bits And Pixels. Instead, we've devised a simple solution that allows us to use the "official" AS2-compatible Netservices classes from Macromedia as we await the official AS2 release. Our solution was to load the includes using a dynamic class, which, in its briefest form, looks like this:

dynamic class com.ariaware.arp.remoting.Includes
{
    public static function getInstance ()
    {
        #include "NetServices.as"
        #include "NetDebug.as"
    }
}

For the inquisitive of mind, Ariaware is the name of a service that we are going to be launching very soon and ARP stands for Ariaware RIA Platform, our internal RIA framework. Not shown here, the Includes class is actually implemented as a Singleton.

In order to use our includes, we simply call them from the onLoad method of our main Application form as thus:

class com.ariaware.sampleApp.view.Application extends mx.screens.Form
{
    function Application ()
    {
        // We don't do anything in the constructor that involves child
        // components or screens (forms) since none of these have initialized
        // yet. Instead we carry out all such actions in the onLoad() event
        // handler. 

        // Listen for the onLoad event
        addEventListener ("onLoad", this);

	// stop the timeline
	stop();
    }

    public function onLoad ()
    {
        // Do other stuff...

        // Load remoting
        com.ariaware.arp.remoting.Includes.getInstance();

        // More stuff...
    }
}

Ok, I lied, actually we load the AS1 Netservices classes by getting an instance of our GatewayConnection singleton, but I didn't want to complicate this example any further. This, in a nutshell, is a quick way to use the current official remoting classes with AS2 and forms.

It is puzzling why it is taking Macromedia so long to release the official AS2 version of Flash Remoting, given that the community has had enough time to release not one but two versions. Macromedia has announced the release, which leads me to believe that they will not be taking the alternative route, which would involve endorsing one of the current open solutions. I cannot help but think that not having an official and/or endorsed AS2/forms version of Flash Remoting is hurting the status of Flash Remoting as a supported Macromedia technology. That said, if the release is delayed further, we will probably end up going with Justin's solution in future projects and perhaps it will be up to the community itself to endorse and support this solution.

Application Icons

What would we do without icons? Chances are you cannot glance around your screen at any given moment without spotting one of these bold little creatures staring back at you with that begging "click me" look that we all know only too well. They're everywhere! Lined up on toolbars, peering out from within menus, sunbathing on buttons... No surprise, then, that they are good friends to have if you build RIAs. Therein lies the rub: These little critters are also notoriously difficult to create in both an aesthetically pleasing and functional manner. Fear not, however, since all hope does not rest solely on hiring one of a handful of expert icon designers to recreate the wheel for your next application (although, depending on your business domain, that may just be the most efficient, and economic, route to take for your project.) Enter, icon libraries.

As creating icons is a difficult art, finding a quality icon library suitable for use in a professional RIA is all that much harder. That is why, dear reader, I have a feeling that you are about to send some very warm karma my way. Here are two icon libraries that should fit the bill:

The first, I can vouch for fully. We used it in building the interface for Opal, our latest Rich Internet Application for Telrock Communications. As we were working in Flash MX for this project, the icons required some simple manual alterations due to the bitmap shifting bug in Flash MX.

The latter, I have only recently become aware of and have not used in production as of yet. From the look of the icons in the catalog, however, I believe we may soon do just that.

We also have a couple of aces up our sleeves over at Bits regarding some new tools we'll be releasing in the near future that should make it very easy for you to create RIAs with beautiful professional icons! :)






Bad Behavior has blocked 0 access attempts in the last 7 days.