teleren/devto huggingface dataset:
Migraciones de base de datos con Phinx
Tags: tip, desarrollo, php
Published: 2021-02-09 12:25:19

---
title: Migraciones de base de datos con Phinx
published: true
tags: ['tip', 'desarrollo', 'php']
canonical_url: https://marceloandrader.github.io/blog/2021/02/09/migraciones-de-base-de-datos-con-phinx/
---

Cuando uno piensa que una aplicación va a ser muy pequeña como para usar un framework completo o un framework que no tiene migraciones para base de datos, y los cambios a la base de datos generalmente se hacen a mano. Pero luego de un tiempo el sistema sigue creciendo y el equipo también crece, es importante que los cambios a la estructura de la base de datos sean versionados dentro del repositorio.

Aquí es donde entra una excelente herramienta [phinx](https://phinx.org/) un paquete de PHP escrito por Rob Morgan que es agnóstico a los frameworks. Puede ser instalado en cualquier proyecto de PHP usando composer. Permite crear migraciones en el ambiente de desarrollo que una vez probadas completamente, serán aplicadas en ambientes de pruebas y producción.

Phinx permite a los desarrolladores alterar y manipular la base de datos en una manera clara y concisa. No ejecuta SQL directamente sino que ofrece una API poderosa para crear migraciones usando código PHP. Esto hace que las migraciones de phinx sean portables entre diferentes motores de bases de datos. Phinx sabe cuales migraciones ya se ejecutaron, así que no tienes que llevar cuenta de cuales migraciones tienen que ejecutarse.

Para instalar solo necesita:

```
$ composer require robmorgan/phinx
```

Y crear una carpeta donde se almacentarán las migraciones, generalmente `db/migrations`.

Para iniciar el uso de phinx se ejecuta:

```
$ vendor/bin/phinx init
```

Revisar el archivo phinx.php donde se debe especificar las diferentes conexiones a las bases de datos.

Para crear una nueva migración con

```
$ vendor/bin/phinx create CrearTablaUsuarios
```

Una migración es una clase php con un nombre único, que se crea con el método `change` o que puede se puede cambiar para tener los métodos `up` y `down`. Y dentro de este método se utiliza el api de phinx para realizar las operaciones de cambios. Up para cambiar la estructura y down para reversar el cambio si hacemos un rollback. O simplemente change se usa para hacer el cambio y que phinx infiera la reversión. Por ejemplo las siguientes funciones son frecuentes al escribir migraciones:

```php
$this->table('usuarios')
->addColumn('name', 'string')
->addColumn('created_on', 'datetime')
->create();

$this->table('usuarios')
->removeColumn('name', 'string')
->udpate();
```

Se aplica la migración con:

```
$ vendor/bin/phinx migrate -e development
```

donde -e indica que conexión definida en phinx.php usar

Se reversa la migración con:

```
$ vendor/bin/phinx rollback
```

Verificar el estado del ambiente:

```
$ vendor/bin/phinx status
```

También se puede usar phinx para crear archivos `Seed` para generar datos en la base de desarrollo. Pueden investigar más en la [documentación](https://book.cakephp.org/phinx/0/en/index.html) que es muy completa.
Routing using Vue Router
Tags: vue, webdev, javascript, firebase
Published: 2021-02-09 10:19:06

---
title: Routing using Vue Router
published: true
date: 2021-02-09 10:18:00 UTC
canonical_url: https://hiltonmeyer.com/articles/series/pantry/2-routing.html
tags: vue, webdev, javascript, firebase
series: Vue Full Application Build
---

### Setting up Vue Router [#](https://hiltonmeyer.com/articles/series/pantry/2-routing.html#setting-up-vue-router)

After the [initial setup](https://dev.to/iarehilton/project-setup-19eg) in the previous post. One of the first things I want to to is add routing so that I will be able to create the navigation required to be able to get to all the views in the application. [Vue Router](https://router.vuejs.org/) is the official router for Vue and makes things super simple to setup although based on the current setup and in hindsight I could of simply added the routing in the setup but I prefer to do it this was to keep things simple. A simple command will not only setup the routing but the scaffolding of the views and the routing directories which is pretty awesome.

```
vue add router

```

![directory layout](https://res.cloudinary.com/hiltonmeyer-com/image/upload/f_auto,q_auto,c_scale,w_auto,dpr_auto/v1611684947/hiltonmeyer.com/vue-router_kohdax.jpg)

As you can see with this command we have routing setup and ready to go although there'll be errors now as it tries to add the hello world example from the vue install. So in the `views/Home.vue` file set the `<template>` as follows

```
<template>
  <div class="home">
    <img
      alt="App logo"
      src="https://res.cloudinary.com/hiltonmeyer-com/image/upload/v1611488325/pantry/cooking-robot_xdaw7k.png"
    />
    <h1>Pantry</h1>
    <h2>Kitchen Manager</h2>
  </div>
</template>

```

I also made a view small tweaks in the `App.vue` file to get the color scheme going although this may need to be placed somewhere else, but for now I've changed the `<style>` to this

```
<style>
:root {
  --clr-neutral-500: #2c3e50;

  --clr-accent-500: #00b8f0;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: var(--clr-neutral-500);
}

#nav {
  padding: 30px;
}

#nav a {
  font-weight: bold;
  color: var(--clr-neutral-500);
}

#nav a.router-link-exact-active {
  color: var(--clr-accent-500);
}
</style>

```

So after the routing we have an application that looks like this which I think isn't that bad after what is basically two commands

![Current Layout](https://res.cloudinary.com/hiltonmeyer-com/image/upload/f_auto,q_auto,c_scale,w_auto,dpr_auto/v1611685840/hiltonmeyer.com/pantry-003_akawbz.jpg)
How to Install NGINX on AlmaLinux 8
Tags: nginx, almalinux, linux, webserver
Published: 2021-02-09 12:19:12

In this article, we’ll discuss how it is how to install NGINX on AlmaLinux 8.

Ngnix (Pronounce as Engine X) is a free, open source web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. Unlike traditional servers, NGINX doesn’t rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but more importantly, predictable amounts of memory under load.

Learn more: <a href="https://www.hostnextra.com/kb/how-to-install-nginx-on-almalinux-8/">Install NGINX on AlmaLinux 8</a>
What are your favourite command line tools?
Tags: discuss, commandline, productivity, cli
Published: 2021-02-09 12:15:13

---
title: What are your favourite command line tools?
published: true
description: 
tags: #discuss #commandline #productivity #cli
---

Hello, guys! What is your 3 favourite command line apps? Mine:

- [lazygit](https://github.com/jesseduffield/lazygit) - A simple terminal UI for git commands
- [lf](https://github.com/jesseduffield/lazygit) - a terminal file manager written in Go
- [buku](https://github.com/jarun/buku) - Browser-independent bookmark manager written in Python3 and SQLite3
Taller completo de formación frontend para chicas en español
Published: 2021-02-09 12:06:48

Primera edición del curso en línea de programación por mujeres para mujeres llamado Beautiful Patterns (organizado por chicas del MIT desde el 2018). En este curso en línea se abordarán temas de pensamiento computacional, HMTL, CSS y JavaScript.

La información es la siguiente:

- Audiencia: Mujeres de todas las edades sin experiencia previa necesaria. 
- Precio: ¡Gratis!
- Duración: 9 semanas 
- Formato: En plataforma en línea con un nuevo módulo por semana a cubrir a tu ritmo + asesorías en vivo semanales.


Inscríbanse antes del 14 de febrero en el siguiente link: http://bit.ly/3j99RBU ✨

Para más info, pueden escribir a la siguiente cuenta en twitter @adasilvapdev

https://mit.zoom.us/j/96780042130

Si tienes amigas, familiares o conocidas que saben que les puede aportar no dejes de correr la voz!
Discourse thread integration on a React Website
Tags: react, discourse, html, javascript
Published: 2021-02-09 12:02:51

[Discourse](https://www.discourse.org/) is an open-source civilised discussion forum and used by many Developer communities. [Mozilla](https://discourse.mozilla.org/), [Magic](http://community.magic.link/), [Netlify](https://community.netlify.com/), [Auth0](https://community.auth0.com/), [MongoDB](https://developer.mongodb.com/community/forums/) to name a few.

This is a simple walkthrough integration of a discourse thread in a React application.

If you are an admin or a moderator of a discourse forum, I am pretty sure you have integrated the thread post onto your website's blog, guides, or product announcements page.

For others, who are not, discourse gives the below snippet:

```javascript
<div id='discourse-comments'></div>

<script type="text/javascript">
  DiscourseEmbed = { discourseUrl: 'https://community.discourse.org/',
                     discourseEmbedUrl: 'REPLACE_ME' };

  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();
</script>
```

This is straightforward, just paste the above snippet to the page where you want to integrate discourse thread comments.


# React

Create a `discourse-forum.js` file and paste the below code
```javascript
import { useEffect } from 'react';

export default function DiscourseForum() {
  useEffect(() => {
    window.DiscourseEmbed = {
      discourseUrl: 'https://community.discourse.org/',
      topicId: 123,
    };

    const d = document.createElement('script');
    d.type = 'text/javascript';
    d.async = true;
    d.src = window.DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  }, []);

  return (
    <div>
      <div id="discourse-comments"></div>
    </div>
  );
}

```

Replace `discourseUrl` with your community forum URL and `topicId` with the thread id from your community forum.

And make sure to go to the admin settings and click on `Customise`>`Embedding`>`+Add Host` and add `https://www.website.com` as the host.

# Using DiscourseForum()

Import `DiscourseForum` to the page where you want to integrate the thread comments.

```javascipt
import DiscourseForum from '../link/to/the/file/discourse-forum.js';
```

And use like this in your page
```javascipt
<DiscourseForum />
```

You can further customise this as per your need.

Cheers!
Complete Terraform Course - Beginner to Advanced [2021] 🎉
Tags: terraform, devops, beginners, aws
Published: 2021-02-09 11:55:05

###Learn Terraform with hands-on demos by automating AWS infrastructure 🚀 ###

► The course is available on Udemy: [Access here with 30% discount](https://bit.ly/3pdIcBe) 😊

--------
# Course Overview  🧠 #

###Core concepts you'll learn:###
- Providers - Connect with remote cloud providers and systems
- Resources and Data Sources - Create and fetch resources
- Terraform Commands - Terraform CLI
- Changing and destroying Resources
- Terraform State
- Output Values
- Input Variables - Parameterize your Terraform Configuration to make it re-usable
- Environment Variables in Terraform
- Provisioners in Terraform - Prepare server
- Terraform Modules - Modularize your Terraform Project and use existing Modules from Terraform Registry


###In the main demo project you'll learn:###
- how to setup a git repository for your Terraform project
- how to create the main AWS networking resources: VPC, Subnet, Route Table, Internet Gateway, Security Group
- how to create and prepare a EC2 server instance, install Docker and start a Docker container on it
- & more

-------

#By the end of this course 👏🏻  #
- You will **master one of the most popular Infrastructure Provisioning and Infrastructure as Code (IaC) tool**, which is Terraform
- You will be able to **use Terraform confidently** in your projects
- You will know all the **core concepts** and **components of Terraform language**
- If you follow along the demos, you will have solid **practical experience** with Terraform
- You will know the fundamental AWS networking concepts and how to create AWS resources using Terraform

You will **learn all the concepts with practical examples by automating the AWS infrastructure**. AWS is the most used cloud provider and using Terraform with AWS is the most common combination used in projects, so knowing how to automate AWS infrastructure gives you an advantage in the DevOps job market!

-------------

#Throughout the course #
- You will learn **best practices**
- We will use **Git to manage our configuration code**, which is a best practice in Infrastructure as Code.

-------------

#Why learn from me 🤔 #
- You will learn Terraform step by step and simply explained!
- Thousands of students love the way how I explain complex concepts in an easy way so that everyone can understand it.
- I'm both an educator and a practitioner. All my knowledge is based on real projects that I have worked in or consulted
- Learn from a [Docker Captain](https://www.docker.com/captains/nana-janashia) 🐳


--------
You can get also a visual overview of the course content here 🙂:
{% youtube m3cKkYXl-8o %}

► Get **30% off** - [Udemy course](https://bit.ly/3pdIcBe)

----------

**Like, share and follow me** 😍 for more content:
- [Twitter](https://twitter.com/Njuchi_)
- [YouTube](https://www.youtube.com/channel/UCdngmbVKX1Tgre699-XLlUA?sub_confirmation=1)
- [Instagram](https://www.instagram.com/techworld_with_nana/)
- [LinkedIn](linkedin.com/in/nana-janashia)
"Don't Make Me Think" Summary for UI/UX designers [Fourth Chapter]
Published: 2021-02-09 11:47:08

Today, I'm going to summarize the fourth chapter. It's an easy and small one, so let's dive into it

##Chapter 4: Animal, Vegetable, or Mineral? 
####"It doesn’t matter how many times I have to click, as long as each click is a mindless, unambiguous choice"
[KRUG’S SECOND LAW OF USABILITY]

How many times can users click without getting frustrated?
Krug's opinion is: **that users don’t mind a lot of clicks as long as:**
1. Each click is painless: "Doesn't need a lot of thinking or efforts"
2. And they have continued confidence that they're on the right track. they're on the right way to achieve their goals

-----------------------------------------------------------
If you have to confront your users with difficult choices, there should be guidance too
###Guidance should be:
**1. Brief**: the small amount of information that will help the user
**2. Timely**: placed so a user can encounter it exactly when he needs it
**3. Unavoidable**: Formatted in a way that a user will notice it 

An example from real life mentioned in the book:
"street corners throughout London"
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cacfgn3gvl605rfjkjhz.png)
* **It’s brief**: “LOOK RIGHT” and an arrow pointing right
* **timely**: you see it at the instant you need to
be reminded
* **unavoidable**: you almost always glance down when you’re stepping off a curb
Free course: Ship better code, faster
Tags: devops, productivity, news, learning
Published: 2021-02-09 11:34:09

I'm excited to announce that next week I'll be leading a free, 5-day remote course.

[Learn more »](https://jhall.io/5day/)

## Ship better code, faster
### A 5-day interactive course for devs who want to streamline their workflow

February 15-19

### Are you tired of fixing the same bugs over and over again?

Are you ever confused by code you wrote 6 months ago?

Do you spend too much time on repetitive, non-programming tasks?

Do pull request approvals take too long?

### Imagine fixing your bugs once and for all

What if you knew how to write future-proof code, that you, or anyone, can understand a year later?

How would you feel if you could spend more time writing code?

Would you like to make pull requests your colleagues are eager to review quickly?

### This course will show you the way.

I’ll teach you the DevOps techniques to improve every one of these challenges, and many more in my 5-day interactive course. Why spend hundreds of hours of learning things the hard way when the answers are all right here in one place?

[Enroll now »](https://jhall.io/5day/)
25 interview questions for Go Developer position
Tags: go, recruiting
Published: 2021-02-09 11:30:22

This is a list of common questions that can be asked by technical interviewers for Go developer position. This is definitely not a complete list, just a subset I find pretty likely to occur during the interview.

# Questions

The questions are grouped by the category. Again - the list of categories is far from being complete, however it is very likely that question from given category will be asked during the interview.

## Modules

- What are Go modules?
- What was used before Go modules were introduced?
- What is vendoring?

## Interfaces
- What is an interface in Go?
- How many functions can be usually found in an average Go stdlib interface?
- How to define a function argument that can be anything?

## Pointers
- How to indicate nil string as a return type?
- How to modify arguments passed to a function?
- When arguments passed to a function is stored the stack? When on the heap? What is a difference?

## Slices
- How to define a variadic function?
- How to pass a slice into a variadic function?

## Strings
- How to get a substring?
- How to split a string?
- How to join a slice of strings?
- How to check if a string starts with a substring?
- How to check if a string ends with a substring?

## Context
- What is context? Why is it useful?
- How to define a context timeout for function execution?
- How to handle a context timeout within that function?

## Concurrency
- Improve the following library function:
    - `func ExecuteShellCommand(cmd string) (output []string)`
    - Allow function caller to asynchronously receive every line of stdout of executed shell command (in real time)
    - Notify function caller that command execution is over

## IO
- How to read local file as slice of bytes?
- How to convert `io.Reader` into slice of bytes? 

## JSON support
- What library and function would you use to parse JSON file?
- What library and function would you use to parse JSON file that doesn't fit into RAM?
- What JSON library would you recommend from the usability point of view? For example to support nested queries.

# Summary

What do you think about the list above? What would you add or remove? What other questions do you find to be asked frequently during interviews? What questions to you like to ask when interviewing your candidates? Please leave the answer in the comments!
The Joy of Collecting Timeless Engineering Posts
Tags: todayisearched, motivation, watercooler, career
Published: 2021-02-09 11:27:15

Hiding on the Internet are brilliant software engineering posts. They idle behind a few strokes of a query, having a quality set apart from the endless but helpful Stack Overflow threads.

I recently discovered another collectible gem. This one is titled [When Bad Things Happen to Good Characters](http://hcibib.org/multilingual/badchars.htm). I'm not exactly sure who the author is.

What I immensely enjoy about posts like these are their unassailable attributes. They unquestionably bring *deep nerd joy*. What do I mean?

**They are titled intelligently.** The title is well thought out, with a bit of play with words, but never mincing the impact. They are associatively rememberable.

**The subject is succinct.** Never going on and on about something soft, they get right to the heart of the matter.

**There is playful humor.** It doesn't take itself too seriously. Somewhere in the post, there is a joust for a genuine laugh.

**Has clear examples.** Finding a phenomenon many engineers experience is hard. What's harder is capturing examples that are vivid in one go.

**Brings the joy of partnership.** When a teachable moment surfaces, the content comes back to be shared. Whether it's mentoring an engineer or someone who summons technological prowess, it's revered.

**The content is timeless in nature.** A post like this is unlikely to age. It lives for years without decay. It will always make me happy now I have it in my possession.

I came across the post above as my teammate and I pursued a damned character encoding defect. For a moment, I thought, "wow, a language to describe this awful mojibake." I shared it, and we laughed nervously together about the *wild animals* eating umlauts for breakfast.

And so, "When Bad Things Happen to Good Characters" is added [to my list](https://github.com/solidi/learning-notes/blob/master/mentoring/shared-links.md), primed for the future.

I appreciate its pragmatic approach. It fits in a wide spectrum of engineering posts of principle or practice that invoke feelings of joy, brilliance, and supreme craft. Oh, how such an author distills experience into so little writing and then makes it timelessly shareable.

If by chance you were wondering, we solved the encoding issue by setting the *right* [code page](https://en.wikipedia.org/wiki/Code_page), keeping the wildebeests at bay.
Matthew Brannelly’s The Seven Fundamentals For Law Firm Success
Tags: accountingfirms, matthewbrannelly, lawfirmsuccess
Published: 2021-02-09 11:19:57

This situation is not unique ..… it is not  you….it happens  to all my clients at some stage.
In reality, I have discovered in dealing with 100’s of professionals, you only need one thing to grow your firm successfully….…personal responsibility. You must deeply believe that you and only you are responsible for your success…not your clients, not your advertising guru, not the economy. Once you’ve accepted your role as the architect of your future success you will change your approach towards the business development.   
https://matthewbrannelly.medium.com/matthew-brannellys-the-seven-fundamentals-for-law-firm-success-931f31e550ed
The 22 Most-Used Python Packages in The World in 2021
Tags: python, programming, watercooler, webdev
Published: 2021-02-09 11:08:00

Hi dev.to, I assembled the [top 22 most used Python packages](https://medium.com/pythonland/the-22-most-used-python-packages-in-the-world-in-2021-aed34fea32ef?sk=8e21a452a521a0b12ac697b07a4aa613) in the world and wrote a bit about each of them. I had a lot of fun writing this and learned some new stuff on the way. I'd love to hear your comments!

P.S.: the link is to Medium, but it bypasses the paywall. Enjoy!
Looking for Augmented Reality Technology Companies in India? Contact Reality Premedia.


Tags: wordpress, javascript
Published: 2021-02-09 10:56:58

Reality Premedia is known virtual reality and Augmented Reality app development company in India. We design and develop creative augmented reality apps for ecommerce website, manufacturing industry, retail industry and for real estate.
https://www.realitypremedia.com/technology/our-expertise/augmented-reality/
Flutter Simple Login Page and Drawer Demo
Tags: flutter, 30daysofflutter, mobileappdevelopment, demo
Published: 2021-02-09 10:56:42

This is a simple login page and drawer layout using Flutter. This Flutter project is good for practising in the course of programming learning journey. 

Watch here : https://www.youtube.com/watch?v=rN2YmuiDpJo

Please feel free to comment, this project was created for flutter mobile application coding exercise. 

#30DaysOfFlutter​ #flutter​ #coding​ #learning​ #programming​ #devlife​ #mobileapplicationdevelopment​ #loginpage​ #drawer​ #demo​

Follow @
1. instagram - codelx21 (TechnoLX21)
2. Twitter - @LxTechno
3. github - https://github.com/TechnoLX/Flutter-loginPage-drawer-demo