teleren/devto huggingface dataset:
pg-connection: using PostgreSQL on NodeJS
Tags: postgres, node, javascript
Published: 2020-12-24 11:24:30


You dont like the ways 'ORM' are on node for pg?
Do you wish it was simpler?




I never quite liked the ones ready at the moment so i started to use in my projects a structure tha i realized could become a project, and so i made the pg-connection.

A small postgres wrapper to simplify its use you devopment.

## Requirements
*Requires .env for configuration*

## How to use
It has basic 3 steps to use:

- Add the following props to your `.env`: 
PG_USER,PG_URL, PG_DATABASE, PG_PASSWORD, PG_SCHEMA; If you like or need you cand add PG_SSL, if not set the value is false, PG_PORT  if not set the value is 5432.
- At your Model, Entity, Table, or whatever you like to call it, extends ``@schirrel/pg-connection/Model`` and:
    - call super with the table name;
    - Use `super.addColumn('propName', 'COLUMN_NAME');
- At your data layer, i call it repositories but you can call whatever you like, extends ``@schirrel/pg-connection/Repository`` and call the super with your model reference.


### Example
#### .env

`PG_USER=postgres
PG_URL=localhost
PG_DATABASE=postgres
PG_PASSWORD=postgres
PG_SCHEMA=mercado_alencar
PG_SSL=true`

#### Model

`const Model = require('@schirrel/pg-connection/Model');
class User extends Model{
	constructor(args = {}){
	super("USER");
	this.addColumn('email', 'EMAIL');
	this.addColumn('name', 'NAME');
	this.addColumn('password', 'PASSWORD');
	this.addColumn('active', 'ACTIVE', true);
	this.setValues(args);
	}
}

module.exports = User;`

#### Repository

`const Repository = require('@schirrel/pg-connection/Repository');
const User = require('../models/User');

class UserRepository extends Repository{
	constructor(){
		super(User);
	}
}

module.exports = UserRepository;`

It already have built in: get(id), create(model), update(model),delete(id), list(), search(options)

-------------------------------------------------
The project is only on the start, i will be glad if you could share points of improvement and bugs

Here is the repo
https://github.com/schirrel/pg-connection

You can finde usage at
https://github.com/schirrel/my-movies
How to get the common values of an indefinite number of arrays in Javascript
Tags: javascript, node, react, algorithms
Published: 2020-12-24 11:43:53

---
title: How to get the common values of an indefinite number of arrays in Javascript
published: true
description: 
tags: javascript, nodeJS, react, algorithm
//cover_image: https://direct_url_to_image.jpg
---
Some days ago I needed to write an algorithm in javascript to get the common values of an indefinite number of arrays.

Let’s look at the following case:
```js
const listArray = [
["ivr", "web", "wap", "add", "acd"],
["ivr", "wap", "add", "web"],
["ivr", "web", "add"]
]
```
Desired result:
```js
["ivr", "web", "add"]
```
In this case the common values are **ivr**, **add** and **web** meanwhile the others were excluded because they were not present in all arrays.

Seen my case, I’m not aware how many element an array can have and also how many arrays can I have. But **the once thing that I aware was the possible data within the array**.

I fully leaned on this last and only piece of information I had available to avoid too many cycles.

The solution that I used to get this algorithm is:
```js
const listArray = [
["ivr", "web", "wap", "add", "acd"],
["web", "add"],
["ivr", "wap", "add", "web"],
["ivr", "web", "add"]
];

let commonChannels = ["ivr", "wap", "web", "acd", "add"];

listArray.forEach(item => {
commonChannels = commonChannels.filter(ch => item.indexOf(ch) > -1);
})
```
I have created an array with all possible values (*commonChannels*).

I started to cycle all arrays then every within item each
Whenever an element was missing it was excluded from the array. To do this I rewrote the base variable (*commonChannels*)

To exclude the elements I've combined of the *Filter* and *IndexOf* methods.
Modular Flask App with Blueprints
Tags: flask, python, api, webdev
Published: 2020-12-24 11:41:12

If your flask project started to grow larger and many features added, you should not write them in a single file. Flask has its own way to separate the features using the blueprints.

## Basic Structure and Files

As the starter, we only have one file inside our project:

```
- project
  |_ app.py
```

and the file is the simple flask app like this:

```py
from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello():
    return 'Hello World!'

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

```

## Creating Products and Stores Blueprints

For examples, let's create a folder named `blueprints` and also create the `products_blueprints` and `stores_blueprints`

```
- project
  |_ blueprints
     |_ products_blueprint.py
     |_ stores_blueprint.py
  |_ app.py
```

and for the blueprints, let's make them simple like these:

`blueprints/products_blueprints`:
```py
from flask import Blueprint, jsonify

products_blueprint = Blueprint('products_blueprint', __name__)

@products_blueprint.route('/api/products')
def product_list():
    return jsonify({'data': [{'id': 1, 'name': 'Cappucinno'}]})
```

`blueprints/stores_blueprints`:
```py
from flask import Blueprint, jsonify

stores_blueprint = Blueprint('stores_blueprint', __name__)

@stores_blueprint.route('/api/stores')
def store_list():
    return jsonify({'data': [{'id': 1, 'name': '4th Avenue Cafe'}]})
```

## Importing and Registering the Blueprints to Flask App

Let's modify the `app.py` to import the blueprints and register them to the app:

```py
from flask import Flask

from blueprints.products_blueprint import products_blueprint
from blueprints.stores_blueprint import stores_blueprint

app = Flask(__name__)

@app.route('/')
def hello():
    return 'Hello World!'

app.register_blueprint(products_blueprint)
app.register_blueprint(stores_blueprint)

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

```

That's it. Try to run and access the `api/products` and `api/stores` to make sure it works.
CTF {All A-Log The Watchtower} 
Tags: linux, serverlogs, ctf, mlh
Published: 2020-12-24 11:27:29

I tried this challenge as per my maximum knowledge.But I am not a linux user so i don't know how can i use awk,grep,sed for this challenge. please anyone help me completing this challenge with me, I also don't believe in spoon feeding i just wanna know how can i use these commands to perform my challenge.

[CTF Challenge](https://blackrock-ctf-04.herokuapp.com)
Is Next JS really that good? 
Tags: discuss, javascript, webdev
Published: 2020-12-24 11:21:20

Throughout 2020 I've written a tonne of front-ends in both React (using [Create-React-App](https://github.com/facebook/create-react-app)) and Vue. I've also dabbled into Preact and Svelte. 

Currently, [next.js](https://nextjs.org/) seems to be all the rage, but I'm struggling to see what makes it so compelling over plain, old React. Is server-side rendering really that good? To me, it seems like it causes more trouble that it solves.

Is next.js really that good? Is it worth making a switch?
5 Tips to Start Your Freelance Journey in 2021
Published: 2020-12-24 10:58:00

2020 has been a tough year for all of us. Covid19 showed up and changed the way a lot of things are being done. The definition of work has evolved. Companies no longer need ‘brick-and-mortar’ offices. 

**We now have the flexibility to work with whomever from wherever! Remote working & freelancing is now the way many of us work, and that’s amazing!**

As a freelancer, you have the ability to choose your clients, offer the services you are good at and earn money from the comfort of your home. 

It’s a new year in a couple of days. If you’re looking to become a freelancer in 2021, here are 5 tips to get you started:

### 1. Identify your skills
What skills have you been paid for in the past? If you’ve been paid to do some work, it’s very likely that you’re good at it or you’ve learned well on the job. Making a list of those skills is a crucial first step to effective freelancing.

### 2. Present your skills as a solution
The skills you have are a solution to a client’s problem. Identifying and articulating the problem your skills can solve is important because people pay for solutions and not skills. For example, if your skill is writing JavaScript code, the service you offer a client is “website development”.

### 3. Sign up on a freelance platform
There are a lot of freelance service sites that connect skilled professionals like you with local and remote employers. My top 3 platforms are Upwork, Fiverr, and Toptal. You’ll need to create a compelling profile to attract the right clients.

### 4. Create a compelling Profile
Now you’ve signed up for any of these sites but the journey is just beginning.

**The competition in the freelance world is pretty high given that they are many people who have the same skillset as you. There is a need to differentiate yourself and stand out from the crown to attract clients. To achieve this, you’ll need to craft a compelling profile.**

Based on my experience, a compelling profile consists of a clear explanation of the service you offer (remember, this is not your skillset), the problems you can solve for the client, and a clear process of how they should work with you.

PS: Avoid spelling mistakes and typos, and keep your profile as concise as possible.


### 5. Prepare a proposal template to send to clients
Freelancers often have to write proposals in order to receive projects. 

**A proposal template is a document that has the structure and content for every proposal to be sent but can easily be tweaked and customized for each project.**

Some things your proposal template should contain are:
- Scope of service
- The cost of the project
- Timeframe
- Personal recommendations
- Pitch on why to pick you


**Are you looking to start freelancing or have you started? What additional tips can you give someone looking to start freelancing in the coming year?**
The Scrimba #javascriptmas challenge!
Tags: javascript, challenge, motivation, firstpost
Published: 2020-12-24 10:55:13

This month I've been participating in the 24 days of #javascriptmas challenge by Scrimba. I had great fun and learned a ton of cool stuff that I can actually use in future projects! Every day I was looking forward to a new challenge to do. So thank you Scrimba!

Here are all my solutions:

Day 1: [Candies](https://t.co/czfFJnx9wn?amp=1)
Day 2: [Deposit Profit](https://t.co/WdwYCmNcF8?amp=1)
Day 3: [Chunky Monkey](https://t.co/3G1WIWwdL7?amp=1)
Day 4: [Century From Year](https://t.co/KM1nZaU3gk?amp=1)
Day 5: [Reverse A String](https://t.co/hj5RuqlhuD?amp=1)
Day 6: [Sort By Length](https://t.co/a1rTsITYws?amp=1)
Day 7: [Count Vowel Consonant](https://t.co/WI9LZf54Yr?amp=1)
Day 8: [Rolling The Dice](https://t.co/UqkLCzU3e8?amp=1)
Day 9: [Sum Odd Fobinacci Numbers](https://t.co/vSEzei11v1?amp=1)
Day 10: [Adjacent Elements Product](https://t.co/oshxZ52xpB?amp=1)
Day 11: [Avoid Obstacles](https://t.co/Z1blkwmJ7r?amp=1)
Day 12: [Valid Time](https://t.co/5Zm6bIZRjY?amp=1)
Day 13: [Extract Each Kth](https://t.co/M280fe3pNd?amp=1)
Day 14: [Maximal Adjacent Difference](https://t.co/rpqldwDze6?amp=1)
Day 15: [Carousel](https://t.co/H2nqxQB32N?amp=1)
Day 16: [Insert Dashes](https://t.co/0MMI7xrPvu?amp=1)
Day 17: [Different Symbols Naive](https://t.co/9rzQZqkeoO?amp=1)
Day 18: [Array Previous Less](https://t.co/sttCT8rBjk?amp=1)
Day 19: [Alphabet Subsequence](https://t.co/XfUDXNd4o9?amp=1)
Day 20: [Domain type](https://t.co/Ctvzk51wae?amp=1)
Day 21: [Sum Of Two](https://t.co/FwahspLIcG?amp=1)
Day 22: [Extract Matrix Column](https://t.co/szQ0fk1O6I?amp=1)
Day 23: [Social Media Input](https://scrimba.com/scrim/cob6c4194b484a00226a82774)
Day 24: [Test Your Agility](https://t.co/YZxGGqQ29Q?amp=1)
Business Software Development from Scratch: traditional development vs. 1C:Enterprise
Tags: 1c, devops, software, developers
Published: 2020-12-24 10:50:09

1C has been producing business solutions for roughly 30 years. In that time, the company's solutions have evolved from simple accounting and reporting programs to complex multi-user ERP systems. To improve its productivity and arm clients and partners with an effective tool for creating and customizing business solutions, 1C wrote its own platform 1C:Enterprise. 

The platform includes a development environment, a runtime, and support and administration tools. The 1C platform proved its effectiveness by becoming one of the leading development platforms for business applications in the CIS region. The platform has been used to create more than 1300 COTS corporate solutions and an abundance of custom-made solutions, implemented in over 30 countries.

Let's look at the principal differences between the 1C platform and traditional methods when it comes to software development. Take this typical business task, for instance: your back-office system needs to be able to accept and process a new type of document, such as production orders.

Learn more about new methods and technologies in [our blog] (https://1c-dn.com/blog/business-software-development-from-scratch-traditional-development-vs-1c-enterprise/)
Painless i18n for Moment.js
Tags: javascript, i18n, momentjs
Published: 2020-12-24 10:31:22

You serve a multi-lingual JS app, use Moment.js and need to internationalize how times are displayed? Why bother with an expansive new NPM package where you could do it yourself in just a few lines of code?

First create a file that'll store the various formats you need, as well as the function that'll pass them to your custom Moment.js `localize` function:

```javascript
// First find a way to determine the user's locale
const getLocale = () => window.locale || 'fr'

// Define as many formats as you wish.
const formats = {
  'ddd DD': {
    fr: 'ddd DD',
    de: 'ddd Do',
    en: 'ddd Do',
    'en-US': 'ddd Do',
    it: 'ddd DD',
  },
  'D MMM YYYY à HH:mm': {
    fr: 'D MMM YYYY à HH:mm',
    de: 'Do MMM YYYY [um] H:mm',
    en: 'D MMM YYYY [at] H:mm',
    'en-US': 'MMM Do YYYY [at] H:mm',
    it: 'D MMM YYYY [alle] HH:mm',
  },
}

// Whether you want the function to fail or not if the name doesn't exist is up to you. 
const i18nFormat = (name, locale = getLocale()) => {
  if (typeof formats[name] !== 'object') {
    console.log(`Unknown format definition for "${name}"`)

    return name
  }

  if (!formats[name][locale]) {
    console.log(
      false,
      `Missing format definition for "${name}" in locale "${locale}"`
    )

    return name
  }

  return formats[name][locale]
}

export default i18nFormat
```

Now you can create a file defining your `localize` function...
```javascript
import moment from 'moment'

moment.fn.localize = function localize(inputString) {
  return this.format(i18nFormats(inputString))
}
```

...and import it at the root of your project. You're hot to trot!
```javascript
import React from 'react'
import './setupMoment'
import moment from 'moment'

const App = () => (
  <div className="App">
    <h1>Internationalize Moment.js the easy way</h1>
    <h2>'dddd': {moment().localize('dddd')}</h2>
    <h2>'D MMM YYYY à HH:mm': {moment().localize('D MMM YYYY à HH:mm')}</h2>
  </div>
)

export default App
```
[Functional demo on Codesandbox](https://codesandbox.io/s/confident-feather-e9h50?file=/src/App.js)
Top 10 Android App Development Trends to Look Out for in 2021
Tags: android, ios, mobile
Published: 2020-12-24 10:14:42

Android OS rules the smartphone market with over 85% of the share worldwide. From entrepreneurs to individuals, everyone wants to make the most from the growing popularity of Android. But, if you want to build an Android app, you need to consider changing market trends and intensifying competition. Google Play Store has over 3 million apps available for download, and chances are high that your app will find similar apps on Google Play.

In such a competitive situation, it is better to consult a reputed Android app development company to build a unique and user-friendly app. The mobile app development domain is thriving with advancing technology, and your upcoming Android app should have the latest and innovative features to stay ahead of the curve. Here we are going to discuss the top ten Android app development trends for 2021 that will help you provide an improved user experience.

Top Ten Technology Trends for Android App Development in 2021

Blockchain

Be it making online transactions secure or enabling app users to transact in cryptocurrency, blockchain technology has proven its importance in the mobile app development domain. A PwC survey has revealed that as many as 84% of companies are engaged in Blockchain technologies globally. In the coming years, this revolutionary technology will remain useful for enhancing security in the apps for various sectors like real estate, healthcare, and retail.

AI and Machine Learning

In the age of cloud-based apps, AI app development enables enterprises to leverage the benefits of thriving Artificial Intelligence and Machine Learning (ML) technologies. AI models can easily augment regular procedures and bring automation to various business processes. In the coming time, AI and ML will be penetrated more in the mobile app development domain.

Chatbots

Chatbots and voice assistants have already secured their places in enterprise apps. Chatbots are available for resolving the customer’s queries and interacting with them in a humanlike manner on a 24/7 basis. Google Assistant has also taken the user experience to a new level, and we will see more apps will chatbots and voice assistants in the year 2021.

Visit: https://www.suriainternational.com/top-10-android-app-development-trends-to-look-out-for-in-2021/
Laravel Validation Required Example
Tags: laravel, validation, php, laravel8
Published: 2020-12-24 10:05:39

Hi Guys,

Today, I will learn you to create validation required in laravel.we will show example of laravel validation required.

The field under validation must be present in the input data and not empty. A field is considered "empty" if one of the following conditions are true

->The value is null.

->The value is an empty string.

->The value is an empty array or empty Countable object.

->The value is an uploaded file with no path.

Here, I will give you full example for simply required validation in laravel bellow.
more

https://www.nicesnippets.com/blog/laravel-validation-required-example

https://www.youtube.com/watch?v=5URmv9C-Qxk
How to code Rock Paper Scissors in the browser with C# (VIDEO)
Tags: csharp, html, css
Published: 2020-12-24 09:53:28

In this video, you will learn to create the Rock-paper-scissors game using Blazor WebAssembly.

You will use HTML, CSS, and C# to create the game.

The source code is available on Github : [https://github.com/estyval/RockPaperScissors](https://github.com/estyval/RockPaperScissors) 

If you like the content, feel free to like the video and subscribe to the channel 🙏.

{% youtube 0lOUf5svGIc %}
Permission to username/project.git denied to user
Tags: github, git
Published: 2020-12-24 09:39:53

I was trying to push my new repository to my Github and the permission was denied because I was trying to push it to my old workplace's account. 

But it took some time to find the right solution for me so I wanted to leave here. 



If you attempt all these steps and your terminal says like this 
```
remote: Permission to harukakato35/StressBox.git denied to ○○○.
fatal: unable to access 'https://github.com/harukakato35/StressBox.git/': The requested URL returned error: 403
```

Try this as the quickest way. 
```
git push git@github.com:harukakato35/StressBox.git main
```

Or with this way, you can connect with the account you want 
```
$ git remote set-url origin https://hoge@github.com/hoge/abc.git
$ git push origin main
``` 

Hope this is useful for you!
Viable frameworks for Back-End Web Development
Tags: backend
Published: 2020-12-24 09:35:38

All websites incorporate the use of frameworks for the creation and building of its Front-End and Back-End. Here is a directory of viable frameworks that are in common use for Back-End Web Development. But first, let’s get to know about the framework.

Read More: https://www.navicosoft.com/articles/viable-frameworks-for-back-end-web-development/
Author: https://alsapakistan.com/
Day 1 of 100 Days of Code: Python Basics
Tags: 100daysofcode, codenewbie, beginners
Published: 2020-12-24 09:34:50

Here I begin my #100daysofcode challenge. I have learned Python from Coursera's [Programming for Everybody](https://www.coursera.org/learn/python/home/week/1) course. I am excited to take next course of the specialization.

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Starting my <a href="https://twitter.com/hashtag/100DaysOfCode?src=hash&amp;ref_src=twsrc%5Etfw">#100DaysOfCode</a> from today.<br>Day 1:<br>* Learned about python basics. <br>* Learned about python class and methods. <a href="https://t.co/nmRKLybq87">pic.twitter.com/nmRKLybq87</a></p>&mdash; Durga Pokharel (@mathdurga) <a href="https://twitter.com/mathdurga/status/1342040051312541697?ref_src=twsrc%5Etfw">December 24, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Historical optimization trend in SEO services
Tags: seo
Published: 2020-12-24 09:33:31

Since the business world has shifted to the digital world, digital marketing is vital to any business. To the fortune of Entrepreneurs, the digital world offers affordable marketing tools and platforms. You don’t need to spend large amounts of money on marketing strategies. You can work on it yourself as well. Search Engine Optimization has been the best result-promising digital marketing tool. Realizing the tool’s significance, search engines like Google, Bing, and Yahoo keep on changing the SEO ranking factors. To ace the digital world competition, you must keep updated with every new trend in SEO services. 

Read More: https://www.navicosoft.com/articles/historical-optimization-trend-in-seo-services/
Author: https://syedbrothers.com.pk
Web development trends of 2021
Tags: webdev, trends
Published: 2020-12-24 09:27:07

With the ever-growing pace of the digital world, everything is getting online. From horoscope websites to educational platforms, everything is operating online now. Moreover, the recent outbreak of COVID-19 has fastened the pace of growth in the tech world. Currently, there are about 1.74 billion websites globally. The interesting fact is that the digital world is still innovating and expected to bring in various new features by 2021. There are some exciting features to be incorporated in web development for a better experience for the visitors. There are some of the web development trends of 2021 that every CTO must know.

Read More: https://www.navicosoft.com/articles/web-development-trend-for-2021/
How to start coding journey as non tech person?
Tags: help, beginners, codenewbie, discuss
Published: 2020-12-24 09:22:53

If you are viewing this post then I am really grateful. I used to be a mathematics student from Nepal and I want to learn coding and start my career as programmer. Being non technical person and completely newbie to the field, I used to get stuck and sometimes frustration comes. However, from the help of friend I learned about simple blogging with [GitHub pages](https://iamdurga.github.io) and  also doing some Python Beginner course on Coursera. I heard this platform from friend and I am enjoying it here. 

Please take a time and give your suggestions to complete newbie from non technical background. How can I learn efficiently and become productive? If there are any resources you recommend or any rule or any suggestions are requested.