<?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; Web Development</title>
	<atom:link href="http://blog.alexbeutel.com/category/programming/web-development/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>Rankophilia and Rankophiliacs</title>
		<link>http://blog.alexbeutel.com/275/rankophilia-and-rankophiliacs/</link>
		<comments>http://blog.alexbeutel.com/275/rankophilia-and-rankophiliacs/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 03:24:26 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Duke]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=275</guid>
		<description><![CDATA[For my CPS 182S class, we have an assignment which is a competition among groups of students (and the professor) to have the highest ranking page on Google for the terms rankophilia and rankophiliac.  As such, I have created a page at rankophilia.dorm.duke.edu to be my group&#8217;s main page on Google. For now, there is [...]]]></description>
			<content:encoded><![CDATA[<p>For my CPS 182S class, we have an assignment which is a competition among groups of students (and the professor) to have the highest ranking page on Google for the terms rankophilia and rankophiliac.  As such, I have created a page at <a href='http://rankophilia.dorm.duke.edu/' target='_blank' title='rankophilia, rankophiliac, rankphilia, rankphiliac'>rankophilia.dorm.duke.edu</a> to be my group&#8217;s main page on Google.  For now, there is not much interesting on there, and I am merely posting it here in an attempt to increase the PageRank.  I am considering adding more interesting content and submitting it around online rather than just spamming.  I will post updates (probably at least a few for links) as the contest goes on.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/275/rankophilia-and-rankophiliacs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL Injection at Duke TechExpo 2009</title>
		<link>http://blog.alexbeutel.com/265/sql-injection-at-duke-techexpo-2009/</link>
		<comments>http://blog.alexbeutel.com/265/sql-injection-at-duke-techexpo-2009/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 19:56:07 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Duke]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=265</guid>
		<description><![CDATA[I gave my first public talk today at Duke&#8217;s TechExpo 2009. I along with my coworker Artem Kazantsev discussed the risks of SQL Injection. The presentation gives a good overview of the capabilities of SQL injection along with how to prevent such vulnerabilities. I also gave a demo of performing a SQL injection attack on [...]]]></description>
			<content:encoded><![CDATA[<p>I gave my first public talk today at <a href="http://techexpo.oit.duke.edu/" target="_blank">Duke&#8217;s TechExpo 2009</a>.  I along with my coworker Artem Kazantsev discussed the risks of SQL Injection.  The presentation gives a good overview of the capabilities of SQL injection along with how to prevent such vulnerabilities.  I also gave a demo of performing a SQL injection attack on a vulnerable site during the talk.  For any web programmers who aren&#8217;t familiar with SQL injection, take a look at the code for the demo to see exactly how and why it is vulnerable, along with how to fix these vulnerabilities.</p>
<p><a href="http://ambmediadesign.com/SQLInjection.pdf">SQL Injection Presentation</a></p>
<p><a href="http://ambmediadesign.com/SQLInjectionDemo.zip">SQL Injection Demo</a></p>
<p>Additionally, earlier in the year I worked with Duke&#8217;s ITSO to write up examples of good coding practices to protect against a variety of web application security issues.  This referenced is linked on Duke ITSO&#8217;s site here: <a href="http://www.security.duke.edu/ITSO_Web_Application_Security_Standard_v1.pdf">http://www.security.duke.edu/ITSO_Web_Application_Security_Standard_v1.pdf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/265/sql-injection-at-duke-techexpo-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drag and Drop off the Desktop in Duke Webfiles</title>
		<link>http://blog.alexbeutel.com/255/drag-and-drop-off-the-desktop-in-duke-webfiles/</link>
		<comments>http://blog.alexbeutel.com/255/drag-and-drop-off-the-desktop-in-duke-webfiles/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 23:07:39 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Duke]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=255</guid>
		<description><![CDATA[While on break, I&#8217;ve been playing around with Mozilla&#8217;s File API and integrating it with Duke Webfiles, which I work on for OIT. This is only a proof of concept since the spec has not been completed and I only implemented it in the icon view of Webfiles. Regardless, I think it is pretty cool [...]]]></description>
			<content:encoded><![CDATA[<p>While on break, I&#8217;ve been playing around with Mozilla&#8217;s File API and integrating it with <a href="http://webfiles.duke.edu" target="_blank">Duke Webfiles</a>, which I work on for OIT.  This is only a proof of concept since the spec has not been completed and I only implemented it in the icon view of Webfiles.  Regardless, I think it is pretty cool and makes the application much easier to use.  Here is a screencast to see it in action:</p>
<p><object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/9RBfyC60ADI&#038;hl=en&#038;fs=1&#038;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/9RBfyC60ADI&#038;hl=en&#038;fs=1&#038;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object></p>
<p>To do this I used examples from <a href="http://www.thecssninja.com/javascript/drag-and-drop-upload" target="_blank">here</a> for the new File API and <a href="http://blog.igstan.ro/2009/01/pure-javascript-file-upload.html" target="_blank">here</a> for the AJAX upload.  Obviously this could be expanded upon by implementing it in all three file views in Webfiles and by showing progress bars for each file.  Additionally, there are some small bugs with uploading large files.  However, if you are a Duke student and want to give it a try, follow the instructions below.   Please note, this is a alpha version of the software, and you may run into some bugs when using it.</p>
<ul>
<li>Make sure you are using <a href="https://developer.mozilla.org/devnews/index.php/2009/08/07/firefox-3-6-alpha-1-now-available-for-download/">Firefox 3.6 Alpha &#8211; Namoroka</a>.</li>
<li>Go to our <a href="http://pnsdev.oit.duke.edu" target="_blank">development version of Webfiles</a> and log in.</li>
<li><em>After</em> you are logged in, go <a href="http://pnsdev.oit.duke.edu/#beta" target="_blank">here</a> to turn on the new drag and drop feature.</li>
</ul>
<p>Please, give it a try and let me know your thoughts.  Thanks.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/255/drag-and-drop-off-the-desktop-in-duke-webfiles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Reader vs. Netvibes, and Jetpack Notifications</title>
		<link>http://blog.alexbeutel.com/81/google-reader-vs-netvibes-and-jetpack-notifications/</link>
		<comments>http://blog.alexbeutel.com/81/google-reader-vs-netvibes-and-jetpack-notifications/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 18:41:02 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Jetpack]]></category>
		<category><![CDATA[Musings]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=81</guid>
		<description><![CDATA[A couple of weeks ago I decided to give Google Reader a try.  I have been addicted to Netvibes for at least 2-3 years now, but I saw that Reader had a more active community around it, so I thought it was worth trying out.  Almost immediately I disliked the look and feel.  I am [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago I decided to give Google Reader a try.  I have been addicted to Netvibes for at least 2-3 years now, but I saw that Reader had a more active community around it, so I thought it was worth trying out.  Almost immediately I disliked the look and feel.  I am subscribed to over thirty fairly active RSS feeds and  in Reader it was hard to see which blogs had new posts.  The default action is to just look at a long list and viewing posts by blog is almost hard to do.  As a result &#8220;Mark[ing] all as read&#8221; for a specific blog takes many more scrolls and clicks, which had been extremely easy in Netvibes.   About this time I was giving Mozilla&#8217;s Jetpack a try and found the Google Reader Notifier, which would notify me via Growl of new posts.  So I decided to give Reader a longer try, despite some initial disappointments.</p>
<p>Ultimately, I became addicted to these near instant updates for new blog posts that the Jetpack extension provided.  At the same time I learned to love the fact that by default I was forced to read the title for every blog post in Reader.  Where as before in Netvibes I would never scroll through the backed up posts from Gizmodo and Engadget, Reader&#8217;s chronological ordering makes me go through each post.  Recently, this is just another case where what I think I want does not match up with what actual creates a better user experience (similar to Google&#8217;s analysis of users searching more with 10 results despite asking for as many as possible or  Dan Curtis&#8217;s explanation that we are <a href="http://dustincurtis.com/you_should_follow_me_on_twitter.html" target="_blank">not in control of our deicions</a>).  Also, this reminds me of <a href="http://www.azarask.in/blog/" target="_self">Aza Raskin</a>&#8216;s <a href="http://andywibbels.com/2009/06/aza-raskin-google-techtalk/" target="_blank">statement</a> &#8220;Every time you make the user make a decision they don&#8217;t care about, you have failed as a designer.&#8221;  Interestingly, Google forced me to make a harder decision than I wanted to make; where before I could avoid deciding whether or not to remove the blog by just leaving it on my page and just easily clicking away new posts with &#8220;Marking all as read,&#8221; I now had to decide to either read the post titles or make the leap to get ride of the RSS feed all together.  While I was able to be lazy before, it made for a more concrete decision and user experience.</p>
<p>The other thing I realized was that the Jetpack extension for Reader notifications was causing my browser to hang when I had a bad internet connection.  Sadly, living in an off campus apartment with spotty Internet this happens all too often, and I decided to disable Jetpack.  However, I missed the notifications and decided to fix the Jetpack extension.  I reworked the old extension to only perform asynchronous AJAX calls, getting rid of the browser hanging issue, and modified the extension to display notifications to show new posts by blog title, thus making the notifications more informative.  The status bar display and the new Growl notifications can be seen below.  Click <a title="Jetpack - Google Reader Notifier" href="http://ambmediadesign.com/scripts/Jetpack-gReader.html" target="_blank">here</a> to install this extension or <a href="http://ambmediadesign.com/scripts/greader.js" target="_blank">here</a> to view the code.  Of course, let me know your thoughts or any bugs you run into.  Thanks.</p>
<p>Also, as some friends like <a href="http://nirum.tumblr.com/" target="_blank">Niru</a>, <a href="http://djsharkey.com/blogz" target="_blank">DJ</a>, and <a href="http://blog.mediabymrb.com/" target="_blank">Marc</a> have pointed out, I have somewhat decreased my blogging but have been posting a good number of posts on Twitter.  So of course, you should follow me on Twitter <a title="Twitter - Alex Beutel" href="http://twitter.com/alexbeutel" target="_blank">here</a>.</p>
<p><img style="padding-bottom: 15px;" src="http://ambmediadesign.com/scripts/statusbar2.png" alt="" /><br />
<img src="http://ambmediadesign.com/scripts/growl-greader2.png" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/81/google-reader-vs-netvibes-and-jetpack-notifications/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="p492"><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="p49code2"><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>
		<item>
		<title>Acrobat.com and Flash &#8211; Again</title>
		<link>http://blog.alexbeutel.com/15/acrobatcom-and-flash-again/</link>
		<comments>http://blog.alexbeutel.com/15/acrobatcom-and-flash-again/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 01:14:12 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=15</guid>
		<description><![CDATA[I know I already posted about this subject once, but I must again express my disappointment in Adobe.  After reading this post on Adobe&#8217;s blog about their &#8220;cool new features&#8221; such as this embedable flash version of PDF&#8217;s, I was again a bit surprised at their Adobe&#8217;s simply silly buisness strategy.  Adobe is clearly trying [...]]]></description>
			<content:encoded><![CDATA[<p>I know I already posted about this subject once, but I must again express my disappointment in Adobe.  After reading <a href="http://blogs.adobe.com/loridefurio/2008/07/pdf_widget_on_a.html" target="_blank">this post</a> on Adobe&#8217;s blog about their &#8220;cool new features&#8221; such as this embedable flash version of PDF&#8217;s, I was again a bit surprised at their Adobe&#8217;s simply silly buisness strategy.  Adobe is clearly trying to keep up with a combination of services offered by Google Docs and Zoho with their Buzzword application and Scribd&#8217;s iPaper with this PDF-flash widget.  However, I find it both rediculous and unintelligent that Adobe is blatantly offering a sub-par service when trying to win over Web 2.0 users; it offers a small, buggy flash widget to compete with iPaper and leaves Flashpaper, a clean, simple solution, on the sidelines hoping to make money off the $100 charge for the software or hoping some host will fork over a good chunk of money to suddenly revive Coldfusion, starting at ground zero of this arena?  One would think that in the face of serious competition to many of its services, it would throws its best into this new arena, and change the way they monetize their product as they have been doing with other services such as Photoshop Express.  I would love to use this new embedable flash preview but it simply unrealistic.  The quality is too low to read and can not even be enlarged to fit the web page appropriately.  Adobe, make a smart move and bring Flashpaper mainstream, enable it for everyone, offer up some ads with it.  Do this and I will gladly support and use this new project.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/15/acrobatcom-and-flash-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook Beacon NOT Dead?</title>
		<link>http://blog.alexbeutel.com/14/facebook-beacon-not-dead/</link>
		<comments>http://blog.alexbeutel.com/14/facebook-beacon-not-dead/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 00:39:24 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Beacon]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Fandango]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=14</guid>
		<description><![CDATA[So it is 10:51 on June 26th and of course I am waiting around to go see Wanted at midnight.  Being the responsible consumer I am, I purchased 3 tickets for the showing 2 hours ago so as to make sure my friends and I had tickets before taking a single REM-cycle nap so I [...]]]></description>
			<content:encoded><![CDATA[<p>So it is 10:51 on June 26th and of course I am waiting around to go see Wanted at midnight.  Being the responsible consumer I am, I purchased 3 tickets for the showing 2 hours ago so as to make sure my friends and I had tickets before taking a <a href="http://www.boston.com/bostonglobe/ideas/naps/" target="_blank">single REM-cycle nap</a> so I do not die getting up for 8 AM work tomorrow.  And, like the trusty computer nerd I am, as I fell out of bed and stumbled to my computer in the dark, I refreshed my Facebook home page to see a popup from Fandango asking if I wanted to display that I bought tickets for Wanted.  And, like a rational, typical American consumer that thinks after he acts and then realizes what he has done, I said <em>sure,</em> tell the world that I bought tickets to Wanted &#8211; hell it&#8217;s going to be an awesome movie, and then I realized DAMN I forgot to even take a screenshot or click on the &#8220;Preferences&#8221; link.  And now I sit here I am wondering, what in the world was that?  As far as I know Facebook Beacon has been dead for nearly a year and a quick search on <a href="http://www.google.com/search?hl=en&amp;safe=off&amp;client=firefox-a&amp;rls=org.mozilla%3Aen-US%3Aofficial&amp;hs=3Lj&amp;q=fandango+%2B+facebook&amp;btnG=Search" target="_blank">Google</a> for Facebook and Fandango only pulled up articles from November of last year.</p>
<p>Unlike most of the posts from last November, I am not enraged at some sort of loss of privacy, not even annoyed that is on my Facebook Mini-Feed; it&#8217;s kind of cool actually in light of the new commenting features.  However, I am still at a loss of how Fandango was able to do this.  As far as I&#8217;ve seen in the standard Facebook API, to at all interact with Facebook at least requires the user&#8217;s approval of the application or website before the data is sent.   Also, Facebook Connect is not out yet (unless that was Beta testing).  And, although Facebook Beacon can still be found on the developer&#8217;s website, there is no way to use it other than send Facebook an e-mail and hope for a response (which I did a few months ago to no avail).  So, I am still a bit at a loss as to how Fandango has this privileged access into Facebook and more importantly &#8211; when can everyone else use it?</p>
<p>On a side note since I am posting this a day late &#8211; <em>Wanted</em> was awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/14/facebook-beacon-not-dead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP and Acrobat.com</title>
		<link>http://blog.alexbeutel.com/13/php-and-acrobatcom/</link>
		<comments>http://blog.alexbeutel.com/13/php-and-acrobatcom/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 01:36:46 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Adobe]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=13</guid>
		<description><![CDATA[A good while ago I heard about Adobe acquiring Buzzword, which was quite exciting since it definitely seemed like the most clean of the up and coming online document editing software.  Finally, just last week Adobe released a public beta of a suite of Buzzword, Share, and other online editing tools to go along with [...]]]></description>
			<content:encoded><![CDATA[<p>A good while ago I heard about Adobe acquiring Buzzword, which was quite exciting since it definitely seemed like the most clean of the up and coming online document editing software.  Finally, just last week Adobe released a public beta of a suite of Buzzword, Share, and other online editing tools to go along with their release of Adobe Acrobat 9.  So, of course, I signed up, played around a bit before going to work in the morning and took a quick peek at the Share API.  Well to jump to the point,  I am excited at the possibilities but disappointed in Adobe.  For a company that is usually solid in their product releases, this is <em>very</em> beta.  As I read in another blog post, there is no continuity to the suite.  As a matter of fact, why is it even a suite?  The multiple features available at <a href="http://acrobat.com" target="_blank">Acrobat.com</a> should be implemented together.  And, rather than worrying so much about their value, open the features up more.  5 PDFs per month?  Really?  Anybody that can use Google can find infinite other ways to convert their documents to PDF.  My final complaint is that the flash viewer used to share the documents is atrocious.  It is impossible to actually read any documents with it.  Adobe has beautiful flash paper and again by trying to retain value will just kill itself off in the face of newer compartively open formats like Scribd&#8217;s iPaper (just a hack of Flashpaper but at least more accessible conversion).</p>
<p>Anyway, regardless of the poor GUI congruity, I would like to discuss the API.  The <a href="http://learn.adobe.com/wiki/display/acds/D.+Public+Libraries" target="_blank">site</a> has a few public libraries at first appearance, and I must hand it to Adobe that their Java library looks extremely clean and easy to use.  But the Python library &#8211; not even a library, although probably the easiest reading of all of their online documentation.  The writer of the blog even states that he has given up and decided to use the Java library -  encouraging.  Anyway, disappointed in not even an attempt at a PHP implementation, I decided to give it a shot.  I essentially went as far as the writer of the Python blog post: authenticate, get sessionid, and get a list of files you have on your account.  (Note this requires PEAR&#8217;s HTTP_Request package.)  Also, I know this is very ugly code and I&#8217;m possitive could and should be done much cleaner.  However, it works if your just trying to take the first steps and get some output.  If anyone wants to clean it up or continue on with a PHP implementation, feel free and let me know how it goes.  However, until they open up the platform to worthwhile features, it is sadly not worth my time.  Hopefully Adobe soon realizes the mistake of being so possessive and thinks a little more creatively about how to monetize their technology.  Anyway, here is the code; enjoy:</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="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p13code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p134"><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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
</pre></td><td class="code" id="p13code4"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #000088;">$acrobat_api_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$acrobat_shared_secret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$acrobat_base_url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;https://api.share.acrobat.com/webservices/api/v1/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$acrobat_username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;your_username@somecompany.com&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$acrobat_password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;your_acrobat.com_password&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> getAuthToken<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$acrobat_api_key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acrobat_shared_secret</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acrobat_base_url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acrobat_password</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acrobat_username</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #990000;">HTTP_Request</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setURL</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$acrobat_base_url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;auth/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;POST&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;POST https://api.share.acrobat.com/webservices/api/v1/auth/ &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$time</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$md5</span> <span style="color: #339933;">=</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">.</span><span style="color: #000088;">$acrobat_shared_secret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$auth</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;AdobeAuth apikey=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$acrobat_api_key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>,data=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$data</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>,sig=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$md5</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$request_body</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;request&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;username&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$acrobat_username</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/username&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;password&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$acrobat_password</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/password&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;/request&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Authorization&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$auth</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setBody</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request_body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sendRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getResponseBody</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$regex</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;authtoken&gt;[a-zA-Z0-9]+&lt;/authtoken&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$regex</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$p</span> <span style="color: #339933;">=</span> <span style="color: #990000;">xml_parser_create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #990000;">xml_parse_into_struct</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$vals</span><span style="color: #339933;">,</span> <span style="color: #000088;">$index</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #990000;">xml_parser_free</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$vals</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> getSession<span style="color: #009900;">&#40;</span><span style="color: #000088;">$auth_token</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$acrobat_api_key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acrobat_shared_secret</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acrobat_base_url</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #990000;">HTTP_Request</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setURL</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$acrobat_base_url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;sessions/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;POST&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;POST https://api.share.acrobat.com/webservices/api/v1/sessions/ &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$time</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$md5</span> <span style="color: #339933;">=</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">.</span><span style="color: #000088;">$acrobat_shared_secret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$auth</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;AdobeAuth apikey=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$acrobat_api_key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>,data=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$data</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>,sig=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$md5</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$request_body</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;request&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;authtoken&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$auth_token</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/authtoken&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;/request&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Authorization&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$auth</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setBody</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request_body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sendRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getResponseBody</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$regex</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;sessionid&gt;[a-zA-Z0-9]+&lt;/sessionid&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$regex</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$p</span> <span style="color: #339933;">=</span> <span style="color: #990000;">xml_parser_create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #990000;">xml_parse_into_struct</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$vals</span><span style="color: #339933;">,</span> <span style="color: #000088;">$index</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #990000;">xml_parser_free</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$regex</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;secret&gt;[a-zA-Z0-9]+&lt;/secret&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$regex</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$p</span> <span style="color: #339933;">=</span> <span style="color: #990000;">xml_parser_create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #990000;">xml_parse_into_struct</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$vals2</span><span style="color: #339933;">,</span> <span style="color: #000088;">$index</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #990000;">xml_parser_free</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$vals</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$vals2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span>  <span style="color: #000088;">$response</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> getList<span style="color: #009900;">&#40;</span><span style="color: #000088;">$session</span><span style="color: #339933;">,</span> <span style="color: #000088;">$secret</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$acrobat_api_key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acrobat_shared_secret</span><span style="color: #339933;">,</span> <span style="color: #000088;">$acrobat_base_url</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #990000;">HTTP_Request</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;GET&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;GET /webservices/api/v1/dc/ apikey=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$acrobat_api_key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; calltime=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$time</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; sessionid=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$session</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$md5</span> <span style="color: #339933;">=</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">.</span><span style="color: #000088;">$secret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$acrobat_base_url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;dc/?apikey=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$acrobat_api_key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;calltime=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$time</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;sessionid=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$session</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;sig=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$md5</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setURL</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sendRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getResponseBody</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$xml</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$auth</span> <span style="color: #339933;">=</span> getAuthToken<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> getSession<span style="color: #009900;">&#40;</span><span style="color: #000088;">$auth</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$session</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$secret</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> getList<span style="color: #009900;">&#40;</span><span style="color: #000088;">$session</span><span style="color: #339933;">,</span> <span style="color: #000088;">$secret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/13/php-and-acrobatcom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
