teleren/devto huggingface dataset:
Dependency
Published: 2019-12-10 03:24:00

โค้ดที่เขียนไม่ตรงมาตรฐาน ปั่นงานให้เสร็จ ไม่ได้แก้ยากเลย แต่โค้ดที่มีส่วนอื่นๆ ของระบบใช้มันเยอะต่างหากที่แก้ไขยาก และถ้าตรงนั้นยุ่งเหยิงจะยิ่งแก้ไขยากขึ้นอีกหลายเท่า

แล้วโค้ดที่มี Dependency เยอะเกิดได้ยังไง? ก็เกิดขึ้นเพราะมันเป็นฐานรากของ Use case ของคนใช้ เช่น ถ้าระบบคุณต้องการความปลอดภัย Authorize service ก็จะเป็นฐานรากไปอยู่แล้ว ถ้าคุณทำระบบที่เกี่ยวข้องกับการเงิน ตัวตัดบัญชีก็เป็นฐานราก  

แล้วคุณจะรู้ได้ยังไงว่าโค้ดส่วนไหนจะ Use case ฐานรากในระบบ ก็มีสองทาง คือ ปล่อยระบบเล็กๆ ออกไปเทสก่อน ดูว่าส่วนไหนคนใช้เยอะ คนอยากให้ต่อเติมเยอะ ตรงนั้นก็จะเป็นฐานราก หรือไม่งั้นก็คือคุณใช้ความเชี่ยวชาญในโดเมนมาตัดสินใจ

ซึ่งความเชี่ยวชาญในโดเมน ก็มีทั้งโดเมนทางเทคนิคและโดเมนทางธุรกิจ เช่น คุณรู้อยู่แล้วในฐานะ Software developer ว่า Input validation ต้องเป็นฐานรากที่ขาดไม่ได้ หรือต้องมี API จากหลังบ้านปล่อยออกไป กับโดเมนทางธุรกิจเช่น ทำระบบ ERP สุดท้ายต้องมาอยู่กับบัญชี

หลายคน พยายามรีบตัดสินใจว่าอะไรเป็นฐานราก ซึ่งอาจจะคิดเอาเอง หรือบังคับให้ User/Stakeholder/Etc. ที่ไม่ได้เป็น Domain expert จริง รีบตัดสินใจให้ ซึ่งก็มักจะผิด วางสิ่งที่ไม่ใช่ฐานไปเป็นฐาน แล้วก็มักจะต้องรื้อ หรือที่แย่กว่าเลยคือคุณกำลังทำงานในโดเมนใหม่ที่ไม่มี Expert แต่เรียกร้องโวยวายให้ต้องมีให้ได้ ก็จะมีตัวปลอมเกิดขึ้นเพื่อสนองนี้ดนั้น แล้วให้ข้อมูลผิดๆ

ตรงข้าม พอทำแบบไปตัดสินใจทีหลัง ก็ลืมมอง Dependency graph ของตัวเองว่าถึงจุดนี้เราต้องตัดสินใจแล้วนะว่านี่คือฐานราก  จนกลายเป็นว่าโค้ดพันกัน แล้วต่อให้ทำ Code ได้มาตรฐานขนาดไหน แต่ Track ไม่ได้ว่าแก้ตรงนี้กระทบอะไรบ้าง ก็แก้ไขยากอยู่ดี

เรามี Design ที่ไว้จัดการ Dependency มาก แต่จะเลี่ยง Dependency ได้ยังไงตั้งแต่แรก?


มีโค้ดชุดนึงอารมณ์ประมาณว่า
```javascript
function X () {
  DoA()
  DoB()
  DoC()
}

function Y () {
  DoQ()
  DoB()
  DoZ()
}
```

```csharp
class X () {
  public Execute() {
    A.Do();
    B.Do();
    C.Do();
  }
}

class Y () {
  public Execute() {
    Q.Do();
    B.Do();
    Z.Do();
  }
}
```

ถ้าเราไม่พยายามเลี่ยง Dependency เราเห็นโค้ดชุดนี้เราอาจจะ Abstract ออกมาเป็น

```javascript
function AdvanceB(preB, postB) {
  preB()
  DoB()
  postB()
}
```

```csharp
class BExecutor extends Executor {
   public constructor (DoObj preObj, DoObj postObj) {
     this.preObj = preObj;
     this.postObj = postObj;
   }

   public Execute() {
     preObj.Do();
     B.Do();
     postObj.Do();
   }
}
```

แล้วจับให้ X กลายเป็น `AdvanceB(DoA, DoB)` หรือ `BExecutor(A, B)`

แต่พอกลายเป็นว่างาน X ต้องเอาผลลัพธ์จาก B มาใช้ยิงเข้า postObj ส่วนงาน Y ไม่ต้อง 

ฐานรากที่ชื่อว่า BExecutor ที่เราวางไว้ก็พัง

นี่คือตัวอย่างของการมีฐานรากที่เร็วเกินไป

ซึ่งการสร้าง Class Executor แล้วใช้ Polymorphism ในการวาง General case สำหรับงานทำ B มันเป็นวิธีการจัดการ Dependency ที่ดีนะ มีสอนกันก็เยอะ เป็น Practice ที่ยอมรับกันเป็นมาตรฐาน

**แต่ที่เหนือกว่าการจัดการ Dependency ที่ดีคือการเลี่ยง Dependency ที่ไม่จำเป็นตั้งแต่แรกเลย มีให้น้อยที่สุด มีเท่าที่จำเป็นจริงๆ เท่านั้น**

สวัสดีครับ
How to be productive as a developer using your andriod device
Tags: softwaredevelopment, programming, coding
Published: 2019-12-10 03:21:36

---
title: How to be productive as a developer using your andriod device
published: true
description: 
tags: #Softwaredevelopment #Programming #coding
---

Andriod Operating System runs on Linux Kernel. As a Software Engineer whose main desktop environment is Linux, I find it easy working with termux, a mobile terminal that allows you to turn your Andriod device into a working environment. With termux, you can install all the command line tools needed for you to start your coding journey on mobile. As someone coming from the background of wapka.mobi, I’m used to coding on mobile. Why don’t you try it out today? I strongly believe you will be thrilled that you can actually continue your coding journey without a laptop or desktop. Get Termux from Google’s playstore. Run apt update && apt upgrade

Note: make sure you have internet access, and you should also verify that  coreutils is installed on termux by typing  apt install coreutils.

To install nodejs, simply type this command apt install nodejs.

Source https://anibesam.com/how-to-be-productive-as-a-developer-using-your-andriod-device/
Big list of Ruby Web Frameworks
Tags: ruby, rails, sinatra, padrino
Published: 2019-12-10 02:11:00

Web Frameworks are important for any programming language especially today when more and more of the applications we use are based around the web whether delivered by a desktop browser, mobile browser, mobile application or through IoT devices.

So in a previous article, I covered the world of Javascript/Typescript web frameworks and I’ll continue to do the same for other languages so developers can find the array of options available to them.

Some frameworks are minimalist and offer just the basics to get a web server up and running, some are robust and have built-in tools for authentication, session management and more, some are built mainly for creating an API that can serve single page applications, mobile applications and devices.

# Here is the List of Ruby Web Frameworks
Ruby on Rails — “Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.”

Sinatra — “Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort”

Pakyow — “Hello, Web. Pakyow is a web framework that helps you turn your html into a complete web app. We set out to design a better way to build for the web. This is the result — a full stack of open-source frameworks that offers a simpler, design-first approach. We want to help you do more with what you already know, whether you’re just starting out or have been building for the web for years.”

Midori — “Midori is a Ruby Web Framework, providing high performance and proper abstraction.”

Busker — “An extremely simple web framework. It’s called Busker as a reference to Sinatra. It mimics Sinatra in some aspects while still trying to stay a true wanderer of the streets.”

Utopia — “Utopia is a website generation framework which provides a robust set of tools to build highly complex dynamic websites. It uses the filesystem heavily for content and provides functions for interacting with files and directories as structure representing the website.”

Ovto — “Client-side web framework for Opal”

Flame — “Client-side web framework for Opal”

Ditty — “Ditty provides an extra layer of functionality on top of Sinatra to give structure and basic tools to an already great framework. You can get a new application, with user authentication and basic CRUD / REST interfaces, up and running in minutes.”

Waxx — “The Waxx Framework is a high perfomance, functional-inspired (but not truly functional), web application development environment written in Ruby and inspired by Go and Haskel.”

Woah! — “Woah! is an unobtrusive, (extremely) minimal web framework built on Rack.”

Lux-FW — Explicit Rack Based Framework
Big List of GO Web Frameworks
Tags: go, buffalo, mux
Published: 2019-12-10 02:09:53

Web Frameworks are important for any programming language especially today when more and more of the applications we use are based around the web whether delivered by a desktop browser, mobile browser, mobile application or through IoT devices.

So in a previous article, I covered the world of Javascript/Typescript web frameworks and I’ll continue to do the same for other languages so developers can find the array of options available to them.

Some frameworks are minimalist and offer just the basics to get a web server up and running, some are robust and have built-in tools for authentication, session management and more, some are built mainly for creating an API that can serve single page applications, mobile applications and devices.

# Here is the List of GO Web Frameworks
Mux — “Package gorilla/mux implements a request router and dispatcher for matching incoming requests to their respective handler.”

Buffalo — “Buffalo helps you to generate a web project that already has everything from front-end (JavaScript, SCSS, etc.) to the back-end (database, routing, etc.) already hooked up and ready to run. From there it provides easy APIs to build your web application quickly in Go.”

Echo — “High performance, minimalist Go web framework”

Beego — “beego is an open-source, high-performance web framework for the Go programming language.”

DotWeb— “Simple and easy go web micro framework”

Revel — “A high productivity, full-stack web framework for the Go language.”

Goji — “Goji is a minimalistic web framework that values composability and simplicity.”

Gramework — “Gramework is a fast, highly effective, reliable, SPA-first, go-way web framework made by a fasthttp maintainer. You get the simple yet powerful API, we handle optimizations internally. We’re always glad to see your feature requests and PRs.”

Tigo — “A web framework developed in go language.”

Gear — “A lightweight, composable and high performance web service framework for Go.”

Gin — “Gin is a web framework written in Go (Golang). It features a martini-like API with performance that is up to 40 times faster thanks to httprouter. If you need performance and good productivity, you will love Gin.”

Aah — “A secure, flexible, rapid Go web framework”
Big List of Web Component Tools and Compilers
Tags: svelte, stencil, polymer, litelements
Published: 2019-12-10 02:08:51

Building components in frameworks like React, Angular and Vue are great if future projects will be within the same framework. Standard Web Components allow this to be the case. Below is a list of tools you can use to make standard Web Components you can use in any framework and application.

Hybrids — “Hybrids is a UI library for creating Web Components with a strong declarative and functional approach based on plain objects and pure functions.”

Stencil — “Stencil is a simple compiler for generating Web Components and progressive web apps (PWA). Stencil was built by the Ionic Framework team for its next generation of performant mobile and desktop Web Components.”

Svelte — “Svelte is a new way to build web applications. It’s a compiler that takes your declarative components and converts them into efficient JavaScript that surgically updates the DOM.”

React Web Component — “Create Web Components with React”

diffHTML — “diffHTML is a library that assists with creating user interfaces using JavaScript. These interfaces can be: applications, games, data visualizations, or anything else that you may want to render in a web browser.”

lit-element — “A base class for creating web components using lit-html”

Litedom — “At ~3.5kb gzip, it allows you to create Web Component/Custom Element easily. Litedom can effortlessy be added into exitsing HTML page, without the need to bring in the bloat of big frameworks.”

zUIx — “A lightweight JavaScript library to support you in creating amazing component-based websites and applications.”
My First Blog
Tags: blogging, personal
Published: 2019-12-10 02:07:27

---
title: "My First Blog"
published: true
description: "make sure you read the instructions"
tags: blogging, personal
cover_image: https://images.unsplash.com/photo-1471107340929-a87cd0f5b5f3?ixlib=rb-1.2.1&auto=format&fit=crop&w=1932&q=80
---

So this will be my starting point of my new adventure, venturing out the world of storytelling or in other words info spreader. (seem to like that word better)

I'm totally excited for this adventure!

# A little Background
### Who I Am In General
Im currently 18 (2019), a student of CITE Tech. Inst.,Inc. , here in the Philippines 🇵🇭. Im currently studying under Computer Engineering, and Im inspired to one day teach children the beauty of coding. Or just want to help the community in a way, how they helped me. 

### Why My Course
- I do love problem solving that was one main reason why i entered the world of coding and computer technology.

### Contact Me Anytime
Im open to any questions, or need someone to share too im there for you brother!

twitter: [@dylan_balagtas](https://twitter.com/dylan_balagtas)
github: [mcdylanb](https://github.com/mcdylanb)
Http Error 500.30 Ancm In Process Start Failure
Tags: iis, aspnetcore, dotnetcore, ancm
Published: 2020-01-25 22:42:52

---
title: Http Error 500.30 Ancm In Process Start Failure
published: true
date: 2019-12-10 00:00:00 UTC
tags: IIS,aspnetcore,dotnetcore,ancm 
canonical_url: 
---

## HTTP Error 500.30 - ANCM In-Process Start Failure

I host an [aspnetcore](https://dot.net/) website on a Windows Server 2012 R2 running IIS on Amazon AWS and it’s generally fast and stable.

However, the past two nights the server has restarted unexpectedly leaving the website down with the following error message:

```
HTTP Error 500.30 - ANCM In-Process Start Failure
```

The first night a simple `IISRESET` command was all that was needed to get the site running again, however, last night it did the same thing.

Looking at `Event Viewer` I noticed the following:

```
Application '/LM/W3SVC/2/ROOT' with physical root 'C:\Path\To\Website' failed to load clr and managed application. Managed server didn't initialize after 120000 ms.
```

So, doing some googling I came across an article suggesting that [An x86 app is deployed but the app pool isn’t enabled for 32-bit app](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/azure-iis-errors-reference?view=aspnetcore-3.1#an-x86-app-is-deployed-but-the-app-pool-isnt-enabled-for-32-bit-apps).

This suggests that:

```
For an x86 framework-dependent deployment (<PlatformTarget>x86</PlatformTarget>), enable the IIS app pool for 32-bit apps. In IIS Manager, open the app pool's Advanced Settings and set Enable 32-Bit Applications to True.
```

Following those instructions the setting in IIS I changed then looked like this:

![In IIS Manager, open the app pool's Advanced Settings and set Enable 32-Bit Applications to True](https://i.imgur.com/J5OvzM2.png)

An `IISRESET` for good measure and the site is back up again.

I still need to see why Windows is restarting at approximately the same time each night the past few nights but if it does I hope to have solved the `HTTP Error 500.30 - ANCM In-Process Start Failure` error.

Success? 🎉
Day 49 : Desires
Tags: hiphop, code, coding, lifelongdev
Published: 2019-12-09 23:57:07

_liner notes_:
- Professional : Pretty much did some research into how I want to structure the web components I want to build in the new year. Things like what the naming convention should be and how to break apart some apps into components. In the last meeting with my manager, he mentioned about putting together a list of various CLI tools that I like so we can have a basis and examples for what we would like to include into ours in the next year. Basically just taking notes, creating documents and putting together a presentation. I want to have Mondays be like my planning day for what I want to do during the week.

- Personal : Tomorrow I'm going to pick up my new van so I've been getting things ready for that. Like making sure my auto insurance will be transferred over. That I'll be able to use my debit card for the payment. So much stuff just to get a new vehicle. Right now, I'm outside where the Orlando Devs Holiday Party is happening trying to get some work done. The only thing I brought was my Pixel Slate. So I'm writing this blog from it. Kind of cool. I think I'm going to sign up to codesandbox.io with a paid account and see how far I can push this whole coding from a tablet thing. haha So, van and coding from a tablet... some of my desires are coming to life!

![mountain view over the clouds in Mount Tamalpais, CA, USA](https://thepracticaldev.s3.amazonaws.com/i/in236jrzw53ooiobud9m.png)

Hoping that everything goes smoothly at the car dealership tomorrow. I've read that it can take like 3 hours to complete everything! Getting back to work before this meetup.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube 9agX4xR6_YI %}
Don't let security vulnerabilities crawl into your Node.js Docker images
Tags: docker, scan, image, vulnerabilities
Published: 2019-12-09 23:29:16

---
title: Don't let security vulnerabilities crawl into your Node.js Docker images
published: true
description: 10 Docker image security best practices
tags: docker, scan, image, vulnerabilities
---

When we choose a base image for our Docker container, we indirectly take upon ourselves the risk of all the security concerns that the base image is bundled with.

This can be poorly configured defaults that don’t contribute to the security of the operating system, as well as system libraries that are bundled with the base image we chose.

> Based on scans performed by Snyk users, it was found that 44% of Docker image scans had known vulnerabilities, and for which there were newer and more secure base images available.

A good first step is to make use of as minimal a base image as is possible while still being able to run your application without issues.

This helps reduce the attack surface by limiting exposure to vulnerabilities; on the other hand, it doesn’t run any audits on its own, nor does it protect you from future vulnerabilities that may be disclosed for the version of the base image that you are using.

Therefore, one way of protecting against vulnerabilities in open source software is to use tools such as [Snyk](https://snyk.io/product/container-vulnerability-management/), to add continuous scanning and monitoring of vulnerabilities that may exist across all of the Docker image layers that are in use.

In action, a snyk test for a docker image:

![snyk test for security vulnerabilities in a docker image](https://snyk.io/wp-content/uploads/snyk-docker-scanning.gif)

To practice the same workflow you can use snyk to scan a Docker image for known vulnerabilities with these commands:

```
# fetch the image to be tested so it exists locally
$ docker pull node:10
# scan the image with snyk
$ snyk test --docker node:10 --file=path/to/Dockerfile
```

Monitoring vulnerabilities as they get discovered is not any less important than scanning them to begin with.

Monitor a Docker image for known vulnerabilities so that once newly discovered vulnerabilities are found in the image, Snyk can notify and provide remediation advice:

```
$ snyk monitor --docker node:10
```

Snyk also found that for 20% out of all Docker image scans, only a rebuild of the Docker image would be necessary in order to [reduce the number of vulnerabilities](https://snyk.io/blog/top-ten-most-popular-docker-images-each-contain-at-least-30-vulnerabilities).

---

This tip is part of a complete [10 Docker image security best practices](https://snyk.io/blog/10-docker-image-security-best-practices/) you should adopt. Thanks for reading and to [Omer Levi Hevroni](https://twitter.com/omerlh) who worked with me on it.

The original blog post includes a high-resolution printable PDF like the snippet you see below. [Check it out](https://snyk.io/blog/10-docker-image-security-best-practices/)
Handling async await
Tags: help
Published: 2019-12-09 22:58:07

I'm trying to implement a register system, and I have to validate the mail and check that it's not already being used by another account in the database. The problem is that the validator function for email must be asynchronous as the query is asynchronous, but the verifyUser function that among other things verifies the email must be a normal function.

## To the code! ##
```
async function _verifyEmail(User){
    const { email } = User;
    var isAvailable = await UserModel.countDocuments({email: email}).then(res => isAvailable = res > 0 ? false : true);
    var isValid = EmailValidator.validate(email)
    console.log(`isValid: ${isValid}`)
    console.log(`isAvailable: ${isAvailable}`);
    if(!!isValid || !isAvailable)
        return 400;
    else
        return 202;   
}

function _verifyUser(User){
    var emailStatus;
    _verifyEmail(User).then(res => {
        emailStatus = res;
        console.log(`res: ${res}`);
    });

    const passwordStatus = _verifyPassword(User);
    const nameStatus = _verifyName(User);
    const surnameStatus = _verifySurname(User);

    console.log(`email status: ${emailStatus}`);
    console.log(`password status: ${passwordStatus}`);
    console.log(`name status: ${nameStatus}`);
    console.log(`surname status: ${surnameStatus}`);

    if(emailStatus === 400 || passwordStatus === 400 || nameStatus === 400 || surnameStatus === 400)
        return 400;
    else
        return 202;
}
``` 

## The problem ##

When I run this code while every other parameter in _verifyUser is fine, emailStatus is unavailable since the _verifyEmail function returns after the if  computation. 

How can I solve this?
Laravel 6 Notification Tutorial
Tags: laravel, notification, tutorial, email
Published: 2019-12-09 22:48:23

Hello artisan, in this tutorial, i will show you how to send email notification in laravel 6. we will create laravel 6 notification to email address. we will send email to notify user using laravel 6 notification system.

Using laravel 6 notifications, you can send email, send sms, send slack message notification to user. in this example i give you very simple way to create first notification to send mail in laravel 6. we can easily create Notification by laravel artisan command.

We can easily customization of notification like mail subject, mail body, main action etc. we almost require to use notification when we work on large amount of project like e-commerce. might be you need to send notification for payment receipt, order place receipt, invoice etc.

In this example we will create email notification and send it to particular user, than we saved to database. So, you need to follow few step to make basic example with notification.

Read post https://codechief.org/article/laravel-6-notification-tutorial-create-notification-with-laravel-6