<?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>Blog of developer Mikkel Ovesen &#187; Software</title>
	<atom:link href="http://blog.ovesens.net/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ovesens.net</link>
	<description>My thoughts, stuff I need to remember or things I just want to share with the world</description>
	<lastBuildDate>Thu, 19 Jan 2012 11:55:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>My attempts at installing Umbraco via NuGet</title>
		<link>http://blog.ovesens.net/2011/11/my-attempts-at-installing-umbraco-via-nuget/</link>
		<comments>http://blog.ovesens.net/2011/11/my-attempts-at-installing-umbraco-via-nuget/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 13:19:20 +0000</pubDate>
		<dc:creator>Mikkel Ovesen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[nuget]]></category>
		<category><![CDATA[umbraco]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[vs]]></category>
		<category><![CDATA[vs2010]]></category>

		<guid isPermaLink="false">http://blog.ovesens.net/?p=461</guid>
		<description><![CDATA[I often use Umbraco as a CMS for my web projects, and NuGet for referencing other libraries. This made me wonder whether Umbraco could be deployed via Nuget. The short answer is, it is possible, but it does not work &#8230; <a href="http://blog.ovesens.net/2011/11/my-attempts-at-installing-umbraco-via-nuget/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I often use <a href="http://umbraco.com/">Umbraco</a> as a CMS for my web projects, and NuGet for referencing other libraries. This made me wonder whether Umbraco could be deployed via Nuget. The short answer is, it is possible, but it does not work very well. Here is my experience.</p>
<p>I started to read the <a href="http://docs.nuget.org/">NuGet docs</a> to figure out what a NuGet package actually is.</p>
<h2>NuGet package</h2>
<p>A NuGet package is a file that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework. A NuGet package is comprised by these three things:</p>
<ul>
<li><strong>tools</strong> &#8211; The tools folder of a package is for powershell scripts and programs accessible from the Package Manager Console. After the folder is copied to the target project, it is added to the `$env:Path (PATH) environment variable.</li>
<li><strong>lib</strong> &#8211; Assemblies (.dll files) in the lib folder are added as assembly references when the package is installed.</li>
<li><strong>content</strong> &#8211; Files in the content folder are copied to the root of your application when the package is installed.</li>
</ul>
<div><em><span style="font-size: small;"><span class="Apple-style-span" style="line-height: 24px;">The above is from the <a href="http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package">NuGet docs</a>.</span></span></em></div>
<p>The documentation also indicate that NuGet was not designed for a project like Umbraco with so many files and such a complex web.config file. But I wanted to try and see how and if it was actually possible.</p>
<h2>The strategy</h2>
<p>The Umbraco project consists of libraries/assemblies and content, so it should be rather easy to create the NuGet package.</p>
<p>The first step was to download Umbraco 4.7.1 and go through the required assemblies and web.config. Initially I located assemblies that could already be found on NuGet and added these dependencies to the NuGet package. It later showed, that there would be versioning problems which I was not able to fix.</p>
<p>So instead of using dependencies to other NuGet packages as NuGet was actually intended, I  just added all the assemblies released with Umbraco 4.7.1.</p>
<h2>Assemblies</h2>
<p>The assemblies that gave me the most trouble was ClientDependency and ICharpCode.SharpZipLib.</p>
<p>ClientDependency was actually already in the NuGet feed, but the configuration transformation made from that NuGet package combined with the web.config transformation from the Umbraco package, yilded an invalid web.config file.  ClientDependency was therefor provided as an assembly directly from the Umbraco package and not as an external dependency.</p>
<p>The assembly ICSharpCode.SharpZipLib was also found in the NuGet feed, but Umbraco 4.7.1 required a specific version (0.85.5.452) that NuGet could not provide, and this assembly was as such also added as a part of the Umbraco package.</p>
<h2>Web.config</h2>
<p>The web.config configuration file for Umbraco is long and rather complex, and that makes merging of multiple web.config files difficult. The configuration transformation features in NuGet are limited, so you should expect problems when adding the Umbraco package to an existing website. The best results I achieved was when the package was added to an empty website or web application.</p>
<p>But even though a web.config file is almost empty, you should still prepare for some clean up.</p>
<h2>Content</h2>
<p>The <a href="http://umbraco.codeplex.com/releases/view/73692">Umbraco 4.7.1 binary release</a> containes more than 1500 files. NuGet was not designed for this number of files and does not handle it very well. A complete package installation can take up to 5-10 min. depending on you machine and SSD/HDD configuration.</p>
<h2>Example</h2>
<p>The following describes the steps I used to run the Umbraco NuGet package against a web application project and the problems that arose.</p>
<p>1. Open Visual Studio 2010 and create an empty C# web application project</p>
<p>2. Open the NuGet Package Manager Console</p>
<p>3. Write:</p>
<pre>Install-Package "Umbraco" -Source "c:\[NuGetPackageFolder]"</pre>
<p><em>NuGetPackageFolder: Replace with the path to the folder containing the Umbraco.4.7.1.nupkg file. <strong>Important do not give the full path to the file, just the folder</strong></em></p>
<p>4. Hit [ENTER] and wait for NuGet to do its work</p>
<p>5. Wait for the following two messages:</p>
<pre>Successfully installed 'Umbraco 4.7.1'.
Successfully added 'Umbraco 4.7.1' to WebApplication1.</pre>
<p>6. Compile and receive an error from web.config. (Multiple System.Web -&gt; Compilation sections are present)</p>
<p>7. Remove the first and compile and run again</p>
<pre class="brush: xml;">&lt;compilation debug="true" targetFramework="4.0" /&gt;</pre>
<p>8. At this point everything worked and I was able to follow the usual Umbraco installation steps <img src='http://blog.ovesens.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Conclusion</h2>
<p>Umbraco is a fantastic CMS and NuGet is very cool, but together is not a good idea.</p>
<p>My goal was to find a way for installing Umbraco to a web project via NuGet, and that is not impossible, but I would not recommend it. I find it a lot easier to simply download the Umbraco released ZIP, and then extract and drag all files to my web application project. So that is what I will do <img src='http://blog.ovesens.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>But if you still wants the Umbraco NuGet file, you can download it <a href="/wp-content\uploads/2011/11/Umbraco.4.7.1.nupkg.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ovesens.net/2011/11/my-attempts-at-installing-umbraco-via-nuget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MacBook Pro BootCamp/Windows keyboard schema</title>
		<link>http://blog.ovesens.net/2011/11/macbook-pro-bootcampwindows-keyboard-schema/</link>
		<comments>http://blog.ovesens.net/2011/11/macbook-pro-bootcampwindows-keyboard-schema/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 20:37:16 +0000</pubDate>
		<dc:creator>Mikkel Ovesen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[bootcamp]]></category>
		<category><![CDATA[macbook]]></category>
		<category><![CDATA[resharper]]></category>
		<category><![CDATA[shortcut]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[vs2010]]></category>

		<guid isPermaLink="false">http://blog.ovesens.net/?p=370</guid>
		<description><![CDATA[Visual Studio 2010 + Resharper Key Description FN+ALT+[Right arrow] Go to sub types FN+ALT+[Left arrow] Go to super types ALT+SHIFT+F12 Find usages of variable CTRL+SHIFT+F11 Go to type of variable CTRL+SHIFT+R Refactor this CTRL+SHIFT+T Go to file CTRL+T Go to &#8230; <a href="http://blog.ovesens.net/2011/11/macbook-pro-bootcampwindows-keyboard-schema/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Visual Studio 2010 + Resharper</h2>
<table>
<thead>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>FN+ALT+[Right arrow]</td>
<td>Go to sub types</td>
</tr>
<tr>
<td>FN+ALT+[Left arrow]</td>
<td>Go to super types</td>
</tr>
<tr>
<td>ALT+SHIFT+F12</td>
<td>Find usages of variable</td>
</tr>
<tr>
<td>CTRL+SHIFT+F11</td>
<td>Go to type of variable</td>
</tr>
<tr>
<td>CTRL+SHIFT+R</td>
<td>Refactor this</td>
</tr>
<tr>
<td>CTRL+SHIFT+T</td>
<td>Go to file</td>
</tr>
<tr>
<td>CTRL+T</td>
<td>Go to type</td>
</tr>
<tr>
<td>FN+ALT+[ENTER]</td>
<td>Generate</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.ovesens.net/2011/11/macbook-pro-bootcampwindows-keyboard-schema/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2010 Package load errors</title>
		<link>http://blog.ovesens.net/2011/10/visual-studio-2010-package-load-errors/</link>
		<comments>http://blog.ovesens.net/2011/10/visual-studio-2010-package-load-errors/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 07:11:35 +0000</pubDate>
		<dc:creator>Mikkel Ovesen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[vs2010]]></category>

		<guid isPermaLink="false">http://blog.ovesens.net/?p=439</guid>
		<description><![CDATA[My Windows 7 installation on my laptop broke down, and I then had to completely reinstall Windows 7, Visual Studio etc. Besides it being a long and tedious process it seemed to go fine. But I started to get the &#8230; <a href="http://blog.ovesens.net/2011/10/visual-studio-2010-package-load-errors/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>My Windows 7 installation on my laptop broke down, and I then had to completely reinstall Windows 7, Visual Studio etc.</p>
<p>Besides it being a long and tedious process it seemed to go fine. But I started to get the following error messages when Visual Studio 2010 was launched:</p>
<blockquote><p>The &#8216;RadLangSvc.Package, RadLangSvc.VS, Version = 10.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91&#8242; failed to load</p></blockquote>
<blockquote><p>VSTS for Database Professionals Sql Server Data-tier Application did not load</p></blockquote>
<p>and some other VSTS packages that was unable to load.</p>
<p>I followed the steps described <a href="http://techsolutions-at-desk.blogspot.com/2011/04/radlangsvcvs-version-10000-culture.html">here</a>, and it worked <img src='http://blog.ovesens.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . The steps are also described below:</p>
<ol>
<li>Close all running instances of Visual Studio 2010</li>
<li>Install the following MSI packages from the installation CD of VS2010, in the folder  \WCU\DAC</li>
<li>DACProjectSystemSetup_enu.msi</li>
<li>TSqlLanguageService_enu.msi</li>
<li>DACFramework_enu.msi</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.ovesens.net/2011/10/visual-studio-2010-package-load-errors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cuda v3.2 template project using C++</title>
		<link>http://blog.ovesens.net/2011/05/cuda-v3-2-template-project-using-cpp/</link>
		<comments>http://blog.ovesens.net/2011/05/cuda-v3-2-template-project-using-cpp/#comments</comments>
		<pubDate>Wed, 18 May 2011 16:59:27 +0000</pubDate>
		<dc:creator>Mikkel Ovesen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[cuda]]></category>
		<category><![CDATA[gpgpu]]></category>
		<category><![CDATA[gpu]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[vs2008]]></category>

		<guid isPermaLink="false">http://blog.ovesens.net/?p=388</guid>
		<description><![CDATA[Important The tutorial is missing some compilation, linker, library settings steps. However you can download the template project, it works and has everything setup. Introduction Download template project source Download executable I am a developer who has been developing software &#8230; <a href="http://blog.ovesens.net/2011/05/cuda-v3-2-template-project-using-cpp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Important</h2>
<p>The tutorial is missing some compilation, linker, library settings steps. However you can download the template project, it works and has everything setup.</p>
<h1>Introduction</h1>
<ul>
<li><a href="/wp-content/uploads/2011/05/CudaTemplate_Cuda_3.2.zip">Download template project source</a></li>
<li><a href="/wp-content/uploads/2011/05/CudaTemplate_exe_Cuda_3.2.zip">Download executable</a></li>
</ul>
<h2><span style="font-size: 16px; color: #444444; line-height: 24px;">I am a developer who has been developing software using .NET and C# for several years. I have never used C or C++, and it has never been required.</span></h2>
<p>I like to investigate new technologies, mainly because I am curious, but also because it could make my daily development work easier or smarter.</p>
<p>Recently my focus has been directed towards GPGPU on the Nvidia Cuda platform.</p>
<p>The programming language for Cuda is called &#8220;Cuda C&#8221;. The name implies that knowledge of C indeed is required for using GPGPU on the Cuda platform.</p>
<p>I discovered that there exist .NET bindings to the Cuda platform and drivers. However, I find their usage complicated and insufficient, and further more kernel development will still have to done in Cuda C.</p>
<p>These fact made me realise that I would have to learn a bit of C and C++ to use Cuda as it was actually intended by Nvidia. Nvidia provides many samples and suggest that a Cuda development environment on Windows could use Visual Studio and Nvidia Parallel NSight for debugging, profiling etc.</p>
<p>As my knowledge of C and C++ development was severely limited, so was the setting up and configuration of Visual Studio 2008 for Cuda C development.</p>
<p>I have read &#8220;Cuda by example&#8230;&#8221; (<a href="http://developer.nvidia.com/object/cuda-by-example.html">http://developer.nvidia.com/object/cuda-by-example.html</a>), &#8220;Programming Massively Parallel Processors&#8230;&#8221; (<a href="http://www.nvidia.com/object/io_1264656303008.html">http://www.nvidia.com/object/io_1264656303008.html</a>) and &#8220;C Programming Language, 2. edition&#8221; (<a href="http://www.pearsonhighered.com/educator/product/C-Programming-Language/9780131103627.page">http://www.pearsonhighered.com/educator/product/C-Programming-Language/9780131103627.page</a>). These books have given me the foundation to start developing using Cuda C and GPGPU.</p>
<p>Setting up Visual Studio 2008 and making the compiler work required some work, but here is what I did.</p>
<h2>1. Download and install driver and toolkit</h2>
<p>Download Cuda toolkit and the developer driver and install. A restart is probably required. (<a href="http://developer.nvidia.com/object/gpucomputing.html">http://developer.nvidia.com/object/gpucomputing.html</a>)</p>
<h2>2. Start Visual Studio 2008, and create a new project of type Win32 Console Application</h2>
<p>Give the project and solution a name (here called Cuda_Template).</p>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_2_create_project..png"><img class="alignnone size-full wp-image-389" title="Step 2 - Create solution and project" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_2_create_project..png" alt="" width="804" height="572" /></a></p>
<h2>3. Click Next</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_3_click_next.png"><img class="alignnone size-full wp-image-398" title="Step 3 - Click next" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_3_click_next.png" alt="" width="625" height="530" /></a></p>
<h2>4. Select Console application and check the empty project, then click Finish</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_4_project_settings.png"><img class="alignnone size-full wp-image-399" title="Step 4 - Project settings" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_4_project_settings.png" alt="" width="625" height="530" /></a></p>
<h2>5. Add new item called main.cpp of type C++ File</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_5_create_cpp_file.png"><img class="alignnone size-full wp-image-400" title="Step 5 - Create C++ file" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_5_create_cpp_file.png" alt="" width="804" height="514" /></a></p>
<h2>6. Add the following code the file</h2>
<pre class="brush: cpp;">#include &lt;stdio.h&gt; 

int main() {

    printf("Hello world...\n);
    return 0;

}</pre>
<h2>7. Build and try to run the exe file. The output should be</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_7_exe_output.png"><img class="alignnone size-full wp-image-404" title="Step 7 - Hello world output" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_7_exe_output.png" alt="" width="709" height="359" /></a></p>
<h2>8. Select Project -&gt; Custom Build Rules&#8230;</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_8_custom_build_rules.png"><img class="alignnone size-full wp-image-405" title="Step 8 - Custom build rules" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_8_custom_build_rules.png" alt="" width="1280" height="760" /></a></p>
<h2>9. Select Cuda Runtime API build rule (v3.2)</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_9_cuda_build_rules.png"><img class="alignnone size-full wp-image-406" title="Step 9 - Cuda build rule" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_9_cuda_build_rules.png" alt="" width="676" height="433" /></a></p>
<h2>10. Add a new file called kernel.cu</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_10_create_kernel.png"><img class="alignnone size-full wp-image-407" title="Step 10 - Create kernel" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_10_create_kernel.png" alt="" width="804" height="514" /></a></p>
<h2>11. Add the following to the file kernel.cu</h2>
<pre class="brush: c;">/* power: raise base to n-th power; n &gt;= 0 */
__device__ int devicePower(int base, int n) {

    int p = 1;

    for (int i = 1; i &lt;= n; ++i) {
        p = p * base;
    }

    return p;
}

__global__ void power( int *base, int *n, int *output, int threadMax ) {

    int tid = threadIdx.x + blockIdx.x * blockDim.x;

    if (tid &lt; threadMax) {
        output[tid] = devicePower(base[tid], n[tid]);
    }

}</pre>
<h2>12. Right click the newly created file and select properties</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_12_kernel_properties.png"><img class="alignnone size-full wp-image-414" title="Step 12 - Kernel properties" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_12_kernel_properties.png" alt="" width="1280" height="760" /></a></p>
<h2>13. Set the &#8220;Exclude From Build&#8221; and make sure that the project still builds</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_13_kernel_exclude_from_build.png"><img class="alignnone size-full wp-image-415" title="Step 13 - Exclude kernel from build" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_13_kernel_exclude_from_build.png" alt="" width="759" height="531" /></a></p>
<h2>14. Create a new file called call_kernel.cu</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_14_create_kernel_call_file..png"><img class="alignnone size-full wp-image-416" title="Step 14 - Create C++ kernel calling file" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_14_create_kernel_call_file..png" alt="" width="804" height="514" /></a></p>
<h2>15. Add the following to the file call_kernel.cu</h2>
<pre class="brush: c">#include &lt;cuda_runtime_api.h&gt;
#include "main.h"

// includes, kernels
#include &lt;kernel.cu&gt;

void call_kernel_power(int *base, int *n, int *output, int elementCount) {

    int *dev_base, *dev_n, *dev_output;
    int gridX = (elementCount+ThreadsPerBlock-1)/ThreadsPerBlock;

    cudaMalloc( (void**)&amp;dev_base, elementCount * sizeof(int) );
    cudaMalloc( (void**)&amp;dev_n, elementCount * sizeof(int) );
    cudaMalloc( (void**)&amp;dev_output, elementCount * sizeof(int) );

    cudaMemcpy( dev_base, base, elementCount * sizeof(int), cudaMemcpyHostToDevice);
    cudaMemcpy( dev_n, n, elementCount * sizeof(int), cudaMemcpyHostToDevice);

    power&lt;&lt;&lt;gridX,ThreadsPerBlock&gt;&gt;&gt;(dev_base, dev_n, dev_output, elementCount);

    cudaMemcpy( output, dev_output, elementCount * sizeof(int), cudaMemcpyDeviceToHost);

    cudaFree( dev_base );
    cudaFree( dev_n );
    cudaFree( dev_output );
}</pre>
<h2>16. Create a new header file called main.h</h2>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_16_create_main_header.png"><img class="alignnone size-full wp-image-419" title="Step 16 - Create header main.h file" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_16_create_main_header.png" alt="" width="804" height="514" /></a></p>
<h2>17. Add the following content to the file</h2>
<pre class="brush: cpp">#define ThreadsPerBlock 128

#include &lt;stdio.h&gt;

void call_kernel_power(int *base, int *n, int *output, int elementCount);</pre>
<h2>18. Update the main.cpp file with the following:</h2>
<pre class="brush: cpp">#include "main.h"

#define N   80000

int main() {

    printf("Power Cuda kernel test from C++\n");
    printf("Testing %d elements\n", N);

    int base[N], n[N], output[N];

    for(int i = 0; i &lt; N; i++) {
          base[i] = 2;
          n[i] = i+1;
          output[i] = 0;
      }

    call_kernel_power(base, n, output, N);

    for(int i = 0; i &lt; N &amp;&amp; i &lt; 15; i++) {

          printf("%d^%d = %d\n", base[i], n[i], output[i]);

      }

      printf("Done\n");

    return 0;
}</pre>
<h2>19. That should be it&#8230;</h2>
<p>You now have a template that you can work from. When you build the file and run it, I get this output:</p>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_19_exe_output.png"><img class="alignnone size-full wp-image-417" title="Step 19 - Output" src="http://blog.ovesens.net/wp-content/uploads/2011/05/CudaTemplate_19_exe_output.png" alt="" width="661" height="487" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ovesens.net/2011/05/cuda-v3-2-template-project-using-cpp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mercurial graph</title>
		<link>http://blog.ovesens.net/2011/05/mercurial-graph/</link>
		<comments>http://blog.ovesens.net/2011/05/mercurial-graph/#comments</comments>
		<pubDate>Wed, 18 May 2011 16:22:41 +0000</pubDate>
		<dc:creator>Mikkel Ovesen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[mercurial]]></category>

		<guid isPermaLink="false">http://blog.ovesens.net/?p=382</guid>
		<description><![CDATA[This is a screenshot of the Mercurial graph, of a project that I am currently is working on. It kind of looks like a string instrument you want to play]]></description>
			<content:encoded><![CDATA[<p>This is a screenshot of the Mercurial graph, of a project that I am currently is working on.</p>
<p>It kind of looks like a string instrument you want to play <img src='http://blog.ovesens.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://blog.ovesens.net/wp-content/uploads/2011/05/mercurial-graph.png"><img class="alignnone size-full wp-image-383" title="Mercurial graph" src="http://blog.ovesens.net/wp-content/uploads/2011/05/mercurial-graph.png" alt="" width="439" height="1007" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ovesens.net/2011/05/mercurial-graph/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mercurial repository locked on network share and is never released</title>
		<link>http://blog.ovesens.net/2011/03/mercurial-repository-locked-on-network-share-and-is-never-released/</link>
		<comments>http://blog.ovesens.net/2011/03/mercurial-repository-locked-on-network-share-and-is-never-released/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 14:19:08 +0000</pubDate>
		<dc:creator>Mikkel Ovesen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[mercurial]]></category>

		<guid isPermaLink="false">http://blog.ovesens.net/?p=346</guid>
		<description><![CDATA[I have experienced this when the connection is dropped in the middle of a HG command being executed. The solution is to run the following command on the machine hosting the repository. Fire the command in the directory hosting the &#8230; <a href="http://blog.ovesens.net/2011/03/mercurial-repository-locked-on-network-share-and-is-never-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have experienced this when the connection is dropped in the middle of a HG command being executed.</p>
<p>The solution is to run the following command on the machine hosting the repository. Fire the command in the directory hosting the problematic/locked .hg folder. (It is not really a requirement to execute the command on the hosting machine, but it will make it a lot quicker than over the network)</p>
<pre>hg recover</pre>
<p>That is it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ovesens.net/2011/03/mercurial-repository-locked-on-network-share-and-is-never-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IDrive .NET backup library</title>
		<link>http://blog.ovesens.net/2011/02/idrive-net-backup-library/</link>
		<comments>http://blog.ovesens.net/2011/02/idrive-net-backup-library/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 20:05:07 +0000</pubDate>
		<dc:creator>Mikkel Ovesen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[idrive]]></category>

		<guid isPermaLink="false">http://blog.ovesens.net/?p=329</guid>
		<description><![CDATA[What does IDriveLibrary it do? IDrive EVS gives you 5GB of free backup space on the IDrive platform. IDrive EVS makes it possible via a kind of web http interface to upload files and more. The library I have written &#8230; <a href="http://blog.ovesens.net/2011/02/idrive-net-backup-library/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>What does IDriveLibrary it do?</h2>
<p><a href="http://evs.idrive.com/" target="_blank">IDrive EVS</a> gives you 5GB of free backup space on the IDrive platform. IDrive EVS makes it possible via a kind of web http interface to upload files and more.</p>
<p>The library I have written is called IDriveLibrary and can be found here <a href="https://bitbucket.org/ovesen/idrivelibrary">https://bitbucket.org/ovesen/idrivelibrary</a>. My thought about the project, was to be able to write a backup routine in C# for my servers.</p>
<p>Unfortunately IDrive EVS seems buggy and slow. I have in an earlier review of backup providers deemed IDrive buggy (<a href="http://blog.ovesens.net/2010/01/test-of-online-backup-providers/">http://blog.ovesens.net/2010/01/test-of-online-backup-providers/</a>). Nothing has changed.</p>
<p>During the development of the library I have had to contact IDrive 5 times, either because documented features simply did not work or because of errors in the documentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ovesens.net/2011/02/idrive-net-backup-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Membase local development machine ip problem &#8211; FIXED</title>
		<link>http://blog.ovesens.net/2011/02/membase-local-development-machine-ip-problem-fixed/</link>
		<comments>http://blog.ovesens.net/2011/02/membase-local-development-machine-ip-problem-fixed/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 12:05:18 +0000</pubDate>
		<dc:creator>Mikkel Ovesen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[membase]]></category>

		<guid isPermaLink="false">http://blog.ovesens.net/?p=323</guid>
		<description><![CDATA[Membase caching stops working I struggled with Membase last night. I added NHibernate 2. level caching, Asp.net Session caching, Output caching and custom caching to some new Membase providers. It worked at first, but then suddenly nothing was cached, and &#8230; <a href="http://blog.ovesens.net/2011/02/membase-local-development-machine-ip-problem-fixed/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Membase caching stops working</h2>
<p>I struggled with Membase last night. I added NHibernate 2. level caching, Asp.net Session caching, Output caching and custom caching to some new Membase providers.</p>
<p>It worked at first, but then suddenly nothing was cached, and nothing was retrieved from the cache. I was working on my development machine and it seems like the problem is due to the network switching.</p>
<p>Well here is how it was solved. First navigate to the Membase server directory (C:\Program Files\Membase\Server\bin). Then execute the following commands.</p>
<p><code>service_stop.bat<br />
service_unregister.bat<br />
service_register.bat ns_1@127.0.0.1<br />
service_start.bat</code></p>
<p>Read the original here: <a href="http://blog.danhulton.com/2011/02/05/membase-on-windows-7-ip-address-fix/">http://blog.danhulton.com/2011/02/05/membase-on-windows-7-ip-address-fix/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ovesens.net/2011/02/membase-local-development-machine-ip-problem-fixed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Membase cache item expiration issue</title>
		<link>http://blog.ovesens.net/2011/02/membase-cache-item-expiration-issue/</link>
		<comments>http://blog.ovesens.net/2011/02/membase-cache-item-expiration-issue/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 17:08:42 +0000</pubDate>
		<dc:creator>Mikkel Ovesen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[membase]]></category>
		<category><![CDATA[memcache]]></category>

		<guid isPermaLink="false">http://blog.ovesens.net/?p=306</guid>
		<description><![CDATA[Membase can be used as a distributed caching platform, and best of all&#8230; it is free to use. This is from their website: Unlimited use in development and up to two nodes may be deployed for free in a production &#8230; <a href="http://blog.ovesens.net/2011/02/membase-cache-item-expiration-issue/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.membase.org/" target="_blank">Membase</a> can be used as a distributed caching platform, and best of all&#8230; it is free to use. This is from <a href="http://www.membase.com/products-and-services/overview" target="_self">their website</a>:</p>
<blockquote><p>Unlimited use in development and up to two nodes may be deployed for free in a production cluster, with modest additional prices for additional nodes.</p></blockquote>
<p>When I started to develope and test Membase&#8230; I first wondered. Why does the total number of caching items continue to increase. Why do the number never decrease?</p>
<p>I expected items to be removed when their expiration time passed, but they didn&#8217;t and I started to wonder whether I was doing something wrong.</p>
<p>It turns out that Membase does not have an active expiration cache clean-up functionality. If an item has expired, it is not removed until the next Get, or when the cache is full and items need to be evicted.</p>
<p>Here is a very good description of the logic (<a href="http://forums.membase.org/node/197">Original here</a>):</p>
<blockquote><p>Your understanding of evictions is correct. When a new item is added and there is no space for it, an older item must be thrown away. One key thing to understand is that expiration and eviction have nothing to do with one another.</p>
<p>When an item expires, nothing actually happens. It is only upon the next access of that item that the server will notice it has expired and remove it from memory. There is also no guarantee that already expired items will be evicted first, though it practicality they are usually old enough that they tend to be among the first to get evicted (but nothing in the server controls this).</p>
<p>Now, onto the nuances of evictions. Within memcached there is a slab allocator which handles memory allocation for items. Basically, the whole memory space is broken up into 1mb pages which are then broken up into slabs of varying sizes. There are configuration options to control this, but that&#8217;s the default mechanism. Each size is called a &#8220;slab class&#8221; and has its own eviction logic which means that if one slab class fills up, you can&#8217;t reclaim memory from other slab classes. Depending on the variation in size of the objects that you are putting in, this could become more or less of a problem for you. Can you telnet to your servers and run &#8216;stats&#8217; and &#8216;stats slabs&#8217; and paste the output? That will let me understand exactly where memory is being taken up in your server.</p>
<p>Another key point to understand is that evictions are not always a bad thing. With changing workloads you can end up with lots of stale data still stored in cache that just needs to take some time to be pushed out. If everything seems to be running fine (with the exception of the evictions) then you probably don&#8217;t really need to take any action. Are you seeing a large number of misses as well? High misses and high evictions can usually be correlated to mean that the application is expecting data to be there when it&#8217;s not, and that would be a problem. If the application is receiving the data that it&#8217;s asking for, your cache is working correctly.</p>
<p>Your understanding of evictions is correct. When a new item is added and there is no space for it, an older item must be thrown away. One key thing to understand is that expiration and eviction have nothing to do with one another.When an item expires, nothing actually happens. It is only upon the next access of that item that the server will notice it has expired and remove it from memory. There is also no guarantee that already expired items will be evicted first, though it practicality they are usually old enough that they tend to be among the first to get evicted (but nothing in the server controls this).Now, onto the nuances of evictions. Within memcached there is a slab allocator which handles memory allocation for items. Basically, the whole memory space is broken up into 1mb pages which are then broken up into slabs of varying sizes. There are configuration options to control this, but that&#8217;s the default mechanism. Each size is called a &#8220;slab class&#8221; and has its own eviction logic which means that if one slab class fills up, you can&#8217;t reclaim memory from other slab classes. Depending on the variation in size of the objects that you are putting in, this could become more or less of a problem for you. Can you telnet to your servers and run &#8216;stats&#8217; and &#8216;stats slabs&#8217; and paste the output? That will let me understand exactly where memory is being taken up in your server.</p>
<p>Another key point to understand is that evictions are not always a bad thing. With changing workloads you can end up with lots of stale data still stored in cache that just needs to take some time to be pushed out. If everything seems to be running fine (with the exception of the evictions) then you probably don&#8217;t really need to take any action. Are you seeing a large number of misses as well? High misses and high evictions can usually be correlated to mean that the application is expecting data to be there when it&#8217;s not, and that would be a problem. If the application is receiving the data that it&#8217;s asking for, your cache is working correctly.</p></blockquote>
<p>So if it seems like the total number of your Membase  cache items just increases and increases, don&#8217;t worry it is actually normal behavior. Just make sure you have configured the server instance with the recommended amount of  server memory and disk resources. Take a look in the <a href="http://wiki.membase.org/display/membase/Membase+Best+Practices" target="_self">best practises</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ovesens.net/2011/02/membase-cache-item-expiration-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sample TwitterTest authentication and console application</title>
		<link>http://blog.ovesens.net/2011/02/sample-twittertest-authentication-and-console-application/</link>
		<comments>http://blog.ovesens.net/2011/02/sample-twittertest-authentication-and-console-application/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 16:52:49 +0000</pubDate>
		<dc:creator>Mikkel Ovesen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.ovesens.net/?p=300</guid>
		<description><![CDATA[How to make your application or service tweet My case: I have a windows service and I want to be able to know the internal state of this service and e.g. when an exception was thrown. The obviusl answer for &#8230; <a href="http://blog.ovesens.net/2011/02/sample-twittertest-authentication-and-console-application/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>How to make your application or service tweet</h2>
<p>My case: I have a windows service and I want to be able to know the internal state of this service and e.g. when an exception was thrown. The obviusl answer for this is logging. But I already use Log4Net, and I want to be able to access this info without having to remote to the server.<br />
Others have solved this issue by making e.g. Kayak part of the service and expose that state as JSON. That do sound tempting, however I am more to some kind of logging mechanism. I know that there exists Twitter Appenders for Log4Net, but by using something existing I will not learn anything <img src='http://blog.ovesens.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
So what I want to implement is custom Twitter logging, and here is how.</p>
<ol>
<li>Register your application with Twitter (http://dev.twitter.com/apps/new)</li>
<li>Save your consumerKey and consumerSecret</li>
<li>Run TwitterAuthenticator to retrieve the Access token. Save Token and TokenSecret</li>
<li>Use the TweetConsole as a sample for Tweeting. Use the consumerKey, consumerSecret and the Access Token details</li>
</ol>
<p>That is it&#8230;</p>
<p>You can find the source code here: <a href="https://bitbucket.org/ovesen/twittertest">https://bitbucket.org/ovesen/twittertest</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ovesens.net/2011/02/sample-twittertest-authentication-and-console-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

