Concatenating MySQL Results with Group_concat and Concat_ws
Recently, I needed to build a query that would transform data in our database into a format that we posted to ElasticSearch. I’ll use the example of blog posts here since they’re easy for everyone to grasp. Imagine that each post can have many tags and you want one field on ElasticSearch with the tag ids and another field that has the tag names and description. Here’s what the database might look like:
Writing Super Fast Queries in Rails
At work this week I had to speed up a background job that was clogging up our queue. This job aggregates data on records and posts to our Elastic Search index. It was suffering from all kinds of extra database calls. I had lots of fun working on this query! It’s so satisfying to make things fast. Here’s a bit of what I learned about building SQL queries that can get tough with a typical ActiveRecord object.
How to Rewrite git History when Collaborating with Others
I was recently working on a new node project, and while I was first testing things out, I committed the contents of the dist directory to git. Later on, I was getting the project set up with Docker, and I realized I didn’t want the dist in the repo as it would increase the size of the Docker image. Removing files from git is a bit tricky. You can add it to the .
Toronto Sound Prints
A couple years back I collaborated with Sheraz Khan on a couple of art projects. For a while, we had a portfolio site exhibiting our artworks but that domain recently expired. One of the projects we worked on together was called Toronto Sound Prints. I really liked the end product for this project, so here’s a sample of what we worked on. We worked with Ryerson University’s SMART Lab to create visual interpretations of data they collected that correlated sound data with stress in human subjects.
Video Glitch Art in Ruby
This is the text from a talk about my video glitch work on Fido’s Mobile Music Video. Credit for making this kind of work so fun goes to UCNV for creating the AviGlitch Gem. A few months ago I got to work on a music video with Vice Magazine and Fido. When I tell people about this contract, both developers and artists alike ask “How did you get that job?
Developing with Kirby
A year or so ago, I taught myself PHP by way of WordPress. I didn’t consider myself a developer, but I knew how to make things happen. When I learned Ruby on Rails, I was thrilled to realize that I actually understood the basic concepts of programming, and I picked up Ruby really quickly. After learning Rails this winter, I was curious to see how much more I understood about PHP now that I had begun to work with Ruby, so I built a new site using Kirby.
Scraping The City of Toronto's Council Data
I am working with two of my classmates to create an API for the City of Toronto’s City Council data. We’ve spent a lot of time discussing the idea, and this week we got down to work. Why Are We Doing This? A couple weeks back, I was chatting with Matt Elliot about the stories we might find in this data. He had a great example. Checkout the SmartTrack Work Plan from February’s meeting.
Arrays vs Hashes in Ruby
This weekend I created a small, Ruby CRM application that stores contact information. You can check out my code on GitHub. While I was building this app, most people were using an array to store their contact information, but I wanted to use a Hash. I kew that theoretically Hashes are fster than Arrays, but I didn’t know why. Arrays vs Hashes The quick answer is that Hashes in Ruby are more easily accessible than an item in an array.
Optimizing GIFS with FFMPEG
A few months back I was working on an iOS app that delivered GIFs to users. The idea was that someone would visit one of our 3D photo booths, and get an animated avatar created. We could then render animation frames to PNGs using our custom software. The problem was that some of our animations were rather long, so we needed to crunch the gifs down to the smallest possible size.