<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.3">Jekyll</generator><link href="https://toribeiro.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://toribeiro.com/" rel="alternate" type="text/html" /><updated>2023-10-02T01:17:49+00:00</updated><id>https://toribeiro.com/feed.xml</id><title type="html">Thiago Ribeiro</title><subtitle>A blog about Computer Engineering &amp; thoughts</subtitle><entry><title type="html">Increasing productivity with Thyme app: a web version</title><link href="https://toribeiro.com/increasing-productivity-with-thyme-app-a-web-version/" rel="alternate" type="text/html" title="Increasing productivity with Thyme app: a web version" /><published>2020-01-28T00:00:00+00:00</published><updated>2020-01-28T00:00:00+00:00</updated><id>https://toribeiro.com/increasing-productivity-with-thyme-app-a-web-version</id><content type="html" xml:base="https://toribeiro.com/increasing-productivity-with-thyme-app-a-web-version/">&lt;hr /&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/73285386-91430600-41bb-11ea-8016-cde93451d400.jpg&quot; width=&quot;699&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h1 id=&quot;looking-for-a-way-to-increase-your-productivity&quot;&gt;Looking for a way to increase your productivity?&lt;/h1&gt;

&lt;p&gt;Have you ever had those moments where you’re looking for an application to fulfill some specific need? I bet you have.&lt;/p&gt;

&lt;p&gt;That’s how I found myself last year: looking for ways to increase my level of concentration and productivity while focusing on a single task.&lt;/p&gt;

&lt;p&gt;Among the several ways you can accomplish that, for me, the main thing I was looking for was to simply track &lt;em&gt;time spent working deeply on something&lt;/em&gt; (yes, Carl Newports’ &lt;a href=&quot;https://www.calnewport.com/books/deep-work/&quot; target=&quot;_blank&quot;&gt;Deep Work&lt;/a&gt; book did have an influence on that).&lt;/p&gt;

&lt;p&gt;Although I did find several cool options out there (&lt;a href=&quot;https://toggl.com/&quot;&gt;Toggl&lt;/a&gt;, &lt;a href=&quot;https://tickspot.com/&quot; target=&quot;_blank&quot;&gt;Tickspot&lt;/a&gt;, etc),  everything I tried didn’t feel right.&lt;/p&gt;

&lt;p&gt;Some of the other solutions I found were either full of features I didn’t need, or I’d have to pay to use it or sign up to at least see it functioning.&lt;/p&gt;

&lt;p&gt;Until I found &lt;a href=&quot;https://joaomoreno.github.io/thyme/&quot; target=&quot;_blank&quot;&gt;Thyme&lt;/a&gt;. With no expectations (since it was free and open source), I downloaded it, tried it out for a couple of days and…loved it. The app was simple and straight to the point.&lt;/p&gt;

&lt;p&gt;As I was using it, I was noticing how much more focused and productive I’d become while working on something and I am very sure the app has me helped to achieve that. I had finally found exactly what I was looking for.&lt;/p&gt;

&lt;h1 id=&quot;my-workflow-with-thyme&quot;&gt;My workflow with Thyme&lt;/h1&gt;

&lt;p&gt;It seems very obvious, but Thyme seems to get the UX involved in the process of tracking your time, more naturally by dividing it into &lt;em&gt;three&lt;/em&gt; actions: &lt;em&gt;start&lt;/em&gt;, &lt;em&gt;stop&lt;/em&gt; and &lt;em&gt;continue&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;That idea contrasts with a lot of what you’ll see out there with the “Start” and “Stop” button titles only.&lt;/p&gt;

&lt;p&gt;Even Google’s timer (Apple’s too I should say) shows the word “Start” when you stop the timer after awhile, which feels a bit weird to me since I don’t feel like I’m starting. I’m continuing or resuming (UI/UX folks out there, what do you think?) a task.&lt;/p&gt;

&lt;p&gt;Back to Thyme, there is also a little feature that comes in handy, which is the export option.&lt;/p&gt;

&lt;p&gt;Overall, the idea of a timer is straightforward, but the solutions I had found prior to Thyme all seemed overly engineered which distracted me from the real objective: helping me track how long did it take to finish a task.&lt;/p&gt;

&lt;h1 id=&quot;con-thyme-is-mac-os-only&quot;&gt;Con: Thyme is Mac OS only&lt;/h1&gt;

&lt;p&gt;Hopefully I’ve convinced you that that little app is awesome by now, but the con is that Thyme is currently only written for Mac OS (until now I guess).&lt;/p&gt;

&lt;p&gt;As I have been using Windows a lot for the past months, I just started to feel the void. The daily use of the app stuck like a habit.&lt;/p&gt;

&lt;p&gt;It had become part of my daily activities and I was missing it a lot. It had definitely become part of my daily routine: sit down to concentrate, 
start Thyme. Then I had an idea…&lt;/p&gt;

&lt;h1 id=&quot;thyme-web-version&quot;&gt;Thyme Web version&lt;/h1&gt;

&lt;p&gt;I decided to create a web version of that lovely app, trying to mimic the experience you get on the Mac OS native app as much as possible.&lt;/p&gt;

&lt;p&gt;As this is an initial version, and as one of the responsible for maintaining the OS X app (you can check the repository &lt;a href=&quot;https://github.com/joaomoreno/thyme&quot; target=&quot;blank_&quot;&gt;here&lt;/a&gt;), I’ve obviously also decided to make it open source.&lt;/p&gt;

&lt;p&gt;The project is written in Angular and uses Web Workers to keep the timer being updated even if you switch tabs or minimize the browser.&lt;/p&gt;

&lt;p&gt;The beautiful UI you see was created in partnership with &lt;a href=&quot;https://dribbble.com/jandui&quot; target=&quot;blank_&quot;&gt;Jandui&lt;/a&gt; (thanks my friend!) which I’ve successfully been able to convince to start navigating the open source world as well, haha.&lt;/p&gt;

&lt;p&gt;This very first version is available here on &lt;a href=&quot;https://thymeweb.netlify.com/&quot;&gt;https://thymeweb.netlify.com/&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;current-features&quot;&gt;Current Features&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;Basic timer (just like the original Thyme);&lt;/li&gt;
  &lt;li&gt;Option to export list of worked tasks as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.txt&lt;/code&gt;;&lt;/li&gt;
  &lt;li&gt;Tagging tasks when finished;&lt;/li&gt;
  &lt;li&gt;Local storage (tasks are kept even if tab/window closes);&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;future-additions&quot;&gt;Future Additions&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Synching capability&lt;/strong&gt;: since I have noticed that as I have the app installed in multiple Mac machines, and Thyme for Mac stores it locally only, I end up not knowing anything about my tasks from one machine once I switch to another;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Fully developed mobile UI&lt;/strong&gt;: for now only the Desktop app looks good, but we’ve got some work to finish the mobile version of it;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Interested? please star the repo (&lt;a href=&quot;https://github.com/tolribeiro/thyme-web&quot; target=&quot;blank_&quot;&gt;https://github.com/tolribeiro/thyme-web&lt;/a&gt;) and help us spread the word about Thyme. You are more than welcome helping us out to build a better version of it :)&lt;/p&gt;

&lt;p&gt;And I hope Thyme becomes as useful and helpful to you as it has been to me (I’ve used the web version to track the time I spent writing this post as well!)&lt;/p&gt;</content><author><name></name></author><category term="time tracking thyme" /><summary type="html">Looking for a way to increase your productivity? Have you ever had those moments where you’re looking for an application to fulfill some specific need? I bet you have. That’s how I found myself last year: looking for ways to increase my level of concentration and productivity while focusing on a single task. Among the several ways you can accomplish that, for me, the main thing I was looking for was to simply track time spent working deeply on something (yes, Carl Newports’ Deep Work book did have an influence on that). Although I did find several cool options out there (Toggl, Tickspot, etc), everything I tried didn’t feel right. Some of the other solutions I found were either full of features I didn’t need, or I’d have to pay to use it or sign up to at least see it functioning. Until I found Thyme. With no expectations (since it was free and open source), I downloaded it, tried it out for a couple of days and…loved it. The app was simple and straight to the point. As I was using it, I was noticing how much more focused and productive I’d become while working on something and I am very sure the app has me helped to achieve that. I had finally found exactly what I was looking for. My workflow with Thyme It seems very obvious, but Thyme seems to get the UX involved in the process of tracking your time, more naturally by dividing it into three actions: start, stop and continue. That idea contrasts with a lot of what you’ll see out there with the “Start” and “Stop” button titles only. Even Google’s timer (Apple’s too I should say) shows the word “Start” when you stop the timer after awhile, which feels a bit weird to me since I don’t feel like I’m starting. I’m continuing or resuming (UI/UX folks out there, what do you think?) a task. Back to Thyme, there is also a little feature that comes in handy, which is the export option. Overall, the idea of a timer is straightforward, but the solutions I had found prior to Thyme all seemed overly engineered which distracted me from the real objective: helping me track how long did it take to finish a task. Con: Thyme is Mac OS only Hopefully I’ve convinced you that that little app is awesome by now, but the con is that Thyme is currently only written for Mac OS (until now I guess). As I have been using Windows a lot for the past months, I just started to feel the void. The daily use of the app stuck like a habit. It had become part of my daily activities and I was missing it a lot. It had definitely become part of my daily routine: sit down to concentrate, start Thyme. Then I had an idea… Thyme Web version I decided to create a web version of that lovely app, trying to mimic the experience you get on the Mac OS native app as much as possible. As this is an initial version, and as one of the responsible for maintaining the OS X app (you can check the repository here), I’ve obviously also decided to make it open source. The project is written in Angular and uses Web Workers to keep the timer being updated even if you switch tabs or minimize the browser. The beautiful UI you see was created in partnership with Jandui (thanks my friend!) which I’ve successfully been able to convince to start navigating the open source world as well, haha. This very first version is available here on https://thymeweb.netlify.com/ Current Features Basic timer (just like the original Thyme); Option to export list of worked tasks as .txt; Tagging tasks when finished; Local storage (tasks are kept even if tab/window closes); Future Additions Synching capability: since I have noticed that as I have the app installed in multiple Mac machines, and Thyme for Mac stores it locally only, I end up not knowing anything about my tasks from one machine once I switch to another; Fully developed mobile UI: for now only the Desktop app looks good, but we’ve got some work to finish the mobile version of it; Interested? please star the repo (https://github.com/tolribeiro/thyme-web) and help us spread the word about Thyme. You are more than welcome helping us out to build a better version of it :) And I hope Thyme becomes as useful and helpful to you as it has been to me (I’ve used the web version to track the time I spent writing this post as well!)</summary></entry><entry><title type="html">Cultural training in programming: the pitfall of the Stack Overflow phenomenon</title><link href="https://toribeiro.com/cultural-training-in-programming-stack-overflow-phenomenon-and-its-pitfall/" rel="alternate" type="text/html" title="Cultural training in programming: the pitfall of the Stack Overflow phenomenon" /><published>2019-12-14T00:00:00+00:00</published><updated>2019-12-14T00:00:00+00:00</updated><id>https://toribeiro.com/cultural-training-in-programming-stack-overflow-phenomenon-and-its-pitfall</id><content type="html" xml:base="https://toribeiro.com/cultural-training-in-programming-stack-overflow-phenomenon-and-its-pitfall/">&lt;hr /&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/70920688-9ae82400-1fe8-11ea-9ecb-f927c4232d71.png&quot; width=&quot;699&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h1 id=&quot;a-little-story-on-cultural-training-grandmas-ham&quot;&gt;A little story on cultural training: grandma’s ham&lt;/h1&gt;

&lt;p&gt;A couple of years ago I once read a fictional story on a book that resonated so much with me that I could never forget it.&lt;/p&gt;

&lt;p&gt;It talked about a family event where a husband and his wife were in their kitchen and he was sitting at the table reading the newspaper while she prepared a ham for dinner.&lt;/p&gt;

&lt;p&gt;At some point, he observed that she was cutting off about one inch from either end of the ham and then he asked: “Why are you doing that? that’s such a waste of good ham!” to which she promptly responded: “that’s the way my mom has always prepared it”. When he asked &lt;em&gt;why&lt;/em&gt; her mom used to do that, the wife simply didn’t know the answer.&lt;/p&gt;

&lt;p&gt;Now in the search for it, she called her mom to ask: “Mom, why do you cut the ends of the ham off?”. “Well, because that’s the way my mom used to do it”.&lt;/p&gt;

&lt;p&gt;Though the wife’s grandma had passed away, her grandpa was still alive. Still without the answer, she then called him to ask: “Grandpa, would you know why my grandma used to cut the ends off of the ham?” He was silent for a moment and then replied, “Well, she used to do that so the ham could fit in the baking pan.”&lt;/p&gt;

&lt;p&gt;This story illustrates what is often called &lt;strong&gt;cultural training&lt;/strong&gt; which is when one generation (or employee) teaches or passes down a process or knowledge to another.&lt;/p&gt;

&lt;h1 id=&quot;stack-overflow-cultural-training-at-scale&quot;&gt;Stack Overflow: cultural training at scale&lt;/h1&gt;

&lt;p&gt;If you’re a software engineer or have interacted with them for long enough, you’ve probably heard of Stack Overflow at least once in your life.&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/70921763-8dcc3480-1fea-11ea-951a-0c1abed6ad43.jpeg&quot; width=&quot;600&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
  &lt;div style=&quot;text-align:center&quot;&gt;
    &lt;p&gt;&lt;span style=&quot;color:#aaa;&quot;&gt;Jeff and Joel giving a speech one year after the website’s launch (2009)&lt;/span&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Created in 2008 by &lt;a href=&quot;https://en.wikipedia.org/wiki/Jeff_Atwood&quot; target=&quot;_blank&quot;&gt;Jeff Atwood&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Joel_Spolsky&quot; target=&quot;_blank&quot;&gt;Joel Spolsky&lt;/a&gt; (the same guy that created Trello, which I wrote about &lt;a href=&quot;https://toribeiro.com/taking-your-trello-board-to-the-next-level-essential-plugins-to-boost-its-power/&quot; target=&quot;_blank&quot;&gt;on my previous post&lt;/a&gt;), it’s a question and answer website for programmers to post about programming languages, problems and general issues.&lt;/p&gt;

&lt;p&gt;As of January 2019, the platform had reached over &lt;em&gt;10 million&lt;/em&gt; registered users and it exceeded &lt;em&gt;16 million questions&lt;/em&gt; in mid 2018.&lt;/p&gt;

&lt;p&gt;Given these absurd numbers, you can quickly realize the impact it’s had in the life of millions of programmers around the globe, becoming one of the most used tools used for helping to solve tough day-to-day questions and problems that are very common in the life of a software engineer.&lt;/p&gt;

&lt;p&gt;But as the popular Peter Parker proverb states, &lt;em&gt;with great power comes great responsibility&lt;/em&gt;. Now 11 years after its launch, it seems like the responsibility aspect of it is starting to catch up. The evidence is &lt;a href=&quot;https://www.zdnet.com/article/the-most-copied-stackoverflow-java-code-snippet-contains-a-bug/&quot; target=&quot;_blank&quot;&gt;this article&lt;/a&gt; I stumbled upon recently that mentioned that &lt;a href=&quot;https://programming.guide/worlds-most-copied-so-snippet.html&quot; target=&quot;_blank&quot;&gt;the most copied Stack Overflow snippet of all time is flawed&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The answer to the the question &lt;em&gt;“how do you print a byte count in a human readable format”&lt;/em&gt; or &lt;em&gt;“how do you format something like 123,456,789 bytes as ‘123.5 MB’?”&lt;/em&gt; had been copied and embedded in more than 6,000 GitHub Java projects (!)…and &lt;em&gt;it contained a bug&lt;/em&gt;. The admission came 9 years later from the author of the snippet itself, &lt;a href=&quot;https://aioo.be/&quot; target=&quot;_blank&quot;&gt;Andreas Lundblad&lt;/a&gt;, a Java developer at Palantir.&lt;/p&gt;

&lt;p&gt;Now imagine that instead of a simple flaw, this snippet exposed some vulnerability that would put the application at risk?&lt;/p&gt;

&lt;p&gt;That comes to show something I consider a recent phenomenon in our profession: it seems that &lt;em&gt;a lot of us have become bound to simply replicate code or patterns without giving it a second thought or analysis&lt;/em&gt;, imitating exactly the same behavior of the fictional wife preparing the ham from the story above. In order to break that cycle, I’d argue that a simple way would be to willingly force ourselves to start using the word &lt;em&gt;why&lt;/em&gt; more often.&lt;/p&gt;

&lt;h1 id=&quot;escaping-the-blind-replication-trap-always-ask-why&quot;&gt;Escaping the blind replication trap: always ask why&lt;/h1&gt;

&lt;p&gt;I’ve always been a curious kid and soon have learned that in order to undersand something the best way, I’d have to ask myself &lt;em&gt;why&lt;/em&gt; things are the way they are. I confess, though, that this is not always a self-conscious thought process that I go through for every thing I do in life, but it certainly is reinforced whenever I sit down to write code or design a solution to a problem.&lt;/p&gt;

&lt;p&gt;Furthermore, one common thing I’ve seen a lot outside of the Stack Overflow example, is in large codebases where things were written a certain way and new developers tend to believe that since something is written or architected like that, then things should simply be replicated without questioning.&lt;/p&gt;

&lt;p&gt;During my own journey, I’ve constantly tried to train myself to stop whenever I’m about to replicate a pattern, a snippet or a certain way of doing things, and ask: “why am I doing it that way?”. If I can structure my answer around a solid reason through at least some examination, then I feel like I can proceed. That has proven to help me build my confidence in the very early stages of my career and until today has kept me challenging myself to see things on a different light.&lt;/p&gt;</content><author><name></name></author><category term="programming" /><summary type="html"></summary></entry><entry><title type="html">Taking your Trello board to the next level: essential plugins to boost its power</title><link href="https://toribeiro.com/taking-your-trello-board-to-the-next-level-essential-plugins-to-boost-its-power/" rel="alternate" type="text/html" title="Taking your Trello board to the next level: essential plugins to boost its power" /><published>2019-11-30T00:00:00+00:00</published><updated>2019-11-30T00:00:00+00:00</updated><id>https://toribeiro.com/taking-your-trello-board-to-the-next-level-essential-plugins-to-boost-its-power</id><content type="html" xml:base="https://toribeiro.com/taking-your-trello-board-to-the-next-level-essential-plugins-to-boost-its-power/">&lt;hr /&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/69908242-2b98f000-13ab-11ea-9c1e-20542d41725e.png&quot; width=&quot;800&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;why-and-when-to-use-a-process-like-kanban&quot;&gt;Why and when to use a process like Kanban?&lt;/h2&gt;

&lt;p&gt;One of the most important parts of the process involving the design and analysis of systems is the proper choice of the methodology to be used throughout the implementation phase.&lt;/p&gt;

&lt;p&gt;In the case of systems modest in size, operating with relatively small teams, aiming to release software early and often without having to follow the constraints of a more rigid approach, a list of ideal characteristics that fits these requirements would probably look something like this:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Little to none distinction amongst roles;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;High flexibility to change;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Estimation based on cycle time;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Variable prioritization;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sounds familiar? well, yes. We are describing &lt;em&gt;Kanban&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;In the very early phases of &lt;a href=&quot;https://jampapp.com&quot; target=&quot;_blank&quot;&gt;Jamp&lt;/a&gt;, we naturally discovered that this methodology worked great for us and have decided to keep it until today.&lt;/p&gt;

&lt;h1 id=&quot;are-there-good-kanban-tools-out-there&quot;&gt;Are there good Kanban tools out there?&lt;/h1&gt;

&lt;p&gt;As you might’ve guessed, with a very quick search you can find several long lists with tools that can be leveraged to implement Kanban into your project.&lt;/p&gt;

&lt;p&gt;However, for one reason or the other, Trello seems to be the go-to tool when we think about it.&lt;/p&gt;

&lt;p&gt;Maybe because of its simplicitity, maybe because it’s free and with out-of-the-box features ready to use, or simply because it seems to be the best on the market (in my personal experience, I always seemed to go back to it after trying out others).&lt;/p&gt;

&lt;h1 id=&quot;pro4trello--parentchild-dependency-pcd&quot;&gt;Pro4Trello &amp;amp; Parent/Child Dependency (PCD)&lt;/h1&gt;

&lt;p&gt;Although Trello holds its reputation through the advantages mentioned above, if you need to rely on it for collecting metrics or even trivial tracking, it usually doesn’t get you too far.&lt;/p&gt;

&lt;p&gt;The only way I found to keep using it and still extract valuable data from it, was by using these two amazing Chrome extensions: &lt;a href=&quot;https://chrome.google.com/webstore/detail/pro-for-trello-free-trell/hcjkfaengbcfeckhjgjdldmhjpoglecc?hl=fr--------&quot; target=&quot;_blank&quot;&gt;Pro4Trello&lt;/a&gt; and &lt;a href=&quot;https://chrome.google.com/webstore/detail/parentchild-management-fo/flnpbgmiploomjgagfbcjlikpiehclld?hl=en&quot; target=&quot;_blank&quot;&gt;PCD&lt;/a&gt; .&lt;/p&gt;

&lt;h1 id=&quot;what-are-the-advantages-of-using-these-extensions&quot;&gt;What are the advantages of using these extensions?&lt;/h1&gt;

&lt;h3 id=&quot;categorization&quot;&gt;Categorization&lt;/h3&gt;

&lt;p&gt;Since we have a couple of different systems and applications to keep track of, we’ve decided to use the Pro4Trello’s categories feature per card and we divide them between iOS, Android, Website and others.&lt;/p&gt;

&lt;p&gt;So the user would start by typing the name of the category, then writing the description of the card after the pipe:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Category1 | This card is to describe a certain feature...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;tagging&quot;&gt;Tagging&lt;/h3&gt;

&lt;p&gt;Each card that gets added to the board needs to specify its type through a tag. In our case, we have US (for User Stories) and DE (for defects).&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Category1 | This card is to describe a certain feature [US]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;identification&quot;&gt;Identification&lt;/h3&gt;

&lt;p&gt;Since we need to keep track of which changes to the codebase are related to each cards, this feature allows the developers to have an auto generated ID for each card created that can be used for branching or commit messages.&lt;/p&gt;

&lt;h3 id=&quot;prioritization&quot;&gt;Prioritization&lt;/h3&gt;

&lt;p&gt;Another key thing to differentiate cards is the ability to mark some as more important than others. For this, the plugin allows you to simply specifiy the level of priority of a card by using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!!&lt;/code&gt;, or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!!!&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;estimation&quot;&gt;Estimation&lt;/h3&gt;

&lt;p&gt;The person creating the card can also add the estimation for the time that is going to be spent on the task by adding a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{}&lt;/code&gt; with the time inside the curly braces.&lt;/p&gt;

&lt;h3 id=&quot;dependency&quot;&gt;Dependency&lt;/h3&gt;

&lt;p&gt;Finally, as sometimes needed, a task is dependent on the other and for that  we use PCD. Every time you open a card, this plugin shows a dropdown list that you can relate the current open card to its dependent.&lt;/p&gt;

&lt;h2 id=&quot;real-life-example-defect-on-ios-app&quot;&gt;Real life example: defect on iOS app&lt;/h2&gt;

&lt;p&gt;Given that we need a card to track a defect (&lt;em&gt;tag:&lt;/em&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[DE]&lt;/code&gt;) from the Jamp’s iOS app (&lt;em&gt;category:&lt;/em&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;iOS&lt;/code&gt;) where the text gets truncated for words of more than 10 characters and it’s a critical issue (&lt;em&gt;prioritization:&lt;/em&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!!!&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;The developer estimated that it’d take 1 hour to fix it. Here is how the card would be created for Pro4Trello:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;iOS | {1h} !!! Fix truncated text for words of more than 10 characters [DE]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The plugin would then process these formatting from the card and display it like this:&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/69908127-00ad9c80-13a9-11ea-9aad-0bd2aa8dddf6.png&quot; width=&quot;242&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Notice that it created its own id &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#1&lt;/code&gt;, which is the one used for commits and branches.&lt;/p&gt;

&lt;p&gt;Now the most incredible part is that Pro4Trello organizes all the data for you on a tab below the board, where you can simply filter your cards (&lt;em&gt;category&lt;/em&gt;, &lt;em&gt;tags&lt;/em&gt; etc) and have the board display it for you:&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
    &lt;img width=&quot;615&quot; alt=&quot;Screen Shot 2019-11-30 at 7 42 32 PM&quot; src=&quot;https://user-images.githubusercontent.com/6345197/69908152-92b5a500-13a9-11ea-9380-d51e8e9a6c85.png&quot; class=&quot;img-responsive center-block&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;Therefore, by the end of each cycle (be it a week or two), you can archive the lists and they can be easily searched by dates from the default Trello search option whenever you need to pull some data regarding your development cycle.&lt;/p&gt;

&lt;p&gt;That way, we’ve been able to fully function as a small concise team by leveraging these tools, eliminating the need to spend on more powerful ones since we’d only make use of some of the thousands of features these
more robust tools usually provide.&lt;/p&gt;</content><author><name></name></author><category term="trello" /><summary type="html"></summary></entry><entry><title type="html">Easy event tracking using Segment and Google Analytics</title><link href="https://toribeiro.com/easy-event-tracking-using-segment-and-google-analytics/" rel="alternate" type="text/html" title="Easy event tracking using Segment and Google Analytics" /><published>2019-04-01T00:00:00+00:00</published><updated>2019-04-01T00:00:00+00:00</updated><id>https://toribeiro.com/easy-event-tracking-using-segment-and-google-analytics</id><content type="html" xml:base="https://toribeiro.com/easy-event-tracking-using-segment-and-google-analytics/">&lt;blockquote&gt;
  &lt;p&gt;Truth is always to be found in simplicity, and not in the multiplicity and confusion of things
&lt;strong&gt;Isaac Newton&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This quote from Newton has recently become my motto. Along with the divide-and-conquer approach to problem solving, these two ideas together become a powerful concept to remind yourself of whenever a challenge comes up.&lt;/p&gt;

&lt;p&gt;Not that integrating some analytics into a project should be something very complicated to accomplish, but depending on the documentation of the service you want to use and the task at hand, things can get a bit tricky.&lt;/p&gt;

&lt;h3 id=&quot;it-should-not-be-painful&quot;&gt;It should not be painful…&lt;/h3&gt;

&lt;p&gt;If you’ve had experience integrating third-party APIs into any project, you’ve probably had to deal with some unpolished docs out there that instead of clarifying stuff, leave you even more confused than when you started reading them.&lt;/p&gt;

&lt;p&gt;Here is an important point on that: when a company’s target market involves developers, this is something to keep an eye on. John Collison from Stripe can back me up on that when he affirms that their great API and documentation were important factors for &lt;a href=&quot;https://growthhackers.com/growth-studies/how-stripe-marketed-to-developers-so-effectively&quot; target=&quot;_blank&quot;&gt;Stripe’s success&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;And that’s where Segment comes into play.&lt;/p&gt;

&lt;h3 id=&quot;kiss-principle-at-its-core&quot;&gt;KISS principle at its core&lt;/h3&gt;

&lt;p&gt;On that matter, Segment definitely got it right. Learning to integrate event tracking into your project becomes very simple, straight to the point. Let me show you an example.&lt;/p&gt;

&lt;p&gt;Let’s suppose you have a search bar on your website and you just need to track the words people are searching for. Check this out (Javascript):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;analytics.track (&quot;Searched&quot;, {
  searched_word: &quot;medicine&quot;,
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s all you’d need: the &lt;strong&gt;action&lt;/strong&gt; you want to track, and the &lt;strong&gt;property&lt;/strong&gt; to capture the user’s searched word.&lt;/p&gt;

&lt;p&gt;Nevertheless, even though you can send all sorts of custom properties to Segment (and check them on the debugger for testing purposes), it apparently does not keep these values ​​stored in there. For that, you have to connect your project to a destination (such as GA) you want to send these events to so they can be stored, exported and analyzed there instead.&lt;/p&gt;

&lt;h3 id=&quot;checking-the-searched-words-on-google-analytics&quot;&gt;Checking the searched words on Google Analytics&lt;/h3&gt;

&lt;p&gt;Once Segment is receiving your events and they match the payload you expect on the debugger, you need to create the link to GA. Here are the steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Create Custom Dimensions on GA:&lt;/strong&gt; this needs to be done so Segment can link the custom property name you chose, to these “dimensions” (or variable names);
 &lt;img width=&quot;599&quot; alt=&quot;Screen Shot 2019-04-01 at 10 00 57 AM&quot; src=&quot;https://user-images.githubusercontent.com/6345197/55353750-b70f5980-5489-11e9-8cd2-13c82301d2b9.png&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Map property to dimesion index on Segment:&lt;/strong&gt; on the GA settings on Segment (Destinations), link them using its index:
&lt;img width=&quot;577&quot; alt=&quot;Screen Shot 2019-04-01 at 10 00 46 AM&quot; src=&quot;https://user-images.githubusercontent.com/6345197/55353814-d4dcbe80-5489-11e9-9526-17a9dab692f6.png&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Select the Dimension for the event action:&lt;/strong&gt; Once you get to the Events page and select the action (“Searched” on our example), you can select the Custom Dimension and you’ll be able to see the list of searched words.
&lt;img width=&quot;340&quot; alt=&quot;Screen Shot 2019-04-01 at 1 23 39 PM&quot; src=&quot;https://user-images.githubusercontent.com/6345197/55353844-e1f9ad80-5489-11e9-801f-e613dc0cf321.png&quot; /&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That way, you can leverage the amazingly powerful features of GA and Segment’s event tracking library all at once.&lt;/p&gt;

&lt;p&gt;Next time you need to track events on your website or app and you already use Google Analytics, this is definitely a combo you should try out since I do not think it can get any simpler than that!&lt;/p&gt;</content><author><name></name></author><category term="segment" /><summary type="html">Truth is always to be found in simplicity, and not in the multiplicity and confusion of things Isaac Newton</summary></entry><entry><title type="html">From local to public with ngrok</title><link href="https://toribeiro.com/from-local-to-public-with-ngrok/" rel="alternate" type="text/html" title="From local to public with ngrok" /><published>2017-02-23T00:00:00+00:00</published><updated>2017-02-23T00:00:00+00:00</updated><id>https://toribeiro.com/from-local-to-public-with-ngrok</id><content type="html" xml:base="https://toribeiro.com/from-local-to-public-with-ngrok/">&lt;p&gt;For years I had played with server-side apps locally, running and testing it on my machine and not showing it to the world, since, you know…it would take me some extra effort to deploy it somewhere. However, everything changed when I got to know about the wonders of ngrok. It works like magic.&lt;/p&gt;

&lt;p&gt;It’s not my intention here to anylize ngrok’s key features since its own &lt;a href=&quot;https://ngrok.com/docs#getting-started&quot; target=&quot;_blank&quot;&gt;documentation&lt;/a&gt; and this amazing article by &lt;a href=&quot;https://www.twilio.com/blog/2015/09/6-awesome-reasons-to-use-ngrok-when-testing-webhooks.html&quot; target=&quot;_blank&quot;&gt;Phil Nash&lt;/a&gt; cover it all thoroughly (by the way, if you’re a Windows user, check this one by &lt;a href=&quot;https://www.twilio.com/blog/2014/03/configure-windows-for-local-webhook-testing-using-ngrok.html&quot; target=&quot;_blank&quot;&gt;Devin Rader&lt;/a&gt;), but I can show you a basic usage, so you can get it up and running in seconds.&lt;/p&gt;

&lt;h3 id=&quot;running-ngrok-on-terminal&quot;&gt;Running ngrok on Terminal&lt;/h3&gt;

&lt;p&gt;Since it’s built in Go and packaged as a binary, the downloaded file is a Unix Executable (Mac) and you run it passing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http&lt;/code&gt; and the port (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;80&lt;/code&gt; by default) as arguments. On Terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;./ngrok http 80&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;What happens next?&lt;/p&gt;

&lt;h3 id=&quot;easily-sharing-a-public-url&quot;&gt;Easily sharing a public URL&lt;/h3&gt;
&lt;p&gt;So considering this website (my own), when I use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll serve&lt;/code&gt;, Jekyll automatically serves it on port &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4000&lt;/code&gt; (default), so I can access it locally through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://127.0.0.1:4000&lt;/code&gt;. In case I write a new blog post or change something on it and want to show it to someone, with ngrok I can specify the port (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./ngrok http 4000&lt;/code&gt;) and it’ll generate the link for me (you can also set a password, check Phil’s article):&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42243365-b7179e9e-7ed6-11e8-8eec-e84837cb9835.png&quot; width=&quot;506&quot; height=&quot;192&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now you use the public link URL &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://bbfdf75e.ngrok.io&lt;/code&gt;, which will tunnel whoever you shared it with to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://127.0.0.1:4000&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can already see the beauty of it: in my case, no need to push my modifications anywhere in order to show what I’ve been working here to someone. If you’re developing an application on your machine and need to show progress to a client but couldn’t bother deploying it, now you’re good to go. Kudos, &lt;a href=&quot;https://twitter.com/inconshreveable&quot; target=&quot;_blank&quot;&gt;Alan Shreve&lt;/a&gt;!!&lt;/p&gt;</content><author><name></name></author><category term="ngrok" /><summary type="html">For years I had played with server-side apps locally, running and testing it on my machine and not showing it to the world, since, you know…it would take me some extra effort to deploy it somewhere. However, everything changed when I got to know about the wonders of ngrok. It works like magic.</summary></entry><entry><title type="html">Sound Level Meter with ESP8266, Arduino and iOS: IoT device for sound monitoring</title><link href="https://toribeiro.com/sound-level-meter-using-esp8266-arduino-sound-detector/" rel="alternate" type="text/html" title="Sound Level Meter with ESP8266, Arduino and iOS: IoT device for sound monitoring" /><published>2016-01-10T00:00:00+00:00</published><updated>2016-01-10T00:00:00+00:00</updated><id>https://toribeiro.com/sound-level-meter-using-esp8266-arduino-sound-detector</id><content type="html" xml:base="https://toribeiro.com/sound-level-meter-using-esp8266-arduino-sound-detector/">&lt;h3 id=&quot;the-purpose-of-the-project-mapping-noise-in-cities&quot;&gt;&lt;strong&gt;The purpose of the project: mapping noise in cities&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;Nowadays, even without noticing, we have been surrounded by a lot of noise. This noise comes from all sorts of sources such as bars, cars, trains, parties and so on. When this noise starts affecting our well-being or health, we give it a name: &lt;em&gt;noise pollution&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Therefore, my idea was to create a device that would be cheap to assemble and that could be installed in certain areas of the city, constantly updating data about sound levels to a web server and making them available to the population.&lt;/p&gt;

&lt;h3 id=&quot;the-hardware-arduino-sound-level-meter-and-esp8266&quot;&gt;&lt;strong&gt;The hardware: Arduino, Sound Level Meter and ESP8266&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;In order to measure the sound level (analog value), I decided to use the SparkFun Sound Detector (SSD). This little IC has three outputs: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;audio&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gate&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;envelope&lt;/code&gt;. As the purpose is to measure the amplitude of sound, to me, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;envelope&lt;/code&gt; output is what separates this board from the others (figure below).&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42242974-70e2d250-7ed5-11e8-9ff8-5432ff69fb20.jpg&quot; width=&quot;252&quot; height=&quot;188&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Besides, the Arduino UNO works as the “brain” in the system. Regarding the interaction with the SSD, it reads the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;envelope&lt;/code&gt; output into the analog port &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A0&lt;/code&gt; and converts it to a value in decibel, a logarithmic scale used in sound measuring.&lt;/p&gt;

&lt;p&gt;Additionally, the ESP8266 module (figure below), this extremely versatile IC was used as a station, connecting the hardware to the local network using WiFi. It is important to mention that the more advanced versions of the ESP have an ADC port, which would exclude the use of an Arduino. However, in order to make it work for this project, two ports of the Arduino were used to transmit and receive data from the ESP (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TX&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RX&lt;/code&gt;).&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42242149-865b527c-7ed2-11e8-85b7-bca3c0a37e97.png&quot; width=&quot;263&quot; height=&quot;206&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;assembling-the-parts-on-a-breadboard&quot;&gt;&lt;strong&gt;Assembling the parts on a breadboard&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;After assembling the parts on a breadboard, I noticed that the user should be able to read the output data in two forms: being near and far from the device. Thus, I added a regular LCD that would print the status and the measure in decibels. 
Furthermore, three LEDs would be able to alert the user about the loudness: if the green one is on, it means the place is quiet, if yellow the ambient noise is moderate and if red, it’s loud.&lt;/p&gt;

&lt;!-- &lt;br/&gt;
&lt;img src=&quot;./static/img/slm.png&quot; width=&quot;512&quot; height=&quot;401&quot; class=&quot;img-responsive center-block&quot; /&gt;
&lt;br/&gt; --&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42242167-95ceb35c-7ed2-11e8-82b9-e8325c2849fc.png&quot; width=&quot;447&quot; height=&quot;335&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;After doing a couple of tests with the ESP using a voltage regulator, I noticed that the response of the module is better when powered by a clean voltage source, which explains the two batteries used to exclusively power it, once the module works with 3,3V.&lt;/p&gt;

&lt;h3 id=&quot;the-software-ios-app-reading-the-data&quot;&gt;&lt;strong&gt;The software: iOS App reading the data&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;As a way of testing the system, I used the ThingSpeak server to update data directly from my device to the cloud. By using their API, I could read the data coming as a JSON object, parse it, and print it to the user. I set some pins on the map, where the user would hypothetically choose the place he wanted to monitor, and then notify by email or call in case it is being loud.&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42242185-a41731f0-7ed2-11e8-97a9-2611ed75cb11.png&quot; width=&quot;748&quot; height=&quot;410&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The points on the map are from a central part of Recife, the city I live. The idea is to have several devices spread around a given city, updating data about how noisy is the location at any time. Finally, in the video I explain how the hardware and the software work together. :)&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot; class=&quot;img-responsive&quot;&gt;
  &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/G-qB4gLC1Ag&quot; class=&quot;center-block&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;!--&lt;style&gt;.videoWrapper {position: relative;padding-bottom: 56.25%; /* 16:9 */padding-top: 25px;height: 0;}.videoWrapper iframe {position: absolute;top: 0;left: 0;width: 100%;height: 100%;}&lt;/style&gt;&lt;div class='videoWrapper'&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src='http://www.youtube.com/embed/G-qB4gLC1Ag' frameborder='0' allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;--&gt;</content><author><name></name></author><category term="sound level meter arduino" /><summary type="html">The purpose of the project: mapping noise in cities</summary></entry><entry><title type="html">Understanding Graph Coloring (vertex): C++ code and visual graph in LaTeX (Part II)</title><link href="https://toribeiro.com/understanding-graph-coloring-greedy-algorithm-part-II/" rel="alternate" type="text/html" title="Understanding Graph Coloring (vertex): C++ code and visual graph in LaTeX (Part II)" /><published>2015-12-28T00:00:00+00:00</published><updated>2015-12-28T00:00:00+00:00</updated><id>https://toribeiro.com/understanding-graph-coloring-greedy-algorithm-part-II</id><content type="html" xml:base="https://toribeiro.com/understanding-graph-coloring-greedy-algorithm-part-II/">&lt;p&gt;In the &lt;a href=&quot;http://toribeiro.com/understanding-graph-coloring-part-I.html&quot; title=&quot;Understanding Graph Coloring (vertex): a greedy approach (Part I)&quot; target=&quot;_blank&quot;&gt;previous tutorial&lt;/a&gt;, we explored a very simple approach, step-by-step, to color a graph using the three colors available (blue, red and yellow).&lt;/p&gt;

&lt;p&gt;Now we’ll put that approach into practice by using a C++ implementation (from the awesome guys at &lt;a href=&quot;http://www.geeksforgeeks.org/graph-coloring-set-2-greedy-algorithm/&quot; target=&quot;_blank&quot;&gt;GeeksforGeeks&lt;/a&gt;) of that algorithm and my contribution to it, that was among others features, to generate a visualization of the graph colored by using the worldwide famous and open-source tool LaTeX and the powerful TikZ package.&lt;/p&gt;

&lt;h3 id=&quot;how-to-input-the-graph-info-inputtxt&quot;&gt;&lt;strong&gt;How to input the graph info: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;input.txt&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;One of the most important parts of the program is the method that actually colors the graph using the greedy approach.&lt;/p&gt;

&lt;p&gt;However, before the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;greedyColoring()&lt;/code&gt; call, that actually colors the graph, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;input.txt&lt;/code&gt; file is where you enter the information about your graph &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;G(V,E)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The first line is the number &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;V&lt;/code&gt; of vertices and the following ones should contain the edges &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;E&lt;/code&gt;. Let’s say we have the graph below:&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42240018-7e4824ae-7ecb-11e8-9880-b3127e18534d.png&quot; width=&quot;242&quot; height=&quot;266&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The input file should look like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;5
0 1
0 2
1 2
1 3
1 4
2 3
3 4
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;By doing so, the program will read that as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;G(5, 7)&lt;/code&gt; meaning your input graph has 5 vertices and 7 edges which connections are explicited in the lines.&lt;/p&gt;

&lt;h3 id=&quot;the-greedycoloring-method&quot;&gt;&lt;strong&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;greedyColoring()&lt;/code&gt; method&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;This method contains the main part of the code, which is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;result&lt;/code&gt; array. This &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;result&lt;/code&gt; array of size &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;V&lt;/code&gt; is responsible for storing the final colors assigned to the vertices.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;V&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Assign the first color to first vertex&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	
&lt;span class=&quot;c1&quot;&gt;// Initialize remaining V-1 vertices as unassigned&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;u&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;u&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;V&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;u&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;u&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;// no color is assigned to u&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The first color assigned is going to be &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt; and the algorithm assigns the remaining ones as it goes through the adjacency list.&lt;/p&gt;

&lt;p&gt;As a result, the final &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;result&lt;/code&gt; vector for the input graph illustrated here looks like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0, 1, 2, 0, 2&lt;/code&gt; (5 vertices from 0-4) meaning that vertex 0 is colored in 0, vertex 1 is colored in 1, vertex 2 is colored in 2 and so on.&lt;/p&gt;

&lt;p&gt;To handle the output in LaTeX, I created an array that chooses a real color based on the index, i.e., to get the color represented by the number:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;	&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key_value_colors&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;red&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;yellow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// choose color based on index - 0 is red, 1 is yellow etc.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Therefore color 0 is red, color 1 is yellow and color 2 is blue. The program replace them by the ones set in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;key_value_colors&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;latextikz-code-generated&quot;&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LaTeX/TikZ&lt;/code&gt; code generated&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;By running the C++ code we get a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.tex&lt;/code&gt; file that can be compiled to see the result of the algorithm graphically. It’s important to mention that in order to automatically see the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.pdf&lt;/code&gt; you need to have LaTeX installed so the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pdflatex&lt;/code&gt; command is recognized by the Terminal (Linux/Mac OS). Besides, the output for this example should be:&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42240049-a05c8eb8-7ecb-11e8-908a-a9fb818234f6.png&quot; width=&quot;347&quot; height=&quot;335&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Finally, in order to demonstrate how to use the program, I recorded this video where I show how to go from a regular graph as the input to the graph colored in a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.pdf&lt;/code&gt; file as the output.&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/4xPjhYzj614&quot; class=&quot;center-block&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;</content><author><name></name></author><category term="graph coloring" /><summary type="html">In the previous tutorial, we explored a very simple approach, step-by-step, to color a graph using the three colors available (blue, red and yellow).</summary></entry><entry><title type="html">Understanding Graph Coloring (vertex): a greedy approach (Part I)</title><link href="https://toribeiro.com/understanding-graph-coloring-greedy-approach-part-I/" rel="alternate" type="text/html" title="Understanding Graph Coloring (vertex): a greedy approach (Part I)" /><published>2015-12-21T00:00:00+00:00</published><updated>2015-12-21T00:00:00+00:00</updated><id>https://toribeiro.com/understanding-graph-coloring-greedy-approach-part-I</id><content type="html" xml:base="https://toribeiro.com/understanding-graph-coloring-greedy-approach-part-I/">&lt;p&gt;It is known that the problem of coloring a graph with the smallest number of colors needed (finding its &lt;em&gt;chromatic number&lt;/em&gt;), is part of the set of NP-Complete problems.&lt;/p&gt;

&lt;p&gt;However, there are methods that can be used to color vertices sequentially, by choosing the colors based on the colors already assigned in the vertex’s neighborhood. In other words, we can use what is called a &lt;em&gt;greedy algorithm&lt;/em&gt; to solve the problem.&lt;/p&gt;

&lt;p&gt;To explore this approach, imagine that you have a palette with 3 colors available, and the following graph to color:&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42236450-64c68876-7eea-11e8-9e70-170ec09474c6.png&quot; width=&quot;243&quot; height=&quot;205&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Knowing that you cannot color vertices that are adjacent to each other with the same color, the step-by-step process to color the entire graph of Figure 1 is described below:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Let’s say we choose the first color &lt;em&gt;blue&lt;/em&gt; (ordered from left to right), to color vertex 1;&lt;/li&gt;
  &lt;li&gt;Intuitively, we already know that vertices 2 and 3 cannot be colored by blue anymore, because they are adjacent to 1. Thus, following the order, for vertex 2 we choose the next available color and it is &lt;em&gt;red&lt;/em&gt;;&lt;/li&gt;
  &lt;li&gt;The next vertex to color, 3, is also adjacent to 1 and 2, and by that we know that neither blue or red can be used to color it, so the next one available is &lt;em&gt;yellow&lt;/em&gt;.&lt;/li&gt;
  &lt;li&gt;The last vertex, 4, is only adjacent to vertex 2. This tells us that the only color we cannot choose is &lt;em&gt;red&lt;/em&gt;. Then going back to the first color available, vertex 4 is colored by &lt;em&gt;blue&lt;/em&gt; (it could have been yellow).&lt;/li&gt;
&lt;/ol&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42236488-8602ecf0-7eea-11e8-9689-28c53d8e1b36.png&quot; width=&quot;595&quot; height=&quot;170&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;One of the applications that I like the most and where graph coloring can be applied is the frequency assignment in cellular networks. In order to avoid interference (or crosstalk), different frequencies are assigned to adjacent cells, and the total number of distinct frequencies should be minimized.&lt;/p&gt;

&lt;p&gt;Therefore, if you instead of considering the colors blue, red and yellow, consider them as frequency 1, frenquency 2 and frequency 3, the algorithm that we manually applied to the graph above could have been very useful to configure a simple cellular network or any similar schema described as a graph.&lt;/p&gt;

&lt;p&gt;In the next part we’ll be going through a C++ implementation that generates code that can be compiled in LaTeX using Tikz, where we’ll be able to see it working for generic graphs.&lt;/p&gt;</content><author><name></name></author><category term="graph" /><summary type="html">It is known that the problem of coloring a graph with the smallest number of colors needed (finding its chromatic number), is part of the set of NP-Complete problems.</summary></entry><entry><title type="html">Capacitor charging graph web app in JS</title><link href="https://toribeiro.com/capacitor-charging-graph-web-app-js/" rel="alternate" type="text/html" title="Capacitor charging graph web app in JS" /><published>2015-05-04T00:00:00+00:00</published><updated>2015-05-04T00:00:00+00:00</updated><id>https://toribeiro.com/capacitor-charging-graph-web-app-js</id><content type="html" xml:base="https://toribeiro.com/capacitor-charging-graph-web-app-js/">&lt;p&gt;Recently, I faced the task of analyzing the graph of a capacitor in a simple circuit configuration: a voltage source powering the given capacitor connected to a resistor in series.&lt;/p&gt;

&lt;p&gt;The result of this configuration is pretty straightforward: my capacitor will get charged with a certain value of voltage from the source (&lt;em&gt;almost&lt;/em&gt; 100%), respecting the exponential function described below:&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;!-- ![Message Signal](http://tolribeiro.github.io/mywebsite/downloads/charge.png &quot;Function that describes capacitor charge.&quot;) --&gt;
  &lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42239216-e3b42e76-7ec8-11e8-944b-ea5b4c2776f8.png&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
We can easily see that it corresponds to a &lt;em&gt;time&lt;/em&gt; versus &lt;em&gt;voltage&lt;/em&gt; (exponential) function, where the &lt;em&gt;RC&lt;/em&gt; element is what we call &lt;strong&gt;time constant&lt;/strong&gt;. If you multiply the value of your capacitance with the value of the resistance that you have configured in your circuit, the result will represent how long it took for your capacitor to get charged with approximately 63% of the voltage from the source.&lt;/p&gt;

&lt;p&gt;As an example, let’s suppose we have a 12V source powering a 1000uF capacitor connected to a 51k resistor: it would take 51 seconds for the capacitor to have stored approximately 7.5V between its terminals.&lt;/p&gt;

&lt;h3 id=&quot;solving-the-problem-javascript--google-api&quot;&gt;Solving the problem: Javascript + Google API&lt;/h3&gt;

&lt;p&gt;As I didn’t have an oscilloscope, an analog port from a microcontroller board, nor any other resource that would help me to see the graph with the values of time and voltages plotted instantly, the first idea was to use the timer from my cellphone, marking laps and then after plotting the graph on another specific software.&lt;/p&gt;

&lt;p&gt;Thus, I thought that it would be really nice to have an application where I could put it all together (timer, time constant calculation and plotted graph) in one single page. The hassle of switching between my phone and my circuit, having to write down the values of times, made me think of this solution that I called &lt;strong&gt;Cap-Charge&lt;/strong&gt;.&lt;/p&gt;

&lt;h3 id=&quot;first-version-and-demonstration-video&quot;&gt;First version and demonstration video&lt;/h3&gt;

&lt;p&gt;Although I think it would be better to work on all the single bugs and put the &lt;em&gt;almost&lt;/em&gt; perfect solution, I decided to put online a very first version (0.1) so as other people use it, we can keep improving it together. I also recorded a video for those who are interested in using it and seeing how it works (Link is &lt;a href=&quot;http://tolribeiro.github.io/cap-charge/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/3nwURuvDR7w&quot; class=&quot;center-block&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;p&gt;I’ve also realized that the application can be very helpful to use in lab experiments in general, so I hope it optimizes your time whether you’re doing it in school or at home. Please let me know if you have any questions. Have fun!&lt;/p&gt;</content><author><name></name></author><category term="capacitor electronics" /><summary type="html">Recently, I faced the task of analyzing the graph of a capacitor in a simple circuit configuration: a voltage source powering the given capacitor connected to a resistor in series.</summary></entry><entry><title type="html">Simplified DES (SDES): an implementation in C</title><link href="https://toribeiro.com/simplified-DES-implementation-in-C/" rel="alternate" type="text/html" title="Simplified DES (SDES): an implementation in C" /><published>2015-01-12T00:00:00+00:00</published><updated>2015-01-12T00:00:00+00:00</updated><id>https://toribeiro.com/simplified-DES-implementation-in-C</id><content type="html" xml:base="https://toribeiro.com/simplified-DES-implementation-in-C/">&lt;p&gt;A few months ago, I went through a quite challenging experience as a student of an introdutory class on Criptography: I was required to give a presentation on &lt;strong&gt;DES&lt;/strong&gt; algorithm.&lt;/p&gt;

&lt;p&gt;After going through the titles of the reliable books on the subject, I decided to read &lt;em&gt;Criptography and Network Security&lt;/em&gt; by William Stallings and one of the first sentences on that page caught my attention:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“The structure of DES and most symmetric ciphers is very complex and cannot be explained as easily.”.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Therefore, in the next paragraph, it said that studying a simplified version (SDES) would enhance the understanding of DES, and I can guarantee that it actually does.&lt;/p&gt;

&lt;p&gt;After a couple of hours struggling in the beginning, I finally got the idea behind one of the most important symmetric ciphers algorithms.&lt;/p&gt;

&lt;h2 id=&quot;the-encryption-process&quot;&gt;The encryption process&lt;/h2&gt;

&lt;p&gt;The simplified DES operates on a 8-bit block of &lt;em&gt;plaintext&lt;/em&gt; to generate a 8-bit block of &lt;em&gt;ciphertext&lt;/em&gt;. These types of algorithms are called &lt;strong&gt;block ciphers&lt;/strong&gt;. It also uses a 10-bit key, generating two subkeys in the process, used as input for the most delicate part of the algorithm, the &lt;em&gt;fk function&lt;/em&gt;. &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;The scheme below shows how the plaintext (input) is manipulated to generate the ciphertext (output).&lt;/p&gt;

&lt;!-- &lt;div style=&quot;text-align:center&quot; markdown=&quot;1&quot;&gt;  --&gt;
&lt;!-- ![Message Signal](http://tolribeiro.github.io/mywebsite/downloads/encryption.png &quot;Simplified DES encryption scheme.&quot;) --&gt;
&lt;p style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/6345197/42233085-0ba8eb3c-7eb6-11e8-8e3b-4715a1812e18.png&quot; width=&quot;187&quot; height=&quot;662&quot; class=&quot;img-responsive center-block&quot; /&gt;&lt;/p&gt;

&lt;!-- &lt;/div&gt; --&gt;
&lt;p&gt;&lt;br /&gt;
After all these steps, the &lt;em&gt;output&lt;/em&gt; is the encrypted &lt;em&gt;input&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-keys-generation-step&quot;&gt;The keys generation step&lt;/h2&gt;

&lt;p&gt;This step only involves single permutations and shifts. I strongly believe that if you take a look at the implementation you won’t have any problems understanding it.&lt;/p&gt;

&lt;h2 id=&quot;the-decryption-process&quot;&gt;The decryption process&lt;/h2&gt;

&lt;p&gt;DES is a &lt;strong&gt;symmetric cipher&lt;/strong&gt;, which means that it uses the same key to &lt;em&gt;encrypt&lt;/em&gt; and &lt;em&gt;decrypt&lt;/em&gt; the data. Since my idea was only show the step-by-step encryption process, I decided not to write the function to decrypt it.&lt;/p&gt;

&lt;p&gt;However, you might not have any problems doing it either, because the only thing you’ll need to do is the encryption process backwards, i.e.: &lt;em&gt;output -&amp;gt; IP(output) -&amp;gt; fk(output, k2) -&amp;gt; SW(output) -&amp;gt; fk(output, k1) -&amp;gt; IP Inverse (output) -&amp;gt; input&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-implementation-in-c&quot;&gt;The implementation in C&lt;/h2&gt;

&lt;p&gt;Based on the scheme shown above, I implemented the algorithm and came up with the &lt;em&gt;encrypt&lt;/em&gt; function, that summarizes the encryption process of Simplified DES.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// ------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// ---            Encrypt Function   		---&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// ------------------------------------------------&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;encrypt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;initial_permutation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// IP&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;fk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// fk with subkey k1&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;switch_halves&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;	&lt;span class=&quot;c1&quot;&gt;// SW&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;fk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// fk with subkey k2&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;initial_permutation_inverse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// IP Inverse&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To make it easier to understand, I tried to stick to the names of the variables. The variables &lt;em&gt;input&lt;/em&gt;, &lt;em&gt;key&lt;/em&gt; (also the subkeys &lt;em&gt;k1&lt;/em&gt; and &lt;em&gt;k2&lt;/em&gt;) and &lt;em&gt;output&lt;/em&gt; literally mean the same as on the scheme.&lt;/p&gt;

&lt;p&gt;You can download the full implementation &lt;a href=&quot;https://raw.githubusercontent.com/tolribeiro/simplified-des/master/sdes.c&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; or from my &lt;a href=&quot;http://github.com/tolribeiro/simplified-des&quot; target=&quot;_blank&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;final-considerations&quot;&gt;Final Considerations&lt;/h2&gt;

&lt;p&gt;This algorithm was developed by Professor Edward Schaefer of Santa Clara University. I recommend that you read the appendix from &lt;em&gt;Criptography and Network Security&lt;/em&gt;, explaining the algorithm in details (&lt;a href=&quot;http://mercury.webster.edu/aleshunas/COSC%205130/G-SDES.pdf&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Furthermore, take a look at this PDF document (&lt;a href=&quot;http://ict.siit.tu.ac.th/~steven/css322y11s2/unprotected/CSS322Y11S2H01-DES-Examples.pdf&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;), written by Professor Steven Gordon of Sirindhorn International Institute of Technology, which contains some examples that you may want to verify with my implementation.&lt;/p&gt;</content><author><name></name></author><category term="cryptography" /><summary type="html">A few months ago, I went through a quite challenging experience as a student of an introdutory class on Criptography: I was required to give a presentation on DES algorithm.</summary></entry></feed>