<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gruchalski.com</title>
	<atom:link href="http://gruchalski.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gruchalski.com</link>
	<description>confessions of a ria developer</description>
	<lastBuildDate>Sat, 08 May 2010 16:43:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Yet another ViewStack control for Silverlight</title>
		<link>http://gruchalski.com/2009/12/15/yet-another-viewstack-control-for-silverlight/</link>
		<comments>http://gruchalski.com/2009/12/15/yet-another-viewstack-control-for-silverlight/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 23:41:16 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[Silverlight/WPF]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=418</guid>
		<description><![CDATA[In one of my recent Silverlight projects I had to use a ViewStack control. There is few of these already available here and there but I thought it might be fun to build new one from scratch. As image speaks more than words here is the sample. And here is the source code. Hope this [...]]]></description>
			<content:encoded><![CDATA[<p>In one of my recent Silverlight projects I had to use a ViewStack control. There is few of these already available here and there but I thought it might be fun to build new one from scratch. As <em>image speaks more than words</em> here is the sample.</p>
<p><div id="silverlightControlHost"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="400" height="300"><param name="source" value="http://gruchalski.com/wp-content/uploads/2009/12/ViewStackTestApp.xap"/><param name="background" value="white" /><param name="minRuntimeVersion" value="4.0.41108.0" /><param name="autoupgrade" value="true" /><param name="enableHtmlAccess" value="true" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156" style="text-decoration: none;"><img src="http://storage.timheuer.com/sl4wp-ph.png" alt="Install Microsoft Silverlight" style="border-style: none; width:400px; height:200px"/></a></object><iframe style="visibility:hidden;height:0;width:0;border:0px" id="_sl_historyFrame"></iframe></div><br /></p>
<p><a href="/wp-content/uploads/2009/12/ViewStack.zip">And here is the source code</a>.</p>
<p>Hope this helps anyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/12/15/yet-another-viewstack-control-for-silverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Builder 3 Linux Alpha 5 available on labs.adobe.com</title>
		<link>http://gruchalski.com/2009/11/25/flex-builder-3-linux-alpha-5-available-on-labs-adobe-com/</link>
		<comments>http://gruchalski.com/2009/11/25/flex-builder-3-linux-alpha-5-available-on-labs-adobe-com/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 09:57:34 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=412</guid>
		<description><![CDATA[I&#8217;m sure everyone who&#8217;s interested in Flex Builder for Linux already knows that by following Twitter and Adobe JIRA. So what&#8217;s exactly happened? Today, just 5 days before Flex Builder alpha 4 was to expire Adobe released an alpha 5 update on labs.adobe.com which is going to expire in 401 days. I have the gut [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure everyone who&#8217;s interested in Flex Builder for Linux already knows that by following Twitter and <a href="http://bugs.adobe.com/jira/browse/FB-19053">Adobe JIRA</a>. So what&#8217;s exactly happened? Today, just 5 days before Flex Builder alpha 4 was to expire Adobe released an alpha 5 update on <a href="http://labs.adobe.com/technologies/flex/flexbuilder_linux/">labs.adobe.com</a> which is going to expire in 401 days.</p>
<p>I have the gut feeling that Adobe is working on Flex Builder 4 for Linux but is not keen on sharing the info yet. Specially that there is an unofficial build available <a href="http://code.google.com/p/fb4linux/">from here</a>.</p>
<p>Good decision Adobe.</p>
<p>More information on current release <a href="http://blogs.adobe.com/flex/archives/2009/11/flex_builder_linux_alpha_5_rel.html">here</a> and <a href="http://labs.adobe.com/technologies/flex/flexbuilder_linux/releasenotes.html">here (release notes)</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/11/25/flex-builder-3-linux-alpha-5-available-on-labs-adobe-com/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Printing data on multiple pages with Silverlight 4</title>
		<link>http://gruchalski.com/2009/11/20/printing-data-on-multiple-pages-with-silverlight-4/</link>
		<comments>http://gruchalski.com/2009/11/20/printing-data-on-multiple-pages-with-silverlight-4/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 22:52:29 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[Silverlight/WPF]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=385</guid>
		<description><![CDATA[This week at PDC09 Microsoft unveiled latest Silverlight release &#8211; first beta of version 4. One of the new features is printing support. There is a great video introduction to printing published by Tim Heuer. It show the basics, after watching it my first question was how to print the data on multiple pages. Here [...]]]></description>
			<content:encoded><![CDATA[<p>This week at <a href="http://microsoftpdc.com">PDC09</a> Microsoft unveiled latest Silverlight release &#8211; first beta of version 4. One of the new features is printing support. There is a great <a href="http://silverlight.net/learn/videos/all/printing-api-basics/">video introduction to printing</a> published by <a href="http://timheuer.com/blog/">Tim Heuer</a>. It show the basics, after watching it my first question was how to print the data on multiple pages. Here is how I do it. This application is a cut down version of the app published by Tim on <a href="http://silverlight.net/learn/videos/all/printing-api-basics/">silverlight.net</a>.</p>
<p>In this sample we are going to print list of people and display sample header showing page number and some random title. Let&#8217;s jump in.</p>
<p>Let&#8217;s start with XAML:</p>
<pre name="code" class="xml">
&lt;UserControl x:Class=&quot;PrintingTest.MainPage&quot;
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
    xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
    xmlns:data=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;
    mc:Ignorable=&quot;d&quot;
    d:DesignHeight=&quot;300&quot; d:DesignWidth=&quot;400&quot;&gt;
    &lt;Grid x:Name=&quot;LayoutRoot&quot; Background=&quot;White&quot;&gt;
        &lt;data:DataGrid
            ItemsSource=&quot;{Binding}&quot;
            Height=&quot;247&quot; HorizontalAlignment=&quot;Left&quot;
            Margin=&quot;12,41,0,0&quot; Name=&quot;dataGrid1&quot;
            VerticalAlignment=&quot;Top&quot; Width=&quot;376&quot; /&gt;
        &lt;Button
            Content=&quot;Print data&quot; Height=&quot;23&quot;
            HorizontalAlignment=&quot;Left&quot; Margin=&quot;12,12,0,0&quot;
            Name=&quot;PrintDataBtn&quot; VerticalAlignment=&quot;Top&quot;
            Width=&quot;126&quot; Click=&quot;PrintDataBtn_Click&quot; /&gt;
    &lt;/Grid&gt;
&lt;/UserControl&gt;
</pre>
<p>Next is the <code>Person</code> class which is exactly the same as in the original video:</p>
<pre name="code" class="csharp">
using System;

namespace PrintingTest
{
    public class Person
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public int Age { get; set; }
        public string FullName {
            get {
                return string.Concat(FirstName, &quot; &quot;, LastName);
            }
        }
    }
}
</pre>
<p>And now the most important part &#8211; the code behind. The <code>MainPage</code> class wires up the <code>Loaded</code> event and when the app is loaded it populates the list of people as well as sets the <code>DataContext</code> on <code>LayoutRoot</code>.</p>
<pre name="code" class="csharp">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Printing;
using System.Windows.Media;

namespace PrintingTest
{
    public partial class MainPage : UserControl
    {

        public MainPage()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(MainPage_Loaded);
        }

        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            List&lt;Person&gt; people = new List&lt;Person&gt;();
            for (int i = 0; i &lt; 20; i++)
            {
                people.Add(new Person() { FirstName = &quot;Al&quot;, LastName = &quot;Pacino&quot;, Age = 69 });
                people.Add(new Person() { FirstName = &quot;Robert&quot;, LastName = &quot;De Niro&quot;, Age = 66 });
                people.Add(new Person() { FirstName = &quot;Val&quot;, LastName = &quot;Kilmer&quot;, Age = 50 });
                people.Add(new Person() { FirstName = &quot;John&quot;, LastName = &quot;Voight&quot;, Age = 71 });
                people.Add(new Person() { FirstName = &quot;Tom&quot;, LastName = &quot;Sizemore&quot;, Age = 48 });
            }
            LayoutRoot.DataContext = people;
        }

        private void PrintDataBtn_Click(object sender, RoutedEventArgs e)
        {
            // header height:
            double headerHeight = 70.0;
            // footer height:
            double footerHeight = 30.0;
            // single line height:
            double tboxHeight = 20.0;
            // how many elements can we place on one page?
            int numElements = -1;
            // current page number:
            int page = 1;
            // total number of pages to print:
            int totalPages = 0;
            // number of the current item:
            int counter = 1;

            PrintDocument doc = new PrintDocument();
            doc.PrintPage += (s, args) =&gt;
            {
            };
           doc.Print();
        }

    }
}
</pre>
<p>The code below is responsible for printing and should be placed inside <code>doc.PrintPage</code> lambda. Let&#8217;s discuss what is going on there first.</p>
<p>When the application attempts to compose first page the number of elements per page and total number of pages is calculated. Next, the header is created. It is a <code>Grid</code> with two <code>TextBlock</code>s. First of the text blocks holds the title while the second one displays current and the total pages numbers; header is created separately for each page.</p>
<p>Once the header is constructed the <code>dynamicPanel</code> <code>StackPanel</code> is created and previously constructed <code>headerGrid</code> is added to its <code>Children</code> list. Next, we query <code>dataGrid1.ItemsSource</code> for the first of people to display on current page. We skip as many elements as we fitted on previous pages and take number of elements for the current one.</p>
<p>The penultimate step is enumerating over <code>ppl</code> list and for each one of them create a <code>StackPanel</code> with two <code>TextBlock</code>s. First displays the name of the person, second one the age. Finally we set <code>HasMorePages</code>.</p>
<p><code>HasMorePages</code> is the key to multiple pages printing. As long as it is set to <code>true</code> Silverlight expects more pages to be printed. That&#8217;s why when the number of current page is equal to total number of pages we set it to <code>false</code>. At this point printing the document is finished.</p>
<p>Here is the code:</p>
<pre name="code" class="csharp">
                if (page == 1)
                {
                    numElements = (int)((args.PrintableArea.Height - headerHeight - footerHeight) / tboxHeight);
                    double totalItems = (double)((List&lt;Person&gt;)dataGrid1.ItemsSource).Count;
                    totalPages = (int)Math.Ceiling(totalItems / (double)numElements);
                }

                Grid headerGrid = new Grid()
                    {
                        Width = args.PrintableArea.Width,
                        Height = headerHeight
                    };
                headerGrid.RowDefinitions.Add(new RowDefinition());
                headerGrid.ColumnDefinitions.Add(new ColumnDefinition());
                headerGrid.ColumnDefinitions.Add(new ColumnDefinition());

                TextBlock headerTitle = new TextBlock()
                {
                    Text = &quot;Contact list&quot;,
                    HorizontalAlignment = System.Windows.HorizontalAlignment.Left,
                    VerticalAlignment = System.Windows.VerticalAlignment.Center,
                    Margin = new Thickness(50,0,0,0),
                    FontSize = 20
                };
                TextBlock pageCounter = new TextBlock()
                {
                    Text = string.Concat(&quot;Page &quot;, page, &quot; of &quot;, totalPages),
                    HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
                    VerticalAlignment = System.Windows.VerticalAlignment.Center,
                    Margin = new Thickness(0, 0, 50, 0)
                };
                headerGrid.Children.Add(headerTitle);
                headerGrid.Children.Add(pageCounter);
                Grid.SetColumn(headerTitle, 1);
                Grid.SetColumn(pageCounter, 2);

                StackPanel dynamicPanel = new StackPanel();
                // add header to display list:
                dynamicPanel.Children.Add(headerGrid);

                IEnumerable&lt;Person&gt; ppl = ((List&lt;Person&gt;)dataGrid1.ItemsSource).Skip((page - 1) * numElements).Take(numElements);

                foreach (Person p in ppl)
                {
                    // create stack panel for each person:
                    StackPanel namePanel = new StackPanel();
                    namePanel.Orientation = Orientation.Horizontal;

                    TextBlock counterBlock = new TextBlock();
                    counterBlock.TextAlignment = TextAlignment.Right;
                    counterBlock.Margin = new Thickness(0, 0, 5, 0);
                    counterBlock.Text = string.Concat(counter, &quot;.&quot;);
                    counterBlock.Height = tboxHeight;
                    counterBlock.Width = 50.0;

                    TextBlock nameBlock = new TextBlock();
                    nameBlock.Text = p.FullName;
                    nameBlock.Height = tboxHeight;

                    TextBlock ageBlock = new TextBlock();
                    ageBlock.Text = string.Concat(&quot;who is &quot;, p.Age, &quot; years old&quot;);
                    ageBlock.Foreground = new SolidColorBrush(Colors.Red);
                    ageBlock.Margin = new Thickness(5, 0, 0 , 0);
                    ageBlock.Height = tboxHeight;

                    namePanel.Children.Add(counterBlock);
                    namePanel.Children.Add(nameBlock);
                    namePanel.Children.Add(ageBlock);
                    dynamicPanel.Children.Add(namePanel);

                    counter++;
                }

                args.HasMorePages = !(page == totalPages);
                args.PageVisual = dynamicPanel;

                page++;
</pre>
<p>Full source code can be downloaded <a href="/wp-content/uploads/2009/11/PrintingTest.zip">from here</a>. You can test working example below, please make sure you use Silverlight 4 beta. It can be installed <a href="http://silverlight.net/getstarted/silverlight-4-beta/#tools">from this location</a>.</p>
<p><span id="more-385"></span></p>
<p><div id="silverlightControlHost"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="400" height="300"><param name="source" value="http://gruchalski.com/wp-content/uploads/2009/11/PrintingTest.xap"/><param name="background" value="white" /><param name="minRuntimeVersion" value="4.0.41108.0" /><param name="autoupgrade" value="true" /><param name="enableHtmlAccess" value="true" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156" style="text-decoration: none;"><img src="http://storage.timheuer.com/sl4wp-ph.png" alt="Install Microsoft Silverlight" style="border-style: none; width:400px; height:200px"/></a></object><iframe style="visibility:hidden;height:0;width:0;border:0px" id="_sl_historyFrame"></iframe></div><br /></p>
<p>Sample PDF output can be seen <a href="/wp-content/uploads/2009/11/PeoplePrintOutput.pdf">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/11/20/printing-data-on-multiple-pages-with-silverlight-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Installing and connecting Apple Built-in iSight in Windows 7 x64 running under VMWare Fusion</title>
		<link>http://gruchalski.com/2009/11/19/installing-and-connecting-apple-built-in-isight-in-windows-7-x64-running-under-vmware-fusion/</link>
		<comments>http://gruchalski.com/2009/11/19/installing-and-connecting-apple-built-in-isight-in-windows-7-x64-running-under-vmware-fusion/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 00:05:03 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=372</guid>
		<description><![CDATA[It took me a while to figure out how to install Apple Built-in iSight driver so it could be used in Windows 7 x64 running inside VMWare Fusion. I have finally found a solution here. Installing the drivers: run cmd.exe as Administrator D: (or whatever the drive letter of mounted CD is) cd &#34;Boot Camp\Drivers\Apple&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>It took me a while to figure out how to install Apple Built-in iSight driver so it could be used in Windows 7 x64 running inside VMWare Fusion. I have finally found a solution <a href="http://forums.macrumors.com/showthread.php?t=632609">here</a>.</p>
<p>Installing the drivers:</p>
<ol>
<li>run <em>cmd.exe</em> as Administrator</li>
<li>D: (or whatever the drive letter of mounted CD is)</li>
<li>cd &quot;Boot Camp\Drivers\Apple&quot;</li>
<li>msiexec /i BootCamp64.msi</li>
</ol>
<p>It will take a while so be patient. Once installed, restart Windows 7 and you are ready to go.</p>
<p>To connect Apple Built-in iSight:</p>
<ol>
<li>VMWare Fusion &gt; Virtual Machine</li>
<li>USB</li>
<li>Connect Apple Built-in iSight</li>
</ol>
<p>Don&#8217;t forget to enable USB sharing.</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/11/19/installing-and-connecting-apple-built-in-isight-in-windows-7-x64-running-under-vmware-fusion/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I can now start using Safari, ClickToFlash FTW</title>
		<link>http://gruchalski.com/2009/10/06/i-can-now-start-using-safari-clicktoflash-ftw/</link>
		<comments>http://gruchalski.com/2009/10/06/i-can-now-start-using-safari-clicktoflash-ftw/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 23:03:31 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=368</guid>
		<description><![CDATA[For a long time my &#34;browser of choice&#34; was Firefox because of fantastic Flashblock add-in. Today I found out that there is similar add-in for Safari called ClickToFlash. Here is a nice article describing what it can do and here is the link to a github project. Pefect!]]></description>
			<content:encoded><![CDATA[<p>For a long time my &quot;browser of choice&quot; was Firefox because of fantastic Flashblock add-in. Today I found out that there is similar add-in for Safari called ClickToFlash. Here is <a href="http://www.roughlydrafted.com/2009/10/06/html5-assault-on-adobe-flash-heats-up-with-clicktoflash/">a nice article</a> describing what it can do and here is the link to <a href="http://rentzsch.github.com/clicktoflash/">a github project</a>. Pefect!</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/10/06/i-can-now-start-using-safari-clicktoflash-ftw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColdFusion compiler is broken</title>
		<link>http://gruchalski.com/2009/09/22/coldfusion-compiler-is-broken/</link>
		<comments>http://gruchalski.com/2009/09/22/coldfusion-compiler-is-broken/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 10:09:33 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=363</guid>
		<description><![CDATA[Following on a tweet from Sean Corfield, I couldn&#8217;t believe it is possible to create a function called if, else, while and so on as well as declare variable called var. Here is the code that may hurt your head: [sourcecode lang="cf"] &#60;cffunction name=&#34;if&#34;&#62; &#60;cfargument name=&#34;val1&#34; /&#62; &#60;cfargument name=&#34;val2&#34; /&#62; &#60;cfif val1 eq val2&#62; &#60;cfreturn [...]]]></description>
			<content:encoded><![CDATA[<p>Following on <a href="http://twitter.com/seancorfield/status/4113568458">a tweet</a> from Sean Corfield, I couldn&#8217;t believe it is possible to create a function called <em>if</em>, <em>else</em>, <em>while</em> and so on as well as declare variable called <em>var</em>. Here is the code that may hurt your head:</p>
<pre>[sourcecode lang="cf"]
&lt;cffunction name=&quot;if&quot;&gt;
	&lt;cfargument name=&quot;val1&quot; /&gt;
	&lt;cfargument name=&quot;val2&quot; /&gt;
	&lt;cfif val1 eq val2&gt;
		&lt;cfreturn true /&gt;
	&lt;/cfif&gt;
	&lt;cfreturn false /&gt;
&lt;/cffunction&gt;
&lt;cffunction name=&quot;hello&quot;&gt;
	&lt;cfset var var = 2 /&gt;
	&lt;cfreturn var /&gt;
&lt;/cffunction&gt;
&lt;cfif if( hello(), 2 )&gt;
	LOL
&lt;/cfif&gt;
[/sourcecode]</pre>
<p>How cool is that ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/09/22/coldfusion-compiler-is-broken/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Greasemonkey script to remove unwanted results from Google</title>
		<link>http://gruchalski.com/2009/09/15/greasemonkey-script-to-remove-unwanted-results-from-google/</link>
		<comments>http://gruchalski.com/2009/09/15/greasemonkey-script-to-remove-unwanted-results-from-google/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 15:35:44 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=360</guid>
		<description><![CDATA[For myself, for future reference: [sourcecode lang="js"] // ==UserScript== // @name Expert blocker // @namespace my // @description Eliminate Experts Exchange results from Google searches. // @include http://*.google.com/search?* // @include http://*.google.co.uk/search?* // ==/UserScript== var results = document.getElementsByTagName(&#34;a&#34;); for ( var i=0; i&#60;results.length; i++ ) { if ( results[i].href.indexOf(&#34;http:/ /www.experts-exchange.com&#34;) == 0 &#124;&#124; results[i].href.indexOf(&#34;http:/ /swik.net&#34;) == [...]]]></description>
			<content:encoded><![CDATA[<p>For myself, for future reference:</p>
<pre>[sourcecode lang="js"]
// ==UserScript==
// @name           Expert blocker
// @namespace      my
// @description    Eliminate Experts Exchange results from Google searches.
// @include        http://*.google.com/search?*
// @include        http://*.google.co.uk/search?*
// ==/UserScript==

var results = document.getElementsByTagName(&quot;a&quot;);
for ( var i=0; i&lt;results.length; i++ ) {
	if (
		results[i].href.indexOf(&quot;http:/ /www.experts-exchange.com&quot;) == 0
		|| results[i].href.indexOf(&quot;http:/ /swik.net&quot;) == 0 ) {
		results[i].parentNode.parentNode.style.display = &quot;none&quot;;
	}
}
[/sourcecode]</pre>
<p>Before using, in the URLs replace <em>http:/ /</em> with <em>http://</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/09/15/greasemonkey-script-to-remove-unwanted-results-from-google/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ColdFusion to Flex serializer needs better error messages</title>
		<link>http://gruchalski.com/2009/09/02/coldfusion-to-flex-serializer-needs-better-error-messages/</link>
		<comments>http://gruchalski.com/2009/09/02/coldfusion-to-flex-serializer-needs-better-error-messages/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 09:44:03 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Moan]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=353</guid>
		<description><![CDATA[I&#8217;m using Flex with ColdFusion for a long time now but sometimes I really can&#8217;t stand these two products together. I&#8217;m sending nested CFCs through the remote object back to Flex so ColdFusion has to serialize them to the form that may be understood by Flex. But I&#8217;ve got an error, somewhere I have an [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using Flex with ColdFusion for a long time now but sometimes I really can&#8217;t stand these two products together. I&#8217;m sending nested CFCs through the remote object back to Flex so ColdFusion has to serialize them to the form that may be understood by Flex. But I&#8217;ve got an error, somewhere I have an empty string where number is expected. You would expect that CF is smart enough to tell you what the problem is? Nope, it says:</p>
<p><code>Unable to invoke CFC - The value '' cannot be converted to a number.</code></p>
<p>And here is the stack trace:</p>
<pre>[sourcecode lang="cf"]
        [0] &quot;coldfusion.runtime.Cast._double(Cast.java:652)&quot;
        [1] &quot;coldfusion.runtime.Cast._double(Cast.java:632)&quot;
        [2] &quot;coldfusion.runtime.Cast._double(Cast.java:786)&quot;
        [3] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:545)&quot;
        [4] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:494)&quot;
        [5] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:387)&quot;
        [6] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:81)&quot;
        [7] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:512)&quot;
        [8] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:494)&quot;
        [9] &quot;coldfusion.flash.filter.CFCInvokeFilter.invoke(CFCInvokeFilter.java:160)&quot;
        [10] &quot;coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)&quot;
        [11] &quot;coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)&quot;
        [12] &quot;coldfusion.flash.filter.CFCInvokeDebugFilter.invoke(CFCInvokeDebugFilter.java:54)&quot;
        [13] &quot;coldfusion.flash.filter.CFCInvokePathFilter.invoke(CFCInvokePathFilter.java:70)&quot;
        [14] &quot;coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)&quot;
        [15] &quot;coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)&quot;
        [16] &quot;coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)&quot;
        [17] &quot;coldfusion.flash.messaging.ColdFusionAdapter.invoke(ColdFusionAdapter.java:223)&quot;
        [18] &quot;flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:173)&quot;
        [19] &quot;flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1165)&quot;
        [20] &quot;flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:757)&quot;
        [21] &quot;flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:117)&quot;
        [22] &quot;flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)&quot;
        [23] &quot;flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:48)&quot;
        [24] &quot;flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)&quot;
        [25] &quot;flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:145)&quot;
        [26] &quot;flex.messaging.endpoints.AMFEndpoint.service(AMFEndpoint.java:122)&quot;
        [27] &quot;flex.messaging.MessageBrokerServlet.service(MessageBrokerServlet.java:438)&quot;
        [28] &quot;coldfusion.flex.ColdFusionMessageBrokerServlet.service(ColdFusionMessageBrokerServlet.java:50)&quot;
        [29] &quot;javax.servlet.http.HttpServlet.service(HttpServlet.java:853)&quot;
        [30] &quot;coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)&quot;
        [31] &quot;jrun.servlet.FilterChain.doFilter(FilterChain.java:86)&quot;
        [32] &quot;coldfusion.filter.FlashRequestControlFilter.doFilter(FlashRequestControlFilter.java:71)&quot;
        [33] &quot;coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)&quot;
        [34] &quot;jrun.servlet.FilterChain.doFilter(FilterChain.java:94)&quot;
        [35] &quot;jrun.servlet.FilterChain.service(FilterChain.java:101)&quot;
        [36] &quot;jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)&quot;
        [37] &quot;jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)&quot;
        [38] &quot;jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)&quot;
        [39] &quot;jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)&quot;
        [40] &quot;jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)&quot;
        [41] &quot;jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)&quot;
        [42] &quot;jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)&quot;
        [43] &quot;jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)&quot;
        [44] &quot;jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)&quot;
[/sourcecode]</pre>
<p>Helpful, heh?</p>
<p>Why, WHY! it does not say what property is causing the problem? Surely it knows, it just keeps it for itself. Adobe &#8211; please fix!</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/09/02/coldfusion-to-flex-serializer-needs-better-error-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex DateFormatter bug, missing January 1970 month name</title>
		<link>http://gruchalski.com/2009/06/18/flex-dateformatter-bug-missing-january-1970-month-name/</link>
		<comments>http://gruchalski.com/2009/06/18/flex-dateformatter-bug-missing-january-1970-month-name/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 20:23:56 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=330</guid>
		<description><![CDATA[Today, while working on a small piece of code I discovered something that appears to be a DateFormatter bug. I was using following DateFormatter: [sourcecode lang='as3'] private var formatter:DateFormatter = new DateFormatter(); ... formatter.formatString = "MMMM"; [/sourcecode] to display just the month names. I didn&#8217;t really care about the year when constructing new Date so [...]]]></description>
			<content:encoded><![CDATA[<p>Today, while working on a small piece of code I discovered something that appears to be a <em>DateFormatter</em> bug. I was using following DateFormatter:</p>
<pre>[sourcecode lang='as3']
private var formatter:DateFormatter = new DateFormatter();
...
 formatter.formatString = "MMMM";
[/sourcecode]</pre>
<p>to display just the month names. I didn&#8217;t really care about the year when constructing new <em>Date</em> so I thought I would pick 1970. It appears that for January 1970 the <em>DateFormatter</em> returns an empty string while for 1969, 1971 and any other dates it works fine. Here is the demo.</p>
<p>[SWF]/wp-content/uploads/2009/06/DateFormatterBug.swf, 450, 300[/SWF]</p>
<p>And the source code below.</p>
<pre>[sourcecode lang='as3']
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

 <mx:Script>
  <![CDATA[
   import mx.formatters.DateFormatter;

   [Bindable] private var names:String = "";
   private var formatter:DateFormatter = new DateFormatter();

   private function listMonths(year:Number):void {
    // get just the month name:
    formatter.formatString = "MMMM";
    // create dates and get formatted values:
    var values:Array = [];
    for ( var i:Number=0; i<12; i++ ) {
     values.push( formatter.format( new Date(year, i, 1) ) );
    }
    names = values.join(String.fromCharCode(13));
   }

  ]]&gt;
 </mx:Script>

 <mx:HBox>
  <mx:Button label="1969" click="listMonths(1969);" />
  <mx:Button label="1970" click="listMonths(1970);" />
  <mx:Button label="1971" click="listMonths(1971);" />
 </mx:HBox>

 <mx:TextArea width="300" height="200" text="{names}" />

</mx:Application>
[/sourcecode]</pre>
<p>It appears that the bug was logged quite a few times, just one of the tickets I&#8217;ve found: <a href="https://bugs.adobe.com/jira/browse/SDK-14528">https://bugs.adobe.com/jira/browse/SDK-14528</a>. It&nbsp;also appears that it won&#8217;t be fixed. According to the comments under the linked story <em>DateFormatter</em> class is not an Adobe code. Interesting&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/06/18/flex-dateformatter-bug-missing-january-1970-month-name/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flex DataGridColumn width set to the longest value of that column</title>
		<link>http://gruchalski.com/2009/06/16/flex-datagridcolumn-width-set-to-the-longest-value-in-that-column/</link>
		<comments>http://gruchalski.com/2009/06/16/flex-datagridcolumn-width-set-to-the-longest-value-in-that-column/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 23:17:23 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>
		<category><![CDATA[stackoverflow]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=312</guid>
		<description><![CDATA[There was an interesting question on stackoverflow.com today. Some unnamed user asked: Can we change the width of the datagrid column dynamically by clicking on the border of the column in order to display the complete string which is too long to be displayed and needs to be scrolled ? If so, How ?Also, how [...]]]></description>
			<content:encoded><![CDATA[<p>There was an interesting question on <em>stackoverflow.com</em> today. Some unnamed user asked:</p>
<blockquote><p>Can we change the width of the datagrid column dynamically by clicking on the border of the column in order to display the complete string which is too long to be displayed and needs to be scrolled ? If so, How ?<br/><br/>Also, how can we ensure that the column width changes dynamically based on the number of characters / length of string; since many a times the data is too long to be displayed. Can we set the column width to take the length of data into consideration before displaying onto the datagrid ?</p></blockquote>
<p>It looked like a cool practice so I thought I would give it a go. This is what I came up, it doesn&#8217;t resize columns on double click but rather automatically when data provider is set/updated.</p>
<pre>[sourcecode lang="as3"]
 <?xml version="1.0" encoding="utf-8"?>
 <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
  creationComplete="onComplete();">

  <mx:Script>
   <![CDATA[
    // imports:
    import mx.events.FlexEvent;
    import mx.core.UIComponent;
    import mx.controls.dataGridClasses.DataGridColumn;
    import mx.controls.Text;
    import mx.utils.ObjectUtil;
    import mx.controls.Label;
    import mx.collections.ArrayCollection;
    // data provider:
    [Bindable] private var dp:ArrayCollection = new ArrayCollection();

    private function onComplete():void {
     // populate data provider here
     // to avoid calcMaxLengths execution when the app is created:
     dp = new ArrayCollection(
      [
       { col1: "Short", col2: "Other column 1" },
       { col1: "Some long string", col2: "Other column 2" },
       { col1: "Short", col2: "Other column 3" },
       { col1: "Short", col2: "Other column 4" },
       { col1: "The longest value in this column", col2: "Other column 5" },
       { col1: "Short", col2: "Other column 6" },
       { col1: "Short", col2: "Other column 7" }
      ]
     );
    }

    // this is going to be executed whenever the data provider changes:
    [Bindable("dataChange")]
    private function calcMaxLengths(input:ArrayCollection):ArrayCollection {
     // if there are items in the DP:
     if ( input.length > 0 ) {
      // and no SPECIAL child exists:
      if ( getChildByName("$someTempUICToRemoveAfterFinished") == null ) {
       // create new SPECIAL child
       // this is required to call measureText
       // if you use custom data grid item renderer
       // then create instance of it instead of UIComponent:
       var uic:UIComponent = new UIComponent();
       // do not show and do not mess with the sizes:
       uic.includeInLayout = false;
       uic.visible = false;
       // name it to leverage get getChildByName method:
       uic.name = "$someTempUICToRemoveAfterFinished";
       // add event listener:
       uic.addEventListener(FlexEvent.CREATION_COMPLETE, onTempUICCreated);
       // add to parent:
       addChild(uic);
      }
     }
     // return an input:
     return input;
    }

    // called when SPECIAL child is created:
    private function onTempUICCreated(event:FlexEvent):void {
     // keep the ref to the SPECIAL child:
     var renderer:UIComponent = UIComponent(event.target);
     // output - this will contain max size for each column:
     var maxLengths:Object = {};
     // temp variables:
     var key:String = "";
     var i:int=0;
     // for each item in the DP:
     for ( i=0; i<dp.length; i++ ) {
      var o:Object = dp.getItemAt(i);
      // for each key in the DP row:
      for ( key in o ) {
       // if the output doesn't have current key yet create it and set to 0:
       if ( !maxLengths.hasOwnProperty(key) ) {
        maxLengths[key] = 0;
       }
       // check if it's simple object (may cause unexpected issues for Boolean):
       if ( ObjectUtil.isSimple(o[key]) ) {
        // measure the text:
        var cellMetrics:TextLineMetrics = renderer.measureText(o[key]+"");
        // and if the width is greater than longest found up to now:
        if ( cellMetrics.width > maxLengths[key] ) {
         // set it as the longest one:
         maxLengths[key] = cellMetrics.width;
        }
       }
      }
     }

     // apply column sizes:
     for ( key in maxLengths ) {
      for ( i=0; i<dg.columnCount; i++ ) {
       // if the column actually exists:
       if ( DataGridColumn(dg.columns[i]).dataField == key ) {
        // set size + some constant margin
        DataGridColumn(dg.columns[i]).width = Number(maxLengths[key]) + 12;
       }
      }
     }
     // cleanup:
     removeChild(getChildByName("$someTempUICToRemoveAfterFinished"));
    }

   ]]&gt;
  </mx:Script>

  <mx:DataGrid id="dg" horizontalScrollPolicy="on" dataProvider="{calcMaxLengths(dp)}" width="400">
   <mx:columns>
    <mx:DataGridColumn dataField="col1" width="40" />
    <mx:DataGridColumn dataField="col2" width="100" />
   </mx:columns>
  </mx:DataGrid>

 </mx:WindowedApplication>
[/sourcecode]</pre>
<p>Sample:</p>
<p>[SWF]/wp-content/uploads/2009/06/TextTest.swf, 450, 240[/SWF]</p>
<p>This code works just fine however it may be not efficient enough when applied to large data providers.</p>
<p>Source code is also available on <a href="http://stackoverflow.com/questions/1002518/dynamically-change-the-width-of-datagrid-column-in-flex/1004305#1004305">stackoverflow.com</a> under the original entry.</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/06/16/flex-datagridcolumn-width-set-to-the-longest-value-in-that-column/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
