<?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>vi-kan.net</title>
	<atom:link href="http://blog.vi-kan.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.vi-kan.net</link>
	<description>{ TODO -oVegar : insert clever text here}</description>
	<lastBuildDate>Wed, 12 Dec 2012 15:39:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Dagens fotnoter&#8230; #8</title>
		<link>http://blog.vi-kan.net/2011/dagens-fotnoter-8/</link>
		<comments>http://blog.vi-kan.net/2011/dagens-fotnoter-8/#comments</comments>
		<pubDate>Tue, 03 May 2011 10:52:36 +0000</pubDate>
		<dc:creator>Vegar</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://blog.vi-kan.net/?p=365</guid>
		<description><![CDATA[Micro-ORM Mye prat om micro-orms for tiden. Denne podcasten gir ett lite innblikk i hva det dreier seg om. http://www.hanselminutes.com/default.aspx?showID=282 DevDays 2011, Netherlands Opptak fra DevDays 2011 er lagt ut på channel 9. http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands Bart De Smet hadde en interessant session om 10 c# language features. http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands/Devdays041 Breakpoints on Xaml in Silverlight 5 Montro om [...]]]></description>
				<content:encoded><![CDATA[<h3>Micro-ORM</h3>
<p style="padding-left: 30px;">Mye prat om micro-orms for tiden. Denne podcasten gir ett lite innblikk i hva det dreier seg om.<br />
<a href="http://www.hanselminutes.com/default.aspx?showID=282">http://www.hanselminutes.com/default.aspx?showID=282</a></p>
<h3>DevDays 2011, Netherlands</h3>
<p style="padding-left: 30px;">Opptak fra DevDays 2011 er lagt ut på channel 9.<br />
<a href="http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands">http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands</a></p>
<p style="padding-left: 30px;"><a href="http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands"></a>Bart De Smet hadde en interessant session om 10 c# language features.<em><br />
</em><a href="http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands/Devdays041">http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands/Devdays041</a></p>
<h3>Breakpoints on Xaml in Silverlight 5</h3>
<p style="padding-left: 30px;">Montro om dette også blir mulig i WPF? Ville vært høyst velkomment.<br />
<a href="http://www.wpftutorial.net/Templates.html">http://jesseliberty.com/2011/04/26/breakpoints-on-xaml-in-silverlight-5/</a></p>
<h3>MineCraft</h3>
<p style="padding-left: 30px;">Dette fenomenet må en visst bare vende seg til.<br />
<a href="http://www.minecraft.net/">http://www.minecraft.net/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vi-kan.net/2011/dagens-fotnoter-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dagens fotnoter&#8230; #7</title>
		<link>http://blog.vi-kan.net/2011/dagens-fotnoter-7/</link>
		<comments>http://blog.vi-kan.net/2011/dagens-fotnoter-7/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 09:58:09 +0000</pubDate>
		<dc:creator>Vegar</dc:creator>
				<category><![CDATA[Fotnoter]]></category>

		<guid isPermaLink="false">http://blog.vi-kan.net/?p=358</guid>
		<description><![CDATA[ControlTemplate &#38; Triggers {RelativeSource TemplatedParent} is not working in DataTriggers of a ControlTemplate http://www.wpftutorial.net/Templates.html MIX11 Opptak av foredrag er tilgjengelig på channel9 sine sider. http://channel9.msdn.com/events/MIX/MIX11/ SoundSwitch Et lite, men genialt, verktøy for kjapt å flytte lyden mellom ulike outputs. http://blog.contriving.net/2009/05/04/a-hotkey-to-switch-between-headphones-and-speakers-soundswitch/]]></description>
				<content:encoded><![CDATA[<h3>ControlTemplate &amp; Triggers</h3>
<p style="padding-left: 30px;">{RelativeSource TemplatedParent} is not working in DataTriggers of a ControlTemplate<br />
<a href="http://www.wpftutorial.net/Templates.html">http://www.wpftutorial.net/Templates.html</a></p>
<h3>MIX11</h3>
<p style="padding-left: 30px;">Opptak av foredrag er tilgjengelig på channel9 sine sider.<br />
<a href="http://channel9.msdn.com/events/MIX/MIX11/">http://channel9.msdn.com/events/MIX/MIX11/</a></p>
<h3>SoundSwitch</h3>
<p style="padding-left: 30px;">Et lite, men genialt, verktøy for kjapt å flytte lyden mellom ulike outputs.<br />
<a href="http://blog.contriving.net/2009/05/04/a-hotkey-to-switch-between-headphones-and-speakers-soundswitch/">http://blog.contriving.net/2009/05/04/a-hotkey-to-switch-between-headphones-and-speakers-soundswitch/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vi-kan.net/2011/dagens-fotnoter-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dagens fotnoter&#8230; #6</title>
		<link>http://blog.vi-kan.net/2011/dagens-fotnoter-6/</link>
		<comments>http://blog.vi-kan.net/2011/dagens-fotnoter-6/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 21:16:22 +0000</pubDate>
		<dc:creator>Vegar</dc:creator>
				<category><![CDATA[Fotnoter]]></category>

		<guid isPermaLink="false">http://blog.vi-kan.net/?p=352</guid>
		<description><![CDATA[Torbjørn Marø Blogger på norsk om .net, ruby, clojure ++. Har sin egen tegneserie, &#8216;the contiki strip&#8217; Jobber som senior utvikler/teamleder i PCWinCom og aktiv i NNUG Bergen http://kjempekjekt.com Decipering Burndown Charts Sprint Burndown says a lot about your scrum team&#8230;, Hiren Doshi http://www.practiceagile.com/2010/02/sprint-burndown-says-lot-about-your.html Seven common Sprint Burndown Chart Signatures, Kane Mar http://kanemar.com/2006/11/07/seven-common-sprint-burndown-graph-signatures/ Feel the [...]]]></description>
				<content:encoded><![CDATA[<h3>Torbjørn Marø</h3>
<p style="padding-left: 30px;">Blogger på norsk om .net, ruby, clojure ++.<br />
Har sin egen tegneserie, &#8216;the contiki strip&#8217;<br />
Jobber som senior utvikler/teamleder i PCWinCom og aktiv i NNUG Bergen<br />
<a href="http://kjempekjekt.com">http://kjempekjekt.com</a></p>
<h3>Decipering Burndown Charts</h3>
<p style="padding-left: 30px;">Sprint Burndown says a lot about your scrum team&#8230;, <em>Hiren Doshi</em><br />
<a href="http://www.practiceagile.com/2010/02/sprint-burndown-says-lot-about-your.html">http://www.practiceagile.com/2010/02/sprint-burndown-says-lot-about-your.html</a></p>
<p style="padding-left: 30px;">Seven common Sprint Burndown Chart Signatures, <em>Kane Mar</em><br />
<a href="http://kanemar.com/2006/11/07/seven-common-sprint-burndown-graph-signatures/">http://kanemar.com/2006/11/07/seven-common-sprint-burndown-graph-signatures/</a></p>
<p style="padding-left: 30px;">Feel the burn: Getting the most out of burn charts, <em>George Dinwiddie</em><br />
<a href="http://idiacomputing.com/pub/BetterSoftware-BurnCharts.pdf">http://idiacomputing.com/pub/BetterSoftware-BurnCharts.pdf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vi-kan.net/2011/dagens-fotnoter-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dagens fotnoter&#8230; #5</title>
		<link>http://blog.vi-kan.net/2011/dagens-fotnoter-5/</link>
		<comments>http://blog.vi-kan.net/2011/dagens-fotnoter-5/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 22:48:28 +0000</pubDate>
		<dc:creator>Vegar</dc:creator>
				<category><![CDATA[Fotnoter]]></category>

		<guid isPermaLink="false">http://blog.vi-kan.net/?p=332</guid>
		<description><![CDATA[Caliburn.micro MVVM-framework with heavy use of conventions http://caliburnmicro.codeplex.com/ Rob Eisenberg on .net Rocks! http://dotnetrocks.com/default.aspx?showNum=638 Scrummaster-fragrance You&#8217;re certified as a ScrumMaster. Now smell like one. http://www.scrummaster-fragrance.com/]]></description>
				<content:encoded><![CDATA[<h3>Caliburn.micro</h3>
<p style="padding-left: 30px;">MVVM-framework with heavy use of conventions<br />
<a href="http://caliburnmicro.codeplex.com/"> http://caliburnmicro.codeplex.com/</a></p>
<p style="padding-left: 30px;">Rob Eisenberg on .net Rocks!<br />
<a href="http://dotnetrocks.com/default.aspx?showNum=638"> http://dotnetrocks.com/default.aspx?showNum=638</a></p>
<h3>Scrummaster-fragrance</h3>
<p style="padding-left: 30px;">You&#8217;re certified as a ScrumMaster. Now smell like one.<br />
<a href="http://www.scrummaster-fragrance.com/"> http://www.scrummaster-fragrance.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vi-kan.net/2011/dagens-fotnoter-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dagens fotnoter&#8230; #4</title>
		<link>http://blog.vi-kan.net/2011/dagens-fotnoter-4/</link>
		<comments>http://blog.vi-kan.net/2011/dagens-fotnoter-4/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 22:48:34 +0000</pubDate>
		<dc:creator>Vegar</dc:creator>
				<category><![CDATA[Fotnoter]]></category>

		<guid isPermaLink="false">http://blog.vi-kan.net/?p=339</guid>
		<description><![CDATA[WPF Performance Suite “The WPF Performance Suite enables you to analyze the run-time behavior of your WPF applications and determine performance optimizations that you can apply.” http://msdn.microsoft.com/en-us/library/aa969767.aspx Microsoft Health CUI – SearchAndPrescribe-control http://www.mscui.net/Components/SearchAndPrescribe.aspx TellStick “It turns any computer into a wireless home automation center by being the link between your computer and electronics &#38; lights.” [...]]]></description>
				<content:encoded><![CDATA[<h3>WPF Performance Suite</h3>
<p style="padding-left: 30px;">“The WPF Performance Suite enables you to analyze the run-time behavior<br />
of your WPF applications and determine performance optimizations that you can apply.”<br />
<a href="http://msdn.microsoft.com/en-us/library/aa969767.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/aa969767.aspx</a></p>
<h3>Microsoft Health CUI – SearchAndPrescribe-control</h3>
<p style="padding-left: 30px;"><a href="http://www.mscui.net/Components/SearchAndPrescribe.aspx" target="_blank">http://www.mscui.net/Components/SearchAndPrescribe.aspx</a></p>
<h3>TellStick</h3>
<p style="padding-left: 30px;">“It turns any computer into a wireless home automation center by being the link<br />
between your computer and electronics &amp; lights.”<br />
<a href="http://www.telldus.se/products/tellstick">http://www.telldus.se/products/tellstick</a><br />
<a href="http://www.clasohlson.no/Product/Product.aspx?id=157599493" target="_blank">http://www.clasohlson.no/Product/Product.aspx?id=157599493</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vi-kan.net/2011/dagens-fotnoter-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dagens fotnoter&#8230; #3</title>
		<link>http://blog.vi-kan.net/2011/dagens-fotnoter-3/</link>
		<comments>http://blog.vi-kan.net/2011/dagens-fotnoter-3/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 22:54:42 +0000</pubDate>
		<dc:creator>Vegar</dc:creator>
				<category><![CDATA[Fotnoter]]></category>

		<guid isPermaLink="false">http://blog.vi-kan.net/?p=342</guid>
		<description><![CDATA[Geek&#38;Poke ”Best practices in Application Architecture” http://geekandpoke.typepad.com/geekandpoke/2011/03/architectural-best-practices.html Espen Eckbo Tett på en utvikler – it-utvikler Ragnar Hoff http://www.ebaumsworld.com/video/watch/81136517/]]></description>
				<content:encoded><![CDATA[<h3>Geek&amp;Poke</h3>
<p style="padding-left: 30px;">”Best practices in Application Architecture”<br />
<a href="http://geekandpoke.typepad.com/geekandpoke/2011/03/architectural-best-practices.html" target="_blank">http://geekandpoke.typepad.com/geekandpoke/2011/03/architectural-best-practices.html</a></p>
<h3>Espen Eckbo</h3>
<p style="padding-left: 30px;">Tett på en utvikler – it-utvikler Ragnar Hoff<br />
<a href="http://www.ebaumsworld.com/video/watch/81136517/" target="_blank">http://www.ebaumsworld.com/video/watch/81136517/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vi-kan.net/2011/dagens-fotnoter-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dagens fotnoter&#8230; #2</title>
		<link>http://blog.vi-kan.net/2011/dagens-fotnoter-2/</link>
		<comments>http://blog.vi-kan.net/2011/dagens-fotnoter-2/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 22:57:59 +0000</pubDate>
		<dc:creator>Vegar</dc:creator>
				<category><![CDATA[Fotnoter]]></category>

		<guid isPermaLink="false">http://blog.vi-kan.net/?p=347</guid>
		<description><![CDATA[David Brady &#38; Robert C. Martin ”Is SOLID A Good Idea?” http://vimeo.com/20388419]]></description>
				<content:encoded><![CDATA[<h3>David Brady &amp; Robert C. Martin</h3>
<p style="padding-left: 30px;">”Is SOLID A Good Idea?”<br />
<a href="http://vimeo.com/20388419" target="_blank">http://vimeo.com/20388419</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vi-kan.net/2011/dagens-fotnoter-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dagens fotnoter&#8230; #1</title>
		<link>http://blog.vi-kan.net/2011/dagens-fotnoter-1/</link>
		<comments>http://blog.vi-kan.net/2011/dagens-fotnoter-1/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 23:00:32 +0000</pubDate>
		<dc:creator>Vegar</dc:creator>
				<category><![CDATA[Fotnoter]]></category>

		<guid isPermaLink="false">http://blog.vi-kan.net/?p=350</guid>
		<description><![CDATA[Jon Skeet ”Users don&#8217;t mark Jon Skeet&#8217;s answers as accepted. The universe accepts them out of a sense of truth and justice.” http://meta.stackoverflow.com/questions/9134/jon-skeet-facts C# 5: asynchronous programming PDC10 Session The Future of C# and VB http://player.microsoftpdc.com/Session/1b127a7d-300e-4385-af8e-ac747fee677a Eric Lippert: “Today I want to talk about asynchrony that does not involve any multithreading whatsoever.” http://blogs.msdn.com/b/ericlippert/archive/2010/11/04/asynchrony-in-c-5-0-part-four-it-s-not-magic.aspx NHibernate-mapping Multiple [...]]]></description>
				<content:encoded><![CDATA[<h3>Jon Skeet</h3>
<p style="padding-left: 30px;">”Users don&#8217;t mark Jon Skeet&#8217;s answers as accepted. The universe accepts them out of a sense of truth and justice.”<br />
<a href="http://meta.stackoverflow.com/questions/9134/jon-skeet-facts" target="_blank">http://meta.stackoverflow.com/questions/9134/jon-skeet-facts</a></p>
<h3>C# 5: asynchronous programming</h3>
<p style="padding-left: 30px;">PDC10 Session The Future of C# and VB<br />
<a href="http://player.microsoftpdc.com/Session/1b127a7d-300e-4385-af8e-ac747fee677a" target="_blank">http://player.microsoftpdc.com/Session/1b127a7d-300e-4385-af8e-ac747fee677a</a></p>
<p style="padding-left: 30px;">Eric Lippert: “Today I want to talk about asynchrony that does not involve any multithreading whatsoever.”<br />
<a href="http://blogs.msdn.com/b/ericlippert/archive/2010/11/04/asynchrony-in-c-5-0-part-four-it-s-not-magic.aspx" target="_blank">http://blogs.msdn.com/b/ericlippert/archive/2010/11/04/asynchrony-in-c-5-0-part-four-it-s-not-magic.aspx</a></p>
<h3>NHibernate-mapping</h3>
<p style="padding-left: 30px;">Multiple tables to one object-mapping with  &lt;join/&gt;<br />
<a href="http://ayende.com/Blog/archive/2009/04/20/nhibernate-mapping-ltjoingt.aspx" target="_blank">http://ayende.com/Blog/archive/2009/04/20/nhibernate-mapping-ltjoingt.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vi-kan.net/2011/dagens-fotnoter-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler, Problem 18 &amp; 67</title>
		<link>http://blog.vi-kan.net/2010/project-euler-problem-18-67/</link>
		<comments>http://blog.vi-kan.net/2010/project-euler-problem-18-67/#comments</comments>
		<pubDate>Fri, 26 Nov 2010 21:49:50 +0000</pubDate>
		<dc:creator>Vegar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Euler]]></category>

		<guid isPermaLink="false">http://blog.vi-kan.net/?p=294</guid>
		<description><![CDATA[I have been struggling with a couple of Euler Problems the past days. Not so much finding the solution as finding a couple of bugs in my code&#8230; By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. [...]]]></description>
				<content:encoded><![CDATA[<p>I have been struggling with a couple of Euler Problems the past days. Not so much finding the solution as finding a couple of bugs in my code&#8230;</p>
<p>By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.</p>
<p style="text-align: center;"><strong>3</strong><br />
<strong>7</strong> 4<br />
2 <strong>4</strong> 6<br />
8 5 <strong>9</strong> 3</p>
<p>Find the maximum total from top to bottom of the given triangle.<span id="more-294"></span>The 18th problem involves finding the optimal route from top to bottom in a pyramid  of 15 rows. It is possible to solve this using a brute force algorithm, testing every possible solution. Problem no. 67 is the exact same problem, but this time with a pyramid of 100 rows. The problem text includes a little warning, stating that a brute force approach would take a couple of billion years to complete&#8230;</p>
<p>I remember back when I was a kid, I used to solve labyrinths like &#8216;help the little mouse find its cheese&#8217;, I always started with the cheese. It was always easier to find the way back to the mouse. I would guess that the same would go for this one. If we can solve the problem from the bottom instead of the top, it should be easier to choose the right path.</p>
<div style="float: right; margin: 10px; text-align: center;">6<br />
1 7<br />
9 2 3<br />
8 5 9 3</div>
<p>So, lets start at the bottom of the four-row pyramid. We have four numbers: 8 5 9 and 3. Even though 9 is the larger one, we have no idea if 9 is where we want to end up, since the numbers leading to the first number, 8, could be higher. Imagine the third row to be 9 2 and 3. The only way down to the 8 would be through the 9 in the third row, and down to the 9 we could have come through the 2 or the 3. 8 + 9 = 17 looks like a much better total then 2 + 9 = 11 or 3 + 9 = 12. Moving up one more row, to the second row, lets imagine the numbers 1 and 7. If we went for the  8 + 9 combination, we would only have one choice up to the second row, making a total of 8 + 9 + 1 = 18. If we went for the 9 + 3 combination, the 7  would be our only choice, giving a total of 19. From the 2 in the third row, we could reach either one, but would not get a higher total any way, so lets just drop that option all together.</p>
<p>Now, what seemed like a great path, starting with 8 + 9, turned out to be beaten by another option higher in the pyramid. How could we predict that? We couldn&#8217;t. So what would make going from bottom to top a better solution then from the top to bottom? Well, we managed to throw away a couple of options. We never payed either the 5 or the 3 in the bottom row any attention. From the 5, we could have gone up through 9 or 2 in the third row, but if we have come to the 9, why should we go down to the 5 when we know that the 8 would give a better total? Same goes for the 2. Why go down to 5 for a total of 7 when we can go down to 9 for a total of 11? And that is the clue to solve this problem. We need to know what would give the greater total, left or right.</p>
<p>OK. So lets start at the bottom again, this time, with some of the numbers from the given pyramid in problem 18:</p>
<p style="text-align: center;"><span style="line-height: normal; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-size: small;"><img class="aligncenter" title="Last two rows" src="http://blog.vi-kan.net/wp-content/uploads/2010/11/problem18_1.jpg" alt="" width="470" height="50" /></span></p>
<p>If we start with the 63, we could either go down to 04 or 62. Obviously, knowing this is the last row, we would go for 62 and a total of 125. From 66 we can go to 62 or 98. Once again, we would take the right path for a total of 164. From 04, we would pick 98, from 68, 27 or 89, 23 and so on.</p>
<p style="text-align: center;"><a href="http://blog.vi-kan.net/wp-content/uploads/2010/11/problem18_21.jpg"><img class="alignnone size-full wp-image-309" title="Last two rows added together" src="http://blog.vi-kan.net/wp-content/uploads/2010/11/problem18_21.jpg" alt="" width="180" height="75" /></a></p>
<p>Now we can easily know where we want to go next from the 14th row. Lets add the 13th row:</p>
<p><a href="http://blog.vi-kan.net/wp-content/uploads/2010/11/problem18_3.jpg"><img class="aligncenter size-full wp-image-310" title="Three last rows" src="http://blog.vi-kan.net/wp-content/uploads/2010/11/problem18_3.jpg" alt="" width="180" height="110" /></a></p>
<p>Since we already know the best path from each number in the 14th row down to the 15th, we can treat the trip from the 13th row down to the 14th in the same way. From the first number, 91, we know we can choose between 63 and 66. We know that if we choose 63, we can reach a maximum of 91 + 125 by going right from 63. If we choose 66, we know that we can reach a total of 91 + 128 by going left. From the second number, 71, we can go left through 66, or right through 04. By choosing right, we can reach a maximum of 71 + 102, so clearly left would be a better choice, which gives us 71 + 164.</p>
<p><a href="http://blog.vi-kan.net/wp-content/uploads/2010/11/problem18_4.jpg"><img class="aligncenter size-full wp-image-311" title="Three last rows added together" src="http://blog.vi-kan.net/wp-content/uploads/2010/11/problem18_4.jpg" alt="" width="180" height="110" /></a>Do you see the pattern? I think we are ready for some code! I started out with a NumberPiramid-class. It has a method for adding a row of numbers, and a method returning the calculated maximum total.</p>
<pre class="brush: objc; title: ; notranslate">
@interface NumberPiramid : NSObject {
  NSMutableArray *rows;
}

-(void)addRow:(NSString *)stringWithNumbers;
-(int)numberOfRows;
-(int)maximumTotal;

@end</pre>
<p>The method addRow:stringWithNumbers takes all numbers for one row as a string separated by spaces. The string is split into an array of Number, a class able to hold both the number itself, and the totals for the left and right side.</p>
<pre class="brush: objc; title: ; notranslate">
-(void)addRow:(NSString *)stringWithNumbers;
{
  NSArray *numbers = [stringWithNumbers componentsSeparatedByString:@&quot; &quot;];
  NSMutableArray *row = [[NSMutableArray alloc] initWithCapacity:[numbers count]];
  for (NSString *number in numbers) {
    Number *n = [[Number alloc] initWithNumber:number];
    [row addObject:n];
    [n release];
  }
  [rows addObject:row];
  [row release];
}</pre>
<p>So now, we have an array of arrays that we can use to find our total. The method maximumTotal will first traverse the arrays bottom up, adding the numbers one by one, always keeping the larger option. I have given the Number class a convenience method maxSum, that returns the larger number of leftSum and rightSum. When we have reached the top, we have our total.</p>
<pre class="brush: objc; title: ; notranslate">-(int)maximumTotal;
{
  NSArray *row = [rows lastObject];
  NSArray *prevRow;
  for (int r = [self numberOfRows] - 2; r &gt;= 0; r--) {
    prevRow = row;
    row = [rows objectAtIndex:r];
    for (int n = 0; n &lt; [row count]; n++) {
      Number *number = [row objectAtIndex:n]&gt;
      Number *left = [prevRow objectAtIndex:n];
      Number *right = [prevRow objectAtIndex:n + 1];
      number.leftSum = number.number + [left maxSum];
      number.rightSum = number.number + [right maxSum];
    }
  }
  Number *top = [row objectAtIndex:0];
  return [top maxSum];
}</pre>
<p>And thats all there is. Problem 67 is the exact same problem, but with a larger pyramid. The numbers are given in a textfile, so we need a new method that can read the textfile line by line. Actually, I found it easier to just read the whole file into a string, using NSString initWithContentsOfFile:filename. I then split this string into lines with the same method I use to split a single row.</p>
<p>As before, the code is available <a href="http://svn.vi-kan.net/euler">through svn</a>. There is a delphi implementation too.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vi-kan.net/2010/project-euler-problem-18-67/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SyntaxHighlighter and Objective-C</title>
		<link>http://blog.vi-kan.net/2010/syntaxhighlighter-and-objective-c/</link>
		<comments>http://blog.vi-kan.net/2010/syntaxhighlighter-and-objective-c/#comments</comments>
		<pubDate>Fri, 26 Nov 2010 13:15:09 +0000</pubDate>
		<dc:creator>Vegar</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://blog.vi-kan.net/?p=270</guid>
		<description><![CDATA[I have always used  Alex Gorbatchevs SyntaxHighlighter to make code listings look pretty on this blog. There are several wordpress plugins that include these scripts automatically. It has one shortcoming, though. It doesn&#8217;t include any syntax highlighter for objective-c. When searching the net for some tips on how to add this feature, I found yet another [...]]]></description>
				<content:encoded><![CDATA[<p>I have always used  <a href="http://alexgorbatchev.com/SyntaxHighlighter/">Alex Gorbatchevs SyntaxHighlighter</a> to make code listings look pretty on this blog. There are <a href="http://wordpress.org/extend/plugins/search.php?q=syntaxhighlighter">several wordpress plugins</a> that include these scripts automatically. It has one shortcoming, though. It doesn&#8217;t include any syntax highlighter for objective-c. When searching the net for some tips on how to add this feature, I found yet another wordpress plugin, <a href="http://wordpress.org/extend/plugins/syntaxhighlighter/">SyntaxHighlighter Evolved</a>, and this one included some additional languages, including objective-c. Great! Whats not so great, though, is that instead of using the pre-tag, it uses custom -tags. I guess there will be more difficult to switch between plugins in the feature&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vi-kan.net/2010/syntaxhighlighter-and-objective-c/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->