tag:blogger.com,1999:blog-64360360422713304282024-03-14T07:29:49.436+11:00Diary of a Code MonkeyExplore, Learn and ShareWiryadi Adidharmahttp://www.blogger.com/profile/17413013719684399669noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-6436036042271330428.post-9364027063166926822014-07-09T18:49:00.004+10:002014-07-09T18:51:12.178+10:00Test LinkClick me
<a href="http://www.nbnco.com.au/connect-home-or-business/information-for-business.html">http://www.nbnco.com.au/connect-home-or-business/information-for-business.htm</a>Wiryadi Adidharmahttp://www.blogger.com/profile/17413013719684399669noreply@blogger.com0tag:blogger.com,1999:blog-6436036042271330428.post-54521161356769157562010-07-05T21:02:00.007+10:002010-07-05T22:20:04.034+10:00C# 4.0 Dynamic and ExpandoThe most exciting C# 4.0 feature for me is the dynamic.<br />It significantly lowered the cost to create more fluent and beautiful API.<br /><br /><br /><br />Below is the slide from my lightning talk at Sydney ALT.NET June meeting.<br /><br /><a href="http://www.slideshare.net/wiryadi/c-40-dynamic">http://www.slideshare.net/wiryadi/c-40-dynamic</a><br /><br />The source code for CoolSQL will be available on GitHub <br /><a href="http://github.com/wiryadi/DynamicSQL"><br />http://github.com/wiryadi/DynamicSQL</a>Wiryadi Adidharmahttp://www.blogger.com/profile/17413013719684399669noreply@blogger.com1tag:blogger.com,1999:blog-6436036042271330428.post-11006699196109511202008-10-23T22:59:00.003+11:002008-10-23T23:03:51.392+11:00Fluent Spring is AliveFluent Spring project is alive. It is hosted at google code.<br />It is still very rough. <br /><br />The project delivers DSL to configure Spring.NET in C#, no XML required.<br /><br />Check it out at <a href="http://code.google.com/p/fluent-spring">http://code.google.com/p/fluent-spring</a>Wiryadi Adidharmahttp://www.blogger.com/profile/17413013719684399669noreply@blogger.com1tag:blogger.com,1999:blog-6436036042271330428.post-38838556127039270122008-10-15T16:32:00.004+11:002008-10-15T16:49:55.224+11:00Spring.NET fluent configuration<h2>Mission</h2><br />I like Spring.NET framework. But I am not a fan of xml configuration.<br /><br />Spring.NET has programmatic configuration API. <a href="http://blog.springsource.com/2008/01/04/spring-net-11-and-container-configuration/">Refer to Mark Pollack's blog</a><br />However, the api is awkward to work with.<br /><br /><h2>Plan</h2>I like the way<a style="font-family: arial;" href="http://code.google.com/p/autofac/">Autofac's</a> fluent configuration.<br />I plan to create a helper class to provide fluent configuration for Spring.NET a'la Autofac.Wiryadi Adidharmahttp://www.blogger.com/profile/17413013719684399669noreply@blogger.com0tag:blogger.com,1999:blog-6436036042271330428.post-61063290135506294322007-08-05T00:08:00.000+10:002007-12-13T22:12:13.894+11:00Benchmarking SqlBulkCopyBulk uploading into SQL Server programmatically has always been slow and tedious exercise.<br />Fortunately Microsoft has included SqlBulkCopy in the SqlClient for ADO.NET 2.0<br /><br />In my testing. I loaded Australia's PostCode list from csv file, consisting of 16,789 rows.<br />I compared SqlAdapter.Fill(), SqlAdapterFill() + Setting the UpdateBatchSize property, and finally I used SqlBulkCopy.<br /><br />First I read the csv file into in memory DataTable. For this purpose I read all rows in one go. In real live application, we would need to page the operation.<br /><br />Then I push the DataTable into SqlServer 2005 table using 3 different methods.<br /><ol><li>SqlAdapter.Fill</li><li>SqlAdapter.Fill + Setting the UpdateBatchSize property = 500<br /></li><li>SqlBulkCopy</li></ol>Option 1 took 11,365 ms<br />Option 2 took 9,636 ms<br />and .....<br />Option 3 took 568 ms<br /><br />Wow,.....<br />I suspect that option 1 and option 2 difference would be more significant if the SQL Server is located accross network. In this test I use local SQL Server.<br /><br />To do SqlBulkCopy is surprisingly simple:<br />You need only to specify the connection string, the datatable and the name of the destination table.<br /><span style="font-size:85%;"><span style="font-family:courier new;"> string connectionString = "....";</span></span><br /><span style="font-size:85%;"><span style="font-family:courier new;"> DataTable csvTable = PopulateTable();</span></span><br /><span style="font-size:85%;"><span style="font-family:courier new;"> SqlBulkCopy bcp = new SqlBulkCopy(connectionString );<br />bcp.DestinationTableName = "PostCodes";<br />bcp.WriteToServer(csvTable);<br /><br />Here are snippet of the code from my Benchmark Harness, which is a winforms application<br /><br /><hr /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_E-mpUjcusSk/RrSj0sZGxUI/AAAAAAAAAA0/x-L7r55Z4sg/s1600-h/code1.png"><img style="cursor: pointer;" src="http://3.bp.blogspot.com/_E-mpUjcusSk/RrSj0sZGxUI/AAAAAAAAAA0/x-L7r55Z4sg/s400/code1.png" alt="" id="BLOGGER_PHOTO_ID_5094877204127860034" border="0" /></a>Wiryadi Adidharmahttp://www.blogger.com/profile/17413013719684399669noreply@blogger.com0