teleren/devto huggingface dataset:
Blogging About Developing
Published: 2020-10-03 21:11:19

## Hi, my name is William
I recently decided to join Dev to help me find some clarity as I begin the journey of blogging about developing my own projects.  And in doing so, using the platform to not only expand on my ideas but also grow as a self taught developer.

I'm not the best writer so I do apologize in advance.

## My initial journey
To summarize, I've always been the type of person who was interested in most things that other people around me weren't. Naturally that meant there were less people to go to for information outside of the Internet.

My self taught journey into web development and programming in general has always been not centrally focused. Mostly because sometimes life just happens.

I learned to code simple websites at the age of fourteen, in notepad, circa 2004; And from then on continued to dabble here and there into most of my twenties while fathering three beautiful children. 

This lead to me experimenting, in my free time, with many different languages and helped me gain a better understanding of one language by using another.

I'm now in my thirties and still full of ideas. I'd like to bring my thoughts to life and this leads me to starting this blog. I find sometimes it's very easy to become overwhelmed, unmotivated, and a little depressed if you constantly stay in your head.

## My overall goal
Admittedly, being a bit of an introvert, I'd like to break out of my shell. I figured the best place to do such a thing would be a blogging community full of like minded individuals. 

I don't know if I'll ever work as a developer for an already establish company, but I think it's equally important to create things for the world to see anyway. There's always one great developer that is inspired by another.

Like most people, I'm starting a dev blog to strengthen my understanding of the things I do know and help me narrow down what I don't.

## Lets connect

 Feel free to [tweet me](https://twitter.com/intent/tweet?screen_name=wcazes) if you would like to connect, show me your projects, or ask me questions directly.
Inviting contributions to OpenTrading!
Tags: opensource, hacktoberfest
Published: 2020-10-04 05:39:46

Hello there. We just started an open source project that involves algorithmic trading, OpenTrading.

It is a new project. We have a lot of backend and frontend work to do. This is going to be a long running open source project.

You are welcome to read more to contribute to the project on GitHub or spread the word with others.
 
https://github.com/open-algorithmic-trading/docs
https://github.com/open-algorithmic-trading/docs/wiki

You are welcome to join our Slack to participate in the conversation.

Slack:
https://join.slack.com/t/opentrading/shared_invite/zt-h486t1ue-1Pt9Ais587FLdvcWkZZUAg
How to Deploy a Ruby On Rails Backend to Heroku
Tags: ruby, beginners, rails
Published: 2020-10-04 05:36:15

# Introduction
Ruby on Rails for many years now has been an extremely popular and influential framework that allows a programmer to build up and deploy a REST API extremely quickly. With that in mind, many developers will choose to deploy using Heroku do to its simplicity and generous pricing for smaller projects.

# Getting Started

The first thing we are going to need is PostgreSQL as our database management system. This is Heroku's preferred database management system and Heroku will not work with Ruby on Rail's default sqlite3. Installation instructions for your operating system can be found [here](https://www.postgresql.org/download/).

We also want to download and install the Heroku CLI which can be found [here](https://devcenter.heroku.com/articles/heroku-cli)

Before we start getting Heroku set up in our project, we are going to need to make sure that our Ruby on Rails is using PostgreSQL as our database technology instead of its default sqlite3. If you have already built your backend around sqlite3 you can read about migrating it over to PostgreSQL [here](https://dev.to/torianne02/making-the-change-from-sqlite3-to-postgresql-ruby-on-rails-2m0p). Otherwise, if you are just starting a Ruby on Rails backend you can automatically configure it for PostgreSQL by adding the `--database=postgresql` flag when creating your project like so `rails new project-name --api --database=postgresql`.

# Deploying our Backend

Once your rails backend is ready to be deployed you are going to need to create a [Heroku Account](https://signup.heroku.com/login). Once finished we need to click on the "new" button in the top right corner of the web page and then click "create a new app" within the drop-down where it will then ask you to pick a name for the app. Name the app and then click "Create App"

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0bw3u3ul8z84swtbf4ld.PNG)

Once your app is finished being created you will want to enter your Ruby on Rails directory and then run the command `heroku login`. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2fhsdcfetzbw7usw49en.PNG)

Once logged into your Heroku account from your terminal you are going to run these commands in order.

* `git init`
* `heroku git:remote -a <name of your project>`
* `git add .`
* `git commit -am "any message you want"`
* `git push heroku master`

Once this series of commands is finished, your code is now deployed up to Heroku. You can run any of your Rails command line commands as long as you preface it with `heroku run`. For example, if we wanted to create our database within our Heroku server we would run `heroku run rake db:create` or if we wanted to enter our console we could run `heroku run rails console` from our command line.

If you wanted to access the address for your newly deployed server you can click on the overview tab and click the open app button located in the top right corner of the webpage and it will take you to the hosted web address.


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4aqwd36higit9pol4e9i.PNG)
How to fix the wrong name and email being an author in a branch's commits
Published: 2020-10-04 05:35:57

If you have multiple GitHub accounts, and end up making a bunch of commits under the wrong account, what do you do? Reset your branch and start working all over again with the right account in credentials? Maybe that's the more honorable method, but assuming time isn't on your side and you've got a lot of changes to make, there's another way.


Git actually gives developers a ridiculous amount of freedom, so much that warnings tend to inform you when you might be doing something dangerous, this is definitely something dangerous.

These methods all involve modifying git history, if your Organization doesn't allow modification of branch history, you might want to discuss with your team and find a better way.

## To modify the last commit

```shell
git commit --amend --author="Author Name <email@address.com>"
```

## To modify all commits in current branch
```shell
#!/bin/sh

git filter-branch --env-filter '

OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"

if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_AUTHOR_NAME="$CORRECT_NAME"
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
```

You may have to use the force flag to make it work `git filter-branch -f --env-filter  `

All the changes will have to be force pushed to their remote branches because they rewrote git history.

```shell
git push -f
```
Laravel el comienzo(vistas)
Published: 2020-09-28 15:17:16

Las vistas desde un punto de vista personal debería ser lo siguiente. Vamos a ello.

Laravel tiene un sistema llamado Blade (por eso llamamos .blade a las vistas) que es ese doble par de llaves para mostrar los datos almacenados en variables u objetos.

Veamos la ruta primero:
```
Route::get('listado', function(){
	$titulo = "Listado de canciones";
	$lista = array ('Que vas hacer', 'La planta', 'Happy now');

	return view('canciones.listado')
	->with('titulo', $titulo)->with('listado',$listado);
});

```
Lo que hice fue crear una ruta accesible desde la url, esta ruta me retornara una vista, en la vista tendremos disponibles los valores que le pasamos con ->with. Veamos la vista.

```
<h1>{{$titulo}}</h1>

<h2>{{$lista[1]}}</h2>
```
Este es el contenido de listado.blade.php que esta dentro de la carpeta canciones que a su vez esta dentro de la carpeta views.
Lo que estamos realizando es interpolación de variables y sirven básicamente para saber que estamos realizando cambios en la vista porque no usamos sintaxis de PHP como **<?php ?>** sino doble llaves para referirnos a la vista.
Con la interpolación también puedes llamar funciones de PHP tal cual es un echo.
>continuara
Login Tkinter
Tags: python, mmongodb
Published: 2020-10-04 05:20:48

Imagine there's a program in which you put your username and password and on pressing enter you get logged in.....I am stucked on the problem where I can't open a new window when pressing enter after putting in my info!
Can anyone help me with this???
Like I wanna get logged in if the user input info matches that in database!!
Share code, link, anything that can help!!!!
Free EBook Developer's Guide to Azure
Tags: azure, devops, cloud
Published: 2020-10-04 05:14:57

[Download from here](https://aka.ms/azuredevebook)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3ri9lwju2dnyrxmbx3zl.png)

- Chapter 1: The Developer’s Guide to Microsoft
- Chapter 2: Getting started with Microsoft Azure
- Chapter 3: Adding intelligence to your application
- Chapter 4: Securing your application
- Chapter 5: Where and how to deploy your Microsoft Azure services
- Chapter 6: A walk-through of Microsoft Azure
- Chapter 7: Using the Microsoft Azure Marketplace
Teach your Kid Python
Tags: python
Published: 2020-10-04 05:01:16

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/uikz58z54mpjj5srs3pk.png)

My humble open source approach towards teaching Python to students.

**Github page** [https://wrijugh.github.io/python-for-kids/](https://wrijugh.github.io/python-for-kids/)

[Github Repo for feedback and contribution](https://github.com/wrijugh/python-for-kids)

Subscribe to **Youtube Channel** for videos [https://www.youtube.com/channel/UC03RQrU98OOvAoKiB7FNgUA](https://www.youtube.com/channel/UC03RQrU98OOvAoKiB7FNgUA)

Look for the playlist **Python for Kids** [https://www.youtube.com/playlist?list=PLH60I37xI-jmDGHF1S_2ld5Gb7x0tP0Fp](https://www.youtube.com/playlist?list=PLH60I37xI-jmDGHF1S_2ld5Gb7x0tP0Fp)

Spread, learn and enjoy!!!
Different Types of Loops in Python
Tags: python, beginners
Published: 2020-10-04 04:57:12

In this post I will show several loops in Python that you can utilize for your problems in python.

##For Loop
For loop allows you to go over a dictionary, set, string, list, or tuple. 

```python
# loop over array example
array = [1, 2, 3, 4]
for x in array:
    print(x)

=> 1
=> 2
=> 3
=> 4
```

### Loop Over String
```python
string = "word"
for x in string:
    print(x)

=> w
=> o
=> r
=> d
```
Keep in mind, the printed out characters are of type string!

### Loop over Set
Sets are unordered collections that have no duplicate elements
```python
word = set("uniq")
for x in word:
    print(x)

=> u
=> n
=> i
=> q
```

## Looping with range
Using `range` takes in a number to loop. You can use the length of an array for instance to iterate through the whole array. 
Range will go by index so it will begin at 1 and end at the length - 1

```python
array = [1, 2, 3, 4]
for i in range(len(array)):
    print("index:"i, ", value:", array[i])

=> index: 0 , value: 1
=> index: 1 , value: 2
=> index: 2 , value: 3
=> index: 3 , value: 4
```

## While Loops
While loops continue to loop until the condition is met. Be careful using while loops because you can easily have an infinite loop.

```python
counter = 0
while counter < 5:
    print(counter)
    counter += 1

=> 0
=> 1
=> 2
=> 3
=> 4
```
Not incrementing the counter here would result in an infinite loop and may timeout the program.
Sorting Algorithms in Javascript Part 2
Tags: javascript, beginners, algorithms, computerscience
Published: 2020-10-04 04:44:47

It's been a couple of weeks since I wrote my [last post](https://dev.to/123jackcole/sorting-algorithms-in-javascript-5f4b) on sorting algorithms and I think it's finally time to revisit the topic. In this post I'll be covering additional sorting algorithms that are more uncommon than the ones I covered in my first post.

In this article I'm going to cover:
* Selection Sort
* Bucket Sort
* Counting Sort

## Helper Methods

Just like in my first post, we're going to be doing a lot of swapping of elements. It makes sense to create some helper methods that can be used in our sorting methods.

![Helper Methods](https://dev-to-uploads.s3.amazonaws.com/i/8yac3kofqr9sobjuxo0a.png)

## Selection Sort

Selection sort works by dividing the input array into a sorted and unsorted list. The sorted list begins empty and while the unsorted begins as the initial array. We continuously loop through the array to find the smallest element and add that element to the sorted list. This repeats until the entire array is sorted.

![Selection](https://dev-to-uploads.s3.amazonaws.com/i/r3v830d7u6bkq6d4uhdo.png)

Runtime: O(n^2) to O(n^2)

## Bucket Sort

Bucket sort works by distributing the elements of the input array into different sections or *buckets*. The elements are then sorted with a different sorting method, most commonly selection sort. Bucket sort is much faster than solely using selection sort due to the strategic placement of elements into buckets at the cost of additional memory use.

![Bucket](https://dev-to-uploads.s3.amazonaws.com/i/64ofs0qqn5uczuqpbn4y.png)

Runtime: O(n+k) to O(n^2)

## Counting Sort

Counting sort is unique in that it doesn't do any comparing between it's elements. Instead counting sort counts the number of elements having distinct key values. From there it uses arithmetic to calculate the position of each element. The main caveat of counting sort is that we need to know the min and max elements in the input array.

![Count](https://dev-to-uploads.s3.amazonaws.com/i/soi15h09vmaa4h12c0ry.png)

Runtime: O(n)

Thanks for readying! I intent to also cover heap sorting in a future post but wanted to cover heap data structures before getting to that. 

The code for this lesson can be found [here](https://github.com/123JackCole/sorting_algorithms).
How to use Github Actions to build Android App
Tags: android, github
Published: 2020-10-04 03:53:51

Build your android app when push into github actions!

## Add workflow file

Add workflow file under directory `.github/workflows/`. File name can be anything, but the extension must yaml.

Example: `.github/workflows/android.yml`

```yaml
name: Android CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8

      - name: Make gradlew executable
        run: chmod +x ./gradlew

      - name: Build with Gradle
        run: ./gradlew build

```

## Done

Commit this file and push it to the GitHub!

Click Actions tab to see the result

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/safptrne90bg4ypwfvsb.jpg)

Thanks for reading!
Stop deployment
Tags: django, celery, appliku, deployment
Published: 2020-10-04 03:46:09

I am working on Appliku, which is building, and deployment automation SaaS. 

Read the story: https://dev.to/kostjapalovic/tired-of-deployments-built-my-own-heroku-47ed.

It is built with Django and heavily uses Celery.

One of the most important parts that I want to improve is the build/deployment process. More specifically being able to manage running build/deploy jobs.

What problems I see right now:
- Deployments run as long as they want
- There is no way to stop/cancel the deployment
- If the app has a push-to-deploy setting On then several deployments will be running at the same time and this can exhaust the server's resources and lead to errors due to concurrent deployments
- I want to disable the "Deploy Now" button while there are deployments in the queue
- by the way, I want deployments to be in the queue with only one running
- If a deployment is stuck or taking a significant amount of time to complete this will effectively block the user from deploying the next version of the code which might have fixes for the underlying problem.

With all said, it boils done one thing right now: I need a way to stop a deployment job.

How Appliku runs the build/deployment process?

There is a Celery task, that connects to the server using the Paramiko library.

The actual code of the function is this:
{% gist https://gist.github.com/kpavlovsky/5aa7527ffb25d94173ae9972dcfd53ae %}

What I want to do is to somehow pass the signal from the dashboard to stop this. The function will have to kill the command running and close the connection, mark the deployment as canceled.
Also, it must have timeouts in case if any of the stages are stuck for any reason.

I use Redis cache to store the abort flag for deployment.

{% gist https://gist.github.com/kpavlovsky/5606ddf029d7360295f620509ae291f2 %}

Now I only need to add the "Abort Deployment" button in the interface of https://appliku.com/
How to use local font in Nuxt JS and TailwindCSS with Typefaces.js
Tags: nuxt, tailwindcss, typefaces
Published: 2020-10-04 03:36:20

This ideas come when I want to use Nuxt JS, TailwindCSS, and Typefaces at the same time.

Lets begin!

## Select Typefaces

[Typefaces](https://github.com/KyleAMathews/typefaces) come with many font family, but in this tutorial I will use [Inter](https://github.com/KyleAMathews/typefaces/tree/master/packages/inter) and [Metropolis](https://github.com/KyleAMathews/typefaces/tree/master/packages/metropolis).

Add this two packages terminal

```bash
yarn add typefaces-inter
yarn add typefaces-metropolis
```

or use `npm install`

```bash
npm install typefaces-inter
npm install typefaces-metropolis
```

## Add plugin

Add new file in `plugins` directory. 

Example: `/plugins/typeface.js`

```javascript
import "typeface-inter";
import "typeface-metropolis";
```

Then, register and transpile in nuxt.config.js

```javascript
export default {
  ...
  plugins: ["~/plugins/typeface.js"],
  build: {
    ...
    transpile: ["typeface-inter", "typeface-metropolis"]
  },
}
```

## Tailwind config

Now we can use our local font in tailwind config file

```javascript
module.exports = {
  ...
  theme: {
    fontFamily: {
      display: "Metropolis",
      body: "Inter"
    }
  },
  ...
};
```

## We Are Done!

Use `font-display` class for Metropolis font, and `font-body` class for Inter font.

If there any better way to do this, please let me know. Thanks for reading!
Meme generator in emacs
Tags: emacs, elisp
Published: 2021-03-03 22:13:54

---
title: Meme generator in emacs
published: true
date: 2020-10-04 03:27:26 UTC
tags: emacs, elisp
canonical_url: https://erick.navarro.io/til/meme-generator-in-emacs/
---

`#TIL` it is possible to create memes in emacs using [meme](https://github.com/larsmagne/meme), this package allow to choose an image and add some text to it, we can also select any image and use it.

# Installation

This package, at the time of writing this, is not available on melpa so we have to install it manually or using [straight.el](https://github.com/raxod502/straight.el) or [quelpa](https://github.com/quelpa/quelpa), because I'm using `straight.el` for my config we'll use that.

```emacs-lisp
(use-package imgur
  :ensure t
  :straight (imgur
	     :type git
	     :host github
	     :repo "myuhe/imgur.el"))

(use-package meme
  :ensure t
  :straight (meme
	     :type git
	     :host github
	     :repo "larsmagne/meme"))
```

`meme` require `imgur` as a dependency so we need to install it before.

`straight.el` compiles all the installed packages and load them from a different folder so we won't have the base images in the correct folder, we can copy them with:

```shell
cp -r ~/.emacs.d/straight/repos/meme/images ~/.emacs.d/straight/build/meme
```

The meme generator is based on the SVG support that emacs provides, you can check is your emacs installation has it with:

```emacs-lisp
(image-type-available-p 'svg)
```

If it returns `t` you're ready to go.

# Usage

Now we can run `M-x meme` and we can choose a base image:

![pick meme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vbpu3lxutszybq0op3h6.png)

And then we can and add some text to it, like the image below:

![add text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lhbmevgida2xt7qiifr6.png)

Enjoy! 🎉
Learning about @JvmMultifileClass

Tags: kotlin
Published: 2020-10-04 02:56:11

## What is @JvmMultifileClass?
The JvmMultifileClass annotation is described as follows.

> Instructs the Kotlin compiler to generate a multifile class with top-level functions and properties declared in this file as one of its parts. Name of the corresponding multifile class is provided by the JvmName annotation.

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-multifile-class/
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-name/

## Let's decompile
Create a Utils.kt and define the foo method. The foo method just prints foo.

```kotlin
// Utils.kt

fun foo() {
    println("foo")
}
```

When decompiled, it looks like this.

```kotlin
// Utils.decompiled.java

public final class UtilsKt {
   public static final void foo() {
      String var0 = "foo";
      boolean var1 = false;
      System.out.println(var0);
   }
}
```

Let's add @JvmName and @JvmMultifileClass.

```kotlin
// Utils.kt

@file:JvmName("NewUtils")
@file:JvmMultifileClass

fun foo() {
    println("foo")
}
```

Let's decompile. I specified NewUtils in the @JvmName annotation, the NewUtils class was generated. In addition, a facade class (NewUtils__UtilsKt) has been generated.

```kotlin
// Utils.decompiled.java

public final class NewUtils {
   public static final void foo() {
      NewUtils__UtilsKt.foo();
   }
}

final class NewUtils__UtilsKt {
   public static final void foo() {
      String var0 = "foo";
      boolean var1 = false;
      System.out.println(var0);
   }
}
```

If you specify `@file: JvmName("NewUtils")` fot multiple files, the following error will occur.

`Duplicate JVM class name 'NewUtils' generated from: package-fragment, package-fragment`


This can be solved by adding @JvmMultifileClass. @JvmMultifileClass annotation can be used to generate and organize facade classes.
How Can I Download a React Project from Github and Run in My PC  
Tags: react
Published: 2020-10-04 02:42:15

Hello Everyone 
I am new to Javascript and React. I was wondering if there is any way I can download some open source projects written in React JS from Github and run it in my computer with the help of Visual Studio code.I was thinking to study the source code so that I can learn React. 
I found some projects in Github but not sure how I can download the source code and run it .
Is there any step by step guideline? Can anyone help?