<?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>Derek Kwok&#039;s Blog</title>
	<atom:link href="http://www.xairon.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xairon.net</link>
	<description>Blog about Software Development, Techniques and Discoveries.</description>
	<lastBuildDate>Sat, 25 Feb 2012 06:59:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Django and Selenium on Jenkins/Hudson (Headless)</title>
		<link>http://www.xairon.net/2012/01/django-and-selenium-on-jenkinshudson-headless/</link>
		<comments>http://www.xairon.net/2012/01/django-and-selenium-on-jenkinshudson-headless/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 18:17:53 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.xairon.net/?p=332</guid>
		<description><![CDATA[Prerequisite: You already have a basic django build running on Jenkins/Hudson. If not, I highly recommend first reading Continuous Integration with Django and Hudson CI (Day 1). Ubuntu: Remember to replace link to selenium with version you need. Here we &#8230; <a href="http://www.xairon.net/2012/01/django-and-selenium-on-jenkinshudson-headless/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Prerequisite: You already have a basic django build running on Jenkins/Hudson. If not, I highly recommend first reading <a href="http://www.caktusgroup.com/blog/2010/03/08/django-and-hudson-ci-day-1/">Continuous Integration with Django and Hudson CI (Day 1)</a>.</p>
<p><strong>Ubuntu:</strong><br />
Remember to replace link to selenium with version you need. Here we are using version 2.17.0 of Selenium.</p>
<pre>wget http://selenium.googlecode.com/files/selenium-server-standalone-2.17.0.jar
sudo apt-get install xvfb
sudo apt-get install --no-install-recommends firefox
xvfb-run java -jar /root/selenium-server-standalone-2.17.0.jar</pre>
<p>In your Jenkins/Hudson build step, you will want to:</p>
<ul>
<li>export DISPLAY=:99</li>
<li>run your webserver (background)</li>
<li>run your tests</li>
</ul>
<div>Below is a very simplified version of what I have.</div>
<p><a href="http://www.xairon.net/wp-content/uploads/2012/01/Screen-Shot-2012-01-22-at-2.05.47-AM.png"><img class="aligncenter size-full wp-image-333" title="Sample Build Step" src="http://www.xairon.net/wp-content/uploads/2012/01/Screen-Shot-2012-01-22-at-2.05.47-AM.png" alt="" width="329" height="99" /></a></p>
<p>Inside my __init__.py is the following code:</p>
<pre class="brush: python; title: ; notranslate">class BaseWebTestCase(TestCase):

    def setUp(self):
        self.base_url = 'http://localhost:8000'

        self.selenium = selenium(
            &quot;localhost&quot;,
            4444,
            &quot;*chrome&quot;,
            self.base_url
        )
        self.selenium.start()
        self.selenium.open('/')

    def tearDown(self):
        self.selenium.stop()

from webtests.account_tests import *

if __name__ == '__main__':
    import unittest, xmlrunner
    unittest.main(testRunner=xmlrunner.XMLTestRunner(
        output='xmlrunner',
        descriptions=True,
        verbose=True,
    ))</pre>
<p>This is all that is needed to run Selenium tests in Jenkins/Hudson. With my settings above, the XML test results will be output into the folder &#8220;xmlrunner&#8221; which Jenkins/Hudson can read.</p>
<p><strong>Tips and Tricks</strong></p>
<p>You can autostart selenium when your machine boots by adding the following to /etc/rc.local:</p>
<pre>xvfb-run java -jar /root/selenium-server-standalone-2.17.0.jar</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xairon.net/2012/01/django-and-selenium-on-jenkinshudson-headless/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Django, knockout.js and jQuery AJAX</title>
		<link>http://www.xairon.net/2012/01/django-knockout-js-and-jquery-ajax/</link>
		<comments>http://www.xairon.net/2012/01/django-knockout-js-and-jquery-ajax/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 15:39:10 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.xairon.net/?p=309</guid>
		<description><![CDATA[The Problem Django is a great framework for building web applications, and knockout.js is an incredible library for working with the front-end. So how can you get them to work together and build an AJAX driven interface? Answer Use Django&#8217;s &#8230; <a href="http://www.xairon.net/2012/01/django-knockout-js-and-jquery-ajax/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>The Problem</strong><br />
Django is a great framework for building web applications, and knockout.js is an incredible library for working with the front-end. So how can you get them to work together and build an AJAX driven interface?</p>
<p><strong>Answer</strong><br />
Use Django&#8217;s builtin Form and JSON. It turns out that in Django, the data parameter can work nicely with JSON data. Here&#8217;s a simple example of what I mean:</p>
<pre class="brush: python; title: ; notranslate">def view(request):
    json_data = json.loads(request.POST.get('data', {})
    form = MyForm(data=json_data)
</pre>
<p>In knockout.js, your model should contain a subset (or all) your form fields. Then use ko.ToJSON(myModel) to create JSON data which can then be plugged directly into Django Forms.</p>
<p>Below is a somewhat more complete example of how Django, knockout.js and jQuery&#8217;s AJAX work together.</p>
<p><strong>The Django Code</strong></p>
<pre class="brush: python; title: ; notranslate"># urls.py
urlpatterns = patterns('',
    url(r'^$', MyView.as_view(), name='my_view'),
)

# views.py
class MyView(TemplateResponseMixin, View):
    template_name = 'my_template.html'

    def post(self, request):
        data_json = json.loads(request.POST.get('data')
        form = MyForm(data=data_json)
        if form.is_valid():
            form.save()
            response = {'success': True}
        else:
            response = {'success': False}
        return HttpResponse(json.dumps(response), mimetype=&quot;application/json&quot;)

# forms.py
class MyForm(forms.ModelForm):
    field_one = forms.CharField(max_length=200)
    field_two = forms.IntegerField()

    # save() and class Meta-stuff goes here</pre>
<p><strong>The HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;input type=&quot;text&quot; data-bind=&quot;value: form_data.field1&quot;&gt;
&lt;input type=&quot;text&quot; data-bind=&quot;value: form_data.field2&quot;&gt;</pre>
<p><strong>The javascript</strong></p>
<pre class="brush: jscript; title: ; notranslate">// The javascript
$(function() {
    function MyModel(field1, field2) {
        var self = this;
        self.field1 = field1;
        self.field2 = field2;
    }

    function MyViewModel() {
        var self = this;

        // Data
        self.form_data = new MyModel('', 0);

        // Functions
        var handle_response = function(json_data) {
            var result = JSON.parse(json_data);
            if (result.success) {
                alert('success!');
            } else {
                alert('failed!');
            }
        }

        self.submit = function() {
            $.ajax('{% url my_view %}', {
                type: 'post',
                data: { data: ko.toJSON(self.form_data) },
                contentType: 'application/JSON',
                success: handle_response
            });
        }
    }

    ko.applyBindings(new MyViewModel());
});</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xairon.net/2012/01/django-knockout-js-and-jquery-ajax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Django 1.3 logging: A simple file logging example</title>
		<link>http://www.xairon.net/2011/10/django-1-3-logging-a-simple-file-logging-example/</link>
		<comments>http://www.xairon.net/2011/10/django-1-3-logging-a-simple-file-logging-example/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 08:06:02 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.xairon.net/?p=295</guid>
		<description><![CDATA[Below is a super simple example of how to log django requests to a RotatingFileHandler:]]></description>
			<content:encoded><![CDATA[<p>Below is a super simple example of how to log django requests to a RotatingFileHandler:</p>
<pre class="brush: python; title: ; notranslate">LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'standard': {
            'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
        },
    },
    'handlers': {
        'file': {
            'level': 'INFO',
            'class': 'logging.handlers.RotatingFileHandler',
            'filename': '/path/to/logfile/requests.log,
            'maxBytes': 1024*1024*5, # 5MB
            'backupCount': 10,
            'formatter': 'standard'
        },
    },
    'loggers': {
        'django.request': {
            'handlers': ['file'],
            'level': 'INFO',
            'propagate': False,
        },
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.xairon.net/2011/10/django-1-3-logging-a-simple-file-logging-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using virtualenv, virtualenvwrapper for your Python projects</title>
		<link>http://www.xairon.net/2011/09/using-virtualenv-virtualenvwrapper-for-your-django-project/</link>
		<comments>http://www.xairon.net/2011/09/using-virtualenv-virtualenvwrapper-for-your-django-project/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 06:03:23 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.xairon.net/?p=276</guid>
		<description><![CDATA[This post will not cover why you should use virtualenv/virtualenvwrapper for working on Python projects. For that, you can find an excellent presentation here: http://mathematism.com/2009/07/30/presentation-pip-and-virtualenv/ Checking if pip is installed Make sure you have pip installed. You can check if you &#8230; <a href="http://www.xairon.net/2011/09/using-virtualenv-virtualenvwrapper-for-your-django-project/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This post will not cover why you should use virtualenv/virtualenvwrapper for working on Python projects. For that, you can find an excellent presentation here: <a href="http://mathematism.com/2009/07/30/presentation-pip-and-virtualenv/" target="_blank">http://mathematism.com/2009/07/30/presentation-pip-and-virtualenv/</a></p>
<p><strong>Checking if pip is installed</strong></p>
<p>Make sure you have pip installed. You can check if you have it installed by typing pip into your terminal:</p>
<div id="attachment_279" class="wp-caption aligncenter" style="width: 564px"><img class="size-full wp-image-279" title="checking if pip is installed" src="http://www.xairon.net/wp-content/uploads/2011/09/Screen-Shot-2011-09-18-at-1.38.24-PM.png" alt="" width="554" height="75" /><p class="wp-caption-text">checking if pip is installed</p></div>
<p>If you don&#8217;t have pip installed but you do have easy_install, you can install pip this way:</p>
<p>Via easy_install:</p>
<pre class="brush: bash; title: ; notranslate">$ sudo easy_install pip</pre>
<p>Other methods of installation for pip can be found at: <a href="http://www.pip-installer.org/en/latest/installing.html" target="_blank">http://www.pip-installer.org/en/latest/installing.html</a></p>
<p><strong>Installing virtualenv and virtualenvwrapper</strong></p>
<p>On Ubuntu machines, you might need to run the following before you can install virtualenv and virtualenvwrapper properly:</p>
<pre class="brush: bash; title: ; notranslate">$ sudo apt-get install python-setuptools python-dev build-essential</pre>
<p>I was able to install it on my Mac without any issues (although I already have XCode installed).</p>
<p>To install virtualenv and virtualenvwrapper:</p>
<pre class="brush: bash; title: ; notranslate">$ pip install virtualenv
$ pip install virtualenvwrapper
...
$ export WORKON_HOME=~/Envs
$ mkdir -p $WORKON_HOME
$ source /usr/local/bin/virtualenvwrapper.sh
$ mkvirtualenv env1
Installing
distribute..........................................
....................................................
....................................................
...............................done.
virtualenvwrapper.user_scripts Creating /Users/derekkwok/Envs/env1/bin/predeactivate
virtualenvwrapper.user_scripts Creating /Users/derekkwok/Envs/env1/bin/postdeactivate
virtualenvwrapper.user_scripts Creating /Users/derekkwok/Envs/env1/bin/preactivate
virtualenvwrapper.user_scripts Creating /Users/derekkwok/Envs/env1/bin/postactivate  New python executable in env1/bin/python
(env1)$ ls $WORKON_HOME
</pre>
<p>You may also want to add these 3 lines to your shell startup file (.bashrc, .bash_profile, .profile, etc&#8230;):</p>
<pre class="brush: bash; title: ; notranslate">export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh</pre>
<p>You can find the full setup documentation of virtualenvwrapper at: <a href="http://www.doughellmann.com/docs/virtualenvwrapper/" target="_blank">http://www.doughellmann.com/docs/virtualenvwrapper/</a></p>
<p><strong>Setting up your Virtual Environment for work with your Python Project</strong></p>
<p>In the example below, we&#8217;re working on a Django project. You might consider creating a new virtualenv for your work:</p>
<pre class="brush: bash; title: ; notranslate">$ mkvirtualenv myvirtualenv
(myvirtualenv) $ pip install Django==1.3.1
(myvirtualenv) $ pip install south
...
(myvirtualenv) $ python manage.py runserver</pre>
<p>When you open up a new terminal window, your virtual environment is automatically activated. To re-activate your virtual environment, you can use the following commands:</p>
<pre class="brush: bash; title: ; notranslate">$ workon myvirtualenv
(myvirtualenv) $ </pre>
<p>This command will automatically put you into &#8220;myvirtualenv&#8221; environment.</p>
<p>Leave any questions or comments below!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xairon.net/2011/09/using-virtualenv-virtualenvwrapper-for-your-django-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up virtualenv in Jenkins/Hudson</title>
		<link>http://www.xairon.net/2011/09/setting-up-virtualenv-in-jenkinshudson/</link>
		<comments>http://www.xairon.net/2011/09/setting-up-virtualenv-in-jenkinshudson/#comments</comments>
		<pubDate>Sat, 17 Sep 2011 12:28:26 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.xairon.net/?p=262</guid>
		<description><![CDATA[This is a tutorial on setting up virtualenv to work in Jenkins. Setting up VirtualEnv in Jenkins At the time of writing, I was using Jenkins 1.430. The first thing you will need to do is to setup your PATH &#8230; <a href="http://www.xairon.net/2011/09/setting-up-virtualenv-in-jenkinshudson/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a tutorial on setting up virtualenv to work in Jenkins.</p>
<p><strong>Setting up VirtualEnv in Jenkins</strong></p>
<p><em>At the time of writing, I was using Jenkins 1.430.</em></p>
<p>The first thing you will need to do is to setup your PATH environment variable to &#8220;.env/bin:$PATH&#8221; as show below by navigating to &#8220;Manage Jenkins&#8221; &gt; &#8220;Configure System&#8221;:</p>
<div id="attachment_263" class="wp-caption aligncenter" style="width: 444px"><img class="size-full wp-image-263" title="Configure PATH variable" src="http://www.xairon.net/wp-content/uploads/2011/09/Screen-Shot-2011-09-17-at-8.13.53-PM.png" alt="" width="434" height="170" /><p class="wp-caption-text">Configure PATH variable</p></div>
<p>Next, you will need to add a build step which will check to create/use the virtual environment. Here I also install unittest-xml-reporting and coverage tools.</p>
<pre class="brush: bash; title: ; notranslate">if [ -d &quot;.env&quot; ]; then
    echo &quot;**&gt; virtualenv exists&quot;
else
    echo &quot;**&gt; creating virtualenv&quot;
    virtualenv .env
fi

source .env/bin/activate
pip install -r requirements.txt
pip install unittest-xml-reporting==1.2
pip install coverage==3.5.1b1</pre>
<p>You ARE using a requirements.txt file to install dependencies for your project right? If not, see <a href="http://www.pip-installer.org/en/latest/requirement-format.html" target="_blank">http://www.pip-installer.org/en/latest/requirement-format.html</a>.</p>
<div id="attachment_271" class="wp-caption aligncenter" style="width: 498px"><a href="http://www.xairon.net/wp-content/uploads/2011/09/Screen-Shot-2011-09-17-at-9.02.09-PM.png"><img class="size-full wp-image-271" title="Adding virtualenv setup in build step" src="http://www.xairon.net/wp-content/uploads/2011/09/Screen-Shot-2011-09-17-at-9.02.09-PM.png" alt="" width="488" height="269" /></a><p class="wp-caption-text">Adding virtualenv setup in build step</p></div>
<p>Then you can continue your build as normal. This concludes the tutorial to use virtualenv in Jenkins/Hudson.</p>
<p>Source: <a href="http://jenkins-ci.org/content/python-love-story-virtualenv-and-hudson" target="_blank">http://jenkins-ci.org/content/python-love-story-virtualenv-and-hudson</a></p>
<p>Leave your question/comment below!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xairon.net/2011/09/setting-up-virtualenv-in-jenkinshudson/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Win Network</title>
		<link>http://www.xairon.net/2011/09/project-win-network/</link>
		<comments>http://www.xairon.net/2011/09/project-win-network/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 12:06:08 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.xairon.net/?p=249</guid>
		<description><![CDATA[Note: I don&#8217;t usually write personal blog post. September 9th, 2011: Today marks the start Project Win Network, a company for which I am the founder. P-Win (Project Win Network) is a company that focuses on making web apps. We &#8230; <a href="http://www.xairon.net/2011/09/project-win-network/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>Note: I don&#8217;t usually write personal blog post.</em></p>
<p>September 9th, 2011: Today marks the start Project Win Network, a company for which I am the founder.</p>
<p>P-Win (Project Win Network) is a company that focuses on making web apps. We make any web app which we find interesting and where there is a chance for growth and profit (i.e. we can actually make money from it). Although at this point in time, you won&#8217;t find anything related to P-Win on the web, we will be making some announcements before the end of year for the web apps which we are working on. The other members of P-Win will be joining at a later date when the company achieves better stability and profitability.</p>
<p>Project Win Network got its name from when I was in university with <a href="http://www.pioverpi.net">James Ma</a>. We had a lot of ideas, and each them would be called Project Win #1, Project Win #2, etc. All the way up to 52.  But we did not have the technical skills nor experience needed to complete these projects. This time around, we  have more experience/technical and managerial skills to do this properly. James is a project manager at Cast Software, and I spent another year freelancing and working at companies as a software developer.</p>
<p>That&#8217;s it folks! Starting tomorrow, I will be working full time at Project Win Network as Founder. Wish us luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xairon.net/2011/09/project-win-network/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ubuntu+Apache and GeoIP Tutorial</title>
		<link>http://www.xairon.net/2011/07/apache-and-geoip-tutorial-for-ubuntu/</link>
		<comments>http://www.xairon.net/2011/07/apache-and-geoip-tutorial-for-ubuntu/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 04:53:51 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.xairon.net/?p=220</guid>
		<description><![CDATA[Motivation You have a site (say http://www.example.com), with different subdomain or urls mapped for users from different countries. In this example, we&#8217;ll assume something along these lines: http://ca.example.com (for users from Canada) http://jp.example.com (for users from Japan) If you are &#8230; <a href="http://www.xairon.net/2011/07/apache-and-geoip-tutorial-for-ubuntu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Motivation</strong></p>
<p>You have a site (say http://www.example.com), with different subdomain or urls mapped for users from different countries. In this example, we&#8217;ll assume something along these lines:</p>
<ul>
<li>http://ca.example.com (for users from Canada)</li>
<li>http://jp.example.com (for users from Japan)</li>
</ul>
<p>If you are using Apache httpd to serve your website, you can use mod_geoip to make the redirect happen.</p>
<p>In this tutorial, you are assumed to be using Ubuntu with apache to serve your website.</p>
<p><strong>Installing mod_geoip for Apache in Ubuntu</strong></p>
<pre class="brush: bash; title: ; notranslate">sudo apt-get install libapache2-mod-geoip</pre>
<p>This will automatically install Maxmind&#8217;s geoip module and enable it.</p>
<p><strong>Using mod_geoip in httpd.conf or .htaccess</strong></p>
<p>Below is a snippet of code showing an example configuration using geoip. In the example, the user will be redirect to http://ca.example.com if they are from Canada and http://jp.example.com if they are from Japan. The redirect syntax is regular apache mod_rewrite syntax (i.e. you can use regular expression and group matching to better redirect).</p>
<pre class="brush: bash; title: ; notranslate">    GeoIPEnable On
    GeoIPDBFile /usr/share/GeoIP/GeoIP.dat

    RewriteEngine on
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$
    RewriteRule ^(.*)$ http://ca.example.com

    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^JP$
    RewriteRule ^(.*)$ http://jp.example.com</pre>
<p>You can find the list of countries available at: <a href="http://www.maxmind.com/app/iso3166" target="_blank">http://www.maxmind.com/app/iso3166</a></p>
<p>Sources for this tutorial:</p>
<ul>
<li><a href="http://www.howtoforge.com/installing-mod_geoip-for-apache2-on-ubuntu-9.10" target="_blank">Install mod_geoip for Apache2 on Ubuntu 9.10</a></li>
<li><a href="http://www.maxmind.com/app/iso3166" target="_blank">MaxMind &#8211; ISO 3166 Country Codes</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.xairon.net/2011/07/apache-and-geoip-tutorial-for-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Django and Gravatar</title>
		<link>http://www.xairon.net/2011/07/django-and-gravatar/</link>
		<comments>http://www.xairon.net/2011/07/django-and-gravatar/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 03:30:57 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.xairon.net/?p=204</guid>
		<description><![CDATA[Quick explanation on the parameters: size &#8211; in pixels. The default is 80 pixels d &#8211; this stands for &#8216;default&#8217;. If a user doesn&#8217;t have a picture at gravatar, the image will be generated based on the default parameter. In &#8230; <a href="http://www.xairon.net/2011/07/django-and-gravatar/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter" style="width: 170px"><img src="http://www.gravatar.com/avatar/e2caab5db6efb35bc1e0c5378579df74?d=identicon&amp;s=160" alt="" width="160" height="160" /><p class="wp-caption-text">An example of Gravatar&#39;s identicon</p></div>
<div style="font-size: 14px;">
<pre class="brush: python; title: ; notranslate">import urllib
from django.utils.hashcompat import md5_constructor

def get_gravatar_url(user, size=80, d='identicon'):
    gravatar_id = md5_constructor(user.email.lower()).hexdigest()
    gravatar_params = urllib.urlencode({'size': str(size), 'd': d})
    gravatar_url = \
        'http://www.gravatar.com/avatar/%(gravatar_id)s?%(gravatar_params)s' \
        % {'gravatar_id': gravatar_id, 'gravatar_params': gravatar_params}
    return gravatar_url</pre>
</div>
<p>Quick explanation on the parameters:</p>
<ul>
<li>size &#8211; in pixels. The default is 80 pixels</li>
<li>d &#8211; this stands for &#8216;default&#8217;. If a user doesn&#8217;t have a picture at gravatar, the image will be generated based on the default parameter. In this case, the default of &#8216;d&#8217; is identicon.</li>
</ul>
<p><span class="Apple-style-span" style="font-size: 16px; color: #444444; font-family: Georgia, 'Bitstream Charter', serif; line-height: 24px;">If a user doesn&#8217;t have an account at gravatar (or that email doesn&#8217;t have a gravatar image associated with it), then an &#8216;identicon&#8217; will be generated. Identicons are geometric representation of a hash value (you can read more about it <a href="http://en.wikipedia.org/wiki/Identicon" target="_blank">here</a>). Below are other options for &#8216;d&#8217;:</span></p>
<div>
<div class="wp-caption alignleft" style="width: 90px"><img src="https://secure.gravatar.com/avatar/2d2801e66b64e2bc491cc961f8a44b12" alt="" width="80" height="80" /><p class="wp-caption-text">example gravatar with image</p></div>
</div>
<div>
<div class="wp-caption alignleft" style="width: 90px"><img src="http://www.gravatar.com/avatar/e2caab5db6efb35bc1e0c5378579df74?d=mm" alt="" width="80" height="80" /><p class="wp-caption-text">mystery-man</p></div>
</div>
<div>
<div class="wp-caption alignleft" style="width: 90px"><img src="http://www.gravatar.com/avatar/e2caab5db6efb35bc1e0c5378579df74?d=monsterid" alt="" width="80" height="80" /><p class="wp-caption-text">monsterid</p></div>
</div>
<div>
<div class="wp-caption alignleft" style="width: 90px"><img src="http://www.gravatar.com/avatar/e2caab5db6efb35bc1e0c5378579df74?d=wavatar" alt="" width="80" height="80" /><p class="wp-caption-text">wavatar</p></div>
</div>
<div style="clear: both;">
<div>
<ul>
<li>&#8217;404&#8242; &#8211; Returns an Http 404 error instead</li>
<li>&#8216;mm&#8217; &#8211; mystery-man. This is the same image regardless of the hash</li>
<li>&#8216;monsterid&#8217; &#8211; a generated monster icon. The generated image is based on the hash.</li>
<li>&#8216;wavatar&#8217; &#8211; also a generated icon, but with differing backgrounds and faces.</li>
</ul>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.xairon.net/2011/07/django-and-gravatar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing IE6, 7, 8 and 9 on Mac OS X</title>
		<link>http://www.xairon.net/2011/06/testing-ie6-7-8-and-9-on-mac-os-x/</link>
		<comments>http://www.xairon.net/2011/06/testing-ie6-7-8-and-9-on-mac-os-x/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 03:09:32 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.xairon.net/?p=188</guid>
		<description><![CDATA[This is a Free and Legal method to test various versions of Internet Explorer on an Intel Based Mac. The software you will need is: Microsoft Windows Virtual PCs with Internet Explorer http://www.microsoft.com/download/en/details.aspx?displaylang=en&#38;id=11575 Virtual Box: http://www.virtualbox.org/wiki/Downloads Extracting the Microsoft VHDs The easiest &#8230; <a href="http://www.xairon.net/2011/06/testing-ie6-7-8-and-9-on-mac-os-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a <strong>Free </strong>and <strong>Legal</strong> method to test various versions of Internet Explorer on an Intel Based Mac. The software you will need is:</p>
<ul>
<li>Microsoft Windows Virtual PCs with Internet Explorer <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=11575" target="_blank">http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=11575</a></li>
<li>Virtual Box: <a href="http://www.virtualbox.org/wiki/Downloads" target="_blank">http://www.virtualbox.org/wiki/Downloads</a></li>
</ul>
<p>Extracting the Microsoft VHDs</p>
<p>The easiest way to this is to extract the VHD file on a Windows Machine. However, if you do not have access to a Windows machine, you can use <a href="http://www.cabextract.org.uk/" target="_blank">http://www.cabextract.org.uk/</a> to extract the images.</p>
<p>Setting up Virtual Machine</p>
<ol>
<li>Create a new VirtualBox Machine by clicking on &#8220;New&#8221;. Select &#8220;Microsoft Windows&#8221; as the operating system and &#8220;Windows 7&#8243; as the version.
<p><div id="attachment_189" class="wp-caption aligncenter" style="width: 845px"><img class="size-full wp-image-189" title="Creating a new Virtual Machine" src="http://www.xairon.net/wp-content/uploads/2011/06/Screen-shot-2011-06-17-at-10.57.20-AM.png" alt="" width="835" height="533" /><p class="wp-caption-text">Creating a New VM in VirtualBox </p></div></li>
<li>Selecting 512MB to 1024MB of RAM should be enough for this virtual machine.</li>
<li><strong>Important: </strong>Choose &#8220;Use existing hard disk&#8221; and select the .vhd downloaded as it&#8217;s hard disk.
<p><div id="attachment_190" class="wp-caption aligncenter" style="width: 845px"><img class="size-full wp-image-190" title="Selecting Hard Disk for VM" src="http://www.xairon.net/wp-content/uploads/2011/06/Screen-shot-2011-06-17-at-11.01.16-AM.png" alt="" width="835" height="533" /><p class="wp-caption-text">Selecting the .vhd file for VM</p></div></li>
<li>Click &#8220;Continue&#8221; to finish setting up the Virtual Machine.</li>
<li>Select the VM and click on &#8220;Settings&#8221;. Go the Storage Tab:
<p><div id="attachment_191" class="wp-caption aligncenter" style="width: 658px"><img class="size-full wp-image-191" title="Default Storage Configuration" src="http://www.xairon.net/wp-content/uploads/2011/06/Screen-shot-2011-06-17-at-11.04.03-AM.png" alt="" width="648" height="519" /><p class="wp-caption-text">Default Storage Configuration Provided by VirtualBox</p></div></li>
<li><strong>Delete</strong> the Existing Win7_IE8.vhd, and under &#8220;IDE Controller&#8221; add the Win7_IE8.vhd. Your configuration should look like this:
<p><div id="attachment_192" class="wp-caption aligncenter" style="width: 658px"><img class="size-full wp-image-192" title="Configuring Storage for Windows VHD" src="http://www.xairon.net/wp-content/uploads/2011/06/Screen-shot-2011-06-17-at-11.06.06-AM.png" alt="" width="648" height="519" /><p class="wp-caption-text">Configuring Storage for Windows VirtualPC hard disk</p></div></li>
<li>Start the Virtual Machine.
<p><div id="attachment_193" class="wp-caption aligncenter" style="width: 890px"><img class="size-full wp-image-193" title="Windows 7 Login Screen" src="http://www.xairon.net/wp-content/uploads/2011/06/Screen-shot-2011-06-17-at-11.07.55-AM.png" alt="" width="880" height="723" /><p class="wp-caption-text">Windows 7 Login Screen</p></div></li>
<li>The password for IEUser is: <strong>Password1</strong></li>
</ol>
<p>Happy testing previous versions of Internet Explorer! Leave any questions/comments in the comments section below.</p>
<p>Credits:<br />
<a href="http://stackoverflow.com/questions/55577/how-can-i-test-my-web-pages-in-microsoft-internet-explorer-on-a-mac" target="_blank">http://stackoverflow.com/questions/55577/how-can-i-test-my-web-pages-in-microsoft-internet-explorer-on-a-mac</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xairon.net/2011/06/testing-ie6-7-8-and-9-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Guide: Installing cx_Oracle on Mac OS X</title>
		<link>http://www.xairon.net/2011/05/guide-installing-cx_oracle-on-mac-os-x/</link>
		<comments>http://www.xairon.net/2011/05/guide-installing-cx_oracle-on-mac-os-x/#comments</comments>
		<pubDate>Tue, 24 May 2011 04:57:04 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.xairon.net/?p=181</guid>
		<description><![CDATA[Edit &#8211; August 16th, 2011: Updated the guide to properly mention edition .bash_profile instead. This post outlines getting cx_Oracle (for Python) to work in OS X. Downloading Oracle Instant Client You will first need to download the Oracle Instant Client from &#8230; <a href="http://www.xairon.net/2011/05/guide-installing-cx_oracle-on-mac-os-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Edit &#8211; August 16th, 2011: Updated the guide to properly mention edition .bash_profile instead.</p>
<p>This post outlines getting <a href="http://cx-oracle.sourceforge.net/" target="_blank">cx_Oracle</a> (for Python) to work in OS X.</p>
<p><strong>Downloading Oracle Instant Client</strong></p>
<p>You will first need to download the Oracle Instant Client from here: <a href="http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html" target="_blank">http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html</a>. The files you need are:</p>
<ul>
<li>instantclient-basic-10.2.0.4.0-macosx-x86.zip</li>
<li>instantclient-sdk-10.2.0.4.0-macosx-x86.zip</li>
</ul>
<p>Extract both of these zip files into the same folder. Your folder contents should look something like this:</p>
<p><img class="aligncenter size-full wp-image-185" title="Screen shot 2011-05-29 at 12.59.55 PM" src="http://www.xairon.net/wp-content/uploads/2011/05/Screen-shot-2011-05-29-at-12.59.55-PM.png" alt="" width="464" height="230" /></p>
<p><strong>Installing cx_Oracle</strong></p>
<p>Next, you will need to setup your environment variables. Edit your <strong>.bash_profile</strong> in your home directory and add the following:</p>
<p><code>export ORACLE_HOME=[your installation path]/instantclient_10_2<br />
export LD_LIBRARY_PATH=$ORACLE_HOME<br />
export DYLD_LIBRARY_PATH=$ORACLE_HOME</code></p>
<p>Once this is done, <strong>quit </strong>and <strong>reopen</strong> your Terminal and type the following commands in:</p>
<p><code>cd $ORACLE_HOME<br />
ln -s libclntsh.dylib.10.2 libclntsh.dylib</code></p>
<p><code>sudo -i<br />
export ORACLE_HOME=[your installation path]/instantclient_10_2<br />
export LD_LIBRARY_PATH=$ORACLE_HOME<br />
export DYLD_LIBRARY_PATH=$ORACLE_HOME<br />
pip install cx_Oracle</code></p>
<p>cx_Oracle will be installed if there were no errors during the pip installation. Leave a comment here if you encounter any problems!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xairon.net/2011/05/guide-installing-cx_oracle-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

