<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ebeworld's Weblog &#187; Uncategorized</title>
	<atom:link href="http://ebeworld.wordpress.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://ebeworld.wordpress.com</link>
	<description>Trying to create</description>
	<lastBuildDate>Wed, 09 Dec 2009 19:33:44 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='ebeworld.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/cbd4023a12f78275f1676e6f81eb8a20?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Ebeworld's Weblog &#187; Uncategorized</title>
		<link>http://ebeworld.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ebeworld.wordpress.com/osd.xml" title="Ebeworld&#8217;s Weblog" />
		<item>
		<title>Chrome bookmark bar disappear/reappear</title>
		<link>http://ebeworld.wordpress.com/2009/12/09/chrome-bookmark-bar-disappearreappear/</link>
		<comments>http://ebeworld.wordpress.com/2009/12/09/chrome-bookmark-bar-disappearreappear/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 19:33:44 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/?p=222</guid>
		<description><![CDATA[Solution is Ctrl+B.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=222&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Solution is Ctrl+B.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/222/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=222&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2009/12/09/chrome-bookmark-bar-disappearreappear/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>Paging in query.</title>
		<link>http://ebeworld.wordpress.com/2009/12/07/paging-in-query/</link>
		<comments>http://ebeworld.wordpress.com/2009/12/07/paging-in-query/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 17:16:04 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/?p=219</guid>
		<description><![CDATA[I was just wondering how to write paging functionality embedded in T-SQL.  Immediate google search resulted ROW_NUMBER() function, of which simple use is
SELECT  Description, Date
FROM     (SELECT  ROW_NUMBER() OVER (ORDER BY Date DESC)
             AS Row, Description, Date FROM [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=219&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was just wondering how to write paging functionality embedded in T-SQL.  Immediate google search resulted ROW_NUMBER() function, of which simple use is</p>
<pre>SELECT  Description, Date
FROM     (SELECT  ROW_NUMBER() OVER (ORDER BY Date DESC)
             AS Row, Description, Date FROM LOG)
            AS LogWithRowNumbers
WHERE  Row &gt;= 1 AND Row &lt;= 10</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/219/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=219&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2009/12/07/paging-in-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>JSONPath</title>
		<link>http://ebeworld.wordpress.com/2009/08/11/jsonpath/</link>
		<comments>http://ebeworld.wordpress.com/2009/08/11/jsonpath/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 14:45:46 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/?p=216</guid>
		<description><![CDATA[As shown below, Json is a bit cumbersome to work with and specially when user query it, they have to go through a sort of DFS. Look at http://goessner.net/articles/JsonPath/, where Stephen Goessner developed JSONPath which is analogy of XPath for JSON. Remembering, JSON is a native for javascript and more compact, JSONPath is a good [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=216&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As shown below, Json is a bit cumbersome to work with and specially when user query it, they have to go through a sort of DFS. Look at <a href="http://goessner.net/articles/JsonPath/">http://goessner.net/articles/JsonPath/</a>, where Stephen Goessner developed JSONPath which is analogy of XPath for JSON. Remembering, JSON is a native for javascript and more compact, JSONPath is a good idea.</p>
<p>{ <span>&#8220;book&#8221;</span>: [<br />
      { <span>"category"</span>: <span>"reference"</span>,<br />
        <span>"author"</span>: <span>"Nigel Rees"</span>,<br />
        <span>"title"</span>: <span>"Sayings of the Century"</span>,<br />
        <span>"price"</span>: 8.95<br />
      },<br />
      { <span>"category"</span>: <span>"fiction"</span>,<br />
        <span>"author"</span>: <span>"Evelyn Waugh"</span>,<br />
        <span>"title"</span>: <span>"Sword of Honour"</span>,<br />
        <span>"price"</span>: 12.99 }, { <span>"category"</span>: <span>"fiction"</span>,<br />
        <span>"author"</span>: <span>"Herman Melville"</span>,<br />
        <span>"title"</span>: <span>"Moby Dick"</span>,<br />
        <span>"isbn"</span>: <span>"0-553-21311-3"</span>,<br />
        <span>"price"</span>: 8.99<br />
      },<br />
      { <span>"category"</span>: <span>"fiction"</span>,<br />
        <span>"author"</span>: <span>"J. R. R. Tolkien"</span>,<br />
        <span>"title"</span>: <span>"The Lord of the Rings"</span>,<br />
        <span>"isbn"</span>: <span>"0-395-19395-8"</span>,<br />
        <span>"price"</span>: 22.99<br />
      }<br />
    ],<br />
    <span>&#8220;bicycle&#8221;</span>: {<br />
      <span>&#8220;color&#8221;</span>: <span>&#8220;red&#8221;</span>,<br />
      <span>&#8220;price&#8221;</span>: 19.95<br />
    }<br />
  }</p>
<p>JSONPath expression</p>
<p> </p>
<table style="width:40.5em;" border="0">
<tbody>
<tr>
<td><strong>XPath</strong></td>
<td><strong>JSONPath</strong></td>
<td><strong>Result</strong></td>
</tr>
<tr>
<td><code>/store/book/author</code></td>
<td><code>$.store.book[*].author</code></td>
<td>the authors of all books in the store</td>
</tr>
<tr>
<td><code>//author</code></td>
<td><code>$..author</code></td>
<td>all authors</td>
</tr>
<tr>
<td><code>/store/*</code></td>
<td><code>$.store.*</code></td>
<td>all things in store, which are some books and a red bicycle.</td>
</tr>
<tr>
<td><code>/store//price</code></td>
<td><code>$.store..price</code></td>
<td>the price of everything in the store.</td>
</tr>
<tr>
<td><code>//book[3]</code></td>
<td><code>$..book[2]</code></td>
<td>the third book</td>
</tr>
<tr>
<td><code>//book[last()]</code></td>
<td><code>$..book[(@.length-1)]</code><br />
<code>$..book[-1:]</code></td>
<td>the last book in order.</td>
</tr>
<tr>
<td><code>//book[position()&lt;3]</code></td>
<td><code>$..book[0,1]</code><br />
<code>$..book[:2]</code></td>
<td>the first two books</td>
</tr>
<tr>
<td><code>//book[isbn]</code></td>
<td><code>$..book[?(@.isbn)]</code></td>
<td>filter all books with isbn number</td>
</tr>
<tr>
<td><code>//book[price&lt;10]</code></td>
<td><code>$..book[?(@.price&lt;10)]</code></td>
<td>filter all books cheapier than 10</td>
</tr>
<tr>
<td><code>//*</code></td>
<td><code>$..*</code></td>
<td>all Elements in XML document. All members of JSON structure.</td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=216&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2009/08/11/jsonpath/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>Hard prob</title>
		<link>http://ebeworld.wordpress.com/2009/07/24/hard-prob/</link>
		<comments>http://ebeworld.wordpress.com/2009/07/24/hard-prob/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 20:59:25 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/?p=214</guid>
		<description><![CDATA[



Problem Statement




You have a rectangular piece of paper that&#8217;s divided into 1&#215;1 cells, each of which has an integer value. The paper will be described by a vector &#60;string&#62; paper. The ith element of paper will be a space delimited list of integers, where the jth integer of the ith element of paper represents the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=214&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><table border="0">
<tbody>
<tr>
<td style="font-size:12px;" colspan="2">
<h3 style="font-size:1.2em;">Problem Statement</h3>
</td>
</tr>
<tr>
<td style="font-size:12px;"></td>
<td style="font-size:12px;">You have a rectangular piece of paper that&#8217;s divided into 1&#215;1 cells, each of which has an integer value. The paper will be described by a vector &lt;string&gt;<span> </span><strong>paper</strong>. The<span> </span><em>i</em>th element of<span> </span><strong>paper</strong><span> </span>will be a space delimited list of integers, where the<span> </span><em>j</em>th integer of the<span> </span><em>i</em>th element of<span> </span><strong>paper</strong><span> </span>represents the value of the<span> </span><em>j</em>th cell of the<span> </span><em>i</em>th row of the paper.</p>
<p>You want to perform a sequence of folds on the paper, where you may fold anywhere along an axis that is in between two rows or columns of the paper. After performing a fold, we wish to model the folded paper as a new, flat piece of paper. We will do this by considering two overlapping cells as a single cell, with a value that is the sum of the individual cells.</p>
<p>You wish to perform a sequence of folds such that the value of some single cell in the resulting piece of paper is as large as possible. Return this value.</td>
</tr>
<tr>
<td style="font-size:12px;" colspan="2">
<h3 style="font-size:1.2em;">Definition</h3>
</td>
</tr>
<tr>
<td style="font-size:12px;"></td>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">Class:</td>
<td style="font-size:12px;">FoldThePaper</td>
</tr>
<tr>
<td style="font-size:12px;">Method:</td>
<td style="font-size:12px;">getValue</td>
</tr>
<tr>
<td style="font-size:12px;">Parameters:</td>
<td style="font-size:12px;">vector &lt;string&gt;</td>
</tr>
<tr>
<td style="font-size:12px;">Returns:</td>
<td style="font-size:12px;">int</td>
</tr>
<tr>
<td style="font-size:12px;">Method signature:</td>
<td style="font-size:12px;">int getValue(vector &lt;string&gt; paper)</td>
</tr>
<tr>
<td style="font-size:12px;" colspan="2">(be sure your method is public)</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:12px;"></td>
</tr>
<tr>
<td style="font-size:12px;"></td>
</tr>
<tr>
<td style="font-size:12px;" colspan="2">
<h3 style="font-size:1.2em;">Constraints</h3>
</td>
</tr>
<tr>
<td style="font-size:12px;" align="center" valign="top">-</td>
<td style="font-size:12px;"><strong>paper</strong><span> </span>will contain between 1 and 12 elements, inclusive.</td>
</tr>
<tr>
<td style="font-size:12px;" align="center" valign="top">-</td>
<td style="font-size:12px;">Each element of<span> </span><strong>paper</strong><span> </span>will be a single-space delimited list of integers with no leading or trailing spaces.</td>
</tr>
<tr>
<td style="font-size:12px;" align="center" valign="top">-</td>
<td style="font-size:12px;">Each element of<span> </span><strong>paper</strong><span> </span>will contain between 1 and 12 integers, inclusive.</td>
</tr>
<tr>
<td style="font-size:12px;" align="center" valign="top">-</td>
<td style="font-size:12px;">Each element of<span> </span><strong>paper</strong><span> </span>will contain the same number of integers.</td>
</tr>
<tr>
<td style="font-size:12px;" align="center" valign="top">-</td>
<td style="font-size:12px;">Each element of<span> </span><strong>paper</strong><span> </span>will contain between 1 and 50 characters, inclusive.</td>
</tr>
<tr>
<td style="font-size:12px;" align="center" valign="top">-</td>
<td style="font-size:12px;">Each integer in<span> </span><strong>paper</strong><span> </span>will be between -100 and 100, inclusive.</td>
</tr>
<tr>
<td style="font-size:12px;" align="center" valign="top">-</td>
<td style="font-size:12px;">Each integer in<span> </span><strong>paper</strong><span> </span>will have no leading zeros.</td>
</tr>
<tr>
<td style="font-size:12px;" align="center" valign="top">-</td>
<td style="font-size:12px;">An integer in<span> </span><strong>paper</strong><span> </span>equal to zero will not have a preceding negative sign.</td>
</tr>
<tr>
<td style="font-size:12px;" colspan="2">
<h3 style="font-size:1.2em;">Examples</h3>
</td>
</tr>
<tr>
<td style="font-size:12px;" align="center">0)</td>
<td style="font-size:12px;"></td>
</tr>
<tr>
<td style="font-size:12px;"></td>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">
<pre style="font-size:1em;margin:0 0 0 22px;">{
"1 1 1",
"1 1 1"
}</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:12px;">
<pre style="font-size:1em;margin:0 0 0 22px;">Returns: 6</pre>
</td>
</tr>
<tr>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;" colspan="2">We can collapse every cell onto the upper-left cell.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:12px;" align="center">1)</td>
<td style="font-size:12px;"></td>
</tr>
<tr>
<td style="font-size:12px;"></td>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">
<pre style="font-size:1em;margin:0 0 0 22px;">{
"1 -1",
"1 -1"
}</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:12px;">
<pre style="font-size:1em;margin:0 0 0 22px;">Returns: 2</pre>
</td>
</tr>
<tr>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;" colspan="2">We should perform only the fold between the two rows, and take the resulting left column.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:12px;" align="center">2)</td>
<td style="font-size:12px;"></td>
</tr>
<tr>
<td style="font-size:12px;"></td>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">
<pre style="font-size:1em;margin:0 0 0 22px;">{
"1 -1 -1 1",
"-1 -1 -1 -1",
"-1 -1 -1 -1",
"1 -1 -1 1"
}</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:12px;">
<pre style="font-size:1em;margin:0 0 0 22px;">Returns: 4</pre>
</td>
</tr>
<tr>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;" colspan="2">Folding between the middle rows then the middle columns allows us to combine the four corner cells.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:12px;" align="center">3)</td>
<td style="font-size:12px;"></td>
</tr>
<tr>
<td style="font-size:12px;"></td>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">
<pre style="font-size:1em;margin:0 0 0 22px;">{
"20 13 -2 100",
"-12 0 4 -3",
"4 1 -36 21"
}</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:12px;">
<pre style="font-size:1em;margin:0 0 0 22px;">Returns: 131</pre>
</td>
</tr>
<tr>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;" colspan="2"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:12px;" align="center">4)</td>
<td style="font-size:12px;"></td>
</tr>
<tr>
<td style="font-size:12px;"></td>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;">
<pre style="font-size:1em;margin:0 0 0 22px;">{
"0"
}</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="font-size:12px;">
<pre style="font-size:1em;margin:0 0 0 22px;">Returns: 0</pre>
</td>
</tr>
<tr>
<td style="font-size:12px;">
<table border="0">
<tbody>
<tr>
<td style="font-size:12px;" colspan="2"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p><span style="font-family:Verdana;font-size:13px;"></p>
<p style="margin:0 0 14px;">This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.</p>
<p></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/214/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=214&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2009/07/24/hard-prob/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple prob</title>
		<link>http://ebeworld.wordpress.com/2009/07/24/simple-prob/</link>
		<comments>http://ebeworld.wordpress.com/2009/07/24/simple-prob/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 20:46:21 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/?p=212</guid>
		<description><![CDATA[Problem Statement
There is nothing more beautiful than just an integer number.
You are given an integer n. Write down n in decimal notation with no leading zeroes, and let M be the number of written digits. Perform the following operation exactly k times:
Choose two different 1-based positions, i and j, such that 1 &#60;= i &#60; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=212&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Problem Statement</p>
<p>There is nothing more beautiful than just an integer number.<br />
You are given an integer n. Write down n in decimal notation with no leading zeroes, and let M be the number of written digits. Perform the following operation exactly k times:<br />
Choose two different 1-based positions, i and j, such that 1 &lt;= i &lt; j &lt;= M. Swap the digits at positions i and j. This swap must not cause the resulting number to have a leading zero, i.e., if the digit at position j is zero, then i must be strictly greater than 1.<br />
Return the maximal possible number you can get at the end of this procedure. If it&#8217;s not possible to perform k operations, return -1 instead.<br />
Definition</p>
<p>Class:<br />
TheSwap<br />
Method:<br />
findMax<br />
Parameters:<br />
int, int<br />
Returns:<br />
int<br />
Method signature:<br />
int findMax(int n, int k)<br />
(be sure your method is public)</p>
<p>Constraints<br />
-<br />
n will be between 1 and 1,000,000, inclusive.<br />
-<br />
k will be between 1 and 10, inclusive.<br />
Examples<br />
0)</p>
<p>16375<br />
1<br />
Returns: 76315<br />
The optimal way is to swap 1 and 7.<br />
1)</p>
<p>432<br />
1<br />
Returns: 423<br />
In this case the result is less than the given number.<br />
2)</p>
<p>90<br />
4<br />
Returns: -1<br />
We can&#8217;t make even a single operation because it would cause the resulting number to have a leading zero.<br />
3)</p>
<p>5<br />
2<br />
Returns: -1<br />
Here we can&#8217;t choose two different positions for an operation.<br />
4)</p>
<p>436659<br />
2<br />
Returns: 966354</p>
<p>This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/212/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=212&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2009/07/24/simple-prob/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>Good finmath books</title>
		<link>http://ebeworld.wordpress.com/2009/04/27/good-finmath-books/</link>
		<comments>http://ebeworld.wordpress.com/2009/04/27/good-finmath-books/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 01:07:00 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/?p=209</guid>
		<description><![CDATA[Theory of financial risk and derivative pricing
 Modeling Derivatives in C++ 
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=209&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h2 class="title">Theory of financial risk and derivative pricing</h2>
<h2 class="title"> <span>Modeling Derivatives in C++ </span></h2>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/209/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=209&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2009/04/27/good-finmath-books/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>Fast insert</title>
		<link>http://ebeworld.wordpress.com/2009/04/20/fast-insert/</link>
		<comments>http://ebeworld.wordpress.com/2009/04/20/fast-insert/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 20:28:08 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/?p=206</guid>
		<description><![CDATA[Because of locking and serialization, plus logging inserting once is much more faster than inserting by loop. Here i have tested it using CTE
WITH 
 
 
 
&#8211; second CTE which returns 100 million rows by using
 
&#8211; a CROSS JOIN on the first CTE 
, dig AS (
SELECT
(millions.Number * 1000000)
+ (hThousands.Number * 100000)
+ (tThousands.Number * 10000)
+ (thousands.Number * 1000)
+ (hundreds.Number [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=206&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Because of locking and serialization, plus logging inserting once is much more faster than inserting by loop. Here i have tested it using CTE</p>
<p><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">WITH<span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"> </p>
<p></span></span></span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"> </p>
<p></span></span></span></span> </p>
<p><span style="font-size:x-small;"> </p>
<p></span><span style="color:#008000;font-size:x-small;"><span style="color:#008000;font-size:x-small;">&#8211; second CTE which returns 100 million rows by using</span></span></p>
<p><span style="font-size:x-small;"> </p>
<p></span><span style="color:#008000;font-size:x-small;"><span style="color:#008000;font-size:x-small;">&#8211; a CROSS JOIN on the first CTE</span></span> </p>
<p><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">,</span></span><span style="font-size:x-small;"> dig </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS </span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(<br />
</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT<br />
</span></span><span style="color:#0000ff;font-size:x-small;"></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(</span></span><span style="font-size:x-small;">millions</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">Number </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">*</span></span><span style="font-size:x-small;"> 1000000</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)<br />
</span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">+</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"> </span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(</span></span><span style="font-size:x-small;">hThousands</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">Number </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">*</span></span><span style="font-size:x-small;"> 100000</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)<br />
</span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">+</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"> </span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(</span></span><span style="font-size:x-small;">tThousands</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">Number </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">*</span></span><span style="font-size:x-small;"> 10000</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)<br />
</span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">+</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"> </span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(</span></span><span style="font-size:x-small;">thousands</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">Number </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">*</span></span><span style="font-size:x-small;"> 1000</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)<br />
</span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">+</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"> </span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(</span></span><span style="font-size:x-small;">hundreds</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">Number </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">*</span></span><span style="font-size:x-small;"> 100</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)<br />
</span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">+</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"> </span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(</span></span><span style="font-size:x-small;">tens</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">Number </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">*</span></span><span style="font-size:x-small;"> 10</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)<br />
</span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">+</span></span><span style="font-size:x-small;"> ones</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">Number </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS</span></span><span style="font-size:x-small;"> Number<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">FROM</span></span><span style="font-size:x-small;"> digits </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS</span></span><span style="font-size:x-small;"> ones<br />
</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">CROSS</span></span><span style="font-size:x-small;"> </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">JOIN</span></span><span style="font-size:x-small;"> digits </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS </span></span><span style="font-size:x-small;">tens<br />
</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">CROSS</span></span><span style="font-size:x-small;"> </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">JOIN</span></span><span style="font-size:x-small;"> digits </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS </span></span><span style="font-size:x-small;"> hundreds<br />
</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">CROSS</span></span><span style="font-size:x-small;"> </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">JOIN</span></span><span style="font-size:x-small;"> digits </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS </span></span><span style="font-size:x-small;"> thousands<br />
</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">CROSS</span></span><span style="font-size:x-small;"> </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">JOIN</span></span><span style="font-size:x-small;"> digits </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS</span></span><span style="font-size:x-small;"> tThousands<br />
</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">CROSS</span></span><span style="font-size:x-small;"> </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">JOIN</span></span><span style="font-size:x-small;"> digits </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS</span></span><span style="font-size:x-small;"> hThousands<br />
</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">CROSS</span></span><span style="font-size:x-small;"> </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">JOIN</span></span><span style="font-size:x-small;"> digits </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS</span></span><span style="font-size:x-small;"> millions<br />
</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)</span></span></p>
<p><span style="font-size:x-small;"> </span><span style="color:#008000;font-size:x-small;"><span style="color:#008000;font-size:x-small;">&#8211; Third CTE which generates a &#8220;number&#8221;. repeated after 50M </span></span></p>
<p> </p>
<p><span style="font-size:x-small;"> </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">,</span></span><span style="font-size:x-small;"> nums </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS </span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(<br />
</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> number<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">FROM</span></span><span style="font-size:x-small;"> dig<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">WHERE</span></span><span style="font-size:x-small;"> number </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">&lt;</span></span><span style="font-size:x-small;">5000000<br />
</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)</span></span></p>
<p> </p>
<p><span style="font-size:x-small;"> </p>
<p></span><span style="color:#008000;font-size:x-small;"><span style="color:#008000;font-size:x-small;">&#8211; the insert statement goes here</span></span></p>
<p><span style="font-size:x-small;"> </p>
<p></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">INSERT</span></span><span style="font-size:x-small;"> Test</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">dbo</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">PerformanceTester</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"> </span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(</span></span><span style="font-size:x-small;">col1</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">,</span></span><span style="font-size:x-small;">col2</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">,</span></span><span style="font-size:x-small;">col3</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)<br />
</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> number</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">,</span></span><span style="font-size:x-small;">number</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">,</span></span><span style="font-size:x-small;"> number<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">FROM </span></span><span style="font-size:x-small;"> nums</span></p>
<p> and performance gain is more than 40 times. Cool.  but this query is bound to memory and if we try to increase 5M to 50M, will complain about revising long running transactions. My trick to this is</p>
<p><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">insert <span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"> </p>
<p></span></span></span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"> </p>
<p></span></span></span></span> </p>
<p><span style="font-size:x-small;">which basically doubles size of the table by 2 much faster.</span></p>
<p></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">into</span></span><span style="font-size:x-small;"> Test</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">dbo</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">PerformanceTester</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(</span></span><span style="font-size:x-small;">col1</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">,</span></span><span style="font-size:x-small;">col2</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">,</span></span><span style="font-size:x-small;">col3</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)<br />
</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">select</span></span><span style="font-size:x-small;"> col1</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">,</span></span><span style="font-size:x-small;">col2</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">,</span></span><span style="font-size:x-small;">col3 </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">from</span></span><span style="font-size:x-small;"> Test</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">dbo</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="font-size:x-small;">PerformanceTester</span></p>
<p></span><span style="color:#008000;font-size:x-small;"><span style="color:#008000;font-size:x-small;">&#8211; first CTE which returns 10 rows (0-9)<br />
</span></span><span style="font-size:x-small;">digits </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">AS </span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">(<br />
</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> 0 </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">as </span></span><span style="font-size:x-small;"> Number<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">UNION</span></span><span style="font-size:x-small;"> </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> 1<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">UNION</span></span><span style="font-size:x-small;"> </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> 2<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">UNION</span></span><span style="font-size:x-small;"> </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> 3<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">UNION</span></span><span style="font-size:x-small;"> </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> 4<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">UNION</span></span><span style="font-size:x-small;"> </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> 5<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">UNION</span></span><span style="font-size:x-small;"> </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> 6<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">UNION</span></span><span style="font-size:x-small;"> </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> 7<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">UNION</span></span><span style="font-size:x-small;"> </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> 8<br />
</span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">UNION</span></span><span style="font-size:x-small;"> </span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">SELECT</span></span><span style="font-size:x-small;"> 9<br />
</span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">)</span></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/206/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=206&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2009/04/20/fast-insert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server: How to get all table columns?</title>
		<link>http://ebeworld.wordpress.com/2009/04/17/sql-server-how-to-get-all-table-columns/</link>
		<comments>http://ebeworld.wordpress.com/2009/04/17/sql-server-how-to-get-all-table-columns/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 21:13:57 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/?p=202</guid>
		<description><![CDATA[select column_name 
from information_schema.columns
where table_name = &#8217;my_table_name&#8217; 
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=202&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">select </span></span></span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;"><span style="font-size:x-small;">column_name<span style="font-size:x-small;"> <br />
</span></span></span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">from</span></span><span style="font-size:x-small;"> </span><span style="color:#008000;font-size:x-small;"><span style="color:#008000;font-size:x-small;">information_schema</span></span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">.</span></span><span style="color:#008000;font-size:x-small;"><span style="color:#008000;font-size:x-small;">columns<br />
</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">where</span></span><span style="font-size:x-small;"> table_name </span><span style="color:#808080;font-size:x-small;"><span style="color:#808080;font-size:x-small;">=</span></span><span style="font-size:x-small;"> &#8217;my_table_name&#8217;</span><span style="color:#ff0000;font-size:x-small;"><span style="color:#ff0000;font-size:x-small;"> </span></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/202/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=202&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2009/04/17/sql-server-how-to-get-all-table-columns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>Dependency Injection</title>
		<link>http://ebeworld.wordpress.com/2009/04/04/dependency-injection/</link>
		<comments>http://ebeworld.wordpress.com/2009/04/04/dependency-injection/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 15:52:30 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/2009/04/04/dependency-injection/</guid>
		<description><![CDATA[A object holds reference to certain interface and object, therefore by setting it  is a way of injecting dependency. Really simple example at http://en.wikipedia.org/wiki/Dependency_injection.
It is somehow related with IoC, where Hollywood principle &#8220;Don&#8217;t call us, we&#8217;ll call you&#8221; works
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=200&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A object holds reference to certain interface and object, therefore by setting it  is a way of injecting dependency. Really simple example at <a href="http://en.wikipedia.org/wiki/Dependency_injection">http://en.wikipedia.org/wiki/Dependency_injection</a>.</p>
<p>It is somehow related with IoC, where Hollywood principle &#8220;Don&#8217;t call us, we&#8217;ll call you&#8221; works</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/200/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=200&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2009/04/04/dependency-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>Preventing double click</title>
		<link>http://ebeworld.wordpress.com/2009/03/29/preventing-double-click/</link>
		<comments>http://ebeworld.wordpress.com/2009/03/29/preventing-double-click/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 22:39:56 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/2009/03/29/preventing-double-click/</guid>
		<description><![CDATA[this.bSubmit.Attributes.Add(&#8220;onclick&#8221;, &#8221; this.disabled = true; &#8221; + ClientScript.GetPostBackEventReference(bSubmit, null) + &#8220;;&#8221;);
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=199&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>this.bSubmit.Attributes.Add(&#8220;onclick&#8221;, &#8221; this.disabled = true; &#8221; + ClientScript.GetPostBackEventReference(bSubmit, null) + &#8220;;&#8221;);</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/199/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=199&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2009/03/29/preventing-double-click/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
	</channel>
</rss>