<?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 Cristhian Ferreira on Medium]]></title>
        <description><![CDATA[Stories by Cristhian Ferreira on Medium]]></description>
        <link>https://medium.com/@cferreirasuazo?source=rss-abf6595d01e9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3NoteqSE0OCFHx8af1MgoA.jpeg</url>
            <title>Stories by Cristhian Ferreira on Medium</title>
            <link>https://medium.com/@cferreirasuazo?source=rss-abf6595d01e9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 03:55:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cferreirasuazo/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[Web Scraping + Bookstore: notify me when a book is available]]></title>
            <link>https://cferreirasuazo.medium.com/web-scraping-bookstore-notify-me-when-a-book-is-available-19091aa2c89?source=rss-abf6595d01e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/19091aa2c89</guid>
            <category><![CDATA[beautifulsoup]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[crontab]]></category>
            <category><![CDATA[sendinblue]]></category>
            <category><![CDATA[python3]]></category>
            <dc:creator><![CDATA[Cristhian Ferreira]]></dc:creator>
            <pubDate>Wed, 22 Sep 2021 22:37:42 GMT</pubDate>
            <atom:updated>2021-09-22T22:37:42.351Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VAD3mYh9uGi8QpTJ" /><figcaption>Photo by <a href="https://unsplash.com/@aaronburden?utm_source=medium&amp;utm_medium=referral">Aaron Burden</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Some days ago I wanted to buy a book called At The Mountains of Madness by HP Lovecraft but the store was out of prints. I contacted them and they told me they don’t know when more copies will arrive and I should keep watching the page for updates.</p><p>I encounter with 2 problems:</p><ol><li>I don’t want to be reviewing the page every week for notice if the book is available.</li><li>I would forget the to review it and they would sold out again</li></ol><p>So I came up with a solution. Using web scraping I would create a script for fetch the availability of the book once there are copies available. I will show the the steps needed for this.</p><p>What are you going to need</p><ul><li>basic knowledge of python</li><li>basic knowledge of web scraping</li><li>basics using web inspector</li></ul><p>For web scrapping we are going to use Beautiful Soup and request</p><pre>### main.py ###</pre><pre>import requests<br>from bs4 import BeautifulSoup</pre><pre>def main(book_id):<br>   URL = f&#39;https://cuestalibros.com/{<em>book_code</em>}&#39;      #1<br>   #gets the page that yo want <br>   page = requests.get(URL)                           #2<br>   soup = BeautifulSoup(page.content, &#39;html.parser&#39;)  #3</pre><p>the function main is receiving the id of the book This will allows us to create the URL where we are going to scrap from. Line 2 will request the web page and in Line 3 we are instantiating a beautiful soup object. page.content access to the html content of the request while ‘html.parser’ is the name of the parser library you want to use. There are other libraries such as “lxml” and “html5lib”.</p><pre>result = soup.find(<em>class_</em>=&#39;availability&#39;) #4<br>result = result.find(<em>class_</em>=&quot;value&quot;)      #5<br>status = result.text                      #6</pre><p>In order to access the property that I wanted to evaluate if the book was available or not, I had to be a bit astute. Using the Firefox devtools, I could hover over the html element that has the book status with pick a element tool. This allowed me to get the ‘availability’ class. Now the element that has the value is ‘value’. In this way we can know if the book is available or not.</p><h3>Creating a Email handler for notify me over email</h3><p>The most interesting part of this script is to notify me when the book is available. The status variable owns the status of the book. Now in order to be notified I have to use a 3rd party service. There are a wide variety of email providers such as SendinBlue, Sendgrid, AWS, Mailchimp. For this feature we are going to use SendinBlue API.</p><p>In order to use SendinBlue, you need to sign up. Now, we are going to create our email manager, the constructor will receive the smpt server, smpt port, user, password and subject. The smpt server, smpt port, user and password can be optioned in SMTP &amp; API tab in the corner menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i1HmrprabLOD94IxF0OmsQ.png" /></figure><pre>email_from_addr = &quot;bookbot@mail.com&quot;<br>email_to_addr = &quot;destination@mail.com&quot;<br>email_smtp_server = &quot;smtp-relay.sendinblue.com&quot;<br>email_smtp_port = &quot;587&quot;<br>email_user = &quot;your-user-name&quot;<br>email_password = &quot;your-secret-password&quot;<br>email_subject = &quot;Book in Cuesta available&quot;email_handler = EmailHandler(email_smtp_server, email_smtp_port , email_user, email_password , email_subject)</pre><p>In our main.py, we are going to add the next lines where we are instantiating out email manager using our credentials.</p><p>Using something simple as a condition we can send an email to us if It’s available</p><pre>if status != &quot;Agotado&quot;:<br>     email_handler.send_email(&quot;cferreirasuazo@gmail.com&quot;, URL)<br>else:<br>    print(&quot;no hay&quot;)</pre><p>Using a program like crontab we can schedule our script to run every day at 11 am.</p><pre>00 11 * * * your_script_directory / main.py</pre><p>And this is how by using web scraping and Sendinblue we can save ourselves the need to access the book store or avoid going to the store in vain. I hope you like it, let me know in your comments. I’m open to any suggestions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i1HmrprabLOD94IxF0OmsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_CcC-ttoIxIa9JutnqgKnw.png" /><figcaption>here is the whole script</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19091aa2c89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lets Unit Test Django Forms]]></title>
            <link>https://cferreirasuazo.medium.com/lets-unit-test-django-forms-280704168d1b?source=rss-abf6595d01e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/280704168d1b</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[tddwithpython]]></category>
            <category><![CDATA[unittest]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Cristhian Ferreira]]></dc:creator>
            <pubDate>Tue, 06 Apr 2021 01:54:49 GMT</pubDate>
            <atom:updated>2021-04-06T01:54:49.179Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uogTxM0a-lVa__VkjFBjew.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@hiteshchoudhary?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Hitesh Choudhary</a> on <a href="https://unsplash.com/collections/63239549/python?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>In the last few months I have been building a web application using Django. In a brief, It’s a app that does CRUD operations to a PostgreSQL DB. The project can be said to be moderate in size, it has dozens of models, dozens of views and a few dozen forms.</p><p>There was a moment when I was thinking that the project will grow more. If I make a change in a model, I will have to change its instances in different parts of the code like in views, Admins and forms.</p><p>Any tiny change could trigger a bug in the whole project. So I started researching about what good practices, libraries or approaches that I could implement to improve the development of my Django Application. I came up with Unit Testing and Test-Driven Development.</p><p>Test-Driven Development is a software development approach where you first write tests before making the logic of your application source code. This tests are write in form unit tests (testing every aspect of the code).</p><h4>Unit Testing Django Forms</h4><p>Forms are components that accepts data from the user. Django validates those forms based in the structure of the model that they are based on or the validations that you implement.</p><p>So, Let’s create our first unit testing for a form based in a a model. First lets create a project:</p><pre>django-admin startproject unit-test-project<br>python manage.py startapp product<br>python manage.py runserver<br>python manage.py migrate</pre><h4>Making tests</h4><p>In order to implement unit tests in your Django project, we can inherent our tests from TestCase. This is a subclass of unitest.TestCase, which is a class used in python for unit tests. There are other classes like TransactionTestCase or SimpleTestCase.</p><p>For make tests, we implement asserts. Assert are declarations that validates if a piece of code works correctly. There are multiple types of asserts like:</p><p>self.assertTrue // checks if a value is true<br>self.assertFalse <em>//check if a value if false</em><br>self.assertEqual <em>//check if two values are equal</em></p><p>If you want to learn more about them here is a <a href="https://docs.python.org/3/library/unittest.html#assert-methods">link</a> for a list of available asserts in python</p><p>Inside tests.py, write</p><pre>from django.test import TestCase<br>from .models import Product<br>from .forms import ProductForm</pre><pre>class ProductFormTest(<em>TestCase</em>):</pre><pre>def test_is_invalid(<em>self</em>):<br>    form = ProductForm(<em>data</em>={&quot;name&quot;: &quot;Computer&quot;, &quot;price&quot;: 400.1234})<br>    <em>self</em>.assertFalse(form.is_valid())</pre><pre>def test_form_is_valid(<em>self</em>):<br>    form = ProductForm(<em>data</em>={&quot;name&quot;: &quot;Computer&quot;, &quot;price&quot;: 400})<br>    <em>self</em>.assertTrue(form.is_valid())</pre><p>We are going to validate if the data passed to the form is valid.</p><p>For run our tests, we have to run:</p><pre>python manage.py test</pre><p>This will search tests in any file named “test*.py” under the current working directory. This will cause an error because we don’t have our Product Model or Product Form.</p><h4>Implementing model and form</h4><p>In product’s model.py, write the next model:</p><pre>class Product(models.Model):<br>   name = models.CharField(max_length=25)<br>   price = models.IntegerField()</pre><pre>def __str__(self):<br>      return self.name</pre><p>then hit</p><pre>python manage.py makemigrations<br>python manage.py migrate</pre><p>This will create the entity in the DB.</p><p>Now, write the next form in forms.py</p><pre>from django import forms<br>from .models import Product</pre><pre>class ProductForm(<em>forms</em>.<em>ModelForm</em>):<br>  class Meta:<br>    model = Product<br>    fields = (&quot;name&quot;, &quot;price&quot;, )</pre><p>Having the model and the form, we can make the tests.</p><pre>python manage.py test</pre><p>This will show if the tests passed.</p><h3>Conclusion</h3><p>Make unit tests to every aspect of your code allows you to check if it works like you are expecting. You can use your tests as a documentation for your code. If you migrate the version of your library or programming language, it allows you to verify if everything is working correctly.</p><p>if you want to learn more about testing in Django: <a href="https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/"><em>here</em></a> and <a href="https://docs.djangoproject.com/en/3.1/topics/testing/overview/"><em>here</em></a> are good links from Django documentation</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=280704168d1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Scraping: Retrieving the Highest-Grossing Movies of All Time]]></title>
            <link>https://cferreirasuazo.medium.com/web-scraping-retrieving-the-highest-grossing-movies-of-all-time-89e5017b088b?source=rss-abf6595d01e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/89e5017b088b</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[movies-to-watch]]></category>
            <dc:creator><![CDATA[Cristhian Ferreira]]></dc:creator>
            <pubDate>Wed, 10 Apr 2019 01:22:30 GMT</pubDate>
            <atom:updated>2019-04-10T01:33:29.863Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*piaYP2cP_953emDkzs6CFA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/AtPWnYNDJnM?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Krists Luhaers</a> on <a href="https://unsplash.com/search/photos/cinema?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>The best way to learn something is by <strong>trial and error </strong>so I wanted to put in practice this principal with learning web scraping by building a small project. This is what you are going to learn next:</p><ul><li>Getting data with BeautifulSoup and requests</li><li>Cleaning data with Regex</li><li>Making tables with Pandas</li></ul><p>Because I like movies, last year I wrote an article of how to use an API for get movie data (<a href="https://medium.com/@cferreirasuazo/getting-movie-data-from-omdbapi-using-fetch-f2b96ae230dd">here is the link </a>) and now I want to retrieve data from The List of the Highest-Grossing Movies of All Time from Wikipedia(<a href="https://en.wikipedia.org/wiki/List_of_highest-grossing_films">link</a>). Scrolling down you will find a table with the rank, name, worldwide gross,etc. But we are going to use name and worldwide gross columns.</p><h4>Beautiful Sou-oop</h4><blockquote>Pennyworth only of Beautiful Soup,<br> Beautiful Sou-oop<br> Beautiful Sou-oop<br> Soup of the evening Beautiful Sou-oop<br> Beautiful, Beautiful Soup.</blockquote><p>This is a verse from a song in a chapter of Lewis Carol’s Alicen in Wonderland</p><p>Beutiful Soup is a python library that that allows to gather data from a website(web scraping) . It parses documents like XML, HTML and malformed HTML tags called tag soup.</p><pre>pip install beautifulsoup4</pre><h4>Parsers</h4><p>In order to scrap information we need a parser, Beautiful Soup uses python parses like lxml and html5lib.</p><blockquote>pip install lxml</blockquote><h4>Request Library</h4><p>The next library that we’re going to use is request, in a brief, <strong>request </strong>is a library for making HTTP request.</p><pre>pip install request</pre><h4>Pandas</h4><p>We want to structure our values, we are going to use pandas.</p><pre>pip install pandas</pre><p><strong>Pandas</strong> is a popular library used for data analysis. It offers data structures and a variety of tools for data manipulation.</p><pre>from bs4 import BeautifulSoup<br>import request <br>import pandas as pd</pre><pre>#url from our data<br>url = “https://en.wikipedia.org/wiki/List_of_highest-grossing_films&quot;<br>request = requests.get(url)</pre><pre>#gets the content from the web site<br>src = request.content</pre><pre>#used lxml to parse the data<br>soup = BeautifulSoup(src,’lxml’)</pre><p>When you want to fetch some data from a HTML or XML file you must know what element you want to retrieve. Using the Developers Tool from your browser, search for the CSS attributes of the objects that you want to retrieve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vNB8eSBemLMwFH8iFHz92g.png" /><figcaption>using picker from Developers Tool, hover the table and it will give you the tag and de css attribute</figcaption></figure><p>How are you going to get the table that we want? Using BeautifulSoup’s function “find”. This function takes a CSS Attributes and returns the value associated to this attribute.</p><pre>#Gets the table with the class &#39;wikitable&#39;<br>movies_table = soup.find(’table’,{’class’:’wikitable’</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v9VuEGIr7pnV_2CShGuMFA.png" /></figure><p>So we have our table, now we have to get all the names and all the grosses so.<br>Now, let’s use find_all method and make it search for all the &lt;a&gt; tags. It extracts all the elements &lt;a&gt;.</p><pre>#Gets all items with the tag &#39;a&#39;<br>raw_names = movies_table.find_all(&quot;a&quot;)</pre><pre>names = []</pre><pre><br>for item in raw_names:<br>    name = item.get(&#39;title&#39;)</pre><pre>    if name != None:<br>        names.append(name)</pre><p><strong>title</strong> is the CSS attribute of the elements that have the names of the movies. The condition will only take those that the are not empty or doesn’t have the value <strong>None</strong>.</p><p>Next, we want to get the amount of money gather by the movie</p><pre>#Gets all items with the align attribute right<br>raw_gross = movies_table.find_all(&#39;td&#39;,{&#39;align&#39;:&#39;right&#39;})</pre><pre>#get plain text from tags<br>gross_text = list(map(lambda g : g.text,raw_gross))</pre><pre>#Remove links<br>remove_link = list(map(lambda x :re.sub(r&#39;F\d+&#39;,&quot;&quot;,x),gross_text))</pre><pre>#Removes everything that is not a number</pre><pre>remove_character =<br>list( map(lambda x : re.sub(r&#39;[^0-9]&#39;,&quot;&quot;,x),remove_link))</pre><pre>parsed =  [int(t) for t in remove_character]</pre><p>The column that contains the values of the money tt’s a &lt;td&gt;tag and has the rules ‘align:right’. (Sorry for the messy code). After gathering text, we have to clean it using Regex. The first patter will remove links, and the second will remove characters that aren’t numbers like special characters. And finally parse to integers.</p><p>If you print both variables: parsed and names, you will get something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eiF4LCKL3eMxOO-E1_EVrA.png" /></figure><p>Two list representing name and gross. To arrange it we are going to use pandas.</p><pre>df = pd.DataFrame({&quot;Movie:&quot;:names, &quot;Gross&quot;:parsed})</pre><p>Panda’s class DataFrame will create a table based in the list that you pass in. For each column, you’ll give a name for the column and the rows containing the data to represent.</p><p>If everything went well you will get something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*DfvqCVdv8-gA_jitMUYd2A.png" /><figcaption>Result!!!</figcaption></figure><p>Web scraping is a cool way of learning Data Science. You have to get the data, clean it, parse it and finally arrange it to represent this data using graphs, tables, etc.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89e5017b088b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Repetitive Tasks with Scripts]]></title>
            <link>https://cferreirasuazo.medium.com/automating-repetitive-tasks-with-scripts-7307f3bc4546?source=rss-abf6595d01e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7307f3bc4546</guid>
            <category><![CDATA[batch]]></category>
            <category><![CDATA[scripting]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Cristhian Ferreira]]></dc:creator>
            <pubDate>Wed, 05 Dec 2018 14:54:56 GMT</pubDate>
            <atom:updated>2018-12-06T02:11:11.373Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*csqpgoE3UUyh-aUsqycOfw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/9SoCnyQmkzI?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jefferson Santos</a> on <a href="https://unsplash.com/search/photos/code?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Back in my days in high school, I started learning about different things related with computer science. A friend called Carlos used to talk to me a lot about hacking, programming languages, video games and electronics. One day he sent me a PDF which talked about how to run a Trojan in a computer and by that way I was introduced to scripting languages.</p><p>A scripting language is a programming language which runs in a special environment to automate tasks those could be a software application, a web browser, and some embedded system like a raspberry pi. Additionally they are used as general purpose language such as Python (Data Science, Back-end, embedded Devices, etc), JavaScript (Mobile Development, Back-end,Web Development).</p><p><strong>Interpreted languages</strong></p><p>A computer uses 1s and 0s to run programs so in order to create programs, we use a programming language based in English to write our programs which is decipher by the computer and expressed the result in machine code. This allows checking mistakes.</p><p>If you want to run a program in Linux or Windows or MacOS or an embedded system in C or C++ or Java you need a compiler written for that system.</p><p>In other hand interpreted languages such as scripting languages doesn’t need to be compiled. The code is executed line by line but the process of getting a result is slower than with a compiled language. But if you write a program in Python you don’t need to worry if you run it in Linux or in Windows or any other system.</p><p>Among the features of scripting languages includes</p><p>-Use of variables<br>-User input<br>-Conditions<br>-Loops<br>-Modulate with functions<br>-Some allows to use Regular Expressions(RegEx)</p><p>Some uses</p><p>-System Administration<br>-Development<br>-Schedule tasks</p><h3><strong>Possible scenarios with Batch and Bash scripting</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ndkpz2Ok26C6JNnfDeQ2gQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/Tjbk79TARiE?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Sai Kiran Anagani</a> on <a href="https://unsplash.com/search/photos/linux?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Now, I want to talk about some cases where I automated some boring stuff with Batch and Bash Scripting at work and my daily life.</p><p><strong>open_files.bat</strong></p><p>Windows comes integrated with batch to automate stuff. Some of its features are read user input, control structure, use of functions, regular expressions, etc.</p><p>At work I have to open multiple programs and files such as Excel, Word, Calculator, Outlook, Word and many others but it takes a time when you have to open all of them at once when the computer resets or if there is a shutdown so I though “I can create a batch script and open all these programs at once”</p><p>The script is stored in a plane text file containing all the commands to execute once you click it. The file is saved with .bat extension.</p><p>The script looks like this:</p><p>//Name: run.bat</p><pre><em>start Calculator<br>start email #Outlook <br>start app1_shortcut.lnk<br>start some_page.website<br>start explorer_shortcut.lnk<br>start app2.exe<br>start excel_file1.xlsx<br>start excel_file2.xlsx<br>start excel_file3.xltx</em></pre><h4><strong>git_ft.sh</strong></h4><p>After working with a new feature or fixing something in your project, you’d like to commit those changes to your repository. You will use something like this:</p><p>git add –A<br>git commit –m “Some Message”<br>git push –u origin some_branch</p><p>If you want to improve this workflow you could use one of those options:</p><p><em>Using aliases:</em></p><p>gaa //git add –A<br>gcm “Some Message” //git commit –m “Some Message”<br>gpuo some_branch //git push –u origin some_branch</p><p>or you can do it with scripts 😃</p><p><em>Creating a script:</em></p><pre><em>//git_script.sh</em><br> 1 read -p “Message: “ message<br> 2 branch=$(git branch | sed -n -e ‘s/^\* \(.*\)/\1/p’)<br> 3 <br> 4 git add -A<br> 5 git commit -m “$message”<br> 6 git push -u origin $branch</pre><p>Line 1- Gets message for the commit<br>Line 2- gets current branch</p><h3><strong>Scheduling task with Cron Jobs</strong></h3><p>As System Administrator or for automation you would like to run periodically some tasks in your system like making backups, check for logs, send emails, generate reports and many other things. These are possible with Cron.</p><p>Cron is a daemon, a process that runs in background. It allows running commands or scripts given a date or time.</p><p>I’d talk more about Cron and Cron Jobs but It’d make this article larger, instead, I will leave <a href="https://youtu.be/ljgvo2jM234">this</a> and <a href="https://en.m.wikipedia.org/wiki/Cron">this</a> if you want to learn more about it.</p><h3><strong>What’s next?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Onppb3NuGffSrTTUk4JizA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/zoN_TUPs5gA?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">rawpixel</a> on <a href="https://unsplash.com/search/photos/bye?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Hey, now go ahead and start writing some scripts. You could use node or python. That includes more features than shell scripts. I hope you enjoyed this little introduction. If you liked this article don’t forget to clap and share it. I would like to read your stories about what you automated and share with me your scripts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7307f3bc4546" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting movie data from OMDBAPI using fetch()]]></title>
            <link>https://cferreirasuazo.medium.com/getting-movie-data-from-omdbapi-using-fetch-f2b96ae230dd?source=rss-abf6595d01e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2b96ae230dd</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[series]]></category>
            <category><![CDATA[movies]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[omdb-api]]></category>
            <dc:creator><![CDATA[Cristhian Ferreira]]></dc:creator>
            <pubDate>Wed, 05 Sep 2018 14:06:15 GMT</pubDate>
            <atom:updated>2018-09-05T14:06:15.778Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VYae49oiBQwwg5rC" /><figcaption>“Batman logo placed on white surface” by <a href="https://unsplash.com/@hngstrm?utm_source=medium&amp;utm_medium=referral">Henry &amp; Co.</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>During my 3rd week in #100DaysofCode Challenge I wanted to learn more about Async and working with APIs so I wanted to make a small app functionality to test my knowledge. After a couple of hours searching and filtering options I found an API called OMDB API(Open Movie Database), it’s a RESTful web service to retrieve movie or series information (title, plot, actors, year, poster, etc). so I choose to create a small app called Movie Catalog.</p><p><strong>Making first request</strong></p><p>To make a request we need an API key. You can get one by registry. In their [website].</p><p><a href="http://www.omdbapi.com/?apikey=%5byour-apikey%5d&amp;s=batman"><em>http://www.omdbapi.com/?apikey=[your-apikey]&amp;</em></a></p><p><strong>Playing with the API</strong></p><p>There are three options to make request:</p><p>Search(s=): Retrieves you all possible options.<br>Title(t=): A movie title.<br>ID(i=): a valid IMDB ID (e.g. tt1234567).</p><p>There are also more options we could include in our request like the data type to return (JSON / XML), the type of content (movie, series, or episode), year of the movie, etc. You can learn more options by reading their <a href="https://www.omdbapi.com/">documentation</a>.</p><p>Here we have our request for batman movies :</p><p><a href="http://www.omdbapi.com/?apikey=[your-apikey]&amp;s=batman"><em>http://www.omdbapi.com/?apikey=[your-apikey]&amp;s=batman</em></a></p><p>But wait, we have to use a function for this request, that’s where JavaScript and fetch API play their roles.</p><p><strong>What is fetch API?</strong></p><p>Fetch() allows you make http request using Promises for a more simple functionality avoiding callback hell and avoiding to use XMLHttpRequest if you don’t want to use a framework.</p><p>Fetch takes a required argument as resource path to retrieve and returns a promises if is revolved or not.</p><p>Our fetch request looks like this:</p><pre>fetch(<a href="http://www.omdbapi.com/?apikey=[your-apikey]&amp;s=batman"><em>http://www.omdbapi.com/?apikey=[your-apikey]&amp;s=batman</em></a>)<br> .then((success) =&gt; { success.json() } )<br> .then((movies) =&gt; { console.log(movies) } )<br> .catch((error)=&gt;{ console.log(error)});</pre><p>One of the coolest features of fetch() is chaining promises. After making the request, we parse the information in JSON, then we chain to another promises to print the information in screen, then wallah!!!! , there is your movies in JSON.</p><pre> { Search: <br>   [ { Title: &#39;Batman Begins&#39;,<br>       Year: &#39;2005&#39;,<br>       imdbID: &#39;tt0372784&#39;,<br>       Type: &#39;movie&#39;,<br>       Poster: &#39;https://m.media-amazon.com/images/M/MV5BZmUwNGU2ZmItMmRiNC00MjhlLTg5YWUtODMyNzkxODYzMmZlXkEyXkFqcGdeQXVyNTIzOTk5ODM@._V1_SX300.jpg&#39; },<br>     { Title: &#39;Batman v Superman: Dawn of Justice&#39;,<br>       Year: &#39;2016&#39;,<br>       imdbID: &#39;tt2975590&#39;,<br>       Type: &#39;movie&#39;,<br>       Poster: &#39;https://m.media-amazon.com/images/M/MV5BYThjYzcyYzItNTVjNy00NDk0LTgwMWQtYjMwNmNlNWJhMzMyXkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SX300.jpg&#39; },<br>     { Title: &#39;Batman&#39;,<br>       Year: &#39;1989&#39;,<br>       imdbID: &#39;tt0096895&#39;,<br>       Type: &#39;movie&#39;,<br>       Poster: &#39;https://m.media-amazon.com/images/M/MV5BMTYwNjAyODIyMF5BMl5BanBnXkFtZTYwNDMwMDk2._V1_SX300.jpg&#39; },<br>     { Title: &#39;Batman Returns&#39;,<br>       Year: &#39;1992&#39;,<br>       imdbID: &#39;tt0103776&#39;,<br>       Type: &#39;movie&#39;,<br>       Poster: &#39;https://m.media-amazon.com/images/M/MV5BOGZmYzVkMmItM2NiOS00MDI3LWI4ZWQtMTg0YWZkODRkMmViXkEyXkFqcGdeQXVyODY0NzcxNw@@._V1_SX300.jpg&#39; },<br>     { Title: &#39;Batman Forever&#39;,<br>       Year: &#39;1995&#39;,<br>       imdbID: &#39;tt0112462&#39;,<br>       Type: &#39;movie&#39;,<br>       Poster: &#39;https://m.media-amazon.com/images/M/MV5BNWY3M2I0YzItNzA1ZS00MzE3LThlYTEtMTg2YjNiOTYzODQ1XkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SX300.jpg&#39; },<br>     { Title: &#39;Batman &amp; Robin&#39;,<br>       Year: &#39;1997&#39;,<br>       imdbID: &#39;tt0118688&#39;,<br>       Type: &#39;movie&#39;,<br>       Poster: &#39;https://m.media-amazon.com/images/M/MV5BMGQ5YTM1NmMtYmIxYy00N2VmLWJhZTYtN2EwYTY3MWFhOTczXkEyXkFqcGdeQXVyNTA2NTI0MTY@._V1_SX300.jpg&#39; },<br>     { Title: &#39;The Lego Batman Movie&#39;,<br>       Year: &#39;2017&#39;,<br>       imdbID: &#39;tt4116284&#39;,<br>       Type: &#39;movie&#39;,<br>       Poster: &#39;https://m.media-amazon.com/images/M/MV5BMTcyNTEyOTY0M15BMl5BanBnXkFtZTgwOTAyNzU3MDI@._V1_SX300.jpg&#39; },<br>     { Title: &#39;Batman: The Animated Series&#39;,<br>       Year: &#39;1992–1995&#39;,<br>       imdbID: &#39;tt0103359&#39;,<br>       Type: &#39;series&#39;,<br>       Poster: &#39;https://m.media-amazon.com/images/M/MV5BNzI5OWU0MjYtMmMwZi00YTRiLTljMDAtODQ0ZGYxMDljN2E0XkEyXkFqcGdeQXVyNTA4NzY1MzY@._V1_SX300.jpg&#39; },<br>     { Title: &#39;Batman: Under the Red Hood&#39;,<br>       Year: &#39;2010&#39;,<br>       imdbID: &#39;tt1569923&#39;,<br>       Type: &#39;movie&#39;,<br>       Poster: &#39;https://m.media-amazon.com/images/M/MV5BYTdlODI0YTYtNjk5ZS00YzZjLTllZjktYmYzNWM4NmI5MmMxXkEyXkFqcGdeQXVyNTA4NzY1MzY@._V1_SX300.jpg&#39; },<br>     { Title: &#39;Batman: The Dark Knight Returns, Part 1&#39;,<br>       Year: &#39;2012&#39;,<br>       imdbID: &#39;tt2313197&#39;,<br>       Type: &#39;movie&#39;,<br>       Poster: &#39;https://m.media-amazon.com/images/M/MV5BMzIxMDkxNDM2M15BMl5BanBnXkFtZTcwMDA5ODY1OQ@@._V1_SX300.jpg&#39; } ],<br>  totalResults: &#39;345&#39;,<br>  Response: &#39;True&#39; }</pre><p>Here is a preview of the search function that i made</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Orixzzf7X8T6_pQAhkMJFw.png" /></figure><p>Thanks for your time for read my article i hope you liked it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2b96ae230dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Going to CodeCampSDQ, my first programming conference]]></title>
            <link>https://cferreirasuazo.medium.com/going-to-codecampsdq-my-first-programming-conference-bcc5e9a3a0d1?source=rss-abf6595d01e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcc5e9a3a0d1</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[dominican-republic]]></category>
            <category><![CDATA[conference]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Cristhian Ferreira]]></dc:creator>
            <pubDate>Mon, 25 Jun 2018 02:21:26 GMT</pubDate>
            <atom:updated>2018-06-25T02:21:26.829Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-w4J3MUpKTKKGG91Tllgg.jpeg" /></figure><p>It’s been 8 months since I went to CodeCampSDQ the greatest IT Conference in the Dominican Republic. So I wanted to share with you about my experience during this conference and maybe read about yours.</p><p>While scrolling in different Medium sections I found a bunch of people talking about Programming Conferences, I found about JSConf, a conference for Javascript programmers; some about Linux and Python. So I asked in a Dominican Developer’s Facebook Group and found out that there was one Dev. Conf. in Dominican Republic but it only takes place once a year so I had to wait a couple of months before going.</p><p>On Black Friday I bought my ticket, I was really excited, I was going to a Programming Conference where experts talk about their experience and emerging technologies.</p><p><strong>About CodeCampSDQ</strong></p><p>CodeCampSDQ is a technical conference that took place in December, at The Institute of Technology of Santo Domingo, the Dominican Republic. They provide access to renowned experts from different fields in technology — Mobile, Cloud Computing, Web Development, Security, etc — and topics about the last trends, best practices, and common mistakes.2017 was its 5th year and brought 19 speakers from the Dominican Republic and other countries.</p><p><strong>People</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*mHcKE966iK2AdMjJ_le2Zg.png" /></figure><p>650 hundred people including volunteers plus 19 speakers assisted to CodeCampSDQ.</p><p>Among the speakers were a Microsoft consultant, a Github developer, avideo game developer, security experts and Mujeres TIC(- a community of IT woman and girls who want to foment the IT technologies with Dominican woman).</p><p>Also, I was able to meet with some Campers from FreeCodeCamp Santo Domingo; they were both volunteers and attendees.</p><p><strong>Environment</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*JlWVGAquoIgbRR8UDgTlxA.png" /></figure><p>INTEC is one of the most renowned technological institutions in DR. the talks were arranged in 3 buildings in INTEC.</p><p>Walked in and volunteers greeted me and gave me a blue T-shirt, an ID card, an envelope with stickers of Digital Ocean, a food ticket, and some brochures of sponsors.</p><p><strong>Talks and topics</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uCLY4gHUO6lRxLt_W6u5Cg.jpeg" /></figure><p>CodeCampSDQ Evolved was the name of this edition. Attendants were wearing blue t-shirts, speakers black ones and volunteers red ones.</p><p>It was a one day conference so every presentation lasted from 45 minutes to one hour. Azure, Github, Machine Learning, Unity, Xamarin, Cyber Security, including best practices and tips brought to us by the speakers. Almost at the end of the Conf, there was a Q.A. Panel with some speakers and hosted by one of the organizers.</p><p><strong>The Aftermath</strong></p><p>At the end of the event I was inspired, I knew that I had to learn more, work harder. It was one of my best days of 2017. I was really motivated to continue learning more technologies and more tools, I opened my mind. After I got home I continue working with my portfolio from FreeCodeCamp and 3 months later I finished.</p><p>Megsoft, thanks for this amazing experience, I loved it and I would like to assist again to another edition of CodeCampSDQ.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcc5e9a3a0d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>