<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ariel Reyes</title>
    <description>The latest articles on DEV Community by Ariel Reyes (@arrefl).</description>
    <link>https://dev.to/arrefl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F277032%2F43a24b06-9994-4840-9ebb-4e3b5e0eb175.jpg</url>
      <title>DEV Community: Ariel Reyes</title>
      <link>https://dev.to/arrefl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arrefl"/>
    <language>en</language>
    <item>
      <title>Store English Words while you're surfing on a WebBrowser with MateTranslate and Javascript</title>
      <dc:creator>Ariel Reyes</dc:creator>
      <pubDate>Sat, 24 Jul 2021 11:38:10 +0000</pubDate>
      <link>https://dev.to/arrefl/store-english-words-while-you-re-surfing-on-a-webbrowser-with-matetranslate-and-javascript-5gjh</link>
      <guid>https://dev.to/arrefl/store-english-words-while-you-re-surfing-on-a-webbrowser-with-matetranslate-and-javascript-5gjh</guid>
      <description>&lt;p&gt;When I am reading often we track all words that we don't know but when we consume many content, could be great have a tool to help us do this job instead.&lt;/p&gt;

&lt;p&gt;So with this Idea I reuse an extension called Mate Translate so, to have this feature in the app you need to pay. For that reason we could make our own implementation of that.&lt;/p&gt;

&lt;p&gt;Get the components: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ArjmwR8F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t776kxtvw1tjirfz3ail.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ArjmwR8F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t776kxtvw1tjirfz3ail.png" alt="Creating the components" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Defining validations:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZdFEqL0E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/54lo0y7q54m9x9gfabsf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZdFEqL0E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/54lo0y7q54m9x9gfabsf.png" alt="defining validations" width="664" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also =&amp;gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6ecesOLi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bxnlutra7uoiyd25oxmr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6ecesOLi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bxnlutra7uoiyd25oxmr.png" alt="more" width="746" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Obtaining the dictionary:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hhppNJeK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ys8u7qyndzlf16bzezqp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hhppNJeK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ys8u7qyndzlf16bzezqp.png" alt="get the dic" width="726" height="655"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Creating the service:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D6WRajPo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7o3te4mdjta5939gyz0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D6WRajPo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7o3te4mdjta5939gyz0.png" alt="creating the service" width="594" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Running the service:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Copy the code from here: https://github.com/irrefl/WordsStoringWithMateTranslateAndJavascript/blob/main/WordsCollector.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and paste it into the web console pressing F12:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--upqgXwdt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vu4xdx77es4v17my2vw4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--upqgXwdt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vu4xdx77es4v17my2vw4.png" alt="press f12" width="800" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Result:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ucbPnMQL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/264oiyn70vv5q6k25m06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ucbPnMQL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/264oiyn70vv5q6k25m06.png" alt="alt text" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webscraping</category>
      <category>cleancode</category>
    </item>
    <item>
      <title>Making a dynamic Stored Procedure with SQL and C#</title>
      <dc:creator>Ariel Reyes</dc:creator>
      <pubDate>Thu, 21 Nov 2019 18:08:06 +0000</pubDate>
      <link>https://dev.to/arrefl/making-a-dynamic-stored-procedure-with-sql-and-c-8-1699</link>
      <guid>https://dev.to/arrefl/making-a-dynamic-stored-procedure-with-sql-and-c-8-1699</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;﻿using Backend.Infrastructura.ProcedimientosAlmacenados.Command;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
using System.Web.Script.Serialization;

namespace Backend.Infrastructura
{
    public class SqlStoredProcedureServiceManager
    {
        public async Task&amp;lt;List&amp;lt;T&amp;gt;&amp;gt; Get&amp;lt;T&amp;gt;(string uri)
        {
            HttpClient client = new HttpClient();

            HttpResponseMessage response = await client.GetAsync(uri);
            bool responseWasWrong = !response.IsSuccessStatusCode;
            if (responseWasWrong)
            {
                return null;
            }

            string jsonString = await response.Content.ReadAsStringAsync(); 
            JavaScriptSerializer JSserializer = new JavaScriptSerializer();

            return JSserializer.Deserialize&amp;lt;List&amp;lt;T&amp;gt;&amp;gt;(jsonString);
        }

        private DataTable GetDataTable(string query)
        {

                SqlDataAdapter adapter = new SqlDataAdapter(query,SQLConfiguration.GetDbString());
                DataTable dataTable = new DataTable();
                adapter.Fill(dataTable);

                SQLConfiguration.Close();
                return dataTable;

        }

        public DataTable GetDataByStoredProcedure(CommandSender cmdSnd)
        {

            using (SqlDataAdapter sda = new SqlDataAdapter(cmdSnd.GetCommand()))
            {

                DataTable dt = new DataTable();
                sda.Fill(dt);
                SQLConfiguration.Close();
                return dt;
            }

        }

        public List&amp;lt;T&amp;gt; GetAnyDataByCommand&amp;lt;T&amp;gt;(CommandSender cmdSender)
        {
            DataTable table = GetDataByStoredProcedure(cmdSender);
            return ConvertToList&amp;lt;T&amp;gt;(table);
        }


        public List&amp;lt;T&amp;gt; ConvertToList&amp;lt;T&amp;gt;(DataTable dataTable)
        {
            var columnNames = dataTable.Columns.Cast&amp;lt;DataColumn&amp;gt;()
                    .Select(c =&amp;gt; c.ColumnName)
                    .ToList();
            var properties = typeof(T).GetProperties();

            return dataTable.AsEnumerable().Select(row =&amp;gt;
            {
                var objectType = Activator.CreateInstance&amp;lt;T&amp;gt;();
                foreach (var prop in properties)
                {
                    if (columnNames.Contains(prop.Name))
                    {
                        PropertyInfo propInfo = objectType.GetType().GetProperty(prop.Name);


                        prop.SetValue(objectType, row[prop.Name] == DBNull.Value ? null : Convert.ChangeType(row[prop.Name], propInfo.PropertyType));
                    }
                }
                return objectType;
            }).ToList();
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
