Setting up new laptop for Flex Development
Going to take a break from the Google App Engine posts to document setting up my new laptop for Flex/AIR development.
I have a copy of Flash Builder 4 on my desktop, but I don't have any additional licenses for it. because I am unclear on all the rules surrounding if I can install it on my laptop and only use one at a time, I have decided to explore an open source alternative. It appears that FlashDevelop is a viable alternative, so I've decided to give it a shot. It is Windows only, so if you're on a Mac or Linux, you're out of luck.
Installation instructions for FlashDevelop can be found here: http://www.flashdevelop.org/wikidocs/index.php?title=Installation
Note that even though their instructions, and my instructions, include downloading the Flex SDK, it appears that FlashDevelop will download the SDK for you as part of the installation process.
Here are the steps I followed:
- Download and install the IE Flash Player ActiveX control (ActiveX, /me shudders)
- I skipped the SVN & Git download for now
- I haven't installed Java yet, so I grabbed the latest 64-bit Java JDK and installed it
- Java sdk went into c:\dev\sdks\java\ (I had to copy this over, I didn't catch the dialog for doing it in the installer, if it existed)
- Java jre went into c:\apps\java
- I downloaded the Open Source Flex 4.1.0 SDK and unzipped it to c:\dev\sdks\flex\4.1.0
- I downloaded the FlashDevelop 3.3.4 release and installed it to c:\apps\FlashDevelop
After installation, FlashDevelop started up fine. I created a new Flex 4 project, added a Spark Label with Hello World, and built. This is where I encountered my first problem:
Running process: C:\apps\FlashDevelop\Tools\fdbuild\fdbuild.exe "C:\dev\workspaces\FlashDevelop\FirstFlashDevelopProject\FirstFlashDevelopProject.as3proj" -ipc b9d4ab28-7ed8-4f2c-ab61-febf52b9bd08 -compiler "C:\apps\FlashDevelop\Tools\flexsdk" -library "C:\apps\FlashDevelop\Library"
Using the Flex Compiler Shell.
Building FirstFlashDevelopProject
mxmlc -load-config+=obj\FirstFlashDevelopProjectConfig.xml -debug=true -incremental=true -benchmark=false -static-link-runtime-shared-libraries=true -o obj\FirstFlashDevelopProject634362202147913601
Unable to start java.exe: The system cannot find the file specified
Could not compile because the fcsh process could not be started.
Build halted with errors (fcsh).
INITIALIZING: Failed, unable to run compiler
Done(1)
If you come across this, make sure you have the bin directory for Java on your PATH environment variable. If you haven't already, make sure you've got the JAVA_HOME pointing at your JRE or JDK. I also pointed FlashDevelop at the Flex SDK that I had downloaded instead of the version it had downloaded (I don't believe this was related to the error, but I took the opportunity to change it).
After I resolved that issue, the project compiled fine and I was able to view the results in Chrome.
That's all that was needed to get a FlashDevelop project up and running. I will play with the tool more later and write up my impressions of it. Hopefully it turns out to be a good Open Source alternative to Flash Builder 4.
Google App Engine Getting Started #4
The next topic in the getting started with Google App Engine was working with storing data. There are two options to persistence in the Google App Engine world, JDO and JPA. JPA is probably familiar to anyone who is doing enterprise development in Java. I had personally never heard of JDO before. The example for this getting started guide uses the JDO option for persistence.
By default, a new Google App Engine sets up everything that you'll need for persisting objects so all you haev to do is create your objects and add the appropriate annotations to them. I followed the steps from the guide except I named my PersistenceManagerFactory "PersistenceManagerFactory" since PMF tells nothing to someone trying to read your code. This conflicts with the built in class, but since that class should only be referenced by your own PersistenceManagerFactory I didn't view this as much of a negative.
This part of the guide can be found here:
http://code.google.com/appengine/docs/java/gettingstarted/usingdatastore.html
The results are located here:
http://alevicki.appspot.com/guestbook.jsp
Google App Engine Getting Started #3
This getting started was all about using JSPs. As soon as I added a JSP to the project I got an error:
Description Resource Path Location Type
Your project must be configured to use a JDK in order to use JSPs helloUser.jsp /googleAppEngineAlevicki/war Unknown Google App Engine Problem
The problem was that my Eclipse instance was pointing at an installed JRE instead of an installed JDK for its JRE purposes. Pointing at my installed JDK via Window > Preferences, Java, Installed JREs fixed the problem.
I deployed the first simple JSP to my App Engine as the default page. It can be accessed via
or
Google App Engine Getting Started #2
For this post I tackled the 2nd part of the App Engine getting started guide located here: http://code.google.com/appengine/docs/java/gettingstarted/usingusers.html
I didn't follow their instructions exactly. Instead of modifying my existing servlet, located here:
http://alevicki.appspot.com/googleappenginealevicki
I decided to create an additional servlet for the new functionality. Because of this I had to make some changes to my existing web.xml that were not included in the getting started guide. You can find my modified web.xml below.
In addition, instead of just saying "Hello, Nickname" I decided that I would expose some of the other fields on the User object. These included auth domain, federated identity, user id, and email address. I was surprised by the length of the user id, as it implies Google could support an astronomical number of users unless they are somehow encoding additional information into the id, which would be rather odd.
The hello user servlet is located here: http://alevicki.appspot.com/hellouser. It will redirect you to a Google sign in page if you do not already have an active session. This is accomplished using the userService.createLoginURL as described in the getting started guide.
Updated web.xml:
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<servlet>
<servlet-name>GoogleAppEngineAlevicki</servlet-name>
<servlet-class>com.menofactionscript.GoogleAppEngineAlevickiServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>HelloUser</servlet-name>
<servlet-class>com.menofactionscript.HelloUser</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GoogleAppEngineAlevicki</servlet-name>
<url-pattern>/googleappenginealevicki</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>HelloUser</servlet-name>
<url-pattern>/hellouser</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
Google App Engine Hello World
This is the first blog post on here, so I might as well say that this one has nothing to do with ActionScript, and honestly a lot of the posts probably won't.
I decided to check out how difficult it was to get an application running on Google App Engine, and I've found it to be surpisingly easy to do. Google has done an awesome job of integrating with the developer tools out there to make this almost as painless a process as possible. Here are some steps to getting setup:
- Check out the Google App Engine site for information: http://code.google.com/appengine/
- Go to the Download page to find the downloads you're going to need: http://code.google.com/appengine/downloads.html
- If you haven't already, download the latest Eclipse version. At the time of this writing it was Helios. You can find a list of the available Eclipse downloads here: http://www.eclipse.org/downloads/ I chose the Eclipse IDE for Java Developers
- Download and unzip the Eclipse installation. Because I have multiple Eclipse installed on my system, I placed it here: C:\apps\eclipse_helios
- Start up Eclipse and follow the instructions for installing the Google App Engine plugin found here http://code.google.com/eclipse/docs/install-eclipse-3.6.html
- After Eclipse has installed the plugin and restarted, follow the getting started with Java guide found here to get your Hello World up and running http://code.google.com/appengine/docs/java/gettingstarted/creating.html
My Hello World is located here: http://alevicki.appspot.com/googleappenginealevicki
Extremely simple, but the key takeaway here was that Google has made this extremely easy to do. You can even upload your application from Eclipse to your App Engine account. I'll be looking at the other getting started topics in future posts.