↓ Skip to main content
The technical notebook of Bryan Avery

Ideas worth sharing.

Practical notes on software architecture, cloud platforms, security and AI. Written from real engineering experience, with an eye on what actually works.

A little about me

Latest articles

553 articles in the archive

CSV file parser and writer in C# (Part 3)

·3 mins
This is the last part of an article series exploring reading and writing CSV files with C#/.NET. Part 1 covered converting the contents of a DataTable into CSV format. Part 2 explained how to read a CSV file back into a DataTable. Finally we will look at some test cases for use with NUnit, a very important tool that I'll describe in more detail in an upcoming article. There is quite a bit of code, but it is all very simple and easy to understand. Each method marked with [Test] will be called by NUnit and run one of the CSV related methods in turn. Assert statements will then check if the returned values are valid or not.

CSV file parser and writer in C# (Part 2)

·4 mins
This is the second part of an article series exploring reading and writing CSV files with C#/.NET. Part 1 covered converting the contents of a DataTable into CSV format; this part explains reading a CSV file back into a DataTable.

CSV file parser and writer in C# (Part 1)

·3 mins
An issue that comes up quite frequently is how to read and write comma seperated value (CSV) files in C#. Surprisingly the .NET libraries have no built-in support for this, and the usual solution to use an OleDb connection to the CSV file with Microsoft Excel's database driver is convoluted and not cross-platform. CSV files have a very simple structure (source): Each record is one line (with exceptions) Fields are separated with commas Leading and trailing space-characters adjacent to comma field separators are ignored Fields with embedded commas must be delimited with double-quote characters Fields that contain double quote characters must be surounded by double-quotes, and the embedded double-quotes must each be represented by a pair of consecutive double quotes. A field that contains embedded line-breaks must be surounded by double-quotes Fields with leading or trailing spaces must be delimited with double-quote characters Fields may always be delimited with double quotes The first record in a CSV file may be a header record containing column (field) names In this article, I'll provide simple, but fully functional code to read and write a CSV file according to these rules. In memory, data will be represented as a DataTable, which makes it easy to process; for storage in the file system or transfer over a network the CSV data will be stored as a String or in a Stream.

Using BlogEngine.net as a General Purpose Content Management System

·3 mins
So I keep running into the same problem – I am building a small website for somebody and I need to provide them with a way to update the content of their site so I don’t have to. Basically, I need a lightweight and flexible content management system that is easy to use.

Wiki

·1 min
I've been after creating a Wiki for some time, and I think I may have found one worth looking at 'Screw Turn', not the most inspiring name but I have read good reviews, so I'll be having a look in my spare time at what it can do and how I can implement it www.screwturn.eu

Resume now available online

·1 min
My Latests Resume is now available online in both HTML and Word format Click here to see what I've been doing!

Directions to Coppermill

·1 min
DIRECTIONS TO THE 31 The Pound, Bromham, SN15 2HE View Larger Map From where-ever you start drive to Junction 17 of M4 THE FOLLOWING WILL ONLY TAKE YOU ABOUT 15 MINS! Take the A350 to Chippenham (Mostly Dual Carriageway) Services on 1st roundabout and keep following signs ‘A350 Chippenham’ Lots of rounabouts Reach Roundabout turn left following signs for Chippenham/Devizes this roundabout has Sainsburys on your left (its quite hidden) Drive through housing area with lots of roundabouts (your going round outskirts of chippenham) Reach roundabout with ‘Town Centre left’ and ‘Devizes right’, turn right. Drive pass small petrol station and a pub turn turn right up hill ‘A342 Devizes’ Go up hill pass ‘Bowood Country Club’ on your left Follow road through ‘Sandy Lane’ with lovely thatch cottages Road becomes v straight again with sign post ‘Melksham right’ DON’T turn right! Keep straight on Almost there so slow down, a few bends, sign post turn right BROMHAM Drive pass tennis courts on right with kids play area – keep slow! Set of trees on right, Bryans house is 1st house on right IT’S QUITE HIDDEN! Turn right and park 

Using LINQ to SQL

·1 min
Found these great articles on LINQ to SQL, well worth reading as it the way to go forwards Using LINQ to SQL (Part 1) LINQ to SQL (Part 2 – Defining our Data Model Classes) LINQ to SQL (Part 3 – Querying our Database)

spammer-proof email address

·1 min
edream.org Blog Article Extending Personal Web Site Starter Kit (3) spammer-proof email address

How to run an application as another user

·1 min
Useful little short cut to allow you to run / login as another process as a different user without having to logoff and back in again. %windir%\system32\runas.exe /profile /user:gwtest\testuser /savecred "c:\program files\internet explorer\iexplore.exe"

Concurrent Remote Sessions in XP

·3 mins
Concurrent Remote Desktop Sessions in Windows XP SP2 I mentioned before that Windows XP does not allow concurrent sessions for its Remote Desktop feature. What this means is that if a user is logged on at the local console, a remote user has to kick him off (and ironically, this can be done even without his permission) before starting work on the box. This is irritating and removes much of the productivity that Remote Desktop brings to Windows. Read on to learn how to remove that limitation in Windows XP SP2 A much touted feature in SP2 (Service Pack 2) since then removed was the ability to do just this, have a user logged on locally while another connects to the terminal remotely. Microsoft however removed the feature in the final build. The reason probably is that the EULA (End User License Agreement) allows only a single user to use a computer at a time. This is (IMHO) a silly reason to curtail Remote Desktop's functionality, so we'll have a workaround. Microsoft did try out the feature in earlier builds of Service Pack 2 and it is this that we're going to exploit here. We're going to replace termserv.dll (The Terminal Server) with one from an earlier build (2055). To get Concurrent Sessions in Remote Desktop working, follow the steps below exactly: Download the termserv.zip file below and extract it somewhere. (You have to be registered to see the file) Reboot into Safe Mode. This is necessary to remove Windows File Protection. Copy the termserv.dll in the zip to %windir%\System32 and %windir%\ServicePackFiles\i386. If the second folder doesn't exist, don't copy it there. Delete termserv.dll from the dllcache folder: %windir%\system32\dllcache Merge the contents of Concurrent Sessions SP2.reg file into the registry. Make sure Fast User Switching is turned on. Go Control Panel -> User Accounts -> Change the way users log on or off and turn on Fast User Switching. Open up the Group Policy Editor: Start Menu > Run > 'gpedit.msc'. Navigate to Computer Configuration > Administrative Templates > Windows Components > Terminal Services. Enable 'Limit Number of Connections' and set the number of connections to 3 (or more). This enables you to have more than one person remotely logged on. Now reboot back into normal Windows and try out whether Concurrent Sessions in Remote Desktop works. It should! If anything goes wrong, the termserv_sp2.dll is the original file you replaced. Just rename it to termserv.dll, reboot into safe mode and copy it back. The termserv.dl_ file is provided in the zip is for you slipstreamers out there. Just replace that file with the corresponding file in the Windows installation disks. I've added in extra information from the comments below… thanks for all who researched! 🙂 http://sig9.com/node/110

Lightbox Example

·1 min
[lightbox:/uploads/2008/11/ViewfromtheChurch.jpg]