Posts tagged ‘C Sharp (C#)’

Yet Another Guide to Dynamic Assembly loading and Execution Using Reflection

Download ReflectionTest.zip

There are already many good guides out there illustrating how to construct a weakly coupled system that dynamically loads in modules as needed. In .Net, this can be accomplished using reflection. Continue reading ‘Yet Another Guide to Dynamic Assembly loading and Execution Using Reflection’ »

Redirecting StandardOutput

Sometimes it is necessary for a main program to invoke other executables during runtime. Continue reading ‘Redirecting StandardOutput’ »

Populating Object from Text Files via Reflection

Download readfileviareflection.zip

In .Net, an XML file or even a CSV file can easily be mapped to an object using proper attributes. Using the reflected object type, such XML or CSV files can easily be deserialized into the corresponding object. Continue reading ‘Populating Object from Text Files via Reflection’ »

File.Exists and UNC

If you have used System.IO.File.Exists in ASP.Net, you probably have found out that unless the account under which ASP.Net is running (e.g. ASPNET for Windows XP and IIS_WPG for Windows 2003 Server, etc) has access to a networked location (either a unc or a mapped drive, File.Exists will always return a false no matter whether the file actually exists in the location queried or not. This behavior has caused a lot of headaches for Web developers. Continue reading ‘File.Exists and UNC’ »

Hyper-Threading and Dual Core Performance Comparison for Computational Intensive Applications – Update

In a post (Hyper-Threading and Dual Core Performance Comparison for Computational Intensive Applications) I wrote at the end of last year, I compared multi-threaded scientific application performance of a Pentium 4 processor with hyper-threading enabled and a Pentium D processor, and concluded that for multi-threaded scientific applications, hyper-threaded processor helped little in terms of application performance. Continue reading ‘Hyper-Threading and Dual Core Performance Comparison for Computational Intensive Applications – Update’ »

Parsing MMddyyyy or ddMMyyyy Date Format

Today I was discussing how to convert date strings MMddyyyy (e.g. 03282007) or ddMMyyyy (e.g. 28032007) back to DateTime object. Continue reading ‘Parsing MMddyyyy or ddMMyyyy Date Format’ »

ToString() and Error Logging

In production environment, it is not always possible to step through the compiled code using a debugger and thus we rely on error logs to provide insights into the potential causes of bugs. Continue reading ‘ToString() and Error Logging’ »

Understanding “Error MSB6006” in MSBuild

A couple of days ago, I ran into a mysterious problem when trying to build a web project using MSBuild. Continue reading ‘Understanding “Error MSB6006” in MSBuild’ »

Remote Code Execution via Reflection

Background

In .Net, distributed computing can be done in a number of ways. Continue reading ‘Remote Code Execution via Reflection’ »

One Time Password Generation

In many applications, it is often required to generate one time passwords. Continue reading ‘One Time Password Generation’ »

Auto Sizing RichTextBox Based on Content

I got a request from my client a couple of weeks ago. For simplicity reasons, I will present it as follows. Continue reading ‘Auto Sizing RichTextBox Based on Content’ »

Debugging Tabbing Issues with Spy++

A few weeks back, I ran into some issues related to tab stops for certain controls on a windows form not behaving as expected (e.g. a TabStop is set to false but the tab seems to still be trapped in the control somewhere). Continue reading ‘Debugging Tabbing Issues with Spy++’ »

Watch Out for Number Conversion Errors

Converting from floating point numbers (e.g. double, single) to integers can be tricky. Continue reading ‘Watch Out for Number Conversion Errors’ »

Generating Unique Permutations Programmatically

Download UniquePermutation.zip The numbers of permutations on a set of n elements is n! (see definition). Continue reading ‘Generating Unique Permutations Programmatically’ »

Implementing a Trie in C#

Download Trie.zip Trie is a tree like data structure that can be used for fast text search. Continue reading ‘Implementing a Trie in C#’ »