• Leaky boat

  • The knowledge gap

    If you are creating software, business processes, or digital content for profit, then you are a member of the knowledge economy and may find this article to be worth your time.

    Read More »
  • The season for code

    It’s currently Dec 24th, 2019 and Santa is getting ready to make his rounds. While presents and overeating are great, this time of year is also a time for reflection, and with that in mind, I’d like to share my thoughts about software development and empathy and hopefully make a convincing argument that having empathy will make you a better developer.

    Read More »
  • Musical Chairs

    Most managers understand that employee turnover can be disruptive and expensive. The cost to recruit, train, and provide a competitive wage is typically one of an organizations highest costs in the knowledge economy. Failure to address employee churn and its many different causes can create a downward spiral. If left uncorrected, the churn rate keeps increasing until the organization becomes a revolving door of employees.

    Read More »
  • How to be a mentor

    I use this blog to organize my thoughts about my professional work, with the intent of helping others organize their thoughts, if they find themselves in a similar position. While much of my work is related to writing code and connecting the technology dots, another large and growing part of my work is centered around technical and career mentorship.

    Read More »
  • Counting on dynamodb

    Recently, some folks at my company Agero starting discussing strategies for pre-aggregating data that could be used for statistical compuation based on business metrics. Specifically, the question came up as to how we could maintain event counts.

    Read More »
  • Who are you?

  • python builder pattern

    After years of ruby and javascript I’ve started doing some work with python recently after joining the team at Agero. One of the first things I noticed was that a lot of folks in the python world pass around a lot of named arguments as a convention. My first example of this is the boto3 library used to interact with AWS in python (for proof, click here)

    Read More »
  • Static asset headers in rails 5

    First things first. Conventional wisdom tells us we should be serving our static assets from something like nginx because it’s optimized for doing such a task. Generally speaking I disagree with that thinking and instead offer a different solution. One should be serving static content out of a CDN and that CDN should be caching your content at edge locations.

    Read More »
  • A gentle introduction to Machine Learning

    I recently completed a great course on Machine Learning, the course is offered by coursera so check it out if you find this article interesting. Until now, I’ve only been a passive consumer of machine learning in my own application development and home life Amazon Echo. As a scientist and engineer, I always knew that some interesting algorithms were crunching data and then making complex decisions behind the scene, but I didn’t really understand the mechanics of that process. I believe writing is a great way to share information as well as solidify one’s understanding about a particular subject and so it is with that reasoning that I write the following article. If you don’t care for understanding how machine learning works but are more interested in why it’s important right now feel free to skip over the details.

    Read More »
  • User permissions using a join table in Rails

    I’ve been mentoring students for the firehose project for close to a year now and one thing that keeps tripping people up is how to allow for a flexible permissions system. To be clear, what I mean by permissions system is a mechanism for tracking who is associated with a particular resource and what their access rights are.

    Read More »
  • The sooner the better - ASAP's passive aggressive cousin

    Hopefully you’ve read my article regarding what I think about the phrase ASAP, if not check it out before you continue.

    Read More »
  • Matrix multiplication performance standard lua vs torch vs ruby

    I decided very recently to re-learn my college linear algebra course with the goal of eventually moving on to deep machine learning neural networks. Additionally, I recently started reading Make it Stick and found many of the arguments compelling for retaining what I’m learning. One of the theories says, “that if you combine multiple subjects and work through practice problems regularly your results will be much better than if you just read a textbook even multiple times”. Thus, I decided that while I’m re-learning linear algebra I would additionally learn how to program in the Lua programming language. This is the product of my work so far. So far, I’m loving lua for it’s simple constructs and speed while offering a more accessible syntax than something like C or C++.

    Read More »
  • Using form_for in rails to filter a data

    Have you ever wondered how to filter data for admin users in a rails app? If so, I present a reasonble way of doing it, such that you can use your existing form helpers via form_for. At first, filtering data in rails seems simple. You can just create a custom form using the form_tag helper right? The problem with using the form_tag helper is that once you are using form_tag you are no longer using a form builder to create the fields in your form. This would not be an issue if you were using the default builder that ships with Rails.

    Read More »
  • ASAP is toxic, avoid it As Soon As Possible

    This is a short rant about ASAP, which translates to, “please, stop whatever you are doing and work on my task instead, and complete it by sometime in the future, but preferably yesterday”.

    Read More »
  • Rails logging with loggly in production

    Logging has become increasingly important for web application developers looking to take advantage of their data to better optimize their marketing and development efforts. Until recently I accepted the way that Rails wrote logs as gospel, not wanting to upset the Rails gods I left them alone in both production and development environments. Until recently….

    Read More »
  • Polymer on Rails, tooling the asset pipeline for performance

    Music Xray is continuing our migration from a jQuery plugin based UI system to a component based UI system. There are many competing frameworks out there including Angular, React, and Riot that help solve the declarative UI problem. We choose polymer for a number of reason. But the biggest reason we chose it, is that it is attempting to be standards based and thus natively supported in browsers. That said, many browsers have not fully implemented the web components specification leading to slow performance on browsers yet to update. The end result is that chrome is blazing fast, firefox is a close second, safari can get slow and IE is the worst offender.

    Read More »
  • Using arel instead of strings in rails 4

    First, what is Arel?

    As I understand it, Arel is the lazy loading sql generation library that backs ActiveRecord or more specifically ActiveRelation. It allows framework developers to reduce coupling between the famework and the sql database by offering a standardized API to generate sql queries. Arel is not an ORM but it can be used to build an ORM (object relational mapper).

    Read More »
  • Quick guide to command line oriented github team workflow

    This is another article inspired by my work at the thefirehoseproject. To be clear, the firehose team does a great job of laying out a team workflow via an advanced git topics module that they provide. This guide is meant for people not taking thefirehoseproject course or for those taking it that want a quick refresher along with some additional tips and tricks.

    Read More »
  • Debugging a resque background job for rails 4.2 using rails console

    As the title implies, this article assumes you are using rails 4.2 and resque for background jobs. I suppose it also assumes that you want to quickly debug a piece of code. To be clear, the best way to make sure your code doesn’t have issues is to make sure you have full test coverage. However, I had a problem recently that my test was saying was working but in production it wasn’t working. The only way I know to fix such a thing is to work through it with a debugger and fix and then write a test that recreates the situation. Hopefully this short tutorial can help you if you find yourself in a similar spot.

    Read More »
  • Do we still need javascript event delegation?

    We (musicxray.com) have been converting many of our UI over to the wonderful new web-components specification via the Polymer framework. With transition to Polymer, we started reducing our reliance on jQuery. jQuery has really great built in support for event handling that’s both efficient and intuitive. With the removal of jQuery I found myself wanting to use “addEventListener” more frequently. To be clear, Polymer does have event delegation, it’s just not the same as jQuery and so takes re-learning things.

    Read More »
  • How to pass instance variables from one object to another.

    I have been doing some mentoring for the firehose project. Recently my student was a bit puzzled as to why she could access an instance variable in a view but not access them in a model after declaring them in a controller. Long story short is that rails doesn’t try to pass instance variables to models (for good reason) so it is not done.

    Read More »
  • amazon product advertising api ruby signing requests

    This week the marketing department at my company decided that they wanted to make a new landing page with a focus on social validation. Social validation means that the advertisement references other people who like the service in an effort to pursuade people that if the service works for these people then it might also work for them.

    Read More »
  • AWS SDK dynamodb web worker

    A while back I decided to start tracking all the song playing data on musicxray.com. Looking for a lightweight solution that wouldn’t impact the performance of our application servers, I decided to send data directly from the browers to dynamodb.

    Read More »
  • Call $.ajax sequentially via jquery deferred's

    This is just a quick tip for anyone searching the interwebs wondering how you can make a bunch of ajax calls on a page one right after another without turning async to false on the ajax request. The problem you see is that if you call $.ajax directly in a for loop or as part of an each statement you will trigger a crap pile of ajax requests all at once. In theory this is a good way to do things. But in practice this could lead to one or more page loads consuming a large amount of server resources and slowing down your app for other users.

    Read More »
  • Ruby retry with timeout

    The following post is mostly code, but hopefully is still easy to follow. The inspiration for this little utility is is that 3rd party API’s can have intermittent network issues and in production you’d be better off re-trying your code once or twice before completely failing and having your users see a 503 or not receiving a notification or something similarly infuriating. Whenever you are making a call over the nextwork, it’s probably good to wrap your code in something like the following. Tests are provided to help the user understand how to use the utility function.

    Read More »
  • FB.init webcomponents.js ie11 InvalidCharacterError

    music xray is in the process of a major overhaul to both our backend and frontend technologies. One move we decided to make was to start using webcomponents. As you may know, web components is not fully supported on every browser. That’s where webcomponents.js comes in. Webcomponents.js attempts to polyfill old browsers until they implement the web components specification.

    Read More »
  • Bypass Strong parameters for a single ActiveRecord model

    Upgrading to rails 4 from rails 3.2 has been pretty smooth with one exception: Strong parameters. Strong parameters is the most current iteration on how rails handles parameters sent from the view to the controller then eventually passed to the model. The idea is that the controller should be in charge of deciding which parameters ultimately make it the model.

    Read More »
  • Zopim custom button

    Recently, I was charged with integrating zopim with musicxray.com in an effort to improve our customer support experience. I must say, the software is really nice and functions about as good as I could have hoped for.

    Read More »
  • Collections of PORO (plain old ruby objects)

    Often times when writing a ruby based application (yes that includes Rails) you end up with a bunch of objects that you would like to treat like an array but with special powers (okay methods). This usually comes up when you want to start asking questions about your array.

    Read More »
  • Selenium testing fixed bootstrap menu (Ruby Driver)

    Recently we decided to implement our website UI using bootstrap 3 as a base. Along with this conversion came some really nice menus on the header and footer of the site. I didn’t think that this change would cause too many issues with our Selenium based testing. Generally speaking, it didn’t, except for one issue. The menu is fixed, so when the selenium driver tries to click on element below the fold of the page it encounters the following error.

    Read More »
  • help: acts_as_list is locking up my database

    The Acts As List gem has been around for a pretty long time. DHH originally wrote it in 2007. That makes the plugin (now a gem) over 7 years old. The fact that I am still using this in production shows just how useful the gem was. Recently (yes, recently) my team and I decided to upgrade a very old rails 2.3 codebase. In doing this move, I started removing plugins from the old plugin directory as they are no longer supported in rails > 4.0. Long story short, we replaced the acts_as_list plugin with the acts_as_list gem. You would think that such a simple gem would work the same from rails 2.3 to rails 3.2. That’s what I thought too…

    Read More »
  • Mushroom hunting 2014 season roundup

    So along with writing software and expressing my opinions about systems architectures. I also love to hike and hunt for wild edible mushrooms. This year I found some pretty great stuff in MA and NH. Here is a quick rundown of what I found this year.

    Read More »
  • Have we learned nothing about the way we deploy software

    Motiviated by this article on techcrunch which states that mobile fragmentation is turning into a nightmare. I want to ask the platform developers out there. Have you learned nothing in the past 10 years?

    Read More »
  • Upsert, a necessity for modern api design

    I’ve had the good fortune of being able to work with a few NoSql databases lately. One feature that they all share in common is that they each provide a really easy way to perform an upsert. An upsert is where you insert a new entry or record if one has not been created else if one has been created you simply update what’s already there with the new values. This is a nice clever trick to remove logic from the application and save some code in the process. Using mongo db, your code might look like the following, without upsert.

    Read More »
  • Meta-programming in ruby with prepend module

    Recently my team and I started using ruby 2.1.1 in production on www.musicxray.com. With this change we now have the ability to use the prepend method inside of our classes. The prepend functionality allows a fairly clean syntax for wrapping existing functionality in custom code in a dynamic way.

    Read More »
  • PORO and Minitest for mocking and stubbing in tests (part1: Dependency injection)

    Let me start by saying I’ve never been a huge fan of rspec. I think the magic it provides shields new developers from learning and understanding how ruby works, learning and understanding is partly what unit testing aims to offer in the first place. Over the years I’ve decided that if a mock or a stub is necessary to test a piece of code that I would simply write it using plain old ruby and where necessary using using Minitest::Mock.

    Read More »
  • Non Coding CTO?

    About 2 years ago I began going on interviews at various software development firms in the Greater Boston Area. I was specifically looking to step down from my position as CTO into a more dedicated software development role.

    Read More »
  • Convert json to a useful ruby object

    In a quest to find the absolute easiest way to create a useable object from a json doc, I read some of the ruby stdlib documentation and like so many issues I’ve come across, I quickly discovered that the briliant ruby community already had a simple solution for me.

    Read More »

subscribe via RSS