<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<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/"
	>

<channel>
	<title>Rizal Almashoor's Blog</title>
	<link>http://www.rizalalmashoor.com/blog</link>
	<description>Valid use of Null</description>
	<pubDate>Tue, 05 Jun 2012 11:44:53 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>Invoking a post-build batch file in TFS 2010</title>
		<link>http://www.rizalalmashoor.com/blog/invoking-a-post-build-batch-file-in-tfs-2010/</link>
		<comments>http://www.rizalalmashoor.com/blog/invoking-a-post-build-batch-file-in-tfs-2010/#comments</comments>
		<pubDate>Mon, 04 Jun 2012 09:46:30 +0000</pubDate>
		<dc:creator>Rizal Almashoor</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.rizalalmashoor.com/blog/invoking-a-post-build-batch-file-in-tfs-2010/</guid>
		<description><![CDATA[The scenario: you are using TFS 2010 as your build server, and you would like to deploy files to a remote server upon successful build by invoking a batch file.
Do note that the following steps work great in conjunction with Visual Studio T4 Templates, whereby multiple .config files (e.g. Web.Dev.config, Web.Test.config) can be generated from [...]]]></description>
			<content:encoded><![CDATA[<p>The scenario: you are using TFS 2010 as your build server, and you would like to deploy files to a remote server upon successful build by invoking a batch file.</p>
<p>Do note that the following steps work great in conjunction with Visual Studio T4 Templates, whereby multiple .config files (e.g. Web.Dev.config, Web.Test.config) can be generated from a master template to reflect different connection strings, etc. <a href="http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-config-files">Oleg Sych has a nice write-up on this</a>. Hint: hand-edit your .csproj file and use the DependentUpon element to keep your project view clean in Visual Studio&mdash;multiple .tt files can be nested under the main .tt file.</p>
<ol>
<li>Make a copy of DefaultTemplate.xaml and check it in. Let&#8217;s call it BatchFilePostBuild.xaml.</li>
<li>Open BatchFilePostBuild.xaml in the designer and add 2 new Arguments:
<ul>
<li>BatchFile (Direction = In, Argument type = String, Default value = [blank])</li>
<li>BatchFileArguments (Direction = In, Argument type = String, Default value = [blank])</li>
</ul>
</li>
<li>Expand &#8220;Run On Agent&#8221;. Drag &#8220;InvokeProcess&#8221; from the Toolbox and place it after &#8220;Try Compile, Test, and Associate &#8230;&#8221;</li>
<li>In the Properties pane for InvokeProcess:<br />
<table border="1" style="border-collapse: collapse">
<tr>
<th>Property</th>
<th>Value</th>
</tr>
<tr>
<td>Arguments</td>
<td><code>BatchFileArguments</code></td>
</tr>
<tr>
<td>EnvironmentVariables</td>
<td><code>New Dictionary(Of String, String) From {{&quot;SourcesDirectory&quot;, SourcesDirectory}, {&quot;BinariesDirectory&quot;, BinariesDirectory}}</code></td>
</tr>
<tr>
<td>FileName</td>
<td><code>BatchFile.Replace(&quot;$(SourceDir)&quot;, SourcesDirectory)</code></td>
</tr>
</table>
</li>
<li>Double-click InvokeProcess:
<ul>
<li>Drag &#8220;WriteBuildMessage&#8221; from the Toolbox and place it under stdOutput. Set Importance = High, Message = stdOutput.</li>
<li>Drag &#8220;WriteBuildWarning&#8221; from the Toolbox and place it under stdError. Set Message = stdError.</li>
</ul>
</li>
<li>Save and check in BatchFilePostBuild.xaml.</li>
<li>In Team Explorer, create a new build definition, with its process template being BatchFilePostBuild.xaml.</li>
<li>In the Process tab, there will be 2 properties under Misc:<br />
<table border="1" style="border-collapse: collapse">
<tr>
<th>Property</th>
<th>Value</th>
</tr>
<tr>
<td>BatchFile</td>
<td>Here you can specify the path and file name to your batch file relative to $(SourceDir). Refer to the folder structures in the Workspace tab.</td>
</tr>
<tr>
<td>BatchFileArguments</td>
<td>A list of arguments separated by spaces. In your batch file, they will be <code>%1</code>, <code>%2</code>, <code>%3</code>, and so on.</td>
</tr>
</table>
</li>
<li>Create and check in your batch file. In this batch file you will be able to refer to <code>%SourcesDirectory%</code> and <code>%BinariesDirectory%</code>, in addition to <code>%1</code>, <code>%2</code>, <code>%3</code>, etc. above. Assuming <code>%1</code> is the environment type (e.g. &#8220;Test&#8221;) and <code>%2</code> is the server name, here are some useful commands:<br />
<table border="1" style="border-collapse: collapse">
<tr>
<td>Clean target folder</td>
<td><code>del /s /q "\\%2\path\to\remote\folder\*"</code></td>
</tr>
<tr>
<td>Copy directory structure</td>
<td><code>xcopy "%BinariesDirectory%\path\to\folder\*" "\\%2\path\to\remote\folder" /s /y</code></td>
</tr>
<tr>
<td>Copy Web.Test.config to the Test server</td>
<td><code>copy /y "%BinariesDirectory%\_PublishedWebsites\MyProject\Web.%1.config" "\\%2\path\to\remote\folder\Web.config"</code></td>
</tr>
<tr>
<td>Start remote Windows service</td>
<td><code>sc \\%2 start "My Windows Service"</code></td>
</tr>
<tr>
<td>Stop remote Windows service</td>
<td><code>sc \\%2 stop "My Windows Service"</code></td>
</tr>
<tr>
<td>Dirty wait for around 30 seconds</td>
<td><code>ping 127.0.0.1 -n 30 &gt; NUL</code></td>
</tr>
</table>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.rizalalmashoor.com/blog/invoking-a-post-build-batch-file-in-tfs-2010/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Exception-handling wrappers for Task.ContinueWith()</title>
		<link>http://www.rizalalmashoor.com/blog/exception-handling-wrappers-for-taskcontinuewith/</link>
		<comments>http://www.rizalalmashoor.com/blog/exception-handling-wrappers-for-taskcontinuewith/#comments</comments>
		<pubDate>Mon, 28 May 2012 09:59:05 +0000</pubDate>
		<dc:creator>Rizal Almashoor</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.rizalalmashoor.com/blog/exception-handling-wrappers-for-taskcontinuewith/</guid>
		<description><![CDATA[The .NET 4 Task Parallel Library is great because you can specify continuations for new threads:


private Task&#60;WebResponse&#62; GetWebResponseAsync(string url)
{
    var webRequest = WebRequest.Create(url);
    return Task.Factory.FromAsync&#60;WebResponse&#62;(
        webRequest.BeginGetResponse,
        webRequest.EndGetResponse,
        null);
}

public [...]]]></description>
			<content:encoded><![CDATA[<p>The .NET 4 Task Parallel Library is great because you can specify continuations for new threads:</p>
<div style="font-size: 0.85em">
<pre class="brush: csharp">
private Task&lt;WebResponse&gt; GetWebResponseAsync(string url)
{
    var webRequest = WebRequest.Create(url);
    return Task.Factory.FromAsync&lt;WebResponse&gt;(
        webRequest.BeginGetResponse,
        webRequest.EndGetResponse,
        null);
}

public void Run(string url)
{
    Task.Factory.StartNew(StartBusyIndicator)
        .ContinueWith(task => GetWebResponseAsync(url)).Unwrap()
        .ContinueWith(task => Console.WriteLine(task.Result.Headers))
        .ContinueWith(task => StopBusyIndicator());
}
</pre>
</div>
<p>Otherwise we&#8217;d have to handle the result of the async call either in callbacks or in event handlers&mdash;messy.</p>
<p>There are two caveats, though, when using <code>Task.ContinueWith()</code>. The first is that we have to sometimes use <code>.Unwrap()</code>. The second is that we have to handle exceptions in the next <code>.ContinueWith()</code>. Otherwise, our exceptions will just get swallowed.</p>
<p>So now:</p>
<div style="font-size: 0.85em">
<pre class="brush: csharp">
public void Run(string url)
{
    Task.Factory.StartNew(StartBusyIndicator)
        .ContinueWith(task => GetWebResponseAsync(url)).Unwrap()
        .ContinueWith(task =>
        {
            if (task.IsFaulted) // handle errors
            else Console.WriteLine(task.Result.Headers);
        })
        .ContinueWith(task => StopBusyIndicator());
}
</pre>
</div>
<p>There goes our pretty code. Also, imagine the duplication if we do this for every <code>.ContinueWith()</code>.</p>
<p>And so, inspired by Stephen Toub&#8217;s <a href="http://blogs.msdn.com/b/pfxteam/archive/2010/11/21/10094564.aspx">Processing Sequences of Asynchronous Operations with Tasks</a>, I&#8217;ve written drop-in replacements for <code>.ContinueWith()</code> and <code>.Unwrap()</code> that will bubble up exceptions to a <code>.Finally()</code> extension method. Now our code can be clean again:</p>
<pre class="brush: csharp">
public void Run(string url)
{
    Task.Factory.StartNew(StartBusyIndicator)
        .Then(task => GetWebResponseAsync(url))
        .Then(task => Console.WriteLine(task.Result.Headers))
        .Finally(ExceptionHandler, StopBusyIndicator);
}
</pre>
<p>Do help yourself to the <a href="https://gist.github.com/2818038">full source and example usage at github:gist</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rizalalmashoor.com/blog/exception-handling-wrappers-for-taskcontinuewith/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Calling an Oracle function using NHibernate</title>
		<link>http://www.rizalalmashoor.com/blog/calling-an-oracle-function-using-nhibernate/</link>
		<comments>http://www.rizalalmashoor.com/blog/calling-an-oracle-function-using-nhibernate/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 08:31:16 +0000</pubDate>
		<dc:creator>Rizal Almashoor</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rizalalmashoor.com/blog/calling-an-oracle-function-using-nhibernate/</guid>
		<description><![CDATA[
Tested with NHibernate 2.1.2 and Oracle 11g.
Needs Oracle.DataAccess (not System.Data.OracleClient). Tested with Oracle.DataAccess 2.111.6.0 AMD64.
If your Oracle function returns a scalar value of datatype number, the .NET object will be a Decimal.

NHibernate config:

&#60;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&#62;
  &#60;session-factory&#62;
    &#60;property name="connection.driver_class"&#62;
      NHibernate.Driver.OracleDataClientDriver
    &#60;/property&#62;
  &#60;/session-factory&#62;
&#60;/hibernate-configuration&#62;

C# code:

var result [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>Tested with NHibernate 2.1.2 and Oracle 11g.</li>
<li>Needs Oracle.DataAccess (not System.Data.OracleClient). Tested with Oracle.DataAccess 2.111.6.0 AMD64.</li>
<li>If your Oracle function returns a scalar value of datatype number, the .NET object will be a Decimal.</li>
</ol>
<p>NHibernate config:</p>
<pre class="brush: xml">
&lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&gt;
  &lt;session-factory&gt;
    &lt;property name="connection.driver_class"&gt;
      NHibernate.Driver.OracleDataClientDriver
    &lt;/property&gt;
  &lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;
</pre>
<p>C# code:</p>
<pre class="brush: csharp">
var result = nhibernateSession
    .CreateSQLQuery("select GetSomeValue(:p_parameter1) from dual")
    .SetParameter("p_parameter1", parameter1)
    .UniqueResult();

// GetSomeValue returns a scalar of datatype number; result will be object of type Decimal

var someValue = Convert.ToInt32(result);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rizalalmashoor.com/blog/calling-an-oracle-function-using-nhibernate/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Calling an Oracle stored procedure using NHibernate</title>
		<link>http://www.rizalalmashoor.com/blog/calling-an-oracle-stored-procedure-using-nhibernate/</link>
		<comments>http://www.rizalalmashoor.com/blog/calling-an-oracle-stored-procedure-using-nhibernate/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 08:16:41 +0000</pubDate>
		<dc:creator>Rizal Almashoor</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.rizalalmashoor.com/blog/calling-an-oracle-stored-procedure-using-nhibernate/</guid>
		<description><![CDATA[
The stored procedure must have an out sys_refcursor parameter as the first argument.
Tested with NHibernate 2.1.2 and Oracle 11g.
Needs Oracle.DataAccess (not System.Data.OracleClient). Tested with Oracle.DataAccess 2.111.6.0 AMD64.

NHibernate config:

&#60;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&#62;
  &#60;session-factory&#62;
    &#60;property name="connection.driver_class"&#62;
      NHibernate.Driver.OracleDataClientDriver
    &#60;/property&#62;
  &#60;/session-factory&#62;
&#60;/hibernate-configuration&#62;

NHibernate mapping:

&#60;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="SampleProject" namespace="SampleProject"&#62;
  &#60;sql-query name="GetEmployeesByDepartmentId"&#62;
 [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>The stored procedure must have an out <strong>sys_refcursor</strong> parameter as the <strong>first</strong> argument.</li>
<li>Tested with NHibernate 2.1.2 and Oracle 11g.</li>
<li>Needs Oracle.DataAccess (not System.Data.OracleClient). Tested with Oracle.DataAccess 2.111.6.0 AMD64.</li>
</ol>
<p>NHibernate config:</p>
<pre class="brush: xml">
&lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&gt;
  &lt;session-factory&gt;
    &lt;property name="connection.driver_class"&gt;
      NHibernate.Driver.OracleDataClientDriver
    &lt;/property&gt;
  &lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;
</pre>
<p>NHibernate mapping:</p>
<pre class="brush: xml">
&lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="SampleProject" namespace="SampleProject"&gt;
  &lt;sql-query name="GetEmployeesByDepartmentId"&gt;
    &lt;return class="Employee" /&gt;
    { call GetEmployeesByDepartmentId(:p_departmentid) }
  &lt;/sql-query&gt;
&lt;/hibernate-mapping&gt;
</pre>
<p>C# code:</p>
<pre class="brush: csharp">
var employees = nhibernateSession
    .GetNamedQuery("GetEmployeesByDepartmentId")
    .SetParameter("p_departmentid", departmentId)
    .List&lt;Employee&gt;();
</pre>
<p>To execute a stored procedure that has no out parameters:</p>
<pre class="brush: csharp">
nhibernateSession
    .CreateSQLQuery("call DoSomething(:p_parameter1)")
    .SetParameter("p_parameter1", parameter1)
    .ExecuteUpdate();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rizalalmashoor.com/blog/calling-an-oracle-stored-procedure-using-nhibernate/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LINQPad &#8211; a worthy successor to Snippet Compiler</title>
		<link>http://www.rizalalmashoor.com/blog/linqpad-a-worthy-successor-to-snippet-compiler/</link>
		<comments>http://www.rizalalmashoor.com/blog/linqpad-a-worthy-successor-to-snippet-compiler/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 10:03:15 +0000</pubDate>
		<dc:creator>Rizal Almashoor</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[Applications]]></category>

		<guid isPermaLink="false">http://www.rizalalmashoor.com/blog/linqpad-a-worthy-successor-to-snippet-compiler/</guid>
		<description><![CDATA[In 2009 I blogged about how Snippet Compiler allows us to test out C# code without having to create a project in Visual Studio just for that. Now there&#8217;s something better: LINQPad. Don&#8217;t be misled by its name; it&#8217;s not just for LINQ, it can run any C#, VB, or even SQL code. I particularly [...]]]></description>
			<content:encoded><![CDATA[<p>In 2009 I <a href="http://www.rizalalmashoor.com/blog/snippet-compiler">blogged</a> about how <a href="http://www.sliver.com/dotnet/SnippetCompiler/">Snippet Compiler</a> allows us to test out C# code without having to create a project in Visual Studio just for that. Now there&#8217;s something better: <a href="http://www.linqpad.net">LINQPad</a>. Don&#8217;t be misled by its name; it&#8217;s not just for LINQ, it can run any C#, VB, or even SQL code. I particularly like its results view. A screenshot is worth a thousand words:</p>
<p><img src="http://www.linqpad.net/linqpadscreen.png" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rizalalmashoor.com/blog/linqpad-a-worthy-successor-to-snippet-compiler/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Problem with Transactions on Windows 64-bit Oracle Client</title>
		<link>http://www.rizalalmashoor.com/blog/problem-with-transactions-on-windows-64-bit-oracle-client/</link>
		<comments>http://www.rizalalmashoor.com/blog/problem-with-transactions-on-windows-64-bit-oracle-client/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 04:56:25 +0000</pubDate>
		<dc:creator>Rizal Almashoor</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rizalalmashoor.com/blog/problem-with-transactions-on-windows-64-bit-oracle-client/</guid>
		<description><![CDATA[After upgrading to a 64-bit machine at the office, my Visual Studio 2010 unit tests that were making heavy use of transactions (i.e., hundreds of uncommitted database table insertions within a using (new TransactionScope()) statement) failed with the following error message:
ORA-00603: ORACLE server session terminated by fatal error
ORA-00600: internal error code, arguments: [ktcirs:hds], [0&#215;00F7D8078], [0&#215;006F10BF0], [...]]]></description>
			<content:encoded><![CDATA[<p>After upgrading to a 64-bit machine at the office, my Visual Studio 2010 unit tests that were making heavy use of transactions (i.e., hundreds of uncommitted database table insertions within a <code>using (new TransactionScope())</code> statement) failed with the following error message:</p>
<p><code>ORA-00603: ORACLE server session terminated by fatal error<br />
ORA-00600: internal error code, arguments: [ktcirs:hds], [0&#215;00F7D8078], [0&#215;006F10BF0], [0&#215;01B8C8078], [], [], [], [], [], [], [], []<br />
ORA-00600: internal error code, arguments: [ktcirs:hds], [0&#215;00F7D8078], [0&#215;006F10BF0], [0&#215;01B8C8078], [], [], [], [], [], [], [], []<br />
Process ID: 4084<br />
Session ID: 125 Serial number: 369</code></p>
<h4>The solution</h4>
<ol>
<li>Install 64-bit Oracle Client 11.1.0.6.0 (<code><a href="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/111060-win64soft-099656.html">win64_11gR1_client.zip</a></code>) but do <strong>not</strong> install Oracle Services for Microsoft Transaction Server.</li>
<li>Install <strong>only</strong> OraMTS using 64-bit Oracle Data Access Component 11.2.0.2.1 (<code><a href="http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html">ODAC112021Xcopy_x64.zip</a></code>).</li>
</ol>
<h4>What&#8217;s the problem, BTW?</h4>
<p>&#8220;Windows Vista and Windows Server 2008 introduce new MSDTC changes that do not interoperate with older versions of Oracle Services for MTS. Oracle Services for MTS 10.2.0.4 and higher, <strong>with the exception of 11.1.0.6</strong>, support these new changes on Windows Vista Service Pack 1 and Windows Server 2008 or higher.&#8221; Source: <a href="http://www.oracle.com/technetwork/database/windows/index-089915.html">http://www.oracle.com/technetwork/database/windows/index-089915.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rizalalmashoor.com/blog/problem-with-transactions-on-windows-64-bit-oracle-client/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Robocopy in lieu of rsync</title>
		<link>http://www.rizalalmashoor.com/blog/robocopy-in-lieu-of-rsync/</link>
		<comments>http://www.rizalalmashoor.com/blog/robocopy-in-lieu-of-rsync/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 05:59:45 +0000</pubDate>
		<dc:creator>Rizal Almashoor</dc:creator>
		
		<category><![CDATA[LAMP]]></category>

		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.rizalalmashoor.com/blog/robocopy-in-lieu-of-rsync/</guid>
		<description><![CDATA[Perhaps you’re a web developer familiar with Linux and SVN. Then you’ll definitely know how to copy files from your SVN working directory to a test server whilst excluding all .svn directories:
rsync -IrW --stats --exclude=.svn /path/to/project/dir/ //testsrv/whatever
If for some reason your development environment is Windows you might be tempted to use rsync on Cygwin. That’s [...]]]></description>
			<content:encoded><![CDATA[<p>Perhaps you’re a web developer familiar with Linux and SVN. Then you’ll definitely know how to copy files from your SVN working directory to a test server whilst excluding all .svn directories:</p>
<p><code>rsync -IrW --stats --exclude=.svn /path/to/project/dir/ //testsrv/whatever</code></p>
<p>If for some reason your development environment is Windows you might be tempted to use rsync on Cygwin. That’s works fine (albeit with a very noticeable performance lag), but there is actually a native Windows alternative to rsync:</p>
<p><code>robocopy \path\to\project\dir \\testsrv\whatever /MIR /XD .svn</code></p>
<p>Robocopy has long been available on NT 4.0 via the Windows Resource Kit, and is included in Vista, Windows 7, and Windows Server 2008.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rizalalmashoor.com/blog/robocopy-in-lieu-of-rsync/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Memories of the past</title>
		<link>http://www.rizalalmashoor.com/blog/memories-of-the-past/</link>
		<comments>http://www.rizalalmashoor.com/blog/memories-of-the-past/#comments</comments>
		<pubDate>Sat, 08 Jan 2011 16:01:46 +0000</pubDate>
		<dc:creator>Rizal Almashoor</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rizalalmashoor.com/blog/memories-of-the-past/</guid>
		<description><![CDATA[The past doesn&#8217;t exist, except in our minds. There is not one past, but many pasts, each belonging to a different person.
If not for memory, there would be no such thing as the past. It is literally all in the mind.
Easy enough to comprehend, but extremely difficult to internalize.
]]></description>
			<content:encoded><![CDATA[<p>The past doesn&#8217;t exist, except in our minds. There is not one past, but many pasts, each belonging to a different person.</p>
<p>If not for memory, there would be no such thing as the past. It is literally all in the mind.</p>
<p>Easy enough to comprehend, but extremely difficult to internalize.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rizalalmashoor.com/blog/memories-of-the-past/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A fundamentally flawed argument</title>
		<link>http://www.rizalalmashoor.com/blog/a-fundamentally-flawed-argument/</link>
		<comments>http://www.rizalalmashoor.com/blog/a-fundamentally-flawed-argument/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 21:38:43 +0000</pubDate>
		<dc:creator>Rizal Almashoor</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rizalalmashoor.com/blog/a-fundamentally-flawed-argument/</guid>
		<description><![CDATA[I believe that everyone has at least one fundamental flaw. Those who think they aren&#8217;t fundamentally flawed turn out to have three fundamental flaws: first, their fundamental flaw; second, their ignorance of their fundamental flaw; and third, their belief that they are free of fundamental flaws.
The least fundamentally flawed are those armed with full knowledge [...]]]></description>
			<content:encoded><![CDATA[<p>I believe that everyone has at least one fundamental flaw. Those who think they aren&#8217;t fundamentally flawed turn out to have three fundamental flaws: first, their fundamental flaw; second, their ignorance of their fundamental flaw; and third, their belief that they are free of fundamental flaws.</p>
<p>The least fundamentally flawed are those armed with full knowledge of exactly how much and in what way they are fundamentally flawed. Inhabiting unhappy middle ground would be those who are aware that they&#8217;re fundamentally flawed, but now how so.</p>
<p>If it is indeed possible not to be fundamentally flawed, then that would be the biggest fundamental flaw of all.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rizalalmashoor.com/blog/a-fundamentally-flawed-argument/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Implementing the right-click context menu in Silverlight 4</title>
		<link>http://www.rizalalmashoor.com/blog/implementing-the-right-click-context-menu-in-silverlight-4/</link>
		<comments>http://www.rizalalmashoor.com/blog/implementing-the-right-click-context-menu-in-silverlight-4/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 03:58:55 +0000</pubDate>
		<dc:creator>Rizal Almashoor</dc:creator>
		
		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.rizalalmashoor.com/blog/implementing-the-right-click-context-menu-in-silverlight-4/</guid>
		<description><![CDATA[
Download and install Silverlight 4 Toolkit - April 2010.
In your Silverlight 4 project, add references to:

System.Windows.Controls
System.Windows.Controls.Input.Toolkit

In your UserControl XAML, add the following to the LayoutRoot grid opening tag: MouseRightButtonDown="LayoutRoot_MouseRightButtonDown" MouseRightButtonUp="LayoutRoot_MouseRightButtonUp"
In the codebehind:


using System.Windows.Controls;

...

private void LayoutRoot_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
    e.Handled = true;
}

private void LayoutRoot_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
    var contextMenu = [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>Download and install <a href="http://silverlight.codeplex.com/releases/view/43528">Silverlight 4 Toolkit - April 2010</a>.</li>
<li>In your Silverlight 4 project, add references to:
<ul>
<li><code>System.Windows.Controls</code></li>
<li><code>System.Windows.Controls.Input.Toolkit</code></li>
</ul>
<li>In your UserControl XAML, add the following to the LayoutRoot grid opening tag: <code>MouseRightButtonDown="LayoutRoot_MouseRightButtonDown" MouseRightButtonUp="LayoutRoot_MouseRightButtonUp"</code></li>
<li>In the codebehind:</li>
</ol>
<pre class="brush: csharp">
using System.Windows.Controls;

...

private void LayoutRoot_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
    e.Handled = true;
}

private void LayoutRoot_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
    var contextMenu = new ContextMenu();

    var menuItem = new MenuItem();
    menuItem.Header = "First menu item";
    menuItem.Click += menuItem_Click;
    contextMenu.Items.Add(menuItem);

    contextMenu.IsOpen = true;
    contextMenu.HorizontalOffset = e.GetPosition(null).X;
    contextMenu.VerticalOffset = e.GetPosition(null).Y;
}

private void menuItem_Click(object sender, System.Windows.RoutedEventArgs e)
{
    System.Windows.MessageBox.Show("First menu item was clicked");
}
</pre>
<h3>Notes</h3>
<ul>
<li>If you don&#8217;t include a reference to <code>System.Windows.Controls</code>, you won&#8217;t be able to compile, with the error &#8220;&#8216;System.Windows.Controls.MenuItem&#8217; does not contain a definition for &#8216;Header&#8217; and no extension method &#8216;Header&#8217; accepting a first argument of type &#8216;System.Windows.Controls.MenuItem&#8217; could be found (are you missing a using directive or an assembly reference?)&#8221;</li>
<li>Ensure that <code>System.Windows.Controls.Toolkit</code> (if present) is version 4.0.5.0. If it&#8217;s version 2.0.5.0, you&#8217;ll get runtime error &#8220;Unknown parser error: Scanner 2148474880. [Line: 818 Position: 596]&#8221;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rizalalmashoor.com/blog/implementing-the-right-click-context-menu-in-silverlight-4/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
