<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2227942430237618163</id><updated>2012-02-16T13:46:32.060-08:00</updated><category term='Oracle'/><category term='Corel Draw'/><category term='Programming'/><category term='UI Design'/><category term='.NET'/><title type='text'>Coder's Notes</title><subtitle type='html'>My own personal notes on coding, made them while doing my job or as I play around with things. Complete with severe grammatical errors.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thecodernotes.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://thecodernotes.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Coder's Notes</name><uri>http://www.blogger.com/profile/16615242307066709821</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2227942430237618163.post-9000032090124944805</id><published>2007-11-01T08:01:00.000-07:00</published><updated>2007-11-02T00:39:02.883-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><title type='text'>JSON: Alternative Data Interchange Method</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;What is JSON? I can just tell you to take a hike and got to &lt;a href="http://json.org/"&gt;http://json.org/&lt;/a&gt;, but I don’t think that’s what a Blog should like, so let me quote the introduction part for you:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The point is, JSON lets us interchange object across different programming languages without the troublesome parsing task. JSON works by converting object to JavaScript string representation of object. The best part is that JSON is available for nearly every popular programming language. For me this is definitely a great alternative to XML, which I regularly use to exchange data on AJAX calls between client website (JavaScript) to ASP.NET or PHP server. Interestingly in JavaScript an object represented with JSON string can be “deserialized” (that is, converted back to object) by simply evaluate the string by using “eval” function. Comparison between object represented in XML dan JSON string is available at &lt;/span&gt;&lt;span class="Apple-style-span" style=" text-align: left; "&gt;&lt;a href="http://json.org/example.html"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;http://json.org/example.html&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;)&lt;/span&gt;&lt;span class="Apple-style-span" style=" text-align: justify; "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;.&lt;span class="Apple-style-span"  style=" text-align: left; font-family:'courier new';"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Enough said that JSON is certainly a good or at least interesting alternative for object exchange due to its simplicity&lt;/span&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2227942430237618163-9000032090124944805?l=thecodernotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thecodernotes.blogspot.com/feeds/9000032090124944805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2227942430237618163&amp;postID=9000032090124944805' title='92 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default/9000032090124944805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default/9000032090124944805'/><link rel='alternate' type='text/html' href='http://thecodernotes.blogspot.com/2007/11/json-alternative-data-interchange.html' title='JSON: Alternative Data Interchange Method'/><author><name>Coder's Notes</name><uri>http://www.blogger.com/profile/16615242307066709821</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>92</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2227942430237618163.post-7025975168377993635</id><published>2007-10-30T18:46:00.000-07:00</published><updated>2007-11-02T00:38:11.644-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UI Design'/><category scheme='http://www.blogger.com/atom/ns#' term='Corel Draw'/><title type='text'>Glossy 3D Interface with Corel Draw</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Let’s make something clear, I’m NOT a designer, I am a coder. I learn bit about design just because I don’t want my apps to end up looks to much like crap as many Open Source application being done without the help of a designer.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;So here’s my story. One day I was asked by a client if I could show them what their website might look like if I was to build them using CMS, sure enough I didn’t want to show crappy sample website with standard template even if it’s only a preview. I want it to look at least a close-to-nice website, complete with their company name on the header. I searched Google for a tutorial on the first thing that crossed my mind, glossy interface design. I got a nice one with a very promising title, “Principles of Glossy Interface Design” (&lt;a href="http://www.partdigital.com/tutorials/glossy"&gt;http://www.partdigital.com/tutorials/glossy&lt;/a&gt;), it’s in Photoshop. &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;I opened Photoshop, click here and there, input this and that, and I’m stuck at some point where it didn’t give me clear instruction. After few minutes of trying in vain I cowardly gave up (hey, Photoshop is not one of my thing). So I thought I’ll give it a shot with Corel Draw at which I’m more experienced with, what I did was this:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Create a rounded rectangle, do it by first create an ordinary rectangle by selecting Rectangle Tool from the Tool Box, then use Shape Tool to drag the corner to make it round.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_fT-W0AHFp5U/Ryf1GDZxSJI/AAAAAAAAAAk/qXX8HaHLMhA/s1600-h/img1.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_fT-W0AHFp5U/Ryf1GDZxSJI/AAAAAAAAAAk/qXX8HaHLMhA/s320/img1.JPG" alt="" id="BLOGGER_PHOTO_ID_5127336185126013074" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;By using the Fill Tool, fill the rectangle with RGB value of 117, 153, and 163 (as instructed in the mentioned article, any color would do of course), don’t forget to remove the outline by using the Outline Tool.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;NOTE: When Fill Dialog opened, the default color input model is &lt;a href="http://en.wikipedia.org/wiki/CMYK_color_model"&gt;CMYK&lt;/a&gt;, change the model to RGB.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_fT-W0AHFp5U/Ryf1GDZxSKI/AAAAAAAAAAs/hYoqki5GvyI/s1600-h/img2.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_fT-W0AHFp5U/Ryf1GDZxSKI/AAAAAAAAAAs/hYoqki5GvyI/s320/img2.JPG" alt="" id="BLOGGER_PHOTO_ID_5127336185126013090" border="0" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Next is to create ellipse crossing the rounded rectangle, fill it up with white and remove the outline. The intersection between this ellipse and the rounded rectangle will be used to create shine effect by setting the intersection to semi transparent white.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;NOTE: The illustration below shows the ellipse without fill color and with outline for the comfort of our viewing, it should be white and without outline.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_fT-W0AHFp5U/Ryf1GjZxSLI/AAAAAAAAAA0/aS1pfTeDElM/s1600-h/img3.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_fT-W0AHFp5U/Ryf1GjZxSLI/AAAAAAAAAA0/aS1pfTeDElM/s320/img3.JPG" alt="" id="BLOGGER_PHOTO_ID_5127336193715947698" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;To create intersection between ellipse and rounded rectangle bring up Shaping Dialog from the main menu Arrange -&gt; Shaping  -&gt; Shaping. Select the rounded rectangle, select Intersect from the shaping type while making sure that on the Leave Original section Target Object checkbox is cleared. Click the Intersect With button and then click on the ellipse to create intersection between to shapes and remember to remove the outline of the intersection.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_fT-W0AHFp5U/Ryf1GjZxSMI/AAAAAAAAAA8/SLs9sj7Ovh4/s1600-h/img4.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_fT-W0AHFp5U/Ryf1GjZxSMI/AAAAAAAAAA8/SLs9sj7Ovh4/s320/img4.JPG" alt="" id="BLOGGER_PHOTO_ID_5127336193715947714" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Now to create that shiny effect we talked about a while ago we must set intersection to be nearly transparent, to do so use the Transparency Tool click inside the intersection and drag it slightly at any direction, that should create Linear Transparency which is not what we need, we want a Uniform Transparency which we could get by setting Transparency Type at the transparency toolbar to Uniform. Next, set the Starting Transparency value at the same toolbar to 70.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_fT-W0AHFp5U/Ryf2lzZxSNI/AAAAAAAAABE/lGgj1_hUBxo/s1600-h/img5.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_fT-W0AHFp5U/Ryf2lzZxSNI/AAAAAAAAABE/lGgj1_hUBxo/s320/img5.JPG" alt="" id="BLOGGER_PHOTO_ID_5127337830098487506" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Starting to look shiny here are we? No? Ok, let us move to the next step where we back to work on the rounded rectangle. To add a rather 3D look, we’ll fill the rounded rectangle with gradient, so select the rounded rectangle and click on the Fountain Fill Dialog, a dialog will appear with gradient editor, set the Angle to 90, set the “From” Color selection to RGB 117, 153, 163 and “To” Color to RGB 153, 219, 222.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_fT-W0AHFp5U/Ryf2lzZxSOI/AAAAAAAAABM/979bNGcGOps/s1600-h/img6.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_fT-W0AHFp5U/Ryf2lzZxSOI/AAAAAAAAABM/979bNGcGOps/s320/img6.JPG" alt="" id="BLOGGER_PHOTO_ID_5127337830098487522" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Now don’t tell me you can’t see something started to look shiny, but yes, something is missing, a little shadow perhaps.  Select the rounded rectangle, select Shadow Tool and click on the center of rounded rectangle and drag it just a little bit at any direction. A Shadow Dialog will appear on the toolbar , set Drop Shadow Opacity and Drop Shadow Feathering to 10, Drop Shadow Feathering Direction to Outside.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_fT-W0AHFp5U/Ryf2mDZxSPI/AAAAAAAAABU/G_2xFDaZ0kw/s1600-h/img7.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_fT-W0AHFp5U/Ryf2mDZxSPI/AAAAAAAAABU/G_2xFDaZ0kw/s320/img7.JPG" alt="" id="BLOGGER_PHOTO_ID_5127337834393454834" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Nice isn’t? Well, for a programmer at least. I guess that’s all I can share, next time I probably going to share some other simple tips on Corel Draw for Programmers. &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2227942430237618163-7025975168377993635?l=thecodernotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thecodernotes.blogspot.com/feeds/7025975168377993635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2227942430237618163&amp;postID=7025975168377993635' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default/7025975168377993635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default/7025975168377993635'/><link rel='alternate' type='text/html' href='http://thecodernotes.blogspot.com/2007/10/glossy-3d-interface-with-corel-draw.html' title='Glossy 3D Interface with Corel Draw'/><author><name>Coder's Notes</name><uri>http://www.blogger.com/profile/16615242307066709821</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_fT-W0AHFp5U/Ryf1GDZxSJI/AAAAAAAAAAk/qXX8HaHLMhA/s72-c/img1.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2227942430237618163.post-1041569119469983180</id><published>2007-10-29T23:17:00.000-07:00</published><updated>2007-11-02T00:40:01.177-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Oracle TNS Error : Could not resolve the connect identifier specified</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;A cliché, yes, but I think what cause the problem is worth noted, at least for myself. One day I was thinking about bringing home some of my work and the country in which I live and work was (and still) no high-tech developed countries where internet speed generally fast enough to remotely access a Database Server. Anyway, the problem was that I only have Oracle 9i Client installed on my laptop, I need Server. So I installed Oracle 10g Express Edition (the download took quite some time, mind you).&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Everything went just fine until I was back at my office trying to run the application with the TNS configuration set to Oracle Server at the office, when it said:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Oracle TNS Error : Could not resolve the connect identifier specified&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;I tried TOAD to connect using the same TNS configuration and no problem occurred, which was an addition my confusion. So I called Google, worked some search and found some discussions about the topic here:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://forums.oracle.com/forums/thread.jspa?messageID=2154989"&gt;http://forums.oracle.com/forums/thread.jspa?messageID=2154989&lt;/a&gt;&lt;br /&gt;&lt;a href="http://ora-12154.ora-code.com/"&gt;http://ora-12154.ora-code.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;The point is that after I installed Oracle XE I had two Oracle Homes, the one used by my application was the Oracle XE’s, that’s why it won’t connect to my office’s server. One of the solutions is to use TNS_ADMIN variable, but those instructions brought me headache. I need a quick solution, my boss was coming. So my solution was to temporarily replace Oracle XE’s TNSNAMES.ORA file with the one from the Oracle 9i Client. It was a quick and certainly a dirty solution, but save me some accusing questions from my boss.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Actually if I was thinking more careful (and having more knowledge on Oracle) instead of instantly weep and ran to Google, I should have seen the Oracle Home options on TOAD’s Login Window at which displayed selections of which Oracle Home to use, then I would (probably) got the problem figured out at that moment, silly me.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2227942430237618163-1041569119469983180?l=thecodernotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thecodernotes.blogspot.com/feeds/1041569119469983180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2227942430237618163&amp;postID=1041569119469983180' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default/1041569119469983180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default/1041569119469983180'/><link rel='alternate' type='text/html' href='http://thecodernotes.blogspot.com/2007/10/oracle-tns-error-could-not-resolve.html' title='Oracle TNS Error : Could not resolve the connect identifier specified'/><author><name>Coder's Notes</name><uri>http://www.blogger.com/profile/16615242307066709821</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2227942430237618163.post-2320298715045838883</id><published>2007-10-27T00:34:00.000-07:00</published><updated>2007-11-02T00:39:02.883-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Optimizing ASP.NET Web Service with DataSet Compression</title><content type='html'>&lt;span style="font-size: 10pt;"&gt;This is one of those days when I received a disastrous application source (I often call them garbage codes). To tell you something about this application, it abuses Web Service by simply, if not brutally, created a method called QueryData (returned DataSet) as a Web Method so that the Web Service is no more than a dummy proxy serving database queries without single knowledge on the business logic. When the big surprise came, that is the application failed to deliver expected performance due to network limitation and none of those brutish programmers seems to know what to do (another big surprise), the supervisor came to my desk:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt; “Can you do something to make this application run faster?”&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;At this point I’ve got a glimpse on the codes and found so many sign telling me this is garbage and I calmly said:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-style: italic; color: rgb(153, 0, 0);"&gt;“My recommendation is to burn this piece of s**t, piss on it, and never look back”&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;      &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;Yeah I wish, but hey he’s my supervisor, so as always I obediently said, “I’ll see what I can do Sir”.&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;So here I am on the job, firing up Google on the first thing that crosses my little mind, Compression. Some recommendations quickly offered:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ol style="margin-top: 0in;" start="1" type="1"&gt;&lt;li class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;Create a pair of Web      Service Filter (Input and Output) by utilizing WSE (Web Service      Enhancement) to compress and uncompress data transmitted between Server      and Client. This is nice in the way that the application core doesn’t have      to be changed, on simple modification on the Web Method declaration and      the generated proxy (usually named Reference.cs), and even nicer various open      source implementations were already available. The not-so-nice part is      that somehow it does not work with my garbage codes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;Utilize standard HTTP      Compression by adding Web Service request with “Accept-Encoding: gzip,      deflate” and then uncompress the data at the client side. This is done by      slight modification on the GetWebRequest&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; and &lt;/span&gt;&lt;span style="font-size: 10pt;"&gt;GetWebResponse      at the proxy. Sounds nice, but Gzip is only “normally” supported on IIS      6.0 bundled with Windows Server 2003, while the IIS 5.0 requires so much effort      to make it work, and according to the community (and my own frustrating      experiment) there’s no guarantee that the same steps will work on      different machine. Even if I make it work most probably it will mean hours      of support for the installation guys, no way I’m gonna go for it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;So I’ve come to a conclusion that maybe I should use a brutal approach for this brutal application, that is directly compress the DataSet. This certainly defy good programming practice, since it would require major changes on the Web Method including its return value, not to mention it’s not scalable and so forth, but thankfully my brutal application centralize its data call only at one method which mean I only have to deal with that method only. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;So here we go, the previously mentioned QueryData method is originally returns DataSet, like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;[WebMethod]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public DataSet QueryData (string UserName, string Password, string Database, string Server, string Query, string TableName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;... &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;return myDataSet;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;What I would do is to rename this Web Method to QueryDataWithCompression with byte array contains compressed DataSet as the return value, in this method DataSet is compressed then returned as byte array. What will we need is the use of GZipStream class in System.IO.Compression (available at .NET 2.0), you can also use the popular SharpZipLib (available at &lt;a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/"&gt;http://www.icsharpcode.net/OpenSource/SharpZipLib/&lt;/a&gt;) if you’re still using .NET 1.1, all you have to do is use GZipInputStream instead of GZipStream to compress the DataSet.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;[WebMethod]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public byte[] QueryDataWithCompression (string UserName, string Password, string Database, string Server, string Query, string TableName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;... //generate DataSet here&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;MemoryStream memStream = new MemoryStream();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.5in;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;GZipStream zipStream = new GZipStream(memStream, CompressionMode.Compress);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;myDataSet.WriteXml(zipStream, XmlWriteMode.WriteSchema);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;zipStream.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;byte[] data = memStream.ToArray();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;memStream.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;myDataSet.Dispose();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;return data;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;i style=""&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="font-weight: bold;"&gt;NOTE:&lt;/span&gt; Do remember that when you update Web Reference from the Visual Studio IDE, the changes you made in Reference.cs (the proxy) will be lost, so be careful.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 10pt;"&gt;Then to avoid changing function calls to the original QueryData method, at the proxy class we will create a public method called QueryData which is actually a wrapper for the generated QueryDataWithCompression method. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public DataSet QueryData(string UserName, string Password, string Database, string Server, string query, string TableName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in; text-align: justify; text-indent: -0.5in;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt; &lt;/span&gt;byte[] data = QueryDataWithCompression(UserName, Password, Database, Server, query, TableName);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;MemoryStream memStream = new MemoryStream(data);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;GZipInputStream unzipStream = new GZipInputStream(memStream);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;DataSet ds = new DataSet();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;ds.ReadXml(unzipStream, XmlReadMode.ReadSchema);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;memStream.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;unzipStream.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;return ds;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 8pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;span style="font-size: 10pt;"&gt;That’s it! Now my Dataset will be compressed before transmitted, but what about performance improvement? I tested a query by using Web Browser calling to the service, the code manage to optimize from 5.3 MB of XML DataSet down to about 300 KB or about 1/18 from the uncompressed size! Yes, it works.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2227942430237618163-2320298715045838883?l=thecodernotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thecodernotes.blogspot.com/feeds/2320298715045838883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2227942430237618163&amp;postID=2320298715045838883' title='90 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default/2320298715045838883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default/2320298715045838883'/><link rel='alternate' type='text/html' href='http://thecodernotes.blogspot.com/2007/10/optimizing-aspnet-web-service-with.html' title='Optimizing ASP.NET Web Service with DataSet Compression'/><author><name>Coder's Notes</name><uri>http://www.blogger.com/profile/16615242307066709821</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>90</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2227942430237618163.post-5783378325605641091</id><published>2007-10-25T18:58:00.000-07:00</published><updated>2007-11-02T00:39:02.883-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Optimize Web Service Database Connection</title><content type='html'>&lt;p class="MsoNormal"  style="text-align: justify; font-style: italic; color: rgb(153, 0, 0);font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;“Can we optimize the way our Web Service connects to Database Server? Since every time a call is being made to a method contains query, a group of codes to create new database connection is being executed.”&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;I was asked this question by my supervisor and (thanks to my lack of knowledge on MS SQL Server) it tickles me, so I fired up Google and found this article “10 Tips for Writing High-Performance Web Applications” by Rob Howard for Microsoft. Tips 3 seemed to answer my curiosity, the full article is at this link:&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/msdnmag/issues/05/01/ASPNETPerformance/"&gt;http://msdn.microsoft.com/msdnmag/issues/05/01/ASPNETPerformance/&lt;/a&gt;&lt;/span&gt; &lt;/p&gt;    &lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;i style=""&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i style=""&gt;Tip 3—Connection Pooling&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;        &lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;Setting up the TCP connection between your Web application and SQL Server™ can be an expensive operation. Developers at Microsoft have been able to take advantage of connection pooling for some time now, allowing them to reuse connections to the database. Rather than setting up a new TCP connection on each request, a new connection is set up only when one is not available in the connection pool. When the connection is closed, it is returned to the pool where it remains connected to the database, as opposed to completely tearing down that TCP connection.&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;Of course you need to watch out for leaking connections. Always close your connections when you're finished with them. I repeat: no matter what anyone says about garbage collection within the Microsoft® .NET Framework, always call Close or Dispose explicitly on your connection when you are finished with it. Do not trust the common language runtime (CLR) to clean up and close your connection for you at a predetermined time. The CLR will eventually destroy the class and force the connection closed, but you have no guarantee when the garbage collection on the object will actually happen.&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i style=""&gt;To use connection pooling optimally, there are a couple of rules to live by. First, open the connection, do the work, and then close the connection. It's okay to open and close the connection multiple times on each request if you have to (optimally you apply Tip 1) rather than keeping the connection open and passing it around through different methods. Second, use the same connection string (and the same thread identity if you're using integrated authentication). If you don't use the same connection string, for example customizing the connection string based on the logged-in user, you won't get the same optimization value provided by connection pooling. And if you use integrated authentication while impersonating a large set of users, your pooling will also be much less effective. The .NET CLR data performance counters can be very useful when attempting to track down any performance issues that are related to connection pooling.&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i style=""&gt;Whenever your application is connecting to a resource, such as a database, running in another process, you should optimize by focusing on the time spent connecting to the resource, the time spent sending or retrieving data, and the number of round-trips. Optimizing any kind of process hop in your application is the first place to start to achieve better performance.&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i style=""&gt;The application tier contains the logic that connects to your data layer and transforms data into meaningful class instances and business processes. For example, in Community Server, this is where you populate a Forums or Threads collection, and apply business rules such as permissions; most importantly it is where the Caching logic is performed.&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;o:p&gt;&lt;/o:p&gt;So, basically SQL Server done the optimization job for us, all we need to do is &lt;b style=""&gt;use the same connection string (and the same thread identity if integrated authentication is used)&lt;/b&gt; and SQL Server will see if it is still available in the connection pool to be reused.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="text-align: justify;font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;I found a deeper analysis and recommendation on Connection Pooling at the article “Tuning Up ADO.NET Connection Pooling in ASP.NET Applications” by Dmitri Khanine, this article can be found at this link:&lt;br /&gt;(&lt;a href="http://www.15seconds.com/issue/040830.htm"&gt;http://www.15seconds.com/issue/040830.htm&lt;/a&gt;)&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2227942430237618163-5783378325605641091?l=thecodernotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thecodernotes.blogspot.com/feeds/5783378325605641091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2227942430237618163&amp;postID=5783378325605641091' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default/5783378325605641091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2227942430237618163/posts/default/5783378325605641091'/><link rel='alternate' type='text/html' href='http://thecodernotes.blogspot.com/2007/10/optimize-web-service-database.html' title='Optimize Web Service Database Connection'/><author><name>Coder's Notes</name><uri>http://www.blogger.com/profile/16615242307066709821</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
