<?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>Cubehouse&#039;s Blog</title>
	<atom:link href="http://cubehouse.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://cubehouse.org/blog</link>
	<description>My Blog. I occasionally write something vaguely smart here.</description>
	<lastBuildDate>Sun, 15 Jan 2012 11:34:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PlayStation 3 Web Browser Development Tips</title>
		<link>http://cubehouse.org/blog/2012/01/14/playstation-3-web-browser-development-tips/</link>
		<comments>http://cubehouse.org/blog/2012/01/14/playstation-3-web-browser-development-tips/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 17:08:45 +0000</pubDate>
		<dc:creator>cubehouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cubehouse.org/blog/?p=855</guid>
		<description><![CDATA[It&#8217;s fairly common knowledge that the PlayStation 3&#8242;s web browser sucks. It does the job and can play YouTube, iPlayer and browse tons of sites. But the underlying [..]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s fairly common knowledge that the PlayStation 3&#8242;s web browser sucks. It does the job and can play YouTube, iPlayer and browse tons of sites. But the underlying engine is just awful for developers who want to use their existing code to make a PS3-compatible website.</p>
<p>The PlayStation 3 browser is pretty much undocumented online, so it&#8217;s almost impossible to find any tips. For example, do you know how to enable the JavaScript debugger? To which most people respond, &#8220;It has a debugger?!?!?!?!&#8221;</p>
<p>Here are some tips to ease your pains:<span id="more-855"></span></p>
<h2>Enabling the PS3 Browser Debugger</h2>
<p>Create two bookmarks for yourself. Edit the URLs to match the following:</p>
<pre>javascript:window.external.webbrowser.startDebugging();
javascript:window.external.webbrowser.stopDebugging();</pre>
<p>(obviously using one bookmark for enabling debug mode and one for disabling)</p>
<h2>jQuery Issues</h2>
<p>Commonly used library jQuery simply does not work on the PS3. The PS3 JavaScript parser throws a wobbly on the line:</p>
<pre>support.checkClone = fragment.cloneNode(......</pre>
<p>&#8230; which can be found around line 1464, depending on your jQuery version.</p>
<p>Wrap this line with a try/catch statement to let the PS3 browser at least accept jQuery as a sane file. You will suffer endless problems with some jQuery functions, but getting it to load is the first massive step.</p>
<h2>JSONP Ajax Requests on the PS3 Browser</h2>
<p>jQuery offers some fantastic features for quickly making AJAX calls, but it is mega borked on the PS3. Rather than rely on jQuery, you can make your own request method for calling JSONP URLs that use a callback function name.</p>
<pre>function ps3JSONP(method, args, cb){
  // generate random function name for callback
  var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
  var func = 'JSONPFunc_';
  for (var i=0; i&lt;16; i++){
    var rnum = Math.floor(Math.random()*chars.length);
    func += chars.substring(rnum,rnum+1);
  }
  // success function
  window[func] = function(data){
    success = true;
    cb(data);
    window[func+"_clear"]();
  };
  // error function
  window[func+"_err"] = function(){
    alert("Error loading "+f.src);
    window[func+"_clear"]();
  };
  window[func+"_clear"] = function(){
    try{
      delete window[func];
      delete window[func+"_err"];
      delete window[func+"_clear"];
    }catch(e){
      window[func] = undefined;
      window[func+"_err"] = undefined;
      window[func+"_clear"] = undefined;
    }
    document.getElementsByTagName("head")[0].removeChild(f);
  };
  // add arguments to JS
  var a = [];
  for(var i in args){
    a.push(i+"="+args[i]);
  }
  // create the element
  var f = document.createElement("script");
  f.type = 'text/javascript';
  // error catching for FireFox/Chrome/Safari etc. etc. etc.
  f.setAttribute("onerror", func+"_err()");
  // error catching for IE.
  var success = false;
  f.onreadystatechange = function(){
    if ((this.readyState == 'complete') || (this.readyState == 'loaded')){
      // set timeout to test if code actually executed
      setTimeout(function(){
        // check the success variable
        if (!success){
          success = true; // to stop multiple execution (IE sucks.)
          window[func+"_err"]();
        }
      }, 100);
    }
  }
  // call URL
  f.src = url+"/?callback="+func+"&amp;"+a.join("&amp;");
  // append and GO
  document.getElementsByTagName("head")[0].appendChild(f);
 }</pre>
<p>Simply call the ps3JSONP function with your url, an object of arguments=&gt;values and the callback function and it will actually work on the PS3!</p>
<p>For example, you can call:</p>
<pre>ps3JSONP("http://some.api.com/method/get/time",{
  id: "my id",
  variable: 12345
}, function(data){
  alert(data);
});</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://cubehouse.org/blog/2012/01/14/playstation-3-web-browser-development-tips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Remote Uploading to Coppermine Gallery 1.5x with PHP</title>
		<link>http://cubehouse.org/blog/2011/07/04/remote-uploading-to-coppermine-gallery-1-5x-with-php/</link>
		<comments>http://cubehouse.org/blog/2011/07/04/remote-uploading-to-coppermine-gallery-1-5x-with-php/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 14:30:42 +0000</pubDate>
		<dc:creator>cubehouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cubehouse.org/blog/?p=801</guid>
		<description><![CDATA[Through some reverse engineering of the Coppermine flash uploader, I built my own remote uploader for Coppermine that allows users to upload images from a different part of [..]]]></description>
			<content:encoded><![CDATA[<p>Through some reverse engineering of the Coppermine flash uploader, I built my own remote uploader for Coppermine that allows users to upload images from a different part of my website. I use bridging to authenticate my WordPress users with my Coppermine installation, so this is particularly useful for areas of my website where users want to add images without having to navigate to the gallery and then back to the page they were last on to add an image.</p>
<p>Essentially, the flash uploader sends a POST request to the upload.php file in your main gallery installation folder.</p>
<p>It sends the following variables:</p>
<ul>
<li>user (base 64 of serialised user_id and password_hash)</li>
<li>album (album id)</li>
<li>process (1)</li>
<li>Filename (filename of uploaded image)</li>
<li>[standard multi-part image data]</li>
</ul>
<div>In response, it sends a single line of plaintext like follows:</div>
<p><em>success0|albums/userpics/10002/thumb_IMAG0061.jpg</em></p>
<p>To generate the user variable, you need to make a php array with a user_id and pass_hash variable inside from your authenticated user.</p>
<div>Then serialise the object and run it through base64_encode.</div>
<div>For example, with my WordPress bridged copy of Coppermine, I get the user variable using:</div>
<p><em><br />
global $current_user;<br />
get_currentuserinfo();<br />
$coppermine_user_var = base64_encode(serialize(array(&#8220;user_id&#8221; =&gt; $current_user-&gt;ID, &#8220;pass_hash&#8221; =&gt; $current_user-&gt;user_pass)));</em></p>
<p>Best solution to implementing this is to look at the setup_swf_upload.js file inside of the Coppermine js folder.</p>
]]></content:encoded>
			<wfw:commentRss>http://cubehouse.org/blog/2011/07/04/remote-uploading-to-coppermine-gallery-1-5x-with-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Easy Integration of Google +1 into a WordPress Blog</title>
		<link>http://cubehouse.org/blog/2011/06/01/easy-integration-of-google-1-into-a-wordpress-blog/</link>
		<comments>http://cubehouse.org/blog/2011/06/01/easy-integration-of-google-1-into-a-wordpress-blog/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 20:07:10 +0000</pubDate>
		<dc:creator>cubehouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cubehouse.org/blog/?p=784</guid>
		<description><![CDATA[Google Like +1 put their embedding code live today, allowing developers and script kiddies alike to add it into their very own websites and spread some of the [..]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cubehouse.org/blog/wp-content/uploads/2011/06/google-1-button.jpg" rel="shadowbox[sbpost-784];player=img;" title="google-1-button"><img class="alignright size-thumbnail wp-image-786" title="google-1-button" src="http://www.cubehouse.org/blog/wp-content/uploads/2011/06/google-1-button-150x150.jpg" alt="" width="150" height="150" /></a>Google <del>Like</del> +1 put their embedding code live today, allowing developers and script kiddies alike to add it into their very own websites and spread some of the Google +1 love.</p>
<p>To add it to your own website, add the following lines to your themes functions.php file:</p>
<pre>wp_register_script('googleplus1', "http://apis.google.com/js/plusone.js");
wp_enqueue_script('googleplus1');</pre>
<p>Then add the following to your single.php file to add it to the bottom of your articles. Make sure you put it somewhere sensible. You could even float it in a div if you fancy having it somewhere in particular.</p>
<pre>&lt;g:plusone&gt;&lt;/g:plusone&gt;</pre>
<p>See <a href="http://www.google.com/webmasters/+1/button/">http://www.google.com/webmasters/+1/button/</a> for more details about how to customise the button.</p>
<p>Easy peasy! I&#8217;m sure &#8216;share bar&#8217; plugins will be adding it to their list of sharing providers soon, so if you aren&#8217;t using a custom theme, best to wait for your plugin coders to update or drop them a line suggesting they implement +1.</p>
]]></content:encoded>
			<wfw:commentRss>http://cubehouse.org/blog/2011/06/01/easy-integration-of-google-1-into-a-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using BlackMagic Intensity Pro with VLC</title>
		<link>http://cubehouse.org/blog/2011/05/20/using-blackmagic-intensity-pro-with-vlc/</link>
		<comments>http://cubehouse.org/blog/2011/05/20/using-blackmagic-intensity-pro-with-vlc/#comments</comments>
		<pubDate>Fri, 20 May 2011 16:09:34 +0000</pubDate>
		<dc:creator>cubehouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cubehouse.org/blog/?p=777</guid>
		<description><![CDATA[VLC doesn&#8217;t play it as easily as you would hope. It has to do with the frame rate setting, that has to be 59.940001 for some bizarre reason. However, [..]]]></description>
			<content:encoded><![CDATA[<p>VLC doesn&#8217;t play it as easily as you would hope. It has to do with the frame rate setting, that has to be 59.940001 for some bizarre reason.</p>
<p>However, after setting that you will eventually get it working but with an input delay. This is because VLC caches video in memory briefly before displaying it. You can pull this right down though, however the sound messes up the lower you set the cache. I recommend a setting of 50ms, you barely notice at all while using whatever device you have hooked into your capture card.</p>
<p>I&#8217;ve included a playlist file for VLC that will automatically play the video stream (assuming it&#8217;s 720p and you&#8217;ve set your BlackMagic settings correctly &#8211; if BlackMagic Media Express works you&#8217;re set).</p>
<p><a href="http://www.cubehouse.org/blog/wp-content/uploads/2011/05/Play-PS3-in-VLC.zip">Play PS3 in VLC</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cubehouse.org/blog/2011/05/20/using-blackmagic-intensity-pro-with-vlc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Password Hashing &#8211; How to make it not suck. A basic guide.</title>
		<link>http://cubehouse.org/blog/2011/05/02/password-hashing-how-to-make-it-not-suck-a-basic-guide/</link>
		<comments>http://cubehouse.org/blog/2011/05/02/password-hashing-how-to-make-it-not-suck-a-basic-guide/#comments</comments>
		<pubDate>Mon, 02 May 2011 22:29:53 +0000</pubDate>
		<dc:creator>cubehouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cubehouse.org/blog/?p=753</guid>
		<description><![CDATA[When you register for websites or online services, you have to set a password to enable yourself to login again in the future. Your username and password needs [..]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">When you register for websites or online services, you have to set a password to enable yourself to login again in the future. Your username and password needs to be stored in a database so that when you ask to login, the server can verify your details are correct and allow you access.</p>
<p>Let&#8217;s look at the basic way of doing this (btw, the WRONG way) and then work our way up to how most websites (should) be storing your password.</p>
<p>(comic from <a href="http://xkcd.com/" target="_blank">XKCD.com</a>)<span id="more-753"></span></p>
<h2>Version 1 &#8211; Plain-text</h2>
<p>Joe has registered on my website and I have chosen to store his password in &#8220;plain-text&#8221;. This means I store his password with no other security measures than normal.</p>
<p>So in my database I store:</p>
<blockquote><p>Username: Joe<br />
Email: Joe@bloggs.com<br />
Password: 12345</p></blockquote>
<p>Yes, it&#8217;s a bad password. But you&#8217;d be surprised how many people use that one. (see top passwords on Gawker leak: <a href="http://blogs.wsj.com/digits/2010/12/13/the-top-50-gawker-media-passwords/" target="_blank">http://blogs.wsj.com/digits/2010/12/13/the-top-50-gawker-media-passwords/</a>)</p>
<p>Now when Joe tried to log into my website, I look at the password he gave me and compare it to my database. Let&#8217;s say Joe gives me his password &#8220;12345&#8243; &#8211; Hurrah! It matches! I can let him login and access my lovely website.</p>
<p>Where are the problems with this? First, anybody running the website can easily look into their database and read all the passwords for all their users. Ideally you want even the admins on the website to not be able to know your password. Secondly, all the security is based on the database. If somebody managed to break into the website, they may be able to break into the database and download all your usernames, emails and passwords.</p>
<p>We need a better form of security.</p>
<h2>Version 2 &#8211; Password Hashing</h2>
<p>Now we are going to secure our passwords with something called &#8220;hashing&#8221;. We use a mathematical equation called a &#8220;hash function&#8221; to turn your password into a piece of nonsensical data. There are many different types of hash functions we could use, however they ideally need to have these properties:</p>
<ul>
<li>One-way only
<ul>
<li>This means if we take a password and run it through a hash function, we cannot reverse the process. This means you can&#8217;t take the password hash, run it through a modified version of the hash function and get the original password.</li>
<li>This requires some complex mathematics to ensure it&#8217;s absolutely impossible to find a way of reversing the hash function.</li>
</ul>
</li>
<li>No collisions
<ul>
<li>We don&#8217;t want two passwords resulting in the same password hash. For example, if &#8220;12345&#8243; and &#8220;password&#8221; resulted in the same password hash, people will be able to login with either of these passwords.</li>
<li>This will make more sense after an example.</li>
</ul>
</li>
</ul>
<p>So, for this example we&#8217;re going to use a famous hash function called MD5 (which has actually been proven to have some rare hash collisions, there are better functions available now, but for this example we&#8217;ll use a popular one).</p>
<p>When Joe registers, instead of storing his password in plain-text, we store the result of the hash function.</p>
<blockquote><p>Username: Joe<br />
Email: Joe@bloggs.com<br />
Password: 827ccb0eea8a706c4c34a16891f84e7b</p></blockquote>
<p>You can see that the result of &#8220;12345&#8243; is a long piece of text that is impossible to understand.</p>
<p>Now, when Joe tries to log in, we take his password. We run the hash function on the password he gave us and we <em>compare the two hashes</em> instead. If he gives us &#8220;12345&#8243;, we will run it through the hash function, check the resulting password hash and if it matches the hash we have in the database &#8211; Hurrah! We have logged Joe into the site again.</p>
<p>But is this really safe enough?</p>
<p>Note that this time, we never store the plain password. So an admin can&#8217;t look through the database and read everyone&#8217;s passwords. But, there is still a flaw in this system.</p>
<p>What if we built a massive database of every single possible combination of letters, numbers and symbols and ran the same MD5 hash function over every possibility and saved the result. It will take a very very long time to calculate, but people have done exactly this. They have created databases where you can type in a password hash, and it will search through their massive databases trying to find the password that originally created it.</p>
<p>This is the problem of everybody using the same hash functions. But there are very few available that are secure and strong enough.</p>
<p>However, there is a solution to this problem too.</p>
<h2>Version 3 &#8211; Salted hashes</h2>
<p>Salting is almost exactly the same as password hashing, but with one minor difference. We add a new piece of data to each user in our database. For this example, I&#8217;m going to generate a random piece of text for Joe using a random text generator.</p>
<p>For Joe, we generated a random piece of text &#8220;b5h64h0c78FbXWJHKl7DDKKE35d6SO&#8221;. We shall call this his &#8220;password salt&#8221;. We store this alongside his username and email address in the database.</p>
<p>Now, instead of storing the hash of only his password, we also add our salt to his password. Now instead of performing the hash function of &#8220;12345&#8243; we perform the hash function of &#8220;12345b5h64h0c78FbXWJHKl7DDKKE35d6SO&#8221;. Notice it starts with Joe&#8217;s normal password, but we add our salt onto the end. This gives us a new password hash to store.</p>
<blockquote><p>Username: Joe<br />
Email: Joe@bloggs.com<br />
Password: f88378f45a99a13be6f42cefbd80e976<br />
Salt: b5h64h0c78FbXWJHKl7DDKKE35d6SO</p></blockquote>
<p>So now, we have made Joe&#8217;s password very long. It would take way too long for somebody to go through every single possibility up to the point of a 35 letter password because of the salt we added on. This is why it&#8217;s vital that websites add the salt to each user, making it impossible to pre-calculate as many password possibilities as possible, since every user will have a completely different salt, it will take centuries of computation to get anywhere close to finding the right one.</p>
<p>Recently, Gawker, (a website network including Fleshbot, Deadspin, Lifehacker, Gizmodo, io9, Kotaku, Jalopnik and Jezebel) was hacked and their database was compromised. They did not use password salting. Millions of passwords were instantly looked up in large password hash database. It&#8217;s hard to know how many other websites out there don&#8217;t salt their password hashes.</p>
<p>We&#8217;ve glanced over a lot of password security, but I thought it would be helpful to essentially explain how your data is secure. After the recent media hype over hacked systems, people actually suddenly seem to care about their online information. Just wait until people get into your Facebook. If you don&#8217;t want people to know about it, don&#8217;t put it online.</p>
<p>How can we improve this further? Look up Two-Factor Authentication, banks (and recently GMail <a href="http://googleblog.blogspot.com/2011/02/advanced-sign-in-security-for-your.html">http://googleblog.blogspot.com/2011/02/advanced-sign-in-security-for-your.html</a>) implements it and will keep your account significantly more secure: <a href="http://en.wikipedia.org/wiki/Two-factor_authentication">http://en.wikipedia.org/wiki/Two-factor_authentication</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cubehouse.org/blog/2011/05/02/password-hashing-how-to-make-it-not-suck-a-basic-guide/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using RDS (AWS MySQL) on an Elastic Beanstalk Java Tomcat server (with EC2 security permissions)</title>
		<link>http://cubehouse.org/blog/2011/03/04/using-rds-aws-mysql-on-an-elastic-beanstalk-java-tomcat-server-with-ec2-security-permissions/</link>
		<comments>http://cubehouse.org/blog/2011/03/04/using-rds-aws-mysql-on-an-elastic-beanstalk-java-tomcat-server-with-ec2-security-permissions/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 19:15:46 +0000</pubDate>
		<dc:creator>cubehouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cubehouse.org/blog/?p=740</guid>
		<description><![CDATA[Initial-ism filled title. Nice. I&#8217;ve been playing with Amazon Web Service&#8217;s Elastic Beanstalk service to host a web app I&#8217;ve been working on in Java. Everything worked fine [..]]]></description>
			<content:encoded><![CDATA[<p>Initial-ism filled title. Nice.</p>
<p>I&#8217;ve been playing with Amazon Web Service&#8217;s Elastic Beanstalk service to host a web app I&#8217;ve been working on in Java. Everything worked fine until I integrated my MySQL library and was unable to connect to the database with an error message like so:</p>
<blockquote><p>&#8220;The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.&#8221;</p></blockquote>
<p>So, I hunted down the solution. But, I&#8217;m going to go over how you set up a connection to a MySQL database too (if you know your code and library is set up right, skip the first bit).<span id="more-740"></span></p>
<h2>Setting up MySQL with Elastic Beanstalk</h2>
<p>I&#8217;m assuming you&#8217;re using RDS for all of this. If you&#8217;re not, find another tutorial.</p>
<p>First, hunt down your MySQL connector library (I&#8217;m using mysql-connector-java-5.1.15-bin.jar) and copy it into the &#8220;WEB-INF/lib&#8221; directory of your Eclipse project (Eclipse should detect it and add it under &#8220;Web App Libraries&#8221; in your package panel.</p>
<p>Here is some really simple code for connecting to a database:</p>
<p><code>&lt;%@ page import="java.sql.*" %&gt;<br />
private Connection con;<br />
String pass = "password";<br />
String url = "jdbc:mysql://DATABASE-URL:3306/";<br />
Statement stmt;<br />
try{<br />
if (con == null){<br />
Class.forName("com.mysql.jdbc.Driver").newInstance();<br />
con = DriverManager.getConnection(url, "username", pass);<br />
con.setCatalog("mydatabase");<br />
}<br />
stmt = con.createStatement();<br />
ResultSet r = stmt.executeQuery("SELECT name FROM table ORDER BY RAND() LIMIT 5"); while(r.next()){ %&gt;<br />
&lt;%= r.getString("name") %&gt;<br />
&lt;%<br />
}<br />
//con.close();<br />
}catch(Exception e){<br />
%&gt;<br />
Error :: &lt;%= e.getMessage() %&gt;<br />
&lt;%<br />
}</code></p>
<p>You may notice the con.close() is commented out. The private Connection con variable near the top keeps the connection alive between page views to make the application run faster. Useful if you know that your web app is going to be hit a lot.</p>
<p>Obviously, modify this example to suit your own environment.</p>
<h2>Setting up your RDS (MySQL) permissions</h2>
<p>Goto your AWS account area and open the &#8220;Security Credentials&#8221; area. Scroll right down to the bottom and copy the AWS Account ID to a text file somewhere for use in a second.</p>
<p>Next, goto your AWS panel and find the EC2 tab. Go into the &#8220;Security Groups&#8221; area and find the security group named &#8220;elastic-beanstalk-#####&#8221; or something similar. Copy this group&#8217;s name to a text file too.</p>
<p>Now open the RDS section of the AWS panel. Goto &#8220;DB Security Groups&#8221; and add an &#8220;EC2 Security Group&#8221; with the two pieces of information your just saved somewhere.</p>
<p>Now you can connect to your RDS database from your Elastic Beanstalk instances!</p>
<p>Have fun <img src='http://cubehouse.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://cubehouse.org/blog/2011/03/04/using-rds-aws-mysql-on-an-elastic-beanstalk-java-tomcat-server-with-ec2-security-permissions/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CentOS How To: Running Apache and Lighttpd on port 80. At the same time. On the same server.</title>
		<link>http://cubehouse.org/blog/2011/02/24/centos-how-to-running-apache-and-lighttpd-on-port-80-at-the-same-time-on-the-same-server/</link>
		<comments>http://cubehouse.org/blog/2011/02/24/centos-how-to-running-apache-and-lighttpd-on-port-80-at-the-same-time-on-the-same-server/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 21:39:23 +0000</pubDate>
		<dc:creator>cubehouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cubehouse.org/blog/?p=734</guid>
		<description><![CDATA[Introduction to the problem Step back, going to be performing some web server magic before you. Port 80 is the default port for all websites, it&#8217;s what all [..]]]></description>
			<content:encoded><![CDATA[<h2>Introduction to the problem</h2>
<p>Step back, going to be performing some web server magic before you. Port 80 is the default port for all websites, it&#8217;s what all websites use if you don&#8217;t define the port number. I found it particularly useful to use Apache and Lighttpd at the same time for my server optimisation. I originally had Lighttpd running on port 81, but loads of foolish web admins decide to block loads of port numbers making a large amount of my important visitors unable to access static content on my site (CSS and JS dead. Not pretty.)</p>
<p>If you know much about how servers work, you&#8217;ll know you can&#8217;t usually have two programs running on the same port number. Otherwise, how will both programs know what information is for them?<span id="more-734"></span></p>
<h2>Getting a second IP address</h2>
<p>You can get around this problem by having two IP addresses for one server. Most hosts will let you purchase an additional IP address for your dedication/virtual-dedicated servers.</p>
<p>You need to purchase an extra IP address and &#8220;attach&#8221; it to your server. I had to create a new random subdomain on my server in order for myhost (1and1) to let me hook the IP to my box.</p>
<p>Now you need to configure your server to accept the new connection using a virtual network card. Browse to your network directory and copy your current network configuration file to create another one.</p>
<p style="padding-left: 30px;"><code>cd /etc/sysconfig/network-scripts/<br />
cp ifcfg-eth0 ifcfg-eth0:0</code></p>
<p>Now you need to edit your new network card. You have to change DEVICE and IPADDR. So, edit the file you just created (ifcfg-eth0:0) with:</p>
<p style="padding-left: 30px;"><code>DEVICE=eth0:0<br />
IPADDR=[your.new.ip.address]</code></p>
<p>Note: If your files don&#8217;t have an IPADDR entry, create one and also add your original IP address into the ifcfg-eth0 file.</p>
<p>Now reset your networking:</p>
<p style="padding-left: 30px;"><code>/etc/rc.d/init.d/network reload</code></p>
<p>Try and access your new IP address to confirm it&#8217;s connected to the server correctly (Apache by default takes over all port 80 connections, which is helpful for testing).</p>
<p><span style="font-size: 20px; font-weight: bold;">Setting Apache to your original IP address</span></p>
<p>Find your apache configuration log (usually at /etc/httpd/conf/httpd.conf &#8211; try find / -name&#8221;httpd.conf&#8221; if you need help finding it)</p>
<p>Find the &#8220;Listen&#8221; line of your configuration and modify it (note: lines beginning with # are comments, so ignore there).</p>
<p style="padding-left: 30px;"><code>Listen [your.original.ip.address]:80</code></p>
<p>Obviously inserting your original IP address instead of [your.original.ip.address]</p>
<p>Now restart Apache and test that your website still works (your new IP address will now not work)</p>
<p style="padding-left: 30px;"><code>service httpd restart</code></p>
<h2>Installing and configuring Lighttpd</h2>
<p>First install Lighttpd (if you haven&#8217;t already)</p>
<p style="padding-left: 30px;"><code>yum install lighttpd</code></p>
<p>Edit the Lighttpd config file at /etc/lighttpd/lighttpd.conf</p>
<p>Find the line &#8220;server.bind = &#8221; and modify the entry to use your new IP address (it will most likely also be commented, so remove the #)</p>
<p>You may also want to add some virtual hosts (you will have to make sure these sub domains are set to go to your new IP address for these to work).</p>
<p>This is just an example of setting images.example.com to serve static files from the given directory on example.com.</p>
<p style="padding-left: 30px;"><code>$HTTP["host"] == "images.example.com" {    server.document-root = "/var/www/vhosts/example.com/httpdocs/images/" }</code></p>
<p>Finally, set Lighttpd to start up automatically when your server starts and start it.</p>
<p style="padding-left: 30px;"><code>chkconfig lighttpd on<br />
service lighttpd start </code></p>
]]></content:encoded>
			<wfw:commentRss>http://cubehouse.org/blog/2011/02/24/centos-how-to-running-apache-and-lighttpd-on-port-80-at-the-same-time-on-the-same-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress How To: Default images to link to the file</title>
		<link>http://cubehouse.org/blog/2011/02/24/wordpress-how-to-default-images-to-link-to-the-file/</link>
		<comments>http://cubehouse.org/blog/2011/02/24/wordpress-how-to-default-images-to-link-to-the-file/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 20:32:32 +0000</pubDate>
		<dc:creator>cubehouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cubehouse.org/blog/?p=732</guid>
		<description><![CDATA[My own website seems to handle this just fine, maybe it&#8217;s because I actually explore the options inside WordPress and it defaults to what I like. However, when [..]]]></description>
			<content:encoded><![CDATA[<p>My own website seems to handle this just fine, maybe it&#8217;s because I actually explore the options inside WordPress and it defaults to what I like.</p>
<p>However, when running a website for a large group of other people to mess around with, all their images link to an attachment page rather than the image itself (which causes havoc for shadowbox plugins etc.)</p>
<p>So, you can force the default link to be the file (or the attachment page&#8230; or even blank if you would like).</p>
<p>Goto the &#8220;secret WordPress options page&#8221; at http://www.example.com/wp-admin/options.php (obviously, replace example.com with your domain)</p>
<p>Find the option &#8220;image_default_link_type&#8221; and change as required:</p>
<ul>
<li><em>leave it blank</em> &#8211; no URL at all</li>
<li><code>file</code> &#8211; Default to File URL eg. /wp-content/image.png</li>
<li><code>post</code> &#8211; Default to Attachment Page URL eg. /?attachment=111</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://cubehouse.org/blog/2011/02/24/wordpress-how-to-default-images-to-link-to-the-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress How To: Disable the Admin Bar in WordPress 3.1</title>
		<link>http://cubehouse.org/blog/2011/02/18/how-to-disable-the-admin-bar-in-wordpress-3-1/</link>
		<comments>http://cubehouse.org/blog/2011/02/18/how-to-disable-the-admin-bar-in-wordpress-3-1/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 17:32:17 +0000</pubDate>
		<dc:creator>cubehouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cubehouse.org/blog/?p=726</guid>
		<description><![CDATA[This may be helpful to those WordPress developers who want to keep their site as it was without the new admin bar arriving with WordPress 3.1 soon. Simply [..]]]></description>
			<content:encoded><![CDATA[<p>This may be helpful to those WordPress developers who want to keep their site as it was without the new admin bar arriving with WordPress 3.1 soon.</p>
<p>Simply use this code in your there&#8217;s function.php file or add it to a new file in the plugins folder and activate.<br />
<code>add_filter( 'show_admin_bar', '__return_false' );remove_action( 'personal_options', '_admin_bar_preferences' );</code></p>
]]></content:encoded>
			<wfw:commentRss>http://cubehouse.org/blog/2011/02/18/how-to-disable-the-admin-bar-in-wordpress-3-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP scanning for free Twitter usernames with auto-Tweet on success</title>
		<link>http://cubehouse.org/blog/2010/08/20/php-scanning-for-free-twitter-usernames/</link>
		<comments>http://cubehouse.org/blog/2010/08/20/php-scanning-for-free-twitter-usernames/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 17:15:40 +0000</pubDate>
		<dc:creator>cubehouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cubehouse.org/blog/?p=669</guid>
		<description><![CDATA[I&#8217;ve had a pretty rubbish twitter name for a long time: cubehouseathome It&#8217;s too long, stupid and annoying (much like how I get distracted and put small side-stories [..]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a pretty rubbish twitter name for a long time: cubehouseathome</p>
<p>It&#8217;s too long, stupid and annoying (much like how I get distracted and put small side-stories in brackets in blog posts).</p>
<p>So, I set up a small PHP script to scan for a selection of names I preferred. It is designed to run every few minutes and instantly DM me on Twitter with the good news (which coupled with using the latest live version of TweetDeck, meant if I was at my computer, was guaranteed to get the name).</p>
<p>Here is the code I used for checking if a name was free (how you then alert yourself is up to you).<span id="more-669"></span></p>
<blockquote><p>&lt;?<br />
function check_twitter($name){<br />
$ch = curl_init();<br />
curl_setopt($ch,CURLOPT_URL,&#8221;http://twitter.com/&#8221;.$name);<br />
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);<br />
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5);<br />
$o = curl_exec($ch);<br />
curl_close($ch);<br />
if (strpos($o, &#8220;Twitter / ?&#8221;)){<br />
echo $name.&#8221; is FREE!!!\r\n&#8221;;<br />
// write some email/notification code here<br />
}else{<br />
echo $name.&#8221; taken&#8230; still\r\n&#8221;;<br />
}<br />
}<br />
// call the function with the names you want<br />
check_twitter(&#8220;cube&#8221;);<br />
?&gt;</p></blockquote>
<p>Now the proud owner of <a href="http://twitter.com/cube" target="_blank">@cube</a></p>
<p><strong>Update:</strong></p>
<p>I&#8217;ve expanded the original script to include the auto-tweet notifier that I used for my scanner.</p>
<p>Download this one file that contains everything you need to make the scanner tweet you when it finds an empty username. Note, it will keep tweeting you until it is taken or you stop the scanner.</p>
<p>Simply create a Twitter app, fill in the configuration and run the file. Then setup a cron job or something to repeatedly execute the PHP file. (don&#8217;t just sit there hitting refresh, it took me 13 months to get my username).</p>
<p>Note: You need two Twitter accounts. One to send the DM and one to receive it. The one receiving must be following the sender. Try a random jargon username to test it works.</p>
<p><a href="http://www.cubehouse.org/blog/wp-content/uploads/2010/08/twitterscan.zip">TwitterScanner.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cubehouse.org/blog/2010/08/20/php-scanning-for-free-twitter-usernames/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

