<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Electric Pineapple</title>
	
	<link>http://electricpineapple.net</link>
	<description>Powered by Fruit?</description>
	<lastBuildDate>Wed, 03 Mar 2010 17:10:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain="electricpineapple.net" port="80" path="/?rsscloud=notify" registerProcedure="" protocol="http-post" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/electricpineapple" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="electricpineapple" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Making the most of your toy robot (Part 2 of 4) – Processing the video stream in Flash</title>
		<link>http://electricpineapple.net/2010/03/01/making-the-most-of-your-toy-robot-part-2-of-4-%e2%80%93-processing-the-video-stream-in-flash/</link>
		<comments>http://electricpineapple.net/2010/03/01/making-the-most-of-your-toy-robot-part-2-of-4-%e2%80%93-processing-the-video-stream-in-flash/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 22:58:41 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://electricpineapple.net/?p=241</guid>
		<description><![CDATA[Now that we can move the robot, we need to be able to see where we are going. To give our robot eyes within flash, I first tried a series of images using the still image command from the Rovio api (/Jpeg/CamImg[value].jpg). This produced stuttering, unreliable quality video. I needed to get at the video [...]]]></description>
			<content:encoded><![CDATA[<p>Now that we can <a href="http://electricpineapple.net/2010/02/11/making-the-most-of-your-toy-robot-part-1-of-4-custom-hardware-controls/">move the robot</a>, we need to be able to see where we are going. To give our robot eyes within flash, I first tried a series of images using the still image command from the Rovio api (/Jpeg/CamImg[value].jpg). This produced stuttering, unreliable quality video. I needed to get at the video stream that Rovio broadcasts, the RTSP stream (Rtsp://xxx.xxx.xxx.xxx/webcam). To get the video stream into flash it needed to be transcoded to flv. The go-between for the video was a Red 5 server which took in the live Rovio RTSP stream and output a live flv stream. Catching the flv stream was a netstream connected to a video object. This provided a much cleaner, smoother image for driving the robot.</p>
<p>Not only did the robot need eyes, he also needed to be able to recognize what he was looking at. The objective of the interactive was to have young children track down specific objects on a surface. To give them a prompt and to make the video of the surface a bit more interesting, a target was to be overlayed on the video pointing to where the object was. This meant that the Rovio would need to distinguish between the unique objects on the driving surface. So what set the objects apart from each other?</p>
<p>Shape and size: Using these characteristics and constructing custom object (<a href="http://www.quasimondo.com/archives/000687.php" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.quasimondo.com/archives/000687.php?referer=');">similar to facial</a>) recognition using <a href="http://opencv.willowgarage.com/wiki/FullOpenCVWiki" target="_blank" onclick="pageTracker._trackPageview('/outgoing/opencv.willowgarage.com/wiki/FullOpenCVWiki?referer=');">opencv</a> and <a href="http://note.sonots.com/SciSoftware/haartraining.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/note.sonots.com/SciSoftware/haartraining.html?referer=');">haartraining</a> the different objects could be &#8220;seen&#8221; by the rover. This ended up being a balance of accuracy and speed, of which neither was good enough to use in the application.</p>
<p>Position: Using the rover&#8217;s position, both location and orientation, the specific object could be determined from its coordinates. The numbers coming back from the rover, through the beacon, ended up being too cryptic and not reliable enough to give specific positioning information, especially for moving a precise onscreen target. There was also no way to get vertical movement information.</p>
<p>Color: Pairing a unique color with the object to be identified could allow color detection to run the brain of the rover. This ended up being the most streamlined and accurate approach to identifying object in the interactive. Using a vibrant red, green and blue gave enough differentiation between the objects to bring up specific prompts for each target. Running the color detection on the video stream and then creating a box around the identified color gave a specific position in the video frame. The target could then be positioned in the center of the box, and exceptions could be made for outlying false positives. Color scraps could be disregarded and focus could be on heavy concentrations of the specific colors. Below you can see the blue box (hidden when not in debug mode) surrounding the green colored image.</p>
<p><img class="size-full wp-image-268 alignnone" title="Non lit color" src="http://electricpineapple.net/wp-content/uploads/2010/03/boxcolordetect.png" alt="Non lit colored box" width="277" height="261" /></p>
<p><img class="size-full wp-image-273 alignnone" title="blacked out boxes" src="http://electricpineapple.net/wp-content/uploads/2010/03/blackedout3.png" alt="blacked out boxes" width="556" height="462" /></p>
<p>Lighting greatly impacted the color detection on the objects. Above is a picture of two of the colored boxes blacked out by the  background window light. The objects needed to be lit from a reliable, consistent source of light. This light would have to be pointed on the object or what was done in this case from within the object. The targets were lit with colored light to attempt to nullify lighting differences due to sunny or cloudy days (the interactive being in a heavily windowed area). Below are images against the window areas. First, the transparent gels of the three different colors (the red needed some help and has a light behind it). Second is a stronger light competing with the self lit color cone.</p>
<p><img class="alignnone size-full wp-image-270" title="Colored tubes" src="http://electricpineapple.net/wp-content/uploads/2010/03/tubes.png" alt="Colored tubes" width="554" height="331" /></p>
<p><img class="alignnone size-full wp-image-271" title="With light" src="http://electricpineapple.net/wp-content/uploads/2010/03/lightin.png" alt="Color cone with light behind" width="553" height="528" /></p>
<p>Recipe for robot eyes:<br />
<a href="http://www.wowwee.com/en/products/tech/telepresence/rovio/rovio" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.wowwee.com/en/products/tech/telepresence/rovio/rovio?referer=');">Wowwee Rovio</a><br />
<a href="http://osflash.org/red5" target="_blank" onclick="pageTracker._trackPageview('/outgoing/osflash.org/red5?referer=');">Red 5 video server</a><br />
<a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/NetStream.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/NetStream.html?referer=');">Flash netstream/video objects</a><br />
<a href="http://livedocs.adobe.com/flex/3/langref/flash/display/BitmapData.html#getColorBoundsRect%28%29" target="_blank" onclick="pageTracker._trackPageview('/outgoing/livedocs.adobe.com/flex/3/langref/flash/display/BitmapData.html_getColorBoundsRect_28_29?referer=');">Color detection</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electricpineapple.net/2010/03/01/making-the-most-of-your-toy-robot-part-2-of-4-%e2%80%93-processing-the-video-stream-in-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Widget update</title>
		<link>http://electricpineapple.net/2010/02/18/widget-update/</link>
		<comments>http://electricpineapple.net/2010/02/18/widget-update/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 18:19:16 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://electricpineapple.net/?p=240</guid>
		<description><![CDATA[
A year ago I published a post about widgets coming to the television. A year later I have widgets on my TV. Now that I have experienced the widgets first hand, there is not much change to my feelings about the basics of the previous post.
There is still no bridge between the cable content coming [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://connectedtv.yahoo.com/services/tv-widgets" onclick="pageTracker._trackPageview('/outgoing/connectedtv.yahoo.com/services/tv-widgets?referer=');"><img class="alignnone size-full wp-image-258" title="Widgets" src="http://electricpineapple.net/wp-content/uploads/2010/02/widgetbarsm.png" alt="Widgets" width="600" height="51" /></a></p>
<p>A year ago I published a <a href="http://electricpineapple.net/2009/03/01/interteletube-widgets/">post about widgets coming to the television</a>. A year later I <a href="http://www.vizio.com/flat-panel-hdtvs/sv472xvt.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.vizio.com/flat-panel-hdtvs/sv472xvt.html?referer=');">have widgets on my TV</a>. Now that I have experienced the widgets first hand, there is not much change to my feelings about the basics of the previous post.</p>
<p>There is still no bridge between the cable content coming over the wire and the widgets on screen. Widget content cannot be populated by on-screen cable content. This leaves out advertising tie-ins and related content that would be automatically populated.</p>
<p>There are however widgets for pulling video content from online. This enables the content to interact with additional features. The main downside to the online content is the timeliness of the content in comparison to traditional counterparts. There is very little to no live television content being delivered through the widget interface, or anywhere online. Any online movie rentals or purchases are delayed by at least a month compared to in-store movies.</p>
<p>HD is another problem area for online content. There are allot of bits to move for HD content and until broadband infrastructure is in place to handle the content, a coaxial cable is the only option.</p>
<p>Online content delivery still needs time to develop and find a viable business model. Timely content will not be allowed to move to an online market unless it promises not to threaten the more profitable traditional models, and until timely content is delivered people will still want cable/satellite and physical dvd rental.</p>
]]></content:encoded>
			<wfw:commentRss>http://electricpineapple.net/2010/02/18/widget-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making the most of your toy robot (Part 1 of 4) – Custom hardware controls</title>
		<link>http://electricpineapple.net/2010/02/11/making-the-most-of-your-toy-robot-part-1-of-4-custom-hardware-controls/</link>
		<comments>http://electricpineapple.net/2010/02/11/making-the-most-of-your-toy-robot-part-1-of-4-custom-hardware-controls/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 20:15:38 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://electricpineapple.net/?p=217</guid>
		<description><![CDATA[Using a keyboard to navigate a virtual space; be it the internet, a game or some other format, is familiar to most adults and older children. The Wowwee Rovio (rover) can be driven by such keyboard controls or mouse clicks with the built-in interface. Couple of problems with this however:

The interactive needed a custom interface [...]]]></description>
			<content:encoded><![CDATA[<p>Using a keyboard to navigate a virtual space; be it the internet, a game or some other format, is familiar to most adults and older children. The Wowwee Rovio (rover) can be driven by such keyboard controls or mouse clicks with the built-in interface. Couple of problems with this however:</p>
<ol>
<li><strong>The interactive needed a custom interface so the built-in web interface (and keyboard controls) would not work.</strong></li>
<li><strong>The interactive needed to be accessible to children as young as 3 years old.</strong></li>
</ol>
<p><br/>The custom interface was built with ActionScript3 and so to move the rover, the api was used. With the api, the rover could be sent movements via http requests. These api requests needed to be mapped back to user input and so the web interface was recreated in with as3. The ASDW keys were mapped back to specific movement requests via the api. This is a specific piece of code initiated by a keypress that gets sent to the rover:</p>
<p><code>switch(e.keyCode){<br />
//forward<br />
case 87: //W key<br />
drive = 1; //1 maps to forward<br />
speed = 1;<br />
request.data = "Cmd=nav&amp;action=18&amp;drive=" + drive +  "&amp;speed="+speed; //action 18 is manual drive mode<br />
loader.load(request);<br />
break;<br />
}</code></p>
<p><a href="http://www.happcontrols.com/joysticks/universal_joy_e.htm" onclick="pageTracker._trackPageview('/outgoing/www.happcontrols.com/joysticks/universal_joy_e.htm?referer=');"><img class="alignleft" style="margin-left: 5px; margin-right: 10px;" title="Happ Joystick" src="http://www.happcontrols.com/images/50/50604800_exploded.gif" alt="Happ Joystick" width="90" height="256" /></a></p>
<p>The drive variable signals the command/direction for the rover (forward, backward, rotate right) and the speed variable is how fast the command should be executed by the rover. Sending one of these http requests would move the rover a fraction of an inch. Mapping each key to a specific movement and sending multiple commands successively reproduces the motion of the built-in interface. This does not remedy our problem of simplifying the interface for 3 year olds. This is where the custom hardware comes in.</p>
<p>Our custom hardware consists primarily of a joystick but also includes some auxiliary buttons for game functionality which I will describe in a following post. The hardware came from <a href="http://www.happcontrols.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.happcontrols.com/?referer=');">Suzo Happ</a> and also included a UGCI board for USB interface. The UGCI board had an included key-mapping utility which was used to map the joystick and button contacts to key presses. A constant connection with the joystick in any direction sent a repeating key press rather than a key up and down.</p>
<p>With key presses mapped to the joystick control and to the rover&#8217;s api through actionscript, the rover could now be driven with custom joystick controls. Now if only our rover could see&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://electricpineapple.net/2010/02/11/making-the-most-of-your-toy-robot-part-1-of-4-custom-hardware-controls/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Making the most of your toy robot</title>
		<link>http://electricpineapple.net/2010/01/30/making-the-most-of-your-toy-robot/</link>
		<comments>http://electricpineapple.net/2010/01/30/making-the-most-of-your-toy-robot/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 16:42:55 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://electricpineapple.net/?p=174</guid>
		<description><![CDATA[
Over the past months at work I have been taking a consumer mobile webcam (robot) and converting it to custom interactive experience. Over the next couple of weeks I will be talking about some of the finer point of taking an off-the-shelf WowWee Rovio (which comes with some fine built-in features) and transforming it into [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://electricpineapple.net/wp-content/uploads/2010/01/atplay.png"><img class="size-full wp-image-192  alignright" style="margin-left: 5px; margin-right: 5px;" title="robots at play" src="http://electricpineapple.net/wp-content/uploads/2010/01/atplay.png" alt="Caution robots at play" width="300" height="300" /></a></p>
<p>Over the past months at work I have been taking a consumer mobile webcam (robot) and converting it to custom interactive experience. Over the next couple of weeks I will be talking about some of the finer point of taking an off-the-shelf <a href="http://www.wowwee.com/en/products/tech/telepresence/rovio/rovio" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.wowwee.com/en/products/tech/telepresence/rovio/rovio?referer=');">WowWee Rovio</a> (which comes with some fine built-in features) and transforming it into something much more. I will be talking about the following modifications in the coming weeks:</p>
<ul>
<li><a href="http://electricpineapple.net/2010/02/11/making-the-most-of-your-toy-robot-part-1-of-4-custom-hardware-controls/"><strong>Custom hardware controls</strong></a></li>
<li><a href="http://electricpineapple.net/2010/03/01/making-the-most-of-your-toy-robot-part-2-of-4-%E2%80%93-processing-the-video-stream-in-flash/"><strong>Processing the video stream in Flash</strong></a></li>
<li><strong>Object detection</strong></li>
<li><strong>Docks and Beacons</strong></li>
</ul>
<p>This is on the side of the Rovio box:</p>
<p><a href="http://electricpineapple.net/wp-content/uploads/2010/01/notatoy.png"><img class="alignnone size-full wp-image-195" title="notatoy" src="http://electricpineapple.net/wp-content/uploads/2010/01/notatoy.png" alt="This product is not a toy." width="270" height="259" /></a></p>
<p>I will be proving this incorrect.</p>
]]></content:encoded>
			<wfw:commentRss>http://electricpineapple.net/2010/01/30/making-the-most-of-your-toy-robot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing – software or students</title>
		<link>http://electricpineapple.net/2010/01/19/testing-software-or-students/</link>
		<comments>http://electricpineapple.net/2010/01/19/testing-software-or-students/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 05:44:15 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://electricpineapple.net/?p=175</guid>
		<description><![CDATA[I was recently putting together a test plan for some interactives that we are deploying in the next couple of months. As I was putting the pieces together I was realizing that software testing is very similar to something I had previously done, writing educational goals for children with disabilities. I guess I have a [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently putting together a test plan for some interactives that we are deploying in the next couple of months. As I was putting the pieces together I was realizing that software testing is very similar to something I had previously done, writing educational goals for children with disabilities. I guess I have a unique work history that would reveal this fact but it may be interesting for some in either profession.</p>
<p>First the <span style="color: #b21257;"><strong>condition</strong></span> must be set. This would be the circumstances under which the assessment is performed. This could be further broken down for software into the current state of the application and the action that the user takes to initiate the test. In regards to instruction this could be the classroom conditions or the specific format for the test (worksheet, one-on-one, with a behavioral prompt).</p>
<p>Next is the specific <span style="color: #b21257;"><strong>behavior</strong></span> that is to be observed. This should be something that is both observable and measurable. While the tests that we are performing are higher level tests (functional/usability), this could be applied simpler unit tests that would be measured by simple logic (does 2 + 2 evaluate to be 4?). Seeing that a video plays without visual stuttering would be observable. This behavior could however use some clarifying in terms of what the visual stuttering would be defined as, or would be left to subjective opinion, which may at some point be acceptable. In the educational realm, the behavior could be a students verbal response to a behavioral prompt or responding to a question with a correct answer.</p>
<p>The final relevant similarity is the <span style="color: #b21257;"><strong>criteria</strong></span> used to measure success. In most cases with software testing, the only acceptable criteria is pass or fail, but in some circumstances this could be measured with a success rate/percentage.</p>
<p>Given [<strong><span style="color: #b21257;">condition</span></strong>] the application/student will [<strong><span style="color: #b21257;">behavior</span></strong>] at [<strong><span style="color: #b21257;">criteria</span></strong>]</p>
<p>At it&#8217;s basic level both of these tests are about quantifying behavior and removing subjectivity as much as possible. Someone unfamiliar with the inner workings of the application or the student should be able to record the same results as someone who is familiar with the subject.</p>
]]></content:encoded>
			<wfw:commentRss>http://electricpineapple.net/2010/01/19/testing-software-or-students/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Morton EDC Social Networking</title>
		<link>http://electricpineapple.net/2009/10/31/morton-edc-social-networking/</link>
		<comments>http://electricpineapple.net/2009/10/31/morton-edc-social-networking/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 03:54:47 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://electricpineapple.net/?p=155</guid>
		<description><![CDATA[I and fellow Iona Group developer, Mark Tovey, had the chance to present a basics of social media for the Morton, IL Economic Development Council&#8217;s LEAP (Local Education, Affordable Price) session.
Edc Leap Social Media

View more presentations from electricpineapple.

Social networking on the web is just an extension of social networking in person. You are connecting with [...]]]></description>
			<content:encoded><![CDATA[<p>I and fellow Iona Group developer, Mark Tovey, had the chance to present a basics of social media for the Morton, IL Economic Development Council&#8217;s LEAP (Local Education, Affordable Price) session.</p>
<div style="width: 425px; text-align: left;"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" title="Edc Leap Social Media" href="http://www.slideshare.net/electricpineapple/edc-leap-social-media" onclick="pageTracker._trackPageview('/outgoing/www.slideshare.net/electricpineapple/edc-leap-social-media?referer=');">Edc Leap Social Media</a><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=edcleapsocialmedia-091028230541-phpapp02&amp;stripped_title=edc-leap-social-media" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=edcleapsocialmedia-091028230541-phpapp02&amp;stripped_title=edc-leap-social-media" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<div id="__ss_2372334" style="width: 425px; text-align: left;">
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/" onclick="pageTracker._trackPageview('/outgoing/www.slideshare.net/?referer=');">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/electricpineapple" onclick="pageTracker._trackPageview('/outgoing/www.slideshare.net/electricpineapple?referer=');">electricpineapple</a>.</div>
</div>
<p>Social networking on the web is just an extension of social networking in person. You are connecting with other people for a variety of purposes: business, social, common interest. As the internet came along we adapted these same ideas to the tools of the time. Chat rooms and email became the tools of socializing. As the web became more of a marketplace of ideas it became more social. Specific tools to socialize became available adding yet another avenue to network with others.</p>
<p>Because social media is so prevalent it is a hot place to be in terms of a business. Advertising dollars are continuing to be thrown at the web and at social media and there is growing marketplace on the internet and especially within social media outlets. Why? This is where the people are gathering and talking, why not talk about you?</p>
<p>One of the tools of social media is <a title="Twitter" href="http://twitter.com" target="_blank" onclick="pageTracker._trackPageview('/outgoing/twitter.com?referer=');">Twitter</a>. Twitter is a micro-blogging platform limiting posts (tweets) to 140 characters. This character limitation has its roots in cell phone communication but Twitter has grown since it&#8217;s cell platform start. Twitter is a give and take, where you can follow people and have them follow you. Signing up for Twitter is fairly straight forward. Click on the sign up link, enter your information and start tweeting. If you are a business these micro messages would reflect the message you are trying to deliver about your company. Are you representing an individual at your company or are you the official marketing voice of your company? The answer to this may determine the content of the tweet. Twitter is also good for following others and keeping an ear to the ground about your business&#8217;s buzz. Are customers talking up your service or criticizing you for an area they found lacking. Responding to good or bad can more than make up for the original offense. Being able to head off some bad word of mouth can turn a negative advertisement into a good one. How do you find these people to listen to? Search is a great option to find people in your area, industry or people who are talking about you. There are some directories that may also be helpful (<a title="We follow" href="http://wefollow.com" target="_blank" onclick="pageTracker._trackPageview('/outgoing/wefollow.com?referer=');">wefollow.com</a>) or just using the basic search or &#8220;find people&#8221; functionality on Twitter may be enough to get started. You may also find that by putting out quality information people may start to find you, and if they are not spammers or bots you may very well want to follow them back. If they are interested in your business you are interested in them.</p>
<p>Another tool to connect is <a title="Facebook" href="http://facebook.com" target="_blank" onclick="pageTracker._trackPageview('/outgoing/facebook.com?referer=');">Facebook</a>. Facebook was started on the Harvard campus by Mark Zuckerburg and quickly took root on other college campuses and then around the world. Facebook now has 300 million active users and 50% of those users log on any given day. How does a business take advantage of the networks built on Facebook? Usually through a Fan Page. A fan page is a brand or business landing page on Facebook. The sign up process is similar to Twitter. If you want to build a fan page you can use an existing personal Facebook account or create one fresh. In either case you use the <a title="Fan Page" href="http://www.facebook.com/pages/create.php" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/pages/create.php?referer=');">create a page</a> link on the Facebook&#8217;s home page. From here you can indicate you type of business and the name of the fan page. When you are logged in you need to add some details to the profile and an profile picture to gain a bit more footing as people search and gain information about your business. Add as much information to the profile as possible to enhance the value of your page. Status updates are similar to Twitter&#8217;s tweets.</p>
<p>So why do people share information on the social networks? As with anybody we do things for ourselves. We are promoting a self image, whether it be humorous, helpful, emotional, friendly or any number of different characteristics. So sharing something that triggers on emotions is key to encouraging social marketing. A funny video will get shared around as people want to make others laugh.</p>
<p><!-- Smart Youtube --><span class="youtube"><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/iAvTEVScwjo&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0" /><param name="allowFullScreen" value="true" /><embed wmode="transparent" src="http://www.youtube.com/v/iAvTEVScwjo&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="355" ></embed><param name="wmode" value="transparent" /></object></span></p>
<p>This advertisement for Dove may get shared as people want to encourage a healthy self image:</p>
<p><!-- Smart Youtube --><span class="youtube"><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/iYhCn0jf46U&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0" /><param name="allowFullScreen" value="true" /><embed wmode="transparent" src="http://www.youtube.com/v/iYhCn0jf46U&amp;rel=1&amp;color1=d6d6d6&amp;color2=f0f0f0&amp;border=&amp;fs=1&amp;hl=en&amp;autoplay=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="355" ></embed><param name="wmode" value="transparent" /></object></span></p>
<p>The strength of the emotion and impact of the message increases the sharing potential. These are videos but text or still images can be just as viral. Oprah has been a catalyst for coupon sharing with a KFC grilled chicken promotion and more recently a 50% off Payless shoe coupon that was good for two days only. This type of information relies on getting shared through social tools. People also get a great feeling of helping their fellow man by sharing this information around.</p>
<p>Individuals like to help people by sharing information and that is good for business too. Participating in the community shows that you are a valuable resource and full of expertise. Offering tips or how-to&#8217;s is the equivalent to a physical coupon in that you are giving some information away for free in the hopes of gaining a paying customer. Listen to your community and share back. Dell has done this in an ironic way by <a title="Dell Social Media" href="http://www.facebook.com/dellsocialmedia?v=app_6009294086" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/dellsocialmedia?v=app_6009294086&amp;referer=');">offering advice about social media to small businesses on Facebook</a>. They took their own advice.</p>
<p><a title="Linkedin" href="http://www.linkedin.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/?referer=');">LinkedIn</a> is another social tool more designed for professionals within business rather than businesses themselves. This may be a good way to gain credibility with people within your field. There is a similar simple sign up process and a free or subscription level of service.</p>
<p>To utilize these networks to their fullest you will want to connect them. Use your business website to advertise your membership in each of these platforms. Know that to get the most out of social media networking you need to put time in. Leaving a Twitter account dormant could be just as damaging as not having one at all. This may indicate to customers that you are not listening or contributing anything to the community. So communicate with sincerity and with the intention of advancing your business&#8217;s place in the community. This is a legitimate marketing venture.</p>
<p>And if you wondering the results of your labor there are a few ways to track statistics. Facebook fan pages and <a title="Youtube" href="http://youtube.com" target="_blank" onclick="pageTracker._trackPageview('/outgoing/youtube.com?referer=');">Youtube</a> videos have built-in numbers associated with their content. If you want a bit more granularity you could share links you may have via a url shortener like <a title="Bit.ly" href="http://bit.ly" target="_blank" onclick="pageTracker._trackPageview('/outgoing/bit.ly?referer=');">bit.ly</a>. Many of these services will offer statistics on individual links, such as how many clicks and where the clicks are coming from (both platform and geographic location). And if you are looking for more feed back on whether social media is working, look to the quality of conversation being conducted between you and your customer.</p>
<p><a title="EDC Leap" href="http://delicious.com/tag/edcleap" target="_blank" onclick="pageTracker._trackPageview('/outgoing/delicious.com/tag/edcleap?referer=');">Social Media Delicious links</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electricpineapple.net/2009/10/31/morton-edc-social-networking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flipping for new media delivery</title>
		<link>http://electricpineapple.net/2009/07/29/flipping-for-new-media-delivery/</link>
		<comments>http://electricpineapple.net/2009/07/29/flipping-for-new-media-delivery/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 03:21:41 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://electricpineapple.net/?p=142</guid>
		<description><![CDATA[For good or for bad the television experience, at some point, involves plopping down on the couch, turning on the television and flipping. Having to not make a decision of what to watch before getting a 3 second preview. In what I hope will be a new emerging media delivery model, streaming internet video does [...]]]></description>
			<content:encoded><![CDATA[<p>For good or for bad the television experience, at some point, involves plopping down on the couch, turning on the television and flipping. Having to not make a decision of what to watch before getting a 3 second preview. In what I hope will be a new emerging media delivery model, streaming internet video does not offer this method of viewing. This is not the only shortfall of bringing the masses into the fold of internet television (hardware being the largest) but it is something to consider. My proposal: have a favorites list of channels/networks that would mimic televisions stations (this could be preset with popular sets and customizable). When &#8220;flipping&#8221; a &#8220;channel&#8221; would play a 10-15 second cold opening to draw viewers in and commercials could be inserted at any time after this. These programs could recycle after a 30 minute period to also mimic television operation. This concern may be a way off and is not the ideal operation of internet delivered video but I would like to see more people on board with a new model, this may be a piece in bridging the gap.</p>
]]></content:encoded>
			<wfw:commentRss>http://electricpineapple.net/2009/07/29/flipping-for-new-media-delivery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bookmark ‘em Danno (social bookmarking web interface)</title>
		<link>http://electricpineapple.net/2009/04/27/bookmark-em-danno/</link>
		<comments>http://electricpineapple.net/2009/04/27/bookmark-em-danno/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 15:14:55 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://electricpineapple.net/?p=96</guid>
		<description><![CDATA[Options available for a handful of bookmarking/sharing sites in the form of a url string.]]></description>
			<content:encoded><![CDATA[<p>Many of the social bookmarking sites have apis that offer a wide variety of options for posting, searching, and other combination of actions. Maybe you don&#8217;t want to delve into the api, maybe you don&#8217;t want to deal with user verification information, or maybe for some reason it just is not working. Well there is a way to pass all of these sites simple url strings that will achieve the basic posting information and these strings are often used for blog bookmarking icons like the ones below (go ahead and click all of them at the bottom of this page and show some love). The following are some of the options available for a handful of bookmarking/sharing sites in the form of a url string.</p>
<p><strong>Twitter &#8211; </strong><br />
Simple one option url to post status message:</p>
<p>http://twitter.com/home?</p>
<p><span style="color: #b21257;"><em>status</em></span>=Great+post+on+social+bookmarking+http://electricpineapple.net/?p=96+%23electricpineapple</p>
<p>Basic options for most sites include the url, title and additional information (notes, description, etc). Urls may work without encoding but for best results everything should be url encoded.</p>
<p><strong>Delicious -</strong></p>
<p>http://delicious.com/save?</p>
<p><span style="color: #b21257;"><em>url</em></span>=http://electricpineapple.net/?p=96&amp;<br />
<span style="color: #b21257;"><em>title</em></span>=Bookmark%20%27em%20Danno&amp;<br />
<span style="color: #b21257;"><em>notes</em></span>=Check out this awesome post</p>
<p><strong>Digg -</strong></p>
<p>http://digg.com/submit?</p>
<p><span style="color: #b21257;"><em>url</em></span>=http://electricpineapple.net/?p=96&amp;<br />
<span style="color: #b21257;"><em>title</em></span>=Bookmark%20%27em%20Danno&amp;<br />
<span style="color: #b21257;"><em>bodytext</em></span>=Great post on social bookmarking&amp;<br />
<span style="color: #b21257;"><em>media</em></span>=news&amp;<br />
<span style="color: #b21257;"><em>topic</em></span>=Programming</p>
<p>Media options for digg are news, video or image. Topics are a fixed list of items. Digg had good <a href="http://digg.com/tools/integrate#3" onclick="pageTracker._trackPageview('/outgoing/digg.com/tools/integrate_3?referer=');">documentation</a> for this feature.</p>
<p><strong>Facebook -</strong></p>
<p>http://www.facebook.com/share.php?</p>
<p><span style="color: #b21257;"><em>u</em></span>=http://electricpineapple.net/?p=96&amp;<br />
<span style="color: #b21257;"><em>t</em></span>=Bookmark%20%27em%20Danno</p>
<p><strong>LinkedIn -</strong></p>
<p>http://www.linkedin.com/shareArticle?</p>
<p><span style="color: #b21257;"><em>mini</em></span>=true&amp;<br />
<span style="color: #b21257;"><em>url</em></span>=http%3A%2F%2Felectricpineapple.net%2F%3Fp%3D96&amp;<br />
<span style="color: #b21257;"><em>title</em></span>=Bookmark%20%27em%20Danno&amp;<br />
<span style="color: #b21257;"><em>source</em></span>=Electric+Pineapple&amp;<br />
<span style="color: #b21257;"><em>summary</em></span>=Options%20available%20for%20a%20handful%20of%20bookmarking%2F<br />
sharing%20sites%20in%20the%20form%20of%20a%20url%20string</p>
<p>The mini parameter is required to be true. LinkedIn also was well <a href="http://www.linkedin.com/static?key=developers_widget_shareonlinkedin" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/static?key=developers_widget_shareonlinkedin&amp;referer=');">documented</a>.</p>
<p><strong>Reddit -</strong></p>
<p>http://www.reddit.com/submit?</p>
<p><span style="color: #b21257;"><em>url</em></span>=http%3A%2F%2Felectricpineapple.net%2F%3Fp%3D3&amp;<br />
<span style="color: #b21257;"><em>title</em></span>=Bookmark%20%27em%20Danno</p>
<p><strong>Google Bookmarks -</strong></p>
<p>http://www.google.com/bookmarks/mark?</p>
<p><span style="color: #b21257;"><em>op</em></span>=edit&amp;<br />
<span style="color: #b21257;"><em>bkmk</em></span>=http%3A%2F%2Felectricpineapple.net%2F%3Fp%3D96&amp;<br />
<span style="color: #b21257;"><em>title</em></span>=Bookmark%20%27em%20Danno&amp;<br />
<span style="color: #b21257;"><em>labels</em></span>=Social%20Bookmarking&amp;<br />
<span style="color: #b21257;"><em>annotation</em></span>=Options%20available%20for%20a%20handful%20of%20bookmarking%2F<br />
sharing%20sites%20in%20the%20form%20of%20a%20url%20string</p>
<p>The op parameter is required for submitting. Labels and annotation are additional information fields.</p>
<p><strong>Myspace -</strong></p>
<p>http://www.myspace.com/Modules/PostTo/Pages/?</p>
<p><span style="color: #b21257;"><em>u</em></span>=http%3A%2F%2Felectricpineapple.net%2F%3Fp%3D96&amp;<br />
<span style="color: #b21257;"><em>t</em></span>=Bookmark%20%27em%20Danno</p>
<p><strong>Slashdot -</strong></p>
<p>http://slashdot.org/bookmark.pl?</p>
<p><span style="color: #b21257;"><em>title</em></span>=Bookmark%20%27em%20Danno&amp;<br />
<span style="color: #b21257;"><em>url</em></span>=http%3A%2F%2Felectricpineapple.net%2F%3Fp%3D96</p>
<p><strong>Stumbleupon -</strong></p>
<p>http://www.stumbleupon.com/submit?</p>
<p><span style="color: #b21257;"><em>url</em></span>=http%3A%2F%2Felectricpineapple.net%2F%3Fp%3D96&amp;<br />
<span style="color: #b21257;"><em>title</em></span>=Bookmark%20%27em%20Danno</p>
<p><strong>Newsvine -</strong></p>
<p>http://www.newsvine.com/_tools/seed&amp;save?</p>
<p><span style="color: #b21257;"><em>u</em></span>=http%3A%2F%2Felectricpineapple.net%2F%3Fp%3D96&amp;<br />
<span style="color: #b21257;"><em>h</em></span>=Bookmark%20%27em%20Danno</p>
<p><strong>Technorati -</strong></p>
<p>http://technorati.com/faves?</p>
<p><span style="color: #b21257;"><em>add</em></span>=http%3A%2F%2Felectricpineapple.net%2F%3Fp%3D96</p>
<p>This is by far a complete list, please add your own favorite sites in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://electricpineapple.net/2009/04/27/bookmark-em-danno/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Api keys to the kingdom (addendum for Air with Drupal Services)</title>
		<link>http://electricpineapple.net/2009/03/15/api-keys-to-the-kingdom-addendum-for-air-with-drupal-services/</link>
		<comments>http://electricpineapple.net/2009/03/15/api-keys-to-the-kingdom-addendum-for-air-with-drupal-services/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 04:08:40 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://electricpineapple.net/?p=87</guid>
		<description><![CDATA[The difference between setting up Drupal Services for a Flex 3 project and for an Air project is a few slight modifications. Using my tutorial for connecting a Flex project with Services and making the changes below will get Air connected with Drupal Services.

You will need to create an Air project instead of a Flex [...]]]></description>
			<content:encoded><![CDATA[<p>The difference between setting up Drupal Services for a Flex 3 project and for an Air project is a few slight modifications. Using <a href="http://electricpineapple.net/?p=32">my tutorial for connecting a Flex project</a> with Services and making the changes below will get Air connected with Drupal Services.</p>
<ol>
<li>You will need to create an Air project instead of a Flex project in the initial setup in Flex Builder (WindowedApplication vs. Application)</li>
<li>If you did not give the services-config.xml a full path to Drupal Services for the endpoint uri you will need to do that (http://www.mydomain.com/services/amfphp)</li>
</ol>
<p>That&#8217;s it, 2 steps. Air is up and working.</p>
]]></content:encoded>
			<wfw:commentRss>http://electricpineapple.net/2009/03/15/api-keys-to-the-kingdom-addendum-for-air-with-drupal-services/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Api keys to the city (setting up a Flex 3 project with Drupal Services)</title>
		<link>http://electricpineapple.net/2009/03/10/api-keys-to-the-city-setting-up-a-flex-3-project-with-drupal-services/</link>
		<comments>http://electricpineapple.net/2009/03/10/api-keys-to-the-city-setting-up-a-flex-3-project-with-drupal-services/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 04:29:38 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://electricpineapple.net/?p=32</guid>
		<description><![CDATA[With some of the recent changes to the Services module in Drupal and without a great Flex integration example I was pressed to work my way through putting the pieces together. There are some good starter examples but I hope to take this start to finish including the use of api keys and session ids [...]]]></description>
			<content:encoded><![CDATA[<p>With some of the recent changes to the Services module in Drupal and without a great Flex integration example I was pressed to work my way through putting the pieces together. There are some good starter examples but I hope to take this start to finish including the use of api keys and session ids in amfphp service calls. I used this example as my starting point: <a href="http://groups.drupal.org/node/2768" onclick="pageTracker._trackPageview('/outgoing/groups.drupal.org/node/2768?referer=');">A really, really simple Services + AMFPHP example using Flex</a>, but I do repeat many of these steps in this tutorial as well.</p>
<p>Some assumptions:</p>
<ul>
<li>Drupal 6 installed</li>
<li>Views module installed</li>
<li>Services module installed</li>
<li>AMFPHP module installed &#8211; with <a href="http://www.5etdemi.com/blog/archives/2007/01/amfphp-19-beta-2-ridiculously-faster/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.5etdemi.com/blog/archives/2007/01/amfphp-19-beta-2-ridiculously-faster/?referer=');">AMFPHP 1.9 Beta 2</a> &#8211; this needs to be in the amfphp module directory<a href="http://www.5etdemi.com/blog/archives/2007/01/amfphp-19-beta-2-ridiculously-faster/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.5etdemi.com/blog/archives/2007/01/amfphp-19-beta-2-ridiculously-faster/?referer=');"><br />
</a></li>
</ul>
<p>Starting with setting up Drupal, we are going to enable the services module, amfphp module, and for this example node service, system service, user service, and views service. After enabled go to the site building/services and make sure that in settings &#8220;use keys&#8221; and &#8220;use sessid&#8221; is checked (this is done by default). Now go to the keys tab and create a key with the title of the site you are wanting the key to be used for (just a label for your purposes) and the domain which it will reside on (this will be checked by the service call). This process will produce a key we will use later in our flex application. Note this or have this page available.</p>
<p>Now to the Flex side. Create a new project and include in the src directory the services-config.xml that comes with amfphp (in the browser directory). Modify the uri in this line to point to your amfphp service:</p>
<p><code>&lt;endpoint uri="http://flashservices/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/&gt;</code></p>
<p><code>&lt;endpoint uri="/services/amfphp" class="flex.messaging.endpoints.AMFEndpoint"/&gt;</code></p>
<p>This may be different if you have your drupal install inside a directory and not at the root (i.e. /subdir/services/amfphp)</p>
<p>In your project properties/compiler arguments append this line to the existing arguments:</p>
<p>-locale en_US <strong>-services &#8220;services-config.xml&#8221;</strong></p>
<p>We also want to grab the <a href="http://code.google.com/p/as3corelib/" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/as3corelib/?referer=');">as3corlib</a> for its crypto functions. We&#8217;ll use this to hash our api key before passing it to Druapl. Include this in your libs directory.</p>
<p>Now we need to add some remote objects to our Flex project and for this tutorial a couple of forms and a data grid. In this example we will create a new user, automatically log them in, create some node data and view that node data in the data grid (what you do with the information is up to you, this is simply to display different functionality).</p>
<p><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"&gt;<br />
&lt;mx:Script source="ServicesTutorial.as"/&gt;<br />
&lt;mx:RemoteObject showBusyCursor="true" destination="amfphp" source="system" id="system"&gt;<br />
&lt;mx:method name="connect" result="onSystemConnect(event)"  fault="onFault(event)" /&gt;<br />
&lt;/mx:RemoteObject&gt;<br />
&lt;mx:RemoteObject showBusyCursor="true" destination="amfphp" source="node" id="node"&gt;<br />
&lt;mx:method name="save" result="onNodeSaved(event)" fault="onFault(event)"/&gt;<br />
&lt;/mx:RemoteObject&gt;<br />
&lt;mx:RemoteObject showBusyCursor="true" destination="amfphp" source="user" id="user"&gt;<br />
&lt;mx:method name="save" result="onUserSaved(event)" fault="onFault(event)"/&gt;<br />
&lt;mx:method name="login" result="onUserLogin(event)" fault="onFault(event)"/&gt;<br />
&lt;/mx:RemoteObject&gt;<br />
&lt;mx:RemoteObject showBusyCursor="true" destination="amfphp" source="views" id="views"&gt;<br />
&lt;mx:method name="get" result="onViewsResult(event)"  fault="onFault(event)" /&gt;<br />
&lt;/mx:RemoteObject&gt;<br/><br />
&lt;mx:Form&gt;<br />
&lt;mx:FormItem label="Username"&gt;<br />
&lt;mx:TextInput id="usernameInput"/&gt;<br />
&lt;/mx:FormItem&gt;<br />
&lt;mx:FormItem label="Password"&gt;<br />
&lt;mx:TextInput id="passwordInput" displayAsPassword="true"/&gt;<br />
&lt;/mx:FormItem&gt;<br />
&lt;mx:FormItem label="Email"&gt;<br />
&lt;mx:TextInput id="emailInput"/&gt;<br />
&lt;/mx:FormItem&gt;<br />
&lt;mx:FormItem &gt;<br />
&lt;mx:Button label="Register" click="registerUser();"/&gt;<br />
&lt;/mx:FormItem&gt;<br />
&lt;/mx:Form&gt;<br/><br />
&lt;mx:Form&gt;<br />
&lt;mx:FormItem label="Title"&gt;<br />
&lt;mx:TextInput id="titleInput" text="{selectedStories.selectedItem.node_title}"/&gt;<br />
&lt;/mx:FormItem&gt;<br />
&lt;mx:FormItem label="Body"&gt;<br />
&lt;mx:TextArea id="bodyInput" text="{selectedStories.selectedItem.node_revisions_body}"/&gt;<br />
&lt;/mx:FormItem&gt;<br />
&lt;mx:FormItem&gt;<br />
&lt;mx:Button label="Submit" click="saveStory();"/&gt;<br />
&lt;/mx:FormItem&gt;<br />
&lt;/mx:Form&gt;<br/><br />
&lt;mx:DataGrid id="selectedStories" dataProvider="{theStories}"&gt;<br />
&lt;mx:columns&gt;<br />
&lt;mx:DataGridColumn headerText="NID" dataField="nid"/&gt;<br />
&lt;mx:DataGridColumn headerText="Title" dataField="node_title"/&gt;<br />
&lt;mx:DataGridColumn headerText="Body" dataField="node_revisions_body"/&gt;<br />
&lt;/mx:columns&gt;<br />
&lt;/mx:DataGrid&gt;<br/><br />
&lt;/mx:Application&gt;</code></p>
<p>For the remote object the <strong>source</strong> property is the type of service (node, system, user, views), the <strong>destination</strong> matches the the destination ID in the services-config.xml, the <strong>method name</strong> is the service method we want to call (get, save, etc).</p>
<p>These remote objects need their corresponding result handlers so we will create another ActionScript file to hold our script. In this we will create all of the result handlers for our service calls. This including the single fault handler which would ideally would have different messages/actions for each type of service call.</p>
<p><code>import com.adobe.crypto.HMAC;<br />
import com.adobe.crypto.SHA256;<br/><br />
import mx.controls.Alert;<br />
import mx.rpc.events.FaultEvent;<br />
import mx.rpc.events.ResultEvent;<br />
import mx.utils.ArrayUtil;<br/><br />
private var apiKey:String = "your api key from drupal services";<br />
private var apiDomain:String = "your api domain from drupal services";<br/><br />
public function onSystemConnect(event:ResultEvent):void{<br />
}<br/><br />
public function onUserSaved(event:ResultEvent):void{<br />
}<br/><br />
public function onUserLogin(event:ResultEvent):void{<br />
}<br/><br />
public function onNodeSaved(event:ResultEvent):void{<br />
}<br/><br />
public function onViewsResult(event:ResultEvent):void{<br />
}<br/><br />
public function onFault(event:FaultEvent):void{<br />
Alert.show("there was a problem");<br />
}<br/><br />
public function hashKey(serviceMethod:String):Array{<br />
var captureTime:String = (Math.round((new Date().getTime())/1000)).toString();<br />
var captureRandom:String = randomString(10);<br />
var hashString:String = captureTime + ";";<br />
hashString += apiDomain + ";";<br />
hashString += captureRandom +";";<br />
hashString += serviceMethod;<br />
return [HMAC.hash(apiKey,hashString,SHA256),apiDomain,captureTime,captureRandom];<br />
}<br/><br />
private function randomString(Stringlength:Number):String{<br />
var allowedChar:String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";<br />
var allowedArray:Array = allowedChar.split("");<br />
var randomChars:String = "";<br />
for (var i:Number = 0; i &lt; Stringlength; i++){<br />
randomChars += allowedArray[Math.floor(Math.random() * allowedArray.length)];<br />
}<br />
return randomChars;<br />
}</code></p>
<p>At the end of this script is the hashing function which will return an array of the information we need and a helper random string generator. You&#8217;ll notice also that there are imports for the crypto functions in the as3corelib and we have set strings containing our api key and the api domain, fill these in with the information you generated with the services module.</p>
<p>Now we can start calling our services and telling flex what to do with the results. First we will connect to the system to get a session ID from drupal as well as check if there is a user currently logged in. We will call the system.connect method from an init function run in creation complete. Add the creationComplete event to the application and the corresponding function.</p>
<p>mxml:<br />
<code>&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" <strong>creationComplete="init();"</strong>&gt;</code></p>
<p>as:<br />
<code>public function init():void{<br />
system.connect();<br />
}</code></p>
<p>When we get a response from system.connect it returns an object with the session id and a logged in user. We want to retreive this information and store it for subsequent calls. In the onSystemConnect method we&#8217;ll handle the results and store these in appropriate varaibles, we&#8217;ll put these at the top to keep them in scope with the rest of the functions.</p>
<p><code>private var sessionID:String;<br />
private var currentUser:String;<br/><br />
public function onSystemConnect(event:ResultEvent):void{<br />
sessionID = event.result.sessid;<br />
currentUser = event.result.user.name;<br />
}</code></p>
<p>Also for this call to work as an anonymous user we need to open up the permissions allowing anonymous users to connect to services (user/permissions/service module/access services). You&#8217;ll notice that I am storing the user&#8217;s name rather than uid. This is because Flex uses the uid internally as a &#8220;unique identifier.&#8221; When we save the user name with other data Drupal will complete the Drupal uid when it sees the name variable.</p>
<p>After we connect to services we want to do something. I have chosen to give the option to register a new user in Drupal. This next call is the user.save service. We are using the hashKey function and using the returned array as our first arguments for the user.save. We are passing the &#8220;user.save&#8221; string to the hashKey function because we are calling the system.connect method. The session id we retrieved from system.connect will be passed in and a username, password and email which are also required fields for a new user. I have created a new function to handle the registration data called registerUser. You may want some validation on these fields but I am omitting that for length.</p>
<p><code>public function registerUser():void{<br />
var hashedArray:Array = hashKey("user.save");<br />
var userCreate:Object = new Object();<br />
userCreate.name = usernameInput.text;<br />
userCreate.pass = passwordInput.text;<br />
userCreate.mail = emailInput.text;<br />
userCreate.status = 1;<br />
user.save(hashedArray[0], hashedArray[1], hashedArray[2], hashedArray[3], sessionID, userCreate);<br />
}</code></p>
<p>I have also set the status on the userCreate so that the user is immediatly set to active. If this is not done admin approval would be required. And like system.connect for anonnymous users to create a new users, permissions will need to be changed (user_service module/create new users). I am choosing to log the user in right after registration but this could be done in a seperate action. Additional requirements for login are the username and password.</p>
<p><code>public function onUserSaved(event:ResultEvent):void{<br />
var hashedArray:Array = hashKey("user.login");<br />
user.login(hashedArray[0], hashedArray[1], hashedArray[2], hashedArray[3], sessionID, usernameInput.text, passwordInput.text);<br />
}</code></p>
<p>After we log in I&#8217;m going to grab all of the stories that have been created with a view that I have created. This view retrieves the body, title and nid fields from stories.</p>
<p><code>[Bindable]<br />
private var theStories:Array;<br/><br />
public function onUserLogin(event:ResultEvent):void{<br />
var hashedArray:Array = hashKey("views.get");<br />
views.get(hashedArray[0], hashedArray[1], hashedArray[2], hashedArray[3], sessionID, "getUserStories");<br />
}<br/><br />
public function onViewsResult(event:ResultEvent):void{<br />
theStories = ArrayUtil.toArray(event.result);<br />
}</code></p>
<p>Again make sure that you have permissions to access views in the user permissions. Make sure the array we are populating is bindable because this array will populate our datagrid. You should now be able to register a new user, auto login and see the all stories in the data grid. If you wanted to log in an existing user you would have to set up another action to do just the login. The last thing we will do with services is change the content of one of the stories or create new stories by doing a node.save. Using the views that pulled in we can modify that information and send it back to Drupal.</p>
<p><code>public function saveStory():void{<br />
var edit:Object;<br />
if(selectedStories.selectedItem){<br />
edit = selectedStories.selectedItem;<br />
}<br />
else{<br />
edit = new Object;<br />
}<br />
edit.type = "story";<br />
edit.title = titleInput.text;<br />
edit.body = bodyInput.text;<br />
var hashedArray:Array = hashKey("node.save");<br />
node.save(hashedArray[0], hashedArray[1], hashedArray[2], hashedArray[3], sessionID, edit);<br />
}<br/><br />
public function onNodeSaved(event:ResultEvent):void{<br />
var hashedArray:Array = hashKey("views.get");<br />
views.get(hashedArray[0], hashedArray[1], hashedArray[2], hashedArray[3], sessionID, "getUserStories");<br />
}</code></p>
<p>If there is no story selected a new one will be created and saved to the view. After the node is saved it updates the views list. Give all appropriate permissions for these actions (create and edit).</p>
<p>I hope that this is starting point for expanding and using api keys/sessid in service calls from Flex to Drupal. Comments are welcome and I have included a full copy of the mxml and the as files below.</p>
<p><a href="http://electricpineapple.net/uploads/ServicesTutorial.zip">Source zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://electricpineapple.net/2009/03/10/api-keys-to-the-city-setting-up-a-flex-3-project-with-drupal-services/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
	</channel>
</rss>
