<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Enrique Moreno Tent</title>
	<atom:link href="https://enriquemorenotent.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://enriquemorenotent.com</link>
	<description></description>
	<lastBuildDate>Sat, 17 Jun 2017 12:24:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.8.2</generator>
	<item>
		<title>NOTAN development &#8211; Using ScriptableObjects for weapons and armors</title>
		<link>https://enriquemorenotent.com/notan-development-using-scriptableobjects-for-weapons-and-armors/</link>
		<comments>https://enriquemorenotent.com/notan-development-using-scriptableobjects-for-weapons-and-armors/#respond</comments>
		<pubDate>Sat, 07 Jan 2017 14:43:01 +0000</pubDate>
		<dc:creator><![CDATA[Enrique Moreno Tent]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://enriquemorenotent.com/?p=1008</guid>
		<description><![CDATA[I have started a new project in an area that is out of my comfort zone, but exciting. I am developing my first video-game! It started as a PS Vita game, but it is possible that it will be released in more platforms later on. This is being an enriching experience for me, so I [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I have started a new project in an area that is out of my comfort zone, but exciting. I am developing my first video-game! It started as a PS Vita game, but it is possible that it will be released in more platforms later on.</p>
<p>This is being an enriching experience for me, so I have decided to document my discoveries  in my blog. I will be writing a series of posts about my progress. Let&#8217;s call the game for now <strong>NOTAN</strong>.</p>
<p>Today I am going to talk about Scriptable Objects. They are just data containers, but with them I will be able to edit and manipulate my objects in the Unity Editor. This will be quite helpful.</p>
<p><span id="more-1008"></span></p>
<p>In my game I am going to have a wide catalogue of weapons and armors. The weapons are going to have a certain type of attack: <strong>blunt</strong>, <strong>slash </strong>or <strong>ranged</strong>. The armors on the other side are going to have a resistance to every kind of attack, which will be ranked <strong>Low</strong>, <strong>Med</strong>, <strong>Strong</strong> or <strong>Super</strong>.</p>
<p>First let&#8217;s create Enumerations for this kinds of attributes</p>
<pre class="brush: csharp; title: ; notranslate">
public enum WeaponType { Blunt, Slash, Ranged };
public enum Defense { Low, Med, High, Super };
</pre>
<p>Good! Now that those are defined, let&#8217;s create our data classes</p>
<pre class="brush: csharp; title: ; notranslate">
// Weapon.cs
using UnityEngine;

public class Weapon : ScriptableObject {

    // Enums
    public enum WeaponType { Blunt, Slash, Ranged };

    // Attributes
    public WeaponType type;
}
</pre>
<pre class="brush: csharp; title: ; notranslate">
// Armor.cs
using UnityEngine;

public class Armor : ScriptableObject {

    // Enums
    public enum Defense { Low, Med, High, Super };

    // Attributes
    public Defense blunt, slash, ranged;
}
</pre>
<p>We have defined an attribute for the weapons to decide the type of attack that it will have.</p>
<p>We have also defined 3 attributes on the Armor class. These will define what its resistance is to every tyre of attack.</p>
<p>Finally we also moved the enums inside the classes. Semantically they make sense to live there.</p>
<p>Now that our data structures are defined, let&#8217;s see how can we create them in Unity. We will aim to create an entry in the menu bar that allows us to create new instances of our classes. To achieve this, we will add the following directive on top of each class:</p>
<pre class="brush: plain; title: ; notranslate">
[CreateAssetMenu(fileName = &quot;Armor&quot;, menuName = &quot;NOTAN/Armor&quot;, order = 1)]
</pre>
<p>The first attribute is the class name that will be used to create the Scriptable Object. The second attribute will be the path that will be created to achieve such instance. The last parameter is the position that this element will take inside the menu.</p>
<p>Now let&#8217;s take a look at our finished classes</p>
<pre class="brush: csharp; title: ; notranslate">
// Weapon.cs
using UnityEngine;

[CreateAssetMenu(fileName = &quot;Weapon&quot;, menuName = &quot;NOTAN/Weapon&quot;, order = 1)]
public class Weapon : ScriptableObject {

    // Enums
    public enum WeaponType { Blunt, Slash, Ranged };

    // Attributes
    public WeaponType type;
}
</pre>
<pre class="brush: csharp; title: ; notranslate">
// Armor.cs
using UnityEngine;

[CreateAssetMenu(fileName = &quot;Armor&quot;, menuName = &quot;NOTAN/Armor&quot;, order = 2)]
public class Armor : ScriptableObject {

    // Enums
    public enum Defense { Low, Med, High, Super };

    // Attributes
    public Defense blunt, slash, ranged;
}
</pre>
<p>With this, our scriptable object is finished. If we try to create a new element inside one of our project&#8217;s folder, we will encounter the following menu.</p>
<p><a href="https://enriquemorenotent.com/wp-content/uploads/2017/01/creating_scriptable_objects.gif"><img src="https://enriquemorenotent.com/wp-content/uploads/2017/01/creating_scriptable_objects.gif" alt="" width="1068" height="771" class="alignnone size-full wp-image-1024" /></a></p>
<p>Wonderful! Now we can create object with scripts attached to them. This will make them much easier to manipulate and use, thanks to Unity&#8217;s inspector.</p>
<p>How does it look in the inspector, you ask me? Well, let&#8217;s take a look.</p>
<p><a href="https://enriquemorenotent.com/wp-content/uploads/2017/01/scriptable_objects_in_the_inspector.gif"><img src="https://enriquemorenotent.com/wp-content/uploads/2017/01/scriptable_objects_in_the_inspector.gif" alt="" width="904" height="672" class="alignnone size-full wp-image-1027" /></a></p>
<p>Great, isn&#8217;t it? Now we can change the properties of our gear without even having to touch any code. And we can easily assign our gear to another Unity scripts as simple parameters!</p>
<p>I hope you liked this first episode on developing with Unity. Tell me your opinion and experience about Scriptable Objects in the comments section.</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>https://enriquemorenotent.com/notan-development-using-scriptableobjects-for-weapons-and-armors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using LINQ to manage Lists and Arrays in C#</title>
		<link>https://enriquemorenotent.com/using-linq-to-manage-lists-and-arrays-in-c/</link>
		<comments>https://enriquemorenotent.com/using-linq-to-manage-lists-and-arrays-in-c/#respond</comments>
		<pubDate>Tue, 06 Dec 2016 10:29:23 +0000</pubDate>
		<dc:creator><![CDATA[Enrique Moreno Tent]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://enriquemorenotent.com/?p=997</guid>
		<description><![CDATA[Looping through array, lists and such types of structures is a common practice in development. It requires the well-known loop code I am sure most of you have written this loop about 1 million times. I recently discovered there is a simpler way to do this: Much more pleasant to the eye, right? But this [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Looping through array, lists and such types of structures is a common practice in development. It requires the well-known loop code</p>
<pre class="brush: csharp; title: ; notranslate">
Enemy[] enemies = GetEnemies();

bool anyEnemyAlive = false;
foreach (Enemy enemy in enemies) {
    if (enemy.alive) {
        anyEnemyAlive = true;
        break;
    }
}
if (anyEnemyAlive) {
    // Do something
}
</pre>
<p>I am sure most of you have written this loop about 1 million times. I recently discovered there is a simpler way to do this:</p>
<pre class="brush: csharp; title: ; notranslate">
using System.Linq;

Enemy[] enemies = GetEnemies();

if (enemies.Any(enemy =&gt; enemy.alive)) {
    // Do something
}
</pre>
<p>Much more pleasant to the eye, right?</p>
<p>But this approach should be use with care, since it can have unexpected performance hits or garbage allocations. It would be best used for one-time set up methods, probably.</p>
<p>Feel free to comment on this technique and share your thoughts.</p>
<p>Credit: <a href="https://twitter.com/adamgryu/status/664116395823747073" target="_blank">ADAMGRYU</a></p>
]]></content:encoded>
			<wfw:commentRss>https://enriquemorenotent.com/using-linq-to-manage-lists-and-arrays-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;DOMContentLoaded&#8221; vs &#8220;load&#8221; &#8211; What are the differences?</title>
		<link>https://enriquemorenotent.com/domcontentloaded-vs-load-what-are-the-differences/</link>
		<comments>https://enriquemorenotent.com/domcontentloaded-vs-load-what-are-the-differences/#respond</comments>
		<pubDate>Thu, 22 Sep 2016 12:09:26 +0000</pubDate>
		<dc:creator><![CDATA[Enrique Moreno Tent]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://enriquemorenotent.com/?p=976</guid>
		<description><![CDATA[I was looking at the network tab inside Chrome developer tools, and I found this image before me, inside the &#8220;Network&#8221; tab: If we look at the timeline, we see 2 lines. One is blue and the other one is red. Looking at the footer from that same panel, we see the blue one is [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I was looking at the network tab inside Chrome developer tools, and I found this image before me, inside the &#8220;Network&#8221; tab:</p>
<p><img src="https://enriquemorenotent.com/wp-content/uploads/2016/09/network-tab.png" alt="none" /></p>
<p>If we look at the timeline, we see 2 lines. One is blue and the other one is red. Looking at the footer from that same panel, we see the blue one is called &#8220;DOMContentLoad&#8221; and the red one is called &#8220;Load&#8221;. But what is the difference between them?</p>
<p>DOMContentLoad: This is the time it takes to download all the DOM tree, and parse it. This means not only download the content of the HTML file, as in its characters, but also the time it takes to understand the relationship between the nodes of the DOM and form the tree structure inside Chrome. Basically to form the DOM hierarchy.</p>
<p>Load: This event includes all things from DOMContentLoad, and includes also all the sub-resources included in the document. This means: CSS files, JS files, images, iframes, etc&#8230; Basically all that is needed for the page to render completely.</p>
<p>From a Javascript and jQuery point of view, DOMContentLoad is enough most of the times to start executing. This is the reason why most jQuery code is attached to the event &#8220;ready&#8221;, which fires with &#8220;DOMContentLoad&#8221;.</p>
<p>On the other side, if some code needs to access things like the size of an image, or the CSS attribute of a certain DOM node, waiting for the &#8220;load&#8221; event is necessary, since this information will not be available until this event fires.</p>
<p>If you want to understand better how these events are fired, <a href="http://web.archive.org/web/20150405114023/http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/Default.html" target="_blank">here</a> is a great demo for it.</p>
<p>Hopefully now you have a better understanding of what these 2 events mean, and they help you know better how your own websites work and perform.</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>https://enriquemorenotent.com/domcontentloaded-vs-load-what-are-the-differences/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add SSL/TLS to Apache with &#8220;Let&#8217;s Encrypt&#8221;</title>
		<link>https://enriquemorenotent.com/add-ssltls-to-apache-with-lets-encrypt/</link>
		<comments>https://enriquemorenotent.com/add-ssltls-to-apache-with-lets-encrypt/#respond</comments>
		<pubDate>Thu, 31 Dec 2015 14:46:15 +0000</pubDate>
		<dc:creator><![CDATA[Enrique Moreno Tent]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://enriquemorenotent.com/?p=904</guid>
		<description><![CDATA[Everyone would love to see that lovely green lock next to your website&#8217;s URL and that glorious &#8220;https&#8221; mark, which makes us all feel warm and fuzzy inside, right? No problem. Thank&#8217;s to &#8220;Let&#8217;s Encrypt&#8221; you can now make it happen fast and free. Let&#8217;s build together a better internet. This tutorial is to set [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Everyone would love to see that lovely green lock next to your website&#8217;s URL and that glorious &#8220;https&#8221; mark, which makes us all feel warm and fuzzy inside, right? No problem. Thank&#8217;s to &#8220;Let&#8217;s Encrypt&#8221; you can now make it happen fast and free. Let&#8217;s build together a better internet.</p>
<p>This tutorial is to set up the certificate on an Apache Web Server</p>
<h2>Get the client</h2>
<p>First of all we will download the &#8220;Let&#8217;s encrypt&#8221; client. That is right. They made a client-side app, to make it extra easy for you. So we will save it under <code>/opt</code>, which seems to be the standard directory to place 3rd-party software, or so I am told.</p>
<pre class="brush: bash; title: ; notranslate">sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt</pre>
<h2>Set up the certificate</h2>
<p>Keep in mind how many domains you want to support with a single certificate. For instance, this blog should work only with the URL <code>https://enriquemorenotent.com</code>, but it could also be set to work with <code>https://www.enriquemorenotent.com</code> which means that we have 2 domains to support:</p>
<ul>
<li>enriquemorenotent.com</li>
<li>www.enriquemorenotent.com</li>
</ul>
<pre class="brush: bash; title: ; notranslate">
cd /opt/letsencrypt
./letsencrypt-auto --apache -d enriquemorenotent.com -d www.enriquemorenotent.com
</pre>
<p>Notice how I add a <code>-d</code> for every domain I want to support. It is <strong>important</strong> that the first domain is the base domain.</p>
<p>After a few questions like email address and others, you will be all set!</p>
<h2>Renew your certificate automatically</h2>
<p>The certificates from Let&#8217;s Encrypt only last 3 months. But updating them is quite easy. Just download the following script and install it</p>
<pre class="brush: bash; title: ; notranslate">
sudo curl -L -o /usr/local/sbin/le-renew http://do.co/le-renew
sudo chmod +x /usr/local/sbin/le-renew
</pre>
<p>Now all you have to do is run</p>
<pre class="brush: bash; title: ; notranslate">
sudo le-renew enriquemorenotent.com
</pre>
<p>and the cerfiticate will update (or it will tell you that is too soon for it).</p>
<p>We can make this task automatic using crontab:</p>
<pre class="brush: bash; title: ; notranslate">
crontab -e
</pre>
<pre class="brush: plain; title: ; notranslate">
30 2 * * 1 /usr/local/sbin/le-renew enriquemorenotent.com &gt;&gt; /var/log/le-renew.log
</pre>
<p>This will run every Monday at 2:30 am the script, updating the certificate if necessary</p>
<h2>Update the client</h2>
<p>Remember that the client you cloned with git might be in development, so every now and then it might not be a bad idea to do this:</p>
<pre class="brush: bash; title: ; notranslate">
cd /opt/letsencrypt
sudo git pull
</pre>
<p>Just to make sure we are using the latest version 😉</p>
<p>&#8212;</p>
<p>Based on <a href="https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-14-04" target="_blank">this tutorial</a></p>
]]></content:encoded>
			<wfw:commentRss>https://enriquemorenotent.com/add-ssltls-to-apache-with-lets-encrypt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manage Sublime Text themes easily with Colorsublime</title>
		<link>https://enriquemorenotent.com/manage-sublime-text-themes-easily-with-colorsublime/</link>
		<comments>https://enriquemorenotent.com/manage-sublime-text-themes-easily-with-colorsublime/#respond</comments>
		<pubDate>Thu, 10 Dec 2015 19:30:11 +0000</pubDate>
		<dc:creator><![CDATA[Enrique Moreno Tent]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://enriquemorenotent.com/?p=898</guid>
		<description><![CDATA[Changing themes in Sublime Text can be a difficult task. Not because it is extremely critical for your productivity, but we all want our editor to look nice and pretty. It is like waking up in the morning and spending 30 minutes in front of the mirror, trying to decide what trousers to wear, so [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Changing themes in Sublime Text can be a difficult task. Not because it is extremely critical for your productivity, but we all want our editor to look nice and pretty. It is like waking up in the morning and spending 30 minutes in front of the mirror, trying to decide what trousers to wear, so that our ass do not look too fat.</p>
<p>Choosing themes was not usually an easy task. Usually involves choosing theme, activating it, and checking it, which shouldn&#8217;t take more than 10 seconds, but if you are doubting between 20 themes, it can get quite tedious.</p>
<p>Luckily we have a good solution now. It is called <a href="http://colorsublime.com/" target="_blank">Colorsublime</a>. This website has a huge collection of themes, with nice previews of how it will look like, so you can decide faster. But <strong>that is not the deal-breaker</strong>. The real breakthrough is <a href="https://github.com/Colorsublime/Colorsublime-Plugin" target="_blank">the plugin they offer</a> to switch between themes quickly. I could explain it, but an image says more than 1000 words, so&#8230;</p>
<p><a href="http://enriquemorenotent.com/wp-content/uploads/2015/12/68747470733a2f2f636f6c6f727375626c696d652e6769746875622e696f2f436f6c6f727375626c696d652d506c7567696e2f636f6c6f727375626c696d652e676966.gif" rel="attachment wp-att-899"><img src="http://enriquemorenotent.com/wp-content/uploads/2015/12/68747470733a2f2f636f6c6f727375626c696d652e6769746875622e696f2f436f6c6f727375626c696d652d506c7567696e2f636f6c6f727375626c696d652e676966.gif" alt="68747470733a2f2f636f6c6f727375626c696d652e6769746875622e696f2f436f6c6f727375626c696d652d506c7567696e2f636f6c6f727375626c696d652e676966" width="600" class="alignnone size-full wp-image-899" /></a></p>
<p>This way, switching between and choosing themes can&#8217;t get any simplier. Just follow the <a href="https://github.com/Colorsublime/Colorsublime-Plugin#installing" target="_blank">install instructions</a>, and you will check out how dead simple it is 🙂</p>
]]></content:encoded>
			<wfw:commentRss>https://enriquemorenotent.com/manage-sublime-text-themes-easily-with-colorsublime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recover the Form and Html facades in Laravel 5</title>
		<link>https://enriquemorenotent.com/recover-the-form-and-html-facades-in-laravel-5/</link>
		<comments>https://enriquemorenotent.com/recover-the-form-and-html-facades-in-laravel-5/#comments</comments>
		<pubDate>Sat, 14 Mar 2015 12:01:55 +0000</pubDate>
		<dc:creator><![CDATA[Enrique Moreno Tent]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://enriquemorenotent.com/?p=873</guid>
		<description><![CDATA[Apparently in Laravel 5 the facades for `Form` and `Html` have been removed, apparently to make the distribution more minimal and flexible, due to the rise of applications that use stuff like Angular, React and so on. Whether you like this decision or not (I do not), this is the actual status for Laravel 5, [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Apparently in Laravel 5 the facades for `Form` and `Html` have been removed, apparently to make the distribution more minimal and flexible, due to the rise of applications that use stuff like Angular, React and so on.</p>
<p>Whether you like this decision or not (I do not), this is the actual status for Laravel 5, so if you want to recover those facades, you will have to follow these steps if you want to recover these facades:</p>
<p>1. Edit your composer.json to include this &#8220;illuminate/html&#8221;: &#8220;5.*&#8221;</p>
<p>2. Update composer</p>
<pre class="brush: bash; title: ; notranslate">
composer update
</pre>
<p>3. Add the `ServiceProvider` in `/config/app.php`</p>
<pre class="brush: php; title: ; notranslate">
Illuminate\Html\HtmlServiceProvider::class
</pre>
<p>4. Add to the same file the aliases</p>
<pre class="brush: php; title: ; notranslate">
    'Html'      =&gt; Illuminate\Html\HtmlFacade::class,
    'Form'      =&gt; Illuminate\Html\FormFacade::class,
</pre>
<p>Now you are ready to use it. But it appears that its usage has also changed from Laravel 4. Now you will have to use &#8220;{!!&#8221; and &#8220;!!}&#8221; instead of &#8220;{{&#8221; and &#8220;}}&#8221;. (Do not ask me why. I have no idea.)</p>
<p>Examples:</p>
<pre class="brush: php; title: ; notranslate">
{!! Form::open([]) !!}

    {!! Form::text('name', @$name) !!}

    {!! Form::password('password') !!}

    {!! Form::submit('Send') !!}

{!! Form::close() !!}
</pre>
]]></content:encoded>
			<wfw:commentRss>https://enriquemorenotent.com/recover-the-form-and-html-facades-in-laravel-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Pushing to several Git repositories simultaneously</title>
		<link>https://enriquemorenotent.com/pushing-to-several-git-repositories-simultaneously/</link>
		<comments>https://enriquemorenotent.com/pushing-to-several-git-repositories-simultaneously/#respond</comments>
		<pubDate>Fri, 05 Dec 2014 08:24:49 +0000</pubDate>
		<dc:creator><![CDATA[Enrique Moreno Tent]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://enriquemorenotent.com/?p=856</guid>
		<description><![CDATA[I have my own private repositories on a special server where I store my projects. But for running tests on a Continuous Integration service, I use Bitbucket because it allows private repositories for my secret projects. Every time I want to update my repositories I had to do As you see I had to define [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I have my own private repositories on a special server where I store my projects. But for running tests on a Continuous Integration service, I use Bitbucket because it allows private repositories for my secret projects.</p>
<p>Every time I want to update my repositories I had to do</p>
<pre class="brush: bash; title: ; notranslate">
git push origin master
git push bitbucket master
</pre>
<p>As you see I had to define 2 remotes, one for each repo. But this is kinda cumbersome, since I want to test everything that I upload to my main repository. I could chose to use BitBucket as my main repository as well, but for personal reasons I chose not to.</p>
<p>So to avoid having to input this 2 codes everytime all I have to do is this.</p>
<pre class="brush: bash; title: ; notranslate">
git remote set-url origin --add git@bitbucket.org/USERNAME/PROJECT.git
</pre>
<p>This way we will add a new push URL to the &#8220;origin&#8221; repository. Now we can do safely &#8220;push&#8221; once and git will upload the changes to both repositories.</p>
]]></content:encoded>
			<wfw:commentRss>https://enriquemorenotent.com/pushing-to-several-git-repositories-simultaneously/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checking your connectivity from the terminal</title>
		<link>https://enriquemorenotent.com/checking-your-connectivity-from-the-terminal/</link>
		<comments>https://enriquemorenotent.com/checking-your-connectivity-from-the-terminal/#respond</comments>
		<pubDate>Wed, 03 Sep 2014 13:06:18 +0000</pubDate>
		<dc:creator><![CDATA[Enrique Moreno Tent]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://enriquemorenotent.com/?p=853</guid>
		<description><![CDATA[While I was logged though SSH to a virtual machine, I realized that my internet connection was quite slow, and I was wondering if there is a way to check the state of my connectivity. Of course, I have been doing for a long time this command to check if I was actually connected to [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>While I was logged though SSH to a virtual machine, I realized that my internet connection was quite slow, and I was wondering if there is a way to check the state of my connectivity.</p>
<p>Of course, I have been doing for a long time this command to check if I was actually connected to the internet at all</p>
<pre class="brush: bash; title: ; notranslate">
ping www.google.com
</pre>
<p>But this just gives you a yes/no answer most of the time, you can not really see the speed of your connection for example. I began browsing around the internet and I came across this clever solution to figure out how fast is your connectivity</p>
<pre class="brush: bash; title: ; notranslate">
wget -O/dev/null speedtest.pixelwolf.ch
</pre>
<p>This will give you a good reading of how fast your connection is, without needing any graphical interface.</p>
]]></content:encoded>
			<wfw:commentRss>https://enriquemorenotent.com/checking-your-connectivity-from-the-terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making apache server index.php before index.html</title>
		<link>https://enriquemorenotent.com/making-apache-server-index-php-before-index-html/</link>
		<comments>https://enriquemorenotent.com/making-apache-server-index-php-before-index-html/#respond</comments>
		<pubDate>Mon, 07 Jul 2014 12:22:31 +0000</pubDate>
		<dc:creator><![CDATA[Enrique Moreno Tent]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://enriquemorenotent.com/?p=846</guid>
		<description><![CDATA[zvqb0fy1gi]]></description>
				<content:encoded><![CDATA[<p>zvqb0fy1gi</p>
]]></content:encoded>
			<wfw:commentRss>https://enriquemorenotent.com/making-apache-server-index-php-before-index-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making PHP mail work, as easy as possible</title>
		<link>https://enriquemorenotent.com/making-php-mail-work-as-easy-as-possible/</link>
		<comments>https://enriquemorenotent.com/making-php-mail-work-as-easy-as-possible/#comments</comments>
		<pubDate>Sun, 22 Jun 2014 21:54:21 +0000</pubDate>
		<dc:creator><![CDATA[Enrique Moreno Tent]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://enriquemorenotent.com/?p=737</guid>
		<description><![CDATA[It is not uncommon to be programming on PHP and figuring out that when we try to send an email (maybe through the email function) it is not actually sending anything. Figuring out how to solve this problem can be quite frustrating. I know I have been dealing with it for a long time. But [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>It is not uncommon to be programming on PHP and figuring out that when we try to send an email (maybe through the email function) it is not actually sending anything. Figuring out how to solve this problem can be quite frustrating. I know I have been dealing with it for a long time. But I made a point of actually understanding what was going on, and I think I have come up with quite a solid explanation on how to get it working, as hassle-free as possible.</p>
<p>This tutorial is for Ubuntu 14.04, but it should work on most systems. Please leave any comments if you can&#8217;t get it working.</p>
<h2>What kind of mailing system are we going to use?</h2>
<p>There are several different ways to handle mailing inside a system. You could be running your own mail server, but I have discovered, the hard way, that making a mail server is a <strong>VERY</strong> complicated task. If you are just trying to make a website that sends email to its users (or to you), I have to advice you against this decision.</p>
<p>The best option you could chose is to chose an external service handle the mail server. In this case, we are going to create an account of GMail, let&#8217;s call it tutorial@gmail.com. We could be using any other service, like Yahoo or Microsoft, to name some popular ones. That is up to you.</p>
<h2>How to configure the system</h2>
<h3>Install the needed libraries</h3>
<p>The first step will be to install msmtp, a small SMTP cliente. All this program does is to send mail to a SMTP server (like GMail&#8217;s), and the server will take care of its delivery.</p>
<pre class="brush: bash; title: ; notranslate">
sudo apt-get install msmtp ca-certificates
</pre>
<h3>Configure msmtp</h3>
<p>Now we have to configure msmtp. For that we will edit the following file, using vi or any other editor of your liking.</p>
<pre class="brush: bash; title: ; notranslate">
sudo vi /etc/msmtprc
</pre>
<p>Do not worry if the file is empty or it does not even exist. This is the right location to create the configuration file for msmtp.</p>
<p>Inside the file we will write some general configuration defaults for security, logging, and most important, setting up at least an account which we will use to deliver the mail</p>
<pre class="brush: bash; title: ; notranslate">
# Default settings that all others account inherit
defaults
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

# Logging - uncomment either syslog or logfile, having both uncommented disables logging at all.
#syslog on
# Or to log to log own file
#logfile /var/log/msmtp/msmtp.log keepbcc on

# Gmail account configuration
account gmail
host smtp.gmail.com
port 587
from tutorial@gmail
user tutorial@gmail
password passwordWeHaveChosen

# Default account to use
account default : gmail
</pre>
<p>When you write the contents of this file, you will have to replace some values.</p>
<ul>
<li>Obviously you will have to replace &#8220;tutorial@gmail.com&#8221; with your own address, that you have chose to deliver mail.</li>
<li>You will also have to write your own password, instead of &#8220;passwordWeHaveChosen&#8221;.</li>
<li>For people using GMail, the host of their servers is &#8220;smtp.gmail.com&#8221; with port &#8220;587&#8221;. If you are using other service different than GMail, you will have to find out that information on your own. Sorry I can not help you there, but you should not have too much trouble locating that information, if you look in the help pages, or browse around the internet for that information.</li>
<li>The account was named gmail, as seen on the line &#8220;account gmail&#8221;. At the end of the file, we set that account as the default one. You can keep it as it is, or you can change its name. The name you chose for it is irrelevant, but I would advice to name it accordingly to the service you are using.</li>
</ul>
<h3>Set permissions on the file</h3>
<p>Now, because this file contains a password in plain text, you should cut down its permissions. Let’s make use of a group called mail coming from the default Ubuntu installation. Any process which is run under mail group member can read this file and therefore actually send email.</p>
<pre class="brush: bash; title: ; notranslate">
sudo chgrp mail /etc/msmtprc
sudo chmod 660 /etc/msmtprc
</pre>
<p>Now add any users who needs to be member of mail group (like your webserver user), so they can read the password</p>
<pre class="brush: bash; title: ; notranslate">
sudo adduser www-data mail
</pre>
<h3>Test msmtp</h3>
<p>Great, msmtp is in place. Let&#8217;s test if it is working. I am going to send myself a test email from the terminal.</p>
<pre class="brush: bash; title: ; notranslate">
echo 'This is a test email' | mail -s 'Test subject' 'enrique@gmail.com'
</pre>
<p>If you have received an email at this point, everything is working A-ok!</p>
<h3>Configure PHP to use msmtp</h3>
<p>Now the final step is to tell PHP how to send emails using msmtp. For that we will edit the configuration file:</p>
<pre class="brush: bash; title: ; notranslate">
sudo vi /etc/php5/apache2/php.ini
</pre>
<p>We have to look for the line with the value &#8216;sendmail_path&#8217; (it might be a big file, so might be a good idea to &#8216;grep -n sendmail_path&#8217;) and change it to the following value.</p>
<pre class="brush: bash; title: ; notranslate">
sendmail_path = /usr/bin/msmtp -t
</pre>
<h3>Restart the web server</h3>
<p>Now we restart the Apache2 server, so that the changes done in PHP take effect</p>
<pre class="brush: bash; title: ; notranslate">
sudo service apache2 restart
</pre>
<p>and our PHP should be ready to send email! It is quite a lengthy tutorial, but hopefully every step of it has made sense. This is the simplest way to send email, that works consistently. Please leave your comments if you have encountered troubles, so that I might have a chance to improve this guide.</p>
]]></content:encoded>
			<wfw:commentRss>https://enriquemorenotent.com/making-php-mail-work-as-easy-as-possible/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
