<?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>Blog of Auzigog - Jeremy Blanchard &#187; Photography</title>
	<atom:link href="http://auzigog.com/category/photography/feed/" rel="self" type="application/rss+xml" />
	<link>http://auzigog.com</link>
	<description>ideas and guides from a nerdy college student</description>
	<lastBuildDate>Tue, 27 Jul 2010 00:53:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Creating a MediaWiki API Instance Outside Installation Directory</title>
		<link>http://auzigog.com/2009/01/11/creating-a-mediawiki-api-instance-outside-installation-directory/</link>
		<comments>http://auzigog.com/2009/01/11/creating-a-mediawiki-api-instance-outside-installation-directory/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 08:24:15 +0000</pubDate>
		<dc:creator>Auzigog</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Guides]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://auzigog.com/?p=222</guid>
		<description><![CDATA[
I&#8217;m in the process of writing mediawiki2wordpress&#8212;a plugin to allow WordPress to access and display content from a MediaWiki installation. I spent a bit of the evening figuring out how to get MediaWiki to let me trick it into thinking I was making a standard request. The method I explain here gives you access to [...]
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m in the process of writing <a href="http://github.com/auzigog/mediawiki2wordpress/tree/master">mediawiki2wordpress</a>&mdash;a plugin to allow <a href="http://wordpress.org/">WordPress</a> to access and display content from a <a href="http://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a> installation. I spent a bit of the evening figuring out how to get MediaWiki to let me trick it into thinking I was making a standard request.</p>
<p>The method I explain here gives you access to the <a href="http://www.mediawiki.org/wiki/API">MediaWiki API class</a> as opposed to the standard MediaWiki rendering class. Most of this code came from MediaWiki&#8217;s <span class="code">api.php</span> which you can find in <a href="http://download.wikimedia.org/mediawiki/1.13/mediawiki-1.13.3.tar.gz">MediaWiki 1.13</a>.</p>
<p>Here&#8217;s what the API output will look like for the <a href="http://en.wikipedia.org/w/api.php?action=parse&#038;page=Foobar">Foobar page on Wikipedia</a> (in XML).</p>
<p>I spent quite a bit of time poking around in the MediaWiki /includes directory and trying different hack-ish methods before <a href="http://www.mediawiki.org/wiki/API:Calling_internally#Using_API_internally_by_other_code">this page</a> that had exactly what I needed! It did need updating, but I <a href="http://www.mediawiki.org/w/index.php?title=API:Calling_internally&#038;diff=232400&#038;oldid=214333">was happy to oblige</a>. I even had this whole post written up using a sloppier approach before finding the <span class="code">FauxRequest</span> class that I explain below.<br />
<span id="more-222"></span></p>
<h3>The code</h3>
<p>Let&#8217;s start with the sample code, then go over the details.</p>
<pre lang="php" line="1">$mediawiki_root = '/Users/eyeRmonkey/www/mediawiki-test';
putenv("MW_INSTALL_PATH=$mediawiki_root");
// Initialise common code
require ($mediawiki_root . '/includes/WebStart.php');

class MediaWikiAPIWrapper {
	public function make_fake_request($params) {
		$request = new FauxRequest($params, true);

		$api = new ApiMain($request);

		// Process data &#038; use an output buffer to capture the resutls
		$api->execute();
		$result = $api->getResult();
		$data = &#038;$result->getData();

		return $data;
	}
}</pre>
<h3>Initializing</h3>
<p>The first matter of business is <strong>lines 1 through 4</strong>. These <em>need</em> to be called outside of any function or class. I spent some time trying to figure out why none of MediaWiki&#8217;s global variables were showing up in <span class="code">print_r($GLOBALS)</span> before thinking to <span class="code">require_once()</span> it outside of any functions. Duh. Make sure you get the path to your MediaWiki installation root correct (no trailing slash, obviously).</p>
<p>Most of the work get&#8217;s done on <strong>line 4</strong>. This get&#8217;s all the code ready for a standard API call from the web. This whole approach is meant to be used by an <a href="http://www.mediawiki.org/wiki/Extension_Matrix">extension</a>, so we need to play catchup by initializing the core MediaWiki code.</p>
<h3>Faking the Request</h3>
<p>The good folks at MediaWiki were are kind enough to provide us with a class specifically meant for faking an API request! Joy! It&#8217;s called <span class="code">FauxRequest</span> and it extends the <span class="code">WebRequest</span> object that is used by default for API calls. The <span class="code">FauxRequest</span> class takes an array of keys and values that represent what would&#8217;ve been passed in the URL.</p>
<p>The API manual has more information on  <a href="http://www.mediawiki.org/wiki/API:Data_formats">formats</a> and different <a href="http://www.mediawiki.org/wiki/API:Query">queries</a> you can make to the API.</p>
<p>Here is what your <span class="code">$params</span> array might look like to grab the Main Page:</p>
<pre lang="php">$data = array(
		'action' => 'parse',
		'page' => 'Main_Page'
	);</pre>
<h3>Running the API</h3>
<p><strong>Lines 10 through 15</strong> create an instance of the API and pass in our <span class="code">FauxRequest</span> object to get things rolling!</p>
<p>The <span class="code">$data</span> array will hold all of the information that you would get from a <span class="code">format=php</span> API call. As always, you could use <span class="code">print_r()</span> to display the Array for debugging purposes.</p>
<p><em>That&#8217;s it!</em></p>
<h3>mod_rewrite Issues</h3>
<p>On <a href="http://wiki.auzigog.com">my wiki</a>, the .htaccess mod_rewrite rules that I have seem to be preventing the API from functioning totally correctly. A workaround I discovered is to use the following API call: <a href="http://en.wikipedia.org/w/api.php?action=parse&#038;title=Main_Page&#038;text=%7B%7B%3AMain_Page%7D%7D"><span class="code">/api.php?action=parse&#038;title=Main_Page&#038;text={{:Main_Page}}</span></a>. This works by asking the API to translate the <span class="code">text</span> parameter into rendered text. The <span class="code">{{:Main_Page}}</span> says that the text is actually a <a href="http://en.wikipedia.org/wiki/Wikipedia:Transclusion">transclusion-ed</a> page. It&#8217;s definitely a hack, but it works on servers with weird rewrite rules for <a href="http://www.mediawiki.org/wiki/Manual:Short_URL">pretty URLs</a>.</p>
<h3>Further reading</h3>
<ul>
<li><a href="http://www.mediawiki.org/wiki/API:Query_-_Properties">API: Query Properties</a>
</li>
<li><a href="http://www.mediawiki.org/wiki/API:Expanding_templates_and_rendering">API: Expanding templates and rendering</a> &#8211; Relevant to the transclusion workaround.
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://auzigog.com/2009/01/11/creating-a-mediawiki-api-instance-outside-installation-directory/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Enlightened Photography</title>
		<link>http://auzigog.com/2008/01/09/enlightened-photography/</link>
		<comments>http://auzigog.com/2008/01/09/enlightened-photography/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 02:50:11 +0000</pubDate>
		<dc:creator>Auzigog</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://eyermonkey.com/2008/01/09/enlightened-photography/</guid>
		<description><![CDATA[
Photo by Kazze Seize the moment of excited curiosity on any subject to solve your doubts; for if you let it pass, the desire may never return, and you may remain in ignorance. -William Wirt Ever since I first ran across this jewel of advice, I have always made an effort to apply it to [...]
]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 260px; text-align: center;"><a href="http://www.flickr.com/photos/kazze/289620863/" title="Curiosity"><img src="http://farm1.static.flickr.com/110/289620863_fec1c94a58_m.jpg" width="240" height="172" alt="Curiosity" title="Curiosity" style="border: 0pt none;" /></a><br />Photo by <a href="http://www.flickr.com/photos/kazze/">Kazze</a></div>
<blockquote><p>Seize the moment of excited curiosity on any subject to solve your doubts; for if you let it pass, the desire may never return, and you may remain in ignorance.<br />
-William Wirt</p></blockquote>
<p>Ever since I first ran across this jewel of advice, I have always made an effort to apply it to my life. Whenever my interest in a certain subject flares, I make a point to explore it before my focus has a chance to shift elsewhere.</p>
<p>As of late, my excitement and curiosity have revolved around photography. I bought a <a href="http://en.wikipedia.org/wiki/Nikon_D40">Nikon D40</a> in June and have since only put it to good use on occasion. Since I purchased it, I&#8217;ve had a nagging sense that my photos weren&#8217;t turning out as interesting or &#8220;professional looking&#8221; as those taken by my friends who are amateur photographers. Part of this has to do with the fact that I&#8217;m not always as creative as I&#8217;d like. I also knew the source of my displeasure wasn&#8217;t the fact that I have an entry-level Nikon, because I&#8217;ve been told time and time again that <a href="http://www.kenrockwell.com/tech/notcamera.htm">the camera doesn&#8217;t matter</a>.</p>
<p><span id="more-20"></span></p>
<div style="float: left; width: 181px; text-align: center;"><a href="http://www.flickr.com/photos/mazakar/1720761226/" title="Idea"><img src="http://farm3.static.flickr.com/2107/1720761226_77a909e73d_m.jpg" width="161" height="240" alt="Idea" title="Idea" style="border: 0pt none;" /></a><br />Photo by <a href="http://www.flickr.com/photos/mazakar/">Will Foster</a></div>
<p>It wasn&#8217;t until recently (while browsing <a href="http://www.flickr.com/photos/mazakar/">Will Foster&#8217;s Flickr gallery</a>) that I realized what my photos were missing: <b>light</b>. In retrospect, it seems so obvious. After all, in it&#8217;s simplest form, a photograph is just the capturing of light. All I&#8217;ve ever used is my D40&#8242;s pop-up flash (which leads to harsh lighting and harsh shadows in photographs). It had never occurred to me that a hot-shoe flash (or an off camera flash) could dramatically improve the quality of my photos.</p>
<p>After doing some research, I went out and bought a <a href="http://www.kenrockwell.com/nikon/sb600.htm">Nikon SB-600</a> Speedlight. The difference in my photos was noticeable right away. Below is a comparison of the D40&#8242;s pop-up flash and the SB-600. My roommate, Ryan, was happy to stand in for this experiment. The photo on the left was taken using the built-in pop-up flash on the D40. To the right we have a the remarkable results using the SB-600. The key to the second photo was that I angeled the flash head to bounce off the ceiling and <i>then</i> to Ryan. If you look at the <a href="http://eyermonkey.com/wp-content/uploads/2008/01/flash-comparison-web.jpg">larger version</a>, you can really see the natural shading and definition on his face. An off camera flash (or two) could&#8217;ve produced even better results!</p>
<p><a href="http://eyermonkey.com/wp-content/uploads/2008/01/flash-comparison-web.jpg" title="Flash comparison" style="border: 0;"><img src="http://eyermonkey.com/wp-content/uploads/2008/01/flash-comparison-thumb-web.jpg" alt="Flash comparison" style="float: none;" /></a></p>
<p>The day after I bought the speedlight, Will wrote a <a href="http://willarg.blogspot.com/2008/01/happy-new-year-its-time-to-rock-2008.html">retrospective new years blog</a>, in which, he mentioned a site called <a href="http://www.strobist.blogspot.com/">Strobist</a>. I decided to check out the site, and after an hour or two, I finally came out of my trance of amazement. The site was packed to the brim with useful information for a photographer on a budget. The mantra as Strobist can be found at the top of every page on the site: <i>Less Gear. More Brain. Better Light.</i> </p>
<p>The Strobist community certainly takes these words to heart. They have entire series of courses designed to help you get your an inexpensive, <i>off camera</i> lighting system so you can get creative with your photos. I&#8217;m working my way through their <a href="http://strobist.blogspot.com/2006/03/lighting-101.html">Lighting 101 series</a> right now. I ordered an &#8220;<a href="http://search.stores.ebay.com/Gadget-Infinity_v2s_W0QQfciZQ2d1QQfclZ4QQfsnZGadgetQ20InfinityQQfsooZ1QQfsopZ1QQsaselZ88783763QQsofpZ0">eBay trigger</a>&#8221; so I can start wirelessly triggering my flashes. I&#8217;m already started preparing all my friends for the amount of modeling that I&#8217;ll be forcing them to partake in once those triggers arrive.</p>
<p>After my interest in photography was reignited, I started pillaging through my dad&#8217;s old gear which had been sitting in his closet for an eternity. I ended swiping an SB-15, an umbrella and a stand for the umbrella. I also ordered an extra flash trigger from eBay so I could fire the SB-15 remotely also.</p>
<p>I&#8217;m now on my way to doing some cool things with my photography. I plan on reading Strobist and <a href="http://feeds.feedburner.com/willarg_shared">other photography blogs</a> on a regular basis. I also hope to be at the next <a href="http://www.flickr.com/groups/pdxstrobist/discuss/72157603491005662/">Portland Strobist Photo Shoot</a>. I&#8217;m also looking into building a <a href="http://www.flickr.com/groups/strobist/discuss/72157603455708647/">DIY</a> <a href="http://www.flickr.com/groups/strobist/discuss/72157603053892127/">flash</a> <a href="http://www.flickr.com/groups/strobist/discuss/72157603302830038/">ring</a>.</p>
<p>What have been some turning points in your photographic journey? Or more generally, what have you been excited about recently that you made a point to pursue?</p>
]]></content:encoded>
			<wfw:commentRss>http://auzigog.com/2008/01/09/enlightened-photography/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

