teleren/devto huggingface dataset:
5 docker commands to install PostgreSQL (Postgis), MongoDB, MySQL, and Redis
Tags: redis, postgres, mongodb, docker
Published: 2020-11-27 08:58:37

## PostgreSQL

```
docker run --name "postgresql" -p 25432:5432 -e POSTGRES_USER=your_user -e POSTGRES_PASSWORD=your_password -e POSTGRES_DB=your_dbname -t -d postgres
```

where (you can change them on your choice):

- `your_username` is required PostgreSQL user
- `your_password` is the user's password
- `your_dbname` is db's name (notice that the missing db_name will be substituted by `your_username`)
- `25432` is a PORT available outside docker's container
- `postgresql` is a key you can use for accessing the container

> Hint: using `25432` (or any other rarely used) port prevents conflicts

You also can install it directly to your machine using [this guide](https://dev.to/try_catch/postgresql-post-install-steps-ubuntu-server-20-04-58pf):

{% post https://dev.to/try_catch/postgresql-post-install-steps-ubuntu-server-20-04-58pf %}

## PostgreSQL + Postgis

```
docker run --name "postgis" -e POSTGRES_USER=your_user -e POSTGRES_DBNAME=your_dbname -e POSTGRES_PASSWORD=your_password -p 25432:5432 -d -t kartoza/postgis
```

> Hint: `-d` flag runs the container as a daemon: it starts in the background and you can continue working with the same terminal tab

where (you can change them on your choice):

- `your_username` is required PostgreSQL user
- `your_password` is the user's password
- `your_dbname` is database's name
- `25432` is a PORT available outside docker's container
- `postgis` is a key you can use for accessing the container

## MongoDB

```
docker run --name "mongodb"  -p 28777:27017 -e MONGO_INITDB_ROOT_USERNAME=your_username -e MONGO_INITDB_ROOT_PASSWORD=your_password -d mongo
```

where (you can change them on your choice):

- `your_username` is required MongoDB admin user
- `your_password` is the user's password
- `28777` is a PORT available outside docker's container
- `mongodb` is a key you can use for accessing the container

> Hint: `-t` flag runs a pseudo terminal, therefore you can send different commands to the container

## MySQL

```
docker run --name "mysql" -p 23306:3306 -e MYSQL_ROOT_PASSWORD=your_password -t -d mysql/mysql-server
```

where (you can change them on your choice):

- `your_password` is the root password
- `23306` is a PORT available outside docker's container
- `mysql` is a key you can use for accessing the container

> Hint: you can add a volume for any container in this guide: it will store data on your machine nevertheless the container is removed or stoped, e.g. for mysql `-v $HOME/docker/volumes/mysql:/var/lib/mysql`, for postgres `-v $HOME/docker/volumes/postgres:/var/lib/postgresql/data`

## Redis

```
docker run --name "redis" -p 26379:6379 -t -d redis
```

where (you can change them on your choice):

- `26379` is a PORT available outside docker's container
- `redis` is a key you can use for accessing the container

[Check out more DevOps stuff on my blog](https://ntscx.com/posts/5-docker-commands-to-install-postgresql-(postgis)-mongodb-mysql-and-redis)
How to solve shrinker error in Flutter.
Tags: flutter, android, errors, acctgen1
Published: 2020-11-27 08:41:01

So I just came across this error while I was trying to integrate google sign in into one of my Flutter app.

shrinker may have failed to optimize the Java bytecode.
To disable the shrinker, pass the ` — no-shrink` flag to this command
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/420m4o3rm1av98m1u1gy.png)

So, to solve this error just navigate to {your-app-name}\android\app\build.gradle, when you get to the build.gradle file just scrolls down to where defaultConfig was specified and change the minSdkVersion from 16 to 21 and the problem is gone.


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

This solution work like a charm, if your error has been solved through this article don’t forget to subscribe to the newsletter. Thanks

**Join Flutter Developer Community: [Telegram](https://t.me/flutterdevsgroup) | [Facebook](https://www.facebook.com/groups/flutterdevsgroup/) | [WhatsApp](https://chat.whatsapp.com/FxD3bp4jVB21PlnGHve0SY)**

Let’s connect each other online:
[Github](https://github.com/techwithsam), [Twitter](https://twitter.com/techwithsam_), [Youtube](https://www.youtube.com/techwithsam), [Medium](https://techwithsam.medium.com), [LinkedIn](https://ng.linkedin.com/in/techwithsam)

Happy Fluttering 👩‍💻
Capturing issues over http in iOS & Android mobile apps and watchOS apps
Tags: ios, android, mobile
Published: 2020-11-27 08:36:32

Most mobile apps work in tandem with a backend application to which the apps need to communicate as and when required. It's well known that any interaction with an external system will have higher chance of inducing issues. Communicating with backend application over http / https is no exception.
 
# Common issues while handling http calls.

1. Server returning error status codes
2. Server side exception and a 500 error response
3. Delay beyond reasonable limits in getting response
4. Duplicate requests with same payload being send to the server with in millisecond gap. (Yes, this is a very common bug that goes unnoticed)

Some of the issues, especially the second one in above list, are caused by bugs in server. But most often issues could be the result of wrong data being send from the app. Even for those issues caused by the server, having a log of the request body and headers would help in identifying the root cause.

# Using Finotes to handle http issues

So how do you capture these issues in your mobile apps? Finotes provides an easy mechanism to track such bugs and report issues with relevant data points to reproduce them. Such data include the request and response headers, body, device data, device state data, bandwidth availability and such.

Also Finotes provides a call back mechanism when a bug is encountered, and this will help you gracefully handle the situation.

Do try Finotes by visiting [finotes.com](https://finotes.com). It's available in Java & Kotlin for Android apps, and in Swift & Objective-C for iOS and watchOS apps.
Quick Express-TypeScript Setup
Tags: typescript, javascript, express
Published: 2020-11-27 08:26:17

Steps to create a barebones Express app with TypeScript and ESLint.
A sample app setup is available [here](https://github.com/metamodal/blog/tree/master/quick-express-typescript-setup/example). To clone it locally, run:

```sh
npx degit metamodal/blog/quick-express-typescript-setup/example express-ts-project
```

Else follow along to setup the project manually.

# Step 1
Create an npm project:
```sh
mkdir express-ts-project
cd express-ts-project
npm init -y
```

#Step 2
Install dependencies:
```sh
# Express-related deps
npm install express cors

# Tooling
npm install -D typescript eslint nodemon ts-node @typescript-eslint/eslint-plugin @typescript-eslint/parser

# Typings
npm i -D @types/cors @types/express @types/node
```
- `cors`: to allow cross-origin requests
- `ts-node`: to run TypeScript programs directly from the terminal (instead of having to transpile to JavaScript first)
- `nodemon`: to run your project in "watch" mode, meaning the program is automatically restarted every time you change your code
- `@typescript-eslint/parser`: allows ESLint to understand TypeScript syntax
- `@typescript-eslint/eslint-plugin`: loads the ESLint rules defined by you

# Step 3
Create a file named `tsconfig.json` in the root of your project and paste the following config:

```json
{
  "compilerOptions": {
    "lib": ["es2018"],
    "module": "commonjs",
    "target": "es2018",

    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "sourceMap": true,
    "outDir": "dist"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "**/*.spec.ts"]
}
```

# Step 4
Create a file named `.eslintrc` in the root of your project, and paste the following config:
```json
{
  "root": true,
  "parser": "@typescript-eslint/parser",
  "plugins": [
    "@typescript-eslint"
  ],
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended"
  ]
}
```

# Step 5
Create a folder named `src` and inside it a file `src/index.ts`. Paste the following in `index.ts`:
```ts
import express from "express";
import cors from "cors";

const app = express();
const port = 3000;

app.use(cors({ origin: true }));

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => console.log("Listening on port " + port));
```

# Step 6
Add the following in the `scripts` object in `package.json`:
```json
"scripts": {
  "build": "tsc",
  "start": "nodemon src/index.ts"
}
```

# Step 7
From the root of your project, run the command:
```sh
npm start
```
Go to http://localhost:3000 on your browser. If you see "Hello World!" printed on your screen, everything has worked correctly.

# Typos? Improvements?
Thanks for reading. If you notice any typos or would like to suggest improvements, please feel free to either create an issue or PR [here](https://github.com/metamodal/blog/blob/master/quick-express-typescript-setup/quick-express-typescript-setup.md).
Top 11 Kubernetes Tools For 2021
Tags: go, kubernetes, technology
Published: 2020-11-27 08:17:07

For developers, writing applications for various operating environments is a major requirement. Kubernetes eliminates the restrictions and extends the capabilities of containers so got a high attention. There are some benefits like discoverability, observability, horizontal scaling and load balancing that Kubernetes offer through its collection of pods that can perform similar functions. You can use a deployment controller to achieve scalability, visibility, time savings and control over versions. Kubernetes tools extend the functionalities and eliminate the imposed restrictions for better performance. Here we’ll see top 11 Kubernetes tools that enhance your development work. 

#Top 11 Kubernetes Tools –
**1. cAdvisor-**
cAdvisor is an open-source tool and maintained by Google.  It is used to monitor resource usage and performance. It natively supports Docker and is integrated with Kubelet. This tool can auto-detect all containers in a server, collects, processes and disseminates container information. But it has one weakness, it is limited to store metrics for long term monitoring. cAdvisor’s container abstraction is based on Imctfy, it inherits the nested hierarchical behavior.

**2. Kubernetes Operational View (Kube-ops-view)-**
It is an open-source tool and you can use it in all popular browsers like Chrome and Mozilla Firefox also. This tool provides a common operational structure for all Kubernetes clusters. Besides it can be considered as a read-only system dashboard for multiple Kubernetes platforms. This tool allows you to navigate between your cluster and monitor nodes seamlessly.

Creation and termination process of pod will be easier if you use this tool. Also it uses Heapster as a data source and render nodes to enable users to indicate overall status and remember that it is not an operational tool. Vertical bar for total memory can be rendered through this tool, while the rendering of individual pods has also been made possible by its developers.  Also you can group the system pods and get tooltip data for nodes and pods. But you can not consider it as a replacement for the kubernetes dashboard.

Know more at- https://solaceinfotech.com/blog/top-11-kubernetes-tools-for-2021/
#4 Introduction to Mocha testing
Tags: mongodb
Published: 2020-11-27 08:16:04

Mocha is a testing framework.
We use it to perform within our application
To make sure everything works correctly
First install Mocha `npm install mocha --save`
Keep the test script `demo_test.js` to a folder `/test`.
demo_test.js
```
const mocha = require('mocha');
const assert = require('assert');

describe('Some demo tests', function(){
    //Create tests
    it('adds two numbers together', function(){
        assert(2+3===5)
    })
})
```
Set the `test` property to `mocha` in `package.json`
and run `npm run test`
#3 Models and Collection
Tags: mongodb
Published: 2020-11-27 07:58:33

File: models/marioChar.js
```
const mongoose = require('mongoose');

const Schema = mongoose.Schema;

const MarioCharSchema = new Schema({
    name: String,
    weight: Number
})

const MarioChar = mongoose.model('mariochar', MarioCharSchema)

module.exports = MarioChar;

// Now we can do the following
// var myChar = new MarioChar({ name: "Rayan", weight: 100 });
```
How to test easily your local website on real phone devices
Tags: webdev, javascript, php, docker
Published: 2020-11-27 07:50:40

> Imagine you're developing a cool responsive website to use with mobile. You have develop some special features like using geolocation or cam qrcode scanner to work well with mobile experience. But how to test those features in local where you just have easily access to your website through your computer.

To achieve this, You can use [httpdumper](https://www.npmjs.com/package/httpdumper).

## Requirements:
* node >= 11.0
* wifi network where your computer with your local website and your mobile are connected together.

## Install
```bash
$ npm i -g httpdumper
```

## Getting started

1. Get your local computer IP

on linux with:
```bash
$ /sbin/ifconfig
```
you should get your local IP for your wifi interface, so something like this by example:

```
192.168.X.X
```

2. Run httpdumper
 
If you have your local website running on http://localhost:9000 from your computer. You can just start httpdumper like this:

```bash
$ httpdumper --port="3000" --host="http://localhost:9000" --uplaodDir="./uploads/"
```

3. Mobile test

Access your local website from your mobile browser at the address:

```
http://<your-local-ip>:3000
```

You will get the log requests in the terminal. If your requests have some files, they will be uploaded in the specified upload directory.

Hope it will be useful for some of you!
:)
#2 Installing MongoDB Locally & connecting to MongoDB
Tags: mongodb
Published: 2020-11-27 07:43:42

1. `npm init` -- to track the dependencies.
2. Install mongoose `npm install mongoose --save`
3. Connecting to database: Mongoose do not automatically knows about database. we've to tell it explicitly.
```
//connection.js
const mongoose = require('mongoose');

mongoose.connect('mongodb://localhost/testaroo');

mongoose.connection.once('open', function(){
    console.log('Connection is made');
}).on('error', function(error){
    console.log('Connection error', error);
})
```
Dummy’s Guide to Roots Sage Theme in WordPress
Tags: wordpress, laravel, php, node
Published: 2020-11-27 07:39:26

I published this on my main blog, but thought I'd link to it here.

[Dummy’s Guide to Roots Sage Theme in WordPress](https://toby.ink/blog/2020/11/26/dummys-guide-to-roots-sage-theme-in-wordpress/)
Why use Atom?
Tags: elixir
Published: 2020-11-27 07:13:14

Atom is describe as `Constants whose values are their own name.`

One of the use of Atom is that it allows you to pattern match.
For example you can pattern match the result:
```elixir
case result do 
  {:ok, user} -> 
    #handle success
  {:error, changeset} -> 
    #handle error
end

```
The code below is okay but when I first tried it, it looks no different to a constant string. 

For example, we can change the code to look like this

```elixir
case result do 
  {"ok", user} -> 
    #handle success
  {"error", changeset} -> 
    #handle error
end
```

Instead of pattern matching an Atom, we pattern match a `String` instead. 

The downside of this is that if we want to change `ok` to `okay` in the future, we need to change it everywhere. However, this is the same problem if we were to use an Atom. 

So why should we use an Atom? Well, after some digging, I found out that Atom value are mapped at runtime. Basically Atom is a global value. 

Why is this important? Lets take a look a the previous code
```elixir
case result do 
  {"ok", user} -> 
    #handle success
  {"error", changeset} -> 
    #handle error
end
```

If you see the code above, if we were to pattern match using `String`, Elixir would need to compare the character 1 by 1. This can obviously become cumbersome.

If we were to use an Atom instead, Elixir can just compare the pointer/address . We don't have to compare the value 1 by 1 because by default an Atom value is the same. This makes pattern matching much faster.

Also, the syntax is much nicer :D
How On-demand Grocery Delivery App Benefits Your Store and Expands Business
Tags: discuss, mobile, android
Published: 2020-11-27 07:09:34

We have witnessed a huge surge in the usage of grocery apps in this pandemic age. Grocery mobile apps are among the fastest-growing apps in the US and other countries. As per the Statista estimate, online grocery shopping sales will cross US$30 billion by the end of 2021. If you own a brick-and-mortar grocery store or want to kickstart a grocery delivery startup, then on-demand grocery app development can remain handy for you.

Instacart, Walmart Grocery, and other grocery delivery apps have made records in the number of downloads recently. Though these top players have intensified the competition in the grocery app market, there is a huge scope left for new players who want to come up with an online grocery delivery system along with a feature-rich app. Be it a grocery app for iOS or Android, you can generate high revenue through a seamlessly performing app.

Major Reasons for the Popularity of On-demand Grocery Delivery Apps

Higher Comfort and Convenience- This is one of the biggest reasons for the increasing popularity of on-demand grocery apps. In this quarantine age, people prefer to give orders online and want to get the delivery of groceries at their doorstep. The on-demand grocery delivery app makes it possible.

 Also, the grocery delivery apps enable users to get rid of standing in long queues at the cash counters of superstores or brick-and-mortar grocery stores. The app offers your customer a pleasant and smooth grocery shopping experience at the comfort of their home. They can easily place an order and pay with only a few clicks through an app.
Use multiple versions of an npm package at the same time
Tags: npm, yarn, javascript, react
Published: 2020-11-27 06:45:29

Sometimes the API of an npm package changes. And sometimes the package is not backward compatible. In big projects, it is sometimes hard to refactor all the code concerned with a new API of an npm package you just updated. You probably want to be able to refactor this code step by step.

# Aliases

With npm or yarn, you can install a package under a custom alias. This enables you to install multiple versions of a package in the same project.

Read the documentation on aliasing with npm [here](https://docs.npmjs.com/cli/v6/commands/npm-install) and yarn [here](https://classic.yarnpkg.com/en/docs/cli/add/#toc-yarn-add-alias).

# How to use?

To install a package under an aliased name run:

```bash
npm install <alias>@npm:<name>
```

or 

```bash
yarn add <alias>@npm:<name>
```

When you want to install a specific version of the package append the command with `@<version>`.

# Using multiple versions of the same package

So for example, if you want to use multiple versions of the `react-helmet` package run:

```bash
npm install react-helmet-old@npm:react-helmet@5.2.1
npm install react-helmet@npm:react-helmet
```

or

```bash
yarn add react-helmet-old@npm:react-helmet@5.2.1
yarn add react-helmet@npm:react-helmet
```

Npm or yarn will now add two folders to your `node_modules` folder, e.g. `react-helmet` and `react-helmet-old`, and lets you import from `react-helmet-old` and `react-helmet` in your project. Now you can start refactoring step by step.

## Sidenote

Not all packages support the usage of multiple versions side by side. For example, we tried to install two versions of `react-dnd` for which you need to use a provider component which was changed in the newer version. The two providers collided when used together so we were forced to do the whole refactor at once.

# Conclusion

Aliases are a convenient way to upgrade a package gradually. Although we couldn't use it in our specific use case maybe there are people out there who can!
Tips for Resume
Tags: resume
Published: 2020-11-27 04:58:38

## Which is the better format for a resume .doc or .pdf and why?

I suggest why not both?

PDF: if you are sending your resume directly to a Hiring Manager or Recruiter or for Referral it is suggested that you send it as a PDF document. This ensures that the document format stays an equivalent across all word versions and computers.

Word Document: once you are applying to employment indirectly i.e. company website, Indeed, LinkedIn etc. you can submit your resume via a Word document. The main reason for this is that when an Applicant Tracking System (ATS) is being used your document has the highest readability with a Word Document. A pdf is actually an image of the document and thus sometimes the content and keywords could also be skipped when being scanned. Thus, it is imperative to submit a Word Document to ensure all of your information is accounted for.

## What's up with these horrible resume templates?

1) Please use overleaf (previously known as ShareLatex) and use those templates.
2) Make sure that your resume is ATS compliant.
3) What are you even writing in 4 pages resume. Restrict to 1 page
4) Nobody cares if you won some random competition in class 1
5) Windows 7 is NOT a skill worthy to be written.
6) Always rename files to your name.
7) No need for a declaration (True to my knowledge blah blah...). You are not transferring your property to me.
8) I DON'T need your family details or DOB.
9) Blank pages? Seriously?
Semantic HTML
Tags: html, meaningfulhtml, semantichtml, semanticmarkup
Published: 2020-11-27 05:51:20

Before CSS was introduced, HTML only was used to convey both structural and presentational information. You would also encode certain presentational characteristics of the content such as font color, font type, and layout using HTML. Since the inception of CSS, it has been encouraged to use HTML strictly for structural markup, leaving the responsibility of styling and presentation to CSS.

HTML tags are classified as semantic and non-semantic tags according to the purpose they serve.

### Semantic markup tags
Tags such as `h1` and `p` elements explain the meaning or purpose of the content they enclose.

`<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>`

When a browser notices the above piece of HTML, it understands that the content is a paragraph.

### Non-semantic markup tags
There are tags in HTML, namely `div` and `span` that just indicate that the content inside them are grouped together, while not giving any semantic information of it.

## What is semantic HTML?

Semantic HTML is using semantic markup tags to precisely describe the meaning of the content between them. In semantic HTML, non-semantic markup tags should only be used for data that cannot be semantically labeled. It could be said that HTML was semantically written:
* If HTML was not used to describe presentational characteristics of the content.
* If appropriate tags were used to mark up different types of content in the document.

## Why Semantic HTML?

Semantic HTML makes navigation easier for the visually impaired. Imagine a visually impaired person using 2 websites, one which was developed using semantic HTML, and the other which was not. While using the former website, the user can easily navigate as the screen reader readily provides the outline of it. But, in the case of the latter website, as it has no accessibility features, the user has to read from top to bottom of the page, making navigation difficult.

It also helps in increasing accessibility to web pages. Search engines depend on HTML elements to extract the meaning of the text on webpages. So, by using semantic HTML the overall semantic clarity increases, which leads to better accessibility.