The Office
First watch, 5 bells (10:53 pm)

Tonight Lorien and I drove over to The Office, a new(er) restaurant in Post Falls. I was skeptical, especially when the sign outside says “Bistro Pub and Martini Bar”. Anyway, the food was a little pricey, but quite good. The waitress staff was very friendly, and the chef even came out to our table to ask how everything was. I haven’t had that pleasure before, and it was nice. I had a nightly special, grilled halibut, it was a little under $17, but quite a big piece of fish. To be totally honest, I expected it to be smaller. For some reason, the “bistro” name comes with higher prices and smaller servings. The menu wasn’t really big, but had enough selections to choose from. The dessert menu was in the waitresses head (there were only three items). Lorien had some very good linguine noodles in a soup with some clams and bread all around the bowl—the bread was awesome.

Overall, I have to say the food was great, but I won’t be going back soon because the menu wasn’t huge. I certainly recommend it for a night out for a couple that’s looking for a new restaurant. The Office is located where the old Momiji’s Japanese food place used to be, right behind The White House (the garlic-smelling restaurant right off the freeway in Post Falls).

One of the perks of being a married guy is you get your dinner, plus a little taste of what your wife gets.

Leave a Comment »
My Bees, Part Two
First watch, 5 bells (10:44 pm)

Remember my bees from the other day? Well, they moved back in! That bee spray sure didn’t poison the nest like it advertised. I bought some more spray on my way home tonight, climbed up once again onto the ladder and sprayed those stinking wasps. They fell dead pretty quick, and I really soaked the nest good. There were a bunch of larva sacks under the nest where they dropped down to the ground. Despite the “don’t remove nest for 24 hours” line in the directions, I decided to evict the squatters (hey, they weren’t paying me rent!) and knocked down the nest with a 10 foot piece of PVC pipe I had lying about.

The nest was half full of more larva in the cones, and yes, JM, I’ll get you a picture. Although now the nest isn’t as impressive after I blasted the shell off the other day. I hosed the nest down with the rest of the can of spray after it hit the ground to make sure anything left in it was dead dead dead.

Leave a Comment »
Dealing with NULLs in SQL
Posted in Code
Afternoon watch, 7 bells (3:59 pm)

I ran across a nasty problem today that MS, a former cow-orker, failed to solve. And failed to notice. This isn’t a huge deal, but things aren’t getting reported right because of it.

Here are the basics:
Three fields of type money are being SELECTed from a table. Sometimes one of them is NULL. Two of the fields are being added together, and one is being subtracted from that sum.

The problem is, any time a NULL value is present, then entire mathematical operation evaluates to NULL as well.

Through some research, I discovered Microsoft’s T-SQL CASE keyword:

SELECT (Tax +
  CASE WHEN Freight IS NULL
  THEN '0.00' ELSE Freight
  END -
  Discount) AS 'Cost'
FROM myTable

Of course, the fields Tax, Freight, and Discount are all the in the table myTable.

This actually works quite nicely. The problem was tracking down the information. I’m posting it here mainly for my own use later, when I forget how to do something weird like this.

Normally I’d just set the NULL values to 0.00 and forge on ahead, but in this case I have no idea what I may be breaking somewhere else and needed a simple, non-intrusive peek into the database.

2008 April 25 Note: Today I needed this information. I’m a genius.

Leave a Comment »
My Bees!
Forenoon watch, 4 bells (10:16 am)

I found a wasp nest under the eave of my house the other day.

Let me put this in perspective, though—I found a wasp nest as big as my head under my eave the other day.

I’ve been engaging them and their queen in chemical warfare. I needed to haul a ladder out so the sprays at least twenty feet bee spray can spray up the 18 or 20 feet to the nest. Apparently you can only “spray at least 20 feet” when you spray down… :)

Anyway, last night I really got them stirred up, there was buzzing everywhere. Fortunately for me, most of it was on the ground, writhing in bee-pain. I couldn’t get back inside for about 15 minutes due to the sheer amount of bees swarming around my front door. Finally, most of them died off and I was able to head inside to safety.

I hosed down the nest this morning, about half of it fell off the house. Whatever bee-glue they used to stick it on is still working for the honeycomb apartments where they lived, though. I’m going to have to get a big stick and poke it until it drops off, I can’t have any new bees moving in unless they pay me rent.

2 Comments »
Family’s Fine
Posted in General
Forenoon watch, 2 bells (9:25 am)

I talked to my mom yesterday evening and she said that my grandfather is doing okay. Apparently he chowed down on a bunch of chocolate just before bed, and got sick from it. It’s about the least-possible bad thing that was in my head, and I’m happy for it.

Leave a Comment »
City Lookup
First dog watch, 4 bells (6:10 pm)

Building up on yesterday’s AJAX code, I finished by getting an official list of US and Canadian postal codes, cities, provinces, and some extra information hooked up. Now I can auto-populate City, State, and Country based on a quick postal-code lookup. It works beautifully.

Leave a Comment »
No Hospitals
Forenoon watch, 5 bells (10:52 am)

I just heard that my grandfather is in the hospital right now, they took him there last night. My mom is on her way down to Eugene to find out what’s going on. I hope he’s doing better, but everyone’s pretty worried, he’s old and he doesn’t want to be in the hospital.

Leave a Comment »
LOLcode
Posted in Creepiness
Forenoon watch, 5 bells (10:38 am)

Thanks to Ben for the scary link of the week: lolcode.com

Leave a Comment »
Microsoft CRM v3 and AJAX
Posted in Code
Last dog watch, 1 bell (6:58 pm)

I’ve been trying for at least a year to figure out a way to do some dynamic updating in Microsoft CRM v3 (or Dynamics, or whatever). Anyway, the problem is you don’t have access to the source code for the pages, and even the customizable onLoad() or onChange() functionality just isn’t enough sometimes. Perhaps you need an onKeyDown() or onBlur() function linked to an entity, which was my problem. Well, today I finally figured out how.

In the entity’s onLoad() function box (we’re talking Account, Contact, Lead etc), you need to write the javascript function to handle the job (I’m using some AJAX myself), and you need to attach an event to the element of the form you need to watch.

The element name is the ID found in the customization interface (in my case, I’m looking at a zip code as it is changing), the one I needed was address1_postalcode:

var xmlHttp = null;
var formZip = document.getElementById("address1_postalcode");
var formCity = document.getElementById("address1_city");
var formState = document.getElementById("address1_stateorprovince");

formZip.attachEvent("onkeydown", show);

function setCity(city) {
  formCity.value = city;
}

function getCity(zip) {
  xmlHttp = GetXmlHttpObject();
  if(xmlHttp == null) {
    alert("Browser does not support HTTP requests!");
    return;
  }
  var uri = "/path/to/ajax/page.php?zip=" + zip;
  xmlHttp.onreadystatechange = stateChanged;
  xmlHttp.open("GET", uri, true);
  xmlHttp.send(null);
}

function stateChanged() {
  if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
    var results = xmlHttp.responseText.split(",");
    setCity(results[0]);
    setState(results[1]);
  }
}

function GetXmlHttpObject() {
  var objXMLHttp = null;
  if(window.XMLHttpRequest) {
    objXMLHttp = new XMLHttpRequest();
  } else {
    objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  return objXMLHttp;
}

function show() {
  var zip = formZip.DataValue;
  switch(zip.length) {
    case 5:
      getCity(zip);
      break;
    default:
      return true;
  }
  return true;
}

Everything goes into the entity’s onLoad block, and not the individual attribute’s onChange block. Obviously, you’d need to code your own URI to submit to, making sure it returned the properly formatted data, but this should be plenty to get anybody going with AJAX in Microsoft CRM.

The key to everything working, for me, was figuring out the attachEvent bit. Once I had that, everything else came together pretty quickly. You can change the event type to any of the other standard javascript events that happen on normal web pages.

Leave a Comment »
Death On Heels
Posted in General
First watch, 4 bells (10:00 pm)

Tomorrow is the big day—Ironman Coeur d’Alene. My in-laws have tons of guests at their B&B, and tonight was their carb feed. I saw the rest of the family (Mike and Arwen and their offspring) earlier today, and my father-in-law has reversed his earlier decision to not run Ironman and he’ll be in it tomorrow. Since he hasn’t trained much, we’ve tried to talk him out of it, all to no avail. About a year ago, when this crazy idea was first brought up, and someone said we’ll station family all along the course to help cheer him on, I asked “where are we going to get that many boats?” (the swimming part is first). Everyone laughed about it, but now it may prove true.

Leave a Comment »
Late Night, Early Morning
Forenoon watch, 1 bell (8:39 am)

I got home last night after heading out to the Thackray household to fix their computer, it was a little after 11pm when I got home. I was still quite awake, though, so I just stayed up since it was nice and quiet with everyone else asleep (it’s a nice time to get some reading done). Anyway, I ended up going to bed around 1:30am, which turned out to be a big mistake: Cami’s kids got up around 7am, and me being the extremely light sleeper that I am got up right with them.

Leave a Comment »
Family Descending
Posted in General
Afternoon watch, 1 bell (12:47 pm)

My wife says that family is descending upon us today. Her younger sister and her two kids are going to be staying with us for the next week. If I were a drinking man, I’d say it’s time for me to get my drink on, but I guess I can’t.

There are a few things I need to do tonight before they get to our house, to baby-proof some things…

Leave a Comment »
Guitar Hero—Sans Console
Posted in Strangeness
Forenoon watch, 3 bells (9:34 am)

Those clever Japanese are inventing new stuff all the time. Check out the Air Guitar. From the description:

This is just the upper neck of a guitar, and the strings are the infrared ray that makes the sound as your fingers hit the fretboard. The controller has seven buttons on the front to click for “G” to “A” and four buttons on the side to identify the chords as major, minor, augmented or diminished.

For $27 you can sit on a bus and entertain people. Plus, it fits in your pocket better than a real guitar!

Leave a Comment »
Pine Cones
Posted in Random Thoughts
First dog watch, 4 bells (6:12 pm)

Pine cones are like tree poop—they drop off the main body from time to time and litter the ground. Dripping sap would then be tree pee.

Leave a Comment »
Lindt Truffles
Posted in General
Afternoon watch, 3 bells (1:58 pm)

I went with JM over to Daanen’s Deli earlier, J wanted something to help him get his drink on. While I was poking around the store I saw they stocked Lindt’s Lindor truffles. My wife loves the ones we get at Costco, but they’re the dark chocolate ones, her least favorite flavor, and Costco doesn’t carry any of the other kinds. I picked up some milk chocolate, milk chocolate and hazelnut, and chocolate mint truffles for her. Bonus points for me!

Leave a Comment »