<?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>Nullobject Studios Inc</title>
	<atom:link href="http://blog.nullobjectstudios.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nullobjectstudios.com</link>
	<description>Development</description>
	<lastBuildDate>Thu, 16 Feb 2012 21:45:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>SSH Configuration Files</title>
		<link>http://blog.nullobjectstudios.com/2012/02/16/ssh-configuration-files/</link>
		<comments>http://blog.nullobjectstudios.com/2012/02/16/ssh-configuration-files/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 21:45:42 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.nullobjectstudios.com/?p=122</guid>
		<description><![CDATA[Lately I have been managing a ton of servers, all using different users, passwords, key&#8217;s etc. I wanted an easier way to access them, and a friend pointed out SSH config files. I personally hadn&#8217;t used them and there was not really some place to show there use other then great walls of text. I <a href="http://blog.nullobjectstudios.com/2012/02/16/ssh-configuration-files/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Lately I have been managing a ton of servers, all using different users, passwords, key&#8217;s etc. I wanted an easier way to access them, and a friend pointed out SSH config files. I personally hadn&#8217;t used them and there was not really some place to show there use other then great walls of text. I figured I would setup a post to keep track of how I been using them for both myself and anyone else that might be interested.</p>
<p>&nbsp;</p>
<p>The <strong><em>config</em></strong> file is contained in your .<em><strong>ssh</strong></em> folder located in your <strong><em>home. </em></strong>There are a few directives in the files that I use constantly. Here is an example of a file that I might have setup</p>
<p>&nbsp;</p>
<pre class="brush: bash; ">

Host local-server-name

HostName 0.0.0.0

Port 22

User Me

IdentityFile ~/.ssh/local-server-name-key
</pre>
<p>&nbsp;</p>
<p>The first value <strong>Host</strong> is what I want to use as a name for that server locally. Depending on how much typing you like to do you can make it as long or as short as you want. <strong>HostName</strong> is the ip or address used for connecting to the server normally. The P<strong>ort</strong> only needs to be added if your using a port other then 22. <strong>User</strong> is the user name that you wish to connect to with. <strong>IdentityFile</strong> is the location of the private key that you might have setup on that server for authentication.</p>
<p>Once this file has been created and you have all your servers added, you can now access any of these servers via there name in most commands.</p>
<p>&nbsp;</p>
<h3>Connecting to the server via <strong>SSH</strong></h3>
<pre class="brush: bash; ">

ssh local-server-name
</pre>
<p>&nbsp;</p>
<h3>Sending a file to the server</h3>
<pre class="brush: bash; ">

scp ./filename.text local-server-name:/
</pre>
<p>&nbsp;</p>
<p>Your configuration file can have as many entries as you want for as many servers as you want. You can even have the same server setup multiple times with different User or <strong>User</strong>/<strong>IdentityFile. </strong>I hope this was helpful, I know it has saved me a ton of typing on many occasions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nullobjectstudios.com/2012/02/16/ssh-configuration-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s Been Too Long</title>
		<link>http://blog.nullobjectstudios.com/2012/01/09/its-been-too-long/</link>
		<comments>http://blog.nullobjectstudios.com/2012/01/09/its-been-too-long/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 04:51:21 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Update]]></category>

		<guid isPermaLink="false">http://blog.nullobjectstudios.com/?p=115</guid>
		<description><![CDATA[It has been some time since my last post, things were getting a little busy for a while. Lots of work to do both for my own projects as well as for clients. In October I started a full time position with a local start up, for now I won&#8217;t make mention of what I <a href="http://blog.nullobjectstudios.com/2012/01/09/its-been-too-long/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>It has been some time since my last post, things were getting a little busy for a while. Lots of work to do both for my own projects as well as for clients. In October I started a full time position with a local start up, for now I won&#8217;t make mention of what I will be doing or for who I will be doing it for, but its going to be some awesome stuff.</p>
<p>&nbsp;</p>
<p>My New Years Resolution this year was to do a much better job at maintaining this site, as well as keeping to a sort of floating posting schedule. I will try and maintain at least one post per week, maybe more if I find the time. I want to also start posting <em>reviews</em> on items that I use, enjoy, read or like in hopes that maybe someone else thinking of getting such items will see value in them.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nullobjectstudios.com/2012/01/09/its-been-too-long/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Freeze and Unfreeze Environments</title>
		<link>http://blog.nullobjectstudios.com/2011/07/04/freeze-and-unfreeze-environments/</link>
		<comments>http://blog.nullobjectstudios.com/2011/07/04/freeze-and-unfreeze-environments/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 05:34:57 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[VirtualEnv]]></category>

		<guid isPermaLink="false">http://blog.nullobjectstudios.com/?p=109</guid>
		<description><![CDATA[In a previous post I explained how to setup VirtualEnv and start a new project. I however never explained the one important aspect of VirtualEnv. Saving a requirements file, a list of all installed libraries, is one of the must useful aspects. Allowing yourself or other developers to easily load up the environment you used, <a href="http://blog.nullobjectstudios.com/2011/07/04/freeze-and-unfreeze-environments/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>In a previous <a href="http://blog.nullobjectstudios.com/2011/06/24/why-you-should-be-using-virtualenv/" target="_blank">post</a> I explained how to setup <a href="http://pypi.python.org/pypi/virtualenv" target="_blank">VirtualEnv</a> and start a new project. I however never explained the one important aspect of <a href="http://pypi.python.org/pypi/virtualenv" target="_blank">VirtualEnv</a>. Saving a <em>requirements</em> file, a list of all installed libraries, is one of the must useful aspects. Allowing yourself or other developers to easily load up the environment you used, the same libraries, same versions. All without overwriting your changing the versions your using on your own system, or other projects.</p>
<h2>Freezing</h2>
<p>Let&#8217;s say your sitting in front of a newly created project, you just setup the environment, installed all the foreseeable libraries, setup the structure of your project, and create the repository and committed all your changes. Your missing one thing, a <em>requirements</em> file, a file outlining to yourself or anyone else that might work on your project exactly what libraries you have. Creating such a file really is not that difficult, deciding where you want to put it, that can be tricky. I always place my <em>requirements</em> file right at the root of my repository. To create this file just run the following command, either keep it as is to drop your file in the current working directory, or add a path to it.</p>
<pre class="brush: shell; ">

pip freeze &gt; requirements
</pre>
<p>&nbsp;</p>
<p>You now have your very own <em>requirements</em> file setup specifically for your project. The only task left for you at this point, is to add it to your repository and commit the changes. If down the road you need to install new libraries, running this command and overwriting your file, is perfectly fine, just be sure to commit those changes also.</p>
<p>&nbsp;</p>
<h2>Unfreezing</h2>
<p>If you are about to work on an existing project, and have this project checked out and ready to go. The first thing you will want to do is setup the environment for that project, and activate it.</p>
<pre class="brush: shell; ">

virtualenv --no-site-packages --distribute [project_folder]

cd [project_folder]

source bin/activate
</pre>
<p>&nbsp;</p>
<p>Afterwards enter the project folder, assuming the original developer used similar naming conventions and named there requirements file <em>requirements</em>, you can install all the required libraries.</p>
<pre class="brush: shell; ">

pip install -U -r requirements
</pre>
<p>&nbsp;</p>
<p>If the original developer didn&#8217;t use any kind of environment, and they just simply listed the requirements. You are still in a good spot, you can build the environment from here using pip to install all the packages you need then saving your own <em>requirements</em> file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nullobjectstudios.com/2011/07/04/freeze-and-unfreeze-environments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python and MySQL dev on OSX</title>
		<link>http://blog.nullobjectstudios.com/2011/06/26/python-and-mysql-dev-on-osx/</link>
		<comments>http://blog.nullobjectstudios.com/2011/06/26/python-and-mysql-dev-on-osx/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 22:58:59 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[VirtualEnv]]></category>

		<guid isPermaLink="false">http://blog.nullobjectstudios.com/?p=103</guid>
		<description><![CDATA[One of the biggest pains I have when developing on OSX is always trying to get MySQLdb working. Its one of those things that just doesn&#8217;t seem to be easy enough. I prefer not having MySQL running right off my desktop if I can so I will describe how I get MySQLdb running without installing <a href="http://blog.nullobjectstudios.com/2011/06/26/python-and-mysql-dev-on-osx/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>One of the biggest pains I have when developing on OSX is always trying to get MySQLdb working. Its one of those things that just doesn&#8217;t seem to be easy enough. I prefer not having MySQL running right off my desktop if I can so I will describe how I get MySQLdb running without installing the whole server, on Snow Leopard, using a VirtualEnv, and running 64bit.</p>
<p>&nbsp;</p>
<h2>Step 1</h2>
<p>Download the necessary packages</p>
<pre class="brush: shell; ">

wget http://www.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.13-osx10.6-x86_64.tar.gz/from/http://mysql.mirror.rafal.ca/

wget http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download
</pre>
<p>&nbsp;</p>
<h2>Step 2</h2>
<p>Uncompress the archives</p>
<pre class="brush: shell; ">

tar -zxvf mysql-5.5.13-osx10.6-x86_64.tar.gz

tar -zxvf MySQL-python-1.2.3.tar.gz
</pre>
<p>&nbsp;</p>
<h2>Step 3</h2>
<p>The first thing thats needed to be done is located the exact path of <strong>mysql_config</strong>, which should be located directly in the <strong>bin/</strong> folder of the extracted files from MySQL, for my files they are located in <strong>~/temp/mysql-5.5.13-osx10.6-x86_64/bin/ </strong>with this in mind change your working path to the root of your extracted <strong>MySQL-python-1.2.3</strong> and modify the <strong>site.cfg</strong> file so that it now contains a <strong>mysql_config</strong></p>
<pre class="brush: shell; ">

vim site.cfg

mysql_config = ~/temp/mysql-5.5.13-osx10.6-x86_64/bin/mysql_config
</pre>
<p>&nbsp;</p>
<h2>Step 4</h2>
<p>Now its time to build the library while still in the root of your extracted <strong>MySQL-python-1.2.3 </strong>be sure to run the build</p>
<pre class="brush: shell; ">

export ARCHFLAGS=&quot;-arch i386 -arch x86_64&quot;

python setup.py build
</pre>
<p><em>note: I added the export to allow for 64bit compiling under the newer versions of xcode</em></p>
<p>&nbsp;</p>
<h2><em>Step 5</em></h2>
<p>Now that the build is complete, you don&#8217;t have any use for the extracted version of MySQL server, but we still need the libraries. Enter back into the root of the <strong>mysql-5.5.13-osx10.6-x8</strong><strong>6_64 a</strong>nd lets put them on our systems. Afterwards you can delete the files associated with MySQL Server (<strong><strong>mysql-5.5.13-osx10.6-x8</strong><strong>6_64</strong></strong>)</p>
<pre class="brush: shell; ">

cd ./lib/

cp ./*.dylib /usr/lib/
</pre>
<p>&nbsp;</p>
<h2>Step 6</h2>
<p>From here its up to you, you can install the libraries system wide or you can install them on a per environment bases</p>
<pre class="brush: shell; ">

source ./bin/activate

cd ~/temp/MySQL-python-1.2.3/

python setup.py install
</pre>
<p>&nbsp;</p>
<p>Once you have completed all these simple tasks you will have a system or environment with a mysql connectable python. Also located in the <strong>MySQL-python-1.2.3 </strong>folder there will now be a <strong>dist/ </strong>folder which will contain a nicely packaged egg that you can use for future installs on your system. Which makes the whole process easier to install assuming you picked the route of installing on a virtual environment. Save the egg for later and use it again when you need a new install in a new environment.</p>
<pre class="brush: shell; ">

easy_install MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg
</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nullobjectstudios.com/2011/06/26/python-and-mysql-dev-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why you should be using VirtualEnv</title>
		<link>http://blog.nullobjectstudios.com/2011/06/24/why-you-should-be-using-virtualenv/</link>
		<comments>http://blog.nullobjectstudios.com/2011/06/24/why-you-should-be-using-virtualenv/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 18:25:26 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Practices]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[VirtualEnv]]></category>

		<guid isPermaLink="false">http://blog.nullobjectstudios.com/?p=96</guid>
		<description><![CDATA[One of the more annoying things when writing any code is when libraries change. Either deprecating functions, or changing how you expect functions to be handled. In some languages and platforms this isn&#8217;t a very large issue, libraries made by large companies seldom change. But now, so many libraries are community driven, updates are happening <a href="http://blog.nullobjectstudios.com/2011/06/24/why-you-should-be-using-virtualenv/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>One of the more annoying things when writing any code is when libraries change. Either deprecating functions, or changing how you expect functions to be handled. In some languages and platforms this isn&#8217;t a very large issue, libraries made by large companies seldom change. But now, so many libraries are community driven, updates are happening almost daily. New releases are happening monthly in some cases.</p>
<p>&nbsp;</p>
<p>There is a solution, <a title="VirtualEnv" href="http://pypi.python.org/pypi/virtualenv" target="_blank">VirtualEnv</a> allows you to create an environment for python and all its libraries. This environment is separate from the rest of your system libraries, anything installed is only accessible from within the environment. I am planning on writing a few articles related to <a href="http://pypi.python.org/pypi/virtualenv" target="_blank">VirtualEnv</a>, everything from setting it up, using it, and deploying a website using <a href="https://www.djangoproject.com/" target="_blank">django</a> with it.</p>
<p>&nbsp;</p>
<p>Installing VirtualEnv is fairly simple, I am assuming that you already have <a href="http://pypi.python.org/pypi/setuptools" target="_blank">easy_install</a> installed.</p>
<pre class="brush: shell; ">

sudo easy_install virtualenv
</pre>
<p>&nbsp;</p>
<p>Once <a href="http://pypi.python.org/pypi/setuptools" target="_blank">easy_install</a> has done its thing, and virtualenv is installed there&#8217;s really only 2 main commands you will want to familiarize yourself with. The first command is used for creating a environment, making sure to use distribute (<em>&#8211;distribute</em>) for installing new packages and telling virtualenv to not use the systems already installed packages (<em>&#8211;no-site-packages</em>). Finally at then end will be the path (full or relative) to the project location.</p>
<pre class="brush: shell; ">

virtualenv --no-site-packages --distribute ./project/

cd ./project/
</pre>
<p>&nbsp;</p>
<p>Now that your environment is setup, all there is to do is enter the environment, this is easily accomplished</p>
<pre class="brush: shell; ">

source bin/activate
</pre>
<p>&nbsp;</p>
<p>From here you will notice that your prompt has changed, adding the project name at the start, anything you install from here is now installed on your environment and will only be accessible from with in. Installing new packages is easily accomplished using the <a href="http://pypi.python.org/pypi/pip" target="_blank">PIP</a> installer.</p>
<pre class="brush: shell; ">

pip install django
</pre>
<p>&nbsp;</p>
<p>To access your environment all you must do is execute a deactivate command anywhere from within the shell</p>
<pre class="brush: shell; ">

deactivate
</pre>
<p>&nbsp;</p>
<p>Although this might seem like a bit more work then your standard work flow, the benefits severely outweigh the extra work involved. The entire environment is portable, meaning you can dump a list of all libraries (including versions) to a file which allows anyone to completely build your environment on there computer without requiring you to upload the entire set of libraries to them. I will cover this later in the series, stay tuned.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nullobjectstudios.com/2011/06/24/why-you-should-be-using-virtualenv/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Times are changing</title>
		<link>http://blog.nullobjectstudios.com/2011/06/23/times-are-changing/</link>
		<comments>http://blog.nullobjectstudios.com/2011/06/23/times-are-changing/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 18:59:33 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.nullobjectstudios.com/?p=90</guid>
		<description><![CDATA[It has been almost a full year since my last post, in that short time much has changed. My previous place of work has decided to pull their offices out of town leaving myself and many others behind. Many sought refuge in a few larger businesses in town and seem to be enjoying it. A <a href="http://blog.nullobjectstudios.com/2011/06/23/times-are-changing/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>It has been almost a full year since my last post, in that short time much has changed. My previous place of work has decided to pull their offices out of town leaving myself and many others behind. Many sought refuge in a few larger businesses in town and seem to be enjoying it. A few have ventured out into smaller local companies, bringing with them there knowledge and expertise. In January I decided I would do something I have always wanted to do, I incorporated Nullobject and started working on contracts and whatever work I could find in an effort to build up some money into the company as well as keep my bills payed.</p>
<p>&nbsp;</p>
<p>I have decided that I want to keep a record of some of the stuff I am working on, as well as continue to help people learn in all areas. I plan on posting articles on things as I did before, problems I tackle and solve, solution to problems people have, as well as the usual rants and opinions. I am hoping that I will learn more by teaching others and others will learn as well. So anyone that can bare my horrible writing and want to learn new stuff together, are welcome to join me. I plan on keeping updates frequent and with substance.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nullobjectstudios.com/2011/06/23/times-are-changing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django: Sending mail with Templates</title>
		<link>http://blog.nullobjectstudios.com/2010/07/19/sending-mail-with-templates/</link>
		<comments>http://blog.nullobjectstudios.com/2010/07/19/sending-mail-with-templates/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 02:44:08 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://blog.nullobject.ca/?p=85</guid>
		<description><![CDATA[It&#8217;s interesting how only a few lines of code can save so much work. A few days ago, I was working on adding a new feature to a system I wrote a while ago using django. I noticed there were a few places that I wanted to send out an email along with logging. I <a href="http://blog.nullobjectstudios.com/2010/07/19/sending-mail-with-templates/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s interesting how only a few lines of code can save so much work. A few days ago, I was working on adding a new feature to a system I wrote a while ago using django. I noticed there were a few places that I wanted to send out an email along with logging. I started looking into Django&#8217;s ability to send out emails, after much searching I found the <a href="http://docs.djangoproject.com/en/dev/topics/email/#mail-admins">mail_admins</a> function. I wasn&#8217;t a huge fan of having the email content buried in the code. I did a few quick searches on the documentation and came up with no real solutions. Using Django&#8217;s <a href="http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response">render_to_response</a> as an example I created a function that would allow me to send an email using a Django template.</p>
<pre class="brush: python; ">

from django.template import loader
from django.core.mail import mail_admins

def render_to_email(template, subject, context):
    template = loader.render_to_string(template,  context)
    mail_admins(subject, template)
</pre>
<p>The function works exactly like Django&#8217;s <a href="http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response">render_to_response</a> function, with one added value to the function for setting the email&#8217;s <em>subject</em></p>
<pre class="brush: python; ">

render_to_email(&#039;email_general_error.html&#039;, &#039;General Error&#039;, { &#039;request&#039;: request, &#039;message&#039;: message})
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.nullobjectstudios.com/2010/07/19/sending-mail-with-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Website Image Caching</title>
		<link>http://blog.nullobjectstudios.com/2010/05/09/website-image-caching/</link>
		<comments>http://blog.nullobjectstudios.com/2010/05/09/website-image-caching/#comments</comments>
		<pubDate>Mon, 10 May 2010 02:07:15 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Practices]]></category>
		<category><![CDATA[http]]></category>

		<guid isPermaLink="false">http://blog.nullobject.ca/?p=80</guid>
		<description><![CDATA[In a previous post titled Django Json Woes I mentioned setting response headers for caching for Json responses. This was done to make sure that data that was sent was always refreshed and the browser didn&#8217;t use cached content. Most times this is accomplished with a technique called &#8220;cachebuster&#8221;, which means adding a pseudo random <a href="http://blog.nullobjectstudios.com/2010/05/09/website-image-caching/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>In a previous post titled <a href="http://blog.nullobject.ca/2010/02/08/django-json-woes/">Django Json Woes</a> I mentioned setting response headers for caching for Json responses. This was done to make sure that data that was sent was always refreshed and the browser didn&#8217;t use cached content. Most times this is accomplished with a technique called &#8220;cachebuster&#8221;, which means adding a pseudo random string to your request. This is done because your web browser, performs caching on your content based on urls including any parameters that are passed. By adding a random string onto the URL, your tricking your browser into thinking its a totally different URL and the browser will bypass the cache and download it. </p>
<p>I personally am not a huge fan of using the &#8220;cachebuster&#8221; because deciding if something should be cached or not should be decided on by the site and less by the connection to the site for 90% of requests. </p>
<p>This kind of cache bypassing can be useful when trying to get a bit more performance from a image heavy website. By hosting your images with a cache set to essentially never expire, and having your website pass &#8220;cachebuster&#8221; type information at the end.</p>
<pre class="brush: html; ">

 &lt;img src=&quot;/images/background.jpg?1273456709&quot; &gt;
</pre>
<p>The data at the end of the image url could be anything that indicates that the image has changed. When a request comes in the first time the browser would download the image based on the given url, each time afterwards it would continue to use the cache image. When you modify or change the image the data on the url would change and any hit from cached browsers would see the change and download the new copy of the image.</p>
<p>I am currently working on a template command for django that can do this easily, once its completed ill update this post.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nullobjectstudios.com/2010/05/09/website-image-caching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Html5 LocalStorage, Client Side Memcached.</title>
		<link>http://blog.nullobjectstudios.com/2010/05/05/html5-localstorage-client-side-memcached/</link>
		<comments>http://blog.nullobjectstudios.com/2010/05/05/html5-localstorage-client-side-memcached/#comments</comments>
		<pubDate>Thu, 06 May 2010 02:36:58 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Html5]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.nullobject.ca/?p=70</guid>
		<description><![CDATA[Although HTML5 isn&#8217;t 100% finalized, there are a few things that have been finished up and implemented in the newer browsers. One such feature is a local storage, it doesn&#8217;t provide any fancy functions it&#8217;s more of a client side Memcached. It&#8217;s a persistent storage area that&#8217;s accessed using a key, value pair, attached to <a href="http://blog.nullobjectstudios.com/2010/05/05/html5-localstorage-client-side-memcached/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Although HTML5 isn&#8217;t 100% finalized, there are a few things that have been finished up and implemented in the newer browsers. One such feature is a local storage, it doesn&#8217;t provide any fancy functions it&#8217;s more of a client side <a href="http://memcached.org/">Memcached</a>. It&#8217;s a persistent storage area that&#8217;s accessed using a key, value pair, attached to the <strong>window</strong> object. </p>
<pre class="brush: javascript; ">

window.localStorage[&#039;key&#039;] = &#039;value&#039;
</pre>
<p>Setting the value of the key is just a matter of assigning a variable. Obtaining an already saved value is also just as easy.</p>
<pre class="brush: javascript; ">

var value = window.localStorage[&#039;key&#039;]
</pre>
<p>Here is a small sample using a few basic functions to show how it might be used. You are able to enter text in the box and save it. when the page reloads that new value will display in the browser. When you click on load it will load whatever value is saved in the current storage.</p>
<pre class="brush: html; ">

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
	&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;Html LocalStorage&lt;/title&gt;
		&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;
			function save() {
				obj = document.getElementById(&#039;btn_text&#039;);
				if(obj.value)
					window.localStorage[&#039;text&#039;] = obj.value
			}
			function load() {
				obj = document.getElementById(&#039;btn_text&#039;);
				value = window.localStorage[&#039;text&#039;];
				if(value)
					obj.value = window.localStorage[&#039;text&#039;];
			}
		&lt;/script&gt;
	&lt;/head&gt;
	&lt;body onload=&quot;load();&quot;&gt;
		&lt;input type=&quot;text&quot; value=&quot;&quot; id=&quot;btn_text&quot;&gt;
		&lt;input type=&quot;button&quot; onclick=&quot;save();&quot; value=&quot;Save&quot;&gt; | &lt;input type=&quot;button&quot; onclick=&quot;load();&quot; value=&quot;Load&quot;&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Keep in mind that because of browsers are only starting to roll out these implementations now, it might not work in all browsers. Also be sure to use the most recent versions.</p>
<p>I&#8217;ll be writing and posting more HTML5 posts, giving examples and code on implementing some of the new exiciting things that will be out soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nullobjectstudios.com/2010/05/05/html5-localstorage-client-side-memcached/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apple vs Adobe Flash, Rant.</title>
		<link>http://blog.nullobjectstudios.com/2010/05/05/apple-vs-adobe-flash-rant/</link>
		<comments>http://blog.nullobjectstudios.com/2010/05/05/apple-vs-adobe-flash-rant/#comments</comments>
		<pubDate>Wed, 05 May 2010 04:02:28 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Rant]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://blog.nullobject.ca/?p=65</guid>
		<description><![CDATA[You can not go on any tech related site without seeing some comment, post, or article related to The iPhone and/or Adobe. There is a line drawn in the sand, you have iPhone supporters on one side and Adobe Flash supporters on the other. Here is a little back story. Everything was to some extent <a href="http://blog.nullobjectstudios.com/2010/05/05/apple-vs-adobe-flash-rant/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>You can not go on any tech related site without seeing some comment, post, or article related to The iPhone and/or Adobe. There is a line drawn in the sand, you have iPhone supporters on one side and Adobe Flash supporters on the other. </p>
<p>Here is a little back story. Everything was to some extent <em>fine</em>, well as fine as everything can be. Until April 8, 2010, Apple announced the new iPhone OS 4, they showed off some of the stuff people have been waiting for. Shortly after the announcement there leaked out a slight change on the new Terms Of Service indicating that Apple didn&#8217;t want applications not written in C/C++/Obj-C or &#8220;Open Standards&#8221; Html5, Javascript, and CSS on their platform:</p>
<blockquote><p>Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).</p></blockquote>
<p>This was just days before Adobe was to launch their new Creative Studio, containing a system that allowed users to write applications using Flash and export them to the iPhone. This was also after a large helping of applications had already been approved and sold on the iTunes App Store that were in violation of this very change, it&#8217;s unknown what the future for these applications is.</p>
<p>Now, was this a under-handed tactic, for Apple to pull off? A calculated move to screw over Adobe and everyone else that wouldn&#8217;t fall into the allow list? All very good questions, and questions that everyone will have there own opinions on. </p>
<p>Many speculate that this change was done in hopes of maintaining a powerful eco system of applications. There are a few reasons that can be used to argue this:</p>
<p>1) Applications written for multiple platforms always need to be written for the lowest common denominator, otherwise they are not really multiple platform applications. In this case Apple&#8217;s argument is that they want applications written to utilize all the capabilities of the iPhone, not just whatever the lowest machine the developers decided to support. This directly affects the customer in a positive way.</p>
<p>2) Applications written using a 3rd party library takes control of the eco system away from Apple and gives it to the 3rd party libraries. If Apple decides to release changes to the Operating System, they now have to rely on the 3rd party library makers to add the functionality on there side before those developers can use it. </p>
<p>3) Applications written in one language and simply translated to another language (C, C++, Obj-C), historically end up with a slower, performing application then the original. Works very similarly on the same basis that how you code something in Java isn&#8217;t the same as how you would code it in Python. </p>
<p>All these points can be argued back and fourth, for and against. But in the end it comes down to the customers. After all the dust settles, and either Apple changes there terms or they keep them and enforce it. Companies will still be writing iPhone applications, along with those Flash apps. Flash developers won&#8217;t be loosing there jobs, and C/C++/Obj-C developers will have more work. What will be different is iPhones will have native, fast running applications. While other phone customers will get the occasional Flash apps that might or might not be as good as a native app.</p>
<p><em>P.S: I understand that just cause the application is written in C/C++/Obj-C, does not mean they are guaranteed to run fast. But a properly written one will run faster 9 times out of 10 against a properly written flash app. <img src='http://blog.nullobjectstudios.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nullobjectstudios.com/2010/05/05/apple-vs-adobe-flash-rant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

