teleren/devto huggingface dataset:
ApnaAnaaj- A crop value prediction webapp
Tags: devgrad2020, octograd2020
Published: 2020-05-23 16:03:47

ApnaAnaaj aims to solve crop value prediction problem in an efficient way to ensure the guaranteed benefits to the poor farmers. The team decided to use Machine Learning techniques on various data to came out with better solutionThis solution uses POLYNOMIAL MULTIVARIABLE REGRESSION technique to predict the crop value using the data trained from authentic datasets of Annual Rainfall, WPI Index for about the previous 10 years. This implementation proved to be promising with 93-95% accuracy.

Features
1.    Around 23 commodities(including all kind of crops) crop value forecasting
2.    Crop detailed forecast upto next 12 months
3.    Top Gainers and Losers of current time
4.    Crop price prediction with 93-95% accuracy
5.    Model trained on authenticated datasets provided by data.gov.in
6.    Detailed analysis of crop prices using tables and charts
7.    Prediction done by using Polynomial Multivariable Regression techniques.
8.    Annual Rainfall, WPI(Wholesale Price Index) datasets are used for training the model
9.    User friendly UI made by using materializecss

Built with my team members :- Rahul Jain, Somya Jain
Link: https://github.com/Pratyush2710/Crop_Prediction
Rendering HTML in Flask
Tags: python3, flask, webdev
Published: 2020-05-23 15:55:31

Hello World!
In my [previous article](https://dev.to/kouul/building-a-minimal-flask-application-290), I talked about building the most simple application you can ever build using Flask. In this article, I will write about rendering HTML files instead of return static strings. It will not really matter if you did not read the previous article, because I will build a new application from scratch that renders HTML pages in this article.

#### Content
1. Prerequisites
2. Generate HTML pages
3. Build flask application
4. Run the app!

---

### 1. Prerequisites
- Python3
- Pip3
- Flask
- Basics of Html

Directory layout
```
.
├── app.py
├── templates/
    └── index.html
```

Before starting, please create a directory as shown above. This will be where we will store all our code.

### 2. Generate HTML pages
In flask, we use a *render_template* method to render any HTML page on our browser. This method will, first of all, look for a specific folder in the project's root folder called *templates*. All your html pages need to be placed in *templates* so that it can rendered correctly on your browser. Below is a snippet for a simple Hello World which I will write to templates/index.html.

```html
<!-- templates/index.html -->
<!DOCTYPE html>
<html>
  <head>
    <title>Hello World</title>
  </head>
  <body>
    <h1>Hello World!!</h1>
  </body>
</html>
```

### 3. Build flask application
After writing our rendering template, we have to pass this to our backend code for it to know when to return it to the browser. This page can be rendered when the user go to route '/' or '/test'. We need to specify this in our back-end code. Below you will find the snippet for our *app.py* file.

```
from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def hello():
  return render_template('index.html')

if __name__ == '__main__':
  app.run()

```
Compared to [previous article](https://dev.to/kouul/building-a-minimal-flask-application-290), we are importing a render_template method from flask and we are using this method to return our *index.html* file that we created earlier.

After you set this, you are good to go and run the application.

### 4. Run the app!
To run the app, simply run
```
python3 app.py
```

After that, open up localhost:5000 to see you newly written HTML page.


---

Thank you for reading and I hope this article was helpful. I will be seeing you in my next article.

Cheers!
Bulls and Cows game remake but with online/local multiplayer capabilities
Tags: gamedev, 2020grads, unity3d
Published: 2020-05-23 15:53:40

## Intro to Project

I enjoyed playing BullsAndCows with my friends but we had to do it using pen and paper as all apps I found were single player so I created my own.

## Code

https://github.com/MKSherbini/BullsAndCows


## Tools Used

C#, Unity and Photoshop

## Main Features 

The game supports multiplayer with different unique icons, a time limit per turn, various AI difficulties, and various facilities to make playing the game as enjoyable as can be.
The day I erased all the customer data
Tags: blunder, learning, beginners, career
Published: 2020-05-23 15:37:25

---
title: The day I erased all the customer data
published: true
description: 
tags: blunder, learning, beginners, career 
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/ck8zkgg66xnhfn135oaa.jpg
---
*Photo by Sarah Kilian on Unsplash*

This story takes place in a company where I previously worked. Back then, I was a young developer and I was tasked with the deletion of former customer’s data.

I checked the database and identified all the tables that would be impacted. Then, I wrote a SQL script to delete all the rows concerning this particular customer. 
This script was not directly executed in the production environment. Instead, all changes are included in a version control system tool equivalent to Liquibase or Flyway.

![done](https://i.giphy.com/media/CzbiCJTYOzHTW/giphy.webp)

A few days later, our support team received a phone call from a customer who could no longer find his data on the application. After performing an investigation, we came to the realization that all customer data were deleted from the database. The main culprit was none other than my SQL script. Indeed, some `DELETE` SQL statements were missing the `WHERE` clause. In the meantime, the ops team tried to restore the production database with the most recent backup.

At that time, I was petrified and I dreaded what my boss could say to me. 

![petrified](https://i.giphy.com/media/zdFNkQ6vGJADC/giphy.webp)

To my surprise, he did not single me out but blamed all the team and particularly our quality checks. In fact, he simply wanted to answer this question: How could this blunder have made its way to the production environment?

![done](https://i.giphy.com/media/3o7aTskHEUdgCQAXde/giphy.webp)

First of all, the SQL script was merged on the master branch, with at least 2 approbators on my pull request. So, it means that our code review was not thorough enough. 
Secondly, this script passed all our End to End tests and manual testing. 
Finally, we discovered that the database backup system was not working properly and the last available backup was at least 2 months old. Luckily, it had a fairly limited impact on our business, since it happened during summertime. 

In my opinion, we can learn two things about this little story. In the first place, a good team and a good manager will not put the blame on you if you have done a mistake. Everyone makes mistakes and it’s a good way to question some of the practices.
In the second place, it is important for a team to insure itself against the risk of fault, error or minor oversight. Despite quality processes, it’s important to test and prove those processes. 


*Thanks to Marc Barret for his time and his review*
Hindsight and automation
Tags: ansible, docker, vscode
Published: 2020-05-23 15:31:01

This was originally published on my blog https://www.redeving.dev/2020/05/hindsight-and-automation.html?m=1


The old adage of "hindsight is 20/20" is a wisdom so many of us forget until ... after. More flippantly, "sometimes we see better out our butts!" 

Case in point. Our Wifi, or rather our Rogers-black-box-of-magic, decided to die. The LAN ports anyways. Both flashing orange (one to the cable box -- I think my wife is now coming around to the cable cutting 🤞as this is the 3rd time in a month or so -- and one to my network.) So, nothing but cellular (I really should make an offering of an old cell phone to the cellular gods...)

Luckily my wife's iPad could use my Pixel 2 XL hotspot! But my laptop can't for some reason. Damn! But that brings me to my point. Hindsight.

I was so caught up in getting the laptop ready with a Docker image for development (see my post  https://www.redeving.dev/2020/05/can-hat-save-me-part-2.html?m=1 ) that I not only forgot to re-download a Docker image of Go, but I also forgot to install a local version of VSCode! Doh!

So instead of waiting for the delivery of the new (or whatever) Rogers modem and continuing my Go adventure, I'm doing some basic html\css stuff to put a basic drop-down menu on my blog with my text editor. All well and good (anyone remember using notepad for webdev?) but really? I am a dumbass!

Which brings us to the final point of automation. Ansible has been on my back burner for awhile now, but it has come to the top of the pile now. Then I can do bare metal deploys without all the manual stuff that, even with lists, can get stupid. Case in point!

Also, it's unexpectedly raining and thunderstorming so my outside Reno stuff is off (siding replacement around the new and smaller window -- one piece to cut, plus edging), inside Reno stuff (basement bathroom window and laundry room walls) is off since the weather gives my wife migraines, so no noise. Usually this would be great, more time to code!

But I limited myself, unnecessarily. If I had taken the time then, I wouldn't be in this pickle now.

Brain mantra ... ".. between noon and 2pm .. between noon and 2pm .. between noon and 2pm .. "  The birds seem to be fascinated by me spinning around in the backyard trying to kick my own butt....
DEV is monetized
Tags: webmonetization, gftwhackathon
Published: 2020-05-23 15:04:03

Has anyone noticed anything different about dev.to today?

I did. It is monetized.

![dev.to is monetized](https://dev-to-uploads.s3.amazonaws.com/i/td71kq23vrntkyit6udj.png)

DEV is going to be a platform for monetizing your posts.
Free Icons and Illustrations for designers to use for their projects and you can also earn 
Tags: icons, illustrations, animatedillustration, freetouse
Published: 2020-05-23 14:50:42

try this : https://iconscout.com/?referral_code=C5FWCNPRVUC


You can find every icons with different different patterns and colors. Also you can easily customize it. You can download png, svg or esp format so you can do changes as you need for you project.


Best thing is here you get all the icons and illustration so you don't need to find somewhere else.

I personally suggest iconscout. share your views or other site which you think is better.
ConfigMap and Secret as Kubernetes Volumes?! 🤔
Tags: kubernetes, devops, docker, tutorial
Published: 2020-05-23 14:46:49

ConfigMap and Secret components are **usually used for creating individual values**, which are passed as environment variables in the pod configuration.  

####But ConfigMap and Secret are also volume types, which people don't realize in the beginning. 💡####

Using ConfigMap and Secret as volumes is actually a common requirement, e.g. **think of applications that take configuration files** as parameter on startup. Like prometheus, elastic search or your own java application taking a properties file or certificate file.

The question is how to pass these config files to Kubernetes Pods?

In this video 🎬 I show you how to create these configMap and secret volumes and how to use them in pods. I give you some real-life use cases and show you the syntax of using volumes in a pod configuration. 🙌🏼

![ConfigMap and Secret](https://static.wixstatic.com/media/e7182f_e8024feaeca04ea590c526305b51b47b~mv2.png)

You can find the full video here:
{% youtube FAnQTgr04mU %}

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

I'm happy to connect with you on 🙂
- [Twitter](https://twitter.com/Njuchi_)
- [YouTube](https://www.youtube.com/channel/UCdngmbVKX1Tgre699-XLlUA?sub_confirmation=1)
- [Instagram](https://www.instagram.com/techworld_with_nana/)
Angular 9 + Material + Transloco + Jest + Compodoc
Published: 2020-05-23 14:41:12

Angular 9 Starter project with Material, Transloco, Jest &amp; Compodoc  
by [@wlucha](https://github.com/wlucha)

**Project**  
You can find the project here:  
https://github.com/wlucha/angular-starter  
  
## Features    
✅ Angular 9+   
✅ Angular Material Theming  
✅ Jest Unit Testing  
✅ Internationalization with Transloco  
✅ Auto documentation with Compodoc  
✅ Analyse your project with webpack-bundle-analyzer  

## Deploy
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)

## Table of Contents
- [Demo](https://stackblitz.com/github/wlucha/angular-starter)

## Install / Development

```bash
git clone https://github.com/wlucha/angular-starter
cd angular-starter

# Install dependencies
npm install

# Start server
npm run start

# Open in browser: http://localhost:4200
```

## Commands
- `npm run start`             - start the app
- `npm run test`              - run unit tests
- `npm run build`             - build the project
- `npm run build:prod`        - build the project in production mode
- `npm run build:prod:stats`  - build the project in product mode with stats
- `npm run analyse`           - analyse bundle with [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer)
- `npm run compodoc`          - generate [compodoc](https://github.com/compodoc/compodoc) documentation
- `npm run changelog`         - generate changelog
How I cloned Chatible for my school
Tags: octograd2020, githubsdp, node, chatible
Published: 2020-05-23 14:40:27

If you don't know what Chatible is, it's a Messenger bot that allows you to chat with someone random. I love its idea, but I don't want to chat with a total stranger. It would be great if we have something in common. Studying at the same school sounds good, so I cloned Chatible for my school, which I call PTNK Chatible (PTNK stands for my school name).

## Demo
[PTNK Chatible](http://m.me/ptnkchat)

Currently only Vietnamese is supported. English will be added soon.

## Source code
{% github https://github.com/ptnkchat/ptnkchat %}

## How I built it
PTNK Chatible is written in TypeScript, run on Node.js.

[express](https://www.npmjs.com/package/express) is used to handle webhook events from Facebook.

[phin](https://www.npmjs.com/package/phin) is used to send messages to Facebook. I have tried many HTTP clients and found that [phin](https://www.npmjs.com/package/phin) suits me best. It's lightweight, fast, and supports async/await.

The database is the most interesting thing. Data is stored in MongoDB Atlas. [mongoose](https://www.npmjs.com/package/mongoose) is used to interact with MongoDB Atlas. However, MongoDB Atlas is slow. To work around this, I store the entire database in [megahash](https://www.npmjs.com/package/megahash), a super-fast C++ hash table with wrappers for Node.js.

I have plan to switch to a proper cache module. I'm considering [node-cache](https://www.npmjs.com/package/node-cache).

For deployment, I use Heroku Hobby Dyno from GitHub Student Pack.

## Final Thoughts
I want to express my gratitude to GitHub and Heroku. This project will be much harder to complete without them.
Try using swagger-ui
Tags: swagger, docker
Published: 2020-05-23 14:36:30

Hi all,
I try using [swagger-ui](https://github.com/swagger-api/swagger-ui) on docker. It is too easy to build.

## github
[https://github.com/katsuya-n/docker-swagger-ui](https://github.com/katsuya-n/docker-swagger-ui)

## environment
docker image : [swaggerapi/swagger-ui](https://hub.docker.com/r/swaggerapi/swagger-ui)

directory structure
```
.
├── docker-compose.yml
└── swagger
                  └── api.yaml
```


# 1. make docker-compose.yml

```yaml
version: '3.3'
services:
  swagger-ui:
    image: swaggerapi/swagger-ui
    container_name: swagger-ui
    ports:
      - "8001:8080"
    volumes:
      - ./swagger:/usr/share/nginx/html/swagger
    environment:
      API_URL: swagger/api.yaml
```

If you use port number 8001, you should change other.
Acocording to my research, docker swagger-ui image seems to use nginx. So,  file path is `/usr/share/nginx/html/swagger`.

#2. make swagger directory and api.yaml
If you just want to build swagger-ui, I recommend copy [swagger editor sample](https://editor.swagger.io/) and paste in api.yaml.

# 3. build
Run docker command.
`docker-compose up -d`

You check [http://localhost:8001/](http://localhost:8001/) when docker build is completed.


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

# how to edit api.yaml?
By the way, do you think it is not easy to edit yaml file?
If you use Visual Studio Code, you can use [Swagger Viewer](https://marketplace.visualstudio.com/items?itemName=Arjun.swagger-viewer). It can see preview of editing file in real time and is comfortable.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8ciaj24v9gtevwk3vl04.png)
Errors while installing a Gatsby blog starter 
Tags: help, blog, webdev
Published: 2020-05-23 14:35:15

Hey devs, I really need help on my project which I am about to use Gatsby netlify CMS for the set-up but is not working fine. I need guide to walk through it. I really appreciate your comments. And if you really know how to set up a tech blog too kindly drop comments. Thank you
The making of "Simon Draws!"
Tags: octograd2020, devgrad2020, swiftstudentchallenge, wwdc2020
Published: 2020-05-23 14:35:14



## Introduction

"Simon Draws!" is one of the last projects I've worked on while being a high-school student. This project started out as my submission for this year’s [WWDC](https://developer.apple.com/wwdc20/). Every year Apple creates a [Swift Student Challenge](https://developer.apple.com/wwdc20/swift-student-challenge/) (also known as a Scholarship), where students are encouraged to showcase their love of coding and creativity through a 3 minutes playground app.

## Idea

This project is a fun game of memory 🧠 combined with drawing ✍️ that integrates on device machine learning to create a personalized experience for each user. Here's the gist of it:

* First of all, you will have to tell Simon which theme of symbols you prefer.
* Draw each symbol a couple of times, so that Simon can familiarize and understand your drawing style.
* Afterward, you will be shown a sequence of symbols and your task is to draw them in the same order as they are presented to you.
* Play. Repeat. Play 😝

You can checkout a youtube video that showcases the game.
{% youtube KyiXl2NFWHg %}

## How I built it?

The development has been split up into 3 core parts:

1. UI & UX
2. Drawing Canvas
3. Machine Learning Model


#### 1. UI & UX

The primary UI framework is [SwiftUI](https://developer.apple.com/documentation/swiftui). Its functional programming and state paradigms made it a breeze to keep track of game states and create "liquid smooth" animations.

Furthermore, to create an immersive experience while playing, I've added sound effects to most of the user interactions using [AVFoundation](https://developer.apple.com/documentation/avfoundation). An example of this is the sound of a pencil scratching a paper while drawing or the "whoosh" transition.

{% soundcloud https://soundcloud.com/user-324175970/pencilsound %}
{% soundcloud https://soundcloud.com/user-324175970/whooshsound %}


#### 2. Drawing Canvas

Since this is an app that revolves around the user drawing symbols, it meant that the drawing canvas is an essential part of the user interface. Through careful and intentional design, I've made all of the interactions, like picking, playing, and restarting, available via the canvas interface. 

Regarding the actual implementation, [PencilKit](https://developer.apple.com/documentation/pencilkit) not only enabled the user to make his own sketches, but also create a genuine and natural drawing experience.


#### 3. Machine Learning Model

The ML Model is a drawing classifier that recognizes new drawings based on a K-Nearest Neighbors model (KNN). By using on device machine learning, the model gets updated in real time and creates a personalized experience for each user.


## Try it yourself! 🕹 

If you feel like trying the game yourself you can find all of the source code and steps to install on Github.

{% github https://github.com/Pondorasti/SimonDraws %}
Use full spread operation in JavaScript
Tags: javascript, es6, 100daysofcode
Published: 2020-05-23 14:32:51

---
title: Use full spread operation in JavaScript
published: true
description: Learn practical use case of Spread Operation
tags: javascript, es6, JS, 100DaysOfCode 
---

![8 Use full spread operation](https://miro.medium.com/max/1400/1*ck6Fs5k54T8Yv09D2dS0jA.png)

Learn more 5 examples [here](https://javascriptjeep.com/js-spread-syntax/)
Handwritten Digit Recognition using KE Sieve Neural Network
Tags: octograd2020, machinelearning, patternrecognition, python
Published: 2020-05-23 14:04:31

  
## My Final Project  

Different people in the world write the digits in different ways. Identifying these handwritten digits and classifying these digits is a big issue. This project recognizes the handwritten digits using KE SNN algorithm. 

## Demo Link

One can try this at - https://api.alpes.ai/digit/

## How I built it

The whole data of handwritten images are stored in the data set called MNIST. This database of handwritten digits has a training set of 60,000 examples and a test set of 10,000 examples. The MNIST data is collected from the large dataset called NIST. It is a subset of NIST. The digits in the dataset have been size-normalized and converted to fixed-size images. The images were centered in a 28x28 image by computing the center of mass of the pixels, and translating the image so as to position this point at the center of the 28x28 field. In MNIST the train and test data files contain grayscale images of all the digits that are from zero to nine. For each digit the train and test data files are unique. Each image is 28 pixels in height and 28 pixels in width, for a total of 784 pixels in total. Each pixel has a single pixel-value associated with it, indicating the lightness or darkness of that pixel, with higher numbers meaning darker. This pixel-value is an integer between 0 and 1. The trainset of MNIST data is used to train the non-iterative algorithm and then the model is used to test. This whole model is deployed as API. 


Image Source - https://en.wikipedia.org/wiki/MNIST_database