In an effort to make this site load as fast as possible I’ve been using tools such as YSlow and PageSpeed. These tools analyze your page and give you insights into how to improve the loading speed. Things such as minifying your files, using compression such as deflate or gzip, putting your js includes at the bottom of the page so that everything else loads first, and so on. I’ve done most of these things and have seen some improvement.
While trying to install
therubyracer gem I ran into a problem where it couldn’t find a debug file and would not build the native extension. Google reported that there is a bug in CLT 6.3 where a file is missing which is present in version 6.2. I couldn’t seem to downgrade because I don’t have a paid developer account so I thought I was stuck. A kind soul on StackOverflow found a workaround.
After two years of taking a step back and trying other things, I’ve returned to the land of the living and have dived head first back into all things technical. Too many years of mediocrity had taken their toll on the passion for programming I once had. First computer when I was three, second when I was eight, first website in ‘96 when I was 18, and first programing job a couple years later. The journey from novice to professional was a quick one.
Not being too familiar with HAML nor how the
group :assets block works in a gemfile, I ran into a wall. Due to my own ignorance I initially theorized the blame must lay with AppFrog but further investigation lead me to where I had gone wrong and how to fix it.
As promised, a blog post detailing the proper way to handle your counter_cache columns.
For my bucket list site I need to know how many goals each user has and of those, how many are completed. Doing this with eager loading is easy but less than optimal. After watching the RailsCast on the subject (#23 Counter Cache Column - RailsCasts), I was intrigued. This seemed like the ideal way to efficiently solve my problem.
When using a blogging platform such as Wordpress, you can typically find a plugin that will do pretty much anything. With Octopress you’re a bit more on your own. Thankfully there are services that assist with much of this. Today I setup an account on IFTTT which stands for If This, Then That. Once you have an account on here, setting up automatic tweets is trivial.
For those running Octopress and wanting to set up a full-text search of their site, something a little nicer than the stock Google Simple Search, Tapir is a valid option. It’s a third party website that indexes your RSS feed and provides search tools against that data-set.
In rails it’s common to add a
validates_uniqueness_of validation to models for any fields that you want to be unique. Most of the time this is sufficient and will catch when a record is submitted that already exists. But what if two submissions come in at the same time? What if a user while registering clicks the submit button multiple times? You could run into a case where rails checks for uniqueness multiple times before the first record has time to be saved in the database, sees that they are in fact, at that point in time, unique, and allows them to go through. The database doesn’t know you want them to be unique so it gladly accepts them, and now your formerly pristine database is pristine no more.
When setting up a new database schema, one is faced with a multitude of choices and decisions that can directly impact both the performance and maintainability of said database. One decision regards Nested Models vs Monolithic Models. What are the differences and why is one better than the other?