
<?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>From inspiration to realization</title>
	<atom:link href="http://www.kensodev.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kensodev.com</link>
	<description>Professional web/RIA development blog</description>
	<lastBuildDate>Wed, 28 Jul 2010 20:03:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>gitignore template for flex projects</title>
		<link>http://www.kensodev.com/2010/07/28/gitignore-template-for-flex-projects/</link>
		<comments>http://www.kensodev.com/2010/07/28/gitignore-template-for-flex-projects/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 20:03:38 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[Trick]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=532</guid>
		<description><![CDATA[Hi All, Well, me being an enthusiastic flex developer is no secret, nor me being a GIT fan-boy. I thought it will be helpful to post my template for the gitignore files in all repositories containing flex projects this is how it looks like .DS_Store .actionScriptProperties .flexProperties .project .settings/* bin-debug/* The reason I'm ignoring all [...]]]></description>
			<content:encoded><![CDATA[<p>Hi All,</p>
<p>Well, me being an enthusiastic flex developer is no secret, nor me being a GIT fan-boy.</p>
<p>I thought it will be helpful to post my template for the gitignore files in all repositories containing flex projects</p>
<p>this is how it looks like</p>
<pre class="brush: bash;">
.DS_Store
.actionScriptProperties
.flexProperties
.project
.settings/*
bin-debug/*
</pre>
<p>The reason I'm ignoring all the settings files and the properties files is because all of these are environment specific, often not all developers on the team use the same settings and properties and that can break the entire working process.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/07/28/gitignore-template-for-flex-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery colorbox plugin no opacity (overlay) &#8211; IE7</title>
		<link>http://www.kensodev.com/2010/07/26/jquery-colorbox-plugin-no-opacity-overlay-ie7/</link>
		<comments>http://www.kensodev.com/2010/07/26/jquery-colorbox-plugin-no-opacity-overlay-ie7/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 21:59:58 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=530</guid>
		<description><![CDATA[today, while checking a website I did heavy client side work on, converting PSD's to html, CSS and JavaScript I checked everything on IE7, one of the most annoying things I encountered was that the colorbox overlay color was pitch black. On other browsers, everything seemed fine and the overlay was in the correct opacity. [...]]]></description>
			<content:encoded><![CDATA[<p>today, while checking a website I did heavy client side work on, converting PSD's to html, CSS and JavaScript I checked everything on IE7, one of the most annoying things I encountered was that the colorbox overlay color was pitch black.</p>
<p>On other browsers, everything seemed fine and the overlay was in the correct opacity.</p>
<p>This bug is very easy to fix.</p>
<p>this was my code before:</p>
<pre class="brush: jscript;">
	$('.guestboox_more').colorbox({
		inline:true,
		href:'.guestbook_more_details',
		innerWidth:'610px',
		opacity: '.2',
		transition: 'elastic'
	});
</pre>
<p>And this is the code after (this fixed the problem)</p>
<pre class="brush: jscript;">
	$('.guestboox_more').colorbox({
		inline:true,
		href:'.guestbook_more_details',
		innerWidth:'610px',
		opacity: '0.2',
		transition: 'elastic'
	});
</pre>
<p>The problem was only that IE7 didn't recognizance .2 as 0.2 and needed to be more specific (as often IE needs).<br />
I hope this will save you some time.</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/07/26/jquery-colorbox-plugin-no-opacity-overlay-ie7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>flash media server security hardening</title>
		<link>http://www.kensodev.com/2010/07/25/flash-media-server-security-hardening/</link>
		<comments>http://www.kensodev.com/2010/07/25/flash-media-server-security-hardening/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 12:51:43 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[Flash media server]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Consulting]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash player]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=524</guid>
		<description><![CDATA[today, while browsing my feed in google reader, I found something very interesting. this link is a hardening guide for flash media server. for quite some time now I have been developing and consulting on flash media server advanced topics, I have been teaching students and consulting companies on issues regarding this great peace of [...]]]></description>
			<content:encoded><![CDATA[<p>today, while browsing my feed in google reader, I found something very interesting.<br />
this <a href="http://www.adobe.com/devnet/flashmediaserver/articles/hardening_guide.html">link</a> is a hardening guide for flash media server.</p>
<p>for quite some time now I have been developing and consulting on flash media server advanced topics, I have been teaching students and consulting companies on issues regarding this great peace of software.</p>
<p>Adobe seemed vert silent about this product for some time, not publishing any new materials what so ever, so it was very nice to see this link, I read it and it has some good observations and very well written instructions on how to harden your server.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/07/25/flash-media-server-security-hardening/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>set button width to text width in flex</title>
		<link>http://www.kensodev.com/2010/07/14/set-button-width-to-text-width-in-flex/</link>
		<comments>http://www.kensodev.com/2010/07/14/set-button-width-to-text-width-in-flex/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 08:07:18 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[As3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=521</guid>
		<description><![CDATA[Well, I have been working on a very interesting project recently, really stretching flex to the limits I needed to set buttons, linkButtons, Labels and more component's width to the width of the text inside them. Usually, flex does it for you but the width was hardcoded in compile time and I needed to change [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I have been working on a very interesting project recently, really stretching flex to the limits <img src='http://www.kensodev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
I needed to set buttons, linkButtons, Labels and more component's width to the width of the text inside them.<br />
Usually, flex does it for you but the width was hardcoded in compile time and I needed to change the text and the width in runtime and resize the component according to that.</p>
<p>I have written a nifty helper function for that.</p>
<p>here it is:</p>
<pre class="brush: as3;">
/**
* This function will accept the text and the UI component and set the width to the width of the text
* @param text the text or label of the component
* @param container the container casted to a UIComponent
*
*/
public static function measureTextWidthAndResizeComponent(text:String, container:UIComponent):void
{
	var _measuredWidth:Number = 0;
	var  _paddingLeft:uint = 0;
	var _paddingRight:uint = 0;
	var _horizontalGap:uint = 0;
	var _addedToWidth:int;

	if(text == null)
		return;

	if(text.length &lt;= 1)
		return;

	_paddingLeft = container.getStyle(&quot;paddingLeft&quot;);
	_paddingRight = container.getStyle(&quot;paddingRight&quot;);
	_horizontalGap = container.getStyle(&quot;horizontalGap&quot;);

	_addedToWidth = int(_horizontalGap + _paddingLeft + _paddingRight);

	var lineMetrics:TextLineMetrics = container.measureText(text);

	_measuredWidth = (lineMetrics.width + _addedToWidth);
	container.width = _measuredWidth;
}
</pre>
<p>That's it, enjoy!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/07/14/set-button-width-to-text-width-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery, wait for animation to end then do something</title>
		<link>http://www.kensodev.com/2010/07/12/jquery-wait-for-animation-to-end-then-do-something/</link>
		<comments>http://www.kensodev.com/2010/07/12/jquery-wait-for-animation-to-end-then-do-something/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 17:09:51 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=516</guid>
		<description><![CDATA[I have been using jQuery for quite some time now, following a question on one of the many forums and discussions group I visit daily I found that not many know that jQuery has a built in way to "listen" for an animation to end and then continue work. For instance if I am using [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using jQuery for quite some time now, following a question on one of the many forums and discussions group I visit daily I found that not many know that jQuery has a built in way to "listen" for an animation to end and then continue work.</p>
<p>For instance if I am using the slideDown effect, I can create a function that will only execute when the slide is finished.</p>
<p>how?</p>
<p>like this...</p>
<pre class="brush: jscript;">
		$('div.menuOurHotel').slideDown(&quot;slow&quot;, function()
		{
			$(&quot;div.order_form&quot;).hide();
		});
</pre>
<p>This is a very useful way to create a responsive intuitive user interface.</p>
<p>Good luck</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/07/12/jquery-wait-for-animation-to-end-then-do-something/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy object properties to another object &#8211; Flex</title>
		<link>http://www.kensodev.com/2010/06/22/copy-object-properties-to-another-object-flex/</link>
		<comments>http://www.kensodev.com/2010/06/22/copy-object-properties-to-another-object-flex/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 09:23:42 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=504</guid>
		<description><![CDATA[In a project I am working on with Flex and AS3 I needed to copy all of the object's properties and accessors to another object. because I didn't want to hard code the properties for various reasons I needed to write a function that will "crawl" the object properties and accessors and copy then to [...]]]></description>
			<content:encoded><![CDATA[<p>In a project I am working on with Flex and AS3 I needed to copy all of the object's properties and accessors to another object.<br />
because I didn't want to hard code the properties for various reasons I needed to write a function that will "crawl" the object properties and accessors and copy then to the new object.</p>
<p>I created a static function that does exactly that</p>
<pre class="brush: as3;">
		/**
		 * copies a source object to a destination object
		 * @param sourceObject the source object
		 * @param destinationObject the destination object
		 *
		 */
		public static function copyObject(sourceObject:Object, destinationObject:Object):void
		{
			// check if the objects are not null
			if((sourceObject) &amp;&amp; (destinationObject)) {
				try
				{
					//retrive information about the source object via XML
					var sourceInfo:XML = describeType(sourceObject);
					var objectProperty:XML;
					var propertyName:String;

					//Â loop through the properties
					for each(objectProperty in sourceInfo.variable)
					{
						propertyName = objectProperty.@name;
						if(sourceObject[objectProperty.@name] != null)
						{
							if(destinationObject.hasOwnProperty(objectProperty.@name)) {
								destinationObject[objectProperty.@name] = sourceObject[objectProperty.@name];
							}
						}
					}
					//loop through the accessors
					for each(objectProperty in sourceInfo.accessor) {
						if(objectProperty.@access == &quot;readwrite&quot;) {
							propertyName = objectProperty.@name;
							if(sourceObject[objectProperty.@name] != null)
							{
								if(destinationObject.hasOwnProperty(objectProperty.@name)) {
									destinationObject[objectProperty.@name] = sourceObject[objectProperty.@name];
								}
							}
						}
					}
				}
				catch (err:*) {
					;
				}
			}
</pre>
<p>This function will copy everything, you can simply add an "allowedProperties" definition and make the function only copy definitions and properites which exist in your allowed definition.</p>
<p>like so:</p>
<pre class="brush: as3;">
private static var allowedProperties:String = &quot;height,width,visible,styleName,x,y,alpha,visible,source,dataProvider,styleDecleration,text,label,horizontalScrollPolicy,labelField,&quot;;

		public static function copyDisplayObjectData(sourceObject:Object, destinationObject:Object):void
		{
			if((sourceObject) &amp;&amp; (destinationObject)) {
				try
				{
					var sourceInfo:XML = describeType(sourceObject);
					var objectProperty:XML;
					var propertyName:String;
					Â
					for each(objectProperty in sourceInfo.variable)
					{
						propertyName = objectProperty.@name;
						if(allowedProperties.indexOf(propertyName) &gt; -1)
						{
							if(sourceObject[objectProperty.@name] != null)
							{
								if(destinationObject.hasOwnProperty(objectProperty.@name)) {
									destinationObject[objectProperty.@name] = sourceObject[objectProperty.@name];
								}
							}

						}
					}
					Â
					for each(objectProperty in sourceInfo.accessor) {
						if(objectProperty.@access == &quot;readwrite&quot;) {
							propertyName = objectProperty.@name;
							if(allowedProperties.indexOf(propertyName) &gt; -1)
							{
								if(sourceObject[objectProperty.@name] != null)
								{
									if(destinationObject.hasOwnProperty(objectProperty.@name)) {
										destinationObject[objectProperty.@name] = sourceObject[objectProperty.@name];
									}
								}
							}
						}
					}
				}
				catch (err:*) {
					;
				}
			}
		}
</pre>
<p>That's it, tricky but absolutely can be done <img src='http://www.kensodev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/06/22/copy-object-properties-to-another-object-flex/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>YUI Calendar page to the selected date (multi calendar)</title>
		<link>http://www.kensodev.com/2010/06/22/yui-calendar-page-to-the-selected-date-multi-calendar/</link>
		<comments>http://www.kensodev.com/2010/06/22/yui-calendar-page-to-the-selected-date-multi-calendar/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 08:54:01 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=488</guid>
		<description><![CDATA[I have been working with YUI calendar for a couple of weeks now on a project, I found that it is highly customizable although the documentation are not always clear and you have to dig around the internet to find your answers. So, I am here to help. In this new website I have a [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working with YUI calendar for a couple of weeks now on a project, I found that it is highly customizable although the documentation are not always clear and you have to dig around the internet to find your answers.</p>
<p>So, I am here to help.</p>
<p>In this new website I have a multi-calendar where you can page forwards and backwards through the dates, the calendar is also showing and hiding according to a user click (see photo)</p>
<p><a rel="attachment wp-att-497" href="http://www.kensodev.com/wp-content/uploads/2010/06/yui_calenda_popup.png" rel="facebox"><img class="aligncenter size-full wp-image-497" title="YUI Calendar popup" src="http://www.kensodev.com/wp-content/uploads/2010/06/yui_calenda_popup.png" alt="" width="330" height="204" /></a></p>
<p>The problem was (for me) that when the user clicked the calendar button and the calendar showed up it always showed the last paging position.</p>
<p>Let's say I selected a date, or even better a date interval (from Feb 2nd to Feb 10th) and then paged to see other months available dates, closed the calendar and re-opened it, it seemed as if the selection cleared and the paging position kept.</p>
<p>My client's request was "if the client selected a date and paged, always take him back to his selection when the calendar is shown"</p>
<p>Well, this is the way to do it.</p>
<pre class="brush: jscript;">
var dates = cal1.getSelectedDates();

if(dates.length &gt; 0)
{
var l = dates[0];

cal1.cfg.setProperty(&quot;pagedate&quot;, l);
cal1.render();
}
</pre>
<p>What did we do here?<br />
first, we checked if there are s<br />
}elected dates in the calendar, if there are.. we got the lowest date (the first date of the interval), then we set a property on the calendar called "pagedate" with this lowest date and WHALLLA, it works, now, every time you open the calendar it pages to the selected dates section, no matter if you paged forward before hiding the calendar.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/06/22/yui-calendar-page-to-the-selected-date-multi-calendar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Empty dialogs in flex builder 3 + Flash builder 4</title>
		<link>http://www.kensodev.com/2010/06/10/empty-dialogs-in-flex-builder-3-flash-builder-4/</link>
		<comments>http://www.kensodev.com/2010/06/10/empty-dialogs-in-flex-builder-3-flash-builder-4/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 13:58:17 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Consulting]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[Tips and tricks]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=472</guid>
		<description><![CDATA[This week I needed to work with My PC on a flex project, I usually stay away of the PC with flex projects, I'm used to working on the mac with these project but I needed to work on the PC. While trying to configure the project in flex builder 3 (and with 4 as [...]]]></description>
			<content:encoded><![CDATA[<p>This week I needed to work with My PC on a flex project, I usually stay away of the PC with flex projects, I'm used to working on the mac with these project but I needed to work on the PC.</p>
<p>While trying to configure the project in flex builder 3 (and with 4 as well) I stumbled upon a weird bug that made me scratch my head for a while.<br />
The bug was that all of the dialogs appeared empty, no configuration, almost no buttons.</p>
<p>Here's a screenshot of the problem:</p>
<p style="text-align: center;"><a rel="facebox" href="http://www.kensodev.com/wp-content/uploads/2010/06/10-06-2010-11-06-14.png" rel="facebox"><img class="size-medium wp-image-473 aligncenter" title="Flex empty dialog" src="http://www.kensodev.com/wp-content/uploads/2010/06/10-06-2010-11-06-14-300x249.png" alt="" width="300" height="249" /></a></p>
<p>Now, I remembered a teammate I had a while back had the same problem and it appeared to be a WACOM with a windows 7 driver that caused the problem so I started disabling devices one after the other.</p>
<p>The problem was a logitech mouse software I have installed on the pc, once I quited this application everything went back to normal.</p>
<p>Here's the icon on the taskbar. (not hard to trace)</p>
<p><a rel="attachment wp-att-474 facebox" href="http://www.kensodev.com/wp-content/uploads/2010/06/10-06-2010-11-06-43.png" rel="facebox"><img class="aligncenter size-medium wp-image-474" title="Logitech Mouse Icon in taskbar" src="http://www.kensodev.com/wp-content/uploads/2010/06/10-06-2010-11-06-43-300x26.png" alt="" width="300" height="26" /></a></p>
<p>Hope this post helps you and you won't scratch your had for hours like I did.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/06/10/empty-dialogs-in-flex-builder-3-flash-builder-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Git export (like SVN export)</title>
		<link>http://www.kensodev.com/2010/06/09/git-export-like-svn-export/</link>
		<comments>http://www.kensodev.com/2010/06/09/git-export-like-svn-export/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 16:16:15 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[Concept]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Product management]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Tips and tricks]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=467</guid>
		<description><![CDATA[I have been working with git for a while now on my Ruby on Rails projects and client side (css, Html and JS) projects, I haven't moved completely in flex projects and other projects but I do plan to in the near future, mainly becuase of the reason that you can integrate GIT into flash [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working with git for a while now on my Ruby on Rails projects and client side (css, Html and JS) projects, I haven't moved completely in flex projects and other projects but I do plan to in the near future, mainly becuase of the reason that you can integrate GIT into flash builder 4.</p>
<p>But, that is not the point.</p>
<p>This week I was working with a company on a client side project, I had to email them the files every time and the .git folders inside the project were heavy and unnecessary.</p>
<p>If you worked with SVN in the future you probably know the export command, after searching for a bit in git help I found how you can do it in git with ease.</p>
<p>This is the command you should use</p>
<pre class="brush: bash;">
git checkout-index -a -f --prefix=/path/to/your/folder/
</pre>
<p>The ending forward slash is very important, do not forget to use it please.</p>
<p>a screenshot of my shell.</p>
<p><a rel="attachment wp-att-468" href="http://www.kensodev.com/wp-content/uploads/2010/06/Screen-shot-2010-06-09-at-7.13.54-PM.png" rel="facebox"><img class="aligncenter size-medium wp-image-468" title="Git export to folder (shell)" src="http://www.kensodev.com/wp-content/uploads/2010/06/Screen-shot-2010-06-09-at-7.13.54-PM-300x182.png" alt="" width="300" height="182" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/06/09/git-export-like-svn-export/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Access flex application through the SWFLoader component</title>
		<link>http://www.kensodev.com/2010/05/30/access-flex-application-through-the-swfloader-component/</link>
		<comments>http://www.kensodev.com/2010/05/30/access-flex-application-through-the-swfloader-component/#comments</comments>
		<pubDate>Sun, 30 May 2010 16:18:32 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=460</guid>
		<description><![CDATA[Often you load flex applications through another flex application using the SWFLoader component. it's not that common knowledge that you can actually access all of that application exactly the same way you are accessing your own application. What does that mean? It means you can access that application components, get the children and get a [...]]]></description>
			<content:encoded><![CDATA[<p>Often you load flex applications through another flex application using the SWFLoader component.<br />
it's not that common knowledge that you can actually access all of that application exactly the same way you are accessing your own application.</p>
<p><strong>What does that mean?</strong></p>
<p>It means you can access that application components, get the children and get a good knowledge on how this application is build, you can also access it's component and dispatch events.</p>
<p><strong>OK, how?</strong></p>
<p>Let's start doing it. we will create a simple application, put an SWFLoader on stage and create a listener for the complete event.<br />
Lets's also add 2 global variables, one for SystemManager, another for IUIComponent (I will explain later)</p>
<p>This is what the application code should look like:</p>
<pre class="brush: as3;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot; minWidth=&quot;955&quot; minHeight=&quot;600&quot;&gt;
	&lt;mx:Script&gt;
		&lt;![CDATA[
			import mx.core.IUIComponent;
			import mx.managers.SystemManager;

			private var _systemManager:SystemManager;
			private var _innerApplication:IUIComponent;

			protected function loader_completeHandler(event:Event):void
			{
				_systemManager = SystemManager(loader.content);
			}
		]]&gt;
	&lt;/mx:Script&gt;

	&lt;mx:SWFLoader id=&quot;loader&quot; source=&quot;VistaRemix.swf&quot; width=&quot;800&quot; height=&quot;600&quot; autoLoad=&quot;true&quot; complete=&quot;loader_completeHandler(event)&quot;/&gt;
&lt;/mx:Application&gt;
</pre>
<p>As you can probably see, we are assigning a value to _systemManager when the loader (SWFLoader) finished loading, this enables us to work with that application system Manager and access properties.</p>
<p>Continuing...</p>
<p>We will add 2 Event listeners inside that function</p>
<pre class="brush: as3;">
_systemManager.addEventListener(FlexEvent.APPLICATION_COMPLETE, sysManage_ApplicationComplete_Handler);
_systemManager.addEventListener(FlexEvent.UPDATE_COMPLETE, sysManage_UpdateComplete_Handler);
</pre>
<p>Now that we have those in place, let's add the closure functions</p>
<pre class="brush: as3;">
			private function sysManage_UpdateComplete_Handler(event:FlexEvent):void
			{
				_innerApplication = _systemManager.application;
			}

			private function sysManage_ApplicationComplete_Handler(event:FlexEvent):void
			{
				_innerApplication = _systemManager.application;
			}
</pre>
<p>Great, now _innerApplication is actually an application, you can get it's children, get properties, get components, dispatch events and more.</p>
<p>This comes in very handy when you want control over an application and you don't have the source, you can create a clone of that application and create your own GUI for it, it's an amazing feature.</p>
<p>This is a screenshot of debugging mode, check out the debugger watch section, these are all methods you can use on that variable, you can of course use much more...</p>
<p><a rel="attachment wp-att-464" href="http://www.kensodev.com/wp-content/uploads/2010/05/Screen-shot-2010-05-30-at-7.23.21-PM-e1275236766248.png" rel="facebox"><img class="aligncenter size-medium wp-image-464" title="Debug view of the application in Flash builder 4" src="http://www.kensodev.com/wp-content/uploads/2010/05/Screen-shot-2010-05-30-at-7.23.21-PM-e1275236766248-300x179.png" alt="Debug view of the application in Flash builder 4" width="300" height="179" /></a></p>
<p>Good luck!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/05/30/access-flex-application-through-the-swfloader-component/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flash builder 4 &#8211; sharing a project with your team using SVN Screencast</title>
		<link>http://www.kensodev.com/2010/05/24/flash-builder-4-sharing-a-project-with-your-team-using-svn-screencast/</link>
		<comments>http://www.kensodev.com/2010/05/24/flash-builder-4-sharing-a-project-with-your-team-using-svn-screencast/#comments</comments>
		<pubDate>Mon, 24 May 2010 04:38:26 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Product management]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=449</guid>
		<description><![CDATA[In this post I will show you how you can share a project with your team using SVN and flash buider 4. This is my first screencast in English after quite a few in my nativeÂ tongue language so please excuse me is I stutterÂ or swallow some of my words, I promise to keep getting better [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-450" href="http://www.kensodev.com/wp-content/uploads/2010/05/Flash-Builder-4.png" rel="facebox"><img class="alignleft size-thumbnail wp-image-450" title="Flash Builder 4" src="http://www.kensodev.com/wp-content/uploads/2010/05/Flash-Builder-4-150x150.png" alt="" width="150" height="150" /></a></p>
<p>In this post I will show you how you can share a project with your team using SVN and flash buider 4.</p>
<p>This is my first screencast in English after quite a few in my nativeÂ tongue language so please excuse me is I stutterÂ or swallow some of my words, I promise to keep getting better with time.</p>
<p><span id="more-449"></span></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="309" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11974122&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="550" height="309" src="http://vimeo.com/moogaloop.swf?clip_id=11974122&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://vimeo.com/11974122">Flash builder 4 - share project with your team using SVN</a> from <a href="http://vimeo.com/kensodev">Avi Tzurel</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/05/24/flash-builder-4-sharing-a-project-with-your-team-using-svn-screencast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change WebOrb default port from 2037 to what you want</title>
		<link>http://www.kensodev.com/2010/05/09/change-weborb-default-port-from-2037-to-what-you-want/</link>
		<comments>http://www.kensodev.com/2010/05/09/change-weborb-default-port-from-2037-to-what-you-want/#comments</comments>
		<pubDate>Sun, 09 May 2010 15:36:06 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[As3]]></category>
		<category><![CDATA[Consulting]]></category>
		<category><![CDATA[WebOrb]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=433</guid>
		<description><![CDATA[I have been using WebOrb for almost a year now, sometimes it's a great experience, sometimes less (like any other product I have ever used). I have been running production machines for a client, this client request to test the WebOrb service on another port other then 2037 (default). It's actually quite simple to create, [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-434" href="http://www.kensodev.com/wp-content/uploads/2010/05/brown_net.jpg" rel="facebox"><img class="alignleft size-thumbnail wp-image-434" title="Weborb" src="http://www.kensodev.com/wp-content/uploads/2010/05/brown_net-150x150.jpg" alt="" width="150" height="150" /></a>I have been using WebOrb for almost a year now, sometimes it's a great experience, sometimes less (like any other product I have ever used).</p>
<p>I have been running production machines for a client, this client request to test the WebOrb service on another port other then 2037 (default).</p>
<p>It's actually quite simple to create, but not intuitive.</p>
<p>if you are using WebOrb from the command line, you have a setting called "port". all you have to do is run the command with the port param and everything will work great.</p>
<p>like so:</p>
<pre class="brush: bash;">
c:\inetpub\wwwroot\weborb30\weborbee.exe -port 1935
</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/05/09/change-weborb-default-port-from-2037-to-what-you-want/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic streaming (Adaptive bitrate) using Flash media Server</title>
		<link>http://www.kensodev.com/2010/04/15/dynamic-streamin-adaptive-bitrate-using-flash-media-server/</link>
		<comments>http://www.kensodev.com/2010/04/15/dynamic-streamin-adaptive-bitrate-using-flash-media-server/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 18:56:09 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[Flash media server]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[As3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash player]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=417</guid>
		<description><![CDATA[Video and the web are long time friends already, you see lots of websites with some sot of player for video content, you also see media companies and television channels serving video over the wire to the end users. Video can be downloaded (progressive download) to the client like YouTube or can be streamed to [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-418" href="http://www.kensodev.com/wp-content/uploads/2010/04/fms.png" rel="facebox"><img class="alignleft size-thumbnail wp-image-418" title="Flash Media Server" src="http://www.kensodev.com/wp-content/uploads/2010/04/fms-150x150.png" alt="" width="150" height="150" /></a>Video and the web are long time friends already, you see lots of websites with some sot of player for video content, you also see media companies and television channels serving video over the wire to the end users.</p>
<p>Video can be downloaded (progressive download) to the client like YouTube or can be streamed to him.</p>
<p>I won't discuss the pro's &amp; con's of streaming and progressive, we will only be discussing streaming in this post.</p>
<p>So, What is the post worthy problem we have when streaming video to the client?</p>
<p>Continue reading and find out.<br />
<span id="more-417"></span>When streaming video, you usually encode your video in a certain bitrate, this bitrate will work well in certain computers and won't work well in others.</p>
<p>Why is that?</p>
<p>That's because each of your users has a different connection thus being capable to receive a limited amount of bytes streamed to him.</p>
<p>So, you always have to find the "sweet spot" where you deliver a video that looks good and also light enough to fit a wider range of network connection speeds.</p>
<p>That is of course a problem becuase sometimes you want to stream hiQuality video and audio (HD) and you can't because some of your users won't be able to watch it smoothly.</p>
<p>Well, this is a problem we will solve here in this post.</p>
<p>Flash media server introduced a new way of streaming video to the client, it is called dynamic streaming and it is very dynamic (name implies just that).</p>
<p>That way, you can create several encodes to the same source movie and supply a movie best fit to the user cosuming it.</p>
<p>Another obvious advantage of this approach is the way it skips on top of the movie, when you skip to a further point in the movie, you are actually being supplied a different movie from the lowest quality to the highest.</p>
<p>So, how is it done, first, let's create a flash file (I'm using flash CS4).</p>
<p style="text-align: center;"><a rel="facebox" href="http://www.kensodev.com/wp-content/uploads/2010/04/Screen-shot-2010-04-15-at-9.37.06-PM.png" rel="facebox"><img class="aligncenter size-medium wp-image-419" title="New flash file (Adaptive bitrate) dynamic streaming" src="http://www.kensodev.com/wp-content/uploads/2010/04/Screen-shot-2010-04-15-at-9.37.06-PM-300x171.png" alt="" width="300" height="171" /></a></p>
<p>Now, we will create (by dragging and dropping from the components panel) an FLVPlayback control.</p>
<p>We will give it the same dimensions as the movie itself so it will fill the entire surface.</p>
<p>Now, we will give the player an instance name of "flvPlayer"</p>
<p>so, we have a movie, we have an FLVPlayback control, we called it "flvPlayer".</p>
<p>We will create another layer, called "action script" and we will create this code inside.</p>
<pre class="brush: as3;">
import fl.video.*;
VideoPlayer.iNCManagerClass = NCManagerDynamicStream;
flvPlayer.source = &quot;dynamicStream.smil&quot;;
</pre>
<p>OK, so as we can see we created a pointer to a file called "dynamicStream.smil", this is a special file (XML format).</p>
<p>This file details the following</p>
<ul>
<li>FMS Url</li>
<li>files you have encoded and a network speed in correlation</li>
</ul>
<p>The file looks like this:</p>
<pre class="brush: xml;">
&lt;smil&gt;
    &lt;head&gt;
        &lt;meta base=&quot;rtmp://your_fms_location/vod/&quot; /&gt;
    &lt;/head&gt;
    &lt;body&gt;
	&lt;switch&gt;
		&lt;video src=&quot;mp4:erets7_03_vod1_300.mp4&quot; system-bitrate=&quot;300000&quot;/&gt;
		&lt;video src=&quot;mp4:erets7_03_vod1_500.mp4&quot; system-bitrate=&quot;500000&quot;/&gt;
		&lt;video src=&quot;mp4:erets7_03_vod1_800.mp4&quot; system-bitrate=&quot;800000&quot;/&gt;
        &lt;/switch&gt;
    &lt;/body&gt;
&lt;/smil&gt;
</pre>
<p>Now, when we put this file on our web-server, the user will get the file it can receive and play, not slower, not faster, just the perfect file for him.</p>
<p>NO buffering, NO waiting, NO frustration, smooth, cool and fast user experience.</p>
<p>Good luck.</p>
<p>You can download the complete solution from here:<br />
<a class="downloadlink" href="http://www.kensodev.com/wp-content/plugins/download-monitor/download.php?id=dynamic_streaming.zip" title=" downloaded 84 times" >Source - Dynamic streaming (flash media server) (84)</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/04/15/dynamic-streamin-adaptive-bitrate-using-flash-media-server/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Enumeration on a property &#8211; Flex 3</title>
		<link>http://www.kensodev.com/2010/04/07/enumeration-on-a-property-flex-3/</link>
		<comments>http://www.kensodev.com/2010/04/07/enumeration-on-a-property-flex-3/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 08:28:47 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[As3]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=383</guid>
		<description><![CDATA[Often when you create custom controls in flex application, you create custom properties and the apps consuming your components needs to set those properties for the component to work properly. lack of documentation often lead to situation when the developer consuming your component doesn't know what are the values you expect of him to set. [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-409" href="http://www.kensodev.com/wp-content/uploads/2010/04/fx-icon.png" rel="facebox"><img class="alignleft size-thumbnail wp-image-409" title="Flex 3" src="http://www.kensodev.com/wp-content/uploads/2010/04/fx-icon-150x150.png" alt="" width="150" height="150" /></a>Often when you create custom controls in flex application, you create custom properties and the apps consuming your components needs to set those properties for the component to work properly.</p>
<p><span id="more-383"></span></p>
<p>lack of documentation often lead to situation when the developer consuming your component doesn't know what are the values you expect of him to set.</p>
<p>Well, there's a solution for this, Flex introduced the "Inspectable" metadata tag, you can simply set this tag above your setter and the developer will get full intellisense and be able to know what you meant.</p>
<p>In this simple application, I create a custom mxml component based on Canvas, I create a property called myString and created an "Inspectable" metatag.</p>
<p>like so:</p>
<pre class="brush: as3;">
[Bindable]
private var _myString:String;

[Inspectable (enumeration=&quot;stringValue1,stringValue2,stringValue3&quot;)]
public function set myString(val:String):void
{
_myString = val;
}
</pre>
<p>So far, it's as simple as it can get, now, check out a screenshot of my flex builder when setting this property from outside</p>
<p style="text-align: center;"><a rel="attachment wp-att-384 facebox" href="http://www.kensodev.com/wp-content/uploads/2010/04/Screen-shot-2010-04-07-at-11.20.01-AM.png" rel="facebox"><img class="aligncenter size-medium wp-image-384" title="Flex enum on peoprty" src="http://www.kensodev.com/wp-content/uploads/2010/04/Screen-shot-2010-04-07-at-11.20.01-AM-300x137.png" alt="" width="300" height="137" /></a></p>
<p>And that's it, that's how simple it is to create enumeration and ease the life on your fellow developers.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/04/07/enumeration-on-a-property-flex-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup all databases (SQL Express) with a single T-Sql</title>
		<link>http://www.kensodev.com/2010/04/05/backup-all-databases-sql-express-with-a-single-t-sql/</link>
		<comments>http://www.kensodev.com/2010/04/05/backup-all-databases-sql-express-with-a-single-t-sql/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 14:00:20 +0000</pubDate>
		<dc:creator>Avi Tzurel</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Sql server]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[Sql]]></category>
		<category><![CDATA[Sql 2008]]></category>
		<category><![CDATA[T-Sql]]></category>

		<guid isPermaLink="false">http://www.kensodev.com/?p=377</guid>
		<description><![CDATA[I'm using SQL Express 2008 for development on my development machines, I'm saving the full version for the servers and not on development. One of the things I often see when people talk about the express disadvantages is the lack of support for JOBS so you cannot create a custom backups for your database. Well, [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-302" href="http://www.kensodev.com/wp-content/uploads/2010/01/iStock_000010274670XSmall.jpg" rel="facebox"><img class="alignleft size-thumbnail wp-image-302" title="Database server" src="http://www.kensodev.com/wp-content/uploads/2010/01/iStock_000010274670XSmall-150x150.jpg" alt="" width="150" height="150" /></a>I'm using SQL Express 2008 for development on my development machines, I'm saving the full version for the servers and not on development.</p>
<p>One of the things I often see when people talk about the express disadvantages is the lack of support for JOBS so you cannot create a custom backups for your database.</p>
<p>Well, in this post I will show you how you can create a single database on your development machine that will be responsible for all of the backups, create a table that will log the backups and a stored procedure that will do the work.</p>
<p>In a later post, I will also show how you can integrate this into a command line and then into your nightly backup startegy.</p>
<p>The most beautiful part of this solution is that it is totally free of charge and using custom T-Sql. and the command line is using a custom tool supplied by the EXPRESS package.</p>
<p>So, without talking too much, let's dive into the solution.<br />
<span id="more-377"></span></p>
<p>First, we will create the database.</p>
<pre class="brush: sql;">
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[DatabaseBackup](
	[Name] [varchar](128) NOT NULL,
	[BackupFlagFull] [varchar](1) NOT NULL,
	[BackupFlagLog] [varchar](1) NOT NULL,
	[RetentionPeriodFull] [datetime] NOT NULL,
	[RetentionPeriodLog] [datetime] NOT NULL,
PRIMARY KEY NONCLUSTERED
(
	[Name] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
</pre>
<p>Now, we have the database all set-up, let's create the stored procedure</p>
<pre class="brush: sql;">
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[s_BackupAllDatabases]
@Path varchar(128) ,
@Type varchar(4) -- Full / Log
as
set nocount on
declare @sql varchar(1000)

	-- Get all database names
	create table #DBName
		(
		ID int identity (1,1) ,
		Name varchar(128) not null ,
		RetentionPeriod datetime null
		)

	insert #DBName
		(Name)
	select name
	from master..sysdatabases

	-- Include any new databases in the backup
	insert DatabaseBackup
		(
		Name ,
		BackupFlagFull ,
		BackupFlagLog ,
		RetentionPeriodFull ,
		RetentionPeriodLog
		)
	select #DBName.Name ,
		'Y' ,
		'N' ,
		'2 jan 1900' , -- default 2 days
		'1 jan 1900'
	from #DBName
		left outer join DatabaseBackup
			on DatabaseBackup.Name = #DBName.Name
	where DatabaseBackup.Name is null
	and lower(#DBName.Name) &lt;&gt; 'tempdb'

	-- Remove any non-existant databases
	delete DatabaseBackup
	where not exists
		(
		select *
		from #DBName
		where #DBName.Name = DatabaseBackup.Name
		)

	delete #DBName

	create table #ExistingBackups
		(
		Name varchar(128) ,
		ID int identity (1,1)
		)

	-- loop through databases
declare @Name varchar(128) ,
	@RetentionPeriod datetime ,
	@LastBackupToKeep varchar(8) ,
	@ID int ,
	@MaxID int

	insert #DBName
		(Name, RetentionPeriod)
	select Name, case when @Type = 'Full' then RetentionPeriodFull else RetentionPeriodLog end
	from DatabaseBackup
	where (@Type = 'Full' and BackupFlagFull = 'Y')
	or (@Type = 'Log' and BackupFlagLog = 'Y')

	select @MaxID = max(ID) ,
		@ID = 0
	from #DBName

	while @ID &lt; @MaxID
	begin
		-- get next database to backup
		select @ID = min(ID) from #DBName where ID &gt; @ID

		select @Name = Name ,
			@RetentionPeriod = RetentionPeriod
		from #DBName
		where ID = @ID

		-- Delete old backups
		delete #ExistingBackups
		select @sql = 'dir /B ' + @Path
		select @sql = @sql + '&quot;' + @Name + '_' + @Type + '*.*&quot;'

		insert #ExistingBackups exec master..xp_cmdshell @sql

		if exists (select * from #ExistingBackups where Name like '%File Not Found%')
			delete #ExistingBackups

		select @LastBackupToKeep = convert(varchar(8),getdate() - @RetentionPeriod,112)
		delete #ExistingBackups where Name &gt; @Name + '_' + @Type + '_' + @LastBackupToKeep

declare @eID int ,
	@eMaxID int ,
	@eName varchar(128)

		-- loop round all the out of date backups
		select 	@eID = 0 ,
			@eMaxID = coalesce(max(ID), 0)
		from 	#ExistingBackups

		while @eID &lt; @eMaxID
		begin
			select @eID = min(ID) from #ExistingBackups where ID &gt; @eID
			select @eName = Name from #ExistingBackups where ID = @eID

			select @sql = 'del ' + @Path + '&quot;' + @eName + '&quot;'
			exec master..xp_cmdshell @sql, no_output
		end
		delete #ExistingBackups

		-- now do the backup
		select @sql = @Path + @Name + '_' + @Type + '_'
				+ convert(varchar(8),getdate(),112) + '_'
				+ replace(convert(varchar(8),getdate(),108),':','') + '.bak'
		if @Type = 'Full'
			backup database @Name
				to disk = @sql
		else
			backup log @Name
				to disk = @sql
	end
GO
/****** Object:  Check [CK__DatabaseB__Backu__023D5A04]    Script Date: 04/05/2010 16:49:17 ******/
ALTER TABLE [dbo].[DatabaseBackup]  WITH CHECK ADD CHECK  (([BackupFlagFull]='N' OR [BackupFlagFull]='Y'))
GO
/****** Object:  Check [CK__DatabaseB__Backu__03317E3D]    Script Date: 04/05/2010 16:49:17 ******/
ALTER TABLE [dbo].[DatabaseBackup]  WITH CHECK ADD CHECK  (([BackupFlagLog]='N' OR [BackupFlagLog]='Y'))
GO
</pre>
<p>Now, we have our database, we have our stored procedure.</p>
<p>Let's execute the stored procedure.</p>
<p>Right click on the stored procedure and click on "Execute..."</p>
<p style="text-align: center;"><a rel="attachment wp-att-378 facebox" href="http://www.kensodev.com/wp-content/uploads/2010/04/05-04-2010-16-55-15.png" rel="facebox"><img class="aligncenter size-medium wp-image-378" title="Execute stored procedure" src="http://www.kensodev.com/wp-content/uploads/2010/04/05-04-2010-16-55-15-300x225.png" alt="" width="300" height="225" /></a></p>
<p>Now, set the parameters</p>
<p>The first parameter is the library and the second is the backup type, you can use full, log</p>
<p style="text-align: center;"><a rel="attachment wp-att-379 facebox" href="http://www.kensodev.com/wp-content/uploads/2010/04/05-04-2010-16-55-47.png" rel="facebox"><img class="aligncenter size-medium wp-image-379" title="Store procedure execution parameters" src="http://www.kensodev.com/wp-content/uploads/2010/04/05-04-2010-16-55-47-300x268.png" alt="" width="300" height="268" /></a></p>
<p>That's it, you have a backup up and running.</p>
<p>in the next post I will show how you can do it from command line and integrate it into your backup program post-backup action.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kensodev.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kensodev.com/2010/04/05/backup-all-databases-sql-express-with-a-single-t-sql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
