teleren/devto huggingface dataset:
Day 18 of #100DaysOfCode: Create Sitemap to Improve SEO
Tags: 100daysofcode, marketing, seo, webdev
Published: 2020-05-16 11:38:37


## Introduction
Sitemap can't really improve SEO for the website. However, it can make sure that search engine includes every pages of the website.
 
## Steps
### 1. Generate sitemap for the website
The sitemap.xml has to include all pages. We can use sitemap generator to generate sitemap if the website is too large. https://www.xml-sitemaps.com/

* Put one page's URL one the input box and click start
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6l62n5jsj7r9n21u2jdj.png)

* Then the site generator will scan the website and shows all pages 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tvmvrzeq1ivo7mrsv2ag.png)

* The following example shows the format of the sitemap
```xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
  <loc>https://jenhsuan.github.io/ALayman/profile.html</loc>
  <lastmod>2020-05-09T00:44:26+00:00</lastmod>
  <priority>1.00</priority>
</url>
<url>
  <loc>https://jenhsuan.github.io/ALayman/projects.html</loc>
  <lastmod>2020-05-09T00:44:26+00:00</lastmod>
  <priority>0.80</priority>
</url>
...

</urlset>
```
* Put the sitemap.xml in the root folder. Make sure that others can visit sitemap under the domain.

### 2. Submit the Sitemap to Google Search Console
* Login to Google search console (https://search.google.com/) and select *Sitemap* put the url of the sitemap and submit.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6r0rqj26il4oqpkv5yc7.png)

That's it!

## Articles
There are some of my articles. Feel free to check if you like! 
* My blog-posts for software developing: https://medium.com/a-layman
* My web resume: https://jenhsuan.github.io/ALayman/cover.html
* Facebook page: https://www.facebook.com/imalayman
Which is most powerful, Golang or Node.js?
Tags: go, node
Published: 2020-05-16 12:24:04

They have different strengths, I'd say neither. But if you have a specific purposes one could be better suited for your work than the other.

We'll compare both Golang and Node.js

**Concurrency**
Golang is far superior to Node.js for concurrency. Golang can start hundreds of thousands of threads (<a href="https://golangr.com/goroutines/">goroutines</a>) and it  would be fine, not the case for Node.js

**Ecosystem**
Nodejs has a larger ecosystem with very good 3rd-party tooling. With nodejs you can build single page apps written end-to-end in javascript.

**Performance**
If you need high performance, Go is a better choice. Node.js is an interpreted language based on JavaScript, that is slower than a compiled language like Go.

Golang compiles to fast native code. Node.js runs JavaScript that is much slower.

**Learning Curve**
Go needs to be learned from the start (<a href="https://golangr.com/">learn Go</a>). But all web developers already know Javascript. Javascript is one of the most known languages.

That makes it much easier to start with Node.js than Golang for many developers. That said, Golang is not hard to learn either.

So to create a short list:

**Pros of Go:**

* Faster than Node 
* Concurrency model
* Has a standard library 
* Static binaries, portable binaries

**Pros of Node:**

* Has a larger ecosystem
* Good 3rd-party tooling.
* JavaScript

**Related links:**
* <a href="https://golang.org/">Golang website</a>
* <a href="https://nodejs.org/en/">Nodejs website</a>
Windows and Linux: A Sane Discussion
Tags: discuss, healthydebate
Published: 2020-05-16 15:56:31

---
title: Windows and Linux: A Sane Discussion
published: true
description: It's time we reopened the conversation about Windows vs. Linux...in a healthy way.
tags: discuss, healthydebate
---

Let's face it — neither Microsoft Windows nor Linux in its many distributions are the same as they were ten years ago. The face of the computing ecosystem has changed. The past few years especially have brought many surprises, not least of which included Microsoft's wholesale embracing of open source and the Linux community.

I think it's time we reopened the conversation about Windows vs. Linux. What's working? What's not? What factors go into choosing one over the other?

I think @shadowjonathan made a very good point in response to @kailyons's decision to archive his posts surrounding this very topic...

{% devcomment p3k2 %}

That got me thinking...*THIS IS DEV!* Not only do we have a moderation staff who cares, but we have a nifty little tool that allows authors to hide comments.

---

# What are the pros and cons of Windows vs. Linux? What factors go into deciding to use one or the other?

---


Here's the rules:

1. You can share your opinions and your technical views, in favor of Microsoft Windows, Linux, any other operating system, or both...but you MUST be polite!

2. Disagreement isn't rude.

3. Healthy debate is fine, but hostility, elitism, and ad hominem attacks are not.

4. Unconstructive comments, even those that are "just shy" of violating community rules, WILL be hidden, and reported as needed.

5. I also don't want to receive any argumentative or offensive DMs about this. Any such messages will be reported, and then summarily ignored.

6. **If you're concerned about getting attacked for your views, please DM your comment to me, and I'll post it anonymously on your behalf!** (I will not post replies under most circumstances, only initial comments.)

Since I'm obviously the guy with the "hide posts" ability here, understand that I'm going to be more than a bit zealous about keeping this conversation safe for everyone, even the folks who have altogether opposite views from me. If your post gets hidden, move on.
# Understanding the Role and Usage of Node.js
Tags: node, javascript, tutorial, codequality
Published: 2020-05-16 17:00:47

When a user interacts with our web site there may be a chance when it performs some operation like registration, login, or posts anything. For example, the user performs a login operation, the user could unhook the validation javascript from the controls. Mostly the Client Side Validation depends on the JavaScript Language, so if users turn JavaScript off, it can easily bypass and submit dangerous input to the server. So the Client Side Validation can not protect your application from malicious attacks on your server resources and databases. therefore node.js comes into the picture. with the help of the node.js, we can perform all these operations on the server.
![Alt text of image](https://miro.medium.com/max/980/1*zyPkYiWEjIy3qKPqVWjXxQ.png)

Node.js, can perform server-side validation, database connection, authentication, and write our business logic.
The huge advantage of node.js is that it uses javascript, a language which you need so much in modern web development for all the frontend, for some build tool and if you then can also use it on their server-side you don’t need to learn a bunch of different languages you can use the same language.

## **Node.js Role (In Web Development)**
##### **Run Server**
Create Server and listen to the incoming request
##### **Business Logic**
Handle Request, Validate Input, Connect to Database
##### **Response**
Return Response
Dhaka University Paragraph
Published: 2023-04-02 20:44:36

Dhaka University is the result of a movement for regional identity. It was founded by the people of East Bengal. and reached its zenith in the war for Bangladeshi independence. In 2021, Bangladesh and the University of Dhaka will both be celebrating their 50th birthdays. This is to remember these important events. In this article, we will discuss DU’s 100-year short paragraph at a glance.

DU was started in 1921 with just three faculties, 12 departments, three dorms, 60 teachers, and 877 students living on 600 acres of land. It has since grown into a huge educational and political force.

As it prepares to mark its 100th anniversary on Thursday, DU has 13 faculties, 83 departments, 12 institutions, 20 residence halls, 3 hostels, and more than 56 research centers. According to the university’s website, there are now 37,018 students and 1,992 faculty members.

[Dhaka University paragraph](https://www.banglanewsinfo.com/dhaka-university-du/)

An early distinguishing factor for Dhaka University was the university’s non-affiliated and residential nature, akin to Oxford University. Dhaka University is known as the “Oxford of the East” because of its top-notch living and learning facilities.

Affiliation mandates have replaced the university’s sole residency requirement since 1947.
Dart and C : how to ffi and wasm (2) Hello 
Tags: dart, c, ffi, webassembly
Published: 2020-05-16 18:34:22

Let's create the Shared Library and JS Library in the environment we created [last time](https://dev.to/kyorohiro/dart-and-c-how-to-support-ffi-and-wasm-1-514f).

Create a C language function that displays "Hello !!" and call that function at  "Web browser" and "Linux Server".


# Create Clang func

```c:ky.c
#include <stdio.h>

// [Linux]
// find . -name "*.o" | xargs rm
// gcc -Wall -Werror -fpic -I. -c ky.c -o ky.o 
// gcc -shared -o libky.so ky.o

// [Wasm]
// find . -name "*.o" | xargs rm
// find . -name "*.wasm" | xargs rm
// emcc ky.c -o ky.o 
// emcc ky.o -o libky.js -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' -s EXPORTED_FUNCTIONS="['_print_hello']"
// cp libky.js ../web/libky.js 
// cp libky.wasm ../web/libky.wasm
void print_hello() {
    printf("Hello!!\n");
}
```

## Create Shared Library 

```bash
$ find . -name "*.o" | xargs rm
$ gcc -Wall -Werror -fpic -I. -c ky.c -o ky.o 
$ gcc -shared -o libky.so ky.o
```

## Create JS and WASM

```bash
$ find . -name "*.o" | xargs rm
$ find . -name "*.wasm" | xargs rm
$ emcc ky.c -o ky.o 
$ emcc ky.o -o libky.js -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' -s EXPORTED_FUNCTIONS="['_print_hello']"
```

# Let's call this function from linux server

```dart:main.dart
import 'dart:ffi' as ffi;

typedef PrintHelloFunc = ffi.Pointer<ffi.Void> Function();
typedef PrintHello = ffi.Pointer<ffi.Void> Function();

ffi.DynamicLibrary dylib = ffi.DynamicLibrary.open('/app/libc/libky.so');
PrintHello _print_hello = dylib
    .lookup<ffi.NativeFunction<PrintHelloFunc>>('print_hello')
    .asFunction();

void printHello() {
  _print_hello();
}

main(List<String> args) {
  printHello();
}
```

# Let's call this function from Web Browser

```dart:main.dart
import 'dart:js' as js;

js.JsObject Module = js.context['Module'];
js.JsFunction _print_hello =  Module.callMethod('cwrap',['print_hello','',[]]);

void printHello() {
  _print_hello.apply([]);
}

void main() {  
  printHello();
}


```

# Test

```bash 
$ dart ./bin/main.dart 
```

```bash
webdev serve --hostname=0.0.0.0
```

thanks!!


# Next time 

I will explain how to handle Buffer OR how to handle various Primitives.

# PS 

this text's code is the following
https://github.com/kyorohiro/dart_clang_codeserver/tree/02_hello
How do you name your webpack/parcel/etc aliases?
Tags: discuss, javascript, webpack
Published: 2020-05-17 00:16:22

Bundlers such as webpack have an option to replace your relative paths with aliases. I've seen some articles and tutorial where they use either `@` prefix or capitalizing the first letter of the relative path, like `App/` or `Components/`.

For me I started using `@` prefixes at the beginning but then started to experiment around with `#` prefixes instead for my projects.

```js
// webpack config
resolve: {
  alias: {
    '#app': './src'
  }
}
```

I'm interested to know what you use as your webpack (or any other bundler) aliases? Or if you don't use them at all?
TIL: Hidden switch of ecto_sql migration
Tags: elixir, phoenix, ecto
Published: 2020-05-17 07:11:07

There is a hidden switch `--change` for `mix ecto.gen.migration`. 

```
mix ecto.gen.migration --change "create table(:user)"
```

The above code simply substitutes the value inside the `def change` function.

```
# excerpt from ecto_sql

  embed_template :migration, """
  defmodule <%= inspect @mod %> do
    use <%= inspect migration_module() %>

    def change do
  <%= @change %>
    end
  end
  """
```
Build a Complete Solution With AWS, Django , React , React Native and Heroku - Day 2
Tags: python, javascript, react, django
Published: 2020-05-17 14:41:25

Today I got the List api endpoints from the django backend working

Root API endpoint = /api/v1

**Products** = /products/all
**Warehouses** = /warehouses/all
**Customers** = /customers/all
**Shipments**  = /shipments/all

To enable My React work with my backend I needed to install `django-cors-headers` and add **localhost:300** to my whitelist.This is as a result of **CORS**


Cross-origin resource sharing is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.

The next thing I need to do is to work on all my components in React.
TypeScript: Object Destructuring
Published: 2020-05-17 18:55:59

Writing annotations for primitive values and object literals is pretty straightforward, but it differs slightly when it comes to object destructuration. In this post, I want to shortly mention differences and give a couple of examples of how to write annotations for the destructured properties of object literals.

### Object literal

For simple object literals we can write annotations just after the variable and before the object. For example:

```ts
const car: { model: string; year: number } = {
  model: "Ford",
  year: "1969",
};
```

In short, we write the whole object structure and assign types before the actual object.
If the object has nested properties, we list them in the similar structure:

```ts
const car: { model: string; year: number; owner: { name: string } } = {
    model: 'Ford Mustang',
    year: 1969,
    owner: {
        name: 'John',
    },
}
```

### Object Destructuring

Giving types for destructured object properties is not very common. Usually, the inference system is reliable and assigns correct types for variables accurately, well most of the time. But there are cases when you need to add types manually. For example, if a function returns an object and it has `any` type, or if the object is initiated first and some properties are added later.
We will use a declared object bellow as an example. It has a couple of properties, including a nested object and a method. We will destructure all properties using ES6 syntax and explain how to add annotations to them.

```ts
const car = {
    model: 'Ford Mustang',
    year: 1969,
    owner: {
        name: 'John',
    },
    setOwner(name: string): void {
        this.owner.name = name;
    }
}
```

Lets take out the first property from the object:

```ts
const { model } = car;
```

First, we cannot add just a type for a variable. Meaning, that writing `const { model }: string = car` is incorrect. What's wrong with this approach? Well, imagine if you have to pull out a second property from the same object: `const { mode, year }: string = car` then which is the string?

When destructing, a type system expects you to write the full object property, which gives the ability to add types for all the properties:

```ts
const { model }: { model: string } = car;

// pull out more properties
const { model, year }: { model: string; year: number } = car;
```

The same goes for the nested properties:

```ts
// destructure name property
const { owner: { name } } = car;

// mirror the whole "owner" property
const { owner: { name } }: { owner: { name: string } } = car;
```

The methods will have similar syntax, though they need to mention that preferable methods should be annotated inside the object, and TypeScript will notify you. Nevertheless, let's add type for a destructured method:

```ts
const { setOwner }: { setOwner: (name: string) => void } = car;
```

## Conclusion

To sum up, if annotations are required for destructured object properties, we have to mirror and write the exact structure of that property.
Como clonar um app no Heroku
Tags: devops
Published: 2020-05-17 19:48:35

Originalmente postado no [Medium](https://medium.com/@jonyhayama/como-clonar-um-app-no-heroku-f8b7488950e3)

Hoje fui confrontado com uma task super simples: Criar 3 ambientes de _staging_ para que nossos QAs trabalharem e assim evitar que fiquem “trombando” uns nos outros. O nosso cenário até o momento era, 1 ambiente por projeto e 2 profissionais para fazer os testes.

Nosso problema surgiu quando decidimos fazer uma força-tarefa e agilizar as entregas para um cliente em específico. Todo o time será realocado para o mesmo projeto. Aliado a isso, um novo QA foi contratado para compor a equipe.

Agora ficamos: 1 projeto, 3 QAs e apenas 1 ambiente para que façam seus testes.

Com apenas um ambiente, é natural que não consigam testar coisas diferentes em paralelo. Nossa ideia foi bastante simples: Criar um ambiente de staging para cada um e compartilho como fizemos:

A ideia é copiar o app `my-staging` para `my-new-staging`. Estou partindo do pressuposto que o [Heroku Cli](https://devcenter.heroku.com/articles/heroku-cli) já está instalado e operando.

## Repositório

Aqui trabalhamos com o Automatic Deploy, vinculado a uma branch específica do GitHub (carinhosamente chamada de `stg/star-wars`).

Esse processo é bastante simples:

```bash
git checkout master
git pull
git checkout -b stg/star-wars
git push -u origin HEAD
```

Depois crie a nova aplicação no Heroku e na seção “Deploy” conecte seu GitHub e escolha a branch conforme o print abaixo:

![Heroku Config](https://dev-to-uploads.s3.amazonaws.com/i/v8uha9c449e8mwwlmkgr.png)

## Copiando as variáveis de ambiente

Primeiro copiamos as variáveis para um `txt` qualquer:

```bash
heroku config -s -a my-staging > heroku-env.txt
```

Depois é necessário enviá-las para a nova aplicação. Antes disso, é importante revisar as variáveis que, de fato, precisam ir. De cara, precisamos remover `DATABASE_URL`, já que o banco de dados será outro.

```bash
cat heroku-env.txt | tr '\n' ' ' | xargs heroku config:set -a my-new-staging
```

## Copiando o banco de dados (PostgreSQL)

Primeiramente precisamos gerar o backup na app de origem:

```bash
heroku pg:backups:capture -a my-staging
```

Esse comando terá uma resposta parecida com o print abaixo:

![Heroku DB Response](https://dev-to-uploads.s3.amazonaws.com/i/dr071jp0p5skh41tbjfm.png)

O importante aqui é a referência `b079`, que utilizaremos no próximo comando:

```bash
heroku pg:backups:restore my-staging::b079 --app my-new-staging
```

Repeti esse processo mais duas vezes e _voilà_ card movido para “done” 😃
Business logic in Stored Procedures?
Tags: database, sql, data, design
Published: 2020-05-17 21:41:51

---
title:  Business logic in Stored Procedures?
published: true
description: What is a Stored Procedure? What are the benefits of a stored procedure?
tags: [Database, sql,data,design]
cover_image: https://www.complexsql.com/wp-content/uploads/2018/04/Stored-Procedure.png
---
>A stored procedure(SP) is a set of Structured Query Language (SQL) statements with a given name stored in RDBMS, so it can be reused and shared by multiple programs.

## Performance
First SP in some databases system are compiled once and are in always executable form making calls faster since they can be cached. Therefore, increasing performance.

From my experience in using SP, I have been able to group multiple SQL commands and queries. This reduces network traffic and chaining of IFS on the code side.  SP makes use of transactions e.g. using PL and T-SQL. 
## Security
SP enhances security since the user has to pass some values to the database without knowing the underlining tables, views, and other information. The Developer calls the methods. This makes use of abstraction. The business logic is abstracted. 

# Maintenability
SP enhances the maintainability of the System. Some conditions can be changed without necessarily changing the frontend code. Let's say the VAT tax reduces from 16% to 12%. This change can be made in the database without recompiling a POS system developed in 20 supermarkets. Some DB ensures changes in SP are transferred to all other slave databases. 

SP ensures a central point for all business logic. No scattering of the business logic all over.
## Downside
one negative side of SP is that it leads to vendor locking eg T-SQL and PL/SQL. When migrating to a new DB you need to write some of them from scratch.
## Privilege Abuse
How do we ensure security and authorization? users who have DB-admin roles may abuse their roles and execute some SP maliciously. Ensuring data ACID properties becomes a challenge to an organization.

How best can we avoid database degradation?
## Where applicable?
I would recommend using SP when:
- the business logic is ever-changing
- doing complex data processing like in a warehouse
Biggest Challenges Of Cloud Computing In 2020

Published: 2020-05-18 07:51:46

Everyone is using the cloud computing technology knowingly or unknowingly. Cloud computing is emerging as a need of this modern world. If you have not used it, you will surely use it in future due to its amazing benefits. Let us see what cloud computing is.

**What Is Cloud Computing?**
Simply, cloud computing is accessing, storing, and managing a huge amount of data over the web. And Firewall is there to secure this entire data. With the use of cloud computing you can easily access any software, tool or data installed in data centers globally. Preparing any document over the web and web based email services are the most common examples of cloud technology. There are various types of cloud computing platforms such as platform as a service (PaaS), Infrastructure as a service(IaaS) and Software as a service(SaaS). These days, this technology plays a vital role in business development too. Each technology comes with some issues rather than being the strength of some major business industries. Also it can create some major problems under some rare circumstances. Let us see the Biggest  challenges of cloud computing in 2020.

**Biggest Challenges Of Cloud Computing In 2020–**
*1. Shortage Of Resources And Experts-*
According to the survey 75% of the respondent listed it as a challenge and 23% stated that it was a major challenge. Many IT specialists are trying to improve their cloud computing future predictions expertise, Employers still feel that it is a challenging issue to get workers the skills they require. And future trends in cloud computing seem to grow in the near future. Technologies like Big data, mobile, security will become more valuable for businesses in the future. Many organizations are looking to overcome the challenges of moving to cloud computing by employing experts having cloud computing skills or certifications. Experts also suggest the training of existing staff to speed up with the latest technology.

*2. Security-*
With the arrival of public cloud, many organizations are worried about security risks. As per the analysis, it is one of the most serious issues with cloud computing technology in 2020. Cybersecurity experts are more worried about the latest cloud security than that of IT employees. They have fear about the data loss and data leakage, breaches and confidentiality of data. A report by rightscale analyzed that as companies become more experienced with the cloud, the cloud challenges shifts. Security becomes a major issue among cloud beginners, when cost becomes a major challenge for advanced and beginner users.

Know more at- [https://solaceinfotech.com/blog/biggest-challenges-of-cloud-computing-in-2020/]