<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>rhymes.dev</title><link>/</link><description>Recent content on rhymes.dev</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sun, 24 Jul 2022 20:45:18 +0000</lastBuildDate><atom:link href="/index.xml" rel="self" type="application/rss+xml"/><item><title>How to save memory with Celery using Redis as a backend</title><link>/posts/how-to-save-memory-with-celery-using-redis-as-a-backend/</link><pubDate>Sun, 24 Jul 2022 20:45:18 +0000</pubDate><guid>/posts/how-to-save-memory-with-celery-using-redis-as-a-backend/</guid><description>&lt;p>If you&amp;rsquo;re working a Python web app, there&amp;rsquo;s a good probability you are using &lt;a href="https://docs.celeryq.dev/en/stable/" class="external-link" target="_blank" rel="noopener">Celery&lt;/a> (or &lt;a href="https://python-rq.org/" class="external-link" target="_blank" rel="noopener">RQ&lt;/a>) to offload work to a background queue.&lt;/p>
&lt;p>In its simplest form a Celery unit of work (task) looks like this:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="nd">@app.task&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">def&lt;/span> &lt;span class="nf">hello&lt;/span>&lt;span class="p">():&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">return&lt;/span> &lt;span class="s1">&amp;#39;hello world&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>A regular Python method, with a decorator to declare it as a task and a(n optional) return value.&lt;/p>
&lt;p>Celery runs at least one worker process, which asks the broker (the queue transport) for the next task to process and optionally stores its result in what Celery calls a &amp;ldquo;backend&amp;rdquo;. Celery supports a combination of brokers and backends, though the most popular options are respectively RabbitMQ and Redis.&lt;/p></description></item><item><title>How to combine Rails's Ajax support and Stimulus</title><link>/posts/how-to-combine-rails-s-ajax-support-and-stimulus/</link><pubDate>Fri, 27 Aug 2021 15:03:18 +0000</pubDate><guid>/posts/how-to-combine-rails-s-ajax-support-and-stimulus/</guid><description>&lt;p>In this post I&amp;rsquo;m going to explain how we are exploring adding snappier SPA-like interactivity to the Admin and what we&amp;rsquo;ve learned so far. I am using the word &amp;ldquo;exploring&amp;rdquo; because this is ongoing work, that is not visible yet in Forems, so it many or may not reflect the final version but I think there are useful lessons to be learned nonetheless.&lt;/p>
&lt;p>I&amp;rsquo;m going to assume you&amp;rsquo;re familiar with &lt;a href="https://rubyonrails.org/" class="external-link" target="_blank" rel="noopener">Ruby on Rails&lt;/a>, &lt;a href="https://stimulus.hotwired.dev/" class="external-link" target="_blank" rel="noopener">Stimulus&lt;/a> and the concept of &lt;a href="https://en.wikipedia.org/wiki/Component-based_software_engineering" class="external-link" target="_blank" rel="noopener">componentization&lt;/a>.&lt;/p></description></item><item><title>How to wrap a Preact component into a Stimulus controller</title><link>/posts/how-to-wrap-a-preact-component-into-a-stimulus-controller/</link><pubDate>Thu, 24 Jun 2021 13:51:54 +0000</pubDate><guid>/posts/how-to-wrap-a-preact-component-into-a-stimulus-controller/</guid><description>&lt;p>In this post I&amp;rsquo;m going to illustrate the following:&lt;/p>
&lt;ul>
&lt;li>wrapping a Preact component inside a Stimulus controller&lt;/li>
&lt;li>loading Preact and the component asynchronously on demand&lt;/li>
&lt;li>communicating with the wrapped component via JavaScript &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent" class="external-link" target="_blank" rel="noopener">custom events&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>This is partly based on work &lt;a href="https://dev.to/s_aitchison" class="external-link" target="_blank" rel="noopener">Suzanne Aitchison&lt;/a> did &lt;a href="https://github.com/forem/forem/pull/12511" class="external-link" target="_blank" rel="noopener">last February on Forem&lt;/a>. Forem&amp;rsquo;s public website uses Preact and vanilla JavaScript. Some of Forem&amp;rsquo;s Admin views are using Stimulus. This is an example of how to recycle frontend components from one framework to another.&lt;/p></description></item><item><title>How to build unique indexes in PostgreSQL on large text</title><link>/posts/how-to-build-unique-indexes-in-postgresql-on-large-text/</link><pubDate>Thu, 28 May 2020 12:15:24 +0000</pubDate><guid>/posts/how-to-build-unique-indexes-in-postgresql-on-large-text/</guid><description>&lt;p>As I believe a relational database schema should be as independent as possible from the apps using it, &lt;a href="https://github.com/thepracticaldev/dev.to/pulls?q=is%3Apr&amp;#43;author%3Arhymes&amp;#43;%22unique&amp;#43;indexes%22" class="external-link" target="_blank" rel="noopener">I&amp;rsquo;ve been trying to strengthen the DEV&amp;rsquo;s database a bit lately&lt;/a> (there are exceptions to this rule but they are not for this post).&lt;/p>
&lt;p>One way to do that is to make sure that Rails model statements like this:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-ruby" data-lang="ruby">&lt;span class="line">&lt;span class="cl">&lt;span class="n">validates&lt;/span> &lt;span class="n">username&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="ss">uniqueness&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kp">true&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>correspond to actual &lt;a href="https://www.postgresql.org/docs/11/indexes-unique.html" class="external-link" target="_blank" rel="noopener">unique indexes&lt;/a> in PostgreSQL.&lt;/p>
&lt;p>Two reasons for that:&lt;/p>
&lt;ul>
&lt;li>let the DBMS do its job, it was built to check constraints&lt;/li>
&lt;li>data can &amp;ldquo;get in&amp;rdquo; from all sort of ways (throwaway SQL scripts for example)&lt;/li>
&lt;/ul>
&lt;p>Even if today your database is used only by a single app, you might have more than one in the future and adding indexes on existing tables or having to clean duplicate rows in large tables is always a bit of a pain (because of locking, I might write another article about that..).&lt;/p></description></item><item><title>What can we learn from rewrites?</title><link>/posts/what-can-we-learn-from-rewrites/</link><pubDate>Mon, 25 Feb 2019 17:26:58 +0000</pubDate><guid>/posts/what-can-we-learn-from-rewrites/</guid><description>&lt;p>Rewrites are a classic argument in software development. Every software architect at some point ponders over the existential question: &lt;em>Should I rewrite this app?&lt;/em>&lt;/p>
&lt;p>As always, there&amp;rsquo;s no universal answer to the question.&lt;/p>
&lt;p>I finished reading quite a long article titled &lt;a href="https://medium.com/@herbcaudill/lessons-from-6-software-rewrite-stories-635e4c8f7c22" class="external-link" target="_blank" rel="noopener">Lessons from 6 software rewrite stories&lt;/a>.&lt;/p>
&lt;p>In it the author, &lt;a href="https://twitter.com/herbcaudill" class="external-link" target="_blank" rel="noopener">Herb Caudill&lt;/a>, analyses six different famous rewrites that had different premises and outcomes. I really liked what he did and I&amp;rsquo;d like to use it as a basis for further the discussion here on DEV.&lt;/p></description></item><item><title>You don't need to know everything (but you should know something well)</title><link>/posts/you-dont-need-to-know-everything-but-you-should-know-something-well/</link><pubDate>Sat, 05 Jan 2019 18:49:27 +0000</pubDate><guid>/posts/you-dont-need-to-know-everything-but-you-should-know-something-well/</guid><description>&lt;p>&lt;a href="https://mobile.twitter.com/dan_abramov" class="external-link" target="_blank" rel="noopener">Dan Abramov&lt;/a> recently published a couple of posts that made me think considerably. I regard these two posts as precious gifts. Let me tell you why.&lt;/p>
&lt;p>In the first one, &lt;a href="https://overreacted.io/things-i-dont-know-as-of-2018/" class="external-link" target="_blank" rel="noopener">Things I Don’t Know as of 2018&lt;/a>, he lists technologies and topics he knows little about or none at all. I&amp;rsquo;m not going to list them here because it would be beside the point.&lt;/p>
&lt;p>Many developers struggle with the mythical manifestation of the omniscient programmer, those who inhale all the cool technologies (present, past and future). This myth probably arises from a combination of fluctuations in self esteem, peer pressure, unrealistic expectations, buzz wording as a sport, boisterous &amp;ldquo;ninjas&amp;rdquo; of software, aggrandized job ads and more. Going down that path either results in burn out or a progressive disappearing of one&amp;rsquo;s social life.&lt;/p></description></item><item><title>A big rewrite</title><link>/posts/a-big-rewrite/</link><pubDate>Tue, 18 Dec 2018 17:09:14 +0000</pubDate><guid>/posts/a-big-rewrite/</guid><description>&lt;p>Folklore and common sense warn developers and teams against doing big rewrites.&lt;/p>
&lt;h2 id="to-do-or-not-to-do">
 To do or not to do
 &lt;a class="heading-link" href="#to-do-or-not-to-do">
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading">&lt;/i>
 &lt;span class="sr-only">Link to heading&lt;/span>
 &lt;/a>
&lt;/h2>
&lt;p>There are many reasons not to rewrite apps from scratch:&lt;/p>
&lt;ul>
&lt;li>rewrites take time&lt;/li>
&lt;li>the &amp;ldquo;legacy&amp;rdquo; app still needs to be supported and probably debugged&lt;/li>
&lt;li>rewriting the same exact app hoping to change the outcome could be an early sign of madness&lt;/li>
&lt;li>requirements will definitely change from when you start to when you finish&lt;/li>
&lt;li>the company already paid for the &amp;ldquo;legacy&amp;rdquo; app, now you want it to pay for the same thing twice&lt;/li>
&lt;li>management will probably be hard to convince&lt;/li>
&lt;/ul>
&lt;p>If the rewrite is justified though, there are some positive aspects:&lt;/p></description></item><item><title>How to make Python code concurrent with 3 lines</title><link>/posts/how-to-make-python-code-concurrent-with-3-lines-of-code/</link><pubDate>Fri, 23 Nov 2018 20:05:51 +0000</pubDate><guid>/posts/how-to-make-python-code-concurrent-with-3-lines-of-code/</guid><description>&lt;p>I was inspired by Ryan Palo&amp;rsquo;s &lt;a href="https://dev.to/rpalo/defaultdicts-never-check-if-a-key-is-present-again-5hlp" class="external-link" target="_blank" rel="noopener">quest to uncover gems in Python&amp;rsquo;s standard library&lt;/a>.&lt;/p>
&lt;p>I decided to share one of my favorite tricks in Python&amp;rsquo;s standard library through an example. The entire code runs on Python 3.2+ without external packages.&lt;/p>
&lt;h2 id="the-initial-problem">
 The initial problem
 &lt;a class="heading-link" href="#the-initial-problem">
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading">&lt;/i>
 &lt;span class="sr-only">Link to heading&lt;/span>
 &lt;/a>
&lt;/h2>
&lt;p>Let&amp;rsquo;s say you have a thousand URLs to process/download/examine, so you need to issue as much HTTP GET calls and retrieve the body of each response.&lt;/p></description></item><item><title>Come with me on a journey through DEV's source code by way of a bug</title><link>/posts/come-with-me-on-a-journey-through-devs-source-code-by-way-of-a-bug/</link><pubDate>Tue, 09 Oct 2018 22:02:25 +0000</pubDate><guid>/posts/come-with-me-on-a-journey-through-devs-source-code-by-way-of-a-bug/</guid><description>&lt;p>This article started because I thought that researching a particular bug could be useful to understand devto&amp;rsquo;s source code a little better. So I literally wrote this while doing the research and I ended up writing about other things as well. Here we go.&lt;/p>
&lt;p>The bug I&amp;rsquo;m referring to is called &lt;a href="https://github.com/thepracticaldev/dev.to/issues/821" class="external-link" target="_blank" rel="noopener">Timeouts when deleting a post&lt;/a> on GitHub. As the title implies, removing a post results in a server timeout which results in an error to the user. &lt;a href="https://dev.to/peter" class="external-link" target="_blank" rel="noopener">Peter Frank&lt;/a> in his bug report added a couple of details we need to keep present for our &amp;ldquo;investigation&amp;rdquo;: this bug doesn&amp;rsquo;t always happens (which would be better in the context of finding a solution, deterministic is always better) and it more likely presents itself with articles that have many reactions and comments.&lt;/p></description></item><item><title>I broke login for 80k users</title><link>/posts/i-broke-login-for-80k-users/</link><pubDate>Mon, 10 Sep 2018 17:40:07 +0000</pubDate><guid>/posts/i-broke-login-for-80k-users/</guid><description>&lt;p>Let me start by saying that I&amp;rsquo;m not happy about this :-D&lt;/p>
&lt;p>The following is a post mortem of carelessness, naivety and bad changelogs and upgrade guides.&lt;/p>
&lt;h2 id="what-happened">
 What happened
 &lt;a class="heading-link" href="#what-happened">
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading">&lt;/i>
 &lt;span class="sr-only">Link to heading&lt;/span>
 &lt;/a>
&lt;/h2>
&lt;p>A client of mine has a mobile app with a login that uses &lt;a href="https://www.oauth.com/oauth2-servers/access-tokens/password-grant/" class="external-link" target="_blank" rel="noopener">OAuth2 Password Grant&lt;/a>. It&amp;rsquo;s an app both for Android and iOS.&lt;/p>
&lt;p>We started receiving complaints about users that couldn&amp;rsquo;t login so I went into &amp;ldquo;investigative mode&amp;rdquo; (which lasted the entire day until now).&lt;/p></description></item><item><title>Server to server communication using GraphQL</title><link>/posts/server-to-server-communication-using-graphql/</link><pubDate>Thu, 05 Apr 2018 17:13:58 +0000</pubDate><guid>/posts/server-to-server-communication-using-graphql/</guid><description>&lt;p>The development of the &lt;a href="/posts/seven-days-of-go/" >Go API server&lt;/a> I was &amp;ldquo;documenting&amp;rdquo; a couple of weeks ago has gone forward.&lt;/p>
&lt;p>Since then I added tests (mostly functional), refactored some parts and learnt a bit more about Go.&lt;/p>
&lt;p>The API server is the owner of its own database. Now, for the same app, we&amp;rsquo;re building a frontend web app which for some features needs to talk to the API server and exchange data.&lt;/p></description></item><item><title>Seven days of Go</title><link>/posts/seven-days-of-go/</link><pubDate>Thu, 22 Mar 2018 01:57:46 +0000</pubDate><guid>/posts/seven-days-of-go/</guid><description>&lt;p>The following is a brain dump of everything I&amp;rsquo;ve learned so far using Go, writing the mvp of an app, in 7 days.&lt;/p>
&lt;p>My only previous experience with Go was &amp;ldquo;copying and pasting&amp;rdquo; with what become part of &lt;a href="/posts/adventures-in-traildb-with-millions-of-rows-python-and-go/" >this article&lt;/a> last year.&lt;/p>
&lt;h2 id="what-and-why">
 What and why
 &lt;a class="heading-link" href="#what-and-why">
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading">&lt;/i>
 &lt;span class="sr-only">Link to heading&lt;/span>
 &lt;/a>
&lt;/h2>
&lt;p>I&amp;rsquo;ve been asked by a client to write an API server. The deadline for the MVP was &amp;ldquo;yesterday&amp;rdquo; so I decided, instead of comfortably using Python (and quite frankly taking a little bit less of time) to write it in Go in 7 days.&lt;/p></description></item><item><title>Logging Rails requests with structure and colors</title><link>/posts/logging-rails-requests-with-structure-and-colors/</link><pubDate>Fri, 16 Mar 2018 10:51:42 +0000</pubDate><guid>/posts/logging-rails-requests-with-structure-and-colors/</guid><description>&lt;p>In a &lt;a href="/posts/logging-flask-requests-with-colors-and-structure/" >related post about Flask and Python&lt;/a> I explained how to structure request logs in Python with a sprinkle of colors.&lt;/p>
&lt;p>Rails already has the great &lt;a href="https://github.com/roidrage/lograge" class="external-link" target="_blank" rel="noopener">lograge&lt;/a> but how can we leverage it and add ANSI colors to the strings?&lt;/p>
&lt;p>Fortunately lograge supports custom formatters with:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-ruby" data-lang="ruby">&lt;span class="line">&lt;span class="cl">&lt;span class="no">Rails&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">application&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">configure&lt;/span> &lt;span class="k">do&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">config&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">lograge&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">enabled&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="kp">true&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">config&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">lograge&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">formatter&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="no">YourOwnFormatter&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">new&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">end&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>so I just created a new formatter to add colors like this:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-ruby" data-lang="ruby">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">require&lt;/span> &lt;span class="s1">&amp;#39;colorized_string&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">class&lt;/span> &lt;span class="nc">ColorKeyValue&lt;/span> &lt;span class="o">&amp;lt;&lt;/span> &lt;span class="no">Lograge&lt;/span>&lt;span class="o">::&lt;/span>&lt;span class="no">Formatters&lt;/span>&lt;span class="o">::&lt;/span>&lt;span class="no">KeyValue&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="no">FIELDS_COLORS&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nb">method&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:red&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">path&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:red&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nb">format&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:red&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">controller&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:green&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">action&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:green&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">status&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:yellow&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">duration&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:magenta&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">view&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:magenta&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">db&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:magenta&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">time&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:cyan&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">ip&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:red&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">host&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:red&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="ss">params&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="ss">:green&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">def&lt;/span> &lt;span class="nf">format&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">key&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">value&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">line&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="k">super&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">key&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">value&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">color&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="no">FIELDS_COLORS&lt;/span>&lt;span class="o">[&lt;/span>&lt;span class="n">key&lt;/span>&lt;span class="o">]&lt;/span> &lt;span class="o">||&lt;/span> &lt;span class="ss">:default&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="no">ColorizedString&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">new&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">line&lt;/span>&lt;span class="p">)&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">public_send&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">color&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">end&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">end&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>I admit that color coding each parameter might be a little too much but I&amp;rsquo;m having fun :-D&lt;/p></description></item><item><title>Logging Flask requests with structure and colors</title><link>/posts/logging-flask-requests-with-colors-and-structure/</link><pubDate>Fri, 16 Mar 2018 10:29:39 +0000</pubDate><guid>/posts/logging-flask-requests-with-colors-and-structure/</guid><description>&lt;p>Logging is one of those things on which all developers agree, what we don&amp;rsquo;t agree with is the format.&lt;/p>
&lt;p>You can log using &amp;ldquo;free text&amp;rdquo;, agree on a structure of use full JSON.&lt;/p>
&lt;p>I tend to use a combination of free text and structured logging. My favorite logging library so far is &lt;a href="https://github.com/roidrage/lograge" class="external-link" target="_blank" rel="noopener">lograge&lt;/a> for Rails which funnily enough is described by the authors as &lt;code>&amp;quot;An attempt to tame Rails' default policy to log everything&amp;quot;&lt;/code>.&lt;/p></description></item><item><title>Awaiting for async promises in JavaScript</title><link>/posts/awaiting-for-async-promises-in-javascript/</link><pubDate>Wed, 27 Dec 2017 07:17:54 +0000</pubDate><guid>/posts/awaiting-for-async-promises-in-javascript/</guid><description>&lt;p>&lt;em>This post originated as a comment to &lt;a href="https://dev.to/warrend" class="external-link" target="_blank" rel="noopener">Daniel Warren&lt;/a>&amp;rsquo;s post &lt;a href="https://dev.to/warrend/clarifying-async-and-promises-4h38" class="external-link" target="_blank" rel="noopener">Clarifying Async and Promises&lt;/a> and I decided to repost it as a separate article because it might be useful to others.&lt;/em>&lt;/p>
&lt;p>I was exploring the other day the possibilities beyond the &amp;ldquo;then/catch&amp;rdquo; pattern with promises because to me it still looks like callbacks, neater and cleaner but there has to be a better way, for readability&amp;rsquo;s sake.&lt;/p>
&lt;p>In Python land (see the &lt;a href="https://nodejs.org/en/about/" class="external-link" target="_blank" rel="noopener">Twisted framework which influenced Node.js&lt;/a>) this problem has been already met. In Twisted promises are called &amp;ldquo;deferreds&amp;rdquo; but the issue is the same: cascading callbacks, error handlers, callbacks to your error handlers, sibling callbacks and error handlers can still become a mess to read and understand:&lt;/p></description></item><item><title>Adventures in TrailDB with millions of rows, Python and Go</title><link>/posts/adventures-in-traildb-with-millions-of-rows-python-and-go/</link><pubDate>Fri, 22 Sep 2017 18:31:58 +0000</pubDate><guid>/posts/adventures-in-traildb-with-millions-of-rows-python-and-go/</guid><description>&lt;p>Storing and querying massive quantities of data is a problem not many projects or companies have to deal with but, at some point, if a product is popular and many users find it useful, it could happen.&lt;/p>
&lt;p>You might naturally design your app around a relational database system and use many techniques to scale horizontally or vertical (or both) based on your own requirements and issues.&lt;/p>
&lt;p>What do you do with the event data? It might be collected in batches or in real-time but at the end of the day, what do you do with all this information that belongs to a user?&lt;/p></description></item><item><title>About me</title><link>/about/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/about/</guid><description>&lt;p>Hi, I&amp;rsquo;m rhymes.&lt;/p>
&lt;p>I am an experienced programmer, my pronouns are he/him.&lt;/p>
&lt;p>Most recently in tech I worked at &lt;a href="https://www.blockpartyapp.com" class="external-link" target="_blank" rel="noopener">Block Party&lt;/a> on what is now known as &lt;a href="https://www.blockpartyapp.com/faqs/whats-the-difference-between-block-party-and-privacy-party" class="external-link" target="_blank" rel="noopener">Block Party Classic&lt;/a>, a Django + NodeJS web application with satellite services backed by PostgreSQL, Redis and RabbitMQ.&lt;/p>
&lt;p>Before that I worked at &lt;a href="https://www.forem.com/" class="external-link" target="_blank" rel="noopener">Forem&lt;/a> from May 2019 until October 2021, as Senior and then Principal Software Engineer. I was working as an opensource maintainer and contributing to the entire stack:&lt;/p></description></item><item><title>Work Experience</title><link>/work/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/work/</guid><description>&lt;ul class="company__list">
&lt;li>&lt;span class="company__name">&amp;#x1f3e1; Block Party&lt;/span>
&lt;ul>
&lt;li>&amp;#x1f4bb; Senior Software Engineer&lt;/li>
&lt;li>&amp;#x1f310; Remote (US hours)&lt;/li>
&lt;li>&amp;#x1f5d3;&amp;#xfe0f; June 2022 to March 2023&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;span class="company__name">&amp;#x1f3e1; Forem (formerly Dev)&lt;/span>
&lt;ul>
&lt;li>&amp;#x1f4bb; Principal Software Engineer&lt;/li>
&lt;li>&amp;#x1f310; Remote (US hours)&lt;/li>
&lt;li>&amp;#x1f5d3;&amp;#xfe0f; May 2019 to October 2021&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;span class="company__name">&amp;#x1f3e1; Independent consultant&lt;/span>
&lt;ul>
&lt;li>&amp;#x1f4bb; Software Developer (DoveConviene, alittlebit, CommonSense, &amp;hellip;)&lt;/li>
&lt;li>&amp;#x1f310; Milan, Italy and Remote&lt;/li>
&lt;li>&amp;#x1f5d3;&amp;#xfe0f; September 2013 to May 2019&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;span class="company__name">&amp;#x1f3e1; TravelAvenue&lt;/span>
&lt;ul>
&lt;li>&amp;#x1f4bb; Web Developer&lt;/li>
&lt;li>&amp;#x1f310; Paris, France&lt;/li>
&lt;li>&amp;#x1f5d3;&amp;#xfe0f; November 2011 to May 2013&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;span class="company__name">&amp;#x1f3e1; Smartdate&lt;/span>
&lt;ul>
&lt;li>&amp;#x1f4bb; Web Developer&lt;/li>
&lt;li>&amp;#x1f310; Paris, France&lt;/li>
&lt;li>&amp;#x1f5d3;&amp;#xfe0f; May 2011 to September 2011&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;span class="company__name">&amp;#x1f3e1; StatPro Group&lt;/span>
&lt;ul>
&lt;li>&amp;#x1f4bb; Software Developer&lt;/li>
&lt;li>&amp;#x1f310; Milan, Italy&lt;/li>
&lt;li>&amp;#x1f5d3;&amp;#xfe0f; September 2007 to November 2010&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;span class="company__name">&amp;#x1f3e1; Pragma 2000&lt;/span>
&lt;ul>
&lt;li>&amp;#x1f4bb; Software Developer&lt;/li>
&lt;li>&amp;#x1f310; Milan, Italy&lt;/li>
&lt;li>&amp;#x1f5d3;&amp;#xfe0f; May 2007 to June 2010&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;span class="company__name">&amp;#x1f3e1; Python Software Foundation (Google Summer of Code)&lt;/span>
&lt;ul>
&lt;li>&amp;#x1f4bb; Software Developer&lt;/li>
&lt;li>&amp;#x1f310; Geneva, Switzerland and Remote&lt;/li>
&lt;li>&amp;#x1f5d3;&amp;#xfe0f; May 2006 to September 2010&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul></description></item></channel></rss>