<?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:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
    <channel>
    
    <title>phawk</title>

    <link>http://phawk.co.uk</link>
    <description>Web Developer, Codeigniter, PHP, Java, JavaScript</description>
    <dc:language>en-gb</dc:language>
    <dc:creator>Pete Hawkins is at pete at phawk dot co dot uk</dc:creator>

    <dc:rights>Copyright 2012</dc:rights>
    <admin:generatorAgent rdf:resource="http://www.codeigniter.com/" />

            <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/peteyhawkins" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="peteyhawkins" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
          <title>Performance: Play Framework vs. CodeIgniter vs. WordPress</title>
          <link>http://phawk.co.uk/journal/post/performance-play-framework-vs-codeigniter-vs-wordpress</link>
          <guid>http://phawk.co.uk/journal/post/performance-play-framework-vs-codeigniter-vs-wordpress</guid>

          <description><![CDATA[
		      		      <p>In December 2011 I decided to give <a href="http://www.playframework.org">Play! Framework</a> a go, and what better place to start than right here on my blog. A totally non mission critical application that I can just have fun with and figure out how play works. I was so impressed with play but I already wrote an <a href="http://phawk.co.uk/journal/post/trying-play-framework">article on that</a>.</p>

<p>Having had previous versions of my blog with pretty much the exact same data structure and queries being pulled out, all running on MySQL, I had three copies of my blog sitting on my VPS:</p>

<ul>
<li>My <a href="http://wordpress.org">Wordpress</a> site from 2010</li>
<li>My <a href="http://codeigniter.com">CodeIgniter</a> blog from 2011</li>
<li>This blog your reading running on <a href="http://www.playframework.org">Play!</a></li>
</ul>

<p>I would love to have the time to write my blog in a few other languages and frameworks to put into this benchmark, especially Ruby on Rails and ASP.net MVC 3, though finding the time for that would be a nightmare!</p>

<h2>Test specs</h2>

<h3>Hardware</h3>

<p>All three sites are running on a cloud VPS provided by <a href="http://bigwetfish.co.uk/">BigWetFish</a>, basic specs and system setup detailed below:</p>

<ul>
<li>Two dedicated Xeon cores</li>
<li>2GB dedicated ram</li>
<li>50 GB SAN storage</li>
<li>Ubuntu 10.04 O/S</li>
<li>Apache 2.2 web server</li>
<li>Based in a datacenter in London</li>
</ul>

<h3>Test system</h3>

<p>I have been using a free account on <a href="http://blitz.io/">blitz.io</a> to send concurrent users to the sites over a measured period of time, this will test the throughput of the sites. Here are the exact parameters of the tests being run:</p>

<ul>
<li>1-250 concurrent users over a 60 second window</li>
<li>All users coming from Ireland</li>
<li>Timeout of 1 second.</li>
</ul>

<p>I have set the timeout to 1 second as I think any page taking more than 1 second to load is extremely slow.</p>

<h2>Results</h2>

<h3>Wordpress</h3>

<p>It gets banded about a lot in the developer industry that wordpress is terrible when it comes to performance, with version 3 of their blogging platform they noted that one of the major changes was performance, they have really worked hard to strip things back.</p>
<p>I don&#8217;t think their performance tuning worked that well. Wordpress crashed apache on my server after 35 concurrent users, managing a shocking 85 successful hits and only lasting 8.54seconds into the test.</p>
<p>Wordpress can handle around <strong>230,000 hits per day</strong> on this server.</p>

<p><a href="/public/img/journal/hpc/wp.png"><img src="/public/img/journal/hpc/wp_small.png" alt="Wordpress Performance results" /></a></p>

<h3>CodeIgniter</h3>

<p>I have been using CodeIgniter for almost 2 years now, writing a lot of web applications, it seems to fair very well in any performance tests I have seen against other PHP frameworks, usually landing in the top 3.</p>
<p>CodeIgniter at least managed to make it the whole way through the test and didn&#8217;t push apache to the breaking point either. 
Codeigniter managed 1,450 hits over the 60 seconds and made it up to 121 concurrent users without any timeouts.</p>
<p>Once the number of users went above 121 however, timeouts started to occur, in fact 66.1% of all hits in the test where timeouts.
<p>CodeIgniter can handle around <strong>3.1 million hits per day</strong> on this server.</p>

<p><a href="/public/img/journal/hpc/ci.png"><img src="/public/img/journal/hpc/ci_small.png" alt="CodeIgniter Performance results" /></a></p>

<h3>Play Framework</h3>

<p>I know play framework is certainly not using PHP, compiled Java is obviously going to be faster, but I think this test is still certainly valid to show how much faster Play can be for a small application with simple data structures, and how that would translate into being exponentially faster for large applications with complex data structures.
Play made it all the way to 250 concurrent users without breaking a sweat, the maximum response time at 250 users was 558ms, almost half of what our timeout was set to, so I would expect play to be able to serve over 400 concurrent users on this server without timing out.
Play managed 5,944 users over the 60 seconds and can handle around <strong>8.2 million hits per day</strong> on this server.</p>

<p><a href="/public/img/journal/hpc/play.png"><img src="/public/img/journal/hpc/play_small.png" alt="Play Framework Performance results" /></a></p>

<h2>Summary</h2>

<p>If you&#8217;re a developer and thinking of writing a blog, I would suggest not to use wordpress, especially if you expect to get a lot of visitors!</p>

<p>With CodeIgniter, you&#8217;ll certainly be able to handle a lot more traffic than wordpress, but if performance is key there is no reason not to look at something like <a href="http://playframework.org">Play! Framework</a>.</p>

<p>Your development time will rapidly increase especially if you use JPA and Hibernate persistence with play to automatically map your objects straight to your database, and performance wise I believe play can handle around 4 times the throughput on a simple application like this, possibly even more on a larger more complex web app.</p>
		      
	      ]]></description>
			<pubDate>Sun, 22 Jan 2012 17:29:37 +0000</pubDate>
        </item>
            <item>
          <title>2012 is full of goals</title>
          <link>http://phawk.co.uk/journal/post/2012-is-full-of-goals</link>
          <guid>http://phawk.co.uk/journal/post/2012-is-full-of-goals</guid>

          <description><![CDATA[
		      		      <h2 id="abriefreviewof2011">A brief review of 2011</h2>

<p>As this is the first time setting goals to measure myself against next year, I don&#8217;t really have anything tangible to measure against from the start of 2011. </p>

<p>The one thing I have accomplished though is getting a lot more into development. I started out from an early age as a web designer, got around 5 years commercial experience under my belt and then in mid 2010 after starting a fantastic job at <a href="http://craftydevil.co.uk">Crafty Devil</a> I started to learn more about development, starting with PHP and <a href="http://codeigniter.com">Codeigniter</a>. </p>

<p>I enjoyed every minute writing code, even though my code wasn&#8217;t anything special for the first 3-6months. 
Slowly I started to realise my passion for design disipating, I was growing rapidly in love with coding. I still have a strong appreciation for great design and tasty looking apps, but my heart has changed, I now can&#8217;t wait to grab the laptop and learn something new about programming, systems or performance, gone are the days spent culminating over single pixel adjustments in photoshop and moving grid lines a few micro pixels in illustrator.</p>

<p>I think I possibly should have been a developer all along, I always struggled profusely with artistic creativity and really treated design as a logical process, which is why most of my designs probably lacked that delight factor all these years. 
Through education my strong points where always math, ICT, business and accounting which makes sense why I enjoy figuring out how things work and taking complex problems and coming up with an efficient solution.</p>

<h3 id="summingup2011">Summing up 2011</h3>

<p>The past year has been a very educational one for me, learning new things daily and vastly growing my skills as a developer. I have got a real passion for what I do and always striving to learn more.</p>

<p>It has been a great help to be surrounded by other talented and wise developers both in <a href="http://craftydevil.co.uk">Crafty Devil</a> and in the local community, to provide help, alternate solutions and share articles, thoughts and ideas. I love this industry!</p>

<h2 id="lookingforward">Looking forward</h2>

<p>Without setting realistic goals, next year I&#8217;ll have nothing to measure my personal progress against. I have never made any resolutions or long term personal goals before, soon to be 25, I think it&#8217;s time I started.</p>

<p>The goals I have for 2012 are reasonably specific, and I&#8217;ll explain them in a little more detail below.</p>

<ul>
<li>Contribute to open source projects</li>
<li>Write at least 2 quality blog posts per month</li>
<li>Launch and validate 2 apps</li>
<li>Build a native iPhone or Mac app and have it in the app store</li>
<li>Build either a native android or windows phone app and have it in the marketplace</li>
</ul>

<h3 id="contributetoopensourceprojects">Contribute to open source projects</h3>

<p>In my day to day work I use a ridiculously high amount of open source software, and up until two weeks ago, I have never contributed anything to an open source project. Sure I&#8217;ve shared a fair amount of code on <a href="https://github.com/peteyhawkins">Github</a>, but never contributed to a larger scale, more widely used project.</p>

<p>I&#8217;ve had this goal in mind for some time, but never measured against it, hopefully this will give me the push I need to make progress. </p>

<p>Last week I finally made my first <a href="https://github.com/lmcalpin/Play--Paginate/pull/11">public pull request on GitHub</a> to a <a href="https://github.com/lmcalpin/Play--Paginate">Pagination module</a> for Play Framework. I&#8217;m definitely not bragging about this, the only 1 word that changed in the diff was a css class in the view file, but it&#8217;s a start, a very small start which gave me a bit of a moral boost getting that first pull request accepted. </p>

<p>Hopefully I&#8217;ll continue to contribute more to projects that I actively use, such as <a href="http://codeigniter.com/">Codeigniter</a> and <a href="http://www.playframework.org/">Play Framework</a>.</p>

<h3 id="writeatleasttwoqualityblogpostsamonth">Write at least two quality blog posts a month</h3>

<p>This goal doesn&#8217;t look too hard to accomplish, but the main problem I always struggle with here is quality. I&#8217;ll spend an hour writing a draft post and 10minutes later after a rapid spell check, it&#8217;s live on my blog. I then have another read and find some phrase of text that barely translates to human readable english, then goes the mad scramble to change it round before one of my few twitter followers visits the page.</p>

<p>To accomplish this goal and write quality posts I know I need to set more time aside for editing, spending an hour writing a draft post is only the start.</p>

<p>I need to fire a few more hours towards making articles coherant. I have always struggled with writing, rushing things out because I don&#8217;t enjoy reading over my own work, we&#8217;ll see how this goes.</p>

<h3 id="launchandvalidate2apps">Launch and validate 2 apps</h3>

<p>Over the past two years since I have &#8220;become&#8221; a developer I&#8217;ve come up with some class ideas (at least I think so anyway),  started building them and for whatever reason, moved onto something else, leaving these projects stagnant.</p>

<p>I need to take an idea from start to finish, finish being a product launched to beta to validate whether it can work and also whether it can make money. </p>

<p>In 2011 I&#8217;ve got the closest I ever have to validation, I had a product almost ready for alpha testing, when I decided to ditch the code and rewrite it based off an API. I doubt I made the correct descision as by now I probably could have validated the idea amongst a few hundred target users.</p>

<h3 id="buildanativeiphoneormacappandhaveitintheappstore">Build a native iPhone or Mac app and have it in the app store</h3>

<p>Having looked at Cocoa touch around 4 separate times last year, I still really want to make an iPhone or Mac app that I can launch into the app store. Sure I&#8217;ve launched a phone gap and appcelerator titanium iPhone app into the app store through work, though it&#8217;s not quite the same as having a native app in there.</p>

<p>In 2011 I built my first native Mac app, it was a very basic monthly compound interest calculator for my father and really a simple primer on using Objective-C.</p>

<p>I didn&#8217;t seem to have any problems understanding or writting Objective-C, the main issue I have is hooking the code up to the interface and making the interface do fancy stuff. </p>

<p>Having mainly done web development up to this point and not coming from a Computer Science university background, I&#8217;ve never made a desktop app, and I suppose once you get into this way of working, a lot of the knowledge will carry through to other platforms.</p>

<h3 id="buildeitheranativeandroidorwindowsphone7appandhaveitinthemarketplace">Build either a native android or windows phone 7 app and have it in the marketplace</h3>

<p>I&#8217;m also very keen to look at the other side of the fence and develop either a windows phone or android application, and have something to compare against iOS and possibly consider which type of mobile app development I&#8217;d like to specialise in, if any.</p>

<p>I&#8217;m not sure which I&#8217;ll be attracted to yet, I&#8217;m currently using Java and probably going to be using it a lot more with <a href="http://www.playframework.org/">Play Framework</a>, that may help with writing an android app, but I usually don&#8217;t go with the easy option, so I may well get to do a bit of C# this year.</p>

<h2 id="credits">Credits</h2>

<p>Have to credit our <a href="http://craftydevil.co.uk">Crafty Devil</a> quarterly retreat in which we were asked to think about our goals for the year and spend 5minutes talking about them. There are probably a few extra ones in here than I spoke about at the meeting, but having more time for these to lament in my mind has helped a lot as to what my goals should be.</p>

<p>Also have to credit <a href="http://swanson.github.com/">Matt Swanson</a> for posting his <a href="http://swanson.github.com/blog/2011/12/26/one-developer-year-in-review-2011.html">developer year in review</a>, this post made me see the value in posting your goals on your blog and then being able to measure them year on year.</p>
		      
	      ]]></description>
			<pubDate>Sun, 15 Jan 2012 11:24:57 +0000</pubDate>
        </item>
            <item>
          <title>Recursive closures in PHP</title>
          <link>http://phawk.co.uk/journal/post/recursive-closures-in-php</link>
          <guid>http://phawk.co.uk/journal/post/recursive-closures-in-php</guid>

          <description><![CDATA[
		      		      <p>Being quite a JavaScript aficionado, I am used to and quite like functional programming, I finally got the opportunity to use a <a href="http://php.net/manual/en/functions.anonymous.php">closure in PHP</a>, a recursive one at that.</p>

<h3>Is there a benefit to using closures?</h3>

<p>To be honest from the PHP code I write, which is usually in <a href="http://codeigniter.com/">codeigniter</a> and thus always inside the scope of an object, using recursive closures doesn&apos;t really bring a huge benefit. In actual fact I find using them might lead to a bit of a disadvantage when it comes to writing DRY software.</p>

<h3>What does it look like?</h3>

<script src="https://gist.github.com/1611175.js?file=PHP%20Recursive%20Closures"></script>

<p>For a closure to be able to call itself through recursion, you have to pass the closure to itself by reference as your variables would not normally exist in the function scope.</p>

<h3>Thoughts</h3>

<p>I don&apos;t think I&apos;m suddenly going to go haywire for anonymous functions in PHP, I doubt that it helps with writing maintainable easy to understand code, but I think it&apos;s pretty cool at the same time and hopefully I&apos;ll find a valid use case for them someday.</p>
		      
	      ]]></description>
			<pubDate>Fri, 06 Jan 2012 22:46:30 +0000</pubDate>
        </item>
            <item>
          <title>Trying Play! Framework</title>
          <link>http://phawk.co.uk/journal/post/trying-play-framework</link>
          <guid>http://phawk.co.uk/journal/post/trying-play-framework</guid>

          <description><![CDATA[
		      		      <p>Over the Christmas break I&#8217;ve been trying out <a href="http://www.playframework.org">Play! Framework</a> using java. I really like it, so much so that I&#8217;ve not only written an article, but rewritten my blog to run on play.</p>

<h2 id="whatisit">What is it?</h2>

<h3 id="overview">Overview</h3>

<p>Play is a reasonably new web framework based on the java language. It uses model view controller as a base for structuring your applications, but also has a few other neat tools to break down your code into a few extra layers, to hopefully acheive logic-less templates.</p>

<h3 id="domainpersistence">Domain persistence</h3>

<p>Play uses some very powerful and mature java librarys for the persistence of your objects, JPA and hibernate. Migrations aren&#8217;t really neccessary, or so it seems from my experience of using play. Many to Many mapping is just as simple as using Rails and one to one and one to many is a gift.</p>

<h3 id="rest">REST</h3>

<p>All of the routing takes the HTTP methods GET, POST, PUT and DELETE, so you can really built RESTFul applications, all of the routing also supports content types, so urls with different formats (.xml, .json) can link to different view files automatically, or even different methods if you so wish.</p>

<h3 id="modulespackagemanagement">Modules / Package management</h3>

<p>The controllers and models within Play are full java classes so you can really accomplish powerful things and have access to thousands of Java libraries and modules.</p>

<p>You can autoload Jar files by placing them in the lib directory, use maven2 repositories in your dependecies.yml file and even roll your own <a href="http://www.playframework.org/modules">modules</a> and contribute them to the community.</p>

<h3 id="testing">Testing</h3>

<p>Testing seems like a very large part of the framework, especially if you run through the tutorial. JUnit is built in for unit testing and functional testing, it has direct access to your controllers along with Selenium for front end browser testing.</p>

<h2 id="mythoughts">My thoughts</h2>

<p>I have just rewritten my personal blog in play to get to grips with the framework and see on a small scale how well it works.</p>

<p>A lot of plays inspiration has come from rails along with many other frameworks of late, though play just seems to do it better. I love the RESTful routing, domain persistence and the template system, particularly with plays template syntax it really discourages writing logic into your views.</p>

<h3 id="routing">Routing</h3>

<p>One thing I find I am using a lot more in play is the routing, compared to codeigniter where I would rarely touch the routes file, in play it seems to be central to setting up pretty urls and a RESTful application.</p>

<p>I quite like adding in the routes and having the control over the gateways into my application. This custom routing has also made it extremely easy to keep the same urls as my codeigniter site previously used and shouldn&#8217;t affect my ranking with google.</p>

<h3 id="modules">Modules</h3>

<p>Modules are very easy to install with play, and don&#8217;t install 1001 different documentation files (<em>cough</em> ruby gems <em>cough</em>).</p>

<p>I haven&#8217;t written a module yet, I&#8217;m sure it won&#8217;t be too long before I contribute some code to the play community. One very nice thing with the modules is that they technically symlink into your own applications files, so when creating a module, you can make controllers, views, models or whatever sort of file you want. </p>

<p>One of the downsides with most other frameworks I&#8217;ve used, modules aren&#8217;t MVC, they are almost libraries and for things like REST Controllers and oauth providers where there should be models and contollers, they are hacked into libraries and don&#8217;t quite feel right, so plays integration gets a big plus from me.</p>

<h3 id="formvalidation">Form validation</h3>

<p>I am either a fan of codeigniters form validation class, or just got so used to it that everything else feels alien, play was no exception and at first took a little getting used to, though it makes a lot more sense now and really helps you to break down the logic of your forms into smaller chunks, it is definately growing on me.</p>

<p>Basic validation is very simple to do and can be integrated with anotations to keep your code very short. Error objects are automatically setup with form errors and messages etc and passed to the view file automatically which is always nice.</p>

<h3 id="objectpersistence">Object Persistence</h3>

<p>When rewriting my blog on play I literally just entered details to my mysql DB and haven&#8217;t even nearly written SQL, this was a very smooth experience and just as good if not better than Rails ActiveRecord/ActiveModel when looking at it previously.</p>

<p>The one extra touch that might not work in a multi-developer enviornment, but worked here for me, I didn&#8217;t have to write a single migration, run a migration or anything, JPA and hibernate just did everything for me, I was very impressed with this.</p>

<p>For larger projects or those with many developers play does have evolution migrations, I just don&#8217;t know if I will need to use them or not.</p>

<h3 id="deployments">Deployments</h3>

<p>Play has many <a href="http://www2.playframework.org/documentation/1.2/deployment">deployment options</a> though for ease of updating files on the fly I chose to install play on my server and run the site throught the command <code>play start</code>.</p>

<p>I found this very easy to setup and if you have mod_proxy installed for apache you can easily remap your domain from a virtual host to http://localhost:9000 for play. Below is the apache vhost that I used.</p>

<script src="https://gist.github.com/1611181.js?file=apache-proxy"></script>

<h2 id="conclusion">Conclusion</h2>

<p>From what I have used so far, I love play framework! I will definately be using it in future projects where I can over codeigniter and PHP.</p>

<p>If you&#8217;ve ever wanted to give play a go, knuckle down and just do it!</p>

<p><em>Edit:</em> I&#8217;ve just broke and deleted my entire database when making some changes to the site, from reading an article it recommended setting a particular variable in plays application config file which I think was the problem. It was designed to only allow create operations on the database in production mode and not allow any deletion, though somehow when restarting play, my entire database wiped clean. </p>

<p>I will look into this issue further and post up my solution. Thankfully I didn&#8217;t really lose anything!</p>

<pre>
%prod.jpa.ddl=create
</pre>
		      
	      ]]></description>
			<pubDate>Wed, 04 Jan 2012 20:10:24 +0000</pubDate>
        </item>
            <item>
          <title>Updated Codeigniter template</title>
          <link>http://phawk.co.uk/journal/post/updated_codeigniter_template</link>
          <guid>http://phawk.co.uk/journal/post/updated_codeigniter_template</guid>

          <description><![CDATA[
		      		      <p>
 I decided a couple of weeks ago to start putting the new things I&rsquo;ve learnt over the past six months into <a href="https://github.com/peteyhawkins/CI-Template">my codeigniter template</a> on github. This is mainly for my own use when starting each new project to be able to clone, but it&rsquo;s in a public repository and it might be useful for others to take it as a starting point as well.</p>
<h2>
 Goals</h2>
<p>
 The goals I set out when putting this template together were a combination of two main things, Boilerplate code to help you start out with a solid structure and common app setup code that you will usually rewrite every time. Alongside these I have altered some of the default settings of the framework to tighten security and aid with rapid development.</p>
<h3>
 Boilerplate code to keep things well structured from the beginning of a project</h3>
<p>
 The boilerplate code put together is a combination of things I have learned from dealing with small - medium sized web applications over the past 18 months. I started out with the common areas of a site that could end up pieced together badly if not done right from the start. One of the main issues with a streamlined constantly changing web application can be user authentication and access control, with some layered abstract inheritance in the MY_Controller we can help structure the application to leave a bit of breathing room to split access up into 3 or 4 main categories and share standard functionality between these areas. One thing a lot of small web applications lack is a unified error reporting system, for during development and to log errors whilst the project is in a production environment. The use of Exceptions is a must throughout the system for true error handling and stack trace abilities.</p>
<h3>
 Common application setup code</h3>
<p>
 Similar to boilerplate code in a way is the common things that you setup on each web application, which would be a lot quicker to strip out for the apps that don&rsquo;t need it, than to add it in for the ones that do. Various things have been added to this install including a template library, bcrypt library for password hashing and a basic user model and authentication pages (login, register etc).</p>
<h2>
 User Authentication</h2>
<p>
 Nearly all web apps will need some for of user authentication, whether it&rsquo;s for the site owner to login, or for users to signup and use the application. With this in mind, it doesn&rsquo;t make sense to rewrite a proven secure login system on every application you develop.</p>
<h3>
 Secure password hashes</h3>
<p>
 With the bcrypt library in place you can easily generate fairly secure passwords, certainly a lot better than sha1 or md5 could accomplish. <a href="http://blog.ircmaxell.com/2011/08/rainbow-table-is-dead.html">More information on why you should use bcrypt for your hashes.</a></p>
<p>
 In short Bcrypt has been around for some time, attracted a lot of attention and yet still remains uncracked. The major benefit though is that you can tweak the amount of cycles of crypt, the more cycles, the stronger the hash. Bear in mind though this will have a detrimental effect on performance.</p>
<h3>
 MY Controller</h3>
<p>
 All of the controllers within the site will inherit a custom controller. With this setup there are 4 different controllers to choose from as standard.</p>
<ul>
 <li>
  <strong>Base controller</strong> is the barebones controller where the shared methods and data is placed.</li>
 <li>
  <strong>Frontend controller</strong> is for any public facing front end site pages and thus doesn&rsquo;t require a login.</li>
 <li>
  <strong>App controller</strong> is for the users section of the application itself and requires any user trying to access a controller that inherits this to be logged in.</li>
 <li>
  <strong>Admin controller</strong> is for the owners administration section and will not only check for login, but also that the user has admin privileges.</li>
</ul>
<h2>
 Models</h2>
<p>
 For some applications that may not receive a large amount of traffic and thus don&rsquo;t need highly optimised querys, I personally wouldn&rsquo;t have a strong objection to using an ORM to help build rapid models&hellip; however for the most part I like to have things running super fast even if I will be the only user of the app. The custom MY Model takes care of the basic CRUD tasks and populates the model with data. When considering the data structure of the models I really wanted something that could directly be passed into json_encode to make dealing with JavaScript a lot easier, I therefore decided it was best to populate the models properties directly rather than have accessor methods for each instance variable and using <code>__call</code> to magically make get methods and set methods.</p>
<p>
 One thing I wanted to make sure though was the restriction of only setting and getting properties that exist in the defined array of fields in the models constructor. This will aid massively in some late night coding efforts when you might mistype a certain properties name. To accomplish this I made use of the <code>__get</code> and <code>_set</code> magic methods and checked if the objects property existed in the fields array.</p>
<h3>
 Built in methods</h3>
<ul>
 <li>
  <strong>populate</strong> will take a query row or stdClass object and populate each of the required fields with the data passed to it.</li>
 <li>
  <strong>add</strong> will insert a new object into the database</li>
 <li>
  <strong>update</strong> will do the same as add only specifying an ID to change data in.</li>
 <li>
  <strong>delete</strong> is the one to look out for, there are no warnings or easy undo&rsquo;s for deleting records, so just be careful you have the right confirmations in place.</li>
 <li>
  <strong>find</strong> will search for 1 particular record by the primary key and populate its object for you.</li>
 <li>
  <strong>find_where</strong> has to be a little more complex because multiple entries could be returned from the database call, therefore find_where shall just return an array of populated objects.</li>
</ul>
<h2>
 Error handling</h2>
<p>
 I have made all errors work through Exceptions with try, catch blocks. One handy and conventional route I decided to go down was to extend the Exceptions class for each model (User_model - line 34) to allow multiple catch blocks based on Exception type. If you haven&rsquo;t tried try catch and exceptions, I thoroughly recommend it, you will be able to debug your application a lot easier.</p>
<p>
 For my general purpose needs I am quite pleased with this implementation and think it will help with rapid development on most projects.</p>
<h2>
 Wrapping up</h2>
<p>
 I hope this is an inciteful overview of my default <a href="https://github.com/peteyhawkins/CI-Template">codeigniter setup</a> and for those who are new to the framework might provide some inspiration. Leave any comments below on other tips or things you usually find yourself implementing in codeigniter (or whatever other framework you use).</p>
<h3>
 <a href="https://github.com/peteyhawkins/CI-Template">View on github</a></h3>

		      
	      ]]></description>
			<pubDate>Sat, 29 Oct 2011 09:54:16 +0100</pubDate>
        </item>
            <item>
          <title>baseless</title>
          <link>http://phawk.co.uk/journal/post/baseless</link>
          <guid>http://phawk.co.uk/journal/post/baseless</guid>

          <description><![CDATA[
		      		      <h2>
 Simple css styles for type, lists and forms.</h2>
<p>
 I have started a little project called <a href="http://phawk.co.uk/baseless/">baseless</a> (Base styles using the less css framework).Baseless is designed to help developers (and designers) in prototyping web apps and web sites.</p>
<p>
 This is by no means an alternative to a grid system or boilerplate, baseless simply provides basic styling for common elements to help your prototypes easier and not look painful.</p>
<p>
 You can view the <a href="http://phawk.co.uk/baseless/">micro site for baseless</a>, or jump straight to the <a href="https://github.com/peteyhawkins/baseless">source code</a>.</p>

		      
	      ]]></description>
			<pubDate>Tue, 27 Sep 2011 20:02:07 +0100</pubDate>
        </item>
            <item>
          <title>The real-time web is here</title>
          <link>http://phawk.co.uk/journal/post/the_real-time_web_is_here</link>
          <guid>http://phawk.co.uk/journal/post/the_real-time_web_is_here</guid>

          <description><![CDATA[
		      		      <p>
 I&#39;ve been looking at web sockets this evening and building a <a href="http://phawk.co.uk/chat/">proof of concept</a> to see how easy these new technologies are. <a href="http://socket.io">socket.io</a> is something I&#39;ve been meaning to look at for months, it provides client -&gt; server sockets on web pages and falls back to using other methods for browsers that don&#39;t support this new technology.</p>
<p>
 Although very much still in its infancy node.js and its various modules are very much ready for production enviornments. The new things that can be accomplished with these technologies haven&#39;t even been comprehended yet, and as we pass into the next couple of years of web design and development, I very doubt the highlight we&#39;ll look back on and remember is the web becoming responsive (as much as I appreciate responsive design, it&#39;s small in comparison to whats now possible using sockets).</p>
<p>
 Near real time communication is now very easy to accomplish.</p>
<p>
 Have a look at the <a href="http://phawk.co.uk/chat/">demo of the chat app</a> I put together, or <a href="https://github.com/peteyhawkins/socket-chat">view the source code</a>.</p>

		      
	      ]]></description>
			<pubDate>Sat, 17 Sep 2011 22:46:41 +0100</pubDate>
        </item>
            <item>
          <title>What's up buddy?</title>
          <link>http://phawk.co.uk/journal/post/whats_up</link>
          <guid>http://phawk.co.uk/journal/post/whats_up</guid>

          <description><![CDATA[
		      		      <p>
 I haven&#39;t posted anything up here frequently lately, despite me looking at a lot of cool stuff. So I guess this post is a small catchup of some of the cool things I&#39;ve been learning and coding up.</p>
<h2>
 Objective-C</h2>
<p>
 First up, and most recently, I ventured into xcode and started writing an Objective-C Mac app. My dad needed a basic monthly compound interest calculator, so I thought I&#39;d kill two birds with one stone and try learning Obj-C while making something basic for my dad to use.</p>
<p>
 Asides from doing the old hello world tutorial several months ago, I have had no experience with Objective-C or desktop programming so it was a very interesting step forward into the unknown for me.</p>
<h3>
 The two main things that took a little bit to comprehend were:</h3>
<ul>
 <li>
  Linking code up to the interface, although this actually turned out to be really easy once I figured out how it was done</li>
 <li>
  Memory allocation and releasing. I still dont know enough on the theory of this topic to know exactly what to do about memory management. I just know what I have done works and didn&#39;t show up any errors in the IDE, I think I will need to research a lot more on this topic.</li>
</ul>
<p>
 You can download the source xcode project for my little <a href="https://github.com/peteyhawkins/Compound-Calculator">compound calculator app on github</a> and take a peek. If you are an experience Obj-C developer, please do point out any flaws in the code to me, I would very much appreciate it.</p>
<h2>
 Up next is node.js</h2>
<p>
 Over the past 6 months or so my JavaScript skill has improved tremendously, and I have somewhat of an affection for the language, especially considering its history. I love having a play with new technologies and node.js is certainly one of them. For my first exposure to node I put together a very quick and <a href="https://github.com/peteyhawkins/Node-Svr">simple static file web server</a>.</p>
<h2>
 Last but not least is Ruby</h2>
<p>
 As you may know I prominently program in php for everyday web development, though looking at some of the features that Ruby on Rails has to offer, I have to give it a chance to change my mind. I&#39;ve been trying to learn bits and pieces over the last 6 months, but with this being so disjointed I haven&#39;t really learnt anything substantial, so I thought it time to knuckle down and give Ruby on Rails a proper go.</p>
<p>
 First up from remembering some things about the ruby syntax from my brief exposures I went ahead and fired up a quick <a href="https://github.com/peteyhawkins/Rails-url-shortener">rails URL shortener</a> (I know, how original!).</p>
<p>
 This then led me to realise that I do in fact need to spend more time on ruby specific syntax stuff, so running through the <a href="http://rubykoans.com/">ruby koans</a> did me a world of good. I shall try to think of a more substantial project to undertake in Rails soon, and no doubt will share my experiences back here.</p>

		      
	      ]]></description>
			<pubDate>Thu, 15 Sep 2011 10:19:50 +0100</pubDate>
        </item>
            <item>
          <title>Thoughts on Lion</title>
          <link>http://phawk.co.uk/journal/post/thoughts_on_lion</link>
          <guid>http://phawk.co.uk/journal/post/thoughts_on_lion</guid>

          <description><![CDATA[
		      		      <p>
 I&#39;ve been using a Macbook Pro now as my primary computer since September 2010, using snow leopard from the start and moving onto Lion as soon as it became available.</p>
<p>
 I&#39;ll briefly outline my thoughts on the move to the new operating system for those who haven&#39; tried or are wondering if it is worth the move.</p>
<h3>
 General stability / issues</h3>
<p>
 Apart from a few apps not working on lion, I&#39;ve had no issues at all with running Apples new operating system, in fact theres one issue that I was having with Snow Leopard which has now vanished. I was having a mysterious graphics card freeze up when playing long flash based TV shows from BBC iplayer, this has disappeared with the install of the new O/S.</p>
<h3>
 App Support</h3>
<p>
 With the new operating system I suspected some apps would have glitches, it&#39;s definitely something to be spotted when moving to the latest Microsoft product. The only real quarrels I had were with my two text editors, mac rabbits espresso and panics coda, the developers did a good job and patches were released within a week or so to sort out all the bugs. Every other app worked pretty much 100%, I can&#39;t recall or just didn&#39;t notice any other bugs in other applications that I use.</p>
<h3>
 New features</h3>
<p>
 On Snow Leopard I was big fan of expose for switching between currently open apps. With Lion comes the new mission control, it has received a lot of tweaks and updates, this feature has just gone from awesome, to outstanding!</p>
<p>
 Resume is a delightful feature that opens up all your applications how they were before you turned off or restarted your machine, I like this, but quite often when I am turning off the computer I&#39;ll be closing down everything and wanting to start afresh in a new day. That said, it really does come in handy for restarting due to a software update.</p>
<p>
 In the same train of thought as resume, comes versions, suspiciously named the same as one of panic&#39;s version control systems. This I have to say confused me a little when trying to &#39;Save as..&#39; a document I was working on and feeling a little lost and not knowing what to do instead, the idea is nice, but implementation could have been a little more user friendly.</p>
<p>
 Full screen apps are a delight when using the 13&quot; screen on the MBP though I don&#39;t find myself using them when I have my 26&quot; display hooked up.</p>
<h3>
 Inverse scrolling</h3>
<p>
 I had tried to prepare myself in advance for this by inverting the mouse scrolling in snow leopard, and as much as it took about a week to get fully used to the idea, I really like it now, it makes sense. The one thing I would point out however is, if you use another O/S like windows or linux a lot, I&#39;d maybe stick with the normal scrolling for now, or try and implement inverse scrolling on these platforms too, as it could get very confusing.</p>
<h3>
 Multitouch gestures</h3>
<p>
 And finally I have one thing that pissed me off a little, the gestures had been changed by default on Lion, anything that was 3 fingers left or right on Snow Leopard had now become 4 fingers, and replaced the more simple gesture for switching between desktops... really!? I am more likely to flick to my next desktop than do something like navigation back a page in my web browser? I switched back the gestures in the trackpad settings almost immediately, but this default setting just didn&#39;t make sense.</p>
<h2>
 Conclusion</h2>
<p>
 Theres many other hidden features under the surface such as random memory allocation for each of your applications that make Lion a lot more secure, but looking at the face value of this upgrade I think it&#39;s a few really quirky tweaks to still what I perceive to be the #1 O/S on the market today. It&#39;s definitely not a 100% overhaul, but it never needed to be, Apple has improved upon a leading product and you can&#39;t complain really for &pound;20.99.</p>
<p>
 Comparing the scale of updates included in Apples new O/S to how Microsoft do things is crazy, a new version of windows is released which is completed different to the old one, you have to re-learn how to use it and get stung over &pound;100 in the process, Apple keeps the same great user interface and ease of use, throws in a few new features and helps you make use of these over time, without disrupting your current workflow to learn how to use your computer again.</p>

		      
	      ]]></description>
			<pubDate>Sun, 04 Sep 2011 00:16:49 +0100</pubDate>
        </item>
            <item>
          <title>Google Maps JavaScript Library</title>
          <link>http://phawk.co.uk/journal/post/google_maps_javascript_library</link>
          <guid>http://phawk.co.uk/journal/post/google_maps_javascript_library</guid>

          <description><![CDATA[
		      		      <p>
 I was having a wee play about with Google Maps v3 Javascript API and decided to write up a simple js library.</p>
<p>
 The library by no means does anything advanced, but it will allow you to fire together quick maps in the future for contact pages or other simple solutions.</p>
<p>
 All <a href="https://github.com/peteyhawkins/Google-Maps-JS-Library">code is available on github</a> and you can tweak / reuse as you like.</p>

		      
	      ]]></description>
			<pubDate>Sat, 23 Jul 2011 15:35:12 +0100</pubDate>
        </item>
            <item>
          <title>Simple PHP Contact Form Library</title>
          <link>http://phawk.co.uk/journal/post/simple_php_contact_form_library</link>
          <guid>http://phawk.co.uk/journal/post/simple_php_contact_form_library</guid>

          <description><![CDATA[
		      		      <p>
 Ever had to make a quick contact form on PHP site that&rsquo;s not using a framework or doesn&rsquo;t have contact form stuff built in? Well I got fed up of doing just that. The last time I had to make a PHP contact form I put a little bit more effort into making it reusable and bam we have this little library.</p>
<p>
 You will find the <a href="https://github.com/peteyhawkins/php-Contact-Form">code freely available on github</a>.</p>
<p>
 Let me know if it turns out useful, or equally if there are massive flaws in it, since I still am a little new to this development game.</p>

		      
	      ]]></description>
			<pubDate>Sun, 26 Jun 2011 19:49:19 +0100</pubDate>
        </item>
            <item>
          <title>The importance of working on large scale web projects</title>
          <link>http://phawk.co.uk/journal/post/the_importance_of_working_on_large_scale_web_projects</link>
          <guid>http://phawk.co.uk/journal/post/the_importance_of_working_on_large_scale_web_projects</guid>

          <description><![CDATA[
		      		      <p>
 As you may or may not know, I work for Crafty Devil, a web applications design company based in Belfast. We have a pet project (turning into a very large one :) ) <a href="http://planzai.com">Planzai</a>. Working on Planzai is one of the most exciting things to do, and here&#39;s why.</p>
<p>
 When you work on a large scale web app, you&#39;re never done with a particular feature or UI. We are constantly seeking to improve our core features, making them easier to use, more efficient on the server, using finer code for great readability and security. Every time you have major editions to a particular section, you focus on improving the rest of that feature as it looks dated and as your skills and knowledge improve.</p>
<p>
 One main example in my case has to be JavaScript. I am constantly learning more about the language, and the more I use it, the more I love it. If used correctly JavaScript is an extremely powerful language and its features (such as closures and everything being an object, even functions) have insanely creative uses. I cringe when I look over the javascript I wrote 3 months ago, never mind 18months ago. Coming back and re-developing old features is delightful when you can improve what you did 18months ago by almost 3x efficiency, less code, more inheritance and more reusable libraries.</p>
<p>
 Spotting improvement in yourself by these standards says a lot about the team and the approach to learning and development in your company.</p>
<p>
 Each day has its new challenges and that&#39;s what I love. If your still working away making 4 page websites, make a little time for an application or larger scale project, you will learn a lot!</p>

		      
	      ]]></description>
			<pubDate>Thu, 16 Jun 2011 22:31:42 +0100</pubDate>
        </item>
            <item>
          <title>Automatic template rendering with codeigniter</title>
          <link>http://phawk.co.uk/journal/post/automatic_template_rendering_with_codeigniter</link>
          <guid>http://phawk.co.uk/journal/post/automatic_template_rendering_with_codeigniter</guid>

          <description><![CDATA[
		      		      <p>
 From a conversation I had with another developer I work with today, just thought I&#39;d mock this up real quick and share it.<br />
 This will save you a little time writing out your template view rendering stuff. If your prepared to be organised and have some naming conventions for your views.</p>
<p>
 Very simple to implement with php5&#39;s new __destruct magic method. You can easily override the location of a certain view file if it doesn&#39;t match your naming convention:</p>
<blockquote>
 <p>
  /views/[controller]/[method].php</p>
</blockquote>
<h2>
 MY_Controller.php</h2>
<script src="https://gist.github.com/1611188.js?file=my-controller"></script>

<p>
 As you can see, there are a couple of instance variables to hold a) the data being sent to the view and b) the view_path override.</p>
<p>
 The main thing you want to pay attention to is the <strong>render</strong> method. This is what is called on __destruct. If your using standard views or a different template library other than <a href="http://williamsconcepts.com/ci/codeigniter/libraries/template/reference.html">williamsconcepts</a>. You will want to edit this slightly.</p>
<h2>
 Your Controllers</h2>
<script src="https://gist.github.com/1611194.js?file=your-controller"></script>
<p>
 Rather basic setup, add in your destructor method. Also if you need to override there is a quick example.</p>

		      
	      ]]></description>
			<pubDate>Thu, 19 May 2011 19:22:35 +0100</pubDate>
        </item>
            <item>
          <title>An email from Sony PSN</title>
          <link>http://phawk.co.uk/journal/post/an_email_from_sony_psn</link>
          <guid>http://phawk.co.uk/journal/post/an_email_from_sony_psn</guid>

          <description><![CDATA[
		      		      <p>
 For any of you who didn&#39;t get an email or want to know more about what sony is saying to their customers.</p>
<blockquote>
 <p>
  Valued PlayStation Network/Qriocity Customer:</p>
 <p>
  We have discovered that between April 17 and April 19, 2011, certain PlayStation Network and Qriocity service user account information was compromised in connection with an illegal and unauthorized intrusion into our network. In response to this intrusion, we have:</p>
 <ol>
  <li>
   Temporarily turned off PlayStation Network and Qriocity services;</li>
  <li>
   Engaged an outside, recognized security firm to conduct a full and complete investigation into what happened; and</li>
  <li>
   Quickly taken steps to enhance security and strengthen our network infrastructure by re-building our system to provide you with greater protection of your personal information.</li>
 </ol>
 <p>
  We greatly appreciate your patience, understanding and goodwill as we do whatever it takes to resolve these issues as quickly and efficiently as practicable.</p>
 <p>
  Although we are still investigating the details of this incident, we believe that an unauthorized person has obtained the following information that you provided: name, address (city, state/province, zip or postal code), country, email address, birthdate, PlayStation Network/Qriocity password and login, and handle/PSN online ID. It is also possible that your profile data, including purchase history and billing address (city, state, zip), and your PlayStation Network/Qriocity password security answers may have been obtained. If you have authorized a sub-account for your dependent, the same data with respect to your dependent may have been obtained. While there is no evidence that credit card data was taken at this time, we cannot rule out the possibility.&nbsp; If you have provided your credit card data through PlayStation Network or Qriocity, to be on the safe side we are advising you that your credit card number (excluding security code) and expiration date may have been obtained.</p>
 <p>
  For your security, we encourage you to be especially aware of email, telephone, and postal mail scams that ask for personal or sensitive information. Sony will not contact you in any way, including by email, asking for your credit card number, social security, tax identification or similar number or other personally identifiable information. If you are asked for this information, you can be confident Sony is not the entity asking.&nbsp; When the PlayStation Network and Qriocity services are fully restored, we strongly recommend that you log on and change your password.&nbsp; Additionally, if you use your PlayStation Network or Qriocity user name or password for other unrelated services or accounts, we strongly recommend that you change them, as well.</p>
 <p>
  To protect against possible identity theft or other financial loss, we encourage you to remain vigilant to review your account statements and to monitor your credit or similar types of reports.</p>
 <p>
  We thank you for your patience as we complete our investigation of this incident, and we regret any inconvenience.&nbsp; Our teams are working around the clock on this, and services will be restored as soon as possible. Sony takes information protection very seriously and will continue to work to ensure that additional measures are taken to protect personally identifiable information. Providing quality and secure entertainment services to our customers is our utmost priority.&nbsp; Please contact us at www.eu.playstation.com/psnoutage should you have any additional questions.</p>
 <p>
  Sincerely,<br />
  Sony Network Entertainment and Sony Computer Entertainment Teams</p>
 <p>
  Sony Network Entertainment Europe Limited (formerly known as PlayStation Network Europe Limited) is a subsidiary of Sony Computer Entertainment Europe Limited the data controller for PlayStation Network/Qriocity personal data&nbsp;</p>
</blockquote>
<p>
 Quite frankly, it&#39;s a disgrace that sony are storing information like this in plain text. That is a major embarrassment for them, and probably why it took them so long to admit it.</p>
<p>
 There needs to be laws against this sort of thing, and more thorough enforcement to store peoples details.</p>

		      
	      ]]></description>
			<pubDate>Fri, 29 Apr 2011 17:35:09 +0100</pubDate>
        </item>
            <item>
          <title>Using Byword for content creation</title>
          <link>http://phawk.co.uk/journal/post/using_byword_for_content_creation</link>
          <guid>http://phawk.co.uk/journal/post/using_byword_for_content_creation</guid>

          <description><![CDATA[
		      		      <p>
 Started a new approach recently. Download <a href="http://itunes.apple.com/us/app/byword/id420212497?mt=12&ign-mpt=uo=4">Byword</a> from the mac app store, a truly minimal approach to writing. No complexities of formatting, colour, margins - Just type in the text, maybe fire a few headings in, and that&rsquo;s you!</p>
<p>
 Fullscreen mode lets you write away &rsquo;til your hearts content with nothing else on the screen getting in your way.</p>
<p>
 This may be useful to any of you who are writing content, particularly for the web, as you will get problems copy &amp; pasting from MS Word or Pages into most WYSIWYG web editors.</p>
<p>
 <a class="img" href="http://itunes.apple.com/us/app/byword/id420212497?mt=12&ign-mpt=uo=4"><img alt="Byword in action" src="/public/img/journal/byword/img.png" /></a></p>

		      
	      ]]></description>
			<pubDate>Sun, 10 Apr 2011 15:53:40 +0100</pubDate>
        </item>
            <item>
          <title>The tools that get the job done.</title>
          <link>http://phawk.co.uk/journal/post/the_tools_that_get_the_job_done</link>
          <guid>http://phawk.co.uk/journal/post/the_tools_that_get_the_job_done</guid>

          <description><![CDATA[
		      		      <h2>
 What&#39;s the job?</h2>
<p>
 As you may or may not know, I am a designer and developer working mainly with front-end UI or object oriented PHP.</p>
<p>
 My normal day to day tasks are writing html5, css3 and php, developing on a local server and then deploying through version control to dev, staging and production servers. One other critical point is using a graphics editing application / suite.</p>
<p>
 <a class="img" href="/public/img/journal/tools/desktop.jpg"><img alt="phawks Desktop" src="/public/img/journal/tools/desktop640.jpg" /></a></p>
<h2>
 Hardware</h2>
<p>
 I am currently using a 2011 13&rdquo; MacBook Pro. Spec&#39;s below:</p>
<ul>
 <li>
  2.3ghz core i5 CPU</li>
 <li>
  4gb DDR3 1333mhz memory</li>
 <li>
  128GB Crucial C300 SSD (355mb/s read, 275mb/s write)</li>
</ul>
<p>
 The Solid State Drive makes an unbelievable performance increase, the bottleneck of the hard drive is finally gone, and every app is opened immediately (minus Photoshop, which only under 3 seconds).</p>
<h2>
 Development</h2>
<p>
 For development I use a number of different applications.</p>
<h3>
 Mac Rabbit Espresso</h3>
<p>
 Espresso is one of the nicest looking mac editors, but lacks some features that other, more bulky editors have (Coda, with svn + ftp built in).</p>
<p>
 When I am coding my html5 and css3 I just want a box to type in, and to easily navigate the different files of my site. This keeps me focused and allows me to use other applications for svn / git / ftp / mysql.</p>
<h3>
 Kaleidoscope</h3>
<p>
 For file comparisons. Beautiful, simple and just works like a charm.</p>
<h3>
 Sequel Pro</h3>
<p>
 Despite the &#39;Pro&#39; name, this app is free, simple and a great alternative to navicat for browsing / editing and setting up your mysql databases.</p>
<h3>
 Transmit by Panic</h3>
<p>
 Without a doubt the best ftp application I have ever used. It&#39;s very good looking, easy to use and very fast and reliably at transfers.</p>
<h3>
 Cornerstone</h3>
<p>
 A great wee svn app, a little tricky to get used to if you&#39;ve never used svn before. Svn is terrible, but I have to use it for certain projects and cornerstone just makes it a lot more bearable.</p>
<h3>
 Terminal</h3>
<p>
 Good ole terminal and bash commands are used for git, configuring server stuff, ssh / scp to my servers and a whole host of other stuff.</p>
<h3>
 MAMP Pro</h3>
<p>
 Approx. 10x better than xampp or wamp if you have ever used them. Mamp takes care of setting up all your virtual host containers and manages your host file for you.</p>
<h2>
 Design</h2>
<h3>
 Adobe Creative Suite 5</h3>
<p>
 Mainly use Photoshop CS5 for graphics for web and mobile, while having Illustrator and InDesign around is never a bad thing if in the rare circumstances you need to look at doing some print work.</p>
<h3>
 Chrome / Safari</h3>
<p>
 I tend to do a lot of web applications design in the browser. I find it a lot quicker and easier to just start firing away with css, when you have to do wireframes first in most cases, this definitely cuts time out.</p>
<p>
 Tussling between Google Chrome and Safari right now is tough, using Safari mainly because of &#39;1 Password&#39; mentioned below.</p>
<h3>
 Rulers</h3>
<p>
 A little app with a lovely icon. Can be used to measure the width of anything on your screen, handy.</p>
<h2>
 Writing</h2>
<h3>
 Byword</h3>
<p>
 Completely stripped down app for writing, takes all distractions away and in full screen mode just helps you to focus 100% on the content.</p>
<h3>
 Pages</h3>
<p>
 Prefer it over MS word, and because you can purchase and install it separately o from iWork from the app store, that is the only app from iWork / Office on my mac.</p>
<h2>
 Media</h2>
<h3>
 Spotify (premium)</h3>
<p>
 I listen to nearly all of my music through spotify, both on the macbook and on my mobile.</p>
<h3>
 VLC</h3>
<p>
 Needed for all those wonderful HD videos I can download on the 40mb BT Infinity :)</p>
<h3>
 Airfoil</h3>
<p>
 To stream music from my Mac to my sony hi-fi connected to my Airport Express.</p>
<h2>
 Communication / RSS</h2>
<h3>
 Reeder</h3>
<p>
 When will the RC be over, I want to pay for reeder now, it&#39;s that good.</p>
<h3>
 Twitter</h3>
<p>
 The twitter app is pretty damn good and makes it easy to keep up with your stream throughout the day.</p>
<h3>
 Sparrow</h3>
<p>
 <strong>My favourite mac app so far!</strong> This just makes email enjoyable, with its twitter like interface, email has never been so simple.</p>
<h2>
 Anything else</h2>
<h3>
 Alfred</h3>
<p>
 A great alternative to spotlight, I have my spotlight search disabled, and alfred uses it&#39;s shortcut key. Custom searches, open Spotify tracks etc, delightful!</p>
<h3>
 1Password</h3>
<p>
 To manage all of my passwords, hosting details and personal web accounts.</p>
<h3>
 Homebrew</h3>
<p>
 A very simple package manager for OS X. Lightweight and easy to use. Very limited in your choice of repo&#39;s, but if all you use is git and wget, you&#39;ll be just fine.</p>
<h2>
 That&#39;s about the height of it.</h2>
<p>
 Any questions, comments or suggestions for other apps that you feel you couldn&#39;t cope without are very welcome.</p>

		      
	      ]]></description>
			<pubDate>Sun, 10 Apr 2011 14:59:37 +0100</pubDate>
        </item>
            <item>
          <title>Mac hardware, overpriced?</title>
          <link>http://phawk.co.uk/journal/post/mac_hardware_ovepriced</link>
          <guid>http://phawk.co.uk/journal/post/mac_hardware_ovepriced</guid>

          <description><![CDATA[
		      		      <p>
 There is always an awful lot of talk about how overpriced Apple&#39;s hardware is, I&#39;d like to clear up some of those concerns.</p>
<p>
 I may be a little biased towards Mac hardware as I now use a 13&quot; MacBook Pro as my main computer, however before this, I always custom built my own PCs, from my very first one, to my last.</p>
<p>
 The custom build market is pretty large among tech savvy enthusiasts and you can put together a mid-end machine at a very low cost. Unfortunately the same can&#39;t be done very easily with laptops, you have to pick a brand and a model an anything more than memory or hard disk upgrades can&#39;t be done easily.</p>
<h3>
 The MacBook Pro 13&quot;</h3>
<p>
 I&#39;d like to start out with my system specs and compare what a similar spec PC laptop would cost.</p>
<ul>
 <li>
  2.3ghz core i5 CPU</li>
 <li>
  4gb DDR3 ram 1333mhz</li>
 <li>
  Intel 3100 Pro HD Graphics</li>
 <li>
  13&quot; LED backlit display @ 1280x800</li>
 <li>
  250gb Hard Disk</li>
</ul>
<p>
 All in this badboy would cost you &pound;999, which seems like a lot of money for a laptop.</p>
<p>
 <img alt="MacBook Pro 13inch" src="/public/img/journal/mbp13hp/mbp.jpg" /></p>
<h3>
 HP Pavilion dm4-1101ea 14&quot;</h3>
<p>
 About the closest match I could find after a quick snoop around seemed to be this HP laptop.</p>
<ul>
 <li>
  2.4ghz core i5 CPU</li>
 <li>
  4gb DDR3 ram 800mhz</li>
 <li>
  Intel integrated graphics</li>
 <li>
  14&quot; 1366x768 LED backlit display</li>
 <li>
  320gb Hard Disk</li>
</ul>
<p>
 These specs are pretty close on the base hardware, and with the HP coming in at &pound;649.99, almost &pound;350 less than Mac, it&#39;s easy to see why people jump to the conclusion that Apple overprice their products.</p>
<p>
 <img alt="HP" src="/public/img/journal/mbp13hp/hp.jpg" /></p>
<h2>
 CPU Architecture</h2>
<p>
 The MacBook was one of the first laptops to get the revised version of Intels Sandybridge chipset technology. This new version (which the HP does not come with) runs faster, has more bandwidth and is more power efficient. Another huge advantage of this new architecture is the support for ThunderBolt.</p>
<p>
 ThunderBolt is a revolutionary new communications interface which can transfer at speeds of up to 10,000mb/s, compared to USB2 at approx 478mb/s this is insane.</p>
<p>
 With this in mind, the Mac is by no means outdated hardware, Apple launched this revision of their MacBook Pro range just 1 week after Intel announced they had fixed the problems with Sandybridge.</p>
<h2>
 Memory</h2>
<p>
 Apple has also been one of the first manufacturers to introduce the latest 1333mhz bus DDR3 memory,. Ram is often a constraint which other manufacturers impose in laptops, you will find most other laptops with DDR3 will only run at 800mhz, less than 2/3 of the speed.</p>
<h2>
 Graphics</h2>
<p>
 Unfortunately in the 13&quot; Mac model, the only graphics chipset on board is Intels. I have a late 2010 MacBook, which came with an nvidia 320m graphics chip, a good bit more powerful than the intel one currently shipped. This is due to the core i series processors from Intel are required to be tethered with an intel graphics chip. You&#39;ll be glad to hear the 15&quot; and 17&quot; MacBook models come with one of the latest ATI radeon graphics cards as well, due to the extra room to fit it in.</p>
<p>
 The HP in this case has a bigger disadvantage, the previous version of the core i chips, also had to be tethered to an intel gpu, however these first gen gpu&#39;s had a lot less power than the new models.</p>
<h2>
 Display</h2>
<p>
 The two laptops come with very similar display sizes and resolutions, however the screen on the MacBook gives a much higher brightness level and deeper more vibrant colours.</p>
<p>
 The other main advantage with the Apple MacBook is the sturdiness of the display, it does not twist when you tilt it back and forth from one side, does not shake if you bang your hand off the table and is almost half as thin as it&#39;s competitor.</p>
<h2>
 Build quality</h2>
<p>
 The MacBook, being made out of 1 single block of machined aluminum is of a standard you couldn&#39;t compete with. It feels entirely solid, unlike nearly all other PC laptops which are made out of cheap flimsy plastic.</p>
<p>
 Comparing trackpads is something that just can&#39;t be done either, the level of accuracy, smoothness and just the general feeling when you stroke the MacBooks trackpad is unbelievably good.</p>
<p>
 The level of detail on Apples products is really something else, unlike your standard PC power adapter, a black box with a plug that pushes into the laptop, apple really looked at the power adapter, the problems with fraying wires and came up with a great solution that just sticks (magnetically of course).</p>
<h2>
 Looks</h2>
<p>
 The hp is trying to take a leaf out of apples book, and if you were comparing it to other pc laptops, it would come out quite well.</p>
<p>
 What I really want to say though is, there is nothing made by any other manufacturer I have seen yet, that comes close to the Apple MacBooks. Nothing.</p>
<h2>
 Summary</h2>
<p>
 In all honesty, my MBP is my prize possession, it goes with me everywhere and I just can&#39;t compare it to any other laptop / desktop I&#39;ve ever owned / built.</p>
<p>
 In regards to the pricing aspect, for the build quality, spec, features and just how it all comes together, there is real value in owning a MacBook pro.</p>
<h3>
 Let me know your thoughts and if you agree / disagree.</h3>
<p>
 I may write an post up about the how I find the software comes into it, maybe a Windows 7 vs Snow Leopard vs ubuntu. Or maybe even the hardware and software I use on a regular basis for web design / development.</p>

		      
	      ]]></description>
			<pubDate>Fri, 08 Apr 2011 00:25:08 +0100</pubDate>
        </item>
            <item>
          <title>Basic model inheritance</title>
          <link>http://phawk.co.uk/journal/post/basic_model_inheritance</link>
          <guid>http://phawk.co.uk/journal/post/basic_model_inheritance</guid>

          <description><![CDATA[
		      		      <p>
 Last week I posted up my base codeigniter template to github and wrote a quick article on it in the journal here. I have drafted up a very <a href="https://github.com/peteyhawkins/CI-Template/blob/master/app/core/MY_Model.php">basic MY_Model class</a> and added it into the <a href="http://peteyhawkins.com/journal/post/ci_template">CI_Template</a>. This won&#39;t provide accessor methods or anything fancy, but just a few simple reusable methods for getting and inserting records that you will likely use across different models dealing with databases.</p>
<h2>
 Changes to your models</h2>
<p>
 Your models will now need to extend &#39;MY_Model&#39; as opposed to &#39;CI_Model&#39;. You will also need to add the following information into the constructor:</p>
<script src="https://gist.github.com/1615678.js?file=ci-basic-inheritance.php"></script>
<h2>
 Getting a single record</h2>
<p>
 Very simple, just calls the database table, with the ID you pass in to the $primary_value argument. This will return a CI row object.</p>
<script src="https://gist.github.com/1615680.js?file=basic-single-record.php"></script>
<h2>
 Insert a record</h2>
<p>
 This looks even simpler, just pass this method an array of data to be inserted to the table.</p>
<script src="https://gist.github.com/1615684.js?file=basic-insert.php"></script>
<h3>
 Check it out</h3>
<p>
 As usual there will be frequent improvements to the template and you can <a href="https://github.com/peteyhawkins/CI-Template">watch it on github</a>.</p>

		      
	      ]]></description>
			<pubDate>Fri, 01 Apr 2011 18:22:15 +0100</pubDate>
        </item>
            <item>
          <title>CI Template</title>
          <link>http://phawk.co.uk/journal/post/ci_template</link>
          <guid>http://phawk.co.uk/journal/post/ci_template</guid>

          <description><![CDATA[
		      		      <p>
 I have spent some time putting together my base <a href="http://codeigniter.com">codeigniter</a> install. This contains common features / functions that I use when starting most apps.</p>
<p>
 If this is useful, I have made the files <a href="https://github.com/peteyhawkins/CI-Template">available on github</a> for anyone to download.</p>
<h3>
 Below you&#39;ll find a list of features:</h3>
<h2>
 Authentication</h2>
<p>
 A basic Users_model and Auth controller which inherits a custom MY_Controller for logging in and out and page authentication.</p>
<h2>
 Local, Development &amp; Live Databases</h2>
<p>
 Custom changes to the site path to allow automatic detected of site type (local, development, live). This enables you to have numerous different database groups and use different settings for each site type.</p>
<script src="https://gist.github.com/1615666.js?file=ci-temp-dbswitch.php"></script>
<p>
 Pages that don&#39;t required authentication can be added to the &#39;no_validation&#39; array in your site_config</p>
<script src="https://gist.github.com/1615669.js?file=ci-temp-noval.php"></script>
<h2>
 Shared Application Path</h2>
<p>
 This is just a technique I use to keep the application path one level out of the root CI directory</p>
<script src="https://gist.github.com/1615671.js?file=ci-temp-shared-app-path.php"></script>
<h2>
 Languages</h2>
<p>
 Basic site language files have been setup, nice to have in place initially, otherwise I&#39;ll never both with the language stuff.</p>
<h2>
 Template Library</h2>
<p>
 <a href="http://williamsconcepts.com/ci/codeigniter/libraries/template/">I always use williamsconcepts.com Template library</a>, this is included and setup with a wee HTML5 template.php file.</p>
<p>
 Alongside the Template library there is a copy of <a href="http://docs.jquery.com/Downloading_jQuery">jQuery 1.5.1.min</a>, a modified version of <a href="http://meyerweb.com/eric/tools/css/reset/">Eric Meyer&#39;s</a> CSS reset, the 978px grid system and Google Codes <a href="http://code.google.com/p/html5shiv/">HTML5 shiv</a></p>
<h2>
 <a href="https://github.com/peteyhawkins/CI-Template">Download</a></h2>
<p>
 <a href="https://github.com/peteyhawkins/CI-Template">Have a browse or give it a download</a>. If you have any tweaks / improvements, give me a buzz on twitter and I may include your tweaks.</p>
<p>
 <em>Note: Use the &#39;users.sql&#39; file in the root directory to create your users table.</em></p>

		      
	      ]]></description>
			<pubDate>Sun, 27 Mar 2011 19:26:50 +0100</pubDate>
        </item>
            <item>
          <title>Making the most of 64bit</title>
          <link>http://phawk.co.uk/journal/post/making_the_most_of_64bit</link>
          <guid>http://phawk.co.uk/journal/post/making_the_most_of_64bit</guid>

          <description><![CDATA[
		      		      <h2>
 Snow leopard on a 64bit mac</h2>
<p>
 When you install or buy a new apple mac with Snow Leopard, there is a lot of hype about <a href="http://google.com">64 bit computing</a>. I made the assumption that I was running a full 64 bit operating system on my MacBook Pro 7,1. When I launched photoshop cs5 it said 64bit in the splash screen as shown below. <img alt="" class="alignnone size-full wp-image-237" height="328" src="/public/img/journal/64bit/pscs5.jpg" title="pscs5" width="620" /></p>
<h2>
 What&#39;s actually going on</h2>
<p>
 When I found out that I was only running in 32bit mode, but with support for 64bit applications I was a little shocked, as I know these apps would not be running as quickly as they would if I was running a 64 bit kernel for Snow Leopard.</p>
<h2>
 How many apps are ready for 64 bit?</h2>
<p>
 I took a look into what software on my mac was 64bit compatible and was amazed that just over half of my software and most of the software I use on a regular basis was ready for 64bit. If you want to check your apps, click on <em>Apple icon -&gt; About this mac -&gt; More info -&gt; Software -&gt; Applications</em> <img alt="" class="alignnone size-full wp-image-238" height="433" src="/public/img/journal/64bit/software.jpg" title="software" width="620" /></p>
<h2>
 Check if I&#39;m already running a 64bit kernel</h2>
<p>
 Click on <em>About this mac -&gt; More info -&gt; Software</em>, There should be a line titled <strong>64 bit kernel and extensions</strong>. <img alt="" class="alignnone size-full wp-image-239" height="315" src="/public/img/journal/64bit/kernel.jpg" title="kernel" width="620" /></p>
<h2>
 How can i run the 64bit kernel?</h2>
<p>
 If you want to run the 64bit kernel and let your mac make full use of all those 64bit apps then the next time you boot up, hold down the &quot;6&quot; &amp; &quot;4&quot; keys on your keyboard, this will boot your mac up in 64bit. If you want a more permanent solutinon you can enter the following line into terminal.</p>
<pre class="brush: bash">
sudo systemsetup -setkernelbootarchitecture x86_64
</pre>
<h2>
 Apple Applications</h2>
<p>
 By running the 64bit kernel, you&#39;ll be able to take advantage of a lot of apple apps in 64bit, most of the apps and system are all 64bit, there are only a couple which are still running in 32bit, but it won&#39;t be too long until they are all up to date. To learn more about 64bit on snow leopard you can visit <a href="http://www.apple.com/macosx/technology/">apples site</a>.</p>
<p>
 <a href="http://www.apple.com/macosx/technology/"><img alt="" class="alignnone size-full wp-image-236" height="346" src="/public/img/journal/64bit/64bitapple.jpg" title="64bitapple" width="620" /></a></p>

		      
	      ]]></description>
			<pubDate>Fri, 14 Jan 2011 13:17:39 +0000</pubDate>
        </item>
        
    </channel>
</rss>

