Passing on knowledge about software development and related technologies.
While counting records with ActiveRecord seems straightforward, you can quickly experience performance problems if not done properly. In the context of Rails ActiveRecord, the methods for counting records each do it a bit differently. Let's take a look at the three methods available in Rails:
count - When called on an ActiveRecord::Relation object, count will perform a SQL COUNT query, which is very fast, especially on large result sets.
size - Like count, size works differently depending on whether you call it on an ... Continue reading
With users demanding more sophisticated dashboards and reports in this ocean of Data Science and Artificial Intelligence I thought it would be prudent to review how to calculate some basic statistical functionality in Ruby. First, let me point out all the code shown below should work with Ruby 2.7 and above. All the examples are in IRB. I am not here to write your code, but I do want to show you how to do the math in Ruby. Let's get started!
Calculating the Average (Mean)
Unfortunately, Ruby does not provide a native method to generate an average (mean) v... Continue reading
After five years of hard work by the core language team, Ruby 3.0 was released on Christmas 2020 with better performance and other features for this high-level general-purpose programming language.
Why am I writing a review six months later? I wanted to get plenty of "hands-on" time with the new version before commenting on it. Let's get going...
Ruby 3.0 was developed with a focus on better performance, concurrency, and typing and achieved its goal of being 3x faster than the performance of Ruby 2.0. That 3x speed-up is when making use of the new Ruby 3.0 J... Continue reading
I like most of you, are constantly having to create new passwords for sites and applications we use daily. Unfortunately, most of the password generator sites cover you with ads or try to collect info on you to sell. Because of this, I decided to write my own and make it respect everyone's privacy.
I used Rails 6 / Ruby 2.7 / JQuery deployed on Heroku to craft this tool. It has simple use analytics (if you create a simple account) and does not collect identifying info on visitors as I use GoatCounter for my analytics on the site. Check it out and feel free to use this tool I ... Continue reading