Stories about Software


What is Your Next Action?

I just got back from a long weekend vacation and am still getting settled and back into the swing of things, so this is going to be another relatively short post.  I’ll soon return to your regularly scheduled extended rants and code-cast posts, but I need a little slack in the meantime.

For the last six months or so, I’ve been making a 5 hour drive twice a week.  This has provided me with a lot of opportunities to listen to books through Audible and Overdrive, and I’ve been listening to a lot of non-fiction stuff that runs the gamut from tech to sociology to science.  Recently, I took a suggestion from a comment in a previous post and read/listened to “Getting Things Done.”

Read More


The Consultant’s Life: Weird Stuff You Suddenly Need To Think About

I’m going to start off with a quote, though I’ve been warned by someone who knows more about writing than I do that this may be a cheesy thing to do. Oh well, I’m living dangerously these days.

“Gentlemen,” he said
“I don’t need your organization, I’ve shined your shoes
I’ve moved your mountains and marked your cards
But Eden is burning; either brace yourself for elimination
Or else your hearts must have the courage for the Changing of the Guards”

— Bob Dylan (Changing of the Guards)

I’ve made little secret of my opinion that the software developer (and knowledge worker in general) is trending toward a life of increased autonomy and agency.


Anyway, I’ve been on my own for a few weeks now, so I thought I’d share some experiences that I’ve had so far. And, I’m not talking about anything especially profound here such as that I’ve reconsidered my life and found nirvana in controlling my own destiny, or whatever. I’m talking about the kind of things that, should you undertake this particular choice in career, are going to prompt you to say, “holy crap, I have to do what!?” Or maybe that’s just me.

You Need a Company

This is cheating a bit, because I did this some years ago, but if you’re contemplating free agency, this is important. Personally, I’ve formed a limited liability corporation (LLC). There are other corporate structures that you can choose from that differ in various legal and tax-oriented ways, but I won’t really go into those. Instead, I’ll discuss my motivations that I think are probably paramount for you to consider.

(I will qualify what I’m about to say with the standard “I am not a lawyer” caveat, so keep in mind that you’re hearing my understanding and recollection of what lawyers and others have told me. These are my motivations based on my understanding of the world.)

My LLC got me two important things: limited liability and a business entity. By default, if you start moonlighting through something like E-Lance, you’re operating as a “Sole Proprietorship.” In a Sole Proprietorship you are Louis XIV, in that you ARE the business. This makes life easy from an income tax perspective because there’s only you, but it makes things a real bummer from a getting sued perspective, since, if you write software that takes down your client’s business for a week, you can be personally sued for damages. If you don’t have enough money in the bank to cover the tab, the client can come after your car and your house (though you should certainly write verbiage into your contract that limits your liability, however you do business). If you create an LLC, on the other hand, you’re creating a separate entity — a property that you own and that can conduct business. Now, you client can sue the LLC for all that it is worth, but the LLC doesn’t own your car or your house, so those are off limits.

The motivation of having owning a business entity (second thing I listed) extends beyond just the limited liability motivation, however. A huge consideration here is that the business entity makes it a lot easier to classify things as business expenses for tax purposes. Having always done my own taxes and operated both in Sole Proprietorship and LLC capacities, my experience is that you can claim a substantially larger amount of deductions when you have a business entity. It also makes keeping things straight for taxes and accounting easier. My LLC has checking, savings, and credit card accounts, so for bookkeeping purposes, anything that DaedTech needs (supplies, equipment, etc) goes through that channel and anything non-business related is with my normal credit cards and bank accounts. On top of that, the business entity lends legitimacy in your dealings with others. There’s a big difference between telling your clients to mail you a check made out to Joe Smith and invoicing them on corporate letterhead instructing them to make checks payable to Acme Inc, for instance.

Creating an LLC isn’t particularly difficult. It’ll vary some by state in terms of the procedure, but you essentially fill out a form and send it into the appropriate government agency in your state (or, potentially another state — a lot of places incorporate in Delaware because of its favorable tax laws or something, but I don’t know what’s required to be able to do this). There will be a fee to incorporate and then an annual maintenance fee and these also vary by state. When you do this, you also notify the federal government of what you’re doing and you are issued an EIN (Employer Identification Number), which is basically your LLC’s social security number, for all intents and purposes. You’ll need this for tax purposes and for conducting certain kinds of business with other entities.

Now onto the things I’ve stumbled across in the last few weeks…

Tracking Your Time

When moonlighting, it was generally easy to keep track of billable hours, since I’d work 9-5 and then come home and do an hour or two of freelance work. I’d have a spreadsheet or something where I’d log the hours as I went. But boy did I discover how wildly impractical that is when doing this full time.

In the first place, I’m now doing billable work for several different entities, so the spreadsheet would need to be more complicated. But even more importantly, I don’t want to just look back on a week and say, “oh, that’s nice, I billed 30 hours.” I want to be able to audit how much billable work versus total work I did (with the idea of maximizing this ratio). There’s a big difference between billing 30 hours and working 30 hours and billing 30 hours while working 60 (the other 30 going to looking for more business, doing clerical work, taking exploratory meetings, side projects, blog posts, etc). In fact there’s literally a difference of 100% of your pay. If Jane bills $100 per hour, bills 30 hours and works 60 total, she’s really only making $50 per hour and not $100.

Other considerations abound as well, such as searches, filtering, different billing rates, and annotations about the work. I saw immediately that a spreadsheet was going to get way out of control very quickly. A younger, wetter-behind-the-ears Erik would have immediately started building a homegrown database app for this, but, bearing in mind how that would absolutely sink my billable ratio, I did some research and settled on Grindstone for logging hours. It has a lot of nice features to it and it also had the advantage that I’d used it previously. It gives me enough granularity that I can easily look back at the tasks I’ve logged all week or month and any notes I’ve appended to them, and generate invoices for individual customers as appropriate.

Working Too Much or Thrashing

This is kind of a weird one, but it’ll probably creep up on you. When I started on the freelance path my concern was that I’d depart from my schedule and start staying up ’til all hours or sleeping until 9 every day or something. What I didn’t anticipate was what actually happened. I had no problem getting up, keeping focused, sticking to a routine, but I did find that I was logging 9 to 6 hours in Grindstone and then also logging 11 PM to 1 AM hours after I was the only one awake in the house. And also Saturday and Sunday hours.

As your own person, responsible for your own income, there’s a much more intense feeling that every hour you’re not working is an hour that you’re leaving income on the table. Every would-be non-technical startup partner with an idea for an app that you don’t meet for lunch is you missing out. Every recruiter call is an opportunity for you to turn the tables and look for contract work. You can’t pass on anything.

I’ve had to fight tooth and nail to give myself the freedom to pass on leads and not pursue everything. Weird as it sounds, my blog post announcing free agency was met with more recruiters calling me about CTO/Dev Manager type positions by far than it was with people interested in my consulting. I started doing some interviews because I’m open to all sorts of possibilities, but I’ve now had to ramp that back and pass on some offers because between scheduling all of that and also earning my keep, I was logging 80+ hours per week in Grindstone. And, while I’m not averse to hard work, I had to look at the fact that doing job interviews and lots of exploratory meetings are unlikely to be revenue generating for me — I have to focus on the most promising/profitable things going on.

That’s been unexpectedly hard, since I’m very enthusiastic and game for things. Anyone approaching me with a project or an opportunity makes me want to say, “yeah, totally, let’s do that,” but I’m learning there’s no way I can say that to everyone or even the majority of those to whom I talk.

Weird Tax Things (Quarterly Filing and Mileage)

Anything related to taxes is always an odd combination of scary and extremely boring, and that led me to procrastinate a bit when it came to “what do I do with all of this gross income I’m getting with no taxes withheld?” When you work for a company, you fill out a W-4 form and your company then sets up your paychecks such that the IRS takes its pound of flesh before the money ever hits your bank account. At tax time, you then get a “refund,” which is really just them saying, “turns out we held on to too much of your money and, oops, look at that, we earned interest on it, but here ya go.” In a case where your employer didn’t withhold enough from your paycheck, on the other hand, you have to cut the IRS a check for what you owe, come tax time.

But if all your money is coming in via checks for services paid, there are no taxes being withheld at all. And that means, come tax time, you’re going to have to write the IRS a massive check for your entire annual tax burden. However, the IRS, while happy to hold onto and earn interest on your money, gets extremely cranky if you hold onto and earn interest on theirs. So, if you’re a free agent, the normal course of action is that you have to send them quarterly checks in order not to face penalties. (If you’re liquid enough and depending on how you structure your business for tax purposes, there are ways around this, but I’m going to focus on the simplest sort of case — me with my LLC).

I spoke with an accountant, and I have yet to actually do this, but you basically fill out a form Schedule C that calculates the business’s profits and losses and then, based on that, you compute/estimate the tax you owe for the quarter and send them a check for that amount. Then, at tax time each year, like a normal, workaday person, you’ll probably either get a small refund or owe a small amount of money, rather than the entire 30% or whatever of your salary that would go to Fed, SS, Medicare and State taxes.

So be aware that you now have to be an active participant in the tax game, rather than just passively waiting for your W2s each year and firing up Turbo Tax or dropping things off at H&R Block.

Forms, Forms, Forms

I earlier mentioned sending invoices to clients. To do this, you need an invoice form. I also mentioned drawing up contracts for clients. To do this, you need a contract form. You’re going to need a lot of forms, so if you’re contemplating a move to freelancing, I’d get these ready in advance.

I’d say you’ll want the following forms in your arsenal: invoice, contract, statement of work, master services agreement. Invoices are obvious — this is simply the way you enumerate the services rendered and request payment. Contract is an agreement signed by both parties for work, often on an ongoing basis. I’d use this for retainer arrangements or “I’ll work 15 hours per week for you” arrangements. Statement of work is a more project oriented document — “I’m going to build you a website and you’re going to pay me for it.” Master Services agreement is an umbrella agreement that establishes general terms for you to do business with a company (e.g. “we won’t steal each others’ intellectual property, we won’t poach each others’ employees, etc”). Usually you would exchange this with a client for the duration of your relationship and then have individual contracts or SOWs underneath its umbrella. This one is probably not quite as critical for fledgling consultancies/free agencies, but may be worth having around.

Where do you get these? Well, if you know or have a lawyer, the lawyer can probably draft them or perhaps just supply you with a boilerplate one. A lawyer will also be happy to review any specifics and mark them up. But if you don’t want to incur that expense, search your inbox for emails on which you were CCed at your company that may have included these. For instance, if you were CCed on some email where your department reached an agreement with Expensive Consultants Inc to do some web design, grab that and use it as a starting point for creating your own. If they’ve been in business a while, they’re probably doing something right.

Keeping the Books

When you’re on you own, running your company finances isn’t quite the same as whatever you do for your personal finances. You want bookkeeping software. I’m fortunate in that I’ve been using Quicken since my finances were no more complex than a checking account and the occasional paycheck, and so the move to Quicken for Home and Small Business was easy.

Quicken (or Quick Books or whatever you use) will allow you to record invoices that you’ve issued and then to keep track of whether payment has been received. This is important because you’ll send out invoices that require payment within 30 days, and then it’s up to you to keep track of whether clients have paid or not. This is not like W2 employment. Companies will straight up forget to pay you. Or not bother. Because, remember, you’re not dealing with an individual and you’re not dealing with a payroll system — you’re dealing with Accounts Payable departments and people who have jobs of which only a tiny portion is sending out the dozens or hundreds of checks per day that a company has to send out. Stuff falls through the cracks, and you need to be checking back on the status of payments that you’re due. If you have only one client or if you’re missing huge checks, this will be obvious, but if you remoted in and helped a former client for an hour or 2 in June, it’s pretty easy to forget that they owe you $150, unless you have software that reminds you.

Software like this also helps you keep track of things you can deduct but wouldn’t think of. Sure, if you bought a computer or a bunch of printer ink, you’ll file that as “business expense” for tax purposes when recording expenses. But what about the mileage you drove getting to a meeting? Record that! It’s tax deductible at about 50 cents per mile. Quicken lets you keep track of this and other similar non-expsense-per-se-expenses.

That’s All for Now

This has become a pretty long post, so I’m going to wrap up here and save other things that I learn for another post, later. And, while I’m speaking somewhat authoritatively on this stuff, it’s stuff I am truly learning the nuance of as I go. A lot of it falls under the purview of “stuff that I’d have known if I’d thought about, but was kind of surprised by its immediacy.” Other things were news to me. And, since this is a learning experience, please feel free to chime in on the comments section with your experiences, tips, or corrections of anything you feel I’ve gotten wrong.

Cheers, and happy free agency to anyone reading in advance of taking the plunge!


How to Prepare for Windows 8.1 Update Fail

I was going to publish the next Chess TDD post today, but I got caught up in the worst kind of yak-shaving where I was basically just trying to get my computer functional again. So, I didn’t get the audio recorded, and I have something different to talk about, to-boot.

Last night, I stayed up late programming and left my computer on. This morning, I got up and it had powered off for some reason or another. When I turned it on, it told me that it was installing updates. Whatever, new OS (for me), same difference on the updates. Except, this time it got to 99% installed, stayed there for a really long time, and then eventually came back with the message:

We couldn’t complete the updates
Undoing changes
Don’t turn off your computer

I let this go for around 45 minutes before figuring there must be something wrong. I did a hard reset, and it booted right back into that screen. Tried again, same result. Let it go for another half hour, nothing. At this point, I tried to boot into safe mode, but there are apparently six different ways to do it and three of them don’t work because Windows 8 is too fast or something. It appeared as though the only way to boot into safe mode was to launch the OS normally and enable it. Sigh.

I figured I could boot from some kind of media, but none shipped with the PC. I figured I could make one, but all of the guides about making Windows 8 recovery CDs/USB Drives all seemed to start with “boot into Windows 8 and…” Double sigh. So, pretty much everything you might do to recover the machine in light of an unexpected problem involves you having prepared ahead of time for such a problem. And, while it’s certainly good practice to do so, it hadn’t occurred to me that the source of instability would be an OS update. And, apparently, it’s a common problem with this update that has yet to be fully resolved for everyone.

To solve my problem, I eventually managed to mash F8 at just the right time, get the advanced startup menu, and find a restore point that had been set yesterday morning. After wasting a couple of hours of my life, I’m going to take steps to prevent this kind of nonsense and minimize headaches. If you’re running Windows 8.1, I’d suggest that you follow some of these relatively quick steps. They’ll take you little time and, since these updates seem rather issue-prone, they might save you a huge headache later.

So here’s what I’m doing.

Turn off automatic updates

The last thing I want is to go to bed tonight and have a repeat of this morning. If updates are going to be a source of problems, I want to be opting into them instead of having them pushed. To do that, go to the start screen and type “Windows Update,” which will return the Windows Update menu. Go to “Change Settings” and you can choose a less aggressive setting. I chose “check for updates but let me choose whether to download and install them.”


YMMV on how you want to handle this, but it might be a good idea if you don’t want some update bombing out and costing you a couple of hours.

Make Sure Safe Mode is Accessible

I lucked out in that I was able to get into safe mode, but having that be a crapshoot is silly (and, in my opinion, should absolutely not be the default setting). Here’s a guide for how to do this. You basically have to run a command line utility to make it happen. It might marginally slow down your boot. Whatever, this is a no-brainer, and shaving a few seconds off of boot time at the risk of not being able to launch the OS in safe mode is completely not worth it.

Create a recovery USB Drive

Here are instructions for doing this. I haven’t actually done this one yet, but I’ve ordered a USB drive for the purpose and will do it when it gets here. It never hurts to have options and since my computer didn’t ship with an OS disk, I think this is something I should have.

Here is an alternative method if you’d prefer to use a DVD.

Create a custom refresh image

Windows 8 has a refresh feature that will basically reinstall the OS while leaving your files and Metro apps alone. However, it will blow away your installed applications, which is a bummer. You can create your own refresh image that will include the things you’ve installed, though. Instructions for that are here. I believe you’ll still have to reconfigure your applications when you launch them, but it’s better than nothing.

Create a system restore point before updates

It probably never hurts to create system restore points to recover to (and you can actually use them if you do the F8 enabling). But, given the trouble with system updates, it might make sense to create them immediately prior to trying an update. Here’s a “dummy’s guide” if you’re so inclined, but if you just type “restore point” at the start screen, you can probably figure it out from there.

Remove any extraneous things plugged in

After I had started writing this post, I continued to try to update because I needed to upgrade to Windows 8.1 Pro and because I wanted the problem solved. In the end, I wound up doing a complete “refresh” and then unplugging various things from the USB ports, including a Fitbit and my USB web cam. After these steps were taken together, I was finally able to get through the offending update. I can’t say for sure, but I suspect the latter cause, particularly because at one point I’d found a blurb about someone having the same experience.

So as a good troubleshooting step, you might consider ripping out everything not strictly necessary (and perhaps disabling various applications that startup at boot and anything else not necessary).

Good Luck and Happy Computing

An ounce of prevention is worth a pound of cure… I learned the hard way, today. Hopefully this saves you some headaches, particularly if Microsoft belches out a problematic but ‘mandatory’ system update. I encourage you to do some of these things (at the very least, make sure you can run the OS in safe mode when it’s not critical) now before you’re panicked or furious.


Failed to Open storage.ide

I don’t make a lot of “lessons learned” posts anymore, but here’s hoping this quick post saves some of you out there a headache when you get this message and google it.

A few weeks back, I had an issue with the Git source code provider in Visual Studio and tweeted about it here (though in my haste/ire, I incorrectly described it as “tfs-git”):

It was a weird problem, because I’d been hitting that code base from 3 machines, each with the same version of Visual Studio installed. One of them never had any problems, and the other two always bombed out with this message, forcing me to go into the command line and committing from there, which worked. I have no idea what’s different among these machines and why it would work on one but not the others. Weird.

A long way down in the reply chain, Buck Hodges provided the answer that worked:

Sure enough, I went in and added this to my .ignore file, and it did the trick. This never would have occurred to me, however, as a possible solution. That whole directory and all of the files in it were created by the IDE-Source control apparatus anyway. It’s not like I went in there and created those files, and it’s not like I was using them for anything. I actually would have assumed they would already be in that auto-generated .ignore file. I mean, this is sort of like the IDE saying to me, “I can’t check in your code because this file I created without your knowledge is being used… by me.” (When troubleshooting, I investigated which process was using the file, and the only one was Visual Studio).

Nevertheless, I was grateful for the fast response and the fix that worked, so I won’t look a gift horse in the mouth.


Basic Protections on Your Mobile Devices: A Stitch in Time

Today’s post is going to be one where I’ll regale you with a rather ridiculous tale of woe, relief, and redemption. And, it’s my hope that you can learn from my buffoonery just as I did, but without the part where you’re a buffoon.

It’s a story that starts out simply enough. I have a phone and a tablet, both of which are Android devices. With the last Android phone I had, I set up a pattern verification for login, but about a year ago, I got a new phone and never bothered. I also got a new tablet and never bothered with it, either. So, two devices, no security to prevent access to anyone who happens to find them, and no plan of action in case I lose them. My security is just me not losing them or having them stolen, which has actually historically gone pretty well. So, it always will, right? But wait, the plot dumbens.

Today, I went to the gym, which is what I do most days. I’m fortunate enough to have a gym in the same building as my office, and, due to the fact that the gym locker room is one of the weirdest and most annoying places on Earth, I typically have a process flow where I change in my office and go to the gym. So, I did that, leaving my office with my keys, wallet, and tablet in tow. I use the tablet to watch Pluralsight videos while I jog on the machines. After working out, I left the gym, changed in my office, got a bite to eat, and went home.

When I was ready to start thinking about bed earlier tonight, I noticed that I didn’t have my tablet in my gym bag or my laptop bag that I’d brought home. Checked the car, and nope. Guess I left it at the office. Or the gym. Ruh roh. Nah, couldn’t be. I must have left it at the office. Just to make myself feel better, I called the gym, and they told me that they hadn’t seen it. Good, must be in my office. Or… crap. I realize that I’m not going to be able to sleep without solving this mystery, since my tablet has no security and is synced up with all kinds of stuff that I don’t want people accessing. Why, oh why, didn’t I secure the tablet? Oh well, I’ll just drive the half hour to my office, see it on my desk, and feel better. Grumble, grumble.

I get to my office, half an hour later, and have trouble with my keycard for some reason. Luckily, the night custodian knows me and was there to let me in (the fact that the night custodian knows me means that I should probably think about scaling back my hours). I go upstairs, unlock the door to my office and there on my desk is… no tablet. It’s also not in any of my chairs, bookshelves or other places in there that I might have tossed it. It’s almost midnight, I’m back at work, and someone has taken my tablet. I start googling, and fast. I found this site, called Android Device Manager, which is pretty awesome. It lets you see where any of your devices are and, if you’ve set it up, it lets you lock or wipe them remotely. Too bad I hadn’t set it up. The only option I have is to send a loud, five minute “ring” to the tablet, but this app can’t locate the thing anyway, so nevermind.

I also found this “Android Lost” site along with a companion “Jump Start” app that you can use in tandem to remote install something that allows you to wipe the device. Whoah, seems ripe for abuse, but whatever, I’m desperate. No go, however, because it can’t seem to locate the tablet on wifi anywhere and I had already in a panic changed my google password and disabled twitter. Not much, but it was a start. But, it also seemed like it would now prevent me from engaging this option since my google store credentials were different. Oh well, I’d change my google password back. But, I discovered I couldn’t, unless this dude on the internet was to be believed and google caches exactly 110 old passwords before it lets you roll them back over. I can picture him laughing once every evening at each sucker that stumbles on that link and spends 45 minutes changing google passwords 110 times.

I was screwed. I sent one last “ring” signal to my lost tablet, locked my office, and wandered down toward the gym, which had closed at 11, to see if I could hear the thing or something, notwithstanding the apparent lack of wifi connection. When I got there, I couldn’t hear any joyous tablet noises, but the door was open for some reason, so I just went in. I was alone except the usual bad gym music that’s always blaring — something about a drum that, mercilessly and cruelly to the ears of anyone not in love with autotune, “won’t stop beating.” Given my despondence and general distaste for gym-garbage-pop, I so desperately wanted it to stop beating for just a second. Nonetheless, I wandered over to the elliptical that I had used and there, lo and behold, was the tablet, exactly where I’d forgotten to collect it when I was hurrying out of the gym.

Wow am I lucky. I almost didn’t go back to work. I almost didn’t make it into the building because of a key malfunction. I have no idea why I was able to wander into the gym, unsupervised, over an hour after closing and just help myself to whatever was in there, but I was. And now I have it back, and all it cost me was having to change my Google password and my Outlook password.

But I’ve learned my lesson. Phone and tablet now require a pattern swipe to sign in. And both devices are completely configured for remote wipe via the Android Device Manager. If you’re on Android, set both of these things up right now, I beg you. It will take you literally 20 seconds if you have your phone and a browser with you. If you have iThings or Microsoft stuff, I’m sure there’s some equivalent that you can find. It’s oh-so worth it, and you won’t realize it until you’re hit with that sinking feeling. Do yourself a favor, and avoid the late night drives and scrambles to change passwords and whatnot. If you go this route, you’ll just be kicking yourself for losing a few hundred bucks and not wondering what horrible things “you” will have broadcast over email, text message, and every social media platform on Earth by the time the dust settles.


Speeding Up DaedTech

As I get back into doing web development more and more these days, I’ve started to pay attention to some of the finer points, such as not having a sluggish site that turns off visitors. To that end, my Trello Board for this site had a card/story sitting in the “To Do” bucket for speeding up DaedTech’s load performance.

The first thing that I did was visit GTMetrix and run a baseline to see if subsequent things that I did would improve performance. From there, I installed W3 Total Cache which is a WordPress plugin that provides a whole bunch of functionality for speeding your site, mostly revolving around setting cache settings. After a bit of poking around and research, I figured out what was going on, and I enabled settings that helped with some low hanging fruit.

This included “minification” of CSS and javascript, a process whereby the whitespace is compressed out of these things as they’re sent from the server, thereby reducing the total amount of data sent (and thus time to process that data on the client side before displaying it). It also included optimizing the caching settings that the site suggests to returning visitors so that pages, styles, media, etc are stored locally on your machine as much as possible, which prevents reloads. This also setup the further use of GZip for further compression.

For improvement in the future, I installed a plugin called WP-Smush.it that will use the Yahoo utility for image compression to any file I add through the media library. This seems convenient enough that I should probably start adding files through the media library in general rather than simply putting them on the server and linking to them at their full local URL to get this functionality.

While I’m at making resolutions to improve speed going forward, here are some other tips that I’ve picked up today:

  1. Serve scaled content. Meaning don’t put up some huge image that the browser downloads only to use CSS or HTML in to tell the client to shrink it down. Send over the smallest possible image.
  2. Favor using my own images instead of embedding them from other sites. This lets me control the cache expiration suggested to the browser and the size as well. With hyperlinked images, I don’t have this control.
  3. Specify the image dimensions rather than simply accepting the default.
  4. Consider using image “spriting” to combine images such as the gaggle of social buttons into a single “image” to reduce the amount of stuff getting sent over the wire.
  5. Consider using a content delivery network to store your resources in places closer to site readers.
  6. Try to limit the number of things that make HTTP requests (like social media buttons)
  7. Use a utility to defer javascript execution so that it doesn’t block page load

I’m no web performance guru by any stretch. This is just what I pieced together in a morning after saying “I want my site to load faster”. I’m hoping that people in a similar situation to me will see this and realize that there is some pretty low hanging fruit to be picked here and that it isn’t terribly complicated to do so.


Connecting to TFS Server with Different Credentials

Hello, all. My apologies for the unannounced posting hiatus. I’ve recently started a new employment venture and I was also on vacation last week, touring the Virgina/Pennsylvania/DC area. Going forward, I’m going to be doing more web-related stuff and probably be a little more of a jack of all trades, so stay tuned for posts along those lines.

Today, I’m going to post under “lessons learned” for getting rid of an annoyance. Every once in awhile I have occasion to connect to a TFS Server using different credentials from those with which I have logged in. Whenever I do this, I am prompted for credentials when connecting to source control, which can be fairly annoying. Well, thanks to Mark Smith for a recent tip for how to avoid this.

In Windows 7/Server, go to the Control Panel and choose the “Credential Manager”. In a strange quirk, “Credential Manager” isn’t actually visible in the default control panel view, and so you have to click “View By” and select something other than “Category”. Once you’ve done this, you should see the Credential Manager.

In Credential Manager, go to “Add a Windows Credential” and enter the computer name, along with your login credentials for it. You’ll probably want to include the domain, so your username will be YOURDOMAIN\YOURUSERNAME. The domain isn’t strictly necessary if both logins are on the same domain, but I think a common scenario is you’re logged in to the local machine and connecting to a TFS server on a domain somewhere.

Once you’re done, you might need to restart Visual Studio. (Truthfully, I don’t know because I had already closed it when I was doing this).

Richard Banks has posted this same process with screenshots (minus the bit about Credential Manager not showing up by default).

And, that’s it. Spend 30 seconds doing it and save yourself daily or even more frequent annoyance from here forward. Cheers!


JUnit for C# Developers 8 – Obeying Demeter and Going Beyond the Tests

Last time in this series, I pulled an “Empire Strikes Back” and ended on a bit of a down note. This time around, I’d like to explore how I’ve alleviated my Law of Demeter problems, and about how fixing a code smell in my tests pushed me into a better design.

Up until now, I’ve been blogging as I go, but this one is all in the past tense — the work is done as I type this. I set out tonight with only one goal, get rid of my LOD violations, and this is where it took me.

Rethinking my Class

Recall that last time, I was passing in a database object, querying that for a collection, querying that for a cursor, and then querying the cursor for my actual database objects that I parsed and returned from the service. After a bit of trial and error and research, I decided that my service class needed to encapsulate the collection since, as best as I can tell from whatever Eclipse’s version of Intellisense is called, cursors are forward only and then you need to get another one. So, if I don’t pass in the collection at least, my service method will only work once. Fine – not thrilled about the collection.cursor.objects thing, but it’s at least pulling one LOD violation out.

I now have a handful of tests that look like this:

and my class became:

A lot cleaner and more manageable following some good TDD if I do say so myself (though I may be whiffing on some finer points of the language as I’m still rusty from 2 years of mostly uninterrupted C#). I’m still not thrilled about the heavy test setup overhead, but I’ve made incremental progress.

Now, where things got interesting is in wiring this up through Spring and MongoDB. The class works in test, but I need now to figure out how to use my spring-servlet.xml to get an instance of the collection injected into my class’s constructor. I wanted to do this (1) without defining any additional code and (2) without resotring to static implementations or singletons. For (1) I’d rather leave the DB setup stuff in XML as much as possible and for (2) I try to avoid static at all costs unless there’s some compelling argument that doesn’t lean prominently on a premise of “it’s more convenient”. Static is about as flexible as a diamond.

So, here is what I did:

I discovered that I can use factory-bean and factory-method attributes to invoke instance methods on beans that I’d created, turning their return values into other beans. I also learned that “constructor-arg” is rather unfortunately named in that it actually just translates to “arguments to the method in question”. So, in the case of the mongoDatabase bean, I’m getting it from my mongo object’s getDB() method with a string parameter of “daeadlus”. On the whole, the beans above translate to new Mongo(“″).getDB(“daedalus”).getCollection(“house”) being stored in the “mongoHouseCollection” bean, which I injected into my service. When I wired and fired it, it worked perfectly the first time.

So, this post has been a little thin on actual information about JUnit (really just the denouement to my last post), but there is a nugget in here for spring wireup, and, I think the most important lesson for me is that the design benefits to TDD go beyond just code. By taking my test smell seriously, I wound up with a design where I completely factored the database setup garbage out of my code, which is clearly a good thing. Now, I’ve been around the block enough times that this would have happened regardless, but it was interesting to note that making a testability/clean-code decision and sticking to my guns teased out a macroscopic design improvement.


Configuring Fedora and MongoDB

In my last post, I covered installing MongoDB on Fedora. This is another post as much for my reference as for anything else, and I’ll go over here getting set up so that my application successfully uses the MongoDB server.

When I left off last time, I had successfully configured the server to allow me to create documents using the mongo command line utility. So, I created a collection and a document and was ready to access it from my web application. Following the examples in the MongoDB java tutorial, I created the following implementation of my HouseService interface that I had previously hard coded room values into:
Read More


Setting up MongoDB on Fedora

This is one of those posts as much for my own reference as anything else, and if it helps others, then bonus.

I installed MongoDB on my old Fedora server just now, and while it was actually pretty straightforward to do, I figured I’d document the steps. The first thing to remember is that there are two separate installs: the client and the server (this is what tripped me up on the MongoDB site’s documentation). There isn’t some deal where running server install also gives you a client.

So, to set up a smooth, easy install with yum, the first thing you need to do is create the file “/etc/yum.repos.d/10gen.repo”. Once you’ve created that file, open it and add the following:

Now, once you’ve got that in place, run the command, “yum install mongo-10gen mongo-10gen-server”. This will install both the client and the server. When the client and the server are in place, you can start the server by running “/etc/init.d/mongod start”. Finally, if you’re like me, you probably want the server to run automatically. If that’s the case, execute the command “chkconfig mongod on”.

And, you’re set. MongoDB server is installed and running and will also run on your next reboot.

Acknowledgements | Contact | About | Social Media