<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>TrueBoolean</title>
	
	<link>http://www.trueboolean.com</link>
	<description>Programming Blog, Portfolio and Projects of Lastkarrde</description>
	<lastBuildDate>Sun, 20 Jan 2013 09:43:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Trueboolean" /><feedburner:info uri="trueboolean" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Mafia</title>
		<link>http://feedproxy.google.com/~r/Trueboolean/~3/70H1Coz5EFI/</link>
		<comments>http://www.trueboolean.com/mafia/#comments</comments>
		<pubDate>Sun, 20 Jan 2013 09:42:52 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[MurderAndLies]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[mafia]]></category>
		<category><![CDATA[murderandlies]]></category>

		<guid isPermaLink="false">http://www.trueboolean.com/?p=163</guid>
		<description><![CDATA[Over the last few months I&#8217;ve been working on creating a browser based version of the party game Mafia. Mafia is a highly strategic game which forces each player to independently devise a strategy, even though multiple players share the same goal. A basic game of Mafia works as follows: At the start of the...  <a href="http://www.trueboolean.com/mafia/" class="more-link" title="Read Mafia">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p>Over the last few months I&#8217;ve been working on creating a browser based version of the party game <a href="http://en.wikipedia.org/wiki/Mafia_%28party_game%29">Mafia</a>. Mafia is a highly strategic game which forces each player to independently devise a strategy, even though multiple players share the same goal. A basic game of Mafia works as follows:</p>

<ul>
<li>At the start of the game players are randomly assigned their roles (roughly 20% of players will be mafia, the rest will be citizens). Only mafia know who each other are. There is no way for citizens to know any other player&#8217;s role until that player dies. Citizens win when all mafia are dead. Mafia win when all citizens are dead.</li>
<li>The game is made up of 5 turns. Day, Lynch Vote, Lynch Vote Result, Night and Morning. This cycle repeats until one faction is the winner.</li>
<li>All players can talk in a public chat channel during non night turns. Mafia can talk to each other in a hidden channel at night.</li>
<li>At the Lynch Vote everyone can place a vote to lynch a player (Citizens will aim to vote for players they think are Mafia, Mafia will vote for Citizens). The player who receives the most votes will be lynched. They are out of the game and their role will be revealed to everyone else.</li>
<li>At Night all Citizens sleep. Mafia can choose to assassinate one player. </li>
</ul>

<p>A more complicated game can involve other roles such as:</p>

<ul>
<li>Doctor &#8211; Aligned with the Citizens, can specify a target to save each night. This target&#8217;s life will be saved even if they were hit by the mafia.</li>
<li>Jester &#8211; Independent. Wins the game if he is lynched during the day.</li>
<li>Serial Killer &#8211; Independent, can kill 1 player each night. Wins the game if he is the last person left alive.</li>
<li>Detective &#8211; Aligned with the Citizens. Can target a player to investigate at night and view their actions. (eg. If they investigated a mafia role, they would see that the player had killed someone that night).</li>
<li>Witch &#8211; Independent. Can take control of a player at night. (eg. If she took control of a Serial Killer she could choose a different target to kill).</li>
</ul>

<h3>Game Strategy</h3>

<p>The complexity in the game comes from imperfect knowledge and false information.</p>

<p>All citizens in the game share the same goal (to kill all Mafia) but each citizen is forced to develop their strategy independent of each other. Citizens can&#8217;t win unless they cooperate (by lynching mafia). Only Mafia can identify and privately communicate with each other, yet citizens out number them 5:1. Staying quiet in the game will not guarantee mafia a win. So mafia must actively deceive citizens by spreading lies and casting suspicion on other players. Independent roles have powerful abilities, yet are almost always targetted by both the town and mafia once their role is discovered. They must balance the use of their power with the attention they receive in order to win.</p>

<h3>Murder and Lies</h3>

<p>My browser based version of Mafia is called <em>Murder and Lies</em>. I&#8217;ll be posting more about it (both technical and gameplay aspects) in the weeks to come. In the meantime here is a screenshot of the splash screen.</p>

<img src="http://www.trueboolean.com/wp-content/uploads/2013/01/murder.png" alt="Landing page" />
]]></content:encoded>
			<wfw:commentRss>http://www.trueboolean.com/mafia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.trueboolean.com/mafia/</feedburner:origLink></item>
		<item>
		<title>Testing the Status of a SOCKS5 Proxy in Python</title>
		<link>http://feedproxy.google.com/~r/Trueboolean/~3/q5nJYIVlsxM/</link>
		<comments>http://www.trueboolean.com/testing-status-of-socks5-proxy-in-python/#comments</comments>
		<pubDate>Mon, 19 Nov 2012 05:46:23 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Proxies]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[connect]]></category>
		<category><![CDATA[packet]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[socket]]></category>
		<category><![CDATA[socks5]]></category>
		<category><![CDATA[struct]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.trueboolean.com/?p=150</guid>
		<description><![CDATA[I&#8217;ve been working on a proxy testing application in Clojure and have been thinking about porting it to Python. There are a couple of Python libraries that I could use to test the status of a SOCKS proxy. PyCurl is a Python wrapper of the C library curl, this makes it easy to do HTTP...  <a href="http://www.trueboolean.com/testing-status-of-socks5-proxy-in-python/" class="more-link" title="Read Testing the Status of a SOCKS5 Proxy in Python">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been working on a <a href="https://github.com/lastkarrde/ProxyTools">proxy testing application</a> in Clojure and have been thinking about porting it to Python. There are a couple of Python libraries that I could use to test the status of a SOCKS proxy. PyCurl is a Python wrapper of the C library curl, this makes it easy to do HTTP requests by using a SOCKS proxy. Another option is <a href="http://socksipy.sourceforge.net/">socksipy</a> which essentially provides a wrapper around an instance of the <em>socket</em> module. Both of these establish a full connection with the proxy.</p>

<p>Looking at the <a href="http://www.ietf.org/rfc/rfc1928.txt">SOCKS5 protocol</a> we can see that it&#8217;s possible to test the status of a SOCKS5 proxy just by reading the response to the initial greeting packet. Both PyCurl and socksipy establish a full SOCKS connection with the server. This full connection is necessary if we want to send data through the proxy, but because we only need to check the status of the proxy, we can write a script to send just the first packet and read the response.</p>

<p>The format of the greeting packet is as follows (<a href="http://en.wikipedia.org/wiki/SOCKS#SOCKS5">source</a>):</p>

<ul>
<li>field 1: SOCKS version number (must be 0&#215;05 for this version)</li>
<li>field 2: number of authentication methods supported, 1 byte</li>
<li>field 3: authentication methods, variable length, 1 byte per method supported</li>
</ul>

<p>And the server responds:</p>

<ul>
<li>field 1: SOCKS version, 1 byte (0&#215;05 for this version)</li>
<li>field 2: chosen authentication method, 1 byte, or 0xFF if no acceptable methods were offered</li>
</ul>

<p>Using Python we can write a small script to test this:</p>

<pre><code class="python">import socket
import struct

sen = struct.pack('BBB', 0x05, 0x01, 0x00)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 9050))
s.sendall(sen)

data = s.recv(2)

version, auth = struct.unpack('BB', data)
s.close()</code></pre>

<p>If <em>version</em> is 5 and <em>auth</em> is 0 (no authentication), then the proxy is up and available for us to connect to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trueboolean.com/testing-status-of-socks5-proxy-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.trueboolean.com/testing-status-of-socks5-proxy-in-python/</feedburner:origLink></item>
		<item>
		<title>Java Method Overloading</title>
		<link>http://feedproxy.google.com/~r/Trueboolean/~3/cwqxC9fjnHs/</link>
		<comments>http://www.trueboolean.com/java-method-overloading/#comments</comments>
		<pubDate>Fri, 12 Oct 2012 07:07:13 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.trueboolean.com/?p=115</guid>
		<description><![CDATA[Method overloading is where multiple methods in a class share the same name but accept different parameters. The difference in parameters can be in both number and type. Depending on the parameters passed to a function call, a different method is chosen for execution. This powerful feature of Java appears to make your code seem...  <a href="http://www.trueboolean.com/java-method-overloading/" class="more-link" title="Read Java Method Overloading">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p>Method overloading is where multiple methods in a class share the same name but accept different parameters. The difference in parameters can be in both number and type. Depending on the parameters passed to a function call, a different method is chosen for execution. This powerful feature of Java appears to make your code seem more dynamic.</p>

<p>If you are coming from a dynamic language such as Python or PHP the concept of Method Overloading may seem foreign. Because you cannot have multiple methods with the same name, you may do type checking from within the function body as shown below.</p>

<pre><code>def say(phrase):

    if type(phrase) == str:
        return "The phrase is: " + phrase
    elif type(phrase) == list:
        r = "The phrase is: "
        m = " ".join(phrase)
        return r + m


print say("hi")
print say(["Hello", "how", "are", "you?"])
</code></pre>

<p>Here is how you would write the above code in Java. You would declare two <em>say</em> methods which accept different parameters.  When the first <em>o.say()</em> is executed, the JVM looks for a method named <em>say</em> which accepts a single <em>String</em> as an argument. When the second <em>o.say()</em> is executed, the JVM looks for a method named <em>say</em> which accepts an array of <em>String</em> as an argument. Since both of these method declarations exist, the code runs fine.</p>

<pre><code>public class Overloading {

    public static void main(String [] args){

        String[] words = {"Hello", "how", "are", "you?"};

        Overloading o = new Overloading();

        System.out.println(o.say("Howdy"));
        System.out.println(o.say(words));

    }

    public String say(String phrase){
        return "The phrase is: " + phrase;
    }

    public String say(String[] phrases){

        String r = "The phrase is: ";

        for(String s : phrases){
            r += s + " ";
        }

        return r;
    }

}
</code></pre>

<p>One limitation of Method Overloading in Java is that you cannot have two methods which accept the same parameters but have different return types. This code won&#8217;t compile.</p>

<pre><code>    public String say(String phrase){
        return "The phrase is: " + phrase;
    }

    public int say(String phrase){
        return 53;
    }
</code></pre>

<p>You can however declare methods with the same name that have different parameters and different return types. This code will compile.</p>

<pre><code>    public String say(String phrase){
        return "The phrase is: " + phrase;
    }

    public int say(String phrase, int i){
        return 53;
    }
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.trueboolean.com/java-method-overloading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.trueboolean.com/java-method-overloading/</feedburner:origLink></item>
		<item>
		<title>Ubuntu Linux on Macbook 5,2</title>
		<link>http://feedproxy.google.com/~r/Trueboolean/~3/DXy6z3OPiaI/</link>
		<comments>http://www.trueboolean.com/ubuntu-linux-on-macbook-52/#comments</comments>
		<pubDate>Wed, 27 Jun 2012 03:04:19 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[macbook]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.trueboolean.com/?p=44</guid>
		<description><![CDATA[Here are some notes and a quick guide on getting Ubuntu 12.04 working on a Macbook 5,2. I&#8217;ve spent many hours over the past few years trying to get a stable Linux system working on my Macbook. EFI, power management, multiple core support and the touchpad have all proved troublesome on previous versions of Ubuntu...  <a href="http://www.trueboolean.com/ubuntu-linux-on-macbook-52/" class="more-link" title="Read Ubuntu Linux on Macbook 5,2">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p>Here are some notes and a quick guide on getting Ubuntu 12.04 working on a Macbook 5,2. I&#8217;ve spent many hours over the past few years trying to get a stable Linux system working on my Macbook. EFI, power management, multiple core support and the touchpad have all proved troublesome on previous versions of Ubuntu but with the latest releast (12.04) I&#8217;ve finally had some success.</p>

<h3>Installation</h3>

<p>I used the <a href="http://cdimage.ubuntu.com/releases/12.04/release/ubuntu-12.04-desktop-amd64+mac.iso">ubuntu-12.04-desktop-amd64+mac.iso</a> disk image from the Ubuntu servers. For some reason Canonical don&#8217;t list the <em>amd64+mac</em> version on their website so if you are wanting to download it off a local mirror you may need to do a bit of digging.</p>

<p>Burn the .iso to a disc, put it in your DVD drive and restart your Macbook. Hold down the <em>c</em> key to boot from the disc. Once loaded choose the &#8216;Install&#8217; option. The installation process is straight forward. If (like me) you are wanting to single boot Ubuntu on your Macbook then let Ubuntu do a guided/recommended setup of your entire hard disk. If you are wanting to dual boot with OSX then follow <a href="https://help.ubuntu.com/community/MactelSupportTeam/AppleIntelInstallation#Dual-Boot:_Mac_OSX_and_Ubuntu">this guide</a> on the Ubuntu Wiki.</p>

<h3>Work out of the box..</h3>

<ul>
<li>Bluetooth</li>
<li>Wifi (need to install restricted driver)</li>
<li>Graphics card (need to install restricted driver)</li>
<li>Sleep / open and close lid</li>
<li>Sound</li>
<li>Brightness and sound keys</li>
<li>Desktop effects</li>
</ul>

<h3>Touchpad</h3>

<p>By default the touchpad is very jerky and hard to control. I recommend plugging in a USB mouse for initial installation and setup. Once installed getting the trackpad to behave is simple. <em>synclient</em> is a program that allows you to make live changes to the X Server Synaptics Touchpad driver. While there are many options and parameters you can change, you only really need to alter <em>FingerLow</em> and <em>FingerHigh</em>. My settings are as follows (enter them into the terminal):</p>

<pre><code>synclient FingerLow=1
synclient FingerHigh=10
</code></pre>

<p>These make live changes to the system, but don&#8217;t persist after a system restart. There are several ways to make sure they do persist (most notably an xorg configuration file) but the easiest way I found was to simply make a new <em>Startup Application</em> entry with the command:</p>

<pre><code>synclient FingerLow=1 &amp;&amp; synclient FingerHigh=10
</code></pre>

<p>That will run every time you login and your trackpad will behave as expected. You can configure other touchpad settings such as multitouch, clicking and scrolling via the <em>Mouse &amp; Touchpad</em> GUI in <em>System Settings</em>.</p>

<h3>Keyboard and Command Key</h3>

<p>Remapping the apple command key to the Ctrl key saves a lot of finger stretching. Open the <em>Keyboard Layout</em> application -> <em>Layouts</em> tab -> <em>Options</em> -> <em>Alt/win key behavior</em> -> <em>Control is mapped to Win keys (and the usual Ctrl keys)</em>.
<img src="http://www.trueboolean.com/wp-content/uploads/2012/05/keyboard_remap.png" alt="preview" /></p>

<h3>Battery</h3>

<p>With a default screen brightness, no system tweaks and a GNOME 3 desktop the GNOME power manager estimated that a full battery charge would last 2hrs and 11 minutes. This is compared to 2hrs and 48 minutes for a vanilla OSX install under the same conditions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trueboolean.com/ubuntu-linux-on-macbook-52/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.trueboolean.com/ubuntu-linux-on-macbook-52/</feedburner:origLink></item>
		<item>
		<title>Announcing ProxyTools</title>
		<link>http://feedproxy.google.com/~r/Trueboolean/~3/S2i_VM6AJAU/</link>
		<comments>http://www.trueboolean.com/announcing-proxytools/#comments</comments>
		<pubDate>Wed, 13 Jun 2012 02:00:51 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Clojure]]></category>
		<category><![CDATA[Proxies]]></category>

		<guid isPermaLink="false">http://www.trueboolean.com/?p=105</guid>
		<description><![CDATA[ProxyTools is my first real Clojure project. It is a SOCKS and HTTP proxy checker with a web interface that communicates with a Clojure backend. It is designed to be high performance: There is an HTML5 WebSocket connection between client and server, so no waiting around for AJAX polling. Also no heavyweight Flash solution which...  <a href="http://www.trueboolean.com/announcing-proxytools/" class="more-link" title="Read Announcing ProxyTools">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p><a href="https://github.com/lastkarrde/ProxyTools">ProxyTools</a> is my first real Clojure project. It is a SOCKS and HTTP proxy checker with a web interface that communicates with a Clojure backend. It is designed to be high performance:</p>

<ul>
<li>There is an HTML5 WebSocket connection between client and server, so no waiting around for AJAX polling. Also no heavyweight Flash solution which can clog up the browser.</li>
<li>Each proxy is checked asynchronously in it&#8217;s own <em>future</em>.</li>
<li>As soon as a proxy has been checked, the result is immediately sent to the web browser.</li>
</ul>

<img src="http://www.trueboolean.com/wp-content/uploads/2012/06/7gTVC.png" alt="Preview" />

<p><a href="https://github.com/lastkarrde/ProxyTools#installation">Installation</a> is very easy. <a href="https://github.com/lastkarrde/ProxyTools">View on Github</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.trueboolean.com/announcing-proxytools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.trueboolean.com/announcing-proxytools/</feedburner:origLink></item>
		<item>
		<title>PhoneGap Tutorial: Building an Exercise Tracking App</title>
		<link>http://feedproxy.google.com/~r/Trueboolean/~3/yXRWL-s03qI/</link>
		<comments>http://www.trueboolean.com/phonegap-tutorial-building-an-exercise-tracking-app/#comments</comments>
		<pubDate>Mon, 11 Jun 2012 08:24:35 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[PhoneGap]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.trueboolean.com/?p=91</guid>
		<description><![CDATA[I recently wrote a tutorial for MobileTuts+ called Build an Exercise Tracking App. It&#8217;s a 2 part tutorial on creating a cross platform mobile app from scratch. The app (ExerciseTracker) tracks, records and maps your workouts. The tutorial covers: PhoneGap Location API jQueryMobile Google Maps Javascript API HTML5 localStorage Here is a screenshot of the...  <a href="http://www.trueboolean.com/phonegap-tutorial-building-an-exercise-tracking-app/" class="more-link" title="Read PhoneGap Tutorial: Building an Exercise Tracking App">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p>I recently wrote a tutorial for MobileTuts+ called <em><a href="http://mobile.tutsplus.com/tutorials/phonegap/build-an-exercise-tracking-app-geolocation-tracking/">Build an Exercise Tracking App</a></em>. It&#8217;s a 2 part tutorial on creating a cross platform mobile app from scratch. The app (ExerciseTracker) tracks, records and maps your workouts. The tutorial covers:</p>

<ul>
<li>PhoneGap Location API</li>
<li>jQueryMobile</li>
<li>Google Maps Javascript API</li>
<li>HTML5 localStorage</li>
</ul>

<p>Here is a screenshot of the Track Info page (plotting the exercise route on a Google Map).</p>

<img src="http://www.trueboolean.com/wp-content/uploads/2012/06/trackinfo.png" alt="Preview" />

<p>Tutorials &amp; Source:</p>

<ul>
<li><a href="http://mobile.tutsplus.com/tutorials/phonegap/build-an-exercise-tracking-app-geolocation-tracking/">Part 1 &#8211; Geolocation and Tracking</a></li>
<li><a href="http://mobile.tutsplus.com/tutorials/phonegap/build-an-exercise-tracking-app-geolocation-tracking/">Part 2 &#8211; Persistence and Graphing</a></li>
<li><a href="https://mobiletuts.s3.amazonaws.com/PhoneGap_Exercise-Tracker/source.zip">App Source</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.trueboolean.com/phonegap-tutorial-building-an-exercise-tracking-app/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.trueboolean.com/phonegap-tutorial-building-an-exercise-tracking-app/</feedburner:origLink></item>
		<item>
		<title>Clojure Eclipse Leiningen Counterclockwise Setup</title>
		<link>http://feedproxy.google.com/~r/Trueboolean/~3/4XuBh9OuXxI/</link>
		<comments>http://www.trueboolean.com/clojure-eclipse-leiningen-counterclockwise-setup/#comments</comments>
		<pubDate>Mon, 21 May 2012 18:52:46 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Clojure]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[counterclockwise]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[lein]]></category>
		<category><![CDATA[leiningen]]></category>
		<category><![CDATA[setup]]></category>

		<guid isPermaLink="false">http://www.trueboolean.com/?p=68</guid>
		<description><![CDATA[Introduction Here is a short tutorial on setting up an Eclipse + Clojure + Counterclockwise + Leiningen development environment. Most of which was learnt from Chad Emerick&#8217;s excellent Starting Clojure screencast. Eclipse Download and install the latest version of Eclipse Classic Leiningen Download the latest Leiningen script and add it to your system path. I...  <a href="http://www.trueboolean.com/clojure-eclipse-leiningen-counterclockwise-setup/" class="more-link" title="Read Clojure Eclipse Leiningen Counterclockwise Setup">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<h3>Introduction</h3>

<p>Here is a short tutorial on setting up an Eclipse + Clojure + Counterclockwise + Leiningen development environment. Most of which was learnt from Chad Emerick&#8217;s excellent <a href="http://cemerick.com/2012/05/02/starting-clojure/">Starting Clojure</a> screencast.</p>

<h3>Eclipse</h3>

<p>Download and install the latest version of <a href="http://eclipse.org/downloads/">Eclipse Classic</a></p>

<h3>Leiningen</h3>

<p>Download the latest Leiningen <a href="https://github.com/technomancy/leiningen">script</a> and add it to your system path. I have a <em>~/bin/</em> directory for user scripts.</p>

<p>To add <em>~/bin/</em> to your path just:</p>

<p>OSX: <code>echo 'export PATH=~/bin:$PATH' &gt;&gt; ~/.profile</code></p>

<p>Linux: <code>export PATH=~/bin:$PATH</code></p>

<p>Then make <em>lein</em> executable..</p>

<p><code>chmod 777 ~/bin/lein</code></p>

<p>Run the <code>lein</code> command. It will automatically download the dependencies and install itself.</p>

<h3>Eclipse Counterclockwise Plugin</h3>

<p>Help -> Install New Software -> Add
<code>http://ccw.cgrand.net/updatesite/</code></p>

<h3>Eclipse Leiningen Plugin</h3>

<p>Help -> Install New Software -> Add
<code>http://ccw.cgrand.net/updatesite-lein-betas</code></p>

<h3>Usage</h3>

<p>Start a new project with leiningen <code>lein new foo</code></p>

<p>Open that Project as a &#8220;normal&#8221; project (NOT Clojure project) in Eclipse.</p>

<p>Right click on that project
-> Configure -> Convert to Leiningen Project
-> Enable Clojure support
-> Run as -> Clojure Application</p>

<p>The REPL should now launch and automatically load whatever Clojure file you were working in.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trueboolean.com/clojure-eclipse-leiningen-counterclockwise-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.trueboolean.com/clojure-eclipse-leiningen-counterclockwise-setup/</feedburner:origLink></item>
		<item>
		<title>Route Qt Network Traffic Through Tor in PySide</title>
		<link>http://feedproxy.google.com/~r/Trueboolean/~3/ohBi3h3IdvY/</link>
		<comments>http://www.trueboolean.com/route-qt-network-traffic-through-tor-in-pyside/#comments</comments>
		<pubDate>Fri, 11 May 2012 07:25:22 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[PySide]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[Tor]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[pyside]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[tor]]></category>

		<guid isPermaLink="false">http://www.trueboolean.com/?p=36</guid>
		<description><![CDATA[For an application I am working on I needed to route all Qt network traffic through Tor. This can easily be done by routing all Tor traffic through a SOCKS5 proxy server, then getting Qt to route all of it&#8217;s traffic through that server. Tor itself doesn&#8217;t come with a proxy server so you will...  <a href="http://www.trueboolean.com/route-qt-network-traffic-through-tor-in-pyside/" class="more-link" title="Read Route Qt Network Traffic Through Tor in PySide">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p>For an application I am working on I needed to route all Qt network traffic through Tor. This can easily be done by routing all Tor traffic through a SOCKS5 proxy server, then getting Qt to route all of it&#8217;s traffic through that server.</p>

<p>Tor itself doesn&#8217;t come with a proxy server so you will need to use a 3rd party proxy server such as <a href="http://www.pps.jussieu.fr/~jch/software/polipo/tor.html">Polipo</a> or <a href="http://www.privoxy.org/">Privoxy</a>. The Tor bundle comes with Polipo, so I use that. By default, Polipo runs on port 9050.</p>

<p>Below we declare our proxy, then tell Qt to route all Qt traffic through it using the <em>setApplicationProxy()</em> static method.</p>

<pre><code>from PySide.QNetwork import QNetworkProxy

proxy = QNetworkProxy()
proxy.setType(QNetworkProxy.Socks5Proxy)
proxy.setHostName('127.0.0.1')
proxy.setPort(9050)

QNetworkProxy.setApplicationProxy(proxy)
</code></pre>

<p>We can also force Tor to change our identity (essentially IP address) with a few simple lines of code. By default Tor listens on port 9051. I have disabled password authentication for my Tor process (so I don&#8217;t need to pass a password in the AUTHENTICATE command).</p>

<pre><code>import socket

s = socket.socket()
s.connect(('127.0.0.1', 9051))
s.send("AUTHENTICATE \r\n")
s.send("SIGNAL NEWNYM \r\n")
s.close()
</code></pre>

<p>If your application uses Tor, consider <a href="https://www.torproject.org/getinvolved/volunteer.html.en">volunteering</a> to help the Tor project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trueboolean.com/route-qt-network-traffic-through-tor-in-pyside/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.trueboolean.com/route-qt-network-traffic-through-tor-in-pyside/</feedburner:origLink></item>
		<item>
		<title>Java Swing Native UI</title>
		<link>http://feedproxy.google.com/~r/Trueboolean/~3/uVk4lGWnKoc/</link>
		<comments>http://www.trueboolean.com/java-swing-native-ui/#comments</comments>
		<pubDate>Sat, 05 May 2012 03:47:36 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Swing]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[native]]></category>
		<category><![CDATA[swing]]></category>
		<category><![CDATA[ui]]></category>
		<category><![CDATA[UIManager]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://www.trueboolean.com/?p=16</guid>
		<description><![CDATA[The following snippet sets your Swing app to use the native operating system theme (rather than the ugly blue/grey steel theme). import javax.swing.UIManager; try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { System.out.println("Error setting native LAF: " + e); }]]></description>
				<content:encoded><![CDATA[<p>The following snippet sets your Swing app to use the native operating system theme (rather than the ugly blue/grey steel theme).</p>

<pre><code>import javax.swing.UIManager;

try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
    System.out.println("Error setting native LAF: " + e);
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.trueboolean.com/java-swing-native-ui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.trueboolean.com/java-swing-native-ui/</feedburner:origLink></item>
		<item>
		<title>Displaying an Image in a JPanel</title>
		<link>http://feedproxy.google.com/~r/Trueboolean/~3/Xq1JVlYh-VY/</link>
		<comments>http://www.trueboolean.com/displaying-an-image-in-a-jpanel/#comments</comments>
		<pubDate>Sat, 05 May 2012 00:07:57 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Swing]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[ImageIcon]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JLabel]]></category>
		<category><![CDATA[jpanel]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://www.trueboolean.com/?p=4</guid>
		<description><![CDATA[In an application I&#8217;m working on I needed a way to display an image in a JPanel. The simplest way I found was to use a JLabel. import javax.swing.JLabel; import javax.swing.ImageIcon; JLabel label_captchaIcon = new JLabel(); some_jpanel_instance.add(label_captchaIcon); ImageIcon icon = new ImageIcon("captcha.jpg"); label_captchaIcon.setIcon(icon); In my application when the user clicks a JButton, a new image...  <a href="http://www.trueboolean.com/displaying-an-image-in-a-jpanel/" class="more-link" title="Read Displaying an Image in a JPanel">Read more &#187;</a>]]></description>
				<content:encoded><![CDATA[<p>In an application I&#8217;m working on I needed a way to display an image in a <em>JPanel</em>. The simplest way I found was to use a <em>JLabel</em>.</p>

<pre><code>import javax.swing.JLabel;
import javax.swing.ImageIcon;


JLabel label_captchaIcon = new JLabel();
some_jpanel_instance.add(label_captchaIcon);

ImageIcon icon = new ImageIcon("captcha.jpg");
label_captchaIcon.setIcon(icon);
</code></pre>

<p>In my application when the user clicks a <em>JButton</em>, a new image is downloaded which overwrites the old <em>captcha.jpg</em>. Even with ImageIcon code in the <em>JButton</em> event handler, the <em>JLabel</em> would display the old image, not the newly downloaded <em>captcha.jpg</em>.</p>

<p>This problem can be fixed by flushing the old image.</p>

<pre><code>//Needs to be called every time a new image is being set
icon.getImage().flush();
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.trueboolean.com/displaying-an-image-in-a-jpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.trueboolean.com/displaying-an-image-in-a-jpanel/</feedburner:origLink></item>
	</channel>
</rss>
