<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pio Tofanelli on Medium]]></title>
        <description><![CDATA[Stories by Pio Tofanelli on Medium]]></description>
        <link>https://medium.com/@ptofanelli?source=rss-6cd0ae5a959------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Db0LQ5fyMBTsXpgaIn1fpA.png</url>
            <title>Stories by Pio Tofanelli on Medium</title>
            <link>https://medium.com/@ptofanelli?source=rss-6cd0ae5a959------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 14:30:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ptofanelli/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mindfulness na Liderança de Equipes]]></title>
            <link>https://medium.com/@ptofanelli/mindfulness-na-lideran%C3%A7a-de-equipes-13e7d8f0db40?source=rss-6cd0ae5a959------2</link>
            <guid isPermaLink="false">https://medium.com/p/13e7d8f0db40</guid>
            <category><![CDATA[soft-skills]]></category>
            <category><![CDATA[leadership-development]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[mindfulness-at-work]]></category>
            <category><![CDATA[mindfulness]]></category>
            <dc:creator><![CDATA[Pio Tofanelli]]></dc:creator>
            <pubDate>Sun, 22 Dec 2019 19:41:56 GMT</pubDate>
            <atom:updated>2019-12-22T19:41:56.823Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dri_uDCw1g3xai7IeXy6mg.png" /></figure><p>Este breve artigo descreve a minha primeira experiência com o mindfulness e os benefícios que este trouxe para o meu papel de liderança.</p><h3>O Desafio</h3><p>No início de 2019, fui convidado a liderar a equipe de desenvolvimento do aplicativo <a href="https://whatsgood.com.br/"><strong>WhatsGood</strong></a> da <a href="https://cravehq.com/">Crave</a>, composta por profissionais altamente capacitados tecnicamente e que esperariam um líder técnico especialista para conduzi-los. Com minha carreira generalista e uma breve experiência em liderança, estava aquém do nível técnico da equipe. Havia um grande desafio a minha frente.</p><p>Logo nos primeiros dias, senti a pressão do fluxo de trabalho completamente diferente do anterior, antes trabalhando remoto e agora lado a lado com minha equipe em escritório. Além disso, as ferramentas de trabalho eram completamente diferentes: de Windows, Visual Studio e Xamarin passei a utilizar MacOS, Android Studio, GitHub e inúmeras outras ferramentas que antes para mim eram desconhecidas.</p><p>Eu estava correndo contra o tempo para me adaptar, corresponder tecnicamente ao time e servi-los como um líder. Durante esse período intenso, sentia ansiedade por duvidar da quantidade e qualidade do trabalho que estava entregando. Para minha sorte, a Crave me ofereceu o curso de Mindfulness, o que aceitei prontamente.</p><h3>O Mindfulness</h3><p>O curso, chamado <a href="https://www.entua.com.br/cursos/curso-mindfulness-para-qualidade-de-vida-e-reducao-do-estresse/"><strong>Viva Consciente — Mindfulness para qualidade de vida e redução de stress</strong></a><strong> </strong>conduzido pelo excepcional <a href="https://www.linkedin.com/in/marcelo-borges-de-oliveira/">Marcelo Borges</a><strong>,</strong> tratava-se de oito encontros toda segunda-feira, no início da noite, em uma chácara silenciosa e que mesmo em dias quentes, era agradável. A turma era composta por uma variedade interessante de pessoas de diferentes idades, profissões, formações, crenças e opiniões.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-UOLxWhadtPrA6khAUyR7g.png" /><figcaption>Turma 9 — Viva Consciente</figcaption></figure><p>Logo no início do primeiro encontro veio a lição mais valiosa: <strong>RESPEITO</strong>. Sim, o instrutor deixa claro que independente de toda e qualquer diferença entre as pessoas no grupo, devemos respeitá-las e ouvi-las de mente e coração abertos. Nesse momento já me sinto mais calmo e seguro para compartilhar um pouco sobre mim.</p><p>Durante os encontros aprendemos e discutimos algumas práticas simples de serem aplicadas no cotidiano e que tem um grande potencial de trazer bem estar e, especificamente, saúde mental. Claro que não há uma regra universal, uma prática que funcione bem para alguém pode não fazer sentido para outra pessoa, portanto, devemos enxergar as práticas com respeito e de coração aberto, adaptando-as para a nossa realidade. No meu caso, separei algumas atividades que considerei mais importantes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uHtta0Qy0pOgUvMLFJSOVQ.png" /><figcaption>Abraço da turma no final dos encontros</figcaption></figure><h4>Atenção Plena</h4><p>Este é o alicerce do mindfulness, que mostra a importância da real presença em um determinado momento. Como ilustrado na primeira imagem deste artigo, <em>Be Here Now</em> (esteja aqui agora), essa prática ressalta a possibilidade estar plenamente consciente em atividades do cotidiano, tais como comer, conversar e caminhar, e percebê-las de uma maneira nova.</p><p>A atenção plena me serviu como uma luva, pois me fez perceber que estava em uma rotina acelerada do trabalho e ainda assim tentando fazer o máximo de atividades extras possíveis para &quot;aproveitar o tempo&quot; (crossfit, pilates, vôlei, pós graduação). E nessa ansiedade por fazer tudo, na realidade não estava fazendo nada de forma consciente.</p><h4>Escaneamento Corporal</h4><p>Trata-se de um escaneamento pelo corpo no intuito de utilizar as sensações de cada parte como âncoras que auxiliam a atenção no momento presente. Pode-se começar dos pés ou pela cabeça onde a pessoa faz um movimento mental de <em>scanner</em> pelo corpo se atentando a cada detalhe e sensação.</p><p>Praticar o escaneamento corporal foi a primeira vez que consegui esvaziar os pensamentos conscientemente, simplesmente pensar em nada, somente num vazio e escuro. É uma tremenda sensação de alívio.</p><p>Para mim essa prática funciona muito bem antes de dormir, pois ameniza a velocidade dos pensamentos e proporciona um relaxamento conduzindo a um sono melhor.</p><h4>Respiração</h4><p>Esta prática separa a respiração em quatro etapas:</p><blockquote>— Inspirar<br>— Pausa<br> — Expirar<br> — Pausa</blockquote><p>Nesta também se utiliza a respiração como âncora de atenção, focando somente nessa atividade.</p><p>No meu caso, utilizo essa prática em momentos em que preciso de concentração nos estudos ou trabalho e percebo que estou muito agitado. Então coloco fones de ouvido com cancelamento de ruído, utilizo o <a href="https://www.noisli.com/">Noisli</a> como som de fundo (ou mesmo alguma trilha sonora instrumental) e faço um exercício de respiração.</p><h4>Pensamentos</h4><p>Todos nós temos problemas, traumas e tristezas que visitam nossos pensamentos frequentemente e que muitas vezes atrapalham um momento. A prática simples de reconhecer, aceitar e deixar ir esse pensamento ajuda muito a retomar o controle e seguir presente e consciente do momento. Uma simples sequência de frases é o suficiente para a prática:</p><blockquote>Olá Pensamento. Obrigado Pensamento. Tchau Pensamento.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ik1F2mubHZQydSQfUq2TOw.png" /><figcaption>Representação dos pesos que carregamos conosco</figcaption></figure><h3>A Liderança</h3><p>Eu levei muitas práticas do Mindfulness para a minha rotina pessoal e profissional. Como líder de equipe, acredito que o maior ganho foi aprender a ouvir mais e melhor, estar realmente presente quando alguém me fala algo, assim, mostrando à pessoa que ela pode confiar em mim e que está sendo realmente ouvida.</p><p>Outro ponto importante é o respeito pelas diferenças e a aceitação de que cada um tem seus dias bons e ruins. Por algumas vezes senti uma atitude áspera de alguém comigo ou outro colega, mas não interpretei como algo pessoal, pelo contrário, prestei atenção para entender o motivo da pessoa estar desajustada naquele momento específico e como eu poderia ajudar.</p><p>Estar mais presente e ouvir melhor os meus pensamentos, sentimentos e sensações, transformou os momentos de frustrações, irritações e tristezas mais breves pois passei a aceitar melhor minhas limitações, assim como entender minhas ambições e no meio de tudo isso, um equilíbrio de concentração e foco no momento presente.</p><h3>O Resultado</h3><p>Após realizar as avaliações semestrais de cada integrante de minha equipe, obtive o feliz parecer de que meu time se sentia representado por um ótimo líder que os ouvia, compreendia e respeitava. Esse retorno deles sobre minha liderança foi extremamente gratificante ao proporcionar o sentimento de trabalho cumprido, de estar fazendo a diferença na equipe e na companhia.</p><p>Por meio do <a href="https://officevibe.com/">OfficeVibe</a>, ferramenta de pesquisa e acompanhamento da satisfação de colaboradores, constatei que o time de Android estava acima da média de satisfação geral da empresa.</p><p>A produtividade do time também cresceu. A partir do momento que passei a me comunicar melhor com meu time, passei a entender suas necessidades e dificuldades, então foi possível tomar atitudes para atendê-los de uma forma melhor, abrindo o caminho para que pudessem focar em seu trabalho tranquilamente.</p><p>Sendo assim, o time sobre uma liderança reconhecida e respeitada tornou-se mais rápido e satisfeito.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mu4XrxDomKCExVpCbTK2kw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13e7d8f0db40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How working on WhatsGood changed my relationship with food]]></title>
            <link>https://medium.com/@ptofanelli/how-working-on-whatsgood-changed-my-relationship-with-food-ba0433912b25?source=rss-6cd0ae5a959------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba0433912b25</guid>
            <category><![CDATA[whatsgood]]></category>
            <category><![CDATA[health-foods]]></category>
            <category><![CDATA[health-lifestyle]]></category>
            <category><![CDATA[buylocal]]></category>
            <category><![CDATA[fresh-food]]></category>
            <dc:creator><![CDATA[Pio Tofanelli]]></dc:creator>
            <pubDate>Mon, 07 Oct 2019 19:06:38 GMT</pubDate>
            <atom:updated>2019-10-07T19:12:14.579Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RVk3uIGNYBYZBF_ngcTk4A.png" /><figcaption>source: <a href="https://www.instagram.com/sourcewhatsgood/">instagram.com/sourcewhatsgood</a></figcaption></figure><h3>How working on WhatsGood team changed my relationship with food</h3><p>It has been some time since I decided that I wanted to have a healthier way of life. It all started after noticing that most of my close relatives suffered from conditions caused by bad eating habits and lack of exercise. You name it, they have it: high blood pressure, high triglyceride levels, high cholesterol, obesity, shortness of breath and so on. I did not want that for myself.</p><p>I always felt that I lived a relatively healthy lifestyle in comparison to others in my country, but felt it wasn’t enough. In the beginning of 2016, I decided to make more of a commitment to my diet and make some serious changes:</p><ul><li>No more sodas</li><li>No fast food</li><li>Stopped adding sugar to anything</li><li>Cut out processed pastries and candies — and with it, a lot of fat</li><li>Replaced anything possible for whole grains</li><li>Chose homemade over delivery</li></ul><p>March 2019, I started working at <a href="https://cravehq.com/">Crave</a> as Android Team Leader on <a href="https://www.sourcewhatsgood.com/">WhatsGood</a>. That was when I was inspired to further evaluate my lifestyle.</p><h3>WhatsGood</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TeMJjBEcT0aC-aaFvJ_ocQ.png" /><figcaption>source: <a href="https://www.instagram.com/sourcewhatsgood/">instagram.com/sourcewhatsgood</a></figcaption></figure><p>In short, WhatsGood is a service that connects small local producers directly to consumers. For me, the WhatsGood culture became the motivation to take the next step in improving my habits. And here is why:</p><h3>Buy Local</h3><p>You can’t go wrong buying from small local producers: they are more likely to care about their products and their customers, giving more time to both. In addition, by buying local you will spend your dollars where it counts, on your local community, instead of giving money to huge companies, whose owners have enough helicopters already.</p><h3>Buy Fresh</h3><p>Let’s be honest, what would you choose: a loaf of bread that has been sitting on a supermarket shelf for weeks or just baked, naturally fermented bread, made with organic ingredients? I rest my case.</p><h3>Impact Less</h3><p>Consuming products from small local producers within your region reduces your environmental impact because your food travels a shorter distance. Your producers will use less water and fuel, producing less pollution and less packing waste compared to mass-produced products.</p><h3>Rethink Cost</h3><p>It is not a rule, but often local products cost more than the ones available at the market. I, myself, have always asked (and heard the same question a bunch of times too) “Why is health, fresh food so expensive?”. Now, I believe it is time to change the question to “How do big companies make such cheap food?”.</p><p>My family runs a small business making homemade corn based pastries and candies. I’ve been helping them for the last eight years. During this time, I noticed how difficult the artisan food business is: you get up early, work hard preparing the ingredients (with no artificial additives), and delivery it yourself or sell it on a small stand at a farmers market. The result is a fresh natural product that is worth its cost.</p><p>Truth is: if your food is cheap, someone is paying for that. If it is not the purveyors, then it is the chef, the delivery crew or the buyer. But more often than not, it is our purveyors who suffer.</p><h3>Conclusion</h3><p>Now that I am learning more about “WhatsGood”, I have been more thoughtful about the products I consume: where they are from, who produces them, how they are made, what are the ingredients and how healthy they are for me, my local community and the environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3XEzeu8URK_r3hO540qCaw.png" /><figcaption>source: <a href="https://www.instagram.com/sourcewhatsgood/">instagram.com/sourcewhatsgood</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba0433912b25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Raspberry Pi — Creating a home media server]]></title>
            <link>https://medium.com/@ptofanelli/raspberry-pi-creating-a-home-media-server-767e169a6cb3?source=rss-6cd0ae5a959------2</link>
            <guid isPermaLink="false">https://medium.com/p/767e169a6cb3</guid>
            <category><![CDATA[file-sharing]]></category>
            <category><![CDATA[torrent]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[media-server]]></category>
            <category><![CDATA[dns]]></category>
            <dc:creator><![CDATA[Pio Tofanelli]]></dc:creator>
            <pubDate>Mon, 26 Nov 2018 12:37:40 GMT</pubDate>
            <atom:updated>2020-08-05T15:47:11.931Z</atom:updated>
            <content:encoded><![CDATA[<h3>Raspberry Pi: Creating a home media server</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fc-8bcLObWseLtNk.jpg" /><figcaption>Raspiberry Pi 3</figcaption></figure><p>In this long article I&#39;m going to show how I set up a <strong>Raspberry Pi</strong> as a home server for media, backup and file sharing, and also working as torrent client. I will assume the reader has some basic knowledge about Linux.</p><p>At the end of this tutorial we should have a raspberry pi configured as home server, sharing files via samba and media via DLNA, working as torrent client and accessible by public address.</p><h3>Equipment</h3><p>Minimum:</p><ul><li>Raspberry Pi (any model with USB Type A Port). I&#39;ll just call it &quot;raspi&quot; through this article.</li><li>Micro SD card for the raspi OS. Minimum 8GB fastest card you can get.</li><li>(Optional) External USB hard drive (either 2.5&quot; or 3.5&quot;). It is optional because you can use the memory card as storage.</li><li>5V 1A micro usb power supply. A cellphone charge will do. When using a 2.5&quot; usb-powered external hdd, a 5V +2A power supply must be used.</li></ul><p>This case:</p><ul><li>Raspberry Pi 2 Model B+</li><li>Sandisk 32GB class 10 A1 micro SD card</li><li>2.5&quot; usb powered 1TB exFAT external HDD</li><li>5V 2A Motorola Moto G4 Play cellphone charger</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/0*t2WYWcs5AZ2FRwIG" /><figcaption>Equipment used in this article</figcaption></figure><h3>Operational System</h3><p>This entire article is based on <strong>Raspibian</strong> Noobs OS distribuition. It is really easy to install following the official docs on <a href="https://www.raspberrypi.org/documentation/installation/noobs.md">https://www.raspberrypi.org/documentation/installation/noobs.md</a></p><p>After installation, there are some setups to do:</p><ul><li>Change user (pi) password</li><li>Change hostname</li><li>Enable SSH access</li><li>Disable graphical interface</li></ul><p>Everything is done via terminal using raspi configuration program. The default user created is “pi”. I do not recommend changing that to keep things simple.</p><pre>$ sudo raspi-config</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*lTT0NxwDbu7fFFDmNHCDDQ.png" /><figcaption>raspi-config main menu</figcaption></figure><p>Changing user password is straightforward, just select <strong><em>Change User Password</em> </strong>and the user will be prompt to enter the new password for the default user “pi”</p><p>Modifying the hostname is also pretty simple. Access <strong><em>Network Options &gt; Hostname</em></strong> and fill it as you like. In this case, I used <em>rpi</em>.</p><p>To enable SSH, go to <strong><em>Interfacing Options &gt; SSH</em></strong> and enable it.</p><blockquote>Before disabling the Graphical User Interface (GUI), make sure the raspi is accessible by other computer connected to the same network.</blockquote><p>To disable the GUI, go to <strong><em>Boot Options &gt; Desktop/CLI</em></strong> and choose <strong><em>Console</em></strong> or <strong><em>Console Autologin</em></strong>. If you choose autologin, the user pi will log on automatically on startup.</p><p>All that done, you can restart it to apply the modifications.</p><pre>$ sudo reboot</pre><blockquote>I recommend attributing a fixed Local network IP to raspi, facilitating the remote access. It can be done through the DHCP server — usually a router — using raspi’s MAC address or directly in the raspi. The command to show current IP and MAC address is <em>ifconfig.</em> In this case, I reserved an IP to the raspi’s MAC in the router. This configuration is usually under <strong><em>DHCP &gt; Address Reservation</em></strong><em>.</em></blockquote><p>The last step is to update and upgrade the packages through apt-get</p><pre>$ sudo apt-get update<br>$ sudo apt-get upgrade<br>$ sudo apt-get update<br>$ sudo apt-get dist-upgrade</pre><p>The linux full version used at this article is:</p><pre>$ uname -a<br>Linux rpi 4.14.71-v7+ #1145 SMP Fri Sep 21 15:38:35 BST 2018 armv7l GNU/Linux</pre><h3>External HDD</h3><p>This section shows how to set up the external hdd to be mounted automatically on system boot. It is optional if you are not using an external drive, hence storing all files on the sd card.</p><p>First, create a folder to mount the HDD.</p><pre>$ mkdir /media/hd</pre><blockquote>If you are going to use NTFS drives, install the <strong><em>ntfs-3g</em></strong> package, enabling the system to read/write on NTFS partitions.</blockquote><blockquote><strong>$ sudo apt-get install ntfs-3g</strong></blockquote><p>To mount it automatically, you will need the drive’s UUID. It is shown executing the <em>blkid</em> command. Find your drive by its label.</p><pre>$ sudo blkid </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3hNxWuDhVLGd8MEeZdkzaQ.png" /><figcaption>Getting HDD UUID</figcaption></figure><p>Finally, we must edit the <strong><em>/etc/fstab</em></strong> adding a line to mount this drive on boot on the folder we created previously. Before editing the file, make a copy of it.</p><pre>$ sudo cp /etc/fstab /etc/fstab.bkp<br>$ sudo nano /etc/fstab<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F4rkG69Z-aUchvJ4zFmR8w.png" /><figcaption>/etc/fstab edited</figcaption></figure><blockquote>Use <em>ntfs-3g</em> for NTFS, <em>vfat</em> for FAT32, <em>ext4</em> for ext4 and exfat for exFAT partitions.</blockquote><p>Now reboot and check if the drive was mounted, and also the write permissions by executing echo test &gt; /media/hd/test.txt<em> </em>and checking if the file was created with the “test” content.</p><h3>Sharing Files in the Home Network</h3><p>In this section we will enable a folder to be accessible to all devices connected in the local network. To do so, we need to install and configure <strong>samba</strong>.</p><pre>$ sudo apt-get install samba samba-common-bin</pre><p>After installation, let&#39;s set up samba by editing the file <strong><em>/etc/samba/smb.conf</em></strong>. First of all, create backup of the file. In this case, I want to share the entire HDD connected to pi, so I set up the storage mount root (/media/hd)</p><pre>#======================= Share Definitions =======================<br>[storage]<br>   comment=Home Media<br>   path=/media/hd<br>   browseable = yes<br>   writeable = yes<br>   only guest = no<br>   create mask = 0777<br>   directory mask = 0777<br>   public = no<br>   guest ok = yes<br>   available = yes<br>   force user = pi<br>   read only = no<br></pre><p>With these settings, we are giving full access to the samba user pi and guests. To restrict access, modify the parameters to match your need, but remember to always execute <strong><em>testparm</em></strong> after editing <strong><em>smb.conf</em></strong><em> </em>to check for errors in the configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*1Qq4Bdq2hM1PUq2AaGb_zw.png" /><figcaption>testparm command</figcaption></figure><p>Check below how to set up pi user to samba:</p><pre>$ sudo smbpasswd -a pi</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*bC4Kk12jbtkxncMnNur3Iw.png" /><figcaption>Setting user pi password for samba</figcaption></figure><p>Restart samba service.</p><pre>$ sudo /etc/init.d/samba restart</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*BsG1waflYNeLpurLFi1Uqw.png" /></figure><p>Now it should be working.</p><blockquote>To access the file share on windows, use <em>\\&lt;raspi IP or hostname&gt;\&lt;share name&gt;</em>, in this case <em>\\rpi\storage.</em> To access on Linux or Mac, use smb://&lt;raspi IP or hostname&gt;</blockquote><h3>Public IP &amp; DNS</h3><p>Enabling your raspi to be publicly accessible is simple — we just need to use a free DNS service, in this case, I am using the <a href="https://freedns.afraid.org/"><strong>FreeDNS</strong></a> service. It offers free subdomain names so it will be possible to reach your home server from anywhere. This section is based on this <a href="https://thelastmaimou.wordpress.com/2014/03/23/find-pi-everywhere-freedns-a-free-dynamic-dns-service/">tutorial</a>.</p><p>First step is to sign up on the service, then choose domain server in a list on <em>registry</em> page, set up a subdomain name that is not used yet and finally copy the hash created for it. Check below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*csHCLfQ3lUaQGtbYuIu7eQ.png" /><figcaption>Sign up</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*7gAdvSNYH--W_jgtZdlyxQ.png" /><figcaption><strong>Domains</strong> page: choose a domain to create your subdomain.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*M4uSBdU7gtJ7O6sLoCPqpg.png" /><figcaption>Set a new subdomain</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*tYparlAZsoNUjrjTrbZ8lg.png" /><figcaption>On <strong><em>Dynamic DNS</em></strong><em> page, copy the link from </em><strong><em>Direct URL</em></strong><em>. You should get an URL like this: </em>http://freedns.afraid.org/dynamic/update.php?&lt;<strong>HASHKEY&gt;</strong></figcaption></figure><p>Now that we have the subdomain and hashkey, it is possible to update the IP on DNS server just executing <strong><em>wget</em></strong> command:</p><pre>$ wget -q --read-timeout=0.0 --waitretry=5 --tries=400 http://freedns.afraid.org/dynamic/update.php?<strong>&lt;HASHKEY&gt;</strong></pre><p>But, if the external IP changes (what probably will happen) a new update is needed, so let&#39;s make raspi update the IP in the DNS server once in a while to avoid updating it manually. First, create the script file</p><pre>$ sudo nano /etc/cron.d/freedns_update.sh</pre><p>Script:</p><pre>#!/bin/sh<br># freedns_update.sh: Update the public IP on freedns.afraid.org only if it has changed.<br>## Place this script in the cron&#39;s job directory /etc/cron.d and assign the proper permissions<br>## and owner<br>## sudo chmod 500 /etc/cron.d/freedns_update.sh<br>## sudo chown root:root /etc/cron.d/freedns_update.sh<br>## Add to /etc/crontab to execute on reboot and every 5 minutes<br>## Edit /etc/crontab and append these two lines:<br>## <a href="http://twitter.com/reboot">@reboot</a> root /etc/cron.d/freedns_update.sh &gt;/dev/null<br>## */5 * * * * root /etc/cron.d/freedns_update.sh &gt;/dev/null<br> <br>#Use your own values<br>DOMAIN=rpihomeserver.us.to<br>HASHKEY=<strong>&lt;HASHKEY&gt;</strong><br> <br>UPDATE_URL=&quot;<a href="http://freedns.afraid.org/dynamic/update.php?${HASHKEY">http://freedns.afraid.org/dynamic/update.php?${HASHKEY</a>}&quot;<br>    <br>current_ip=$(wget -q --output-document - <a href="http://checkip.dyndns.org/">http://checkip.dyndns.org</a> | grep -o &#39;[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}&#39;)<br>registered_ip=$(ping -qn -c 1 $DOMAIN | head -n 1 | grep -o &#39;[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}&#39;)<br> <br>if [ &quot;${current_ip}&quot; != &quot;${registered_ip}&quot; ]; then  <br>   wget -q --read-timeout=0.0 --waitretry=5 --tries=400 --output-document /dev/null $UPDATE_URL<br>   if [ $? -eq 0 ]; then<br>     echo &quot;$(date +&quot;%b %_d %T&quot;) $(hostname) $0: IP address updated on freedns.afraid.org: new IP &#39;${current_ip}&#39;, old IP &#39;${registered_ip}&#39;&quot; &gt;&gt; /var/log/messages<br>   else    <br>     echo &quot;$(date +&quot;%b %_d %T&quot;) $(hostname) $0: ERROR IP address could not be  updated on freedns.afraid.org: current IP &#39;${current_ip}&#39;, registered IP &#39;${registered_ip}&#39;&quot; &gt;&gt; /var/log/messages<br>   fi<br>fi</pre><p>Having the script created, we just add the script at <strong><em>cron</em></strong><em>:</em></p><pre>$ sudo chmod 500 /etc/cron.d/freedns_update.sh<br>$ sudo chown root:root /etc/cron.d/freedns_update.sh</pre><p>And add these two lines at <em>/etc/crontab:</em></p><pre>@reboot root /etc/cron.d/freedns_update.sh &gt;/dev/null<br>*/5 * * * * root /etc/cron.d/freedns_update.sh &gt;/dev/null</pre><p>Lets just restart raspi to make sure configuration takes effect. You should be able to access your raspi by the address name chosen.</p><blockquote>Remember to set up port forwarding on your router for the services will want to access remotely.</blockquote><h3>Torrent Client</h3><p>We will install and configure <strong>Deluge</strong> as web-based torrent client on raspi. The WebUI version has fewer features than the full ThinClient experience, but it pays by being lighter and enabling remote access. To install the WebUI, run the following commands. The deluge-web command locks the terminal, make sure you open another terminal before running it.</p><pre>$ sudo apt-get install deluged<br>$ sudo apt-get install python-mako<br>$ sudo apt-get install deluge-web<br>$ deluge-web</pre><p>This sequence installs the Deluge daemon, Mako (a template gallery for Python that the WebUI needs), the WebUI itself, and then starts the WebUI program.</p><p>The default port for the WebUI is 8112. If you want to change it, edit the file by running the following commands:</p><pre>$ sudo pkill deluge-web<br>$ nano ~/.config/deluge/web.conf</pre><p>This stops the WebUI and opens up the configuration file for it. Use nano to edit the line: “port”: 8112, and replace the 8112 with any port number above 1000 (as 1–1000 are reserved by the system).</p><p>Once you have the WebUI up and running, it’s time to connect using a web browser. Open up a browser and point it at the IP address of your raspi with the port you just chose (e.g. http://192.168.0.10:8112 ).</p><p>You’ll be greeted with a password prompt (the default password is “deluge”) and be immediately encouraged to change it after you enter it for the first time. After that, you’ll be able to interact with Deluge via the lightweight interface.</p><p>Now it is time to configure the paths Deluge will use. In this case, a folder in the storage we set up previously. Remember to create the folders before you set them up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*z8ylqZKUvmwB8srR9mLAtg.png" /><figcaption>Check the boxes to customize the settings. I preferred to use just one folder for all files.</figcaption></figure><p>Test the download and upload. Maybe it will be necessary to open and forward the ports used by deluge. Also do it on <strong>P<em>references</em></strong> too.</p><p>Before we leave the Deluge setup, there is one final detail to attend to: we need to set up the Deluge daemon and WebUI to run automatically when our raspi boots up. To do so simply, we’ll simple annotate the rc.local file, so open it for edition.</p><pre>sudo nano /etc/rc.local</pre><p>Having the rc.local file loaded, add the following lines to the end:</p><pre># Start Deluge on boot:<br>sudo -u pi /usr/bin/python /usr/bin/deluged<br>sudo -u pi /usr/bin/python /usr/bin/deluge-web</pre><p>Restart. Now the Deluge daemon and Web UI should run on startup.</p><h3>Media Server</h3><p>It is possible to share the media files present on raspi storage to other devices connected in the local network (e.g. TVs, Consoles, PCs and Smartphones) through DLNA protocol using <strong>miniDLNA</strong>. First, let&#39;s install it.</p><pre>$ sudo apt-get install minidlna<br>$ sudo service minidlna stop</pre><p>Add minidlna user to the user group pi</p><pre>$ sudo usermod -a -G pi minidlna</pre><p>Having miniDLNA installed, we stop the service to edit its configuration file /etc/minidlna.conf as we have to point out the folders we want it to monitor and share on the local network. It helps a lot if you describe what kind of files the service should expect in that folder. There are samples inside the conf file we can base on:</p><blockquote># * “A” for audio (eg. media_dir=A,/var/lib/minidlna/music)<br># * “P” for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)<br># * “V” for video (eg. media_dir=V,/var/lib/minidlna/videos)<br># * “PV” for pictures and video (eg. media_dir=PV,/var/lib/minidlna/camera)</blockquote><p>In the <strong><em>conf file</em></strong> we have to change three things: <strong><em>media_dirs</em></strong> (media folders we want to share), <strong><em>inotify</em></strong> (monitor folders for update) and <strong><em>friendly_name</em></strong> (name of the service that will appear on the client devices). Here is my configuration:</p><pre>[...]<br>media_dir=V,/media/hd/movies<br>media_dir=A,/media/hd/songs<br>[...]<br>inotify=yes<br>[...]<br>friendly_name=Tofamedia</pre><p>Save and close the conf file, restart the service and force the reload.</p><pre>$ sudo service minidlna start<br>$ sudo service minidlna force-reload</pre><p>Check the service status to see there was any errors.</p><pre>$ sudo service minidlna status</pre><p>In my case, the service was running as a user that did not have permission on the media folder I set up. To fix it, I changed the user the service should use to run on /etc/init.d/minidlna</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*L8zXySeh7KXcsoTaQzA_yQ.png" /><figcaption>Set the user minidlna should use to run</figcaption></figure><p>Save, restart raspi, check the service health and try to open a media file from other devices connected on the local network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/0*dGWGPFWCe-I5j98s" /><figcaption>Accessing media on the TV</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*dyqhMZVpndCqCxnbieFvcQ.png" /><figcaption>Accessing media on android phone via <strong>BubbleUPnP</strong> app.</figcaption></figure><blockquote>If your TV does not support DLNA, it is possible to use <strong>BubbleUPnP</strong> app to play media files from raspi on Chromecast only using the smartphone.</blockquote><h3>FTP Server</h3><p>This sections shows how to prepare your raspi system to send and receive files through FTP. The First step is to install a FTP server service. We will use <strong>vsftpd.</strong></p><pre>$ sudo apt-get install vsftpd</pre><p>Having it installed, let&#39;s stop the service and configure it.</p><pre>$ sudo service vsftpd stop<br>$ sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bkp<br>$ sudo nano /etc/vsftpd.conf</pre><p>Add the following configurations to the file (make sure it covers your scenario)</p><pre># Edit or uncomment the following lines<br>anonymous_enable=NO<br>local_enable=YES<br>write_enable=YES<br>ftpd_banner=Welcome to Tofa FTP server<br>ascii_upload_enable=YES<br>ascii_download_enable=YES</pre><pre># ADD the following lines to the bottom of the file<br>pasv_enable=YES<br>listen_port=64000<br>pasv_min_port=64001<br>pasv_max_port=64040<br>pasv_address=<strong>&lt;YOUR REMOTE ADDRESS (e.g. rpihomeserver.us.to)&gt;</strong><br>pasv_address_resolve=YES<br>local_root=/media/hd</pre><p>Start the service. Remember to forward the ports 64000–64040 to your raspi IP.</p><pre>$ sudo service vsftpd start</pre><p>Test the service on a FTP client using a system user (pi). I used FileZilla.</p><h3>That’s it</h3><p>Now we have a Raspberry Pi setup that works as an always on torrent client, file and media sharing and can be accessed over the internet anywhere.</p><p>I hope it was useful.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=767e169a6cb3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Xamarin Forms: REST API cloud database using Azure Easy Tables]]></title>
            <link>https://medium.com/@ptofanelli/xamarin-forms-rest-api-cloud-database-using-azure-easy-tables-7434476df138?source=rss-6cd0ae5a959------2</link>
            <guid isPermaLink="false">https://medium.com/p/7434476df138</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[xamarin-forms]]></category>
            <category><![CDATA[cloud-storage]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Pio Tofanelli]]></dc:creator>
            <pubDate>Tue, 18 Sep 2018 14:42:24 GMT</pubDate>
            <atom:updated>2018-09-19T13:36:01.949Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*SfpUzbfNLO6RumH_V_GPEg.jpeg" /></figure><p>Recently I had to develop a project in the graduate study on mobile development that I am attending to, a simple CRUD app in Xamarin Forms, so I chose Azure <strong>Easy Tables</strong> as data storage instead of <strong>SQLite</strong>.</p><p>The application consists of a private gallery organized in posts: users take a picture or choose one from another gallery, write a comment and save it. The image and text is shown as a post on a timeline in the application main screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*ZHXzQDx89N5b1WCgb1jQuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*_Yn5bpPwOC9tBmQ0fPyHVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*6G43hJdp_TEuph-8vFkXfQ.png" /><figcaption>Timeline, New Post and Edit Post screens</figcaption></figure><h3>Setting Up Easy Tables</h3><p>First things first, using easy tables requires creating some resources on Azure Cloud: App Service Plan, App Service, SQL Server and SQL Database. Remember to always pay attention to the pricing tier of the resources being created.</p><h4>App Service Plan</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*nkwiwdOYz46G7A678hdr9g.png" /><figcaption>What App Service Plan is used for</figcaption></figure><p>Locate the App Service Plan inside the “Create a resource” menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yn3kcMPZ7ViuHJ6x1_yXng.png" /><figcaption>App Service Plan Menu Location</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*hRk8aeFE3Tj7xC6BslCCEg.png" /><figcaption>Service Plan settings</figcaption></figure><p>I usually use the same Resource Group to make the tests easier. In this case, I’m using an existing one. Just mark “Create new” if there is none.</p><p>It is important to choose the plan that fits best the project demand. In this case, the free pricing tier do the trick.</p><p>Create!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*qmsB1rZKCw-YgnomhKtESg.png" /><figcaption>App Service Plan created</figcaption></figure><h4>App Service</h4><p>As we have created the App Service Plan, now we can create resources. It is time to create the Mobile App service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*iEpP2j3x_1LN_TeoGMMrAQ.png" /><figcaption>Mobile App creation shortcut</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*aP-qxV36f-efdkGDyLAnGw.png" /></figure><p>Here it is necessary to choose an Azure unique name for the resource, as it has a public URL.</p><p>On “App Service plan/Location” choose the plan previously created.</p><p>Create!</p><h4>SQL Server and Database</h4><p>The Easy Tables must be inside a SQL Database. This creation process will ask you for a server to contain the database. On this terms, I will create a new SQL Server instance for the new database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*yxRpqbHhfMwG8qWceO_uUQ.png" /></figure><h4>Easy Tables</h4><p>Finally! The requirements for the easy tables are done, so let’s create it. Inside the App Service dashboard, open the Easy Tables menu. As it is not configured yet, a message will be shown as the first set up is opened.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*B1KHP7s4JldDUfntq8D3rw.png" /><figcaption>Easy Tables page</figcaption></figure><p>Now, just select the database that will be used for the future easy tables of this app service. It will be necessary to edit the connection string, add the username and password of the SQL Server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q7PF-Crxz5_1nld8Nrjqng.png" /><figcaption>Set up data connection for easy tables</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*TIGF6N6jXSczs7I4AxeQcg.png" /><figcaption>Easy Table database selection</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*adQKZ61xPc1AXyw4Aha4Tw.png" /><figcaption>Easy Tables database connection string</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*yIEOyiZ_dDKuisu3qapeyA.png" /></figure><p>As you have the data connection, it is time to initialize the resource in the second item, “Create TodoItem table”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*DMIalMMtF023Dz_meVpNxg.png" /><figcaption>Easy Tables Initialization</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*BPAN6TMj2_gR01aBSaBIOg.png" /><figcaption>posts table schema</figcaption></figure><p>The Easy Tables service is finally set up. Let’s create the <strong>posts</strong> table and edit its schema to look like the image shown. The columns id, createdAt, updatedAt, version, deleted are created automatically.</p><p>Done! The table access is available via REST API using the App Service URL+ “<strong>/tables/posts”</strong>. It is required to use the header “ ZUMO-API-VERSION” with a value of “2.0.0”.</p><p>The REST operations to get, add, update and delete are GET, POST, PATCH, DELETE. One item operations require the id to be sent in the URL (…/tables/posts/&lt;id&gt;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*ACT2diSTMuLQxY6JbYINaQ.png" /><figcaption>CORS set up</figcaption></figure><p>It is common having permission problems. If this happens, add the allowed origin “*” on the CORS page of the app service.</p><h3>The Source Code</h3><p>As a way to make it simpler, I’ve created an interface and an abstract class with the basic easy table operations: Get(GET), Add (POST), Update (PATCH), Delete (DELETE).</p><p>IAzureEasyTableClient:</p><pre>public interface IAzureEasyTableClient&lt;T&gt;<br>{<br>  Task&lt;T&gt; GetAsync(object id);<br>  Task&lt;IEnumerable&lt;T&gt;&gt; GetAsync();<br>  Task&lt;T&gt; AddAsync(T obj);<br>  Task&lt;T&gt; UpdateAsync(object id, T obj);<br>  Task&lt;T&gt; DeleteAsync(object id);<br>}</pre><p>AbstractAzureEasyTableClient:</p><pre>public class AbstractAzureEasyTableClient&lt;T&gt; : IAzureEasyTableClient&lt;T&gt;<br>{<br>  protected string url;<br>  protected HttpClient client;</pre><pre>  public AbstractAzureEasyTableClient(string url)<br>  {<br>    this.url = url;<br>    client = new HttpClient();<br>    client.DefaultRequestHeaders.Add(&quot;Accept&quot;, &quot;application/json&quot;);<br>    client.DefaultRequestHeaders.Add(&quot;ZUMO-API-VERSION&quot;, &quot;2.0.0&quot;);<br>  }</pre><pre>  public async Task&lt;IEnumerable&lt;T&gt;&gt; GetAsync()<br>  {<br>    string result = await client.GetStringAsync(url);<br>    try<br>    {<br>      return JsonConvert.DeserializeObject&lt;IEnumerable&lt;T&gt;&gt;(result);<br>    }<br>    catch (Exception)<br>    {<br>      return null;<br>    }<br>  }</pre><pre>  [...]<br>}</pre><p>Having these functions implemented by the abstract class makes extremely easy to create a class to handle the posts easy table:</p><pre>public class PostsClient : AbstractAzureEasyTableClient&lt;Post&gt;<br>{<br>  const string URL = &quot;&lt;your_app_service_url&gt;/tables/posts/&quot;;<br>  public PostsClient() : base(URL) { }<br>}</pre><p>Post class:</p><pre>public class Post<br>{<br>  public string Id { get; set; }<br>  public string Text { get; set; }<br>  public string ImageBase64 { get; set; }<br>  [JsonIgnore]<br>  public byte[] ImageBytes { get; set; }<br>  public DateTime UpdatedAt { get; set; }<br>  public bool ShouldSerializeUpdatedAt()<br>  {<br>    return false;<br>  }<br>[...]<br>}</pre><p>The complete solution is available on GitHub.</p><p><a href="https://github.com/ptofanelli/xamarin/tree/master/GalleryTimeline">ptofanelli/xamarin</a></p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7434476df138" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>