Python

May 05, 2008

The Smashed Apples Open Source Development Platform

Smashedapples2

The Smashed Apples Development Platform is an open source development platform that aims to help flex developers easily and quickly develop flex applications on cloud services, like Amazon Web Services, Google App Engine, the Google Web Api’s.

Many Clouds, 1 App.

Flex is perfect for leveraging cloud services. It was designed to have multiple sources of data. Your data can be in an xml file, a web service, or come from remoting directly into backend code. You can use Google App Engine to host your database, store your images in Amazon S3 and deploy the messaging through BlazeDS running on an Ec2 instance.

Smashedapples1

Why not all, and more.

 

V 099 Beta

We’re still currently in version 099 beta. But we decided to go ahead and solicit help and feedback from the flex community. We have ideas about what other flex developers might want, but it’ll be better if you just tell us.

More than a swc

Smashed Apples is more than a swc. It’s a development platform. The SmashedApplesSDK is just one piece of a much bigger puzzle. For example on Amazon we created a public Amazon Ec2 ami  ( ami-5640a53f -) that starts up an apache web server that deploys blazeDS and a java project that allows you to access the Amazon SimpleDB from within flex. The swc just ties it all together from within flex. Also, with that image you can open up messaging ports and do push pulls off of Amazon Web Services.

Besides being a swc to leverage cloud services, I’ve also been incorporating enterprise-level dynamic flex computing components that will help you create flex apps faster. Forms that know how to submit themselves. DataQuery objects that allow you to consistently create dynamic queries on backend resources.

Harnessing Cloud Services as Needed

Last August at Flex 360 Seattle I had the simple idea of using flex with Amazon Web Services to build a photo viewer using Amazon S3. The problem was I knew nothing about using Amazon Web Services. I wasn’t a linux administrator and every time I tried to use Amazon Web Services from within flex I just got frustrated. (What’s up with that freaking SSH KeyPair!!) I mentioned it to long time friend Jeremy Mooer and it turns out he knew everything about using linux on amazon web services that I didn’t. That simple idea turned into a full blown open source project. As I started looking into Cloud Services, I found there were alot more out there than I suspected. Jeremy Got busy creating Ec2 ami’s and I went about creating the flex sdk, and the smashed apples java ec2 java api. BlazeDS went Open Source, Google came out with AppEngine and it became very apparent to me that the applications of tomorrow are going to be built off of cloud services. ( Get ready to dump your RDBMS btw ). Businesses are going to create thier own mini cloud services. Relational Database Management Systems are going to give way to Object Persistent Systems. Words like Hadoop, MapReduce, Erlang and Mnesia are going to be found on more and more resumes. Smashed Apples has turned into my goto for being able to harness cloud services from within flex applications. Pay for what you use, right?

 

 

Future Development

We’ve already been looking into ways to incorporate Google App Engine, and more code will be coming soon. 

But in the future, we’d also like to support:

 

Learn More

Site: http://www.smashedapples.com/

Code: http://smashedapples.googlecode.com/

 User Group: http://groups.google.com/group/smashedapples

Simple Explorer: http://www.smashedapples.com/samples/explorer/SmashedExplorerApp.html

It currently runs off of the public smashed apples ami, it use blazeds for remoting, to the smashed apples java api that stores data in SimpleDB.

Help is Welcome

We are an open source project! If you’re a flex developer with some free time and would like to get involved please email me. There’s plenty to do. We’re easy to get along with, like to joke around and doing an open source project is a great way to get your name out there. We give credit where credit is due. 

Corporate Sponsors

Finding corporate sponsors has not been our goal when we created this project. That being said, I have received several inquiries about whether or not we have corporate sponsors for the project and we are open to the idea of having a corporate sponsor(s). If you would like to become a corporate sponsor please contact me.

 

 

 

April 15, 2008

PyAMF 0.3 released

The guys at PyAMF released version 0.3. It fixes some of the hacks i hacked out to get up and running with Google App Engine. You can read more about it over at their blog. Also, here’s their tutorial for getting  setup.

April 10, 2008

Debugging Google AppEngine with PyDev in Eclipse

This assumes you have Google AppEngine, Eclipse & PyDev installed.

I’m gonna have to go back a bit on what I said about creating a python project in this previous post. Instead of creating individual projects for each app you intend to create, I found it much easier to create one project that encompassed my entire development directory. Also, I received a few emails on how I was adding PyAMF and the google sdk to get code completion support. > Prefs

Pythondebug1

I added the .egg file for PyAMF and I zipped up the google folder underneath my appengine installation and added it.

 

Now onto debugging.

1. Create a new PyDev Project. Right click the project folder and Add New Folder. Click Advanced, Check the Link to folder and point it to the your appengine installation directory. Essentially your entire AppEngine Directory.

Pythondebug2

 

My project now looks like this

Pythondebug3

 

2. Now I open the project I want to debug and place my breakpoints.

Pythondebug4

 

3. Now right click on the dev_appserver.py file  and go to Debug As > Open Debug Dialog. 

Right Click Python Run and choose New. 

Name the configuration

Select your Project

Add the dev_appserver.py as the Main Module

Pythondebug5

 

Then switch to the Arguments tab and enter the project you want to debug for the program arguments. You can also enter the —port=8080 switch here just like the command prompt.

Pythondebug6

 

Finally, Click Apply Then debug. You should see the following the Console:

Pythondebug7

 

Run your  app. From Flex or from the Browser you should be able to hit your break points. Oh and I don’t recommend doing this to your arm or back. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Getting Started on Google App Engine with Flex and PyAMF (2)

UPDATE: For setting up PyAMF I recommend using this article written over on PyAMF. This original post was written before a patch was created. And there instructions will be more up to date and maintained.

 

The previous article on this topic can be found here.

I’m also shamelessy pulling from this article. It almost got me there, but there was one thing noted below that I needed to do. 

1. Download pyamf.

2. Now unzip the pyamf into a directory ( i went with c:/pyamf ) and browse to it from the command prompt. When you get to the source folder run “ez_setup.py”.

3. Now complete the following steps ( original reference can be found here )

  • Download and unpack pyAMF-0.2
  • Download fpconst and put it in pyAMF-0.2/pyamf
  • Delete the file pyAMF-0.2/pyamf/adapters/__init__.py
  • Comment out the line register_adapters(); at the end of pyAMF-0.2/pyamf/__init__.py

 (I did these steps and found I still needed to comment out line 26 in the pyAMF-0.2/pyamf/__init__.py that looks like:  from pyamf.adapters import register_adapters )

4. After that is completed, go back to your command prompt and run “setup.py install”

5. Afterwards in the directory where you downloaded pyamf you should have a directory that has a dist directory under that. Add the .egg in the dist directory to your System – PYTHONPATH. in windows > prefs > PyDev > Interepretor just like we did for the google.zip file above. ( This will bring in code completion support )

6. From the command prompt start your server   /appengine/dev_appserver.py {app name}

7. Browse to http://localhost:8080/

if everything’s set up and running properly you’ll see something like

400 Bad Request

To access this PyAMF gateway you must use POST requests (GET received)


 


 


8. Finally, create a flex app.  Below is the code I used. You should be able to drop it in your flex app file. If everything works you can use the appcfg.py commands to upload your application and point your endpoint to your new application url.  


Pyamfcode1


 


This is by no means complete and I hope to get more examples up and running soon. If you have any questions feel free to comment or email me. I’ll be posting on how to debug python apps from eclipse when making calls from flex and also some other topics that have been floating around. Like Google Authentication.


 


 


 


 


 


 



 

April 09, 2008

Getting Started on Google App Engine with Flex and PyAMF (1)

So this is my first of hopefully two posts on getting setup to work on Google App Engine. This will get your python and local google server up and running

1. Download and install python if you need to.

2. Download and install the google app engine sdk. I recommend installing this somewhere on your system that is easily accessible. By default on windows it went under /program files/google/appengine. I reinstalled it under c:/appengine/ for easy access from the command prompt. Do as you will but remember where it gets put.

3. Install pydev into your eclipse. There’s a great getting started guide for pydev located here. It explains how to set your python interpreter up.  

To add code complete support for the google sdk in eclipse first zip up the google directory in your appengine installation directory. Then go to windows > prefs > PyDev > Interpretor : System PYTHONPATH click “New Egg/Zip” and add that google.zip

UPDATE: The crossed out steps are better explained by this post  about getting your debugger up and running in eclipse.

4. Create a new PyDev project. Finish. 

5. Now browse to your appengine installation directory and copy / paste the new_project_template into the same directory. Then rename it to the name of  your project.

6. And now back in eclipse right click on the src folder and do a add new folder > advanced > Link to the file system and browse to the project folder under your appengine installation.

7. Open app.yaml on the top line change the application: new-project-template to application : your-app-name

 

Now open a command prompt and go to your appengine isntallation directory and type dev_appserver.py —port=9999 {YOUR APP FOLDER NAME}

Then open a browser and go to http://localhost:9999/ and you should see it running.

 

Installing PyAMF and Setting up flex environment next.