FileHelpers flat-file library

A while back, I started doing some work on an application that does a lot of flat-file writing — specifically, fixed-width (positional) ASCII text files.  Now, this isn’t really exciting stuff, but like COBOL, it still makes a lot of businesses go round, but doing flat-file manipulation by hand seemed like about seven kinds of crazy, so I started looking for a better solution.

I found a project called FileHelpers.  It’s a utility library to help .Net applications read and write structured flat files. Most of the library lives in a core assembly with a number of “engine” classes that are used to drive I/O along with attributes that are used to decorate record classes in your application.

Your code uses these attributes to define records:

namespace FileHelpers.Tests

	internal class FixedRec1
		public String String10Field1;

		public DateTime DateField2;

		public decimal MoneyField3;


To read or write files, then, one of the FileHelper engines works with the records you’ve defined to manipulate, format, and validate data:

var recs = new List<FixedRec1>();
recs.Add(new FixedRec1 { String10Field1 = "abc", DateField2 = DateTime.Today, MoneyField3 = 123.45M });  // show truncation of field 1
recs.Add(new FixedRec1 { String10Field1 = "abcdefghijklmnopqrstuvwxyz", DateField2 = DateTime.Today, MoneyField3 = 123.45M });  // show null translation of field 1
recs.Add(new FixedRec1 { DateField2 = DateTime.Today, MoneyField3 = 123.45M });  // show illegal value for field3
recs.Add(new FixedRec1 { String10Field1 = "abc", DateField2 = DateTime.Today, MoneyField3 = -0.00001M });
// To Write Use: engine.WriteFile("FileOut.txt", recs.ToArray());

You can extend FileHelpers by constructing your own custom attributes, such as converters to handle formats not natively provided by FileHelpers, but it’s pretty handy to have source code for FileHelpers on-hand for debugging, because if you do any amount of heavy lifting with it, you’ll end up wanting to walk through the code to see what’s going on.

FileHelpers is open source software released under the LGPL. Source is available on SourceForge, but note that the released versions of code currently go up only to the 2.x release, dated 2007. If you’re going to work with this library, you really want to go after the development source code, which is currently in a pre-release status for version 3.0, and compile the library on your own. You can find a subversion connection string on this Sourceforge page.

Don’t be this guy

I found this sort of amusing, though I’ll be the first to admit that the humor will be lost on some people.  This is a clip from a web site that’s promoting an infrastructure component that’s supposed to be enterprise-quality and highly available.  While I’m sure this is true, it’s also true that having a web page that doesn’t load won’t inspire tons of confidence.  Oops.

(yes, I blurred the text a bit — no need to pile on for what’s certainly an isolated problem)

Stored Procedure References

Last week, I did a little work to track down unused stored procedures in a large-ish SQL Server database.  Searching for references in source code was interesting all by itself, but I also wanted to see which procs were referenced by other procedures.  This is what I came up with:

select 'referencing proc', 'referenced proc'
	sysdepends d,
	sys.objects o1,
	sys.objects o2
where = o1.object_id
	d.depid = o2.object_id
	and o2.type = 'P'

Quora Blocks Startup Search Engines

According to an article on ReadWriteWeb, Q&A site Quora is blocking search engines from indexing its site — all, that is, except for Google, Bing, and a couple other big players.  If this is true, this is a really chilling development for the competitive landscape of the Internet.

Image representing ReadWriteWeb as depicted in...
Image via CrunchBase

Google is plenty big enough all by itself — just look at how difficult it’s been for Bing to claw out any sort of market share at all.  I’d really like to think that the market is still open to someone who wants to build a better mousetrap, but this sort of behavior is going to make it just about impossible for a new player to break into search.

So take a look around — this may be as good as search gets.

Enhanced by Zemanta

How *not* to help your users

I got an email this afternoon from “VMWare Communities.”  You’ve seen emails like this, I’m sure — here’s your status, and some stuff you might be interested in, and so on.  Emails like this are generally intended to strengthen a connect with customers, which is great — normally.

In this case, though, there was a section of the email entitled “Your Content”:

Activity around content you’ve created or contributed to

When I saw this, I was pretty excited, because I’d forgotten (for the time being) about both of these issues.  I’d posted questions in VMWare’s forums for a couple of issues, and I hadn’t recalled seeing solutions for either of them.   According to the newsletter, though, there were updates available on both questions.  Happy day!

Until I went and read the forum topics.

It turns out that VMWare’s little newsletter-writer counting tool was counting *all* views and *all* replies, so in both cases, it turns out that my post was the last one in the topic.  Worse, yet, my posts were six and nine months old, respectively (no wonder I’d forgotten about them).  So instead of reaching out and building ties with me, in this case, VMWare merely succeeded in reminding me that their open issues aren’t being fixed, and that their support forums are effectively dead.

“You break up…call back in six months.”

Spec’ing a Computer

I recently helped a friend build a new PC, and I threw a few notes together along the way.  If you’ve never built a PC from scratch (or haven’t done so recently), you may find some of these things helpful.  Note that the focus here is on building a high-end business machine or a developer workstation.  I’ll try to point out some places where you’d bump up specs for a gaming machine, but there are really plenty of other guides out there for “ultimate gaming machines”.

Since we’re building a business machine, we’re looking for good performance without breaking the bank.  The notes below are organized by component; if you work your way through the list, you should end up with a pretty solid build.

Case: A mid-tower gives you plenty of room for all but the most extreme expansion.  Some crazy-big video cards might be tough to fit, but there’s no reason to buy those if you’re not building a gaming PC.  Compact cases are nice & tidy, but might have limited drive bays, and probably won’t be as easy to cool.

Styles range from conservative to gaming styles with all sorts of windows & lights.  Plain black should be fine.  Some will come with power supplies, and may be a bit cheaper as a result.  Unless you know what kind of power supply is included, though, you might be better off getting that separate.  Power supplies, believe it or not, are actually pretty important to having a reliable, quiet system.

Be sure to check out how many internal 3.5″ bays the case has.  A case with four or more internal bays gives you plenty of room for expansion, and usually has good options for cooling the drives.  I’ve found that it’s helpful to put a fan on hard drives, so look for a case that will facilitate this.

Good brands: Antec, Cooler Master, Thermaltake.

Target price point: $50-80.

Power supply. For most new system builds these days, 400W is just about entry-level.  If you start adding extra drives and gaming video cards, you can get up in the 650-750W range.  Typically, you won’t need anything bigger than that unless you’re going to do a gaming build with run dual video cards, overclocking & water cooling.

Look for an “80 Plus” or “Bronze” energy certification (or better).  “Modular” supplies let you plug in only the leads you need, so you have fewer wires in your case.  This is a nice-to-have, but not critical unless you plan to gaze lovingly at the guts of your PC.  Extra wires can be tucked out of the way so they don’t interfere with cooling.

Good brands: OCZ, Thermaltake, Corsair, Antec (except for low-end), Raidmax.

Target price point: $60-90.

Processor. I’d stick with Intel here.  I think AMD still gives you a slightly better value, but not by much, and I think Intel’s performance is a little more consistent.  This choice is pretty tightly connected with your choice of motherboard and RAM, as they’ll all need to match.  Skip Celerons (Intel’s entry-level series) and Core 2 (the last-generation mainstream processors).  A Core i3 or i5 processor will be perfect for this sort of build, though.  If you’re really concerned about processor speed, you could go for an i7, but an i5 should be fine for most development needs.

You’ll see references like “Manufacturing tech: 32nm”.  Newer tech is smaller, so 32nm is newer than 45nm.  This isn’t a big deal, but all things being equal, the smaller components will be more energy (and heat) efficient.  If you see power consumption listed (ex: 73W), a lower number will run cooler and cheaper.  For a development machine, get a quad-core processor.

Target price point: $150-250.

CPU cooler. When you buy a retail (“boxed”) Intel processor, it’ll come with an Intel heatsink and fan.  In most cases, this will be fine.  An aftermarket CPU cooler can cool better and run quieter.  I’d skip this unless you really want to shoot for a super-quiet PC or you want to overclock the CPU.

Motherboard. The CPU socket on the motherboard must match the socket of your processor (ex: Socket LGA 1156).  Not all Intel CPUs have the same socket, so be sure to check this.  Other features:

  • Size – most MB’s will be ATX or micro-ATX.  Both will fit in a mid-sized case.  The micro-ATX is needed for a compact case.  If you’ve got a mid-size case, get an ATX board — it’ll be easier to work with because the components won’t be as cramped.
  • Chipset – Intel usually has one or two mainstream chipsets (matched to the CPU), and one premium chipset, which adds the latest cutting-edge features.  Stick to the current mainstream (probably P55 / H55).
  • RAM slots / max RAM.  Look for boards with four slots.  Most boards you’ll see should support up to 16GB of RAM, which is more than you’ll need.  If you see one with slots in multiples of three (triple-channel), this is a high-end board meant for a Core i7 CPU.  Don’t confuse this with DDR2 vs. DDR3.
  • SATA ports – you’ll want one per hard drive (including an SSD) and one per optical drive.  Most newer chipsets give you six or more, which will be fine, and you’d prefer 6Gb/s SATA vs, 3Gb/s.
  • SATA RAID – this tells you that you can do software RAID on the motherboard.  Most will have 0/1/JBOD, which is fine for you (you want “1”).
  • eSATA – “external SATA”.  This is for plugging in an external hard drive.  If you don’t have USB 3.0 (below), this is another way to speed up an external hard drive.
  • PATA – old-style drive connector.  Optional – can be handy if you want to reuse an optical drive or plug in an old hard drive to copy its contents to your system.
  • PCI-x (PCI Express) slots.  Most expansion cards you’ll buy today will be PCI-x.  You’ll want a PCI-x 2.0 x16 slot for your video card.  Boards that support multiple video cards will have more than one of these slots (up to three).
  • PCI slots.  Older expansion cards will use PCI slots.  It’s nice to have one of these, just in case.
  • USB ports.  Look for somewhere around 6 USB 2.0 ports.  Some motherboards now have a couple of USB 3.0 ports – this would be nice if you can get it without paying an arm and a leg.  This will let stuff like external hard drives work a ton faster (once you’ve got a compatible external hard drive).
  • Onboard video.  Motherboards with the H55 chipset can work with compatible Core i3 and i5 processors to do graphics acceleration without a separate video card.  You probably want to go ahead and get a separate card for a development machine, but this could save a few bucks and allow an easy upgrade later.
  • Onboard audio- you’ll want this.  Any kind will do.
  • Onboard LAN – you’ll want this, too.  Look for 10/100/1000 support.  Some boards have two ports, which can be handy, especially if you’re going to run VM’s (you can bind the VM’s to one of these lan ports).

Good brands: Asus, Gigabyte.

Target price: $80-150.

RAM. You’ll want at least 4GB or more — probably at least 8GB for a development machine.  Dual-channel is fine — that’s what you’ll get on mainstream motherboards.  You’ll probably want to look for DDR3.

Good brands: I like GSkill, but Kingston, Crucial, and Patriot are also good.

Target price: $75-90 for 4GB, or $185-ish for 8GB.

Video card. You want good, basic graphics acceleration for the Windows desktop to work well.  Gaming is a whole other story — you can drop a ton of money in a hurry on a gaming system, so for the purposes of this discussion, I’ll focus on “normal” graphics needs.

Video cards have chipsets by either ATI or NVidia, and the chipsets are so much a part of the card that a card made by Evga is pretty much the same as a card by Gigabyte or another manufacturer as long as they use the same NVidia chip, for instance.  This is true to the extent that you’ll actually get drivers from ATI or NVidia rather than Evga, Gigabyte, etc.  It’s tough to call whether NVidia or ATI are better.  I think ATI is pretty hot right now, especially in the mid-market, but NVidia was the best for a number of years.  You can toss a coin on this one.

Pay attention to the connector(s) on the back.  Many now give you an HDMI connector, but you’ll want to make sure your monitor can support this.  If the card also has a DVI, you’re pretty safe.  Dual-screen support is a near must-have for a development box.  Look for at least 512MB of video RAM.  GDDR5 is faster than GDDR3, which is faster than DDR2.  You should be able to find 512MB of GDDR5 at a pretty reasonable price point.  Look for DirectX support for at least 10, but 11 would be better.

Good brands: Pretty much not applicable, per discussion above.  Focus on getting the chipset you want.

Target price: $80-150.

Storage. The best setup for a new build today is a Solid State Drive (SSD) plus two or more data drives set up as mirrored pairs (RAID 1).  The SSD gives you a fast boot time and fast loading for your applications, and the hard drives give you redundant storage for your data.  You’ll want to use Serial ATA (SATA) drives for all storage on a workstation — avoid IDE (old and slow) and SCSI (server use only).

SSD drive. This tech is actually still changing pretty rapidly.  As these drives have matured, their performance is characterized by the drive controller chipset they use (much like video cards).  Right now, the best overall controller chipset is the Sandforce chipset, so any Sandforce-powered drive will tend to perform similarly.

Good brands: Intel, Kingston, OCZ.

Target price: $150-250.

Hard drives. With the price of hard drives today, mirrored drives are almost a no-brainer.  Years ago, RAID was only available via expensive dedicated peripheral boards, but now, just about every motherboard you can buy has SATA RAID built into the motherboard.  I’ve been running mirrored drives on my workstation for a few years now, and this setup has saved me tons of time.  Recovering from a drive failure is even easier than restoring from a backup; just replace the faulty drive and let the RAID controller rebuild onto the new drive while you keep working.  Note that RAID isn’t a replacement for a backup — it’s another layer of protection, but having said that, I’m a huge fan.
If you’re going to run RAID-1 (mirroring), it’s best if you start with two identical drives.  Note that “identical” isn’t a requirement if you have to replace a drive, but it’s best if you’re setting up a new mirror.  When picking drives, you’re looking for capacity, spindle speed, and cache size.   Right now, the sweet spot for drives is moving from 1TB to 2TB.  There are 3TB drives available, but they’re still pretty expensive.  Spindle speeds for SATA drives will generally be either 5400 RPM or 7200 RPM.  You can find 10,000 RPM drives, but they’re not worth the price, since you’re using an SSD for the stuff you really want to load quickly.  In fact, using a pair of larger, slower 5400 RPM drives for your data will be quieter, cooler, and more efficient than 7200 RPM drives, and the speed difference shouldn’t impact you a lot if your apps are all run from an SSD.  Caches are used to speed access on these drives; larger caches are generally faster than smaller caches.

When buying hard drives, it’s worth looking at the warranty.  Most will be three years, but if you can, find one with a 5yr warranty.

Good brands:  Samsung has actually been getting really good reviews for the last couple years.  Hitachi, Seagate, and Western Digital are also about the same.  I know I swore off WD a few years ago, but I’ve seen as many failures in Seagate as I have in WD.  All hard drives will fail — that’s why you’re going to mirror yours and get one that’s got a good warranty.

Target price:  $60 for 1TB, $90 for 2TB.

NAS / Drive Arrays. If you’ve got big storage needs, you’re going to need to build something more capacious than a single mirrored drive can provide, and at some point, you’re going to end up looking at Network Attached Storage (NAS) and/or drive arrays.  You can purchase something like this (ex: Drobo) or build your own.  Up until a couple months ago, I would have put a Windows Home Server box on the short list for your NAS needs, but given the recent hubub over their forthcoming VAIL release, I’d be reluctant to jump on that bandwagon right now.  Although focused mainly on WHS builds, there’s a great forum on that’s got information on all sorts of DIY storage server builds if you’re looking for ideas and/or inspiration.

Optical drive. You’ll want some sort of DVD reader / writer, and for a few bucks more, you can get Blu-ray, too.  This is a good place to save a couple of bucks if you don’t need Blu-ray.

Good brands: Lite-On, Asus, Samsung, LG.

Target price: $20 for a DVD writer up to $100 or more for a Blu-ray burner.

Floppy drive. Skip it.

Extra fan(s). I’d recommend  installing an extra fan to cool your hard drives.  I’ve had better drive reliability on my system since I put a fan on them.

Final note:  Since the shelf life on this sort of guide is pretty limited, you’ll probably find that specific recommendations for brands, chipsets, prices, and so on will go out of date pretty quickly, but I hope that the general concepts here will apply for a while yet.  Good luck!

Choosing an open-source platform

As an architect, I’m sometimes asked to evaluate and/or choose platforms for software, web sites, and so on.  As you might imagine, choosing a platform can be an enterprise-critical decision, and one of the big forks in this road is whether to consider open-source software.

I’m not going to touch that debate here – this tends to be a pretty religious point with a lot of people, and I’m not sure I can add too much value to a religious debate.  Instead, I’m going to assume that you’re at least open to open-source software and you’d like to evaluate some alternative open-source alternatives.

The factors you’re evaluating in an open source platform really aren’t too different from the factors for a closed-source platform:

  • Community size and stability
  • Ease-of-use
  • Ability to extend / grow
  • Indirect costs
Logo Open Source Initiative
Image via Wikipedia

Without a doubt, the most important factor of all for open-source platforms is the size and vitality of the community, which ends up being pretty vital for the long-term viability of the project.  While it’s certainly true that you’ve always got access to source code if you need it, you really don’t want to count on that if you can avoid it.  A large, active community implies a bunch of good things for the platform:

  • Lots of people have already evaluated and bought into this platform.  No matter what you experience on this platform, chances are, you’ll have company.
  • Lots of contributors means that the platform is more likely to keep growing.
  • An active platform will get important update (like security patches) more quickly.
  • A large community means a large market, which means lots of people offering services.  If you need something, and you can’t find it for free, there’s a good chance you can hire someone to help you.
  • If you’re looking at a platform that supports some sort of extensions, plugins, themes, etc., a large community usually inspires more people to contribute to these pools, which means more choices for you.
  • With any luck, you might even be able to find user groups for your platform of choice.  These groups can help you with free advice, as well as put you in contact with other people who can help answer your questions.

One last thought:  consider where the platform gets its funding.  In some rare cases, open source projects are funded entirely by donation, but when organizations reach a certain size, there really has to be a plan to pay the bills.  Watch for “freemium” models, where certain functionality might be available in a “community edition” of the platform, but the latest and greatest stuff is available only to paying customers.  This certainly isn’t a deal-breaker, but understand that you’re going to have to wait in line for new stuff, or deal with an upgrade to a paid version at some later point.

Enhanced by Zemanta

Matthew Groves: OR/M Comparisons

Matthew Groves has been working on a series of articles comparing some OR/M frameworks.  So far, he’s done some posts on Entity Framework and Fluent NHibernate, but I believe he’s planning on hitting a couple more, too.

If you’re a .Net developer, you know what a “lively” subject this always is.  Data access consumes so much time and effort in most applications that it’s worth educating yourself on the options so you can make informed decisions.  I’d also recommend checking out a couple of these frameworks yourself, as merely reading about these frameworks isn’t quite the same as using them on a project.

Here’s a list of Matthew’s posts so far:

Ray Ozzie takes us back to Windows 1.0

This one is definitely worth a read:

Early Windows logo (1985-1992)
Image via Wikipedia

I’m back.

Be sure to check out the Windows 1.0 press kit that he scanned in.  I can’t believe it’s been 25 years, and Microsoft has  managed to add — what — Direct-X and muti-monitor support, I think.  I love how “Paint” is a big selling point, and CD technology is broken down like it’s a flux capacitor or something.

Ahh, simpler times.