Posts

Reflections on Style for Shrink Wrap Web Sites

My main bread and butter is commercial software designed to be installed on customer sites (with the host of environmental variations that may occur). One aspect is build websites that may be easily branded by the customers with the use of CSS.   One of the first steps  is moving CSS to resource files so pages may be style in a culturally aware manner.  Sentence length can be doubled or halved in different languages so layouts may need to change.   Once that step is done – then there’s the issue of how to factor the page for branding. Often folks go for a cheap solution – allow only a few things to be branded; I prefer to support comprehensive branding.   Often the page delivered by a developer may look like this: 1: < div style ="display: table-row block; border-bottom: solid thin red;" > 2: < div style ="display: table-cell; whitespace: nowrap" > 3: < font: Aria...

Working Around The Yield Restriction In Try/Catch

The code below is a workaround for the restriction that you can’t yield from inside a try/catch statement that contains a catch. Note: you can yield from inside a try/catch statement that only has a finally clause (no catch). What I need to do was: Call Microsoft SQL Server and return a result set. Support IEnumerable so I could take advantage of SQL Servers forward only cursors and Linq. Catch any exceptions of type SQLException and clear the connection pool. Here is the code I would like to have compile (THIS DOES NOT WORK): static public IEnumerable<DbDataRecord> Execute( String connectionString, String statement) { using (SqlConnection sqlConnection = new SqlConnection(connectionString)) { try { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand(statement, sqlConnection); using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader()) ...

A mystery: AnteMeridiem and PostMeridiem

I was working with resource files (RESX) and been getting these obtuse messages.   Warning    4    The resource name 'AnteMeridiem ' is not a valid identifier.    \ContentPage.be.Resx Warning    4    The resource name 'PostMeridiem ' is not a valid identifier.    \ContentPage.be.Resx   Both are proper latin (for AM and PM) – and it’s a mystery why they are deemed to be invalid. To add more mystery to it – it only objects is some cultureinfo (languages). Is this an easter egg????

A new code review item: Initializers in Alphabetical Order

I’ve been using MZTools Visual Studio add-in for a few years. The original reason I acquired it was because of it’s sorting of code ability: Sorting a collection of lines Sorting the elements in a class by type and then alphabetical. I had gotten frustrated by manual re-organizing  of code and fighting the random dropping of code where it fell into the file. I love the use of initializers – it keeps code cleaner and easier to read (visually chunking), but with rapid evolution of code, we can often end up with something like: 1: deposit.CreditCard.AccountHolder = new AccountHolderDetail() 2: { 3: AddressLine1 = GetString(CreditCardAddressLine1), 4: AddressLine2 = GetString(CreditCardAddressLine2), 5: Company = GetString(CreditCardCompany), 6: FirstName = GetString(CreditCardFirstName), 7: LastName = GetString(CreditCardLastName), ...

The New SQL Azure DBA

Image
Compared to SQL Server here is the list of things that you can be completely ignorant about and still be a SQL Azure DBA: Hard Drives : You don’t have to purchase hard drives, hot swap them, care about hard drive speed, the number of drives your server will hold , the speed of SANs or motherboard bus, fiber connection, hard drive size . No more SATA vs. SCSI debate. Don’t care about latest solid state drive news . Everything you know about Hard Drives and SQL Server – you don’t need it. RAID : How to Implement RAID, choose a RAID type , divide physical drives on a RAID – don’t care. RAID is for hornets now. Backup and Restore: You need to know nothing about Back up SQL Server data files , transaction logs, or how the database model effects your backup. You don’t need a backup plan/strategy – nor answer questions the about risk factor for tsunami in Idaho. No tapes, tape swapping, or tape mailing to three locations including a hollowed-out mountain in the Ozarks. R...

USB hard drives going the way of 8” and 5.25” floppies….

Image
I am a convert to eSATA drives, external SATA docking bays where you can just drop in a raw SATA drive.  On my new machines, the port is already there. On my older machines with SATA on the motherboard, it’s just a matter of buying something like Vantec NexStar NST-D100SU 2.5-Inch/3.5-Inch SATA to USB 2.0 and eSATA Hard Drive Dock which comes with a card tab with eSata and the cable to connect it to the motherboard sata connectors. For older machines, you need to buy an eSATA card, or Sata card with eSata Connector. There are also eSata cards for laptops (but not for Netbooks, since the only ports seem to be USB ports on most netbooks.  You want to make sure that the eSATA is SATA 2… why?  Bus speed… BUS Maximum speed in MB/Sec USB 1 1.5 USB 2 60 SATA 1 150 SATA 2 300 SCSI-320 320   So you can see wh...

Mirror, Mirror on the drive, who is the smartest of them all?

Image
At today’s Bellingham DotNet meeting we got into a discussion of software mirroring (built into Server 2003, 2008, Vista and Windows 7).  The consensus was that every desktop system should have all of the drives mirrored (by OS mirroring or hardware mirroring). An older machine may have 3 smaller SATA/IDE drives and the cost to mirror is $100 or less. Just buy a big drive (1-2TB) and drop it into the machine.   You can then mirror all of the existing drives to this one big drive (you do not need 1 physical drive to 1 physical drive), you can use a dynamic drive to mirror each drive on one drive. The drives do not have to be the same – you can mirror from an IDE to a SATA drive.   The second item discussed was buying a spare laptop/netbook hard drive, drop it into a USB holder and periodically at night mirror the internal drive to the USB external drive. If the internal hard drive fails, it’s just minutes to put the former-USB drive into the machine and you are up...