tag:blogger.com,1999:blog-190532940030036782024-03-08T09:28:58.450-08:00Derek Liang<%=Braindump()%>dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.comBlogger23125tag:blogger.com,1999:blog-19053294003003678.post-27561393998773179512011-09-22T15:22:00.001-07:002011-09-22T15:22:36.694-07:00C++ part 2 returning an objectThe following code in C++ is not the same.<br><font style="font-family: courier new,monospace;" size="4"><br></font><div style="margin-left: 40px;"><font style="font-family: courier new,monospace;" size="4"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">Fraction</span><span style="color: rgb(192, 192, 192);"> </span>multiply<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">Fraction</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">f2</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">{</span> </font></div><pre style="margin: 0px 0px 0px 40px; text-indent: 0px; font-family: courier new,monospace;"><font size="4"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">return</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">Fraction</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0);">m_Numer</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">f2</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(128, 0, 0);">m_Numer</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 0);">m_Denom</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">f2</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(128, 0, 0);">m_Denom</span><span style="color: rgb(0, 0, 0);">);</span></font></pre> <div style="margin-left: 40px;"><font style="font-family: courier new,monospace;" size="4"> </font><font size="4"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">}</span></font><br><font size="4"><span style="color: rgb(0, 0, 0);"></span></font></div><pre style="margin: 0px; text-indent: 0px; font-family: courier new,monospace;"> <font size="4"><span style="color: rgb(0, 0, 0);"><br></span></font></pre><font style="font-family: courier new,monospace;" size="4"> </font> <div style="text-align: left;"><pre style="margin: 0px; text-indent: 0px; font-family: courier new,monospace;"><font size="4"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">Fraction</span><span style="color: rgb(192, 192, 192);"> </span>multiply1<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">Fraction</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">f2</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">{</span></font></pre> <font style="font-family: courier new,monospace;" size="4"> </font><pre style="margin: 0px; text-indent: 0px; font-family: courier new,monospace;"><font size="4"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">Fraction</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">a</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0);">m_Numer</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">f2</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(128, 0, 0);">m_Numer</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 0);">m_Denom</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">f2</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(128, 0, 0);">m_Denom</span><span style="color: rgb(0, 0, 0);">);</span></font></pre> <font style="font-family: courier new,monospace;" size="4"> </font><pre style="margin: 0px; text-indent: 0px; font-family: courier new,monospace;"><font size="4"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">return</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">a</span><span style="color: rgb(0, 0, 0);">;</span></font></pre> <font style="font-family: courier new,monospace;" size="4"> </font><pre style="margin: 0px; text-indent: 0px; font-family: courier new,monospace;"><font size="4"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">}</span></font></pre></div><br> <br>The first one return an actual object. And second is returning a local object which will be invalid after the method returns. Therefore the second method call will cause run-time error.<br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com1tag:blogger.com,1999:blog-19053294003003678.post-43515664602871570812011-09-21T23:51:00.001-07:002011-09-21T23:51:52.259-07:00c++After spending so many years programming in C#, I really appreciate how life make it so simple by language designers. Consider the following code written in c++:<br><br><br>Fraction a = b;<br><br>vs.<br><br>Fraction a;<br> a=b;<br><br>In C#, these 2 blocks of code are saying the same thing. It declares a variable and assigns it value b (i.e. a and b now pointing to the same object).<br><br>However, in C++, it is totally different. The first code block is to create an object of class Fraction by calling constructor(const & Fraction). The second block is to create an object with default constructor, and call the operator=(const Franction &). Depends on how you write your member functions of the class, the code might or might not work the way it looks.<br> <br>I like C#'s version, since the code worked exactly it is read. Whereas, in C++, errors might be introduced.<br><br><br><br>dl<br><br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-27688277933480222072008-09-05T15:54:00.001-07:002008-09-05T15:54:44.147-07:00Error with Nant<div dir="ltr">It seems that the following error message can be fixed by create a new registry entry. I am not sure why it is missing.<div><span class="Apple-style-span" style="font-family: 'courier new', monospace;"><br> </span></div><div><span class="Apple-style-span" style="font-size: 12px; "><span class="Apple-style-span" style="font-family: 'courier new', monospace;">Solution:</span></span></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"> <span class="Apple-style-span" style="font-family: 'courier new'; font-size: 12px; ">[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]</span><br><span class="Apple-style-span" style="font-family: 'courier new'; font-size: 12px; ">"sdkInstallRootv2.0"="C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727"</span><br> </blockquote><div><div><span class="Apple-style-span" style="font-family: 'courier new', monospace;"><br></span></div></div><span class="Apple-style-span" style="font-family: 'courier new', monospace;"><br> Error message:<br></span><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span class="Apple-style-span" style="font-family: 'courier new', monospace;"><span class="Apple-style-span" style="font-family: 'courier new', monospace;">C:\wiki>c:\nant\bin\NAnt.exe svn.build<br> NAnt 0.86 (Build 0.86.2898.0; beta1; 12/8/2007)<br>Copyright (C) 2001-2007 Gerry Shaw<br><a href="http://nant.sourceforge.net">http://nant.sourceforge.net</a><br><br><br>BUILD FAILED<br><br>Failed to initialize the 'Microsoft .NET Framework 2.0' (net-2.0) target framewo<br> rk.<br><br> Property evaluation failed.<br>Expression: ${path::combine(sdkInstallRoot, 'bin')}<br> ^^^^^^^^^^^^^^<br><br> Property 'sdkInstallRoot' has not been set.<br> <br>For more information regarding the cause of the build failure, run the build aga<br>in in debug mode.<br><br>Try 'nant -help' for more information</span><br><br><br></span></blockquote></div> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-63344830290302179182008-08-25T16:32:00.000-07:002008-08-26T09:29:56.969-07:00LizardTF : a much better alternative than Visual Studio TFS client<div dir="ltr">I highly recommend anyone whom works with TFS as his/her primary source control tool to give <a href="http://www.codeplex.com/lizardtf">LizardTF</a> a try. I especially likes the review sub-menu, 10 times better than TFS, since I sometimes making changes of a couple of hundreds files and can view the check-in items in a hierarchical view. Another reason is it categorized the items into 4 categories. IMHO Microsoft should hire the guy if they want to improve the usability of the product. :)<br> <br>Personally, I use GIT while work offline to keep track of intermediate changes and update the TFS while a work item is done.<br></div> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-20204568339545081762008-08-12T12:46:00.001-07:002008-08-25T15:31:16.128-07:00things that I do like in TFS<div dir="ltr">1. No shell integration. I do not understand why it is not a priority. I spend lots of time in Windows Explorer for adding, moving, deleting, and copying files. It is just impossible after I re-arrange a couple of folders and try to check-in the changes. No easy way to identify which files are added, moved, and deleted.<br> <br>2. Bad integration with VS 2008. For example, it does not tell you if the file under the folder is modified until you expand the folder. Same apply for the project, you won't know if any file gets modified after you open/expand the project. It is not difficult thing to do, why it worked this way. No drag and drop support is another example. Lack of unified diff. I am not a mouse-clicker. I know I can get it from view pending change menu option. But what if I made 20 small changes to 20 files, I have to click through these 20 files to find out the changes I made.<br> <br>3. No disconnect mode. I could not work offline, check-in the changes, and later synchronize with main server. Every operation needs to contact server. That explains why the performance is so slow and inconsistent via VPN. Sometimes it takes 15 seconds to open the property page of a project. It is extremely slow comparing VS 2008 without TFS installed. Luckly I have <a href="http://git.or.cz/">GIT</a> installed on my local machine and used it keep intermediate changes and only update it when it is done.<br> <br>I moved from SVN+TortoisesSVN+AnkhSVN, I felt the difference is day and night. In everyway, I felt the TFS is working against you not for you.<br><br>Things that so simple with SVN become impossible to do it or at least 10 times more difficult to do in TFS. Here is another example, I used a code generation tools that creates about 200+ .cs files which is part of the c# project. In SVN, every time I need to refresh the generated code, I just need to generate the code and refresh project by clicking the refresh icon under the Solution Explorer. Then I can then <b>visually </b>tell what files have changed since last check-out and I can do unified diff to find out all the updates. I do not think it is possible at all in TFS. What a shame!!!<br> <br><br><h2 class="r"><a href="http://tortoisesvn.tigris.org/" class="l" onmousedown="return rwt(this,'','','res','1','AFQjCNE3AGLQNZb9GvR1WVhdQ8oQGhIG7Q','&sig2=s0OJ63M8a54IF_l6v0fBvA')"><br> </a></h2></div>dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-40119127924191474192008-07-15T17:04:00.001-07:002008-07-15T17:04:21.529-07:00How to extending default MSBuild script for Teambuild<div dir="ltr">I have been configuring and using Cruise Control .NET and NANT combination for my last project in my company. Everyone loves it, it takes only 10 minutes from the code check-in to generate the final deployable binaries. I even setup the an auto-deploy project so that when the latest code is generated, it will automatically deploy under the IIS. Everyone can monitor the project status via the little green icon in the system tray.<br> <br>Since I was the person who was most familiar with compile/build process in the team, I undertook the task to setup a new build system and convert all existing projects into Team Foundation Server (TFS). Since I do not like hybrid solution, I set out to just use the MSBuild functionality. It was quite easy to configure the MSBuild agent. I did it with the following steps:<br> <br>1. Install the Team Foundation Build from the TFS CD.<br>2. Make sure that you are granted access rights to Build Services via the Project Security dialog box.<br>3. Right-mouse click on the Builds and select Manage Build Agents and add a build agent that setup in step 1.<br> 4. Right-mouse click on the Builds and select Add new Build Definition.<br>5. Under the Project File menu, you can have the TFS to create a default build file. <br>6. Complete the rest of menu options and click OK to save the changes.<br> <br>Now you have a newly created build definition and you can launch it by right-mouse clicking and selecting Queue New Build. You should have the compiled binary files in the drop location in 5 minutes if your project is not too big.<br> <br>The next thing comes is how to further configure it. Specifically there are 2 things I would like to do:<br><br>1. replace some place holder in the source files before compile<br>2. run the WISE setup module to create final MSI files for distribution.<br> <br>After a little bit digging in the Microsoft.TeamFoundation.Build.targets file, I found all the extension points that are available as the following. By create 2 targets (AfterGet and PackageBinaries) in the newly-created build definition file, I could archieve what I what to do here.<br> <br><br><br><div style="margin-left: 40px;"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><!-- Override this target to execute custom tasks before EndToEndIteration --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeEndToEndIteration" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!--</span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> Override this target to execute a task for customizing the build number and/or drop location.</span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> Make sure that the task outputs properties with the names 'BuildNumber' and/or 'DropLocation'.</span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BuildNumberOverrideTarget" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!--</span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> Override this target to execute a task for customizing the build number and/or drop location.</span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> Make sure that the task outputs properties with the names 'BuildNumber' and/or 'DropLocation'.</span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BuildNumberOverrideTarget" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before clean --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeClean" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after clean --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterClean" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeCleanConfiguration" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterCleanConfiguration" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before cleaning an individual solution --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeCleanSolution" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after cleaning an individual solution --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterCleanSolution" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before workspace initialization --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeInitializeWorkspace" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after workspace initialization --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterInitializeWorkspace" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before getting sources --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeGet" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after getting sources --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterGet" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before labeling sources --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeLabel" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after labeling sources --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterLabel" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before compilation --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeCompile" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after compilation --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterCompile" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before the compilation of an individual configuration --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeCompileConfiguration" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after the compilation of an individual configuration --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterCompileConfiguration" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before the compilation of an individual solution --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeCompileSolution" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after the compilation of an individual solution --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterCompileSolution" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before associating changesets and updating work items --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeGetChangesetsAndUpdateWorkItems" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after associating changesets and updating work items --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterGetChangesetsAndUpdateWorkItems" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before running tests --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeTest" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after running tests --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterTest" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before the testing of an individual configuration --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeTestConfiguration" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after the testing of an individual configuration --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterTestConfiguration" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to generate documentation. --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="GenerateDocumentation" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to package all binaries for deployment. --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="PackageBinaries" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before copying files to the drop location --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeDropBuild" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after copying files to the drop location --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterDropBuild" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before the BuildBreak target --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeOnBuildBreak" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override the target to execute custom tasks after associating changesets on a build break --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterGetChangesetsOnBuildBreak" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override the target to execute custom tasks before associating changesets on a build break --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeGetChangesetsOnBuildBreak" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override the target to execute custom tasks after associating changesets on a build break --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterGetChangesetsOnBuildBreak" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks before work item creation --></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="BeforeCreateWorkItem" /></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <!-- Override this target to execute custom tasks after work item creation--></span><br style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <span style="font-family: courier new,monospace; color: rgb(51, 51, 51);"> <Target Name="AfterCreateWorkItem" /></span><br style="color: rgb(51, 51, 51);"></div><br><br><br></div> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-75433861389203504712008-03-18T10:06:00.001-07:002008-03-18T10:06:59.547-07:00GWT(google Web Toolkit)Recently I was doing feasibility study of implementation <a href="http://code.google.com/webtoolkit/">GWT</a> for our next project. <br><br>The tool kit allows programmers write plain Java which be compiled into JavaScript for rich web front-end application. There is a Java to JavaScript compiler will compile the Java code to JavaScript while the library that comes with the tool kit will hide the any browser quicks for you. The resulting JavaScript code will only be load once on the client and only the data will be dynamically requested by the JavaScript code. I think it is wonderful programming model.<br> <br>The issue I am running into is that since Javascript has so called <a href="http://en.wikipedia.org/wiki/Same_origin_policy">Same Origin Policy</a> . It prevents any scripts that try to request data from any servers other than the server that the scripts are loaded. <br> <br>It is not much a problem for the GWT, the front-end development server happens to be the same back-end server if you are using built-in RPC calls. For me, I was going to use Microsoft IIS as my development back-end server. Since I am going to use Eclipse with GWT plugin as my front-end development environment, the JavaScript will be loaded from my front-end development server and will not be able to request any data from back-end server on a different port (it will violate the Same Origin Policy).<br> <br>To work around the problem, I use a tool called <a href="http://www.fiddler2.com/fiddler2/">Fiddler</a> which allows you to modify the request on the fly. What you need to do it just download and install the software from the web site. Upon launching the Fiddler UI, press CTRL-R to open customized script editor (it can also be open via menu Rules | Customize Rules... ). Locate a function call OnBeforeRequest and insert the following lines:<br> <br><span style="font-family: courier new,monospace;"> if (oSession.HostnameIs("MYAPP")) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if (oSession.PathAndQuery.StartsWith("/search")){</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;"> oSession.host = "<a href="http://www.google.ca">www.google.ca</a>"; </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;"> else {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> oSession.host = "<a href="http://127.0.0.1:8888">127.0.0.1:8888</a>"; </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;"> }</span><br><br>It is quite self-explanatory. It basically says that if the host name is MYAPP, then rewrite the host name based on the requesting URL. In the example, if the URL is starting with "/search", it will send the request to "<a href="http://www.google.ca">www.google.ca</a>" otherwise it will send requests to localhost port 8888. It needs to customized to suit your needs.<br> <br>After you set it up, you can now requesting paging via Internet Explorer (unfortunately it works only on IE). Try the following:<br><div style="margin-left: 40px;"><a href="http://myapp/search?hl=en&q=test">http://myapp/search?hl=en&q=test</a><br> </div><br><div style="margin-left: 40px;"><a href="http://myapp/com.mycompany.project.ImageViewer/ImageViewer.html">http://myapp/com.mycompany.project.ImageViewer/ImageViewer.html</a><br></div><br>This will overcome the Same Origin Policy restriction for you since your JavaScript and back-end server will all appear as it originated from the same server.<br> <br>It has the following drawbacks.<br>1. It does not work on Firefox.<br>2. The breakpoint has no effect if you invoking the page via the proxy. (I do not know why?)<br><br><br><br><br><br><br><br><br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-69678166566165824482008-02-22T19:05:00.001-08:002008-02-22T19:05:46.775-08:00Microsoft Web UIMicrosoft has so many web technologies to do the same Web UI AJAX thingy. It does not even funny. Here is the (not exhaustive) list :<br><br><ul><li><a href="http://ASP.NET/AJAX">ASP.NET/AJAX</a></li><li>SliverLight</li><li> <a href="http://labs.live.com/volta/faq/">Volta</a><br></li><li><a href="http://ASP.NET/MVC">ASP.NET/MVC</a> (a programming model that not related to always related AJAX)</li><li>Visual Web GUI</li><li>...</li></ul>Sometimes it is a tough decision to make, especially they are still new and you have to overcome some quirks that are not very well-documented. I used the <a href="http://ASP.NET/AJAX">ASP.NET/AJAX</a> in my most recent project. It turned out that in order to write a AJAX control extender you have to learn a whole framework/library in a completely different language (JavaScript). What a nightmare to maintain the code.<br> <br><br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-38103168750368195622008-02-05T11:08:00.001-08:002008-02-05T11:08:01.552-08:00Is object assignment statement thread safe?It really depends on the type of the assignment. <br><br><i>" The CLR guarantees that for types which are no bigger than the size of a native integer, if the memory is properly aligned (as it is by default - if you specify an explicit layout, that could change the alignment), reads and writes are atomic. In other words, if one thread is changing a properly aligned <code>int</code> variable's value from 0 to 5 and another thread is reading the variable's value, it will only ever see 0 or 5 - never 1 or 4, for instance. For a <code>long</code>, however, on a 32-bit machine, if one thread is changing the value from 0 to 0x0123456789abcdef, there's no guarantee that another thread won't see the value as 0x0123456700000000 or 0x0000000089abcdef. You'd have to be unlucky - but writing thread-safe code is all about taking luck out of the equation."<br><br>From l<a href="http://www.yoda.arachsys.com/csharp/threads/volatility.shtml">ink</a><br><br></i>It does not mention object reference assignment. However the size of object reference is always equal to the native integer which means on 32-bit machine the reference size should be 32 bits and on 64-bit machine the reference size should always be 64 bits, therefore it is thread safe.<br> <br><br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-50110571389923032102008-02-04T10:39:00.001-08:002008-02-04T10:39:32.022-08:00Best practice for database versionI was always curious about how other people implement the database versioning in their software development process. Today I tumbled across the following <a href="http://www.codinghorror.com/blog/archives/001050.html">article</a> about best practice in database versioning.<br> <br>The way I am doing it is quite strange forward and involves 2 steps.<br><ol><li>Create base-line database.</li><li>Create and maintain a single change script file which will be checked into source control.<br></li></ol> Apparently it works well for us. The difference between the method mentioned in the article and my approach are (A) whether we create multiple files to maintain the changes in the source control (B)whether to create a separated table to maintain the current schema version. Everything else works the same way, including branching and merging. <br> <br> Point A has no semantic difference.<br><br>For point B, it is not necessary because when you apply the script which has a version number in the source control (I am using SubVersion which will generate a unique repository-wide incremental number each time you make change(s) to the source repository and our build number is tied to this number), and therefore you know what is the database schema version after the script applies. If customer reports a problem with build 213, I know exactly what the database schema should be and all the source code that associated with this build.<br> <br><br><br><br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-36709637464741809642008-02-03T21:51:00.001-08:002008-02-03T21:51:39.485-08:00Session for ASP.NETI ran across <a href="http://www.hanselman.com/blog/TroubleshootingExpiredASPNETSessionStateAndYourOptions.aspx">this article</a> about some hints and tips about session state server in production environment. It is not programming related but I think as a <a href="http://ASP.NET">ASP.NET</a> programmer should be aware of it if the site is high-traffic site that uses web farm. It also provides some links to cache server product. I think it is quite useful.<br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-35662016879924937292008-01-24T14:47:00.001-08:002008-01-24T14:47:21.565-08:00Generic Wrapper for Session variable in ASP.NETI found a way to wrap around Session variable in <a href="http://ASP.NET">ASP.NET</a>. It provides a strong-type return type and make code much easy to understand. <p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"><br></span></p><p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";">Usage:</span> </p> <p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: rgb(43, 145, 175);">GlobalAppParameter</span> gp = GetSession<<span style="color: rgb(43, 145, 175);">GlobalAppParameter</span>>(<span style="color: rgb(163, 21, 21);">"gp"</span>, <span style="color: blue;">delegate</span> {<br> <span style="color: blue;">return</span> <span style="color: rgb(43, 145, 175);">GlobalAppParameter</span>.NewGlobalAppParameter();<br> });</span></p><span style="font-size: 10pt; font-family: "Courier New";">Declare/implementation</span><span style="font-size: 10pt; font-family: "Courier New";"></span> <p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">protected</span> <span style="color: blue;">delegate</span> T <span style="color: rgb(43, 145, 175);"> CallBack</span><T>();</span></p><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">protected</span> T GetSession<T>(<span style="color: blue;">string</span> sessionName, <span style="color: rgb(43, 145, 175);">CallBack</span><T> callBack )</span><span style="font-size: 10pt; font-family: "Courier New";">{</span> <p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> T ret;<br> <span style="color: blue;">if</span> (Session[sessionName] == <span style="color: blue;">null</span>)<br> {<br> ret = callBack();<br> Session[sessionName] = ret;<br> }<br> <span style="color: blue;">else</span><br> ret = (T) Session[sessionName];</span></p> <p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">return</span> ret;<br> }</span></p> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-48939747214654570602008-01-22T16:54:00.001-08:002008-01-22T16:54:48.055-08:00Order By Sub-queryIn case you never heard of this, you can actually create a select statement in which the <span style="font-family: courier new,monospace;">Order By</span> clause can be a sub-query too.<br><br> <p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: blue;">SELECT </span><span style="font-size: 10pt; font-family: "Courier New";">BranchID, <br></span></p><p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";">(<span style="color: blue;"> SELECT TOP </span>1 InstitutionName <span style="color: blue;">FROM </span>Institution <span style="color: blue;">WHERE </span>Institution.InstitutionID=FIServiceLocation.InstitutionID) InstitutionName </span></p> <p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: blue;">FROM </span><span style="font-size: 10pt; font-family: "Courier New";">FIServiceLocation </span></p> <p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: blue;">Order By </span><span style="font-size: 10pt; font-family: "Courier New";">(<span style="color: blue;">SELECT TOP </span>1 InstitutionName <span style="color: blue;">FROM </span>Institution <span style="color: blue;"> WHERE </span>Institution.InstitutionID=FIServiceLocation.InstitutionID)</span></p>The feature actually is very useful for me in a project I am working on, since I wanted to be able to sort a computed field.<br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-20377115481909068462008-01-16T16:03:00.001-08:002008-01-16T16:03:33.296-08:00Inversion of Control Example StructuremapI am experimenting with <a href="http://en.wikipedia.org/wiki/Inversion_of_control" target="_blank">IoC </a>for the first time today. There are number of open source library out <a href="http://csharp-source.net/open-source/containers" target="_blank"> there </a>. I chose Structuremap since I was introduced the concept by Jeremy D. Miller who was the author of the software last year in <a href="http://www.devteach.com/" target="_blank">DevTeach</a>. After I search around on the Internet to try to find some tutorials on the how it works with <b>minimal</b> amount of code to demonstrate how it works without success, I dicided to write my own. Here is the code:<br><br> <p style="font-family: courier new,monospace;"><span style="font-size: 10pt; color: blue;"><?</span><span style="font-size: 10pt; color: rgb(163, 21, 21);">xml</span><span style="font-size: 10pt; color: blue;"> </span><span style="font-size: 10pt; color: red;">version</span><span style="font-size: 10pt; color: blue;">=</span><span style="font-size: 10pt; color: blue;"> "<span style="color: blue;">1.0</span>"<span style="color: blue;"> </span><span style="color: red;">encoding</span><span style="color: blue;">=</span>"<span style="color: blue;">utf-8</span>"<span style="color: blue;"> ?></span><br><</span><span style="font-size: 10pt; color: rgb(163, 21, 21);">StructureMap</span><span style="font-size: 10pt; color: blue;"> ><br> <</span><span style="font-size: 10pt; color: rgb(163, 21, 21);">Assembly</span><span style="font-size: 10pt; color: blue;"> </span><span style="font-size: 10pt; color: red;">Name</span><span style="font-size: 10pt; color: blue;">=</span><span style="font-size: 10pt; color: blue;">"<span style="color: blue;">ConsoleApplication4</span>" <span> /><br> </span><</span><span style="font-size: 10pt; color: rgb(163, 21, 21);">PluginFamily</span><span style="font-size: 10pt; color: blue;"> </span><span style="font-size: 10pt; color: red;">Assembly</span><span style="font-size: 10pt; color: blue;">=</span><span style="font-size: 10pt; color: blue;"> "<span style="color: blue;">ConsoleApplication4</span>"<span style="color: blue;"> </span><span style="color: red;">Type</span><span style="color: blue;">=</span>"<span style="color: blue;">ConsoleApplication4.IScheduler </span>"<span style="color: blue;"> </span><span style="color: red;">DefaultKey</span><span style="color: blue;">=</span>"<span style="color: blue;">MyFirstScheduler</span>"<span>><br> </span> <</span><span style="font-size: 10pt; color: rgb(163, 21, 21);">Instance</span><span style="font-size: 10pt; color: blue;"> </span><span style="font-size: 10pt; color: red;">Type</span><span style="font-size: 10pt; color: blue;">=</span><span style="font-size: 10pt; color: blue;"> "<span style="color: blue;">Daily</span>"<span style="color: blue;"> </span><span style="color: red;">Key</span><span style="color: blue;">=</span>"<span style="color: blue;">MyFirstScheduler</span>"<span> /><br> </span></</span><span style="font-size: 10pt; color: rgb(163, 21, 21);">PluginFamily</span><span style="font-size: 10pt; color: blue;"> ><br></</span><span style="font-size: 10pt; color: rgb(163, 21, 21);">StructureMap</span><span style="font-size: 10pt; color: blue;">></span> </p> <p style="font-family: courier new,monospace;"><span style="font-size: 10pt; color: blue;">using</span><span style="font-size: 10pt; color: blue;"> System;<br>using</span><span style="font-size: 10pt; color: blue;"> System.Data;<br>using</span><span style="font-size: 10pt; color: blue;"> StructureMap;<br>namespace</span><span style="font-size: 10pt;"> ConsoleApplication4<br>{<br><span> </span>[<span style="color: rgb(43, 145, 175);">Pluggable</span>(<span style="color: rgb(163, 21, 21);"> "Daily"</span>)]<br><span> </span><span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: rgb(43, 145, 175);">DailyScheduler</span> : <span>IScheduler<br> </span>{<br><span> </span><span style="color: blue;">public</span> <span style="color: rgb(43, 145, 175);">DateTime</span> GetNextRunTime(<span style="color: rgb(43, 145, 175);"> DateTime</span> currentTime)<br><span> </span>{<br><span> </span><span style="color: blue;">return</span> <span style="color: rgb(43, 145, 175);">DateTime</span>.Now;<br><span> </span>}<br><span> </span>} <br></span></p> <p style="font-family: courier new,monospace;"> </p> <p style="font-family: courier new,monospace;"><span style="font-size: 10pt;"><span> </span><span style="color: blue;">public</span> <span style="color: blue;">interface</span> <span> IScheduler<br> </span>{<br><span> </span><span style="color: rgb(43, 145, 175);">DateTime</span> GetNextRunTime(<span style="color: rgb(43, 145, 175);">DateTime</span> now);<br><span> </span>}</span></p> <p style="font-family: courier new,monospace;"><span style="font-size: 10pt;"><span> </span><span style="color: blue;">class</span> <span>Program<br> </span>{<br><span> </span><span style="color: blue;">static</span> <span style="color: blue;">void</span> Main(<span style="color: blue;">string</span>[] args)<br><span> </span>{<br><span> </span><span style="color: rgb(43, 145, 175);">IScheduler</span> s = <span style="color: rgb(43, 145, 175);">ObjectFactory</span>.GetInstance<<span style="color: rgb(43, 145, 175);">IScheduler</span>>();<br><span> </span>}<br><span> </span>}<br>}</span> </p> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-59617281609966677422008-01-15T12:10:00.001-08:002008-01-15T12:10:29.546-08:00Gridview paging within other data control<span style="font-family: courier new,monospace;"><font face="arial,sans-serif">One approach to solve a programming problem is to re-create the problem with minimal </font></span><span style="font-family: courier new,monospace;"> <font face="arial,sans-serif">amount of </font></span><span style="font-family: courier new,monospace;"><font face="arial,sans-serif">code and work on it. It has 2 effects on solving the problem. One is that it lets you focus on the problem without any distraction from other parts of the code which could be huge. The other one is that it shorten the code change and debug/test loop. You can almost get instantaneous feed back from your code changes. <br><br>Here is how I apply the principle. In my work project, I encounter a problem to paginate a GridView which is inside a data control. I am keep getting error message saying ""Object reference not set to an instance of an object.". <br><br><font size="4"><b>Reproduce the problem</b></font><br>So I start out to create the problem with minimal amount of code. The following code shows a repeater control and within the repeater control it display a GridView control which has pagination enabled. Upon page loading, it sets the datasource for the repeater and call the DataBind() method to update the repeater and its child controls. It works fine on the first initial page load, but fails when you click on the numbers that represents each page of the GridView. </font><br><br></span> <p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span><span style="color: blue;"><</span><span style="color: rgb(163, 21, 21);">asp</span><span style="color: blue;"> :</span><span style="color: rgb(163, 21, 21);">Repeater</span> <span style="color: red;">ID</span><span style="color: blue;">="Repeater1"</span> <span style="color: red;">runat</span><span style="">="server"> <br> </span><span style="color: blue;"><</span><span style="color: rgb(163, 21, 21);">ItemTemplate</span><span style="">><br> </span><span style="color: blue;"><</span><span style="color: rgb(163, 21, 21);"> asp</span><span style="color: blue;">:</span><span style="color: rgb(163, 21, 21);">GridView</span> <span style="color: red;">ID</span><span style="color: blue;">="GridView1"</span> <span style="color: red;">runat </span><span style="color: blue;">="server"</span> <span style="color: red;">AllowPaging</span><span style="color: blue;">="True"</span> <span style="color: red;">EnableSortingAndPagingCallbacks</span> <span style="">="True"<br> </span><span style="color: red;">PageSize</span><span style="color: blue;">="2"</span> <span style="color: red;">DataSource</span><span style="color: blue;">=' </span><span style="background: yellow none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><%</span>#<span style=""> </span> ( (A) Container.DataItem).b <span style="background: yellow none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">%></span><span style=""> '><br> </span><span style="color: blue;"></</span><span style="color: rgb(163, 21, 21);">asp</span><span style="color: blue;">:</span><span style="color: rgb(163, 21, 21);">GridView</span><span style=""> ><br> </span><span style="color: blue;"></</span><span style="color: rgb(163, 21, 21);">ItemTemplate</span><span style="">><br> </span><span style="color: blue;"></</span><span style="color: rgb(163, 21, 21);"> asp</span><span style="color: blue;">:</span><span style="color: rgb(163, 21, 21);">Repeater</span><span style="color: blue;">></span></span></p> <div style="background: white none repeat scroll 0% 50%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <pre style="margin: 0px;"> <span style="color: blue;">protected</span> <span style="color: blue;">void</span> Page_Load(<span style="color: blue;">object</span> sender, <span style="color: rgb(43, 145, 175);">EventArgs </span> e)</pre><pre style="margin: 0px;"> {</pre><pre style="margin: 0px;"> <span style="color: blue;">if</span> (!IsPostBack)</pre><pre style="margin: 0px;"> {</pre><pre style="margin: 0px;"> <span style="color: rgb(43, 145, 175);">A</span> a = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">A</span>();</pre><pre style="margin: 0px;"> a.b = <span style="color: blue;">new </span> <span style="color: blue;">int</span>[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};</pre><pre style="margin: 0px;"> </pre><pre style="margin: 0px;"> Repeater1.DataSource = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);"> List</span><<span style="color: rgb(43, 145, 175);">A</span>>(<span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">A</span>[] {a});</pre><pre style="margin: 0px;"> Repeater1.DataBind ();</pre><pre style="margin: 0px;"> }</pre><pre style="margin: 0px;"> }</pre></div>It is good sign that I am able to reproduce the problem with the minimal <span style="font-family: courier new,monospace;"><font face="arial,sans-serif"> amount of </font></span>code shown above without any Ajax, JavaScript, database access.<br><br><font size="4"><b>Tackle the problem</b></font><br>A quick search on the e-books that I have and on the Internet could not find any information on the topic. One related the <a href="http://www.vbdotnetheaven.com/UploadFile/nikhil_be_it/GridViewInsideGridView05232006004636AM/GridViewInsideGridView.aspx">article</a> shows a technique to display GridView within a GridView is the closest that I can find. It uses 2 datasource controls and bind the child datasource at runtime. In the problem code above, I bind the datasource declaratively. Maybe declaration of child datasource only takes effect via the page loading not the subsequent page post-back. That is exactly how my test code fails. <br><br>So I quickly change the code as the following: (changes are in bold)<br><br><span style="font-size: 10pt; font-family: "Courier New";"><span style=""> </span><span style="color: blue;"><</span><span style="color: rgb(163, 21, 21);"> asp</span><span style="color: blue;">:</span><span style="color: rgb(163, 21, 21);">Repeater</span> <span style="color: red;">ID</span><span style="color: blue;">="Repeater1"</span> <span style="color: red;">runat </span><span style="">="server" </span></span><b><span style="font-size: 10pt; font-family: "Courier New";"><span style="color: blue;"></span> <span style="color: red;">OnItemDataBound</span><span style=""> ="Repeater1_ItemDataBound"</span></span></b><span style="font-size: 10pt; font-family: "Courier New";"><span style="">><br> </span><span style="color: blue;"><</span><span style="color: rgb(163, 21, 21);">ItemTemplate</span><span style="">><br> </span><span style="color: blue;"><</span><span style="color: rgb(163, 21, 21);">asp</span><span style="color: blue;">:</span><span style="color: rgb(163, 21, 21);">GridView</span> <span style="color: red;"> ID</span><span style="color: blue;">="GridView1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">AllowPaging</span><span style="color: blue;"> ="True"</span> <span style="color: red;">EnableSortingAndPagingCallbacks</span><span style="">="True"<br> </span><span style="color: red;">PageSize</span><span style="color: blue;">="2"</span> <b><span style="color: red;"></span></b></span><b><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: red;">OnDataBinding</span><span style="">="GridView1_DataBinding"</span></span></b><span style="font-size: 10pt; font-family: "Courier New";"><span style="color: red;"></span><span style=""> ><br> </span><span style="color: blue;"></</span><span style="color: rgb(163, 21, 21);">asp</span><span style="color: blue;">:</span><span style="color: rgb(163, 21, 21);">GridView</span><span style="">><br> </span><span style="color: blue;"></</span><span style="color: rgb(163, 21, 21);">ItemTemplate</span><span style="">><br> </span><span style="color: blue;"></</span><span style="color: rgb(163, 21, 21);">asp</span><span style="color: blue;">:</span><span style="color: rgb(163, 21, 21);">Repeater</span><span style="color: blue;">></span> </span><br> <p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"><span style=""></span><span style="color: blue;"><br></span></span></p> <div style="background: white none repeat scroll 0% 50%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <pre style="margin: 0px;"><b> <span style="color: blue;">protected</span> <span style="color: blue;">void</span> Repeater1_ItemDataBound(<span style="color: blue;">object</span> sender, <span style="color: rgb(43, 145, 175);"> RepeaterItemEventArgs</span> e)</b></pre><pre style="margin: 0px;"><b> {</b></pre><pre style="margin: 0px;"><b> <span style="color: rgb(43, 145, 175);">GridView</span> gv = (<span style="color: rgb(43, 145, 175);"> GridView</span>) e.Item. FindControl(<span style="color: rgb(163, 21, 21);">"GridView1"</span>);</b></pre><pre style="margin: 0px;"><b> gv.DataBind();</b></pre><pre style="margin: 0px;"><b> }</b></pre> <pre style="margin: 0px;"><b> </b></pre><pre style="margin: 0px;"><b> <span style="color: blue;">protected</span> <span style="color: blue;">void</span> GridView1_DataBinding(<span style="color: blue;">object</span> sender, <span style="color: rgb(43, 145, 175);">EventArgs</span> e)</b></pre><pre style="margin: 0px;"><b> {</b></pre><pre style="margin: 0px;"><b> <span style="color: rgb(43, 145, 175);">GridView</span> gv = (<span style="color: rgb(43, 145, 175);"> GridView</span>)sender;</b></pre><pre style="margin: 0px;"><b> gv.DataSource = <span style="color: blue;">new</span> <span style="color: blue;">int</span>[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };</b></pre><pre style="margin: 0px;"> <b> }</b></pre></div> <br>Basically, I removed the declarative databinding for the GridView and intercept 2 events that will allow me to populate the GridView programmatically. The chain of events that fires are Repeater1_Databinding, Repeater1_itemDataBound, Gridview1_DataBinding. The last 2 events will repeat as many times as the amount of data in the repeater. <br><br>Now we have a solution and just need to port it to my work project.<br><br><br><br><br><br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-37154895136342904712008-01-15T10:50:00.001-08:002008-01-15T10:50:36.956-08:00MS SQL quirkI used sub-query as column output quite often. As shown in the following command SQL command.<br><br><div style="margin-left: 40px;"><b><span style="font-family: courier new,monospace;">select (select top 1 a from b.c=d.c) e from d </span></b><br></div><br>However, if you query further based on the sub-query result e, the result is not defined, as shown in the following statement.<br><br><div style="margin-left: 40px;"><b><span style="font-family: courier new,monospace;"> select (select top 1 a from b.c=d.c) <span style="color: rgb(255, 153, 102);">e</span>, (select top 1 f from g where g.h=<span style="color: rgb(255, 102, 102);">e</span>) i from d</span></b></div><br>The query will run successfully but the resulting data for <b>i</b> is not changing based on the value <b>e</b> which is correct even multiple rows are returned.<br><br>The solution is quite simple. We just need to replace the <b>e</b> with the sub-query it represents as shown below: <br><br><div style="margin-left: 40px;"><b><span style="font-family: courier new,monospace;">select (select top 1 a from b.c=d.c) <span style="color: rgb(255, 153, 102);">e</span>, (select top 1 f from g where g.h in </span> </b><b><span style="font-family: courier new,monospace;">(select top 1 a from b.c=d.c)</span></b><b><span style="font-family: courier new,monospace;"><span style="color: rgb(255, 102, 102);"></span>) i from d</span></b><br> </div> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-34091862314365066382008-01-10T15:24:00.001-08:002008-01-10T15:39:41.367-08:00Mole for Visual Studio<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://derekliangblogger.s3.amazonaws.com/MoleScreenshot.jpg"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px;" src="https://derekliangblogger.s3.amazonaws.com/MoleScreenshot.jpg" border="0" alt="" /></a><br /><br />I came across a very useful tool called "Mole for Visual Studio" that allow you to visualize the data easily. The project that I am working right now has about 8 level deep in one <a href="http://ASP.NET">ASP.NET </a> page. It is hard to keep track of all the objects that created at different the levels. Mole for Visual Studio works like a charm.<br /><br />Here is the <a href="https://derekliangblogger.s3.amazonaws.com/MoleScreenshot.jpg"> link </a>to the screenshot.dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-42198356582601514162008-01-10T10:00:00.001-08:002008-01-10T10:00:58.625-08:00How to monitor text changes in an input box on a web pageI was assigned a task to implement something like Autocomplete control in <a href="http://ASP.NET">ASP.NET</a> Ajax Control Tool Kit with JavaScript. The only difference is that instead of displaying a drop drown list like what Autocomplete does, I need to display more rich content. <br><br>It took me a while to figure out how to monitor the input text changes in a text box. I created kyepress and mousedown and various other event handlers to start the process to monitor the input text box. It worked in some cases, but failed in others. <br><br>In the end, I have to take a look into the source code that implemented Autocomplete control released with Ajax Contrl Took Kit by Microsoft. The correct answer is to intercept focus, blur, and keydown events. In the past, it would not be possible because all the software is not open-sourced. The only solution is to read documentation and use trial and error approach. <br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-22050768942193150722008-01-08T10:14:00.001-08:002008-01-08T10:14:19.205-08:00Referencing type within a generic classIn the following code snippet, an enum<span style="color: rgb(43, 145, 175);"> class1Enum </span>type is declared with in a generic class<span style="color: rgb(43, 145, 175);"> Class1</span><T>. In order to reference to <span style="color: rgb(43, 145, 175);"> class1Enum </span>type, we have to instantiate the generic class by supplying its type as shown in the declaration of var1 and var2. Another catch is that, although the var1 and var2 are of the same <span style="color: rgb(43, 145, 175);"> class1Enum </span>type, they are declared in different classes namely <span style="color: rgb(43, 145, 175);">Class1</span><<span style="color: blue;">int</span>> and <span style="color: rgb(43, 145, 175);"> Class1</span><<span style="color: blue;">string</span>>, and therefore they are not the same.<br><br> <div style="background: white none repeat scroll 0% 50%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: rgb(43, 145, 175);">Class1</span><T></pre><pre style="margin: 0px;"> {</pre><pre style="margin: 0px;"> <span style="color: blue;">public</span> T t;</pre><pre style="margin: 0px;"> </pre><pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">enum</span> <span style="color: rgb(43, 145, 175);"> class1Enum</span></pre><pre style="margin: 0px;"> {</pre><pre style="margin: 0px;"> a,</pre><pre style="margin: 0px;"> b</pre><pre style="margin: 0px;"> }</pre><pre style="margin: 0px;"> }</pre><pre style="margin: 0px;"> </pre><pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: rgb(43, 145, 175);">Class2</span></pre><pre style="margin: 0px;"> {</pre><pre style="margin: 0px;"> <span style="color: blue;">public</span> Class1.class1Enum var; <span style="color: green;">// compile error</span></pre><pre style="margin: 0px;"> </pre><pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: rgb(43, 145, 175);">Class1</span><<span style="color: blue;">int</span>>.<span style="color: rgb(43, 145, 175);">class1Enum</span> var1;</pre><pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: rgb(43, 145, 175);">Class1</span><<span style="color: blue;">string</span>>.<span style="color: rgb(43, 145, 175);">class1Enum</span> var2;</pre><pre style="margin: 0px;"> </pre><pre style="margin: 0px;"> <span style="color: blue;">public</span> Class2()</pre><pre style="margin: 0px;"> {</pre><pre style="margin: 0px;"> var1 = var2; <span style="color: green;">// compile error </span></pre><pre style="margin: 0px;"> }</pre><pre style="margin: 0px;"> }</pre></div> <br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-90533898415849344482008-01-08T09:35:00.001-08:002008-01-08T09:35:20.150-08:00My Sudoku SolverMy first published article about <a href="http://www.codeproject.com/KB/game/SudokuSolver.aspx">Sudoku Solver</a> in C# 3.0 back in 2006 when LINQ was still in public beta.<br> dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-22751098842298610572008-01-07T16:56:00.001-08:002008-01-07T23:01:30.665-08:00Enum FlagsThe following code demostrates how to use enum type in c# as flags.<br> <div style="background: white none repeat scroll 0% 50%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <pre style="margin: 0px;"><br> [<span style="color: rgb(43, 145, 175);">Flags</span>]</pre><pre style="margin: 0px;"> <span style="color: blue;">public</span> <span style="color: blue;">enum</span> <span style="color: rgb(43, 145, 175);"> test</span></pre><pre style="margin: 0px;"> {</pre><pre style="margin: 0px;"> none = 0,</pre><pre style="margin: 0px;"> a = 0x01,</pre><pre style="margin: 0px;"> b = 0x02,</pre><pre style="margin: 0px;"> c = 0x04,</pre><pre style="margin: 0px;"> d = 0x08</pre><pre style="margin: 0px;"> }</pre><pre style="margin: 0px;"> <span style="color: blue;">static</span> <span style="color: blue;"> void</span> Main(<span style="color: blue;">string</span>[] args)</pre><pre style="margin: 0px;"> {</pre><pre style="margin: 0px;"> <span style="color: rgb(43, 145, 175);">test</span> t = <span style="color: rgb(43, 145, 175);"> test</span>.none;</pre><pre style="margin: 0px;"> <span style="color: rgb(43, 145, 175);">Console</span>.WriteLine(t);</pre><pre style="margin: 0px;"> </pre><pre style="margin: 0px;"> t = t | <span style="color: rgb(43, 145, 175);"> test</span>.a; <span style="color: green;">//set bit a</span></pre><pre style="margin: 0px;"> <span style="color: rgb(43, 145, 175);">Console</span>.WriteLine(t);</pre><pre style="margin: 0px;"> </pre><pre style="margin: 0px;"> <span style="color: blue;">if</span> (t == <span style="color: rgb(43, 145, 175);">test</span>.a) </pre><pre style="margin: 0px;"> <span style="color: rgb(43, 145, 175);">Console</span>.WriteLine( <span style="color: rgb(163, 21, 21);">"only bit a is set"</span>);</pre><pre style="margin: 0px;"> </pre><pre style="margin: 0px;"> t = t | <span style="color: rgb(43, 145, 175);">test</span>.b; <span style="color: green;"> // set bit a</span></pre><pre style="margin: 0px;"> <span style="color: rgb(43, 145, 175);">Console</span>.WriteLine(t);</pre><pre style="margin: 0px;"> </pre><pre style="margin: 0px;"> <span style="color: blue;"> if</span> ((t & <span style="color: rgb(43, 145, 175);">test</span>.a) != 0) <span style="color: green;">//test to see if bit a is set</span></pre><pre style="margin: 0px;"> <span style="color: rgb(43, 145, 175);"> Console</span>.WriteLine(<span style="color: rgb(163, 21, 21);">" test bit a is set"</span>);</pre><pre style="margin: 0px;"> </pre><pre style="margin: 0px;"> <span style="color: rgb(43, 145, 175);">Console </span>.ReadKey();</pre><pre style="margin: 0px;"> }</pre></div> <br>The implementation I was using is to use the BitArray which is very efficient. The good news is I implemented by using code generation which means I only need to modify the code generation templates and all my generated code will be benefiting. :) <br><br><br>dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-3558175499882737432008-01-07T14:00:00.000-08:002008-01-07T14:14:23.899-08:00Setting the timeout value when doing unit testing<div class="Section1"> <p class="MsoNormal">It is actually quite easy to set the timeout for Microsoft Unit Test. It is shown as the following which set the timeout to 10 minutes:<o:p></o:p></p> <o:p> </o:p></p> <p class="MsoNormal" style=""><span style=";font-family:";font-size:10;" > [<span style="color: rgb(43, 145, 175);">TestMethod</span>]<o:p></o:p></span><br> <span style=";font-family:";font-size:10;" > [<span style="color: rgb(43, 145, 175);">Timeout</span>(600000)]<o:p></o:p><br></span><span style=";font-family:";font-size:10;color:blue;" > public</span><span style=";font-family:";font-size:10;" > <span style="color:blue;">void</span> QuickSearchRegressionTestWithThread() {… }<o:p></o:p></span> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Actually it the following <a href="http://vmlb-build/ccnet/server/local/project/ServicePortal.NET/build/log20080107123131.xml/ViewBuildReport.aspxhttp:/www.codeplex.com/xunit/Wiki/View.aspx?title=Comparisons&referringTitle=Home">link</a> provides the comparison of all the fixtures of all the popular unit test suites for the .NET framework.<o:p></o:p></p> </div>dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0tag:blogger.com,1999:blog-19053294003003678.post-55689267203799743582006-10-12T11:34:00.000-07:002008-01-07T23:01:38.833-08:00I tumbled into <a href="http://en.wikipedia.org/wiki/Aspect_Oriented_Programming">Aspect-oriented programming</a>. It is very <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-corrected" id="SPELLING_ERROR_0">interesting</span> concept. The basic idea is to <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-corrected" id="SPELLING_ERROR_1">decorate</span> implicitly or explicitly classes or methods (or event statements) to trigger events which will be intercepted across the program.<br /><br />The immediate use I can think of is logging, <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-corrected" id="SPELLING_ERROR_2">transaction</span> and security checking. However some of these aspects had been addressed in C# 2.0 through <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-corrected" id="SPELLING_ERROR_3">declarative</span> method and class attributes. I am wondering how much C# will be evolved to address the other aspects of the Aspect-oriented programming.dlhttp://www.blogger.com/profile/16761868981627454535noreply@blogger.com0