Category: NodeJS

Hey there! I hope you have some fun Thanksgiving plans that include lots of gorging yourself and relaxing. Today’s song is an old favorite of mine.

I’ve been looking for a project for my Tessel2 microcontroller for a few months now. It’s cool because it allows you to program hardware using Javascript, which is my favorite.

With the coming holidays, I’ll be traveling for a few days. Since I’m the proud father of a Betta fish named Rhaegar, I wanted to make sure he stayed alive and happy, so I decided to make him an automatic fish feeder.

Then, I did lots of testing. I needed to make sure the amount of food was consistent in each feeding, which was exceedingly difficult. I decreased the time between feedings and tried both worms and pellets to see which was the easiest to produce consistent results, and ended up with a mixture of both.

Good morning and Happy Friday! I’m back after a little prompting from an old friend.

Song of the day:

Quick life update: I’m living near New York City now, and I’m working as a Senior Software Engineer for a team that writes the software that supports such excellent blogs as Engadget, Huffington Post Australia (more international editions to follow!), and Autoblog, among many others.

I’ve also gotten way into 3D printing, Internet of Things development, and am still doing minor development on my open-source fitness project, PPL.fitness.

Enter stage right:Nightwatch.js. Super simple to set up. I get to use Node.js to simulate clicks, typing, and key presses, and check to see if elements are visible. I also get to check properties of the elements. Plus, it runs against the industry-standard Selenium server.

Though the initial setup took about a day to get my code decently covered by tests, I can now rest a little easier knowing that when I release new feature updates to my software, everything will work.

//this is where we make our actual comparisons to see if everything is working!
client.expect.element(‘#template-container .headline-1 .splash__header’).text.to.equal(‘Automated Testing Is the Best!’);
client.expect.element(‘#template-container .headline-1 .splash__header’).to.have.css(‘font-size’, ’80px’);
client.expect.element(‘#template-container .headline-1 .splash__header’).to.have.css(‘color’, ‘#2D7061’);

client.end();
}
};
[/code]

As you can see, the syntax is really simple!

[code]

expect(elementSelector).to.have.css(style, value)

expect(elementSelector).text.to.equal(value)

[/code]

I am even able to test the type of my remote data store’s JSON schema with it by running AngularJS commands using client.api.execute(command)!

Good morning everybody! I strongly recommend you let this song melt into your ears while you read.

It’s been a busy couple of weeks for me! I’ve been working on a big feature release at work, and in my free time, I’ve also been working on arkWatcher and ojo, two open-source Javascript projects. I ran into an issue with some of arkWatcher’s functionality that I posted to StackOverflow, and ended up getting some excellent guidance from my brilliant coworker Michael Timbrook. He suggested using Reactive Extensions to solve my problem, so I’ve been reading up on it the past day or two. It’s really cool, and builds quite simple functions into complex functions to solve big problems. So far, I’ve found this awesome YouTube video and this guide to help me learn more about it.

In other, non-programming, news, I’ve been swimming a ton lately. I love it, and it’s fun, but it’s made me noticeably more tired and hungry lately, so I probably have to eat more.

Speaking of eating more, check out this breakfast sandwich I custom-ordered at Lucky Donuts and Deli. Two glazed donuts, scrambled eggs, excellent bacon, and bubbly cheese. This was, without a doubt, the most craving-satisfying, stomach-filling, rich, delicious thing I’ve eaten in a long time.

I’m of the firm belief that you have to have a cheat meal once in a while, at least. This near-obscene, perfect sweet-and-salty combination is the cheatiest of all meals.

This month is just flying by, and I still haven’t come up with a Halloween costume. It’s weird – being on the West Coast for the first time, it doesn’t feel like Fall yet, so some part of me is in denial about what time of year it is. But the days are getting shorter. My friends back at home sent me tons of pictures of hail and snow and 20 degree temperatures last weekend, which seems a little early, even for the Northeast, although this week was apparently a gorgeous one. Here in San Diego, it’s been pretty nice with some occasional rain and cool temperatures. Here was the view on my porch this morning:

Yeah, I live next to a freeway. And a construction site. It’s pretty loud sometimes.

Pool’s nice, though.

This month, I really started pushing myself more physically, mentally, and with my work. I’m starting to enjoy and see great benefit from pushing past the limits of my comfort zone and moving as far into the learning zone as I can. I’m working on finding small optimizations that give me more time, and then using that time to get stronger.

The other day, my buddy asked my advice about which things he should prioritize in his life and which he should drop. The problem was – all the items he wanted me to choose from were equally important. The only answer I could give him in good conscience was that he had to do them all. If they’re all critically important items, what other choice does he have?

Sometimes, it feels like we have the barest illusion of choice; really, we have no true choice at all. Sometimes we just have to stay awake later than we want; sometimes we have to concentrate longer and harder, and do more, than we ever thought possible. Sometimes, everything seems to go wrong all at once.

Important in my examination of these ideas is remembering how lucky we are to be given these challenges in the first place. How lucky we are that we have people all around us who’ve gone through similar things! I’m starting to treat each challenge as a gift, a lesson, and a test. A way to glean as much as possible from the brilliant and amazing people around me.

Lately, I’ve been looking into tracing the route of service calls through chained services. Since many companies are moving toward a Service-Oriented-Architecture model, tracing when services are called is a crucial step in debugging. This way, when there’s an issue with a service, we know which one is breaking and causing everyone downstream to fail.

As a quick example of what I’m talking about, I’ve made a simple model:

Service A: returns “Hello”

Service B: returns “world”

Service C: calls A and B, then returns “Hello world”

Now, imagine service B is taking a long time to respond. Service C will be stuck, and we couldn’t be sure whether it was A or B who is causing the problem!

My goal is to get in the middle of those calls to services A and B and attach headers that track when those calls are made. First, I tried digging into my services’ Bunyan() logging modules and adding my interceptors there. Didn’t work.

Instead, after asking around work and on StackOverflow, I’ve decided to make my own NodeJS module that wraps around Request() and handles all of this for developers with them doing a minimal amount of work. Here’s what I came up with: