<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: pob</title>
    <description>The latest articles on Forem by pob (@pobb).</description>
    <link>https://forem.com/pobb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F345644%2Fe751e139-98e5-4a08-9cc1-57de061e02e6.png</url>
      <title>Forem: pob</title>
      <link>https://forem.com/pobb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/pobb"/>
    <language>en</language>
    <item>
      <title>Legacy : a great mentorship for dev !</title>
      <dc:creator>pob</dc:creator>
      <pubDate>Mon, 18 May 2020 07:17:31 +0000</pubDate>
      <link>https://forem.com/pobb/legacy-a-great-mentorship-for-dev-3688</link>
      <guid>https://forem.com/pobb/legacy-a-great-mentorship-for-dev-3688</guid>
      <description>&lt;p&gt;Today I want to talk about a topic that is present in a developer's life : &lt;strong&gt;legacy&lt;/strong&gt;. This word means a lot of things in the IT world, and can be translated or interpreted in such many different ways. So here I will push my point of view as a developer, this is not a regular definition of legacy. The fact is, after experience, I don't understand why during all my studies, no one talked or teached about this, because it concern more than 50% of my career.&lt;/p&gt;

&lt;p&gt;I want to talk about &lt;code&gt;human legacy&lt;/code&gt; when nobody don't know how this feature works because "&lt;em&gt;it was developed a long time ago by a guy who left the company&lt;/em&gt;". And of course about &lt;code&gt;technical legacy&lt;/code&gt; : a language, technology, framework that is out of date or just dead, source code with no structuring or design strategy, no documentation, no tests. Legacy is everywhere, in each project or system, there is a part of legacy. You can't fight this, but you have to deal with it !&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't judge too fast ....
&lt;/h2&gt;

&lt;p&gt;Behind the scene maybe there are some people that in a particular context did this "&lt;em&gt;strange&lt;/em&gt;" thing. When I was younger I pushed back these projects and judged first on the situation. "&lt;em&gt;Why they did that like it ?&lt;/em&gt;" or "&lt;em&gt;How the !/=-$ is possible ?!&lt;/em&gt;". But this was not the good way. Don't lose your time. When you think about that just look at a situation where you had to "&lt;em&gt;do it fast&lt;/em&gt;", "&lt;em&gt;do it now&lt;/em&gt;" or just "&lt;em&gt;it has to works, we will QA later&lt;/em&gt;". Have a look at particular context of this situation, why you didn't do the best thing. There are reasons for that : insufficient time (deadlines ?), applicant never understood how a software works, your are new to the project, there is a lack of documentation, tools are out of date,  you never worked with this language, or maybe you're just more experienced right now than the young developer who worked on the project (&lt;em&gt;maybe it was a trainee or just junior&lt;/em&gt;) in the past ? Maybe it was not a developer at all ...&lt;/p&gt;

&lt;h2&gt;
  
  
  Nobody is perfect
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;We all do mistakes&lt;/strong&gt; ! Yes even if you are a &lt;code&gt;100x engineer&lt;/code&gt;, you do mistakes. Because we become stronger and stronger learning during all our career. We start younger and become senior. There is a difference between a developer alone and a developer in a team. Sometimes a "POC" become a project but you didn't know at first, and you leave. The developer behind you will start with a "legacy" (&lt;em&gt;don't tell me that all of your POCs are healthy ^^&lt;/em&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Analyse and secure
&lt;/h2&gt;

&lt;p&gt;First of all : analyse situation. Which &lt;code&gt;environments&lt;/code&gt; are available ? We got production, is there any staging environment ? Can we simply re-start project in &lt;code&gt;local&lt;/code&gt; ? Is there any &lt;code&gt;CI/CD&lt;/code&gt; process to put code in production ? Are there any &lt;code&gt;tests&lt;/code&gt; that I can rely on ? Is code on &lt;code&gt;git&lt;/code&gt; or &lt;code&gt;svn&lt;/code&gt; plateform ? Do you get &lt;code&gt;access&lt;/code&gt; to servers or tools or &lt;code&gt;APIs&lt;/code&gt; ? Can we found &lt;code&gt;logs&lt;/code&gt; somewhere ? Is there any &lt;code&gt;backlog&lt;/code&gt; ?&lt;/p&gt;

&lt;p&gt;And secure it as possible. Sometimes you won't get enough time to do all these shortcomings. You will have to choose and vote which one is needed. If project must go to live, &lt;strong&gt;GIT&lt;/strong&gt; is the first thing we use to settle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tests&lt;/strong&gt; just come next : how can we secure our refactoring without killing something ? Create tests, start as simple you can. A little but brillant guy always learned me : "&lt;strong&gt;1 test &amp;gt; 0 test&lt;/strong&gt;". Sometimes you won't have suffisant skill to put tests in this from scratch project you don't know. Have you ever heard and tried &lt;code&gt;Golden Master Testing&lt;/code&gt; ? This is so nice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read and learn
&lt;/h2&gt;

&lt;p&gt;So when you get this project the first thing to do is something that you will do during all of your time : &lt;strong&gt;READ&lt;/strong&gt;. Read code and &lt;strong&gt;LEARN&lt;/strong&gt;. A developer will spend most of his time to read code, not to write code. One more thing that only experience has taught me : start small ! One small upgrade is better than no upgrade. Extract some parts away and test them. And repeat. So read, learn about the code, the context, you will find solutions and achieve to better things. Sometimes maybe, your search and work will conclude to a new project, or to kill a project. But this is at least, &lt;strong&gt;an upgrade of the project&lt;/strong&gt;. Decide about kill or upgrade is not easy and it depends a lot on how much you want to invest on it, and which things we talked about during analyze (&lt;em&gt;environments, CI/CD, tests, versioning, accesses, logs, backlog, etc.&lt;/em&gt;) we can push.&lt;/p&gt;

&lt;h2&gt;
  
  
  Legacy : the best coworker to learn
&lt;/h2&gt;

&lt;p&gt;You have to practice a lot to deal with it, this is exactly the same as automated tests : you have use them every day at work, but it was a little part during all your studies (&lt;em&gt;if you get lucky to get some courses on this&lt;/em&gt;). Sometimes you will compare yourself as an archaeologist or genealogist, and yes it can be exciting to interfere in a project that you do not know. At the end you will be proud of your work and you will have grown ! The fact is that this work of search, analyze, read, act is very formative and will bring you new visions for next projects.&lt;/p&gt;

&lt;p&gt;I hope that these lines will help you to fight some deamons with legacy in the future.&lt;/p&gt;

</description>
      <category>career</category>
      <category>legacy</category>
      <category>learning</category>
    </item>
    <item>
      <title>Rails : How to preview Office files ?</title>
      <dc:creator>pob</dc:creator>
      <pubDate>Tue, 14 Apr 2020 08:29:21 +0000</pubDate>
      <link>https://forem.com/pobb/rails-how-to-preview-office-files-11go</link>
      <guid>https://forem.com/pobb/rails-how-to-preview-office-files-11go</guid>
      <description>&lt;p&gt;We use to work with CSV or PDF files when we talk about web apps. CSV are easy to use and edit after exportation (we can also easily create them), PDF are easy to read and and pretty much a standard. But when we have to deal with &lt;code&gt;.docx&lt;/code&gt;, &lt;code&gt;.xslx&lt;/code&gt; or similar formats, things get complicated. &lt;/p&gt;

&lt;h2&gt;
  
  
  Preview a file
&lt;/h2&gt;

&lt;p&gt;In your app, you have certainly used a preview for images or PDFs files. But how will you do in case of an emails app that must show preview of all attachments or another DMS app that must preview files with exotic extensions (&lt;em&gt;docx, pptx, xslx, odt, ods, odp etc.&lt;/em&gt;) ? &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Convert them to PDF&lt;/strong&gt; and you are done !&lt;/p&gt;

&lt;h2&gt;
  
  
  Libre office to the rescue
&lt;/h2&gt;

&lt;p&gt;To get this tool, just install libreoffice on your server using :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt-get install libreoffice -qq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A little look to the doc and you can see two options we will use : &lt;/p&gt;

&lt;p&gt;&lt;code&gt;--convert-to&lt;/code&gt; : allow us to convert a file from our extension to pdf&lt;br&gt;
&lt;code&gt;--headless&lt;/code&gt; : it ignore GUI environment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;libreoffice --headless --convert-to pdf my_file.docx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Rails : there is a gem for that
&lt;/h2&gt;

&lt;p&gt;In a rails app, just add a gem on your Gemfile :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Gemfile&lt;/span&gt;
&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'libreconv'&lt;/span&gt;

&lt;span class="c1"&gt;# In your ruby file module or class&lt;/span&gt;
&lt;span class="no"&gt;Libreconv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;convert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="no"&gt;Rails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;root&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/public/files/my_file.docx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="no"&gt;Rails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;root&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/public/files/my_file.pdf"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bundle install, and now you can make a preview of your file using the PDF version on your server. Note that libreoffice's tool don't convert only in PDF but can convert a file from extension that it can open and read to a file with extension that he can write. PDF won't disappoint you ;) &lt;/p&gt;

</description>
      <category>rails</category>
      <category>office</category>
      <category>openoffice</category>
      <category>linux</category>
    </item>
    <item>
      <title>Docket : connect to your docker's container easily !</title>
      <dc:creator>pob</dc:creator>
      <pubDate>Thu, 05 Mar 2020 15:54:46 +0000</pubDate>
      <link>https://forem.com/pobb/docket-connect-to-your-docker-s-container-easily-10gc</link>
      <guid>https://forem.com/pobb/docket-connect-to-your-docker-s-container-easily-10gc</guid>
      <description>&lt;p&gt;I'll introduce you today a tool helping you to connect to docker containers quickly and easily using CLI.&lt;/p&gt;

&lt;p&gt;The current docker way you already know is simple. If you want to connect to one of your running containers, you have to execute "&lt;strong&gt;docker ps&lt;/strong&gt;" command, listing all your (&lt;em&gt;running&lt;/em&gt;) containers informations. &lt;/p&gt;

&lt;p&gt;Next you have to execute "&lt;strong&gt;docker exec -it my_container bash&lt;/strong&gt;" command. This will connect you in your container to a bash session.&lt;/p&gt;

&lt;p&gt;Every time I use the "docker ps" command, I get a long and large table. Unreadable if your terminal is not with 6px font-size .. On my terminal it looks like this : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W6gYcRaM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/Dkc2VgY.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W6gYcRaM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/Dkc2VgY.png" alt="docker ps command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not really easy to read. But because I hate loose my time and love to find funny's solutions, I tried to develop a script that automatically get all containers available in "docker ps" command, only displaying "name" in a list option. I just have to select the right one with my keyboard, and it give me the good bash session, that's all !&lt;/p&gt;

&lt;h2&gt;
  
  
  Docket : docker in your pocket !
&lt;/h2&gt;

&lt;p&gt;That's why Docket is born : in a few lines of bash or ruby (&lt;em&gt;maybe one day it will be available in python too&lt;/em&gt;), job is done !&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y4Z1jdlA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/http://g.recordit.co/vN2zEXCrgw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y4Z1jdlA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/http://g.recordit.co/vN2zEXCrgw.gif" alt="Recordit GIF"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All of my mates that saw it on my computer just asked to use it, so maybe it will be useful to you too! Go on the &lt;a href="https://github.com/Pobb/docket"&gt;GitHub project&lt;/a&gt; for setup instructions. You just have to download script (bash or ruby, as you want), and execute it. For more comfortable use, you can create an alias.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>container</category>
      <category>bash</category>
      <category>ruby</category>
    </item>
  </channel>
</rss>
