<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>Doug's Blog</title>
	<link>http://blog.dougco.com</link>
	<description>Handily dispensing information to .00000001% of the world's population</description>
	<pubDate>Thu, 14 Aug 2008 17:05:53 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>Setting up a Digital Media System</title>
		<link>http://blog.dougco.com/fun-stuff/setting-up-a-digital-media-system/</link>
		<comments>http://blog.dougco.com/fun-stuff/setting-up-a-digital-media-system/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 17:05:53 +0000</pubDate>
		<dc:creator>doug</dc:creator>
		
		<category><![CDATA[Fun Stuff]]></category>

		<category><![CDATA[Hardware]]></category>

		<category><![CDATA[852x480]]></category>

		<category><![CDATA[digital server]]></category>

		<category><![CDATA[dvd to avi]]></category>

		<category><![CDATA[media server]]></category>

		<guid isPermaLink="false">http://blog.dougco.com/fun-stuff/setting-up-a-digital-media-system/</guid>
		<description><![CDATA[For many years I&#8217;ve had my own home file server tucked away in my basement serving all my home file needs. It is a Linux box with 2 Terabytes of storage that acts as:

a NFS file server for other UNIX systems
a Samba file server for Windows systems
a LDAP server for keeping a single location of [...]]]></description>
			<content:encoded><![CDATA[<p>For many years I&#8217;ve had my own home file server tucked away in my basement serving all my home file needs. It is a Linux box with 2 Terabytes of storage that acts as:</p>
<ul>
<li>a NFS file server for other UNIX systems</li>
<li>a Samba file server for Windows systems</li>
<li>a LDAP server for keeping a single location of contacts</li>
<li>an Apache web server for an internal website of links and other information (photos, etc)</li>
<li>a Slimserver daemon that provides support to my <a href="http://slimdevices.com/" title="Slimdevices" target="_blank">Squeezebox</a></li>
<li>a MediaTomb server that provides support to my <a href="http://www.dlink.com/products/?pid=438" target="_blank">DLINK DSM-520</a></li>
<li>an internal Domain Name Server (DNS)</li>
</ul>
<p>and more!</p>
<p>I use this setup to hold all my digital photos, audio (mp3) files, and I&#8217;m now in the process of scanning in my DVD library. So let me take a moment to say &#8220;Just say NO to piracy!&#8221;</p>
<p>I personally have found it to be cost effective to buy used CDs or DVDs and scan them in to get good quality recordings, and all my media stays only on my local server that is inaccessible from the Internet. Aside from the legal issues, who wants to clog up their Internet connection with unnecessary traffic for others?</p>
<p><img src="http://www.slimdevices.com/images/sb3_side_reflection.jpg" align="right" height="113" width="100" /> I&#8217;ll pass along some things I found while building my setup. I never went the iTunes route because I&#8217;ve always used smaller mp3 players that were smaller and cheaper than the iPod. Plus, I want to use a generic format like mp3 and not be limited by what I can play it on. With mp3 I can play all my music on my computer, laptop, stereo (through Slimdevices Squeezebox) or even my DSM-520. It is simple enough to get your CDs into mp3 files so I won&#8217;t go into that.</p>
<p><img src="http://images.dlink.com/products/DSM-520/DSM-520_main.jpg" alt="Inexpensive and nice" align="left" height="180" width="230" />Next, the video portion. I chose the DSM-520 because I wanted a cheap box that had no moving parts (i.e., no hard drive) that would talk nicely to my fileserver. Well, it turns out that it doesn&#8217;t just look for a fileserver using something like Samba &#8212; it requires a UPnP type server to be running. DLINK gives you one, but it is for Windows, and you can&#8217;t really have a Windows box on all the time to that purpose. At least, not reliably <img src='http://blog.dougco.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Seriously, I have linux boxes that have been up for 450 days with no problems. I can&#8217;t let a Windows box go for 3 weeks before all hell breaks loose.</p>
<p>So, I looked around for some <a href="http://en.wikipedia.org/wiki/UPnP_AV_MediaServers" target="_blank">UPnP server</a> software I could use and chose <a href="http://mediatomb.cc/" target="_blank">MediaTomb</a> which I could easily add using Yum. It is simple enough to run, and lets me add video/photos/music that puts references of those files into a MediaTomb database.</p>
<p>Now you need to scan your DVDs into your library! There are various free packages (like handbrake) which I looked at, but in the end I settled on <a href="http://www.slysoft.com/en/clonedvd-mobile.html" target="_blank">CloneDVDMobile</a> which is by SlySoft, a great little company that I&#8217;ve used for their AnyDVD software which allows me to watch my DVDs on my PC (believe it or not, some DVDs refuse to play nice on a PC).</p>
<p>When you use this software, you are given a whole slew of formats to choose from. I used the generic DivX one that produces AVI files. Most DVDs will offer me the 852&#215;480 resolution, and I max out the quality which goes to 25-29 usually. I use 2-pass deinterlacing and prefer saving it as one big file.</p>
<p>The AVI files it produces look great on my win media player, and I had some trouble figuring out how to make it look nice on my DSM-520, and after much hair pulling it turned out that I just had to alter the aspect ratio in the DSM-520&#8217;s settings screen to 16:9 and then it was perfect!</p>
<p>So now I can kick back on my couch and flip through all my DVD titles and watch anything I want with a touch of a button!</p>
<p>Of course now my wife says, &#8220;There&#8217;s nothing here to watch! It&#8217;s all The Matrix and James Bond!&#8221;</p>
<p>So now I need to scan in a bunch of Julia Roberts movies.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dougco.com/fun-stuff/setting-up-a-digital-media-system/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My World Series Experience</title>
		<link>http://blog.dougco.com/poker/my-world-series-experience/</link>
		<comments>http://blog.dougco.com/poker/my-world-series-experience/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 02:16:56 +0000</pubDate>
		<dc:creator>doug</dc:creator>
		
		<category><![CDATA[Poker]]></category>

		<category><![CDATA[world series of poker]]></category>

		<category><![CDATA[wsop]]></category>

		<guid isPermaLink="false">http://blog.dougco.com/poker/my-world-series-experience/</guid>
		<description><![CDATA[I was at some of the World Series of Poker 2008 and it was my first time at the event. I was only there for 4 days, and I played in event 48, a no-limit hold &#8216;em event that was set to last 3 days if you made it to the final table. It started [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://pokerow.files.wordpress.com/2008/05/wsop-pix1.jpg" align="left" height="194" width="200" />I was at some of the World Series of Poker 2008 and it was my first time at the event. I was only there for 4 days, and I played in event 48, a no-limit hold &#8216;em event that was set to last 3 days if you made it to the final table. It started with about 2,600 people and I managed to outlast my friends to make it to busting out around with 500 people left. You know what all the losers say, &#8220;I didn&#8217;t make the money but it was a great experience.&#8221; There is some truth to that if it is your first time at the WSOP! It is a bit like poker heaven. All the table felt is brand new with no worn down sections like the crappy cardhouse near me. All the cards are new and crisp, and the atmosphere is electric.</p>
<p>There is one hand I had in the early rounds which goes as follows. The blinds were 25-50, I had about $3500 in chips, and I had  <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/7s.gif" border="0" style="margin-bottom:-3px"> <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/7h.gif" border="0" style="margin-bottom:-3px"> in early position. I open raise to $200, and I get three callers.</p>
<p>The flop is  <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/7c.gif" border="0" style="margin-bottom:-3px"> <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/8c.gif" border="0" style="margin-bottom:-3px"> <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/9h.gif" border="0" style="margin-bottom:-3px">. I am first to act and bet out $500. The first person folds, the second and third people call.</p>
<p>The turn is  <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/Jh.gif" border="0" style="margin-bottom:-3px">. I bet out $1000 and he calls. The river puts another possibility out there,  <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/2c.gif" border="0" style="margin-bottom:-3px">. At this point, I check. The fact that both of these guys are hanging around doesn&#8217;t make me happy. I have bottom set, and there is a potential straight and flush out there.</p>
<p>The first guy checks, the second guy goes all-in and has me covered by a little bit. It is early in the tournament and I figure that I don&#8217;t want to bust out so early, and I still have enough chips to get back in the tournament, so I fold.</p>
<div>
	<div class='democracy'>
		<strong class="poll-question">What would you have done in this situation?</strong>
		<div class='dem-results'>
		<form action='http://blog.dougco.com/wp-content/plugins/democracy/democracy.php' onsubmit='return dem_Vote(this)'>
		<ul>
			<li>
					<input type='radio' id='dem-choice-6' value='6' name='dem_poll_2' />
					<label for='dem-choice-6'>Fold</label>
			</li>
			<li>
					<input type='radio' id='dem-choice-7' value='7' name='dem_poll_2' />
					<label for='dem-choice-7'>Call</label>
			</li>
		</ul>
			<input type='hidden' name='dem_poll_id' value='2' />
			<input type='hidden' name='dem_action' value='vote' />
			<input type='submit' class='dem-vote-button' value='Vote' />
			<a href='/feed/?dem_action=view&amp;dem_poll_id=2' onclick='return dem_getVotes("http://blog.dougco.com/wp-content/plugins/democracy/democracy.php?dem_action=view&amp;dem_poll_id=2", this)' rel='nofollow' class='dem-vote-link'>View Results</a>
		</form>
		</div>
	</div></div>
<p>The first guy calls and turns over  <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/Ad.gif" border="0" style="margin-bottom:-3px"> <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/9s.gif" border="0" style="margin-bottom:-3px">. The second guy turns over  <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/Jh.gif" border="0" style="margin-bottom:-3px"> <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/8h.gif" border="0" style="margin-bottom:-3px"> for two pair. Man, I almost jumped out of my seat for laying down to these guys!</p>
<p>I really figured one of these guys either had the Ten or a Club or even a better set. It turns out later the guy who won said he was playing very loose and aggressive to try and chip up fast. Well, poker is a series of lessons, isn&#8217;t it?</p>
<p>I swear this hand left me steaming for a good 15 minutes, but I managed to stay tight until I calmed down and then ramped up my chips for a bit until I lost steam at the end of the day. I can&#8217;t wait until next year <img src='http://blog.dougco.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dougco.com/poker/my-world-series-experience/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Inline Poker Cards</title>
		<link>http://blog.dougco.com/coding/inline-poker-cards/</link>
		<comments>http://blog.dougco.com/coding/inline-poker-cards/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 23:04:14 +0000</pubDate>
		<dc:creator>doug</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Poker]]></category>

		<category><![CDATA[cards]]></category>

		<category><![CDATA[poker blog]]></category>

		<category><![CDATA[wordpress plugin]]></category>

		<guid isPermaLink="false">http://blog.dougco.com/coding/inline-poker-cards/</guid>
		<description><![CDATA[I created a WordPress plugin to display small poker cards in blog posts. Once you install the plugin you can use the nomenclature of:
&#91;Ac&#93;
to show the card of Ace of Clubs for example. You use a two-letter code that is Rank and Suit to show a card. The ranks/suits are as follows:
Ranks:  2, 3, [...]]]></description>
			<content:encoded><![CDATA[<p>I created a WordPress plugin to display small poker cards in blog posts. Once you install the plugin you can use the nomenclature of:</p>
<p>&#91;Ac&#93;</p>
<p>to show the card of Ace of Clubs for example. You use a two-letter code that is Rank and Suit to show a card. The ranks/suits are as follows:</p>
<p>Ranks:  2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, A</p>
<p>Suits: c, d, h, s, x</p>
<p>where c=Clubs, d=Diamonds, h=Hearts, s=Spades, and x=Unknown</p>
<p>So go ahead and tell people how you had your  <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/Ad.gif" border="0" style="margin-bottom:-3px"> <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/Ah.gif" border="0" style="margin-bottom:-3px"> cracked by a donkey with  <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/5c.gif" border="0" style="margin-bottom:-3px"> <IMG SRC="/wp-content/plugins/inline_poker_cards/smallcards/8c.gif" border="0" style="margin-bottom:-3px"> !</p>
<p>Download the plugin <a href="/wp-content/uploads/inline_poker_cards.zip" title="Download the plugin">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dougco.com/coding/inline-poker-cards/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tips Using Amazon EC2</title>
		<link>http://blog.dougco.com/coding/tips-using-amazon-ec2/</link>
		<comments>http://blog.dougco.com/coding/tips-using-amazon-ec2/#comments</comments>
		<pubDate>Wed, 21 May 2008 21:08:57 +0000</pubDate>
		<dc:creator>doug</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Hardware]]></category>

		<category><![CDATA[amazon ec2]]></category>

		<category><![CDATA[ec2 tips]]></category>

		<guid isPermaLink="false">http://blog.dougco.com/coding/tips-using-amazon-ec2/</guid>
		<description><![CDATA[When I started using Amazon&#8217;s EC2 service, I found it hard to gather all the info I needed. There was no easy guide that provided all the steps in an easy format. So, here are some tips I hope some might find helpful. I am interacting with EC2 from a Linux system, so my tips [...]]]></description>
			<content:encoded><![CDATA[<p>When I started using <a href="http://www.amazon.com/EC2-AWS-Service-Pricing/b/ref=sc_fe_l_2?ie=UTF8&amp;node=201590011&amp;no=3435361&amp;me=A36L942TSJ2AJA" target="_blank">Amazon&#8217;s EC2 service</a>, I found it hard to gather all the info I needed. There was no easy guide that provided all the steps in an easy format. So, here are some tips I hope some might find helpful. I am interacting with EC2 from a Linux system, so my tips are from that viewpoint.</p>
<p>I assume you have already done the basics, like <a href="http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key" target="_blank">created your developer account</a> (and know your secret key), and <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351&amp;categoryID=88" target="_blank">installed the command line tools</a>.</p>
<p>Note that you will need <a href="http://java.sun.com/javase/downloads/index.jsp" target="_blank">Java</a> installed on your system for the tools to function.</p>
<p>You can find the official EC2 docs <a href="http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=87" target="_blank">here.</a></p>
<p>Now, on to my tips!</p>
<h3><strong>Find A Starter Image</strong></h3>
<p>You can browse the images at Amazon via the command :</p>
<address><font color="#008000">% ec2-describe-images</font> </address>
<p>You&#8217;ll see a bunch of images that are out there, in different UNIX flavors, and some with LAMP already installed. I found that whatever you pick, you&#8217;ll want to do your own package installs anyway, so just pick a baseline that you like, i.e. Ubuntu or Redhat or whichever you feel comfortable.</p>
<blockquote></blockquote>
<p>Note that you need the AMI string of your choice to continue. Not only will you see a number of Amazon created AMI&#8217;s, but other folks have created some public AMIs that you can choose from. Here are some <a href="http://alestic.com/" target="_blank">AMIs for Ubuntu</a> you can check out.</p>
<h3>Choose A Server Size</h3>
<p>Note that EC2 provides a small, large, and extra-large version your can use. I&#8217;ve found that the small instances are incompatible with the the large and XL, so be careful! You should start with the large if you plan on any expansion whatsoever.</p>
<p>So when you are ready to create an instance, you&#8217;ll need to specify the size (m1.large or m1.xlarge) on the command line otherwise it will default to small, i.e.:</p>
<address><font color="#008000">% ec2-run-instances ami-20b65349 -k gsg-keypair -t m1.large</font></address>
<blockquote></blockquote>
<p>You&#8217;ll need to create a gsg-keypair file first of course. This is described nicely in the command line docs, you&#8217;ll use &#8220;ec2-create-keypair&#8221;.</p>
<p>Note that you can apply a firewall to your instance via the &#8220;-g &lt;name&gt;&#8221; option, where you define a group with the name of &#8220;&lt;name&gt;&#8221;. You can see what groups you have via:</p>
<address><font color="#008000">%  ec2-describe-group</font></address>
<blockquote></blockquote>
<p>You can create these groups using commands like:</p>
<address><font color="#008000">%  ec2-authorize mygroup -P tcp -p 22 -s 0.0.0.0/0</font></address>
<blockquote>
<blockquote></blockquote>
</blockquote>
<h3>Access Your Instance</h3>
<p>After you run an instance, you can check on the progress via:</p>
<address><font color="#008000">%  ec2-describe-instances</font></address>
<p>And you can provide the instance name also, e.g.</p>
<address><font color="#008000">%  ec2-describe-instances i-be9237aaa</font></address>
<p>Then you can SSH into it when it is ready by using the domain name it returns, e.g.</p>
<address><font color="#008000">%  ssh -i gsg-keypair root@ec2-67-200-1-123.z-1.compute-1.amazonaws.com</font></address>
<blockquote>
<blockquote></blockquote>
</blockquote>
<h3>Customize Your Instance</h3>
<p>You should now make sure your instance has all the packages you want, and configure them how you like. I install the latest Apache, MySQL, PHP, Perl, etc, and edit all the configuration files to my liking.fone</p>
<blockquote></blockquote>
<p>Make sure you stay in &#8220;/&#8221;, and do not use &#8220;/mnt&#8221; since this will go away if you reboot and won&#8217;t be saved when you save your instance.</p>
<p>If you need more space, you can use the extra storage service from Amazon although I have not done that at this point.</p>
<p>When you have everything the way you like it, you should save your instance. You will use <a href="http://docs.amazonwebservices.com/AWSEC2/2008-02-01/DeveloperGuide/CLTRG-ami-bundle-vol.html" target="_blank">ec2-bundle-vol</a> to create the image, and <a href="http://docs.amazonwebservices.com/AWSEC2/2008-02-01/DeveloperGuide/CLTRG-ami-upload-bundle.html" target="_blank">ec2-upload-bundle</a> to upload it to Amazon&#8217;s storage service.</p>
<p>You&#8217;ll need your secret key, access key, cert key, user id and a sample command set is as follows. You will run these from your Amazon instance (where real keys and numbers are replaced by X&#8217;s and fake numbers):</p>
<address><font color="#008000">amazon%  ec2-bundle-vol  -d /mnt -k pk-XXXXXXX.pem -c cert-XXXXXXX.pem -u 432132132132 -s 1536</font></address>
<address> </address>
<address> </address>
<address><font color="#008000">amazon%   ec2-upload-bundle -b my_image_name -m /mnt/image.manifest.xml -a XXXXXXX -s XXXXXX</font></address>
<blockquote></blockquote>
<p>Once it is uploaded, you will need to now register it as an AMI image you can access later. You need to do this command from your local host:</p>
<address><font color="#008000">%  ec2-register my_image_name/image.manifest.xml</font></address>
<blockquote></blockquote>
<p>This will output your AMI string that you need to note so you can use it later to use your new instance on new Amazon servers.</p>
<h3>Cleanup When Done</h3>
<p>Don&#8217;t forget to make sure you terminate instances you don&#8217;t need to use anymore, or you will continue to be charged for them! Run &#8220;ec2-describe-instances&#8221; to see what you are running, and then you can use &#8220;ec2-terminate-instances&#8221; with the instance string as an argument to remove them.</p>
<blockquote></blockquote>
<blockquote></blockquote>
<blockquote></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.dougco.com/coding/tips-using-amazon-ec2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Segway Crash!</title>
		<link>http://blog.dougco.com/fun-stuff/segway-crash/</link>
		<comments>http://blog.dougco.com/fun-stuff/segway-crash/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 04:04:29 +0000</pubDate>
		<dc:creator>doug</dc:creator>
		
		<category><![CDATA[Fun Stuff]]></category>

		<category><![CDATA[crash]]></category>

		<category><![CDATA[san francisco]]></category>

		<category><![CDATA[segway]]></category>

		<guid isPermaLink="false">http://blog.dougco.com/fun-stuff/segway-crash/</guid>
		<description><![CDATA[I live near Fisherman&#8217;s Wharf in San Francisco, and for those of you who don&#8217;t know, &#8220;The Wharf&#8221; is one of the most visited tourist area anywhere in the world. And as such, it is filled with all sorts of products and services that a tourist would be drawn towards, such as Alcatraz T-Shirts, Golden [...]]]></description>
			<content:encoded><![CDATA[<p>I live near Fisherman&#8217;s Wharf in San Francisco, and for those of you who don&#8217;t know, &#8220;The Wharf&#8221; is one of the most visited tourist area anywhere in the world. And as such, it is filled with all sorts of products and services that a tourist would be drawn towards, such as Alcatraz T-Shirts, Golden Gate Bridge snow globes, and, yes, you guessed it &#8212; <a href="http://www.segway.com/" target="_blank">Segway</a> tours.</p>
<p>Every now and then I can spy a group of around 20 tourists in single file segwaying around the streets of San Francisco. On this particular day I watched as five of them got into a big pileup and fell over on top of each other in the middle of an intersection! These things are supposed to be easy to ride, but apparently not <em>too</em> easy.</p>
<p>I couldn&#8217;t get my camera out in time to catch the tourists flailing around with their segways on top of them, but here they are trying to drag these things up and out of the way of traffic.</p>
<p align="center"><img src="/wp-content/images/segways.jpg" alt="Boom! Crash!" height="300" width="400" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dougco.com/fun-stuff/segway-crash/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Passing State with a Timer</title>
		<link>http://blog.dougco.com/coding/flex/passing-state-with-a-timer/</link>
		<comments>http://blog.dougco.com/coding/flex/passing-state-with-a-timer/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 00:23:05 +0000</pubDate>
		<dc:creator>doug</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[timer event]]></category>

		<guid isPermaLink="false">http://blog.dougco.com/coding/flex/passing-state-with-a-timer/</guid>
		<description><![CDATA[Early on in my Flex work I found many cases where I needed the function after a timer event to have some more information. In other words, I really needed to pass state of variables to the next function. You could do this by using global variables, but a cleaner way is to create a [...]]]></description>
			<content:encoded><![CDATA[<p>Early on in my Flex work I found many cases where I needed the function after a timer event to have some more information. In other words, I really needed to pass state of variables to the next function. You could do this by using global variables, but a cleaner way is to create a subclass of the Timer class and pass along an object.</p>
<p>To do this, you can create this actionscript class in your main mxml directory (or get fancy and name it within subdirectories) as &#8221; ObjTimer.as&#8221; and the contents are simply:</p>
<pre>
// ActionScript file
// ObjTimer is just a timer that can hold an object of variables to pass along
package {
    import flash.utils.Timer;
    public class ObjTimer extends Timer {
        public var obj:Object = new Object;
        public function ObjTimer(delay:Number, repeatCount:int = 0) {
             super(delay, repeatCount);
        }
    }
}</pre>
<p>and then you can access it from within your mxml like so for example:</p>
<pre>
var newTimer: ObjTimer = new ObjTimer(900,1);
newTimer.obj["myvar1"] = "test";
newTimer.obj["firstname"] = "joe";
newTimer.obj["count"] = 10;
newTimer.addEventListener(TimerEvent.TIMER, handleFunction);
newTimer.start();

private function handleFunction(e:Event):void{
    var value:String = e.target.obj["myvar1"];
    var fn:String = e.target.obj["firstname"];
    var count:int = parseInt(e.target.obj["count"]);
}</pre>
<p>This example is really quick-n-dirty, you can make it nicer by adding setters and getters in the new class, but for an easy implementation this should get you going.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dougco.com/coding/flex/passing-state-with-a-timer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>San Francisco Ready for Olympic Torch Protesters</title>
		<link>http://blog.dougco.com/fun-stuff/san-francisco-ready-for-olympic-torch-protesters/</link>
		<comments>http://blog.dougco.com/fun-stuff/san-francisco-ready-for-olympic-torch-protesters/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 22:49:34 +0000</pubDate>
		<dc:creator>doug</dc:creator>
		
		<category><![CDATA[Fun Stuff]]></category>

		<category><![CDATA[helicoptors]]></category>

		<category><![CDATA[olympic torch]]></category>

		<category><![CDATA[san francisco]]></category>

		<guid isPermaLink="false">http://blog.dougco.com/fun-stuff/san-francisco-ready-for-olympic-torch-protesters/</guid>
		<description><![CDATA[Everyone knows how much of a ruckus the Olympic Torch is causing this year as it traipses its way across the world. Well here in San Francisco the officials did not want the same silliness that ensued in Paris so they are doing a variety of things, which apparently include helicopters, motorcycle police, police running, [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone knows how much of a ruckus the Olympic Torch is causing this year as it traipses its way across the world. Well here in San Francisco the officials did not want the same silliness that <a href="http://www.cnn.com/2008/WORLD/europe/04/07/oly.torchrelay/index.html?eref=rss_topstories#cnnSTCText" title="Paris bungling the torch visit" target="_blank">ensued in Paris</a> so they are doing a variety of things, which apparently include helicopters, motorcycle police, police running, police on bicycles, buses full of police that pour out fresh policemen when the running ones get tired, police on horseback, and a big yellow car shaped like a boat.</p>
<p>Just over my house alone I spotted 10 helicopters, I assume a bunch of them are the media. But who knows? They could be packed with SWAT police ready to rappel down and save the torch. Photos below, click for larger versions.</p>
<p><a href="/wp-content/images/helicopters1.jpg" target="_blank"><img src="/wp-content/images/helicopters1b.jpg" alt="Helicopters protecting the torch" width="200" height="150" /></a> <a href="/wp-content/images/helicopters2.jpg" target="_blank"><img src="/wp-content/images/helicopters2b.jpg" alt="Helicoptors protecting the torch" width="200" height="150" /></a></p>
<p>The crowd was excited and peaceful, I did not see anyone charging the torch with a fire extinguisher or any other fire-intimidating device. Which is great, because, really, why protest the <em>torch </em>for crying out loud! The torch didn&#8217;t hurt anyone. And certainly the 80 year-old man carrying the torch in one hand, and his cane in the other, doesn&#8217;t need anyone yelling at him for the block or two he gets to participate. You want to protest China? Here&#8217;s an idea &#8212; go to the embassy.  Trust me, you don&#8217;t want to <a href="http://en.wikipedia.org/wiki/Fajitagate" title="If the police want your fajita, you give it to them" target="_blank">cross the San Francisco police</a>.</p>
<p><a href="/wp-content/images/torch1.jpg" target="_blank"><img src="/wp-content/images/torch1b.jpg" alt="Police protecting the torch" width="200" height="150" /></a> <a href="/wp-content/images/torch2.jpg" target="_blank"><img src="/wp-content/images/torch2b.jpg" alt="Police protecting the torch" width="200" height="150" /></a></p>
<p><a href="/wp-content/images/torch3.jpg" target="_blank"><img src="/wp-content/images/torch3b.jpg" alt="Police protecting the torch" width="200" height="150" /></a> <a href="/wp-content/images/torch4.jpg" target="_blank"><img src="/wp-content/images/torch4b.jpg" alt="A yellow boat-car protecting the torch" width="200" height="150" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dougco.com/fun-stuff/san-francisco-ready-for-olympic-torch-protesters/feed/</wfw:commentRss>
		</item>
		<item>
		<title>FaceBook Applications</title>
		<link>http://blog.dougco.com/coding/facebook/facebook-applications/</link>
		<comments>http://blog.dougco.com/coding/facebook/facebook-applications/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 22:46:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[FaceBook]]></category>

		<guid isPermaLink="false">http://blog.dougco.com/coding/facebook/facebook-applications/</guid>
		<description><![CDATA[I&#8217;ve been developing some applications on FaceBook and like what they&#8217;ve built as their API framework. It&#8217;s a work in progress, but is growing and getting better. My FaceBook profile is here, and I&#8217;ve built the following applications so far:
 Ujogo Poker: This is a more condensed version of the official Ujogo.com website, and allows [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been developing some applications on FaceBook and like what they&#8217;ve built as their API framework. It&#8217;s a work in progress, but is growing and getting better. My FaceBook profile is <a href="http://www.facebook.com/profile.php?id=748092525" target="_blank">here,</a> and I&#8217;ve built the following applications so far:</p>
<p><a href="http://apps.facebook.com/ujogopoker" target="_blank"><img src="http://photos-f.ak.facebook.com/photos-ak-sctm/v43/221/7218169277/app_1_7218169277_3716.gif" align="left" height="75" width="75" /> Ujogo Poker</a>: This is a more condensed version of the official <a href="http://www.ujogo.com" target="_blank">Ujogo.com</a> website, and allows the FB avatars to be shown, adding friends, seeing user&#8217;s profiles inside the app, and various alerts to users based on performance, etc. The backend code is done in J2EE using the Java API.<br />
<br clear="all" /></p>
<p><a href="http://apps.facebook.com/forgiveness" target="_blank"><img src="http://photos-b.ak.facebook.com/photos-ak-sctm/v43/245/5103502985/app_1_5103502985_1788.gif" align="left" height="75" width="75" />Confessions:</a> This is a game to let users create confessions that are put in front of their group of friends for judgement. The backend is done in PHP using the FaceBook PHP API.<br />
<br clear="all" /></p>
<p><a href="http://apps.facebook.com/drivertest" target="_blank"><img src="http://photos-h.ak.facebook.com/photos-ak-sctm/v43/19/11324052703/app_1_11324052703_6976.gif" align="left" height="75" width="75" />The Driving Test</a>: A test-taking game where you can add your own questions into the database. The backend is in PHP. It is a good thing I have an approval process function for when people submit their own questions, some of the stuff people submit is crazy! Perhaps I&#8217;ll post some of it someday.</p>
<p>All the applications are Flash (SWF) developed in Flex, communicating with standard backend services.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dougco.com/coding/facebook/facebook-applications/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DataGrid with Multiple Pulldowns</title>
		<link>http://blog.dougco.com/coding/flex/datagrid-with-multiple-pulldowns/</link>
		<comments>http://blog.dougco.com/coding/flex/datagrid-with-multiple-pulldowns/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 22:38:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.dougco.com/coding/flex/datagrid-with-multiple-pulldowns/</guid>
		<description><![CDATA[Here is an example that illustrates how you need to add some additional logic when you add ItemRenderers into a DataGrid. The way I came across this problem is I noticed that when I had ItemRenderers doing things like checkboxes or pulldowns, the choices that they were set to on a row basis would CHANGE [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an example that illustrates how you need to add some additional logic when you add ItemRenderers into a DataGrid. The way I came across this problem is I noticed that when I had ItemRenderers doing things like checkboxes or pulldowns, the choices that they were set to on a row basis would CHANGE whenever I scrolled or sorted a column.</p>
<p>I struggled with finding a way, as I talk about in another posting, and found that using the dataChange event does the trick, and I always create the ItemRenderer as a separate component instead of trying to put all the logic in the main mxml. The component gets the initial setting of the value for that cell via &#8220;.data&#8221; and then you need to maintain and check it within the component. This can end up with the coder doing some hacking, and my example is only that &#8212; an example. I&#8217;m sure there are more elegant ways to achieve this. But that&#8217;s one of the things I think Flex shares with Perl &#8212; there are always multiple ways to get something done!</p>
<p>Take a look at the first flash example, where I DON&#8217;T use the dataChange &#8212; then see how it works nicely on the 2nd example.</p>
<p>First example (Try sorting columns and see it randomizes each time):</p>
<p id="swf5e44_4" style="text-align: center"> This movie requires Adobe Flash Player &#8212; Download at www.adobe.com</p>
<p><script type="text/javascript"> var vswf1 = new SWFObject("/wp-content/uploads/flash/test_datagrid1.swf", "id4", "400", "200", "9", "#CCCCCC"); vswf1.addParam("wmode", "transparent"); vswf1.addParam("menu", "false"); vswf1.addParam("quality", "high"); vswf1.write("swf5e44_4"); </script></p>
<p>Second example (Works!):</p>
<p id="swf5e44_8" style="text-align: center"> This movie requires Adobe Flash Player &#8212; Download at www.adobe.com</p>
<p><script type="text/javascript"> var vswf2 = new SWFObject("/wp-content/uploads/flash/test_datagrid2.swf", "id8", "400", "200", "9", "#CCCCCC"); vswf2.addParam("wmode", "transparent"); vswf2.addParam("menu", "false"); vswf2.addParam("quality", "high"); vswf2.write("swf5e44_8"); </script></p>
<p>Download my code sample <a href="/wp-content/uploads/flash/test_datagrid.zip">here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dougco.com/coding/flex/datagrid-with-multiple-pulldowns/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex2 -&gt; Flex3 font size issue</title>
		<link>http://blog.dougco.com/coding/flex/flex2-flex3-font-size-issue/</link>
		<comments>http://blog.dougco.com/coding/flex/flex2-flex3-font-size-issue/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 17:23:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.dougco.com/coding/flex/flex2-flex3-font-size-issue/</guid>
		<description><![CDATA[I switched to Flex3 the other day and found that the font sizing for the default font has changed! So on most of my applications where I
painstakingly sized buttons so that they exactly fit the text label, I now see the text does NOT FIT anymore and has &#8220;&#8230;&#8221; at the end!
The Flex folks have [...]]]></description>
			<content:encoded><![CDATA[<p><font face="Times New Roman" size="3"><span style="font-size: 12pt">I switched to Flex3 the other day and found that the font sizing for the default font has changed! So on most of my applications where I<br />
painstakingly sized buttons so that they exactly fit the text label, I now see the text does NOT FIT anymore and has &#8220;&#8230;&#8221; at the end!</span></font></p>
<p>The Flex folks have some good solutions, see more on <a href="http://tech.groups.yahoo.com/group/flexcoders/message/107044" target="_blank">Flexcoders.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dougco.com/coding/flex/flex2-flex3-font-size-issue/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
