Skiing “The Beav”

DSCN1092

Chris and Katie came up this Saturday and we had a great time skiing Beaver Mountain. The weather was great with sun, some snow, and was a little hot at times. I rented some skis and got to try out some nice, short, parabolic skis and they were really fun. Beaver Mountain had a nice, new triple that went all the way to the top. This was a great upgrade for the mountain with finally some padded seating. Now I just have to fight off the “Spring Fever” for another month or two until we can go catch some fish.

DSCN1090

Valentine’s Day

Laura and I had a nice Valentine’s Day. Rather than fighting crowds we decided we’d enjoy having a nice dinner and relaxing. Last year for Valentine’s Day we cooked up some lobster tail and crab legs. We loved that so much that we thought we’d do it again except this time we had steak & seafood (King crab legs). Even though it was all really delicious we both thought the legs were better than the claws. Easier to handle and tastes better too.

Steak


& Seafood

Free PHP Flash Charts

A Chart

I was looking for some good flash charts to use and found one that is free, customizable, sleek, and works with PHP! Open Flash Charts are great even though the examples on their site don’t do it total justice. With a couple customization options you can make your own flash charts look really close to Google Analytics flash charts. Now, I’m not saying they’re both the same, because they’re not. But Open Flash Charts are pretty close. They also have an active community so they are always adding new features and graphs. They also support not only PHP, but ASP, Ruby, Python, etc.

To install, just download the files and upload them somewhere where your website pages can include them. The only hard part of the installation is just figuring out the right path name to include the file open flash chart file.

Calculating Floating Holidays in PHP

Since I’ve spent so much time figuring out the best method for calculating floating holidays in PHP, I’ve decided to share this little function with everyone. I found the best calculation method and mixed it in with what I thought was a little more useful. Just feed in the needed parameters and you’re good to go!

  1. function ordinal_day($ord, $day, $month, $year) {
  2.     $targetDay = date("w", strtotime("next $day"));
  3.     $earliestDate = 1 + 7 * ($ord - 1);
  4.     $weekday = date("w", mktime(0, 0, 0, $month, $earliestDate, $year));
  5.    
  6.     if ($targetDay == $weekday) {
  7.         $offset = 0;
  8.     } else {
  9.         if ($targetDay < $weekday) {
  10.             $offset = $targetDay + (7 - $weekday);
  11.         } else {
  12.             $offset = ($targetDay + (7 - $weekday)) - 7;
  13.         }
  14.     }
  15.    
  16.     // Calculate the actual date of the holiday
  17.     $holidayDate = mktime(0, 0, 0, $month, $earliestDate + $offset, $year);
  18.    
  19.     return $holidayDate;
  20. }

The parameters:

  • $ord - The number of days. Ex. “The fourth Thursday in November” (Thanksgiving)
  • $day - The short abbreviation of the day of the week. Ex. “Thu”
  • $month - The month in number form. Ex. “11″
  • $year - The year in four-digit form. Ex. 2007

Weekend in Ephraim

Weekend in Ephraim

Laura and I sitting on the “dock” at her parents house

Zombies in Plain English

Protect yourself this halloween.

PHP Tutorial for Quickbooks Web Connector

I hope to provide you with enough information to get you familiar with coding PHP to work with Quickbooks Web Connector. I am going to expand on the very useful php tutorial for Quickbooks Web Connector posted by the wonderful guys at ubercart. Please read what they have provided, and then come back here for a few things I thought to be helpful.

Where to put the Webservice

Initially, I just assumed I would put the webservice on one of my sites. I found out that when you create and try to add your QB Web Connector (QBWC) application, it will try to verify the security of your site. I ran into that problem so I decided to host my web service on the local machine that had QBWC installed on it. So I installed Wamp on the machine, then put my webservice on there as well, and it worked great because when your QWC app is looking on the localhost it ignores the security check. My action queue table has a few fields like: ID, orderNumber, isComplete, and a timestamp.

Since the Quickbooks Web Connector basically processes “batches”, I needed a way for an employee to request a single order to be processed. We used to use QB RDS server (remote data sharing server) which was an “on command” type of method. QBWC works backwards from that requests originate from QB instead of from an employee. So I added the functionality for an employee to add an order to the queue to be processed. This helped fill the void left from the RDS server that we no longer use. Its not immediate, but it works.

Action Queue?

It took me awhile to figure out how the action queue worked. I was used to making one call to the web service to process a list of orders or transactions or whatever. The QWC app makes one call though, and then your web service says back to it either, “Please make another call because I’ve got another order to process” or it’ll say, “I’m done so don’t make another call to this web service.” In the beginning I was hoping to just query what orders needed to be processed, process them, and then say back to the QWC app, “I’m done.” Since it makes seperate calls though, I created a table (an action queue table) that my web service could call at anytime and say things like: “Is there an order ready to be put into Quickbooks? If so, which one?”, “How many orders are left before I’m finished?”, and “Please mark this order as being processed so I don’t process it again.” Those turn into your functions that the ubercart guys have used in their code.

Conclusion

I know I didn’t cover everything, and I didn’t provide any code sample. The guys at Ubercart did provide code sample though that gave me a good enough idea of how the Quickbooks Web Connector works in PHP. If you have any questions, feel free to ask here by posting a comment and I’ll see if I can help. But know in advance, I’m no “Quickbooks know-it-all” kind of person so don’t expect a perfect answer.

The Fremont River in May

A Fremont Brown Trout

I wanted to post a photo of my trip to the Fremont River that I took in May. I know its way late, but better late than never. I love to fish here because there are so many good holes and riffles to fish. Plus its just so beautiful.

Prototype - Form.Element.Serializers[method] is not a function

A quick little tip for when you get the javascript Prototype library error

Form.Element.Serializers[method] is not a function.

When I got this error, it was because I had another element on the page with the same id. This element happened to be an anchor element. So if you get this error, make sure your id is unique on your page.

Another great tip.  Use Firebug’s breakpoints with step into feature to really see whats going on under the hood.

Prototype Javascript Library

Fly Fishing the Big Thompson River

I finally got to fish Colorado for the first time and it was really beautiful. The one thing I love about Colorado is they decided to substitute sage brush for grass.

While the women were left to shop in Estes Park, the guys went and fished the Big Thompson! We found a little stretch that just looked great. Right off the bat we were greeted by a little, excited, jumping brown right by our feet. I started off fishing a hopper dropper combo with a copper john. After moving upstream about 100 feet I ran into a great shallow stretch where I spotted a few rising fish. Immediately I clipped off the combo meal and tied on a BWO. I started fishing up the bottom part of the main riffle and hooked a little rainbow. After that we had to wait out a thunderstorm under some willows. Later we didn’t have too much luck other than a foul hooked rainbow.

A really great experience though for only fishing for about 2 hours. I’d love to go exploring some more places to fly fish in Colorado.