<?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>{5} Setfive - Talking to the World &#187; amazon</title>
	<atom:link href="http://shout.setfive.com/tag/amazon/feed/" rel="self" type="application/rss+xml" />
	<link>http://shout.setfive.com</link>
	<description></description>
	<lastBuildDate>Wed, 18 Jan 2012 21:09:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Running Java apps from the crontab</title>
		<link>http://shout.setfive.com/2011/08/12/running-java-apps-from-the-crontab/</link>
		<comments>http://shout.setfive.com/2011/08/12/running-java-apps-from-the-crontab/#comments</comments>
		<pubDate>Sat, 13 Aug 2011 02:40:04 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[Free Advice]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=872</guid>
		<description><![CDATA[Earlier this week I was completely dumbfounded by a PHP script that launched a Java app that seemed to work fine when it was run from the command line but kept failing when it was run from a cron. The Java app in question was &#8220;ec2-describe-group&#8221; out of the Amazon EC2 API Tools package.  Basically, [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this week I was completely dumbfounded by a PHP script that launched a Java app that seemed to work fine when it was run from the command line but kept failing when it was run from a cron.</p>
<p>The Java app in question was &#8220;ec2-describe-group&#8221; out of the <a href="http://aws.amazon.com/developertools/351" target="_blank">Amazon EC2 API Tools</a> package.  Basically, the ec2-describe-group tool hits the EC2 API and returns information about your account&#8217;s currently configured security groups.</p>
<p>The issue I was having was that when the PHP script was launched from a cron ec2-describe-group would keep returning an empty string, but when the script was launched from the CLI ec2-describe-group behaved normally.</p>
<p>After some poking around, I found <a href="http://stackoverflow.com/questions/4816889/running-a-scheduled-task-written-in-java-on-a-linux-server" target="_blank">this StackOverflow</a> post which points out that most the environment variables your shell has aren&#8217;t available in a cronjob.</p>
<p>With that in mind, I tried adding JAVA_HOME as well as EC2_HOME to my crontab. Doing this is pretty straight forward, just add these two lines above any of your scheduled jobs:</p>
<pre name="code" class="php">
EC2_HOME=/opt/ec2-api-tools-1.3.36506
JAVA_HOME=/etc/java-config-2/current-system-vm
</pre>
<p>Unfortunately, this still didn&#8217;t resolve the issue. On a whim, I decided to check what type of file ec2-describe-group actually is and discovered that its a Bash script not a Java JAR. Looking at the Bash, the file is actually just executing &#8220;EC2_HOME/bin/ec2-cmd DescribeGroups&#8221; but it utilizes other environment variables that my cron didn&#8217;t have.</p>
<p>For simplicity&#8217;s sake, I decided to just switch the PHP script to run ec2-cmd directly and finally everything started working as expected.</p>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2011/08/12/running-java-apps-from-the-crontab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upload directly to S3 with SWFUpload</title>
		<link>http://shout.setfive.com/2011/04/21/upload-directly-to-s3-with-swfupload/</link>
		<comments>http://shout.setfive.com/2011/04/21/upload-directly-to-s3-with-swfupload/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 03:56:01 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[Free Advice]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[SWFUpload]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=652</guid>
		<description><![CDATA[I was working on an application earlier today that required allowing a user to upload a large file (several hundred MB) which would eventually be stored on Amazon S3. After reviewing the requirements, I realized it made sense to just upload the file directly to S3 instead of having to first stage the file on [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on an application earlier today that required allowing a user to upload a large file (several hundred MB) which would eventually be stored on <a href="http://aws.amazon.com/s3/" target="_blank">Amazon S3</a>. After reviewing the requirements, I realized it made sense to just upload the file directly to S3 instead of having to first stage the file on a server and then use PHP to push the file to S3.</p>
<p>Amazon has a nice walk through of using a plain HTML form to upload a file directly to S3 <a href="http://doc.s3.amazonaws.com/proposals/post.html" target="_blank">here</a>.</p>
<p>I had all ready been using <a href="http://swfupload.org/" target="_blank">SWFUpload</a> to upload files to the server so I decided to look into using it to uploading directly to S3. After some head banging, I finally got it to work &#8211; here&#8217;s the quick n dirty.</p>
<ol>
<li>Download <a target="_blank" href="http://code.google.com/p/swfupload/downloads/list">SWFUpload 2.5</a></li>
<li>Get SWFUpload ready to use in your project. Copy the SWF file somewhere accessible and include their swfupload.js Javascript file. More info <a href="http://demo.swfupload.org/Documentation/" target="_blank">here</a></li>
<li>Setup an S3 bucket. You&#8217;ll need to set the policy to allow uploads from your own user (its the default).</li>
<li>Place a crossdomain.xml file in the root of your S3 bucket. This file &#8220;authorizes&#8221; flash player to upload files into this host. The content of the file is below.</li>
<li>Initialize the SWFUpload object (example below).</li>
<li>Before beginning the upload, you need to set the appropriate postParams in the SWFUpload object. This is really the &#8220;magic&#8221; of this process. Example is below.</li>
<li>Start the upload with startUpload()</li>
</ol>
<p>Thats it! It&#8217;s pretty straight forward once you have things going. As an FYI, you can put SWFUpload into &#8220;debug&#8221; mode by adding debug: true as a property to the initialization object. You can also debug the responses from Amazon by using a packet sniffer like <a href="http://www.wireshark.org/" target="_blank">Wireshark</a>. </p>
<h3>crossdomain.xml</h3>
<p>You probably want to make this file a little less permissive. More details <a href="http://kb2.adobe.com/cps/142/tn_14213.html" target="_blank">here</a>. Also note, there are differences in the implementation of the file between various versions of Flash player.</p>
<pre class="xml" name="code">
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-access-from domain="*" secure="false" />
</cross-domain-policy>
</pre>
<h3>Initialize SWFUpload</h3>
<pre class="javascript" name="code">
        var swfu = new SWFUpload(
                       {  flash_url: "/assets/swfupload.swf",
                          flash9_url: "/assets/swfupload_fp9.swf",
                          file_size_limit: "1000 MB",
                          file_types: "*.*",
                          debug: false,
                          upload_url: "http://your-bucket.s3.amazonaws.com",
                          button_placeholder_id : "SWFUploadButton",
                          button_image_url : "/assets/select_filesbtn.png",
                          button_width: '112',
                          button_height: '33',
                          button_cursor : SWFUpload.CURSOR.HAND,
                          http_success : [201, 303, 200], /* Amazon returns a 303 on success */
                          file_post_name: "file", /* Amazon expects the file data to be in a input named "file"

                          file_queued_handler: function(f){

                            // track the filenames so you can upload them later
                            cachedUploadFiles[ f.index ] = f.name;
                          },
                          upload_complete_handler: function(e){ uploadSWFFile( ); },
                          upload_start_handler: function(e){
                                  // reset the progress bar
                        	  $("#progressBar").progressbar( 'value', 0 );
                          },
                          upload_error_handler: function(e){

                          },
                          upload_progress_handler: function(f, c, t){
                             // update the progress bar as the process continues
                             $("#progressBar").progressbar( 'value', Math.ceil( ( c/t ) * 100 ) );
                          }
        });
</pre>
<h3>Set SWFUpload postParams</h3>
<p>The HMAC signature MUST be calculated on the server because it uses your S3 secret. You MUST keep that value secret in order to maintain the security of your S3 buckets. I&#8217;m using <a href="https://github.com/tpyo/amazon-s3-php-class" target="_blank">Don Schonknecht&#8217;s S3 PHP</a> library to calculate the HMAC signatures but you could just as easily do it in straight PHP.</p>
<pre class="php" name="code">

/* In PHP */
$encodedPolicy = json_encode( array(
              "expiration" => "2011-4-22T13:54:23.000Z",
              "conditions" => array(
                  0 => array( "acl" => "public-read" ),
                  1 => array( "bucket" => "your-bucket" ),
                  2 => array( "x-amz-meta-sig" => 'some meta signature to ensure authentic requests'),
                  3 => array( "redirect" => $'URL to redirect a success request (its doesnt matter)' ),
                  4 => array( "key" => "the S3 key for the file (the S3 filename)" ),
                  5 => array( "Filename" => "The original filename of the file. THIS IS IMPORTANT." )
              ),
            )
);

$encodedPolicy = base64_encode( $encodedPolicy );
$s3 = new S3( sfConfig::get("app_amazon_s3_id"), sfConfig::get("app_amazon_s3_secret") );
list($dist, $hmacSignature) = explode(":", $s3->__getSignature( $encodedPolicy ));

/* END PHP */

            var swfConfig = {
                    'AWSAccessKeyId': 'your amazon ID',
                    'acl': 'public-read',
                    'key': 'the S3 key for the file (the S3 filename)',
                    'policy': '&lt;?php echo $encodedPolicy?&gt;',
                    'signature': '&lt;?php echo $signature'?&gt;,
                    'redirect': 'URL to redirect a success request (its doesnt matter)',
                    'x-amz-meta-sig': 'some meta signature to ensure authentic requests',
            };

            // this line sets the post params so that SWFUpload will send the additional fields when it uploads the file.
            $.swfu.setPostParams( swfConfig );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2011/04/21/upload-directly-to-s3-with-swfupload/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>99designs and Amazon. Design. Crowd sourced.</title>
		<link>http://shout.setfive.com/2009/07/14/99designs-and-amazon-crowd-sourced/</link>
		<comments>http://shout.setfive.com/2009/07/14/99designs-and-amazon-crowd-sourced/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 03:40:19 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[fun stuff]]></category>
		<category><![CDATA[web2.0]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=191</guid>
		<description><![CDATA[A week or so ago my Dad asked if we could have our designer put together a logo for him. Unfortunately, our guy was buried under a mound of work and generally couldn’t help us out. We haven’t always had the best luck with Craigslist so I was ready to try something new. Over the [...]]]></description>
			<content:encoded><![CDATA[<p>A week or so ago my Dad asked if we could have our designer put together a logo for him. Unfortunately, our guy was buried under a mound of work and generally couldn’t help us out. We haven’t always had the best luck with <a href="http://www.craigslist.org" target="_blank">Craigslist</a> so I was ready to try something new.</p>
<p>Over the last few months, I’ve been seeing a good amount of chatter surrounding “spec” design sites especially <a href="http://99designs.com" target="_blank">99designs.com</a>. After taking a look around the site I figured now was a good time to give it a shot. We were on a tight budget, tight time line, and my Dad didn’t have much direction for the logo.</p>
<p>I posted up a contest last Sunday <a href="http://99designs.com/contests/24619" target="_blank">here</a> and we were looking at entries by Monday afternoon. Now things got more difficult. We were having a hard time coming up with “star ratings” and constructive feedback in general. My Dad’s staff was having a hard time not getting pigeon holed by the submitted designs and Setfive wasn’t doing a great job helping them along.</p>
<p>We did our best and we felt like the entries were moving in the right direction. Then the contest closed. In the last 8 hours of the contest the number of entries nearly doubled. With 70 entries we now had the problem with objectively picking a winning logo.</p>
<p>At this point, I wanted some more input on what people thought about the logos. I decided to create a set of <a href="https://www.mturk.com/mturk/welcome" target="_blank">Amazon Mechanical Turk</a> tasks to get some feedback.</p>
<p>After about a day, I had 200 responses asking for user’s top three logos and any additional comments they had.</p>
<p>Some of the comments I got back were insightful and moving:</p>
<ul>
<li>Don&#8217;t pick any of the logos on the second page. They all look terrible.</li>
<li>Due to nature of your business I would prefer a sober and serious looking logo.</li>
<li>I chose these three because they are visually appealing, and convey a sense of being able to ease pain.</li>
<li>I suffer from cronic pain. I wish you the best of luck in finding your logo. People that do your type of work are a life line for people like me. Hope I hope have helped.</li>
</ul>
<p>I tallied up the results by weighting +3, +2, +1 for first, second, and third choices respectively. The results were interesting.</p>
<ul>
<li>Every logo received at least one vote.</li>
<li>The top ten logos accounted for just about 41% of all the votes.</li>
<li>Only counting the top choice caused 3 logos to fall out of the top ten.</li>
</ul>
<p>The top ten logos as voted by the Amazon Mechanical Turks were:</p>
<table border="1" cellspacing="0" cellpadding="0" width="449">
<tbody>
<tr>
<td width="65" valign="bottom">Entry ID</td>
<td width="65" valign="bottom">Votes</td>
<td width="318" valign="bottom">URL</td>
</tr>
<tr>
<td width="65" valign="bottom">
<p align="right">88</p>
</td>
<td width="65" valign="bottom">
<p align="right">76</p>
</td>
<td width="318" valign="bottom"><a href="http://99designs.com/contests/24619/entries/88">http://99designs.com/contests/24619/entries/88</a></td>
</tr>
<tr>
<td width="65" valign="bottom">
<p align="right">78</p>
</td>
<td width="65" valign="bottom">
<p align="right">65</p>
</td>
<td width="318" valign="bottom"><a href="http://99designs.com/contests/24619/entries/78">http://99designs.com/contests/24619/entries/78</a></td>
</tr>
<tr>
<td width="65" valign="bottom">
<p align="right">75</p>
</td>
<td width="65" valign="bottom">
<p align="right">60</p>
</td>
<td width="318" valign="bottom"><a href="http://99designs.com/contests/24619/entries/75">http://99designs.com/contests/24619/entries/75</a></td>
</tr>
<tr>
<td width="65" valign="bottom">
<p align="right">87</p>
</td>
<td width="65" valign="bottom">
<p align="right">55</p>
</td>
<td width="318" valign="bottom"><a href="http://99designs.com/contests/24619/entries/87">http://99designs.com/contests/24619/entries/87</a></td>
</tr>
<tr>
<td width="65" valign="bottom">
<p align="right">91</p>
</td>
<td width="65" valign="bottom">
<p align="right">51</p>
</td>
<td width="318" valign="bottom"><a href="http://99designs.com/contests/24619/entries/91">http://99designs.com/contests/24619/entries/91</a></td>
</tr>
<tr>
<td width="65" valign="bottom">
<p align="right">58</p>
</td>
<td width="65" valign="bottom">
<p align="right">48</p>
</td>
<td width="318" valign="bottom"><a href="http://99designs.com/contests/24619/entries/58">http://99designs.com/contests/24619/entries/58</a></td>
</tr>
<tr>
<td width="65" valign="bottom">
<p align="right">47</p>
</td>
<td width="65" valign="bottom">
<p align="right">42</p>
</td>
<td width="318" valign="bottom"><a href="http://99designs.com/contests/24619/entries/47">http://99designs.com/contests/24619/entries/47</a></td>
</tr>
<tr>
<td width="65" valign="bottom">
<p align="right">90</p>
</td>
<td width="65" valign="bottom">
<p align="right">41</p>
</td>
<td width="318" valign="bottom"><a href="http://99designs.com/contests/24619/entries/90">http://99designs.com/contests/24619/entries/90</a></td>
</tr>
<tr>
<td width="65" valign="bottom">
<p align="right">43</p>
</td>
<td width="65" valign="bottom">
<p align="right">36</p>
</td>
<td width="318" valign="bottom"><a href="http://99designs.com/contests/24619/entries/43">http://99designs.com/contests/24619/entries/43</a></td>
</tr>
</tbody>
</table>
<p>Personally, I like the top ten logos and my Dad’s staff seems to like many of the same logos that were voted up. It’s been an interesting experiment almost exclusively using the “crowd” to design and then select a logo. I’m not sure if we’ll use 99designs in the future but it has been a pleasant experience.</p>
<p><b>We still haven&#8217;t picked a winning logo but I&#8217;ll update once we do!</b></p>
<h3>Update:</h3>
<p>We finally picked a winner! We decided to go with the crowd and selected http://99designs.com/contests/24619/entries/88 as the winning logo. </p>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2009/07/14/99designs-and-amazon-crowd-sourced/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Artificial artificial intelligence &#8211; our experience with Mechanical Turk</title>
		<link>http://shout.setfive.com/2008/11/20/artificial-artificial-intelligence-our-experiance-with-mechanical-turk/</link>
		<comments>http://shout.setfive.com/2008/11/20/artificial-artificial-intelligence-our-experiance-with-mechanical-turk/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 06:55:30 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[mechanical turk]]></category>
		<category><![CDATA[web2.0]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=56</guid>
		<description><![CDATA[So Amazon Web Services (AWS) has a pretty neat service called the Mechanical Turk. The name of the service is inspired by this story where a human was hidden inside a chess playing &#8220;robot&#8221; which impressed crowds during the late 18th century. Amazon&#8217;s service doesn&#8217;t hide the fact that its powered by humans but the [...]]]></description>
			<content:encoded><![CDATA[<p>So Amazon Web Services (AWS) has a pretty neat service called the Mechanical Turk. The name of the service is inspired by this story where a human was hidden inside a chess playing &#8220;robot&#8221; which impressed crowds during the late 18th century. Amazon&#8217;s service doesn&#8217;t hide the fact that its powered by humans but the end result is the same &#8211; humans performing tasks in lieu of a computer.<br />
The task we needed &#8220;turked&#8221; was the transcription of various text labels that were on top of overlays on a particular large image. The goal of all of this was a Google Maps product so we all ready had the overlays loaded into a Google Maps UI.  To recap:</p>
<ul>
<li>We had a Google Maps application which loaded an image layer with about 3000 discrete overlays.</li>
<li>We had lat/lng coordinates for all of these overlays.</li>
<li>Each of these images had a text label that uniquely described it.</li>
<li> We wanted the Turks to transcribe these labels.</li>
</ul>
<p>Next, we began to investigate how the Mechanical Turk service actually works. The process is delightfully simple. The idea is to break the tasks out into discrete and reproducible actions called human intelligence tasks (HITs). This pattern aligned well with our problem because all of the overlays were independent and we had coordinates for each of them. Amazon displays each of these HITs inside a template that the &#8220;requester&#8221; constructs.</p>
<p>The templates are HTML pages (Amazon allows javascript) which plug-in variables for each HIT when the tasks go live. They also capture the data that you want to save from the task &#8211; in our case the labels. Designing templates is pretty straightforward and javascript is a nice touch.</p>
<p>For our task, we embeded Google Maps with our image overlaid and used HIT variables to display 3 markers per task. This is where we hit our first and only snag. Because of directory restrictions on Google Maps API keys our HIT template kept generating javascript errors because it was being executed on un-predictable domain names. We didn&#8217;t think this was a huge deal so we plowed ahead as planned.<br />
We ran the first set of HITs with a 2 cent/HIT payment and a minimum approval rating of 95%.</p>
<p>The results were less than stellar &#8211; within an hour or so we received this email:</p>
<blockquote><p>A strange error message pops up for your/these HITS.<br />
&#8220;The Google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at http://code.google.com/apis/maps/.&#8221;<br />
Also, the mouseover that displays at screen bottom is &#8220;javascript: void (0)&#8221;&#8230;and no label appears below the marker either.  I do NOT have any javascript blockers operational, so no problem there.<br />
Also, I would appreciate it if you NOT deny me credit for this HIT, as the technical error message was not my fault and not explained or warned in the instructions.<br />
I would like to do several, possibly many of these HITS, if you can tell me what to do to overcome this problem.<br />
Thanks,<br />
[REDACTED]</p></blockquote>
<p>People were obviously not getting the instructions and were scared away by the JS error and fear of HIT rejection. One of the problems with the service is that you can&#8217;t modify your HIT template once a set has been published. You have to cancel the batch and re-start after your edits. At this point, we decided to cancel the run and modify the instructions. With the new instructions people seemed to &#8220;get it&#8221; and were generally more willing to forgive the JS error.</p>
<p>At the end of the run, the accuracy of the Turks was around 90% or so on transcribing the labels. We got about 25 man hours of work accomplished in about 42 hours of actual time at a cost of about $25. All told we were really impressed with the service as well as the Turks themselves. We definitely recommend the service for any discrete and repeatable tasks.</p>
<p>Things we learned:</p>
<ul>
<li> Be EXTREMELY clear in your instructions &#8211; try to be as un-ambiguity as possible.</li>
<li> The Turks live and die by their approval rating so be nice (we just accepted every task).</li>
<li> Unexpected popups and JavaScript errors probably scare people away so try to avoid them.</li>
<li> Obviously higher reward rates are going to attract more Turks &#8211; something to take into account.</li>
</ul>
<p>We&#8217;ve also recently become fascinated by other things that could be played out or experimented with the Turks. Notably it seems like an ideal venue to experiment with some game theory topics. </p>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2008/11/20/artificial-artificial-intelligence-our-experiance-with-mechanical-turk/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

