<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.1-alpha" -->
<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/"
>

<channel>
	<title>Symmetri Developer Blog</title>
	<link>http://symmetri.blogsome.com</link>
	<description>Solving the daily problems of software development</description>
	<pubDate>Fri, 20 Nov 2009 01:17:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.1-alpha</generator>
	<language>en</language>

		<item>
		<title>Flex String.replace() function only replaces the first match</title>
		<link>http://symmetri.blogsome.com/2009/11/20/flex-stringreplace-function-only-replaces-the-first-match/</link>
		<comments>http://symmetri.blogsome.com/2009/11/20/flex-stringreplace-function-only-replaces-the-first-match/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 01:16:49 +0000</pubDate>
		<dc:creator>Shourov Bhattacharya</dc:creator>
		
	<category>General</category>
	<category>Flash/Flex</category>
		<guid>http://symmetri.blogsome.com/2009/11/20/flex-stringreplace-function-only-replaces-the-first-match/</guid>
		<description><![CDATA[	That&#8217;s right - a function that has an equivalent in several other programming languages works differently in Actionscript. The String.replace function in Flex replaces only the first match by default. To get it to replace all matches, you can either add a regular expression as the first argument for the replace; or you can use [...]]]></description>
			<content:encoded><![CDATA[	<p>That&#8217;s right - a function that has an equivalent in several other programming languages works differently in Actionscript. The <code>String.replace</code> function in Flex <a href="http://livedocs.adobe.com/flex/3/langref/String.html#replace()">replaces only the first match by default</a>. To get it to replace all matches, you can either add a regular expression as the first argument for the replace; or you can use the following:</p>
	<p><code>string = string.split("a").join("b");</code></p>
	<p>I prefer this to using a regular expression. To do something that is intuitively simple, it is not reasonable that the programmer has to introduce the complexity of a regular expression in this case. This implementation of the replace() function in Actionscript 3 is bad because it is not intuitive. The word &#8220;replace&#8221; in English has the meaning of substituting one thing for another; but it does not include the concept of <em>only doing that substitution in a partial way</em>. So, by having a default implementation that is only partial and not global, the <code>replace()</code> function fails to do what its name implies. Additionally, as a Flex programmer familiar with replace functions in other languages, I may not even aware of the fact that I am not doing a global replace unless I consult the documentation. So the designers of the language have facilitated the introduction of bugs by <i>silently breaking a convention</i>. </p>
]]></content:encoded>
			<wfw:commentRss>http://symmetri.blogsome.com/2009/11/20/flex-stringreplace-function-only-replaces-the-first-match/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Canvas with background color style does not show graphics?</title>
		<link>http://symmetri.blogsome.com/2009/11/09/canvas-with-background-color-style-does-not-show-graphics/</link>
		<comments>http://symmetri.blogsome.com/2009/11/09/canvas-with-background-color-style-does-not-show-graphics/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 01:29:36 +0000</pubDate>
		<dc:creator>Shourov Bhattacharya</dc:creator>
		
	<category>Flash/Flex</category>
		<guid>http://symmetri.blogsome.com/2009/11/09/canvas-with-background-color-style-does-not-show-graphics/</guid>
		<description><![CDATA[	This is one of those things I couldn&#8217;t believe when I first came across it; now I have to live with it. It seems that if you set the background-color style for a Canvas component, the graphics that you draw on top of the canvas cannot be seen. The &#8220;background&#8221; covers the graphics. Seems crazy [...]]]></description>
			<content:encoded><![CDATA[	<p>This is one of those things I couldn&#8217;t believe when I first came across it; now I have to live with it. It seems that if you set the <code>background-color</code> style for a <code>Canvas</code> component, the graphics that you draw on top of the canvas cannot be seen. The &#8220;background&#8221; covers the graphics. Seems crazy but that&#8217;s what happens. The following code will draw a black line from (0,0) to (100,100) but you won&#8217;t be able to see it because it will be obscured by the background.</p>
	<pre style='color:#000000;background:#ffffff;'><span style='color:#696969; '>//displayView is a Canvas that has been added to the display list</span>
displayView<span style='color:#808030; '>.</span>setStyle<span style='color:#808030; '>(</span><span style='color:#800000; '>&#8220;</span><span style='color:#0000e6; '>backgroundColor</span><span style='color:#800000; '>&#8220;</span><span style='color:#808030; '>,</span> <span style='color:#800000; '>&#8220;</span><span style='color:#0000e6; '>#FFFFFF</span><span style='color:#800000; '>&#8220;</span><span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
	
<span style='color:#696969; '>// here we draw a black line on the Canvas</span>
<span style='color:#696969; '>// but it won&#8217;t appear :(</span>
displayView<span style='color:#808030; '>.</span>graphics<span style='color:#808030; '>.</span>setLineStyle<span style='color:#808030; '>(</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>,</span> <span style='color:#008000; '>0x000000</span><span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
displayView<span style='color:#808030; '>.</span>graphics<span style='color:#808030; '>.</span><span style='color:#800000; font-weight:bold; '>moveTo</span><span style='color:#808030; '>(</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>,</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
displayView<span style='color:#808030; '>.</span>graphics<span style='color:#808030; '>.</span><span style='color:#800000; font-weight:bold; '>lineTo</span><span style='color:#808030; '>(</span><span style='color:#008c00; '>100</span><span style='color:#808030; '>,</span><span style='color:#008c00; '>100</span><span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
</pre>
	<p>To see your drawing, you need to turn off the background style. As the Americans would say: go figure.
</p>
]]></content:encoded>
			<wfw:commentRss>http://symmetri.blogsome.com/2009/11/09/canvas-with-background-color-style-does-not-show-graphics/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Using a Flash symbol from an SWF as the background for a UIComponent using styles</title>
		<link>http://symmetri.blogsome.com/2009/11/04/using-a-swf-as-the-background-for-a-uicomponent-using-styles/</link>
		<comments>http://symmetri.blogsome.com/2009/11/04/using-a-swf-as-the-background-for-a-uicomponent-using-styles/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 23:12:04 +0000</pubDate>
		<dc:creator>Shourov Bhattacharya</dc:creator>
		
	<category>Flash/Flex</category>
		<guid>http://symmetri.blogsome.com/2009/11/04/using-a-swf-as-the-background-for-a-uicomponent-using-styles/</guid>
		<description><![CDATA[	You can use a Flash movie clip from within an SWF as the background for a component in Flex. First, you must create the symbol in Flash and then be sure to create a linkage for the symbol (Export for Actionscript etc.) and give it a unique name; then publish the Flash movie as a [...]]]></description>
			<content:encoded><![CDATA[	<p>You can use a Flash movie clip from within an SWF as the background for a component in Flex. First, you must create the symbol in Flash and then be sure to create a linkage for the symbol (Export for Actionscript etc.) and give it a unique name; then publish the Flash movie as a SWF. Within Flex, the background can be set up as part of a style in the CSS stylesheet - but the part that had me stumped was that instead of using <code>background-skin</code>, you must use <code>background-image</code>. That is, the following code is correct and will work:</p>
	<pre style='color:#000000;background:#ffffff;'><span style='color:#808030; '>.</span>bubble
<span style='color:#800080; '>{</span>
    <span style='color:#bb7977; font-weight:bold; '>background-image</span><span style='color:#808030; '>:</span> <span style='color:#074726; '>Embed</span>(source=<span style='color:#800000; '>&#8220;</span><span style='color:#0000e6; '>../swf/bubble_skins.swf</span><span style='color:#800000; '>&#8220;</span><span style='color:#808030; '>,</span> symbol=<span style='color:#800000; '>&#8220;</span><span style='color:#0000e6; '>bubble</span><span style='color:#800000; '>&#8220;</span>)<span style='color:#800080; '>;</span>
    background-alpha<span style='color:#808030; '>:</span> <span style='color:#008c00; '>1.0</span><span style='color:#800080; '>;</span>
    background-size<span style='color:#808030; '>:</span> <span style='color:#800000; '>&#8220;</span><span style='color:#0000e6; '>100%</span><span style='color:#800000; '>&#8220;</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
</pre>
	<p>The following code will NOT work:</p>
	<pre style='color:#000000;background:#ffffff;'><span style='color:#808030; '>.</span>bubble
<span style='color:#800080; '>{</span>
    <span style='color:#bb7977; font-weight:bold; '>background-skin</span><span style='color:#808030; '>:</span> <span style='color:#074726; '>Embed</span>(source=<span style='color:#800000; '>&#8220;</span><span style='color:#0000e6; '>../swf/bubble_skins.swf</span><span style='color:#800000; '>&#8220;</span><span style='color:#808030; '>,</span> symbol=<span style='color:#800000; '>&#8220;</span><span style='color:#0000e6; '>bubble</span><span style='color:#800000; '>&#8220;</span>)<span style='color:#800080; '>;</span>
    background-alpha<span style='color:#808030; '>:</span> <span style='color:#008c00; '>1.0</span><span style='color:#800080; '>;</span>
    background-size<span style='color:#808030; '>:</span> <span style='color:#800000; '>&#8220;</span><span style='color:#0000e6; '>100%</span><span style='color:#800000; '>&#8220;</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://symmetri.blogsome.com/2009/11/04/using-a-swf-as-the-background-for-a-uicomponent-using-styles/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Dividing the perimeter of an ellipse into equal segments</title>
		<link>http://symmetri.blogsome.com/2009/11/04/dividing-the-perimeter-of-an-ellipse-into-equal-segments/</link>
		<comments>http://symmetri.blogsome.com/2009/11/04/dividing-the-perimeter-of-an-ellipse-into-equal-segments/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 23:02:02 +0000</pubDate>
		<dc:creator>Shourov Bhattacharya</dc:creator>
		
	<category>Flash/Flex</category>
	<category>Algorithms</category>
		<guid>http://symmetri.blogsome.com/2009/11/04/dividing-the-perimeter-of-an-ellipse-into-equal-segments/</guid>
		<description><![CDATA[	Suppose we want to lay out N number of objects on the perimeter of a circle, equally spaced. Finding the position of each object is trivial; we simply divide the total angle 2*PI by N and then draw out a point at the constant radius at that angle. However, doing the same thing on an [...]]]></description>
			<content:encoded><![CDATA[	<p>Suppose we want to lay out N number of objects on the perimeter of a circle, equally spaced. Finding the position of each object is trivial; we simply divide the total angle 2*PI by N and then draw out a point at the constant radius at that angle. However, doing the same thing on an ellipse is surprisingly tricky. Using the same algorithm as the circle in <a href="http://en.wikipedia.org/wiki/Ellipse#Polar_form_relative_to_center">polar form</a> does not yield the right results; the points end up &#8220;bunching up&#8221; on the minor axis. To find the correct algorithm, we need to think <i>parametrically</i> - we <a href="http://en.wikipedia.org/wiki/Ellipse#Parametric_form_in_canonical_position">parametrize</a> the elliptical curve by a variable <i>theta</i> and then plot points at equadistant intervals projected on the linear axis of <i>theta</i>:</p>
	<pre style='color:#000000;background:#ffffff;'><span style='color:#800000; font-weight:bold; '>var</span> theta<span style='color:#808030; '>:</span>Number <span style='color:#808030; '>=</span> <span style='color:#808030; '>(</span>Math<span style='color:#808030; '>.</span>PI<span style='color:#808030; '>*</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>)</span><span style='color:#808030; '>*</span><span style='color:#808030; '>(</span>i<span style='color:#808030; '>/</span>NUMBER_OF_SEGMENTS<span style='color:#808030; '>)</span> <span style='color:#808030; '>-</span> Math<span style='color:#808030; '>.</span>PI<span style='color:#808030; '>/</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>;</span>
<span style='color:#800000; font-weight:bold; '>var</span> a<span style='color:#808030; '>:</span>Number <span style='color:#808030; '>=</span> <span style='color:#008c00; '>100</span><span style='color:#808030; '>;</span>
<span style='color:#800000; font-weight:bold; '>var</span> b<span style='color:#808030; '>:</span>Number <span style='color:#808030; '>=</span> <span style='color:#008c00; '>80</span><span style='color:#808030; '>;</span>
<span style='color:#800000; font-weight:bold; '>var</span> x<span style='color:#808030; '>:</span>Number <span style='color:#808030; '>=</span> a<span style='color:#808030; '>*</span> Math<span style='color:#808030; '>.</span><span style='color:#800000; font-weight:bold; '>sin</span><span style='color:#808030; '>(</span>theta<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
<span style='color:#800000; font-weight:bold; '>var</span> y<span style='color:#808030; '>:</span>Number <span style='color:#808030; '>=</span> b<span style='color:#808030; '>*</span>Math<span style='color:#808030; '>.</span><span style='color:#800000; font-weight:bold; '>cos</span><span style='color:#808030; '>(</span>theta<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
<span style='color:#800000; font-weight:bold; '>var</span> point<span style='color:#808030; '>:</span>Point <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>new</span> Point<span style='color:#808030; '>(</span>x<span style='color:#808030; '>,</span> y<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://symmetri.blogsome.com/2009/11/04/dividing-the-perimeter-of-an-ellipse-into-equal-segments/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Duplicate event listeners in Flex?</title>
		<link>http://symmetri.blogsome.com/2009/10/13/duplicate-event-listeners-in-flex/</link>
		<comments>http://symmetri.blogsome.com/2009/10/13/duplicate-event-listeners-in-flex/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 00:05:49 +0000</pubDate>
		<dc:creator>Shourov Bhattacharya</dc:creator>
		
	<category>General</category>
	<category>Flash/Flex</category>
		<guid>http://symmetri.blogsome.com/2009/10/13/duplicate-event-listeners-in-flex/</guid>
		<description><![CDATA[	Does adding the same event listener multiple times to a Flex object cause multiple, duplicate postbacks? I didn&#8217;t know for sure, but I just tried it and the answer is (thankfully) no. Let the good times carry on, then.

]]></description>
			<content:encoded><![CDATA[	<p>Does adding the same event listener multiple times to a Flex object cause multiple, duplicate postbacks? I didn&#8217;t know for sure, but I just tried it and the answer is (thankfully) no. Let the good times carry on, then.
</p>
]]></content:encoded>
			<wfw:commentRss>http://symmetri.blogsome.com/2009/10/13/duplicate-event-listeners-in-flex/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Banking site that uses Flex</title>
		<link>http://symmetri.blogsome.com/2009/10/08/banking-site-that-uses-flex/</link>
		<comments>http://symmetri.blogsome.com/2009/10/08/banking-site-that-uses-flex/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 03:50:33 +0000</pubDate>
		<dc:creator>Shourov Bhattacharya</dc:creator>
		
	<category>General</category>
		<guid>http://symmetri.blogsome.com/2009/10/08/banking-site-that-uses-flex/</guid>
		<description><![CDATA[	We just joined UBank and I noticed that their secure online banking site uses Flex within the HTML page as the most important and functional part of the interface. You can&#8217;t see what I mean unless you are a customer and have a valid login &#8230; and I realize this is hardly exciting to anyone [...]]]></description>
			<content:encoded><![CDATA[	<p>We just joined <a href="http://www.ubank.com.au">UBank</a> and I noticed that their secure online banking site uses Flex within the HTML page as the most important and functional part of the interface. You can&#8217;t see what I mean unless you are a customer and have a valid login &#8230; and I realize this is hardly exciting to anyone else but me. But having created a series of real-world Flex applications over the last year I was happy to see that the most&#8221;serious&#8221; type of online applications are now starting to move in the direction of becoming RIAs.
</p>
]]></content:encoded>
			<wfw:commentRss>http://symmetri.blogsome.com/2009/10/08/banking-site-that-uses-flex/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Adding same child to Container twice gives error &#8220;Error #2006: The supplied index is out of bounds.&#8221;</title>
		<link>http://symmetri.blogsome.com/2009/10/05/adding-same-child-to-container-twice-gives-error-error-2006-the-supplied-index-is-out-of-bounds/</link>
		<comments>http://symmetri.blogsome.com/2009/10/05/adding-same-child-to-container-twice-gives-error-error-2006-the-supplied-index-is-out-of-bounds/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 11:03:04 +0000</pubDate>
		<dc:creator>Shourov Bhattacharya</dc:creator>
		
	<category>Flash/Flex</category>
		<guid>http://symmetri.blogsome.com/2009/10/05/adding-same-child-to-container-twice-gives-error-error-2006-the-supplied-index-is-out-of-bounds/</guid>
		<description><![CDATA[	I thought I would document this as I think the error message is rather unhelpful and even misleading. In Flex, say you add the same child DisplayObject to a Container:
	// container is of type Container
// child is of type DisplayObject
container.addChild(child);
container.addChild(child);

	you get the error message &#8220;Error #2006: The supplied index is out of bounds.&#8221; That&#8217;s not [...]]]></description>
			<content:encoded><![CDATA[	<p>I thought I would document this as I think the error message is rather unhelpful and even misleading. In Flex, say you add the same child <code>DisplayObject</code> to a <a href="http://w1000.mv.us.adobe.com/livedocs/flex/2/langref/mx/core/Container.html"><code>Container</code></a>:</p>
	<pre style='color:#000000;background:#ffffff;'><span style='color:#696969; '>// container is of type Container</span>
<span style='color:#696969; '>// child is of type DisplayObject</span>
container<span style='color:#808030; '>.</span>addChild<span style='color:#808030; '>(</span>child<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
container<span style='color:#808030; '>.</span>addChild<span style='color:#808030; '>(</span>child<span style='color:#808030; '>)</span><span style='color:#808030; '>;</span>
</pre>
	<p>you get the error message &#8220;Error #2006: The supplied index is out of bounds.&#8221; That&#8217;s not a particularly helpful message, because it&#8217;s a very general error that is generated inside the <code>Container.addChildAt() </code> method; even though you are not explicitly defining a child index, the error is related to indexing of the array that holds children of the container. You would get the same error if you tried to use <code>container.addChildAt()</code> and specified an invalid index. </p>
	<p>A better error message for this case would be something like &#8220;Duplicate child object not allowed in single instance of Container&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://symmetri.blogsome.com/2009/10/05/adding-same-child-to-container-twice-gives-error-error-2006-the-supplied-index-is-out-of-bounds/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Flex CSS property font-family is case-sensitive!</title>
		<link>http://symmetri.blogsome.com/2009/10/01/flex-css-property-font-family-is-case-sensitive-2/</link>
		<comments>http://symmetri.blogsome.com/2009/10/01/flex-css-property-font-family-is-case-sensitive-2/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 23:49:54 +0000</pubDate>
		<dc:creator>Shourov Bhattacharya</dc:creator>
		
	<category>General</category>
	<category>Flash/Flex</category>
		<guid>http://symmetri.blogsome.com/2009/10/01/flex-css-property-font-family-is-case-sensitive-2/</guid>
		<description><![CDATA[	This is just a little thing, but I have noticed that it isn&#8217;t widely understood. When using CSS in Flex to style components, the font-family property can be case sensitive on some operating systems. For example, the following CSS will not work on my Safari browser with Flash Player 10:
	.content{font-family: arial;}

	but this will work:
	.content{font-family: Arial;}

]]></description>
			<content:encoded><![CDATA[	<p>This is just a little thing, but I have noticed that it isn&#8217;t widely understood. When using CSS in Flex to style components, the <code>font-family</code> property can be case sensitive on some operating systems. For example, the following CSS will not work on my Safari browser with Flash Player 10:</p>
	<pre style='color:#000000;background:#ffffff;'><span style='color:#808030; '>.</span>content<span style='color:#800080; '>{</span><span style='color:#bb7977; font-weight:bold; '>font-family</span><span style='color:#808030; '>:</span> arial<span style='color:#800080; '>;</span><span style='color:#800080; '>}</span>
</pre>
	<p>but this <em>will</em> work:</p>
	<pre style='color:#000000;background:#ffffff;'><span style='color:#808030; '>.</span>content<span style='color:#800080; '>{</span><span style='color:#bb7977; font-weight:bold; '>font-family</span><span style='color:#808030; '>:</span> Arial<span style='color:#800080; '>;</span><span style='color:#800080; '>}</span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://symmetri.blogsome.com/2009/10/01/flex-css-property-font-family-is-case-sensitive-2/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Flex Layout with draggable, resizable components</title>
		<link>http://symmetri.blogsome.com/2009/10/01/flex-layout-with-draggable-resizable-components/</link>
		<comments>http://symmetri.blogsome.com/2009/10/01/flex-layout-with-draggable-resizable-components/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 23:20:50 +0000</pubDate>
		<dc:creator>Shourov Bhattacharya</dc:creator>
		
	<category>Flash/Flex</category>
		<guid>http://symmetri.blogsome.com/2009/10/01/flex-layout-with-draggable-resizable-components/</guid>
		<description><![CDATA[	I have been looking for a way to layout elements (child components) within a Flex container that is flexible, resizable, draggable and visually impressive. The main requirements are that a) the individual child elements can be reordered with drag-and-drop, b) elements can be maximized/minimized, c) elements can expand to fill the available space and d) [...]]]></description>
			<content:encoded><![CDATA[	<p>I have been looking for a way to layout elements (child components) within a Flex container that is flexible, resizable, draggable and visually impressive. The main requirements are that a) the individual child elements can be reordered with drag-and-drop, b) elements can be maximized/minimized, c) elements can expand to fill the available space and d) elements can be given a default width and height. </p>
	<p>Unfortunately, none of the native Flex components have layout algorithms that are suitable. They mostly implement absolute positioning or a simple vertical or horizontal &#8220;flow&#8221; layout which can fit elements into the parent container, but without any resizing.</p>
	<p>Recently I have found a really nice implementation of layout within Flex called the <a href="http://www.adobe.com/devnet/flex/samples/dashboard/dashboard.html">Adobe Flex 3 Dashboard sample</a>. It implements a &#8220;pod layout&#8221; which handles all my requirements EXCEPT for the fact that the individual elements (&#8221;pods&#8221;) cannot be given an initial/default width and height - they simply scale to each take up an equal amount of space within the parent container. The drag and drop functionality also has some nice animated effects. </p>
]]></content:encoded>
			<wfw:commentRss>http://symmetri.blogsome.com/2009/10/01/flex-layout-with-draggable-resizable-components/feed/</wfw:commentRss>
	</item>
		<item>
		<title>SQL Server 2005 import from Excel can lose your data!</title>
		<link>http://symmetri.blogsome.com/2009/09/22/sql-server-2005-dts-import-from-excel-can-lose-your-data-2/</link>
		<comments>http://symmetri.blogsome.com/2009/09/22/sql-server-2005-dts-import-from-excel-can-lose-your-data-2/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 02:09:26 +0000</pubDate>
		<dc:creator>Shourov Bhattacharya</dc:creator>
		
	<category>General</category>
	<category>SQL Server</category>
		<guid>http://symmetri.blogsome.com/2009/09/22/sql-server-2005-dts-import-from-excel-can-lose-your-data-2/</guid>
		<description><![CDATA[	I&#8217;ve been using SQL Server 2005 SSIS Import Wizard (the replacement for SQL Server 2000 Data Transformation Services (DTS)) lately to import data from Excel files, and I&#8217;ve come across a serious bug that should be documented. It appears that when importing data from a spreadsheet that is sparsely populated - having a lot of [...]]]></description>
			<content:encoded><![CDATA[	<p>I&#8217;ve been using <a href="http://www.google.com/search?hl=en&#038;client=safari&#038;rls=en-us&#038;q=SQL+Server+2005+SSIS+import&#038;aq=f&#038;oq=&#038;aqi=">SQL Server 2005 SSIS Import Wizard</a> (the replacement for <a href="http://msdn.microsoft.com/en-us/library/cc917688.aspx">SQL Server 2000 Data Transformation Services (DTS)</a>) lately to import data from Excel files, and I&#8217;ve come across a serious bug that should be documented. It appears that when importing data from a spreadsheet that is sparsely populated - having a lot of empty cells - the import process can fail to import some of your data. Specifically, if you have a column in your Excel spreadsheet that does not contain any data for the first 1000 rows (or even a few hundred - I have not been able to work out the exact threshold), then you may find that <i>data in subsequent rows for that column is imported as NULL</i>. </p>
	<p>What is worse is that no error messages or warnings are shown, so you have no idea that anything has gone wrong. The only way to detect the problem is to manually compare the imported data row by row with the import data source spreadsheet.</p>
	<p>This problem persists no matter what data type you might choose for the destination column.</p>
	<p>Searching around in the forums for this issue, I have come across some talk of <a href="http://www.windows-tech.info/15/ec34092ce982af40.php">changing the connection string used to the OLEDB connection to include &#8220;IMEX=1&#8243;</a>. That works fine if you are building a SSIS Integration Services package in the full version of SQL Server 2005. But there is no way to do anything like that in the SSIS Import Wizard - no access to connection strings and no way to choosing different providers for importing Excel files.</p>
	<p>So I have found my own workaround which is quite simple. What I do now before importing any Excel sheet is to check the first few rows. If there are columns that have empty values in the first few rows, I check further down the sheet. If the same column has data further down, I know that I am in danger of losing it during the import. So I <i>create a dummy first row of data that has all columns filled out with representative data</i>. For example, if a column contains integers, I might put a 1 in the dummy row; if it is string data, just a few characters. This seems to make the import process less cavalier about ignoring data, and I find that all columns now import correctly for all rows. </p>
	<p>After the import, I run a query to delete the dummy row of data.</p>
	<p>The workaround is fairly simple, but I must say this is a horrendous bug. Not only is it a high impact bug but the user has no feedback that anything has gone wrong. This is on top of the problems I have had with arcane error messages when an import fails because of bad data; and problems with row delimiters when importing CSV files. I have lost confidence in the SQL Server SSIS import now. The old SQL Server 2000 DTS seemed much more stable and reliable. SQL Server 2005 has been generally good to use, but not having a reliable way to import data is a severe handicap and makes me less likely to continue using it. </p>
	<p>By the way, you can find an excellent tutorial on how to use the new SSIS Import/Export Wizard in SQL Server 2005 <a href="http://www.databasejournal.com/features/mssql/article.php/3580216/SQL-Server-2005-Import--Export-Wizard.htm">here</a>.
</p>
]]></content:encoded>
			<wfw:commentRss>http://symmetri.blogsome.com/2009/09/22/sql-server-2005-dts-import-from-excel-can-lose-your-data-2/feed/</wfw:commentRss>
	</item>
	</channel>
</rss>
