Refactored Noise

Time Blocking With A $39 Casio Watch

I have been (unsuccessfully) trying to use the Time Blocking technique endorsed by Cal Newport. Time Blocking is a work productivity technique that involves slicing your day into blocks. These blocks prioritize your most important work for the day. Each block involves deep focus and is basically treated like a meeting for your self. I love the...

Integration Testing in Python Django

We all know that we should write tests to validate the functionality of our Django applications. However, it can be easy to fall into the trap of writing too many tests at the unit or integration level. Having thousands of unit tests is not helpful when the interactions between those units are not tested. To make matters worse, Django does not c...

Mocking My Way Through Python Tests

Mocking is a powerful tool that I like to turn to while unit testing. Python ships with a flexible mocking package in the unittest library called unittest.mock. Mocks can help simplify test setup, allow you to test code that depends on features not yet implemented, and minimize undesired side effects in our test suite. I would like to show you h...

Writing a Chatbot in Django: Part 2

Last time we managed to create a terminal based chatbot with Chatterbot that can understand basic scheduling instructions. Today, we will take that simple terminal application and drop it into a Django application. This will allow us to wrap our chatbot’s functionality within a full fledged web server that can receive RESTful requests. It will a...

Writing a Chatbot in Django: Part 1

While brainstorming Django app ideas, I thought that it would be cool to design a personal assistant chatbot that can schedule appointments based on my availability and meeting time preferences. This would function as a simple chatbot version of Calendly. Ideally this application can even be integrated with a service like Twilio so that users co...

Caching in Django with the Prefetch and Annotate Pattern

At some point you will add a property to a model that triggers an n+1 query. This is when an attribute of an associated table is requested. For each time this happens n additional queries are added to the request. What we need to do is request all of the joined tables as a single request and then reference the fetched data with the joined tables...

From Ruby on Rails to Python Django: Initial Thoughts

I recently made the transition to the Python Django web framework after working with Ruby on Rails for 5 years. Both frameworks are similar but the adjustment to Django was a little more interesting than I expected. What follows is a brief summary of my initial reactions to the Django framework as a Rails developer. Comparing Project File Struc...