Here's Johnny!

Mental Vomit from week of 2/7/16


Sloppy Weather Week

Time to vomit out some more basic todo list type stuff to see if we can keep Mr. Dillon….SQUIRREL! on track.


First Week Back

Time to vomit out some more basic todo list type stuff to see if we can keep Mr. Dillon….SQUIRREL! on track.


Using TodoMVC as ShoppingList base

iPhone reminders app sucks donkey balls. Takes FOREVER to update for me and my wife. I wanted to play with Firebase anyway so heres my chance.


The day after, after....

Time to vomit out some more basic todo list type stuff to see if we can keep Mr. Dillon….SQUIRREL! on track.


The day after....

Time to vomit out some more basic todo list type stuff to see if we can keep Mr. Dillon….SQUIRREL! on track.


Angular Tree view hunt

So we don’t typical pair at work. I feel like I’m so much more productive when we do occasionally pair. I have noticed that I am more productive when I’m blogging as I go. I think its cause I have to actually write what I’m going to do next, like I would when pairing. So here we go again.


Back to the grind

So I’ve got an endpoint, and I’ve got quite a few different filters setup. Now I need to get it so that it returns the total available after the filters are applied. Then order and skip/take a page.

I’m having issues with the repository and IOrderedQueryable types not casting properly. So time to figure that out…..


Meet the New blog, same as the old blog

So for the most part I’d stopped blogging, having a baby does that to you. However it seems like it’d probably be a good thing to show that I didn’t stop working 6 months ago so probably looking at taking it up again. As before it’ll be a rambling stream of consciousness that is poorly if ever spell checked. You have been warned.


Ninja Blocks I am disappoint

The HVAC system at our current house sucks. The place is three stories and the furnace doesn’t heat the building evenly or even linearly for that matter. I intended to use some Ninja Block components to rig up my own custom thermostat but that was a pipe dream.


RabbitMQ for Errors in .Net

So we’ve been trying to dip our feet into messaging for some time now. We have one ‘module’ in our application that currently uses RabbitMQ to pipeline message across several different languages and processes. Overall that experience has been very positive.


Dropbox Sync

So I talked about wanting to use dropbox-sync-js to synch a dropbox account with pictures of my daughter. The library seemed to be very well written though not quite general enough for my purposes on further examination. So time to mod it and see if we can’t contribute back to the project in the process.


Baby Pictures

So since Norah was born I’ve been wrestling with finding a way to have all of our pictures of her available to us and our family/friends, while also giving our family and friends a way to send us their pictures of Norah. The other requirement is that they have to be “backed up”.


Angular: Nursing

My wife is currently nursing so we are going to sneak in a little ‘work’.


Angular Interrupted

So another project that I’d worked on stopped its compiling and decided to do a suprise deploy. So I’ll be a litte more sporadic on the angular posts for a couple weeks.


Angular From Scratch: Day 5

Ok so today we get start by putting everything I destroyed last night back into shape. Ugh, you’d think I’d have learned this lesson by now.


Angular From Scratch: Day 4

Ok, so we’ve got the page up and it loads info on who the user is and puts some easy stuff in the index.html. We also have a little directive that puts up a nice little badge if we are on the DEV/CI/STAGING versions of the site.

So my choices for today are:

  • Menus
  • Login $http interceptor

Angular From Scratch: Day 3

Ah day 3. It feels like this might become an actual thing. So were where we….


Angular From Scratch: Day 2

So, we left off looking for a way to make the E2E tests run with Protractor easier to run. This means we need something to start up the Selenium server, then run mocha with the correct files.


Angular From Scratch: Brownfield Everywhere.....

At my current job, Reachmail, we’ve got a disgusting brownfield app. We’ve been working our way through a plethora of different technologies, methodoligies and theologies. We decided awhile ago that a one page app makes alot of sense in our case.


Html5 DND into document/body

So I’m trying to implement a drag and drop file upload somewhat like imgur or Github’s issues. I started with Eric Bidelman’s artcle ‘Native HTML5 Drag and Drop’, and its a great article that goes into more depth then I’d seen before.


So Much Want

I want to go so bad.

My wife says I can go! Pretty sure this is one I’ll be attending whether my employer decides to fund the excursion or not. I really hope he doesn’t read this.

So you forgot about DFS and waxed the root share?

If you, like me, forget your DC is the root share for DFS then you can use the link below to wax it and start over. Dumbass.

Recursive Mocking: Rhino vs NSubstitute

I'm toying with the idea of ditching Rhino mocks. I've always felt pretty lost when trying to use it and have to look up examples pretty much every time. I rarely 'mock' anything and the stubbing leaves something to be desired from the syntax and usability standpoint.

Anyway what has brought this to a head is that I'm doing a service and it has a dependency on IConfiguration. I knew/know Rhino mocks has a recursive mocking ability so I thought I'd use that.

            IConfiguration config = MockRepository.GenerateMock<IConfiguration>();
            config.Stub(x => x.Data.OurApp.ConnectionString).Return("SomeConnectionString");


This works as expected. However if you complicate it a little....

            IConfiguration config = MockRepository.GenerateMock<IConfiguration>();
            config.Stub(x => x.Data.OurApp.ConnectionString).Return("SomeConnectionString");
            config.Stub(x => x.Web.Sites.OurApp.Urls.ClientFiles).Return(new{new Uri(""));


I start to have issues and I haven't been able to find a way to get it to let me set more then one property recursively.

I just started playing with NSubstitue. Here is the same stuff/more and it works as expected.

            IConfiguration config = Substitute.For();
            config.Web.Sites.OurApp.Urls.ClientFiles.Returns(new Uri(""));


Thoughts feelings?

Inline Sensing Variables: Saving your bacon one assert at a time

The term 'Inline Sensing Variables' is my fancy way of saying using Asserts in production code. I think its probably got a tad less pretentious name somewhere out there.

I work on what could generously be called a 'Brownfield' app. More precisely its a steaming pile of shiat. The major component that I've been working on cobbles together all the information needed to send email. Its pretty much the heart of the app and if it messes up it can really bite us in the ass. When one client gets 2K emails in 2 min we tend to hear about. So refactoring the component carefully is key. Reading through books like 'Agile Principles, Patterns, and Practices in C#' suggest that you have tests in place so you can refactor with little to no worry. What do you on a component thats not testable? Asserts baby. I'm currently ripping all the data access code out and replacing it with nHibernate based objects. There are a few (hundred) quirks in the data access layer though so making sure it all does exactly what it did before is paramount.

DisplayLink: How to piss of a user base

Don't jerk us around and release a god damned driver for Windows Server 2008 R2. Oh and make sure your stuff doesn't conflict with the newest Nvidia drivers.

Application Verifier: Awsome, that is all.

Get this! Windows 7 is Major version 6 minor version 1. Have fun :)

Log Shipping: When you boss pulls the plug

So me and my boss were rooting around in the rack and he discovered that the secondary SQL server's cabling to its hard drive enclosure wasn't screwed down. He discovered this by knocking it free of course. Considering I installed them I thought he showed alot of restraint not throttling me. Anyway after we got done going over all the connections in the rack to make sure that was the only loose one we bounced the box and the RAID controller recovered with remarkable aplomb. So we went on with our chores.

This morning SQL was whining about the latency of the last backup applied to our secondary server. Basically log shipping was kaput. Running  the job by hand yielded errors, but not much in the way of info. So I did a log shipping report and manually ran a restore of the last log it had finished. I was operating on the hunch it failed to finish the last one before it was disconnected. I go the error "A previous restore operation was interrupted and did not complete processing on file". Quick Google sent me here. Apparently WITH RESTART didn't work for that guy but it worked like a charm for me. So I thought I was roll'in, but restore job failed on me again. Alot of good info to be had in msdb.log_shipping_monitor_history_detail. I also tried running the next log restore by hand and it got most of the way through before bitching about the trn being messed up. So I surmised that the copy prolly got cut off when the drives where disconnected (trn temp storage is on the same drive set). I went and got a new copy from the primary sql server and fired off the job again. Log shipping reports shows latency of last backup falling so I believe its catching up.

These boxes are both Win Srv '08 and SQL Srv '08 so you might be asking why we haven't gone to DB mirroring. I looked at it when I initially setup the servers, but the whitepapers where saying you could expect a 25% performance hit with synchronous mirroring. That was pretty unacceptable to us. Async would probably work fine but we don't want to buy the expensive version of SQL Srv. I guess I should bite the bullet at some point and setup mirroring just to test it.

Inline Sensing Variables

Ok, stop me if you've heard this one. Use Assertions in prod code to make sure your new code is doing the same thing as your old code.

I first read about sensing variables in this book, but honestly was such a newbie they really didn't register. For some reason today it dawns on me that I should revisit the subject. It was prolly the pile of legacy shiat I've got to make some rather major changes to that inspired me. Anyway over to Michael Feathers for info about sensing variables. He's also got a nifty framework for it, but its for java :( I figured I'd implement then manually for now. That wouldn't work either.

If your app, like mine, only lends itself to acceptance testing its kinda hard to implement sensing variables. You can't test it so you can't test the sensing variables. Well thats not gonna work. So what if you just add your new code and leave the old code then add assertions to make sure you new code is giving you the same thing as the old code was. I've got some acceptance tests setup so every time I run those these tests will get exercised as well. Seems like a win-win.

Anyway thats the jist what I'm going to do. Hopefully using assertions I'll be able to get it all broken out into testable chunks and they will no longer be needed at all.

BTW if you know of anybody else doing something like this or someone who thinks its stupid let me know.

I did some quick searches and came up with this tid bit. Its how to find what tests exercise a given piece of code. Kinda neat I thought.

PMTA Utilities: First OSS project

This post is more about the fact that I'm doing an open source project then the project itself. Its kinda odd to feel like you might have something to contribute.

Watin Reliability

I've been having issues with getting Watin to work reliably from our build server. IE is the biggest PITA, but FF bites me once in awhile as well.

If, like us, you've got self signed certs on all your development boxes (build,CI,Staging) you'll have to log on as your build user and make sure that FF and IE both accept your SSL certs. FF lets you do a quick exception, but with IE you get to play around with downloading the cert and that certs root authority cert as well and installing them. There are a lot of walkthroughs about.

Default Browser:
First off if you do this:


Your Watin tests will hang on these for IE. I think FF keeps trucking though.

Crash Recovery:
Nice in theory, but just annoying in practice. For Watin its yet another show stopper. If you were to say, go on your build server and use something like ProcessExplorer to kill of all the IE processes that had accumulated because you are incapable of writing a test that cleans up after itself. Then you might see this. Just an off the cuff example you understand :)
And to disable:

Protected Mode:
IE apparently has something called protected mode. I don't know what it is and to tell you the truth I could give a shit. Some guy says turn it off for Watin or at least add your sites to trusted sites so they won't be run as protected mode. I've just turned it off. It is for our build user and the only place its going is our own development sites using Watin. Someguy

Thats all I've got so far. I'll keep you posted if I find any more or determine any of these are so much BS.

Audible: Your iPhone app sucks

Very unimpressed with Audibile Inc.'s iPhone app. It was refusing to continue playing a book I was about half way through. Now it refused to even start. POS.

Log Shipping from SQL Server 2008 SP1 to SQL Server 2008 R2

In a works with some caveats. No stand by :( Apparently the change to R2 was significant enough to require that the database files be upgraded. So because my backups are 2008 SP1 I have to run it in No Recovery. Boo. We used the standby feature as a short term point in time backup. Our database is roughly 450GB so restores and such could take quite a while. When we screwed up something in production we had about half an hour to scoot over to the log shipping secondary and get the data back before having to resort to a full restore. You have no idea how many times I would shut down log shipping when I hear a yelled, 'Shit!' from my bosses office.

Our primary was setup about 2 weeks ago with 2008 SP1, and now our secondary has 2008 R2.I'll punch it up to R2 at some point and then redo the log shipping. PITA oh well.

I looked at mirroring but we only have SQL Server Standard and our secondary box is less performant then our primary. I felt synchronous mirroring would probably slow us down substantially. Granted I haven't tried it,  but from the white papers it looked like it would be about 60-75% slower.

SQL Server Pile Schema Pattern

A simple set of rules to help you implement the Pile Schema Pattern in your database.

NHibernate Profiler and Legacy Crap

The system I work on can only be described as legacy crap. We are working to get it updated, the data consistent and to use NHibernate. NHibernate has been great in that the number of options available has given us the ability to work around some of the past ridiculous design choices. To that end we have been playing with/evaluating NHibernate Profiler

I haven't used it that much, but some other members of the team regard it highly. So far to me it looks like a very nice piece of software.....if its not used on a legacy piece of $@!$. We have an application that runs as a windows service and is fired off ever 30 seconds. However the fun doesn't stop there. The service is replicated 7 times specifying the ID of the service on the command line. Its bunk, but it works. We've started using NHibernate hydrated POCO objects in this service. After about two hours the services would go berserk and use all the CPU. The version in production had a single usage of a NHibernate entity and seemed to work fine and forcing our CI server back to the production code stopped the services from going all Seppuku. It wasn't till I put 10-15 instances on my local dev box an dropped the service timer to 3 secs that I was able to recreate the issue locally.

Having10 instances of a service that want 100% cpu? Not fun. Took me a good while but, I was able to use Procces Explorer to set their priority to 'Below Normal' and get a usable system back. I attached the debugger and watched as it seemed to run just fine. My code was fine and I couldn't figure out what was going on. Then I looked at the threads and realized there were probably 30 threads trying to reset the NHProf logging. Woops. Until then I didn't realize that NHProf was the issue. If I were to actually start NHProf I could cause the berserk behavior at will.

So if you have alot of separate processes using NHibernate watch your use of NHProf. Like I said appears to be a sweet app, but you know what they say about crap in....

15 Gallons of beer on the wall...

NHibernate: Ignore case when parsing string Enum

This is not the answer sorry. If you find out how to do this let me know.

I've got a table of 'TableElements'. These elements can be used to create new tables. They contain the column 'element_type' that is literally the SQL type of the potential column (ie varchar,int,bit,,,,). We are switching the application over to use NHibernate and so I created a simple class to encapsulate this and figured on using the System.Data.SqlDbType Enum to expose this field. NHibernate has no problem with string to Enum, except when the cases are different. Enum.Parse has a boolean to spec if the operation is case sensitive, but I can not for the life of me figure out how to make it case insensitive in NHibernate.

Luckily I'm just going to correct the case on all the strings in the DB and call it done. I got lucky in the first place the syphilitic monkeys who originally wrote this app even used the standard SQL type names and not some BS they pulled out of their ass.

Regurgitation: Fix Icon Overlays. Aka Windows Explorer is Bunk.

If your running TortoiseSVN and Dropbox or any other program that does overlays in Explorer your going to run into issues. This guy has a lame work around, but its the best I've found. I'd pay attention to the guy that recommends using a 'Z' prefix in the comments. He's spot on.

Regurgitation: Enable Aero Peek in Windows Server 2008 R2

If your running Windows Server 2008 R2 as a workstation and you've enabled all the Windows 7 GUI goodies you might have noticed by default the feature 'Aero Peek' that turns windows transparent isn't working. If you go to the little bezeled vertical bar on the extreme right of the taskbar and hover over it can you see your desktop? If not then you've got no Aero Peek love.

Head over to this guys page and use method #2 to enable it. In reverse of course.

Audible, the second-class citizen

Why does Apple not like Audible? My iPhones support for Audible keeps changing seemingly at random. The interface changes that they've made I'll admit are pretty, but the actual playback has become so buggy at times its almost unusable.

The first complaint is more a general iPhone bug. The external speaker stops working. No sound except through the head phones. Ring and alarm still work but any music, game or Audible content doesn't play through the external speakers. You have to bounce the phone to get it back.

That brings me to the next problem. Power related loss of position. In the case above if you bounce the phone your Audible book get set back to as if it were never played. So remember to take note of where your book was at before bouncing your phone. It doesn't always happen, but enough that I take note of chapter and minute anytime I bounce the phone.

Playing your book.....but not really. I will pause the book with the headset control and then after a min or two try to restart it. It will take a couple seconds to start and then will only play for about 3 seconds. If I try to stop and restart it has not effect and if I look at the iPhone it says its playing and is happily ticking off the time. The easiest way to get it back is to move around within the audio book using the slider. It seems to re-synch what ever got messed up in the first place.

Anyway, I'm just bitching cause I honestly thought that Apple sold Audible its DRM tech. You would think they would be able to get it right. It is my gut feeling going by the way it messes up that a lot of the problems are related to the DRM. Does anyone know if audio books purchased from iTunes suffer from the same issues?