Eduardo Zepeda's latests posts
Categories in Django using ForeignKey to self
- django
Grouping by categories is quite common in web applications, from movies, courses or any other resource that presents a hierarchical relationship to another object. In Django there are different ways to model these relationships. Probably, the first that will come to your mind wil...
Read more
Debounce and Throttle in Javascript
- javascript
Debounce and throttle are design patterns used to limit the execution of functions, generally they are used to restrict the amount of times an event is fired: click, scroll, resize or other events. Patterns are not exclusive to Javascript; in a previous post I explained how to us...
Read more
How to customize the User model in Django?
- django
In this post I explain three methods to extend or customize Django’s User model, without having to rewrite it from scratch, and keeping all Django’s user management features But, before we start, let’s see where Django’s User model comes from.
Where do...
Read more
Differences between select_related and prefetch_related in Django
- django
The select_related and prefetch_related methods are used to reduce the number of queries made to the database. This translates into response time for each view. In addition, using these methods is one of the actions to implement to improve the performance of a Django application ...
Read more
Why using React.FC could be a bad practice?
- opinions
- typescript
When we use Typescript with React and we want to pass a children as prop to one of our components , we need to indicate the type. Generally we use the type React.FC, which is short for React.FunctionComponent. With this the Typescript message warning us of a children with type an...
Read more
Go: profiling or basic profiling of CPU usage
- go
In addition to unit test testing and coverage measurement in go , this programming language is capable of profiling the efficiency of the code by analyzing it in a very detailed way. This is quite useful to find bottlenecks or very expensive parts of the code, which are called nu...
Read more
Go: basic testing and coverage
- go
- testing
Go already has a testing module in its standard library that is ready for our use, we just need to import it and use it.
Hey! did you know that I wrote a completely Free Go programming language tutorial?, you can find it directly in the top menu bar or clicking this box. Test...
Read more
Go: race conditions on goroutines and mutexes
- go
In past posts I talked a bit about goroutines, deadlocks and channels . But there is another quite interesting issue about goroutines that stands out when we use asynchrony and there are many functions accessing data at the same time and. Multiple functions reading and writing th...
Read more
Go: channels, understanding the goroutines deadlocks
- go
When working with channels there is a quite common error that occurs when you are not familiar with the concepts, the error is “fatal error: all goroutines are asleep - deadlock!”. The first time I saw this error I was perplexed and, although I knew how to fix it, I d...
Read more
Go: use of channels to communicate goroutines
- go
So far I have explained how to run a goroutine, execute code concurrently with the goroutines and wait for them to finish executing but our goroutines can’t do anything else, they can’t cooperate with each other to speed up the processes.
Imagine you have a web sc...
Read more