<?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-3760169963830810897</id><updated>2012-01-26T16:27:14.791Z</updated><category term='flash'/><category term='interop'/><category term='Visual Studio'/><category term='templates'/><category term='XSD'/><category term='Performance'/><category term='web-services'/><category term='SQL'/><category term='JSP'/><category term='flvtool2'/><category term='SQLServer2005'/><category term='Customization'/><category term='Misc'/><category term='conversion'/><category term='VB.NET'/><category term='SQLServer'/><category term='poll'/><category term='VC++'/><category term='Architeture'/><category term='ASP.NET'/><category term='div-positioning'/><category term='Testing'/><category term='exceptions'/><category term='stackoverflow'/><category term='XmlReader'/><category term='troubleshooting'/><category term='Visual Studio 2008'/><category term='DOM'/><category term='css'/><category term='eVC++'/><category term='GIT'/><category term='ActiveX'/><category term='player'/><category term='tips'/><category term='servlet'/><category term='AGILE'/><category term='VS2003'/><category term='Property'/><category term='Xalan'/><category term='Events'/><category term='SSIS'/><category term='review'/><category term='EC2'/><category term='GITHUB'/><category term='Threading'/><category term='file-system'/><category term='jQuery'/><category term='SSH'/><category term='MySQL'/><category term='XSL'/><category term='scalability'/><category term='DTSX'/><category term='Javascript'/><category term='maths'/><category term='CVS'/><category term='MVP'/><category term='Jetspeed-2'/><category term='msi'/><category term='ffmpeg'/><category term='XML'/><category term='Design'/><category term='OSX'/><category term='IIS'/><category term='COP'/><category term='VS2008'/><category term='batch'/><category term='CruiseControl.NET'/><category term='Tomcat'/><category term='Jimmy Sole'/><category term='multi-threading'/><category term='opinion'/><category term='Google-Datastore'/><category term='Eclipse'/><category term='session'/><category term='HTML'/><category term='OOP'/><category term='regular expressions'/><category term='Process'/><category term='T-SQL'/><category term='Methodology'/><category term='J2EE'/><category term='.NET'/><category term='Crystal Reports'/><category term='web technology'/><category term='reflection'/><category term='GWT'/><category term='AWT'/><category term='JAVA'/><category term='SilverLight'/><category term='AJAX'/><category term='ScrollViewer'/><category term='SQLServer2008'/><category term='server controls'/><category term='application path'/><category term='inelegant'/><category term='GUI'/><category term='Swing'/><category term='C++'/><category term='Pinal Dave'/><category term='css-positioning'/><category term='bat'/><category term='windows'/><category term='layout'/><category term='VS6'/><category term='dos'/><category term='casting'/><category term='ICONIX'/><category term='Design Patterns'/><category term='flowplayer'/><category term='svcutil'/><category term='ListView'/><category term='hack'/><category term='SQLServer2000'/><category term='WindowsAPIs'/><category term='VSS'/><category term='butchering'/><category term='programming'/><category term='Migration'/><category term='streaming'/><category term='flv'/><category term='cross browser'/><category term='S3'/><category term='Generics'/><category term='Gitbash'/><category term='book'/><category term='XmlDoc'/><category term='client-validation'/><category term='Google App Engine'/><category term='Delegates'/><category term='AWS'/><category term='.NET vs Java'/><category term='C#'/><category term='PHP'/><category term='meta'/><category term='blogger'/><category term='JFace'/><category term='MFC'/><category term='SEO'/><category term='paypal'/><category term='WCF'/><category term='Genetic Algorithms'/><category term='Google Mail Service'/><category term='Maven'/><category term='Linux'/><category term='Management Studio'/><category term='SQLExpress'/><category term='Wokhei'/><category term='DHTML'/><category term='VS2005'/><category term='Game Programimng'/><category term='JDO'/><category term='WPF'/><category term='WinCE'/><category term='Xerces'/><category term='keywords'/><category term='SWT'/><title type='text'>Code Butchering</title><subtitle type='html'>When there's no time for best practices</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default?start-index=101&amp;max-results=100'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>164</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1728688510229947318</id><published>2012-01-24T23:15:00.002Z</published><updated>2012-01-25T17:47:03.867Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='opinion'/><category scheme='http://www.blogger.com/atom/ns#' term='Methodology'/><title type='text'>The never-ending dilemma: Easy VS Right</title><content type='html'>&lt;div style="text-align: justify;"&gt;If you're a software engineer, countless times you have been in situations where you had to choose between the &lt;b&gt;easy way&lt;/b&gt; and the &lt;b&gt;right way&lt;/b&gt; to solve a given problem.&amp;nbsp;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Every experienced hacker knows that the right(eous) way will probably spare you some trouble in the long run (and probably will help you sleep at night too), but the same experienced engineer is also familiar with the reality of facts:&amp;nbsp;&lt;b&gt;sometimes&lt;/b&gt;&amp;nbsp;&lt;b&gt;there's just no time for best practices&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;As a&amp;nbsp;personal&amp;nbsp;code of conduct, I think it is OK to choose the &lt;b&gt;easy way&lt;/b&gt;&amp;nbsp;(often referred to as a &lt;b&gt;HACK&lt;/b&gt;) if the following is true:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;&lt;span style="color: #cc0000;"&gt;You are aware you are doing a horrible thing, and it makes you sick&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;span style="color: #cc0000;"&gt;Environmental constraints&lt;/span&gt; (such as a guy coming at your desk every 5 minutes to check if it's done) &lt;span style="color: #cc0000;"&gt;make the HACK the only affordable/reasonable solution.&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;span style="color: #cc0000;"&gt;You are aware that the given piece of &lt;strike&gt;crap&lt;/strike&gt; code will most likely never be changed &lt;/span&gt;(we'll change it later = we'll forget everything about it around 6)&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;span style="color: #cc0000;"&gt;You can live with the fact that&amp;nbsp;people&amp;nbsp;looking at the horror will know you are responsible and talk shit about you when you leave&lt;/span&gt; (you can try to sweeten the pill with comments on how bad it is, but that just makes it worse)&lt;/b&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In conclusion, as an engineer you are often called to compromise, and this is perfectly normal. I will add that this happens most of the times unless you are very lucky, and arguably as an engineer you'll be judged &amp;nbsp;based on the goodness of the compromises you make.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Unfortunately, all of the above doesn't help with sleeping at night.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1728688510229947318?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1728688510229947318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1728688510229947318' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1728688510229947318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1728688510229947318'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2012/01/never-ending-coder-dilemma-easy-vs.html' title='The never-ending dilemma: Easy VS Right'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2092624474865595682</id><published>2011-11-28T16:40:00.004Z</published><updated>2011-12-02T18:56:45.733Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='S3'/><category scheme='http://www.blogger.com/atom/ns#' term='Google App Engine'/><category scheme='http://www.blogger.com/atom/ns#' term='AWS'/><title type='text'>AccessControlException when pushing file to S3 bucket from GAE (on OSX)</title><content type='html'>&lt;div style="text-align: justify;"&gt;This is one of those edge case scenarios that can drive people crazy.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I was trying to push a file from a Google App Engine app to an Amazon S3 bucket via the &lt;a href="http://jets3t.s3.amazonaws.com/toolkit/toolkit.html"&gt;jetS3t&amp;nbsp;API&lt;/a&gt; and it would keep coming back with an &lt;b&gt;AccessControlException (access denied)&lt;/b&gt; kind of exception.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;After quite a bit of digging around &lt;a href="http://groups.google.com/group/google-appengine-java/browse_thread/thread/7ee7053d153c2103/a4a5edef8500bbd3"&gt;turns out&lt;/a&gt; the Mac default Java SDK will try to load a native library for the cryptographic needs of the S3 stuff and this is forbidden in GAE.&lt;/div&gt;&lt;br /&gt;There's 2 &lt;b&gt;workarounds &lt;/b&gt;apparently&lt;b&gt;:&lt;/b&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;if you feel adventurous, (as I did) add this to your VM args from Properties &amp;gt; Run/Debug settings &amp;gt; Edit launch configuration options &amp;gt; Arguments:&amp;nbsp;&lt;b&gt;-D--enable_all_permissions=true&lt;/b&gt;&lt;/li&gt;&lt;li&gt;use another crypto library instead of the default (BouncyCastle is a common one, and it comes with the S3 API). &amp;nbsp;&lt;/li&gt;&lt;/ol&gt;Happy hacking!&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;u&gt;EDIT (Dec 2nd 2011)&lt;/u&gt;:&amp;nbsp;&lt;/span&gt;&lt;/b&gt;Some news after more work on this, unfortunately solution 1) only fixes the problem locally - when you go and deploy you still get the same&amp;nbsp;&lt;b&gt;AccessControlException. &lt;/b&gt;Also, it appears that Google App Engine prevents you from specifying a custom crypto library so solution 2) is no good either.&lt;b&gt;&amp;nbsp;&lt;/b&gt;But bad news don't stop there, according to &lt;a href="http://groups.google.com/group/jets3t-users/browse_thread/thread/063c990ec6e43b62"&gt;this thread&lt;/a&gt;:&amp;nbsp;&lt;/div&gt;&lt;blockquote class="tr_bq"&gt;JetS3t is not compatibile with Google App Engine. Or the other way around.&amp;nbsp;Because JetS3t uses a number of libraries and techniques that are not&amp;nbsp;supported in the restricted execution environment of Google App Engine there&amp;nbsp;is no easy way to remedy this.&lt;/blockquote&gt;Viable solutions seem to be:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;This &lt;a href="https://github.com/apcj/aws-sdk-for-java-on-gae"&gt;contraband version of the AWS SDK forked for app-engine&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/jclouds/"&gt;jclouds&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;I am in the process of trying some of this stuff. Will probably post something in a future post (if this stuff doesn't kill me first).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2092624474865595682?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2092624474865595682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2092624474865595682' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2092624474865595682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2092624474865595682'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2011/11/accesscontrolexception-when-pushing.html' title='AccessControlException when pushing file to S3 bucket from GAE (on OSX)'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1071912657778446677</id><published>2011-11-10T03:43:00.000Z</published><updated>2011-11-10T03:43:43.741Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='meta'/><title type='text'>.NET Butchering --&gt; Code Butchering</title><content type='html'>This is probably long overdue, I am changing the title of the blog to reflect the fact that I've been posting less and less .NET related stuff. This is somehow related to the fact that I've been trying to get more experience on non-microsoft technologies (mainly working on my pet &lt;a href="http://code.google.com/p/openworm/"&gt;open-source project&lt;/a&gt;), trying to practice my credo of language agnosticism.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1071912657778446677?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1071912657778446677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1071912657778446677' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1071912657778446677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1071912657778446677'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2011/11/net-butchering-code-butchering.html' title='.NET Butchering --&gt; Code Butchering'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4204118457053410654</id><published>2011-07-04T01:34:00.005+01:00</published><updated>2011-07-04T01:36:37.613+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='SSH'/><category scheme='http://www.blogger.com/atom/ns#' term='EC2'/><category scheme='http://www.blogger.com/atom/ns#' term='AWS'/><title type='text'>How to ssh into Amazon EC2 Linux instance (and copy stuff over)</title><content type='html'>&lt;div style="text-align: justify;"&gt;This is easy enough on an absolute scale but can be a bit of a nightmare if you're windows-oriented (as I unfortunately am ... but I am trying to snap out of it).&lt;/div&gt;&lt;br /&gt;Here's a list of steps:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Create amazon instance with a new key pair&lt;/li&gt;&lt;li&gt;Save your private key to a known location (it's a .pem file you'll download in the process)&lt;/li&gt;&lt;li&gt;Make sure the folder with the private key has appropriate access otherwise it won't work&amp;nbsp;(e.g. on mac: &lt;b&gt;chmod -R 700 path/to/pvtk&lt;/b&gt;).&lt;/li&gt;&lt;li&gt;In the EC2 dashboard go the the security group settings for the instance and open ssh port 22&lt;/li&gt;&lt;li&gt;Connect: &lt;b&gt;ssh -i path/to/key/myKey.pem root@my-ec2-public-ip.amazonaws.com&lt;/b&gt;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;An alternative to&amp;nbsp;referencing&amp;nbsp;your key on the ssh command is to add it via &lt;a href="http://goo.gl/AXvzN"&gt;ssh-add&lt;/a&gt; (on mac).&lt;br /&gt;&lt;br /&gt;Another thing you might wanna do is to copy stuff over to the EC2 instance - you can use the&amp;nbsp;&lt;a href="http://goo.gl/sf21N"&gt;scp&lt;/a&gt;&amp;nbsp;command:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;scp test/winning.txt root@&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;b&gt;my-ec2-public-ip.&lt;/b&gt;&lt;/span&gt;amazonaws.com:temp-files/&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Good luck!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4204118457053410654?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4204118457053410654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4204118457053410654' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4204118457053410654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4204118457053410654'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2011/07/how-to-ssh-into-amazon-ec2-linux.html' title='How to ssh into Amazon EC2 Linux instance (and copy stuff over)'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4424432211056550382</id><published>2011-06-14T14:18:00.000+01:00</published><updated>2011-06-14T14:18:02.377+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL'/><title type='text'>T-SQL Convert string to datetime</title><content type='html'>This is the kind of stuff you don't wanna waste time on - and yet ...&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;DECLARE @test varchar(10)&lt;br /&gt;SET @test = '12/31/2011'&lt;br /&gt;&lt;br /&gt;DECLARE @test_date datetime&lt;br /&gt;SET @test_date = CONVERT(datetime, @test, 101)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4424432211056550382?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4424432211056550382/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4424432211056550382' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4424432211056550382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4424432211056550382'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2011/06/t-sql-convert-string-to-datetime.html' title='T-SQL Convert string to datetime'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8296756775850733663</id><published>2011-04-27T20:43:00.004+01:00</published><updated>2011-04-27T21:17:05.301+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Misc'/><title type='text'>Heads or Tails? or: how to lose money at the roulette table</title><content type='html'>I've always wondered how many heads/tails you'd get in a row if you could just keep flipping coins forever.&amp;nbsp;The other day I was bored so I put together a &lt;a href="https://gist.github.com/944924"&gt;stupid matlab script&lt;/a&gt; to try it out (leaving out the "forever" bit).&lt;br /&gt;&lt;br /&gt;It's obvious that in theory you could get a never ending series of heads or tails, but in practice that is infinitely unlikely to happen, so I just wanted to get a feel for a "reasonable" figure in terms of how many repetitions one should expect to experience if one actually started tossing coins (or betting money on red/black at the roulette) for a &lt;b&gt;very&lt;/b&gt; long time.&lt;br /&gt;&lt;br /&gt;Out of &lt;b&gt;100 million series&lt;/b&gt;&amp;nbsp;of coin tosses (where a series is defined by an uninterrupted&amp;nbsp;streak&amp;nbsp;of heads or tails) the longest streak of identical outcomes was &lt;b&gt;&lt;a href="http://www.flickr.com/photos/johnidol/5654471143/"&gt;26&lt;/a&gt;&amp;nbsp;(&lt;/b&gt;I wanted to try with a billion series but was taking too long&lt;b&gt;)&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;That means that if you go to a casino to make money doubling bets on red/black (the so-called Martingale strategy) and you are particularly unlucky you might have to flush out 20*(2^25) = 671,088,630 $ (a single bet is&amp;nbsp;usually&amp;nbsp;at&amp;nbsp;least&amp;nbsp;20 $) on your last bet to actually make a profit (plus all the money you spent to get there).&lt;br /&gt;&lt;br /&gt;If you play smart though, and you wait for 5 reds/blacks in a row before you start betting against that, then you can get away with a last bet of only 20*(2^20) = 20,971,520 $ (that's 20 millions!).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8296756775850733663?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8296756775850733663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8296756775850733663' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8296756775850733663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8296756775850733663'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2011/04/heads-or-tails-or-how-to-lose-money-at.html' title='Heads or Tails? or: how to lose money at the roulette table'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4641289311367173877</id><published>2011-04-08T20:53:00.001+01:00</published><updated>2011-04-08T20:53:55.785+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DHTML'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='hack'/><title type='text'>Disable DIV with jQuery</title><content type='html'>Here's a lame trick I use to disable divs:&lt;br /&gt;&lt;pre&gt;&lt;div class="code"&gt;&lt;code&gt;&lt;br /&gt;// this works on IE&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;// disable&lt;/code&gt;&lt;br /&gt;&lt;code&gt;$('#myDiv').attr('disabled', 'disabled');&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;// enable&lt;/code&gt;&lt;br /&gt;&lt;code&gt;$('#myDiv').attr('disabled', '');&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;/pre&gt;&lt;br /&gt;Disabling the whole div doesn't seem to disable inputs in chrome and firefox though, so here's the alternative version drilling&amp;nbsp;down&amp;nbsp;to each single input elements:&lt;br /&gt;&lt;pre&gt;&lt;div class="code"&gt;&lt;code&gt;&lt;br /&gt;// this works everywhere but looks weird in IE&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;// disable&lt;br /&gt;$('#myDiv :input').attr('disabled', 'disabled');&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;// enable&lt;/code&gt;&lt;br /&gt;&lt;code&gt;$('#myDiv :input').attr('disabled', '');&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;/pre&gt;&lt;br /&gt;Good hacking.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4641289311367173877?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4641289311367173877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4641289311367173877' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4641289311367173877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4641289311367173877'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2011/04/disable-div-with-jquery.html' title='Disable DIV with jQuery'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2887593476812506940</id><published>2011-02-13T18:43:00.001Z</published><updated>2011-02-13T18:44:17.882Z</updated><title type='text'>Get list of OpenCL supported devices with jogamp.jocl</title><content type='html'>I recently got started on GPGPU, and the natural choice seemed to be OpenCL, since it's supported by both ATI and nVidia. The nice thing about OpenCL (other than being cross-platform) is also that it provides a layer of abstraction that allows you to use both CPUs and GPUs (not only GPUs as for nVidia's CUDA and AMD's Stream technologies).&lt;br /&gt;&lt;br /&gt;I started investigating a few java wrappers (there's only a handful around) and ended up playing with &lt;a href="http://jogamp.org/jocl/www/"&gt;jogamp.jocl&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This is just a snippet showing how to retrieve a list of OpenCL enabled devices on your machine:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;// create context for all devices detected using default platform&lt;br /&gt;CLContext context = CLContext.create();&lt;br /&gt;&lt;br /&gt;// an array with available devices&lt;br /&gt;CLDevice[] devices = context.getDevices();&lt;br /&gt;         &lt;br /&gt;for(int i=0; i &amp;lt; devices.length; i++)&lt;br /&gt;{&lt;br /&gt;   out.println("device-" + i + ": " + devices[i]);&lt;br /&gt;} &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;Goes without saying that if you don't see your GPU in the output it's time for some painful driver sweeping. I found that Snow Leopard works straightaway with both ATI and nVidia (MacOSX 10.6.x ships with OpenCl support), while windows can be a bit trickier to setup (as we all know, Catalyst software kinda sucks).&lt;br /&gt;&lt;br /&gt;Just to give you a sneak-peek at what comes after, once you've had a look at the output then you can go ahead and select a device to create the queue(s) you'll use for sending data up to the devices:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;// have a look at the output and select a device&lt;br /&gt;CLDevice device = devices[0];&lt;br /&gt;&lt;br /&gt;// create command queue on selected device.&lt;br /&gt;CLCommandQueue queue = device.createCommandQueue();&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;You can see the entire code for the official jogamp.jocl &amp;nbsp;&lt;a href="http://goo.gl/j6Zm3"&gt;'Hello World' example here&lt;/a&gt; if you're curious.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2887593476812506940?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2887593476812506940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2887593476812506940' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2887593476812506940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2887593476812506940'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2011/02/get-list-of-opencl-supported-devices.html' title='Get list of OpenCL supported devices with jogamp.jocl'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6261482084457215910</id><published>2011-01-02T04:45:00.000Z</published><updated>2011-01-02T04:45:10.429Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Genetic Algorithms'/><title type='text'>Was Darwin Wrong?</title><content type='html'>In the beginning it was self-replicators.&lt;br /&gt;&lt;br /&gt;Then it was self-replicators with metabolism (which kind of is the definition of life).&lt;br /&gt;&lt;br /&gt;Now, to go from self-replicating blobs to human beings it takes a pretty good search algorithm.&lt;br /&gt;&lt;br /&gt;Natural selection is that algorithm, and it happens to be the most robust search algorithm there is, beating hands down any other kind of human-designed search tool.&lt;br /&gt;&lt;br /&gt;So, &lt;a href="http://geneticoddity.appspot.com/wasdarwinwrong.htm"&gt;was Darwin wrong?&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;P.S. if you don't believe in facts then there is very little that can be done to convince you&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6261482084457215910?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6261482084457215910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6261482084457215910' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6261482084457215910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6261482084457215910'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2011/01/was-darwin-wrong.html' title='Was Darwin Wrong?'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7045952562016008856</id><published>2010-12-17T20:37:00.000Z</published><updated>2010-12-17T20:37:49.059Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='file-system'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><title type='text'>How to load text files with jQuery</title><content type='html'>&lt;div style="text-align: justify;"&gt;I was looking into this to help out &lt;a href="http://twitter.com/#!/tarelli"&gt;@tarelli&lt;/a&gt; with one of his crazy tasks from hell (spare you the details). Here's how you go about loading local files using jquery:&lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;// LOAD file&lt;br /&gt;$.get('file:///C:/myPath/myFile.txt', function(data) {    &lt;br /&gt;    &lt;br /&gt;    var lines = data.split("\n");&lt;br /&gt;&lt;br /&gt;    $.each(lines, function(n, elem) {&lt;br /&gt;       $('#myContainer').append('&amp;lt;div&amp;gt;' + elem + '&amp;lt;/div&amp;gt;');&lt;br /&gt;    });&lt;br /&gt;});&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;This will only work if you double click on the file that executes the script, obviously a web-server shouldn't allow you to go mess around in the file system (I tried on IIS and couldn't fool it, damn). Obviously the same snippet can be used to load files on a web-server by providing a url to an accessible file.&lt;/div&gt;&lt;br /&gt;Notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;couldn't get it to work without specifying the file full path in format&amp;nbsp;file:///C:/myPath/myFile.txt&lt;/li&gt;&lt;li&gt;to get this to work on chrome you'll have launch it with the&amp;nbsp;--allow-file-access-from-files cmd line arg&lt;/li&gt;&lt;/ul&gt;P.S. happy xmas&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-7045952562016008856?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7045952562016008856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7045952562016008856' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7045952562016008856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7045952562016008856'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/12/how-to-load-text-files-with-jquery.html' title='How to load text files with jQuery'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-5348654050111275452</id><published>2010-09-29T22:24:00.000+01:00</published><updated>2010-09-29T22:24:54.805+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='regular expressions'/><title type='text'>Javascript - strip off illegal characters from string</title><content type='html'>&lt;div style="text-align: justify;"&gt;Recently had to come up with a piece of javascript to strip off a set of illegal characters from strings before passing down to the persistance layer.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;a href="http://stackoverflow.com/questions/3780696/javascript-string-replace-with-regex-to-strip-off-illegal-characters"&gt;Took me a while&lt;/a&gt; to come up with a regex for the replace, not because it's particularly difficult, but because I suck at regexes (and I am no js expert either). &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I thought it could be handy to have this functionality as a string prototype:&lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;// strips off illegal chars &amp;amp;%$&lt;br /&gt;String.prototype.stripOffIllegalChars = function() {&lt;br /&gt; return this.replace(/[&amp;amp;%$]/g, "");&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;The /g above means that the replace will be global (so not just the first of those characters will be replaced). &lt;br /&gt;&lt;br /&gt;It can be used like this on any string:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;var dirtyString = "blah$blah%blah&amp;amp;";&lt;br /&gt;var cleanString = dirtyString.stripOffIllegalChars();&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;Hopefully it'll save some time to the next in line.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-5348654050111275452?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/5348654050111275452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=5348654050111275452' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5348654050111275452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5348654050111275452'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/09/javascript-strip-off-illegal-characters.html' title='Javascript - strip off illegal characters from string'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1927756935748361825</id><published>2010-05-27T23:14:00.003+01:00</published><updated>2010-05-27T23:59:58.912+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web-services'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>WCF client hangs on big response: make it streamed</title><content type='html'>I have to blog about this - as I spent a few days having nightmares about it.&lt;br /&gt;&lt;br /&gt;An operation from a websphere service was returning a pdf string, for a payload of about 500KB. The WCF client consuming the service was working fine on the test fixture, but when the operation was integrated in the web solution, with the exact same binding and endpoint, the client was hanging for more than a minute onto the response of this particular operation (every other operation with a smaller payload was OK) before coming back with the deserialized response.&lt;br /&gt;&lt;br /&gt;I initially blamed the service, but then noticed (sniffing traffic via fiddler) the response was coming back quick enough and only then the client would hang for more than a minute obviously trying to deserialize or God knows what.&lt;br /&gt;&lt;br /&gt;After quite a bit of hacking around on and off, I managed to change the transportmode config setting on the binding from buffered to streamed (I had nothing else left to try!), and it did the trick. In light of this it's pretty obvious that the response was being chunked in parts the size of the buffer and that was probably slowing down the whole process.&lt;br /&gt;&lt;br /&gt;Morale of the story: if you've got big payloads &lt;a href="http://msdn.microsoft.com/en-us/library/ms731913.aspx"&gt;transportMode="Streamed"&lt;/a&gt; could save your sorry ass.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1927756935748361825?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1927756935748361825/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1927756935748361825' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1927756935748361825'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1927756935748361825'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/05/wcf-client-hangs-on-response-make-it.html' title='WCF client hangs on big response: make it streamed'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-5421226426260273645</id><published>2010-04-07T00:59:00.000+01:00</published><updated>2010-04-07T00:59:02.848+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='paypal'/><title type='text'>You have requested an outdated version of PayPal. This error often results from the use of bookmarks.</title><content type='html'>Recently started getting this error when linking to paypal:&lt;div&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="color: purple;"&gt;&lt;b&gt;You have requested an outdated version of PayPal. This error often results from the use of bookmarks&lt;/b&gt;.&lt;/span&gt;&lt;/blockquote&gt;Solved it by commenting this line on my code (when setting up the paypal form in GWT):&lt;/div&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="color: #cc0000;"&gt;&lt;b&gt;paypalForm.setEncoding(FormPanel.ENCODING_MULTIPART);&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;Apparently PayPal recently implemented changes to prevent it from accepting posts with encoding type multipart/form-data.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hope it helps.&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/3760169963830810897-5421226426260273645?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/5421226426260273645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=5421226426260273645' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5421226426260273645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5421226426260273645'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/04/you-have-requested-outdated-version-of.html' title='You have requested an outdated version of PayPal. This error often results from the use of bookmarks.'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-716325995453877533</id><published>2010-03-12T19:26:00.001Z</published><updated>2010-03-12T19:28:53.616Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='web-services'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='interop'/><category scheme='http://www.blogger.com/atom/ns#' term='JAVA'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>CWWSS7200E: Unable to create AxisService from ServiceEndpointAddress</title><content type='html'>&lt;div style="text-align: justify;"&gt;This is what I got back when I tried to bounce a JAVA WebSphere Axis service from a WCF client:&lt;/div&gt;&lt;blockquote&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;CWWSS7200E: Unable to create AxisService from ServiceEndpointAddress&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div style="text-align: justify;"&gt;Took me a while but eventually figured out what was wrong and ,&lt;b&gt;long story short&lt;/b&gt;, WebSphere did not like the HttpHeaders generated by the WCF bindings (basicHttpBinding) when sending the request.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I started sniffing traffic with &lt;a href="http://www.fiddler2.com/fiddler2/"&gt;Fiddler&lt;/a&gt;, but initially I was paying attention only to the SOAP envelope. I then tried to directly invoke the service using &lt;a href="http://www.soapui.org/"&gt;SoapUI&lt;/a&gt; and it basically seemed to work fine (no &lt;i&gt;Unable to create AxisService&lt;/i&gt; error message and I was getting back the result I expected). With the SOAP envelope ruled out, the next logical consequence needed to be the HttpHeader, so I compared the header generated by WCF with the one automatically generated by SoapUI (by pointing the tool to the endpoint url):&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;WCF Generated HttpHeader&lt;/b&gt;:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: purple;"&gt;&lt;b&gt;POST /MyWebServiceDomain/aWebService HTTP/1.1&lt;/b&gt;&lt;/span&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;b&gt;SoapUI Generated HttpHeader&lt;/b&gt;:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: purple;"&gt;&lt;b&gt;POST http://xx.xxx.xxx.xx:9080/MyWebServiceDomain/aWebService HTTP/1.1&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;At this point it was fairly obvious that I needed to tweak the POST line of the HttpHeader to include the full definition of the endpoint, hopefully by WCF configuration - and after asking around a co-worker pointed me in the right direction: &lt;b&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.hostnamecomparisonmode.aspx"&gt;hostNameComparisonMode&lt;/a&gt;="Exact"&lt;/b&gt; on the WCF binding is what I was looking for (it seems to be set to StrongWildcard by default).&lt;br /&gt;&lt;br /&gt;Couldn't find anything on the web about any of the above - I hope this helps someone else with the same problem.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-716325995453877533?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/716325995453877533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=716325995453877533' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/716325995453877533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/716325995453877533'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/03/cwwss7200e-unable-to-create-axisservice.html' title='CWWSS7200E: Unable to create AxisService from ServiceEndpointAddress'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7601098597596942663</id><published>2010-03-05T23:43:00.003Z</published><updated>2010-03-16T09:49:04.505Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='web-services'/><category scheme='http://www.blogger.com/atom/ns#' term='VS2008'/><category scheme='http://www.blogger.com/atom/ns#' term='svcutil'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>Add Service Reference duplicates properties on Faults</title><content type='html'>&lt;div style="text-align: justify;"&gt;Spent the last few days fighting with this, finally found what seems to be a workaround so I thought I'd share hoping that it can be of some use to some other poor devil who's stuck.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Dealing with WebSphere generated web services, the curious occurrence of duplicate properties on &lt;b&gt;Faults&lt;/b&gt; (on different partial classes) was encountered when generating proxies through &lt;b&gt;add service reference&lt;/b&gt; on Visual Studio 2008, pretty much in a very similar way as described in &lt;a href="http://social.msdn.microsoft.com/Forums/en/wcf/thread/66f8c5c0-0c3e-47de-abd3-ba6e1a228f2d"&gt;this post&lt;/a&gt; on the msdn forum.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;Solution&lt;/b&gt;: Long story short, you have to use svcutil to generate your proxy classes and data types with the &lt;b&gt;/useSerializerForFaults&lt;/b&gt; attribute, this will cause the XmlSerializer to be used for reading and writing faults (but only those), instead of the default DataContractSerializer (which will still be used for the rest of the stuff). &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;b&gt;Note 1&lt;/b&gt;: using the option &lt;b&gt;/serializer:XmlSerializer&lt;/b&gt; instead of&amp;nbsp;&lt;b&gt;/UseSerializerForFaults&amp;nbsp;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;on svcutil will cause the Faults to be wrapped in a sub-namespace (the same namespace they were defined in the xsd contract).&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;Note 2&lt;/b&gt;: setting the corresponding option item &lt;b&gt;UseSerializerForFaults&lt;/b&gt;&amp;nbsp;to false in the ServiceMap file does not give the same results (instead of generating duplicated properties it started generating duplicated attributes, two on each partial class).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;This seems to be a &lt;a href="http://connect.microsoft.com/wcf/feedback/details/424733/svcutil-generates-faults-elements-always-with-datacontract-serializer"&gt;genuine bug&lt;/a&gt;. Let's just hope it gets fixed because it's a pain to import stuff manually.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Note that if you kick it old school and import the service as web reference (the .NET 2.0 way) it should work fine as well, but for me this was not a choice. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-7601098597596942663?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7601098597596942663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7601098597596942663' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7601098597596942663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7601098597596942663'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/03/add-service-reference-duplicates.html' title='Add Service Reference duplicates properties on Faults'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-3085283610878624602</id><published>2010-02-27T01:47:00.003Z</published><updated>2010-02-27T01:48:33.567Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='stackoverflow'/><category scheme='http://www.blogger.com/atom/ns#' term='maths'/><category scheme='http://www.blogger.com/atom/ns#' term='Misc'/><title type='text'>Russel's antinomy and stackoverflows</title><content type='html'>Russel's Antinomy goes like this (an extract from &lt;a href="http://bit.ly/bhC5xi"&gt;Gödel's proof&lt;/a&gt;):&lt;br /&gt;&lt;blockquote&gt;Classes seem to be of two kinds: those which do not contain themselves as members, and those which do. A class will be called normal if, and only if, it does not contain itself as a member; otherwise it will be called non-normal. Let N by definition stand as the class of all normal classes. We ask whether N itself is a normal class. If N is normal it is a member of itself (because by definition it contains all the normal classes); but, in that case, N is non-normal because by definition a class that contains itself as a member is non-normal. On the other hand, if N is non-normal it is a member of itself (by definition of non-normal); but, in that case, N is normal, because by definition the members of N are normal classes. In short, N is normal if, and only if, N is non-normal. It follows that the statement "N is normal" is both true and false.&lt;/blockquote&gt;&lt;br /&gt;By reading this sort of stuff, we get reminded how all the stuff we work with as software engineers, comes from Mathematicians.&lt;br /&gt;&lt;br /&gt;Anyway, this is what I came up with, inspired by the above:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;public class NonNormal&lt;br /&gt;{&lt;br /&gt;   NonNormal _nonNormal = new NonNormal();&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;Now you just instantiate NonNormal and you'll get a pretty sweet stackoverflow.&lt;br /&gt;&lt;br /&gt;I don't know about you, but this looks like a pretty elegant fuck-up to me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-3085283610878624602?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/3085283610878624602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=3085283610878624602' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/3085283610878624602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/3085283610878624602'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/02/russels-antinomy-and-stackoverflows.html' title='Russel&apos;s antinomy and stackoverflows'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8362567595827600118</id><published>2010-02-24T20:24:00.001Z</published><updated>2010-02-24T20:26:35.132Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='templates'/><category scheme='http://www.blogger.com/atom/ns#' term='DHTML'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><title type='text'>Falling in line to the (micro)templating frenzy</title><content type='html'>&lt;div style="text-align: justify;"&gt;A few weeks ago I would've laughed in your face if you told me I was gonna fall in line to the templating frenzy that seems to be spreading like a virus between coders. Now - one way or the other - I seem to be infected.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I recently tackled the challenge of generating a DTO layer (including mapping logic) from WCF service client using T4 (with no editor whatsoever - don't get me started). I honestly&amp;nbsp;thought&amp;nbsp;I was gonna blog about that sooner or later but then I immediately got shuffled around like a puppet to some front-end work (I am talking web here) and faced the &lt;s&gt;lame-ass&lt;/s&gt;&amp;nbsp;ordinary challenge of dynamically injecting repetitive structures into a given page in response to a given event (click-click-click-click ... click).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Coming from that T4 work, templating obviously came to mind as a way not to get bored: wouldn't it be great if there was something like T4 for js? It sounded crazy at first, but I started looking into it and immediately found the &lt;a href="http://ejohn.org/blog/javascript-micro-templating/"&gt;John Resig Micro-Templating engine&lt;/a&gt;.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;There was no way I was gonna pass on that and, to be honest, the only alternatives were pretty lame:&lt;/div&gt;&lt;ul&gt;&lt;li style="text-align: justify;"&gt;implement your own templating engine&amp;nbsp;&lt;/li&gt;&lt;li style="text-align: justify;"&gt;shamelessly hard-code the markup to inject in your .js functions (as I always did before)&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;So I started playing with it and managed to stumble upon the &lt;a href="http://www.west-wind.com/Weblog/posts/509108.aspx"&gt;Rick Strahl variation to it&lt;/a&gt;, which actually uses T4 syntax (it sure doesn't look like a coincidence) and also has a nice addition for error handling.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Anyway, this is getting too long: here's an example where I am adding divs with a bunch of input fields to a container, ids are generated at runtime depending on how many divs we have in there. It's ugly as &lt;strike&gt;fuck&lt;/strike&gt; it gets, but it drags the message across (I think).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;Let's start&lt;/b&gt;:&amp;nbsp;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;you need to shove the templating engine function in a file. I called it templating.js and you can just copy paste whatever Rick Strahl has on his article. Once you've done that, add templating.js and jQuery.js as external script files to your html.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Once you have that in place, it's time to populate you jQuery init function and add your micro-template (the micro-template is added in a script element defined as text). This should be pretty straightforward if you read the comments: &lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;div style="text-align: justify;"&gt;&lt;/div&gt;&lt;code&gt;&amp;lt;!-- all this goes into the head section --&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;    $(document).ready(function() {&lt;br /&gt;        //IDs for the first div&lt;br /&gt;        var idsArray = { divId: "div_0", input1Id: "input1_0", input2Id: "input2_0" };&lt;br /&gt;&lt;br /&gt;        // logic to add the first div&lt;br /&gt;        function onLoad() {&lt;br /&gt;            var templ = $("#myRepeaterTemplate").html();&lt;br /&gt;            var parsed = parseTemplate(templ, idsArray);&lt;br /&gt;            $("#myTarget").html(parsed);&lt;br /&gt;        }&lt;br /&gt;            &lt;br /&gt;        // inject the first div&lt;br /&gt;        onLoad();&lt;br /&gt;&lt;br /&gt;        // Add onclick handler to button w/id addBtn&lt;br /&gt;        $("#addBtn").click(function() {&lt;br /&gt;            //1. count how many divs&lt;br /&gt;            var size = $("#myTarget &amp;gt; div").size();&lt;br /&gt;                &lt;br /&gt;            //2. generate name value pairs&lt;br /&gt;            var myArray = { divId: "div_" + size, input1Id: "input1_" + size, input2Id: "input2_" + size };&lt;br /&gt;                &lt;br /&gt;            //3. invoke parseTemplate&lt;br /&gt;            var templ = $("#myRepeaterTemplate").html();&lt;br /&gt;            var parsed = parseTemplate(templ, myArray);&lt;br /&gt;                &lt;br /&gt;            //4. append&lt;br /&gt;            $("#myTarget").append(parsed);&lt;br /&gt;        });&lt;br /&gt;    });&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script id="myRepeaterTemplate" type="text/html"&amp;gt;&lt;br /&gt;     &amp;lt;div id="&amp;lt;#= divId #&amp;gt;" &amp;gt;&lt;br /&gt;        &amp;lt;input id="&amp;lt;#= input1Id #&amp;gt;" type="text" value="some input" /&amp;gt;&lt;br /&gt;        &amp;lt;input id="&amp;lt;#= input2Id #&amp;gt;" type="text" value="some input" /&amp;gt;&lt;br /&gt;     &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;And the following is what you need in the body of the page for this to work:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;div id="myTarget"&amp;gt;&lt;br /&gt;   &amp;lt;p&amp;gt;this stuff should be wiped on load&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;input id="addBtn" type="button" value="Add" /&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This is just a very basic example that should be suitable when you just want to inject some markup given a template, but you can put actual js logic into the template. For a nice example of that have a look at &lt;a href="http://www.satyakomatineni.com/akc/display?url=displaynoteimpurl&amp;amp;ownerUserId=satya&amp;amp;reportId=3270"&gt;this nice example here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I am a lazy-ass late adopter, and if I am using this stuff &amp;nbsp;(talking about the templating frenzy in general) - it generally means it can't be ignored much longer. Do so at your own risk.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8362567595827600118?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8362567595827600118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8362567595827600118' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8362567595827600118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8362567595827600118'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/02/falling-in-line-the-microtemplating.html' title='Falling in line to the (micro)templating frenzy'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6903600481416223556</id><published>2010-02-03T00:51:00.002Z</published><updated>2010-02-03T00:55:31.307Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='reflection'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><title type='text'>GetProperties(BindingFlags.DeclaredOnly) returns no properties</title><content type='html'>&lt;div style="text-align: justify;"&gt;If you're trying to use reflection to retrieve a list of properties and you want only the properties declared in a given type but not the inherited ones, &lt;a href="http://msdn.microsoft.com/en-us/library/kyaxdd3x.aspx"&gt;msdn says&lt;/a&gt; you need to call GetProperty passing down the DeclaredOnly binding flag.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;What msdn doesn't say is that if you just pass down DeclaredOnly you'll get nothing back (and if you ended up on this post through a google search that's probably the reason why).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;In order to get back the properties you're looking for you need to pass down also the Public and Instance binding flags - smt like this should work:&lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;div style="text-align: justify;"&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;div style="text-align: justify;"&gt;var properties  = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;This is probably working "as designed" but could definitely make you waste a bit of time (as it did for me).&lt;br /&gt;&lt;br /&gt;In the spirit of human hive intelligence - hope it helps some other average Joe out there.&lt;/div&gt;&lt;div style="text-align: justify;"&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;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6903600481416223556?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6903600481416223556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6903600481416223556' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6903600481416223556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6903600481416223556'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/02/getpropertiesbindingflagsdeclaredonly.html' title='GetProperties(BindingFlags.DeclaredOnly) returns no properties'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8603676711488712198</id><published>2010-01-22T19:23:00.002Z</published><updated>2010-01-22T19:35:28.969Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='MVP'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='Architeture'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Are MVP and AJAX a good match?</title><content type='html'>&lt;div style="text-align: justify;"&gt;Can't seem to get through a conversation these days without talking about the MVP pattern - so here's a boring post about just that.&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;If you need extensive unit testing coverage, adopting the MVP pattern in your app is probably going to make your life easier. In the specific case of web apps though there are a number of considerations to take into account.&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;First of all, not everyone seems to be aware that&amp;nbsp;&lt;a href="http://martinfowler.com/eaaDev/ModelViewPresenter.html"&gt;MVP was retired&lt;/a&gt;&amp;nbsp;a while ago, and it has been split by the author in two different patterns:&amp;nbsp;&lt;a href="http://martinfowler.com/eaaDev/PassiveScreen.html"&gt;Passive View&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="http://martinfowler.com/eaaDev/SupervisingPresenter.html"&gt;Supervising Controller&lt;/a&gt;. In my experience, when talking about MVP, most people implicitly refer to the Passive View model.&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;Passive View looks like a pretty good fit for the ASP.NET post-back model, where your presenter triggers updates on the view server-side and everyone can feel comfortable they're following the pattern. This is all good till you start sneaking loads of AJAX calls into your page, resulting in a view that has got now inherent behavior (in this discussion I am considering all the client-side scripting as inherent behavior of the view - which might be a wrong assumption, if so please slap me hard).&amp;nbsp;Still nothing wrong, till the AJAX calls from the view go straight down to the model to fetch data which is used by the view to update itself. Bare in mind that here the problem is not so much the view that updates itself, but the fact that, going straight to the model, &lt;b&gt;the view is no longer passive&lt;/b&gt; and the presenter doesn't trigger the update (as we obviously don't have a client-side equivalent).&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;The considerations above seem to rule out the passive view approach for AJAX intensive apps. In fact, in the Passive View pattern the view is only allowed to talk to the presenter (usually through some messaging mechanism).&amp;nbsp;All this to say that if you're adopting MVP in a web project that requires AJAX calls from the client representation of the view to the service layer (the model), you better specify you're not adopting Passive View, because - at all effects - you're not!&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;But maybe not all is lost.&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;If Martin Fowler makes a clear distinction between passive view and selective controller there must be a reason (and a pretty good one for sure). In fact, in a scenario where the view selectively talks to the model and updates itself and&amp;nbsp;&lt;i&gt;"the controller/presenter defers as much as it is reasonable to the view",&amp;nbsp;&lt;/i&gt;you're basically adopting the Supervising Controller variation of the MVP pattern (even if you don't know).&amp;nbsp;This scenario is particularly well suited in case of databindings, and even if this is not strictly true in the case of loads of AJAX calls down to the model, I would probably see this AJAX scenario a good fit for this variation of the pattern (compared to passive view).&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;I find it might be easier for people to get it right if they feel they're closely following the pattern - this is definitely true for me!&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;So in answer to the title question:&amp;nbsp;&lt;b&gt;Are MVP and AJAX a good match?&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I think they might - as long as you're not talking about Passive View!&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/3760169963830810897-8603676711488712198?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8603676711488712198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8603676711488712198' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8603676711488712198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8603676711488712198'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/01/are-mvp-and-ajax-good-match.html' title='Are MVP and AJAX a good match?'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4281507742202392296</id><published>2010-01-09T00:57:00.000Z</published><updated>2010-01-09T00:57:04.224Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='GWT'/><category scheme='http://www.blogger.com/atom/ns#' term='Google App Engine'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET vs Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JAVA'/><category scheme='http://www.blogger.com/atom/ns#' term='Wokhei'/><title type='text'>What a .NET guy likes about AppEngine</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;I recently completed work on an app built on AppEngine and Google Web Toolkit:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;&lt;a href="http://www.wokhei.com/"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_LLByA-cjSbY/S0eN9pIkRCI/AAAAAAAAAGo/jZ3o3jQsIPI/s320/logo.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left;"&gt;It's basically a logo design app with a twist - &lt;a href="http://www.wokhei.com/"&gt;follow the link&lt;/a&gt; if you wanna find out more on the app itself.&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"&gt;To the point, the team on this project came mostly from a Java background and even though I am mainly a .NET nut I also have a bit of Java under the belt, so this project represented the perfect opportunity for me to get some sweet &amp;nbsp;AppEngine + GWT action.&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"&gt;So here we go, here's the good old list of things I really liked about the setup on this project (Java/AppEngine/GWT on Eclipse + Google plugins) compared to the setup I am more familiar with (C#/ASP.NET + SQLServer + Azure hosting, all on VS):&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;With AppEngine and the Google-Datastore you don't have to cope with SQL or SQLServer (and if you follow this blog you know &lt;a href="http://dotnetbutchering.blogspot.com/2008/11/how-i-feel-about-sql.html"&gt;how I feel about SQL&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;You can literally&amp;nbsp;&lt;a href="http://code.google.com/appengine/docs/java/gettingstarted/uploading.html"&gt;deploy your app with one-click&lt;/a&gt; from the eclipse plug-in (all extremely easy to setup - and it works)&lt;/li&gt;&lt;li&gt;Hosting is free on google appspot (if you don't go over the free quotas, and quite cheap after that anyway)&lt;/li&gt;&lt;li&gt;GWT = virtually no messing around with javascript (I do like javascript but not if I am in a hurry) &lt;/li&gt;&lt;li&gt;.NET/VS to JAVA/Eclipse transition turned out to be OK (Eclipse is pretty cool) with people around to rely on&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;So far AppEngine has proven reliable - the app still runs a bit slow but we did not put any effort into improving performance (I've seen &lt;a href="http://dotnetbutchering.blogspot.com/2008/01/aspnet-sqlserver-performance-problems.html"&gt;ASP.NET apps running much slower&lt;/a&gt;, and it rarely boils down to hosting anyway) - stay tuned for more. &lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4281507742202392296?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4281507742202392296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4281507742202392296' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4281507742202392296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4281507742202392296'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2010/01/what-net-guy-likes-about-appengine.html' title='What a .NET guy likes about AppEngine'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_LLByA-cjSbY/S0eN9pIkRCI/AAAAAAAAAGo/jZ3o3jQsIPI/s72-c/logo.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7705796168675865274</id><published>2009-12-24T14:26:00.002Z</published><updated>2009-12-24T14:52:03.195Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='SWT'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET vs Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JFace'/><category scheme='http://www.blogger.com/atom/ns#' term='JAVA'/><title type='text'>Nightmare before Christmas: How to use JFace + SWT standalone</title><content type='html'>&lt;div style="text-align: justify;"&gt;I could've as easily called this &lt;i&gt;Eclipse plugins from HELL&lt;/i&gt;, but being Christmas and all I thought I would go for the Christmas thing, which gives me the opportunity to wish Merry Xmas to all the geeks who happen to be reading this lame-ass blog over the holidays instead of watching Star Trek as per tradition.&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;Being mainly a .NET guy, I am not too familiar with the eclipse platform, but I desperately needed to put together a quick UI and decided to go with JFace and SWT after &lt;a href="http://twitter.com/tarelli"&gt;@tarelli&lt;/a&gt; suggested so (he's the JAVA guy). Unfortunately, at the time I didn't realize he was talking about an Eclipse plugin project and not about using JFace and SWT in a standalone Java app.&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;So I went on and got started with some &lt;a href="http://www.ibm.com/developerworks/java/library/os-ecgui1/index.html?dwzone=java"&gt;nice tutorials&lt;/a&gt; specific to running JFace + SWT standalone, and some more &lt;a href="http://www.ibm.com/developerworks/opensource/library/os-jface1/"&gt;gentle introductions&lt;/a&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;Time to get my hands dirty, so I started a new Java project, and dropped in some of the code from the tutorials.  In order to get it build I needed to import JFace and SWT plugins as external jars, which I could not find anywhere in my plugins folder (I am on Galileo C:\eclipse 3.5\plugins). I needed to somehow get the damn plugins, but could not quite figure out how to get only those I needed from Help --&amp;gt; Install Software Updates, so I ended up pulling down anything to do with Eclipse SDK. To my delight the SWT and JFace plugins were there (in the plugins folder) after the lengthy process of downloading tons of stuff I didn't need. &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;After a bit of mocking about (blindly trying to import anything with jface or swt in it) I managed to understand which jars I needed to import to get the damn thing to build (&lt;b&gt;org.eclipse.jface_3.5.1.M20090826-0800.jar and org.eclipse.swt.win32.win32.x86_3.5.1.v3555a.jar&lt;/b&gt;) I started mocking about with the code and spent a good while playing around with ContentProviders, ListViewers and so forth. Everything was building nicely, but as soon as I tried to run it as java application got the cold shower:&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IProgressMonitor&lt;br /&gt;    at demo.ui.test.EntryPoint.main(EntryPoint.java:18)&lt;br /&gt;Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.IProgressMonitor&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Apparently &lt;b&gt;some type was missing somewhere&lt;/b&gt;. I've seen a lot of sh*t working on Visual Studio and all, but errors don't get much more cryptic than this.&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;After a good while, after unfruitfully trying to offline troubleshoot the heck out of my project (&lt;a href="http://dotnetbutchering.blogspot.com/2008/09/how-long-can-developer-survive-without.html"&gt;offline troubleshooting is just madness&lt;/a&gt; but I was waiting the phone company to turn on my broadband in the new apt i moved to recently), I reverted to &lt;a href="http://twitter.com/tarelli"&gt;@tarelli&lt;/a&gt;, the eclipse guru who got me into this mess, and begged for help: he promptly told me that I was in a bit of a feckin' mess, and if I wanted to get out of it alive I would've had to create a Plugin Project "with a view" and take it from there. I tried, and he was right, but I did not want a plugin and all the overhead that comes with it, so I kept pulling my hair for several hours with no luck, then went to bed. I felt &lt;a href="http://www.youtube.com/watch?v=_tG4m_nSezg"&gt;rightly and truely screwed&lt;/a&gt;, if you want.&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;Luckily the day after the phone company turned on my broadband and I could stop passively obsessing about the problem and started &lt;a href="http://stackoverflow.com/questions/1952586/cant-use-jface-and-swt-in-eclipse-without-creating-plugin"&gt;aggressively&lt;/a&gt; abusing google in search of a solution to the problem. &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;After a not too long research (God bless &lt;a href="http://www.youtube.com/watch?v=iRmxXp62O8g"&gt;THE INTERNET&lt;/a&gt;), turns out that if you want to use JFace + SWT outside a plugin based project you need &lt;b&gt;some other jars&lt;/b&gt;. Basically if you're using JFace and SWT in a plugin project runtime dependencies are managed for you through the manifest file (I seem to understand) but if you go for the rogue option of having SWT running standalone then you need to know you need that stuff. &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;In the specific case of the IProgressMonitor thingy, adding a reference to the &lt;b&gt;org.eclipse.equinox.common&lt;/b&gt; jar did the trick. After that I got the same error on a different class, EventManager, and after a couple of blind trials I got it working by importing the &lt;b&gt;org.eclipse.core.commands&lt;/b&gt; jar. Obviously, not a mention of this in the tutorials, as I seem to understand there was a bit of refactoring on those packages after those tutorials were drafted (looks like this problem is around since eclipse 3.2 --&amp;gt; read &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=122935"&gt;this bug report&lt;/a&gt; for further info).&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;What can I say? If you're coming from .NET sometimes Java == Pain.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-7705796168675865274?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7705796168675865274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7705796168675865274' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7705796168675865274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7705796168675865274'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/12/nightmare-before-christmas-how-to-use.html' title='Nightmare before Christmas: How to use JFace + SWT standalone'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8644935513211694280</id><published>2009-12-10T20:45:00.002Z</published><updated>2009-12-10T20:51:38.293Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Misc'/><title type='text'>What a bunch of ...</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;p&gt;... bullshit!&lt;br /&gt;&lt;br /&gt;The developers count on the &lt;a href="http://inedomedia.com/stackoverflow.aspx"&gt;stackoverflow ad page&lt;/a&gt; is clearly increased at random.&lt;br /&gt;&lt;br /&gt;The count is being increased in a recursively called function at random intervals. Here's the javascript:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;$(function(){&lt;br /&gt;       &lt;br /&gt;        var visitors = 5373966;&lt;br /&gt;        var updateVisitors = function()&lt;br /&gt;            {&lt;br /&gt;                visitors++;&lt;br /&gt;                &lt;br /&gt;                var vs = visitors.toString(), &lt;br /&gt;                     i = Math.floor(vs.length / 3),&lt;br /&gt;                     l = vs.length % 3;&lt;br /&gt;                while (i--&gt;0) if (!(l==0&amp;&amp;i==0))&lt;br /&gt;                    vs = vs.slice(0,i*3+l)&lt;br /&gt;                       + ',' &lt;br /&gt;                       + vs.slice(i*3+l);&lt;br /&gt;                $('#devCount').text(vs);&lt;br /&gt;                setTimeout(updateVisitors, Math.random()*2000);&lt;br /&gt;            };&lt;br /&gt;        &lt;br /&gt;        setTimeout(updateVisitors, Math.random()*2000);&lt;br /&gt;        &lt;br /&gt;    });&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;P.S. Posting this from google SideWiki - kinda cool&lt;/p&gt;in reference to: &lt;a href='http://inedomedia.com/stackoverflow.aspx'&gt;&lt;a href='http://inedomedia.com/stackoverflow.aspx'&gt;http://inedomedia.com/stackoverflow.aspx&lt;/a&gt;&lt;/a&gt; (&lt;a href='http://www.google.com/sidewiki/entry/107021285642509092240/id/DMsDiggCOl-0P8LZe5LwvDHUPfQ'&gt;view on Google Sidewiki&lt;/a&gt;)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8644935513211694280?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8644935513211694280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8644935513211694280' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8644935513211694280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8644935513211694280'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/12/what-bunch-of.html' title='What a bunch of ...'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1692876844010420549</id><published>2009-12-04T18:48:00.004Z</published><updated>2009-12-04T18:55:37.035Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='ListView'/><title type='text'>[WPF] How to programmatically add databound item to ListView</title><content type='html'>In this post I'll show how to programmatically add databound items to a WPF ListView - it's actually pretty straightforward but it's not the most intuitive task if you don't have a lot of experience with WPF.&lt;br /&gt;&lt;br /&gt;Here's your xaml - pay attention to the bindings on the grid columns:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;ListView.View&amp;gt;&lt;br /&gt;   &amp;lt;GridView&amp;gt;&lt;br /&gt;      &amp;lt;GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}"/&amp;gt;&lt;br /&gt;      &amp;lt;GridViewColumn Header="Value" DisplayMemberBinding="{Binding Path=Value}"/&amp;gt;&lt;br /&gt;   &amp;lt;/GridView&amp;gt;&lt;br /&gt;&amp;lt;/ListView.View&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;We need to define a data class with Name and Value properties such as:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;public class BoringData&lt;br /&gt;{&lt;br /&gt;    public string Name { get; set; }&lt;br /&gt;    public string Value { get; set; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;And here comes the &lt;i&gt;fun&lt;/i&gt; - how to programmatically add items to the ListView:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;//utterly boring call to generate your data item&lt;br /&gt;BoringData boredom = getBoringData(index);//&amp;lt;-- whatever&lt;br /&gt;//add the item to the listView &lt;br /&gt;this.myListView.Items.Add(boredom);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;If you're thinking I post boring stuff ... well, you're right.&amp;nbsp;Posts like this I mainly post so that I won't forget how it's done (and hopefully will be helpful to some other occasional WPF hacker).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1692876844010420549?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1692876844010420549/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1692876844010420549' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1692876844010420549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1692876844010420549'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/12/wpf-how-to-programmatically-add.html' title='[WPF] How to programmatically add databound item to ListView'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6012178491189069441</id><published>2009-11-24T18:34:00.010Z</published><updated>2009-11-25T22:11:04.614Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><title type='text'>2 Obscure Javascript Features You Probably Don't Know About</title><content type='html'>&lt;div style="text-align: justify;"&gt;I was going through the &lt;a href="http://www.w3schools.com/js/default.asp"&gt;w3c javascript tutorial&lt;/a&gt; (I like the &lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_try_catch2"&gt;try it yourself sections&lt;/a&gt; ... yes - I am that kind of geek) and I spotted 2 pretty basic but obscure &lt;strike&gt;ECMAScript&lt;/strike&gt; Javascript features I didn't know about.&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Feature 1: &lt;span class="Apple-style-span"  style="color:#990000;"&gt;the '===' operator!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;That's right, that's a triple equal. What's it for? Well, you know javascript is not strongly typed, so you can cast a variable from a number to a string just assigning values to it. This triple = operator checks for equality of &lt;span style="font-weight:bold;"&gt;both value and type&lt;/span&gt;. Smart, uh? Also kinda horrible.&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Feature 2: &lt;span class="Apple-style-span"  style="color:#990000;"&gt;variable re-declaration!&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Apparently you can re-declare a variable and the javascript interpreter couldn't care less. Moreover, if you re-declare a variable it will retain the same value as the previous homonymous variable had. Handy uh? Except it's plain twisted wrong.&lt;/div&gt;&lt;br /&gt;Anyway, God bless &lt;strike&gt;ECMAScript&lt;/strike&gt; Javascript, glorification of all sorts of butchers, and the genius &lt;a href="http://video.techrepublic.com.com/2422-13792_11-184259.html"&gt;dude who invented it&lt;/a&gt;.&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://4.bp.blogspot.com/_LLByA-cjSbY/Swwvfjjr_1I/AAAAAAAAAGc/yeGMo-qI-7k/s400/rockOnDude.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5407749471732498258" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 200px; height: 133px; " /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6012178491189069441?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6012178491189069441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6012178491189069441' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6012178491189069441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6012178491189069441'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/11/2-obscure-javascript-features-you.html' title='2 Obscure Javascript Features You Probably Don&apos;t Know About'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_LLByA-cjSbY/Swwvfjjr_1I/AAAAAAAAAGc/yeGMo-qI-7k/s72-c/rockOnDude.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-902331683962099397</id><published>2009-11-16T14:37:00.004Z</published><updated>2009-11-16T14:52:57.288Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>[.NET] How to swallow warnings</title><content type='html'>Well aware this is against all best practices, here's how you suppress all warnings coming from a given region of code:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;#pragma warning disable&lt;br /&gt;&lt;br /&gt;   //All the warnings in here are swallowed!&lt;br /&gt;&lt;br /&gt;#pragma warning restore&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This is way beyond cool - and might help you out when you can't change your code but you're being hovered by a frustrating policy of &lt;span style="font-weight:bold;"&gt;ZERO WARNING TOLERANCE&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Go forth and get it done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-902331683962099397?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/902331683962099397/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=902331683962099397' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/902331683962099397'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/902331683962099397'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/11/net-how-to-swallow-warnings.html' title='[.NET] How to swallow warnings'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4994317421083596707</id><published>2009-11-03T20:12:00.011Z</published><updated>2009-11-05T00:29:18.939Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='Customization'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='ListView'/><title type='text'>Quick and Dirty WPF ListView Customization</title><content type='html'>&lt;div style="text-align: justify;"&gt;When in need of &lt;b&gt;customizing a WPF ListView &lt;/b&gt;&lt;span style="font-style:italic;"&gt;&lt;b&gt;without much WPF experienc&lt;/b&gt;&lt;/span&gt;&lt;b&gt;e&lt;/b&gt;, chances are you'll hit the wall soon enough on pretty trivial tasks.&lt;/div&gt; &lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;This is a collection of recent posts appeared on this blog on the topic. I think the list covers most of the common basic ListView customization tasks.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dotnetbutchering.blogspot.com/2009/08/how-to-set-row-height-in-wpf-listview.html"&gt;Hot to set row height&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://dotnetbutchering.blogspot.com/2009/08/how-to-set-wpf-listview-selected-item.html"&gt;How to set selected item background color&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://dotnetbutchering.blogspot.com/2009/08/how-to-set-wpf-listview-alternate-row.html"&gt;How to set custom alternate row colors&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://dotnetbutchering.blogspot.com/2009/09/how-to-set-wpf-listview-or-scrollviewer.html"&gt;How to set scrollbar width&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Hope this'll spare a good share of frustration to some of you cheap guys out there, pulling your hair trying to write xaml by hand rather than using some version of Expression Blend or the likes (as I did myself 'cause the 30-days trial expired and &lt;i&gt;the boss&lt;/i&gt; wouldn't show the money).&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2009%2f11%2fquick-and-dirty-wpf-listview.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2009%2f11%2fquick-and-dirty-wpf-listview.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4994317421083596707?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4994317421083596707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4994317421083596707' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4994317421083596707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4994317421083596707'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/11/quick-and-dirty-wpf-listview.html' title='Quick and Dirty WPF ListView Customization'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1238133368787426834</id><published>2009-11-01T20:50:00.004Z</published><updated>2009-11-01T21:08:59.028Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='WindowsAPIs'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>[.NET] How to bring window upfront</title><content type='html'>The stuff on this post can be easily integrated with a previous post:&lt;div&gt;&lt;a href="http://dotnetbutchering.blogspot.com/2009/10/net-how-to-check-if-app-is-already.html"&gt;How to Check if App is Already Running&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In order to bring a window upfront you need to mess with win32 API calls - no easy way around (if you know any please give me a shout). Here's how to import the calls we'll be using:&lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;//Win32 API calls to raise a given processs main window&lt;br /&gt;[DllImport("user32.dll")]&lt;br /&gt;private static extern bool SetForegroundWindow(IntPtr hWnd);&lt;br /&gt;[DllImport("user32.dll")]&lt;br /&gt;private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);&lt;br /&gt;[DllImport("user32.dll")]&lt;br /&gt;private static extern bool IsIconic(IntPtr hWnd);&lt;br /&gt;&lt;br /&gt;private const int SW_RESTORE = 9;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;Here's a static method to bring a Window upfront in a given winApp (can be easily integrated with the previous post linked above):&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;static class Program&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;// all the rest of the stuff ... Main other methods etc.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;public static void BringOnFront()&lt;br /&gt;{&lt;br /&gt; Process myProcess = Process.GetCurrentProcess();&lt;br /&gt;&lt;br /&gt; string myAsseblyName = Assembly.GetExecutingAssembly().GetName().Name;&lt;br /&gt;&lt;br /&gt; foreach (Process processId in Process.GetProcessesByName(myAsseblyName))&lt;br /&gt; {&lt;br /&gt;     if (myProcess.Id != processId.Id)&lt;br /&gt;     {&lt;br /&gt;         IntPtr hWnd = processId.MainWindowHandle;&lt;br /&gt;&lt;br /&gt;         if (IsIconic(hWnd))&lt;br /&gt;         {&lt;br /&gt;             ShowWindowAsync(hWnd, SW_RESTORE);&lt;br /&gt;         }&lt;br /&gt;&lt;br /&gt;         SetForegroundWindow(hWnd);&lt;br /&gt;&lt;br /&gt;         break;&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;That'd be all - knock yourself out (tested on a number of XP and Vista machines).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1238133368787426834?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1238133368787426834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1238133368787426834' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1238133368787426834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1238133368787426834'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/11/net-how-to-bring-window-upfront.html' title='[.NET] How to bring window upfront'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8644953626991146581</id><published>2009-10-25T23:04:00.007Z</published><updated>2009-11-01T21:12:04.611Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Threading'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>[.NET] How to check if app is already running</title><content type='html'>&lt;div style="text-align: justify;"&gt;Here's a quick and dirty snippet (and sample usage) to check if your app is already running (using a Mutex).&lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;static class Program&lt;br /&gt;{&lt;br /&gt;private static Mutex mutex;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;public static bool IsThisProcessAlreadyRunning()&lt;br /&gt;{&lt;br /&gt;   bool createdNew;&lt;br /&gt;   mutex = new Mutex(false, Application.ProductName, out createdNew);&lt;br /&gt;   return !createdNew;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;/// &lt;summary&gt;&lt;br /&gt;/// The main entry point for the application.&lt;br /&gt;/// &lt;/summary&gt;&lt;br /&gt;[STAThread]&lt;br /&gt;static void Main()&lt;br /&gt;{&lt;br /&gt;   if (!&lt;span style="font-weight:bold;"&gt;IsThisProcessAlreadyRunning()&lt;/span&gt;)&lt;br /&gt;   {&lt;br /&gt;      // whatever you might be doing&lt;br /&gt;      // here's some default form initialization&lt;br /&gt;      Application.EnableVisualStyles();&lt;br /&gt;      Application.SetCompatibleTextRenderingDefault(false);&lt;br /&gt;      Application.Run(new MainForm());&lt;br /&gt;   }&lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;      // do something!&lt;br /&gt;      // usually smt like --&gt; BringOnFront();&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Bringing the app to the foreground is usually what you'll want to do next in scenarios like this. A post about that might follow soon enough.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Side note - if you're using VB.NET I believe there is a check-box you can tick under application properties somewhere that does the job. I'll avoid making jokes about VB.NET 'cause life is tough enough for the suckers who use it without me being a jerk.&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;EDIT&lt;/span&gt;: 2009-11-01 --&gt; posted &lt;a href="http://dotnetbutchering.blogspot.com/2009/11/net-how-to-bring-window-upfront.html"&gt;How to Bring Window Upfront&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8644953626991146581?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8644953626991146581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8644953626991146581' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8644953626991146581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8644953626991146581'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/10/net-how-to-check-if-app-is-already.html' title='[.NET] How to check if app is already running'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6439596891855269059</id><published>2009-10-15T20:29:00.012+01:00</published><updated>2009-10-16T10:37:26.216+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='XmlDoc'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='XmlReader'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>[.NET] XmlDocument VS XmlReader</title><content type='html'>&lt;div style="text-align: justify;"&gt;To cut a long story short I recently learned (thanks to a co-worker) that &lt;span style="font-weight:bold;"&gt;XmlDocument performance sucks&lt;/span&gt;.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;It's very handy to manipulate XML stuff with XmlDocument because it comes with all the DOM stuff, and for example you can use XPath for node selection like this:&lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;// load up the xml doc&lt;br /&gt;XmlDocument doc = new XmlDocument();&lt;br /&gt;doc.Load(filename);&lt;br /&gt;&lt;br /&gt;// get a list of all the nodes you need with xPath&lt;br /&gt;XmlNodeList nodeList = doc.SelectNodes("root/whatever/nestedWhatever");&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The above is quite cool and it works just fine if you're not loading hundreds of files  for a total size of hundreds of MBs, in which case you'll notice a lethal blow to performance.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;If you need speed you wanna go with XmlReader, a bare bones class that will scan the old way (forward only) element after element your XML file. Bad thing is that you won't have all the nice DOM stuff, so you'll have to manually parse elements retrieving innerText and/or attribute values. An example:&lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;XmlReader xmlReader = XmlReader.Create(fileName);&lt;br /&gt;&lt;br /&gt;while (xmlReader.Read())&lt;br /&gt;{&lt;br /&gt;//keep reading until we see my element&lt;br /&gt;if (xmlReader.Name.Equals("myElementName") &amp;amp;&amp;amp; (xmlReader.NodeType == XmlNodeType.Element))&lt;br /&gt;{&lt;br /&gt;  // get attributes (or innerText) from the Xml element here&lt;br /&gt;  string whatever = xmlReader.GetAttribute("whatever");&lt;br /&gt;  // do stuff&lt;br /&gt;}&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I can't be bothered benchmarking as it bores the sh*t out of me - but performance increases a &lt;b&gt;whole lot &lt;/b&gt;with XmlReader, and if you want figures to look at you can find plenty on google (this guy &lt;a href="http://www.nearinfinity.com/blogs/joe_ferner/performance_linq_to_sql_vs.html"&gt;here&lt;/a&gt; did a pretty good job for example) and &lt;a href="http://www.hanselman.com/blog/CommentView.aspx?guid=276"&gt;here&lt;/a&gt;'s another good overview of XML classes (from Scott Hanselman's blog).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Anyway - here comes the common sense advice - &lt;i&gt;whatever you're doing go with XmlDocument, if it's too slow for you needs switch over to XmlReader and you'll be grand&lt;/i&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6439596891855269059?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6439596891855269059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6439596891855269059' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6439596891855269059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6439596891855269059'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/10/net-xmldocument-vs-xmlreader.html' title='[.NET] XmlDocument VS XmlReader'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2898120464839285768</id><published>2009-10-03T18:35:00.006+01:00</published><updated>2009-10-03T18:50:46.362+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GITHUB'/><category scheme='http://www.blogger.com/atom/ns#' term='Gitbash'/><category scheme='http://www.blogger.com/atom/ns#' term='GIT'/><title type='text'>GIT + GITHUB --&gt; How to setup local repository</title><content type='html'>&lt;div style="text-align: justify;"&gt;Once the code is up on Github (for example if you need to pull your buddy's code from github 'cause he's too cool for SVN), after you install &lt;a href="http://code.google.com/p/msysgit/"&gt;any git package&lt;/a&gt; for windows it's quite easy to setup a local repository for git and pull your stuff from github.&lt;/div&gt;&lt;br /&gt;Browse to your local repository from &lt;span style="font-style:italic;"&gt;gitbash&lt;/span&gt; and this is how it's done in just 3 lines:&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;span style="font-weight:bold;"&gt;//init git local repo&lt;br /&gt;git init&lt;br /&gt;&lt;br /&gt;//register github user + repo&lt;br /&gt;git remote add origin git@github.com:UsEr/repOsitOry.git&lt;br /&gt;&lt;br /&gt;//pull the stuff&lt;br /&gt;git pull origin master&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;In order to be able to talk to the github servers from your machine you need to setup&lt;i&gt; the ssh stuff&lt;/i&gt;, which I am not covering because I can't be bothered and you can read all about it &lt;a href="http://help.github.com/msysgit-key-setup/"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2898120464839285768?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2898120464839285768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2898120464839285768' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2898120464839285768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2898120464839285768'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/10/git-github-how-to-setup-local.html' title='GIT + GITHUB --&gt; How to setup local repository'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6094090063344322545</id><published>2009-10-01T21:57:00.007+01:00</published><updated>2009-10-01T22:27:16.346+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JDO'/><category scheme='http://www.blogger.com/atom/ns#' term='Google-Datastore'/><category scheme='http://www.blogger.com/atom/ns#' term='Google App Engine'/><category scheme='http://www.blogger.com/atom/ns#' term='JAVA'/><title type='text'>How to mimic SQL WHERE clause on Google Datastore queries</title><content type='html'>This puzzled me for a while as I never used JDO before crashing the app-engine party. &lt;br /&gt;&lt;br /&gt;Assuming we have an &lt;span style="font-style:italic;"&gt;Order&lt;/span&gt; class with a member variable named &lt;span style="font-style:italic;"&gt;customer&lt;/span&gt; of type &lt;span style="font-style:italic;"&gt;User&lt;/span&gt;:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;//get current user&lt;br /&gt;UserService userService = UserServiceFactory.getUserService();&lt;br /&gt;User user = userService.getCurrentUser();&lt;br /&gt;&lt;br /&gt;//prepare query&lt;br /&gt;PersistenceManager pm = PMF.get().getPersistenceManager();&lt;br /&gt;String select_query = "select from " + Order.class.getName(); &lt;br /&gt;Query query = pm.newQuery(select_query); &lt;br /&gt;query.setFilter("customer == paramCustomer"); &lt;br /&gt;query.declareParameters("com.google.appengine.api.users.User paramCustomer"); &lt;br /&gt;&lt;br /&gt;//execute query&lt;br /&gt;List&amp;lt;OrderDTO&amp;gt; result= OrderUtils.getOrderDTOList((List&amp;lt;Order&amp;gt;) query.execute(user));&lt;br /&gt;&lt;br /&gt;//feck-off --&gt; I'll never get an MVP but I can swear on my blog!&lt;br /&gt;pm.close();&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Just wanted to share to spare some random googler (you) the same process.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6094090063344322545?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6094090063344322545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6094090063344322545' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6094090063344322545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6094090063344322545'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/10/how-to-fetch-stuff-by-user-from-google.html' title='How to mimic SQL WHERE clause on Google Datastore queries'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8013209484519489507</id><published>2009-09-26T14:20:00.007+01:00</published><updated>2009-09-26T14:48:45.762+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Google-Datastore'/><category scheme='http://www.blogger.com/atom/ns#' term='Google App Engine'/><title type='text'>Google App Engine for JAVA Local Data Viewer!</title><content type='html'>&lt;div style="text-align: justify;"&gt;I've been screaming like a sissy for a  local Data Viewer since I put my hands on the Google App Engine. Turns out it has been there for a while (definitely &lt;a href="http://googleappengine.blogspot.com/2009/07/google-app-engine-for-java-sdk-122.html"&gt;not from the beginning&lt;/a&gt;) but I didn't know. It can be accessed when you're running the development server locally from the following URL (assuming you're running the default setup): &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="color:#CC0000;"&gt;http://localhost:8080/_ah/admin/&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;You can browse your data and delete records but for the time being (at least on Java App Engine) edit operations are not supported, so don't bin just yet your dirty little hacks (a bunch of servlets in my case) for local development.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8013209484519489507?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8013209484519489507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8013209484519489507' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8013209484519489507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8013209484519489507'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/09/google-app-engine-local-data-viewer.html' title='Google App Engine for JAVA Local Data Viewer!'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7356510796646271719</id><published>2009-09-04T14:46:00.008+01:00</published><updated>2009-09-04T15:20:38.335+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='ListView'/><category scheme='http://www.blogger.com/atom/ns#' term='ScrollViewer'/><title type='text'>How to set WPF ListView or ScrollViewer Scrollbar width</title><content type='html'>&lt;div style="text-align: justify;"&gt;A pretty common dirty hack to modify the scrollbars width is to set the OS value for scrollbars width to whatever you need in your app - this obviously &lt;span style="font-style:italic;"&gt;sucks&lt;/span&gt; as not only your application will be affected.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;In WPF you can override scrollbars width in both &lt;span style="font-weight:bold;"&gt;ListView&lt;/span&gt; and &lt;span style="font-weight:bold;"&gt;ScrollViewer&lt;/span&gt; controls pretty easily with the following XAML markup.&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;1) &lt;/span&gt;Include mscorlib with the sys prefix (or whatever prefix you want) in the page declaration:&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;Page x:Class="AtlasPrototype.VehicleIdHistory"&lt;br /&gt;  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br /&gt;  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;xmlns:sys="clr-namespace:System;assembly=mscorlib"&lt;/span&gt;&lt;br /&gt;  DataContext="{Binding RelativeSource={RelativeSource Self}}"&lt;br /&gt;  Title="VehicleIdHistory"&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;2)&lt;/b&gt; Override vertical scrollbar width resource for the ScrollViewer (exact same for a ListView):&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;ScrollViewer&amp;gt;&lt;br /&gt; &amp;lt;ScrollViewer.Resources&amp;gt;&lt;br /&gt;    &lt;span style="font-weight:bold;"&gt;&amp;lt;sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}"&amp;gt;60&amp;lt;/sys:Double&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;lt;/ScrollViewer.Resources&amp;gt;&lt;br /&gt; &amp;lt;-- other stuff --&amp;gt;&lt;br /&gt;&amp;lt;/ScrollViewer&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Sounds all cool and easy but I had to &lt;strike&gt;beg&lt;/strike&gt; work hard on &lt;a href="http://stackoverflow.com/questions/1321247/how-to-increase-scrollbar-width-in-wpf-scrollviewer"&gt;stackoverflow&lt;/a&gt; to get this figured out. Show due Respect.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-7356510796646271719?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7356510796646271719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7356510796646271719' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7356510796646271719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7356510796646271719'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/09/how-to-set-wpf-listview-or-scrollviewer.html' title='How to set WPF ListView or ScrollViewer Scrollbar width'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-498282661258365283</id><published>2009-09-03T20:30:00.005+01:00</published><updated>2009-09-03T21:10:41.204+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>How to check if WPF is using Hardware or Software Rendering?</title><content type='html'>&lt;div style="text-align: justify;"&gt;In general, software rendering will usually kick-in if your machine doesn't support DirectX or if the drivers installed are not working correctly (for whatever reason). WPF is entirely built on Direct3D, and software rendering means your WPF app will run &lt;span style="font-style:italic;"&gt;painfully slow&lt;/span&gt;. &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;In borderline scenarios, such as running on portable device where hardware capability is constrained, you might find yourself in a bit of a mexican standoff situation where you don't know if the bottleneck is the hardware itself or the problem is just that hardware acceleration is not working and the system falls back to software rendering. So, how do you check if software rendering is kicking in?&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;You can do this from code querying the RenderCapability.Tier property, as follows:&lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;//shifting some 16 bits will do the trick&lt;br /&gt;int renderCapabilityTier = (RenderCapability.Tier &amp;gt;&amp;gt; 16);&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;The int above can have three possible values:&lt;div&gt;&lt;ul&gt;&lt;li&gt;0 --&gt; you're screwed - no hardware acceleration&lt;/li&gt;&lt;li&gt;1 --&gt; you're half screwed - you got &lt;i&gt;some&lt;/i&gt; hardware acceleration&lt;/li&gt;&lt;li&gt;2 --&gt; you're good to go with full blown hardware acceleration&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;You might also wanna run the DirectX diagnostic tool (just run dxdiag.exe) to double check the state of your hardware acceleration (check the display tab) and, since we are at it, the new &lt;a href="http://windowsclient.net/wpf/perf/wpf-perf-tool.aspx#perforator"&gt;WPF profiler&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-498282661258365283?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/498282661258365283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=498282661258365283' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/498282661258365283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/498282661258365283'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/09/how-to-check-if-wpf-is-using-hardware.html' title='How to check if WPF is using Hardware or Software Rendering?'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7420974437081240958</id><published>2009-08-26T09:18:00.013+01:00</published><updated>2009-08-26T17:16:51.308+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='layout'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='ListView'/><title type='text'>How to set WPF ListView alternate row color</title><content type='html'>Another common task you might have to tackle when working with WPF ListView is &lt;span style="font-weight:bold;"&gt;setting the background color for the rows in an alternate fashion&lt;/span&gt; (odd rows and even rows - you know what I mean).&lt;br /&gt;&lt;br /&gt;This is how you do it.&lt;br /&gt;&lt;br /&gt;First thing, create a style element in your &lt;span style="font-style:italic;"&gt;ResourceDictionary&lt;/span&gt; or if you don't have one drop it on the page itself: &lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;Style x:Key="alternatingListViewItemStyle" TargetType="{x:Type ListViewItem}"&gt;&lt;br /&gt;     &amp;lt;Style.Triggers&amp;gt;&lt;br /&gt;         &amp;lt;!-- setting up triggers for alternate background colors --&amp;gt;&lt;br /&gt;         &amp;lt;Trigger Property="ItemsControl.AlternationIndex" Value="1"&amp;gt;&lt;br /&gt;             &amp;lt;Setter Property="Background" Value="LightGray"&amp;gt;&amp;lt;/Setter&amp;gt;&lt;br /&gt;         &amp;lt;/Trigger&amp;gt;&lt;br /&gt;         &amp;lt;Trigger Property="ItemsControl.AlternationIndex" Value="2"&amp;gt;&lt;br /&gt;             &amp;lt;Setter Property="Background" Value="White"&amp;gt;&amp;lt;/Setter&amp;gt;&lt;br /&gt;         &amp;lt;/Trigger&amp;gt;&lt;br /&gt;     &amp;lt;/Style.Triggers&amp;gt;&lt;br /&gt;     &amp;lt;!-- setting row height here --&amp;gt; &lt;br /&gt;     &amp;lt;Setter Property="Height" Value="30" /&gt;&lt;br /&gt;&amp;lt;/Style&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Now set the &lt;span style="font-style:italic;"&gt;ItemContanerStyle&lt;/span&gt; on the actual ListView and set the &lt;span style="font-style:italic;"&gt;AlternationCount&lt;/span&gt; attribute):&lt;br /&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;ListView Name="recordContainer" ItemContainerStyle="{StaticResource alternatingListViewItemStyle}" AlternationCount="2" &amp;gt;&lt;br /&gt;   &amp;lt;ListView.View&amp;gt;&lt;br /&gt;      &amp;lt;GridView&amp;gt;&lt;br /&gt;         &amp;lt;!-- Just a few sample columns --&amp;gt;         &lt;br /&gt;         &amp;lt;GridViewColumn Header="aField" /&amp;gt;&lt;br /&gt;         &amp;lt;GridViewColumn Header="anotherField" /&amp;gt;&lt;br /&gt;         &amp;lt;GridViewColumn Header="yetAnotherField" /&amp;gt;&lt;br /&gt;      &amp;lt;/GridView&amp;gt;&lt;br /&gt;   &amp;lt;/ListView.View&amp;gt;&lt;br /&gt;   &amp;lt;!-- Whatever you might have in here --&amp;gt;&lt;br /&gt;&amp;lt;/ListView&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;And this is all there is to it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-7420974437081240958?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7420974437081240958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7420974437081240958' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7420974437081240958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7420974437081240958'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/08/how-to-set-wpf-listview-alternate-row.html' title='How to set WPF ListView alternate row color'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8609757262593726261</id><published>2009-08-14T15:22:00.008+01:00</published><updated>2009-08-16T22:15:51.982+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='ListView'/><title type='text'>How to set WPF ListView selected item background color</title><content type='html'>&lt;div style="text-align: justify;"&gt;After &lt;a href="http://dotnetbutchering.blogspot.com/2009/08/how-to-set-row-height-in-wpf-listview.html"&gt;my last post&lt;/a&gt; I came across another common WPF task that could result in excruciating frustration if you're not using Expression Blend (or you just don't know enough about this &lt;strike&gt;shit&lt;/strike&gt; nice framework): &lt;b&gt;setting the color of the selected item in a ListView&lt;/b&gt;.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;This is how you do it:&lt;/div&gt;&lt;div&gt;&lt;pre class="code"&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;ListView&amp;gt;&lt;br /&gt;&amp;lt;ListView.Style&amp;gt;&lt;br /&gt;  &amp;lt;Style TargetType="{x:Type ListView}"&amp;gt;&lt;br /&gt;    &amp;lt;Setter Property="BorderBrush" Value="Black"/&amp;gt;&lt;br /&gt;    &amp;lt;Setter Property="BorderThickness" Value="0"/&amp;gt;&lt;br /&gt;    &amp;lt;Setter Property="Margin" Value="0"/&amp;gt;&lt;br /&gt;    &amp;lt;!-- here we go --&amp;gt;&lt;br /&gt;    &amp;lt;Style.Resourcesgt&amp;gt;&lt;br /&gt;      &amp;lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Black"/&amp;gt;&lt;br /&gt;      &amp;lt;SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Gray"/&amp;gt;&lt;br /&gt;    &amp;lt;/Style.Resources&amp;gt;&lt;br /&gt;  &amp;lt;/Style&amp;gt;&lt;br /&gt;&amp;lt;/ListView.Style&amp;gt;&lt;br /&gt;&amp;lt;!-- other stuff --&amp;gt;&lt;br /&gt;&amp;lt;ListView&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Hope it helps - if so you can express your gratitude by randomly upvoting some of my answers on &lt;a href="http://stackoverflow.com/users/19967/johnidol"&gt;stackoverflow&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8609757262593726261?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8609757262593726261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8609757262593726261' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8609757262593726261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8609757262593726261'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/08/how-to-set-wpf-listview-selected-item.html' title='How to set WPF ListView selected item background color'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-9216373038987044933</id><published>2009-08-07T19:26:00.006+01:00</published><updated>2009-11-04T10:53:39.057Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='ListView'/><title type='text'>How to set row height in WPF ListView</title><content type='html'>&lt;div style="text-align: justify;"&gt;I've been checking out WPF lately for some prototyping work and came across something that's gotta be a very common show-stopper for beginners: I had a ListView element setup as a grid and no clue about how to set row height (without increasing font text - should go without saying).&lt;/div&gt;&lt;br /&gt;This is a nice way of doing it (thanks &lt;a href="http://stackoverflow.com/questions/1244090/how-to-set-wpf-listview-row-height"&gt;stackoverflow&lt;/a&gt;):&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;ListView&amp;gt;&lt;br /&gt;  &amp;lt;ListView.ItemContainerStyle&amp;gt;&lt;br /&gt;      &amp;lt;Style TargetType="ListViewItem"&amp;gt;&lt;br /&gt;            &amp;lt;Setter Property="Height" Value="50" /&amp;gt;&lt;br /&gt;      &amp;lt;/Style&gt;&lt;br /&gt;  &amp;lt;/ListView.ItemContainerStyle&amp;gt;&lt;br /&gt;  &amp;lt;!-- WHATEVER --&amp;gt;&lt;br /&gt;&amp;lt;/ListView&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;That's what you get if you try to do some WPF magic without an Expression Blend license, which reminds me the good old days of editing html manually and feeling a God (except the God part).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-9216373038987044933?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/9216373038987044933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=9216373038987044933' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/9216373038987044933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/9216373038987044933'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/08/how-to-set-row-height-in-wpf-listview.html' title='How to set row height in WPF ListView'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2630083713878662893</id><published>2009-07-22T22:33:00.008+01:00</published><updated>2009-07-22T23:59:41.199+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='paypal'/><category scheme='http://www.blogger.com/atom/ns#' term='servlet'/><category scheme='http://www.blogger.com/atom/ns#' term='JAVA'/><title type='text'>IPN delivery failed. HTTP error code 405: Method Not Allowed</title><content type='html'>&lt;div style="text-align: justify;"&gt;I was trying to test a servlet I wrote to process payapal IPN notifications (my servlet is very similar to the jsp in &lt;a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=p/pdn/ipn-codesamples-pop-outside#java"&gt;this example&lt;/a&gt;) and even after enabling all the IPN settings in the paypal test account the IPN was not firing at all after the payment, or at least so I thought because my servlet wasn't logging anything.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I then found out that in the sandbox you can thest IPN notifications through the IPN simulator, which also gives you handy error codes in case of failed transactions, such as:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;&lt;div style="text-align: justify;"&gt;IPN delivery failed. HTTP error code 405: Method Not Allowed&lt;/div&gt;&lt;/b&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Thanks to this I then realized that in my servlet I was only implementing the doGet method but not the doPost. Without the doPost method implemented the servlet won't accept any HTML POSTs, thus the error 405. Implementing the doPost (same code as doGet) method solved the problem.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Morale of the story: Paypal integration can be a bitch.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2630083713878662893?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2630083713878662893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2630083713878662893' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2630083713878662893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2630083713878662893'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/07/ipn-delivery-failed-http-error-code-405.html' title='IPN delivery failed. HTTP error code 405: Method Not Allowed'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4887576110778169608</id><published>2009-06-30T20:14:00.005+01:00</published><updated>2009-06-30T20:50:07.127+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='conversion'/><category scheme='http://www.blogger.com/atom/ns#' term='VS2005'/><category scheme='http://www.blogger.com/atom/ns#' term='VS2008'/><category scheme='http://www.blogger.com/atom/ns#' term='msi'/><title type='text'>Converting MSI Project from VS2005 to VS2008 - Welcome Back to (DLL) Hell</title><content type='html'>&lt;div style="text-align: justify;"&gt;Just a few lines to outline something I've recently found out about &lt;span style="font-weight:bold;"&gt;converting msi projects from vs2005 to vs2008&lt;/span&gt;.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;After upgrading to VS2008, we've been trying at work to convert everything to 2008. Everything built straightaway, "happy days", we thought. &lt;/div&gt;&lt;div style="text-align: justify;"&gt;Comes the first release of &lt;a href="http://dotnetbutchering.blogspot.com/2008/10/unmentionable-necronomicon-of-legacy.html"&gt;THE legacy product&lt;/a&gt; we start realizing something is not quite right - the msi is not overwriting all the dlls packaged as expected (this was the behavior on a vs2005 build, where everything was being replaced independently of the version). Also when spawning an msi installation as another process the installation fails and rolls back (which is a always a good crack).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;After a bit of digging, looks like good old MS managed to sneak in and ship with vs2008 a fix to the RemoveExistingProducts sequence for msi projects whit the result that &lt;span style="font-weight:bold;"&gt;msis do not replace files on a vs2008 build unless the version number of the files is greater or has a wildcard in it (i.e x.x.x.*)&lt;/span&gt;.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Possible solutions? there's plenty, here we go:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li style="text-align: justify;"&gt;Increase the msi project version every release to force an overwrite&lt;/li&gt;&lt;li style="text-align: justify;"&gt;Increase single dlls versions (as a decent shop should do) where necessary&lt;/li&gt;&lt;li style="text-align: justify;"&gt;Throw wildcards in all your dlls and go home happy&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Great - but this doesn't seem to play quite right with COM interoperability where increasing version numbers or the wildcard trick doesn't seem to serve the purpose. &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;It's back to DLL Hell all over again, and it's time to get creative.&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Good luck (any suggestion appreciated).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4887576110778169608?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4887576110778169608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4887576110778169608' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4887576110778169608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4887576110778169608'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/06/converting-msi-project-from-vs2005-to.html' title='Converting MSI Project from VS2005 to VS2008 - Welcome Back to (DLL) Hell'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-884065574667538869</id><published>2009-06-09T01:19:00.005+01:00</published><updated>2009-06-09T01:36:48.283+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Google App Engine'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Mail Service'/><title type='text'>Google App-Engine Mail Service: Unauthorized Sender Error</title><content type='html'>I was messing around with the Google App-Engine mail service and I stumbled upon a little gotcha that I feel like sharing.&lt;br /&gt;&lt;br /&gt;To cut a long story short - you can send emails though the mail service only from emails of accounts (google accounts or other Google app domains) &lt;span style="font-weight:bold;"&gt;registered as Developers from the Google app engine dashboard&lt;/span&gt; (Google App-Engine--&gt; Dashboard--&gt; Developers).&lt;br /&gt;&lt;br /&gt;It took me a while to figure this out because:&lt;div&gt;&lt;ol&gt;&lt;li&gt;It doesn't make any sense: assume you wanna setup an admin account to send out mini-reports from your scheduled cron jobs, in this scenario you're supposed to setup your admin@yourDomain.com as a Developer!?&lt;/li&gt;&lt;li&gt;I am linking this Google app deployed to appspot to a domain I have registered with Google, so I thought the app could send emails only from accounts registered as administrator of my given domain, which would make slightly more sense!&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;But then - I can only blame myself  'cause the &lt;a href="http://code.google.com/appengine/docs/java/mail/usingjavamail.html#Senders_and_Recipients"&gt;documentation&lt;/a&gt; clearly says:&lt;blockquote&gt;The sender must be either the address of a registered developer for the application, or the address of the user for the current request signed in with a Google Account.&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;As a matter of fact, &lt;i&gt;I never read the documentation&lt;/i&gt; till I am desperate (who does?).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-884065574667538869?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/884065574667538869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=884065574667538869' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/884065574667538869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/884065574667538869'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/06/google-app-engine-mail-service.html' title='Google App-Engine Mail Service: Unauthorized Sender Error'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6533634508968868565</id><published>2009-05-23T13:45:00.004+01:00</published><updated>2009-05-23T14:09:03.155+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2005'/><title type='text'>[SQLServer2005] Select from Excel Spreadsheet for SQL-Rejects</title><content type='html'>&lt;div style="text-align: justify;"&gt;This is DBA bread and butter - not being a DBA and having no will whatsoever to become one (I am too weak) I always forget the syntax for this procedure, so here we go.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;In order to be able to query an excel spreadsheet we need to &lt;span style="font-weight:bold;"&gt;enable ad hoc distributed queries&lt;/span&gt;, to do so follow the procedure in &lt;a href="http://dotnetbutchering.blogspot.com/2009/05/sqlserver2005-enable-ad-hoc-distributed.html"&gt;this other post&lt;/a&gt;.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Once that's sorted - assuming you have an excel spreadsheet with column names (in the example I have Column1, Column2, Column3, Column4) in the first row - this is how you go about selecting the spreadsheet content into a temporary table:&lt;/div&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;USE myDB&lt;br /&gt;&lt;br /&gt;-- drop temp table&lt;br /&gt;DROP TABLE #tempTable&lt;br /&gt;&lt;br /&gt;-- select spreadsheet content into #tempTable&lt;br /&gt;SELECT S.[Column1], S.[Column2], S.[Column3], S.[Column4]&lt;br /&gt;INTO #tempTable&lt;br /&gt;FROM OPENROWSET&lt;br /&gt;('Microsoft.Jet.OLEDB.4.0',&lt;br /&gt;'Excel 8.0;Database=C:\mtSpreadsheet.xls;HDR=YES',&lt;br /&gt;'select * from [Query1$]') AS S;&lt;br /&gt;&lt;br /&gt;-- check if the stuff is there&lt;br /&gt;select *&lt;br /&gt;from #tempTable&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;That's it. Hope it helps some other fellow SQL-Reject.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6533634508968868565?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6533634508968868565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6533634508968868565' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6533634508968868565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6533634508968868565'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/05/sqlserver2005-select-from-excel.html' title='[SQLServer2005] Select from Excel Spreadsheet for SQL-Rejects'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-5592859889412054104</id><published>2009-05-20T17:59:00.004+01:00</published><updated>2009-05-20T18:22:48.884+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2005'/><title type='text'>[SQLServer2005] Enable Ad hoc distributed queries</title><content type='html'>&lt;div style="text-align: justify;"&gt;The &lt;span style="font-weight:bold;"&gt;Ad Hoc Distrubuted Queries&lt;/span&gt; advanced feature is disabled by default - it needs to be enabled if you wanna run OpenRowSet or OpenDataSource operations (queries on excel spreadsheets and other stuff). &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;To enable it run the following script and you should be OK:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;-- allows you to see advaced options status&lt;br /&gt;sp_configure 'show advanced options', 1&lt;br /&gt;RECONFIGURE&lt;br /&gt;GO&lt;br /&gt;-- enables Ad Hoc Distributed Queries&lt;br /&gt;sp_configure 'Ad Hoc Distributed Queries', 1&lt;br /&gt;RECONFIGURE&lt;br /&gt;GO&lt;br /&gt;-- shows you the full list of features&lt;br /&gt;sp_configure&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The same result can be achieved by opening SQL Server Area Configuration tool &lt;span style="font-weight:bold;"&gt;for features&lt;/span&gt; and after picking Ad Hoc Distributed Queries ticking the "&lt;span style="font-style:italic;"&gt;Enable ...&lt;/span&gt;" checkbox.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;That'd be all.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-5592859889412054104?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/5592859889412054104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=5592859889412054104' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5592859889412054104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5592859889412054104'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/05/sqlserver2005-enable-ad-hoc-distributed.html' title='[SQLServer2005] Enable Ad hoc distributed queries'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4700516366650883373</id><published>2009-05-04T14:56:00.006+01:00</published><updated>2009-05-06T16:39:11.903+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cross browser'/><category scheme='http://www.blogger.com/atom/ns#' term='css-positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>[CSS] Center DIV within DIV</title><content type='html'>This is one of those that'll give you nightmares.&lt;br /&gt;&lt;br /&gt;You have a wrapper div and an inner DIV:&lt;div class="code"&gt;&lt;code&gt;&lt;pre&gt;&amp;lt;div id="wrapper"&amp;gt;&lt;br /&gt;&amp;lt;div id="inner"&amp;gt;&lt;br /&gt;  &amp;lt;!-- your rubbish here --&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Css styling below will do the trick - &lt;span style="font-style:italic;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;text-align: center&lt;/span&gt;&lt;/span&gt; will work on IE but won't work on other browsers (css compliant) which require &lt;span style="font-style:italic;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;margin: 0 auto&lt;/span&gt;&lt;/span&gt;:&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;/* for IE */&lt;br /&gt;div#wrapper {&lt;br /&gt;text-align: center;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div#inner {&lt;br /&gt;margin: 0 auto; /* this centers the DIV */&lt;br /&gt;width: 30%; /* whatever */&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;alternatively you could set left and right margin separately.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4700516366650883373?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4700516366650883373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4700516366650883373' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4700516366650883373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4700516366650883373'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/05/css-center-div-within-div.html' title='[CSS] Center DIV within DIV'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4925855900203106297</id><published>2009-05-03T00:11:00.003+01:00</published><updated>2009-05-03T00:43:09.447+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Google App Engine'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><title type='text'>[Google App Engine] How to Clear SDK Datastore</title><content type='html'>&lt;div style="text-align: justify;"&gt;To clear the SDK datastore you'll just have to delete the following file: &lt;span style="font-weight:bold;"&gt;"./WEB-INF/appengine-generated/local_db.bin"&lt;/span&gt;. The file will be generated for you again next time you run the development server and you'll have a clear db.&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;This is one of the little gotchas that come in handy when you start playing with the Google Application Engine. You'll find yourself persisting objects into the datastore then changing the JDO object model for your persistable entities ending up with a obsolete data that'll make your app crash all over the place.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4925855900203106297?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4925855900203106297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4925855900203106297' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4925855900203106297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4925855900203106297'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/05/google-app-engine-how-to-clear-sdk.html' title='[Google App Engine] How to Clear SDK Datastore'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1801434731882926107</id><published>2009-04-30T20:11:00.010+01:00</published><updated>2009-05-01T10:13:16.743+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pinal Dave'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>[SQL] How to escape single quotes in the words of Pinal Dave</title><content type='html'>I will answer this SQL riddle in the words of &lt;a href="http://blog.sqlauthority.com/"&gt;Pinal Dave&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Jr. Developer asked me other day how to escape single quote?&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;User can escape single quote using two single quotes (NOT double quote).&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/blockquote&gt;In case you need it (I doubt it) he also provides a great &lt;a href="http://blog.sqlauthority.com/2008/02/17/sql-server-how-to-escape-single-quotes-fix-error-105-unclosed-quotation-mark-after-the-character-string/"&gt;example&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The man is a SQL master, and if you're a Jr.Developer (I am not but when it comes to SQL I am probably less than that) you gotta &lt;a href="http://twitter.com/pinaldave"&gt;follow him on twitter&lt;/a&gt;. &lt;span class="Apple-style-span" style="font-style: italic;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Another way of injecting single quotes using CHAR(39):&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;DECLARE @&lt;a href="http://twitter.com/IanQuigley"&gt;IanQuigley&lt;/a&gt; as varchar(MAX)&lt;br /&gt;SET @&lt;a href="http://www.ianquigley.com"&gt;IanQuigley&lt;/a&gt; = 'Thanks, I don' + CHAR(39) + 't know much about SQL'&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;I did my worst - as usual.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1801434731882926107?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1801434731882926107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1801434731882926107' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1801434731882926107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1801434731882926107'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/04/sql-how-to-escape-single-quotes-in.html' title='[SQL] How to escape single quotes in the words of Pinal Dave'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2728162989269576487</id><published>2009-04-23T22:29:00.010+01:00</published><updated>2009-04-24T18:03:55.547+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='div-positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>[CSS] DIVs next to each other (and DIVs VS Tables all over again)</title><content type='html'>Let me guess - you need a page header/footer and you wanna use DIVs 'cause your buddy on digg or reddit says tables are soooooooo uncool? &lt;div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Here's a few CSS classes that will get you were you want to be:&lt;br /&gt;&lt;/div&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;.left {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;width: 80%;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;heigth: 10%;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;position: relative;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;float: left;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;.right {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;width: 20%;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;heigth: 10%;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;position: relative;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;float: right;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;.wrapper {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;width: 100%;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;position: relative;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;clear: both;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;And here's an example of the markup you might be looking for:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;&amp;lt;div class="wrapper"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt; &amp;lt;div class="left"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;  &amp;lt;!-- Whatever - maybe a lame logo --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt; &amp;lt;div class="right"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;  &amp;lt;!-- Whatever - maybe login stuff --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;&amp;lt;div class="wrapper"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt; &amp;lt;!-- Content --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;You can repeat this basic Header structure as much as you want if you need nested divs to resemble (here I say it) &lt;span style="font-style: italic;"&gt;tables&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;But - on a side note - using a table would be much more intuitive 'cause you know what a table is and how it looks like. You certainly don't need to remember loads of crazy CSS properties semantically and visually unrelated to what your trying to do.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Ok, if we're really doing this ... truth is everyone started using DIVs because the word has been spread that using nested tables is unprofessional. &lt;a href="http://www.smashingmagazine.com/2009/04/08/from-table-hell-to-div-hell/"&gt;This is not totally untrue&lt;/a&gt;, but guess what - nesting hundreds of DIVs will bring you nowhere good in terms of maintainability at much lower speed.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;My personal choice is a moderate one, try to stay in control finding the balance using a bit of both, DIVs within tables or tables within DIVs, to keep the built-in simplicity of tables and the advantages of DIVs.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Look at this:&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0);"&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); text-decoration: underline;"&gt;&lt;img src="http://4.bp.blogspot.com/_LLByA-cjSbY/SfHwMFQQSFI/AAAAAAAAAFU/D_QJaAYmmQU/s400/AmazonLLovesTables.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5328303924515457106" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 202px; " /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;If Amazon uses that many nested tables (that's 35 results for the table opening tag in the home page) no-one's gonna bug you for using a few (except those W3C pansies).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2728162989269576487?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2728162989269576487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2728162989269576487' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2728162989269576487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2728162989269576487'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/04/css-div-next-to-each-other-and-divs-vs.html' title='[CSS] DIVs next to each other (and DIVs VS Tables all over again)'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_LLByA-cjSbY/SfHwMFQQSFI/AAAAAAAAAFU/D_QJaAYmmQU/s72-c/AmazonLLovesTables.jpg' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6390140539461486248</id><published>2009-04-20T18:57:00.008+01:00</published><updated>2009-04-21T21:32:34.338+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='inelegant'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>[SQL] Counting Rows with the Same Value of a Given Field</title><content type='html'>Here's a piss-easy script to count the number of rows in a table where a given field has the same value:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;SELECT myField, COUNT(*) AS 'inelegantCount'&lt;br /&gt;FROM myTable&lt;br /&gt;GROUP BY myField&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;It's the classic GROUP BY statement example - which I can't manage to remember, thus the blog post.&lt;div&gt;&lt;br /&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/3760169963830810897-6390140539461486248?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6390140539461486248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6390140539461486248' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6390140539461486248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6390140539461486248'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/04/sql-counting-rows-with-same-value-of.html' title='[SQL] Counting Rows with the Same Value of a Given Field'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7144673451544085631</id><published>2009-04-10T21:19:00.004+01:00</published><updated>2009-04-10T21:34:32.109+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Misc'/><title type='text'>Start Using WikiSearch Already!</title><content type='html'>&lt;div style="text-align: justify;"&gt;When I run a search I often have a peek at other people's favourite search results for that given search (from the &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;"&lt;/span&gt;&lt;span style="font-weight:bold;"&gt;see all notes for this WikiSearch" &lt;/span&gt;&lt;span style=""&gt;link&lt;/span&gt;) in the hope I won't have to spend precious seconds/minutes to find what I am looking for. Unfortunately  - even if WikiSearch has been out for a while now - the usual result is the &lt;span style="font-weight:bold;"&gt;&lt;a href="http://www.google.ie/search?q=void&amp;amp;hl=en&amp;amp;rlz=1C1GGLS_enIE291IE303&amp;amp;swm=2"&gt;void&lt;/a&gt;&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;It's well known that any respectable developer spends a fair share of time &lt;a href="http://dotnetbutchering.blogspot.com/2008/09/how-long-can-developer-survive-without.html"&gt;looking up stuff on Google&lt;/a&gt;. Wouldn't it be easier for everyone if we all started using WikiSearch? &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;Telling the good stuff from the crap would be much faster.&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/3760169963830810897-7144673451544085631?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7144673451544085631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7144673451544085631' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7144673451544085631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7144673451544085631'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/04/start-using-wikisearch-already.html' title='Start Using WikiSearch Already!'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1887296252760653709</id><published>2009-04-03T23:58:00.010+01:00</published><updated>2009-10-10T15:27:09.970+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='client-validation'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='regular expressions'/><title type='text'>Definitive Javascript RegEx Validation for Butchers</title><content type='html'>This comes back to bother me now and then - so I decided to put together a few snippets to use as base in case of client validation with RegExes.&lt;br /&gt;&lt;br /&gt;First of all the core snippet, which takes text to validate and a regex and returns a boolean:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;function regexMatch(regEx, stringToValidate)&lt;br /&gt;{&lt;br /&gt;   var oREGEXP = new RegExp(regEx);&lt;br /&gt;   return oREGEXP.test(stringToValidate);&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Often you will be validating a text field - so here's other two functions using the previous one:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;function textFieldVisualRegexValidation(textElement, regEx)&lt;br /&gt;{  &lt;br /&gt;   var returnValue = false;&lt;br /&gt;  &lt;br /&gt;   if (regexMatch(regEx, textElement.value))&lt;br /&gt;   {&lt;br /&gt;       textElement.style.backgroundColor = "green";&lt;br /&gt;       returnValue = true;&lt;br /&gt;   }&lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;       textElement.style.backgroundColor = "red";&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   return returnValue; &lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;function textFieldRegexMatch(ctrlName, regEx)&lt;br /&gt;{  &lt;br /&gt;   var elem = document.getElementById(ctrlName);&lt;br /&gt;  &lt;br /&gt;   return textFieldVisualRegexValidation(elem, regEx);&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Some event will call textFieldRegexMatch triggering the validation. You can customize textFieldVisualRegexValidation to perform some action in case of validation succeeded or failed (I am setting the input field background to green.red but one could swap images or whatever).&lt;br /&gt;&lt;br /&gt;You can hook up the above from (for example) the onBlur event of one of your textBoxes or any input field:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;onblur="textFieldRegexMatch('yourInputFieldID', regExPattern)"&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;You obviously have to declare somewhere your regExPattern:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;const regExPattern = "^[A-Z,a-z,0-9]{1,12}$";&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;I am sure there are better ways of doing the above but this is just meant as a reference to brutally Copy-Paste and tailor to your needs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1887296252760653709?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1887296252760653709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1887296252760653709' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1887296252760653709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1887296252760653709'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/04/definitive-javascript-validation-with.html' title='Definitive Javascript RegEx Validation for Butchers'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-587395418674393480</id><published>2009-03-28T21:05:00.013Z</published><updated>2009-03-28T23:29:56.111Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Genetic Algorithms'/><title type='text'>Typing Monkeys and Genetic Algorithms</title><content type='html'>&lt;div style="text-align: justify;"&gt;Recently I spent time playing with generic algorithms. I was looking for something easy enough to implement (read: PLAIN LAZY) and I found the &lt;a href="http://www.generation5.org/content/2003/gahelloworld.asp"&gt;Hello World!&lt;/a&gt; (literally) of genetic algorithms.&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;Gathering the algorithm itself from the C++ example (in the link above), I re-designed and re-coded the whole thing in C#.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-style:italic;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-style: normal; "&gt;&lt;span style="font-style:italic;"&gt;TypingMonkey&lt;/span&gt; is a very simple application which uses a number (defined by the user) of random strings to evolve the user input text.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;From the screen-shot below you can see how it took the algorithm 87 generations to evolve the string ".NET Butchering" from an initial population of 2500 random 15-characters strings:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); "&gt;&lt;img src="http://2.bp.blogspot.com/_LLByA-cjSbY/Sc6hpwgq45I/AAAAAAAAAE0/f5LgS4_yczo/s400/TypingMonkey_DotNetButchering.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5318365948739773330" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 256px; height: 400px; " /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;Why "typing monkey"? Inspired by the &lt;a href="http://en.wikipedia.org/wiki/Infinite_monkey_theorem"&gt;Infinite Monkey Theorem&lt;/a&gt;, I am pretending our population of random string is generated by a typing monkey:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;/// The Typing monkey generates random strings - can't be static 'cause it's a monkey.&lt;br /&gt;/// If you wait long enough it will eventually produce Shakespeare.&lt;br /&gt;class TypingMonkey&lt;br /&gt;{&lt;br /&gt;    private const string legalCharacters = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.";&lt;br /&gt; &lt;br /&gt;    static Random random = new Random();&lt;br /&gt; &lt;br /&gt;    /// The Typing Monkey Generates a random string with the given length.&lt;br /&gt;    public string TypeAway(int size)&lt;br /&gt;    {&lt;br /&gt;        StringBuilder builder = new StringBuilder();&lt;br /&gt;        char ch;&lt;br /&gt; &lt;br /&gt;        for (int i = 0; i &lt; size; i++)&lt;br /&gt;        {&lt;br /&gt;            ch = legalCharacters[random.Next(0, legalCharacters.Length)];&lt;br /&gt;            builder.Append(ch);&lt;br /&gt;        }&lt;br /&gt; &lt;br /&gt;        return builder.ToString();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;You can find the source code here: &lt;a href="http://github.com/JohnIdol/typingmonkey/tree/master"&gt;http://github.com/JohnIdol/typingmonkey/tree/master&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Feel free to contribute or despise.&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/3760169963830810897-587395418674393480?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/587395418674393480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=587395418674393480' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/587395418674393480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/587395418674393480'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/03/typing-monkeys-and-genetic-algorithms.html' title='Typing Monkeys and Genetic Algorithms'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_LLByA-cjSbY/Sc6hpwgq45I/AAAAAAAAAE0/f5LgS4_yczo/s72-c/TypingMonkey_DotNetButchering.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8580981635083398329</id><published>2009-03-04T01:16:00.003Z</published><updated>2009-03-04T01:24:42.109Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2000'/><title type='text'>How to figure out which SQL2000 edition is installled</title><content type='html'>&lt;div style="text-align: justify;"&gt;I recently had the problem to understand which edition (standard/developer) was installed on an old machine. This sounds like a pretty straightforward thing to do - and it is indeed IF you know you need to run the following query:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;SELECT  SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;You'd imagine you could figure this out looking at the 'about' information in enterprise manager (as in SQL2005 in SQL Management Studio) but that doesn't seem to be the case. I couldn't find any other solution.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Mysteries of MS faith.&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/3760169963830810897-8580981635083398329?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8580981635083398329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8580981635083398329' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8580981635083398329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8580981635083398329'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/03/how-to-figure-out-which-sql2000-edition.html' title='How to figure out which SQL2000 edition is installled'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-527142082260404021</id><published>2009-02-21T20:30:00.013Z</published><updated>2009-02-23T17:26:20.560Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer'/><category scheme='http://www.blogger.com/atom/ns#' term='scalability'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2000'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2008'/><title type='text'>[SQLServer] Indexing and Scalability Tips</title><content type='html'>&lt;div style="text-align: justify;"&gt;Recently I spent a lot of time messing about with indexes. Not because I like it - but because there was a little bit of a fuckup at work with scalability issues on a DB. After messing around with SQLProfiler (real life-saver in this case) I gained a bit more of understanding about indexes as I never got the chance to do before.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;What I learned about &lt;span style="font-weight:bold;"&gt;indexes and scalability&lt;/span&gt; can be summarized in 2 points:&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;br /&gt;1) &lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;You don't wanna have a clustered index on the primary key on a table once it gets huge&lt;/span&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;(just make it nonclustered) &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;if you plan on running loads of inserts&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;This is not a problem when the table is small - and since it's good for fast selects everyone's cool with it. Once the table gets populated with LOADS of records or it gets HUGE in size this WILL KILL YOU on any insert or update operation.&lt;br /&gt;&lt;br /&gt;Just to give a few figures:&lt;br /&gt;&lt;div style="text-align: justify;"&gt;- A clustered index on a table with 45 million records was &lt;span style="font-weight:bold;"&gt;killing&lt;/span&gt; my SQL server - every insert from code was resulting in nasty timeouts (it was taking more than the default 30 secs for standard inserts - Increasing your timeout tolerance won't solve your scalability problems!)&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;- A clustered index on a HUGE table (15 gigs) with a few million records was slowing down inserts to the point it was taking 15 times as much as it was taking on an empty db (we're talking mSecs but on big batches it's gonna kill you)&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;2) &lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;You wanna have a non-clustered index for frequently selected fields on any table you plan on running extensive selects on&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; (add the fields you select often to a single index&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;- On a &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;medium size&lt;/span&gt; table (40k records) select time on a given set of fields was doubling in time compared to the same table with a lot less data before adding a triple-index on the set of given fields.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Following the points above I was able to solve my scalability issues (the process I was running is now taking the same time on a huge db compared to an empty one). Obviosuly these rules are not applicable in every case - but understanding the points above might help people when 'scalability' hits the fan.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2009%2f02%2fsqlserver-indexing-and-scalability-tips.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2009%2f02%2fsqlserver-indexing-and-scalability-tips.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-527142082260404021?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/527142082260404021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=527142082260404021' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/527142082260404021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/527142082260404021'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/02/sqlserver-indexing-and-scalability-tips.html' title='[SQLServer] Indexing and Scalability Tips'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8454773842869726208</id><published>2009-02-17T23:48:00.004Z</published><updated>2009-02-20T08:55:33.427Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='VS2005'/><category scheme='http://www.blogger.com/atom/ns#' term='VS2008'/><title type='text'>[VS2008] Theming STILL sucks!</title><content type='html'>This is no breaking news - but I feel like ranting.&lt;br /&gt;&lt;br /&gt;I just noticed theming STILL sucks in Visual Studio 2008.&lt;div&gt;&lt;br /&gt;If you apply your theme to your webSite/webApp from web.config with:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;system.web&amp;gt;&lt;br /&gt;&amp;lt;pages theme="myKickAssTheme"&amp;gt;&lt;br /&gt;&amp;lt;/pages&amp;gt;&amp;lt;/system.web&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;you STILL don't get to see your CSS stylesheet(s) applied in design view - also, as part of the same problem, if you set the CssClass property of your controls it doesn't always 'see' CSS classes defined in your theme (sometimes this seems to work).&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Done ranting.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8454773842869726208?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8454773842869726208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8454773842869726208' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8454773842869726208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8454773842869726208'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/02/vs2008-theming-still-sucks.html' title='[VS2008] Theming STILL sucks!'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2280549692791504069</id><published>2009-02-15T19:22:00.008Z</published><updated>2009-02-15T19:41:59.340Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>[T-SQL] How to REPLACE on TEXT field</title><content type='html'>The &lt;span style="font-weight:bold;"&gt;REPLACE&lt;/span&gt; T-SQL function can be used only with &lt;span style="font-weight:bold;"&gt;VARCHAR&lt;/span&gt; - if you try to run &lt;span style="font-weight:bold;"&gt;REPLACE&lt;/span&gt; on a &lt;span style="font-weight:bold;"&gt;TEXT&lt;/span&gt; field you'll notice you're pretty much screwed (and that's probably how you ended up on this page in the first place).&lt;br /&gt;&lt;br /&gt;There are &lt;a href="http://stackoverflow.com/questions/289688/t-sql-replace-on-text-field"&gt;ridiculously complicated&lt;/a&gt; ways to overcome this but the easieast solution I was able to find around is the following:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;UPDATE myTable&lt;br /&gt;SET myField = REPLACE(SUBSTRING(myField, 1, DATALENGTH(myField)), 'string2replace', 'replacementString')&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;SUBSTRING&lt;/span&gt; is returning &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;VARCHAR&lt;/span&gt; so this way it works like charme.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://dotnetbutchering.blogspot.com/2008/11/how-i-feel-about-sql.html"&gt;I HATE SQL&lt;/a&gt; but I am getting to know more than I would like about it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2009%2f02%2ft-sql-how-to-replace-string-in-text.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2009%2f02%2ft-sql-how-to-replace-string-in-text.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2280549692791504069?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2280549692791504069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2280549692791504069' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2280549692791504069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2280549692791504069'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/02/t-sql-how-to-replace-string-in-text.html' title='[T-SQL] How to REPLACE on TEXT field'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-9036298009929364735</id><published>2009-02-11T20:25:00.009Z</published><updated>2009-02-11T23:37:43.283Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='VS2005'/><category scheme='http://www.blogger.com/atom/ns#' term='VS2008'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>[VS] Collapse all projects in a solution + How to setup Macro</title><content type='html'>This is not about increasing productivity - it's about being awesome.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;How many times have you been collapsing manually all the projects in your solution ranting about the fact there's no option to do that automagically? Loadza times is the answer - unless you only work on small projects (which is not a crime btw). &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Anyway - after swearing at the screen a number of times I decided it was about time to do something about it and &lt;span style="font-weight:bold;"&gt;I googled it&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;I found loads of &lt;a href="http://www.milkcarton.com/blog/2007/05/20/Using+Visual+Studio+Macros+To+Increase+Productivity.aspx"&gt;awesome VS Macros&lt;/a&gt; to do what I was looking for but I hadn't a clue about how to create a VS Macro so I thought I'd share the whole thing.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;First thing&lt;/span&gt; you need to go to Visual Studio &lt;span style="font-weight:bold;"&gt;Tools --&gt; Macros --&gt; Macro Explorer&lt;/span&gt;. &lt;span style="font-weight:bold;"&gt;Once you got that&lt;/span&gt; right click on MyMacros and create a new module (I called it CollapseAll).&lt;br /&gt;&lt;br /&gt;Now edit the new module (double-click on it) erase whatever is in there and paste this stuff into it (if you want you can even try to understand what it does - but it's optional):&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;'Awesome Macros ripped-off &lt;br /&gt;'from http://www.milkcarton.com/blog/&lt;br /&gt;&lt;br /&gt;Imports System&lt;br /&gt;Imports EnvDTE&lt;br /&gt;Imports EnvDTE80&lt;br /&gt;Imports EnvDTE90&lt;br /&gt;Imports System.Diagnostics&lt;br /&gt;&lt;br /&gt;Public Module CollapseAll&lt;br /&gt;&lt;br /&gt;Public Sub CollapseTopLevel()&lt;br /&gt;   DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate()&lt;br /&gt;&lt;br /&gt;   Dim solutionWindow As EnvDTE.Window = DTE.ActiveWindow&lt;br /&gt;   solutionWindow.Visible = False&lt;br /&gt;   Dim solution As UIHierarchyItem = GetSolution()&lt;br /&gt;&lt;br /&gt;   CollapseHierarchy(solution.UIHierarchyItems, True, True)&lt;br /&gt;   solutionWindow.Visible = True&lt;br /&gt;   DTE.StatusBar.Clear()&lt;br /&gt;   DTE.StatusBar.Progress(False)&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub CollapseHierarchy(ByRef items As UIHierarchyItems, ByVal IsRoot As Boolean, ByVal OnlyCollapseRootLevel As Boolean)&lt;br /&gt;   For i As Int32 = 1 To items.Count&lt;br /&gt;       If IsRoot Then DTE.StatusBar.Progress(True, "Collapsing", i, items.Count)&lt;br /&gt;       If (items.Item(i).UIHierarchyItems.Count &gt; 0 And Not OnlyCollapseRootLevel) Then&lt;br /&gt;           DTE.StatusBar.Text = "Collapsing " &amp;amp; items.Item(i).Name&lt;br /&gt;           CollapseHierarchy(items.Item(i).UIHierarchyItems, False, False)&lt;br /&gt;       End If&lt;br /&gt;       items.Item(i).UIHierarchyItems.Expanded = False&lt;br /&gt;   Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Function GetSolution() As UIHierarchyItem&lt;br /&gt;   Dim win As Window = DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer)&lt;br /&gt;   Dim uih As UIHierarchy = win.Object&lt;br /&gt;   GetSolution = uih.UIHierarchyItems.Item(1)&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;End Module&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Now, the hard work is done - You'll see your CollapseTopLevel as a child of the CollapseAll module in you Macro Explorer and you can run it double clicking on it but we all know that sucks so the cool thing to do now is to assign an hotkey chord/combination to our kick-ass macro.&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;To do this you need to go to Tools--&gt;Options--&gt;Environment--&gt;Keyboard. Pick your macro from the listBox with all the default VS stuff (remember it will be there like MyMacros.CollapseAll.CollapseTopLevel) and then assign a hotkey combination or chord to it (I used CTRL+K, CTRL+Y since it's not used by VS) and save. &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;That's all.&lt;br /&gt;&lt;br /&gt;P.S. I'd really like to thank &lt;a href="http://www.milkcarton.com/blog/default.aspx"&gt;Dan&lt;/a&gt;, who wrote the snippets I brutally ripped-off. The &lt;a href="http://www.milkcarton.com/blog/2007/05/20/Using+Visual+Studio+Macros+To+Increase+Productivity.aspx"&gt;original article&lt;/a&gt; is awesome and there's plenty of nitty-gritty cut and paste potential there for developers in need.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2009%2f02%2fvisualstudio-collapse-all-projects-in.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2009%2f02%2fvisualstudio-collapse-all-projects-in.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-9036298009929364735?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/9036298009929364735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=9036298009929364735' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/9036298009929364735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/9036298009929364735'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/02/visualstudio-collapse-all-projects-in.html' title='[VS] Collapse all projects in a solution + How to setup Macro'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-5665564978667578546</id><published>2009-02-02T19:44:00.003Z</published><updated>2009-02-02T20:07:12.780Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><category scheme='http://www.blogger.com/atom/ns#' term='VC++'/><title type='text'>[C++] What's the difference between BSTR and _bstr_t?</title><content type='html'>&lt;div style="text-align: justify;"&gt;I stumbled upon this recently while maintaining some old code where &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;BSTR&lt;/span&gt; and &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;_bstr_t&lt;/span&gt; were being used interchangeably. This was generating a nasty (to say the least) bug which you can read all about &lt;a href="http://stackoverflow.com/questions/324168/msxml2ixmldomdocument2ptr-getxml-messing-up-my-string"&gt;here&lt;/a&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;The main thing to understand here is that &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;BSTR&lt;/span&gt; is a dumb pointer while &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;_bstr_t&lt;/span&gt; is a class that wraps &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;BSTR&lt;/span&gt;. The difference between the two is pretty much the same between  &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;char*&lt;/span&gt; and &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;std::string&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-weight: bold;"&gt;_bstr_t&lt;/span&gt; also works like a smart pointer, so it will free the allocated memory when the variable is destroyed or goes out of scope. Another thing to say is &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;_bstr_t&lt;/span&gt; has reference counting, increased every time you pass the &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;_bstr_t&lt;/span&gt; variable by value (avoiding unnecessary copy) and decrement when it is no longer in use. Whenever all references are destroyed, the allocated memory for the string is freed up.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;More about &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;_bstr_t&lt;/span&gt; &lt;a href="http://msdn.microsoft.com/en-us/library/zthfhkd6(VS.71).aspx"&gt;here&lt;/a&gt;, more about &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;BSTR&lt;/span&gt; &lt;a href="http://msdn.microsoft.com/en-us/library/ms221069.aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;That's it folks - lousy as ever.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-5665564978667578546?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/5665564978667578546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=5665564978667578546' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5665564978667578546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5665564978667578546'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/02/c-whats-difference-between-bstr-and.html' title='[C++] What&apos;s the difference between BSTR and _bstr_t?'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-5523021555719386827</id><published>2009-01-22T01:27:00.005Z</published><updated>2009-01-22T01:58:17.949Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>[C#, C++] Cascading Constructors</title><content type='html'>In C# you can call a constructor of your class from another constructor of the same class to do something like this:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;class Cake&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;private string name;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;private int price;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;public Cake(int price, string cakeName)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;this.name = cakeName;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;this.price = price;&lt;span class="Apple-style-span" style="white-space: pre; "&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold; white-space: pre;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;//init stuff&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;public Cake(int price):this(price, "Cheesecake")&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;  //init &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;other stuff&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Unfortunately there's no way to do this in good old C++, but there are two common ways for simulating a similar behavior:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;1) Combine two (or more) constructors via default/optional parameters&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;class Cake&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;private:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold; "&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt; &lt;/span&gt;string name;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt; &lt;/span&gt;int price;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;public:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;//combines Cake() and Cake("whatever")&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;Cake(int price, string name = "Cheesecake Giovacchia")&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;this-&gt;name = name;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;this-&gt;price = price;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;2) Use an Init method to share common code&lt;/span&gt;:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;class Cake&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;private:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;int price;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;string name;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;init(int price, string name)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;//do crazy common stuff with price and name&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;public:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;Cake(int price)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;this-&gt;init(price, "Cheesecake Giovacchia");&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;Cake(int price, string cakeName)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;this-&gt;init(price, cakeName);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0); font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);"&gt;That's about it, I prefer the first solution (the second kinda sucks) but if anyone knows better I am all ears.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);"&gt;I am done sucking for today.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-5523021555719386827?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/5523021555719386827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=5523021555719386827' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5523021555719386827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5523021555719386827'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/01/c-c-cascading-constructors.html' title='[C#, C++] Cascading Constructors'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6591091766169194684</id><published>2009-01-13T18:58:00.006Z</published><updated>2009-01-16T10:22:45.927Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Misc'/><title type='text'>Ask a Google Engineer - He Won't Answer</title><content type='html'>&lt;div&gt;Recently I noticed a very promising initiative on Google Moderator: &lt;a href="http://moderator.appspot.com/#16/e=c9"&gt;Ask a Google Engineer&lt;/a&gt;.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Geeks are encouraged asking questions to Guido Van Rossum &amp;amp; Co. with no limitation - from "Do you use Google toilet paper" to the infamous interview question "&lt;a href="http://neopythonic.blogspot.com/2008/10/sorting-million-32-bit-integers-in-2mb.html"&gt;How would you sort 1 million 32-bit integers in 2MB of RAM?&lt;/a&gt;".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Turns out most of the question (roughly &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;1500&lt;/span&gt; in total so far) asked by people (roughly &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;5000&lt;/span&gt; so far) are silly complaints about how limited is this or why it's not possible to do that in gmail.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;The rest are pretty much questions studied to impress Mr.Van Rossum with very elaborated Python blabbering or people trying to understand how to find the answers for the questions they are voting. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But really - &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;where are the answers&lt;/span&gt;? There are none (almost). Seen the amount of crap they're getting they're sitting it out to enable questions to be filtered by people votes.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Not exactly a success so far I'd say (maybe also because Google moderator kind of sucks imho)!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6591091766169194684?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6591091766169194684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6591091766169194684' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6591091766169194684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6591091766169194684'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/01/ask-google-enginner-he-wont-answer.html' title='Ask a Google Engineer - He Won&apos;t Answer'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-5939694926493072707</id><published>2009-01-08T01:12:00.003Z</published><updated>2009-02-11T21:17:57.001Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='VS2005'/><category scheme='http://www.blogger.com/atom/ns#' term='VS2008'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Speed-up Visual Studio Startup!</title><content type='html'>Who thought getting rid of the splash screen could speed up Visual Studio this much?&lt;div&gt;&lt;div&gt;Add a &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;/nosplash&lt;/span&gt; to the visual studio shortcut target and see for yourself. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, the question would be WHY is it so fast without splash-screen (something dodgy going on there), but &lt;a href="http://visualstudiohacks.com/tips/save-time-at-startup-by-skipping-the-splash/"&gt;this&lt;/a&gt; really made my day!&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-5939694926493072707?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/5939694926493072707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=5939694926493072707' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5939694926493072707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5939694926493072707'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2009/01/speed-up-visual-studio-startup.html' title='Speed-up Visual Studio Startup!'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1553885559501470550</id><published>2008-12-29T01:48:00.012Z</published><updated>2008-12-29T18:49:00.138Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Testing'/><category scheme='http://www.blogger.com/atom/ns#' term='Misc'/><title type='text'>Testers are cool at prime numbers</title><content type='html'>A &lt;span class="Apple-style-span" style="font-style: italic;"&gt;software tester, a software developer, and a project manager&lt;/span&gt; are told: &lt;br /&gt;&lt;div&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 153, 153);"&gt;“All odd numbers are prime”&lt;/span&gt;&lt;/blockquote&gt;&lt;/div&gt;The &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;D&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;eveloper&lt;/span&gt;&lt;/span&gt; says:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 153, 153);"&gt;“Let's see, 3 is prime, 5 is prime, 7 is prime - looks like it‟s true”&lt;/span&gt;&lt;/blockquote&gt;The &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Project Manager&lt;/span&gt; says:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 153, 153);"&gt;“Let's see, 3 is prime, 5 is prime, 7 is prime, 9 is prime, 11 is prime –looks like it‟s true.”&lt;/span&gt;&lt;/blockquote&gt;The &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Tester&lt;/span&gt; says:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 153, 153);"&gt;“&lt;span class="Apple-style-span" style="font-style: italic;"&gt;That's silly&lt;/span&gt;, nine is a non-prime odd number - looks like it's bullshit”&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;I recently heard this &lt;span class="Apple-style-span" style="font-style: italic;"&gt;very sad&lt;/span&gt; &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;anecdote&lt;/span&gt; while attending a lecture about Software Testing. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Everybody (except maybe a Test Manager) knows the developer would look up &lt;span class="Apple-style-span" style="font-weight: bold; "&gt;&lt;a href="http://www.google.ie/search?hl=en&amp;amp;rlz=1C1GGLS_enIE291IE303&amp;amp;q=prime+numbers&amp;amp;btnG=Search&amp;amp;meta="&gt;prime numbers&lt;/a&gt;&lt;/span&gt; on google before even trying to answer.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Anyway - here's a good resource about &lt;a href="http://www.gdargaud.net/Humor/OddPrime.html"&gt;odd prime numbers humour&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1553885559501470550?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1553885559501470550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1553885559501470550' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1553885559501470550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1553885559501470550'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/12/software-testers-and-prime-numbers.html' title='Testers are cool at prime numbers'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-5122526497164587300</id><published>2008-12-24T03:15:00.010Z</published><updated>2009-02-02T19:36:16.140Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='poll'/><title type='text'>[Poll] How many development feeds can you take?</title><content type='html'>&lt;div style="text-align: justify;"&gt;To all of you information addicts out there - I was wondering how much information can people take.&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;At the moment I have 104 active subscriptions on my &lt;a href="http://www.google.com/reader/shared/00461672296143446432"&gt;google reader&lt;/a&gt;, mostly development stuff, and I can barely keep up. I do not really read all the stuff that gets posted - I scan with my eyes and if my fast forward algorithm gets some keyword that I am interested in I go back and read the post.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;If you add &lt;a href="http://twitter.com/John_Idol"&gt;twitter&lt;/a&gt; to that there's enough for an &lt;span class="Apple-style-span" style="font-style: italic;"&gt;overdose of information (&lt;/span&gt;but twitter is more about what people are doing and you don't really try to keep up if you don't wanna go mad).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;How many feeds do-you/can-you follow (assuming you have a day-job)? Check-out the poll.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;P.S. Happy Christmas to all the butchers out there from .NET Butchering &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-weight: bold;"&gt;[POLL RESULT]&lt;/span&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;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_LLByA-cjSbY/SYdK_Ew_cNI/AAAAAAAAAEo/ZP1J5MR78Qs/s1600-h/Poll_Feeds.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/_LLByA-cjSbY/SYdK_Ew_cNI/AAAAAAAAAEo/ZP1J5MR78Qs/s400/Poll_Feeds.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5298285934096117970" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 228px; height: 211px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f12%2fpoll-how-many-development-feeds-can-you.html"&gt;&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f12%2fpoll-how-many-development-feeds-can-you.html" style="text-decoration: none;"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f12%2fpoll-how-many-development-feeds-can-you.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-5122526497164587300?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/5122526497164587300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=5122526497164587300' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5122526497164587300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5122526497164587300'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/12/poll-how-many-development-feeds-can-you.html' title='[Poll] How many development feeds can you take?'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_LLByA-cjSbY/SYdK_Ew_cNI/AAAAAAAAAEo/ZP1J5MR78Qs/s72-c/Poll_Feeds.jpg' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1595896597361165827</id><published>2008-12-12T19:59:00.009Z</published><updated>2008-12-12T21:17:53.658Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='SEO'/><title type='text'>Recession will (hopefully) wipe SEO off the earth</title><content type='html'>I am no economics nostradamus or anything, but it's likely in my opinion that recession will bring people back to the real thing, and wipe SEO scums who lure between marketing an IT off the internet (and hopefully the earth).&lt;br /&gt;&lt;br /&gt;I know there are loads (well, maybe not that much... ) of respectable professionals out there who offer SEO &lt;span class="Apple-style-span" style="font-style: italic;"&gt;as part of their services&lt;/span&gt; - and they'll probably survive, but If I already believed that  "if you do SEO for a living, you will be out of business or irrelevant in 3 years" (quoting &lt;a href="http://learntoduck.com/search-marketing/seo-is-dead"&gt;SEO is dead&lt;/a&gt;) recession seems now to be only accellerating things from this point of view.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;I already stated my views on SEO in a &lt;a href="http://dotnetbutchering.blogspot.com/2008/03/why-seo-is-not-job.html"&gt;previous post&lt;/a&gt;, but if you have a look at &lt;a href="http://stefanjuhl.com/2007/seo-is-bullshit-frankly-on-page-seo-is-stupid-easy/"&gt;this link&lt;/a&gt; you'll notice that this guy's English is way better than mine and his approach to SEO deconstruction is way less simplistic; we're basically saying the same thing though: SEO is piss-easy. Even if I worked in marketing, I'd never invest solely on SEO because it's a soap bubble that's gonna explode in people faces sooner or later. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Go ahead - tell me I am an idiot. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1595896597361165827?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1595896597361165827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1595896597361165827' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1595896597361165827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1595896597361165827'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/12/recession-will-hopefully-wipe-seo-off.html' title='Recession will (hopefully) wipe SEO off the earth'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4694727131682798956</id><published>2008-12-10T22:39:00.006Z</published><updated>2008-12-10T23:13:15.277Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>[T-SQL] How to boost 'joined' Update Performance</title><content type='html'>Time for some real boring stuff.&lt;br /&gt;&lt;br /&gt;The first thing people are tempted to write when they have to run an update on a table picking stuff from another table is probably something like this:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;--method 1: nested select&lt;br /&gt;--around 15 mins to execute on 100.000 records&lt;br /&gt;UPDATE myTable&lt;br /&gt;SET myTable_field = (SELECT myOtherTable_field&lt;br /&gt;                   FROM myOtherTable&lt;br /&gt;                   WHERE myOtherTable_someID = myTable_someID)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;This way the nested select will run once for each record you're updating (100k times in my example) and you'll get shit performance.&lt;br /&gt;&lt;br /&gt;Alternative to this are:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;--method 2: update FROM more than one table&lt;br /&gt;--around 45 secs to execute on 100.000 records&lt;br /&gt;UPDATE myTable&lt;br /&gt;SET myTable_field = b.cache_VmiID&lt;br /&gt;FROM myTable a, myOtherTable b&lt;br /&gt;WHERE b.myOtherTable_someID = a.myTable_someID&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;or, more intuitive:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;--method 3: JOINED UPDATE&lt;br /&gt;--42 secs to execute on 100.000 records&lt;br /&gt;UPDATE myTable&lt;br /&gt;SET a.myTable_field = b.myOtherTable_field&lt;br /&gt;FROM myTable a join myOtherTable b&lt;br /&gt;on b.myOtherTable_someID = a.myTable_someID&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Execution times assume you're clearing SQLServer cache with fucking DROPCLEANBUFFERS (without clearing cache method 2 and 3 take about 4-5 secs).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f12%2ft-sql-how-to-boost-joined-update.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f12%2ft-sql-how-to-boost-joined-update.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4694727131682798956?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4694727131682798956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4694727131682798956' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4694727131682798956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4694727131682798956'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/12/t-sql-how-to-boost-joined-update.html' title='[T-SQL] How to boost &apos;joined&apos; Update Performance'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-195491397492429811</id><published>2008-12-04T23:25:00.005Z</published><updated>2008-12-04T23:31:35.756Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>[.NET] A Microsoft race</title><content type='html'>&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;My&lt;/span&gt; Microsoft &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Visual&lt;/span&gt; Studio 2008 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;is&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;screwed&lt;/span&gt;. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Cannot&lt;/span&gt; start the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;application&lt;/span&gt;. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;After&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;trying&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;to&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;fix&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;it&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;with&lt;/span&gt; the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;troubleshooting&lt;/span&gt; guide &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;from&lt;/span&gt; Microsoft &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;without&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;any&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;joy&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;it&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;looked&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;as&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;if&lt;/span&gt; the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;best&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;solution&lt;/span&gt; was to  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;use&lt;/span&gt; the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;canonical&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;uninstall&lt;/span&gt;/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;reinstall&lt;/span&gt; pattern. A &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;poll&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;for&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;you&lt;/span&gt; all: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;is&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;it&lt;/span&gt; gonna &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_33"&gt;take&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_34"&gt;longer&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_35"&gt;to&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_36"&gt;uninstall&lt;/span&gt; Microsoft &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_37"&gt;Visual&lt;/span&gt; Studio 2008 or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_38"&gt;to&lt;/span&gt; download the 3&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_39"&gt;gigs&lt;/span&gt; ISO &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_40"&gt;from&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_41"&gt;Torrents&lt;/span&gt;? &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_42"&gt;After&lt;/span&gt; 30&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_43"&gt;minutes&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_44"&gt;it&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_45"&gt;looks&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_46"&gt;very&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_47"&gt;tight&lt;/span&gt;, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_48"&gt;who&lt;/span&gt;'s gonna &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_49"&gt;win&lt;/span&gt;?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-195491397492429811?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/195491397492429811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=195491397492429811' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/195491397492429811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/195491397492429811'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/12/net-microsoft-race.html' title='[.NET] A Microsoft race'/><author><name>Tarelli</name><uri>http://www.blogger.com/profile/05276527371988960094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_N6a3WhX-3nU/Sv1A7oIlJkI/AAAAAAAAABo/Y7vNRf7oN8I/s1600-R/me.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7932830483372452360</id><published>2008-12-04T22:59:00.009Z</published><updated>2008-12-06T14:44:56.360Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2005'/><title type='text'>[SQLServer2005] computer localhost does not exist on the network</title><content type='html'>This really bugged me out.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Talking about &lt;a href="http://dotnetbutchering.blogspot.com/2008/11/sqlserver-error-3205-too-many-devices.html"&gt;useful error messages from SQL Server&lt;/a&gt;, After installing SQL Server 2005 whatever edition on Vista and setting up a few DBs on management studio I tried to access SQL Server Surface Area Configuration and I got the following genial error message:&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;"computer localhost does not exist on the network (...)"&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;/div&gt;this is some epic bullshit, obviously followed by some other useless crap which I won't mention.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;This obviously gave me no clue - so just out of curiosity I tried to open SQL Server Configuration Manager and I got another happy error message which makes even less sense:&lt;br /&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;"Cannot connect to WMI provider" &lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;WTF is this supposed to mean? I have no clue what a WMI provider is. Anyway - the only resort I was left was good old Google. So I started googlin' like crazy and I found some crazy SOAB of an MVP on a msdn forum thread who was trying to convince some indian guy to reinstall Windows and SQLServer. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I kept looking till I found &lt;a href="http://weblogs.asp.net/dwahlin/archive/2008/05/21/sql-server-2005-configuration-manager-cannot-connect-to-wmi-provider-error.aspx"&gt;something&lt;/a&gt; that did the trick: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); "&gt;&lt;img src="http://2.bp.blogspot.com/_LLByA-cjSbY/SThmN4ggl7I/AAAAAAAAAEY/zR6ktZ1JQS8/s400/SQLCrazyShit.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5276079352157607858" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 201px; " /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Apparently the problem is due to some SQLServer installation fuckup with some MOF files.&lt;br /&gt;&lt;br /&gt;If you run this in your cmd line it should solve it:&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;C:\Program Files\Microsoft SQL Server\90\Shared&gt;mofcomp "C:\Program Files\Microsoft SQL Server\90\Shared\sqlmgmproviderxpsp2up.mof"&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f12%2fsqlserver2005-computer-localhost-does.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f12%2fsqlserver2005-computer-localhost-does.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-7932830483372452360?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7932830483372452360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7932830483372452360' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7932830483372452360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7932830483372452360'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/12/sqlserver2005-computer-localhost-does.html' title='[SQLServer2005] computer localhost does not exist on the network'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_LLByA-cjSbY/SThmN4ggl7I/AAAAAAAAAEY/zR6ktZ1JQS8/s72-c/SQLCrazyShit.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4136139820227857723</id><published>2008-12-03T19:47:00.005Z</published><updated>2008-12-03T19:57:22.493Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>[.NET] How to sort DataTable</title><content type='html'>&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial; font-size: 14px; line-height: 18px; "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 100%; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; clear: both; margin-bottom: 1em; background-position: initial initial; "&gt;There's no way to automatically sort a DataTable after it's populated.&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 100%; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; clear: both; margin-bottom: 1em; background-position: initial initial; "&gt;A way around this is to sort the DefaultView of the DataTable (or any other DataView associated with the DataTable).&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 100%; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; clear: both; margin-bottom: 1em; background-position: initial initial; "&gt;You can achieve this using the Sort property of the DataView. This is a string which specifies the column (or columns) to sort on, and the order (ASC or DESC).&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 100%; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; clear: both; margin-bottom: 1em; background-position: initial initial; "&gt;&lt;span class="Apple-style-span" style="color: rgb(204, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;myDataTable.DefaultView.Sort = "myColumnOfChoice DESC";&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 100%; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; clear: both; margin-bottom: 1em; background-position: initial initial; "&gt;The DefaultView can now be used as datasource for stuff or to do whatever you need it for.&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4136139820227857723?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4136139820227857723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4136139820227857723' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4136139820227857723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4136139820227857723'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/12/net-how-to-sort-datatable.html' title='[.NET] How to sort DataTable'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7979221874480610499</id><published>2008-11-28T16:39:00.004Z</published><updated>2008-11-28T16:58:35.593Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>[T-SQL] How to get length of TEXT field</title><content type='html'>To calculate the lenght of a &lt;span class="Apple-style-span" style="font-style: italic;"&gt;TEXT&lt;/span&gt; field the &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;LEN&lt;/span&gt;&lt;/span&gt; function used to calculate the length of &lt;span class="Apple-style-span" style="font-style: italic;"&gt;VARCHAR&lt;/span&gt; fields won't work. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You need to use the &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;DATALENGTH&lt;/span&gt;&lt;/span&gt; T-SQL function:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;SELECT DATALENGTH(myTextField) AS lengthOfMyTextField&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f11%2ft-sql-how-to-get-length-of-text-field.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f11%2ft-sql-how-to-get-length-of-text-field.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-7979221874480610499?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7979221874480610499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7979221874480610499' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7979221874480610499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7979221874480610499'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/11/t-sql-how-to-get-length-of-text-field.html' title='[T-SQL] How to get length of TEXT field'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2105506359672406627</id><published>2008-11-25T14:06:00.010Z</published><updated>2008-11-25T19:25:50.689Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2000'/><title type='text'>[SQLServer] Error 3205: too many devices specified for backup or restore only 64 are allowed</title><content type='html'>&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Problem:&lt;/span&gt; restoring a backup on SQLServer I get the following error:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 0, 0);"&gt;[Error 3205: too many devices specified for backup or restore only 64 are allowed] &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Solution&lt;/span&gt;: you're probably trying to restore a SQL2005 backup on a SQL2000 instance. There's no backward compatibility for backup operations bewteen SQL2005 and SQL2000. Installing SQL2005 will make the error go away (I know - it sucks).&lt;br /&gt;&lt;br /&gt;I recently came across the cryptic error message in subject. At first I was puzzled - then google helped me understand the problem was not my lack of sweet SQLServer skills...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2105506359672406627?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2105506359672406627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2105506359672406627' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2105506359672406627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2105506359672406627'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/11/sqlserver-error-3205-too-many-devices.html' title='[SQLServer] Error 3205: too many devices specified for backup or restore only 64 are allowed'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1872593766752460581</id><published>2008-11-23T14:54:00.038Z</published><updated>2009-09-03T21:16:57.475+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>Learning SQL with Ganesh - Part 1 of ?</title><content type='html'>&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); "&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;img src="http://3.bp.blogspot.com/_LLByA-cjSbY/SSlw2rYh73I/AAAAAAAAAEI/yBZrCgiCpVk/s400/Ganesh.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5271868923474734962" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 122px; " /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;I found (and shared) this desperate help request yesterday on my google reader - I felt a burning desire to help the poor guy and I immediately followed the link to StackOverflow, but folks over there already edited the heck out of the &lt;a href="http://stackoverflow.com/questions/311120/sir-my-name-is-ganesh-verma-i-need-help"&gt;original question&lt;/a&gt;. &lt;/div&gt;&lt;div style="text-align: justify;"&gt; &lt;/div&gt;&lt;div&gt;Anyway this is what I'do to &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;find AND&lt;/span&gt;&lt;/span&gt; &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;delete&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt; duplicate rows on a table (with Identity)&lt;/span&gt;&lt;/span&gt;:&lt;/div&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;DELETE&lt;br /&gt;FROM    MyTable&lt;br /&gt;WHERE   ColumnID NOT IN&lt;br /&gt;(    SELECT   MIN(ColumnID)&lt;br /&gt;FROM MyTable&lt;br /&gt;GROUP BY    Column1, Column2, ..., ColumnN )&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;If you don't have an identity on the table you can add it then drop it when you're done.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Anyway - I obviously up-modded the guy and went ahead to have look at other questions from him and - guess what - I found a pair of pearls (the previous one was pretty OK besides the original title):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); "&gt;&lt;img src="http://4.bp.blogspot.com/_LLByA-cjSbY/SSl35OzsEQI/AAAAAAAAAEQ/ke1eKiDfsqE/s400/GaneshSweetStuff.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5271876663925018882" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 92px; " /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Probably weirdest SQL questions ever asked, but anyway, even if &lt;a href="http://dotnetbutchering.blogspot.com/2008/11/how-i-feel-about-sql.html"&gt;I HATE SQL&lt;/a&gt;, I tried to find answers anyway ('cause that's human nature - I guess).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;To get the top 10 rows &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;without sorting&lt;/span&gt; &lt;/span&gt;I'd probably do some rocket science:&lt;/div&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;select top 10 *&lt;br /&gt;from MyTable&lt;br /&gt;-- duh!&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;but then, if random order is required (?), maybe something like:&lt;/div&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;select top 10 *&lt;br /&gt;from MyTable&lt;br /&gt;order by NEWID()&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;To get the last 5 rows &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;without sorting&lt;/span&gt; &lt;/span&gt;I'd rather go with:&lt;/div&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;select top 5 *&lt;br /&gt;from MyTable&lt;br /&gt;order by ColumnID desc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;But what if you don't have an ID? What does without sorting mean? In doubt, I'd probably do something like the following:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;select top 5 *&lt;br /&gt;from ( select *&lt;br /&gt; from MyTable&lt;br /&gt; order by newId() desc)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Which is some crazy shit and without doubt doesn't make any sense.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f11%2flearning-sql-with-ganesh-part-1-of.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f11%2flearning-sql-with-ganesh-part-1-of.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1872593766752460581?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1872593766752460581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1872593766752460581' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1872593766752460581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1872593766752460581'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/11/learning-sql-with-ganesh-part-1-of.html' title='Learning SQL with Ganesh - Part 1 of ?'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_LLByA-cjSbY/SSlw2rYh73I/AAAAAAAAAEI/yBZrCgiCpVk/s72-c/Ganesh.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7557655595874374036</id><published>2008-11-21T21:34:00.005Z</published><updated>2008-11-21T21:56:17.804Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Fags and The Military Got My .NET</title><content type='html'>&lt;div style="text-align: justify;"&gt;I use to read &lt;a href="http://www.monstersgotmy.net/"&gt;Monsters Got My .NET&lt;/a&gt; posts. I subscribed to the feed on google reader and I very much enjoy the concept behind this blog, being a fan of horror movies and a programmer.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Posts on this blog are usually quite verbose - it usually takes me a while to figure out what the heck they talk about (maybe 'cause I am a bit slow), but the content is quite good and honestly I can't wait to see the horror movie mini-poster on the next post. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I particularly enjoyed a &lt;a href="http://www.monstersgotmy.net/post/The-Most-Evil-Extension-Method-Ever!.aspx"&gt;recent post&lt;/a&gt; (it was pretty straightforward and enjoyable compared to the intellectualoid standard) and decided to leave a comment that went something like:&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;This is a very nice post, short enough to be readable and useless enough for me to be able to enjoy it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I really like the concept behind this site - I'll probably start another blog and call it "Fags and The Military Got My .NET", instead of horror movies I'll post military posters with subtle homosexual hints.&lt;/div&gt;&lt;/blockquote&gt;The author didn't appreciate my comment - meant to be a joke - and canceled it mentioning in another comment that &lt;span class="Apple-style-span" style="font-style: italic;"&gt;some retard&lt;/span&gt; posted an &lt;span class="Apple-style-span" style="font-style: italic;"&gt;inappropriate comment&lt;/span&gt; forcing him to moderate his blog.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;At this point I had no other chance left than creating &lt;a href="http://fagsandthemilitarygotmydotnet.blogspot.com/"&gt;Fags and the Military Got My .NET&lt;/a&gt; for real:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); "&gt;&lt;img src="http://3.bp.blogspot.com/_LLByA-cjSbY/SScteXD0qfI/AAAAAAAAADw/xE1X53DMOzw/s320/NETArmy.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5271231888469830130" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 213px; height: 320px; " /&gt;&lt;/span&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/3760169963830810897-7557655595874374036?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7557655595874374036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7557655595874374036' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7557655595874374036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7557655595874374036'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/11/fags-and-military-got-my-net.html' title='Fags and The Military Got My .NET'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_LLByA-cjSbY/SScteXD0qfI/AAAAAAAAADw/xE1X53DMOzw/s72-c/NETArmy.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7823568433025007887</id><published>2008-11-15T11:55:00.017Z</published><updated>2008-11-15T13:04:27.412Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='bat'/><category scheme='http://www.blogger.com/atom/ns#' term='batch'/><category scheme='http://www.blogger.com/atom/ns#' term='dos'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>How to get and format date in a bat file</title><content type='html'>&lt;div style="text-align: justify;"&gt;Sooner or later everyone needs to mess up with some batch file Voodoo for some reason - often to pipe the output of some console application into some kind of log file. At this point you'll probably want to put a timestamp on the log file - but you need to reformat the standard date to elminate slashes and stuff. This is how you do it (depending on your operating system):&lt;/div&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;REM US Operating System: set yyyymmdd=%date:~10%%date:~4,2%%date:~7,2%&lt;br /&gt;REM EU Operating System: set yyyymmdd=%date:~6,4%%date:~3,2%%date:~0,2%&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This formats the date into a variable called yyyymmdd (pretty self-explanatory, uh), which you can use later in our lame script in you log file name (or whatever you need it for - In this case I am piping stuff into a log file):&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;REM EU Operating System&lt;br /&gt;set yyyymmdd=%date:~6,4%%date:~3,2%%date:~0,2%&lt;br /&gt;&lt;br /&gt;ECHO myConsoleApp output: &gt;&gt; myLog_%yyyymmdd%.txt&lt;br /&gt;myConsoleApp.exe &gt;&gt; myLog_%yyyymmdd%.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This stuff sucks - but I couldn't find the date formatting thing - pretty cryptic, uh? - anywhere on the web (I stole it off a collegue of mine who's kind of a batch files guru) so it might be useful to people.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-7823568433025007887?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7823568433025007887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7823568433025007887' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7823568433025007887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7823568433025007887'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/11/how-to-get-and-format-date-in-batch.html' title='How to get and format date in a bat file'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6707463263192407062</id><published>2008-11-13T22:02:00.011Z</published><updated>2008-11-13T23:05:39.322Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='CruiseControl.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>How I feel about SQL</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_LLByA-cjSbY/SRyksMXKq7I/AAAAAAAAADM/A5wj1kEjYgc/s1600-h/iHateSQL.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 259px; height: 273px;" src="http://1.bp.blogspot.com/_LLByA-cjSbY/SRyksMXKq7I/AAAAAAAAADM/A5wj1kEjYgc/s320/iHateSQL.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5268266743256230834" /&gt;&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I really tried hard to make friends with SQL, I even got a few books, and O'Reilly ones (they all sucked, but - hey - it's SQL we're talking about). I eventually came to cope with my feelings - if you gotta hate something, SQL ain't too bad a pick. Ain't too bad for poor SQL either, there's a whole lot of awesome indian dudes who love it to death. &lt;/div&gt;&lt;div style="text-align: justify;"&gt;Maybe it's because I've been too lazy to install intellisense plugins for SQL Management Studio so far, maybe because of the cryptic error messages ("there's a fuck up around line 345" - jeez, Javascript is easier to debug) or maybe just because that's the way it is, you gotta hate it. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;P.S. There's been a lot going on lately - mostly going crazy with a solution that builds fine manually but fails to build through CruiseControl.NET - but I've been a lazy ass and didn't post anything about it. You can read about it &lt;a href="http://stackoverflow.com/questions/273836/why-build-fails-with-cruisecontrolnet-but-it-builds-fine-manually-with-same-set"&gt;here&lt;/a&gt; and &lt;a href="http://groups.google.com/group/ccnet-user/browse_thread/thread/fe0360aa92b18c5c"&gt;here&lt;/a&gt; for now.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6707463263192407062?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6707463263192407062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6707463263192407062' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6707463263192407062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6707463263192407062'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/11/how-i-feel-about-sql.html' title='How I feel about SQL'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_LLByA-cjSbY/SRyksMXKq7I/AAAAAAAAADM/A5wj1kEjYgc/s72-c/iHateSQL.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8539116584698564843</id><published>2008-11-03T17:33:00.005Z</published><updated>2008-11-03T17:43:12.278Z</updated><title type='text'>New Warnings World Record?</title><content type='html'>Just wondering if this might be the &lt;span class="Apple-style-span" style="font-style: italic;"&gt;Visual Studio Warnings World Record&lt;/span&gt;:&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_LLByA-cjSbY/SQ82qNJGlZI/AAAAAAAAAC8/6jS_--PHBCA/s1600-h/warningWorldRecord.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 272px; height: 69px;" src="http://4.bp.blogspot.com/_LLByA-cjSbY/SQ82qNJGlZI/AAAAAAAAAC8/6jS_--PHBCA/s320/warningWorldRecord.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5264486588129645970" /&gt;&lt;/a&gt;1493 is a pretty darn good number - I am getting it from a &lt;a href="http://dotnetbutchering.blogspot.com/2008/10/unmentionable-necronomicon-of-legacy.html"&gt;monster solution&lt;/a&gt; composed by something like 65 projects (.NET, COM, MFC/C++ ... a bit of everything).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Tried to Google up "&lt;span class="Apple-style-span" style="font-style: italic; "&gt;Visual Studio Warnings World Record", &lt;span class="Apple-style-span" style="font-style: normal;"&gt;but no luck. It'd be nice to make it to the Guinness Book of World Records for something so useless.&lt;/span&gt;&lt;span class="Apple-style-span" style="font-style: normal; "&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8539116584698564843?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8539116584698564843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8539116584698564843' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8539116584698564843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8539116584698564843'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/11/new-warnings-world-record.html' title='New Warnings World Record?'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_LLByA-cjSbY/SQ82qNJGlZI/AAAAAAAAAC8/6jS_--PHBCA/s72-c/warningWorldRecord.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6206556381172233591</id><published>2008-11-02T17:44:00.016Z</published><updated>2008-11-02T18:43:31.669Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2005'/><title type='text'>Let that boy copy paste (with SQL2005 and Excel)</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:'Times New Roman';"&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:'Times New Roman';"&gt;I heard Papa tell Mama&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:'Times New Roman';"&gt;Let that boy copy paste from SQLServer2005 to Excel&lt;br /&gt;It's in him&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:'Times New Roman';"&gt;And it got to come out&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:'Times New Roman';"&gt;&lt;br /&gt;John Lee Hooker - Boogie Chillen (1948)&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Being a software engineer - I pretty much hate messing with DBs.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Nonetheless, more often than not, even the brightest designers - such as myself - are called to get their hands dirty with some SQL or moving some data around when the team's DB guy (usually indian) is badly sick at home.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I remember how painful it was the first time I had to understand with SQL2000 how to export to excel a simple resultset from a select - must have wasted a full afternoon of frustration trying to do that a few years back. &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;A couple of months ago I was shocked in discovering that with SQL2005 you can just select all and copy/paste a resultset to excel. This means that if you have to import/export some records you don't need to mess with import/export wizards and all that comes after. Shrinking to 3 clicks (select all - copy - paste) a 5 minutes painful procedure. &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Forget about TRY CATCH, CLR support, and all that fancy stuff, copy/paste to/from excel is my favourite SQL2005 new feature (ok - this sounds something like 3 years late, but it's not what this post is about).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;DB purists might not like it but copy/paste is "de way 2 go".  &lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f11%2flet-that-boy-copy-paste-with-sql2005.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f11%2flet-that-boy-copy-paste-with-sql2005.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6206556381172233591?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6206556381172233591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6206556381172233591' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6206556381172233591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6206556381172233591'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/11/let-that-boy-copy-paste-with-sql2005.html' title='Let that boy copy paste (with SQL2005 and Excel)'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2074102507099753899</id><published>2008-10-25T18:45:00.010+01:00</published><updated>2008-10-26T02:42:33.261Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='DHTML'/><title type='text'>[Blogger] How to dinamically change Blog Title</title><content type='html'>&lt;div style="text-align: justify;"&gt;You can dinamically change your Blogger Blog title to whatever you want (in this case you're changin it into 'NEW KICK-ASS TITLE') using the following Javascript snippet:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 0, 0);"&gt;var myKickAssScript = "document.getElementById('header-inner').getElementsByTagName('h1')[0].innerHTML = 'NEW KICK-ASS TITLE'";&lt;br /&gt;setTimeout(myKickAssScript, 2000);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We have to set a timeout in order to wait for the title element to be injected by the blogger engine. You can put this js code in the script element that's in the head section of the markup (you can edit it from 'edit HTML' section on your blog settings). &lt;/div&gt;&lt;div style="text-align: justify;"&gt;If you put the snippet (passed as string to the timeOut function above) at the bottom of the page (or as event handler for the onLoad event) you obviously don't need to set up a timer.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;It'll work as long as they decide to keep the page markup as it is now.&lt;br /&gt;&lt;br /&gt;P.S. check-out my NEW KICK-ASS TITLE&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2074102507099753899?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2074102507099753899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2074102507099753899' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2074102507099753899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2074102507099753899'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/10/blogger-how-to-dinamically-change-blog.html' title='[Blogger] How to dinamically change Blog Title'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6310750985691741080</id><published>2008-10-24T17:48:00.006+01:00</published><updated>2008-10-25T00:27:20.114+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='conversion'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>[C++] convert std::string to const char * (and back)</title><content type='html'>&lt;div&gt;Kind of a lousy-ass post but Straight to the point (with UNICODE on):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;#include &amp;lt;string&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;using namespace std;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;//..&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;//from std::string to const char*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;string originalStr("Bunny Colvin Kicks Ass");&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;const char* cnstCharPtr = str.c_str();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;//the other way around&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;string convertedStr(cnstCharPtr); //as simple as this&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;I found myself googlin' this up a number of times and I always forgot everything soon enough since I don't use it often. I decided to post it as a reference for myself and to increase chances to find an answer for anyone else who might be looking for it.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Cheers&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6310750985691741080?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6310750985691741080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6310750985691741080' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6310750985691741080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6310750985691741080'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/10/c-convert-stdstring-to-const-char-and.html' title='[C++] convert std::string to const char * (and back)'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4658235859017438684</id><published>2008-10-22T00:28:00.010+01:00</published><updated>2008-10-22T01:35:58.733+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MFC'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>The Unmentionable NECRONOMICON of WinApps (BAD Code is Language Independent)</title><content type='html'>&lt;div style="text-align: justify;"&gt;I am working on a MFC app internally referred as the &lt;span class="Apple-style-span" style="font-style: italic;"&gt;unmentionable NECRONOMICON of WinApps&lt;/span&gt;. This thing is a dying beast composed by an indefinite number of dlls: it seems put together as an ad-hoc example of the so-called DLL HELL. It compiles and builds by magic and by magic only. The thing is so scary no-one ever attempted touching it for 7 years or so. There are stories about the last guy who tried to fix a few bugs: he went crazy and left the company with no reason (OK, he just left the company). &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Anyway, most of this thing is coded in C++ and MFCs (except a bunch of cryptic COM components in VB6 and stuff which hopefully I'll never have to touch).  After having a thorough look at the code I can say that YES, the app is way far from being mainteinable, but - surprise - it's not because of C++. Same stuff written in C# would scare eggs out of (SCRUM) chickens.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Loads of people seems to hate C++, because it's error-prone (...), verbose, kinda cranky and not that cool anymore. Most of them probably don't even know about copy-constructors and destructors otherwise they'd hate C++ even more. I agree with most of this complaints and no-one would ever dream of developing a brand new WinApp today using MFCs. We got away from that and now we can focus on making cool apps, not just "working" ones.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Getting to the point, the fact that C++ apps do not write themselves seems to be ignored - people tend to forget one of the basic laws of programming: &lt;span class="Apple-style-span" style="font-style: italic;"&gt;BAD code is language independent&lt;/span&gt;.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;P.S. Wish me luck, I need it&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4658235859017438684?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4658235859017438684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4658235859017438684' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4658235859017438684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4658235859017438684'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/10/unmentionable-necronomicon-of-legacy.html' title='The Unmentionable NECRONOMICON of WinApps (BAD Code is Language Independent)'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-5809390931931054032</id><published>2008-10-19T13:05:00.046+01:00</published><updated>2009-09-26T15:51:28.613+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AGILE'/><category scheme='http://www.blogger.com/atom/ns#' term='ICONIX'/><category scheme='http://www.blogger.com/atom/ns#' term='Methodology'/><category scheme='http://www.blogger.com/atom/ns#' term='Process'/><title type='text'>Software Development Methodologies Zoo</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_LLByA-cjSbY/SPsjZ_CsgsI/AAAAAAAAABk/psmtnZKSxXo/s1600-h/WATERFALL.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_LLByA-cjSbY/SPsjZ_CsgsI/AAAAAAAAABk/psmtnZKSxXo/s320/WATERFALL.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5258835919211627202" /&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;[Waterfall - 1970]&lt;/span&gt;&lt;div&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;The waterfall model is a sequential software development process (...) in which development is seen as flowing steadily downwards (like a waterfall) through the phases of requirements analysis, design, implementation, testing (validation), integration, and maintenance.&lt;/span&gt;&lt;/blockquote&gt;You can't stop a waterfall - meaning that if you're in the middle of a project and requirements change ... well ... let's say you're in troubles.&lt;/div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;[V-Model - late '80s]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;The V-model is a software development process which can be presumed to be the extension of the waterfall model. Instead of moving down in a linear way, the process steps are bent upwards after the coding phase, to form the typical V shape. The V-Model demonstrates the relationships between each phase of the development life cycle and its associated phase of testing.&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_LLByA-cjSbY/SPsmkkQ9CRI/AAAAAAAAACE/5lEkNih18fQ/s1600-h/VModel.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/_LLByA-cjSbY/SPsmkkQ9CRI/AAAAAAAAACE/5lEkNih18fQ/s320/VModel.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5258839399537117458" style="cursor: pointer; " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is a zombie model, it's dead but plenty of ISO and CMM fanatics out there think V-Model is still pretty cool. V-Model is indeed a very good methodology for high-ceremony organizations for its ability to give management a sense of false security. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;[Cowboy Coding - wild west]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Cowboy Coding is a term used to describe software development where the developers have autonomy over the development process. This includes control of the project's schedule, algorithms, tools, and coding style.&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); font-weight: normal; "&gt;&lt;img src="http://1.bp.blogspot.com/_LLByA-cjSbY/SPspASMi4EI/AAAAAAAAACU/bM2Dg9tp4aI/s320/CowboyCoding_3.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5258842074746380354" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; " /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In an ideal world, this would be my favourite. Whenever I start my own company I am pretty sure I'll adopt and formalize Cowboy Coding [yippy kayay!].&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;[SCRUM - early '90s]&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Scrum is an iterative incremental process of software development commonly used with agile software development. (...)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Scrum is a process skeleton that includes a set of practices and predefined roles. The main roles in Scrum are the ScrumMaster who maintains the processes and works similar to a project manager, the Product Owner who represents the stakeholders, and the Team which includes the developers [chicken and pigs!].&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;During each sprint, a 15-30 day period (length decided by the team), the team creates an increment of potential shippable (usable) software. The set of features that go into each sprint come from the product backlog, which is a prioritized set of high level requirements of work to be done.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_LLByA-cjSbY/SPtbHiRh73I/AAAAAAAAACc/OU6TPITv0As/s1600-h/Pig-Chicken-ScrumMaster.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/_LLByA-cjSbY/SPtbHiRh73I/AAAAAAAAACc/OU6TPITv0As/s320/Pig-Chicken-ScrumMaster.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5258897174902730610" style="cursor: pointer; " /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-style: italic; font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-style: normal; "&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Conceptually born in early '90s, SCRUM started being widely adopted 10 years later. It's like the model farm of AGILE software development with ScrumMaster to coordinate chicken and pigs. All you need to know is pigs do all the work.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;[ICONIX - late '90s]&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-style: italic; font-weight: normal;"&gt;&lt;div style="text-align: justify;"&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-style: italic; font-weight: normal;"&gt;&lt;div style="text-align: justify;"&gt;ICONIX is a software development methodology which predates both the Rational Unified Process (RUP), Extreme Programming(XP) and Agile software development. Like RUP, the ICONIX process is UML Use Case driven but more lightweight than RUP. Unlike the XP and Agile approaches, ICONIX provides sufficient requirement and design documentation, but without analysis paralysis. The ICONIX Process uses only four UML based diagrams in a four step process that turns use case text into working code.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;A principle distinction of ICONIX is its use of robustness analysis (...). This process makes the use cases much easier to design, test and estimate.&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); font-weight: normal; "&gt;&lt;img src="http://3.bp.blogspot.com/_LLByA-cjSbY/SPtfX2YGuuI/AAAAAAAAACk/oEB4uo2kMwU/s320/ICONIX.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5258901853223434978" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; " /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;ICONIX basically combines an AGILE approach with a robustness oriented low-ceremony design. This Process carries the strictly necessary amount of weight to still ride fast. This is the process I use at the moment, you can read more about it on &lt;a href="http://dotnetbutchering.blogspot.com/2008/10/iconix-process-rocks.html"&gt;this post.&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;[Extreme Programming - XP]&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Extreme Programming (XP) is a software engineering methodology prescribing a set of daily stakeholder practices that embody and encourage particular XP values. Proponents believe that exercising these practices—traditional software engineering practices taken to so-called "extreme" levels—leads to a development process that is more responsive to customer needs ("agile") than traditional methods, while creating software of better quality.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Proponents of Extreme Programming and agile methodologies in general regard ongoing changes to requirements as a natural, inescapable and desirable aspect of software development projects; they believe that adaptability to changing requirements at any point during the project life is a more realistic and better approach than attempting to define all requirements at the beginning of a project and then expending effort to control changes to the requirements.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;span class="Apple-style-span" style="font-style: italic; font-weight: normal;"&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-style: normal; "&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_LLByA-cjSbY/SPtmbQxjuKI/AAAAAAAAACs/dIpZ_nQoV3w/s1600-h/XP.jpg"&gt;&lt;img src="http://2.bp.blogspot.com/_LLByA-cjSbY/SPtmbQxjuKI/AAAAAAAAACs/dIpZ_nQoV3w/s320/XP.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5258909608430516386" style="cursor: pointer; " /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;XP is all about speed, and we all like speed if it means no documentation. Biggest drawbacks of this approach may be problems like feature creep and scope creep - moslty due to lack of persistent reference.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-5809390931931054032?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/5809390931931054032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=5809390931931054032' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5809390931931054032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5809390931931054032'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/10/software-development-methodologies-zoo.html' title='Software Development Methodologies Zoo'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_LLByA-cjSbY/SPsjZ_CsgsI/AAAAAAAAABk/psmtnZKSxXo/s72-c/WATERFALL.jpg' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-914131898476763711</id><published>2008-10-16T23:38:00.009+01:00</published><updated>2008-10-17T00:01:32.105+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSIS'/><category scheme='http://www.blogger.com/atom/ns#' term='DTSX'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2005'/><title type='text'>[SSIS] How to remotely run a DTSX package from bat file?</title><content type='html'>&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Short answer&lt;/span&gt; (or at least the conclusion I came to after a fair amount of research  - and plenty of hair pulling): &lt;span class="Apple-style-span" style="font-style: italic;"&gt;you can't &lt;/span&gt;.&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Long Answer&lt;/span&gt;: I started from this cmd, which works like charm locally:&lt;/div&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;DTEXEC /DTS "\File System\MY_PACKAGE_NAME" /SERVER MY_SERVER_NAME /MAXCONCURRENT " -1 " /CHECKPOINTING OFF  /REPORTING V&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you try to use the same cmd remotely it will miserably fail with some nasty timeout.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After a bit of googling it looks like it is impossible to run DTEXEC cmd remotely (it needs to be run locally - remote execution apparently is not supported).&lt;br /&gt;&lt;br /&gt;To overcome this limitation the following method seems to be broadly implemented:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;set up a SQL job to run the DTSX package&lt;br /&gt;&lt;/li&gt;&lt;li&gt;set up a Stored Procedure to run the job&lt;br /&gt;&lt;/li&gt;&lt;li&gt;use isql command line in a BAT file (remotely executed) to run the stored procedure on the relevant SQL instance (with SQL credentials and not machine credentials)&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Might work - but kinda sucks.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-914131898476763711?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/914131898476763711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=914131898476763711' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/914131898476763711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/914131898476763711'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/10/ssis-how-to-remotely-run-dtsx-package.html' title='[SSIS] How to remotely run a DTSX package from bat file?'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-43777366372410255</id><published>2008-10-15T15:29:00.006+01:00</published><updated>2008-10-15T23:02:30.863+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='JAVA'/><category scheme='http://www.blogger.com/atom/ns#' term='exceptions'/><title type='text'>[.NET]  Why are Exceptions not Checked in C#?</title><content type='html'>Going from Java to C#, I've been stunned by the absence of  the "throws" clause in the declaration of a method, in which you want to throw a particular exception.&lt;br /&gt;Actually it hasn't caused me so much pain, but the knowledge at compile time of the possibility that an exception could be thrown sounded very useful to me.&lt;br /&gt;Asking to the &lt;a href="http://www.stackoverflow.com/" target="_blank"&gt;StackOverflow&lt;/a&gt; community, I found out Java is one of the few programming languages where exceptions are "caught" at compile time.&lt;br /&gt;The philosophy behind C# is that what is useful about exceptions is not handling them, but mostly cleaning resources, implementing the IDisposable pattern (&lt;a href="http://www.artima.com/intv/handcuffs.html" target="_blank"&gt;The trouble with Checked expcetions&lt;/a&gt;).&lt;br /&gt;If you know that a particular method can throw an exception, you also know what it does and how to handle it, otherwise you will handle a generic exception, without need to specify it at compile time; moreover handling exceptions is something that comes near the caller of a method reather than the method itself, so there is no need to specify a chain of "throws" declarations, and that is so useful in versioning, because adding a new exception (or removing an old one) doesn't require a refactoring of your lib.&lt;br /&gt;It is worth noting that C# supports the &amp;lt;exception&amp;gt; tag in the documentation section, with which the compiler informs you that an exception (whose type is anyway checked for existence) can be thrown, without any further constraints.&lt;br /&gt;If you have other issues or different opinions I'd like to hear them.&lt;div&gt;&lt;br /&gt;Good butchering!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-43777366372410255?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/43777366372410255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=43777366372410255' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/43777366372410255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/43777366372410255'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/10/net-why-are-esxceptions-not-checked-in.html' title='[.NET]  Why are Exceptions not Checked in C#?'/><author><name>Enrico</name><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>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6776146568031230164</id><published>2008-10-10T20:13:00.022+01:00</published><updated>2008-10-16T11:02:02.210+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AGILE'/><category scheme='http://www.blogger.com/atom/ns#' term='ICONIX'/><category scheme='http://www.blogger.com/atom/ns#' term='Design'/><category scheme='http://www.blogger.com/atom/ns#' term='Process'/><title type='text'>ICONIX Process Rocks</title><content type='html'>Today we talk about my favorite software development process, so-called &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;ICONIX&lt;/span&gt;.&lt;div&gt;This should probably give an answer to the few dinosaurs who like going around saying that &lt;span class="Apple-style-span" style="font-style: italic;"&gt;AGILE is an excuse for not having a well-defined process &lt;/span&gt;(they probably think the V-Model still rocks - good lads).&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;ICONIX adopts a subset of core AGILE techniques and it is a &lt;span class="Apple-style-span" style="font-style: italic;"&gt;behavioral requirements (Use Cases) driven&lt;/span&gt; process. The ICONIX process aims to be as &lt;span class="Apple-style-span" style="font-style: italic;"&gt;low-celebration&lt;/span&gt; as possible carrying &lt;span class="Apple-style-span" style="font-style: italic;"&gt;as little documentation as possible&lt;/span&gt; through iterations - in order to allow you to easily keep it up-to-date (this is a big difference from other AGILE processes, as XP, which aim at carrying no documentation at all).&lt;br /&gt;For fans of TDD (Test Driven Development), it has been proved that ICONIX can be easily paired with the latter: &lt;a href="http://www.springerlink.com/content/k15l318vq1013057/"&gt;http://www.springerlink.com/content/k15l318vq1013057/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here's a practical overview of the process:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Quick Draft of Functional Requirements (in theory throw-away)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Quick Definition of a Domain Model (identify entities and classes)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Model Use Cases on the base of previous steps (This is what drives development)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Draw a throw-away robustness diagram for each use case (to understand relations between your classes)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Draw a Sequence Diagram for each use case (here you'll understand which methods you really need)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Model your test-cases on the use cases&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Implement&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Test&lt;/li&gt;&lt;/ol&gt;At each step you review your work as a whole updating your domain model (it's impossible to get it right first time) and adding comments on your use cases. By the end of step (5) you end up with ready-to-implement classes and logic with just little documentation to maintain if you re-factor or change anything. The following is indeed the only documentation you need to carry through iterations:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Use case diagram&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Sequence Diagram for each use case&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Test case diagram (or test plan)&lt;/li&gt;&lt;/ul&gt;If you need to add features, you add new use cases and follow the whole process.&lt;div&gt; &lt;br /&gt;In my experience the ICONIX process works regardless of the size of the project. In a medium-large project you just split the implementation of features in short iterations in an AGILE fashion. It is worth underlining that the big difference between most extreme AGILE processes and ICONIX is that &lt;span class="Apple-style-span" style="font-style: italic;"&gt;you do keep documentation up-to-date&lt;/span&gt;, you don't just throw it away after each iteration. This is possible because the process aims (again) at keeping very&lt;span class="Apple-style-span" style="font-style: italic;"&gt; light-weight documentation&lt;/span&gt;.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;Resources:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://iconixprocess.com/"&gt;Iconix process website&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.iconixsw.com/"&gt;Iconix Software Engineering website&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Books References:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Agile-Development-ICONIX-Process-Pragmatism/dp/1590594649/ref=pd_bxgy_b_img_a"&gt;AGILE Development with ICONIX Process&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6776146568031230164?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6776146568031230164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6776146568031230164' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6776146568031230164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6776146568031230164'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/10/iconix-process-rocks.html' title='ICONIX Process Rocks'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8501861301132706208</id><published>2008-10-09T10:00:00.004+01:00</published><updated>2008-10-09T10:34:42.376+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JAVA'/><title type='text'>[JAVA] Calendar Months Start from Zero</title><content type='html'>I don't have time to make a big deal out of this but please tell me which month is the 12th one in the year. I was so stupid to think it was December. Thanks to the JAVAAPI guys I got enlightened. &lt;span style="font-style:italic;"&gt;The 12th month is Janaury cause the count starts from 0&lt;/span&gt;, it goes to 11 and then starts over again. Grand job to the java.util.Calendar guy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8501861301132706208?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8501861301132706208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8501861301132706208' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8501861301132706208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8501861301132706208'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/10/java-calendar.html' title='[JAVA] Calendar Months Start from Zero'/><author><name>Tarelli</name><uri>http://www.blogger.com/profile/05276527371988960094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_N6a3WhX-3nU/Sv1A7oIlJkI/AAAAAAAAABo/Y7vNRf7oN8I/s1600-R/me.png'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8157057900580721478</id><published>2008-10-02T01:12:00.010+01:00</published><updated>2008-10-02T13:24:54.501+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>[.NET] How to Programmatically Create and Access Custom ConfigurationSections</title><content type='html'>.NET app.config and web.config are powerful instruments to store simple key value pairs and connections strings.When you need to store config data in some specific format and key value pairs are not enough you can use Custom Configuration Sections as they are not complex to use (unless you need a fairly complex section):&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;1) Define your custom section&lt;/span&gt;:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;public class CustomSection : ConfigurationSection&lt;br /&gt;{&lt;br /&gt;[ConfigurationProperty("LastName", IsRequired = true,DefaultValue = "TEST")]&lt;br /&gt;public String LastName&lt;br /&gt;{&lt;br /&gt;get { return (String)base["LastName"]; }&lt;br /&gt;set { base["LastName"] = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;[ConfigurationProperty("FirstName", IsRequired = true, DefaultValue = "TEST")]&lt;br /&gt;public String FirstName&lt;br /&gt;{&lt;br /&gt;get { return (String)base["FirstName"]; }&lt;br /&gt;set { base["FirstName"] = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public CustomSection()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;2) Programmatically create your section&lt;/span&gt; (if it doesn't already exist):&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;// Create a custom section.&lt;br /&gt;static void CreateSection()&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;CustomSection customSection;&lt;br /&gt;// Get the current configuration file.&lt;br /&gt;System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(@"ConfigurationTest.exe");&lt;br /&gt;&lt;br /&gt;// Create the section entry&lt;br /&gt;// and the&lt;br /&gt;// related target section&lt;br /&gt;if (config.Sections["CustomSection"] == null)&lt;br /&gt;{&lt;br /&gt; customSection = new CustomSection();&lt;br /&gt; config.Sections.Add("CustomSection", customSection);&lt;br /&gt; customSection.SectionInformation.ForceSave = true;&lt;br /&gt; config.Save(ConfigurationSaveMode.Full);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;catch (ConfigurationErrorsException err)&lt;br /&gt;{&lt;br /&gt;//manage exception - give feedback or whatever&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Following CustomSection definition and actual CustomSection will be created for you:&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt; &amp;lt;configuration&amp;gt;&lt;br /&gt; &amp;lt;configsections&amp;gt;&lt;br /&gt; &amp;lt;section name="CustomSection" type="ConfigurationTest.CustomSection,    ConfigurationTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" allowlocation="true" allowdefinition="Everywhere" allowexedefinition="MachineToApplication" overridemodedefault="Allow" restartonexternalchanges="true" requirepermission="true"&amp;gt;&lt;br /&gt; &amp;lt;/section&amp;gt;&lt;br /&gt; &amp;lt;/configsections&amp;gt;&lt;br /&gt; &amp;lt;customsection lastname="TEST" firstname="TEST"&amp;gt;&lt;br /&gt; &amp;lt;/customsection&amp;gt;&lt;br /&gt; &amp;lt;/configuration&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;3) Now Retrieve your section properties:&lt;/span&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;CustomSection section=(CustomSection)ConfigurationManager.GetSection("CustomSection");&lt;br /&gt;string lastName = section.LastName;&lt;br /&gt;string firstName = section.FirstName;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This is all good stuff - nice and easy as you can see.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;P.S. This post orginally appeared on this &lt;a href="http://stackoverflow.com/questions/117407/which-configuration-method-do-you-prefer-in-net-why#117597"&gt; StackOverflow link&lt;/a&gt;, but since I wrote it I thought it would do no harm to recycle my own rubbish here.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f10%2fnet-how-to-programmatically-create-and_02.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f10%2fnet-how-to-programmatically-create-and_02.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8157057900580721478?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8157057900580721478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8157057900580721478' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8157057900580721478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8157057900580721478'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/10/net-how-to-programmatically-create-and_02.html' title='[.NET] How to Programmatically Create and Access Custom ConfigurationSections'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7825362621985511996</id><published>2008-09-26T21:48:00.002+01:00</published><updated>2008-09-26T21:52:14.721+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='web technology'/><category scheme='http://www.blogger.com/atom/ns#' term='Jimmy Sole'/><title type='text'>Jimmy Sole the Renown PHP Programmer is Back Online</title><content type='html'>Check out this &lt;a href="http://digg.com/programming/Jimmy_Sole_the_Renown_PHP_Programmer_is_Back_Online"&gt;great post from DIGG&lt;/a&gt;:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;[Jimmy Sole had decided to take a break from blogging for a while.  Now he is back and beginning to blog about PHP and will soon be blogging about many other web related programing tasks and perhaps some gaming and photography.  Check out JimmySole.com today.]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Apparently Jimmy Sole changed his mind and for some reason he's not going to post any great PHP article in the near foreseeable future.&lt;br /&gt;&lt;br /&gt;.NET Butchering is trying to launch an initiative to convince him to change his mind. If you're not sure just yet wether you wanna support the initiative or not my advice would be to go have a look at &lt;a href="http://www.jimmysole.com/"&gt;Jimmy's website&lt;/a&gt; and you'll make up your mind soon enough. If you decide to endorse Jimmy Sole please leave a comment on his blog.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.jimmysole.com/"&gt;read more&lt;/a&gt; | &lt;a href="http://digg.com/programming/Jimmy_Sole_the_Renown_PHP_Programmer_is_Back_Online"&gt;digg story&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-7825362621985511996?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7825362621985511996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7825362621985511996' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7825362621985511996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7825362621985511996'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/09/jimmy-sole-renown-php-programmer-is.html' title='Jimmy Sole the Renown PHP Programmer is Back Online'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4526119067698762429</id><published>2008-09-25T20:12:00.008+01:00</published><updated>2008-09-26T01:00:33.235+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Generics'/><title type='text'>[.NET] Generics Perfomance Myth (and Tony Northrup VS Wendy Sarret)</title><content type='html'>According to Microsoft, Generics are faster than casting (even in absence of boxing/unboxing).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.northrup.org/"&gt;Tony Northrup&lt;/a&gt; - co-author of &lt;a href="http://www.amazon.co.uk/MCTS-Self-Paced-Training-70-536-2-0%2597Application/dp/0735622779/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1222370080&amp;amp;sr=8-1"&gt;MCTS 70-536: Application Development Foundation&lt;/a&gt; (which BTW totally sucks, a review will probably follow) - states in the same book the following:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;I haven’t been able to reproduce the performance benefits of generics; however, according to Microsoft, generics are faster than using casting. In practice, casting proved to be several times faster than using a generic. However, you probably won’t notice performance differences in your applications. (My tests over 100,000 iterations took only a few seconds.) So you should still use generics because they are type-safe.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I haven't been able to reproduce such performance benefits myself (and I am, as a Certified .NET Butcher, way more reliable than MCTS books) - so I'd say the performance gain is "supposed" more than "significant", unless someone is able to prove it. Until that moment .NET Generic amazing performance &lt;span class="Apple-style-span" style="font-style: italic;"&gt;will remain a myth&lt;/span&gt;.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you know something more than me about this - please share.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;P.S. BTW - isn't Tony Northrup real HOT (I'd rather date him over &lt;a href="http://dotnetbutchering.blogspot.com/2008/05/worst-cover-ever-in-history-of.html"&gt;Wendy Sarret&lt;/a&gt;)?&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-generic-perfomance-myth-and-tony.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-generic-perfomance-myth-and-tony.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4526119067698762429?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4526119067698762429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4526119067698762429' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4526119067698762429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4526119067698762429'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/09/net-generic-perfomance-myth-and-tony.html' title='[.NET] Generics Perfomance Myth (and Tony Northrup VS Wendy Sarret)'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-1890524750932780672</id><published>2008-09-21T21:59:00.014+01:00</published><updated>2008-09-22T17:25:29.226+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Delegates'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET vs Java'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='JAVA'/><title type='text'>[.NET vs Java] Event Handling: Are you sure pure OOP is always the simplest?</title><content type='html'>&lt;p align="justify"&gt;&lt;br /&gt;After a long time I'm again here for another post!&lt;br /&gt;I will talk about event handling, focusing at first on .NET way to supply it, and then spending 2 words about the Java style.&lt;br /&gt;What I want to talk about is &lt;span style="font-weight: bold;"&gt;delegates&lt;/span&gt; and how are they used...I know old good Giovacchia has already spoken about them in a previous post (&lt;a href="http://dotnetbutchering.blogspot.com/2008/01/net-events-and-delegates.html"&gt;here&lt;/a&gt;) but I wanna talk about them again.&lt;br /&gt;Why?&lt;br /&gt;I'm leaving for a while the Java world and walking through the &lt;span style="font-style: italic;"&gt;.NET Framework&lt;/span&gt; (I have to take some Microsoft Certifications, 2 or maybe 3 exams in just 1 month and a half...sounds crazy but it's my task in the short term): this means I have to study, as for now, 2 book of about 1000 pages each one.&lt;br /&gt;I'm not taking part in the war between Open Source Multi Platforms Java Conding and Mama Microsoft Windows-Platform Framework yet, but in this path toward the MS certifications I will try to catch what's good and what's not in both frameworks.&lt;br /&gt;At a first sight (I'm about at the half of the first &lt;a href="http://www.amazon.com/MCTS-Self-Paced-Training-Exam-70-536/dp/0735622779"&gt;book&lt;/a&gt;) 2 years of experience in Java programming has helped me a lot, but I stopped a while learning about &lt;span style="font-weight: bold;"&gt;delegates&lt;/span&gt;.&lt;br /&gt;I don't want to explain what actually they are (Giovacchia in his post said it perfectly), let's just say &lt;span style="font-weight: bold;"&gt;delegates are a kind of function pointers&lt;/span&gt;, and you have to &lt;span style="font-style: italic;"&gt;subscribe&lt;/span&gt; a delegate to a particular event in order to make it running when that event is raised.&lt;br /&gt;Because my memory is so short term (could it be Google's fault?), during the reading I made a simple schema to remember which key words to use when declaring a delegate and rasing your own event.&lt;br /&gt;&lt;/p&gt;&lt;div class="code"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;namespace HereIsMyDelegateNamespace{&lt;br /&gt; . . .&lt;br /&gt;&lt;br /&gt; public &lt;span style="font-weight: bold;"&gt;&lt;span style="font-style: italic;"&gt;delegate&lt;/span&gt;&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;void &lt;span style="font-style: italic;"&gt;MyEventHandler&lt;/span&gt;(object o, System.EventArgs ev);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; . . .&lt;br /&gt;&lt;br /&gt; public class MyClass{&lt;br /&gt;    . . .&lt;br /&gt;    public &lt;span style="font-weight: bold;"&gt;&lt;span style="font-style: italic;"&gt;event&lt;/span&gt; MyEventHandler MyEvent;&lt;/span&gt;&lt;br /&gt;    . . .&lt;br /&gt; &lt;br /&gt;    &lt;span style="font-style: italic;"&gt;/* this method raises an event */&lt;/span&gt;&lt;br /&gt;    publlic &lt;span style="font-style: italic;"&gt;ReturnType&lt;/span&gt; RaisingMethod()&lt;br /&gt;    {&lt;br /&gt;        System.EventArgs ev = new System.EventArgs();&lt;br /&gt;        . . .&lt;br /&gt;        &lt;span style="font-weight: bold;"&gt;MyEvent(this,ev);&lt;/span&gt;&lt;br /&gt;        . . .&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;namespace ConsumerNamespace{&lt;br /&gt;&lt;br /&gt; public class Consumer{&lt;br /&gt;&lt;br /&gt;      public static void Main(string[] args)&lt;br /&gt;      {&lt;br /&gt;          . . .&lt;br /&gt;          &lt;span style="font-weight: bold;"&gt;MyClass m = new MyClass();&lt;/span&gt;&lt;br /&gt;          &lt;span style="font-weight: bold;"&gt;m.MyEvent += MyEventHandler(&lt;span style="font-style: italic;"&gt;m_MyEvent&lt;/span&gt;);&lt;/span&gt;&lt;br /&gt;         . . .&lt;br /&gt;         &lt;span style="font-style: italic;"&gt;/* from now on we can call a method&lt;br /&gt;         *  or make an action which causes MyClass to&lt;br /&gt;         *  raise the MyEvent event */&lt;/span&gt;&lt;br /&gt;         m.SomeMethodThatRaisesTheEvent();&lt;br /&gt;         . . .&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      public static void &lt;span style="font-weight: bold;"&gt;m_MyEvent&lt;/span&gt;(object o, System.EventArgs ev)&lt;br /&gt;      {&lt;br /&gt;          . . .&lt;br /&gt;          &lt;span style="font-style: italic;"&gt;/* handles the event */&lt;/span&gt;&lt;br /&gt;      }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;p align="justify"&gt;&lt;br /&gt;You have to remember few things:&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;The signature of the delegate has to be the same of your own handling method&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The signature of the delagete has to contain 2 parameters: the first one is an object reference, that refers to the object that launches the event, and the second one must be a subclass of System.EventArgs (there are a lots of them implemented for the common events)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;You can subscribe to an event using the overloaded operator &lt;span style="font-weight: bold;"&gt;+=&lt;/span&gt; but you can also unsubscribe by using the &lt;span style="font-weight: bold;"&gt;-=&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;For common applications, you won't need to raise yourself an event, but just supply a method and subscribe it to the event (the method, as said, has to have the same signature of the needed delegate)&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p align="justify"&gt;&lt;span style="font-weight: bold;"&gt;And what about Java?&lt;/span&gt;&lt;br /&gt;Learning Java I actually never had the need to write down some code to remember how Event Handling works.&lt;br /&gt;Why? There are no delegates, in the sense you need to specify an entire class as the delegate for that event. What does it happen when you need to subscribe to an event?&lt;br /&gt;In that situation Java is more OO then .NET, indeed you only use your Handler Class (such as MouseListener class, but for the common events, e.g. such as Mouse and Keyboard, you have at your disposal tons of ready-to-use classes) to manage the event. In this scenario you call directly by the object that throws the event, an &lt;span style="font-weight: bold;"&gt;addXXXListener()&lt;/span&gt; or &lt;span style="font-weight: bold;"&gt;removeXXXListener()&lt;/span&gt;, and inside your class, in which you surely have an array of potential listeners, when you want to raise the event, you have to iterate manually by calling all the needed methods of the listeners subscribed.&lt;br /&gt;IMHO Java is straightforward to the OOP, but you need more code, and .NET allow you by using &lt;span style="font-weight: bold;"&gt;delegate&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;event&lt;/span&gt; keywords not to think to the &lt;span style="font-style: italic;"&gt;propagation&lt;/span&gt; of the event. Moreover, in .NET you won't need to specify an entire class to handle the event, bringing to a more concise code style.&lt;br /&gt;&lt;br /&gt;I'm not as experienced in .NET as I'm in Java, so maybe in few weeks I will post the exact opposite kind of opinion, but as for now I'm feeling better using C#, as it seems it has taken the good in Java and brought it to a more powerfull level (I'm refering to the whole framework ofcourse and not to the language itself).&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-vs-java-event-handling-are-you-sure.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-vs-java-event-handling-are-you-sure.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-1890524750932780672?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/1890524750932780672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=1890524750932780672' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1890524750932780672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/1890524750932780672'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/09/net-vs-java-event-handling-are-you-sure.html' title='[.NET vs Java] Event Handling: Are you sure pure OOP is always the simplest?'/><author><name>Enrico</name><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>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8727770978377672477</id><published>2008-09-20T21:33:00.011+01:00</published><updated>2008-09-21T01:51:11.105+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>[.NET] How to send debug text to output (or file)</title><content type='html'>If you landed here because you want to send debug text to the output console do not worry, it's piss-easy:&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//////////////////////////////////////////////////////////&lt;br /&gt;// you can choose between this:&lt;br /&gt;// first par: "a description of the importance of the message"&lt;br /&gt;// second par: text 'category'&lt;br /&gt;Debugger.Log(2, "Test", "this text in the output console - 1");&lt;br /&gt;//or this&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;Debug.Write("this text in the output console - 2");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//or this&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;Debug.WriteLine("this text in the output console - 3");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//or this&lt;br /&gt;Trace.Write("this text in the output console - 4");&lt;br /&gt;//////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Obviously you have to build in debug mode to see any output (if you do not know this you're a really lousy developer &amp;amp;&amp;amp; human being).&lt;br /&gt;&lt;br /&gt;If you feel sophisticated of you have some obscure reason to send your debug text not only to the output console but to a log file, you do like the following:&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//////////////////////////////////////////////////////////&lt;br /&gt;// clean-up the mess&lt;br /&gt;Trace.Listeners.Clear();&lt;br /&gt;//create new listener&lt;br /&gt;DefaultTraceListener yourListener = new DefaultTraceListener();&lt;br /&gt;//add new listener to trace&lt;br /&gt;Trace.Listeners.Add(yourListener);&lt;br /&gt;//set log file path&lt;br /&gt;yourListener.LogFileName = @"log_test.txt";&lt;br /&gt;//send text to console &amp;amp;&amp;amp; log file like this&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;Trace.Write("butchers will be butchers"); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the case above you can use the Debug class the same way you use Trace (so you could write Debug.Write instead of Trace.Write and so on). Difference between the two is that Trace is implemented in Release build as well while Debug only in Debug mode (will be ignored if you build in Release).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;P.S. Lately I've been to lazy to properly format the code - suck it up&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-how-to-send-debug-text-to-output-or.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-how-to-send-debug-text-to-output-or.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8727770978377672477?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8727770978377672477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8727770978377672477' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8727770978377672477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8727770978377672477'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/09/net-how-to-send-debug-text-to-output-or.html' title='[.NET] How to send debug text to output (or file)'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8922827768246919150</id><published>2008-09-15T22:09:00.013+01:00</published><updated>2008-09-16T20:25:40.571+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web technology'/><title type='text'>How long can a developer survive without Google?</title><content type='html'>How many times did your boss come up with "can we do X?" and you didn't have a clue about it but answered "Yes, no probs at all - consider it done"? You were probably thinking "WTF - I have no idea about this", and first thing you do when you're back and safe at your desk is googling the damn thing up.&lt;span style="font-style:italic;"&gt; We can do stuff like that only because developers are merging into a collective intelligence through internet + Google.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Mortality rate (= getting the axe = being let go = being fired) would be dramatically higher between developers if Google wasn't there to keep them from falling apart (or reverting to slow and painful alternatives) every time they have to learn something new (meaning almost every day unless you are a Reporting Engineer - if so good luck with that).&lt;br /&gt;&lt;br /&gt;I am not saying nothing new here, just that today being able to quickly find answers on Google is - if not the most important - at least the second or third most important skill of a developer/software engineer.&lt;br /&gt;&lt;br /&gt;Said so, I tried a little experiment: I kept track of how many times I look up work-related stuff using Google during an average day of work (9 to 5 let's say):&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;10:05&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt; - looked up C# 'as' operator to refresh a few concepts&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;10:48&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt; - looked up COM on C# sample (there's always something wrong - if you do suck)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;12:30&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt; - looked up CoCreateInstance COM function&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;14:30&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt; - looked up Abstract Factory Pattern sample (no good - Factory is enough for me)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;15:55&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt; - looked up T-SQL reference for 'collate' statement&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;16:40&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt; - looked up osql to run .sql scripts from SQL through xp_cmdshell (BAD idea!)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;So turns out on an average day I looked up 6 times on Google - none of those things were crucial for what I was doing but I needed to shed some light on some doubts or explore possibilities I wouldn't have had otherwise. T&lt;span class="Apple-style-span" style="font-style: italic;"&gt;o answer the headline, I start craving for Google after a couple of hours. After a day I would probably start to freak out. After a week or two I'd probably quit&lt;/span&gt; (OK , maybe not, maybe I'd switch to Yahoo before quitting). I am not able anymore to count all the times Google really made my day- and I have to say that this is the reason why I opened this blog, to participate in this awesome process of merging my experience based knowledge with the average guy out there who's probably doing the same.&lt;br /&gt;&lt;br /&gt;In my experience sometimes people are ashamed of looking up stuff on Google - well they shouldn't be since today is more the '&lt;span class="Apple-style-span" style="font-style: italic;"&gt;look up on google skill'&lt;/span&gt; is more valuable for a developer than any other static skill and you don't have to waste your time trying to memorize APIs or looking for perfect references 'cause google is the perfect reference (if you know how to filter all the crap - obvious). Sometimes it is astonishing to see people that revert to Google (or the web in general) only if all other means fail after a few days of blood-sweating quests (meaning all the books on the shelves and everyone in the company have been consulted) - it is (most of the times) the other way around guys.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I won't go as far as saying that I couldn't do my job without google (did I already do that?) - but certainly I couldn't be as productive without.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;OK - enough boredom for today.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;P.S. if you don't agree I'd like to hear why.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fhow-long-can-developer-survive-without.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fhow-long-can-developer-survive-without.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8922827768246919150?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8922827768246919150/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8922827768246919150' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8922827768246919150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8922827768246919150'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/09/how-long-can-developer-survive-without.html' title='How long can a developer survive without Google?'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6231394444873297681</id><published>2008-09-11T13:40:00.009+01:00</published><updated>2008-09-11T14:05:18.110+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>[.NET] How to create a shared folder in C#</title><content type='html'>To cut a not so long story even shorter, this can be done with the following snippet: &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;using System.IO;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;using System.Management;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//First create your directory&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;div&gt;DirectoryInfo myDir = new DirectoryInfo(@"C:\shared");&lt;/div&gt;&lt;div&gt;myDir.Create();&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;// Create an instance of ManagementClass&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;ManagementClass managementClass = new ManagementClass("Win32_Share");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;// ManagementBaseObjects reference for in and out parameters&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;ManagementBaseObject inParams;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;ManagementBaseObject outParams;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;inParams = managementClass.GetMethodParameters("Create");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;// Set input parameters&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;inParams["Description"] = "Shared directory";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;inParams["Name"] = "shared";//this needs to match with folder name!&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;inParams["Path"] = @"C:\shared";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;inParams["Type"] = 0x0; // Disk Drive&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;// InvokeMethod call on the ManagementClass object&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;outParams = managementClass.InvokeMethod("Create", inParams, null);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;// Check outcome&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;if ((uint)(outParams.Properties["ReturnValue"].Value) != 0)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;   //Unable to share directory&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); "&gt;The above solution is quite sweet and seems to work perfectly - for further details see the article where I originally found the snippet to share the directory: &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); "&gt;&lt;a href="http://www.sarampalis.org/articles/dotnet/dotnet0002.shtml"&gt;http://www.sarampalis.org/articles/dotnet/dotnet0002.shtml&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Man - do I suck!?!&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-how-to-create-shared-folder-in-c.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-how-to-create-shared-folder-in-c.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6231394444873297681?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6231394444873297681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6231394444873297681' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6231394444873297681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6231394444873297681'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/09/net-how-to-create-shared-folder-in-c.html' title='[.NET] How to create a shared folder in C#'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2523940673482292157</id><published>2008-09-04T20:21:00.009+01:00</published><updated>2008-09-05T14:00:57.191+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='casting'/><title type='text'>[.NET] C# 'is' operator</title><content type='html'>The C# 'is' operator looks like a boring little fella at first, but once you get to know it you will eventually appreciate it - &lt;span style="font-weight:bold;"&gt;it checks if you can safely cast an instance of an object to a type&lt;/span&gt;:&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;///////////////////////////////////////&lt;br /&gt;//example 1&lt;br /&gt;string testStr = "";&lt;br /&gt;object obj = testStr;&lt;br /&gt;&lt;br /&gt;//..somewhere else in your code&lt;br /&gt;string newStr;&lt;br /&gt;&lt;br /&gt;if (obj is String)&lt;br /&gt;{&lt;br /&gt;   newStr = (string)obj;&lt;br /&gt;   //go nuts with your string&lt;br /&gt;}&lt;br /&gt;///////////////////////////////////////&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It is important to understand that since the 'is' operator is just checking if it is safe to cast the following expression will always be true for any type:&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;///////////////////////////////////////&lt;br /&gt;//example 2&lt;br /&gt;string var = "whatever";&lt;br /&gt;&lt;br /&gt;if(var is object) //&lt;-always true (for var of any type)&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;    //always executed   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt; ///////////////////////////////////////&lt;/span&gt; &lt;div&gt;The above is always true for any type because everything in .NET inherits from object. This means you can safely cast to object (box) value types for example, and even if quite obvious it helps understanding how the 'is' operator works.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can obtain a result similar to example 1 using GetType and typeof if you're resolving types down to an inheritance line with this code: &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;/////////////////////////////////////// &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//example 3 &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;string testStr = ""; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;object obj = testStr;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;//..somewhere else in your code &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;string newStr;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;if (obj.GetType().Equals(typeof(String))) &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;{    &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;   newStr = (string)obj;    &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;   //have fun with your string &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;} &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;/////////////////////////////////////// &lt;/span&gt;&lt;/div&gt;&lt;div&gt;But here you're just checking for equality and not for safe casting in general, as you do with operator 'is' (i.e. example 2 with GetType Equals typeof returns false - because GetType returns string does not equal object). For an insight on GetType and typeof see &lt;a href="http://dotnetbutchering.blogspot.com/2008/09/net-difference-between-gettype-and.html"&gt;this post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Closing - a probably more efficient way - depending on your taste - to check if casting is safe is to go ahead and cast using the operator 'as', like this:&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 153, 0);"&gt;///////////////////////////////////////&lt;br /&gt;//example 4&lt;br /&gt;MyClass test =  new MyClass("read between the lines");&lt;br /&gt;object obj = test;&lt;br /&gt;&lt;br /&gt;//..somewhere else in your code&lt;br /&gt;MyClass newTest = (obj as MyClass);&lt;br /&gt;&lt;br /&gt;if (newStr != null)&lt;br /&gt;{&lt;br /&gt;   //do CRAZY stuff with YourClass&lt;br /&gt;}&lt;br /&gt;///////////////////////////////////////&lt;/span&gt;&lt;br /&gt;For more details about the 'as' operator have a look &lt;a href="http://dotnetbutchering.blogspot.com/2008/08/net-difference-between-casting-and-as.html"&gt;right here&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-c-is-operator.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-c-is-operator.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2523940673482292157?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2523940673482292157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2523940673482292157' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2523940673482292157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2523940673482292157'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/09/net-c-is-operator.html' title='[.NET] C# &apos;is&apos; operator'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2054348873515178077</id><published>2008-09-03T13:40:00.004+01:00</published><updated>2008-09-03T14:04:43.353+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLServer2008'/><title type='text'>[SQLServer] SQLServer2008: Workgroup VS Standard</title><content type='html'>You might be in doubt when choosing between SQLServer2008 Standard or Workgroup edition (most people rule out the Enterprise edition since it's 7500 € or so) - here's a list of the differences bewteen the two (in &lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;red&lt;/span&gt; most relevant).&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Reporting Services memory limits&lt;/span&gt;&lt;/span&gt; : unlimited for Standard - 4GB for workgroup&lt;br /&gt;&lt;br /&gt;Standard features not supported by workgroup:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;Standard algorithms&lt;/span&gt;&lt;br /&gt;Data mining tools: wizards, editors, query builders&lt;br /&gt;SQL Server Analysis Services service&lt;br /&gt;SQL Server Analysis Services backup&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;General performance/scale improvements&lt;/span&gt;&lt;br /&gt;SSIS Designer including VSTA scripting&lt;br /&gt;Integration Services service, wizards, and command prompt utilities&lt;br /&gt;Basic tasks and transformations&lt;br /&gt;Log providers and logging&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;Data profiling tools&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;Additional sources and destinations&lt;/span&gt;&lt;/span&gt;: (Raw File source, XML source, DataReader destination, Raw File destination, Recordset destination, SQL Server Compact destination, SQL Server destination)&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Business Intelligence Development Studio&lt;br /&gt;MDX edit, debug, and design tools&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;Standard performance reports&lt;/span&gt;&lt;br /&gt;Plan guides&lt;br /&gt;Plan freezing for plan guides&lt;br /&gt;Policy-based best practices&lt;br /&gt;Multi-server policy-based management&lt;br /&gt;Heterogeneous subscribers&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);"&gt;Database mirroring&lt;/span&gt;&lt;/span&gt; (witness only)&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Failover clustering&lt;/span&gt; (very limited in workgroup)&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Dynamic AWE&lt;br /&gt;Failover without client configuration&lt;br /&gt;Automatic corruption recovery from mirror&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The Workgroup edition apparently includes 5 CAL licences (a license is around 130 €) - I see that as the only possible reason you might go for it since the price of the piece of software itself is very similar (around 600 € for the workgroup against 750 for the standard).&lt;br /&gt;&lt;br /&gt;For more details &lt;a href="http://msdn.microsoft.com/en-us/library/cc645993.aspx"&gt;http://msdn.microsoft.com/en-us/library/cc645993.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fsqlserver-sqlserver2008-workgroup-vs.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fsqlserver-sqlserver2008-workgroup-vs.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2054348873515178077?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2054348873515178077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2054348873515178077' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2054348873515178077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2054348873515178077'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/09/sqlserver-sqlserver2008-workgroup-vs.html' title='[SQLServer] SQLServer2008: Workgroup VS Standard'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-8016693164382267212</id><published>2008-09-02T17:29:00.006+01:00</published><updated>2008-09-02T18:17:14.459+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web technology'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Google Chrome Drawbacks (for lazy developers)</title><content type='html'>If as a user and software engineer I am nothing less than aroused by Google Chrome release after reading the brilliant comic (&lt;a href="http://www.google.com/googlebooks/chrome/index.html"&gt;Google Chrome Comic&lt;/a&gt;) they are using as presentation, as a mere nitty-gritty developer I am somewhat worried about the fact that we'll have to bitch with yet another browser in order to produce cross-browser web apps.&lt;br /&gt;&lt;br /&gt;It might seems a little obtuse (or plain lazy) - but yet at the moment if you are developing a ASP.NET application and you set as a system requirement &lt;em&gt;IE x&lt;/em&gt; - no one complains.&lt;br /&gt;On the other end we all now that if you start requiring something different than &lt;em&gt;IE&lt;/em&gt; (i.e. &lt;em&gt;Firefox&lt;/em&gt; or &lt;em&gt;Google Chrome&lt;/em&gt; now) complaints will flood back like crazy.&lt;br /&gt;&lt;br /&gt;Hence you have two possible ways to go:&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;1)&lt;/span&gt; develop your ASP.NET web-app &lt;em&gt;optmized for IE&lt;/em&gt; (&lt;span style="color:#ff0000;"&gt;short for 'we didn't even bother running it even once on Firefox or anything else, so if it breaks it is YOUR problem'&lt;/span&gt;)&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;2)&lt;/span&gt; develop a &lt;em&gt;cross-browser&lt;/em&gt; application (&lt;span style="color:#ff0000;"&gt;short for 'we developed it on Firefox and &lt;em&gt;que serà serà&lt;/em&gt;'&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;Option 2 could now assume a hell of a new meaning (&lt;strong&gt;I am talking stuff like adding yet another 'if' to all your javascripts&lt;/strong&gt;) - possibly nothing will change since the google guys are sound guys and the webkit blah blah blah and the new javascript virtual machine (V8 - that has a specific API which can be included by other browsers and so forth) hell yeah.&lt;br /&gt;&lt;br /&gt;Anyway apart from complaining regardless (I am a developer - it's my nature), I am looking forward to put my hands on the thing and assist to a new chapter of &lt;em&gt;&lt;a href="http://en.wikipedia.org/wiki/Browser_wars"&gt;Browser Wars&lt;/a&gt;&lt;/em&gt; (coming soon on your machines and portable devices).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fgoogle-chrome-drawbacks-for-lazy.html"&gt;&lt;img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fgoogle-chrome-drawbacks-for-lazy.html" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-8016693164382267212?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/8016693164382267212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=8016693164382267212' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8016693164382267212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/8016693164382267212'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/09/google-chrome-drawbacks-for-lazy.html' title='Google Chrome Drawbacks (for lazy developers)'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-2567191999177713663</id><published>2008-09-01T19:15:00.005+01:00</published><updated>2008-09-01T19:56:05.668+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='casting'/><title type='text'>[.NET] Difference between GetType and typeof</title><content type='html'>GetType and typeof come in useful when you need to mess with objects types before casting and so forth.&lt;br /&gt;&lt;br /&gt;The difference between the two is the following:&lt;br /&gt;&lt;strong&gt;GetType&lt;/strong&gt; is a method of the object class - from which everything inherits in .NET - while &lt;strong&gt;typeof&lt;/strong&gt; is an expression that operates on a type (same as you declare variables with).&lt;br /&gt;While &lt;strong&gt;GetType&lt;/strong&gt; takes into account inheritance and gives you back the actual Type of your instance at runtime - &lt;strong&gt;typeof&lt;/strong&gt; just resolves the type into a System.Type object (jeez) at compiletime.&lt;br /&gt;&lt;em&gt;&lt;br /&gt;To cut a long story short: GetType extracts the Type from the object - typeof extracts the correspondent System.Type object from a type (declaration).&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Have a look @ an example and it will be clearer:&lt;br /&gt;&lt;span style="color:#009900;"&gt;////////////////////////////////////////////////&lt;br /&gt;Type myType;&lt;br /&gt;//the following blocks of code are equivalent&lt;br /&gt;{&lt;br /&gt;myType = typeof(int); &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;int i;&lt;br /&gt;myType = i.GetType();&lt;br /&gt;}&lt;br /&gt;/////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Good stuff - ain't it? No, it ain't - this post is child of absolute boredom.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-difference-between-gettype-and.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f09%2fnet-difference-between-gettype-and.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-2567191999177713663?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/2567191999177713663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=2567191999177713663' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2567191999177713663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/2567191999177713663'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/09/net-difference-between-gettype-and.html' title='[.NET] Difference between GetType and typeof'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-6208938560805375176</id><published>2008-08-29T11:54:00.006+01:00</published><updated>2008-08-29T12:10:31.185+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='casting'/><title type='text'>[.NET] Difference between casting and 'as' operator in C#</title><content type='html'>This is an easy one - but it can be useful to someone so here it comes:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The 'as' operator in C# is a tentative cast - if it's impossible to cast (types are not compatible) instead of throwing an exception as the direct cast the 'as' operator sets the reference to null.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;So you can have something like:&lt;br /&gt;&lt;br /&gt;MyClass myObj = new MyClass();&lt;br /&gt;MyOtherClass myOtherObj = myObj as MyOtherClass;&lt;br /&gt;if (obj != null)&lt;br /&gt;{&lt;br /&gt;   //cast was successful&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;   //a little bit of a fuck-up&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The correspondent in VB is the TryCast (usage is the same as DirectCast but it doesn't throw any exception).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-6208938560805375176?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/6208938560805375176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=6208938560805375176' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6208938560805375176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/6208938560805375176'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/08/net-difference-between-casting-and-as.html' title='[.NET] Difference between casting and &apos;as&apos; operator in C#'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-7195216095183706603</id><published>2008-08-23T23:39:00.005+01:00</published><updated>2008-08-29T23:10:17.880+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='web technology'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><title type='text'>[.NET] How to Simulate HttpContext Cookies</title><content type='html'>This might be useful if you're developing an ASP.NET application and you need to Unit Test (for example with NUnit or some other unit testing framework) some .NET component but you cannot do it because your classes use cookies.&lt;br /&gt;&lt;br /&gt;&lt;div class="code" style="HEIGHT: 620px"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;using System.Web; &lt;br /&gt;using System.IO; &lt;br /&gt;using System.Web.Hosting; &lt;br /&gt;//...&lt;br /&gt;//...&lt;br /&gt;//...&lt;br /&gt;//Initialize this stuff with some crap&lt;br /&gt;string appVirtualDir = "/"; &lt;br /&gt;string appPhysicalDir = @"C:\Documents and Settings\"; &lt;br /&gt;string page = @"localhost"; &lt;br /&gt;string query = string.Empty; &lt;br /&gt;TextWriter output = null; &lt;br /&gt;//Create a SimpleWorkerRequest object passing down the crap&lt;br /&gt;SimpleWorkerRequest workerRequest = new SimpleWorkerRequest(appVirtualDir, appPhysicalDir, page, query, output);&lt;br /&gt;//Create your fake HttpContext instance &lt;br /&gt;HttpContext.Current = new HttpContext(workerRequest);&lt;br /&gt;//Create your fake cookie &lt;br /&gt;HttpCookie myCookie = new HttpCookie("myTestCookie", "value"); &lt;br /&gt;HttpContext.Current.Request.Cookies.Add(myCookie);&lt;br /&gt;//...&lt;br /&gt;//... somewhere else in your code&lt;br /&gt;//...&lt;br /&gt;//create a cookie object &lt;br /&gt;HttpCookie anotherCookie;&lt;br /&gt;//Get your cookie from the HttpContext &lt;br /&gt;anotherCookie = HttpContext.Current.Request.Cookies.Get(0);&lt;br /&gt;string cookieName = anotherCookie.Name;//cookieName should be now "myTestCookie" &lt;br /&gt;string cookieValue = anotherCookie.Value;//cookieValue should be now "value" &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You can use the same strategy to stuff the HttpContext with whatever you may need - maybe your problem are not cookies but some other HttpContext property your classes use.&lt;br /&gt;&lt;br /&gt;Anyway I didn't figure this out all by myself - most of the inspiration came from this post on Haacked: &lt;a href="http://haacked.com/archive/2005/06/11/simulating_httpcontext.aspx"&gt;Simulating HttpContext&lt;/a&gt; (btw - he says he has a better version of the post in the first line but for what I needed it I do not agree).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f08%2fnet-how-to-simulate-httpcontext-cookies.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetbutchering.blogspot.com%2f2008%2f08%2fnet-how-to-simulate-httpcontext-cookies.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-7195216095183706603?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/7195216095183706603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=7195216095183706603' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7195216095183706603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/7195216095183706603'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/08/net-how-to-simulate-httpcontext-cookies.html' title='[.NET] How to Simulate HttpContext Cookies'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-385013539259445098</id><published>2008-07-20T15:40:00.014+01:00</published><updated>2008-07-20T16:22:21.084+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='regular expressions'/><title type='text'>[.NET] How to Reformat strings with Regular Expressions</title><content type='html'>.NET has great RegEx support, bad thing is in order to use this features you have to know about regular expressions (or you can just google validation patterns like crazy as I do).&lt;br /&gt;&lt;br /&gt;In a recent post we covered how to validate input against a regex pattern &lt;a href="http://dotnetbutchering.blogspot.com/2008/07/net-how-to-validate-strings-with.html"&gt;How to Validate Strings with RegEx&lt;/a&gt; , now we'll see how to reformat strings using Regular Expressions.&lt;br /&gt;&lt;br /&gt;Instead of using the System.Text.RegularExpressions.Regex.IsMatch (jeez) method that just checks for a match giving you back a boolean you can use the System.Text.RegularExpressions.Regex.Match (jeez) method which gives you back a match object stuffed with useful crap.&lt;br /&gt;&lt;br /&gt;Let'see an example:&lt;br /&gt;&lt;div class="code" style="HEIGHT: 325px"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;//include this statement&lt;br /&gt;using System.Text.RegularExpressions;&lt;br /&gt;&lt;br /&gt;//...&lt;br /&gt;&lt;br /&gt;string funkyString = "Scuffia likes moby dick";&lt;br /&gt;string reformattedString = "";&lt;br /&gt;&lt;br /&gt;//we use round brackets in the reg ex to create groups&lt;br /&gt;Match funkyMatch = Regex.Match(funkyString, @"^(Scuffia) (likes) (moby) (dick)$");&lt;br /&gt;&lt;br /&gt;if (funkyMatch.Success)//success property tells us if we have any match&lt;br /&gt;{&lt;br /&gt;  reformattedString = String.Format("{0} {1} {2}", funkyMatch.Groups[1], funkyMatch.Groups[2], funkyMatch.Groups[4]);&lt;br /&gt;  Console.WriteLine(reformattedString);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The output of this example app should read something (exactly) like "Scuffia likes dick".&lt;br /&gt;&lt;br /&gt;As discussed above the Match object is being filled with useful stuff. You can access the Success property in order to check if we have any match, if so you can reformat the input string accessing "Groups" - assigned using the round brackets in the regular expression. Notice the group array is zero based but in the first element (index=0) we have the whole matched expression - we can access the actual sub-strings starting from the second element of the Groups array (index = 1).&lt;br /&gt;&lt;br /&gt;I must admit, I really suck at regular expressions (I hate them) so my example is really lame, I'll give you that.&lt;br /&gt;&lt;br /&gt;Anyway - a couple of days ago Scuffia turned 26 - happy birthday Scuffia!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-385013539259445098?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/385013539259445098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=385013539259445098' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/385013539259445098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/385013539259445098'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/07/net-how-to-reformat-strings-with.html' title='[.NET] How to Reformat strings with Regular Expressions'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4307916415458145955</id><published>2008-07-16T17:45:00.011+01:00</published><updated>2008-07-16T23:45:07.135+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='conversion'/><category scheme='http://www.blogger.com/atom/ns#' term='VC++'/><title type='text'>[VC++] How to Convert from CString to const char * and back</title><content type='html'>Dealing with VC++, this is only one of the painful conversions you could have to perform if you're working with CString and you need to pass down to some function (or whatever) a const char *. &lt;br /&gt;&lt;br /&gt;Code-snippet follows (UNICODE on):&lt;br /&gt;&lt;div class="code" style="HEIGHT: 230px"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;CString myString = "bollocks";&lt;br /&gt;&lt;br /&gt;char stoneageBuffer[100];&lt;br /&gt;//initialize your stoneage buffer&lt;br /&gt;memset(stoneageBuffer,0,sizeof(stoneageBuffer));&lt;br /&gt;sprintf(stoneageBuffer,"%S",myString);&lt;br /&gt;&lt;br /&gt;//...&lt;br /&gt;&lt;br /&gt;//back to CString&lt;br /&gt;myString = stoneageBuffer;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Note that %S (and not %s) formatting type switches to the opposite type of character set (UNICODE if MBCS build and MBCS if UNICODE build).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4307916415458145955?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4307916415458145955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4307916415458145955' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4307916415458145955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4307916415458145955'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/07/vc-how-to-convert-from-cstring-to-const.html' title='[VC++] How to Convert from CString to const char * and back'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-4225291775257865178</id><published>2008-07-13T17:27:00.018+01:00</published><updated>2008-07-13T18:06:52.939+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='regular expressions'/><title type='text'>[.NET] How to Validate strings with Regular Expressions</title><content type='html'>Hi fellas,&lt;br /&gt;&lt;br /&gt;a tiny code-snippet to show how to use regular expressions to validate strings in .NET:&lt;br /&gt;&lt;br /&gt;&lt;div class="code" style="HEIGHT: 300px"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;//include this&lt;br /&gt;using System.Text.RegularExpressions;&lt;br /&gt;//...&lt;br /&gt;string myRegEx = @"^ScuffiaIsOneBigFatFaggot$";&lt;br /&gt;string myStringToValidate;&lt;br /&gt;//...&lt;br /&gt;//fill string to validate from input or whatever&lt;br /&gt;//...&lt;br /&gt;if (Regex.IsMatch(myRegEx, myStringToValidate))&lt;br /&gt;Console.WriteLine("String is valid!");&lt;br /&gt;else&lt;br /&gt;Console.WriteLine("String is rubbish");&lt;br /&gt;//...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;It's worth to underline that Regular expressions are case-sensitive, even in VB. I hate writing Regular Expressions, but Scuffia is pretty good at it so when I can't find stuff on google I always bug him when I need to validate some data. For example a couple of weeks ago I needed to validate an email and I asked him for help. &lt;br /&gt;He sent this regular expression straightaway:&lt;br /&gt;&lt;br /&gt;&lt;div class="code" style="HEIGHT: 90px"&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))&lt;br /&gt;([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Writing regular expressions is a mess but reading one if someone else wrote it is definitely something you don't wanna even think about: gotta have blind faith sometimes in this job - just remember to throw some bones to them SQA people (they're paid to break what us developers put together after all).&lt;br /&gt;&lt;br /&gt;Thanx Scuffia, the email validation reg ex is working pretty well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-4225291775257865178?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/4225291775257865178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=4225291775257865178' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4225291775257865178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/4225291775257865178'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/07/net-how-to-validate-strings-with.html' title='[.NET] How to Validate strings with Regular Expressions'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-863218021123579457</id><published>2008-07-09T20:00:00.006+01:00</published><updated>2008-07-09T20:40:54.451+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eVC++'/><category scheme='http://www.blogger.com/atom/ns#' term='WinCE'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><category scheme='http://www.blogger.com/atom/ns#' term='VC++'/><title type='text'>[eVC++] Can't include iostream</title><content type='html'>&lt;strong&gt;Problem: &lt;/strong&gt;in Embedded VC++ 3/4 you can't seem to include iostream&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Embedded VC++ 3/4 does not support iostream - use stdio.h instead&lt;br /&gt;&lt;br /&gt;This got me stuck for a while - it's just a good example of the limitation imposed by development on Windows CE: &lt;em&gt;cout&lt;/em&gt; is way too fancy for eVC++ ... you'll have to live with the good old &lt;em&gt;printf&lt;/em&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-863218021123579457?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/863218021123579457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=863218021123579457' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/863218021123579457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/863218021123579457'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/07/evc-cant-include-iostream.html' title='[eVC++] Can&apos;t include iostream'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3760169963830810897.post-5095900455712480250</id><published>2008-05-19T11:59:00.005+01:00</published><updated>2008-05-19T12:15:43.018+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='Crystal Reports'/><title type='text'>Crystal Reports - Request canceled by user</title><content type='html'>&lt;strong&gt;Problem:&lt;/strong&gt; You get this error message when programmatically printing a Crystal Reports Report &lt;span style="color:#cc0000;"&gt;"Error in file [filepath].rpt - Request canceled by user"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution: &lt;/strong&gt;This happens because your default printer is not available - make sure it is online and available.&lt;br /&gt;&lt;br /&gt;OK, this post sucks, but eventually it will be useful to someone in trouble with Crystal Reports. By the way Crystal Reports sucks too - if you wanna read about the reasons why chek this post out &lt;a href="http://dotnetbutchering.blogspot.com/2008/02/net-vc-7-good-reasons-to-hate-crystal.html"&gt;http://dotnetbutchering.blogspot.com/2008/02/net-vc-7-good-reasons-to-hate-crystal.html&lt;/a&gt; .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3760169963830810897-5095900455712480250?l=dotnetbutchering.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetbutchering.blogspot.com/feeds/5095900455712480250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3760169963830810897&amp;postID=5095900455712480250' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5095900455712480250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3760169963830810897/posts/default/5095900455712480250'/><link rel='alternate' type='text/html' href='http://dotnetbutchering.blogspot.com/2008/05/crystal-reports-request-canceled-by.html' title='Crystal Reports - Request canceled by user'/><author><name>Johnny Idol</name><uri>http://www.blogger.com/profile/13431481971279629409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_LLByA-cjSbY/SMD888NWj3I/AAAAAAAAAAg/mnGMHDOu6Lc/S220/snake.jpg'/></author><thr:total>0</thr:total></entry></feed>
