teleren/devto huggingface dataset:
Handy Git Shortcuts (Aliases) and How to Set Them Up
Tags: git, beginners
Published: 2019-07-08 02:55:44

If you’re using git, these handy short codes will speed up your workflow. The following are the basic abbreviated git commands that are recommended on the git website. I'm always forgetting how to do this when I need to set up git on new computer so posting this as a reference.

- `co` for checkout
- `br` for branch
- `ci` for commit
- `st` for status

## How to Set Up
To set up an alias, you use the git config command with the --global tag so that it applies to all of your git repositories.

```shell
$ git config --global alias.<YOUR CHOSEN SHORTCUT> <THE ORIGINAL GIT COMMAND>
```

So to set up the basic shortcuts I mentioned above, open your terminal and put in the following:

```shell
$ git config --global alias.co checkout
$ git config --global alias.br branch
$ git config --global alias.ci commit
$ git config --global alias.st status
```

Now your all set to go! You can use `co` in place of `checkout` and so on. For example, for `git commit`, you can now do something like this:

```shell
git ci -m "add CSS styles"
```

See the official git documentation [here](https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases).
15 Years of Spring: Evolving a Java Application Framework
Tags: java, webdev, tutorial, beginners
Published: 2019-07-08 02:23:41

The Spring Framework originated from a book in 2002, becoming the most widely used application framework in the entire Java ecosystem within a few years... and holding that position to this day. 

This talk illustrates Spring's evolution over 15 years, adapting not only to five new JDK generations but also to ever-changing requirements in modern enterprise architectures.

{% youtube z_N0DLjbCng %}

**Thanks for reading** ❤
If you liked this post, share it with all of your programming buddies!
Follow us on **[Facebook](https://www.facebook.com/Javatutorial4u/)** | **[Twitter]( https://twitter.com/moriohdotcom)**

### Further reading

☞ [Full Stack Web Development with Angular and Spring MVC](https://morioh.com/p/654de255f692 "")
☞ [Build a Simple CRUD App with Spring Boot and Vue.js](https://morioh.com/p/d80e04170d2e)
☞ [Angular 8 + Spring Boot 2.2: Build a CRUD App Today!](https://morioh.com/p/aa758b26c5d2)
☞ [Spring Boot vs. Spring MVC vs. Spring: How Do They Compare?](https://morioh.com/p/4838afbc3e07 "")
A naive approach to finding corners on an image 
Tags: naive, cornerdetection, python
Published: 2019-07-08 02:02:44

---
title: A naive approach to finding corners on an image 
published: true
description: A naive approach to finding corners on an image
tags: naive, corner detection, python
cover_image: https://thepracticaldev.s3.amazonaws.com/i/u0vavmokchcwh8ik7ro1.png
---

# Naive Corners

A naive algorithm to find corners on a image.

![detected](https://thepracticaldev.s3.amazonaws.com/i/u0vavmokchcwh8ik7ro1.png)

## About

When I was still studying the basics of digital image processing I came up with this "algorithm" to detect corners on a image.

## How it works

Well, as the name suggests, this is a very naive approach.

Given any image we will look at it a window of 3 by 3 at a time. (We could resize the image to speed up the process, but who's in a hurry?)

3x3 window.  
![grid](https://thepracticaldev.s3.amazonaws.com/i/migplp8u4l45793ct37v.png)

We will then just count how many colored pixels we have at that window. If there's 4 colored pixels, it must be a corner.

Corner.  
![grid](https://thepracticaldev.s3.amazonaws.com/i/w0glm34ck5ayzvc58gtn.png)

Rotated corner.  
![rotated corner](https://thepracticaldev.s3.amazonaws.com/i/n17k9hi7t0g9s25n67v4.png)

Anything else, is not a corner.

Not a corner.  
![grid](https://thepracticaldev.s3.amazonaws.com/i/pjyaqai1vy1i66x5bbuc.png)

Not a corner either.  
![grid](https://thepracticaldev.s3.amazonaws.com/i/vyp0t7v7ij7pnap1hh39.png)

## See it working

Run by calling
```bash
python corner.py img/mess.png
```

I also used this algorithm to process corners on a [real time webcam video](https://youtu.be/OWOQL5jh_7A).

A python implementation of this algorithm is hosted [here](https://github.com/victorqribeiro/naiveCorners)
Make log Colorful with Python
Tags: python
Published: 2019-07-08 02:00:19

### install colorama
```zsh
$ pip install colorama
```

### code
`test.py`
```py
from colorama import Fore, Back, Style

print('===========================')
print(Fore.GREEN + "green string")
print(Style.DIM + "dim: test")
print(Style.BRIGHT + "BRIGHT: test")
print(Style.NORMAL + "NORMAL: test")
print(Style.RESET_ALL + "RESET_ALL")
print(Back.GREEN + 'green')
print(Style.RESET_ALL)
print('===========================')
print(Fore.RED + "red string")
print(Style.DIM + "dim: test")
print(Style.BRIGHT + "BRIGHT: test")
print(Style.NORMAL + "NORMAL: test")
print(Style.RESET_ALL + "RESET_ALL")
print(Back.RED + 'red')
print(Style.RESET_ALL)
print('===========================')
print(Fore.YELLOW + "yellow string")
print(Style.DIM + "dim: test")
print(Style.BRIGHT + "BRIGHT: test")
print(Style.NORMAL + "NORMAL: test")
print(Style.RESET_ALL + "RESET_ALL")
print(Back.YELLOW + 'yellow')
print(Style.RESET_ALL)
print('===========================')
print(Fore.BLUE + "blue string")
print(Style.DIM + "dim: test")
print(Style.BRIGHT + "BRIGHT: test")
print(Style.NORMAL + "NORMAL: test")
print(Style.RESET_ALL + "RESET_ALL")
print(Back.BLUE + 'blue')
print(Style.RESET_ALL)
```

### result
![](https://thepracticaldev.s3.amazonaws.com/i/ip4toepazo020kd7pfpc.png)
VueJS E-commerce Desk Configurator
Tags: codepen, vue
Published: 2019-07-08 01:47:05

---
title: VueJS E-commerce Desk Configurator
published: true
tags: codepen, vuejs
---

<p>I was shopping for a standing desk and stumbled upon this cool site:
<a href="https://www.fully.com/standing-desks/jarvis/jarvis-adjustable-height-desk-bamboo.html" target="_blank">https://www.fully.com/standing-desks/jarvis/jarvis-adjustable-height-desk-bamboo.html</a></p>

<p>so I recreated it in codepen with some additions</p>

{% codepen https://codepen.io/vincentntang/pen/LKgWbv %}
What is an "old way" of doing things that it'd be surprising/interesting for beginners when it comes to software development?
Tags: discuss
Published: 2019-07-08 00:53:19

---
title: What is an "old way" of doing things that it'd be surprising/interesting for beginners when it comes to software development?
published: true
tags: discuss
---

As usual and expected, I keep accidentally learning things at work that are sort of a mind-blowing to me. The last one happened in a meeting in which a dev had to send over the changes they did in a file to some other dev in the call and I was intrigued to see that they ran a `git diff` command and `pipe`d the output to a file. I couldn't guess what they would do with the file, which was named `changes.patch`.

Then they said: "Just take this file and run a `git apply` on it and you're done".

The other dev replied: "Just like old times..."

I just observed while my mind was ...

![mb](https://media2.giphy.com/media/xT0xeJpnrWC4XWblEk/giphy.gif)

The thing is that I study Git a lot and I knew that devs used to share files via email whenever they wanted to share changes with the team, but it was just surprising to see that the output of a `git diff` could be used like that.

With that, I was wondering what similar stories people have to share and whether they wished that's how things would be done nowadays or not.
White screen on umbraco backoffice after an upgrade
Tags: umbraco
Published: 2019-08-03 19:54:42

---
title: White screen on umbraco backoffice after an upgrade
published: true
tags: umbraco
canonical_url: https://www.owain.codes/blog/posts/2019/july/white-screen-on-umbraco-backoffice-after-an-upgrade/
---

This week I had an issue where I had upgraded a website from Umbraco 7.7 to 7.14. The bit that really confused me was the site worked prefectly on my ... [Continue reading](https://www.owain.codes/blog/posts/2019/july/white-screen-on-umbraco-backoffice-after-an-upgrade/)
🇫🇷 Construire une architecture émergente
Tags: ios, development, tdd, architecture
Published: 2019-07-08 05:03:05

---
title: 🇫🇷 Construire une architecture émergente
published: true
tags: ios, development, tdd, architecture
canonical_url: https://academie.ryfacto.fr/advanced-ios-craft/construire-une-architecture-emergente.html
---

Dans [l’article précédent](la-seule-architecture-qui-compte), je te parlais de ce qu’est une architecture logicielle et de la nécessité de la faire émerger.

Pour y arriver, il faut manipuler son code comme de la **pâte à modeler** ; car avoir une conception qui tape dans le mille du premier coup est proche de l’impossible.

Et puis de toute façon, c’est un fait, **le besoin change !**

Pour répondre à ces nouveaux besoins, il faut modifier le code.

Qui dit le modifier dit potentiellement introduire des _bugs_, casser des choses.

Et là, forcément, la peur te gagne. Comment limiter ce risque ? Comment éviter de casser, de créer des bugs ?

Je ne vais pas te le cacher, il n’y a pas 36 solutions, il faut… **tester !**

Dans cet article, je vais parler de plusieurs _stratégies_ pour à la fois prévenir l’apparition de bugs mais aussi permettre de faire émerger une architecture saine et évolutive.

Pour ne plus avoir peur de casser des choses en modifiant le code.

L’objectif est toujours d’avoir la conception la plus optimale possible pour répondre au besoin présent ; sans sur-ingénierie (pas de code “au cas où”) et sans sous-ingénierie (pas de duplication partout).

**Une conception aux petits oignons pour apporter de la valeur MAINTENANT.**

Voici la liste des stratégies que je vais développer :

- tester manuellement,
- laisser le compilateur tester pour moi,
- automatiser mes tests (tu apprendras aussi pourquoi TDD rend plus efficace et permet de gagner du temps !).

[Lire la suite sur l'Académie Ryfacto...](https://academie.ryfacto.fr/advanced-ios-craft/construire-une-architecture-emergente.html "Construire une architecture émergente")
String padEnd() method
Tags: javascript, beginners
Published: 2019-07-07 23:49:50

String padEnd()

Learn about the `padEnd()` string method. Which will apply some pads to the current string. The padding will be applied from the end of the string.

---

```js
/**
 * targetLength => The length of the current string that will include the padding.
 *
 * paddingString` => The string to add to the current string as padding.
 * By default it will be empty string.
 */

str.padEnd(targetLength, paddingString);
```

```js
const name = 'My name is Henry';

// We want to add to the end of the name three dots ...
// for that we need to get the length of the string plus dynamic and add 3
const nameLen = name.length;
name.padEnd(nameLen + 3, '.');

/**
 * @return "My name is Henry..."
 */
```

Function to add endPad dynamic:

```js
/**
 * @param {String} string
 * @param {Number} extraPad=0
 * @param {String} delimeter=""
 * @return string
 */

const endPad = (str, extraPad = 0, delimeter = '') => {
  if (!str) return '';

  // get string length dynamic to add end pad
  const strLen = str.length;

  // return padded string with the extra pad and it delimeter
  return str.padEnd(strLen + extraPad, delimeter);
};


// example using endPad():
endPad('123', 3, '.');
/**
 * @return "123..."
 */
```
String charAt() method
Tags: javascript, beginners
Published: 2019-07-07 23:10:43

# String charAt() method

Learn about the `charAt()` string method. Which will return a new string consisting of the single character located base on it index.

---

> Note: If no index is proved to `charAt()` it will fallback to `0`

Using `charAt()` without index

```js
const city = 'Miami';
console.log(city.charAt());
// charAt() using default index => 0
/**
 * @return 'M'
 */
```

Using `charAt()` index

```js
const country = 'USA';
country.charAt(1);
/**
 * @return 'U'
 */
```

Using `charAt()` with a outbound index

```js
// note: if the index pass to chartAt(999) is not in the string length
// this will return empty string

const country = 'USA';
country.charAt(999);
/**
 * @return ""
 */
```
Do you really need to start a startup?
Tags: discuss, startup
Published: 2019-07-07 21:46:24

---
title: Do you really need to start a startup?
published: true
description: 
tags: #discuss #startup
---

Do you *really* need to persue the atypical startup? Chase funding, grow, scale, chase funding, grow, scale..?? When is enough, enough? 

Or is it possible to have one or even a few projects, maybe a SaaS thing or an ecommerce site or whatever, that ticks along nicely and keeps you comfortably? 

Is anyone doing this?
Roadrunner & Zend Expressive & Cycle ORM. Not allow to php to die.
Tags: roadrunner, php, zendexpressive, cycleorm
Published: 2019-07-07 21:14:32

Hello everyone! This article is dedicated to run PHP-application under  Roadrunner(RR). if you haven't gotten acquainted with RR yet, I put forward to visiting the [link](https://github.com/spiral/roadrunner).
In my past [article](https://dev.to/sergey_telpuk/zend-expressive-and-cycle-orm-1jkg), I tried to describe how easy to integrate Cycle ORM into ZE, but it isn't so interesting like setting up the following stack: Roadrunner, Zend Expressive, Cycle ORM. Maybe It'll give you another way of starting off your new application with that one.
ZE isn't so popular among PHP developers. From my point of view It's underestimated micro-framework because of that there was chosen ZE. So, go ahead!

I don't like to get a deal with setting local-env, so I give my preference in favor of docker. I prepared the repository for running RR with the help of docker-compose, It can be found by the following [link](https://github.com/sergey-telpuk/roadrunner-docker-skeleton).

After cloned roadrunner-docker-skeleton. We can use Makefile for building and running.
For the first step, run Makefile command:
```bash 
make build
```
Note: don't forget copy sample.env into .env.

For the next step, should install ZE skeleton application:
```bash
docker-compose run composer create-project zendframework/zend-expressive-skeleton expressive  
``` 
For the next step, change file expressive/public/index.php:
```php
<?php declare(strict_types=1);

chdir(dirname(__DIR__));
require 'vendor/autoload.php';

return (function () {
    $container = require 'config/container.php';
    $app = $container->get(\Zend\Expressive\Application::class);
    $factory = $container->get(\Zend\Expressive\MiddlewareFactory::class);
    (require 'config/pipeline.php')($app, $factory, $container);
    (require 'config/routes.php')($app, $factory, $container);

    return $app;
})();
```
For the next step, change file worker.php:
```php
<?php declare(strict_types=1);

ini_set('display_errors', 'stderr');

chdir(dirname(__DIR__));
require 'vendor/autoload.php';

$app = require 'expressive/public/index.php';

$relay = new Spiral\Goridge\StreamRelay(STDIN, STDOUT);
$psr7 = new Spiral\RoadRunner\PSR7Client(new Spiral\RoadRunner\Worker($relay));

while ($req = $psr7->acceptRequest()) {
    try {
        $response = $app->handle($req);
        $psr7->respond($response);
    } catch (\Throwable $e) {
        $psr7->getWorker()->error((string)$e);
    }
}
```
For using Cycle ORM under ZE to follow the [link](https://dev.to/sergey_telpuk/zend-expressive-and-cycle-orm-1jkg).
Finish step is to run our RR:
```bash
make up
```
Enjoy, http://localhost:8080
Creating a native Android app with Vue Native
Tags: vue, android, app, javascript
Published: 2019-07-07 20:56:06

---
title: Creating a native Android app with Vue Native
published: true
description: Love Vue and want to create an Android app? Here are the steps.
tags: vue, android, app, javascript
---

Using https://vue-native.io/

Install `npm install -g react-native-cli`

Install `npm install -g expo-cli`

Install `npm install -g vue-native-cli`

```
npm install -g vue-native-cli
vue-native init <projectName> // Initializes crna project
vue-native init <projectName> --no-crna // Initializes react-native project
cd <project-name>
```

Add or edit the android section of app.json

https://docs.expo.io/versions/latest/distribution/building-standalone-apps/#2-configure-appjson

`expo build:android`

===========================================

I'm sorry. This was going to be a more detailed post, but my mind's not in it. I promised a post, so here you go :(
JS Spread syntax
Tags: javascript, beginners
Published: 2019-07-07 20:33:18

# JS Spread syntax

### Learn the basics of the JavaScript Spread Operator

---

The spread syntax was introduced with ES6. Is a great tool to make your javascript code a little more clean and readable.

### **MDN** definition:

> Spread syntax allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.

Let start with object cloning them:

```js
const person = {
  firstName: 'Henry',
  lastName: 'Arbolaez',
};

const personWithAge = { ...person, age: 27 };
```

Merging two objects:

```js
const profession = {
  career: 'Software Engineer',
  work: 'Lavu',
};

const personalInformation = { ...personWithAge, ...profession };

/**
 * personalInformation becomes
  age: 27;
  career: 'Software Engineer';
  firstName: 'Henry';
  lastName: 'Arbolaez';
  work: 'Lavu';
*/
```

We can also utilize the spread syntax to copy array's:

```js
const numbers = [1, 2, 3, 4, 5];
const copiedNumbers = [...numbers];

// copiedNumbers becomes [1, 2, 3, 4, 5]
```

A better way merging array's

```js
const numbers = [1, 2, 3];
const numbers2 = [6, 7, 8];

const numbers3 = [...numbers, ...numbers2];

// numbers3 becomes [1, 2, 3, 6, 7, 8]
```

We can also assign some remining values using ...rest:

```js
// note `rest` can be name anything you'll like
const [a, b, ...rest] = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];

// a    => "a"
// b    => "b"
// rest => ['c', 'd', 'e', 'f', 'g']
```

Passing parameters with spread syntax

```js
const dateArray = [2019, 1, 15];
const date = new Date(...dateArray);
// @return Fri Feb 15 2019 00:00:00 GMT-0500 (Eastern Standard Time)
```
How do you convince clients to go with Gatsby instead of Wordpress?
Tags: discuss, javascript, gatsby, wordpress
Published: 2019-07-07 20:31:26

A question for freelancers out there: I have a client who is very used to her Wordpress installation, but the exact same thing could be done with Gatsby + Netlify CMS. I can't seem to convince her to switch and I can't stand how complicated Wordpress is.

Have you faced a situation like this where you ended up convincing your client to switch? How did you do it? Or did you just silently swap hoping they wouldn't notice?
TypeScript Promises Examples
Tags: angular, typescriptpromises
Published: 2020-01-30 11:24:25

---
title: TypeScript Promises Examples
published: true
tags: Angular, TypeScript Promises
canonical_url: https://www.positronx.io/angular-8-es-6-typescript-promises-examples/
---

Today in this tutorial, we are going to understand what Promises are, how promise work, when should we use promises, and how to use promises properly. A promise is a TypeScript object which is used to write asynchronous programs. A promise is always a better choice when it comes to managing multiple asynchronous operations, error handling and better code readability. We know what does synchronous and asynchronous programs are. The asynchronous program allows us to move to the next line of code before the previous task is completed.

## TypeScript Callback Example

 
[Click here to read more](https://www.positronx.io/angular-8-es-6-typescript-promises-examples/)
Starting my 100 Days of Code Challenge
Tags: 100daysofcode, coding, swift
Published: 2019-07-07 19:51:14

---
title: Starting my 100 Days of Code Challenge
published: true
description: I’m publicly committing to the 100DaysOfCode Challenge starting today! I will share my progress report on Twitter daily.
tags: 100DaysOfCode, Coding, Swift
cover_image: https://thepracticaldev.s3.amazonaws.com/i/u5d7sosk30lm7pex8lqc.png
---



Hello Everyone,

I’m publicly committing to the 100DaysOfCode Challenge starting today! I will share my progress report on [Twitter](https://twitter.com/dhairyachandra) daily. You can tweet me on [@dhairyachandra](https://twitter.com/dhairyachandra) for any queries and questions. Daily logs and work will be uploaded on [GitHub](https://github.com/dhairyachandra). Also I’ll be sharing my daily learning on [my blog](www.medhairya.com/blog).

I’ll be starting learning Swift language and then I’ll design iOS apps all my work will be shared on Twitter, GitHub and my website.

![](https://thepracticaldev.s3.amazonaws.com/i/dib8p26sk93ezvw6b1ip.png)


## What is 100 Days Of Code Challenge ?

100 Days of Code is a challenge/community, where you publicly commit to code for 1 hour for the next 100 days (it is however more flexible than that). You also become a part of a large friendly dev community.

Two Main Rules:

– Code minimum an hour every day for the next 100 days.

– Tweet your progress every day with the #100DaysOfCode hashtag.
How do you develop your personal brand?
Tags: discuss, brand, career, entrepreneurship
Published: 2019-07-07 19:42:43

Nowadays, many software developers, creators, entrepreneurs and managers in the industry (in the Bay and outside of it) are trying to promote their own **personal brand** or aspire to do so, in order to achieve many goals such as: securing a better position where they work, prove themselves as an expert in some field, get a better job elsewhere, promote their own company/product etc.

Many do it using many different tools and techniques, such as writing tech blogs, hosting a podcast, speak at conferences, tweet, network with specific individuals, actively participate in chats and forums, and many more.

What do you think about it? Do you actively trying to promote yourself? If you do, then how and what are your goals, and if you don't, then why?
Python Dictionary-like objects into database
Tags: python, database
Published: 2019-07-04 10:34:18

---
title: Python Dictionary-like objects into database
published: true
description: python, database
tags: python, database
---
<img src="https://i.imgur.com/eMW3zH8.gif">

Dictionaries are key,value pair groups. But by default that's stored in memory. That works fine, until you run out of memory.

You can create dictionary like objects, data is immediately stored into a SQLite database.

How is this different from a normal dictionary?

* data is stored on the disk, not memory
* creates sqlite database file and stores data there
* dictionary can be explored with a tool like sqlitebrowser

Usage like this:

    #!/usr/bin/python3
    from dbdict import dbdict
    
    d = dbdict("dummy")
    d["foo"] = "bar"
    d["key"] = "value"
    d["pi"] = 3.14159
    print(d["key"])
    
    d["foo"] = "foo foo"
    print(d["foo"])
    print(d.keys())
    
    for key in d.keys():
        print("* d[" + str(key) + "] = " + str(d[key]))

Then you can explore with any sqlite browser program. 

<img src="https://raw.githubusercontent.com/petercour/sqlite-dict-for-python/master/program.png">

The class does all the querying, inserting, table creation and so on. 

So if instead you want to use another database than SQLite, you can just change the module (sqlite) and change the queries for that database system. In theory that should work with any database system once changed.

Download class: https://github.com/petercour/sqlite-dict-for-python/blob/master/dbdict.py

Learn Python:

* https://pythonbasics.org
* https://pythonprogramminglanguage.com/