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

<channel>
	<title>Mental Masturbation, Musings, and Methods &#187; Python</title>
	<atom:link href="http://blog.alexbeutel.com/category/programming/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.alexbeutel.com</link>
	<description>The Mind of Alex Beutel</description>
	<lastBuildDate>Mon, 02 Aug 2010 06:20:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Following Chromium Progress</title>
		<link>http://blog.alexbeutel.com/65/following-chromium-progress/</link>
		<comments>http://blog.alexbeutel.com/65/following-chromium-progress/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 20:52:13 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Chromium]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=65</guid>
		<description><![CDATA[For the past few months I have been following the progress of Chromium for Mac and watching it develop and it has definitely made a lot of progress in that time. In the past few month it has received increasing press, with people asking why it is taking so long. One of the lead developers [...]]]></description>
			<content:encoded><![CDATA[<p>For the past few months I have been following the progress of Chromium for Mac and watching it develop and it has definitely made a lot of progress in that time.  In the past few month it has received increasing press, with people asking why it is taking so long.  One of the lead developers on the project <a href="http://weblogs.mozillazine.org/pinkerton/archives/020035.html" target="_blank">responded </a>that people need to chill out and that building a browser takes time.  So, in part to show myself and others the progress, I decided to make a little application to show this progress.  Throughout the day builds and updates of Chromium are posted to <a href="http://build.chromium.org/buildbot/snapshots/sub-rel-mac/" target="_blank">http://build.chromium.org/buildbot/snapshots/sub-rel-mac/</a> but to read each changelog was a pain.  So, to give myself more exposure to new Python libraries and give the Twitter API a swing, I created a script to check for changes to the builds, pull log entries on the changes and post them all to a <a href="http://twitter.com/chromiumUpdates" target="_blank">Twitter stream</a> so there is a single source you can view updates.  The script is far from perfect, as it has to be running to catch the updates and doesn&#8217;t go back and look for ones it missed.  And currently I just have it running on one of Duke&#8217;s servers so it goes down occasionally.  But it generally works and provides plenty of updates so you can see what is actually be worked on and updated.  Check out the <a href="http://ambmediadesign.com/chromium.py">source code</a> below (twitter username and password cut out).</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://blog.alexbeutel.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=65&amp;download=chromium.py">chromium.py</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p652"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
</pre></td><td class="code" id="p65code2"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># encoding: utf-8</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib2</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">base64</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">xml</span>.<span style="color: black;">dom</span> <span style="color: #ff7700;font-weight:bold;">import</span> minidom
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> twitter<span style="color: black;">&#40;</span>twitter_username, twitter_password, message<span style="color: black;">&#41;</span>:
	request = <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">Request</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'http://twitter.com/statuses/update.json'</span><span style="color: black;">&#41;</span>
	request.<span style="color: black;">headers</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'Authorization'</span><span style="color: black;">&#93;</span> = <span style="color: #483d8b;">'Basic %s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span> <span style="color: #dc143c;">base64</span>.<span style="color: black;">b64encode</span><span style="color: black;">&#40;</span>twitter_username + <span style="color: #483d8b;">':'</span> + twitter_password<span style="color: black;">&#41;</span>,<span style="color: black;">&#41;</span>
	request.<span style="color: black;">data</span> = <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlencode</span><span style="color: black;">&#40;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">'status'</span>: message<span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">try</span>:
		response = <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;"># The Response</span>
	<span style="color: #ff7700;font-weight:bold;">except</span> HTTPError, e:
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Error posting to twitter&quot;</span>
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;HTTP Error code: &quot;</span>, e.<span style="color: #dc143c;">code</span>
	<span style="color: #ff7700;font-weight:bold;">except</span> URLError, e:
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Error posting to twitter&quot;</span>
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;URLError reason: &quot;</span>, e.<span style="color: black;">reason</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	message = <span style="color: #483d8b;">&quot;&quot;</span>
	last_update = <span style="color: #483d8b;">&quot;17514&quot;</span><span style="color: #66cc66;">;</span>
	chromium_url = <span style="color: #483d8b;">&quot;http://build.chromium.org/buildbot/snapshots/sub-rel-mac/&quot;</span>
	<span style="color: #ff7700;font-weight:bold;">while</span><span style="color: black;">&#40;</span><span style="color: #008000;">True</span><span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">try</span>:
			response = <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>chromium_url + <span style="color: #483d8b;">&quot;LATEST&quot;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">except</span> HTTPError, e:
			<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;HTTP Error code: &quot;</span>, e.<span style="color: #dc143c;">code</span>
		<span style="color: #ff7700;font-weight:bold;">except</span> URLError, e:
			<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;URLError reason: &quot;</span>, e.<span style="color: black;">reason</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			latest = response.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
			<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;latest: &quot;</span>, latest
			<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>latest <span style="color: #66cc66;">!</span>= last_update<span style="color: black;">&#41;</span>:
				<span style="color: #ff7700;font-weight:bold;">try</span>:
					response2 = <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>chromium_url + latest + <span style="color: #483d8b;">&quot;/changelog.xml&quot;</span><span style="color: black;">&#41;</span>
				<span style="color: #ff7700;font-weight:bold;">except</span> HTTPError, e:
					<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;HTTP Error code: &quot;</span>, e.<span style="color: #dc143c;">code</span>
				<span style="color: #ff7700;font-weight:bold;">except</span> URLError, e:
					<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;URLError reason: &quot;</span>, e.<span style="color: black;">reason</span>
				<span style="color: #ff7700;font-weight:bold;">else</span>:
					html = response2.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
					<span style="color: #808080; font-style: italic;"># print html</span>
					dom = minidom.<span style="color: black;">parseString</span><span style="color: black;">&#40;</span>html<span style="color: black;">&#41;</span>
					entries = dom.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;logentry&quot;</span><span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;">#[0].childNodes</span>
					<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;entries: &quot;</span>, <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>entries<span style="color: black;">&#41;</span>
					<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>entries<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
						link = chromium_url + latest + <span style="color: #483d8b;">&quot;/ &quot;</span>
						msg = entries<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;msg&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">firstChild</span>.<span style="color: black;">nodeValue</span>
						num = entries<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">getAttribute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;revision&quot;</span><span style="color: black;">&#41;</span>
						<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Revision: &quot;</span>, num
						twitter<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;USERNAME&quot;</span>, <span style="color: #483d8b;">&quot;PASSWORD&quot;</span>, <span style="color: #483d8b;">&quot;Chromium Revision &quot;</span> + num + <span style="color: #483d8b;">&quot;: &quot;</span> + msg<span style="color: black;">&#41;</span>
					last_update = latest
			<span style="color: #dc143c;">time</span>.<span style="color: black;">sleep</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">60</span><span style="color: #66cc66;">*</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
	main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Play with the code or follow the twitter.  Also, I decided to try a new WordPress plugin for code so let me know what you think.  Thanks.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/65/following-chromium-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Begginning of Summer 2009</title>
		<link>http://blog.alexbeutel.com/49/begginning-of-summer-2009/</link>
		<comments>http://blog.alexbeutel.com/49/begginning-of-summer-2009/#comments</comments>
		<pubDate>Sat, 30 May 2009 19:14:43 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Duke]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=49</guid>
		<description><![CDATA[As usual I haven&#8217;t posted in a while but there actually have been some things going on that may be worth writing on here.  I&#8217;m at Duke for the summer doing research with the Physics Neutrino group, among other things so here are some things that have happened: Ethical Hacking Seminar Duke OIT gave me [...]]]></description>
			<content:encoded><![CDATA[<p>As usual I haven&#8217;t posted in a while but there actually have been some things going on that may be worth writing on here.  I&#8217;m at Duke for the summer doing research with the Physics Neutrino group, among other things so here are some things that have happened:</p>
<p><strong>Ethical Hacking Seminar</strong></p>
<p>Duke OIT gave me the opportunity to take this hacking seminar at Duke the first week of summer.  It was definitely an extremely beginner course and I was a little disappointed to see that so much of it was just &#8220;pick the right tool and run it,&#8221; but good opportunity to dig a little deeper into network protocols and learn some new things; without a doubt was worthwhile.  If anyone reading this is as much of a beginner as I am check out things like <a href="http://ettercap.sourceforge.net/" target="_blank">Ettercap</a>, <a href="http://nmap.org/" target="_blank">nmap</a>, and <a href="http://www.nessus.org/nessus/" target="_blank">Nessus</a>.</p>
<p><strong>Duke&#8217;s AFS Online Interface &#8211; Webfiles</strong></p>
<p>The past year I have been working with OIT, half doing web application security and half doing programming updating Duke&#8217;s online interface for its AFS file system, <a title="Duke Webfiles" href="http://webfiles.duke.edu" target="_blank">Webfiles</a>.  Essentially, it was an attempt to make the online interface more comfortable for average users and make it most similar to Windows Explorer and OS X Finder so that using it is as intuitive as possible.  The coding was anything but beautiful, but it was a good opportunity to learn more about Javascript and play with some fun things.  General changes are that it now has an icon and outline view, drag and drop, some of the typical shortcut keys, etc.  Below are some screenshots and I will try to create a demo site at some point.  I am also excited to say Duke is making all my code open source so let me know if you would like to implement it yourself.  I believe Carnegie Mellon is currently looking at deploying it on their systems, which I think is exciting.</p>
<p><span style="padding-right: 20px;"><a href="http://blog.ambmediadesign.com/wp-content/uploads/2009/05/icon.jpg" target="_blank"><img src="http://blog.ambmediadesign.com/wp-content/uploads/2009/05/icon-150x150.jpg" alt="icon" title="icon" height="150" class="alignleft size-thumbnail wp-image-55" /></a></span> <a href="http://blog.ambmediadesign.com/wp-content/uploads/2009/05/outline.png" target="_blank"><img src="http://blog.ambmediadesign.com/wp-content/uploads/2009/05/outline-150x150.png" alt="outline" title="outline" height="150" class="alignleft size-thumbnail wp-image-56" /></a></p>
<p><strong>Neutrino Physics</strong></p>
<p>I just started working with Professor Chris Walter and his Neutrino Physics group.  So far, just to get into the group, I have been working on creating a plug-in for <a href="http://root.cern.ch" target="_blank">ROOT</a> to make it read and write to a specific kind of distributed file system faster.  It has been an interesting experience getting back into C++ and a little bit of Fortran, and learning about this large project out of CERN.  I&#8217;m still finishing up the plug-in but hopefully I will be able to post the code or at least write about how to easily integrate the plug-in into ROOT when I&#8217;m done.  Not sure what I will be doing after that; I am taking classes on GEANT4 and think I will be doing monte carlo simulations of some sort for the rest of the summer, but I will write about this when I know more.</p>
<p><strong>Simple Flash Cards in Python</strong></p>
<p>The second reason I am here for the summer is that I need to take Spanish to fulfill Duke&#8217;s foreign language requirement.  If you actually know me, you will know that I am horrible at foreign languages and have been dreading taking these classes since I got to Duke.  It has now been two years since I last took a Spanish course, so jumping back into the language has been an interesting experience.  Also, Spanish 63 is known to be a lot of work and over the summer its so jam packed together that it is actually a good amount of work each night.  Anyway, we had our first test last Friday, and I had about 100 words of vocabulary to memorize, one of my worse skills.  So, both to procrastinate from actually studying and because I thought it could be useful, I decided to make a basic command line flash card program.  I&#8217;m trying to bit by bit pick up Python, so I used it and it was fairly simple.  The program essentially takes in a plain text file with the two sides of the flash card on one line, each side separated by a colon.  It then goes through the lines, shows you the second half of the line first, waits for you to press enter and then shows you the first half.  If you press enter again it will discard the word and go to another random word in the deck; if you type &#8216;x&#8217; and then press enter it will put the word back in the stack.  Fairly basic, and the code is nothing special; probably took about 15 minutes to throw together, but it was surprisingly very useful as I could run through a lot of the vocab very fast and repeatedly.  I&#8217;ll probably update it to make it a little better packaged together with proper arguments, etc. so you can check back for that.  Anyway, to run it (if you have a Mac python is installed by default and in Windows you need to do it yourself) open up a terminal and make sure you are in the folder where the code and the text file with the vocab are.  Then just type:</p>
<pre>python flashcards.py yourvocabfile.txt</pre>
<p>The code for <a href="http://ambmediadesign.com/flashcards.py" target="_blank">flashcards.py</a>  (<a href="http://ambmediadesign.com/genteDeCine.txt" target="_blank">example vocab linked here</a>) can be seen below:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://blog.alexbeutel.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=49&amp;download=flashcards.py">flashcards.py</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p494"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
</pre></td><td class="code" id="p49code4"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># encoding: utf-8</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">random</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> clearscreen<span style="color: black;">&#40;</span>numlines=<span style="color: #ff4500;">100</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">name</span> == <span style="color: #483d8b;">&quot;posix&quot;</span>:
        <span style="color: #808080; font-style: italic;"># Unix/Linux/MacOS/BSD/etc</span>
        <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'clear'</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">elif</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">name</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;nt&quot;</span>, <span style="color: #483d8b;">&quot;dos&quot;</span>, <span style="color: #483d8b;">&quot;ce&quot;</span><span style="color: black;">&#41;</span>:
        <span style="color: #808080; font-style: italic;"># DOS/Windows</span>
        <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'CLS'</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #66cc66;">*</span> numlines
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span>argv=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">if</span> argv <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span>:
		argv = <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span>
	allLines = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
&nbsp;
	again = <span style="color: #483d8b;">'x'</span>
	<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>argv<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>:
		again = argv<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>
&nbsp;
	f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>argv<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> f:
		allLines.<span style="color: black;">append</span><span style="color: black;">&#40;</span>line<span style="color: black;">&#41;</span>
&nbsp;
	clearscreen<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
	cnt = <span style="color: #ff4500;">0</span>
	wrong = <span style="color: #ff4500;">0</span>
	wWords = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
	<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>allLines<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">0</span>:
		cnt += <span style="color: #ff4500;">1</span>
		l = allLines.<span style="color: black;">pop</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">random</span>.<span style="color: black;">randint</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>allLines<span style="color: black;">&#41;</span>-<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
		parts = l.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;:&quot;</span><span style="color: black;">&#41;</span>
		p = <span style="color: #ff4500;">1</span>
		p2 = <span style="color: #ff4500;">0</span>
		<span style="color: #ff7700;font-weight:bold;">print</span> cnt, <span style="color: #483d8b;">&quot;(&quot;</span>, <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>allLines<span style="color: black;">&#41;</span>, <span style="color: #483d8b;">&quot;). &quot;</span>, parts<span style="color: black;">&#91;</span>p<span style="color: black;">&#93;</span>
		inp = <span style="color: #008000;">raw_input</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>inp == <span style="color: #483d8b;">&quot;exit&quot;</span><span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">break</span>
		<span style="color: #ff7700;font-weight:bold;">print</span> parts<span style="color: black;">&#91;</span>p2<span style="color: black;">&#93;</span>
		inp = <span style="color: #008000;">raw_input</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>inp == <span style="color: #483d8b;">&quot;exit&quot;</span><span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">break</span>
		<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>inp == again<span style="color: black;">&#41;</span>:
			allLines.<span style="color: black;">append</span><span style="color: black;">&#40;</span>l<span style="color: black;">&#41;</span>
			wrong += <span style="color: #ff4500;">1</span>
			wWords.<span style="color: black;">append</span><span style="color: black;">&#40;</span>l<span style="color: black;">&#41;</span>
		clearscreen<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	clearscreen<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Missed &quot;</span>, wrong, <span style="color: #483d8b;">&quot; times&quot;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> wWords :
		<span style="color: #ff7700;font-weight:bold;">print</span> line
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
	<span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span>main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Again, nothing special or fancy, but seemed to work well; I guess I&#8217;ll know how effective it was when I get the test back haha.  Anyway that is all for now, I may make public a <a href="http://blog.ambmediadesign.com/32/catching-up/">post</a> I wrote a few months ago that I never published, so check for that and I&#8217;ll write of any other things I do this summer.  Also check my twitter as I post more frequently there.  Time to go outside.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/49/begginning-of-summer-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
