<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://rss.cnpstudio.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://rss.cnpstudio.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>cnp_studio_Blog</title>
	
	<link>http://cnpstudio.com/blog</link>
	<description>A Division of Clark/Nikdel/Powell</description>
	<pubDate>Wed, 09 Apr 2008 17:00:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://rss.cnpstudio.com/cnpstudioblog" type="application/rss+xml" /><item>
		<title>Around the Office - Toys!</title>
		<link>http://rss.cnpstudio.com/~r/cnpstudioblog/~3/267136747/</link>
		<comments>http://cnpstudio.com/blog/2008/04/09/more-new-office-shots-toys/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 17:00:55 +0000</pubDate>
		<dc:creator>nick</dc:creator>
		
		<category><![CDATA[Who We Are]]></category>

		<category><![CDATA[lego]]></category>

		<category><![CDATA[potatohead]]></category>

		<category><![CDATA[toys]]></category>

		<category><![CDATA[ugly doll]]></category>

		<guid isPermaLink="false">http://cnpstudio.com/blog/2008/04/09/more-new-office-shots-toys/</guid>
		<description><![CDATA[As seen around the office...

Spuda Fett

Darth Mash

Big Toe

Lego Motorized AT-AT
Thanks to Josh for the use of the new D300 for the shots.
]]></description>
			<content:encoded><![CDATA[<p>As seen around the office...</p>
<p><a href="http://flickr.com/photos/hyku/2382096165/"><img src="http://farm3.static.flickr.com/2116/2382096165_e71b4fc42a.jpg?v=0<br />
" alt="Spuda Fett" /></a><br />
Spuda Fett</p>
<p><a href="http://flickr.com/photos/hyku/2382929050/in/photostream/"><img src="http://farm3.static.flickr.com/2283/2382929050_f115c5034d.jpg?v=0" alt="Darth Mash" /></a><br />
Darth Mash</p>
<p><a href="http://flickr.com/photos/hyku/2382094597/in/photostream/"><img src="http://farm4.static.flickr.com/3233/2382094597_7630e4a295.jpg?v=0" alt="Ugly Doll - Big Toe" /></a><br />
Big Toe</p>
<p><a href="http://flickr.com/photos/hyku/2375056766/in/photostream/"><img src="http://farm3.static.flickr.com/2088/2375056766_137e8c4d36.jpg?v=0" alt="Lego AT-AT" /></a><br />
Lego Motorized AT-AT</p>
<p>Thanks to <a href="http://hyku.com">Josh</a> for the use of the new D300 for the shots.</p>
<img src="http://rss.cnpstudio.com/~r/cnpstudioblog/~4/267136747" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://cnpstudio.com/blog/2008/04/09/more-new-office-shots-toys/feed/</wfw:commentRss>
		<feedburner:origLink>http://cnpstudio.com/blog/2008/04/09/more-new-office-shots-toys/</feedburner:origLink></item>
		<item>
		<title>cnp_studio Gets a Mention on the WordPress Publisher Blog</title>
		<link>http://rss.cnpstudio.com/~r/cnpstudioblog/~3/266434201/</link>
		<comments>http://cnpstudio.com/blog/2008/04/08/cnp_studio-gets-a-mention-on-the-wordpress-publisher-blog/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 16:06:24 +0000</pubDate>
		<dc:creator>nick</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[sony]]></category>

		<guid isPermaLink="false">http://cnpstudio.com/blog/2008/04/08/cnp_studio-gets-a-mention-on-the-wordpress-publisher-blog/</guid>
		<description><![CDATA[Raanan over at the WordPress Publisher Blog just posted a note about our involvement with the PlayStation Blog (and that it's running WordPress).  He specifically references our recent post that took a more in-depth look at the work behind the project.  
The Publisher Blog highlights some of the lesser known features of WordPress, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://raanan.com">Raanan</a> over at the <a href="http://publisherblog.automattic.com">WordPress Publisher Blog</a> just posted <a href="http://publisherblog.automattic.com/2008/04/07/sony-playstation-blog-powered-by-wordpress/">a note about our involvement with the PlayStation Blog</a> (and that it's running WordPress).  He specifically references <a href="/blog/2008/04/03/playstationblog-a-closer-look-at-the-wordpress-customizations/">our recent post</a> that took a more in-depth look at the work behind the project.  </p>
<p>The Publisher Blog highlights some of the lesser known features of WordPress, interesting plugins and also projects using WordPress (hence the PS feature) so <a href="http://publisherblog.automattic.com">check it out</a> if you&rsquo;re not already.</p>
<img src="http://rss.cnpstudio.com/~r/cnpstudioblog/~4/266434201" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://cnpstudio.com/blog/2008/04/08/cnp_studio-gets-a-mention-on-the-wordpress-publisher-blog/feed/</wfw:commentRss>
		<feedburner:origLink>http://cnpstudio.com/blog/2008/04/08/cnp_studio-gets-a-mention-on-the-wordpress-publisher-blog/</feedburner:origLink></item>
		<item>
		<title>PlayStation.Blog - A Closer Look at the WordPress Customizations</title>
		<link>http://rss.cnpstudio.com/~r/cnpstudioblog/~3/264223274/</link>
		<comments>http://cnpstudio.com/blog/2008/04/03/playstationblog-a-closer-look-at-the-wordpress-customizations/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 20:17:13 +0000</pubDate>
		<dc:creator>nick</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[1 blog cacher]]></category>

		<category><![CDATA[ajax]]></category>

		<category><![CDATA[hyperdb]]></category>

		<category><![CDATA[opcode]]></category>

		<category><![CDATA[plugins]]></category>

		<category><![CDATA[wordcamp2007]]></category>

		<category><![CDATA[wpcache]]></category>

		<guid isPermaLink="false">http://cnpstudio.com/blog/2008/04/03/playstationblog-a-closer-look-at-the-wordpress-customizations/</guid>
		<description><![CDATA[In January of 2007 we were asked by the guys over at Voce if we&#8217;d like to work on the development of the official PlayStation Blog.  We had to check our calendar, but it just so happened that we had a place where we could squeeze the project in.
Customizing WordPress
The PlayStation Blog is a [...]]]></description>
			<content:encoded><![CDATA[<p>In January of 2007 we were asked by the guys over at <a href="http://www.vocenation.com">Voce</a> if we&rsquo;d like to work on the development of the <a href="http://blog.us.playstation.com">official PlayStation Blog</a>.  We had to check our calendar, but it just so happened that we had a place where we could squeeze the project in.</p>
<h3>Customizing WordPress</h3>
<p>The PlayStation Blog is a design by <a href="http://hyku.com">Josh</a> that pulls influences directly from the <a href="http://www.us.playstation.com">main Sony PlayStation website</a>.</p>
<p><a href="http://blog.us.playstation.com"><img src='http://farm3.static.flickr.com/2326/2386045456_e870f70da2.jpg?v=1207253204' alt='PlayStation.Blog' /></a></p>
<p>Customizations on the theme include:</p>
<ul>
<li>The home page pulls in the two most recent posts in their entirety (or until the MORE tag is used) and then the next five entries as headline and excerpt.</li>
<li>The PS Blog requires users to have an account in order to comment on posts.  The wp-login.php page was completely re-skinned from the traditional WordPress login to match the site.</li>
<li>The registration process was customized to include an age gate.  In order to comment on the site you must be at least a certain age so we check for that (I can't tell you what age, then you'll just cheat the system).</li>
</ul>
<h3>Plugins We Used</h3>
<p>The great thing about WordPress and the community behind it is that in most instances if you want to do something, someone has already created a plugin for that.  In our case we have quite a few plugins at work on the PS Blog including:</p>
<ul>
<li><a href="http://www.1pixelout.net/code/audio-player-wordpress-plugin/">Audio Player</a> - Enjoy those <a href="http://blog.us.playstation.com/2007/08/13/the-lair-score-part-one/">soundtrack posts</a></li>
<li><a href="http://blue-anvil.com/">Wordpress Download Monitor</a> - Helps us track the number of downloads on the PS Blog Widgets.</li>
<li><a href="http://www.keyvan.net/code/paged-comments/">Paged Comments</a> - When posts easily get 300 comments the pages can have a tendency to get long.  We limit things down to 50 per page.</li>
<li><a href="http://lesterchan.net/portfolio/programming.php">WP-Post Rankings</a> - Great little AJAX plugin for letting users rate posts and pages on your blog.</li>
</ul>
<h3>Plugins We Developed</h3>
<p>Sometimes you need something and there isn&rsquo;t a plugin for it.  No problem, you develop a plugin to fill that need.  What&rsquo;s really great is when you have a group like the guys at Sony Computer Entertainment America (SCEA) who want to contribute back to the WordPress community and then release these plugins back for others:</p>
<ul>
<li><a href="http://cnpstudio.com/blog/image-rotator/">Image Rotator</a> &ndash; Adds the ability to insert a random image rotation panel into a WordPress blog.</li>
<li><a href="http://cnpstudio.com/blog/comment-replies/">Author Comment Replies</a> &ndash; Gives authors the ability to reply directly to a posted comment. Unlike threaded comments only authors can respond, not all visitors.</li>
</ul>
<h3>Maximizing Performance</h3>
<p>No matter the amount of traffic every blog can benefit from a caching plugin such as <a href="http://mnm.uib.es/gallir/wp-cache-2/">WP Cache</a> or <a href="http://1blogcacher.com">1 Blog Cacher</a>.  A site like the PlayStation Blog receives a constant high volume of traffic and the difference between using one of these caching plugins and not is incredible.</p>
<p>If you manage your own servers and are running WordPress then a <a href="http://2007.wordcamp.org/schedule/hyperdb-and-performance/">session on performance</a> at <a href="http://2007.wordcamp.org">last year's WordCamp</a> is a worthwhile watch.  <a href="http://barry.wordpress.com">Barry Abrahamson</a> and <a href="http://ma.tt">Matt Mullenweg</a> give great tips on topics such as opcode caching, WP Cache and HyperDB.  Watch it, learn it, and increase your blog's performance.</p>
<h3>My WordPress Wish</h3>
<p>In my perfect WordPress world, plugin developers will get together with developers of plugins that complement what they&rsquo;ve created and make them play nice together.  This may be happening out there more than I realize, so excuse me if this is, even better, let me know which plugins you're developing that work together.  I only bring this up because of two plugins we use on this blog that just don&rsquo;t play well together.  One would be a <a href="http://www.g-loaded.eu/2006/01/15/simple-recent-comments-wordpress-plugin/">recent comments plugin</a>, the other would be the <a href="http://www.keyvan.net/code/paged-comments/">comment paging plugin</a>.  I&rsquo;ve already written an <a href="http://cnpstudio.com/blog/2007/12/07/wordpress-paged-comments-plugin-recent-comments-in-the-sidebar-frustration/">extensive post about this</a> once before, so read more on my frustrations there.</p>
<h3>Just the Surface</h3>
<p>This really just scratches the surface of customizations on this blog.  If there&rsquo;s something specific that you&rsquo;d like to know more about let me know and I&rsquo;ll do my best to answer.  I hope to do more in-depth looks at some of our other projects here soon&hellip; time permitting.</p>
<img src="http://rss.cnpstudio.com/~r/cnpstudioblog/~4/264223274" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://cnpstudio.com/blog/2008/04/03/playstationblog-a-closer-look-at-the-wordpress-customizations/feed/</wfw:commentRss>
		<feedburner:origLink>http://cnpstudio.com/blog/2008/04/03/playstationblog-a-closer-look-at-the-wordpress-customizations/</feedburner:origLink></item>
		<item>
		<title>Breathe in… Now Release</title>
		<link>http://rss.cnpstudio.com/~r/cnpstudioblog/~3/263018947/</link>
		<comments>http://cnpstudio.com/blog/2008/04/02/breathe-in-now-release/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 01:33:51 +0000</pubDate>
		<dc:creator>nick</dc:creator>
		
		<category><![CDATA[New Site]]></category>

		<category><![CDATA[Social Media]]></category>

		<category><![CDATA[Who We Are]]></category>

		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[blogs]]></category>

		<category><![CDATA[ebay]]></category>

		<category><![CDATA[voce]]></category>

		<guid isPermaLink="false">http://cnpstudio.com/blog/2008/04/02/breathe-in-now-release/</guid>
		<description><![CDATA[OK, so I said we'd been MIA for a bit, busy on projects and whatnot and we're very excited about two coming in for a landing today.  I'll touch on that here in just a sec, but first something I've been neglecting to recognize&#8230;
WordPress Had Some Work Done
In the midst of the hustle we [...]]]></description>
			<content:encoded><![CDATA[<p>OK, so <a href="/blog/2008/03/28/whered-we-go/">I said we'd been MIA for a bit</a>, busy on projects and whatnot and we're very excited about two coming in for a landing today.  I'll touch on that here in just a sec, but first something I've been neglecting to recognize&hellip;</p>
<h3>WordPress Had Some Work Done</h3>
<p>In the midst of the hustle we skipped right over posting about the <a href="http://publisherblog.automattic.com/2008/03/31/wordpress-25-released/">release of WordPress 2.5</a>.  Kudos to <a href="http://automattic.com">Automattic</a> and <a href="http://happycog.com">Happy Cog</a> for the wonderful administration facelift.  Expect to see our full thoughts on the upgrade in a future post.</p>
<p>With the upgrade of WordPress the <a href="http://wordpress.org">WordPress.org</a> website also received an update.  A section of the homepage is dedicated to a rotation of companies with sites powered by WordPress.  I&rsquo;m very excited to say we have several of our projects in the rotation.  See below&hellip;</p>
<p><a href="http://flickr.com/photos/cnp_studio/2383872170/"><img src="http://farm4.static.flickr.com/3246/2383872170_dfa08ae2c0.jpg?v=0" alt="Hat Trick" /></a></p>
<p>That eBay logo is a new one for us&hellip; as this week we were able to launch the official <a href="http://ebayinkblog.com"> eBay Corporate Blog (eBay INK)</a> as well as the <a href="http://ebayinsiderblog.com">eBay Insider Blog</a> (both of which are cnp_studio/Voce joints).  The others &ndash; PlayStation (<a href="http://blog.us.playstation.com">PlayStation.Blog</a>) and Yahoo! (<a href="http://ycorpblog.com">Yodel Anecdotal</a>) are previous releases that continue to grow.  You can see more about each of those in the <a href="/portfolio">portfolio</a>.</p>
<img src="http://rss.cnpstudio.com/~r/cnpstudioblog/~4/263018947" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://cnpstudio.com/blog/2008/04/02/breathe-in-now-release/feed/</wfw:commentRss>
		<feedburner:origLink>http://cnpstudio.com/blog/2008/04/02/breathe-in-now-release/</feedburner:origLink></item>
		<item>
		<title>Where’d We Go?</title>
		<link>http://rss.cnpstudio.com/~r/cnpstudioblog/~3/259974993/</link>
		<comments>http://cnpstudio.com/blog/2008/03/28/whered-we-go/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 01:40:10 +0000</pubDate>
		<dc:creator>nick</dc:creator>
		
		<category><![CDATA[Who We Are]]></category>

		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[wordcampdallas2008]]></category>

		<guid isPermaLink="false">http://cnpstudio.com/blog/2008/03/28/whered-we-go/</guid>
		<description><![CDATA[Posting has been a bit light here lately.  We&#8217;ve had a jam-packed last several weeks and the exciting thing is that some big sites are in the home stretch.  Can't wait to share.
We've been doing even more with WordPress and as a result are finishing a few posts on the topics of security, [...]]]></description>
			<content:encoded><![CDATA[<p>Posting has been a bit light here lately.  We&rsquo;ve had a jam-packed last several weeks and the exciting thing is that some big sites are in the home stretch.  Can't wait to share.</p>
<p>We've been doing even more with WordPress and as a result are finishing a few posts on the topics of security, performance and scaling.  All three seem to be a recurring theme lately so it seems fitting.  Speaking of WordPress, <a href="http://dallas.wordcamp.org">WordCamp is this weekend out in Dallas</a>.  I won't be making it, but they say they&rsquo;ll make the videos available online a week or two after the fact.  In the mean time I'll watch the trackbacks on the <a href="http://dallas.wordcamp.org/schedule/">schedule pages</a> for anyone blogging the sessions.</p>
<p>We'll get the posting back to normal here soon.  Lots to talk about.</p>
<img src="http://rss.cnpstudio.com/~r/cnpstudioblog/~4/259974993" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://cnpstudio.com/blog/2008/03/28/whered-we-go/feed/</wfw:commentRss>
		<feedburner:origLink>http://cnpstudio.com/blog/2008/03/28/whered-we-go/</feedburner:origLink></item>
		<item>
		<title>Buzzwords Say It All</title>
		<link>http://rss.cnpstudio.com/~r/cnpstudioblog/~3/245030598/</link>
		<comments>http://cnpstudio.com/blog/2008/03/03/buzzwords-say-it-all/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 19:20:25 +0000</pubDate>
		<dc:creator>nick</dc:creator>
		
		<category><![CDATA[Random Stuff]]></category>

		<category><![CDATA[buzzwords]]></category>

		<category><![CDATA[crap]]></category>

		<guid isPermaLink="false">http://cnpstudio.com/blog/2008/03/03/buzzwords-say-it-all/</guid>
		<description><![CDATA[Recently I was talking with someone who threw out a few buzzwords which prompted all of us here to start reminiscing on some of our favorites.  You know, synergize, monetize, vertical, end-to-end... the list goes on really.  Well this prompted Mike to find this little gem, the Web Economy Bullshit Generator.
Be sure to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was talking with someone who threw out a few buzzwords which prompted <a href="/about/team">all of us here</a> to start reminiscing on some of our favorites.  You know, synergize, monetize, vertical, end-to-end... the list goes on really.  Well this prompted <a href="/about/team/mike">Mike</a> to find this little gem, the <a href="http://www.dack.com/web/bullshit.html">Web Economy Bullshit Generator</a>.</p>
<p>Be sure to save this.  You never know when you might get into a war of buzzwords with someone and need to "engage scalable web services."</p>
<img src="http://rss.cnpstudio.com/~r/cnpstudioblog/~4/245030598" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://cnpstudio.com/blog/2008/03/03/buzzwords-say-it-all/feed/</wfw:commentRss>
		<feedburner:origLink>http://cnpstudio.com/blog/2008/03/03/buzzwords-say-it-all/</feedburner:origLink></item>
		<item>
		<title>SQL Server Side Paging</title>
		<link>http://rss.cnpstudio.com/~r/cnpstudioblog/~3/243551945/</link>
		<comments>http://cnpstudio.com/blog/2008/02/29/sql-server-side-paging/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 21:46:21 +0000</pubDate>
		<dc:creator>mike</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://cnpstudio.com/blog/2008/02/29/sql-server-side-paging/</guid>
		<description><![CDATA[I was extremely excited about GridViews and DataGrids when I first started working with .NET.  The thought of having controls with built in paging and sorting just blew me away.  Needless to say, this excitement was short lived.  By the end of my first project in .NET, I found that this built [...]]]></description>
			<content:encoded><![CDATA[<p>I was extremely excited about GridViews and DataGrids when I first started working with .NET.  The thought of having controls with built in paging and sorting just blew me away.  Needless to say, this excitement was short lived.  By the end of my first project in .NET, I found that this built in sorting and paging had some major performance issues.  It was too much data to send back and forth between the web server and the SQL server; not to mention that .NET just isn't as optimized to sort that much data as fast as SQL Server.</p>
<p>The alternative was to have SQL Server sort and page the data and only send back the data that was needed to the web server.  After some research and some time to combine the ideas I found into my own solution I came up with:</p>
<pre class="sql">&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> PROCEDURE dbo.ReturnPage
<span style="color: #66cc66;">&#40;</span>
  @SelectStmt varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #808080; font-style: italic;">--Select Statement with Where Clause</span>
  @OrderBy varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #808080; font-style: italic;">--Order By Clause 'ASC' is required</span>
  @StartRow int, <span style="color: #808080; font-style: italic;">--First Row of Page</span>
  @EndRow int, <span style="color: #808080; font-style: italic;">--Last Row of Page</span>
  @totRows int output <span style="color: #808080; font-style: italic;">--Output: Total Rows in Set</span>
<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">AS</span>
&nbsp;
DECLARE @ColList varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2000</span><span style="color: #66cc66;">&#41;</span>
DECLARE @WhereCls varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2000</span><span style="color: #66cc66;">&#41;</span>
DECLARE @i int
DECLARE @i2 int
DECLARE @tmp varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span>
DECLARE @dec varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span>
DECLARE @f varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
DECLARE @d varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
DECLARE @Symbol char<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
DECLARE @SQL varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>
DECLARE @Sort varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span>
DECLARE @tmpSQL NVARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">--Assign the total number of rows available to @totRows for output</span>
<span style="color: #993333; font-weight: bold;">SET</span> @SQL = N<span style="color: #ff0000;">'SELECT @totRows = COUNT(*) FROM ('</span> + @SelectStmt + <span style="color: #ff0000;">') tbl'</span>
<span style="color: #993333; font-weight: bold;">SET</span> @tmpSQL = <span style="color: #ff0000;">''</span> + @SQL
EXEC sp_executesql  @tmpSQL , N<span style="color: #ff0000;">'@totRows int OUTPUT'</span>,
     @totRows = @totRows OUTPUT
&nbsp;
<span style="color: #993333; font-weight: bold;">SET</span> @Sort = @OrderBy + <span style="color: #ff0000;">', '</span>
<span style="color: #993333; font-weight: bold;">SET</span> @dec = <span style="color: #ff0000;">''</span>
<span style="color: #993333; font-weight: bold;">SET</span> @WhereCls  = <span style="color: #ff0000;">''</span>
<span style="color: #993333; font-weight: bold;">SET</span> @SQL = <span style="color: #ff0000;">''</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">SET</span> @i = charindex<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">','</span> , @Sort<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">--Pull apart the sort by clause for declarations</span>
WHILE <span style="color: #66cc66;">&#40;</span>@i != <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
BEGIN
  <span style="color: #993333; font-weight: bold;">SET</span> @tmp = <span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span>@Sort,@i<span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">SET</span> @i2 = charindex<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">' '</span>, @tmp<span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">SET</span> @f = ltrim<span style="color: #66cc66;">&#40;</span>rtrim<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span>@tmp,@i2<span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">SET</span> @d = ltrim<span style="color: #66cc66;">&#40;</span>rtrim<span style="color: #66cc66;">&#40;</span>substring<span style="color: #66cc66;">&#40;</span>@tmp,@i2<span style="color: #cc66cc;">+1</span>,<span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">SET</span> @Sort = rtrim<span style="color: #66cc66;">&#40;</span>ltrim<span style="color: #66cc66;">&#40;</span>substring<span style="color: #66cc66;">&#40;</span>@Sort,@i<span style="color: #cc66cc;">+1</span>,<span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">SET</span> @i = charindex<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">','</span>, @Sort<span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">SET</span> @symbol = case when @d = <span style="color: #ff0000;">'ASC'</span> then <span style="color: #ff0000;">'&gt;'</span> else <span style="color: #ff0000;">'&lt; '</span> end +
          case when @i=<span style="color: #cc66cc;">0</span> then <span style="color: #ff0000;">'='</span> else <span style="color: #ff0000;">''</span> end
&nbsp;
  <span style="color: #993333; font-weight: bold;">SET</span> @dec = @dec + <span style="color: #ff0000;">'declare @'</span> + @f + <span style="color: #ff0000;">' sql_variant; '</span>
  <span style="color: #993333; font-weight: bold;">SET</span> @ColList = isnull<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>@colList,<span style="color: #ff0000;">'&gt;'</span>,<span style="color: #ff0000;">'='</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #ff0000;">'&lt; '</span>,<span style="color: #ff0000;">'='</span><span style="color: #66cc66;">&#41;</span> +
    <span style="color: #ff0000;">' and '</span>,<span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span> + @f + @Symbol + <span style="color: #ff0000;">' @'</span> + @f
  <span style="color: #993333; font-weight: bold;">SET</span> @WhereCls = @WhereCls + <span style="color: #ff0000;">' OR ('</span> + @ColList + <span style="color: #ff0000;">') '</span>
  <span style="color: #993333; font-weight: bold;">SET</span> @SQL = @SQL + <span style="color: #ff0000;">', @'</span> + @f + <span style="color: #ff0000;">'= '</span> + @f
 END
&nbsp;
<span style="color: #808080; font-style: italic;">--Put together Transact SQL for final output</span>
<span style="color: #993333; font-weight: bold;">SET</span> @SQL = @dec + <span style="color: #ff0000;">' '</span> +
  <span style="color: #ff0000;">'SET ROWCOUNT '</span> + convert<span style="color: #66cc66;">&#40;</span>varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>, @StartRow<span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">'; '</span> +
  <span style="color: #ff0000;">'SELECT '</span> + substring<span style="color: #66cc66;">&#40;</span>@SQL,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">7000</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">' from ('</span>
  + @SelectStmt + <span style="color: #ff0000;">') a ORDER BY '</span> +  @OrderBy + <span style="color: #ff0000;">'; '</span> +
  <span style="color: #ff0000;">'SET ROWCOUNT '</span> +
  convert<span style="color: #66cc66;">&#40;</span>varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">1</span> + @EndRow - @StartRow<span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">'; '</span> +
  <span style="color: #ff0000;">'select * from ('</span> + @SelectStmt + <span style="color: #ff0000;">') a WHERE '</span> +
  substring<span style="color: #66cc66;">&#40;</span>@WhereCls,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">7000</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">' ORDER BY '</span> + @OrderBy +
  <span style="color: #ff0000;">'; SET ROWCOUNT 0;'</span>
&nbsp;
EXEC<span style="color: #66cc66;">&#40;</span>@SQL<span style="color: #66cc66;">&#41;</span>
GO
&nbsp;</pre>
<h2>What's it doing?</h2>
<p>The procedure works by turning a simple query like:
</pre>
<pre class="sql">&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span> col1, col2, col3, col4 <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> col1 <span style="color: #993333; font-weight: bold;">ASC</span>
&nbsp;</pre>
<p>and turning it into the following to add the paging.</p>
<pre class="sql">&nbsp;
DECLARE @col1 sql_variant
<span style="color: #993333; font-weight: bold;">SET</span> ROWCOUNT = @StartRow
<span style="color: #993333; font-weight: bold;">SELECT</span> @col1 = col1 <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> col1 <span style="color: #993333; font-weight: bold;">ASC</span>
<span style="color: #993333; font-weight: bold;">SET</span> ROWCOUNT = <span style="color: #66cc66;">&#40;</span>@EndRow - @StartRow<span style="color: #66cc66;">&#41;</span> + <span style="color: #cc66cc;">1</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> col1, col2, col3, col4 <span style="color: #993333; font-weight: bold;">FROM</span> tbl <span style="color: #993333; font-weight: bold;">WHERE</span> col1 &gt; @col1
  <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> col1 <span style="color: #993333; font-weight: bold;">ASC</span>
&nbsp;</pre>
<p>Simple enough right?</p>
<h2>Disclaimer</h2>
<p>While this procedure does work with more complex queries containing SUB-SELECTS, JOINS and WHERE clauses, it does have its limitations.  GROUP BY clauses do not work in this version.  Maybe in the future.  </p>
<p>I wouldn't suggest calling this procedure directly as that would mean you're building your query in-code, and probably not doing necessary escaping to prevent security issues.  Creating a stored procedure that builds the original query from passed in WHERE and ORDER BY Parameters and then calls the ReturnPage procedure will be much more efficient and secure.</p>
<p>I hope to post a complete sample that will illustrate the changes to the .NET code and the wrapping procedure soon.</p>
<img src="http://rss.cnpstudio.com/~r/cnpstudioblog/~4/243551945" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://cnpstudio.com/blog/2008/02/29/sql-server-side-paging/feed/</wfw:commentRss>
		<feedburner:origLink>http://cnpstudio.com/blog/2008/02/29/sql-server-side-paging/</feedburner:origLink></item>
		<item>
		<title>At Future of Web Apps (FOWA)</title>
		<link>http://rss.cnpstudio.com/~r/cnpstudioblog/~3/243288233/</link>
		<comments>http://cnpstudio.com/blog/2008/02/29/at-future-of-web-apps-fowa/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 12:13:35 +0000</pubDate>
		<dc:creator>nick</dc:creator>
		
		<category><![CDATA[Who We Are]]></category>

		<category><![CDATA[fowa]]></category>

		<category><![CDATA[miami]]></category>

		<guid isPermaLink="false">http://cnpstudio.com/blog/2008/02/29/at-future-of-web-apps-fowa/</guid>
		<description><![CDATA[After a late arrival to Miami last night, Josh and I are down here for Future of Web Apps today.

Rarely do I make it down to Miami, but this is the second time now within a month that I've been down here.  The last time was for some personal abuse, though.
]]></description>
			<content:encoded><![CDATA[<p>After a late arrival to Miami last night, <a href="http://hyku.com">Josh</a> and I are down here for <a href="http://www.futureofwebapps.com/">Future of Web Apps</a> today.</p>
<p><a href="http://www.futureofwebapps.com/"><img src='http://cnpstudio.com/blog/wp-content/uploads/2008/02/h1-02.gif' alt='Future of Web Apps' /></a></p>
<p>Rarely do I make it down to Miami, but this is the second time now within a month that I've been down here.  The last time was for some <a href="http://www.ingmiamimarathon.com/">personal abuse</a>, though.</p>
<img src="http://rss.cnpstudio.com/~r/cnpstudioblog/~4/243288233" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://cnpstudio.com/blog/2008/02/29/at-future-of-web-apps-fowa/feed/</wfw:commentRss>
		<feedburner:origLink>http://cnpstudio.com/blog/2008/02/29/at-future-of-web-apps-fowa/</feedburner:origLink></item>
		<item>
		<title>2008 Local Addy Awards</title>
		<link>http://rss.cnpstudio.com/~r/cnpstudioblog/~3/241505742/</link>
		<comments>http://cnpstudio.com/blog/2008/02/26/2008-local-addy-awards/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 03:41:30 +0000</pubDate>
		<dc:creator>nick</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Who We Are]]></category>

		<category><![CDATA[addys]]></category>

		<guid isPermaLink="false">http://cnpstudio.com/blog/2008/02/26/2008-local-addy-awards/</guid>
		<description><![CDATA[This past Friday everyone from the CNP offices attended the local Addy Awards banquet to see what kind of awards we would walk out with this year.  The Addy Awards are conducted by the American Advertising Federation and the local competition is the entry point to their national competition.  Awards are given across [...]]]></description>
			<content:encoded><![CDATA[<p>This past Friday everyone from the CNP offices attended the local <a href="http://www.aaf.org/default.asp?id=27">Addy Awards</a> banquet to see what kind of awards we would walk out with this year.  The Addy Awards are conducted by the <a href="http://aaf.org">American Advertising Federation</a> and the local competition is the entry point to their national competition.  Awards are given across a multitude of categories from printed newsletters to TV commercials, product packaging to web sites.</p>
<p><a href="http://www.flickr.com/photos/cnp_studio/2291693227/in/photostream/"><img border="0" src="http://farm4.static.flickr.com/3217/2291693227_dd4d041bae.jpg?v=0" alt="Addy Awards" /></a><br />
Photo by <a href="/about/team/sean">Sean</a></p>
<p>Basically, how it works is that we submit our best works from the previous year to the local competition and based on several criteria are awarded a gold award, silver award or nothing.  Anything that is awarded a gold at the local level is then sent on to the state competition for the next round.  I'm pleased to say that at this year's competition we had four of our submissions receive gold and they will move on to the next level.  They were:</p>
<p>cnp_studio (one gold for the web site, one gold for our logo/stationery/business cards)</p>
<p><a href="http://www.flickr.com/photos/cnp_studio/2293963990/"><img border="0" src="http://farm3.static.flickr.com/2376/2293963990_2a6f0ddd38.jpg?v=0" alt="cnp_studio Web site" /></a></p>
<p>SeaWorld Journey to Atlantis</p>
<p><a href="http://www.flickr.com/photos/cnp_studio/2293177287/in/photostream/"><img border="0" src="http://farm3.static.flickr.com/2019/2293177287_47cf9c7343.jpg?v=0" alt="SeaWorld Journey to Atlantis" /></a></p>
<p>Kelly Homes</p>
<p><a href="http://www.flickr.com/photos/cnp_studio/2293177387/in/photostream/"><img border="0" src="http://farm3.static.flickr.com/2070/2293177387_04055636fd.jpg?v=0" alt="Kelly Homes Web Site" /></a></p>
<p>The award on the Kelly Homes site is bittersweet.  We're glad the site did well, but sadly the entire site design as well as the HTML and CSS behind the site were completely copied and used by someone who thought it was OK to do such a thing.  Expect to see more on this <del>in another post</del> <a href="http://cnpstudio.com/blog/2008/02/26/bmw-marketing-consultants-ripped-off-our-work/">here</a>.</p>
<p>Sites receiving silver awards include <a href="/portfolio/girl-scouts-west-central-florida">Girl Scouts of West Central Florida</a>, <a href="/portfolio/polktpo">Polk Transportation Planning Organization</a>, <a href="/portfolio/true-demand-software">TrueDemand Software</a> and <a href="/portfolio/heacock-classic">Heacock Classic Car Insurance</a>.</p>
<p>All of this is a result of the hard work of an all star team (<a href="/about/team/mike">Mike</a>, <a href="/about/team/pete">Pete</a>, <a href="/about/team/sean">Sean</a>, <a href="http://lazcreative.com">Jeremy</a>) and our great <a href="/portfolio">clients</a>.</p>
<img src="http://rss.cnpstudio.com/~r/cnpstudioblog/~4/241505742" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://cnpstudio.com/blog/2008/02/26/2008-local-addy-awards/feed/</wfw:commentRss>
		<feedburner:origLink>http://cnpstudio.com/blog/2008/02/26/2008-local-addy-awards/</feedburner:origLink></item>
		<item>
		<title>BMW Marketing Consultants Ripped Off Our Work</title>
		<link>http://rss.cnpstudio.com/~r/cnpstudioblog/~3/241840610/</link>
		<comments>http://cnpstudio.com/blog/2008/02/26/bmw-marketing-consultants-ripped-off-our-work/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 12:26:32 +0000</pubDate>
		<dc:creator>sean</dc:creator>
		
		<category><![CDATA[Rants]]></category>

		<category><![CDATA[Who We Are]]></category>

		<guid isPermaLink="false">http://cnpstudio.com/blog/2008/02/26/bmw-marketing-consultants-ripped-off-our-work/</guid>
		<description><![CDATA[This really just makes me sick to my stomach and at the same time, angry enough to rip the head off a Chia Pet. BMW Marketing Consultants ripped off our work - pretty much in its entirety.
When developing the Kelly Homes site, we worked with Bonnie Williams of BMW Marketing Consultants. The project, under careless [...]]]></description>
			<content:encoded><![CDATA[<p>This really just makes me sick to my stomach and at the same time, angry enough to rip the head off a <a href="http://en.wikipedia.org/wiki/Chia_Pet">Chia Pet</a>. BMW Marketing Consultants ripped off our work - pretty much in its entirety.</p>
<p>When developing the <a href="http://kellyhomes.biz">Kelly Homes site</a>, we worked with Bonnie Williams of BMW Marketing Consultants. The project, under careless misdirection and disregard for the cost that Kelly Homes was footing, took a 2 month timeline and turned it into more than 6 months.</p>
<p>Months later, we received an RFP from BMW Marketing Consultants for the <a href="http://www.silverpalmsrv.com">Silver Palms RV Resort site</a>. The RFP was a spiral-bound book that rivaled the thickness of the phone book for Vermont. </p>
<p>We sent out a quote, and never heard back from BMW Marketing Consultants. A few weeks ago, I was reminded about this when I found this "book" during our <a href="http://cnpstudio.com/blog/2008/01/23/weve-moved/">move to our new office</a>. Curious to see what happened with the project, I decided to pull up the site. </p>
<p>Lo' and behold:</p>
<p><img src='http://cnpstudio.com/blog/wp-content/uploads/2008/02/silverpalms-ripoff.jpg' alt='Silver Palms Ripoff 1' /><br />
Funny, guess they couldn't find their "own place in the sun"</p>
<p><img src='http://cnpstudio.com/blog/wp-content/uploads/2008/02/kellyhomes-22608.jpg' alt='Kelly Homes' /><br />
Kelly Homes</p>
<p>The CSS, HTML, and most of the images were ripped off. If you pay close attention, you can even see some images were not completely ripped off.</p>
<div style="text-align: center;">
<img src='http://cnpstudio.com/blog/wp-content/uploads/2008/02/silverpalmsrv-ripoff3.jpg' alt='Silver Palms Ripoff 3' /></div>
<p>Note the beige/orange color from the Kelly Homes site on the left edge of the banner image).</p>
<p>BMW's response? Well, from what I hear, the response was "well all sites on the internet are <em>templates</em> and can be copied." One of my favorite articles about this subject is <a href="http://www.airbagindustries.com/archives/airbag/scab.php">Scab</a> at Airbag Industries regarding the <a href="http://joyent.com">Joyent</a> / <a href="http://corkd.com/">Corkd</a> design theft. Talking about Ray from Falkner Winery, the company that ripped off the designs&hellip;</p>
<blockquote><p>
Ray continued to tell me that all designers borrow ideas from other designers and that his web site design was no different. That line of thinking is the biggest cop-out, bullshit excuse (can't think of a more appropriate term) used over and over by those who simply don't care about how this affects the person who's work has been copied.<br />
&hellip;<br />
A real designer does not cut-and-paste the work of others, change some colors and resell it &hellip; that would be called a hack. The web is filled with hacks because the web makes it easy to hack. Hacks have about as much talent as the guys who "create" stickers at mall kiosks typically featuring Calvin either pissing on an auto manufacturer's logo or praying before a cross.
</p></blockquote>
<p>Couldn't agree more. Granted, I did not design this site - but I feel the same way about the months of work I put into it. I know <a href="http://lazcreative.com">Jeremy</a> feels the same way.</p>
<p>No one wants their hard worked ripped off. Least of all, by the <del>company</del> hack that sends you the RFP for the project. </p>
<p>More to come&hellip;</p>
<p><strong>Update:</strong> Googling "bmw marketing consultants" wields this post as the 2nd hit... got to love the Google juice, eh <a href="http://hyku.com/blog">Hallett</a>?... </p>
<p><img src='http://cnpstudio.com/blog/wp-content/uploads/2008/02/bmwmarketing-googlejuice.gif' alt='BMW Marketing Consultants Google Juice' /></p>
<img src="http://rss.cnpstudio.com/~r/cnpstudioblog/~4/241840610" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://cnpstudio.com/blog/2008/02/26/bmw-marketing-consultants-ripped-off-our-work/feed/</wfw:commentRss>
		<feedburner:origLink>http://cnpstudio.com/blog/2008/02/26/bmw-marketing-consultants-ripped-off-our-work/</feedburner:origLink></item>
	</channel>
</rss>
