Rural Living for Geeks, part 0: Moving to the Country

My wife Sarah and I have been dreaming of buying some rural land and building a house to escape suburbia. We recently placed an offer on a parcel of land not too far from our current home in Indiana, and it was accepted!

We are of course very excited about this, but it’s also a very scary prospect. There are so many unknowns, so much research to be done, and so many potential pitfalls that it has our heads spinning. Each question we answer seems to turn up two new questions that we never even considered. The journey has barely begun and we’ve already learned so much.

So my plan is to document everything we’ve gone through so far and everything we encounter as we move forward, so that hopefully this experience can help others who are in the same boat.

Since I’m a geek and hacker at heart, my posts will also focus on topics specific to technology considerations that come into play. I’m willing to give up some amenities of city life to follow my dream, but that doesn’t mean I can live without fast internet!

Here’s a bullet-point list of some of the things you’ll need to consider when buying rural property, including some things you probably take for granted if you live in a neighborhood. In the coming days I’ll create separate posts for each of these items.

  • Soil test / suitability for septic system
  • Electric
  • Water
  • Internet
  • Trash collection
  • Property assessment
  • Homeowner’s insurance / builder’s risk insurance
  • Postal address
Posted in Rural Living for Geeks

Using ExcelDataReader with AutoMapper to create lists of strongly-typed data

I recently needed to import some data from an Excel spreadsheet in my C# app and wanted to avoid the Office interop assemblies and OleDbReaders if at all possible. I found the excellent ExcelDataReader, which is a pure-.NET class for reading .xls and .xlsx files.

The problem is that this library returns DataSets representing the Excel files, with one DataTable per sheet. This is an understandable approach since the data being imported can be so varied, but I wanted to use lists of strongly-typed objects instead. (LinqToExcel seems to be designed around doing this all as part of one library, but its use of OleDbReader and its hard dependency on log4net to log a single exception in its Dispose method turned me off).

I started going down the road of “rolling my own” methods to create objects from the DataSets, but realized there had to be a better way. After a bit more digging around, I found AutoMapper, which is designed to take the gruntwork out of all type of object-to-object conversions. It can operate on IDataReaders, which are a quick DataTable.CreateDataReader() away. Perfect!

Looking a bit at the examples though, I found that AutoMapper is built around static methods, in which Mapper.CreateMap configures the mapping between two objects, and Mapper.Map performs the mapping conversion. That wasn’t going to work too well for me, because the types of data I needed could vary greatly at runtime, and I’d even need to pull multiple objects of the same type from each row (the data being imported had been flattened somewhat).

StackOverflow helped me solve that problem — the static methods are just wrappers around singletons internally, but you can create your own configuration and MappingEngine objects instead.

Finally, all the pieces were falling into place. I decided to write a quick helper class to build the necessary MappingEngine objects easily.

Because I wanted to map properties at runtime, I was interested in a few different Map methods, which can take a lambda expression representing the property to set, along with either a field name, callback, or both. If a field name is given, the property is set from that field; if a callback is given, it will receive a ExcelMapReaderState object and should return the desired value. (The state object will contain the “current” value if a field name was also given).

Because ExcelDataReader maps all numeric types to double, I wanted the ability to convert these back to int, long or decimal if desired. I also wanted the ability to map a field to an enum, in which case it will call TryParse with the field value (with whitespace removed).

It would be rather straightforward to use attributes instead to perform the mapping, but that isn’t something I really needed (and I’m guessing AutoMapper is already better at that type of thing, but I’m still unfamiliar with its operation).

Find the ExcelDataMapper code here on Gist.

Example usage:

    /// <summary>
    /// This is the class we want to map Excel data to. Value types should be set nullable, since empty
    /// Excel cells will be set as null.
    /// </summary>
    public class PurchaseItem
    {
        public string ItemName { get; set; }
        public AccountTypeEnum? AccountType { get; set; }
        public decimal? Price { get; set; }
        public DateTime? ImportDate { get; set; }
    }

    public void ContrivedExample()
    {
        var mapper = new ExcelRowMapper<PurchaseItem>();
        // get value from Excel "Item" field
        mapper.Map(item => item.ItemName, "Item");

        // parse this field to get enum value
        mapper.Map(item => item.AccountType, "Account Type");

        // get price from "Price" field but post-process it too
        mapper.Map(item => item.Price, "Price", state => (decimal)state.CurrentValue < 0 ? 0 : state.CurrentValue);

        // or ignore the incoming data entirely
        mapper.Map(item => item.ImportDate, state => DateTime.Today);
    }
Posted in General

Don’t sign that cell phone contract

Cell phone sales in the USA have typically revolved around hooking the customer with low-cost (or free) subsidized phones in return for signing an expensive, long-term (usually two-year) contract for service.

This is bad for customers in many ways.

  • You can’t shop around for the best plan or switch plans when you want to.
  • If you realize your carrier’s coverage or customer service doesn’t suit you, you’re stuck.
  • The subsidized phones are often locked to that carrier and getting them unlocked is difficult or impossible.
  • To get the most value, you must upgrade your phone every 2 years. Otherwise you’re paying a built-in premium for a subsidized phone you’re not getting.
  • Even worse, those of us who want to upgrade more often get doubly screwed because we must pay full price if we’re outside the “upgrade window”.

For many years, this was the norm. But in the past couple years, a lot more options have opened up.

Buy an unlocked phone outright

Most smartphones these days cost upwards of $600. The cheapest iPhone 5s currently costs $650. If you think that new iPhone on display at your local carrier really only costs $199, think again… where do you think that extra $450 comes from? Jacked up monthly fees, of course.

But lately, we’ve seen a trend of high-quality, unlocked smartphones available for much less. Since these phones are unlocked, you can take them to any supported carrier and get a much cheaper plan.

  • My current phone, the Google Nexus 5, currently costs $350 brand new and unlocked. It’s one of the best all-around phones out there and always gets the latest Android updates. The Nexus line is Google’s flagship Android brand.
  • The Motorola Moto E, Moto G, and Moto X start at $130, $180, and $350 respectively. These are all great, highly capable Android smartphones at various entry points which have great reviews. The $220 Moto G with 4G LTE is an incredible value for the money.
  • The ZTE Open Firefox OS phone is an incredible $80 unlocked. It would be a great choice for first-time smartphone users who don’t need as many apps as are available on iPhone or Android.
  • The OnePlus One, running a customized version of Android named CyanogenMod which is known for its extra features and privacy options, will start at $300.

Get a cheaper cell phone plan

Once you have your own, unlocked, unsubsidized phone, you’re no longer at the mercy of any one carrier. T-Mobile has led the charge lately at targeting “bring your own device” customers with extremely competitive no-contract plans such as their Simple Starter 4G LTE plan for $40. AT&T likewise has numerous Mobile Share Value plans in the same price range, again with no contract.

T-Mobile will even buy you out of your existing cell phone plan if you switch to them and buy a new phone. Because they’ve done away with contracts completely, their subsidized phones work a bit differently: you can spread the price of your phone over one or more years, but that price is clearly indicated on your bill, and once it’s paid off your bill will drop accordingly.

Rethinking phone+service plans

Of course, there’s something to be said from getting your phone and service contract from the same company and some people still prefer this option. But you now have more options than ever before, including some truly new and innovative offerings that use nearly-ubiquitous WiFi connections while you’re at home or at the office for calls, text and data, then fall back to cell phone usage otherwise.

Republic Wireless and FreedomPop are two such examples. You’ll need to buy a phone from them up front but after their monthly rates are very attractive or even free.

Don’t sign that contract!

In short, there are so many options for going contract-free that it’s really difficult to justify signing or extending a contract for any one carrier. Going contract-free is even more beneficial as shared-device and family plans become more popular, because you don’t need to worry about whether everyone’s contract is up at the same time.

The bigger carriers have fought the move to contract-free plans because they enjoy not having to work too hard to keep your business. As these contract-free plans grow in popularity, they’ll have no choice but to follow suit.

Posted in General

Reboot in progress…

Ohai!

After being dormant for several years I’ve decided to reboot my blog. I’ve archived all the old posts, though they’re still accessible via URL.

More soon…

Posted in General

 

Search The Social Media Firehose or U.S. Census Records online

Posts Calendar

December 2014
M T W T F S S
« Oct    
1234567
891011121314
15161718192021
22232425262728
293031