inbox zero

I always feel compelled to write a meaningless blog post every time I get my inbox to zero. So, here it is: I got my e-mail inbox at work down from about 400 messages to zero today. Everything’s been tagged and filed, or deleted.

My personal email inbox is up to 600 messages though. I cull stuff out of it periodically, but I haven’t gotten around to *really* attacking it in quite a while. Maybe that’s a project for next weekend!

constraint validation and polyfills

I really like the idea of the constraint validation stuff that’s built in to HTML5. I’ve never actually used it though, since it’s not going to work in older browsers. We tend to use the standard ASP.NET validation controls on most of our projects at work, and they’re certainly usable.

The article I linked to above has a section on a couple of options for polyfills, allowing the constraint validation to work with older browsers, though, so maybe I’ll give that a shot the next time I need to do some serious web form stuff.

Bullseye

The main product of the company I currently work for is a hosted store locator and lead manager service, named Bullseye. We’ve been concentrating on both improving it and marketing it recently, so there’s some fairly interesting things going on that I thought I would write up. I’ve mentioned some of these things previously, but I thought it might be useful to have a single consolidated post with some pointers.

We have a Facebook store locator, which you can find at https://www.facebook.com/BullseyeStoreLocator. The Facebook locator was an interesting project. The first iteration was outsourced to an external developer, and was completed before I started working for the company. Due to some major changes in the way Facebook supported app development, we had to do a lot of work on the Facebook locator in mid-2011. I did a pretty major rewrite of it, using the Facebook C# SDK (which seems to have moved to Github, and gotten a nicely redesigned website since I last looked at it). Since that rewrite, one of our other developers has been working on it, mostly adding new features. The most recent new feature is one that allows you to attach ‘like’ buttons to individual locations in the returned results, linking them to individual Facebook pages for each location. It’s described in a blog post here.

We also now have a Drupal module that allows you to easily implement a store locator in any Drupal 7 site. (I’ve blogged about this previously.) It’s still a sandbox project under my drupal.org account. Cleaning it up and getting it ready to be promoted to a full project is on my rainy-day to-do list. (I’ve done a bit of work towards that goal, but I still need to do some more.)

And we now have a way to import and sync locations from Salesforce into Bullseye. This was another component that was initially outsourced. I’ve done some maintenance work on the project, and it’s pretty interesting. We’ve implemented a way to filter the results that we pull in from Salesforce, using serialized LINQ expressions. I was initially leery about this approach, and there are still some things I don’t like about it, but if you need to abstract out and save complex filter conditions to a database, I guess there isn’t a better way to do it than this. The one difficulty is that it’s fairly difficult to read and comprehend the expressions, once they’re serialized, so it’s important to keep track of the original LINQ expressions, for reference.

CoffeeScript

I wanted to take a break from my usual .Net and Drupal stuff for a weekend, and try to learn something new. So I started reading Jump Start CoffeeScript today. CoffeeScript is a language, somewhat similar to Python in terms of syntax, that compiles into JavaScript. In theory, it makes JavaScript easier to use, and easier to read. I’m not entirely sold on it yet, but it’s interesting.

The book I’m reading is supposed to be a quick start, that you can get through in a weekend. It walks you through a sample application, an HTML5 game. I’m finding the sample code less useful than I’d like. It’s mostly drawing on the HTML5 canvas. I think I’d rather see code doing more typical stuff that you’d see being done on a typical web site. It’s hard to relate the canvas stuff to anything I’ve actually done before.

That said, it’s a pretty well-written book, and kind of fun. I had hoped to finish it tomorrow, but it looks like I need to take a trip into NYC tomorrow, and I’ll have company, so I won’t be reading on the train. And I’m working on New Year’s Eve, but maybe I can finish it on New Year’s Day!

Windows 8 Blues

It’s been a while since I’ve posted about Windows 8. My intention was to upgrade both my desktop and laptop to Win 8. My laptop (a ThinkPad Edge) is now upgraded, but, after several failed attempts, my desktop is still running Windows 7. One thing I can say about the Windows 8 upgrade process: if it fails, it does a great job of restoring back to Win 7. I’ve had, I think, three failed attempts to upgrade my desktop. Each time, the Win 8 installer figured out that things weren’t working out, and got me back to Win 7.

Meanwhile, my laptop has been working fine under Win 8 for several weeks. I used Start8 to get the Start Menu back, and I haven’t used the Metro interface at all, really. I have Start8 set up to take me straight to the desktop when I log in, so I really don’t even look at it.

I did have an issue on the laptop with Windows Updates this week though. Somewhere in the process of installing the most recent batch of updates, something went wrong, and left my machine unable to completely boot up. Win 8 detected a problem, and tried to automatically fix it, but that didn’t work. I used System Restore to go back to a restore point, and that got me up and running again, though there was some residual weirdness after that. I *think* I’m back to a stable state now, with all critical updates installed, but I’m not 100% sure of that.

So, for anyone looking for an opinion on Windows 8:
(1) It’s workable, if you do something the get the start menu back, and ignore the Metro interface.
(2) Upgrades from Win 7 are kind of an iffy proposition, but probably won’t destroy your machine if they fail.
(3) Once installed, it’s no less likely to go south than Win 7 was. (The BSOD looks different now, but it’s still a BSOD.)

Oh, and if you’re looking for some useful advice on  Win 8, check out these posts from Scott Hanselman and Paul Allen.

Amazon Web Services

My boss has gotten enthusiastic about AWS recently. We’ve messed around with a bit with in on a couple of projects, and also just for testing. We used a Linux EC2 instance for the Gisgraphy project I blogged about a while back. And we would up using a dedicated Windows EC2 instance for the gas finder site that we put up after Hurricane Sandy.

In addition to that, I’ve done some experimenting with RDS (for SQL Server) and Elastic Beanstalk. I was initially enthusiastic about both, but, once I got to working with them, I saw enough limitations that I decided to back off. RDS is a nice way to have a low-maintenance SQL Server in the cloud, but the main limitation I found was the inability to easily get a local backup of a large database loaded onto it, and vice versa. While there are ways to get data in and out of RDS, of course, there’s no support for standard SQL backups and restores, to (and from) .bak files. The recommended approach is to script the db out to T-SQL, using the standard export capability, but given the size and complexity of some of our databases, that’s just not workable.

And, as for Elastic Beanstalk, it’s a nice way to get a single ASP.NET application up and running on EC2, with a pre-configured load balancer, but we really don’t have any single site that would benefit from that, and easily fit into that model.

For now, we’ve tentatively decided to move some of our stuff up to AWS, using a few EC2 instances, but really that won’t be much different than what we’re doing now (external hosting on a managed server at PEER1). The main difference will be that we’re planning on breaking some stuff up so that we’ll have a few smaller instances, so we can scale them as needed, and we’ll have the option of spinning up a second copy of the instance running our web service, if needed. I’m not really sure how all this will work out, but I’ll blog more as we go forward, if I learn anything that seems like it would be worth sharing.

Meanwhile, I’ve been watching this screencast series on AWS. Unfortunately, I’ve found that it’s mostly covering ground that I’ve already figured out on my own. But, if you’re new to AWS, and want a guided tour, included a (somewhat leisurely) look at some cloud basics, this might be for you.

My MacBook’s birthday

I was looking at some old notes this morning, and I realized that I bought my current MacBook on December 2, 2007. So, tomorrow will be the MacBook’s fifth birthday!

I had been planning to replace it at the end of this year, but, as I’ve been thinking about it, I may put that off for a while more. It’s still working fine, and I don’t really have anything I need to do that I can’t do on this one.

I’m running OS X 10.7.5 right now, and I know that this machine isn’t supposed to be upgradeable to 10.8 (Mountain Lion). That’s really the only reason I’d feel the need to get a new machine.

Selenium

OK, one more post for tonight. (This is another one I suspected that I may have previously written up, but apparently not.)

I’ve known about Selenium for awhile now, mostly because one of our clients has a “testing guy” and he uses it. I’ve always wanted to be able to do some automated testing of web site projects, but it always seemed like the tools for doing so were too limited or complex. I’ll admit I put off downloading & learning Selenium, largely because I thought it would be a hassle and eat up a lot of time before I could really do anything useful with it. When I finally gave it a chance, though, I was surprised how easy it was to use.

I initially started with WebDriver, which is basically a couple of DLLs that let you “drive” Firefox (or another browser), sending keystrokes and click events, and looking for certain responses. You can get started with WebDriver quickly by grabbing it via NuGet. My first project with WebDriver was a simple console program that launches Firefox, then goes to several of the store locator web sites that use our Bullseye API, does a search at each one, and checks to see if it gets results. Nothing big, but just a useful program that I can run any time I roll out code changes to the API. Previously, I’d been checking this stuff by hand after each rollout.

Today, I took another step, and downloaded Selenium IDE. This is a Firefox plugin that lets you record a series of actions as you do them, then save them to a script. There are plugins allowing you save the script in several languages, including C#. So, I can record some steps, export some C# code, then fix it up to do some reasonable testing. My main purpose today was to record the steps involved in a fairly complex workflow on one of our client sites. It’s a multi-step process (around 20 steps, I think). Just in and of itself, the script is useful to have, as I often need to step through it to establish a new test account, so now I can just “play” it instead of clicking through the whole process myself. But, I would also like to use it to automate some testing of this process. Now that I have a base script, I can go in and replace the values I entered today with variables, so I can abstract things out in such a way that I can run the code repeatedly, testing multiple scenarios. And since I can do this all in C#, I can also then check the database, and see if the values I entered were interpreted and stored in the database correctly.

This may all seem pretty routine to some people, but I have to admit that I’ve never really had a chance to do this kind of testing before. It’s kind of cool!

I think my next project is going to have to be trying WebDriver with browsers other than Firefox.  I’d like to be able to test the same workflow in IE, Firefox, and Chrome, at least. (And if I get really ambitious, maybe I’ll see about iOS browser automation…)

xdebug

I thought I’d written up an entry on Xdebug for PHP a while ago,  but apparently not. (Or, if I did, it’s not coming up when I search for “xdebug” for some reason.) Anyway, Xdebug is a debugging tool for PHP. It’s definitely worth enabling, if you’re doing anything with PHP that’s in any way non-trivial.

It’s a bit hard to figure out the best way to get started with it under Windows. It turns out to be pretty easy, though, given a few pointers. First,  go to the wizard page, and paste in the contents of a phpinfo() call, run on the machine you’re installing to. This will then tell you exactly which file to download, where to put it, and what to add to your php.ini. Much easier than trying to figure that stuff out yourself!

A few other pointers:
– Depending on how you download & copy the DLL over, you may need to unblock it. (Blocked files really annoy me, by the way. I don’t know whose idea that “feature” was, but it was not a *good* idea. See here for some ways to unblock multiple files easily.)
– Xdebug can add color to your var_dump() calls. Add “set html_errors = On” to your php.ini to enable this. I’ve found it to be very helpful when looking at a complex object. (Of course, there’s always krumo for that too.)
– To get debugging working under Komodo IDE, take a look at this document. One thing that was confusing to me was that debugging locally is still considered “remote debugging”.

Also, on a related note, I’m not sure I ever mentioned that, after looking at a few options, I settled on Komodo as my PHP IDE of choice. It’s reasonably fast and easy to use, and the debugger works pretty well. There are a few things about it that I’m not too fond of, but overall, it’s really good.

Drupal Rules

I haven’t blogged in a bit, and I have a few random items I want to write up. I’m doing a lot of work with Drupal, and I’m still learning some little tricks here and there.

When I’m writing custom code, I often use Drupal’s cache. That’s pretty easy to do, with cache_set and cache_get. I recently found myself in a situation, though, where I wanted to clear a certain item from cache any time a user created or edited a node of a certain type.

It turns out to be really easy to do that with the Rules module. Just set up a rule that is triggered on insert or update of a certain node type, and make the action a simple line of PHP code:

cache_clear_all(‘your_cache_key’, ‘cache’);

Easy!