Software Development and Asking Good Questions
A resilient tech career isn’t about chasing every new framework - it’s about asking the right question at the right moment. This post shows you how.
A resilient tech career isn’t about chasing every new framework - it’s about asking the right question at the right moment. This post shows you how.
AI isn’t just for writing code faster. I used it to build a custom study plan and wrap my head around some concepts without getting lost in the docs. Here’s how it worked and how you can use it too."
Proactive developers stand out. Not because they wait for tickets, but because they fix problems before they become bigger ones. In an AI-driven world, initiative is one of the most valuable skills you can have.
AI is evolving fast, but that doesn't mean developers are obsolete. History shows that technology disrupts, then improves. The key? Adaptation. Here's how software developers can stay ahead and thrive.
You can style Django forms with Tailwind CSS without Crispy forms or installing any other external libraries. If you already have Tailwind CSS installed in your Django project, all you need is Django’s built-in “widget” feature, more specifically, the attrs field.
The problem During a git merge or rebase, you see the following merge conflict message:
I recently read the book The Software Craftsman: Professionalism, Pragmatism, Pride, by Sandro Mancuso and it highly resonated with me. Here’s an overview of the book with some of the highlights I made while reading it. I hope it piques your interest too.
In this blog post, we’ll explore a way to write unit tests for a Django model using Model Mommy. Our main focus is on the update_dog_from_data function, which updates a Dog object with JSON data. However, the highlight is the technique to dynamically access attribute values in the tested object. By the end, you’ll learn some unit testing strategies and gain insights into dynamically interacting with object attributes during testing.
A while back I wrote about managing local git branches with git rebase and I mentioned that I always submit my code changes with one commit only. No matter how many commits I make during my development process in my local branch when I prepare my code for code review and push it to remote, I squash all commits into one single commit, with one single commit message using git rebase.
There are a few different approaches for writing tests for date and/or time-sensitive functionality. One could choose to add a sleep() in the test, which would guarantee that the time passed, but that also has the downside of increasing the run time of the test.
Here’s an example of adding date and time validation to a DateTimeField in a serializer in the Django Rest Framework (DRF).
As a software developer, I usually self-refer as a “Professional learner” and this book’s subtitle ("What every programmer needs to know about cognition") caught my eye right away.
Existem algumas maneiras diferentes de desfazer as coisas no git, mas para o propósito deste post vamos considerar o seguinte cenário:
If your Python project has a very short list of required packages (in requirements, pipfile, etc), it’s easy to see all packages you have. But on large projects, the dependencies can run pretty long, not to mention the dependencies for the required packages. And what about learning more about those dependencies?
There are a few different ways to undo things in git but for the purpose of this post we will stick with the following scenario:
When you work on a codebase with other people, you need to manage your local branches: you need to ensure that when you push some code and create a merge/pull request on the remote branch, your changes will be easily integrated with the main codebase. And by “easily” I mean preferably without merge conflicts or the dreaded message “your branch is xxx commits behind the target branch”. ?
You are working with an API and after sending a request you receive one of these two HTTP response codes: 401 or 403. What do HTTP status codes 401 and 403 mean?
Most of you might be too young to know this but there was time that the phone in your house - not in your pocket! - would ring and gasp! you had no idea who was calling! You had to ANSWER the phone to find out. :scream:
git is a very useful tool for software development and you only need to know a few commands to get most of the job done. However, you can be a lot more productive if you go beyond the basics.
A few months ago I got a new computer and I have been very intentional about deciding what I install on it. From past experience I know that computers that are used as a development environment tend to get messy in no time since one might install all kinds of libraries, frameworks, dependencies, you name it, and to makes matters worse, you will probably run into version conflicts for any or most of those things. Hardly ever a development environment is a clean environment and I don’t know about you but there are very few things that I find more frustrating than wasting time troubleshooting development environment set up. Let me write the code already!
The context Rails 5 introduced a big change in how it handles ActionController::Parameters (the parameters that you get on your Controllers): before Rails 5, if you called your params you would get a hash back and after Rails 5, you get an ActionController::Parameters object. You can see that by calling params.inspect and if you call .to_h on these parameters you should be good to go.
Se você já programa há algum tempo e não sabe JavaScript ou se está pensando em aprender a programar e não sabe por onde começar, aqui está a minha lista de motivos porque eu acho que você deveria aprender JavaScript (ou simplesmente “JS” no resto desse post):
A few years back when I got serious about learning to program to become a software developer, I remember hearing about version control and getting really confused about git and GitHub (one can add GitLab to this list also!). Are they the same thing? Eventually, I figured it out but this past week in a conversation with a coworker, who is interested in getting into software development, I noticed that they also were confused about this so I decided to write about it.
When I first heard about git bisect I thought it sounded scary and complicated, so I never looked for an opportunity to learn more about it and use it. That’s until last week when I ran into a bug in our master branch. I knew that the bug was not there two days before so I tested an earlier commit and confirmed that that older commit was a good one. Now, we had tens of commits in between. How to find out when exactly the bug was introduced? It would be impractical to check and test each individual commit.
I don’t write much about Rails here but whoa, two posts in a row! Well, it turns out that I thought I should record another lesson I learned while upgrading Rails: how to do it, meaning, what are the practical steps one should take to upgrade Rails?
I was recently tasked with upgrading our Ruby on Rails application at work: my goal was to move two major versions up, with a middle step on a minor version (and a server OS upgrade that was not even planned!). This was an incredible experience and I learned a lot from it. Here are some take-aways I can share:
Learning Go (a.k.a as Golang) was one of my personal goals for 2019 and I chose the book “Get Programming with Go”, by Nathan Youngman and Roger Peppe as my learning resource. Even though there are several other resources out there, I chose this book because they state on their website that “[it] introduces you to the powerful Go language without confusing jargon or high-level theory” and I like to have a physical book to reference to when learning a new code language. Go is also my first statically typed language, so I was looking for something that would walk me through from the very basics.
You want to see line 3842 of file called my_super_long_file.py and you can only access that file using vim. You open the file and to your dismay, by default, vim doesn’t display line numbers. Here are your options:
When I need to create a new custom Docker image, I usually start with a base image (alpine, debian, python, etc, depending on the project), running it in the interactive mode and install the tools and dependencies I will need. Once I get my container the way I want, I create a Dockerfile with all the commands I ran inside my container. It works, but I just learned that this might be unnecessary extra work.
For a text like the following: This is the line I want to move. This line should be the first line. In order to move the first line down, in normal mode* (not edit or insert mode), follow these steps:
Only two steps required (it assumes an existing account in AWS console): Create a Lambda function in AWS Deploy your Lambda function with AWS API Gateway I used these two articles as a reference:
I recently committed an API key to a repository and even worse, I pushed to GitHub before I realized my mistake… 🙁 Removing the key from the code base wouldn’t completely solve my problem since a commit diff would still display my secret key. The solution was to remove that commit from history.
In a previous post I wrote a summary of the things I learned about gRPC. Here I will talk about the prototype app I wrote to test gRPC and gRPC-Web.
I recently spent some time researching gRPC and this post is a summary of what I learned. I also wrote a prototype application to test gRPC and gRPC-Web with Python and JS. The JS client takes a string from user input and test if it’s a palindrome. The code can be found on GitHub and in a future post I will comment on it.
Yes! Indentation, or leading white space at the beginning of a line is required in Python. You can read more about why that is important here. And here is the part of the style guide convention for indentation (PEP 8).
Python has three similar data structures that can hold an unordered collection of elements: list, tuple and set.
In a large web application, the backend logs can get quite verbose: requests created, sent, processed, received, etc. The list can grow large very quickly depending on how logs are implemented.
Note: I’m not being paid or receiving any kind of compensation for this review. TL;DR: This is a very good book. If you are a software developer I highly recommend it!
My primary debugging tool is to add print statements to my programs</confession_time>. Print statements are very easy to use and they work well for any simple scripts. But that’s the catch: if you’re debugging an application and/or a test file, print statements won’t be enough or will just not work (in the case if tests files).
I normally don’t use many shortcuts because it’s easier to just use my arrows and mouse to navigate than to memorize shortcuts but I am slowly realizing that the time spent on learning a new shortcut pays off.
OR: Run a Python script with arguments You can add arguments to the command line when running python scripts by importing the sys module from Python’s standard library and using its argv function.
Given a nested dictionary like this: dog_breeds = { 'Labrador Retriever': {'life_span': 14, 'male_weight': '36 Kg', 'female_weight': '32 Kg'}, 'Beagle': {'life_span': 15, 'male_weight': '11 Kg', 'female_weight': '10 Kg'}, 'German Shepherd': {'life_span': 13, 'male_weight': '40 Kg', 'female_weight': '32 Kg'}, 'Jack Russell Terrier': {'life_span': 16, 'male_weight': '8 Kg', 'female_weight': '8 Kg'}, 'Rottweiler': {'life_span': 10, 'male_weight': '60 Kg', 'female_weight': '48 Kg'} } here’s a way to display its content sorted by key:
NOTE: Catch up with the previous posts in this post series: Part 1: Overview Part 2: Application and Transport layers
NOTE: Catch up with the previous posts in this post series: Part 1: Overview The Network Stack has four layers: Application, Transport, Network (or Internet) and Physical. This post will cover the top two layers: Application and Transport and together they help the destination computer identify what type of data it’s receiving through the network.
For some reason grasping the concepts around computer networks has always been hard for me. Not surprisingly, I find that I’m not the only one: many software developers don’t really understand how computers networks… work. All I know is that I send stuff via the internet and my stuff gets where I wanted it to go. But how does that happen? Magic?
NOTE: the steps below assumes you have a Bash shell. If you are using a Unix machine (Mac or Linux) and are not sure what type oh shell you have, it’s probably Bash.
Recently I needed to repeat a series of long~ish commands in the command line but I never quite memorized them so I ended up resourcing to arrow-up-arrow-up-arrow-up </ad nauseum> until I found the command I was looking for.
I wrote a very simple right-to-the-point Docker introduction post if you’re new to Docker. If you want to see your code changes applied right away to a running Docker container, you need to make sure to run the container using the share volumes tag: -v (or --volume).
From Python’s official documentation: “A profile is a set of statistics that describes how often and for how long various parts of the program executed.”
Problem: create a map of the letters and indices in a string. My first approach was to loop over the string using range(len(s)), and checking if the letter exists in the map before adding it:
This past week marked my first anniversary as a full-time software developer. I thought it would be important to stop and reflect on these last 12 months so this is my “Year 1 retro”. You can read more about my background in the ‘About’ page but here’s the TL;DR: I am a self-taught software developer.
Docker has been around for a few years but it sounded too complicated and I never knew exactly what problem it was solving. Only recently I learned about it and started using Docker both at work and on my personal projects.
Here’s a list of the git commands I use most often: git status when to use it: to know what is the status of the files in your branch. It will show what files have been modified, added, removed, committed, etc. A snapshot of your branch’s current situation. It’s super safe because it doesn’t change anything. It just give you… the status. I git status everything, every time.
There are times when a command line output is too long and it’s hard to scroll through all the lines to see the beginning of the stack trace. This usually happens when you get errors and the best way to fix errors is to read the very first few lines to understand what error message you got and where the error is coming from.
Long story short, today I completed 200 consecutive days of writing code. It most definitely deserved a special treat.
UPDATE: At the time this post was published the blog’s name was print(f’{greeting}') What does this blog name mean?