Join tables in Rails
Let’s say you have a users table and a shows table. A user
has_many shows and a show can
have_many users. You’d need to set up a join table for this.
My reflections as a father to a 9 month old baby
If I don’t write about my experiences as a father while my boy is growing up, it’s almost certain that hormones will take over and I’ll forget how I really felt. Here are some of the themes that came up.
How to ruin your life in your 20s
I’ve lived through my 20s. While I can’t tell you the exact path that will lead you to your destiny, I can list several things that will prematurely trap your life. If you’re aware of these, you’ll have a better chance of avoiding them.
Why I use European Kendamil Baby Formula rather than Enfamil / Similac
My kid was born and I couldn’t find baby formula in stores. It was the US baby formula shortage of 2022. Luckily, I had samples of Enfamil and Similac but they were quickly depleting.
Techniques I use to put a baby to sleep
Here’s what I learned about putting my kid to sleep and the mistakes I’ve made.
Adding Rails references with strong migrations gem
strong_migrations gem prevents large database tables from locking up when running database migrations. The drawback is that instead of running one easy Rails migration, you end up breaking up migrations into three parts.
Essential items for a newborn
If I had to become a first time father again, here are the essentials I’d get for my newborn. I used all the items I list here.
Hear the raw truth from these online parenting communities
While you can ask parents around you about their parenthood experiences, you’ll seldom hear the raw truth. You won’t hear things like — I don’t know if I’d do it again. Or how about — my life has never been the same and I’m depressed. Or how about — it caused my divorce. You’ll mostly hear It’s hard but oh my god, it’s worth it.
Should I have kids? Advice for my younger self
I write this as a Dad with a newborn that is about two months old.
How to maintain your mental health while caring for your newborn
Taking care of a newborn child is difficult. It’s way harder than I imagined. There’s no off switch. There’s no clocking out.
Silly things parents tell new parents
Several parents told me things that I found to be false after having my kid. Let’s explore.
Earbuds keep me sane when babies cry and scream
After watching my few week-old newborn for 7 hours, I was drained. I’m not going to sugarcoat it — I was going through hell as he was fussing, crying, and intermittently sleeping.
Using Typhoeus for API calls in Ruby
I like using Typhoeus for making API calls in Ruby on Rails because the interface is simple. Here’s how I use it.
Prioritize connections with people over companies
All the jobs I’ve held as a petroleum engineer came from direct referrals. After I was laid off from my first job, I filled out a boatload of online applications to work at oil and gas companies.
Why consult your engineers before acquiring a product
Story time — I saw hundreds of thousands of dollars thrown away on a prematurely acquired software product that was eventually killed off.
Applications I use on a Mac
I used to be a Windows guy. I had to switch over to Mac for software development. I disliked iOS. It took about a year of installing the right apps and getting used to the Mac.
If I had to choose a college major again, here’s what I’d do
Bottom Line — Find an online forum for your industry and decide whether the degree is worth your time. You won’t get the whole picture about your industry on a college campus.
Why ask for the salary range as a software developer
I think the advice — the first to give a number loses — doesn’t make sense. Better said — It’s nuanced.
I set my phone to do not disturb for a year — here’s what I learned.
Do not disturb means calls are ignored (except starred contacts). Text messages and alerts are silenced.
Is it worth fighting over tech at your company?
Twelve engineers agreed on a tech stack. Two engineers are fiercely fighting against it. Is the fight worth it?
Don’t leave stale commits in the main branch
The problem happens when several pull requests are merged into main and they aren’t deployed to production right away. A developer comes along and merges their pull request and deploys the main branch to production assuming only their changes were merged.
You are not your code
The code you write today will be killed off in the future. You are not the code you write.
How to transliterate English to Russian in Firefox
Although I can write in Russian, I do not know the Russian keyboard fluently. It takes forever to type in Russian. What if it didn’t have to be that way?
Often I’ll have a boolean value passed in as a string. This means an
if statement will have to look like this:
Use a QR Code to provide contact info
You’re exchanging phone numbers. You have to repeat your phone number and your name and name. Why not simply have the other person scan a QR code that automatically imports your contact info.
Carve out 20% of your working hours for learning
The longer you’re in your career the more you realize how nauseating the following advice is:
- Give it your 110%
- Give it your best
How to add apt packages to Heroku
Is there a Linux package that you want to use in Heroku? In my case, I wanted to use MediaInfo which required an apt package installation. Typically this would be an
apt install mediainfo command on a Linux machine. But how do you do this in Heroku?
Inspect Element for Rails views with xray-rails
All modern browsers have Inspect Element. When I’m working on a Rails page that loads a lot of partials, it’s a pain to hunt down where those partials are located. I wish I had Inspect Element for Rails views.
How I went from an industry-specific to an industry-agnostic career
When I worked in Oil and Gas, I saw guys in their early-60s forced to retire after getting laid off due to downturns.
How much money are other software developers making?
As a software developer — you should know competitive salaries in the industry or else you might end up underpaid (sometimes severely). Having salary data will also help you ask for market-rate raises.
Please ask stupid questions as a new software developer
But what if they think I’m stupid? Guess what — They don’t expect much from you right now anyway.
How to fix a corrupted usb drive with RMPrepUSB
I tried to create bootable usb drives and all three attempts failed. When I went to reformat the drives, windows did not recognize them.
How to apt install any package on Heroku
I got stuck when trying to install the mediainfo package through
apt install mediainfo. Using buildpacks failed and the solution was to use heroku-buildpack-apt.
Install oh-my-zsh to replace bash on a Mac
Plain old bash works but oh-my-zsh color codes folders from files. It also has git integration and shows what git branch you’re on.
Stop labeling yourself a junior developer
I was defeated before I even started interviewing. I gave myself a junior software developer title. The defeat was self-imposed.
Why aiming for the top 20% is good enough
I’m not the best at anything and that’s a strength.
Don’t let originality paralyze your creativity
The problem is sitting down to write and thinking I have nothing original to say. You start a blog and a few weeks later you forget about it. Someone told you that original thought is a prerequisite for creative work.
Changing git commit date
At times I forget to commit my changes until days later. I prefer these commits show an accurate commit date of when the work was actually done.
Writing good git commit messages
I’ve written crappy commit messages in the past and I’ve picked up a few tricks over time that help me write helpful descriptions.
Ira Glass on the gap between ability and taste
Ira Glass is the producer of the radio and television series “The American Life”. His take on bridging the gap between taste and ability deeply resonated with my own journey with writing.
Precision vs Scale in SQL
When I set a table column to decimal, I tend to forget the difference between precision and scale.
Resetting the primary key sequence (row count) in Rails
If you import data into a Rails project manually, you’ll see that the primary key count in Rails might be off. For example, running
User.last doesn’t show the last row in the User table.
Revisiting product management vs software development
It’s been close to three years since I moved away from full-time product management.
Using Redis as Rails Cache
Once you have Redis set up as a Rails cache backend for your project, here’s how you can explore it in the Rails console.
The self-documenting code myth
Document your code so that the next poor developer that has to extend it or fix it will be thankful you did.
Writing a descriptive motd
Have you ssh’d into a production server and had no idea what to do next? For example, I ssh’d into a production Rails server but didn’t know how to access Rails console. It wasn’t straight forward. I was met with a black screen and a white cursor.
Exporting to a CSV from Postgresql
I had to run a query on a Postgresql database in production and export the data to a CSV file. I couldn’t use Postico.
Extracting video metadata with Ruby and Mediainfo gem.
I had to come up with a way to extract video metadata for work. I found Mediainfo to be a great fit.
Use less -S to avoid wrapping in the terminal
When I run
docker ps to look at docker containers, the results are typically wrapped and are hard
to read due to too many displayed columns.
How to deploy multiple websites on one server with Docker and Nginx Proxy Manager
Did you know you could launch multiple small websites from the same server and keep them isolated from each other? Plus, you could link them to multiple domain names / subdomains and apply free SSL / TLS from Let’s Encrypt.
Deploy Wireguard VPN in Docker
Most VPN setups assume that the entire server will be dedicated to the VPN. By using docker containers, I can run a vpn and other applications all on one single server.
NCDU for disk usage in Linux / Mac
NCDU is my primary tool for figuring out what is taking up space on my Linux servers and Mac machine.
Why learning IDE shortcuts is worth it.
I lost significant productivity by relying mostly on the mouse rather than the keyboard. A few days ago, I took a few hours to ‘sharpen the saw’ and find out how other people use RubyMine (IntelliJ IDE) in their workflows.
Avoiding bundle exec in Ruby
When I mix multiple projects in the same Ruby environment, I end up with different versions of the same gem.
How to pass foreign keys to Rails strong params.
We have a project and a project can have many tasks. Let’s say we have a task form where a user can specify the project the task belongs to. How do you pass the project foreign key through Rails strong params?
New feature? Make a new slack channel.
Why do we strive to write DRY (do not repeat yourself) code but fail to apply that technique in communications?
Why move private slack messages to public channels as a software developer.
Bottom line — Manage your time and priorities. If you don’t, someone else will and you won’t like it. Keep your work public and visible within your team. Resist doing hidden work at the expense of your priorities. You ain’t gonna get credit for it.
OOP Dependency Injection with a car example
I’ve been listening to more of Sandi Metz presentations and reviewing notes from her book Practical Object Oriented Designs.
How to backup and restore a postgresql database
Here’s why you might want to do this:
How to use RVM as a Ruby Version Manager
This is the article I wish I had when I started software development with Ruby.
How to extract information from interview rejections
Bottom Line - Ask for feedback after your rejection. Find the common threads, fix them, and get better at the interview game.
How to iterate less on code reviews
Bottom Line - Don’t involve the reviewer prematurely in product management / feature iterations.
Intermediate Debugging Ruby on Rails with Pry
I use Pry on a daily basis while writing / debugging code. I want to show you how to go beyond a simple breakpoint with pry. I’ll show you how I use it to learn about unfamiliar code and how to debug code.
How to kill a rails server
I can’t be the only one who occasionally tries to start
rails server and gets:
Practicing SQL through examples.
Bottom Line - Practice SQL by solving real problems.
How to make good pull requests
Bottom Line - Don’t waste the reviewer’s time. Don’t make them over-think about things you should have provided ahead of time in the pull request description.
How Ruby on Rails Forms and Nested Forms Work.
Forms are a huge part of a dynamic website. It’s through forms that you take user input and do something with it. It’s worth taking time to understand how to build different types of forms with rails.
Tips on importing fonts in Ruby on Rails
I had a problem where fonts were loading fine in development environment but were failing to load in staging / production.
How HTTP Request / Response Works
To know how the internet works, we looked at how the HTTP protocol worked. Let’s take a look at the two parts of HTTP: Request and Response.
How to use the Command Line Interface
Becoming a software developer forced me to learn the command line interface. At first, I strongly resisted. Coming from windows GUI — the command line looked like an ugly remnant of 1980s computing.
How Objects Work in Object Oriented Languages — Ruby Edition.
It took me a while to comprehend how objects worked in Ruby. If I had to explain it to my younger self again, here’s how I would do it.
How to setup Wireguard VPN from a private VPS.
Bottom Line — using a VPN is great for online privacy. Hosting it on a VPS ensures your IP won’t be blacklisted. It’s easy to setup with an automated script.
How to find out if software development is worth switching to
After switching from petroleum engineering to software development, I have folks ask whether they should do the same.
Parable — BS is not enough.
A turkey was chatting with a bull.
How to overcome the imposter syndrome through teaching.
Bottom Line — Imposter syndrome will kill your self-confidence in your craft. The solution is to teach your craft. Teach through writing or video work. You don’t have to be an expert to begin.
Use video backgrounds during video calls
Bottom Line — With a video background, I could move around and other people can be behind me without being seen on video.
Why specify ruby version in your gemfile
Bottom Line — Specify a ruby version and RVM will automatically switch when you open different projects.
Why I switched careers from Petroleum Engineering to Software Development
Bottom Line — My heart wasn’t in it. The cyclical downturns got old. I jumped to software. No regrets about starting with petroleum engineering.
How HTTP Works
The internet is made up of millions of interconnected computers that send and receive messages. That’s it.
How I stack skills to overcome the scarcity mindset.
Bottom Line — Worried about being replaced? If you stack your above average skills, they’ll be worth more than the value of a single highly valued skill. Here are examples where stacked skills helped me overcome fierce competition.
Why I switched from wordpress to Jekyll (Static Site)
Bottom Line — My blog is meant for writing. A Jekyll static site allows me to write with ease and avoid friction I experienced with WordPress.
Fix GitHub missing green boxes on commits
When I setup a new development environment, I’ll commit my code to GitHub but the green boxes won’t show my contribution for that day.
Using Ajax in Rails Forms
Ruby nil, && operand, and no method error
I wanted to show a link in a Rails application based on whether a person was
Using HAML in Rails Helpers
Using HAML in Rails views is great because its more succinct than ERB.
Interact with JQuery from the browser console
I recently stumbled on this technique where you can load JQuery for ANY page and write JQuery commands right in the browser console. This is great for debugging and exploration.
Cleaning data and writing 14,000 rows to the database
I needed car data for a Ruby on Rails project. I found a GitHub repository where someone generously shared 14,000 rows of car model, makes, and year.
Troubleshooting undefined method error when updating database rows
Sometimes I need to make changes to a Ruby on Rails table in production.
How to submit PDUs to PMI to renew your PMP
Here’s exactly how I submitted my PDUs to PMI to renew my PMP (Project Management Professional) certificate in 2020.
Drop big rocks in the Jar first
This analogy is about putting important things first. This is a good analogy that sticks in my head. It comes from Stephen Covey.
How objects send messages in Ruby
If you open IRB (interactive ruby) and type in the following expression
2 + 3, you’ll get
5. If you reverse that with
3 + 2, you’ll still get
Review: Pragmatic Studio Rails I Course
I finished Pragmatic Studio’s Rails I course and it gave me the skills to build a CRUD Rails app from scratch. That speaks volumes about how great this course truly is.
Why skip testing if you’re new to software development
Doing Test Driven Development (TDD) and learning Ruby simultaneously is a problem for brand new developers.
How to install RubyMine and setup a Ruby environment on Linux
You’re going to need a text editor to write Ruby. Although there are many options I prefer using a dedicated Ruby IDE such as RubyMine because it comes with debugging and autocomplete.
ASDF VM Version Manager for Ruby Tutorial
Bottom Line — You’ll need a Ruby version manager if you plan on working with Ruby and Rails.
How to Run Ruby on Windows 10 with VirtualBox
It’s hard enough to learn a new programming language by itself and it’s miserable when you run into avoidable system errors.
How to hide your online traffic with a VPN.
Post Updated on October 2020.
Myth of the 5 year roadmap in software
Bottom Line — 5 year roadmaps are as successful as fast weight loss programs.
The heroes journey in a MuckFEST 2018 obstacle course
I went to MuckFest MS 2018 5K obstacle course in Denver. It was my third time running it. A friend, my girlfriend, and I went together and were part of a bigger team of at least 20 people that started the run at 9 am.
You don’t need to boil the ocean to make a hot cup of tea
Bottom Line — You don’t need to be as ambitious as Bill Gates to have a worthwhile life.
Everybody wanna be a bodybuilder — nobody wants to lift heavy ass weights
When I heard Ronnie Coleman — an eight time Mr. Olympia Champion — utter these words, I was dumbfounded by the profoundness in one single sentence.
What knuckles taught me about life’s peaks and valleys
Bottom Line — I look at my knuckles often to remind myself that this hard moment — It too, shall pass.
Make PowerPoint file size 4 times smaller
Bottom Line — Your powerpoint file doesn’t need to be 100 megabytes. You can quickly batch compress images within it to a reasonable size.
How using a voice recorder helps me generate creative ideas
Bottom Line — Ideas come to my head randomly. If I don’t jot them down, I forget them. I use a voice recorder app to collect them and transcribe them later. That’s how I generate creative ideas and reduce the stress of having to remember a lot.
Fedor Emelianenko on Life, Sport, and Fitness
Fedor “The Last Emperor” Emelianenko is a Russian MMA fighter. There’s no doubt he’s a great fighter, but that’s just one piece that makes up his total package.
A simple guide to getting high credit scores
Bottom Line — Life is easier when you have a solid credit history. Start building it sooner rather than later. Here’s how to do it.
How I failed physics and started teaching it
Bottom Line — I initially failed physics. Here’s how I made my come back and ended up teaching physics to others.
Too cool for earplugs, too deaf to hear.
Bottom Line — Our generation will have a record number of those who will be hard of hearing. It’ll be our own fault. Use ear plugs!
On Traveling Anxiety
It’s easier to sit in one spot rather than get up and do something different. That one spot is familiar and it is safe. A soldier friend of mine told me that during his time in the military, his unit would move locations as often as every 48 hours. His unit lived and breathed with the ability to change their location often.
Specialization is for insects — or why knowing a lot matters.
A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.
Why I love Cold Showers (Restoring Will Power)
Bottom Line — Cold showers will jolt you out of a funky mood. I take them from time to time.
Permission to give up on dreams
Only losers give up on their dreams, right? Common wisdom says to persevere, fight, and to never give up on your dreams. But what if the dream you have is someone else’s or no longer makes sense to you?
On Freedom of Time
While visiting Mexico in May 2016, I found out that a normal work week consists of 6 working days at 8 hours per day. In the US and Europe, we typically have 5 working days, 8 hours per day. I might be spoiled but sometimes two days are not enough. Imagine only having 1 day off. Imagine not having any days off. It’s nerve-racking unless your full-time work is what you feel strongly about. If it’s not, then do you have enough time to engage with projects that you feel destined to do? That’s where freedom of time is an important asset.
Life is a multi-laned highway
I was driving to work on I-25 and a realization hit me as I was switching lanes. I noticed that during my 25 mile drive, I’ll switch lanes several times before arriving at the destination. You probably do the same thing. So what? It can teach us a thing or two about looking at life. Let’s look at some scenarios.
Why you’re afraid and the Amygdala
I stumbled upon a really great video that went into describing how the Navy Seals train their troops to handle high stress situations. They have a unique approach which is focused on exposing the soldiers to fearful situations, and having them react in a sensible matter. I highly recommend watching the video below, but if you’re short on time, I’ll summarize some of the things I got out of it:
The comfortably numb trap
I went to Mexico in May 2016. One of my best friends was getting married, and I went down to attend the ceremony and also to get away and relax for a week. I booked an all inclusive resort that was really a dream to stay at. All inclusive includes breakfast, lunch, dinner, and entertainment. Everything is done for you; you are there to relax.
On lending money and minimizing the chances of getting screwed.
Bottom Line — Here’s what I learned about lending money and how to minimize the chances of getting screwed.
Scarface — The Rise and Fall of Tony Montana
I watched Scarface (1983) several years ago and thought that it was just a violent action movie. I didn’t give it a second thought and was satisfied with just watching it once. I saw it on Netflix and decided to give it another chance. This time around, the movie had a deeper meaning to me and it wasn’t about the violence and the 1980’s drug wave, but it was instead a deeper look into human nature. I’m not sure if that was the intention that Brian De Palma and Oliver Stone had when making this movie, but this is what I felt.
What is a reliable car and how to find one.
Gist: I bought 3 cars for people in 2 years. It might be pretty but it’s going to cost you an arm and a leg in repairs. Research and get a dependable vehicle.
How I renewed my PMP certification
Bottom Line — You don’t need to spend money on courses to renew your PMP certification. Here’s exactly how to do it on the cheap.
PMP Exam Lessons Learned
Bottom Line — I took the PMP exam in 2015. Not much changed today in the exam world in 2020. Here are all the strategies I used to pass the exam. Here’s what I would teach my younger self.
Getting started with wet shaving
Bottom Line — Tired of using triple blade blades? You don’t have to. Here’s how you can shave just like your grandfather did.
Clearing your mind with closed-eye walking meditation
Bottom Line — Close your eyes and pace a known room. My mind stops thinking and relaxes.
Why public speaking builds effective communication
Bottom Line — Speaking skills will greatly amplify your other skills. Here are examples from my life and the lives of others.
Using Jade (Pug) to preprocess HTML
Bottom Line — Pug makes HTML tags look a lot less messy.
Smaller image files with TinyPNG
Bottom Line — “Don’t be that person who uploads a 10mb thumbnail image. Compress it!”
What handstands taught me about life
Bottom Line — Handstand progress is not linear. Neither are learning other skills in life. I don’t want it to be that way but that is the way it is.
Each hour of sleep before midnight is worth two
Over time, I’ve noticed that if I go to sleep closer to 10:30 pm, and sleep until 6:00 am (7.5 hours total), I wake up feeling refreshed in the morning. If I go to bed closer to 12 am, and sleep until 7:30 am, I have a harder time waking up and have a greater propensity to continue sleeping. The total time spent sleeping stays the same at 7.5 hours, but the time intervals change. Let’s take a closer look.
Why you sleep poorly after bright screens at night.
Bottom Line — Get f.lux / night mode on your PC / tablet / smartphone.”
No perfect time to call — do it now!
Bottom Line — There is no perfect time to call someone. When you think about calling that person, just call them and stop over thinking it.
Use larger font size for readability
Bottom Line — Content begs for easy readability. Think about if your text size is too small and therefore hard to read for the average reader.
Parkinson’s Law — Questioning Procrastination
Bottom Line — If you give yourself 3 weeks to do a project, you’ll start it on the last day and finish it in a few hours. That’s Parkinson’s Law.
Improve your public speaking skills with Toastmasters
Bottom Line — Speaking and presenting is an underrated skill. Toastmasters is a cheap and effective way to work on it. It will greatly enhance your other skills.
Why get a custom domain (www.yourname.com) to control your brand.
Bottom Line — With a custom domain, you have a better chance of ending up on the first page of search engines instead of your facebook page.
What does your email address say about you?
Bottom Line — Using firstname.lastname@example.org or email@example.com is a bad idea. Skip the stereotypes.