<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Alex Beutel's Mental Masturbation, Musings, and Methods</title>
	
	<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>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AlexBeutel" /><feedburner:info uri="alexbeutel" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Interactive Voronoi Diagrams with WebGL</title>
		<link>http://feedproxy.google.com/~r/AlexBeutel/~3/UFs2wwdS38k/</link>
		<comments>http://blog.alexbeutel.com/332/interactive-voronoi-diagrams-with-webgl/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 06:20:49 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.alexbeutel.com/?p=332</guid>
		<description><![CDATA[Within computational geometry, the Voronoi diagram is a relatively simple concept with a wide-range of applications.  Everything from physics research to the &#8220;snap-to&#8221; feature in GUI-design uses Voronoi diagrams as a simple underlying data structure to decompose space. I have been working with Voronoi diagrams for the past few months, as my research has focused [...]]]></description>
			<content:encoded><![CDATA[<div style='padding-bottom: 8px;'>Within computational geometry, the <a href='http://en.wikipedia.org/wiki/Voronoi_diagram' target='_blank'>Voronoi diagram</a> is a relatively simple concept with a wide-range of applications.  Everything from physics research to the &#8220;snap-to&#8221; feature in GUI-design uses Voronoi diagrams as a simple underlying data structure to decompose space.  I have been working with Voronoi diagrams for the past few months, as my research has focused on interpolation, specifically scalable <a href='http://en.wikipedia.org/wiki/Natural_neighbor' target='_blank'>natural neighbor interpolation</a>.  Because the interpolation I have been doing (and the demo I have created) focuses on Voronoi diagrams in a plane, I will only discuss the Voronoi diagrams in 2D space.  However, the mathematical concepts can be extended to higher dimensions.</div>
<div style="padding-top: 10px; font-weight: bold;">If you already know all about Voronoi diagrams or simply don&#8217;t care about the math and just want to play, jump to <a href="#play">here</a> or go straight to <a href="http://alexbeutel.com/webgl/voronoi.html" target="_blank">my Voronoi diagram generator application</a>.</div>
<h3>The Voronoi Diagram</h3>
<div>
I would first like to briefly describe what precisely the Voronoi diagram is, along with how nearest neighbor and natural neighbor interpolation make use of this data structure.  The Voronoi diagram is the division of plane into discrete Voronoi cells.  Given a set of input points <em>S</em>, we would like to divide the plane such that for any given position in the plane, we know the nearest input point.  This is the nearest neighbor problem.  A Voronoi cell <em>Vor(p,S)</em> represents the region of the plane for which the given point <em>p</em> is the closest input point from the set of input points <em>S</em>.  Mathematically the Voronoi cell <em>Vor(p,S)</em> is defined as</p>
<div style='height: 60px; width: 430px; margin-left: auto; margin-right: auto; margin-top: -20px; padding-bottom: 5px;'><img src="/voronoi/Vps.png" title='Voronoi definition' /></div>
<p>In the Voronoi diagram below, we color each Voronoi cell with a unique color.  For the entire region covered by each cell, the input point within the cell is the closest point from the set of input points.  You can also easily observe that the boundaries between neighboring cells is the set of points equidistant between two nearby input points.</p>
<div style='width: 400px; margin-left: auto; margin-right: auto; padding-bottom: 10px; margin-top: -10px;'><img style='width: 400px;' src="/voronoi/basic-vor.png" title='Basic Voronoi diagram' /></div>
</div>
<h4>Interpolation with the Voronoi Diagram</h4>
<div style='padding-bottom: 8px;'>Given this understanding of the Voronoi diagram, we can easily answer a nearest neighbor query.  Given a point <em>q</em> at position <em>(x,y)</em> we need only check which Voronoi cell it is within to see which input point is closest to it.  Thus, if each input point also has some height <em>z</em> we could roughly interpolate the height of <em>q</em> by taking the height of its nearest neighbor.</div>
<div>A more complex interpolation scheme, known as natural neighbor interpolation, is to take a weighted average of all of the nearby input points.  This is done by inserting the query point into the Voronoi diagram and observing how much area the Voronoi cell of the query point steals from the neighboring Voronoi cells in the original Voronoi diagram.  Specifically, the fractional weight assigned to each natural neighbor is the area stolen from that nearest neighbor&#8217;s original Voronoi cell divided by the total area of the Voronoi cell of the query point.  Mathematically this interpolation can be defined as:</p>
<div style='height: 80px; width: 500px; margin-left: auto; margin-right: auto; margin-top: -20px; padding-bottom: 5px;' ><img src="/voronoi/nni.png" title='Natural neighbor interpolation definition' /></div>
<p>While more complicated than nearest neighbor interpolation, natural neighbor interpolation offers a higher quality interpolation and produces smooth results.
</p></div>
<h4>Approximating the Voronoi Diagram in OpenGL</h4>
<div style='padding-bottom: 8px;'>As explained briefly in the <a href="http://www.glprogramming.com/red/chapter14.html#name19" target="_blank">OpenGL Red Book</a>, we can compute the Voronoi diagram easily in OpenGL by rendering cones at each input point and using the depth buffer to figure out the boundaries between Voronoi cells.  Specifically, if we place a right angle cone with the apex at a point, the height of the cone at a given position is equal to the distance form the point in the <i>x,y</i> plane.  As such, if we place all the cones in the plane and look at them from below, we will only see the lowest cone at any given point and thus only the cone for which the point it represents is closest.  This is known as taking the lower envelope.  (For more information, you can read <a href="http://portal.acm.org/citation.cfm?id=311567" target="_blank">Hoff et. al.&#8217;s paper</a> on how this works.)</div>
<div style='padding-bottom: 8px;'>Therefore, by merely drawing the cones and placing the viewpoint appropriately within OpenGL, the framebuffer will store the Voronoi diagram.  Naturally, when doing computations with OpenGL, the diagram will be discretized into pixels.  Additionally, OpenGL can not draw cones, only triangles.  Therefore, we approximate a cone with a <em>f</em>-sided pyramid.  With a reasonably large value for <em>f</em>, we will not notice the effect of the discretization, but making <em>f</em> a small value like 4-10 can be interesting.  Both of these discretizations of course create some deviation from the previously defined Voronoi diagram.</div>
<div>I have used this method, implemented in <a href='https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/doc/spec/WebGL-spec.html' target='_blank'>WebGL</a>, the Javascript API to OpenGL, to create the following interactive Voronoi diagram generator.</div>
<h3><a name="play"></a>Enough Math</h3>
<div>While math is necessary to precisely describe these concepts, it is not always the best way to convey some of the nuances of the geometric behavior.  As a result, one night, both to play with WebGL and to better understand Voronoi diagrams, I implemented some of these concepts in the browser.  Below is a short screencast of me playing with the tool, which may be useful if either you don&#8217;t have a WebGL-enabled browser or you want to learn some of the features of tool; or just <a href="http://alexbeutel.com/webgl/voronoi.html" style='font-weight: bold;'>play with it for yourself</a>.</div>
<div style='padding-bottom: 10px; padding-top: 10px;'>
<object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/Aljbw9PQlck&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Aljbw9PQlck&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object>
</div>
<h3>On Code</h3>
<div style='padding-bottom: 8px;'>
Not much to say here.  To make this small application, I used two canvases overlaid, one with WebGL and one with just the 2D-context.  This allowed me to draw over the Voronoi diagram (such as the points).  Following the <a href='' target='_blank'>learningwebgl.com</a> tutorials, I used the <a href='http://sylvester.jcoglan.com/' target='_blank'>Sylvester library</a> for Matrix math as well as the glUtils library from the tutorials.
</div>
<div>
WebGL is still a little buggy and memory management can be an issue, among other things.  But overall, it samples a good portion of OpenGL.  Unfortunately, getting started can take a little effort.  For example, unlike OpenGL in C++, you <i>must</i> write your own shader programs; I suggest using samples from <a href='http://learningwebgl.com/blog/?page_id=1217' target='_blank'>learningwebgl.com</a> at least to get started.  However, once you have a functioning WebGL canvas, it is easy to pick up speed.  I also went slightly overboard on the movement functions, but it was a good chance to play with Javascript closures.
</div>
<h3>Some cool Voronoi diagrams</h3>
<div>And finally, here are some Voronoi diagrams I have generated that I find interesting, cool, or merely pretty.</div>
<div style='padding-bottom: 20px;'>
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/ih-kcHYciSo&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ih-kcHYciSo&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
</div>
<div style='padding-bottom: 10px;'>Similar kinetic Voronoi diagram but with only 6-sided pyramids used.</div>
<div style='padding-bottom: 20px;'>
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/C2OGI1cevm8&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/C2OGI1cevm8&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
</div>
<div style='padding-bottom: 8px;' >Below, the same set of input points are plotted with two different types of cones.  The first uses a 50-sided pyramid.  The second only uses 6-sided pyramids, creating the jagged effect between neigboring Voronoi cells.</div>
<div style='padding-bottom: 20px;'><img src='/voronoi/v4.png' style='float: left; width: 49%; padding-right: 10px;' /><img src='/voronoi/v3.png' style='float: left; width: 49%;' /></div>
<div style='clear: both; width: 100%; height: 2px;'></div>
<div style='padding-bottom: 8px;' >The following two Voronoi diagrams show the Voronoi cells and area stolen for a natural neighbor query.</div>
<div style='padding-bottom: 20px; '><img src='/voronoi/v1.png'  style='width: 550px;' /></div>
<div style='padding-bottom: 15px;'><img src='/voronoi/v2.png' style='width: 550px;' /></div>
<img src="http://feeds.feedburner.com/~r/AlexBeutel/~4/UFs2wwdS38k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/332/interactive-voronoi-diagrams-with-webgl/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.alexbeutel.com/332/interactive-voronoi-diagrams-with-webgl/</feedburner:origLink></item>
		<item>
		<title>CMake, OpenGL, and GLX on OS X</title>
		<link>http://feedproxy.google.com/~r/AlexBeutel/~3/V8nFJ7kaRY0/</link>
		<comments>http://blog.alexbeutel.com/285/cmake-opengl-and-glx-on-os-x/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 23:24:32 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=285</guid>
		<description><![CDATA[As you may know, I am staying at Duke this summer for research.  My research, which I started last semester and am going to be doing for a while, focuses on scalable algorithms.  While that is pretty broad, I am currently working on using the graphics card to speed up processing. Again, here are some [...]]]></description>
			<content:encoded><![CDATA[<p>As you may know, I am staying at Duke this summer for research.  My research, which I started last semester and am going to be doing for a while, focuses on scalable algorithms.  While that is pretty broad, I am currently working on using the graphics card to speed up processing.  Again, here are some technical notes on code.</p>
<p>In doing my work I have come to have to write and run C++ OpenGL code on both OS X and Ubuntu.  To make this easier, <a title="CMake" href="http://www.cmake.org/" target="_blank">CMake</a> has been great for both  having readable make files and for being able to keep the files consistent across both platforms.  Additionally, while <a href='http://www.opengl.org/resources/libraries/glut/' target='_blank'>GLUT</a> is great for cross-platform OpenGL coding, I needed more control over the environment.  Being able to run X11 on OS X has allowed me to test GLX natively without always testing on Linux.  However, to get this set up on OS X without XCode can be a little tricky.  So, two snippets of CMake files for using OpenGL on OS X and Linux.</p>
<p>If you want to run OpenGL with the standard OS X libraries, CMake generally finds the correct frameworks, but it can&#8217;t hurt to specify them more precisely.  A basic example of the CMakeLists is shown below:</p>
<pre>
IF(APPLE)
   INCLUDE_DIRECTORIES ( /System/Library/Frameworks )
   FIND_LIBRARY(COCOA_LIBRARY Cocoa)
   FIND_LIBRARY(GLUT_LIBRARY GLUT )
   FIND_LIBRARY(OpenGL_LIBRARY OpenGL )
   MARK_AS_ADVANCED (COCOA_LIBRARY
                     GLUT_LIBRARY
                     OpenGL_LIBRARY)
   SET(EXTRA_LIBS ${COCOA_LIBRARY} ${GLUT_LIBRARY} ${OpenGL_LIBRARY})
ENDIF (APPLE)
target_link_libraries(main ${EXTRA_LIBS})
</pre>
<p>With this, your C++ should have the following includes:</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('p285code3'); return false;">View Code</a> CPP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2853"><td class="code" id="p285code3"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;GLUT/glut.h&gt;</span>
<span style="color: #339900;">#include &lt;OpenGL/glext.h&gt;</span>
<span style="color: #339900;">#include &lt;OpenGL/gl.h&gt;</span>
<span style="color: #339900;">#include &lt;OpenGL/glu.h&gt;</span></pre></td></tr></table></div>

<p>If, however, you are looking to run your code also on a Linux machine or simply want to use <a title="GLX" href="http://www.google.com/search?hl=en&amp;q=glx+opengl" target="_blank">GLX</a> rather than <a title="CGL Reference" href="http://developer.apple.com/mac/library/documentation/GraphicsImaging/Reference/CGL_OpenGL/Reference/reference.html" target="_blank">CGL</a>, you will need to have X11 installed (which your OS X installation disk contains) and specifically point CMake at the X11 libraries.  The CMake code for this is shown below:</p>
<pre>include_directories(/usr/X11R6/include/)
link_directories(/usr/X11R6/lib)
SET(EXTRA_LIBS GL X11 GLU glut)
target_link_libraries(main ${EXTRA_LIBS})
</pre>
<p>When using the X11 libraries, you must also change the includes as the folder structure for X11 is different than that natively for OS X:</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('p285code4'); return false;">View Code</a> CPP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2854"><td class="code" id="p285code4"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;GL/glew.h&gt;</span>
<span style="color: #339900;">#include &lt;GL/glut.h&gt;</span>
<span style="color: #339900;">#include &lt;GL/glext.h&gt;</span>
<span style="color: #339900;">#include &lt;GL/gl.h&gt;</span>
<span style="color: #339900;">#include &lt;GL/glu.h&gt;</span>
<span style="color: #339900;">#include &lt;GL/glx.h&gt;</span></pre></td></tr></table></div>

<p>That is all.  Not terribly complicated, but hopefully this saves you some time if you are doing development with CMake, OpenGL, or X11.  Look for some new slightly more exciting posts soon.</p>
<img src="http://feeds.feedburner.com/~r/AlexBeutel/~4/V8nFJ7kaRY0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/285/cmake-opengl-and-glx-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.alexbeutel.com/285/cmake-opengl-and-glx-on-os-x/</feedburner:origLink></item>
		<item>
		<title>Convert Quicktime Screencasts with FFmpeg</title>
		<link>http://feedproxy.google.com/~r/AlexBeutel/~3/dBClfKKMXHM/</link>
		<comments>http://blog.alexbeutel.com/302/convert-quicktime-screencasts-with-ffmpeg/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 00:42:05 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Miscellanious]]></category>

		<guid isPermaLink="false">http://blog.alexbeutel.com/?p=302</guid>
		<description><![CDATA[I was trying to convert a Quicktime screencast (saved as .mov) to a format my professor could more readily use. For those who don&#8217;t know, FFmpeg is an amazing tool with a wide range of applications, including converting between video formats and ripping audio from a video. Anyway, this took me a little to get [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to convert a Quicktime screencast (saved as .mov) to a format my professor could more readily use.  For those who don&#8217;t know, <a href='http://www.ffmpeg.org/' target="_blank">FFmpeg</a> is an amazing tool with a wide range of applications, including converting between video formats and ripping audio from a video.  Anyway, this took me a little to get quite right (and maintain output quality) so I thought I&#8217;d post it here both for others and a place to save it for myself.  Although it looks really simple in hindsight:</p>
<pre>ffmpeg -i screencast.mov -f avi -vcodec mpeg4 -sameq -ac 2 -ab 128k screencast.avi</pre>
<p>It is necessary to specify a video codec because AVI can be used with multiple codecs.  To maintain video quality use -sameq.  When converting screencasts, it may also be useful to crop out parts of the screen since Quicktime only does full screen capture.  For this, you can use the -croptop, -cropbottom, -cropright, and -cropleft arguments.  Last, make sure the arguments come <i>before</i> the output file; otherwise they are not applied.</p>
<p>Maybe I will later do a more full post of the different ways I use FFmpeg.  But for now, that is all.</p>
<img src="http://feeds.feedburner.com/~r/AlexBeutel/~4/dBClfKKMXHM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/302/convert-quicktime-screencasts-with-ffmpeg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.alexbeutel.com/302/convert-quicktime-screencasts-with-ffmpeg/</feedburner:origLink></item>
		<item>
		<title>Rankophilia and Rankophiliacs</title>
		<link>http://feedproxy.google.com/~r/AlexBeutel/~3/BJpX83wVN14/</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>
<img src="http://feeds.feedburner.com/~r/AlexBeutel/~4/BJpX83wVN14" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/275/rankophilia-and-rankophiliacs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.alexbeutel.com/275/rankophilia-and-rankophiliacs/</feedburner:origLink></item>
		<item>
		<title>SQL Injection at Duke TechExpo 2009</title>
		<link>http://feedproxy.google.com/~r/AlexBeutel/~3/O69P9OSQL64/</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>
<img src="http://feeds.feedburner.com/~r/AlexBeutel/~4/O69P9OSQL64" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/265/sql-injection-at-duke-techexpo-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.alexbeutel.com/265/sql-injection-at-duke-techexpo-2009/</feedburner:origLink></item>
		<item>
		<title>Drag and Drop off the Desktop in Duke Webfiles</title>
		<link>http://feedproxy.google.com/~r/AlexBeutel/~3/C0o44bAb1LQ/</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>
<img src="http://feeds.feedburner.com/~r/AlexBeutel/~4/C0o44bAb1LQ" height="1" width="1"/>]]></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>
		<feedburner:origLink>http://blog.alexbeutel.com/255/drag-and-drop-off-the-desktop-in-duke-webfiles/</feedburner:origLink></item>
		<item>
		<title>Hilbert Curve with the Canvas element</title>
		<link>http://feedproxy.google.com/~r/AlexBeutel/~3/qRA6yDbHAkY/</link>
		<comments>http://blog.alexbeutel.com/247/hilbert-curve-with-the-canvas-element/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 22:56:48 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Miscellanious]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=247</guid>
		<description><![CDATA[For my discrete math course (CPS 102) this semester, I had to create a space-filling curve for one of my homework assignments. I decided to take this as an opportunity to play with HTML5&#8242;s canvas element since I&#8217;ve yet to had a legitimate use for it in any programming yet. I think it came out [...]]]></description>
			<content:encoded><![CDATA[<p>For my discrete math course (CPS 102) this semester, I had to create a space-filling curve for one of my homework assignments.  I decided to take this as an opportunity to play with HTML5&#8242;s canvas element since I&#8217;ve yet to had a legitimate use for it in any programming yet.  I think it came out decently well (and it&#8217;s kind of fun to play with), so I thought I&#8217;d post it.  Here is a link to it on my Duke account <a href="http://duke.edu/~amb79/fillSpace.html" target="_blank">http://duke.edu/~amb79/fillSpace.html</a> Like I said, nothing huge but fun to program and cool to watch.</p>
<p>I am on fall break now, and will be spending the weekend at home.  Hopefully I&#8217;ll do something cool while I&#8217;m home and will post if anything comes out good.</p>
<img src="http://feeds.feedburner.com/~r/AlexBeutel/~4/qRA6yDbHAkY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/247/hilbert-curve-with-the-canvas-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.alexbeutel.com/247/hilbert-curve-with-the-canvas-element/</feedburner:origLink></item>
		<item>
		<title>Ubiquity Scripts</title>
		<link>http://feedproxy.google.com/~r/AlexBeutel/~3/viWCRis1Zvo/</link>
		<comments>http://blog.alexbeutel.com/233/ubiquity-scripts/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 07:17:58 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=233</guid>
		<description><![CDATA[After playing with the Jetpack API and having an increasing desire to procrastinate my Spanish homework, I decided to give the Ubiquity API a shot too and make a few small scripts just to make my life easier.  The first extension I made was a script to do look ups of IP addresses and get [...]]]></description>
			<content:encoded><![CDATA[<p>After playing with the Jetpack API and having an increasing desire to procrastinate my Spanish homework, I decided to give the Ubiquity API a shot too and make a few small scripts just to make my life easier.  The first extension I made was a script to do look ups of IP addresses and get more information about them.  This is useful mainly if you are looking at raw logs from a web server.  After realizing how easy it was to make these scripts, I made two more for bit.ly links which I frequently come across on Twitter.  The first can get more info and stats about a link (the number of clicks) and easily send you to the bit.ly info page for that link.  The second script can be used to quickly expand the links from their compressed bit.ly form to their original form.  I know there are other scripts that can do this across an entire page, but felt I&#8217;d rather keep short links with a quick and easy way to find out what the link contains.  If any of these sound interesting/useful or if you just want to see some simple examples of how to code Ubiquity extensions, you can check the scripts out <a href='http://ambmediadesign.com/scripts/ubiquity.html' target='_blank'>here</a>.  I have also included screenshots for each of these scripts below.</p>
<div style='padding: 7px;'><img src='http://ambmediadesign.com/scripts/iptrace2.png' /></div>
<div style='padding: 7px;'><img src='http://ambmediadesign.com/scripts/bitly-info.png' /></div>
<div style='padding: 7px;'><img src='http://ambmediadesign.com/scripts/bitly-expand.png' /></div>
<img src="http://feeds.feedburner.com/~r/AlexBeutel/~4/viWCRis1Zvo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/233/ubiquity-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.alexbeutel.com/233/ubiquity-scripts/</feedburner:origLink></item>
		<item>
		<title>Image Aliasing of Plane Propellers in Photos and Video</title>
		<link>http://feedproxy.google.com/~r/AlexBeutel/~3/QBIJJiUt8Vg/</link>
		<comments>http://blog.alexbeutel.com/135/image-aliasing-of-plane-propellers-in-photos-and-video/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 05:33:27 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Miscellanious]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=135</guid>
		<description><![CDATA[Recently, while flying between Durham and New York, I decided to take a picture of the propeller during take off.  I don&#8217;t know what prompted to me to do this, but when I pointed my iPhone camera at the propeller out my window I noticed very odd pattens.  I took multiple pictures throughout the flight [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, while flying between Durham and New York, I decided to take a picture of the propeller during take off.  I don&#8217;t know what prompted to me to do this, but when I pointed my iPhone camera at the propeller out my window I noticed very odd pattens.  I took multiple pictures throughout the flight with my iPhone, and in some cases at the same time took pictures/video with my Canon camera.  To clarify the specs of the two cameras: I have an iPhone 3G (8 GB) and a Canon SD700 IS.  As you will see in the pictures below, the iPhone&#8217;s picture simply makes no sense with the blades appearing to be disconnected vertical lines.  The photo from the Canon seems reasonable, but as you will see in the video the propeller appears to be going fairly slowly, when in real life all I could see was a blur because of how fast it was moving.</p>
<div style='display:block; width: 100%;'>
<div style='float:left;'>
<div id="attachment_155" class="wp-caption alignnone" style="width: 193px"><a href="http://blog.ambmediadesign.com/wp-content/uploads/2009/07/IMG_0140.png" class='thickbox' rel='propellers' title='Plane Propeller Photo from iPhone 3G'><img class="size-medium wp-image-155  " title="Plane Propeller Photo from iPhone 3G" src="http://blog.ambmediadesign.com/wp-content/uploads/2009/07/IMG_0140-225x300.png" alt="Plane Propeller Photo from iPhone 3G" width="183" height="243" /></a><p class="wp-caption-text">Plane Propeller Photo from iPhone 3G</p></div>
</div>
<div style='float:left;'>
<div id="attachment_134" class="wp-caption alignnone" style="width: 187px"><a href="http://blog.ambmediadesign.com/wp-content/uploads/2009/07/IMG_2451.JPG" class='thickbox' rel='propellers' title='Canon SD700 IS Plane Propeller Photo'><img class="size-medium wp-image-134     " title="Canon SD700 IS Plane Propeller Photo" src="http://blog.ambmediadesign.com/wp-content/uploads/2009/07/IMG_2451-300x225.jpg" alt="Canon SD700 IS Plane Propeller Photo" width="177" height="134" /></a><p class="wp-caption-text">Canon SD700 IS Plane Propeller Photo</p></div>
</div>
<div style='float:left;'><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="320" height="265" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/lTqwBKeKnLM&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="320" height="265" src="http://www.youtube.com/v/lTqwBKeKnLM&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
</div>
<div style='clear:both;'></div>
<div style='padding-bottom: 5px'><b>Update:</b> here is a video taken from my iPhone 3G of the propeller.<br />
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/ltMPMz37VPk&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ltMPMz37VPk&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
</div>
<div style='display:block;clear:both;'>
This got me thinking about why the images looked the way they did.  I assumed they were related to frame rate and as a result wondered if I could work backwards to find the speed of the propeller.  When I got back to Duke, I talked it over with some of my friends.  We discussed one theory that explained the slow spinning in the video from my Canon.  I later found out is similar to the Wagon-wheel effect, and will go into more detail on this later.  We also discussed possible distortions and other possible causes but couldn&#8217;t figure out exactly what was causing the odd pattern in the iPhone photo.  Eventually, I decided to search around the internet and found that I was <a href="http://www.flickr.com/photos/jerlich/sets/72157614852342118/">not the only one</a> to notice this oddity.  I also stumbled upon <a href='http://scalarmotion.wordpress.com/2009/03/15/propeller-image-aliasing/' target='_blank'>this great post</a> explaining clearly and graphically why the iPhone photo looks the way it does.  In short, most cameras save pixels from all parts of the lens at once, while the iPhone camera goes through the lens saving pixels linearly over time, similar to watching a scanner save the page of a book.  <strong>(If anyone has an iPhone 3GS and can snap a picture and/or video of a propeller, please let me know.  I&#8217;m very intrested to see if Apple&#8217;s upgraded camera still behaves this way.  Please let me know if you find out.)</strong>  The writer of the post also demonstrated this in a cool video made from a <a href="http://blog.alexbeutel.com/propeller/originalPropeller.m">Matlab script</a>:
</div>
<div>
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/T055cp-JFUA&#038;hl=en&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/T055cp-JFUA&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>
</div>
<div style='padding-top: 10px; padding-bottom:10px;'>
Personally, I think this is really cool so I decided to play around with it some more.  As I mentioned earlier, my friends and I had discussed the wagon-wheel effect or the stroboscopic effect, so I thought I&#8217;d modify his script to demonstrate it more clearly since the Wikipedia pages on the <a href='http://en.wikipedia.org/wiki/Wagon-wheel_effect' target='_blank'>two</a> <a href='http://en.wikipedia.org/wiki/Stroboscopic_effect' target='_blank'>topics</a> both seemed a bit lacking.  First, it is necessary to explain the general concept.  The stroboscopic effect explains if you only see flashes or quick individual frames of a moving object at regular intervals you can get a distorted view of the motion, especially if the motion of the object that is being watched is cyclic or has a frequency.  The relationship between the frequency of the flashes or frames and the frequency of the motion is what determines the perceived motion.  The most common case of this is seeing a wheel which you know to be rolling forward, but it looks to be spinning backwards slowly.  I modified the previous Matlab code to create a basic example of this with the propeller (download the code <a href="http://blog.alexbeutel.com/propeller/propeller.m">here</a>).  As you will see, the propeller on the left will spin counterclockwise at a moderate speed and every 8 frames the image on the right will update with a copy of the image on the left.  This out of sync updating will make the propeller on the right appear to rotate clockwise.</div>
<div id="matlabDemoVideo" style="display: none;position: absolute;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="1130" height="516" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="/propeller/matlab demo2.swf" /><embed type="application/x-shockwave-flash" width="1130" height="516" src="/propeller/matlab demo2.swf"></embed></object></div>
<div>
<div id="attachment_169" class="wp-caption alignnone" style="width: 510px"><a class="thickbox" href="#TB_inline?height=516&#038;width=1130&#038;inlineId=matlabDemoVideo"><img src="http://blog.ambmediadesign.com/wp-content/uploads/2009/07/matlab-screenshot.png" alt="Click the image to view the video" title="Screenshot of Wagon-wheel video" width="500" class="size-full wp-image-169"  style='padding: 15px; width: 500px; cursor: pointer;' onmouseover='this.style.backgroundColor="#333";' onmouseout='this.style.backgroundColor="";' /></a><p class="wp-caption-text">Click the image to view the video</p></div></div>
<div style='padding-top:10px;'>
I also decided to show this more mathematically by plotting these movements in Mathematica.  In the following examples I graph both the y-coordinate of the tip of the propeller and the angle that the blade has rotated in radians.  In the graph of y the coordinate, there are three sinusoidal functions representing 3 propellers, each offset from the previous by 120 degrees (thus equally spaced).  These lines and their colors correspond to the colored lines on the radian vs. time graph.  The red lines mark a flash or frame and the dot on the line shows the top-most propeller.  As you vary the spacing of the lines and thus change the frame rate, you can see the propeller will appear to stay still, then go backwards, then flip back and forth with no perceived motion, then go forwards, until it appears to stand still again.  Below are pictures showing each of these stages, followed by a video fluidly showing these variations.
</div>
<div>
Here is the propeller appearing to stand still.  This is due to the fact that the spacing of the frames is twice the period.<br />
<a href="http://blog.alexbeutel.com/propeller/still.png" target='_blank' class='thickbox' rel='mathematica' title='Propeller appearing to stand still'><img src='/propeller/still.png' style='width: 500px;'/></a><br />
The graphs below show the propeller appearing to go backwards.  Here we see that the frame rate is just below two periods of the propeller.  The downward slope on the radian graph is a simple quick way to see the direction of the propeller rotation.<br />
<a href="http://blog.alexbeutel.com/propeller/backwards.png" target='_blank' class='thickbox' rel='mathematica' title='Propeller appearing to go backwards'><img src='/propeller/backwards.png' style='width: 500px;' /></a><br />
Propeller appearing to flip repeatedly:<br />
<a href="http://blog.alexbeutel.com/propeller/flip.png" target='_blank' class='thickbox' rel='mathematica' title='Propeller appearing to flip repeatedly'><img src='/propeller/flip.png' style='width: 500px;' /></a><br />
This example shows the propeller appearing to rotate forwards.  Again, the upwards slope of the points on the radian graph is an easy way to see the direction of rotation.<br />
<a href="http://blog.alexbeutel.com/propeller/forwards.png" target='_blank' class="thickbox" rel='mathematica' title='Propeller appearing to rotate forwards'><img src='/propeller/forwards.png' style='width: 500px;' /></a><br />
Last, here is the propeller appearing to stand still again.  Unlike the first case of the propeller standing still, the spacing of the frames is not a multiple of the period.  Rather, we see here that it is a multiple of 1/3 the period.  It is only necessary that the spacing be a multiple of 1/3 the period because there are three blades and the blades are indistinguishable.<br />
<a href="http://blog.alexbeutel.com/propeller/still2.png" target='_blank' class='thickbox' rel='mathematica' title='Propeller appearing to stand still again'><img src='/propeller/still2.png' style='width: 500px;' /></a></p>
<div style='padding-top: 10px; padding-bottom:10px;'>
And finally, putting it all together:
</div>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="340" height="475" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="/propeller/graphs.swf" /><embed type="application/x-shockwave-flash" width="340" height="475" src="/propeller/graphs.swf"></embed></object>
</div>
<p>The Mathematica code can be viewed <a href="http://gist.github.com/151142" target='_blank'>here</a> or downloaded <a href="http://blog.alexbeutel.com/propeller/propeller.nb">here</a>, and a printout of the entire Mathematica worksheet can be found <a href="http://blog.alexbeutel.com/propeller/mathematica printout.pdf">here</a>.  Last, if one had a camera which could vary the frame rate just so slightly as to find two nearest frame rates to show the propeller standing still, the frequency of the propeller could be calculated as shown below.</p>
<div style='padding-bottom: 15px;'>
<img src='/propeller/calc1-1.png' />
</div>
<p>As for the iPhone picture, a single image (and knowing the number of blades) is enough to roughly approximate the speed of the propeller as shown below.</p>
<div style='padding-bottom: 15px;'>
<img src='/propeller/calc2-2.png' />
</div>
<p>However, just as a warning both of these are back of the envelope calculations and it is very possible I made a mistake (if so please let me know).  That is all for now.  Nothing ground breaking, but as the title suggests, it was a good chance for some mental masturbation, playing with Mathematica and Matlab.</p>
<img src="http://feeds.feedburner.com/~r/AlexBeutel/~4/QBIJJiUt8Vg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/135/image-aliasing-of-plane-propellers-in-photos-and-video/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blog.alexbeutel.com/135/image-aliasing-of-plane-propellers-in-photos-and-video/</feedburner:origLink></item>
		<item>
		<title>Duke LDAP on the iPhone</title>
		<link>http://feedproxy.google.com/~r/AlexBeutel/~3/YiCuoKKju9Y/</link>
		<comments>http://blog.alexbeutel.com/113/duke-ldap-on-the-iphone/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 23:11:41 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Duke]]></category>
		<category><![CDATA[Miscellanious]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://blog.ambmediadesign.com/?p=113</guid>
		<description><![CDATA[I got an e-mail this morning from someone who saw my post on Twitter about using LDAP on the iPhone here at Duke.  The person said they followed the tutorial but couldn&#8217;t quite get it to work.  So I figured it may be useful to post a few quick instructions on setting it up.  As [...]]]></description>
			<content:encoded><![CDATA[<p>I got an e-mail this morning from someone who saw my <a href="http://twitter.com/alexbeutel/status/2691509584" target="_blank">post</a> on Twitter about using LDAP on the iPhone here at Duke.  The person said they followed the tutorial but couldn&#8217;t quite get it to work.  So I figured it may be useful to post a few quick instructions on setting it up.  As the post on Twitter explains, the basic instructions for getting to adding an LDAP account can be viewed <a href="http://blogs.sun.com/chienr/entry/configuring_ldap_on_iphone_3" target="_blank">here</a> and Duke&#8217;s LDAP server settings can be found <a href="http://www.oit.duke.edu/email-accounts/dukemail/how-to/ldap.php" target="_blank">here</a>.  Once you are set to add the LDAP account, simply set the server to ldap.duke.edu, no need for a username or password.  Once you click next you will want to turn off SSL and change the Search settings for duke,edu to have a base value of &#8220;ou=People,dc=duke,dc=edu&#8221; (leave the scope at subtree).  And that&#8217;s it.  To use it, which turned out to be the issue for the person emailing me, go to write a new email and start to type in the name of the person to search.  You should see a throbber show up at the top of your screen, showing that it is connecting to the server.  There is a bit of a lag but it should eventually return the contacts for people by that name.  Below are some pictures of the settings and the search.  Let me know if you run into any issues.</p>
<div style='float:left; padding-bottom: 10px; padding-right: 20px;'><a href='http://blog.ambmediadesign.com/wp-content/uploads/2009/07/ldap1.png' target='_blank' class='thickbox' rel='ldap' title='Main Settings'><img src='http://blog.ambmediadesign.com/wp-content/uploads/2009/07/ldap1.png' title='Main Settings' style='height: 350px;' /></a></div>
<div style='float:left;'><a href='http://blog.ambmediadesign.com/wp-content/uploads/2009/07/ldap2.png' target="_blank" class='thickbox' rel='ldap' title='Search Settings'><img src='http://blog.ambmediadesign.com/wp-content/uploads/2009/07/ldap2.png' title='Search Settings' style='padding-bottom: 10px; height: 350px;' /></a></div>
<div style='clear:both;'></div>
<p><a href='http://blog.ambmediadesign.com/wp-content/uploads/2009/07/ldap4.png' target='_blank' class='thickbox' rel='ldap' title='Email Search'><img src='http://blog.ambmediadesign.com/wp-content/uploads/2009/07/ldap4.png' title='Email Search' style='height: 350px;' /></a></p>
<img src="http://feeds.feedburner.com/~r/AlexBeutel/~4/YiCuoKKju9Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.alexbeutel.com/113/duke-ldap-on-the-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.alexbeutel.com/113/duke-ldap-on-the-iphone/</feedburner:origLink></item>
	</channel>
</rss>
