<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>XYZPDQ</title>
  <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/" />
  <link rel="self" href="http://www.xyzpdq.org/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2010-11-24T13:00:14.1533527-08:00</updated>
  <author>
    <name>Cody Beckner</name>
  </author>
  <subtitle>ramblings of a .Net coder</subtitle>
  <id>http://www.xyzpdq.org/</id>
  <generator uri="http://dasblog.info/" version="2.2.8279.16125">DasBlog</generator>
  <entry>
    <title>Remote Reboot of Windows 7</title>
    <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/2010/11/24/RemoteRebootOfWindows7.aspx" />
    <id>http://www.xyzpdq.org/PermaLink,guid,90fb8765-1792-47e7-887c-967f6b0e2e9c.aspx</id>
    <published>2010-11-24T12:58:38.9740921-08:00</published>
    <updated>2010-11-24T13:00:14.1533527-08:00</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I ran into an interesting problem recently where I was (admittedly) too lazy to walk
upstairs and reboot my desktop that I use as a home server. 
</p>
        <p>
 
</p>
        <p>
I connected via remote desktop only to discover that I was not able to reboot the
machine from the start menu via a RDC.  
</p>
        <p>
 
</p>
        <p>
Curiosity, persistence (and laziness) prevailed and I spent some time researching
to figure out how to get around this pesky issue. 
</p>
        <p>
 
</p>
        <p>
Being a lover of most things related to the command prompt, I fired one up in admin
mode (since like a good user, my account is not an administrator by default) and tried
to reboot using 
</p>
        <code>shutdown /r /t 0</code> only to be thwarted with a <code>Access is Denied(5).</code> message.  
<p>
 
</p><p>
Researching this told me what was already plainly obvious, it was a permissions issue
and I did not have permissions to do what I wanted.
</p><p>
 
</p><p>
Digging a little further, I came across the solution. 
</p><p>
 
</p><ol><li>
Open the policy editor (secpol.msc) 
</li><li>
Expand Local Policies 
</li><li>
Select User Rights Assignment 
</li><li>
Find the Force shutdown from a remote system policy and add your account. 
</li><li>
Once this is done, go to a command prompt and run gpupdate 
</li></ol><p>
 
</p><p>
Now, when you run shutdown /r /t 0, your remote computer will promptly heed your wishes
and restart.
</p><img width="0" height="0" src="http://www.xyzpdq.org/aggbug.ashx?id=90fb8765-1792-47e7-887c-967f6b0e2e9c" /></div>
    </content>
  </entry>
  <entry>
    <title>Sorting a .Net List with Lambdas</title>
    <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/2010/04/07/SortingANetListWithLambdas.aspx" />
    <id>http://www.xyzpdq.org/PermaLink,guid,7d610533-dc4c-4266-9892-a5c209510586.aspx</id>
    <published>2010-04-07T12:15:14.2735223-07:00</published>
    <updated>2010-04-07T12:15:14.2735223-07:00</updated>
    <category term=".Net" label=".Net" scheme="http://www.xyzpdq.org/CategoryView,category,Net.aspx" />
    <category term="C#" label="C#" scheme="http://www.xyzpdq.org/CategoryView,category,C.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I love linq.  I would wager that most developers who have done much with it share
a similar love.
</p>
        <p>
It makes our lives easier.  It eliminates writing copies amounts of loops, parsing
xml, interacting with databases, you name it.  It’s great.
</p>
        <p>
 
</p>
        <p>
When I run into a situation where linq does not have an obvious tie in, I start to
get a little anxious,  (pathetic I realize).
</p>
        <p>
 
</p>
        <p>
Today I was faced with a situation where I had a list of custom classes that I needed
to sort.  
</p>
        <p>
This being a list, OrderBy was nowhere to be found.
</p>
        <p>
 
</p>
        <p>
So, I returned to my roots and started writing a compare for my class so that I could
use the Sort command that <em>is </em>part of the List generic type.  That is
when it struck me that I could probably accomplish this using a lambda.  It turns
out that I was correct.  Lambda’s were a perfect fit for this scenario. 
The code remained clean and concise and I was saved having to write additional methods
just to accomplish a one-off scenario on what was a otherwise complete project.
</p>
        <p>
 
</p>
        <p>
Lamdas are a progression in C# past anonymous methods.  In the code below, I
show how the code would be implemented with separate function, an anonymous method
and finally, with a Lambda expression.
</p>
        <p>
 
</p>
        <p>
First, the test class that we’ll be working with:
</p>
        <pre class="c-sharp" name="code">public class MyClass
{
    public int propA { get; set; }
    public int propB { get; set; }
    public int propC { get; set; }
}</pre>
        <p>
Our test class:
</p>
        <pre class="c-sharp" name="code">public class Tester
{
    public void Main()
    {
        List<myclass>
list = new List<myclass>
(); list.Add(new MyClass() { propA = 1, propB = 2, propC = 3 }); list.Add(new MyClass()
{ propA = 2, propB = 3, propC = 4 }); list.Add(new MyClass() { propA = 3, propB =
4, propC = 5 }); list.Add(new MyClass() { propA = 4, propB = 5, propC = 6 }); } }
</myclass></myclass></pre>
        <p>
Now then, we write a custom comparer.  Not a <em>lot</em> of code, but you can
imagine how this extrapolates over various properties for large classes.
</p>
        <pre class="c-sharp" name="code">public class Tester
{
    private static int CompareByPropA(MyClass a, MyClass b)
    {
        return a.propA.CompareTo(b.propA);
    }
    public void Main()
    {
        List<myclass>
list = new List<myclass>
(); list.Add(new MyClass() { propA = 1, propB = 2, propC = 3 }); list.Add(new MyClass()
{ propA = 2, propB = 3, propC = 4 }); list.Add(new MyClass() { propA = 3, propB =
4, propC = 5 }); list.Add(new MyClass() { propA = 4, propB = 5, propC = 6 }); //Using
the comparer built into the MyClass method list.Sort(CompareByPropA); } }
</myclass></myclass></pre>
        <p>
This time, we drop the custom comparer and implement the sort using an anonymous method.
</p>
        <pre class="c-sharp" name="code">public class Tester
{
    public void Main()
    {
        List<myclass>
list = new List<myclass>
(); list.Add(new MyClass() { propA = 1, propB = 2, propC = 3 }); list.Add(new MyClass()
{ propA = 2, propB = 3, propC = 4 }); list.Add(new MyClass() { propA = 3, propB =
4, propC = 5 }); list.Add(new MyClass() { propA = 4, propB = 5, propC = 6 }); //Using
an anonymous method list.Sort(delegate(MyClass a, MyClass b) { return a.propA.CompareTo(b.propA);
}); } }
</myclass></myclass></pre>
        <p>
Finally, we rewrite the anonymous method into a Lambda.  It is still easy to
read and much more concise.
</p>
        <pre class="c-sharp" name="code">public class Tester
{
    public void Main()
    {
        List<myclass>
list = new List<myclass>
(); list.Add(new MyClass() { propA = 1, propB = 2, propC = 3 }); list.Add(new MyClass()
{ propA = 2, propB = 3, propC = 4 }); list.Add(new MyClass() { propA = 3, propB =
4, propC = 5 }); list.Add(new MyClass() { propA = 4, propB = 5, propC = 6 }); //Using
a Lambda list.Sort((a, b) =&gt; a.propA.CompareTo(b.propA)); } }
</myclass></myclass></pre>
        <p>
So, next time you go to write custom compare code, step back and see if you can do
it a little more simply.  If you are going to be using your comparison code in
more than one place, then perhaps it is still a better idea to implement it using
that route vs the lambda.  If it is a one-off thing, then a lambda and some linq
can be a beautiful thing!
</p>
        <img width="0" height="0" src="http://www.xyzpdq.org/aggbug.ashx?id=7d610533-dc4c-4266-9892-a5c209510586" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Review of Flex 4 In Action</title>
    <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/2010/03/21/ReviewOfFlex4InAction.aspx" />
    <id>http://www.xyzpdq.org/PermaLink,guid,8489c6c4-27ae-4ced-b582-94632ac92474.aspx</id>
    <published>2010-03-21T13:59:40.8367181-07:00</published>
    <updated>2010-03-21T14:01:50.1057755-07:00</updated>
    <category term="ActionScript" label="ActionScript" scheme="http://www.xyzpdq.org/CategoryView,category,ActionScript.aspx" />
    <category term="Flex" label="Flex" scheme="http://www.xyzpdq.org/CategoryView,category,Flex.aspx" />
    <category term="Reviews" label="Reviews" scheme="http://www.xyzpdq.org/CategoryView,category,Reviews.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
As someone who has relatively little experience with Flex, I found this book to be
a great asset in furthering my understanding of how and why things work the way they
do not only in MXML, but also on the ActionScript side. 
</p>
        <p>
 
</p>
        <p>
The tone of the book is very friendly.  As a general rule, I did not find myself
bogged down in technical terminology.  A good balance was struck between keeping
things simple for the average reader, yet still technical enough to hold the attention
of somebody with more in depth knowledge of previous versions of Flex. 
</p>
        <p>
 
</p>
        <p>
The book also starts out with a nice section on the benefits of Flex and RIA's in
general along with a few pointers on how to sell upper management on its use. 
From there they move on to cover the basics of ActionScript and Flex and show how
MXML layout works, how MXML and AS work with one another, some basics on how to work
with data inside of your application and also detail the differences between the old
Halo controls and the new Spark controls. 
</p>
        <p>
 
</p>
        <p>
The second section of the book delves into more complex topics like the event model,
view states, writing custom components and more.  There is a small jump in the
assumed capabilities of the reading audience at this point.  Readers who are
new to Flex and who have worked through the first part of the book should still be
able to follow along at this point. 
</p>
        <p>
The only negative that struck me as I was reading the book was the code samples. 
While they do an excellent job of demonstrating the topic that they are associated
with, I would have preferred if by the time I reached the end of the book I had a
fully working reference application vs a series of smaller individual apps. 
</p>
        <p>
 
</p>
        <p>
Overall, I enjoyed reading the book and learned quite a lot, not only about Flex 4,
but Flex as a whole.  The authors did a good job of keeping the subject matter
entertaining and making their various contributions flow seamlessly together. 
</p>
        <p>
 
</p>
        <p>
I would recommend this book both to people who are staring out in Flex development
as well as people who are already familiar with Flex and looking to find out what
is new in Flex 4.
</p>
        <p>
 
</p>
        <p>
You can pre-order your copy on <a href="http://www.amazon.com/Flex-4-Action-Dan-Orlando/dp/1935182420" target="_blank">Amazon</a></p>
        <img width="0" height="0" src="http://www.xyzpdq.org/aggbug.ashx?id=8489c6c4-27ae-4ced-b582-94632ac92474" />
      </div>
    </content>
  </entry>
  <entry>
    <title>OData = Hotness</title>
    <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/2010/03/17/ODataHotness.aspx" />
    <id>http://www.xyzpdq.org/PermaLink,guid,216b81ea-90e7-423d-9472-aba206278b80.aspx</id>
    <published>2010-03-16T19:10:55.1562637-07:00</published>
    <updated>2010-03-16T19:10:55.1562637-07:00</updated>
    <category term=".Net" label=".Net" scheme="http://www.xyzpdq.org/CategoryView,category,Net.aspx" />
    <category term="OData" label="OData" scheme="http://www.xyzpdq.org/CategoryView,category,OData.aspx" />
    <category term="WCF" label="WCF" scheme="http://www.xyzpdq.org/CategoryView,category,WCF.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Microsoft has officially announced <a href="http://www.odata.org" target="_blank">OData</a>. 
If you are not aware of what this is, then in a sentence: OData is a queryable REST
based interface that exposes your data via AtomPub.
</p>
        <p>
 
</p>
        <p>
To publish a feed, you have to use .Net.  However, they have provided client
sdk’s for a variety of languages to allow for simple querying of the exposed services
and they are working on several more.
</p>
        <p>
 
</p>
        <p>
I strongly encourage you to check it out.
</p>
        <p>
 
</p>
        <p>
Partly to give an idea of what is possible, and partly for my own reference, I am
going to repost a “cheat sheet” that I found online at <a href="http://blogs.msdn.com/alexj/default.aspx" target="_blank">Meta-Me</a></p>
        <p>
 
</p>
        <p>
 
</p>
        <h4>The Service:
</h4>
        <p>
It all starts with a Data Service hosted somewhere:
</p>
        <p>
          <u>
            <a href="http://server/service.svc">http://server/service.svc</a>
          </u>
        </p>
        <h4> 
</h4>
        <h4>Basic queries:
</h4>
        <p>
You access the Data Service entities through resource sets, like this:
</p>
        <p>
          <u>http://server/service.svc/People</u>
        </p>
        <p>
You request a specific entity using its key like this:
</p>
        <p>
          <u>http://server/service.svc/People(16)</u>
        </p>
        <p>
Or by using a reference relationship to something else you know:
</p>
        <p>
          <u>http://server/service.svc/People(16)/Mother</u>
        </p>
        <p>
This asks for person 16’s mother.
</p>
        <p>
Once you have identified an entity you can refer to it’s properties directly: 
</p>
        <p>
          <u>
            <a href="http://server/service.svc/People(16)/Mother/Firstname">http://server/service.svc/People(16)/Mother/Firstname</a>
          </u>
        </p>
        <h4> 
</h4>
        <h4>$value:
</h4>
        <p>
But the last query wraps the property value in XML, if you want just the raw property
value you append $value to the url like this:
</p>
        <p>
          <u>
            <a href="http://server/service.svc/People(16)/Mother/Firstname/$value">http://server/service.svc/People(16)/Mother/Firstname/$value</a>
          </u>
        </p>
        <h4> 
</h4>
        <h4>$filter:
</h4>
        <p>
You can filter resource sets using $filter:
</p>
        <p>
          <u>http://server/service.svc/People?$filter=Firstname  eq ‘Fred’</u>
        </p>
        <p>
Notice that strings in the filter are single quoted. 
</p>
        <p>
Numbers need no quotes though:
</p>
        <p>
          <u>http://server/service.svc/Posts?$filter=AuthorId eq 1</u>
        </p>
        <p>
To filter by date you have identity the date in the filter, like this:
</p>
        <p>
          <u>http://server/service.svc/Posts?$filter=CreatedDate eq DateTime'2009-10-31'</u>
        </p>
        <p>
You can filter via reference relationships:
</p>
        <p>
          <u>http://server/service.svc/People?$filter=Mother/Firstname eq 'Wendy'</u>
        </p>
        <p>
The basic operators you can use in a filter are:
</p>
        <table border="0" cellspacing="0" cellpadding="2" width="423">
          <tbody>
            <tr>
              <td valign="top" width="139">
                <p align="center">
                  <font size="3">
                    <b>Operator</b>
                  </font>
                </p>
              </td>
              <td valign="top" width="172">
                <p align="center">
                  <font size="3">
                    <b>Description</b>
                  </font>
                </p>
              </td>
              <td valign="top" width="110">
                <p align="center">
                  <font size="3">
                    <b>C# equivalent</b>
                  </font>
                </p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="139">
                <p align="center">
eq
</p>
              </td>
              <td valign="top" width="172">
                <p align="center">
                  <b>eq</b>uals
</p>
              </td>
              <td valign="top" width="110">
                <p align="center">
==
</p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="139">
                <p align="center">
ne
</p>
              </td>
              <td valign="top" width="172">
                <p align="center">
                  <b>n</b>ot <b>e</b>qual
</p>
              </td>
              <td valign="top" width="110">
                <p align="center">
!=
</p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="139">
                <p align="center">
gt
</p>
              </td>
              <td valign="top" width="172">
                <p align="center">
                  <b>g</b>reater <b>t</b>han
</p>
              </td>
              <td valign="top" width="110">
                <p align="center">
&gt;
</p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="139">
                <p align="center">
ge
</p>
              </td>
              <td valign="top" width="172">
                <p align="center">
                  <b>g</b>reater than or <b>e</b>qual 
</p>
              </td>
              <td valign="top" width="110">
                <p align="center">
&gt;=
</p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="139">
                <p align="center">
lt
</p>
              </td>
              <td valign="top" width="172">
                <p align="center">
                  <b>l</b>ess <b>t</b>han 
</p>
              </td>
              <td valign="top" width="110">
                <p align="center">
&lt;
</p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="139">
                <p align="center">
le
</p>
              </td>
              <td valign="top" width="172">
                <p align="center">
                  <b>l</b>ess than or <b>e</b>qual
</p>
              </td>
              <td valign="top" width="110">
                <p align="center">
&lt;=
</p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="139">
                <p align="center">
and
</p>
              </td>
              <td valign="top" width="172">
                <p align="center">
and
</p>
              </td>
              <td valign="top" width="110">
                <p align="center">
&amp;&amp;
</p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="139">
                <p align="center">
or
</p>
              </td>
              <td valign="top" width="172">
                <p align="center">
or
</p>
              </td>
              <td valign="top" width="110">
                <p align="center">
||
</p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="139">
                <p align="center">
()
</p>
              </td>
              <td valign="top" width="172">
                <p align="center">
grouping
</p>
              </td>
              <td valign="top" width="110">
                <p align="center">
()
</p>
              </td>
            </tr>
          </tbody>
        </table>
        <p>
          <a href="http://server/service.svc/People%2816%29/Mother/Firstname/$value" mce_href="http://server/service.svc/People(16)/Mother/Firstname/$value">
          </a>
        </p>
        <p>
There are also a <a href="http://msdn.microsoft.com/en-us/library/cc668793.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc668793.aspx">series
of functions</a> that you can use in your filters if needed.
</p>
        <h4> 
</h4>
        <h4>$expand:
</h4>
        <p>
If you want to include related items in the results you use $expand like this:
</p>
        <p>
          <u>http://server/service.svc/Blogs?$expand=Posts</u>
        </p>
        <p>
This returns the matching Blogs and each Blog’s posts.
</p>
        <h4> 
</h4>
        <h4>$select:
</h4>
        <p>
Some Data Services allow you to limit the results to just the properties you require
– aka projection – for example if you just want the Id and Title of matching Posts
you would need something like this:
</p>
        <p>
          <u>http://server/service.svc/Posts?$select=Id,Title</u>
        </p>
        <p>
You can even project properties of related objects too, like this:
</p>
        <p>
          <u>http://server/service.svc/Posts?$expand=Blog&amp;$select=Id,Title,Blog/Name</u>
        </p>
        <p>
This projects just the Id, Title and the Name of the Blog for each Post.
</p>
        <h4> 
</h4>
        <h4>$count:
</h4>
        <p>
If you just want to know how many records would be returned, without retrieving them
you need $count:
</p>
        <p>
          <u>http://server/service.svc/Blogs/$count</u>
        </p>
        <p>
Notice that $count becomes one of the segments of the URL – it is not part of the
query string – so if you want to combine it with another operation like $filter you
have to specify $count first, like this:
</p>
        <p>
          <u>http://server/service.svc/Posts/$count?$filter=AuthorId eq 6</u>
        </p>
        <p>
This query returns the number of posts authored by person 6.
</p>
        <h4> 
</h4>
        <h4>$orderby:
</h4>
        <p>
If you need your results ordered you can use $orderby:
</p>
        <p>
          <u>http://server/service.svc/Blogs?$orderby=Name</u>
        </p>
        <p>
Which returns the results in ascending order, to do descending order you need:
</p>
        <p>
          <u>http://server/service.svc/Blogs?$orderby=Name%20desc</u>
        </p>
        <p>
To filter by first by one property and then by another you need:
</p>
        <p>
          <u>http://server/service.svc/People?$orderby=Surname,Firstname</u>
        </p>
        <p>
Which you can combine with <b>desc</b> if necessary.
</p>
        <h4> 
</h4>
        <h4>$top:
</h4>
        <p>
If you want just the first 10 items you use $top like this:
</p>
        <p>
          <u>
            <a href="http://server/service.svc/People?$top=10">http://server/service.svc/People?$top=10</a>
          </u>
        </p>
        <h4> 
</h4>
        <h4>$skip:
</h4>
        <p>
If you are only interested in certain page of date, you need $top and $skip together:
</p>
        <p>
          <u>http://server/service.svc/People?$top=10&amp;$skip=20</u>
        </p>
        <p>
This tells the Data Service to skip the first 20 matches and return the next 10. Useful
if you need to display the 3rd page of results when there are 10 items per page.
</p>
        <p>
          <font color="#808080">
            <b>Note:</b> It is often a good idea to combine $top &amp; $skip
with $orderby too, to guarantee the order results are retrieved from the underlying
data source is consistent.</font>
        </p>
        <h4> 
</h4>
        <h4>$inlinecount &amp; $skiptoken:
</h4>
        <p>
Using $top and $skip allows the client to control paging. 
</p>
        <p>
But the server also needs a way to control paging – to minimize workload need to service
both naive and malicious clients – the OData protocol supports this via <a href="http://blogs.msdn.com/astoriateam/archive/2009/03/19/ado-net-data-services-v1-5-ctp1-server-driven-paging.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/03/19/ado-net-data-services-v1-5-ctp1-server-driven-paging.aspx">Server
Driven Paging</a>. 
</p>
        <p>
With Server Driven Paging turned on the client might ask for every record, but they
will only be given one page of results. 
</p>
        <p>
This as you can imagine can make life a little tricky for client application developers.
</p>
        <p>
If the client needs to know how many results there really are, they can append the
$inlinecount option to the query, like this:
</p>
        <p>
          <u>http://server/service.svc/People?$inlinecount=allpages</u>
        </p>
        <p>
The results will include a total count ‘inline’, and a url generated by the server
to get the next page of results. 
<br /><br />
This generated url includes a $skiptoken, that is the equivalent of a cursor or bookmark,
that instructs the server where to resume:
</p>
        <p>
          <u>
            <a href="http://server/service.svc/People?$skiptoken=4">http://server/service.svc/People?$skiptoken=4</a>
          </u>
        </p>
        <h4> 
</h4>
        <h4>$links
</h4>
        <p>
Sometime you just need to get the urls for entities related to a particular entity,
which is where $links comes in: 
</p>
        <p>
          <u>http://server/service.svc/Blogs(1)/$links/Posts</u>
        </p>
        <p>
This tells the Data Service to return links – aka urls – for all the Posts related
to Blog 1.
</p>
        <h4> 
</h4>
        <h4>$metadata
</h4>
        <p>
If you need to know what model an OData compliant Data Service exposes, you can do
this by going to the root of the service and appending $metadata like this:
</p>
        <p>
          <u>http://server/service.svc/$metadata</u>
        </p>
        <p>
This should return an <a href="http://download.microsoft.com/download/B/0/B/B0B199DB-41E6-400F-90CD-C350D0C14A53/[MC-EDMX].pdf" mce_href="http://download.microsoft.com/download/B/0/B/B0B199DB-41E6-400F-90CD-C350D0C14A53/[MC-EDMX].pdf">EDMX</a> file
containing the <a href="http://download.microsoft.com/download/B/0/B/B0B199DB-41E6-400F-90CD-C350D0C14A53/[MC-CSDL].pdf" mce_href="http://download.microsoft.com/download/B/0/B/B0B199DB-41E6-400F-90CD-C350D0C14A53/[MC-CSDL].pdf">conceptual
model</a> (aka EDM) exposed by the Data Service.
</p>
        <img width="0" height="0" src="http://www.xyzpdq.org/aggbug.ashx?id=216b81ea-90e7-423d-9472-aba206278b80" />
      </div>
    </content>
  </entry>
  <entry>
    <title>ColdFusion Troubles</title>
    <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/2010/02/26/ColdFusionTroubles.aspx" />
    <id>http://www.xyzpdq.org/PermaLink,guid,7a9ce043-e153-40cd-aadf-7a32ee82e2b9.aspx</id>
    <published>2010-02-26T12:34:51.6737087-08:00</published>
    <updated>2010-02-26T12:37:05.9749696-08:00</updated>
    <category term="Adobe" label="Adobe" scheme="http://www.xyzpdq.org/CategoryView,category,Adobe.aspx" />
    <category term="ColdFusion" label="ColdFusion" scheme="http://www.xyzpdq.org/CategoryView,category,ColdFusion.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have been running awry of ColdFusion.
</p>
        <p>
 
</p>
        <p>
I am running Windows XP (not by choice), and *had* a local installation of ColdFusion
8 Server.  The instance of ColdFusion was stopped since it is a bit of a memory
hog and I was not actively using it.  I have been working on getting an instance
of Telligent Community Server up and running for evaluation purposes.  I was
baffled by the fact that the Telligent demo was taking around 10 minutes on average
to load a page from the local system.  
</p>
        <p>
 
</p>
        <p>
Needless to say, since everything else seemed to be running fine, I was blaming Telligent’s
software.  Then I started exploring a little more and figure out that IIS was
taking around 30 seconds just to serve up an image.  Something was definitely
up, but despite all of my best troubleshooting skills, I could not source the problem.
</p>
        <p>
 
</p>
        <p>
I did what I always do when something goes wrong that I don’t understand, I turned
to Google.
</p>
        <p>
 
</p>
        <p>
I tried about 20 different “solutions” until I stumbled across a forum post saying
to start ColdFusion if it was installed.  *poof*. The page that took 10 minutes
to load before now takes 5 seconds.  It turns out that the CF ISAPI plugin is
constantly trying to talk to the server.  If it can’t find the server, it doesn’t
just die, it keeps trying. … on every. single. request.
</p>
        <p>
 
</p>
        <p>
          <strike>strike one.</strike>
        </p>
        <p>
 
</p>
        <p>
A short while later, I was working on trying to speed up a dashboard application that 
coworker and I had written.  It is pretty simple. CF queries the database and
retrieves somewhere in the range of 10-700 rows of data, turns them into objects,
passes those objects off to Flex which then graphs the objects.  It was performing
fine as long as there was less than 40 rows. By the time you got up to a few hundred
rows of data, it would take an obscene amount of time to load. 
</p>
        <p>
 
</p>
        <p>
We scratched our heads for the longest time and were pretty convinced that the Flex
chart control was to blame.
</p>
        <p>
 
</p>
        <p>
Then we had an idea.  Instead of letting CF instantiate each row into an object,
just send CF the results as an XML document from the database, let CF hand the XML
off to Flex, and then proceed from there.
</p>
        <p>
 
</p>
        <p>
Same story. 10 minutes now became 2 seconds.
</p>
        <p>
 
</p>
        <p>
It seems that ColdFusion doesn’t do so well at creating objects.
</p>
        <p>
 
</p>
        <p>
          <strike>strike two.</strike>
        </p>
        <p>
 
</p>
        <p>
I’m not very pleased with ColdFusion at the moment.
</p>
        <img width="0" height="0" src="http://www.xyzpdq.org/aggbug.ashx?id=7a9ce043-e153-40cd-aadf-7a32ee82e2b9" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Response.Redirect inside of a Try/Catch</title>
    <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/2009/03/27/ResponseRedirectInsideOfATryCatch.aspx" />
    <id>http://www.xyzpdq.org/PermaLink,guid,339fa3cd-b6d9-4adc-a06c-3ccdf2dbbc1d.aspx</id>
    <published>2009-03-26T17:23:01.7045527-07:00</published>
    <updated>2009-03-26T17:23:01.7045527-07:00</updated>
    <category term=".Net" label=".Net" scheme="http://www.xyzpdq.org/CategoryView,category,Net.aspx" />
    <category term="ASP.Net" label="ASP.Net" scheme="http://www.xyzpdq.org/CategoryView,category,ASPNet.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Ok, first off, let me state, that I am not entirely certain WHY I did this in the
first place.  I am going to say I was rushed and wasn’t thinking clearly. 
However, I glazed over it and moved on and when it came time to test, I was getting
bizarre behavior that didn’t throw an error.
</p>
        <pre class="c-sharp" name="code">
Session[“var”] = “”; 

try 
{ 
    Session[“var”] = “Good Value”;

    Response.Redirect(“newpage.html”); 
} 
catch(Exception ex) 
{ 
    Session[“var”] = “Bad Value”; 
}</pre>
        <p>
In the code above, Session[“var”] will ALWAYS equal “Bad Value”.  Why you may
ask?
</p>
        <p>
Response.Redirect throws a ThreadAbortException.  … Fun, no?
</p>
        <p>
If you are building a URL inside of a try block that you want to then redirect to,
declare a string, build your url, and then pass that on to the Response.Redirect statement.  
</p>
        <p>
For Example:
</p>
        <pre class="c-sharp" name="code">
string _url;

try 
{ 
    _url = “yourpage.aspx?var=” + iffyMethodCall(); 
} 
catch(InvalidOperationException ex) 
{ 
    _url = “error.html”; 
}

Response.Redirect(url);</pre>
        <p>
So, If you ever run into odd behavior in a site you are working on and when debugging,
your code goes straight past your Response.Redirect and into the catch block and the
debugger starts giving you cryptic messages, this may be what you’re seeing.
</p>
        <img width="0" height="0" src="http://www.xyzpdq.org/aggbug.ashx?id=339fa3cd-b6d9-4adc-a06c-3ccdf2dbbc1d" />
      </div>
    </content>
  </entry>
  <entry>
    <title>IIS Worker Process Fail 503 Error</title>
    <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/2008/12/07/IISWorkerProcessFail503Error.aspx" />
    <id>http://www.xyzpdq.org/PermaLink,guid,12283b50-2713-471c-9984-c56f141eff74.aspx</id>
    <published>2008-12-07T05:12:50-08:00</published>
    <updated>2009-02-17T17:38:37.2357-08:00</updated>
    <category term="ASP.Net" label="ASP.Net" scheme="http://www.xyzpdq.org/CategoryView,category,ASPNet.aspx" />
    <category term="IIS" label="IIS" scheme="http://www.xyzpdq.org/CategoryView,category,IIS.aspx" />
    <category term="Windows" label="Windows" scheme="http://www.xyzpdq.org/CategoryView,category,Windows.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">Helping a friend to configure his new Win2k8
Server with IIS7 this weekend we ran into an issue where IIS kept returning 503 errors.<br /><br />
Examining the Application Event log I saw that  IISW3SVC-WP was quitting due
to application errors. "The error is the data".  How helpful.<br /><br />
After a considerable amount of digging I discovered that in the Microsoft.Net/Framework/
folder, there was a beta version of v2 of the framework.  The only version that
*should* be there is v2.0.50727.  
<br /><br />
I deleted the beta version of the framework and restarted the IIS worker processes
that were causing problems and everything immediately burst to life!<br /><br />
I've no clue what installed the beta version of the framework, but it is a definite
lesson to make sure that when distributing a framework to be 100% certain that you
are always including the latest "release" version... oh yeah, and perhaps doing a
check for an existing version of said framework before installing.<br /><br />
At any rate, hope this helps somebody.<br /><img width="0" height="0" src="http://www.xyzpdq.org/aggbug.ashx?id=12283b50-2713-471c-9984-c56f141eff74" /></div>
    </content>
  </entry>
  <entry>
    <title>Useless entry #268</title>
    <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/2008/12/04/UselessEntry268.aspx" />
    <id>http://www.xyzpdq.org/PermaLink,guid,a26bb68f-90c9-4fb0-a463-fdafb12e9bdd.aspx</id>
    <published>2008-12-04T08:12:03-08:00</published>
    <updated>2009-01-08T12:03:10.0416737-08:00</updated>
    <category term="Random Thought" label="Random Thought" scheme="http://www.xyzpdq.org/CategoryView,category,RandomThought.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <div>While in a chat today, the following conversation occurred...
</div>
        <div>
          <br />
        </div>
        <div>After I stopped laughing I had to post it.
</div>
        <div>
          <br />
        </div>
        <div>A : I had a mouse in my well the other day. I shop-vac-d it out.
</div>
        <div>B : lol, I can hear it now... "whrrrrrrrrr, ssshhTHUNK"
</div>
        <div>C : *phoomp*
</div>
        <div>D : and forever after the other mice tell tales of abduction from above
</div>
        <div>D : "seriously, it was like some kind of tractor beam!"
</div>
        <div>B : But is derided as a crazy mouse.
</div>
        <div>
          <br />
        </div>
        <div>
          <br />
        </div>
        <img width="0" height="0" src="http://www.xyzpdq.org/aggbug.ashx?id=a26bb68f-90c9-4fb0-a463-fdafb12e9bdd" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Whedon Quote</title>
    <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/2008/09/08/WhedonQuote.aspx" />
    <id>http://www.xyzpdq.org/PermaLink,guid,e31abdeb-4f9e-44da-88c3-d4e8db150028.aspx</id>
    <published>2008-09-08T08:09:52-07:00</published>
    <updated>2009-01-08T12:03:24.034784-08:00</updated>
    <category term="Random Thought" label="Random Thought" scheme="http://www.xyzpdq.org/CategoryView,category,RandomThought.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">I am not sure how many of you are <a href="http://whedonesque.com/">Whedon</a> fans
like myself.  I came across this today and I'm posting it in part because it
is, in my opinion, phenomenal, and also so that I have an easy place to look
it up in the future.<div><br /></div><blockquote class="webkit-indent-blockquote" style="border: medium none ; margin: 0pt 0pt 0pt 40px; padding: 0px;">Passion,
it lies in all of us, sleeping... waiting... and though unwanted... unbidden... it
will stir... open its jaws and howl. It speaks to us... guides us... passion rules
us all, and we obey. What other choice do we have? Passion is the source of our finest
moments. The joy of love... the clarity of hatred... and the ecstasy of grief. It
hurts sometimes more than we can bear. If we could live without passion maybe we'd
know some kind of peace... but we would be hollow... Empty rooms shuttered and dank.
Without passion we'd be truly dead.</blockquote><blockquote class="webkit-indent-blockquote" style="border: medium none ; margin: 0pt 0pt 0pt 40px; padding: 0px;"><br /></blockquote><blockquote class="webkit-indent-blockquote" style="border: medium none ; margin: 0pt 0pt 0pt 40px; padding: 0px;">--
Joss Whedon</blockquote><img width="0" height="0" src="http://www.xyzpdq.org/aggbug.ashx?id=e31abdeb-4f9e-44da-88c3-d4e8db150028" /></div>
    </content>
  </entry>
  <entry>
    <title>Why I am a Republican - Kinda</title>
    <link rel="alternate" type="text/html" href="http://www.xyzpdq.org/2008/08/25/WhyIAmARepublicanKinda.aspx" />
    <id>http://www.xyzpdq.org/PermaLink,guid,73b5278d-b398-4862-9646-3597578eabe8.aspx</id>
    <published>2008-08-25T02:08:35-07:00</published>
    <updated>2009-01-08T12:03:49.1974227-08:00</updated>
    <category term="Random Thought" label="Random Thought" scheme="http://www.xyzpdq.org/CategoryView,category,RandomThought.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I normally abhore forwards.  However, I recently received one that I thought
was magnificent.
</p>
        <p>
....................................................................................
</p>
        <p>
          <strong>FATHER AND DAUGHTER</strong>
        </p>
        <p>
A young woman was about to finish her first year of college. Like so many others her
age, she considered herself to be a very liberal Democrat, and among other liberal
ideals, was very much in favor of higher taxes to support more government programs,
in other words redistribution of wealth.
</p>
        <p>
She was deeply ashamed that her father was a rather staunch Republican, a feeling
she openly expressed. Based on the lectures that she had participated in, and the
occasional chat with a professor, she felt that her father had for years harbored
an evil, selfish desire to keep what he thought should be his.
</p>
        <p>
One day she was challenging her father on his opposition to higher taxes on the rich
and the need for more government programs. The self- professed objectivity proclaimed
by her professors had to be the truth and she indicated so to her father. He responded
by asking how she was doing in school.
</p>
        <p>
Taken aback, she answered rather haughtily that she had a 4.0 GPA, and let him know
that it was tough to maintain, insisting that she was taking a very difficult course
load and was constantly studying, which left her no time to go out and party like
other people she knew. She didn't even have time for a boyfriend, and didn't really
have many college friends  because she spent all her time studying.
</p>
        <p>
Her father listened and then asked, 'How is your friend Audrey doing?' She replied,
'Audrey is barely getting by. All she takes are easy classes, she never studies, and
she barely has a 2.0 GPA. She is so popular on campus; college for her is a blast.
She's always invited to all the parties and lots of times she doesn't even show up
for classes because she's too hung over.'
</p>
        <p>
Her wise father asked his daughter,
</p>
        <p>
'Why don't you go to the Dean's office and ask him to deduct 1.0 off your GPA and
give it to your friend who only has a 2.0. That way you  will both have a 3.0
GPA and certainly that would be a fair and equal distribution of GPA.'
</p>
        <p>
The daughter, visibly shocked by her father's suggestion, angrily fired back, 'That's
a crazy idea, how would that be fair! I've worked really hard for my grades! I've
invested a lot of time, and a lot of hard work! Audrey has done next to nothing toward
her degree. She played while I worked my tail off!'
</p>
        <p>
The father slowly smiled, winked and said gently, 'Welcome to the Republican party.'
</p>
        <p>
....................................................................................
</p>
        <p>
If anyone has a better explanation of the difference between Republican and Democrat
I'm all ears.<br /></p>
        <p>
          <strong>*UPDATE*</strong>
        </p>
        <p>
Ok. So, after a day of politically inspired tweets &amp; conversations with friends,
I don't think that I am really a republican per se.  I am conservative no doubt,
but I honestly don't think I am as staunch as some of the card carying republicans
out there like my father.
</p>
        <p>
I recieved the following from a good friend (who was apparently unable to post a comment
to my blog... I need to investigate that)
</p>
        <p>
...........................................
</p>
        <p>
          <br />
The largest logical problem with that post, and coincidentally one of the most fundamental
problems both parties have with complicated issues like welfare, is that it breaks
down such a complicated issue into a simple moral dilemma.  Welfare isn't about
morality, though its implementation may be immoral.  Whether a child has enough
to eat isn't the same as whether you get a good grade in school.  In fact, to
suggest such is quite insulting, though I'm sure that wasn't the intent by the OP. 
Welfare, fundamentally, is disaster insurance.  You pay into a group fund when
you can, and when you need it, the fund is available to you.<br />
 <br />
A far more appropriate comparison would be the following discussion between the same
father and daughter.  We pick up the story where she's talking about her friend. 
She's the same party girl as before, but this time, instead of the discussion pointing
out that her grades were low due to her lifestyle choice, she had instead been assaulted
at such a party.  When asked by her father how she handled herself at parties,
she responds that she would never go to such places and if she did she'd mace a guy
trying anything like that.  When asked if she'd give up her mace to her friend,
she replies in the same way as before: why would I suffer because I am prepared, she
deserved it since she didn't prepare, etc.  Of course, her father replies, "Welcome
to the Republican Party".<br />
 <br />
The point is that both parties indicate that you don't know how to run your life. 
Democrats want to provide for those who can't provide for themselves.  Republicans
want to act as examples for those who have fallen.<br />
 <br />
I have a different view, and, yes, I'm a libertarian.  There should be no welfare,
nor any judgement - at least not by the state.  When a wealthy democrat was told
the libertarian ideal, he replied, "Who will care for the homeless."  "You will,"
came the response.  "You mean, people with money will get together and..." he
was cut off.  "No, YOU will."  There is no welfare in a libertarian state,
just concerned citizens.<br />
 <br />
This country has never been libertarian, and likely never will be.  We're far
too full of ourselves to accept responsibility without structure or recognition.<br /></p>
        <p>
...........................................
</p>
        <p>
A good point that is going to lead me off on a tangent.  I believe that as a
general rule, people should not be given hand-outs.  However, if you are making
an effort to get ahead in the world and are simply not able to do it, no matter how
hard you are trying, then I will give you my assistance.  I am not heartless,
but I do think that people who make no effort whatsoever to better their situation
and similarly do nothing but sit and complain about it, are not deserving of my sympathy. 
Personal accountability is becoming more and more infrequent in today's world. 
There is a definite sense of entitlement.  News flash people. Nobody OWES you
anything.  If you want something, go out there and bust your butt.  99 times
out of 100, if you try hard enough, you are going to succeed.  On some level,
life is fair.  The people who say that life isn't fair simply stopped trying
and let their gaurd down.   There is a saying, "you get out of life what
you put into it".  If you keep a positive attitude and give every day your
best, then you are going to live a happy and successful life.  Just don't blame
anyone else for your choices.
</p>
        <p>
I realize that this post started off one way and has devolved into something COMPLETELY
different.  This is my blog though.  If you do not like my chain of conciousness,
then go read somebody elses blog.
</p>
        <img width="0" height="0" src="http://www.xyzpdq.org/aggbug.ashx?id=73b5278d-b398-4862-9646-3597578eabe8" />
      </div>
    </content>
  </entry>
</feed>
