<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Twofer &#187; Uncategorized</title>
	<atom:link href="http://www.atwofer.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.atwofer.com</link>
	<description>A place to talk about Software Development (RoR, J2EE, J2ME, CSS, HTML, JavaScript, Objective-C, etc) and some other stuff</description>
	<lastBuildDate>Fri, 16 Jul 2010 14:56:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Eclipse + Pydev + Django</title>
		<link>http://www.atwofer.com/2010/03/21/eclipse-pydev-django-google-app-engine/</link>
		<comments>http://www.atwofer.com/2010/03/21/eclipse-pydev-django-google-app-engine/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 00:13:26 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Pydev]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.atwofer.com/?p=151</guid>
		<description><![CDATA[So I decided that I wanted to learn Python. On top of that I wanted to learn Django. The catch is that I like to do everything from within Eclipse so that I can make use of the debugger. I couldn&#8217;t find information about how to do all of this so instead I pieced it [...]]]></description>
			<content:encoded><![CDATA[<p>So I decided that I wanted to learn Python. On top of that I wanted to learn <a href="http://www.djangoproject.com/">Django</a>. The catch is that I like to do everything from within Eclipse so that I can make use of the debugger. I couldn&#8217;t find information about how to do all of this so instead I pieced it together here. My overall goal is to run through this <a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/#the-development-server" target="_blank">Django Tutorial</a> but this post will only deal with setting up Eclipse/Pydev and Django.</p>
<p>NOTE: Hopefully soon this post will be rendered useless when <a href="http://pydev.blogspot.com/2010/03/django-on-pydev.html" target="_blank">Pydev includes Django support</a>.</p>
<p><strong>Install Pydev</strong></p>
<p><strong> </strong>Since I use Eclipse for just about everything from Java to Ruby on Rails to ActionScript I obviously already had it installed so the first thing I needed to do was to install the Pydev Eclipse plugin. Pydev is installed just like any other plugin and instructions on how to install Pydev can be found <a href="http://pydev.org/download.html">here</a>.</p>
<p><strong>Install Django</strong></p>
<p>Download Django from here then unzip it and navigate to the unzipped folder and run the following command.</p>
<pre style="padding-left: 30px;">python setup.py install</pre>
<p>I am on a Mac with Python 2.6 installed so Django is installed at</p>
<pre style="padding-left: 30px;">/Library/Python/2.6/site-packages</pre>
<p><strong>Create a Django Project</strong></p>
<p>Now I should be ready to create my project and the configure it to work with Eclipse/Pydev. First I need to navigate to my folder where I want to create the project and type the following.</p>
<pre style="padding-left: 30px;">django-admin.py startproject mysite</pre>
<p>Now this results in the following</p>
<pre style="padding-left: 30px;">cd mysite/</pre>
<pre style="padding-left: 30px;">ls</pre>
<pre style="padding-left: 30px;">__init__.py     manage.py       settings.py     urls.py</pre>
<p>As you can see all the project files are created at the root. Generally projects consist of more than just python files. Also, pydev likes the code to be in a &#8220;src&#8221; folder so lets move the python files to a &#8220;mysite&#8221; package in the &#8220;src&#8221; folder.</p>
<pre style="padding-left: 30px;">mkdir src
cd src
mkdir mysite
mv *.py src/mysite/.</pre>
<p><strong>Create the Pydev Projec</strong>t</p>
<p>Now I can launch Eclipse and create a new project by going to <em>File-&gt; New -&gt; Pydev Project</em>. For the directory I will select the project folder I created earlier.</p>
<p><a href="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django.png"><img class="alignnone size-medium wp-image-170" title="eclipse+pydev+django" src="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django-285x300.png" alt="" width="285" height="300" /></a></p>
<p>Click &#8220;Finish&#8221; and now I have a Pydev project that looks like the following.</p>
<p><a href="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django3.png"><img class="alignnone size-full wp-image-172" title="eclipse+pydev+django3" src="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django3.png" alt="" width="237" height="150" /></a></p>
<p><strong>Add Django to the Project</strong></p>
<p>The first thing I need to do now that I have the project is tell it where to find Django. I can do this by going to <em>Project -&gt; Propertie</em>s. Here I need to add the installed location of Django as an External Library.</p>
<p><a href="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django2.png"><img class="alignnone size-medium wp-image-171" title="eclipse+pydev+django2" src="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django2-300x212.png" alt="" width="300" height="212" /></a></p>
<p><strong>Starting My Server From Eclipse</strong></p>
<p>In Eclipse I go to <em>Run -&gt; Run Configurations&#8230; </em>and create a new Python Run configuration. Select my project and for the main module provide the path to the manage.py file.</p>
<p><a href="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django4.png"><img class="alignnone size-medium wp-image-173" title="eclipse+pydev+django4" src="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django4-300x162.png" alt="" width="300" height="162" /></a></p>
<p>Switch to the arguments tab and add the &#8220;runserver &#8211;noreload&#8221; argument.</p>
<p><a href="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django5.png"><img class="alignnone size-medium wp-image-174" title="eclipse+pydev+django5" src="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django5-300x162.png" alt="" width="300" height="162" /></a></p>
<p>Click &#8220;Apply&#8221; and now click &#8220;Run&#8221; and navigate to http://localhost:8000.</p>
<p><a href="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django6.png"><img class="alignnone size-medium wp-image-175" title="eclipse+pydev+django6" src="http://www.atwofer.com/wp-content/uploads/2010/03/eclipse+pydev+django6-300x166.png" alt="" width="300" height="166" /></a></p>
<p>This is as far as I have gotten so far. Next I will actually try to code something.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.atwofer.com/2010/03/21/eclipse-pydev-django-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting the errorID from an ErrorEvent in ActionScript</title>
		<link>http://www.atwofer.com/2009/02/24/getting-the-errorid-from-an-errorevent-in-actionscript/</link>
		<comments>http://www.atwofer.com/2009/02/24/getting-the-errorid-from-an-errorevent-in-actionscript/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 04:15:29 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ErrorEvent]]></category>
		<category><![CDATA[ErrorEvent.errorID]]></category>
		<category><![CDATA[FlashPlayer]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.atwofer.com/?p=85</guid>
		<description><![CDATA[Our Episodic Video Player is written in ActionScript 3.  I&#8217;m still fairly new to ActionScript but came up with a solution to a problem the other day that I thought I should share.
The player loads various files from the server.  In some cases I want to display an error when one of those [...]]]></description>
			<content:encoded><![CDATA[<p>Our <a href="http://www.episodic.com/" target="_blank">Episodic Video Player</a> is written in ActionScript 3.  I&#8217;m still fairly new to ActionScript but came up with a solution to a problem the other day that I thought I should share.</p>
<p>The player loads various files from the server.  In some cases I want to display an error when one of those files can&#8217;t be found.  I have an error handler that listens for <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/ErrorEvent.html" target="_blank">Error Events</a> and displays an appropriate error message depending on the type of the error event.  For example, I know that error code 2032 will generally mean in our case that the file could not be found. </p>
<p>Alright, so this all seems simple enough except for one problem.  When I looked at the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/ErrorEvent.html#errorID" target="_blank">ASDocs for ErrorEvent.errorID</a> I noticed that that property is not available for Flash Player 9.  Fortunately, ErrorEvent extends <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/TextEvent.html" target="_blank">TextEvent</a> which has text property I can access.  In the case of an ErrorEvent the text property contains a message that includes the error ID.  Therefore, I just wrote my own getter to grab the error ID.</p>
<p><code>public function get errorID():int {<br />
<span style="padding-left: 10px;">if ((text != null) &#038;&#038; (text.indexOf("Error #") == 0) </span><br />
<span style="padding-left: 40px;">&#038;&#038; (text.length > 7)) {</span><br />
<span style="padding-left: 20px;">// The Error IDs always seem to be 4 digits</span><br />
<span style="padding-left: 20px;">return parseInt(errorEvent.text.substr(7, errorEvent.text.length - 7));</span><br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.atwofer.com/2009/02/24/getting-the-errorid-from-an-errorevent-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
