teleren/devto huggingface dataset:
Build Cool APIs In Express and TypeScript
Tags: node, typescript, javascript, programming
Published: 2021-04-15 12:57:29

Node is a run-time environment that makes it possible to write server-side JavaScript. It has gained widespread adoption since its release in 2011. Writing server-side JavaScript can be challenging as a codebase grows due to the nature of the JavaScript language; dynamic and weak typed.

Developers coming to JavaScript from other languages often complain about its lack of strong static typing, but this is where TypeScript comes into the picture – to bridge this gap.

TypeScript is a typed (optional) super-set of JavaScript that can help with building and managing large-scale JavaScript projects. It can be thought of as JavaScript with additional features like strong static typing, compilation, and object-oriented programming.

### How we start a new Express and TypeScript project?

The main idea is how to build applications with Express and TypeScript 🤔 ?

In Kutia we have created a project starter that allows you to have all the right configurations and just start dealing with business logic and not waste time on project configurations 🤪.

### What are the features of this project starter?

Some of features that project contains are:

Beautiful Code 🚀.
Dependency Injection ❤️.
Simplified Database Query 👌.
Clear Structure with different layers such as controllers, services, repositories, models, middlewares 🙋‍♂️.
Easy Exception Handling 👋.
Smart Validation ✔️.
Easy event dispatching 😍.
Fast Database Building with migrations 😜.
Easy Data Seeding with our own factories 🍏.
Auth System 🚗.
Docker 🐳.
Class-based to handle WebSocket events 🎉.
Class-based to handle Cron Jobs 💼.
API Documentation 📝.
GraphQL 📈.
Queue Jobs 🚧.

### How to install the starter project?

You can check all details of a project on GitHub, but to install a project in a short way, you need to: Clone from GitHub, Run npm install and npm run dev.

### Now what?

Now you have a project with Scalable structure, Error handling, Authentication, etc.

Also, you are ready to connect your API with cool javascript clients using the [latest](https://facebook.github.io/react/) [sexy](https://angular.io/) [frameworks](https://vuejs.org).

### Original Article

https://kutia.net/build-cool-apis-in-express-and-typescript/
When Your App Needs a Major Update
Tags: webdev
Published: 2021-04-15 12:57:02

Numerous software upgrades concentrate on bug fixes, polish, tweaks, and perhaps the addition of a minor function. Rarely, a significant change occurs, such as an app switching from version 1.0 to 2.0 or 7.0 to 8.0. For example, in the last year, both Instagram and Uber made significant product changes that significantly altered their user interfaces.

Significant software improvements may involve a whole revamped user model, a redesigned graphic interface, or a slew of new functionality. There are some indicators that the app is due for a significant upgrade. Not all the above conditions must be met for your app to need an upgrade.

Notable App Function
An easier way to determine whether it is time for a new software upgrade is to look at the app’s features. If you want to introduce a significant function that substantially affects your app’s user interface, you will need a considerable upgrade. Essential features may involve security and cross-platform syncing, the addition of a shared or interactive component, collaboration with a third-party provider, or a change in the app’s business model.

More broadly, introducing a new element may have little effect on the minor version number, which is the second number in the series. Adding 3D Touch or improved offline functionality, for example, may suffice to upgrade an app from version 1.0 to version 2.0. Thus, when incorporating a substantial app function may catalyze a significant upgrade, it may also be combined with one of the following factors.

New Design for the App
If you are looking to make significant changes to the app’s architecture, whether it’s the user interface or graphic design, you’ll undoubtedly need to release a new upgrade. The latest illustration of this strategy is the significant upgrade to Gmail for iOS that was just rolled out. Version 5.0 incorporates Material Design, improves the interface, and adds new functionality such as scanning.

Read original source: https://www.aalpha.net/articles/how-to-know-when-your-app-needs-a-major-update/
Five backend books you should read in 2021.
Tags: backend, productivity, books, node
Published: 2021-04-15 12:52:53

---
title: Five backend books you should read in 2021.
published: true
description: 
tags: #backend #productivity #books #node
//cover_image: https://www.developereconomics.com/static/85998943ef43781cf8d21581aa5389a1/9e575/Books_backend_blogpost_cover.jpg
---
Powering up your backend knowledge? Our friends at  [Packt](https://www.packtpub.com/)  have shared five backend books you should read in 2021.

[Node Cookbook, Fourth Edition](https://packt.live/39WoZzx)

Discover solutions, techniques, and best practices for server-side web development with Node.js 14

What reviews say:

_“Want to learn Node.js, brush up on your skills, or discover the latest features of Node 14 and beyond? This book is for you! Written by a senior developer and Red Hatter, With a thorough presentation of everything Node, Bethany Griggs delivers from cover to cover in this latest Node Cookbook edition._  “

[Node.js Web Development, Fifth Edition](https://packt.live/2YSg3Vs)

Server-side web development made easy with Node 14 using practical examples

What reviews say:

_“This book is great. I had some knowledge about full-stack JavaScript, but this book has already taught me a lot. I wouldn’t say that this book is for a complete beginner to software development (coding), but it’s definitely good if you need to deepen your understanding of JavaScript, or if you’re interested in getting started with JavaScript from another backend language like Python, C#, Ruby, etc.”_  [ASP.NET Core 5 and React](https://packt.live/2Z29Ztr)

Full-stack web development using .NET 5, React 17, and TypeScript 4

What reviews say:

_“The book had a very methodical approach to building single-page applications through React. I am familiar with React and .NET separately and partly why I could pick up the concepts in the book faster but I believe otherwise too, things are laid out very clearly. Recommend it for beginners.”_  [Full-Stack React, TypeScript, and Node](https://packt.live/3rsqNWI)

Build cloud-ready web applications using React 17 with Hooks and GraphQL

What reviews say:

_“Nook has a philosophy of “learning by doing” “_  [Building Vue.js Applications with GraphQL](https://packt.live/3a14Wje)

Develop a complete full-stack chat app from scratch using Vue.js, Quasar Framework, and AWS Amplify

What reviews say:

_“This book is a fantastic deep dive into building an end-to-end application on AWS. I really like the fact that he dove deep into many topic areas, showing how to tie everything together to build something that is a real-world use case. The information in this book can also be used in many other areas so the knowledge is very transferable to other scenarios and use cases.”_

What titles do you recommend? Share your thoughts in the comments. Looking for more inspiration? Here are [more](https://developereconomics.com/blog/eight-must-read-books-for-developers-in-2021)  book recommendations.
Mocha.js - how to enable multiple test runners on CI/CD?
Tags: mocha, ci, cd, runner
Published: 2021-04-15 12:40:37

One of our projects is running automated tests on CI/CD AzurePipelines. 

For the test runner, AzurePipeline [supports several](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-test-results?view=azure-devops&tabs=trx%2Cyaml) test results templates but not the default Mocha spec one. 

This is why tests are running on the mocha Junit reporter producing the JUnit XML result. 

As there was a difference between running tests locally and on CI/CD environment, I wanted to debug the logs of the job. That what not possible as the Mocha JUnit reporter was not collecting console outputs/errors. 

Mocha.js does not support multiple runners right now. The solution for that was to introduce own runner, which combines both Mocha JUnit reporter and default spec Mocha reporter: 

```javascript
'use strict';

const Mocha = require('mocha');
const JUnit = require('mocha-junit-reporter');
const Spec = Mocha.reporters.Spec;
const Base = Mocha.reporters.Base;

// This is combination of spec (mocha normal) + junit reporter so both is displayed on azure
class AzurePipelinesReporter extends Base {
    constructor(runner, options) {
        super(runner, options);
        this._junitReporter = new JUnit(runner, options);
        this._specReporter = new Spec(runner, options);
    }
}
module.exports = AzurePipelinesReporter;
```

Then, the custom reporter can be used by specyfing the file name and flags to both reporters if needed: 

`mocha --reporter azurePipelinesReporter.js --reporter-options mochaFile=some_path_to_results`

Let me know if you had a similar problem, stay tuned for the next tips & tricks!

This blog post was original posted on https://brightinventions.pl/blog/mocha-js-how-to-enable-multiple-test-runners-on-ci-cd
Why you should learn about Higher Order Functions
Tags: javascript, beginners, functional
Published: 2021-04-15 12:39:09

#Introduction:

In functional programming languages like Javascript functions are values that means we can pass it around like others values like string, num. We can also assign it to a variable. Confused? Don’t worry here is an example
```
const square = function(x){
    return Math.pow(x, 2);
}

const findSquare = square;

findSquare(3); //will output 9

```
In the above example we have passed an anonymous function to the square variable then assign it to findSquare. Just like the above instance we can also pass function as an input to other functions. Now here Higher Order Functions comes into the picture.

#Higher Order Functions:
[Higher order function](https://developer.mozilla.org/en-US/docs/Glossary/First-class_Function) is the function which accepts other functions as an input. Looks complicated right? . Don’t worry it’s really simple. We will look at one of the most famous and simple higher order functions [.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). First we will take a sample array named cars to perform the operation. And then we will first perform the filtering operation using for() loop and then .filter() to see how easy is to perform the operation with more easily readable code.
```
const cars = [
    {mode: 'NISSAN VERSA' , type: 'SEDAN'},
    {mode: 'SUBARU OUTBACK' , type: 'STATION WAGON'},
    {mode: 'FORD MUSTANG' , type: 'COUPE'},
    {mode: 'AUDI A4 ALLROAD' , type: 'STATION WAGON'},
    {mode: 'KIA RIO' , type: 'SEDAN'},
    {mode: 'AUDI A7' , type: 'HATCHBACK'},
    {mode: 'TOYOTA AVALON' , type: 'SEDAN'},
    {mode: 'AUDI A5' , type: 'COUPE'},
    {mode: 'HONDA ACCORD' , type: 'SEDAN'},
    {mode: 'KIA STINGER' , type: 'HATCHBACK'}
]
```
Now consider a case where we only want data related to type SEDAN. First we will see how to do this operation using for().

```
const SEDAN = [];
for(let i = 0 ; i < cars.length ; i++){
    if(cars[i].type === 'SEDAN'){
        SEDAN.push(cars[i]);
    }
}
//will return [{mode: "NISSAN VERSA", type: "SEDAN"},{mode: "KIA RIO", type: "SEDAN"},{mode: "TOYOTA AVALON", type: "SEDAN"},{mode: "TOYOTA AVALON", type: "SEDAN"}]
```
  Now let’s see using .filter() method
```
const SEDAN = cars.filter((car) => {
    return car.type === "SEDAN"
})
```

The difference between both methods is not drastic but there is some difference. The code written using .filter() is more readable.Also the .fiter() does not change the  original array, it returns a new array which contains the values which have satisfied the filter condition. This is an important part if you are learning React Js as states in react are immutable higher order functions like .filter() are preferred.

#Advantages 
* It is much easier to understand the program and the intention of the programmer is clearly expressed in the code. 
* Functions which take functions as arguments are much easier to re-use than other functions.
I'm live-streaming dev & launch of an app to prank my family
Tags: youtube, html, webdev, livecoding
Published: 2021-04-15 12:36:26

Hey all!

I've built and launched a few things on Product Hunt now. My most recent launch [made it to the front page](https://www.producthunt.com/posts/melody-generator). I thought it would be fun to document my process developing and launching a full app over the course of a day. I'm going to do all of the coding, deployment, and launch live on the YouTube stream below.

I'm starting in 12 hours time at 9am local time, and going through until 3pm when San Francisco clicks over to midnight and I can launch on PH.

Hope you can drop by!

{% youtube KWBljrPdQc4 %}
My FLOSS Project is Launched! Come and Help!
Tags: project, opensource, php
Published: 2021-04-15 12:34:50

Hey!

I've started a small project that aims at helping organizations easily manage their interns. The main idea is to manage interns' attendance, but we might add new features as requested.

The app is standalone that you can install on your local server or even computer.

The technical stack is Docker, PHP, MySQL...

Do use it and let me know things we can improve. 

You can also contribute code as well.

The code is [here](https://github.com/Bam92/gestion-stage).
What's the best strategy to get contributors and stars on a repository?
Tags: github, embedded, opensource, startup
Published: 2021-04-15 12:34:45


Hi there, I got a (stupid?) question. I'm developing an open-source and real-time architecture for embedded applications, and now I'm searching for stars and contributors. To encourage people to star and participate I:

* Add an open-source license
* Add a description + readme + docs
* Add code of conduct + contributing guide + issue template

But the magic didn't happen 😥 What are your strategy/recommendations to make it operate?

(Here is my repo if you want to have a look at it ➔ https://github.com/Luos-io/Luos)
Using the WordPress in_category() function
Tags: wordpress, webdev, php
Published: 2021-04-15 12:28:26

My biggest project at work is the [Delaware COVID-19 information website](https://coronavirus.delaware.gov/). It is built in WordPress. 

I recently had a problem to solve where I wanted alert boxes to automatically display in the language that the page was translated into. We have pages in the three most spoken languages in Delaware: English, Spanish, and Haitian Creole.

I decided to approach it by assigning specific categories to the Spanish and Haitian Creole pages. I was then able to use the WordPress [in_category()](https://developer.wordpress.org/reference/functions/in_category/) function to identify which categories that page belonged to.

This applied to single pages, so in page.php, my code looked something like this:

```
<?php
   if(in_category('spanish')) {
      include 'includes/spanish-file.php';
   } elseif(in_category('haitian-creole')) {
      include 'includes/haitian-creole-file.php';
   } else {
      include 'english-file.php';
   }
?>
```

This if statement first looks to see if the category assigned to the page is "spanish", and if it is, then the [PHP include](https://www.php.net/manual/en/function.include.php) function displays the content within spanish-file.php.

If the category is not "spanish", then it looks to see if it is "haitian-creole", and if it is, then it displays the contents of haitian-creole-file.php.

If the category doesn't match either of those, then it displays english-file.php.

The majority of pages on the website are in English, so I didn't feel the need to assign an English category and simply included it in the "else" condition for all pages that had neither "spanish" or "haitian-creole" assigned to it.

I wrote this function in the page.php file. I'm sure there are arguments against doing that. If you wanted to, you could also define it as a function in the functions.php file and then call the function in page.php. If you did it that way, it would look something like this:

In functions.php:

```
<?php
   function multi_language_page_files() {
      if(in_category('spanish')) {
         include 'includes/spanish-file.php';
      } elseif(in_category('haitian-creole')) {
         include 'includes/haitian-creole-file.php';
      } else {
         include 'english-file.php';
      }
   }
```

No closing PHP ?> tag needed in the functions.php file.

Then, you would call the function in page.php:

`<?php multi_language_page_files() ?>`

I hope this helps. I was not previously aware of the in_category() function before I found it yesterday. It is extremely helpful in this case!
PHP <=> 연산자(Spaceship operator)
Published: 2021-04-15 12:20:09

PHP 7.0.x에 추가된 비교 연산자이다.
딱히 우리말로 옮기기 어색하다. 우주선 연산자?

이 연산자는 두 개의 표현식(정수 또는 실수, 문자)를 비교하여
- 앞의 것이 크면 1, 
- 같으면 0,
- 뒤의 것이 크면 -1
을 반환한다.

## 사용 예:

```
// Integers
echo 1 <=> 1; // 0
echo 1 <=> 2; // -1
echo 2 <=> 1; // 1

// Floats
echo 1.5 <=> 1.5; // 0
echo 1.5 <=> 2.5; // -1
echo 2.5 <=> 1.5; // 1
 
// Strings
echo "a" <=> "a"; // 0
echo "a" <=> "b"; // -1
echo "b" <=> "a"; // 1
```

[출처](https://www.php.net/manual/en/migration70.new-features.php)
Daily Developer Jokes - Thursday, Apr 15, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-04-15 12:00:08

---
title: "Daily Developer Jokes - Thursday, Apr 15, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Thursday%2C%20Apr%2015%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258bb6df5f.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ What did the spider do on the computer?

___A:___ Made a website!
 -->
How to Automate Work Tasks Effectively in 2021
Tags: taskmanagementtool
Published: 2021-04-15 11:49:40

How to Automate Work Tasks Effectively in 2021
Task Automation Tool
Task automation is the need of the hour. As per the Mckinsey survey, task automation enables us to free up 30% of the time while working on daily tasks. Evolving technology has given us a few excellent team task management tools or software to automate repetitive, manual tasks. What’s more, we can monitor the real-time status of those tasks in the tool as well. Simply put, task automation is aimed at implementing and monitoring tasks with minimal human effort. 

We can make a long list of the benefits of task automation in today’s fast-paced business scenario. On one hand, automation can reduce the probability of human mistakes significantly, and on the other hand, it can save a lot of time for your employees.  Your employees can effectively use this time on other productive tasks with a more focused approach. While automating tasks using feature-rich task management software, you can grab new business opportunities and reduce the overall operational expenses without compromising on quality. 

Original Source: https://www.taskopad.com/blog/automate-work-tasks-effectively-in-2021/
Types of Clustering Algorithms...
Tags: machinelearning, datascience, beginners, opensource
Published: 2021-04-15 11:57:18

We all know what is clustering. For revision.....

**Clustering:**It is the task of dividing the population or data points into several groups.

There are two types of clustering 1. Hard Clustering  2. Soft Clustering. 

And there are four types of algorithms also which are...

1) **Connectivity Model:** As the name suggests, these are the models based on the definition that the data points closer in data space exhibit more similarity to each other than the data points lying farther away.

There are two approaches in this type...

I. Start with classifying all data points into separate clusters and then aggregating them as distance increases.

II. All the data points are classified as a single cluster and then partitioned as the distance increases.

Ex: Hierarchical Algorithm, etc.

2) **Centroid Models:** These are the iterative clustering algorithms in which the notion of the similarity is derived by the closeness of data points to the centroid of clusters.

Ex: K-Means Algorithm, etc.

3) **Distribution Models:** These clustering models are based on the definition of how probable is it that all the data points in the cluster belong to the same distribution. This type of model often leads to overfitting.

Ex: Expectation-Maximization Algorithms, etc.

4) **Density Models:** These models search the data space for areas of the varied density of data points in that data space.

Ex: DBSCAN & OPTICS, etc.

The short explanation for hard and soft clustering can be..

1. **Hard Clustering:** In this, each data point either belongs to a cluster complexity or not.

2. **Soft Clustering:** In this, instead of putting each data points into a separate cluster, a probability or likelihood of that data point to be in those clusters is assigned.
Exploring Deque in Swift Collections
Tags: swift, swiftdeque, dequesinswift, swiftarrays
Published: 2021-04-15 11:54:11

Deque (should be pronounced as "deck") is a collection implementing double-ended queues. Deques are similar to arrays, but they have efficient insertions and removal of elements at the beginning and at the end. 

The indexing semantics are integer indices that are the same as arrays. 
Now let's see a sample implementation of deque. 

```
var colors: Deque = ["Yellow", "Orange"]
print(colors) // [Yellow, Orange]
```

The above code implements a deque of colors with the strings yellow and orange. 

## Deque operations
Now let's see some operations or methods unique to deques. 

#### 1. prepend - Adding an element at the beginning of the deque.

```
colors.prepend("Blue") // Blue is added to the beginning
```

#### 2.  append - Adding an element to the end of the deque. 

```
colors.append("White") // White is added to the end
```

#### 3. popFirst - Removal of an element from the beginning of the deque.

```
let _ = colors.popFirst() // Blue is removed
```


#### 4. popLast - Removal of an element from the beginning of the deque.

```
let _ = colors.popLast() // White is removed
print(colors) // [Yellow, Orange]
```

[This article was originally published at ohmyswift.com. Click here to read the full article.](https://ohmyswift.com/blog/2021/04/14/exploring-deque-in-swift-collections/)

### About the author 👨‍💻
Rizwan Ahmed — iOS Engineer. 
Twitter 👉 <https://twitter.com/rizwanasifahmed>
Like our articles? Support us 👉<https://www.buymeacoffee.com/ohmyswift>