Ch-ch-ch-ch-changes! v2.0

Well, almost a year to the day. Pretty bad…

BUT, at least I have a decent excuse. My wife and I had a beautiful baby girl, Haven, on Christmas Day. Shortly after I got the new job we found out about the pregnancy, and then it was doctor visits galore. For the past 5 months now it has been “Daddy time”, so, yeah.

A funny thing about this post and the last – they both have to do with changes. While there are the obvious ones (fatherhood), I mean career changes. You see, I have been on my contract this past year with Walt Disney Parks and Resorts Digital (WDPRD) and I have been kicking some ass (if I may say so myself). I have been working hard to gain FTE their, and it has always been a bit like a carrot on a stick – just out of reach. Well, now I am coming up on my final day tomorrow.

A couple weeks back the axe fell and all contractors were cut. We lost some really good guys in Argentina, and now those of us in Seattle are gone too. Like the last time this happened, I have some options, so I am not too worried, but the whole “Daddy” thing is my priority, and I have been lucky enough to WFH 4 days a week, so I need to look for something matching that. Goo luck to me…

As far as code goes, I don’t have a bunch new. The most recent stuff I did was just some JS sandbox stuff to play around. Here are some links:

JS “Hydra” – an interview test:
https://jsbin.com/wujaxob

Apple basket – add and eat apples from your “basket”:
https://jsbin.com/piruqa

Simple inheritance demo:
https://jsbin.com/vagoyu

Another simple inheritance demo:
https://jsbin.com/rubunu

Sandbox play-around:
https://jsbin.com/yejari

I have a couple of code tests from a recent interview that I will hopefully share soon. Or maybe next year. 🙂

Ch-ch-ch-ch-changes!

I have neglected my blog for some time, and it is time I gave it a little love.

I recently went through a major career change. I received news that my employer of over 10 years was going through some financial hardship and that my hours were no longer guaranteed. I have been telecommuting for the past 5 years, so the news came as quite a shock. I knew I wasn’t going to be able to continue to telecommute, and the best I could hope for was a couple of days a week working from home.

Luckily I have been a developer for some time. I get a lot of recruiter emails, so I started replying and reaching out to previous recruiters I had spoken to. It did not take long for phone interviews to roll in, and then face-to-face interviews. I have always put way too much pressure on myself in interviews, and I was dreading going in to “code in ten minutes” or whiteboard or whatever.

The funniest part of this whole process is most of the employers I interviewed with were not actually on the MS stack – which has been my focus for most of my career as a developer. Most were on some sort of PHP codebase server side (eww…) but the majority of focus was on client-side. I am thankful for taking the leap into js frameworks!

So, I now have a new job in Seattle. I have to commute about 1.5 hrs each way, but it could be worse. I drive maybe 1.5 miles to the marina, park, hop on the foot ferry, then transfer onto the “big” ferry in to Seattle. Here are some pics from the ferry:

IMG_20150527_055839

IMG_20150529_060339

IMG_20150529_164745

If you gotta commute, commute in style

Anyway, to give some examples of some client-side code, I added some new gists and repos. Check them out if you like.

SVN Tree Conflicts

One thing that has always baffled me and my co-workers is SVN tree conflicts. I thought it would be a good idea to keep track of different scenarios that result in tree conflicts as an exercise in demystifying them.

  • Delete a file but don’t check in the delete. Another user performs the same delete and checks it in. Perform an update = tree conflict

jQuery Star Rating Plugin

I am thinking about adding a star rating to one of the sites at work, so I started poking around for what was available in a jQuery plugin. Surprisingly, there are quite a few plugins but none that I totally fell in love with. they either don’t degrade, or use form elements I don’t hink they should, or whatever. I thought it would be a good exercise to try and roll my own plugin.

I started of checking out some how-to’s for jQuery plugin writing, but I usually learn better by doing, so I started with the closest thing I like, Wil Stuckey and John Resig’s rating plugin. It is pretty good, but it just needed a little nudge to be better. I figured this was a good way to start. I would not have to write an entire plugin from scratch, and I’d learn from one of the guys that created jQuery, so how could I go wrong?

It took a few days, with a few hours spent here and there. All in all I feel pretty good about the plugin, though I am sure I could make it better, and I likely forgot something important. If you are interested, you can grade the code from my code section, and there is a demo available too. Let me know what you think in the comments.

Flash Pageflip Code

I am cleaning out my old code snippets to see what I can post on the new blog. Here is a sweet little Flash pageflip app based off some source from PageFlip v2.13 coded by [email protected]

About the code

If you did not already know, I work for an educational publisher. We have an online subscription-based site which is essentially most of our titles chopped up and indexed into small teaching units. Users pay a fee to have unlimited print capability. When we started the site, we were using PDF’s with an encryption plug-in. We want to allow our users the print capability (it is the backbone of the site) but we did not want them to store the files. We wanted them to use the site to “store” them, and we also did not want them distributing PDF’s. The plug-in works, but there are issues.

First off, the Mac version is a bit behind the Windows version. Since we deal with teachers and schools, we must have a Mac solution. The plug-in also only works with Adobe Reader. Since Mac come with Preview, users got confused about why they could see other PDF’s but not ours. Since Preview couldn’t use the plug-in, the users basically saw a bunch of blank pages since the PDF contents were never decrypted. Lastly, we used a Java based virtual page-flip viewer so users could see the contents of the file before downloading the PDF and printing. The major headache is the users had 3 pieces of software to install the get the full experience. Not good.

Alternative solution

Since we were having so many issues with installations and third-party software (reader wouldn’t recognize the plug-in, but the manufacturer’s installer said it was installed, Reader version was too old, Reader’s browser plug-in stinks, etc.) Istarted to look to alternatives. We considered writing our own PDF viewer, but quickly scrapped that idea. Then I started to look at Flash Paper. This looked like a pretty good alternative, but since the Macromedia/Adobe merger, the product is now treated like an illegitimate child.

I found Scribd, a start-up based in SF,CA. They took Flash Paper and basically rewrote it and extended it. It is really a pretty sweet thing. There were a couple issues, however. First, they would not let us purchase the code or host content on our servers. We have over 10,000 units, and we weren’t really eager to let them go, let alone the time it would’ve taken to upload (my company had a T1 back then and it was slooooow). We tried to come to an agreement but they just wouldn’t budge. In retrospect, I think it had to do with there PDF to SWF system (based on SWF Tools) and the fact that the “viewer” is really pretty basic. I think if people could run this locally they’d see that the system isn’t really that complex. The service is free, however, so it’s not like we wouldn’t get our money’s worth, right? However, all that aside, we still had issues with some of our PDF’s and really slow load times. We couldn’t have that, so I had to look elsewhere.

Pageflip

At this time the Flash pageflip stuff was pretty new, and quite cool IMHO. I thought it’d be pretty slick to use something like that and make my own Flash viewer (to replace the Java solution) and also use the Flash printing capabilities. This would solve all our problems! So, I downloaded this code and got to work. The code was using static page references, so I got it working with the XML file to dynamically load images into the viewer. It has been a while, so I don’t recall where the original code ended and mine began. Beyond that, I am no Actionscript guru, so I just kinda futzed around to get what I needed.

In the end, however, this was not the solution we used. It turns out to get that fancy flip action requires multiple versions of each page (3 if I recall correctly) and I could not figure out how to optimize it. Other than that, Flash basically just sucks. There is no garbage collection that can be called. Flash just decides when it will GC. Also, Flash has the nice undocumented feature of consuming every last drop of resources from your PC. We deal with user’s that have older PC’s, and our tests could actually crash browsers and lock-up machines. Thanks, Adobe!

What you get

Included in the zip are 2 versions of the viewer. the 2nd has an improved zoom capability. I put them both in so you could choose which one you wanted, and to let you see the differences I implemented regarding the zoom.

If you keep the number of pages small, or even keep them pretty low res, this will actually work okay. Did I mention you can also print? Oh, well, yeah, you can also print. All in all it is pretty groovy, but it just did not work out.

    Features:

  • Zoom capability
  • Print entire “document”
  • Dynamic page loading
  • Ability to add custom logo to viewer

Sample 1 Sample 2

Download
Preview

I hope someone out there finds a use for this. Enjoy!