teleren/devto huggingface dataset:
The 80/20 rule and software development
Tags: power, law, time, effort
Published: 2020-04-05 09:18:13

---
title: The 80/20 rule and software development
published: true
description: It's amazing how many times I've caught myself about to waste a lot of time on something that isn't really essential. This video is about how I think the 80/20 rule applies to how we allocate effort as software developers.
tags: power, law, time, effort
---

It's amazing how many times I've caught myself about to waste a lot of time on something that isn't really essential. This video is about how I think the 80/20 rule applies to how we allocate effort as software developers.
Add GRPC to Unity project checklist
Tags: unity3d, grpc
Published: 2020-04-05 07:22:20

* Find **unitypackge** from daily build list (https://packages.grpc.io/)
* Extract plugins to project asset folder
* Your project target must be **.NET 4.x Equivalent** (Edit → Project Settings → Player → Configuration → Scripting Runtime Version)

* * *

## Service Compiler

I also made a tool to compile GRPC’s `.proto` files for Unity based on [protobuf-unity](https://github.com/5argon/protobuf-unity) project, you can get it from this [link](https://github.com/insthync/protobuf-unity-grpc_csharp_plugin).

There is a new field to set `grpc_csharp_plugin` path

![New field for protobuf-unity](https://dev-to-uploads.s3.amazonaws.com/i/opv1193eu23p211buwwg.png)

You also can find built `protoc` and `grpc_csharp_plugin` from daily build list (https://packages.grpc.io/)
File or folder naming
Published: 2020-04-05 08:57:25

# Intro
This is not a serious issue. I was curious wheather using hyphen(-) in file nameing good or not. So, I searched and found an answer.

# Good Naming

this is a range of characters that can be considered safe:

    Letters (a-z A-Z) - Unicode characters as well, if needed
    Digits (0-9)
    Underscore (_)
    Hyphen (-)
    Space
    Dot (.)

The forbidden printable ASCII characters are:

    Linux/Unix:

    / (forward slash)

    Windows:

    < (less than)
    > (greater than)
    : (colon - sometimes works, but is actually NTFS Alternate Data Streams)
    " (double quote)
    / (forward slash)
    \ (backslash)
    | (vertical bar or pipe)
    ? (question mark)
    * (asterisk)

As Mac is considered under unix family, I guess this works with Mac too.

# Links
https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names
https://support.office.com/en-us/article/Invalid-file-names-and-file-types-in-OneDrive-OneDrive-for-Business-and-SharePoint-64883a5d-228e-48f5-b3d2-eb39e07630fa
https://sharepoint.stackexchange.com/questions/151575/which-characters-are-allowed-in-file-folder-names-in-sharepoint
How to simplify a complex factory pattern?
Tags: help, python, architecture, refactorit
Published: 2020-04-05 07:22:13

I have a function which takes the incoming request, parses the data and performs an action and posts the results to a webhook. This is running as background as a Celery Task. This function is a common interface for about a dozen Processors, so can be said to follow the Factory Pattern. Here is the psuedo code:

```python
processors = {
    "action_1": ProcessorClass1, 
    "action_2": ProcessorClass2,
    ...
}

def run_task(action, input_file, *args, **kwargs):
    # Get the input file from a URL
    log = create_logitem()
    try:
        file = get_input_file(input_file)
    except:
        log.status = "Failure"

    # process the input file
    try:
        processor = processors[action](file)
        results = processor.execute()
    except:
        log.status = "Failure"

    # upload the results to another location
    try:
        upload_result_file(results.file)
    except:
        log.status = "Failure"
    
    # Post the log about the entire process to a webhoook
    post_results_to_webhook(log)
```

This has been working well for most part as the the inputs were restricted to action and a single argument (`input_file`). As the software has grown, the processors have increased and the input arguments have started to vary. All the new arguments are passed as keyword arguments and the logic has become more like this.

```python
try:
    input_file = get_input_file(input_file)
    if action == "action_2":
       input_file_2 = get_input_file(kwargs.get("input_file_2"))
except:
    log.status = "failure"


try:
    processor = processors[action](file)
    if action == "action_1":
        extra_argument = kwargs.get("extra_argument")
        results = processor.execute(extra_argument)
    elif action == "action_2":
        extra_1 = kwargs.get("extra_1")
        extra_2 = kwargs.get("extra_2")
        results = processor.execute(input_file_2, extra_1, extra_2)
    else:
        results = processor.execute()
except:
    log.status = "Failure"
```

Adding the if conditions for a couple of things didn't make a difference, but now almost 6 of the 11 processors have extra inputs specific to them and the code is starting to look complex and I am not sure how to simplify it. Or if at all I should attempt at simplifying it.

Something I have considered:
1. **Create a separate task for the processors with extra inputs** - But this would mean, I will be repeating the file fetching, logging, result upload and webhook code in each task.
2. **Moving the file download and argument parsing into the BaseProcessor** - This is not possible as the processor is used in other contexts without the file download and webhooks as well.

**Update:**
The title was changed to better describe the situation.
How To Make a Cryptocurrency 
Published: 2020-04-05 06:43:11

Thousands of people are finding ways of making their own cryptocurrency and repeating the success of bitcoin founder Satoshi Nakamoto .. This is your article if you dream the same thing.

From a technological point of view, a new cryptocurrency can be generated by various methods, starting by modifying the source code for bitcoin and ending using ERC20 (23) or Waves. 

A separate article is worth a comprehensive guide to all approaches, but for now we will find the most simple way to use the source code. 

You may not be able to create a groundbreaking cryptocurrency, but at least you can get a general understanding of what kind of crypto-currency developers tasks are going to deal with.

So, if you're interested in trying your luck at creating a cryptocurrency, follow the instructions below.

Step 1. Select the Source Code on the Github Platform

Step 2. Edit the Code

Step 3. Configure the Network Ports

Step 4. Take Security Measures

When creating your own cryptocurrency, you should initially treat it as a commercial enterprise that can both take aim at the market and remain absolutely unnoticed.

Free consultation: https://cryptodevelopers.net
How I came up and developed BizSpot?
Tags: bizspot, businesslocationviability, satelliteimage, computervision
Published: 2020-04-05 06:37:05

The most difficult thing in developing an app is to think about the app itself, what should be its concept and even its functionalities.

# What to do? #
In Graduate School Computer Vision course, we are tasked to develop a computer vision app and write a corresponding research paper of it. Well, I'm so excited at first cause it's the time to think freely and out of the box. But I was wrong, cause it took me months to think about what app I supposed to develop.

Not until one day in the middle of this COVID-19 pandemic, it just came into my mind, what if I create an app wherein it will check if a certain location is viable to be a business location. So, I checked the Google Satellite Map and scan some of the places. One unique thing that I've noticed is that when a specific place has no houses, it only shows greeny pixels but if there's so many houses, it will certainly show you a pixels of roof or building deck. 

# Finding solutions #

So what I did first was, I tried to search for possible methods to extract details from the satellite map. At first, I tried the canny edge detection using OpenCV-python. However, I did not get my desired result cause there's some circumstances and objects affecting the detection. I scanned my digital image processing repository and I've found and recalled the Intensity Level Slicing idea. Apparently, Intensity Level Slicing is mostly used for enhancing features in satellite images and that was it, that was the key.

{% github iamjcoo/Digital-Image-Processing %}

# Coding time #

After testing the code, I've decided that I will use Flask, a python microframework to develop the app. I first create the blade templates by using HTML and CSS Framework. I chose NES.css as my style cause it's kinda cute to me.

{% github nostalgic-css/NES.css no-readme %}

Next, I wrote the routes, I have only two routes, the index route, and the analyze route. Index route is responsible for returning the index blade while the Analyze route is for the analysis of the satellite map image. Here's the full repository of BizSpot for your code reference.

{% github iamjcoo/BizSpot no-readme %}

# Deploy #

Now, it's time to share this with people. I've planned to deploy this to Heroku since it's easy and free to deploy an app there and they support all kinds of environments such as python and everything. 

You can freely use and view[BizSpot](https://bizspot.herokuapp.com) via this link https://bizspot.herokuapp.com

# Summary #

The big thing here is don't lose your hope cause there are so many solutions out there. Just always think that you will do it right in time. Don't be scared to ask and search for stuff and ideas. If you want to build something useful and big, start it with yourself. Think, venture, and explore new things that could make your experience easier. 

Now, show them everything, your ideas, your talent. Don't hide away, come out and build!
What is Server Side Rendering and Client Side Rendering? create-react-app vs next.js?
Tags: react, javascript, nextjs, node
Published: 2020-04-05 05:53:10

#Introduction
What are the performance differences between Next.js and Create React App? Let’s unpack that question with some data, but first, we need to understand what exactly we are comparing here.

Watch This Video For Better Understanding The Concepts .. :)
[![VeeWeb Code](https://img.youtube.com/vi/EN_RXcmkZos/0.jpg)](https://www.youtube.com/watch?v=EN_RXcmkZos)

#What is Next.js?
>Next.js is a React framework built by Zeit, and according to nextjs.org:

With Next.js, server rendering React applications has never been easier, no matter where your data is coming from.

Next.js also supports static exporting, but for the purposes of this post, we are focused on that “server rendering” capability mentioned above.

#What is Create React App?
According to its Getting Started page:

>Create React App is an officially supported way to create single-page React applications.


#SSR vs. CSR
Next.js is one way that you can leverage React to support server-side rendering (SSR). Likewise, Create React App is one way that you can leverage React to support client-side rendering (CSR).

There are other frameworks out there when it comes to either choice, but what we are really comparing in this post is how each rendering strategy impacts web application performance. We just happen to be using two of the more popular frameworks out there to make that comparison.
Bash alias & function tricks
Published: 2020-04-05 05:04:02

Spending some time on the command line you tend to want to find some shortcuts.  Take Rails for example.  Key information is spread all about!  Migrations, controllers, config files, all neatly organized in the directory tree.  But if I wanted to take a quick peek at my routes, I'd have to type out...
```
cat config/routes.rb
```
...or the Models...
```
cat app/models/*
```
...which at first glance doesn't seem so bad.  But when checking that info constantly a shorter solution is desired.  Enter the alias.

Basically an "alias" is a short-cut or code-word for a command you'd like to enter into the terminal.  With the quick command:
```
alias routes="cat config/routes.rb"
```
All I would need to do now is type "routes" into the terminal and it would have the same result as typing out "cat config/routes"

This is great for displaying the contents of one file, or many files in one directory, but what if I'd like to see multiple files across multiple directories?  Enter the function.

Shell "scripts" or "functions" work the the same manner as an alias, but for multiple lines of code.  My controllers for example are spread across a few different directories.  By entering the command:
```
function controls {
```
you're brought to a new ">" prompt.  It's here where you can enter the commands you'd like executed.  In my case to display the controller files in two separate directories I'd enter:
```
function controls {
> cat app/controllers/*
> cat app/controllers/api/v1/*
}
```
Now when I want to quickly see the content of the controllers, all I'd need to type is "controls"

These changes will be temporary to your bash session.  If you'd like the alias or function to be permanent they will have to be added to your .bash_profile.
Implement a simple html syntax highlight using Nim
Tags: nim, highlight
Published: 2020-04-05 03:58:45

We introduce how to implement simple html syntax highlight using Nim. We use `highlight` in stdlib to parse syntax. Then we use `karax` and `htmlgen` to generate Html. 

[Preview](https://tea.nim-cn.com/highlight.html)

## import module

We need `karax` which constructs DSL to generate Html file and use `htmlgen` to generate Html strings.

First you should use command `nimble install karax` to install `karax`.

`karax` can be used as server side rendering and also single page application. To be simple, `karax` can be used to generate Html and `Javascript`.

```nim
import karax / [karaxdsl, vdom]
import packages/docutils/highlite
from htmlgen import span
from xmltree import escape


## code block
const code = """
import hello

type  
  TreeObj* = object
    left*: ref TreeObj
    right*: ref TreeObj
    value*: char
    priority*: float
  Tree* = ref TreeObj

## escape `>=`
if a >= b:
  echo a + b
"""
```

### Generate HTML 

`karax` supply `text` function accepting strings and  `verbatim` function accepting raw Html strings.

We use link `CSS` to render `keywords`, `comments`, `symbols`, etc.

CSS looks like this.(highlight.css)

```css
span.Keyword {
  color: blue;
  font-size: 18px;
}

span.Operator {
  color: purple;
  font-size: 18px;
}

span.Comment {
  color: green;
  font-size: 18px;
}
```

List Nim code as below， `buildLang` function uses stdlib `highlight` to parse syntax information and generates Html strings.

```nim
proc buildPre*(code: string): string =
  let vnode = buildHtml(tdiv):
    pre(class = "text"): text code
  result = $vnode

proc buildVerbatimPre*(code: string, lang: string = "lang-Nim"): string =
  let vnode = buildHtml(tdiv):
    link(rel="stylesheet", `type`="text/css", href = "highlight.css")
    pre(class = lang): verbatim code
  result = $vnode

proc buildLang*(code: string): string =
  var toknizr: GeneralTokenizer
  initGeneralTokenizer(toknizr, code)
  while true:
    getNextToken(toknizr, langNim)
    case toknizr.kind
    of gtEof: break 
    of gtNone, gtWhitespace:
      result.add substr(code, toknizr.start, toknizr.length +
      toknizr.start - 1)
    else:
      result.add span(class=tokenClassToStr[toknizr.kind], escape(substr(code, toknizr.start, toknizr.length +
          toknizr.start - 1)))


proc buildCode*(code: string, lang: string = "Nim"): string =
  if getSourceLanguage(lang) != langNim:
    return buildPre(code)
  buildVerbatimPre(buildLang(code))
```

Let’s test our results，use `openDefaultBrowser` to [preview](https://tea.nim-cn.com/highlight.html).

```nim
import browsers
let file = "highlight.html"
let f = open(file, fmWrite)
f.write buildCode(code)
f.close()
openDefaultBrowser(file)
```
Day6 - git with js challenge
Tags: git, javascript, coding, challenge
Published: 2020-04-05 03:30:34

# Git and JavaScript Learning

## Link to challenges
https://dev.to/codeguppy/50-micro-coding-challenges-for-javascript-learners-5ace

## Commands to start a local and pushing the changes to brand new remote
`git init
 git add
 git commit -m "first commit"
 git remote add origin https://github.com/arung86/50-js-challenges.git
 git push -u origin master`

## My challenges are tracked in Repo
https://github.com/arung86/50-js-challenges.git
Predicting lacrosse games update #2
Tags: python, machinelearning
Published: 2020-04-05 03:29:15

There isn’t much of an update to be honest, but I'll explain a little bit more later. Again the over arching theme this project has presented to myself is how rusty I am with python. But I finished the “simple” version of the program with somewhat surprising results, at least in my mind. I took the bracket for the 2019 lacrosse tournament, ran it through the program and it's accuracy was between 46-53% accurate. What this teaches me is that going straight off of which team has the best stats will only get you so far when trying to figure out who is going to win. 

So the question is what is the biggest factor in predicting the winning time? That's what I've been thinking about during the day on my vacation from my 9-5 and I'm sure it's what everyone thinks about that tackles this same problem. And I haven't made any head way I'm sorry to say.

Regardless of my progress in solving the above question I’ve started the next phase of the project. I’ve decided on a way to simplify the data I’ve collected and then send it on to train the model. I don't know if it's exactly the right way but I'm still a newbie so I don't know any better and I'm gonna try it anyway. In the data I have 14 stats for each team and game, I decided to follow the example of Rodrigo Nader as he tried to predict World Cup winners. (the article is https://towardsdatascience.com/using-machine-learning-to-simulate-world-cup-matches-959e24d0731 and it's really an interesting read). So anyway I'm subtracting the stats from each team, if the result is positive it means team 1 had the better stat, else team 2 had the better stat. Pretty much it sounds like this will be inline with how I'm doing the "simple" prediction but eventually will be more machine learning-ish.

I’ve been frustrated with this project. I’ve been discouraged and wondered if I should even keep going on with it. In those times I simply take a break. That's the thing I've learned over the past couple months with these side projects, if my hearts not in it, take a step back, take a deep breath and put in on the back burner for a little bit. That's why there hasn't been a ton of progress with it. I hit a wall with python and trying to figure out other things with it has been making me pull out my hair. So I put the project off for a day or two and calm down a bit.

So that's the progress this week on the project. If you want to see where I'm at you can check out the project on my GitHub. And if there's any thoughts, comments, or constructive criticism feel free to let me know!
Use Nim language to implement Nim Game
Tags: nim, nimgame, commandline
Published: 2020-04-05 03:14:04

**Nim** is a [mathematical](https://en.wikipedia.org/wiki/Mathematical_game) [game of strategy](https://en.wikipedia.org/wiki/Game_of_strategy) in which two players take turns removing (or "nimming") objects from distinct heaps or piles. On each turn, a player must remove at least one object, and may remove any number of objects provided they all come from the same heap or pile. Depending on the version being played, the goal of the game is either to avoid taking the last object, or to take the last object.

From wiki: https://en.wikipedia.org/wiki/Nim

[Nim language](https://nim-lang.org/) is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula.

## The code

We write a simple program based on command line. It mostly uses `terminal` module to format output, namely `styledEcho`.

We use parameters `paramStr` to get the total numbers of  objects. Use `readline` to continue to get the out output of user. Use random ranging from 1 ~ 3 to emulate operations that computers execute.

```nim
import random, terminal, strutils, os


const TOTAL = 12

proc tryParseInt(s: string): int =
  try:
    result = parseInt(s)
  except ValueError:
    discard

proc succeed() =
  styledEcho(styleBright, fgRed, repeat('#', 50))
  styledEcho(styleDim, fgBlue, "Congratulations!")
  styledEcho(styleBright, fgRed, repeat('#', 50))

proc fail() =
  styledEcho(styleBright, fgGreen, repeat('#', 50))
  styledEcho(styleDim, fgBlue, "Don't lose heart. Come again next time:-)")


proc nimgame(total: int = TOTAL) =
  var
    total = total
    number: int
  randomize()
  while total > 1:
    styledEcho(styleDim, fgBlue, $total & " left" & "\n")
    styledEcho(styleBright, fgRed, "It's your turn")
    styledEcho(styleItalic, fgYellow, "fetch your stones(1 ~ 3): ")
    number = tryParseInt(readLine(stdin))
    while number notin {1, 2, 3}:
      styledEcho(styleItalic, fgYellow, "fetch your stones(1 ~ 3): ")
      number = tryParseInt(readLine(stdin))
    styledEcho(styleDim, fgBlue, "\nYou fetches: " & $number)
    dec(total, number)
    if total == 1:
      succeed()
      return
    if total > 1:
      let choice = rand(1 .. min(3, total))
      styledEcho(styleDim, fgBlue, "Computer fetches: " & $choice)
      dec(total, choice)
      if total == 0:
        succeed()
        return
  styledEcho(styleDim, fgBlue, $total & " left" & "\n")
  fail()


when isMainModule:
  if paramCount() < 1:
    echo "Please input the total numbers of stones!"
  if paramCount() == 1:
    var total = tryParseInt(paramStr(1))
    if total == 0:
      total = 21
    nimgame(total)
```

Now play in windows.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4cirzzwelxj9smikzgi0.png)
DevOps Engineer vs. SRE?
Tags: discuss, sre, devops
Published: 2020-04-05 02:30:34

---
title: DevOps Engineer vs. SRE?
published: true
description: What do you think is the difference?
tags: discuss, SRE, DevOps 
---

Without much of my own additional input, how do ya'll feel that these two job functions differ? 

To reiterate: DevOps Engineer vs. SRE?
opencv-python on deploying heroku app
Published: 2020-04-05 01:35:33

In order to deploy and run properly the applications in heroku that uses opencv-python, you need to include the heroku-buildpack-multi by running this command:

```heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git --app MYAPP```

then create a new file <bold>Aptfile</bold> with the following content:

```
libsm6
libxrender1
libfontconfig1
libice6
```

deploy it and your opencv app will work fine now!