Eduardo Zepeda's latests posts
Categories in Django using ForeignKey to self
- django
- databases
<p>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 ...
Read more
Debounce and Throttle Interactive Explanation
- javascript
<p>Let's do a Debounce vs Throttle. Debounce and throttle are <a class="markdown-link" href="https://coffeebytes.dev/en/python/design-patterns-in-software/">design patterns</a> used to limit the execution of functions, generally they are used to restrict the ...
Read more
How to customize the User model in Django?
- django
<p>In this post I explain three methods to extend or customize Django's <em>User</em> model, without having to rewrite it from scratch, and keeping all <a class="markdown-link" href="https://coffeebytes.dev/en/django/why-should-you-use-django-framework/">Django&rs...
Read more
Differences between Django select_related and prefetch_related
- django
- databases
<p>Django's <em>select_related</em> and <em>prefetch_related</em> methods <strong>are used to reduce the number of queries made to the database</strong>. This translates into response time for each view. In addition, using these methods is one of the <a class="mar...
Read more
Why using React.FC could be a bad practice?
- react
- opinion
<p>When we use Typescript with React and we want to <a class="markdown-link" href="https://coffeebytes.dev/en/react/what-types-to-use-for-react-components-with-children/">pass a children as prop to one of our components</a>, we need to indicate the type. Generally ...
Read more
Go: profiling or basic profiling of CPU usage
- go
<p>In addition to <a class="markdown-link" href="https://coffeebytes.dev/en/go/go-basic-testing-and-coverage/">unit test testing and coverage measurement in go</a>, this programming language is capable of profiling the efficiency of the code by analyzing it in a ve...
Read more
Go: basic testing and coverage
- go
- testing
<p>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.</p><p class="message info"> <span><img width="60" height="60" src="https://res.cloudinary.com/dwrscezd2/image/upload/v1717959563/Go_g...
Read more
Go: race conditions on goroutines and mutexes
- go
<p>In past posts I talked a bit about <a class="markdown-link" href="https://coffeebytes.dev/en/go/go-channels-understanding-the-goroutines-deadlocks/">goroutines, deadlocks and channels</a>. But there is another quite interesting issue about goroutines that stands...
Read more
Go: channels, understanding the goroutines deadlocks
- go
<p>When working with channels there is a quite common error that occurs when you are not familiar with the concepts, the error is “<em>fatal error: all goroutines are asleep - deadlock!</em>”. The first time I saw this error I was perplexed and, although I knew how to...
Read more
Go: use of channels to communicate goroutines
- go
<p>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.</p><p>Imagine you hav...
Read more