<?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>GeekyGoodness</title>
	<atom:link href="http://geekygoodness.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://geekygoodness.com</link>
	<description>Ramblings of a Developer</description>
	<lastBuildDate>Thu, 14 Mar 2013 00:09:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Google Reader is shutting down, whats next for Caffeinated?</title>
		<link>http://geekygoodness.com/google-reader-is-shutting-down-whats-next-for-caffeinated/</link>
		<comments>http://geekygoodness.com/google-reader-is-shutting-down-whats-next-for-caffeinated/#comments</comments>
		<pubDate>Thu, 14 Mar 2013 00:07:21 +0000</pubDate>
		<dc:creator>curthard89</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://geekygoodness.com/?p=26</guid>
		<description><![CDATA[Google have announced they are shutting down the Google Reader service on July 1st this year ( 2013 ), so what is going to happen to Caffeinated? Between now and July 1st Caffeinated will become independent of the Google Reader service and moved over to be a completely independent feed reader, free from any third [...]]]></description>
				<content:encoded><![CDATA[<p>Google have announced they are shutting down the Google Reader service on July 1st this year ( 2013 ), so what is going to happen to Caffeinated?</p>
<p>Between now and July 1st Caffeinated will become independent of the Google Reader service and moved over to be a completely independent feed reader, free from any third party API.</p>
<p>You get the same great user interface and reading experience you have always known, just without the limitation of a third party API.</p>
<p>This is my current plan forward, watch this space for further developments.</p>
]]></content:encoded>
			<wfw:commentRss>http://geekygoodness.com/google-reader-is-shutting-down-whats-next-for-caffeinated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NSTableView &#8211; Cell Based Silk</title>
		<link>http://geekygoodness.com/nstableview-cell-based-silk/</link>
		<comments>http://geekygoodness.com/nstableview-cell-based-silk/#comments</comments>
		<pubDate>Sun, 03 Feb 2013 19:05:25 +0000</pubDate>
		<dc:creator>curthard89</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://geekygoodness.com/?p=17</guid>
		<description><![CDATA[If you dont know what NSTableViews are, you should probably not read on – unless your curious of course. Caffeinated’s article list utilises an NSTableView, but not your standard NSTableView. It has been subclassed and modified until Apple’s default code only really helps with the cell frame calculations, the drawing however is all done within [...]]]></description>
				<content:encoded><![CDATA[<p>If you dont know what NSTableViews are, you should probably not read on – unless your curious of course.</p>
<p>Caffeinated’s article list utilises an NSTableView, but not your standard NSTableView. It has been subclassed and modified until Apple’s default code only really helps with the cell frame calculations, the drawing however is all done within this new instantly bastardised CaffTableView.</p>
<p><span id="more-17"></span></p>
<p>The tableview is redrawn every single time someone scrolls, move 1px, it will redraw, so the datasource and the drawing has to be lightning fast. The problem I first had, were the cells within Caffeinated’s list are variable heights, each time the tableview asked for a height I would have to calculate it out and return it, this was not a fast result. This causes serious lag as my cells are rather complex and computing the height on them was a slow task as you would have to word out the bounds of the cell and how the content would draw inside them and adjust the height accordingly.</p>
<p>Luckily, as any good datasource has, each row within the list has a associating NSManagedObject behind it, which vastly helped. As I could easily add a new property to this object store the calculated row height against it. Simple. If the item has a height, give that back to the tableview instead of calculating it again. Problem solved – not quite. With this in mind, you have to clear these values when ever the user resizes the tableview, or the cells will happily draw all out of place.</p>
<p>This method made scrolling rather smooth, but coming from iOS, it just was not smooth enough. I reverse engineered how the tableview works, simply put, every-time it redraws, it will grab all visible cells in view and draw those into the current graphics context. If you have complex cells ( which Caffeinated’s are ), this is one hell of a drawing routine to do.</p>
<p>To overcome this large drawing routine – I cache the cells being drawn. I created a custom cell which must be subclassed when drawing and override some special methods I created, this basically creates an image, draws the cell into the image and caches it against the cell. I created various methods inside the tableview that invokes these cells to cache there images and when drawn, it will use the cache instead of redrawing the cell. So we could of gone from 1000+ ( bezierpaths, shadows, font rendering etc ) drawing routines, down to the number of rows in the table view. Great!, this is now really getting smooth ( around 30 max instead of 1000, this was huge! ).</p>
<p>I wont go into great detail what these methods do to work out what to cache, but simply put, it works out what cells are on the screen and adds the previous and next cells onto those and caches those. When scrolling, its running a routine of clearing out the cached cells that are no longer needed, this is only done to free up resources ( storing NSImage’s is rather memory hungry ). So its only ever drawing and cached the cells which are visible on the screen, + and – 1.</p>
<p>Doing it this way created a silky smooth tableview, but in doing so also created a huge problem – the tableview grid and selection highlights. For the cells to work, they had to be transparent, which is fine. We can draw these transparent cached images over the top of the tableview. Only until I started to implement this did I realise you cannot have subpixel antialiasing on a transparent background. Yikes! The font and text rendering was horrid. Luckily I managed to write abit of code that made it look a little more pretty ( looks like aliased text rendering, but its not, its a massive cheat, but who will notice? ).</p>
<p>Of course, this method also causes a few other issues. What about the drawing of the cell when its selected or resized? The various methods I added into the tableview to handle caching also handle the recaching of cells that have to be redraw.</p>
<p>Many hours were spent tweaking and improving what I always thought to be, a horrid control that Apple had made. Now, the CaffTableView class over well over 1800 lines of custom implementation – this is not just smooth scrolling, but multi-select, sticky rows and alot more.</p>
<p>I hope this summary of what I did to achieve the tableview which sites happily within Caffeinated is beneficial to someone, if you have any questions or comments, just leave a comment <img src='http://geekygoodness.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://geekygoodness.com/nstableview-cell-based-silk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://geekygoodness.com/hello-world-2/</link>
		<comments>http://geekygoodness.com/hello-world-2/#comments</comments>
		<pubDate>Sun, 03 Feb 2013 15:31:33 +0000</pubDate>
		<dc:creator>curthard89</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://geekygoodness.com/?p=5</guid>
		<description><![CDATA[Get ready for a s**t load of geeky stuff Curtis Hard]]></description>
				<content:encoded><![CDATA[<p>Get ready for a s**t load of geeky stuff</p>
<p><strong>Curtis Hard</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://geekygoodness.com/hello-world-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
