<?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>The Many Hats of Jason Specland &#187; Programming</title>
	<atom:link href="http://www.jasonspecland.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasonspecland.com</link>
	<description>The mostly self-deprecating story of a programmer, performer, and daddy.</description>
	<lastBuildDate>Mon, 06 Feb 2012 17:51:47 +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 Upgrade Actions Can&#8217;t Have a Comment? Really, SharePoint?</title>
		<link>http://www.jasonspecland.com/2011/11/15/my-upgrade-actions-cant-have-a-comment-really-sharepoint/</link>
		<comments>http://www.jasonspecland.com/2011/11/15/my-upgrade-actions-cant-have-a-comment-really-sharepoint/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 15:25:16 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[annoyances]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[sharepoint]]></category>

		<guid isPermaLink="false">http://www.jasonspecland.com/?p=342</guid>
		<description><![CDATA[So I&#8217;m doing new work on a SharePoint feature that&#8217;s already deployed, so naturally, I have to do some upgrade actions to deploy some new fields to a content type. There are a few fields to add, and since the &#8230; <a href="http://www.jasonspecland.com/2011/11/15/my-upgrade-actions-cant-have-a-comment-really-sharepoint/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;m doing new work on a SharePoint feature that&#8217;s already deployed, so naturally, I have to do some upgrade actions to deploy some new fields to a content type.  There are a few fields to add, and since the AddContentType field doesn&#8217;t have any naming elements, I decide to throw in some comments before each entry, so I know which field is which and I make sure I haven&#8217;t forgotten any.  Everything compiles fine and Update-SPSolution works fine.  Then, I try to run my upgrade and I get the following error:</p>
<p><a href="http://www.jasonspecland.com/wp-content/uploads/2011/11/comment_in_feature_upgrade.png"><img src="http://www.jasonspecland.com/wp-content/uploads/2011/11/comment_in_feature_upgrade.png" alt="" title="Error Message for Including a Comment in a SharePoint Feature Upgrade" width="584" height="272" class="alignnone size-full wp-image-343" /></a></p>
<p>Really, SharePoint?  You can clearly <i>see</i> that it&#8217;s a comment, and yet you still just barf on it rather than just ignoring it.  WHY!?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonspecland.com/2011/11/15/my-upgrade-actions-cant-have-a-comment-really-sharepoint/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adventures in Uninformative SharePoint Messages, or The Sandbox is Too Damn Busy for Your List Receiver</title>
		<link>http://www.jasonspecland.com/2011/10/18/adventures-in-uninformative-sharepoint-messages-or-the-sandbox-is-too-damn-busy-for-your-list-receiver/</link>
		<comments>http://www.jasonspecland.com/2011/10/18/adventures-in-uninformative-sharepoint-messages-or-the-sandbox-is-too-damn-busy-for-your-list-receiver/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 16:58:50 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[list receiver]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[sharepoint]]></category>

		<guid isPermaLink="false">http://www.jasonspecland.com/?p=337</guid>
		<description><![CDATA[Hey, non-programmer-type people who read my blog: The following is highly technical. Feel free to ignore. Still here? Great. So, here&#8217;s the situation. Tell me if it seems crazy. There are things that, to me as a programmer, don&#8217;t seem &#8230; <a href="http://www.jasonspecland.com/2011/10/18/adventures-in-uninformative-sharepoint-messages-or-the-sandbox-is-too-damn-busy-for-your-list-receiver/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hey, non-programmer-type people who read my blog:  The following is highly technical.  Feel free to ignore.</p>
<p>Still here?  Great.  So, here&#8217;s the situation.  Tell me if it seems crazy.  There are things that, to me as a programmer, don&#8217;t seem crazy at all, while more seasoned SharePoint developers would look at what I was doing and scream, &#8220;Are you <em>mad</em>?&#8221;  Like iterating through SPList.Items() in a foreach loop without first putting them into an SPListItemCollection, for example.</p>
<p>Anyway, I have the following situation:  A project tracking list, which has a &#8220;Primary Technical Lead&#8221; field and a &#8220;Secondary Technical Lead&#8221; field, both of which are single User-type.  I need to create a &#8220;Team Members&#8221; field, which is a multi-User type.  Upon creation of that field, I need to populate it with both the value from the Primary and Secondary tech lead fields.  Naturally, I chose to implement this one-time setup in the FeatureActivated event receiver.</p>
<p>Additionally, I want to make sure that whenever a tech lead is changed, that that change is reflected in the Team Members field.  I also want to make sure that you can&#8217;t delete someone from Team Members if they&#8217;re still a tech lead.  Naturally, I chose to implement this as an ItemUpdating event receiver.</p>
<p>Every time I tried to activate the solution, however, I always got the following error:</p>
<p>Unhandled exception was thrown by the sandboxed code wrapper&#8217;s Execute method in the partial trust app domain: The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request.</p>
<p>&lt;Steve Martin&gt;Well, excuuuuuuuuse me!&lt;/Steve Martin&gt;</p>
<p>Now, I wasn&#8217;t entirely un-clever about this.  Of <em>course</em> my ItemUpdating event was firing when I was trying to populate the TeamMembers field.  (Okay, I&#8217;m kind of lying.  There was a lot of blank &#8220;WTF?&#8221; going on in my head before I realized that the ItemUpdating event was firing.  Then I went through the feature activation in the debugger, and noticed that the exception was thrown when I called SPListItem.Update() or SPListItem.SystemUpdate(), which I tried in desperation.)  But my ItemUpdating method should have just quickly exited upon not seeing the fields that it was worried about in the AfterProperties.  Still, worried about my logic, I commented out my routine line by line.  Until finally, my entire ItemUpdating receiver looked like:</p>
<pre class="brush: c#; ">

public override void ItemUpdating(SPItemEventProperties properties) {
  // Lots of commented-out lines
  base.ItemUpdating(properties);
}
</pre>
<p>And still, Sandbox is Too Damn Busy.</p>
<p>Then I went to the List Receiver&#8217;s Elements.xml file, and commented out the &lt;Receiver&#8230;&gt;&lt;Type&gt;ItemUpdating&lt;/Type&gt;&#8230;&lt;/Receiver&gt; part.  And lo and behold, the Sandbox would suddenly take my calls again.</p>
<p>I then created the simplest test case.  One list.  One ItemUpdating event receiver which does nothing.  One FeatureActivated event receiver that updates a list item.  Activation == game over.</p>
<p>Now I <em>understand</em> why updating a ListItem that has an ItemUpdating receiver from a FeatureActivated receiver might be a problem.  But, once again, SharePoint has vomited forth one of the least useful error messages possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonspecland.com/2011/10/18/adventures-in-uninformative-sharepoint-messages-or-the-sandbox-is-too-damn-busy-for-your-list-receiver/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Steve Jobs Made Me a Better Developer</title>
		<link>http://www.jasonspecland.com/2011/10/06/steve-jobs-made-me-a-better-developer/</link>
		<comments>http://www.jasonspecland.com/2011/10/06/steve-jobs-made-me-a-better-developer/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 04:17:51 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[jobs]]></category>

		<guid isPermaLink="false">http://www.jasonspecland.com/?p=330</guid>
		<description><![CDATA[&#8220;It seems that perfection is reached not when there is nothing left to add, but when there is nothing left to take away&#8221;. &#8212; Antoine de Saint Exupéry Steve Jobs has passed away. Everyone is talking about him in terms &#8230; <a href="http://www.jasonspecland.com/2011/10/06/steve-jobs-made-me-a-better-developer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<blockquote><p>
&#8220;It seems that perfection is reached not when there is nothing left to add, but when there is nothing left to take away&#8221;. &#8212; Antoine de Saint Exupéry
</p></blockquote>
<p>Steve Jobs has passed away.  Everyone is talking about him in terms of what he did for the world.  His contributions have long since passed &#8220;significant&#8221; and can without reservation be called legendary.  But that will be talked about elsewhere, extensively, and by people far more eloquent than myself.</p>
<p>I&#8217;m just going to talk about what Steve Jobs did for me.  His philosophy made me a better developer.  His relentless pursuit of simplicity and ease of use for the end user changed the way I looked at IT.  </p>
<p>I used to be a unix administrator.  I used to revel in my knowledge of the arcane.  I read the BOFH with glee.  I used Linux, but I was always struggling with little things.  Editing config files.  Building from source.  But smart people like me can figure it out, right?  And for the most part, I did.</p>
<p>Then I got my first Mac, with OS X.  It had the comforting unix command line which got me in the door, but I ended up using Terminal less and less.  It just worked.  I could still mess around with my computer, but now I didn&#8217;t have to deal with the mess if I didn&#8217;t want to.</p>
<p>Then the iPhone came.  It&#8217;s hard to remember the world of cell phones before the iPhone.  It seems like we&#8217;ve always lived in a world of touch screens.  But before iPhone were dark days.  I had a Blackberry for work, and I hated it with a burning hot hate.  iPhone cut through the tyranny of the cell carriers and showed what was possible if someone, anyone, would just spend a few minutes giving a damn about their users.</p>
<p>Gradually, my entire perspective changed.  Steve Jobs showed me that making computers work in an intuitive way is not only possible, but imperative.  He showed me that programs that work in simple, expected ways can not only eliminate frustration, but can even be delightful.  &#8220;User Error&#8221; isn&#8217;t dumb people.  It&#8217;s software that doesn&#8217;t know how to work with people because no one gave enough of a damn to make it work the way ordinary, non-computer people do.</p>
<p>I work in IT, but I don&#8217;t work <em>for</em> IT.  I work for some of the most brilliant physicians and researchers in the world.  I work for an army of dedicated nurses and medical staff.  These people are smart, sophisticated, and know what they&#8217;re doing.  But they are not &#8220;computer people&#8221; and any system that requires them to be one in order to get it to work is a failure.  There is a PEBKAC error, but the &#8220;P&#8221; in this case is the programmer.</p>
<p>I&#8217;ve been fighting a fight at work recently.  No need for specifics, but I was given something from the higher-ups to implement.  Implementing it as given would have been easy.  But I knew it would be a huge and frustrating roadblock for users.  It wasn&#8217;t my place but I fought for the users, and while I haven&#8217;t won a complete victory, I did get some concessions, and I got some people to really think about how what we do affects these users.  It was the spirit of Steve Jobs that compelled me to make that stand.</p>
<p>I&#8217;m not a great programmer.  I have neither the time nor the resources to dedicate to the loving craftsmanship that&#8217;s necessary to achieve perfect Jobsian simplicity.  But I care.  I fight.  I work harder.  And I do so because of Steve Jobs and his vision.</p>
<p>Thank you, Steve.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonspecland.com/2011/10/06/steve-jobs-made-me-a-better-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharepoint: Updating Workflow Task Causes NullReferenceException (a fix)</title>
		<link>http://www.jasonspecland.com/2011/07/11/sharepoint-updating-workflow-task-causes-nullreferenceexception-a-fix/</link>
		<comments>http://www.jasonspecland.com/2011/07/11/sharepoint-updating-workflow-task-causes-nullreferenceexception-a-fix/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 20:03:24 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[sharepoint]]></category>

		<guid isPermaLink="false">http://www.jasonspecland.com/?p=312</guid>
		<description><![CDATA[Hi there, ordinary blog readers! Unless you&#8217;re a SharePoint developer, this entry isn&#8217;t for you. I&#8217;m putting this up to save future developers the head-against-wall-banging that I encountered while trying to fix this problem. So, I&#8217;m kind of new to &#8230; <a href="http://www.jasonspecland.com/2011/07/11/sharepoint-updating-workflow-task-causes-nullreferenceexception-a-fix/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hi there, ordinary blog readers!  Unless you&#8217;re a SharePoint developer, this entry isn&#8217;t for you.  I&#8217;m putting this up to save future developers the head-against-wall-banging that I encountered while trying to fix this problem.</p>
<p>So, I&#8217;m kind of new to SharePoint, so naturally, the first thing I should be doing is writing a crazy insane workflow, right?</p>
<p>I&#8217;ve got a workflow where a project manager approves a project (that&#8217;s one kind of task), or can send it out for technical review (another kind of task), or can request more information from the user (yet another task).  Each of these tasks have their own Content Type, and their own custom task edit form in ASP.NET.  (Because I hate InfoPath with a burning white hot hate.)</p>
<p>Whenever someone uses one of these custom edit forms, however, I get a NullReferenceException.  The stack trace always puts it in the non-public SPListItem.PrepeareItemForUpdate method.  It doesn&#8217;t matter how I change the task list item.  Using SPWorkflowTask.AlterTask, or just SPContext.Current.ListItem followed by Update all threw the NullReferenceException.</p>
<p>To Google I go!  However, most of the results said that it had to do with not having a &lt;FieldRefs&gt; definition in the Content Types.  That wasn&#8217;t my problem, however, since not only did my Content Types have FieldRef&#8217;s, but they were very much full.</p>
<p>At my wits end, I broke out the .NET Reflector and decompiled the Microsoft.SharePoint assembly.  Here&#8217;s what I found:</p>
<p><a href="http://www.jasonspecland.com/wp-content/uploads/2011/07/splistitem.png"><img src="http://www.jasonspecland.com/wp-content/uploads/2011/07/splistitem.png" alt="" title="Screenshot of Decompilation of SPListItem.cs in Microsoft.SharePoint Assembly" width="1098" height="128" class="alignnone size-full wp-image-313" /></a></p>
<p>As you can see (well, kind of see&#8230; click on it to see more clearly), this would only happen in a WorkflowTask.  If the list item&#8217;s &#8220;Completed&#8221; field is null, the cast to bool throws a NullReferenceException.  This is probably the kind of thing that can&#8217;t happen in SharePoint Designer, but only would occur when someone is mucking about in Visual Studio.</p>
<p>To fix it, make sure you set the &#8220;Completed&#8221; field.  I do this:</p>
<pre class="brush: c#; ">

private void SetTaskStatus(string status, bool taskIsComplete) {
      SPListItem taskItem = SPContext.Current.ListItem;

      Hashtable taskData = new Hashtable();
      taskData[SPBuiltInFieldId.TaskStatus] = status;
      taskData[SPBuiltInFieldId.Completed] = taskIsComplete;
      if (taskIsComplete) {
        taskData[SPBuiltInFieldId.PercentComplete] = 1;
      }

      SPWorkflowTask.AlterTask(taskItem, taskData, true);
    }
</pre>
<p>Or, if you work for Microsoft, you could do us a favor and make sure that you null check that line and default to false.  (It&#8217;s entirely possible that this has been fixed by SP1, but my production server doesn&#8217;t run that yet, so I can&#8217;t either.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonspecland.com/2011/07/11/sharepoint-updating-workflow-task-causes-nullreferenceexception-a-fix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Unit Testing: Rhino Mocks, Ordered Mocks, and Events</title>
		<link>http://www.jasonspecland.com/2010/09/16/unit-testing-rhino-mocks-ordered-mocks-and-events/</link>
		<comments>http://www.jasonspecland.com/2010/09/16/unit-testing-rhino-mocks-ordered-mocks-and-events/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 16:23:11 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[rhino mocks]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://www.jasonspecland.com/?p=188</guid>
		<description><![CDATA[Tired of all that improv show talk? Well, now it&#8217;s time for me to get my geek on. Non-computer geeks feel free to tune out. This is actually more along the lines of &#8220;put it out there for the sake &#8230; <a href="http://www.jasonspecland.com/2010/09/16/unit-testing-rhino-mocks-ordered-mocks-and-events/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Tired of all that improv show talk?  Well, now it&#8217;s time for me to get my geek on.  Non-computer geeks feel free to tune out.  This is actually more along the lines of &#8220;put it out there for the sake of future Googlers&#8221; than a serious discussion.</p>
<p>I&#8217;ve had test-first religion for some time now, but deadlines have made me something of a lapsed tester.  After finding a pretty bad-ass bug in my code, I got religion again, admitted I was a sinner, and went forward in Testing.  I am redeeming myself by writing a few hundred unit tests of already existing code.</p>
<p>My preferred mock framework is Rhino Mocks.  Now I&#8217;m all about the AAA (Arrange, Act, Assert) syntax.  99.9% of my tests (seriously, I&#8217;ve got over a thousand of them) are AAA.  Most of my tests are unordered.  I just want to test that something was called, and I don&#8217;t care what was called before or after it.</p>
<p>But you can&#8217;t do AAA syntax when you&#8217;re doing ordered tests.  It hasn&#8217;t been a problem thus far, but I ran into a problem when I started testing objects that hooked up events in the constructor: So my code looked like this:</p>
<pre class="brush: c#; ">

namespace RhinoMocksOrdredWithEvents {
    public interface IOrderedThing {
        void FirstThing();
        void SecondThing();
        void SomethingElse();
        event EventHandler&lt;EventArgs&gt; OnThingHappened;
    }

    public class MyTestClass {

        private IOrderedThing MyOrderedThing { get; set; }

        public MyTestClass(IOrderedThing orderedThing) {
            MyOrderedThing = orderedThing;
            MyOrderedThing.OnThingHappened += new EventHandler&lt;EventArgs&gt;(MyOrderedThing_OnThingHappened);
            MyOrderedThing.SomethingElse();
        }

        public void DoThingsInOrder() {

            MyOrderedThing.SomethingElse();

            MyOrderedThing.FirstThing();
            MyOrderedThing.SecondThing();
        }

        private void MyOrderedThing_OnThingHappened(object sender, EventArgs e) {
            return;
        }

    }
}
</pre>
<p>And here&#8217;s the test to make sure that FirstThing() and SecondThing() are called in order:</p>
<pre class="brush: c#; ">

namespace RhinoMocksOrdredWithEvents {
    [TestClass]
    public class OrderedMockTests { 

        [TestMethod]
        public void TestThingsAreRunInOrder() {
            // Arrange
            MockRepository mocks = new MockRepository(); 

            IOrderedThing mockOrderedThing = mocks.DynamicMock&lt;IOrderedThing&gt;(); 

            MyTestClass classUnderTest = new MyTestClass(mockOrderedThing); 

            using (mocks.Record()) {
                using (mocks.Ordered()) {
                    mockOrderedThing.Expect(thing =&gt; thing.FirstThing());
                    mockOrderedThing.Expect(thing =&gt; thing.SecondThing());
                }
            } 

            mockOrderedThing.Replay(); 

            // Act
            classUnderTest.DoThingsInOrder(); 

            // Assert
            mockOrderedThing.VerifyAllExpectations();
        }
    }
} 
</pre>
<p>Be not fooled by my spurious use of the //Arange, //Act, and //Assert comments.  This is most definitely not the AAA syntax.</p>
<p>So when I tried to run this test, I got the following error:</p>
<p><code><br />
Test method<br />
RhinoMocksOrdredWithEvents.OrderedMockTests.TestThingsAreRunInOrder<br />
threw exception:<br />
Rhino.Mocks.Exceptions.ExpectationViolationException:<br />
IOrderedThing.add_OnThingHappened(System.EventHandler`1[System.EventArgs]);<br />
Expected #1, Actual #0..<br />
</code></p>
<p>What what what!?  I never told Rhino Mocks that I expected the event to be wired!  And anyway, it <i>is</i> wired, right there in the constructor, see?  Then I comment out the event hookup, and the test works!  So off I sauntered to the Rhino Mocks mailing list all like, &#8220;Hey guys, I don&#8217;t mean to be all smug and stuff, but all y&#8217;all got a bug.&#8221;</p>
<p>Thankfully, <a href="http://devlicio.us/blogs/tim_barcz/">Tim Barcz</a> on the mailing list set me straight.</p>
<p>Yes, Virginia, you <i>can</i> do the AAA syntax in an ordered mock, and this is how you do it:</p>
<pre class="brush: c#; ">

namespace RhinoMocksOrdredWithEvents {
    [TestClass]
    public class OrderedMockTests {

        [TestMethod]
        public void TestThingsAreRunInOrder() {
            // Arrange
            //MockRepository mocks = new MockRepository();

            IOrderedThing mockOrderedThing = MockRepository.GenerateMock&lt;IOrderedThing&gt;();

            MyTestClass classUnderTest = new MyTestClass(mockOrderedThing);

            mockOrderedThing.GetMockRepository().Ordered();

            mockOrderedThing.Expect(thing =&gt; thing.FirstThing());
            mockOrderedThing.Expect(thing =&gt; thing.SecondThing());

            // Act
            classUnderTest.DoThingsInOrder();

            // Assert
            mockOrderedThing.VerifyAllExpectations();

        }
    }
}
</pre>
<p>Which works no matter what strange stuff you want to do in the constructor.</p>
<p>Much thanks to Tim Barcz for setting me straight.  Here is <a href="http://groups.google.com/group/rhinomocks/browse_thread/thread/7bfe0b3e2fc59baf/2dbbdc920e78f10a#2dbbdc920e78f10a">the original thread on the Rhino Mocks mailing list</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonspecland.com/2010/09/16/unit-testing-rhino-mocks-ordered-mocks-and-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging WCF Services In Visual Studio 2008 in 32-bit Mode on a 64-bit Architecture</title>
		<link>http://www.jasonspecland.com/2010/06/15/debugging-wcf-services-in-visual-studio-2008-in-32-bit-mode-on-a-64-bit-architecture/</link>
		<comments>http://www.jasonspecland.com/2010/06/15/debugging-wcf-services-in-visual-studio-2008-in-32-bit-mode-on-a-64-bit-architecture/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 14:25:59 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.jasonspecland.com/?p=100</guid>
		<description><![CDATA[This is for my own reference, (and for the sake of anyone Googling) since this has been driving me crazy for months. Feel free to ignore if you&#8217;re not a geek. Feel free to correct it if you are. When &#8230; <a href="http://www.jasonspecland.com/2010/06/15/debugging-wcf-services-in-visual-studio-2008-in-32-bit-mode-on-a-64-bit-architecture/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is for my own reference, (and for the sake of anyone Googling) since this has been driving me crazy for months.  Feel free to ignore if you&#8217;re not a geek.  Feel free to correct it if you are.</p>
<p>When building a WCF project for the x86 architecture on an x64 machine/OS (like, say, Windows 7), you will get a BadFormatException when you try to debug it.  This is because WcfSvcHost.exe will run in the mode defined by your architecture, regardless of your particular build environment.  Microsoft says that this is working as intended.  I say boloney, but I&#8217;m a VS version behind now.  (I haven&#8217;t tested VS 2010 yet.)</p>
<p><a href="https://connect.microsoft.com/VisualStudio/feedback/details/349510/vs2008-incorrectly-launches-x64-version-of-wcfsvchost-for-x86-debugging?wa=wsignin1.0#">Here is a link to part of the solution.</a></p>
<p><code><br />
corflags /32BIT+ WcfSvcHost.exe<br />
</code></p>
<p>However, the signature of this assembly is now broken, and won&#8217;t load.  So to bypass that:</p>
<p><code><br />
sn -Vr WcfSvcHost.exe<br />
</code></p>
<p>to remove strong name signature verification.</p>
<p><b>DANGER:</b><br />
Don&#8217;t do that unless you know what you&#8217;re doing!  That opens up a <i>huge</i> security risk.  Do not do that in a production environment!  Only do it on your dev box!</p>
<p>Why not just build the app in x64 or (even better) Any CPU?  Because I can&#8217;t get Oracle.DataAccess in 64-bit.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonspecland.com/2010/06/15/debugging-wcf-services-in-visual-studio-2008-in-32-bit-mode-on-a-64-bit-architecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming Praxis: Goldbach&#8217;s Conjecture</title>
		<link>http://www.jasonspecland.com/2010/03/02/programming-praxis-goldbachs-conjecture/</link>
		<comments>http://www.jasonspecland.com/2010/03/02/programming-praxis-goldbachs-conjecture/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 03:26:26 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[praxis]]></category>

		<guid isPermaLink="false">http://www.jasonspecland.com/?p=72</guid>
		<description><![CDATA[Since I mentioned in my last post that I live in fear of the tech interview, I decided to do something about it rather than live in fear. To that end, I subscribed to a website called Programming Praxis, which &#8230; <a href="http://www.jasonspecland.com/2010/03/02/programming-praxis-goldbachs-conjecture/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Since I mentioned in my last post that I live in fear of the tech interview, I decided to do something about it rather than live in fear.  To that end, I subscribed to a website called Programming Praxis, which publishes short programming problems to sharpen your saw on.  (Well, I&#8217;d actually been a subscriber for a while, but it&#8217;s just now that I&#8217;ve actually took the time to do my own saw sharpening.)</p>
<p>Geek Content Ahead.  Feel Free to Ignore.</p>
<p><a href="http://programmingpraxis.com/2010/03/02/goldbachs-conjecture/">Today&#8217;s Praxis</a> is on the <a href="http://en.wikipedia.org/wiki/Goldbach_conjecture">Goldbach Conjecture</a> which states that any even number greater than 2 can be expressed as the sum of two primes.  The challenge is to write a program that will take in an even number, and spit out the two primes that can be added together to make it.</p>
<p>I realize my solution is extremely naive, but it&#8217;s the first time in a long time that I&#8217;ve actually worked on programming problems other than &#8220;get data from database a, transform it somehow, and put it in database b.&#8221;  Also, for extra difficulty (and speed, although my algorithm is the real speed hangup in this case) I wrote it in C.</p>
<p>For the one or two people still reading, here is my extremely naive solution, cobbled together while watching West Side Story on TCM.</p>
<pre class="brush: cpp; ">

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

void show_usage();
unsigned long *create_sieve_to_number(unsigned long number);

int main (int argc, const char * argv[]) {

    if (argc != 2) {
		show_usage();
		return -1;
	}

	unsigned long number = atol(argv[1]);

	if ((number % 2) != 0) {
		show_usage();
		return -1;
	}

	unsigned long *sieve = create_sieve_to_number(number);

	for (unsigned long i = 2; i &lt; number; i++) {
		if (sieve[i] == 1) {
			for (unsigned long j = i; j &lt; number; j++) {
				if (sieve[j] == 1) {
					if (i + j == number) {
						printf(&quot;Solution found: %d + %d\n&quot;, i, j);
						return 0;
					}
				}
			}
		}
	}

	printf(&quot;no solution found!  pick up your Fields Medal!\n&quot;);

	return 0;

}

void show_usage(void) {
	printf(&quot;usage: goldbach [even number]\n&quot;);
}

unsigned long *create_sieve_to_number(unsigned long number) {
	unsigned long *sieve;

	sieve = (unsigned long *)malloc(sizeof(unsigned long) * (number + 1));

	for (int i = 0; i &lt; number; i++) {
		sieve[i] = 1;
	}

	for (unsigned long i = 2; i &lt; number; i++) {
		if (sieve[i] == 1) {
			for (unsigned long j = i * i; j &lt; number; j = j + i) {
				sieve[j] = 0;
			}
		}
	}

	return sieve;
}
</pre>
<p><b>Edit:</b> See what happens when you&#8217;re watching TV when you&#8217;re doing your homework?  The flags marking numbers as prime can be a bool (or even a bit) and most certainly does <i>not</i> have to be an unsigned long.  Yay for massive, massive wastes of memory!  (But hey, I <i>was</i> watching West Side Story&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonspecland.com/2010/03/02/programming-praxis-goldbachs-conjecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Dreaded Technology Test</title>
		<link>http://www.jasonspecland.com/2010/02/23/the-dreaded-technology-test/</link>
		<comments>http://www.jasonspecland.com/2010/02/23/the-dreaded-technology-test/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 17:14:14 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[anxiety]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[interview]]></category>

		<guid isPermaLink="false">http://www.jasonspecland.com/?p=70</guid>
		<description><![CDATA[A recent post on Coding Horror about &#8220;Non-Programmer Programmers&#8221; kind of terrified me. Not because I think that my job is going away, and not because I think my skills aren&#8217;t up to snuff, but because the technical interview terrifies &#8230; <a href="http://www.jasonspecland.com/2010/02/23/the-dreaded-technology-test/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A recent <a href="http://www.codinghorror.com/blog/2010/02/the-nonprogramming-programmer.html">post on Coding Horror</a> about &#8220;Non-Programmer Programmers&#8221; kind of terrified me.  Not because I think that my job is going away, and not because I think my skills aren&#8217;t up to snuff, but because the technical interview terrifies me like nothing else.</p>
<p>Jason, with performance anxiety?  Yes, it&#8217;s true!</p>
<p>As a performer, I come from the world of improv, where the mantra is &#8220;Just make it up!  What you say will always be correct!&#8221;  Naturally, this level of bullshittery, while it <i>might</i> get you through a real interview, will never do in a technical interview where you will be eviscerated if you don&#8217;t know the systems you claim to know.  (Or even some detail of a system you really do know, but had never previously used.)  Now I&#8217;ve never put something on my résumé that I did not actually use, but in some cases, it&#8217;s just been a while and I need a few minutes with my friend Google to get back up to speed.</p>
<p>Part of the problem is that the tech interview is like flying an airplane.  Once you stall once, it&#8217;s really hard not to crash and burn.  You just get more and more flustered until you can&#8217;t even answer questions about things that you <i>do</i> know extensively.</p>
<p>I had an interview like that just before I interviewed for my current job.  It was October/November 2001, and as you could imagine, New York City was on edge and not in a hiring mood, especially in the &#8220;dot-com&#8221; world which had gone bust.  I interviewed downtown with a famous phone company for a unix administrator job.  I can&#8217;t remember what question started the stall&#8230; I think it was something about rpc, or what port something listened on&#8230; But after that, I was dead in the water.  They asked me a bog-simple RAID question that I totally blew.  As they escorted me out of the building, one of the managers sypathetically said to me, &#8220;It must be hard getting a job in this economy&#8230;&#8221;  Shellshocked, I agreed.</p>
<p>Reading that article on Coding Horror, and remembering that interview, kept me awake far too late last night.  Again, I&#8217;m reasonably confident that my job&#8217;s not going anywhere, and I&#8217;m confident in my abilities, but one has to plan for these things.</p>
<p>Then today, sitting in the office that I&#8217;ve occupied for almost nine years now, I remembered a tech interview that was tough, but I knocked out of the park.  (In particular, I remember totally killing a question about DNS.)  Naturally, its the one that got me the job I have today.  And they seem to like me after all these years, to the point where they actually let me write production code.</p>
<p>Scary though the tech interview may be, if I keep my skills up, keep my cool, and remember how to pull out of a stall, I should be okay.  Besides, the &#8220;weed out&#8221; questions on that Coding Horror article are laughably easy.  And if your tech interview feels like the Spanish Inquisition, did I really want to work for you in the first place?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonspecland.com/2010/02/23/the-dreaded-technology-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

