Heaven Interactive Coding :: Creative :: Consulting :: Pure Energy 2008-05-27T09:12:08Z WordPress http://www.heaveninteractive.com/weblog/feed/atom/ Jay Harley http://www.heaveninteractive.com <![CDATA[Wordpress Blog Header Slowness Problem Fix]]> http://www.heaveninteractive.com/weblog/2008/05/27/wordpress-blog-header-slowness-problem-fix/ 2008-05-27T09:12:08Z 2008-05-27T09:10:42Z Yes the blog header, when included in other pages (non-wordpress pages) can REALLY slow down your page loading.

However, the problem was not what I thought it was — the system querying the database for the WP configuration information, and then subsequently executing my own scripts. It always seemed just a little TOO slow for this to be the problem.

In another (what I thought was unrelated) search, I was looking for why I was getting 404 headers being served from all of my pages, that were non-wordpress, but included that pesky wp-blog-header.php file.

Turns out that the old wp-blog-header is a freakin megalomaniac. It wants everything. It was the one sending 404 headers out for my pages that were non-wordpress. This effectively killed my google indexing for pages.

On top of that, it WAS SLOWING THE SYSTEM DOWN when rendering that header, doing extra processing.

Now that that is fixed, my non-wordpress pages render about 3 times as fast.

Hallelujah, Praise be to Allah Krishna Jesus and the cast of ‘That 70s Show’.

Here is a link I found detailing a good fix:

http://trac.wordpress.org/ticket/2984

and thanks to these dudes for telling me about it!

Basically the code, in whatever file that includes the header, should look like something like this (mind the paths):

<?php
define(’WP_USE_THEMES’, false) ;
require(’../../../wp-blog-header.php’); // i’m in wp-content/themes/js.php
header(”HTTP/1.1 200 OK”); // else we get 404
header(”Status: 200 All rosy”) ; // what should this really say?
?>

]]>
Jay Harley http://www.heaveninteractive.com <![CDATA[Making a Copy of a Wordpress Installation for Development Purposes]]> http://www.heaveninteractive.com/weblog/2008/04/16/making-a-copy-of-a-wordpress-installation-for-development-purposes/ 2008-04-17T08:20:52Z 2008-04-17T05:08:21Z I am pretty much addicted to WordPress. It is simply my favorite development platform. It’s open source, it’s PHP and MySQL, and things just work out of the box. Well.

If you are running live WordPress installations, you may come to a point where you need to make an actual copy of your existing WordPress installation on the same server. I could not find this procedure documented on the WordPress.org site (I did find moving and upgrading, but not copying).

In this case the procedure is pretty straightforward. Here is an overview of what needs to be done:

  • Make a new folder inside of your web root.
  • Copy your WP files there (but don’t open anything in a web browser yet.)
  • Create a new database for your blog copy.
  • Edit the wp-config.php file in your new copy to reflect your new database and login credentials.
  • Update the “wp-options” table in your DB to reflect your new site location.

I found this tutorial online which shows you how to do it from the command line. You will need some basic UNIX skills, but this way really is quick and easy. Especially if you are running on a virtual dedicated or dedicated server.

The tutorial is written for copying to a local installation on Ubuntu. But you can modify it for copying within your server. You will not necessarily need to setup the alias in the conf.d/ directory or enable mod_rewrite as most likely you will already have these elements installed correctly. Other than that it translates very easily.

Since I use GoDaddy Virtual Dedicated Hosting, it’s pretty freakin’ simple to work with multiple WordPress installations, domains, databases, and files. Just get a shell and every file, folder, as well as MySQL is accessible from the command line. It’s the joy of Linux and the joy of webmastering.

Happy Blogging!

Make a Backup Copy of your Production Wordpress Blog on Ubuntu

]]>
Jay Harley http://www.heaveninteractive.com <![CDATA[The Merits of a Virtual Dedicated Server and Why You Might Need One]]> http://www.heaveninteractive.com/weblog/2008/04/04/the-merits-of-a-virtual-dedicated-server-and-why-you-might-need-one/ 2008-04-05T00:27:06Z 2008-04-04T23:39:17Z I’m really enamored with my virtual dedicated server account with GoDaddy.com. It’s pretty invaluable and really makes my life much easier as a developer and a content producer. Interactive websites really need a core back-end that’s flexible and can do what you want / need, without requiring phone calls to tech support to get various ‘permissions’ or essential software installed. If you have any strain of the ‘do-it-yourself’ gene that I have, you know that it’s awesome to be in control of your own ‘virtual presence’ as much as possible, at an affordable price.

I really dislike calling tech support. It’s just not in my blood. I’m very happy that I have it (it makes me feel very secure, thank you), and if I was a newbie, I would probably use it more. Myself, I just like things to run, and run smoothly. Just keep going without any hangups and everything will be fine. I know a decent amount of Unix and I can find my way around the terminal from OS X (my OS) or Putty on Windows, so being able to just SSH into my system is essential. I call it “my system”, because A VDS is really a platform in itself; and if you are running multiple websites or interactive applications you will definitely need a platform that gives you access to the computing and networking power of the server itself. Sure, lots of shared hosting accounts offer SSH, but it’s usually limited, and of course you can’t get root access, or really install any scripts that use up resources constantly. What if I want to install a Perl chat server, or a Java multi-player game server for Flash? Trick out my PHP installation with new modules? What if I need to work with sockets? Even if I am just prototyping something for myself or a client, having my own VDS just makes it so easy, and I don’t need any one’s permission to go crazy on my own server. It’s my world! Woohoo.

What is a Virtual Dedicated Server?

A virtual dedicated server is basically a partition on a server which is running its own instance of an operating system. A VDS server can be rebooted and managed separately, making it independent from other virtual servers. A VDS can offer a performance level substantially higher than shared hosting, as well as root access and static IP addresses.

Safety Net

The good thing about having a VDS account with GoDaddy is that it’s “managed”, by their system administrators, to a degree. Yes you get root access, but if you really screw things up in a big way, you can always call the aforementioned tech support people and have them reset, reboot, or try to help with your problem. That is a great thing about GoDaddy – they don’t really have to clean up your messes for you, but they will try to give you as much help as possible, because they want your business. You can call them anytime and they will try to sort you out. That means a lot to me, and that’s why I’m sticking with them.

Handling Multiple Domains and Users

When you work with a VDS, you can handle multiple domains very easily, compared to shared hosting. Every domain really is its own entity, not just an aliased folder in your public_html directory. Each website has it’s own true directory structure, with a private/ directory and cgi-bin of its own. Also, each domain will have its own users (shell and FTP), which will give you the ability to handle a big organization’s hosting needs, with every one only being able to see what they need, without exposing the rest of your files.

Run Anything

As mentioned, with a VDS, you can run anything on your server. This is HUGE, if you are creating multimedia apps. I am basically a Flash (ActionScript 3.0) developer working with a lot of PHP / MySQL. However, I often need to add modules to my core system, especially Unix apps that handle .Mp3s and streaming (like Icecast and Ices, getid3, etc), or libraries for processing images or video on the server. I then hook these into Flash through PHP, Perl, Java, XML, or some combination of these. I set up a few cron jobs and init.d scripts, and suddenly I am running an extended back-end, much bigger than I expected at first.. It’s impossible to do this on shared hosting , but if you want to play with the big kids, then VDS will allow you to do it. You can tie in your apps with web services already out there, like Flickr, Amazon, Facebook, etc., making your computing / multi-media power “virtually” unlimited (no pun intended).

Super Responsive

My VDS is quite ‘fast’, from a response standpoint. Even though VDS servers are actually partitions of a bigger server, because of virtualization, when you use a VDS, you are getting your own set of resources. This means that other partitions on the main server can be overloaded, but this will really not affect you – your sites will keep cruising along as fast as your scripts allow. This is so much better than shared hosting where your traffic can see a big drop because of bad programming, or your scripts will end up executing slowly because someone is running resource-hogging scripts. This doesn’t happen on a VDS.

Simple Control Panel

I am not a big fan of those overloaded control panels that some hosting companies offer. They are generally too many graphics, and too many page refreshes for my liking. If I just want to create a database, why do I need to go through 5 screens to make it happen? With my particular VDS account, I get a ‘Simple Control Panel’ which gives me everything I need, without bloat.

Simple Control Panel Screenshot

Plenty of Benefits

There are other things I like about my VDS, but too many to mention here. I’ll summarize some with bullet points:

  • Root Access – Basically gives you complete control of your server, giving you the lowest-level access available
  • Unlimited Databases and Command Line Management of Them
  • Total Control Over Cron Jobs
  • Abiliy to Reboot Your Server When You Want
  • Unlimited User / FTP Accounts
  • Run Java / C++ / Perl Socket programs — Woohoo!
  • Lots More

In short, if you are an interactive designer or developer, and you are still running shared hosting, you will probably need to step it up at some point. When you do, consider a VDS account that gives you the flexibility you need. Oh, and you might want to learn just a little bit of UNIX – it will go a long way. Happy scripting.

Links

GoDaddy Virtual Dedicated Servers

More About Virtual Dedicated Servers

]]>
Jay Harley http://www.heaveninteractive.com <![CDATA[Loading an external .jpg, .png, or .gif bitmap image file in ActionScript 3.0]]> http://www.heaveninteractive.com/weblog/2008/03/28/loading-an-external-jpg-png-or-gif-file-in-actionscript-30/ 2008-04-02T08:18:43Z 2008-03-28T08:53:37Z In AS3, loading external images dynamically is done slightly differently than in ActionScript 2. Whereas in AS2, we could just use the loadMovie() method of the MovieClip class, this is no longer the case.

(Download the files for this tutorial.
You will also need: Flash CS3. Download Trial or Buy Now.)

Instead we have to use the Loader class, as well as the URLRequest class. This actually gives us more flexibility when loading external images, because of the various events of the Loader object that we can create event listeners for.

Let’s say that we a .swf file called “main.swf”, a document class file called “Main.as”, and a .jpg file called “thePic.jpg” in a directory called “images/”. (If you are not yet familar with the document class, please see this tutorial).

Our directory structure would look like the following (click to expand):

picture-7.png

In order to load the .jpg into our file, we first need to import the correct classes into our scope. We will require the URLRequest and Loader classes, and also, we’ll go ahead and import the “events” package, since it is often good practice to have all of the events handy.

The Code

Here is our code for the Main.as file so far:


package {
	import flash.display.MovieClip;
	import flash.display.Loader;
        import flash.events.*;
	import flash.net.URLRequest;

Next, we’ll go ahead and make our constructor, a function called Main(). Inside our constructor we will create:

  1. A Loader object, called imageLoader;
  2. A URLRequest object, called imageRequest.

We will pass the path to our bitmap image (which should be a .gif, .jpg, or .png file), to the URLRequest() constructor. In our case it will be a .jpg.

package {

     import flash.display.MovieClip;
     import flash.display.Loader;
     import flash.events.*;
     import flash.net.URLRequest;

	public class Main extends MovieClip {

		public function Main() {

		var imageLoader:Loader = new Loader();

		var theURL:String = "images/thePic.jpg";

		var imageRequest = new URLRequest(theURL);

Next, we will add the all-important event listener. As you should now be aware, interactivity is all about events (so you should get to know your event listener syntax :) ). Please note here, that we are not adding the event listener directly to the Loader object, we are passing it to one of its properties, its contentLoaderInfo object. For more about the contentLoaderInfo class, see the Adobe docs here. This object will trigger an event called “COMPLETE” when everything is loaded, so this is what we will listen for. To this event we assign the listener onComplete(), to be defined later (see below).

After the event listener is set, we then call the load() method of the Loader() object that we have instantiated as imageLoader.

Lastly, placing the image on stage is handled by our (nested) function called onComplete(). It does the work of adding our newly loaded DisplayObject instance (in this case the content property of a Loader object) to the display list using addChild(). The complete constructor function is below:


public function Main() {

     var imageLoader:Loader = new Loader();
     var theURL:String = "images/thePic.jpg";
     var imageRequest = new URLRequest(theURL);

     imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);

     imageLoader.load(imageRequest);

     function onComplete(evt:Event) {

          addChild(imageLoader.content);

     }

}

Notice the line:

addChild(imageLoader.content);

The content property of the Loader object is used here because it actually contains our image. If we want to manipulate it as a Bitmap however, we will have to cast it to the correct data type (not covered in this tutorial).

Don’t Forget to Unload the Image When You are Done With It

The title of this section says it all. You should use the removeChild() method of the DisplayObjectContainer that the object belongs to (in this case our main timeline), as well as the Loader.unload() method to remove all references to the loaded image. (Unless you want to keep the bitmap in memory of course). Once there are no remaining references, our good friend the garbage collector will remove the bitmap from memory.

And that concludes this tutorial. I hope you enjoyed it. Ciao and happy ActionScripting!

]]>
Jay Harley http://www.heaveninteractive.com <![CDATA[Book Review: Essential ActionScript 3.0 by Colin Moock]]> http://www.heaveninteractive.com/weblog/2008/03/22/book-review-essential-actionscript-30-by-colin-moock/ 2008-03-23T07:31:39Z 2008-03-23T07:13:13Z Essential ActionScript 3.0 (Essential) (Essential)

The world of interactive development has grown immensely in the past few years, due to the increases in processing power, the emergence of social networking, the proliferation of web video, and the very real demands of web users for more, well, interactive experiences – whether they be on a desktop or mobile device, online or off-line. With all of this demand and the rise of available creative tools on the market, we can say that, now more than ever, it’s a wonderful time to be a Flash developer.

Along with the proliferation of so many Flash applications and the ubiquity of the Flash player across platforms, however, knowledge of ActionScript becomes increasingly important. The would-be interactive guru simply must possess a strong grasp of web and application flow concepts, and a real ability to put these ideas into action using code.

To provide this very knowledge, author Colin Moock has given us his book, Essential ActionScript 3.0. With over 800 pages of useful information about the nuances of the AS3 language, this book certainly gives the reader a solid foundation of the latest version of Adobe’s scripting language for Flash and Flex.

Although this volume is aimed at all levels of Flash developers and designers, beginners will find that a substantial investment in time will be necessary for absorption of the material covered. The efforts of a novice ActionScripter will certainly be rewarded however, once the methods given are put into practice. Unlike ActionScript 2.0 and Flash 8, it’s just not possible to ‘wing it’ when writing scripts. Clients and users require interfaces which are designed and executed from the ground up to be usable, intuitive, and responsive. There are a lot of nuances which must be understood when working with the Flash player such as mouse input, keyboard input and focus, and the display list. We also need to understand the power of the garbage collection process (which Colin covers in detail) so that elements can be removed from memory (keeping our playback and loading of objects smooth).

So in the sense of covering the basics and more, this book is indispensable. Following are a list of highlights:

Chapter 1: Core Concepts

This chapter will be of most use to those new to scripting in general. The author discusses variables, literals, syntax, and compilation, as well as core object-oriented programming (OOP) principles. This is a light read for a lot of experienced developers, but if you are new to the Flash player (coming over from Java) it is very useful.

Chapter 5: Functions

Since every ‘web’ or ‘interactive’ scripting language has its own peculiar implementation of functions and methods, this is a very important chapter to read thoroughly. You can also learn about nested functions here, which are a wonderful feature of AS3 (I love them). He also covers ‘functions as values’, as we often find ourselves passing around functions between classes and .swf files in ActionScript 3.0

Chapter 6: Inheritance

This chapter is an absolute must-read even if you are somewhat experienced with OOP, as display list programming is all about inheritance and you will find yourself extending the Movie Clip and Sprite classes, as well as others like Bitmap.

Chapter 12: Events and Event Handling

Interactive content is all about events, and you will spend loads of time writing event handlers. This chapter will save you time and show you the AS3 improvements (which are many) over the AS2 model.

Chapter 20: The Display API and the Display List

The Display List is all new in AS3, so to take advantage of this functionality, you need to get to know it. Movie Clips are just part of a bigger picture now, so if you’re coming from AS2 you have to get at least this far in the book to make things really happen.

Conclusion

Designers and developers moving to AS3 and Flash CS3 or Flex from previous versions of ActionScript will find this book to be an invaluable resource and a great investment. You will find it pretty easy to make the transition to AS3 – if you take the time to study and work with the examples that is. The only criticism I have for this book is that it is not quite as easy for beginners to ‘jump start’ their way into AS3. If you are a complete ActionScript novice, this book might be slightly over your head at first, so you will find it to be a bit of a learning curve to get up to speed. (True beginners might want to look at Learning ActionScript 3.0 by Rich Shupe and Zevan Rosser.) All in all, I highly recommend Essential ActionScript 3.0 as a complete primer, how-to, and reference on the language. Happy scripting!

More Reviews on Amazon.com

]]>
Jay Harley http://www.heaveninteractive.com <![CDATA[Recommended ActionScript 3.0 Books]]> http://www.heaveninteractive.com/weblog/2008/03/17/recommended-actionscript-30-books/ 2008-04-17T08:33:08Z 2008-03-18T00:49:12Z I have been asked to recommend some ActionScript 3 books by students in the past. Below is a list of what I consider to be the best resources available right now. Enjoy!

Learning ActionScript 3.0 in particular is an excellent tool for novice scripters who are starting with AS3 as their first language. For experienced AS2 developers, Essential ActionScript 3.0 is really a complete learning tool and development resource that will not leave your bookshelf for some time.


]]>
Jay Harley http://www.heaveninteractive.com <![CDATA[Using ActionScript 3.0 with PHP Part 1: Loading External Variables]]> http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/ 2008-04-05T00:25:50Z 2008-03-17T23:23:32Z Creating dynamic websites which combine the power of Flash or Flex with PHP is easier than ever with ActionScript 3.0.. Utilizing the networking power of the Flash player we can create next-generation user interfaces which go well beyond static web pages or simple animations and instead act as the front-end for powerful applications. These applications can interface with databases and web services, giving us the ability to add new features, create ‘mash-ups’, or previously unheard-of platforms for user interaction. The sky is the limit! So let’s get started.

Server Requirements

If you are creating web applications which run Flash and PHP obviously your server needs to have PHP installed. If you plan on creating many dynamic sites or applications going forward, you will probably want server space which allows for unlimited databases, has PHP5 and MySQL, and gives you the ability to install programs on the web server. If you are using shared hosting, that is fine, but keep in mind that you will probably want to go with a Virtual Dedicated solution at some point, simply because of the flexibility and responsiveness you receive from having your “own” server. For a virtual dedicated server I personally use GoDaddy, (see my article here about VDS), as I now have unlimited domains, unlimited databases, and root access to my server, so I can do a bit of shell scripting now and again. On top of that it is super-responsive which is really important for creating Flash applications which utilize networking. Otherwise if you want to pay less but still want unlimited domains and a fairly responsive system, I would go with Blue Host in North America or 1 and 1 for Europe (or other regions), and a shared hosting plan. I have experience with all three of these companies and the support is certainly top-notch.

Communicating with a Web Server

Let’s discuss three ways in which we might send data back and forth between a web server and Flash. These are by no means the only ways to do so, but they are fairly common, and you will find them to be popular ways to accomplish networking tasks.

Using GET or POST and Variables

If you are used to working with HTML front-ends and PHP (or another scripting language), this will be familiar to you. Using the GET or POST method, you can send and receive data from server-side scripts. In this scenario, we often output our data in some sort of url-encoded string, which contains variable “name and value” pairs. This is the method we will cover in this article.

Using XML

XML is one of the most important languages for communication between application, servers, and services on the Internet. One good reason to work with XML for loading data from a web server is that you will generally not have to know how the data is being processed, you will just have to know something about the particular XML formatting being used, so that you can process the data.

Using Flash Remoting

For more sophisticated integration with a server, you may want to utilize Flash remoting. If you are using Flex, you may work with Flex Data Services. If you would like an open-source solution, you might want to look into AMFPHP. We will not cover Flash remoting in this series.

Loading Variables

The first thing we will do is use GET to load variables from a PHP script. We will create a simple PHP document, called “dataLayer.php”. This page will act as our main communicator between our server and Flash.

File: dataLayer.php

<?php
$returnVars = array();
$returnVars['username'] = "John Doe";
$returnVars['email'] = "johndoe@hotmail.com";
$returnString = http_build_query($returnVars);

//send variables back to Flash
echo $returnString;

?>

So here we have our data layer. It consists of two variables: username and email. These variables are encoded using the http_build_query() function to send a properly formatted, compliant variable set from the server. Notice that this function takes an array as a parameter. It then just builds out of string in the format of name / value pairs, like so “varname=value&varname2=value”. It’s very handy.

Next, we will instruct the Flash player to load this data so that we can work with it.

Loading the Variables into Flash

Now let’s write some ActionScript to load our variables into Flash. We will do this in a document class which will be the main point of entry for our Flash movie. (If you are not familiar with the document class, see my tutorial here). Our document class will be called “Main.as” and we will utilize it with an .fla file called “main.fla”.

Complete Main.as code below. You can also download it here: data-loader.zip

package {
import flash.display.MovieClip;
import flash.events.*;
import flash.net.*;
public class Main extends MovieClip {

public function Main()  {

// Prepare request

var request:URLRequest = new URLRequest("http://www.yourserver.com/dataLayer.php");
request.method = URLRequestMethod.GET;

var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.load(request);

function completeHandler(evt:Event) {

  var username = evt.target.data.username;
  var email = evt.target.data.email;

  trace ('username is ' + username);

  trace ('email is ' + email);

}

}

}

}

You will want to replace the path (”http://www.yourserver.com/”) with your actual server and directory.

This code is very simple. You will see that we have imported appropriate classes for working with networking, and that our class (being the document class) extends MovieClip.

The first part of our constructor class prepares a request, and it uses the GET method to do so. Here we make an instance of the URLRequest object, passing it the actual web path to our php file.

var request:URLRequest = new URLRequest("http://www.yourserver.com/dataLayer.php");
request.method = URLRequestMethod.GET;

We then make a URLLoader object, specifying its dataFormat property to be “VARIABLES”. This will ensure that we can bring the variables output by PHP into Flash using the same names, and those variables can easily integrate into the scope of our Flash movie.

var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;

Next we define an event handler, which is key for handling the loading of the variables. We are listening for the “COMPLETE” event, which is an event thrown by the URLLoader object that we just created. Notice that we define a handler, called completeHandler, which will do the work of processing our variables for us. This event handler will take the form of a “nested” function – a new feature in ActionScript 3 which allows us to place functions inside of functions. (I love this). After we define a handler, we then call the load() method of the URLLoader object, passing it the request objet.

loader.addEventListener(Event.COMPLETE, completeHandler);
loader.load(request);

Our completeHandler() function does the work of getting our variables from the COMPLETE event. We created a parameter called “evt”, which is populated by the event object itself when this function is called. We get the variables from PHP using the “evt” object and the following syntax: “evt.target.data.variableName“. This allows us to specify the exact variable we want to access. Lastly, we trace this data to the output window.


function completeHandler(evt:Event) {

  var username = evt.target.data.username;
  var email = evt.target.data.email;
  trace ('username is ' + username);
  trace ('email is ' + email);

}

And that’s it! This is a very simple example, but it should get you going with getting data from your PHP scripts into Flash. Obviously there is a lot more to learn about communicating with a server from Flash, but in any case, AS3 makes it simple! In the next tutorial we will talk about sending and receiving data using POST. Good luck!

]]>
Jay Harley http://www.heaveninteractive.com <![CDATA[FTP Tutorial - What is it and How do I Use It? (Windows and Mac)]]> http://www.heaveninteractive.com/weblog/2008/03/07/ftp-tutorial-what-it-is-and-how-to-use-it/ 2008-04-04T07:18:37Z 2008-03-07T09:52:51Z This step-by-step tutorial is aimed at aspiring (and new) web designers or web content publishers who would like to understand one of the most important technologies in use on the World Wide Web: File Transfer Protocol, or FTP.

Why Should I Learn FTP?

Practical knowledge of FTP is essential for just about anyone who wants to update actual HTML pages or other files, which will reside on a web server. Typical users of FTP include web designers, Flash designers, webmasters, system administrators, new media Public Relations professionals, and especially web programmers. Even though there are an abundance of tools to update website content without doing any programming (such as WordPress), you will probably need to transfer some files using FTP software at some point, whether it be to install plug-ins, transferring files to another person or organization, editing templates, or doing actual hand-coding of web pages (which I highly recommend! :) )

How Long Will it Take To Learn It?

Good news - not long at all! I suggest you spend at least good ten minutes on the basic concepts of FTP. Then, if you don’t have one already, you will need to get an FTP client (suggestions below), which you can download from the Web. Next, assuming that you (or your organization) has some type of web server account to transfer your files to, you will be able to upload or download in no time! (Now would be a good time to make a cup of that favorite home or office beverage.) OK, let’s get started.

What is FTP?

FTP stands for File Transfer Protocol. Basically it is a method we employ to “transfer”, or send and receive, files between computers. It can be used between any two computers that have FTP software running on them, whether its your laptop and someone’s desktop in the same room, or your laptop and a web server in another part of the world. The word protocol is used because the computers have to have some standard of doing this communication; they both need to follow the same protocol to make it happen.

FTP has been the standard for transferring files to a web server for many years now, and we expect it to continue to be in the future.

What do I need to Use It?

To use FTP you need some type of software, referred to as an FTP client, which will allow you to send files to other computers, as well as receive files from other computers. If you are working with web sites, the computers that you will send files to will most likely be called ‘web servers.’

You will also need a web hosting account. (Tip: If you are looking for dependable and affordable web hosting, you might want to try Omnis or Blue Host. Generally any hosting account will come with FTP instructions on how to connect to a particular web server (just make sure you are able to contact support when you need them).

So again, you need an FTP client, which you need to install on your computer. There are many FTP clients out there, ranging from the free (or shareware), to commercial full-fledged web design software. Below is a short list of FTP clients that I find useful for both Mac and PC, and links to download them – you can skip this section if you already have an FTP client on your computer.

FTP Clients (Short List) - Macintosh

Free

Cyberduck - Cyberduck is a free, no-nonsense, open source FTP client that is very easy to use. It allows you to maintain ‘bookmarks’, or favorites that you can connect to with one-click, once you have the details setup. Cyberduck is overall a fairly responsive application and a great value (free!). However, Cyberduck will not really help you to manage your websites locally or integrate into your design workflow. If you plan on designing and/or managing several sites, such as client sites or in-house sites for your organization, you will probably want to look at a commercial app. But all in all, it is worth taking the time to download, as it gets the job done and doesn’t take up much memory or processor resources.

Commercial


Fetch - Fetch has more features than Cyberduck that you may find appealing down the road, such as support for archived files (.zip, etc), as well as the ability to edit text files right on the server (this can be very handy). It also integrates very well with OS X by including a dashboard widget and Automator and AppleScript support. Fetch is definitely ‘battle-tested’ in the world of FTP and is a good value (only $25 at time of writing). If you use FTP a good deal, you won’t go wrong with Fetch.

Dreamweaver CS3 - If you are a web designer or producer who needs a complete solution for web publishing, including visual editing of HTML files, drag-and-drop menus, multiple language support, CSS editing, automatic code writing, and ease of use with Photoshop, Flash, Illustrator, Quick Time, and other file formats, you will want to take a good look at Dreamweaver CS3. One big feature of CS3 is the “Manage Sites” functionality which allows you to synchronize local and remote files (the ones on the server), so that you can update all your changes with one click, eliminating much of the repetitive nature of web site updates. This really helps with large projects.

Yes there are many software applications out there which do one thing (such as FTP) well for a lot cheaper – however in Dreamweaver you are basically getting a visual ‘web publishing studio’ in one package that can write all that messy HTML, CSS, and JavaScript for you, and allows you to automatically transfer your files to the server for easy updating. It definitely takes away a lot of the messiness of web site design. Although Dreamweaver is not only an FTP program, as a site management application it really has become a standard in the design and interactive media world.

FTP Clients (Short List) - Windows

Free or Shareware

SmartFTP - This is one of my favorite Windows “no-nonsense” FTP clients. SmartFTP is free for non-commercial use, and under $40 for a single-user license. Like Fetch and Dreamweaver, Smart FTP has remote editing of files, so that you do not have to download them to your computer to make changes — you can do them right on the server, saving you time. It also features a synchronization tool which will allow you to maintain consistency between your local and remote website, giving you some basic site management, along with some drag’n'drop support. All in all, Smart FTP is a good value and a solid Windows program.

Core FTP - Core FTP comes in a free (LE) version or a Pro version. The LE version is certainly adequate for most basic FTP needs, and it features basic site management, and the ability to drag-n-drop files between the client and server. It is also fairly no-frills and will give you what you need to get started.

Cute FTP - Cute FTP has a few more features than the average lite FTP client — it features a fairly user-friendly HTML editor so that you can edit your files without having to use an external program, as well as folder synchronization and compression. It is a step up for the other Windows FTP clients mentioned here, and a popular choice in this price range.

Dreamweaver CS3 - Still my favorite site management and web publishing tool for both Windows and Mac. See my review above for more information about Dreamweaver.

Gather Your Web Server Information

Now that you have your FTP client, you need to connect to the web server. To do this, you will need 3 pieces of information. These are:

The FTP host name

The FTP host name is usually a domain name or address that you will connect to. Some examples could be: yoursite.com, ftp.yoursite.com, or www.yourorganization.edu. The format of the name really depends on what your web host (or your system administrator) decided upon.

The FTP username

The FTP username will be the name on the user account that you will use to connect to the server. This username will go hand-in-hand with the FTP password (next section). You will have a unique username for your web server that you (or several people) will use to connect and transfer files to and from the server.

The FTP password

Your password will be given to you by your system admin or your web host, and you will need it whenever you connect to the server.

Note: A good FTP editor will allow you to save the host, username, and password for your web sites, so that you will not have to remember them when you want to connect.

Connect to the Server

Although each of the FTP clients may have slightly different menu items and appearances, the process of connecting to a web server via FTP will basically be the same. You will need to enter your hostname, username, and password to connect. Below are examples of FTP windows. Usually you will need to find a button or menu item that is labeled ‘Connect’, ‘Connect to Site’, ‘Connect to Server’, ‘New Connection’, ‘New site’, or something similar. You will eventually get a window which asks for your information. (In Dreamweaver, you can go do ‘Manage Sites’) and choose ‘New’)

Here are some visual examples of connecting via FTP:

Cyberduck — Starting a New Connection

The ‘Open Connection’ Button in Cyberduck — click this and you will the be able to enter your site details.

Where to enter host (server), username and password in Cyberduck

After you click ‘Open Connection’ in Cyberduck, you will be prompted for your FTP details. Easy!

Where to put your user information in SmartFTP

In Smart FTP, the site details are always visible in the top bar. Convenient, huh?

picture-2.png

In Dreamweaver, use the ‘Site’ pull-down option from the main menu and choose either “New Site” or “Manage Sites”

picture-16.png

In Dreamweaver, if you choose ‘New Site’, you will get a wizard which will take you through the process of adding site details (Screen 2 of wizard shown)
This is also known as ‘Basic’ view.

picture-6.png

(Dreamweaver) If you click the ‘advanced’ tab , you will be able to add your remote info directly. (Actually saves time compared to the basic method)

picture-6.png

Other Options: Port, Host Directory, Passive FTP, SFTP

When you are connecting to a server, you will often see other options, such as:

Port Number — This will generally be 21 by default, unless your web host tells you otherwise. You can generally leave this field alone.

Host Directory — This is used if you want to immediately ‘jump’ to a certain directory on your web server, and is very useful for bookmarking. You will use this feature once you get used to FTP.

Passive FTP — This will need to be used for many FTP servers, so you may need to check it to get a connection. You can ask your host if it needs to be checked.

SFTP — This means ‘Secure FTP’ and is a more secure method of sending information over the Internet than standard FTP. Unless your host tell you otherwise, you generally won’t need to use it.

Transferring Files

The last (and perhaps most important) practical knowledge you will need is to be able to transfer files between your computer and the remote computer. If you are using a good FTP client or site management tool, you will hopefully be able to ‘drag’n'drop’ files between the two. If you are transferring files that will be viewed on the web in a browser, you will generally need to transfer your files to a ‘public’ directory. This could be named anything (check with your web host or system admin), but is generally called ‘public_html’, ‘public’, ‘www’, or even ‘Sites’.

picture-9.png

I just connected to a web server using Cyberduck. Now I need to navigate into the “public_html” file to place my web files there, so they can be seen on the World Wide Web.

Using GET

Once you get this far, you should be able to copy (download) files to your computer (usually by right-clicking on a file, or dragging it to your desktop, finder, or local view in your FTP program). This is called a ‘GET’ operation in FTP parlance and is standard in FTP clients. You will often see a menu item called ‘get’ file or ‘download’ file.

Using PUT

You can usually upload by finding a ‘put’ command, or dragging into a folder on the server. If you have a good FTP client, it should be fairly intuitive.

Changing Directory

You will often need to change directories on the remote server. This will generally done in a similar fashion to browsing your local computer, by clicking (or double clicking) on folders, and using the ‘Up a directory’ method to get back to where you were.

Creating Directories

You will often need to create a directory on your web server. This is often done by going to File->New Directory, or perhaps right clicking on an item and choosing ‘New Directory,’ depending on your FTP program.

Permissions

Note that you will need correct permission to create files, upload, edit, and delete files and folders on a webserver. Depending on your access level, you should be able to change permissions to some (or all) of the web server files. This is often done by right-clicking (ctrl-click Mac) on a folder or file and choosing a ’set permissions’ option from a menu. It also often appears under the ‘File’ or ‘Edit’ main menu items. In a ‘permissions’ window, you will need to tell your server who can access that file. A permission window will often show numbers like ‘755′ or ‘555′, or contain ‘read’, ‘write’, and ‘execute’ checkboxes.

You generally do not need to change permissions unless instructed to. For example, if you are installing Word Press plug-ins, you will often need to change permissions on a directory to ‘777′, making it ‘writeable’. In this case you would check all of the boxes to make that specific directory writeable. You also often have the option of making a change to a folder ‘recursive’, which means that all folders and files inside that folder, will be affected by the change in a ‘recursive’ loop. (Neato huh?)

Below are some examples of permissions windows in Dreamweaver and Cyberduck:

picture-13.png

Setting permissions on a file in Dreamweaver, done with a right-click (ctrl-click Mac)

picture-14.png

…In Cyberduck right-click (ctrl-click Mac) and choose ‘Info’ to get to setting permissions on a file or folder.

picture-15.png

Typical “Permissions” window.

Conclusion

Well that’s it for this FTP tutorial. Hopefully you came out unscathed, or better yet, totally ‘geeked’ about FTP! Whoo hoo! You made it. I bet your coffee didn’t get even get cold.

As you can see, using FTP is not very difficult once you know the basics. You should be able to handle most, if not all, of your FTP operations with ease from this point onward. As you get used to your FTP client, you will begin to eliminate repetitive tasks, which will save you a lot of development time in the long run. Lotsa Luck!

Cheers,

Jay ;)

Links:

About FTP (Wikipedia)
Dreamweaver CS3

]]>
Jay Harley http://www.heaveninteractive.com <![CDATA[The iPhone, Flash, and Silverlight - Some Thoughts]]> http://www.heaveninteractive.com/weblog/2008/03/06/the-iphone-flash-and-silverlight-some-thoughts/ 2008-03-12T07:22:50Z 2008-03-06T16:09:31Z Apple CEO Steve Jobs’ recent comments regarding the possibility of Flash on the iPhone (summation: Flash Lite is not ready, and the Flash Player is too power-intensive), seems to have really ruffled some feathers over at Adobe. Although the two companies seem to be drifting farther and farther apart, I have to think that Adobe needs to really evaluate his statements.

In my mind, Steve has some valid points. Simply bringing the current Flash plug-in into Safari might really open a “can of worms” from a user-experience standpoint, and could actually be worse for the Flash camp. Below are some thoughts that come to mind.

Existing Flash Content Doesn’t Necessarily Translate to the iPhone

Whenever I read an on-line article (or press release) about Flash (or Flash Lite) and the iPhone, it is inevitably followed by comments from users (non-Flash evangelists) lamenting the current state of much of the Flash content on the web (annoying banners, processor-hogging transitions and overlays, distracting animations, etc). On a desktop screen with lots of available real estate, and within the scope of an informative web page, these types of elements are certainly tolerable – but on the smaller screens of personal media devices, they just seem invasive. Adobe is jonesing to get their player onto every phone possible, and marketing people see the mobile web as the next frontier for personalized advertising. However, it might be a disservice to users (remember them?) for Apple to give salivating web merchants such an immediate, direct window onto our phones without seeing some real examples of the Flash Player adding value to the user experience, and not distracting from it. I have to say I’m with Jobs on this one. I know the Adobe exchange has examples of Flash Lite that are impressive, but the iPhone is a different animal than a Nokia 60 series phone, and Jobs is smart to wait until content development evolves somewhat.

Flash Developers (and Adobe) Think the iPhone Needs Them, No One Else Does

Why is Adobe in such a hurry to get Flash Lite onto so many devices (about 450 million now, 1 billion in the future, they say)? We would think the main reason would be market share, of course. But perhaps the bigger reason for the insistence on ‘Flash Now!’ is simply the reality that looms: ‘Silverlight Later!’ Microsoft is quietly dumping a substantial amount of R&D time and money into their rich internet app platform, and we are already hearing (and seeing) reports that Silverlight is a success with developers and media providers, mainly because, as Bill Gates says, its made for todays’ Internet’. All this while Adobe is busy arguing that the iPhone needs Flash because of You Tube. You Tube? Really? The iPhone needs Flash for a port of a video playing and social networking platform? This rings pretty hollow to my ears. Videos can be played in a multitude of formats and You Tube can simply push its content in other formats, eventually if not right away, and XHTML is quite fine (and fast) in your average social-networking app. There is nothing truly essential about Flash’s use on You Tube. As my friend Jason Sangster would say, it’s time for a dose of ‘Let’s be honest with ourselves here’.

From a business standpoint, Adobe (and Flash developers) have to really showcase applications that people want to use. Why not take a page out of Microsoft’s Silverlight book, spend more time designing, researching, and developing a Flash player for the iPhone that is made from the ground up, for the modern-day Internet. If Flash is really ready to be the superstar platform that we all know it can be, why not give Jobs what he wants, and give developers something to really compete with Silverlight?

Adobe May Be Alienating Designers while Welcoming Java Developers into the Fold

I really enjoy working in Flash CS3, as well as ActionScript 3.0 As a visual person, and someone who has trained visual designers to use Flash, I enjoy working within an authoring environment with instant gratification, where I can work with symbols, as well as a stage and tools for manipulation. The analogies work, and I am used to them. Although I do most of my production with ActionScript and OOP, I enjoy using Flash much more so than Flex (which I have also worked in, and can see the immense possibilities there). Whatever the case, I am glad that AS3 has become so powerful, and that Adobe is giving us so many new tools for creating truly interactive media.

However, when I talk to designers (web or graphic), who are beginning to move into Flash development, they are usually intimidated (with good reason) by the scripting side of Flash, now more than ever. So much of the new marketing material (and training) for Flash development is geared towards Java developers and technical minds, used to thinking in abstract terms. I wonder if Adobe isn’t alienating (what used to be) a big part of its core base of users – web and graphic designers, illustrators and self-starters, moving into interactive media from other fields (such as video, print, or even music)?

I know that Adobe is certainly courting Java developers for good reason – it needs Flash to become the Rich Media platform that it can be – and it needs this sooner than later, with Silverlight looming. But in the attempt to move Flash away from its roots in simple vector graphics and banner ads to Internet applications, let’s not throw out the baby with the bathwater. People still need to be able to use Flash in order to create things, and by people, I mean not just programmers using Flex “black and gray” components.

What does this have to do with the iPhone? Perhaps some of those same creatives who have given so much to multimedia over the last ten years will invent that killer iPhone app that we’re all waiting for. Hopefully the tools will still be available for them to do so. Adobe can do a lot to make it happen, but complaining about Apple is not going to get it done.

]]>
Jay Harley http://www.heaveninteractive.com <![CDATA[Introduction to the Document Class in ActionScript 3.0 - Tutorial]]> http://www.heaveninteractive.com/weblog/2008/03/04/introduction-to-the-document-class-in-actionscript-30-tutorial/ 2008-04-02T09:10:03Z 2008-03-05T07:27:06Z ActionScript programmers who are used to working in Flash have always been encouraged to keep code out of individual frames and movie clips as much as possible. In ActionScript 2.0, this usually meant either keeping function libraries in external files (and bringing them in using #include), or creating AS2 class files. Some designers still prefer to keep their code in the first frame of an .fla file, generally avoiding code anywhere else unless the situation is unavoidable. Whatever the case, it has always been good practice to keep code out of frames as much as possible – it helps you to stay organized and keep ‘all of your ducks in a row’, so to speak.

One great feature in Flash CS3 / AS3 which I find extremely helpful in this regard is the document class. With the document class, you no longer have to write any code on the main timeline for any reason. The document class becomes the “code center” for a given .swf file, and is the first code executed whenever that .swf plays. On top of that, you get to write pure object-oriented code in your class, which can work with all the other classes within the project scope, as well as exported items in your library or named instances sitting on the stage in your .fla.

Writing the MainClass.as File

Let’s imagine I am working with a brand-spankin’ new .fla file called “Main.fla”. The first thing we will do is create the actual document class file, which will of course be an “.as” file. You can create a new .as file by going to File->New and choosing a new ‘ActionScript File.’ Let’s call the file “MainClass.as”.

I usually put my document class files in the same directory as my main .fla. Since their names are very similar you will see them in your directory file listing (Mac Finder / Windows Explorer / Bash shell, etc) easily. (Being able to find files quickly is so so very important right?). Take a look at my Finder window:

The Finder Window with files

Now I need to edit the MainClass.as file. Keep in mind that it needs to be a normal AS3 class file, including a specification of its package as well as class declaration. Here is an example of some simple code that will trace a string to the output window when we test the movie.


package {

	import flash.display.MovieClip;

	public class MainClass extends MovieClip {

		public function MainClass() {

			trace ('the main document class is ALIVE.  Hooray! ');

		}

	}

}

Notice that we made it part of the default package, and that we imported the MovieClip class using (of course) the import statement. This is important (no pun intended), because, as you can see in the next line, our MainClass extends the MovieClip class. Document classes must either extend the MovieClip or Sprite class. If they are to use animations with frames, or need the methods and functions of movie clips, they will need to extend MovieClip. Otherwise, if you only need Sprite functionality, just use Sprite and save yourself some memory.

(For more on the MovieClip class you can read my article on Movie Clips in AS3, or read up in any of the new books on ActionScript 3 such as Essential ActionScript 3.0 by Colin Moock.)

Declaring Your Document Class in Your .fla

As explained by the Adobe documentation, the next thing you will want to do is declare the class name. You need to have all objects de-selected, and then you can click on the stage, open the properties window, and choose the name. We are going to call our class MainClass. Notice the first capital letter for the ‘M’, and second capital for the ‘C’. Also notice how there are no spaces in our class name. This is a convention, or a common practice, used for creating class names, in the Java / C++ world, and of course, it is now becoming a standard for AS3 developers.

declaring_document_class.png


I have created an .fla file called “Main.fla”, so I am going to call the main document class for that file “MainClass”. Notice of course, that we are setup in an ActionScript 3.0 document targeted for Flash Player 9. Don’t forget to press ‘Return’! :)

(Note: if you type in your class name, press return, and get a message telling you that a definition for this class path will be created, you need to make sure that you have a “MainClass.as” file saved so that Flash can find it. If you are getting this message, you must not have that file created.)

If you save both your .as file and your .fla file, you should now be able to test the movie, and viola! Your Main Class’ constructor will execute. You should see a message in your output window.

Further Ideas for Working with the Document Class

  1. When you create movie clips using the Flash authoring tool, export those clips in your library (details in this article). Now these clips will be available to manipulate via your document class, you just need to instantiate them and use the addChild method.
  2. You don’t have to have a constructor in your document class – you can just store functions there that you would like to call from other parts of your application. A good way to centralize code.
  3. Use a ‘main’ document class as the center point of your application, similar to a java main() method.
  4. (Advanced) Gather information about the user’s desktop system (flash player version, available screen width and height) OR other platform details (mobile phone camera availability, etc) in your document class. Then (if you are so inclined), instantiate a singleton or a global variable to store client details. Take advantage of this ‘point of first contact.

There is obviously a lot more to explore with the document class, but I hope you gained some knowledge from this tutorial that you can apply to your AS3 projects. Cheers! Jay

]]>