<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Montelof&#039;s Blog</title>
	<atom:link href="http://montelof.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://montelof.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Thu, 06 Oct 2011 02:00:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='montelof.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/032e562b7f2d72d4c03951dc283d2d27?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Montelof&#039;s Blog</title>
		<link>http://montelof.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://montelof.wordpress.com/osd.xml" title="Montelof&#039;s Blog" />
	<atom:link rel='hub' href='http://montelof.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Return values from ThreadPool.QueueUserWorkItem in a chain of 3 threads for Silverlight.</title>
		<link>http://montelof.wordpress.com/2011/09/14/template-post/</link>
		<comments>http://montelof.wordpress.com/2011/09/14/template-post/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 22:54:20 +0000</pubDate>
		<dc:creator>montelof</dc:creator>
				<category><![CDATA[Programacion]]></category>

		<guid isPermaLink="false">http://montelof.wordpress.com/?p=179</guid>
		<description><![CDATA[Basically what I&#8217;d like to demonstrate here is how to chain 3 ThreadPool.QueueUserWorkItem calls where each thread return a value that is required by the following thread in a chain, this is also useful when working with MEF since you are working with only one instance of your module, you need to be careful to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=179&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Basically what I&#8217;d like to demonstrate here is how to chain 3 ThreadPool.QueueUserWorkItem calls where each thread return a value that is required by the following thread in a chain, this is also useful when working with MEF since you are working with only one instance of your module, you need to be careful to not use global variables too much, especially when multithreading, so all the results are being pass as return values.
</p>
<p>This return value should not be global because these calls came from another thread waiting for the chains to complete.
</p>
<p>Here is the code:
</p>
<p>First we need to create the link between the threads:
</p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:blue;">public</span><span style="color:black;"> </span><span style="color:blue;">class</span><span style="color:black;"> </span><span style="color:#2b91af;">CalcParams</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">{<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">    </span><span style="color:blue;">public</span><span style="color:black;"> </span><span style="color:blue;">int</span><span style="color:black;"> CallID;<br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">    </span><span style="color:blue;">public</span><span style="color:black;"> </span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;"> ManualReset;<br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">    </span><span style="color:blue;">public</span><span style="color:black;"> </span><span style="color:#2b91af;">Action</span><span style="color:black;">&lt;</span><span style="color:blue;">int</span><span style="color:black;">,</span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;">,</span><span style="color:blue;">int</span><span style="color:black;">&gt; CallbackDone;<br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">}<br />
</span></p>
<p style="background:white;">
 </p>
<p>The main thread for the example creates an array of ManualResetEvents, and then executes all the chains in parallel and wait for them to complete.
</p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:blue;">private</span><span style="color:black;"> </span><span style="color:blue;">void</span><span style="color:black;"> LayoutRoot_Loaded(</span><span style="color:blue;">object</span><span style="color:black;"> sender, </span><span style="color:#2b91af;">RoutedEventArgs</span><span style="color:black;"> e)<br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">{<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">    </span><span style="color:#2b91af;">ThreadPool</span><span style="color:black;">.QueueUserWorkItem((obj) =&gt;<br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">    {<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">        </span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;">[] finishcalc = </span><span style="color:blue;">new</span><span style="color:black;"> </span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;">[] <br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">        { <br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">            </span><span style="color:blue;">new</span><span style="color:black;"> </span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;">(</span><span style="color:blue;">false</span><span style="color:black;">), <br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">            </span><span style="color:blue;">new</span><span style="color:black;"> </span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;">(</span><span style="color:blue;">false</span><span style="color:black;">), <br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">            </span><span style="color:blue;">new</span><span style="color:black;"> </span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;">(</span><span style="color:blue;">false</span><span style="color:black;">), <br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">            </span><span style="color:blue;">new</span><span style="color:black;"> </span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;">(</span><span style="color:blue;">false</span><span style="color:black;">), <br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">            </span><span style="color:blue;">new</span><span style="color:black;"> </span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;">(</span><span style="color:blue;">false</span><span style="color:black;">), <br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">            </span><span style="color:blue;">new</span><span style="color:black;"> </span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;">(</span><span style="color:blue;">false</span><span style="color:black;">) <br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">        };<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">        DoCalculation(rand.Next(10), rand.Next(10), 1, finishcalc[0]);<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">        DoCalculation(rand.Next(10), rand.Next(10), 2, finishcalc[1]);<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">        DoCalculation(rand.Next(10), rand.Next(10), 3, finishcalc[2]);<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">        DoCalculation(rand.Next(10), rand.Next(10), 4, finishcalc[3]);<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">        DoCalculation(rand.Next(10), rand.Next(10), 5, finishcalc[4]);<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">        DoCalculation(rand.Next(10), rand.Next(10), 6, finishcalc[5]);<br />
</span></p>
<p style="background:white;">
 </p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">        </span><span style="color:blue;">if</span><span style="color:black;"> (</span><span style="color:#2b91af;">WaitHandle</span><span style="color:black;">.WaitAll(finishcalc))<br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">        {<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:12pt;"><span style="color:black;">            AddTextAsync(</span><span style="color:#a31515;">&#8220;DoCalculation Finish \n&#8221;</span><span style="color:black;">);<br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">        }<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">    });<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:12pt;">}<br />
</span></p>
<p style="background:white;">
 </p>
<p>DoCalculation contains the 3 level deep calculations where all the threads are connected using the class link to pass the parameters:
</p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:blue;">void</span><span style="color:black;"> DoCalculation( </span><span style="color:blue;">int</span><span style="color:black;"> number1,</span><span style="color:blue;">int</span><span style="color:black;"> number2,</span><span style="color:blue;">int</span><span style="color:black;"> callid, </span><span style="color:#2b91af;">ManualResetEvent</span><span style="color:black;"> calcdone)<br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">{<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:green;">//Display the values used by the calculation in the corresponding Call ID</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">AddTextAsync(</span><span style="color:blue;">string</span><span style="color:black;">.Format(</span><span style="color:#a31515;">&#8220;The values for Callid {0} are {1} and {2}\n&#8221;</span><span style="color:black;">,callid , number1,number2));<br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:#2b91af;">ThreadPool</span><span style="color:black;">.QueueUserWorkItem((obj) =&gt;<br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">{<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:green;">//in this case the calculation is the sum of two numbers, it could be any task like</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:green;">//call a webservice for the first thread level it is not required to pass the </span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:green;">//parameters as part of the link, as for the following levels.so im using the method </span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:green;">//parameters directly</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:blue;">int</span><span style="color:black;"> result = number1 + number2;<br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:green;">//after calculation is complete that the obj parameter as cast as the link</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:#2b91af;">CalcParams</span><span style="color:black;"> localparams = (obj </span><span style="color:blue;">as</span><span style="color:black;"> </span><span style="color:#2b91af;">CalcParams</span><span style="color:black;">);                <br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:green;">//here Im using the values passed by the Link class to execute the action in </span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:green;">//the chain with the method parameters</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">    localparams.CallbackDone(result,localparams.ManualReset,localparams.CallID);<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">}, </span><span style="color:blue;">new</span><span style="color:black;"> </span><span style="color:#2b91af;">CalcParams</span><span style="color:black;">()<br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">{<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:green;">//these are the method parameters being pass to the thread through the link class</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">    ManualReset = calcdone,<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">    CallID = callid,<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">    </span><span style="color:green;">//this is the second level callback </span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">    CallbackDone = (r, m, i) =&gt;<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">    {                    <br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">        </span><span style="color:green;">//in the second level I execute another thread passing again the values using </span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">        </span><span style="color:green;">//the link class</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">        </span><span style="color:#2b91af;">ThreadPool</span><span style="color:black;">.QueueUserWorkItem((obj) =&gt;<br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">        {<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">            </span><span style="color:green;">//this time im calculating the sqrt of the previous result</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">            </span><span style="color:blue;">int</span><span style="color:black;"> sqrt = r*r;<br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">            </span><span style="color:#2b91af;">CalcParams</span><span style="color:black;"> localparams = (obj </span><span style="color:blue;">as</span><span style="color:black;"> </span><span style="color:#2b91af;">CalcParams</span><span style="color:black;">);<br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">            </span><span style="color:green;">//im calling the 3rd level Callback passing the result and the original </span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">            </span><span style="color:green;">//parameters as well</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">            localparams.CallbackDone(sqrt, localparams.ManualReset, localparams.CallID);<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">        }, </span><span style="color:blue;">new</span><span style="color:black;"> </span><span style="color:#2b91af;">CalcParams</span><span style="color:black;">()<br />
</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">        {                       <br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">            </span><span style="color:green;">//these are the values for the 2nd level thread</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">            ManualReset = m,<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">            CallID = i,<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">            CallbackDone = (r2, m2, i2) =&gt;<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">            {<br />
</span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">                </span><span style="color:green;">//in the 3rd level callback im calculation the double of the result of </span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">                </span><span style="color:green;">//the previous calculation</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">                </span><span style="color:blue;">int</span><span style="color:black;"> doublesqrt = r2 * 2;<br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">                </span><span style="color:green;">//im showing the result and the call id to the user</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">                AddTextAsync(</span><span style="color:blue;">string</span><span style="color:black;">.Format(</span><span style="color:#a31515;">&#8220;The result for Callid {1} is {0}\n&#8221;</span><span style="color:black;">, doublesqrt, i2));<br />
</span></span></p>
<p style="background:white;"><span style="font-family:Consolas;font-size:10pt;"><span style="color:black;">                </span><span style="color:green;">//set the top level ManualResetEvent</span><span style="color:black;"><br />
			</span></span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">                m2.Set();<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">            }<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">        });<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">    }<br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">});        <br />
</span></p>
<p style="background:white;"><span style="color:black;font-family:Consolas;font-size:10pt;">}<br />
</span></p>
<p>
 </p>
<p>The same logic can be used to execute n levels of chains of threads by simply copying the last level thread inside the last callback you will be passing the ManualResetEvent to the deepest level to set the main thread when the calculation is done.
</p>
<p>Im pretty sure there is much easier way to do it using RX or any other framework available for the .Net Framework 4.0, but this example is intended to demonstrate how to do it for Silverlight using the ThreadPool and Actions only.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/montelof.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/montelof.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/montelof.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/montelof.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/montelof.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/montelof.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/montelof.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/montelof.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/montelof.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/montelof.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/montelof.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/montelof.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/montelof.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/montelof.wordpress.com/179/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=179&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://montelof.wordpress.com/2011/09/14/template-post/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fa60af85bba005898f62ed1aa527ae3?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">montelof</media:title>
		</media:content>
	</item>
		<item>
		<title>GroupBy two fields,correlate another entity, Count matching rows, show row_number using Lambda</title>
		<link>http://montelof.wordpress.com/2011/03/16/groupby-two-fieldscorrelate-another-entity-cont-matching-rows-show-row_number-using-lambda/</link>
		<comments>http://montelof.wordpress.com/2011/03/16/groupby-two-fieldscorrelate-another-entity-cont-matching-rows-show-row_number-using-lambda/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 15:34:47 +0000</pubDate>
		<dc:creator>montelof</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[distinct]]></category>
		<category><![CDATA[groupby]]></category>
		<category><![CDATA[lambda]]></category>
		<category><![CDATA[linq]]></category>
		<category><![CDATA[row_count]]></category>

		<guid isPermaLink="false">https://montelof.wordpress.com/2011/03/16/groupby-two-fieldscorrelate-another-entity-cont-matching-rows-show-row_number-using-lambda/</guid>
		<description><![CDATA[I want to count the Tickets owned by every employee, having two Entities,related by Login_ID, so I have first to get the distinct values from the first list, then count the matching rows of the second list, I also want to assign an image url to each employee so I need a row_count like variable, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=173&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I want to count the Tickets owned by every employee, having two Entities,related by Login_ID, so I have first to get the distinct values from the first list, then count the matching rows of the second list, I also want to assign an image url to each employee so I need a row_count like variable, also the related tickets to each employee must match the Team assigned to the employee so the correlated query must consider two fields:</p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;color:blue;font-size:10pt;">int</span><span style="font-family:&quot;font-size:10pt;"> index = 0;
</p>
<p>   </span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;color:blue;font-size:10pt;">var</span><span style="font-family:&quot;font-size:10pt;"> workload = grouplist.GroupBy(j =&gt; <span style="color:blue;">new</span> { j.LOGIN_ID, j.FULL_NAME,j.TEAM_NAME})
</p>
<p>   </span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>.Where(k =&gt; k.Key.TEAM_NAME == membergroup)
</p>
<p>   </span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>.Select(i =&gt; <span style="color:blue;">new
</p>
<p>     </span></span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{
</p>
<p>   </span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>CoreID = i.Key.LOGIN_ID,
</p>
<p>   </span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>TicketCount = tickets
</p>
<p>   </span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>.Where(k =&gt; k.Assignee_Login_ID == i.Key.LOGIN_ID&#160;&#160; &amp;&amp;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; k.Assigned_Group==i.Key.TEAM_NAME)
</p>
<p>   </span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>.Count(),
</p>
<p>   </span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>Assignee = i.Key.FULL_NAME,
</p>
<p>   </span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>url = <span style="color:#a31515;">@&quot;~\images\man_&quot;</span> + (1 + (index++) % 5) + <span style="color:#a31515;">&quot;.png&quot;
</p>
<p>     </span></span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}).ToList();<span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span></span></span></p>
<p style="line-height:normal;margin-bottom:0;" class="MsoNormal"><span style="font-family:&quot;font-size:10pt;"><span>I choose to use Lambda instead of Linq because of simplicity, Ill post another example using left outer join using Linq in the next one.&#160;&#160;&#160; </span>
</p>
<p>   </span></p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/montelof.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/montelof.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/montelof.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/montelof.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/montelof.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/montelof.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/montelof.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/montelof.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/montelof.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/montelof.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/montelof.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/montelof.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/montelof.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/montelof.wordpress.com/173/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=173&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://montelof.wordpress.com/2011/03/16/groupby-two-fieldscorrelate-another-entity-cont-matching-rows-show-row_number-using-lambda/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fa60af85bba005898f62ed1aa527ae3?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">montelof</media:title>
		</media:content>
	</item>
		<item>
		<title>OCIEnvCreate failed with return code -1 but error message text was not available.</title>
		<link>http://montelof.wordpress.com/2011/03/09/ocienvcreate-failed-with-return-code-1-but-error-message-text-was-not-available/</link>
		<comments>http://montelof.wordpress.com/2011/03/09/ocienvcreate-failed-with-return-code-1-but-error-message-text-was-not-available/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 14:10:27 +0000</pubDate>
		<dc:creator>montelof</dc:creator>
				<category><![CDATA[post]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[programing]]></category>

		<guid isPermaLink="false">http://montelof.wordpress.com/2011/03/09/ocienvcreate-failed-with-return-code-1-but-error-message-text-was-not-available/</guid>
		<description><![CDATA[If anyone is getting this error it could be caused for a setting in the project properties: change update Database to False and the error will go away.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=172&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If anyone is getting this error it could be caused for a setting in the project properties:<br />
<a href="http://montelof.files.wordpress.com/2011/03/properties.jpg"><img src="http://montelof.files.wordpress.com/2011/03/properties.jpg?w=300&#038;h=272" alt="" title="properties" width="300" height="272" class="alignnone size-medium wp-image-171" /></a></p>
<p>change update Database to False and the error will go away.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/montelof.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/montelof.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/montelof.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/montelof.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/montelof.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/montelof.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/montelof.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/montelof.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/montelof.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/montelof.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/montelof.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/montelof.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/montelof.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/montelof.wordpress.com/172/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=172&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://montelof.wordpress.com/2011/03/09/ocienvcreate-failed-with-return-code-1-but-error-message-text-was-not-available/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fa60af85bba005898f62ed1aa527ae3?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">montelof</media:title>
		</media:content>

		<media:content url="http://montelof.files.wordpress.com/2011/03/properties.jpg?w=300" medium="image">
			<media:title type="html">properties</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual SourceSafe missing LAN option</title>
		<link>http://montelof.wordpress.com/2011/02/23/visual-sourcesafe-missing-lan-option/</link>
		<comments>http://montelof.wordpress.com/2011/02/23/visual-sourcesafe-missing-lan-option/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 04:09:29 +0000</pubDate>
		<dc:creator>montelof</dc:creator>
				<category><![CDATA[Programacion]]></category>
		<category><![CDATA[missing lan]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[vss]]></category>

		<guid isPermaLink="false">https://montelof.wordpress.com/2011/02/23/visual-sourcesafe-missing-lan-option/</guid>
		<description><![CDATA[One night I was working very happy at 3am from home when my project started to shows VSS error about the database does not exist anymore, I thought is time to go bed I don&#8217;t have time for this..Next day I woke up thinking I just had a nightmare about my SourceSafe db was gone…but [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=169&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One night I was working very happy at 3am from home when my project started to shows VSS error about the database does not exist anymore, I thought is time to go bed I don&#8217;t have time for this..Next day I woke up thinking I just had a nightmare about my SourceSafe db was gone…but It wasn’t a dream, the db was actually gone, at least totally inaccessible from VS, I was able to see the files directly on the server but I was unable to see it from VS, I tried reinstall update path VSS nothing works, until I found an option in visual studio (that magically changed itself) that was setting VSS Internet by default, here is the screenshot:</p>
<p><a href="http://montelof.files.wordpress.com/2011/02/image.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://montelof.files.wordpress.com/2011/02/image_thumb.png?w=548&#038;h=347" width="548" height="347" /></a> </p>
<p>Just changed it back to Visual Source Safe and everything went back to normal.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/montelof.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/montelof.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/montelof.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/montelof.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/montelof.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/montelof.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/montelof.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/montelof.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/montelof.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/montelof.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/montelof.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/montelof.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/montelof.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/montelof.wordpress.com/169/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=169&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://montelof.wordpress.com/2011/02/23/visual-sourcesafe-missing-lan-option/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fa60af85bba005898f62ed1aa527ae3?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">montelof</media:title>
		</media:content>

		<media:content url="http://montelof.files.wordpress.com/2011/02/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Error processing response stream. The XML element contains mixed content.</title>
		<link>http://montelof.wordpress.com/2010/09/30/error-processing-response-stream-the-xml-element-contains-mixed-content/</link>
		<comments>http://montelof.wordpress.com/2010/09/30/error-processing-response-stream-the-xml-element-contains-mixed-content/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 21:36:54 +0000</pubDate>
		<dc:creator>montelof</dc:creator>
				<category><![CDATA[Programacion]]></category>
		<category><![CDATA[ado dataservices]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">https://montelof.wordpress.com/2010/09/30/error-processing-response-stream-the-xml-element-contains-mixed-content/</guid>
		<description><![CDATA[Ok, in my last post I explained how to pass an array of values to the Webget method of an Ado DataService as a primitive value (csv), in this post Im going to show how to retrieve a primitive value from a Webget method avoiding the error message above. Lets start with the Dataservice: [WebGet] [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=137&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Ok, in my last post I explained how to pass an array of values to the Webget method of an Ado DataService as a primitive value (csv), in this post Im going to show how to retrieve a primitive value from a Webget method avoiding the error message above.</strong></p>
<p><strong>Lets start with the Dataservice:</strong></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;">[<span style="color:#2b91af;">WebGet</span>] <span style="color:green;">//we are going to return an int </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;color:blue;font-family:&quot;">public</span><span style="font-size:8pt;font-family:&quot;"> <span style="color:#2b91af;">IQueryable</span>&lt;<span style="color:blue;">int</span>&gt; DWTNewDownTime(<span style="color:blue;">int</span> metricArrayID, <span style="color:blue;">string</span> metricDate) </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;">{<span>&#160; </span><span style="color:green;">//create the command as we used to do in 1.1 </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:#2b91af;">DbCommand</span> cmd = <span style="color:blue;">this</span>.CurrentDataSource.Connection.CreateCommand(); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>cmd.CommandType = <span style="color:#2b91af;">CommandType</span>.StoredProcedure; </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:green;">//add the parameters needed for the stored procedure </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:#2b91af;">EntityParameter</span> MetricArrayID = <span style="color:blue;">new</span> <span style="color:#2b91af;">EntityParameter</span>(<span style="color:#a31515;">&quot;MetricArrayID&quot;</span>, <span style="color:#2b91af;">DbType</span>.Int16); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>MetricArrayID.Value = metricArrayID; </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>cmd.Parameters.Add(MetricArrayID); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:#2b91af;">EntityParameter</span> MetricDate = <span style="color:blue;">new</span> <span style="color:#2b91af;">EntityParameter</span>(<span style="color:#a31515;">&quot;MetricDate&quot;</span>, <span style="color:#2b91af;">DbType</span>.String, 50); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>MetricDate.Value = metricDate; </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>cmd.Parameters.Add(MetricDate);<span>&#160;&#160;&#160;&#160;&#160;&#160; </span></span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:green;">//add an output parameter, this parameter should be returned as a SELECT not return from the stored procedure </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:#2b91af;">EntityParameter</span> Res = <span style="color:blue;">new</span> <span style="color:#2b91af;">EntityParameter</span>(<span style="color:#a31515;">&quot;res&quot;</span>, <span style="color:#2b91af;">DbType</span>.Int16, 20); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>Res.Direction = <span style="color:#2b91af;">ParameterDirection</span>.Output; </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>cmd.Parameters.Add(Res); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:green;">//constructs the command text </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>cmd.CommandText = <span style="color:blue;">string</span>.Format(<span style="color:#a31515;">@&quot;{0}.{1}&quot;</span>, <span style="color:blue;">this</span>.CurrentDataSource.DefaultContainerName, <span style="color:#a31515;">&quot;DWTGetMetricValuesNewDownTimeActions&quot;</span>); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:blue;">try </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>{<span style="color:green;">//open connection and execute an scalar </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>cmd.Connection.Open(); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>cmd.ExecuteScalar(); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>} </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:blue;">catch</span> (System.<span style="color:#2b91af;">Exception</span> ex) </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>{ </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color:blue;">throw</span> <span style="color:blue;">new</span> System.<span style="color:#2b91af;">Exception</span>(ex.InnerException.Message); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>} </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:blue;">finally </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>{<span>&#160;&#160; </span><span style="color:green;">//always close the connection </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>cmd.Connection.Close(); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>}<span style="color:green;">//return the result output value. </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:#2b91af;">List</span>&lt;<span style="color:blue;">int</span>&gt; _list = <span style="color:blue;">new</span> <span style="color:#2b91af;">List</span>&lt;<span style="color:blue;">int</span>&gt; { <span style="color:#2b91af;">Convert</span>.ToInt32(Res.Value) }; </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:blue;">return</span> _list.AsQueryable(); </span>
</p>
</p>
<p class="MsoNormal"><span style="font-size:8pt;line-height:115%;font-family:&quot;">}</span><span style="font-size:8pt;line-height:115%;"> </span>
</p>
</p>
<p>&#160;</p>
<p><strong>As I mention above the stored procedure should return the output parameter as SELECT.</strong></p>
<p><strong>now lets see the ModelView:</strong></p>
<p>&#160;</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;color:blue;font-family:&quot;">public</span><span style="font-size:8pt;font-family:&quot;"> <span style="color:blue;">void</span> DWTGetMetricValuesNewDownTimeActions(<span style="color:blue;">int</span> metricArrayID, <span style="color:blue;">string</span> metricDate) </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;">{<span>&#160;&#160; </span><span style="color:green;">//create a DataserviceQuery as we normally do for other webget methods </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>QryInsertMetric = <span style="color:blue;">this</span>.context.CreateQuery&lt;<span style="color:blue;">int</span>&gt;(<span style="color:#a31515;">&quot;DWTNewDownTime&quot;</span>) </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>.AddQueryOption(<span style="color:#a31515;">&quot;MetricArrayID&quot;</span>, metricArrayID) </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>.AddQueryOption(<span style="color:#a31515;">&quot;MetricDate&quot;</span>, <span style="color:#a31515;">&quot;&#8217;&quot;</span> + metricDate + <span style="color:#a31515;">&quot;&#8217;&quot;</span>); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:green;">//then create a webclient that will be used to execute the above query </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:#2b91af;">WebClient</span> wc = <span style="color:blue;">new</span> <span style="color:#2b91af;">WebClient</span>(); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>wc.DownloadStringAsync(QryInsertMetric.RequestUri); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>wc.DownloadStringCompleted += (s, e) =&gt; </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>{<span>&#160;&#160; </span><span style="color:green;">//we have to parse the returning XML </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span>&#160;&#160;&#160; </span></span><span lang="ES-MX" style="font-size:8pt;color:#2b91af;font-family:&quot;">XDocument</span><span lang="ES-MX" style="font-size:8pt;font-family:&quot;"> xdoc = <span style="color:#2b91af;">XDocument</span>.Parse(e.Result); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="ES-MX" style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span><span style="font-size:8pt;font-family:&quot;">MetricValueID = <span style="color:#2b91af;">Convert</span>.ToInt32(xdoc.Root.Descendants(((<span style="color:#2b91af;">XNamespace</span>)<span style="color:#a31515;">@&quot;<a href="http://schemas.microsoft.com/ado/2007/08/dataservices&quot;" rel="nofollow">http://schemas.microsoft.com/ado/2007/08/dataservices&quot;</a></span>) + <span style="color:#a31515;">&quot;element&quot;</span>) </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>.Select(xe =&gt; xe.Value).ToList().Single()); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160; </span><span>&#160; </span><span style="color:green;">//fire the property so you can catch it at your silverlight client </span>
</p>
<p>   </span></p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>FirePropertyChanged(<span style="color:#a31515;">&quot;MetricValueID&quot;</span>); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>}; </span>
</p>
</p>
<p class="MsoNormal"><span style="font-size:8pt;line-height:115%;font-family:&quot;">}</span><span style="font-size:9pt;line-height:115%;"> </span>
</p>
</p>
<p>&#160;</p>
<p><strong>Finally just catch the property change at your client:</strong></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:&quot;">void</span><span style="font-size:10pt;font-family:&quot;"> Downtimemodel_PropertyChanged(<span style="color:blue;">object</span> sender, System.ComponentModel.<span style="color:#2b91af;">PropertyChangedEventArgs</span> e) </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:&quot;">{ </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:&quot;"><span>&#160;&#160;&#160; </span><span style="color:blue;">if</span> (e.PropertyName == <span style="color:#a31515;">&quot;MetricValueID&quot;</span>) </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>{ </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:&quot;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color:#2b91af;">Console</span>.WriteLine(Downtimemodel.MetricValueID.ToString()); </span>
</p>
</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:&quot;"><span>&#160;&#160;&#160; </span>}<span>&#160;&#160;&#160; </span></span>
</p>
</p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;font-family:&quot;">}</span></p>
<p> <strong></strong>
<p>and that’s it, I hope this help someone get home early.</p>
<p>some help from <a href="http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/7c71eff7-4951-480f-bbc1-b00046ee788b" target="_blank">Invoking a WebGet throws an exception</a> @ msdn</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/montelof.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/montelof.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/montelof.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/montelof.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/montelof.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/montelof.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/montelof.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/montelof.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/montelof.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/montelof.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/montelof.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/montelof.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/montelof.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/montelof.wordpress.com/137/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=137&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://montelof.wordpress.com/2010/09/30/error-processing-response-stream-the-xml-element-contains-mixed-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fa60af85bba005898f62ed1aa527ae3?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">montelof</media:title>
		</media:content>
	</item>
		<item>
		<title>Only primitive types are supported as parameters</title>
		<link>http://montelof.wordpress.com/2010/09/09/only-primitive-types-are-supported-as-parameters/</link>
		<comments>http://montelof.wordpress.com/2010/09/09/only-primitive-types-are-supported-as-parameters/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 21:53:55 +0000</pubDate>
		<dc:creator>montelof</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ado dataservices]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">https://montelof.wordpress.com/2010/09/09/only-primitive-types-are-supported-as-parameters/</guid>
		<description><![CDATA[This is the error message i got when tried to pass an array or List to an Ado Dataservice. It looks like you can only use int, string etc, when passing parameters to the webget method, this is a limitation on the Dataservice it self, not the Datacontext, you can easily workaround this by passing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=125&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is the error message i got when tried to pass an array or List to an Ado Dataservice. It looks like you can only use int, string etc, when passing parameters to the webget method, this is a limitation on the Dataservice it self, not the Datacontext, you can easily workaround this by passing the comma separated values to the Dataservice then split the values before calling your DataContext.</p>
<p>To convert from the string array to the comma separated use this on your silverlight code:</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:&amp;">string</span><span style="font-size:10pt;font-family:&amp;"> _csvproducts = <span style="color:blue;">string</span>.Join(<span style="color:#a31515;">&#8220;,&#8221;</span>, productList);</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:&amp;"> </span><br />
you webget method on the Dataservice should look like this:</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;">[<span style="color:#2b91af;">WebGet</span>] </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;color:blue;font-family:&amp;">public</span><span style="font-size:8pt;font-family:&amp;"> <span style="color:#2b91af;">IQueryable</span>&lt;<span style="color:#2b91af;">ModelWorkcenter</span>&gt; FilterByModelList(<span style="color:blue;">string</span> models) </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;">{ </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;"> <span style="color:blue;">string</span>[] _modelsqry = models.Split(<span style="color:#a31515;">&#8216;,&#8217;</span>).Select(sValue =&gt; sValue.Trim()).ToArray(); </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;"> <span style="color:blue;">var</span> result = <span style="color:blue;">this</span>.CurrentDataSource.GetModelsByList(_modelsqry); </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;"> <span style="color:blue;">return</span> result; </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;">}</span><span style="font-size:8pt;"> </span></p>
<p>what im doing is to split again the values and passing them to the Datacontext method GetModelsByList this method is expecting a List&lt;string&gt; parameter. your Context class should look like this:</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;color:blue;font-family:&amp;">public</span><span style="font-size:8pt;font-family:&amp;"> <span style="color:#2b91af;">IQueryable</span>&lt;<span style="color:#2b91af;">ModelWorkcenter</span>&gt; GetModelsByList(<span style="color:#2b91af;">IList</span>&lt;<span style="color:blue;">string</span>&gt; modelList) </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;">{ </span></p>
<p class="MsoNormal" style="line-height:normal;margin:0 0 0 19.5pt;"><span style="font-size:8pt;color:blue;font-family:&amp;">var</span><span style="font-size:8pt;font-family:&amp;"> result = (<span style="color:blue;">from</span> c <span style="color:blue;">in</span> Scope.Extent&lt;<span style="color:#2b91af;">ModelWorkcenter</span>&gt;() <span style="color:blue;">where</span> modelList.Contains(c.TopMaterial) <span style="color:blue;">select</span> c); </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;"> <span style="color:blue;">return</span> result; </span></p>
<p><span style="font-size:8pt;font-family:&amp;">}</span></p>
<p>This way your Linq to SQL will generate good SQL code using the IN clause something like</p>
<p>Select Model from ITEM_MASTER where Model in (‘model1’,’model2’,’model3’,’model4’)<br />
To call the webget method use the CreateQuery method of your proxy class so you can add the parameter using AddQueryOption</p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;color:blue;font-family:&amp;">public</span><span style="font-size:8pt;font-family:&amp;"> <span style="color:blue;">void</span> CustomFilterModels(<span style="color:blue;">string</span> models) </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;">{ </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;"> QryModelWorkcenter = Entities.CreateQuery&lt;<span style="color:#2b91af;">ModelWorkcenter</span>&gt;(<span style="color:#a31515;">&#8220;FilterByModelList&#8221;</span>) </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;"> .AddQueryOption(<span style="color:#a31515;">&#8220;models&#8221;</span>, <span style="color:#a31515;">&#8220;&#8216;&#8221;</span> + models + <span style="color:#a31515;">&#8220;&#8216;&#8221;</span>); </span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:8pt;font-family:&amp;"> QryModelWorkcenter.BeginExecute(<span style="color:blue;">this</span>.GetModelWorkcenterCallback, <span style="color:blue;">this</span>.Entities); </span></p>
<p><span style="font-size:8pt;font-family:&amp;">}</span></p>
<p>Also note that I’m adding single quotes to the string, without quotes the url cant be parsed correctly and you will get syntax error. this is the generated Url:</p>
<p><a href="http://localhost:3122/workcenters_service.svc/FilterByModelList()?models='PPT2633-ZRIY0Y03,PPT2637-TRIZ0Y03,PPT2637-ZRIY0Y00'"><a href="http://localhost:3122/workcenters_service.svc/FilterByModelList" rel="nofollow">http://localhost:3122/workcenters_service.svc/FilterByModelList</a>()?models=&#8217;PPT2633-ZRIY0Y03,PPT2637-TRIZ0Y03,PPT2637-ZRIY0Y00&#8242;</a></p>
<p>I have read some post about very complex ways to do the same thing, others build the e-sql from scratch, I liked like this because seems more clear and easy to understand.</p>
<p>Please leave your comments.</p>
<p>source:<a title="http://stackoverflow.com" href="http://stackoverflow.com/questions/2235683/easiest-way-to-parse-a-comma-delimited-string-to-some-kind-of-object-i-can-loop-t" target="_blank">http://stackoverflow.com</a></p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/montelof.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/montelof.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/montelof.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/montelof.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/montelof.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/montelof.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/montelof.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/montelof.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/montelof.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/montelof.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/montelof.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/montelof.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/montelof.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/montelof.wordpress.com/125/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=125&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://montelof.wordpress.com/2010/09/09/only-primitive-types-are-supported-as-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fa60af85bba005898f62ed1aa527ae3?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">montelof</media:title>
		</media:content>
	</item>
		<item>
		<title>13940 3DMark2006!!!</title>
		<link>http://montelof.wordpress.com/2009/12/17/13940-3dmark2006/</link>
		<comments>http://montelof.wordpress.com/2009/12/17/13940-3dmark2006/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 17:32:06 +0000</pubDate>
		<dc:creator>montelof</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[3dmark vantage]]></category>
		<category><![CDATA[ati 3870]]></category>
		<category><![CDATA[crossfire]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://montelof.wordpress.com/?p=108</guid>
		<description><![CDATA[Por fin pase los 10K aqui pongo la configuracion q use, y todo gracias al tutorial de optimizacion publicado anteriormente..<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=108&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Por fin pase los 10K aqui pongo la configuracion q use, y todo gracias al tutorial de optimizacion publicado anteriormente..</p>
<p><a href="http://service.futuremark.com/results/showSingleResult.action?resultId=12718805&amp;resultType=14"><img class="alignnone size-full wp-image-109" title="3dmark2006" src="http://montelof.files.wordpress.com/2009/12/3dmark2006.png?w=632&#038;h=597" alt="" width="632" height="597" /></a></p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/montelof.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/montelof.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/montelof.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/montelof.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/montelof.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/montelof.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/montelof.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/montelof.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/montelof.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/montelof.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/montelof.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/montelof.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/montelof.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/montelof.wordpress.com/108/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=108&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://montelof.wordpress.com/2009/12/17/13940-3dmark2006/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fa60af85bba005898f62ed1aa527ae3?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">montelof</media:title>
		</media:content>

		<media:content url="http://montelof.files.wordpress.com/2009/12/3dmark2006.png" medium="image">
			<media:title type="html">3dmark2006</media:title>
		</media:content>
	</item>
		<item>
		<title>Por fin CPU al 100% y a 70 grados!!!</title>
		<link>http://montelof.wordpress.com/2009/11/10/por-fin-cpu-al-100-y-a-70-grados/</link>
		<comments>http://montelof.wordpress.com/2009/11/10/por-fin-cpu-al-100-y-a-70-grados/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 05:09:06 +0000</pubDate>
		<dc:creator>montelof</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://montelof.wordpress.com/2009/11/10/por-fin-cpu-al-100-y-a-70-grados/</guid>
		<description><![CDATA[<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=104&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-101" title="Monitor" src="http://montelof.files.wordpress.com/2009/11/monitor.png?w=509&#038;h=343" alt="Monitor" width="509" height="343" /></p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/montelof.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/montelof.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/montelof.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/montelof.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/montelof.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/montelof.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/montelof.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/montelof.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/montelof.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/montelof.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/montelof.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/montelof.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/montelof.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/montelof.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=104&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://montelof.wordpress.com/2009/11/10/por-fin-cpu-al-100-y-a-70-grados/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fa60af85bba005898f62ed1aa527ae3?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">montelof</media:title>
		</media:content>

		<media:content url="http://montelof.files.wordpress.com/2009/11/monitor.png" medium="image">
			<media:title type="html">Monitor</media:title>
		</media:content>
	</item>
		<item>
		<title>Esta tu CPU al 70%?</title>
		<link>http://montelof.wordpress.com/2009/10/17/esta-tu-cpu-al-70/</link>
		<comments>http://montelof.wordpress.com/2009/10/17/esta-tu-cpu-al-70/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 20:55:47 +0000</pubDate>
		<dc:creator>montelof</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[cpu]]></category>
		<category><![CDATA[fluctuations]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[power]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[temperature]]></category>

		<guid isPermaLink="false">http://montelof.wordpress.com/2009/10/17/esta-tu-cpu-al-70/</guid>
		<description><![CDATA[Desde q compre esta laptop me visto q en algunos juegos q requieren mucho uso del procesador, los FPS variaban entre 60 y 20 fps, siempre pense q era problema por incompatibilidad de los drivers de la tarjeta de video, hoy, quise hacer una prueba de Benchmark, q tambien hice en la pc del trabajo [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=97&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Desde q compre esta laptop me visto q en algunos juegos q requieren mucho uso del procesador, los FPS variaban entre 60 y 20 fps, siempre pense q era problema por incompatibilidad de los drivers de la tarjeta de video, hoy, quise hacer una prueba de Benchmark, q tambien hice en la pc del trabajo (770 fps) para ver como salia, me di cuenta q los FPS variaban entre 2300 a 1000…</p>
<p><a href="http://rsb.info.nih.gov/plasma/" target="_blank"><img style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" title="image" src="http://montelof.files.wordpress.com/2009/10/image.png?w=244&#038;h=198" border="0" alt="image" width="244" height="198" /></a></p>
<p>Buscando sobre el problema encontre q podria ser por el calentamiento del procesador, asi q baje CPUID Hardware Monitor, el cual comenzo a mostrar variaciones en la temperatura de 70 a 100 grados centigrados cada 5 segundos, y al mismo tiempo q bajaba a 70 grados, era cuando los FPS bajaban tambien a 1600…</p>
<p><a href="http://www.cpuid.com/hwmonitor.php" target="_blank"><img style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" title="image" src="http://montelof.files.wordpress.com/2009/10/image1.png?w=214&#038;h=244" border="0" alt="image" width="214" height="244" /></a></p>
<p>La unica solucion q encontre fue bajar el uso del CPU al 70% de esa manera ya no fluctua mas, pero claro, el uso del procesador se mantiene bajo, pero la temperatura estable en 80 Grados C.</p>
<p><a href="http://montelof.files.wordpress.com/2009/10/image2.png"><img style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" title="image" src="http://montelof.files.wordpress.com/2009/10/image_thumb.png?w=229&#038;h=244" border="0" alt="image" width="229" height="244" /></a></p>
<p>Verifiquen q no tienen el mismo problema siguiendo los mismos pasos, tal vez podrían salvar su CPU de q se queme, antes q sea muy tarde.</p>
<p>Edit: Despues de darle una limpiada a los disipadores de mi laptop, logre subir al 85% de uso de CPU sin problemas, y probando el 3DMark2006 obtuve 8914 puntos en lugar de los 8500 q siempre habia sacado y 3500 en el plasma (foto).</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/montelof.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/montelof.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/montelof.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/montelof.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/montelof.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/montelof.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/montelof.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/montelof.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/montelof.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/montelof.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/montelof.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/montelof.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/montelof.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/montelof.wordpress.com/97/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=97&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://montelof.wordpress.com/2009/10/17/esta-tu-cpu-al-70/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fa60af85bba005898f62ed1aa527ae3?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">montelof</media:title>
		</media:content>

		<media:content url="http://montelof.files.wordpress.com/2009/10/image.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://montelof.files.wordpress.com/2009/10/image1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://montelof.files.wordpress.com/2009/10/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>XMPlay otro media player con efecto reverb</title>
		<link>http://montelof.wordpress.com/2009/09/22/xmplay-otro-media-player-con-efecto-reverb/</link>
		<comments>http://montelof.wordpress.com/2009/09/22/xmplay-otro-media-player-con-efecto-reverb/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 21:25:51 +0000</pubDate>
		<dc:creator>montelof</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[media player]]></category>
		<category><![CDATA[xmplay]]></category>

		<guid isPermaLink="false">http://montelof.wordpress.com/2009/09/22/xmplay-otro-media-player-con-efecto-reverb/</guid>
		<description><![CDATA[Han sido pocos los media player q he encontrado q sean realmente buenos y ligeros, anteriormente recomendé el Dino, pero le encontré muchos bugs, q por la falta de apoyo nunca fueron resueltos… este Player q recomiendo ahora ha sido actualizado recientemente y además de poder cambiar los skins también incluye el efecto Reverb y [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=92&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Han sido pocos los media player q he encontrado q sean realmente buenos y ligeros, anteriormente recomendé el Dino, pero le encontré muchos bugs, q por la falta de apoyo nunca fueron resueltos… este Player q recomiendo ahora ha sido actualizado recientemente y además de poder cambiar los skins también incluye el efecto Reverb y además es configurable. y si, es mucho mas liguero q windows media.</p>
<p>&#160;</p>
<p><a href="http://montelof.files.wordpress.com/2009/09/image8.png"><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="297" alt="image" src="http://montelof.files.wordpress.com/2009/09/image_thumb8.png?w=433&#038;h=297" width="433" border="0" /></a>&#160;</p>
<p>Fuente:<a href="http://www.un4seen.com/" target="_blank">http://www.un4seen.com/</a></p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/montelof.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/montelof.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/montelof.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/montelof.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/montelof.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/montelof.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/montelof.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/montelof.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/montelof.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/montelof.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/montelof.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/montelof.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/montelof.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/montelof.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=montelof.wordpress.com&amp;blog=7755910&amp;post=92&amp;subd=montelof&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://montelof.wordpress.com/2009/09/22/xmplay-otro-media-player-con-efecto-reverb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fa60af85bba005898f62ed1aa527ae3?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">montelof</media:title>
		</media:content>

		<media:content url="http://montelof.files.wordpress.com/2009/09/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
