<?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>Marteinn / Blog</title>
	<atom:link href="http://www.marteinn.se/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.marteinn.se/blog</link>
	<description>Ramblings from a (very dark) coalmine</description>
	<lastBuildDate>Thu, 10 May 2012 22:27:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Use subdomain with S3 and django-storages (using boto)</title>
		<link>http://www.marteinn.se/blog/?p=583</link>
		<comments>http://www.marteinn.se/blog/?p=583#comments</comments>
		<pubDate>Thu, 10 May 2012 22:27:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Django]]></category>

		<guid isPermaLink="false">http://www.marteinn.se/blog/?p=583</guid>
		<description><![CDATA[(I take for granted that everything else is installed and working properly) Put this in your settings.py. Now django-storages will use the bucket-name as url root. from boto.s3.connection import VHostCallingFormat AWS_S3_CALLING_FORMAT = VHostCallingFormat&#40;&#41;]]></description>
			<content:encoded><![CDATA[<p>(I take for granted that everything else is installed and working properly)</p>
<p>Put this in your settings.py. Now django-storages will use the bucket-name as url root.</p>
<div class="codesnip-container" >
<div class="python codesnip" style="font-family:monospace;"><span class="kw1">from</span> boto.<span class="me1">s3</span>.<span class="me1">connection</span> <span class="kw1">import</span> VHostCallingFormat<br />
AWS_S3_CALLING_FORMAT = VHostCallingFormat<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.marteinn.se/blog/?feed=rss2&#038;p=583</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting PIL to run on Ubuntu 11.04 in Virtualenv</title>
		<link>http://www.marteinn.se/blog/?p=580</link>
		<comments>http://www.marteinn.se/blog/?p=580#comments</comments>
		<pubDate>Sun, 29 Apr 2012 16:14:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Server-side stuff]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.marteinn.se/blog/?p=580</guid>
		<description><![CDATA[There are tons of posts out there showing different solutions, but not always pointing out platforms or with/without virtualenv. This code snippet explains how I got PIL to run in Ubuntu 11.04 using Virtualenv on a EC2 instance, plain and simple. # Install image libraries sudo apt-get install libjpeg-dev libjpeg62 libjpeg62-dev zlib1g-dev libfreetype6 libfreetype6-dev # [...]]]></description>
			<content:encoded><![CDATA[<p>There are tons of posts out there showing different solutions, but not always pointing out platforms or with/without virtualenv. This code snippet explains how I got PIL to run in Ubuntu 11.04 using Virtualenv on a EC2 instance, plain and simple.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="co0"># Install image libraries</span><br />
<span class="kw2">sudo</span> <span class="kw2">apt-get</span> <span class="kw2">install</span> libjpeg-dev libjpeg62 libjpeg62-dev zlib1g-dev libfreetype6 libfreetype6-dev<br />
<span class="co0"># Install pip</span><br />
<span class="kw2">sudo</span> <span class="kw2">apt-get</span> <span class="kw2">install</span> python-pip <br />
<span class="co0"># Install virtualenv</span><br />
<span class="kw2">sudo</span> pip <span class="kw2">install</span> virtualenv<br />
<span class="co0"># Create virtual env</span><br />
virtualenv <span class="re5">&#8211;no-site-packages</span> myproject.com<br />
<span class="co0"># Activate it</span><br />
<span class="kw3">source</span> bin<span class="sy0">/</span>activate<br />
<span class="co0"># Run Pillow (a PIL drop-in replacement)</span><br />
pip <span class="kw2">install</span> Pillow</div>
</div>
<p>Credits: <a href="http://stackoverflow.com/a/7015085">Stackoverflow</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marteinn.se/blog/?feed=rss2&#038;p=580</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Note to self: Ident authentication failed for user &#8216;Ubuntu&#8217;</title>
		<link>http://www.marteinn.se/blog/?p=577</link>
		<comments>http://www.marteinn.se/blog/?p=577#comments</comments>
		<pubDate>Wed, 25 Apr 2012 13:53:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PostgresQL]]></category>
		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://www.marteinn.se/blog/?p=577</guid>
		<description><![CDATA[Having problem with authentication failed using postgresql and you know your .pgpass is correct? Try using -U to indicate user. Example: pg_dump -U postgres db_name &#124; gzip &#62; /backup.gz]]></description>
			<content:encoded><![CDATA[<p>Having problem with authentication failed using postgresql and you know your .pgpass is correct? Try using -U to indicate user.</p>
<p>Example:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">pg_dump <span class="re5">-U</span> postgres db_name <span class="sy0">|</span> <span class="kw2">gzip</span> <span class="sy0">&gt;</span> <span class="sy0">/</span>backup.gz</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.marteinn.se/blog/?feed=rss2&#038;p=577</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove SVN &#8211; AppleScript droplet</title>
		<link>http://www.marteinn.se/blog/?p=568</link>
		<comments>http://www.marteinn.se/blog/?p=568#comments</comments>
		<pubDate>Mon, 04 Jul 2011 17:57:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AppleScript]]></category>

		<guid isPermaLink="false">http://www.marteinn.se/blog/?p=568</guid>
		<description><![CDATA[Well, I know this type of droplet&#8217;s has been written before, but I have not seen much code shared. So here&#8217;s my take on it. Do like this. Just drop your folder, or folders if you like, onto the app and all the .svn folders will be cleaned. on open current_files &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I know this type of droplet&#8217;s has been written before, but I have not seen much code shared. So here&#8217;s my take on it. Do like this. Just drop your folder, or folders if you like, onto the app and all the .svn folders will be cleaned.</p>
<div class="codesnip-container" >
<div class="applescript codesnip" style="font-family:monospace;"><span class="kw3">on</span> <span class="kw1">open</span> current_files<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">repeat</span> <span class="kw3">with</span> current_file <span class="kw3">in</span> current_files<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">&#8211; validate if the file as a folder</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">if</span> <span class="br0">&#40;</span>current_file <span class="kw2">as</span> <span class="kw1">string</span><span class="br0">&#41;</span> ends <span class="kw3">with</span> <span class="st0">&quot;:&quot;</span> <span class="kw3">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> current_file_path <span class="kw3">to</span> <span class="br0">&#40;</span><span class="kw1">POSIX path</span> <span class="kw3">of</span> <span class="kw2">the</span> current_file <span class="kw2">as</span> <span class="kw1">string</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">do shell script</span> <span class="st0">&quot;find &nbsp;&#8217;&quot;</span> <span class="sy0">&amp;</span> current_file_path <span class="sy0">&amp;</span> <span class="st0">&quot;&#8217; -name &#8216;.svn&#8217; | xargs rm -Rf&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">if</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">repeat</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="kw3">end</span> <span class="kw1">open</span></div>
</div>
<p>I also added this as a gist under github. So please feel free to fork!<br />
<a href="https://gist.github.com/1063705">https://gist.github.com/1063705</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marteinn.se/blog/?feed=rss2&#038;p=568</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing AtomCart</title>
		<link>http://www.marteinn.se/blog/?p=520</link>
		<comments>http://www.marteinn.se/blog/?p=520#comments</comments>
		<pubDate>Sun, 13 Feb 2011 20:02:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.marteinn.se/blog/?p=520</guid>
		<description><![CDATA[I was actually supposed to release this project a couple of weeks ago, but work interfered (it always seems to do so). Anyhow here is AtomCart. AtomCart is basicly a very lightweight shopping cart in its purest form (hence the name), built in javascript as a jQuery plugin. It does nothing else except hold a [...]]]></description>
			<content:encoded><![CDATA[<p>I was actually supposed to release this project a couple of weeks ago, but work interfered (it always seems to do so). Anyhow here is AtomCart. AtomCart is basicly a very lightweight shopping cart in its purest form (hence the name), built in javascript as a jQuery plugin. It does nothing else except hold a very lightweight interface shopping cart, that supports adding/removing cart items and basic sum calculations. Dead simple and very easy to implement. </p>
<p>AtomCart is hosted on Github, so you can find it here: <a href="https://github.com/marteinn/AtomCart">https://github.com/marteinn/AtomCart</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marteinn.se/blog/?feed=rss2&#038;p=520</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AS3Flobile: Altering the ScrollList dataProvider without forcing a scroll position reset.</title>
		<link>http://www.marteinn.se/blog/?p=511</link>
		<comments>http://www.marteinn.se/blog/?p=511#comments</comments>
		<pubDate>Mon, 25 Oct 2010 01:44:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Action Script]]></category>

		<guid isPermaLink="false">http://www.marteinn.se/blog/?p=511</guid>
		<description><![CDATA[I was working with the AS3Flobile component ScrollList (its a great framework when doing mobile flash-development) and had the need to modify the dataProvider (I was making a continuous scroller), but everytime I changed the dataProvider the scroller would reset the scroll-position to x = 0, y = 0. After a little tinkering, I came [...]]]></description>
			<content:encoded><![CDATA[<p>I was working with the AS3Flobile component ScrollList (its a great <a href="http://custardbelly.com/blog/?p=173">framework</a> when doing mobile flash-development) and had the need to modify the dataProvider (I was making a continuous scroller), but everytime I changed the dataProvider the scroller would reset the scroll-position to x = 0, y = 0. After a little tinkering, I came up with a quick and dirty way to force the ScrollList to move to a position without a animation, and by doing so, making sure that the scroller starts at the same position as where we left off.</p>
<p><em>Of course, if anyone has a better solution, just post a comment at the end of this post!</em></p>
<p>Here it goes. </p>
<p><strong>1. First we need to extend the BaseScrollViewportStrategy class. This could look something like this:</strong></p>
<div class="codesnip-container" >
<div class="actionscript3 codesnip" style="font-family:monospace;"><span class="kw4">package</span> se<span class="sy0">.</span>marteinn<span class="sy0">.</span>app<span class="sy0">.</span>controls<span class="sy0">.</span>viewport<span class="sy0">.</span>context<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">import</span> com<span class="sy0">.</span>custardbelly<span class="sy0">.</span>as3flobile<span class="sy0">.</span>controls<span class="sy0">.</span>viewport<span class="sy0">.</span>context<span class="sy0">.</span>BaseScrollViewportStrategy<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">import</span> com<span class="sy0">.</span>custardbelly<span class="sy0">.</span>as3flobile<span class="sy0">.</span>controls<span class="sy0">.</span>viewport<span class="sy0">.</span>context<span class="sy0">.</span>IScrollViewportStrategy<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">import</span> <span class="kw6">flash.geom</span><span class="sy0">.</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html"><span class="kw5">Point</span></a><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">class</span> CustomScrollViewportStrategy <span class="kw1">extends</span> BaseScrollViewportStrategy implements IScrollViewportStrategy<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> <span class="kw3">function</span> moveToStaticPoint<span class="br0">&#40;</span> point<span class="sy0">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html"><span class="kw5">Point</span></a> <span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _currentScrollPositionX = point<span class="sy0">.</span><span class="kw7">x</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _currentScrollPositionY = point<span class="sy0">.</span><span class="kw7">y</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _coordinate<span class="sy0">.</span><span class="kw7">x</span> = _currentScrollPositionX<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _coordinate<span class="sy0">.</span><span class="kw7">y</span> = _currentScrollPositionY<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>2. Then we need to extend ScrollList and add this method: moveToStaticPoint and then override getDefaultScrollContext.</strong></p>
<div class="codesnip-container" >
<div class="actionscript3 codesnip" style="font-family:monospace;"><span class="co1">// This method sets a new scrolling position on both the ScollList itself and the strategy instance.</span><br />
<span class="kw1">public</span> <span class="kw3">function</span> moveToStaticPoint <span class="br0">&#40;</span> point<span class="sy0">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html"><span class="kw5">Point</span></a> <span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw1">void</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> strategy<span class="sy0">:</span>CustomScrollViewportStrategy<span class="sy0">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; strategy = _scrollContext<span class="sy0">.</span>strategy <span class="kw1">as</span> CustomScrollViewportStrategy<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; _currentScrollPosition = point<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; strategy<span class="sy0">.</span>moveToStaticPoint<span class="br0">&#40;</span> point <span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _listHolder<span class="sy0">.</span><span class="kw7">x</span> = point<span class="sy0">.</span><span class="kw7">x</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _listHolder<span class="sy0">.</span><span class="kw7">y</span> = point<span class="sy0">.</span><span class="kw7">y</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="co1">// And this method makes sure that we implement the new strategy element.</span><br />
override <span class="kw1">protected</span> <span class="kw3">function</span> getDefaultScrollContext<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">:</span>IScrollViewportContext<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw1">new</span> ScrollViewportMouseContext<span class="br0">&#40;</span> <span class="kw1">new</span> CustomScrollViewportStrategy<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>3. After that. You can use ScrollList like this.</strong></p>
<div class="codesnip-container" >
<div class="actionscript3 codesnip" style="font-family:monospace;"><span class="kw2">var</span> scrollList<span class="sy0">:</span>MyScrollList<span class="sy0">;</span></p>
<p><span class="co1">// Dump the scrollPosition (clone() is important). We will use this position after the dataProvider has changed</span><br />
<span class="kw7">position</span> = scrollList<span class="sy0">.</span>scrollPosition<span class="sy0">.</span><span class="kw7">clone</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p><span class="co1">// Do your stuff. for instance alter the dataProvider of the scroll list</span><br />
<span class="co1">// scrollList.dataProvider = updatedContent;</span></p>
<p><span class="co1">// Finish it off by running the moveToStaticPoint method. The ScrollList will now be set at the same position as where we started.</span><br />
scrollList<span class="sy0">.</span>moveToStaticPoint<span class="br0">&#40;</span> <span class="kw7">position</span> <span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.marteinn.se/blog/?feed=rss2&#038;p=511</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Finding your Google App Engine directory under OSX (with GoogleAppEngineLauncher installed)</title>
		<link>http://www.marteinn.se/blog/?p=502</link>
		<comments>http://www.marteinn.se/blog/?p=502#comments</comments>
		<pubDate>Sun, 03 Oct 2010 22:30:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[GAE]]></category>

		<guid isPermaLink="false">http://www.marteinn.se/blog/?p=502</guid>
		<description><![CDATA[I stumbled upon this dilemma when I was trying to create a pydev google app engine project in the AptanaStudio 3 edi, to complete the wizard I had to set my google app engine directory. After a bit of searching, I realized that the &#8220;google_appengine&#8221; directory was not placed in public on my harddrive, but [...]]]></description>
			<content:encoded><![CDATA[<p>I stumbled upon this dilemma when I was trying to create a pydev google app engine project in the <a href="http://www.aptana.com/">AptanaStudio 3</a> edi, to complete the wizard I had to set my google app engine directory. </p>
<p><img src="http://www.marteinn.se/blog/wp-content/uploads/Skärmavbild-2010-10-04-kl.-00.15.39.png" /></p>
<p>After a bit of searching, I realized that the &#8220;google_appengine&#8221; directory was not placed in public on my harddrive, but hidden inside the GoogleAppEngineLauncher.app package (right klick on the application &#8211; choose show content).</p>
<p>So, if you run GoogleAppEngineLauncher on your mac, the path to your google app engine root is this:</p>
<div class="codesnip-container" >/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/</div>
]]></content:encoded>
			<wfw:commentRss>http://www.marteinn.se/blog/?feed=rss2&#038;p=502</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android: InteractiveScrollView</title>
		<link>http://www.marteinn.se/blog/?p=493</link>
		<comments>http://www.marteinn.se/blog/?p=493#comments</comments>
		<pubDate>Fri, 04 Jun 2010 02:20:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.marteinn.se/blog/?p=493</guid>
		<description><![CDATA[This post is a simple follow up to Android: Understanding when ScrollView has reached the bottom where I have created a small plug and play widget which notifies when scroll bottom has been reached through a listener. It works like this: InteractiveScrollView inherits from ScrollView and overrides onScrollChanged to validate scroll position. If bottom has [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a simple follow up to <a href="http://www.marteinn.se/blog/?p=485">Android: Understanding when ScrollView has reached the bottom</a> where I have created a small plug and play widget which notifies when scroll bottom has been reached through a listener.</p>
<p>It works like this: InteractiveScrollView inherits from ScrollView and overrides onScrollChanged to validate scroll position. If bottom has been reached, onBottomReachedListener triggers.</p>
<p><strong>Usage:</strong></p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;">InteractiveScrollView scrollView<span class="sy0">;</span> &nbsp; &nbsp;</p>
<p>scrollView <span class="sy0">=</span> <span class="br0">&#40;</span>InteractiveScrollView<span class="br0">&#41;</span> findViewById<span class="br0">&#40;</span> R.<span class="me1">id</span>.<span class="me1">scrollView</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
scrollView.<span class="me1">setOnBottomReachedListener</span><span class="br0">&#40;</span><span class="kw1">new</span> InteractiveScrollView.<span class="me1">OnBottomReachedListener</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">void</span> onBottomReached<span class="br0">&#40;</span><span class="br0">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// bottom reached</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>View the class or download it <a href="http://www.marteinn.se/code/java/android/InteractiveScrollView/InteractiveScrollView.java">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marteinn.se/blog/?feed=rss2&#038;p=493</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android: Understanding when ScrollView has reached the bottom</title>
		<link>http://www.marteinn.se/blog/?p=485</link>
		<comments>http://www.marteinn.se/blog/?p=485#comments</comments>
		<pubDate>Wed, 12 May 2010 22:15:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.marteinn.se/blog/?p=485</guid>
		<description><![CDATA[This snippet is pretty mutch as the title says, an example in detecting when ScrollView has reached the bottom. In this sample I extend ScrollView and then overrides the onScrollChanged method (inherited from View). @Override protected void onScrollChanged&#40;int l, int t, int oldl, int oldt&#41; &#123; &#160; &#160; &#160; &#160; // Grab the last child [...]]]></description>
			<content:encoded><![CDATA[<p>This snippet is pretty mutch as the title says, an example in detecting when ScrollView has reached the bottom. In this sample I extend ScrollView and then overrides the onScrollChanged method (inherited from View).</p>
<div class="codesnip-container" >
<div class="java codesnip" style="font-family:monospace;">@Override<br />
<span class="kw1">protected</span> <span class="kw4">void</span> onScrollChanged<span class="br0">&#40;</span><span class="kw4">int</span> l, <span class="kw4">int</span> t, <span class="kw4">int</span> oldl, <span class="kw4">int</span> oldt<span class="br0">&#41;</span> <br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Grab the last child placed in the ScrollView, we need it to determinate the bottom position.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a> view <span class="sy0">=</span> <span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">View</span></a><span class="br0">&#41;</span> getChildAt<span class="br0">&#40;</span>getChildCount<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">-</span>1<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Calculate the scrolldiff</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> diff <span class="sy0">=</span> <span class="br0">&#40;</span>view.<span class="me1">getBottom</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">-</span><span class="br0">&#40;</span>getHeight<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">+</span>getScrollY<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// if diff is zero, then the bottom has been reached</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> diff <span class="sy0">==</span> <span class="nu0">0</span> <span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// notify that we have reached the bottom</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Log.<span class="me1">d</span><span class="br0">&#40;</span>ScrollTest.<span class="me1">LOG_TAG</span>, <span class="st0">&quot;MyScrollView: Bottom has been reached&quot;</span> <span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">super</span>.<span class="me1">onScrollChanged</span><span class="br0">&#40;</span>l, t, oldl, oldt<span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Cheers to <a href="http://www.mail-archive.com/android-developers@googlegroups.com/msg32372.html">this</a> thread for helping me getting the calculations right.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marteinn.se/blog/?feed=rss2&#038;p=485</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Patching NetStreamClient</title>
		<link>http://www.marteinn.se/blog/?p=474</link>
		<comments>http://www.marteinn.se/blog/?p=474#comments</comments>
		<pubDate>Sun, 14 Feb 2010 10:55:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Action Script]]></category>

		<guid isPermaLink="false">http://www.marteinn.se/blog/?p=474</guid>
		<description><![CDATA[I couple of days ago I noticed that my conceptual NetStreamClient was failing when connecting it towards a NetStream, the debugger threw errors regarding missing a Proxy implementation of getProperty. The problem was when building the class I took for granted that NetStream referenced against the client object and invoked the callback function from the [...]]]></description>
			<content:encoded><![CDATA[<p>I couple of days ago I noticed that my conceptual NetStreamClient was failing when connecting it towards a NetStream, the debugger threw errors regarding missing a Proxy implementation of getProperty.</p>
<p>The problem was when building the class I took for granted that NetStream referenced against the client object and invoked the callback function from the object when a callback took place. But the fact is that when you assign a client object to netstream it saves a reference to the callback function, not the client object itself. So it was clear why my class didnt work.</p>
<p>So I patched it up with the proxy implementation getProperty (it looks a bit hackish but it does the trick).</p>
<div class="codesnip-container" >
<div class="actionscript3 codesnip" style="font-family:monospace;">flash_proxy override <span class="kw3">function</span> <span class="kw7">getProperty</span><span class="br0">&#40;</span><span class="kw7">name</span><span class="sy0">:*</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="sy0">*</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> qName<span class="sy0">:</span><a href="http://www.google.com/search?q=qname%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:qname.html"><span class="kw5">QName</span></a> = <span class="kw7">name</span> <span class="kw1">as</span> <a href="http://www.google.com/search?q=qname%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:qname.html"><span class="kw5">QName</span></a><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw3">function</span> <span class="br0">&#40;</span> <span class="sy0">&#8230;</span>args <span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw1">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flash_proxy<span class="sy0">::</span><span class="kw7">callProperty</span><span class="br0">&#40;</span> qName<span class="sy0">,</span> args<span class="br0">&#91;</span>0<span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>I also noticed that in my usage example I used an object instead of the NetStreamClientEvent. So this is how you &#8220;really&#8221; use it.</p>
<div class="codesnip-container" >
<div class="actionscript3 codesnip" style="font-family:monospace;"><span class="co1">// create a instance</span><br />
<span class="kw7">client</span> = <span class="kw1">new</span> NetStreamClient<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="co1">// assign the client</span><br />
netStream<span class="sy0">.</span><span class="kw7">client</span> = <span class="kw7">client</span><span class="sy0">;</span><br />
<span class="co1">// then just add listeners to the client</span><br />
<span class="kw7">client</span><span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span> NetStreamClientEvent<span class="sy0">.</span>CUE_POINT<span class="sy0">,</span> client_cuePointHandler <span class="br0">&#41;</span><span class="sy0">;</span></p>
<p><span class="co1">// an example of the handler function</span><br />
<span class="kw3">function</span> client_cuePointHandler <span class="br0">&#40;</span> event<span class="sy0">:</span>NetStreamClientEvent <span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw1">void</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// the info object holds the original data</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> <span class="kw7">info</span><span class="sy0">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw7">info</span> = event<span class="sy0">.</span><a href="http://www.google.com/search?q=arguments%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:arguments.html"><span class="kw5">arguments</span></a><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw7">trace</span><span class="br0">&#40;</span> <span class="br0">&#91;</span><span class="kw7">info</span><span class="sy0">.</span><span class="kw7">name</span><span class="sy0">,</span> <span class="kw7">info</span><span class="sy0">.</span><span class="kw7">time</span><span class="sy0">,</span> <span class="kw7">info</span><span class="sy0">.</span>cuetype<span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Updated classes here: <a href="http://www.marteinn.se/code/as3/NetStreamClient/NetStreamClient.zip">Download it here here</a>, or <a href="http://www.marteinn.se/code/as3/NetStreamClient/NetStreamClient.as">view the NetStreamClient class here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marteinn.se/blog/?feed=rss2&#038;p=474</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

