<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>marocanu2001</title>
        <link>http://geekswithblogs.net/marocanu2001/Default.aspx</link>
        <description>technicle  blog</description>
        <language>en-US</language>
        <copyright>marocanu2001</copyright>
        <managingEditor>marocanu2001@yahoo.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>marocanu2001</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/marocanu2001/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Nasty bug in Sybase Iq analytical function Last_value over partition</title>
            <link>http://geekswithblogs.net/marocanu2001/archive/2011/08/11/nasty-bug-in-sybase-iq-analytical-function-last_value-over-partition.aspx</link>
            <description>&lt;p&gt;I discovered a nasty bug in the way Sybase Iq &lt;strong&gt;last_value&lt;/strong&gt; over partition works. More precisely it returns random values. On the other hand &lt;strong&gt;first_value&lt;/strong&gt; is working fine so for now I am using that one instead, with reverse ordering in partitions. But it makes my queries a little harder to understand.&lt;/p&gt;
&lt;p&gt;Try this eg:&lt;/p&gt;
&lt;p&gt;Let's say we have table TestLastValueTable&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;TableId     RequestId       Sender        MessageNumber      Location&lt;/strong&gt;&lt;br /&gt;
1                    1                      alan                           2                     London&lt;br /&gt;
2                    1                      mary                          3                     Paris&lt;br /&gt;
3                    1                      mike                          1                     Sevilla&lt;br /&gt;
4                    2                      gaga                         2                      Paris&lt;br /&gt;
5                    2                      gugu                         3                      Sevilla&lt;/p&gt;
&lt;p&gt;When using the following query:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;Select Id, requestId , last_value(sender) over (partition by requestId order by messageNum desc)  as lastRequestSender ,&lt;br /&gt;
    first_value(location) over (partition by requestId order by messageNum desc)  as firstRequestLocation &lt;br /&gt;
From TestLastValueTable&lt;br /&gt;
order by Id&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I expected the outcome to be &lt;br /&gt;
&lt;br /&gt;
Id,    requestId,    lastRequestSender,    firstRequestLocation&lt;br /&gt;
1,          1,                   'mike',                             'Paris'&lt;br /&gt;
2,          1,                   'mike',                             'Paris'&lt;br /&gt;
3,          1,                   'mike',                             'Paris'&lt;br /&gt;
4,          2,                   'gaga',                             'Bucharest'&lt;br /&gt;
5,          2,                   'gaga',                             'Bucharest'&lt;br /&gt;
&lt;br /&gt;
And it actually is :&lt;br /&gt;
&lt;br /&gt;
Id,    requestId,    lastRequestSender,    firstRequestLocation&lt;br /&gt;
1,           1,                  '&lt;span style="color: rgb(255, 255, 0);"&gt;&lt;span style="background-color: rgb(255, 0, 0);"&gt;alan&lt;/span&gt;&lt;/span&gt;',                                   '&lt;span style="background-color: rgb(51, 153, 102);"&gt;Paris&lt;/span&gt;'&lt;br /&gt;
2,           1,                  '&lt;span style="color: rgb(255, 255, 0);"&gt;&lt;span style="background-color: rgb(255, 0, 0);"&gt;mary&lt;/span&gt;&lt;/span&gt;',                                  '&lt;span style="background-color: rgb(51, 153, 102);"&gt;Paris&lt;/span&gt;'&lt;br /&gt;
3,           1,                  '&lt;span style="background-color: rgb(51, 153, 102);"&gt;mike&lt;/span&gt;',                                  '&lt;span style="background-color: rgb(51, 153, 102);"&gt;Paris&lt;/span&gt;'&lt;br /&gt;
4,          2,                   '&lt;span style="background-color: rgb(51, 153, 102);"&gt;gaga&lt;/span&gt;',                                  '&lt;span style="background-color: rgb(51, 153, 102);"&gt;Bucharest&lt;/span&gt;'&lt;br /&gt;
5,          2,                   '&lt;span style="color: rgb(255, 255, 0);"&gt;&lt;span style="background-color: rgb(255, 0, 0);"&gt;gugu&lt;/span&gt;&lt;/span&gt;',                                  '&lt;span style="background-color: rgb(51, 153, 102);"&gt;Bucharest&lt;/span&gt;'&lt;br /&gt;
 &lt;/p&gt;
&lt;p&gt;UPDATE: This bug is related to the partition, changing the partition to being specified by "rows between unbounded preceding and unbounded following" (which should not make any difference) , makes last_value to return the correct value:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;Select Id, requestId , last_value(sender) over (partition by requestId order by messageNum desc&lt;strong&gt; rows between unbounded preceding and unbounded following&lt;/strong&gt;)  as lastRequestSender ,&lt;br /&gt;
    first_value(location) over (partition by requestId order by messageNum desc)  as firstRequestLocation &lt;br /&gt;
From TestLastValueTable&lt;br /&gt;
order by Id&lt;/span&gt;&lt;br /&gt;
 &lt;/p&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/marocanu2001/aggbug/146505.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>marocanu2001</dc:creator>
            <guid>http://geekswithblogs.net/marocanu2001/archive/2011/08/11/nasty-bug-in-sybase-iq-analytical-function-last_value-over-partition.aspx</guid>
            <pubDate>Fri, 12 Aug 2011 10:11:51 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/marocanu2001/comments/146505.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/marocanu2001/archive/2011/08/11/nasty-bug-in-sybase-iq-analytical-function-last_value-over-partition.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/marocanu2001/comments/commentRss/146505.aspx</wfw:commentRss>
        </item>
        <item>
            <title>WCF Service reference update gets: Error HRESULT E_FAIL returned from COM component</title>
            <link>http://geekswithblogs.net/marocanu2001/archive/2011/07/19/wcf-service-reference-update-gets-error-hresult-e_fail-returned-from.aspx</link>
            <description>&lt;p&gt;I was trying to update a service reference in a Silverlight project and  I got :  Error HRESULT E_FAIL has been returned from a call to a COM component.&lt;/p&gt;
&lt;p&gt;Problem was that ServiceReferences.ClientConfig file being actually a common file shared between 3 projects, I extracted it outside and referenced it from a common project as a link to the file. When the reference (creation or update) wizard is trying to update this file, this "very descriptive and intuitive" error shows up.&lt;/p&gt;
&lt;p&gt;So, when getting this error and in doubt check that configuration file is writable from your location.&lt;/p&gt;
&lt;p&gt;Good luck!&lt;/p&gt;
&lt;div id="question-header"&gt;
&lt;p&gt;&lt;a class="question-hyperlink" href="http://stackoverflow.com/questions/822766/error-hresult-e-fail-has-been-returned-from-a-call-to-a-com-component"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/marocanu2001/aggbug/146266.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>marocanu2001</dc:creator>
            <guid>http://geekswithblogs.net/marocanu2001/archive/2011/07/19/wcf-service-reference-update-gets-error-hresult-e_fail-returned-from.aspx</guid>
            <pubDate>Tue, 19 Jul 2011 16:10:34 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/marocanu2001/comments/146266.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/marocanu2001/archive/2011/07/19/wcf-service-reference-update-gets-error-hresult-e_fail-returned-from.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/marocanu2001/comments/commentRss/146266.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Running Silverlight tests in TeamCity using StatLight</title>
            <link>http://geekswithblogs.net/marocanu2001/archive/2011/04/18/running-silverlihght-tests-in-teamcity-using-statlight.aspx</link>
            <description>&lt;p&gt;First I downloaded Statlght and copied the binaries here: C:\Program Files\StatLight.v1.3, I tests that Statlight is working fine on the build machine and then I added a new step in my build in order to run the tests&lt;/p&gt;
&lt;p&gt;There is quite a lot of stuff on creating the TeamCity step, but every single post I found was missing some double quotes here and there :) so this might be saving you some time.&lt;/p&gt;
&lt;p&gt;Here is the configuration that is working for me: &lt;/p&gt;
&lt;p&gt;( Build Step 1 compiles and builds the project)&lt;/p&gt;
&lt;p&gt;Build Step 2 : Command line &lt;/p&gt;
&lt;p&gt;Runner type: Command Line&lt;/p&gt;
&lt;p&gt;Working Directory : empty&lt;/p&gt;
&lt;p&gt;Run: Executable with parametres&lt;/p&gt;
&lt;p&gt;Command executable: "C:\Program Files\StatLight.v1.3\StatLight.exe"&lt;/p&gt;
&lt;p&gt;Command parameters : -x="&lt;span style="font-family: Arial;"&gt;C:\Source\trunk\&amp;lt;SolutionNam&lt;strong&gt;e&lt;/strong&gt;&amp;gt;&amp;lt;ProjectName&amp;gt;.Tests\Bin\Release\&amp;lt;projectName&amp;gt;.Tests.xap&lt;/span&gt;" --teamcity&lt;/p&gt;
&lt;p&gt;Report type: Do not process&lt;/p&gt;
&lt;p&gt;The output of this step in the project settings page is as it follow:&lt;/p&gt;
&lt;div class="parameterGroup"&gt;Step 2: &lt;strong&gt;Command Line&lt;/strong&gt; (Simple command  execution)
&lt;div class="nestedParameter"&gt;
&lt;div class="parameter"&gt;Working directory: &lt;strong&gt;&lt;strong&gt;same as checkout  directory&lt;/strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="parameter"&gt;Command executable: &lt;strong&gt;"C:\Program  Files\StatLight.v1.3\StatLight.exe"&lt;/strong&gt;&lt;/div&gt;
&lt;div class="parameter"&gt;Command parameters:  &lt;strong&gt;-x="C:\Source\trunk\&amp;lt;SolutionName&amp;gt;&amp;lt;ProjectName&amp;gt;.Tests\Bin\Release\&amp;lt;projectName&amp;gt;.Tests.xap"  --teamcity&lt;/strong&gt;&lt;/div&gt;
&lt;div class="parameter"&gt;XML report processing: &lt;strong&gt;disabled&lt;/strong&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/marocanu2001/aggbug/144950.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>marocanu2001</dc:creator>
            <guid>http://geekswithblogs.net/marocanu2001/archive/2011/04/18/running-silverlihght-tests-in-teamcity-using-statlight.aspx</guid>
            <pubDate>Tue, 19 Apr 2011 09:03:22 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/marocanu2001/comments/144950.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/marocanu2001/archive/2011/04/18/running-silverlihght-tests-in-teamcity-using-statlight.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/marocanu2001/comments/commentRss/144950.aspx</wfw:commentRss>
        </item>
        <item>
            <title>InvokeRequired not reliable?</title>
            <link>http://geekswithblogs.net/marocanu2001/archive/2010/03/27/invokerequired-not-reliable.aspx</link>
            <description>&lt;p&gt;&lt;code&gt;InvalidOperationException: &lt;em&gt;Cross&lt;/em&gt;-&lt;em&gt;thread&lt;/em&gt; operation not  valid: Control 'progressBar' accessed from a thread other than the thread  it was created ...&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now this is not a nice way to start a day! not even if it's a Monday!&lt;/p&gt;
&lt;p&gt;So you have seen this and already thought, come on, this is an old one, just ask whether InvokeRequired before calling the method in the control, something like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;if (progressBar.InvokeRequired) {&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;          progressBar.Invoke  ( new MethodInvoker( delegate {  progressBar.Value = 50;    }) )&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;}else&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;     progressBar.Value = 50;    &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately this was not working the way I would have expected, I got this error, debugged and though in debugging the InvokeRequired had become true , the error was thrown on the branch that did not required Invoke.&lt;/p&gt;
&lt;p&gt;So there was a scenario where InvokeRequired returned false and still accessing the control was not on the right thread ...&lt;/p&gt;
&lt;p&gt;Problem was that I kept showing and hiding the little form showing the progressbar. The progressbar was updating on an event  , ProgressChanged and I could not guarantee the little form was loaded by the time the event was thrown.&lt;/p&gt;
&lt;p&gt;So , spotted the problem,&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;span style="background-color: rgb(255, 255, 0);"&gt;if none of the parents of the control you try to modify is created at the time of the method invoking, the InvokeRequired returns tru&lt;/span&gt;&lt;span style="background-color: rgb(255, 255, 0);"&gt;e&lt;/span&gt;!&lt;/span&gt; That causes your code to execute on the woring thread. Of course, updating UI before the win dow was created is not a legitimate action either, still I would have expected a different error.&lt;/p&gt;
&lt;p&gt;MSDN: &lt;span&gt;
&lt;p&gt;"If the control's handle does not yet exist, &lt;span&gt;&lt;span class="selflink"&gt;InvokeRequired&lt;/span&gt;&lt;/span&gt; searches up the control's  parent chain until it finds a control or form that does have a window  handle. If no appropriate handle can be found, the &lt;span&gt;&lt;span class="selflink"&gt;InvokeRequired&lt;/span&gt;&lt;/span&gt; method returns &lt;span&gt;&lt;span class="input"&gt;false&lt;/span&gt;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;This means that &lt;span&gt;&lt;span class="selflink"&gt;InvokeRequired&lt;/span&gt;&lt;/span&gt; can return &lt;span&gt;&lt;span class="input"&gt;false&lt;/span&gt;&lt;/span&gt; if &lt;span&gt;&lt;a onclick="javascript:Track('ctl00_MTCS_main_ctl48_ctl00_contenthere|ctl00_MTCS_main_ctl48_ctl00_ctl06',this);" href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.invoke.aspx" id="ctl00_MTCS_main_ctl48_ctl00_ctl06"&gt;Invoke&lt;/a&gt;&lt;/span&gt;  is not required (the call occurs on the same thread), or if the control  was created on a different thread but the control's handle has not yet  been created."&lt;/p&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Have  a look at InvokeRequired's implementation:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span class="ckeyword"&gt;public bool&lt;/span&gt; InvokeRequired&lt;br /&gt;
{&lt;br /&gt;
    &lt;span class="ckeyword"&gt;get&lt;/span&gt;&lt;br /&gt;
    {&lt;br /&gt;
        HandleRef hWnd;&lt;br /&gt;
        &lt;span class="ckeyword"&gt;int&lt;/span&gt; lpdwProcessId;&lt;br /&gt;
        &lt;span class="ckeyword"&gt;if&lt;/span&gt; (&lt;span class="ckeyword"&gt;this&lt;/span&gt;.IsHandleCreated)&lt;br /&gt;
        {&lt;br /&gt;
            hWnd = &lt;span class="ckeyword"&gt;new&lt;/span&gt; HandleRef(&lt;span class="ckeyword"&gt;this&lt;/span&gt;, &lt;span class="ckeyword"&gt;this&lt;/span&gt;.Handle);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;span class="ckeyword"&gt;else&lt;/span&gt;&lt;br /&gt;
        {&lt;br /&gt;
            Control wrapper = &lt;span class="ckeyword"&gt;this&lt;/span&gt;.FindMarshallingControl();&lt;br /&gt;
            if (!wrapper.IsHandleCreated)&lt;br /&gt;
            {&lt;br /&gt;
                &lt;span class="ckeyword"&gt;return false&lt;/span&gt;; &lt;span style="color: red;"&gt;// &amp;lt;==========&lt;/span&gt;&lt;br /&gt;
            }&lt;br /&gt;
            hWnd = &lt;span class="ckeyword"&gt;new&lt;/span&gt; HandleRef(wrapper, wrapper.Handle);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;span class="ckeyword"&gt;int&lt;/span&gt; windowThreadProcessId = SafeNativeMethods.GetWindowThreadProcessId(hWnd, &lt;span class="ckeyword"&gt;out&lt;/span&gt; lpdwProcessId);&lt;br /&gt;
        &lt;span class="ckeyword"&gt;int&lt;/span&gt; currentThreadId = SafeNativeMethods.GetCurrentThreadId();&lt;br /&gt;
        &lt;span class="ckeyword"&gt;return&lt;/span&gt; (windowThreadProcessId != currentThreadId);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Here 's a good article about this and a workaround &lt;a href="http://www.ikriv.com/en/prog/info/dotnet/MysteriousHang.html"&gt;http://www.ikriv.com/en/prog/info/dotnet/MysteriousHang.html&lt;/a&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/marocanu2001/aggbug/138961.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>marocanu2001</dc:creator>
            <guid>http://geekswithblogs.net/marocanu2001/archive/2010/03/27/invokerequired-not-reliable.aspx</guid>
            <pubDate>Sun, 28 Mar 2010 11:16:38 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/marocanu2001/comments/138961.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/marocanu2001/archive/2010/03/27/invokerequired-not-reliable.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/marocanu2001/comments/commentRss/138961.aspx</wfw:commentRss>
        </item>
        <item>
            <title>System.Data.Sqlclient.Sqlexception: Line1 incorrect syntax  ...</title>
            <link>http://geekswithblogs.net/marocanu2001/archive/2010/03/25/system.data.sqlclient.sqlexception-line1-incorrect-syntax.aspx</link>
            <description>&lt;p&gt;Given a SqlConnection, a SqlCommand if you need to execute a stored procedure it is enough to specify the stored procedure name as the CommandText and it will work.&lt;/p&gt;
&lt;p&gt;Now the surprise is that if you also add parametres, you get this creepy error: SqlException: Line 1 incorrect syntax near [storedProcedureName].&lt;/p&gt;
&lt;p&gt;The quick fix is to specify the &lt;strong&gt;CommandType&lt;/strong&gt; to be &lt;strong&gt;StoredProcedure&lt;/strong&gt;.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/marocanu2001/aggbug/138908.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>marocanu2001</dc:creator>
            <guid>http://geekswithblogs.net/marocanu2001/archive/2010/03/25/system.data.sqlclient.sqlexception-line1-incorrect-syntax.aspx</guid>
            <pubDate>Thu, 25 Mar 2010 15:36:12 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/marocanu2001/comments/138908.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/marocanu2001/archive/2010/03/25/system.data.sqlclient.sqlexception-line1-incorrect-syntax.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/marocanu2001/comments/commentRss/138908.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
