<?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>Sam Beauvois</title>
	<atom:link href="http://www.sambeauvois.be/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sambeauvois.be/blog</link>
	<description>general dev, .net and other stuff</description>
	<lastBuildDate>Thu, 25 Feb 2010 22:44:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CSS Mixer</title>
		<link>http://www.sambeauvois.be/blog/2010/02/css-mixer/</link>
		<comments>http://www.sambeauvois.be/blog/2010/02/css-mixer/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 22:41:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://www.sambeauvois.be/blog/?p=207</guid>
		<description><![CDATA[ Css mixer is a tool I&#8217;ve developped in C# winforms, .NET framework 3.5
You can use it to improve you ASP.NET Themes or your CSS files for all your web projects.
If you have many css files linked to a page, you can group them in a single file with CSS Mixer.
You can also minify CSS files [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cssmixer.codeplex.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/cssmixer.codeplex.com/?referer=');"><img class="alignleft size-full wp-image-206" title="CSSmixer128" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/CSSmixer128.png" alt="CSSmixer128" width="128" height="128" /></a> Css mixer is a tool I&#8217;ve developped in C# winforms, .NET framework 3.5</p>
<p>You can use it to improve you ASP.NET Themes or your CSS files for all your web projects.</p>
<p>If you have many css files linked to a page, you can group them in a single file with CSS Mixer.</p>
<p>You can also minify CSS files to save the bandwith.</p>
<p> </p>
<p>To use it, open a folder containing CSS files,</p>
<p style="text-align: center;"><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/cssmixer_screenshot.png" target="_blank"><img class="aligncenter size-full wp-image-208" title="cssmixer_screenshot" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/cssmixer_screenshot.png" alt="cssmixer_screenshot" width="480" /></a></p>
<p>choose an action (simple combine, or combine and minify) then click Save as &#8230;</p>
<p style="text-align: center;"><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/cssmixer_screenshot2.png" target="_blank"><img class="aligncenter size-full wp-image-209" title="cssmixer_screenshot2" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/cssmixer_screenshot2.png" alt="cssmixer_screenshot2" width="480" /></a></p>
<p>Download the last version of <a href="http://cssmixer.codeplex.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/cssmixer.codeplex.com/?referer=');">CSS Mixer on codeplex</a>.</p>
<p>I hope you&#8217;ll find it usefull. please give me feedback on it</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sambeauvois.be/blog/2010/02/css-mixer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get the parent Folder for a SPListItem</title>
		<link>http://www.sambeauvois.be/blog/2010/02/get-the-parent-folder-for-a-splistitem/</link>
		<comments>http://www.sambeauvois.be/blog/2010/02/get-the-parent-folder-for-a-splistitem/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 18:23:08 +0000</pubDate>
		<dc:creator>Sam Beauvois</dc:creator>
				<category><![CDATA[Extension Methods]]></category>
		<category><![CDATA[Reminders]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://www.sambeauvois.be/blog/?p=203</guid>
		<description><![CDATA[To retrieve the parent folder
my extension method


public static SPFolder GetParentFolder(this SPListItem spListItem)

{

if (spListItem == null)

return null;

SPFile spFile = spListItem.Web.GetFile(spListItem.Url);

if (spFile == null)

return null;

return spFile.ParentFolder;

}

Use


SPFolder parentFolder = sPListItem.GetParentFolder();

if (parentFolder != null)

{

// do some stuffs..

}

public static SPFolder GetParentFolder(this SPListItem spListItem)
{
if (spListItem == null)
return null;
SPFile spFile = spListItem.Web.GetFile(spListItem.Url);
if (spFile == null)
return null;
return spFile.ParentFolder;
}[/csharp]
]]></description>
			<content:encoded><![CDATA[<p>To retrieve the parent folder</p>
<p>my extension method</p>
<pre class="brush: csharp;">

public static SPFolder GetParentFolder(this SPListItem spListItem)

{

if (spListItem == null)

return null;

SPFile spFile = spListItem.Web.GetFile(spListItem.Url);

if (spFile == null)

return null;

return spFile.ParentFolder;

}
</pre>
<p>Use</p>
<pre class="brush: csharp;">

SPFolder parentFolder = sPListItem.GetParentFolder();

if (parentFolder != null)

{

// do some stuffs..

}
</pre>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">public static SPFolder GetParentFolder(this SPListItem spListItem)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">if (spListItem == null)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">return null;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">SPFile spFile = spListItem.Web.GetFile(spListItem.Url);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">if (spFile == null)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">return null;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">return spFile.ParentFolder;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}[/csharp]</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sambeauvois.be/blog/2010/02/get-the-parent-folder-for-a-splistitem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to build a “visible on hover” action menu with CSS?</title>
		<link>http://www.sambeauvois.be/blog/2010/02/how-to-build-a-%e2%80%9cvisible-on-hover%e2%80%9d-action-menu-with-css/</link>
		<comments>http://www.sambeauvois.be/blog/2010/02/how-to-build-a-%e2%80%9cvisible-on-hover%e2%80%9d-action-menu-with-css/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 19:44:41 +0000</pubDate>
		<dc:creator>Sam Beauvois</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://www.sambeauvois.be/blog/?p=193</guid>
		<description><![CDATA[In my previous post I explain a way to build a &#8220;visible on hover&#8221; menu using jQuery.
Now, I&#8217;ll explain you how to do that without javascript, using only CSS.
First, built the web page and a CSS file


&#60;html&#62;
 &#60;head&#62;
 &#60;title&#62;Sam Beauvois &#124; CSS on hover menu&#60;/title&#62;
 &#60;link href=&#34;demo.css&#34; type=&#34;text/css&#34; rel=&#34;stylesheet&#34; /&#62;
 &#60;/head&#62;

 &#60;body&#62;
 &#60;h2&#62;Visible on hover [...]]]></description>
			<content:encoded><![CDATA[<p>In my previous post I explain a way to <a href="http://www.sambeauvois.be/blog/2010/02/how-to-build-a-visible-on-hover-action-menu-with-jquery/" target="_blank">build a &#8220;visible on hover&#8221; menu using jQuery</a>.</p>
<p>Now, I&#8217;ll explain you how to do that without javascript, using only CSS.</p>
<p>First, built the web page and a CSS file</p>
<pre class="brush: xml;">

&lt;html&gt;
 &lt;head&gt;
 &lt;title&gt;Sam Beauvois | CSS on hover menu&lt;/title&gt;
 &lt;link href=&quot;demo.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; /&gt;
 &lt;/head&gt;

 &lt;body&gt;
 &lt;h2&gt;Visible on hover with CSS demo.&lt;h2&gt;
 &lt;h3&gt;Please put you mouse hover the following texts&lt;/h3&gt;

 &lt;div&gt;
 Demo 1
 &lt;div&gt;
 &lt;a href=&quot;#&quot;&gt;action 1&lt;/a&gt; | &lt;a href=&quot;#&quot;&gt;action 2&lt;/a&gt; | &lt;a href=&quot;#&quot;&gt;action 3&lt;/a&gt;
 &lt;/div&gt;
 &lt;/div&gt;

&lt;/body&gt;
</pre>
<p><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/20100207_visibleOnHover_CSS_1.png"><img class="aligncenter size-full wp-image-195" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/20100207_visibleOnHover_CSS_1.png" alt="20100207_visibleOnHover_CSS_1" width="403" height="278" /></a>Then add a class to the container and content divs</p>
<pre class="brush: xml;">&lt;/pre&gt;
&lt;div class=&quot;hidden_action_container&quot;&gt;
Demo 1
&lt;div class=&quot;hidden_action&quot;&gt;
&lt;a href=&quot;#&quot;&gt;action 1&lt;/a&gt; | &lt;a href=&quot;#&quot;&gt;action 2&lt;/a&gt; | &lt;a href=&quot;#&quot;&gt;action 3&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;pre&gt;</pre>
<p>And define the classes in the CSS file :</p>
<pre class="brush: css;">

.hidden_action_container .hidden_action
{
 display: none;
}
.hidden_action_container:hover .hidden_action
{
 display:inline;
}
</pre>
<p>note the class declaration :</p>
<pre>.hidden_action_container<strong><span style="text-decoration: underline">:hover</span></strong> .hidden_action</pre>
<p><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/20100207_visibleOnHover_CSS_2.png"><img class="aligncenter size-full wp-image-197" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/20100207_visibleOnHover_CSS_2.png" alt="20100207_visibleOnHover_CSS_2" width="378" height="239" /></a><br />
<strong>Now it&#8217;s functionnal</strong>,</p>
<p>Add a style to make it nicer :</p>
<pre class="brush: css;">
.hidden_action_container
{
 padding : 15px 15px 15px 15px;
 background-color: #DDDDDD;
 border-style:solid;
 border-color:#EEEEEE;
 height:50px;
}

.hidden_action_container .hidden_action a
{
 color:#999999;
 font-size: 20px;
 font-weight:bolder;
}

.hidden_action_container .hidden_action
{
 display: none;
}
.hidden_action_container:hover .hidden_action
{
 display:inline;
}
</pre>
<p><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/20100207_visibleOnHover_CSS_3.png"><img class="aligncenter size-full wp-image-198" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/20100207_visibleOnHover_CSS_3.png" alt="20100207_visibleOnHover_CSS_3" width="387" height="447" /></a>You can see the online demo here : <a href="http://www.sambeauvois.be/Demos/CSS/VisibleOnHover/demo.html" target="_blank">http://www.sambeauvois.be/Demos/CSS/VisibleOnHover/demo.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sambeauvois.be/blog/2010/02/how-to-build-a-%e2%80%9cvisible-on-hover%e2%80%9d-action-menu-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to build a &#8220;visible on hover&#8221; action menu with jQuery ?</title>
		<link>http://www.sambeauvois.be/blog/2010/02/how-to-build-a-visible-on-hover-action-menu-with-jquery/</link>
		<comments>http://www.sambeauvois.be/blog/2010/02/how-to-build-a-visible-on-hover-action-menu-with-jquery/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 16:43:35 +0000</pubDate>
		<dc:creator>Sam Beauvois</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.sambeauvois.be/blog/?p=178</guid>
		<description><![CDATA[Here is a quick way to use jQuery library to create a &#8220;visible on hover&#8221; action menu.
I&#8217;ll explain step by step how to do that.
1.) Create an html page with actions in a container

&#60;html&#62;
 &#60;head&#62;
 &#60;title&#62;Sam Beauvois &#124; jQuery usage demo 1&#60;/title&#62;
 &#60;/head&#62;
 &#60;body&#62;
 &#60;h2&#62;Visible on hover with jQuery demo.&#60;h2&#62;
 &#60;h3&#62;Please put you mouse hover [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick way to use jQuery library to create a &#8220;visible on hover&#8221; action menu.</p>
<p>I&#8217;ll explain step by step how to do that.</p>
<p>1.) Create an html page with actions in a container</p>
<pre class="brush: xml;">
&lt;html&gt;
 &lt;head&gt;
 &lt;title&gt;Sam Beauvois | jQuery usage demo 1&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;h2&gt;Visible on hover with jQuery demo.&lt;h2&gt;
 &lt;h3&gt;Please put you mouse hover the following texts&lt;/h3&gt;
 &lt;div&gt;
 Demo 1
 &lt;div&gt;
 &lt;a href=&quot;#&quot;&gt;action 1&lt;/a&gt; | &lt;a href=&quot;#&quot;&gt;action 2&lt;/a&gt; | &lt;a href=&quot;#&quot;&gt;action 3&lt;/a&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Result is</p>
<div id="attachment_182" class="wp-caption aligncenter" style="width: 396px"><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/jquery.visible.on_.hover_.demo1_.png"><img class="size-full wp-image-182" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/jquery.visible.on_.hover_.demo1_.png" alt="simple page" width="386" height="276" /></a><p class="wp-caption-text">simple page</p></div>
<p>2.) Link the jquery library (here from google code, but you can download the library at <a href="http://www.jquery.com" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.jquery.com?referer=');">jquery.com</a>) and add a css class to the container div and one other to the action div</p>
<pre class="brush: xml;">

&lt;head&gt;
 &lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot; &gt;&lt;/script&gt;
&lt;/head&gt;
</pre>
<pre class="brush: xml;">
&lt;body&gt;
&lt;div&gt;
 Demo 1
 &lt;div&gt;
 &lt;a href=&quot;#&quot;&gt;action 1&lt;/a&gt; | &lt;a href=&quot;#&quot;&gt;action 2&lt;/a&gt; | &lt;a href=&quot;#&quot;&gt;action 3&lt;/a&gt;
 &lt;/div&gt;
 &lt;/div&gt;
&lt;/body&gt;
</pre>
<p>3.) Add a function :</p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;&gt;
 $(document).ready(function()
 {
    ShowActionOnOver();
    $(&quot;.hidden_action&quot;,this).hide(); // hide all
 });

 function ShowActionOnOver()
 {
   $(&quot;.hidden_action_container&quot;).hover(
       function()
       {
          $(&quot;.hidden_action&quot;,this).show();
       },
       function()
       {
           $(&quot;.hidden_action&quot;,this).hide();
        }
    );
 }

 &lt;/script&gt;
</pre>
<p>Now it&#8217;s functionnal, hover the zone to check :</p>
<p><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/jquery.visible.on_.hover_.demo2_.png"><img class="aligncenter size-full wp-image-183" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/jquery.visible.on_.hover_.demo2_.png" alt="jquery.visible.on.hover.demo2" width="385" height="242" /></a></p>
<p>4.) Now, add some css to make it nicer :</p>
<pre class="brush: css;">
.hidden_action_container
{
 padding : 15px 15px 15px 15px;
 background-color: #DDDDDD;
 border-style:solid;
 border-color:#EEEEEE;
 height:50px;
}

.hidden_action a
{
 color:#999999;
 font-size: 20px;
 font-weight:bolder;
}
</pre>
<pre class="brush: xml;">
&lt;head&gt;
 &lt;link href=&quot;demo.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; /&gt;
&lt;/head&gt;
</pre>
<p>And the final result looks like</p>
<p><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/jquery.visible.on_.hover_.demo3_.png"><img class="aligncenter size-full wp-image-184" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/jquery.visible.on_.hover_.demo3_.png" alt="jquery.visible.on.hover.demo3" width="386" height="463" /></a></p>
<h3>You can<a href="http://www.sambeauvois.be/Demos/jQuery/VisibleOnHover/demo.html" target="_blank"> see the online demo here.</a></h3>
]]></content:encoded>
			<wfw:commentRss>http://www.sambeauvois.be/blog/2010/02/how-to-build-a-visible-on-hover-action-menu-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get the list of all stored procedures using a specific table</title>
		<link>http://www.sambeauvois.be/blog/2010/02/how-to-get-the-list-of-all-stored-procedures-using-a-specific-table/</link>
		<comments>http://www.sambeauvois.be/blog/2010/02/how-to-get-the-list-of-all-stored-procedures-using-a-specific-table/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 15:25:25 +0000</pubDate>
		<dc:creator>Sam Beauvois</dc:creator>
				<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://www.sambeauvois.be/blog/?p=173</guid>
		<description><![CDATA[Big projects with a lot of stored procedures can be a mess to maintain.
If you change one field in a table, you have to check if there is no side effect in the stored procedures using this table.
This &#8220;sp_depends&#8221; system stored procedure can help you finding your stored procedures using the table you modified.
Just create [...]]]></description>
			<content:encoded><![CDATA[<p>Big projects with a lot of stored procedures can be a mess to maintain.</p>
<p>If you change one field in a table, you have to check if there is no side effect in the stored procedures using this table.</p>
<p>This &#8220;sp_depends&#8221; system stored procedure can help you finding your stored procedures using the table you modified.</p>
<p>Just create a new query, type</p>
<pre class="brush: sql;">

EXEC sp_depends @objname='tableName'
</pre>
<p>(replace &#8220;tableName&#8221; by the name of your table)</p>
<p>then execute.</p>
<p>result example :</p>
<div id="attachment_175" class="wp-caption alignleft" style="width: 457px"><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/20100202_SP_depends.png"><img class="size-full wp-image-175" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/02/20100202_SP_depends.png" alt="example result" width="447" height="809" /></a><p class="wp-caption-text">example result</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sambeauvois.be/blog/2010/02/how-to-get-the-list-of-all-stored-procedures-using-a-specific-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use the undocumented stored procedure sp_msforeachtable to add a column to all tables in a database ?</title>
		<link>http://www.sambeauvois.be/blog/2010/01/how-to-use-the-undocumented-stored-procedure-sp_msforeachtable-to-add-a-column-to-all-tables-in-a-database/</link>
		<comments>http://www.sambeauvois.be/blog/2010/01/how-to-use-the-undocumented-stored-procedure-sp_msforeachtable-to-add-a-column-to-all-tables-in-a-database/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 20:13:27 +0000</pubDate>
		<dc:creator>Sam Beauvois</dc:creator>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[Tsql]]></category>

		<guid isPermaLink="false">http://www.sambeauvois.be/blog/?p=169</guid>
		<description><![CDATA[There are two examples, in both I add a column to each tables except the spnet membership tables.
Example :
Add the &#8220;CreatedDate&#8221; column to all tables :


print 'Add [CreatedDate] Column for each user table'

EXEC sp_msforeachtable
 '
-- add column
exec(''
 declare @tableName as nvarchar(max)
 set @tableName = ''''_?_''''

 IF (CHARINDEX(''''aspnet_'''',@tableName) = 0) -- no aspnet membership
 BEGIN
 IF [...]]]></description>
			<content:encoded><![CDATA[<p>There are two examples, in both I add a column to each tables except the spnet membership tables.</p>
<p>Example :</p>
<p>Add the &#8220;CreatedDate&#8221; column to all tables :</p>
<pre class="brush: sql;">

print 'Add [CreatedDate] Column for each user table'

EXEC sp_msforeachtable
 '
-- add column
exec(''
 declare @tableName as nvarchar(max)
 set @tableName = ''''_?_''''

 IF (CHARINDEX(''''aspnet_'''',@tableName) = 0) -- no aspnet membership
 BEGIN
 IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N''''?'''') AND type in (N''''U''''))
 BEGIN
 IF columnproperty(object_id(''''?''''), ''''CreatedDate'''', ''''ColumnId'''') is null
 BEGIN
 ALTER TABLE ? ADD [CreatedDate] datetime NOT NULL
 END
 END
 END
'')

' ;
print ' [CreatedDate] Column is created for each user table'
</pre>
<p>Example 2 :</p>
<p>Add the &#8220;CreatedUserID&#8221; column to all tables and enable constraints. For the example, the reference use the aspnet_Users table</p>
<pre class="brush: sql;">
print 'Add [CreatedUserID] Column for each user table'

EXEC sp_msforeachtable
 '
-- add column
exec(''

 declare @tableName as nvarchar(max)
 set @tableName = ''''_?_''''

 IF (CHARINDEX(''''aspnet_'''',@tableName) = 0) -- no aspnet membership
 BEGIN
 IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N''''?'''') AND type in (N''''U''''))
 BEGIN
 IF columnproperty(object_id(''''?''''), ''''CreatedUserID'''', ''''ColumnId'''') is null
 BEGIN
 ALTER TABLE ? ADD [CreatedUserID] uniqueidentifier NOT NULL
 END
 END
 END
'')
-- add constraint

 declare @constraintName as nvarchar(max)
 set @constraintName = ''FK_?_CreatedUserID''
 IF (CHARINDEX(''aspnet_'',@constraintName) = 0) -- no aspnet membership
 BEGIN
 set @constraintName = REPLACE(@constraintName,''[dbo].['','''')
 set @constraintName = REPLACE(@constraintName,'']'','''')
 IF NOT EXISTS(SELECT 1 FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N''''+@constraintName+'''') AND type = (N''F''))
 BEGIN
 exec(''
 ALTER TABLE ? ADD CONSTRAINT [''+@constraintName+''] FOREIGN KEY([CreatedUserID])
 REFERENCES [aspnet_Users]([UserID])
 '')
 END
 END

' ;
print ' [CreatedUserID] Column is created for each user table'
</pre>
<p>The difficulty is to add the right numbers of  &#8216; .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sambeauvois.be/blog/2010/01/how-to-use-the-undocumented-stored-procedure-sp_msforeachtable-to-add-a-column-to-all-tables-in-a-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zeros and strings manipulation in Tsql</title>
		<link>http://www.sambeauvois.be/blog/2010/01/zeros-and-strings-in-tsql/</link>
		<comments>http://www.sambeauvois.be/blog/2010/01/zeros-and-strings-in-tsql/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 12:56:52 +0000</pubDate>
		<dc:creator>Sam Beauvois</dc:creator>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[Tsql]]></category>

		<guid isPermaLink="false">http://www.sambeauvois.be/blog/?p=161</guid>
		<description><![CDATA[How do I convert an int to a zero padded string in T-SQL?
Let’s say I have an int with the value of 1.
How can I convert that int to a zero padded string, such as &#8220;00000001&#8243;?

DECLARE @iVal int
SET @iVal = 1
select REPLACE(STR(@iVal,8,0),' ','0')

result is &#8220;00000001&#8243;
And the inverse :
Let&#8217;s say you have a string &#8220;0000000120345FER&#8221; and [...]]]></description>
			<content:encoded><![CDATA[<p>How do I convert an int to a zero padded string in T-SQL?</p>
<p>Let’s say I have an int with the value of 1.<br />
How can I convert that int to a zero padded string, such as &#8220;00000001&#8243;?</p>
<pre class="brush: sql;">
DECLARE @iVal int
SET @iVal = 1
select REPLACE(STR(@iVal,8,0),' ','0')
</pre>
<p>result is &#8220;00000001&#8243;</p>
<p>And the inverse :</p>
<p>Let&#8217;s say you have a string &#8220;0000000120345FER&#8221; and you want to remove the leading zeros</p>
<pre class="brush: sql;">
DECLARE @iVal nvarchar(max)
set @iVal = '0000000120345FER'

DECLARE @iVal2 nvarchar(max)
set @iVal2= SUBSTRING(@iVal, PATINDEX('%[^0]%', @iVal+'.'), LEN(@iVal))

print @iVal2
</pre>
<p>result is &#8220;120345FER&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sambeauvois.be/blog/2010/01/zeros-and-strings-in-tsql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A few lists &#8230;</title>
		<link>http://www.sambeauvois.be/blog/2010/01/a-few-lists/</link>
		<comments>http://www.sambeauvois.be/blog/2010/01/a-few-lists/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 10:08:29 +0000</pubDate>
		<dc:creator>Sam Beauvois</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.sambeauvois.be/blog/?p=159</guid>
		<description><![CDATA[The Joel Test: 12 Steps to Better Code
Top 10 Things That Annoy Programmers
10 Programming proverbs every developer should know
101 Ways To Know Your Software Project Is Doomed
Top 100 Blogs for Developers
&#8211;&#62; Pragmatic Software Development Tips
]]></description>
			<content:encoded><![CDATA[<p><a title="The Joel Test: 12 Steps to Better Code" href="http://www.joelonsoftware.com/articles/fog0000000043.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.joelonsoftware.com/articles/fog0000000043.html?referer=');">The Joel Test: 12 Steps to Better Code</a></p>
<p><a title="Top 10 Things That Annoy Programmers" href="http://www.kevinwilliampang.com/post/Top-10-Things-That-Annoy-Programmers.aspx" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.kevinwilliampang.com/post/Top-10-Things-That-Annoy-Programmers.aspx?referer=');">Top 10 Things That Annoy Programmers</a></p>
<p><a title="10 Programming proverbs every developer should know" href="http://www.kevinwilliampang.com/post/Programming-Proverbs.aspx" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.kevinwilliampang.com/post/Programming-Proverbs.aspx?referer=');">10 Programming proverbs every developer should know</a></p>
<p><a title="101 Ways To Know Your Software Project Is Doomed" href="http://delimitdesign.com/inspirational/101-ways-to-know-your-software-project-management-is-doomed/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/delimitdesign.com/inspirational/101-ways-to-know-your-software-project-management-is-doomed/?referer=');">101 Ways To Know Your Software Project Is Doomed</a></p>
<p><a title="Top 100 Blogs for Developers" href="http://www.sambeauvois.be/blog/wp-admin/post-new.php" target="_blank">Top 100 Blogs for Developers</a></p>
<p>&#8211;&gt; <a title="Pragmatic Software Development Tips" href="http://pragprog.com/the-pragmatic-programmer/extracts/tips" target="_blank" onclick="pageTracker._trackPageview('/outgoing/pragprog.com/the-pragmatic-programmer/extracts/tips?referer=');">Pragmatic Software Development Tips</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sambeauvois.be/blog/2010/01/a-few-lists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy datatable&#8217;s row to an other datatable&#8217;s row</title>
		<link>http://www.sambeauvois.be/blog/2010/01/copy-datatables-row-to-an-other-datatables-row/</link>
		<comments>http://www.sambeauvois.be/blog/2010/01/copy-datatables-row-to-an-other-datatables-row/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 13:35:39 +0000</pubDate>
		<dc:creator>Sam Beauvois</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.sambeauvois.be/blog/?p=156</guid>
		<description><![CDATA[This method perform a row copy with a few checks


public static void CopyRowToAnOther(DataRow row, DataRow anOtherRow)
        {

            if (row == null &#124;&#124; row.Table == null
             [...]]]></description>
			<content:encoded><![CDATA[<p>This method perform a row copy with a few checks</p>
<pre class="brush: csharp;">

public static void CopyRowToAnOther(DataRow row, DataRow anOtherRow)
        {

            if (row == null || row.Table == null
                || anOtherRow == null || anOtherRow.Table == null)
            {
                return;
            }

            foreach (DataColumn colunm in row.Table.Columns)
            {
                if (anOtherRow.Table.Columns.Contains(colunm.ColumnName)
                &amp;&amp; !row.IsNull(colunm.ColumnName)
                &amp;&amp; colunm.DataType == anOtherRow.Table.Columns[colunm.ColumnName].DataType)
                {
                    anOtherRow[colunm.ColumnName] = row[colunm.ColumnName];
                }
            }
        }
</pre>
<div style="overflow: hidden;width: 1px;height: 1px">public static void CopyRowToAnOther(DataRow row, DataRow anOtherRow)</p>
<p>{</p>
<p>if (row == null || row.Table == null || anOtherRow == null || anOtherRow.Table==null)</p>
<p>{</p>
<p>return;</p>
<p>}</p>
<p>foreach (DataColumn colunm in row.Table.Columns)</p>
<p>{</p>
<p>if (anOtherRow.Table.Columns.Contains(colunm.ColumnName)</p>
<p>&amp;&amp; !row.IsNull(colunm.ColumnName)</p>
<p>&amp;&amp; colunm.DataType == anOtherRow.Table.Columns[colunm.ColumnName].DataType)</p>
<p>{</p>
<p>anOtherRow[colunm.ColumnName] = row[colunm.ColumnName];</p>
<p>}</p>
<p>}</p>
<p>}</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sambeauvois.be/blog/2010/01/copy-datatables-row-to-an-other-datatables-row/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t repeat your common CSS between your different themes</title>
		<link>http://www.sambeauvois.be/blog/2010/01/dont-repeat-your-common-css-between-your-different-themes/</link>
		<comments>http://www.sambeauvois.be/blog/2010/01/dont-repeat-your-common-css-between-your-different-themes/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 18:02:53 +0000</pubDate>
		<dc:creator>Sam Beauvois</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.sambeauvois.be/blog/?p=150</guid>
		<description><![CDATA[To fully understand this article, you need an Asp.Net Themes system knowledge
The case :
You have an application with a CSS layout, and a few themes.
There is just a little change between the different themes, by example you change only the color scheme.
A solution to do that is to repeat all CSS files in all your [...]]]></description>
			<content:encoded><![CDATA[<p>To fully understand this article, you need an Asp.Net Themes system knowledge</p>
<h3>The case :</h3>
<p>You have an application with a CSS layout, and a few themes.<br />
There is just a little change between the different themes, by example you change only the color scheme.</p>
<p>A solution to do that is to repeat all CSS files in all your themes, and change the color part.<br />
The problem with that solution is that if you change one common style in one of your themes, you’ll have to repeat the change in all themes. This is a bad idea, it leads to chaos !</p>
<h3>Then how can you do to avoid the code repetition ?</h3>
<h4>My solution:</h4>
<p>1.) Create a Common Theme.</p>
<p>In the Common theme, you define CCS files with a default color scheme (just in case)</p>
<pre class="brush: css;">
.testclass
{
border:solid 1px #DDDDDD;
background-color:#DDDDAA;
font-size:xx-large;
}
</pre>
<p>2.) Create an other Theme (let say “Green”)</p>
<p>In the Green theme, you define CCS files with only the color information</p>
<pre class="brush: css;">

.testclass
{
background-color:#00FF00;
}
</pre>
<p>2b.) Create an other Theme (let say “Blue”)</p>
<p>In the Green theme, you define CCS files with only the color information</p>
<pre class="brush: css;">

.testclass
{
background-color:#0000FF;
}
</pre>
<p>Your Theme structure has to look like this :</p>
<p><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/01/image.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/01/image_thumb.png" border="0" alt="image" width="190" height="134" /></a></p>
<p>3.) Create a default page (Default.aspx)</p>
<p>And set the class of a div to “testclass” (define above)</p>
<pre class="brush: xml;">
&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;Default.aspx.cs&quot; Inherits=&quot;ThemTests._Default&quot;
%&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &gt;
&lt;head runat=&quot;server&quot;&gt;
 &lt;title&gt;Test with themes&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
 &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;
 &lt;div&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ut tellus eget turpis semper adipiscing sit amet id odio. Nunc vitae imperdiet tellus. Aenean quis orci metus, vitae placerat leo. Pellentesque luctus, lectus sit amet lacinia tincidunt, mi nibh sagittis nisl, vitae mollis eros nisi sit amet sem. Nunc dictum massa turpis. Etiam nisi mauris, consectetur et tempus id, pharetra in turpis. Nullam pretium ultricies nulla nec gravida. Sed porttitor metus nisl, ac condimentum nunc. Integer id feugiat orci. Maecenas ut lacinia purus. Mauris egestas mattis accumsan. Nunc in justo massa, quis egestas orci. Ut tincidunt, ligula sit amet tempor pharetra, magna mauris gravida mi, sed semper magna justo at velit. Donec vulputate fringilla lacus non sollicitudin. Morbi nulla nibh, pellentesque sed bibendum cursus, malesuada ut nisi.
 &lt;/div&gt;
 &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>4.) Edit the Web.Config file</p>
<p>Go to the “Pages” section, set the styleSheetTheme attribute to “Common” and the theme attribute to “Green”</p>
<pre class="brush: xml;">

&lt;pages styleSheetTheme=&quot;Common&quot; theme=&quot;Green&quot;&gt;
</pre>
<p>Now launch your web application, the result has to be like this :</p>
<p><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/01/image1.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/01/image_thumb1.png" border="0" alt="image" width="604" height="484" /></a></p>
<p>See in firebug :</p>
<p><a href="http://www.sambeauvois.be/blog/wp-content/uploads/2010/01/image2.png"><img style="border-bottom: 0px;border-left: 0px;border-top: 0px;border-right: 0px" src="http://www.sambeauvois.be/blog/wp-content/uploads/2010/01/image_thumb2.png" border="0" alt="image" width="644" height="252" /></a></p>
<h3>Explanation :</h3>
<p>This works because of the styleSheetTheme and theme attributes.</p>
<p>In fact, ASP.NET applies the styleSheetTheme defined theme first, then applies the page defined styles and at least applies the theme defined theme.</p>
<p>With this technique you can get rid of a few headaches.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sambeauvois.be/blog/2010/01/dont-repeat-your-common-css-between-your-different-themes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
