<?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 Carlo Gilmar on Medium]]></title>
        <description><![CDATA[Stories by Carlo Gilmar on Medium]]></description>
        <link>https://medium.com/@carlogilmar?source=rss-96696ff6f229------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*jouwssoX01bkOaIrbOQXDg.png</url>
            <title>Stories by Carlo Gilmar on Medium</title>
            <link>https://medium.com/@carlogilmar?source=rss-96696ff6f229------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:36:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@carlogilmar/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[Phoenix Live View: What is it?]]></title>
            <link>https://medium.com/@carlogilmar/phoenix-live-view-what-is-it-a218b2a5fcaa?source=rss-96696ff6f229------2</link>
            <guid isPermaLink="false">https://medium.com/p/a218b2a5fcaa</guid>
            <category><![CDATA[liveview]]></category>
            <category><![CDATA[phoenix]]></category>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[phoenix-liveview]]></category>
            <dc:creator><![CDATA[Carlo Gilmar]]></dc:creator>
            <pubDate>Sat, 07 Sep 2019 05:41:47 GMT</pubDate>
            <atom:updated>2019-09-07T05:41:47.003Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>The content below was generated for prepare a talk for the Elixir Meetup in CDMX 🇲🇽</strong></p><p><em>All the drawings were drew my me.</em></p><p>The <strong>Phoenix Live Views</strong> is an open-source project created since last October, 2018. The core maintainers are <strong>Chris McCord, Jose Valim, Alex Garibay, Gary Rennie and Scott Newcomer</strong>. <a href="https://elixir-slackin.herokuapp.com/">Join to the Elixir Community Slack!</a></p><p>In the next sections I’ll explain what is and how I understood that this works 😅.</p><h3>A live view</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*oDs5bC9xFm3UUzeE.png" /></figure><p>A <strong>live view</strong> could be understood as a process, this process keep an state, and modify his state if an event happens. Keep an eye here.</p><h3>Features and use cases</h3><p>If you read the documentation you’ll see similar content illustrated here.</p><p>A Live View:</p><ul><li>Use the Phoenix Channels, and it scales well vertically and horizontally</li><li>The first rendered is by regular HTTP request</li><li>Implements diff tracking</li><li>Identify static and dynamic content</li><li>React faster</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*bEd22Fs6QEmeL_Rj.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*U8LPExD2y1hAcGzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*TGrH_x5UbalJaSBB.png" /></figure><h3>Life Cycle</h3><p>When we are opening an url in the browser for show our <strong>Live View</strong> there happening many things:</p><ol><li>A regular HTTP Request is sent</li><li>The assets are rendered</li><li>The <strong>Live View</strong> provides a signed <strong>session data</strong></li><li>This <strong>session data</strong> is stored on the client</li><li>When the client is connected it’s time to back to the server</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*TlpeazdMoRj5sRN0.png" /></figure><ol><li>Inside the Live View the mount/2 function is called, in this function we could assign the data for render our view</li><li>render/1 function is called and it’ll send regular HTML to the client</li><li>Our <strong>Live View</strong> will be completed and ready.</li><li>If any event happens, the same flow will be called: 1) mount/2 and then render/1</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*T5Y9b9L90xOyfWV4.png" /></figure><h3>A Live View Anatomy</h3><p>With this we could model the anatomy of a live view as:</p><ul><li>An Elixir Module</li><li>It contains at least the follow functions:</li><li>mount/2</li><li>render/1</li><li>It’ll be render the content identified by the sigil ~L or by a template .leex(remember that a template needs a view for works)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*CNFGL3Q8dO90mUky.png" /></figure><h3>Live View Setup</h3><p>For make the setup you’ll have to follow some steps: create your live view module, config a signing salt, create the socket live in your Endpoint, set as route in the Router or invoke in normal views, and finally connect the socket from the client in JS, you’ll use JavaScript for only this step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*-m6a7pWVOJwsRrMn.png" /></figure><p>When I was learning how to implement Live Views I followed many tutorials availables in the web, and I decided to use my Learning Drive Development flow using my version control, so while I’m following the tutorial and I was doing the setup step by step I created a git commit per step, with this way I’ll be able to remember the steps and the code enough for every step. 😎</p><p>At the end of the day I write this commits:</p><pre>* 192c3cd  Step 9 Import live css<br>* 011d500  Step 8: Enable live reload in dev mode<br>* 5907daa  Step 7: Connecting the socket in app.js<br>* f02fdaf  Step 6: Adding JS live view dependency<br>* c493485  Step 5 Adding websocket in endpoint<br>* 196edd9  Step 4: Adding imports in main Web file<br>* 979d855  Step 3: Adding plugs in router<br>* 942aff2  Step 2 Adding signing salt and engine template<br>* ecb8c8d  Step 1: Adding live view dep<br>* 124a1bd  First commit</pre><p>If you want to follow this setup you have to clone my repo or see on GitHub and make a git show of every commit, or only see the commit content: <a href="https://github.com/carlogilmar/live_view_demo/commits/master">GitHub Repository</a></p><p>I learned this after read the documentation. I drew all the illustrations for understand better, this is my method for learn something, actually I opened an <a href="https://github.com/phoenixframework/phoenix_live_view/issues/316">Issue</a> on the official repo at GitHub for try to become this images as open source contribution.</p><h3>Exploring the repository</h3><p>When I’m learning a new <strong>open source technology</strong> I learned to explore the repository, create a fork, and try to understand what’s happening there. With Elixir this practice is more funny because you have the <strong>IEx Shell!</strong> So I was very interested in discover how people as <strong>Jose Valim and Chris</strong> are creating elixir applications, so I decided to explore the <strong>git commit history</strong> and try to understand when and how the Live View project was developed. <strong>This experience is so valuable because with this way you’re understanding how the authors created a piece of software, and then you’re learning how they are writting software.</strong> And also using a tool as <strong>git</strong> you’re able to discover some behaviours and patterns in the way of how a project was developed based on his version control history.</p><p>Exploring the commit history I found something like this:</p><pre>* efb06a8  hace 9 meses Chris McCord Blur the focused input on form submits to ensure updates. Closes #6<br>* 40cd244  hace 9 meses Chris McCord Fix focus and click bugs<br>* 631f379  hace 9 meses GitHub Fix typo in live_view.js<br>* 2584eec  hace 9 meses GitHub Fix typos in phoenix_live_view.ex docs<br>* 2d16e59  hace 9 meses Chris McCord Fix keypress bug<br>* 86ec0a1  hace 9 meses José Valim Remove unused deps from lock</pre><pre>* 411ca1d  hace 9 meses José Valim Add live_eex &lt;-- 😯</pre><pre>* b362612  hace 9 meses Chris McCord Fix binding bug<br>* fca9fdc  hace 9 meses Chris McCord Set probable active element to fix safari focus issue<br>* 24f0853  hace 9 meses Chris McCord Move to new socket change tracking<br>* ae84de7  hace 9 meses Chris McCord Improve diff tests<br>* 805edbf  hace 9 meses Chris McCord Fix diff tests</pre><p>And the first commit of <strong>Jose Valim</strong> makes me feel curious about how much code contains? Well, for my surprise the first commit contains the Live View Engine and about 600 lines of code.</p><p>This file allow me to understand something about the process implemented by a Live View, which contains tree modules:</p><ul><li>Phoenix.LiveView.Comprehension</li><li>Phoenix.LiveView.Rendered</li><li>Phoenix.LiveView.Engine</li></ul><p>The Phoenix.LiveView.Rendered is a struct which contains the <strong>dynamic</strong> and the <strong>static</strong> part of the view.</p><pre>%Phoenix.LiveView.Rendered{<br>  static: [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;],<br>  dynamic: [&quot;left&quot;, &quot;right&quot;]<br>}</pre><p>It’s important to mention that the Live View have another struct for consider a comprehension:</p><pre>&lt;%= for point &lt;- @points do %&gt;<br>    x: &lt;%= point.x %&gt;<br>    y: &lt;%= point.y %&gt;<br>  &lt;% end  %&gt;</pre><p>The engine will process this as a Phoenix.LiveView.Comprehension</p><pre>%Phoenix.LiveView.Comprehension{<br>    static:<br>  [&quot;\n  x: &quot;, &quot;\n  y: &quot;, &quot;\n&quot;],<br>    dynamics:<br>  [<br>      	[&quot;1&quot;, &quot;2&quot;],<br>      	[&quot;3&quot;, &quot;4&quot;]<br>    	]<br>  }</pre><p>The Live View Engine is the module which generate this structs then to process a .leex file. This flow allow to identify which parts will be dynamic and sent to the client for update the view.</p><p>If we see how the Engine works, we have to execute the compiler from the iEX for Phoenix.LiveView.Engine.compile &quot;path/to/your/file.leex&quot;, 0, we can test simple templates:</p><pre>Hola mundo! &lt;%= name %&gt;</pre><p>And then we’ll see a tuple with Elixir syntax tree which represents the template compiled and ready to update in the client, in some part of this you’ll see something like this:</p><pre>{:%, [],<br>   [<br>     {:__aliases__, [alias: false], [:Phoenix, :LiveView, :Rendered]},<br>     {:%{}, [],<br>      [<br>        static: [&quot;Hola mundo! &quot;, &quot;\n&quot;],<br>        dynamic: [{:arg0, [], Phoenix.LiveView.Engine}],<br>        fingerprint: 120129061871015969357813258734644514847<br>      ]}<br>   ]}</pre><h3>Client Live View</h3><p>This project contains some code wrote in Javascript, although you only have to connect the socket for implement a Live View, there are three goals:</p><ol><li>Store the session signed, and manage the socket connection</li><li>Render and update the view</li><li>Bind the events for connect with the server through events</li></ol><p>You will see a div which contains the session:</p><pre>&lt;div data-phx-session=&quot;SFMyNTY.g3cFAluBC0buY7Iw....&quot;<br>data-phx-view=&quot;CounterWeb.CounterLive&quot;<br>id=&quot;phx-gR6+DLO3&quot; class=&quot;phx-connected&quot;&gt;</pre><p>If you see how the Live View are working, you have to open the HTML Elements tab in your browser and see how only the dynamic parts of the template are updating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p9TM_ePrS6wF8dBOWTQ7vA.gif" /></figure><p>For make this possible Live Views are using a project MorphDOM, a JS library for update the DOM without a Virtual DOM.</p><p>You can see the slides here: <a href="https://www.slideshare.net/karlogilmar1/phoenix-live-views-elixir-meetup-cdmx">https://www.slideshare.net/karlogilmar1/phoenix-live-views-elixir-meetup-cdmx</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a218b2a5fcaa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning IoT: First Steps with Elixir]]></title>
            <link>https://medium.com/@carlogilmar/learning-iot-first-steps-with-elixir-310c4ad4ab15?source=rss-96696ff6f229------2</link>
            <guid isPermaLink="false">https://medium.com/p/310c4ad4ab15</guid>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[phoenix]]></category>
            <dc:creator><![CDATA[Carlo Gilmar]]></dc:creator>
            <pubDate>Wed, 12 Sep 2018 07:14:06 GMT</pubDate>
            <atom:updated>2018-09-12T07:14:06.084Z</atom:updated>
            <content:encoded><![CDATA[<p>Original Post: <a href="http://carlogilmar.me/post/learning-iot/">http://carlogilmar.me/post/learning-iot/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kLxrRcJ3Bm7s3-YX.png" /></figure><p>Recently I have the opportunity to give a conference in the <a href="https://techstarsstartupweekmexicoc2018.sched.com/event/G1Kh/internet-of-things-primeros-pasos">Startup Week in Mexico City</a>. So I decided talk about Internet of things, because I was learning this using an <strong>Arduino</strong> and a <strong>Raspberry Pi</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fme1TFfHmpPM%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dme1TFfHmpPM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fme1TFfHmpPM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b90b55f5d7effb97d6ab86918dfea7d/href">https://medium.com/media/8b90b55f5d7effb97d6ab86918dfea7d/href</a></iframe><h3>Connect Everything!</h3><p>The project is create a simple web application for create distribuid music. I was inspired in the <strong>Launchpad App</strong> and the <a href="https://www.youtube.com/watch?v=lEMG7ZayU48">Smartphone Symphony.</a></p><p>I planned make this using <strong>Phoenix Framework</strong>, and connect an <strong>Arduino</strong> for play the music.</p><h3>The Arduino</h3><p>I use the Arduino for built a circuit based on receipt and send signals using the serial port. This means that, for example, I send a message when I press a key from the membrane switch, or when the photo-resistance validate the light intensity.</p><p>And when the circuit receives a signal, they could do something: turn on leds, etc. I used the <strong>Arduino IDE</strong> for test this circuit, for send and receive signals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Di-EIc6ScipTPIfb.png" /></figure><h3>The Raspberry-Pi</h3><p>Although the <strong>Raspberry Pi</strong> have a <strong>GPIO</strong>, I think that is more convenient use with the <strong>Arduino</strong>, because It has more usability (analog pins, more digital pins). The greatest part about Raspberry is that you could have an entire SO!</p><p>So I used the <strong>Raspbian SO</strong> for get a <strong>Linux SO</strong>. When you have a Linux you know that impossible is nothing.</p><h3>Elixir</h3><p>I decided to choose <strong>elixir</strong> for programming over the Raspberry Pi because I was learning elixir, and this could be a great opportunity for improve my skills using an embedded systems.</p><h3>Installing Elixir</h3><p>Raspbian SO have a simple way to install elixir, although you will have the version 1.3 I used other package installer ASD for install the most recent version.</p><p><a href="https://github.com/asdf-vm/asdf">ASD GitHub Repository</a></p><h3>Phoenix App</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5HmrLCDRWo7_5AeH.png" /></figure><h4>GenServer implementation for get a sound</h4><p>The web app has planned for assign a different sound per user. For this I used the Channels for create sockets connections and I created a simple gen server for get the sound.</p><pre>defmodule Chatter.Director do</pre><pre>  use GenServer</pre><pre>	# The sounds<br>  @songs [<br>    %{&quot;song&quot; =&gt; &quot;<a href="http://carlogilmar.me/uno.m4a">http://carlogilmar.me/uno.m4a</a>&quot;, &quot;category&quot; =&gt; &quot;A&quot;},<br>    %{&quot;song&quot; =&gt; &quot;<a href="http://carlogilmar.me/dos.m4a">http://carlogilmar.me/dos.m4a</a>&quot;, &quot;category&quot; =&gt; &quot;B&quot;},<br>    %{&quot;song&quot; =&gt; &quot;<a href="http://carlogilmar.me/tres.m4a">http://carlogilmar.me/tres.m4a</a>&quot;, &quot;category&quot; =&gt; &quot;C&quot;},<br>    %{&quot;song&quot; =&gt; &quot;<a href="http://carlogilmar.me/cuatro.m4a">http://carlogilmar.me/cuatro.m4a</a>&quot;, &quot;category&quot; =&gt; &quot;D&quot;},<br>    %{&quot;song&quot; =&gt; &quot;<a href="http://carlogilmar.me/cinco.m4a">http://carlogilmar.me/cinco.m4a</a>&quot;, &quot;category&quot; =&gt; &quot;E&quot;},<br>    %{&quot;song&quot; =&gt; &quot;<a href="http://carlogilmar.me/seis.m4a">http://carlogilmar.me/seis.m4a</a>&quot;, &quot;category&quot; =&gt; &quot;F&quot;},<br>    %{&quot;song&quot; =&gt; &quot;<a href="http://carlogilmar.me/siete.m4a">http://carlogilmar.me/siete.m4a</a>&quot;, &quot;category&quot; =&gt; &quot;G&quot;},<br>    %{&quot;song&quot; =&gt; &quot;<a href="http://carlogilmar.me/ocho.m4a">http://carlogilmar.me/ocho.m4a</a>&quot;, &quot;category&quot; =&gt; &quot;H&quot;}<br>  ]</pre><pre>  def start_link() do<br>    GenServer.start_link(__MODULE__, [], [name: __MODULE__])<br>  end</pre><pre>	# I have to call this function for get a sound<br>  def suscribe() do<br>    GenServer.call( __MODULE__, :suscribe)<br>  end</pre><pre>  def init(_) do<br>		# Start the counter in 0 for serve the first sound<br>    {:ok, {:counter, 0} }<br>  end</pre><pre>  def handle_call( :suscribe, _, {:counter, counter} ) do<br>		# I serve the song and update the counter<br>    { counter, song, next_counter } = suscribe_song( counter )<br>    {:reply, {counter, song}, {:counter, next_counter}}<br>  end</pre><pre>	# The counter cannot be more greater than 7</pre><pre>  def suscribe_song( 8 ) do<br>    [ first_song | _ ] = @songs<br>    { 0, first_song, 1 }<br>  end</pre><pre>  def suscribe_song( current_counter ) do<br>    song = Enum.at( @songs, current_counter)<br>    { current_counter, song, current_counter + 1 }<br>  end</pre><pre>end</pre><h4>Getting a sound per user connected</h4><p>I used the channels because It has a function handle_join when somebody create a new connection, so it’s easy identify this moment.</p><pre>def join(&quot;room:lobby&quot;, _, socket) do<br>    Logger.info &quot;:: Join to room:lobby ::&quot;, ansi_color: :green<br>    { _, current_user} = Director.suscribe() # I get the sound and send to the client<br>    {:ok, current_user, socket}<br>  end</pre><p>For know more about Sockets in Phoenix you could visit my <a href="http://carlogilmar.me/post/phoenix-sockets/">last post</a></p><h4>Client side</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S2S5-0q8Qp2Wdqk4.png" /></figure><p>For play and stop music I implement the Howler JS library in the client side from Phoenix. When a user is getting connected, the app assign a sound.</p><p>Using the broadcast messaging I could send strings, and in the client side I play different actions:</p><ul><li><strong>Start</strong>: Start to play every sound in every user connection</li><li><strong>Play</strong>: Put the volume in 1.</li><li><strong>Stop</strong>: Put the volume in 0.</li><li><strong>Reload</strong>: Reload the browser.</li><li><strong>Current Letter</strong>: Play only a sound.</li></ul><p>NOTE: I have one trouble using Phoenix in the Raspberry Pi, that was installing Node JS.</p><h3>Connect the Arduino and the Raspberry Pi: Nerves UART</h3><p>So, at this point I have a simple circuit running on the <strong>Arduino</strong>, and a <strong>Phoenix Web App</strong>. The next step is connect both. For this purpose I used <a href="https://github.com/nerves-project/nerves_uart">Nerves UART Project</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sDo_T2qHl1eIp54O.png" /></figure><p>For understand how it works, read the documentation is enough.</p><h4>Nerves UART</h4><pre>iex&gt; Nerves.UART.enumerate<br>%{&quot;COM14&quot; =&gt; %{description: &quot;USB Serial Port&quot;, manufacturer: &quot;FTDI&quot;, product_id: 24577,<br>    vendor_id: 1027},<br>  &quot;COM5&quot; =&gt; %{description: &quot;Prolific USB-to-Serial Comm Port&quot;,<br>    manufacturer: &quot;Prolific&quot;, product_id: 8963, vendor_id: 1659},<br>  &quot;COM16&quot; =&gt; %{description: &quot;Arduino Uno&quot;,<br>    manufacturer: &quot;Arduino LLC (<a href="http://www.arduino.cc/">www.arduino.cc</a>)&quot;, product_id: 67, vendor_id: 9025}}</pre><pre>iex&gt; {:ok, pid} = Nerves.UART.start_link<br>{:ok, #PID&lt;0.132.0&gt;}</pre><pre>iex&gt; Nerves.UART.open(pid, &quot;COM14&quot;, speed: 115200, active: false)<br>:ok</pre><pre>iex&gt; Nerves.UART.write(pid, &quot;Hello there\r\n&quot;)<br>:ok</pre><pre>iex&gt; Nerves.UART.read(pid, 60000)<br>{:ok, &quot;Hi&quot;}</pre><p><strong>Nerves UART</strong> help to build the communication bridge between the Arduino and the elixir app.</p><p>NOTE: I have some troubles connecting the Arduino with my MacOS. So I tested it directly in the raspberry pi and It works.</p><p>So, the interesting part about this was implement the <strong>UART</strong> with the <strong>Phoenix app</strong>. For this I implemented a <strong>GenServer</strong> for get the port <strong>pidm</strong>.</p><h4>UART GenServer</h4><p>I created a GenServer for get the pidm from the opened port, so in the <strong>init</strong> function I open the port and keep the port as the state. With this pidm I could send messages to this port using the UART write function.</p><pre>def init(_) do<br>	{:ok, uart_pid} = Nerves.UART.start_link<br>	port = Nerves.UART.open( uart_pid, &quot;ttyACM0&quot;, speed: 9600, active: false)<br>	Nerves.UART.configure(uart_pid, framing: {Nerves.UART.Framing.Line, separator: &quot;\r\n&quot;})<br>	loop()<br>	{:ok, uart_pid}<br>end<br></pre><pre>def handle_call( :get_uart, _, state ) do<br>	# state is the uart_pid<br>	{:reply, state, state}<br>end</pre><h4>Read the Serial Port with UART</h4><p>The main idea is send messages, as strings, from the arduino to the phoenix app. For make this possible I had to read the serial port for receive the signals, and send as broadcast to every socket connection.</p><p>For this I created a <strong>loop function</strong> for read every second the serial port, and send the signal as broadcast to the channels.</p><pre>defp loop() do<br>   send self(), :loop<br> end</pre><pre>def handle_info(:loop, state) do<br>  {:ok, message_from_arduino} = Nerves.UART.read( state, 1000 )<br>  RoomChannel.send_broadcast( message_from_arduino )<br>  loop()<br>  {:noreply, state}<br>end</pre><p>With all of this I could connect everything and make the little demo. I built a simple device connecting all of this as a example of how IoT works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zZIxWqh1IrfLKB5Q.png" /></figure><h3>Bonus: Telegram</h3><p>I used <a href="https://github.com/rockneurotiko/ex_gram">Telegram Bot API</a> for connect a Telegram Bot for send messages to the sockets connections.</p><h3>Finally</h3><p>At the end of the day I want to use the <strong>Arduino</strong> for send signals to the web application built with Phoenix. Installing this framework in the Raspberry Pi is so great, because you could implement everything that you know, as an example, I connected Telegram as other device for send messages.</p><p>The web app is simple: create distribuid music melody based on 8 sounds from Launchpad.</p><h3>Features:</h3><h4>Start</h4><ul><li>Every user has a different sound.</li><li>When a user enter to the webapp, the arduino start to play the leds.</li></ul><h4>Photo-resistance</h4><ul><li>When turn-off the light, all devices start to play their sound.</li><li>When turn-off the light, start to turn-on the leds.</li><li>When turn-on the light, all devices stop their sound.</li></ul><h4>Membrance module</h4><ul><li>When touch a letter in the membrance module, all devices with this letter start to play their sound.</li><li>When touch the play button in the membrance module, all devices start to play their sound.</li><li>When touch the stop button in the membrance module, all devices stop their sound.</li><li>When touch the reload button in the membrance module, all devices reload their connection and get a new letter.</li></ul><h4>Telegram</h4><ul><li>Send a message for start to play all sounds, stop, reload, and play every sound.</li></ul><h3>Thanks for reading!</h3><h3>Don’t forget see the demo!!</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fme1TFfHmpPM%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dme1TFfHmpPM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fme1TFfHmpPM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b90b55f5d7effb97d6ab86918dfea7d/href">https://medium.com/media/8b90b55f5d7effb97d6ab86918dfea7d/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=310c4ad4ab15" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Swift]]></title>
            <link>https://medium.com/@carlogilmar/learning-swift-a37efd2f011b?source=rss-96696ff6f229------2</link>
            <guid isPermaLink="false">https://medium.com/p/a37efd2f011b</guid>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Carlo Gilmar]]></dc:creator>
            <pubDate>Thu, 05 Jul 2018 22:19:55 GMT</pubDate>
            <atom:updated>2018-07-05T22:19:55.847Z</atom:updated>
            <content:encoded><![CDATA[<p>Original Post: <a href="http://carlogilmar.me/post/learning-swift/">http://carlogilmar.me/post/learning-swift/</a></p><h4>Recently I have been studying about Swift. I think that the learning experience is a wonderful resource for other persons who are in the same situation, so I consider valuable talk about this.</h4><h3>First Steps</h3><p>When I start to learn swift I decide to watch videos and demonstrations about how to use the Xcode for build iOS apps, but, for be honest, I couldn’t understand some things: optionals, constrains, auto layout… This was my first experience. So I decide start with basics.</p><p>I considered that know and understand the language is important, and Swift is a language with a lot of features. The plan was know more about it, and then introduce me to iOS apps development.</p><h3>Installation</h3><p>By default you have swift installed in you MacOs, but you can install Swift in a linux SO: <a href="https://swift.org/getting-started/#installing-swift">Installing Swift Oficial Website</a></p><p>My first professional language is groovy, so was normal for me find some concepts in this new language. The first things that I found about swift were:</p><ul><li>Xcode for build iOS apps</li><li>Playgrounds</li></ul><p>But this aren’t the only tools!</p><h3>Meeting Swift in Command Line</h3><p>I think that use the command line is better for developer life, fortunately swift is a scripting language, and it have a REPL. I found it more useful in this part of my life instead of use only playgrounds, although this are visual and have a great visual debugger, also are slow in some cases.</p><p>You can write some like this:</p><pre>print(&quot;Hello World from this swift script! 😎&quot;)</pre><p>Save as hello.swift and run with swift hello.swift</p><p><em>If you have a lot of warnings in your REPL, you have to configure your Xcode Command Lines. Go to Xcode &gt; Preferences &gt; Command Line Tools and select your Xcode version</em></p><p>Also swift have a own package for build apps. Remember that swift is general-purpose programming language, so you can build web apps too using <a href="https://vapor.codes/">Vapor Swift Frameworks</a> for example.</p><p>This package manager is useful in the command line:</p><blockquote><em>mkdir sample-app &amp;&amp; cd sample-app</em></blockquote><blockquote><em>swift package init</em></blockquote><pre>~/D/sample-app &gt;&gt;&gt; swift package init<br>Creating library package: sample-app<br>Creating Package.swift<br>Creating README.md<br>Creating .gitignore<br>Creating Sources/<br>Creating Sources/sample-app/sample_app.swift<br>Creating Tests/<br>Creating Tests/LinuxMain.swift<br>Creating Tests/sample-appTests/<br>Creating Tests/sample-appTests/sample_appTests.swift<br>Creating Tests/sample-appTests/XCTestManifests.swift</pre><p>We could make the follow things:</p><ul><li>Test this project with swift package test</li><li>Built this project with swift build</li><li>Create the Xcode project for use it swift generate-xcodeproj</li><li>Use the <a href="https://swift.org/getting-started/#using-the-lldb-debugger">LLDB Debugger</a></li></ul><h3>A text editor for Swift</h3><p>You can use your own text editor! I use VIM in my day by day, and I’m in love because it’s a useful tool for me. So I decide to use it with this plugin for swift syntax <a href="https://vimawesome.com/plugin/swift-vim-red">Swift VIM Plugin</a>.</p><h3>The language</h3><p>The swift language is elegant. It’s a dynamic language, so it could be typed or inferred. Sometimes looks like C, and you can implement some programming approaches as structured, oriented programming and functional programming, have pattern matching, protocols extensions, generics, and more features.</p><p>I found interesting make some like this:</p><pre>struct Student{<br>    var name: String<br>    var age: Int<br>}</pre><pre>struct ListOfSomething&lt;T&gt;{</pre><pre>    var list:[T] = []</pre><pre>    mutating func setList(elementList:[T]){<br>        self.list = elementList<br>    }</pre><pre>    func countElements() -&gt; Int{<br>        return self.list.count<br>    }<br>}</pre><pre>// A list of students<br>var student1 = Student(name: &quot;carlo&quot;, age: 20)<br>var student2 = Student(name: &quot;gilmar&quot;, age: 21)<br>var student3 = Student(name: &quot;carlogilmar&quot;, age: 22)<br>var studentsList:[Student] = [student1, student2, student3]</pre><pre>// A list of something of students<br>var buffer = ListOfSomething&lt;Student&gt;()<br>buffer.setList(elementList: studentsList)<br>buffer.countElements()</pre><h3>My Resources for learn</h3><p>For understand this language I try to start with the basics, so I use the follow books for know more about swift:</p><ul><li><a href="https://www.packtpub.com/application-development/mastering-swift-4-fourth-edition">Mastering Swift 4</a> (Difficult:⭐️⭐ /5, Content:⭐️⭐️⭐️⭐️/5)</li><li><a href="https://www.packtpub.com/application-development/swift-data-structure-and-algorithms">Swift Data Structure and Algorithms </a>(Difficult:⭐⭐️⭐️⭐️ /5, Content:⭐️⭐️⭐️/5)</li><li><a href="https://www.manning.com/books/classic-computer-science-problems-in-swift">Classic Computer Science Problems in Swift</a> (Difficult:⭐️⭐️⭐️⭐️ /5, Content:⭐️⭐️⭐️/5)</li></ul><p>Now, I’m learning about iOS development, and I found some interesting resources:</p><ul><li><a href="https://www.letsbuildthatapp.com/">Let’s Build That App Site</a> <a href="https://twitter.com/buildthatapp">Brian Voong </a>help us to understand easily how to build an iOS application without storyboards, and talk about some tips, he have a lot of videos for learn and learn!</li><li><a href="https://www.swiftbysundell.com/">Swift by Sundell Blog and Podcast</a> <a href="https://twitter.com/johnsundell">John Sundell</a> write about swift, and he have a lot of content about testing!</li><li><a href="https://learnswift.fireside.fm/">The Learn Swift Podcast</a></li><li><a href="http://consultpodcast.com/">Consult Podcast</a> <a href="https://twitter.com/davekopec">David Kopec </a>talk about interesting things about swift!</li></ul><p>This is my learning experience as beginner learning Swift. I hope to help you with start you own way of learn.</p><h3>Thanks for read it!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a37efd2f011b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Ember in 2018: A call for blog post]]></title>
            <link>https://medium.com/@carlogilmar/learning-ember-in-2018-a-call-for-blog-post-67261c9d6c08?source=rss-96696ff6f229------2</link>
            <guid isPermaLink="false">https://medium.com/p/67261c9d6c08</guid>
            <category><![CDATA[emberjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ember]]></category>
            <dc:creator><![CDATA[Carlo Gilmar]]></dc:creator>
            <pubDate>Mon, 14 May 2018 05:25:33 GMT</pubDate>
            <atom:updated>2018-05-14T05:25:33.959Z</atom:updated>
            <content:encoded><![CDATA[<p>Original Post: <a href="http://carlogilmar.me/post/ember-call/">http://carlogilmar.me/post/ember-call/</a></p><h4>This blog post is a response to <a href="https://emberjs.com/blog/2018/05/02/ember-2018-roadmap-call-for-posts.html">Ember’s 2018 Roadmap: A Call for Blog Posts</a></h4><p>Last November 2017 I had to build an application for make exams to evaluate teachers from a popular university. In the beginning this project was considered only for one person (me), so we decide learn Ember JS for this project.</p><h3>The Beginning</h3><p>My previous experiences making front-end projects was using simple <strong>javascript and coffee script</strong>. I used to implement libraries as <strong>Handlebars, Director, Moment, SockJS, etc</strong>.</p><p>Like other learning experiences, I started to make some exercises for understand the basics concepts. But in this case this experience was chaotic, because it resulted difficult for me follow a concept guide.</p><p>I tried to read the most popular books, and I found some difficulties for understand a basic knowledge about it.</p><p>I think that this happen because there isn’t a deep explain about Ember. Five months later this experience I could say that Ember is hard for understand, instead of other javascript frameworks.</p><h3>Loving Ember</h3><p>After this complications I could understand how to build an application using Ember and it results awesome.</p><p>I think that Javascript is a complicated language, there is a lot of frameworks and transpilers. I see EmberJS as a patch for Javascript, because it make the JS for build an application more easy.</p><p>For web apps, Ember implements a great ecosystem based on many concepts and helped by a command line cli.</p><p>Although learning Ember is hard at the beginning, when you understand it, you can work very quickly. With this framework you could have: quick development, reusability, modularity, and maintenance. But first you have to understand the basics.</p><h3>Learning Ember</h3><p>I made this visual recording for explain the most basic flow for start to learn ember as a novice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c4D6gB9Tr3TJx2qc.jpg" /></figure><h3>Learning Ember Concepts:</h3><p><strong>1. Ember Cli</strong></p><p><strong>2. Templates and Handlebars</strong></p><p><strong>3. Routing: model and actions</strong></p><p><strong>4. Models</strong></p><p><strong>5. Request: adapter and serializers</strong></p><p><strong>6. Ember Addons</strong></p><p><strong>7. Ember Mirage</strong></p><p><strong>8. Components</strong></p><p><strong>9. Controllers</strong></p><p>Learning this concepts I could develop an application for my job, so I can say that this are the basics concepts, and obviously there are more features for extend the use of ember. (I’m preparing a workshop with this agenda)</p><h3>I would like to know more about Ember</h3><p>When I was developing my app with Ember I had some questions about how to do something with this framework, and why this framework have this things.</p><ul><li>I see that when Ember lost the connection with the server side, the app is freeze, I don’t know if ember can manage this.</li><li>Testing: I would like to know more about this topic, because I can’t understand why is more useful make testing with ember, it results easy work without this.</li><li>Javascript have a lot of libraries, so, I would like to know how to implement in a Add-on using Components.</li><li>When I implemented the minify I see that the hot reload becomes slow.</li><li>I used the Ember Inspector, but I couldn’t understand how to use it.</li><li>The controllers and the components are too similar, but I didn’t understand what was the main difference, I didn’t found some case for use a controller.</li><li>I can’t found enough content for understand the serializers and adapters. I could only know the basics about it.</li><li>Probably the worst thing about using Ember was the file structure. When you have a lot of routes and nested routes results difficult navigate through the project structure.</li><li>The most difficult part was understand how to create a UI flow through the templates for create an application.</li><li>I think that the environment ecosystem in important, so it could be great know more about how to install plugins for our text-editors, enable the ember syntax, autocomplete syntax, handlebars highlight. I use VIM as my text editor so I have to find what plugins improve my development environment.</li></ul><h3>Thanks for reading!</h3><p>Of course this is the opinion from a novice with 5 months using Ember. This is my opinion for start to learn Ember and my main questions about it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67261c9d6c08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Puppet]]></title>
            <link>https://medium.com/@carlogilmar/learning-puppet-55d2d2391e9c?source=rss-96696ff6f229------2</link>
            <guid isPermaLink="false">https://medium.com/p/55d2d2391e9c</guid>
            <category><![CDATA[puppet]]></category>
            <category><![CDATA[vagrant]]></category>
            <dc:creator><![CDATA[Carlo Gilmar]]></dc:creator>
            <pubDate>Mon, 07 May 2018 07:04:03 GMT</pubDate>
            <atom:updated>2018-05-07T07:04:03.497Z</atom:updated>
            <content:encoded><![CDATA[<p>Original post: <a href="http://carlogilmar.me/post/learning-puppet/">http://carlogilmar.me/post/learning-puppet/</a></p><h3>Hi! Recently I was reviewing two courses about Jenkins, so I had to use Vagrant for configure my environment, also I used other tools as Puppet.</h3><p>In the developer day is very common configure linux servers for a lot of things: install a Jenkins, prepare the deploy environments, etc… Well, Puppet can help us to configure this servers, as a improve script shell. In this post I’m going to talk about the first steps for use Puppet.</p><blockquote><em>I recommend start to learning using Vagrant for create virtual machines ( By default Vagrant machines have installed an old Puppet version), you can know more in the Making Devs Blog: </em><a href="http://blog.makingdevs.com/2017/06/01/creating-virtual-machines-with-vagrant/"><em>Creating virtual machines with Vagrant · Blog de Making Devs</em></a></blockquote><h3>Benefits of use Puppet for configure servers</h3><ul><li>Keeping the configuration synchronized</li><li>Repeating changes across many servers</li><li>Self-updating documentation</li><li>Version Control</li></ul><p>Puppet is a great tool for make this, instead of use manual configuration, shell scripts (fragile, hard to maintain, very specific), or use container as Docker (require more configuration management).</p><p>Puppet is more! Puppet is a language and an engine for applies configuration and managements.</p><h3>Installing Puppet</h3><p>The most easy way for install puppet is download the TAR version <a href="http://downloads.puppetlabs.com/puppet/">here</a> and run the ruby script.</p><p>For install Puppet 5.5.0 in ubuntu:</p><pre>$ wget <a href="http://downloads.puppetlabs.com/puppet/puppet-5.5.0.tar.gz">http://downloads.puppetlabs.com/puppet/puppet-5.5.0.tar.gz</a><br>$ tar -xzf puppet-5.5.0.tar.gz<br>$ cd puppet-5.5.0/<br>$ sudo ./install.rb<br>$ puppet --version<br>5.5.0</pre><h3>Starting With Puppet</h3><p>Puppet can manage three basic resource types:</p><ul><li>Package: for install software.</li><li>File: for deploy configuration files.</li><li>Service: for runs software itself.</li></ul><p>I’m going to create my hello world example. For this I created the follow script:</p><p><strong>hello-world.pp</strong></p><pre>file { &#39;/tmp/hello.txt&#39;:<br>  ensure  =&gt; file,<br>  content =&gt; &quot;hello, world Vagrant with Puppet!!!\n&quot;,<br>}</pre><p>For run this in the empty server:</p><p>vagrant@vagrant-ubuntu-trusty-64:~$ sudo puppet apply puppet1.pp</p><pre>Warning: Could not retrieve fact fqdn<br>Notice: Compiled catalog for vagrant-ubuntu-trusty-64 in environment production in 0.05 seconds<br>Notice: /Stage[main]/Main/File[/tmp/hello.txt]/ensure: defined content as &#39;{md5}4f4e8edd5c7cd9dc6c2d3aaca1baf2c1&#39;<br>Notice: Finished catalog run in 0.01 seconds</pre><pre>vagrant@vagrant-ubuntu-trusty-64:~$ cat /tmp/hello.txt<br>hello, world Vagrant with Puppet!!!</pre><p>The term <strong>File</strong> is a puppet declaration, <strong>ensure</strong> is for specify the resource type, and <strong>content</strong> is an attribute for set the content in the file.</p><h3>Install Packages</h3><p>We can create a puppet script for install packages, it’s very easy:</p><p><strong>package.pp</strong></p><pre>package { &#39;fish&#39;:<br>	ensure =&gt; installed,<br>}</pre><pre>vagrant@vagrant-ubuntu-trusty-64:~$ sudo puppet apply package.pp<br>Warning: Could not retrieve fact fqdn<br>Notice: Compiled catalog for vagrant-ubuntu-trusty-64 in environment production in 0.09 seconds<br>Notice: /Stage[main]/Main/Package[fish]/ensure: ensure changed &#39;purged&#39; to &#39;present&#39;<br>Notice: Finished catalog run in 7.97 seconds</pre><h3>Running Services</h3><p>We can start services too:</p><p><strong>puppet3.pp</strong></p><pre>service { &#39;jenkins&#39;:<br>  ensure =&gt; running,<br>  enable =&gt; true,<br>}</pre><pre>vagrant@vagrant-ubuntu-trusty-64 ~&gt; sudo puppet apply service.pp<br>Warning: Could not retrieve fact fqdn<br>Notice: Compiled catalog for vagrant-ubuntu-trusty-64 in environment production in 0.06 seconds<br>Notice: Finished catalog run in 0.06 seconds</pre><h3>Resources for learn more:</h3><ul><li><a href="https://www.packtpub.com/virtualization-and-cloud/infrastructure-code-iac-cookbook">Infrastructure as Code (IAC) Cookbook | PACKT Books</a></li><li><a href="https://www.packtpub.com/networking-and-servers/puppet-5-beginner%E2%80%99s-guide-third-edition">Puppet 5 Beginner’s Guide — Third Edition | PACKT Books</a></li></ul><h3>Thanks for reading!</h3><p>This are the basic uses with this tool. I hope write more about this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55d2d2391e9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ember JS First Steps]]></title>
            <link>https://medium.com/@carlogilmar/ember-js-first-steps-1a3abbc4cdc?source=rss-96696ff6f229------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a3abbc4cdc</guid>
            <category><![CDATA[ember]]></category>
            <dc:creator><![CDATA[Carlo Gilmar]]></dc:creator>
            <pubDate>Fri, 04 May 2018 05:56:36 GMT</pubDate>
            <atom:updated>2018-05-04T05:56:36.241Z</atom:updated>
            <content:encoded><![CDATA[<p>Original Post in <a href="http://carlogilmar.me/post/ember-first/">http://carlogilmar.me/post/ember-first/</a></p><p>In the last post <a href="http://carlogilmar.me/post/learning-ember/">Learning Ember</a> I talk about how to start with Ember.</p><p>Now, after nights studying Ember I think that learning this framework is difficult because it require think first in <strong>Ember Concepts</strong>.</p><p>After nights studying Ember I can say that learning this framework is difficult because you have to think first in their main concepts, and if you have some experience with other frameworks or transpilers ( coffee script, typescript, elm) probably you will be confused.</p><blockquote><em>In my opinion Javascript is hard and difficult, so, it needs frameworks for be more efficient and simple. Frameworks as Angular JS are good for start to create applications easily and faster, so, why Ember is a special framework?</em></blockquote><p>My main recommendation for persons who are learning Ember is start with understand the main concepts, and then, try to think how to create an application in this terms.</p><h4>This are for me the main concepts that you have to understand:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZDk-PPFsSGxr8k8R.png" /></figure><h3>The Main View</h3><p>Please think always that Ember use conventions. This is so important for understand how Ember render a view. It uses Handlebars, so it could be good understand this first, although you can review the ember documentation about it, this will be enough.</p><p>When you create an app:</p><blockquote><em>ember new example-app</em></blockquote><p>You could see that it will create a file app/templates/application.hbs, the templates are Handlebars Files in app/templatesdirectory.</p><p>The application.hbsare an important file.</p><p>This is the main view that render all in the app/index.html. The application file contains the tag {{outlet}}. This refers where will be render other views.</p><blockquote><em>By default ember put a welcome view in application</em></blockquote><h3>Basic Routing</h3><p>Probably the main file for explore an Ember App is the app/router.js, this file contains all routes.</p><p>For create a route we can use the Ember Cli</p><blockquote><em>ember generate route page1</em></blockquote><p>And this are going to generate three files: <strong>a JS file, a HBS file, and a test JS file.</strong> This is because <strong>the route is the main ember unit</strong>. Every Ember Application would be created using routes.</p><h3>Render Views</h3><p>All routes created by us will start in the <strong>application</strong> view (the father view), and this routes will be render into the application view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VgI7o6HBQOJux_Kf.png" /></figure><blockquote><em>If we go to </em><strong><em>localhost:4200</em></strong><em> we will see only the application view. But if we go to </em><strong><em>localhost:4200/page1</em></strong><em> we will see the </em><strong><em>application</em></strong><em>view and the </em><strong><em>page1</em></strong><em> route view.</em></blockquote><p>We can use the handlebars tag for link views:</p><pre>{{# link-to ‘view-name’}} Go to link{{#link-to}}</pre><h3>Hello World Example</h3><p><strong>application.hbs</strong></p><pre>&lt;h1&gt; Hi I&#39;am the application View! &lt;/h1&gt;<br>&lt;br&gt; {{#link-to &#39;page1&#39;}} Page1 View {{/link-to}}<br>{{outlet}}</pre><p><strong>page1.hbs</strong></p><pre>&lt;h3&gt; I&#39;m the page1 route &lt;/h3&gt;<br>&lt;br&gt; {{#link-to &#39;application&#39;}} Return {{/link-to}}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/0*cqDoGHOG4a90XqTC.png" /></figure><p>We can create more with the templates and routes, but this is a basic example about it, and I think that this would be clear for understand this Framework.</p><p>I hope write more about Ember.</p><h3>Thanks for reading!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a3abbc4cdc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PacktPub Review: Effective Jenkins]]></title>
            <link>https://medium.com/@carlogilmar/packtpub-review-effective-jenkins-ffd68b455daa?source=rss-96696ff6f229------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffd68b455daa</guid>
            <category><![CDATA[packtpub]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[vagrant]]></category>
            <dc:creator><![CDATA[Carlo Gilmar]]></dc:creator>
            <pubDate>Tue, 17 Apr 2018 13:32:15 GMT</pubDate>
            <atom:updated>2018-04-17T13:32:43.347Z</atom:updated>
            <content:encoded><![CDATA[<p>Original post: <a href="http://carlogilmar.me/post/effectivejenkins/">http://carlogilmar.me/post/effectivejenkins/</a></p><h3>Recently, I reviewed a video course from Packt Publishing: <strong>“Effective Jenkins: Improving Quality in the Delivery Pipeline with Jenkins”</strong></h3><blockquote><em>Thanks to </em><strong><em>Packt Publishing</em></strong><em> for this opportunity, and thanks to </em><strong><em>Dwayne D’Souza </em></strong><em>for the collaboration!</em></blockquote><p>So, I want to talk about the content of this course.</p><h3>Before to Start</h3><p>This course is for people who know the basics about Jenkins. If you don’t, I would recommend learning about this from their previous courses:</p><ul><li><strong>Effective Jenkins: Getting Started with Continuous Integration</strong>: <a href="https://www.packtpub.com/networking-and-servers/effective-jenkins-getting-started-continuous-integration-video">https://www.packtpub.com/networking-and-servers/effective-jenkins-getting-started-continuous-integration-video</a></li><li><strong>Effective Jenkins: Continuous Delivery with Jenkins Pipeline</strong>: <a href="https://www.packtpub.com/networking-and-servers/effective-jenkins-continuous-delivery-jenkins-pipeline-video)">https://www.packtpub.com/networking-and-servers/effective-jenkins-continuous-delivery-jenkins-pipeline-video)</a>.</li></ul><p>I would also suggest learning <strong>Vagrant</strong> as an added advantage.</p><p>Before you start with this course, you will need to know <strong>how to install Jenkins and configure it for the first time</strong>.</p><blockquote><em>As an extensible automation server, Jenkins can be used as a simple CI server or turned into the continuous delivery hub for any project.</em></blockquote><h3>The Course</h3><p>This course, by <strong>Rodrigo Zacheu Russo</strong>, ​has four main topics. In every topic you will learn how to improve a tool as <strong>Jenkins</strong>.</p><p>Here is a picture I drew for the main topics:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*reZqmNte14LeNeDn.jpg" /></figure><h3>Implementing an Acceptance Stage</h3><p>You will learn about testing! In this section, you are going to run tests! This chapter teaches you how to improve your quality gate using Jenkins.</p><h3>Branching Strategy</h3><p>Have you ever heard about Feature Branch? No? This chapter talks about it, and how to use Git for implements Git flows for use, in the Jenkins pipeline.</p><h3>Automating Database Scripts</h3><p>As a developer, you have to make Database Migration for version control over the database, you will learn how to make this using Flyway and Jenkins.</p><h3>Automating Pull Request</h3><p>You can automate your pull request by making a connection with GitHub and Jenkins.</p><h3>Conclusion</h3><p>This course goes further than just the use of Jenkins. You will learn four concepts, and you will apply them in an exercise. This course is so great for people who know Jenkins and for novices as well.</p><h3>Thanks for reading!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffd68b455daa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Ember JS]]></title>
            <link>https://medium.com/@carlogilmar/learning-ember-js-5d7dcafb3d5b?source=rss-96696ff6f229------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d7dcafb3d5b</guid>
            <category><![CDATA[ember]]></category>
            <category><![CDATA[emberjs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Carlo Gilmar]]></dc:creator>
            <pubDate>Wed, 11 Apr 2018 06:44:28 GMT</pubDate>
            <atom:updated>2018-04-11T06:45:26.679Z</atom:updated>
            <content:encoded><![CDATA[<p>Original post: <a href="http://carlogilmar.me/post/learning-ember/">http://carlogilmar.me/post/learning-ember/</a></p><h4>Follow with learning more about Ember Js as our JS framework, I have to talk about my learning experience.</h4><p>When I was searching about Ember I found a lot of resources: posts, books, videos, courses and more. Everything looks good, until I had to start my first projects.</p><h3>Before to start</h3><blockquote><em>I think that is good to know the context about it. Ember JS was born as a fork from </em><strong><em>SproutCore Framework</em></strong><em>. Apple was a contributor and develop his web application iWork (iCloud begins) with this framework. Ember Js born from SproutCore 2.0, by </em><strong><em>Yehuda Katz</em></strong><em>, a member of the jQuery, Ruby on Rails and SproutCore core teams.</em></blockquote><blockquote><strong><em>Apple Music</em></strong><em> and </em><strong><em>LinkedIn</em></strong><em> are two applications developed with Ember JS.</em></blockquote><h3>The Installation and the Development Environment</h3><p>For install the most recent version, you will need:</p><ul><li>Git</li><li>Node / NPM (most recent LTS)</li><li>Watchman (optional)</li></ul><p>If you have this, you could type the following command for install ember:</p><blockquote><em>npm install -g ember-cli@3.0</em></blockquote><p>I’m in love with VIM, so I have to install plugins for ES6 and Handlebars.</p><p>But if you are using Sublime Text, I recommend install plugins for Handlebars and Ember, and there are other great plugins for other text editor, as VSCode.</p><p>I recommend use <strong>Google Chrome</strong> for develop and install the <strong>Ember Inspector Extension.</strong></p><h3>Ember JS Framework</h3><p>The framework contains the following core libraries</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cPjusVVk8jzwm7Y9.png" /></figure><p>The ember ecosystem contains:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M9MgMzILtI_nfxEC.png" /></figure><h3>Hello World!</h3><p>We are going to use the Ember Cli for create a simple application</p><blockquote><em>ember new hello-world</em></blockquote><p>And you can see you first application with:</p><blockquote><em>ember serve</em></blockquote><p>This generate a project with the Ember Structure Folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ladNYToamZJ28mb8.png" /></figure><p>Although Ember has a lot of things created by default, I recommend go step by step.</p><h3>Maybe Ember could be hard to learn. But I recommend understand the most important concepts in Ember, and just think how to develop your application in this terms.</h3><p>For the beginning I recommend understand the most basics things:<strong> the routes and the templates.</strong> I hope write about this in other post.</p><h3>Thanks for read!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d7dcafb3d5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Process in Elixir: A Simple Example]]></title>
            <link>https://medium.com/@carlogilmar/process-in-elixir-a-simple-example-d5522028ee7b?source=rss-96696ff6f229------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5522028ee7b</guid>
            <category><![CDATA[elixir]]></category>
            <dc:creator><![CDATA[Carlo Gilmar]]></dc:creator>
            <pubDate>Sun, 08 Apr 2018 04:01:10 GMT</pubDate>
            <atom:updated>2018-04-08T04:01:10.551Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Original post: </em><a href="http://carlogilmar.me/post/elixir-process/"><em>http://carlogilmar.me/post/elixir-process/</em></a></h4><p>In the last days I have been learning about Process in Elixir. After doing some exercises and understand some things about it, I can explain how to create a simple example about process.</p><h3>The Process</h3><p>Work with process in Elixir is so common, so, it’s important know how to use it. For create a process you can use spawn (which takes a function).</p><blockquote><em>The process structure is very simple: you have a mailbox, created within a function and by the word </em><em>receive, and you can manage different messages and do something. When you create a process with </em><em>spawn, you will get a Process ID, and also you can know if this process is alive.</em></blockquote><p>When you have a process alive, you can send it messages, for do this you only have to send with the process ID and a message (a data structure, a tuple, an atom…) .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cs9C9VYrdOnzoDwq.png" /></figure><p>For make this more clearly I will show how to create an example.</p><h3>Ping Pong Example With a Process</h3><p>We have to create a simple function and create a receiver, within this, we are going to use the patter matching for receive different types of messages, in this case we are to receive two atoms: :pingand :pong. When we receive this, we will print a message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LP8SvBIGeeNCABA_.png" /></figure><pre>defmodule Pingpong do</pre><pre>  def mailbox() do<br>    receive do<br>      {:ping} -&gt;<br>        IO.puts &quot; Ping !!&quot;<br>      {:pong} -&gt;<br>        IO.puts &quot; Pong !!&quot;<br>    end<br>  end</pre><pre>end</pre><p>If we run the iexshell we can create a process with this function and send it a messages for print the pingand pong:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*er2UBXisNC1L3AwG.png" /></figure><p>You will see that only in the first message sent we can see the printed message</p><h3>Process Alive</h3><p>This happens because the process created was killed after receive the first message. We can know if the process is alive in the iexshell:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wMAMhvviP08croTP.png" /></figure><p>The solution for avoid this is call the same function in the receiver, with this the process won’t be killed after receive a message.</p><pre>def mailbox() do<br>    receive do<br>      {:ping} -&gt;<br>        IO.puts &quot; Ping !!&quot;<br>	mailbox()<br>      {:pong} -&gt;<br>        IO.puts &quot; Pong !!&quot;<br>	mailbox()<br>    end<br>  end</pre><p>We are sending a message to a process alive. Now I want that this process send messages to the same process for do the ping-pong.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lhwfiCDF7CDF3dPf.png" /></figure><h3>Ping Pong in the same Process</h3><p>My first try is that when the process receive a message, send the other message to the same process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-1m1A295PLnswb3n.png" /></figure><p>For this we only have to include the process ID in the tuple, and make a send with the other message.</p><p>I’m going to print the process id in the function using self() .</p><pre>def mailbox() do<br>    IO.inspect self()<br>    receive do<br>      {:ping, pid} -&gt;<br>        :timer.sleep(500)<br>        IO.puts &quot; Ping !!&quot;<br>        send(pid, {:pong, pid})<br>        mailbox()</pre><pre>      {:pong, pid} -&gt;<br>        :timer.sleep(500)<br>        IO.puts &quot; Pong !!&quot;<br>        send(pid, {:ping, pid})<br>        mailbox()<br>    end<br>  end</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HdwgoBWMgdjMAo_R.png" /></figure><h3>Ping Pong with Two Process</h3><p>Now we have to create the ping-pong example with two process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E6nFTGp6GmVC4tMt.png" /></figure><p>For do this we can create two process of the same function. Instead of get a single process id in the receiverwe can receive two process Id.</p><pre>def mailbox() do<br>    IO.inspect self()<br>    receive do<br>      {:ping, process1, process2} -&gt;<br>        :timer.sleep(500)<br>        IO.puts &quot; Ping !!&quot;<br>        send(process2, {:pong, process1, process2})<br>        mailbox()</pre><pre>      {:pong, process1, process2} -&gt;<br>        :timer.sleep(500)<br>        IO.puts &quot; Pong !!&quot;<br>        send(process1, {:ping, process1, process2})<br>        mailbox()<br>    end<br>  end</pre><p>We can see which process are print the pingor pong message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MQHULXNwjkYUdSY4.png" /></figure><h4>With simple exercise I understand how to create process and send messages</h4><p>It’s important because Elixir use it a lot!</p><h3>Thanks for reading!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5522028ee7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phoenix Simple App using Web Sockets]]></title>
            <link>https://medium.com/@carlogilmar/phoenix-simple-app-using-web-sockets-ecc4cf61d387?source=rss-96696ff6f229------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecc4cf61d387</guid>
            <category><![CDATA[phoenix]]></category>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[phoenix-framework]]></category>
            <category><![CDATA[websocket]]></category>
            <dc:creator><![CDATA[Carlo Gilmar]]></dc:creator>
            <pubDate>Tue, 03 Apr 2018 04:52:55 GMT</pubDate>
            <atom:updated>2018-04-03T04:52:55.297Z</atom:updated>
            <content:encoded><![CDATA[<p>The original post is on my personal blog: <a href="http://carlogilmar.me/post/phoenix-sockets/">http://carlogilmar.me/post/phoenix-sockets/</a></p><p>Hi! This post is for explain how to create a simple application with Phoenix and Elixir using Web Sockets.</p><h3>Web Sockets</h3><blockquote><em>The Web Socket protocol based on TCP produce a bidirectional communication between client-server app, and it doesn’t need to use HTTP protocols.</em></blockquote><p>I created a phoenix project without ecto mix phx.new sampler --no-ecto for show a simple connection using web sockets.</p><h3>Create the two-way communication</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_9-ev6sBIQ-mrb7b.png" /></figure><p>For start, we have to create the communication through the web socket.</p><p>We have to make the connection to phoenix in every browser through channels (phoenix Implementation for web sockets).</p><p>For make this possible it’s necessary enable the Socket Library in assets/js/app.js , and you only have to uncomment the socket import.</p><p>Then you have to join to the channel in assets/js/socket.js, we are going to print a console log with the response. For this case the channel name is <strong>“example”.</strong></p><pre>socket.connect()</pre><pre>let channel = socket.channel(&quot;example&quot;, {})</pre><pre>channel.join()<br>  .receive(&quot;ok&quot;, resp =&gt; { console.log(&quot;Joined to Example Channel!!&quot;, resp) })<br>  .receive(&quot;error&quot;, resp =&gt; { console.log(&quot;Unable to join&quot;, resp) })</pre><p>Until here, we are make a connection request to “example” channel, but now we have to create this channel for complete this connection.</p><p>We have to create an elixir file with the channel in lib/sample_web/channels/example.socket.ex</p><p>The following function join allow the connection to <strong>“example”</strong> channel.</p><pre>defmodule Siample.ExampleChannel do</pre><pre>  use Phoenix.Channel</pre><pre>  def join(&quot;example&quot;, payload, socket) do<br>    {:ok, socket}<br>  end</pre><pre>end</pre><p>The last step is update our user_socket.exadding the next line:</p><pre>## Channels<br>   channel &quot;example&quot;, SampleWeb.ExampleChannel</pre><p>If we run the application and check the browser in localhost:4000 we will see the connection result in the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X6y7vHnPCk8_wycT.png" /></figure><h3>Sending Messages</h3><p>We have the connection created. So we can start to pass messages.</p><p>In the client side we are going to send a simple message to <strong>”example:broadcast”</strong> channel. We need the channelobject (with the connection), and the channel direction example:broadcast and a message {message:&quot;Hello Phoenix!&quot;}</p><p>socket.js</p><pre>channel.push(&#39;example:broadcast&#39;, {message:&quot;Hello Phoenix!&quot;})</pre><p>In our example channel, we can create a function for response to this direction below to the join function.</p><p>example_socket.ex</p><pre>def handle_in(&quot;example:broadcast&quot;, payload, socket) do<br>    Logger.info &quot;:: Example:Broadcast receive a message!::&quot;<br>    {:noreply, socket}<br>  end</pre><h3>Sending Broadcast</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QgWJXAoMaTHGS-Kx.png" /></figure><p>We can modify out last snippet for send a broadcast message to other channel example:alertadding: broadcast! socket, &quot;example:alert&quot;, payload</p><pre>def handle_in(&quot;example:broadcast&quot;, payload, socket) do<br>    Logger.info &quot;:: Example:Broadcast receive a message!::&quot;<br>    broadcast! socket, &quot;example:alert&quot;, payload<br>    {:noreply, socket}<br>  end</pre><p>We are sending a message from elixir script to <strong>”example:alert”</strong>, we can create this channel in the client side.</p><p>In our socket.jswe can add this below to the channel join connection:</p><pre>channel.on(&quot;example:alert&quot;, msg =&gt; {<br>  alert(&quot;Can you see me?!!!!&quot;)<br> })</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vUUoDkUWQn4CbD_d.png" /></figure><p>And this channel are going to receive all messages to <strong>”example:alert”</strong> direction. For this case we are sending a broadcast message, so, we can open many browsers and wait the alert when the message are sended. ( this appears when you reload your application in localhost:4000)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wdzufs3wWPYIm7ff.png" /></figure><h4>With this you will have a simple application using sockets connection, join a channel in client side, sending messages and broadcast messages.</h4><p>This is very simple and useful, recently the Making Devs team develop a simple Type Racer team using this for pass messages and reload the sessions.</p><h4>You could see the complete example here: <a href="https://github.com/carlogilmar/Elixir-Simple-Socket">Github Repository</a></h4><h3>Thanks for reading!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecc4cf61d387" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>