teleren/devto huggingface dataset:
تجربه برنامه نویسی با زبان swift روی ویندوز ممکن شد
Tags: swift, programming
Published: 2020-10-11 11:11:52

در این هفته شاهد ارائه‌ی زبان برنامه نویسی swift روی ویندوز 10 بودیم و حالا توسعه دهندگان می‌توانند ابزارهای این زبان را از طریق پروژه‌ی متن باز دانلود کنند. این ابزارها شامل کامپوننت‌های توسعه‌ای هستند که برای کد نویسی و اجرای مستقیم کدهای swift روی ویندوز نیاز هستند. این ابزارها شامل کامپایلر، کتابخانه‌های استاندارد، کتابخانه‌های مرکزی و اصلی و همه‌ی عناصری کلیدی است که برای ساختن اپلیکیشن‌های کاربردی نیاز است.

تقریباً بیشتر از 1 سال است که تلاش‌های زیادی برای پورت کردن Swift روی ویندوز صورت گرفته است و حالا به نظر می‌رسد که بالاخره می‌توان به صورت واقعی، کد نویسی Swift را روی ویندوز تجربه کرد. با این حال پورت کردن swift روی ویندوز، به سادگی پورت کردن کامپایلر نیست اما این اطمینان را می‌دهد که کل اکوسیستم روی ویندوز قابل دسترسی است.

در راستای نمایش قابلیت‌های این زبان برنامه نویسی روی ویندوز، دموی یک برنامه‌ی ماشین حساب که با استفاده از ابزارهای swift روی ویندوز توسعه داده شد و همچنین از Visual Studio 2019 هم برای توسعه آن استفاده شده است، را می‌توانید از این لینک در گیت هاب ببینید. اگرچه این برنامه با استفاده از CMake توسعه داده شده است اما سلیم عبدالرسول، یکی از اعضای تیم توسعه دهنده‌ی زبان برنامه نویسی Swift و همچنین مهندس نرم افزار در Google Brain، توضیح داده است که پشتیبانی از Swift Package Manager روی ویندوز در حال انجام است.

برخی از توسعه دهندگان در حال حاضر در حال آزمایش زبان برنامه نویسی Swift روی ویندوز هستند. به عنوان یکی از این افراد، می‌توانیم از Readdle، یکی از سابقه‌دارترین توسعه دهندگان نرم افزار برای مک و iOS نام ببریم که از سال 2019 در حال ایجاد یک نسخه‌ی cross-platform از اپلیکیشن ایمیل Spark است.

اگر جز آن دسته از توسعه دهندگانی هستید که به تجربه‌ی برنامه نویسی با swift روی ویندوز علاقه دارید، می‌توانید به این وب سایت مراجعه کنید. همچنین در صورت یافتن هر گونه باگ، می‌توانید آن‌ها را گزارش دهید.

منبع : فیسیت
https://faceit.ir/articles/swift-programming-on-windows/
Create a log service with PHP and Clickhouse [Part 2]
Tags: php, clickhouse, database, logging
Published: 2020-10-11 10:56:50

With Vector taking care of mining and shipping our logs, we need a place to store all these logs. 

I built this logging service for simple and quick debugging and alerting for dev team. My goals are: fast and cheap. The log service can fail and it's okie to fail and get restarted again quickly.

I came up with the following table schema for my log (I want it to be as generic as possible to store logs from different sources)

```
CREATE TABLE IF NOT EXISTS log (
        instance_id String,
        node_id String,
        project_id String,    
        app_name String, 
        app_version String,
        client_ip String,            
        log_level String,
        log_message String,
        log_code Int32,
        log_context String,        
        log_created_timestamp UInt32,
        log_time DateTime,
        log_date Date DEFAULT toDate(log_time)               
    )
    ENGINE = MergeTree()
    PARTITION BY toYYYYMM(log_date)
    TTL log_date + INTERVAL 1 Week
    ORDER BY (project_id, log_created_timestamp)
```

There are several things I would like to point out:

1. I don't care about old logs, for now, so I decided that logs older than 1 week can be deleted.
2. I want logs to always be listed by created date (newest logs first).
3. I want to filter by certain criteria (to group logs by application, client, etc)
4. I'm a Clickhouse newbie, and I'm still figuring things out. I secretly hope that someone will look at the table schema and point out improvements that I can do.

In the beginning, I logged error logs as well as access logs, and the number of records quickly reach billions after just a few days. The good thing is that the log service still runs surprisingly well on a rather small server instance (CPU: 2 vCore RAM: 4096 MB Storage: 80 GB SSD). The bad thing is that listing keeps timing out. I later found out that I didn't set up correct indexes for my table (you really really must setup indexes for the columns you want to filter and order by).

Next time I will show how I handle the logs using PHP.
i18n + Google Spreadsheet = ♥️
Tags: ui, webdev, javascript
Published: 2020-10-11 10:54:49

---
title: i18n + Google Spreadsheet = ♥️
published: true
description: Use Google Spreadsheet to crowdsource translations for your projects
tags: #ui #webdev #javascript
---

I created a CLI tool to synchronise translations from Google Spreadsheet to yaml/json files. 

I was using it already for couple projects and today was starting a new one and realised that I better do it configurable and publish on npm to make it easier.

https://github.com/razbakov/sourcy

## Installation

```bash
yarn add @razbakov/sourcy -D
```

Add to package.json:

```json
{
  "scripts": {
    "sourcy": "sourcy"
  }
}
```

Create **sourcy.config.js** in project root:

```js
module.exports = {
  sources: [
    {
      spreadsheetId: "spreadsheet id",
      range: "sheet name",
      output: "./locales/",
      transformer: "i18n",
      format: "yaml", // or json
    },
  ],
};
```

Execute and follow instructions:

```bash
yarn sourcy
```

## Transformer: i18n

**Input:**

| key        | en   | de         | es             | ru      |
| ---------- | ---- | ---------- | -------------- | ------- |
| home.title | Home | Startseite | Página inicial | Главная |

**Output:**

```
en.yml
    home.title: Home

de.yml
    home.title: Startseite

es.yml
    home.title: Página inicial

ru.yml
    home.title: Главная
```
Docker layers and optimizing your Dockerfile
Tags: docker
Published: 2020-10-11 10:40:32

---
title: Docker layers and optimizing your Dockerfile
published: true
description: Speed up your Dockerfile by splitting commands 
tags: docker
//cover_image: https://direct_url_to_image.jpg
---

One small problem i recently came across was a project that had a slow build time to run, ~7 mins approx. Config changes required a rebuild, so 7 mins per change. Something i noticed was npm packages being installed for config changes and even HTML changes - why do i need to download 1000+ npm packages if i'm only changing HTML? Madness!

Docker _can_ cache commands but only if the Dockerfile is written in a certain way. Take the following scenario:

``` 
FROM node:9
COPY /src /src
RUN npm install
RUN npm build
```

Docker _can_ cache each command and create a [Layer](https://docs.docker.com/storage/storagedriver/#images-and-layers). Layers are cached if Docker detects that no files have been changed for that command. 


By splitting the COPY into 2 commands, we can utilize caching and speed up the build time for builds that haven't modified npm packages:


```
FROM node:9
COPY /src/package*.json /src
# Docker will cache these 2 layers if package.json and package.lock.json are unmodified
RUN npm install

# copy the rest of our code and run a fresh build
COPY /src /src
RUN npm build
```

Just by adding 1 line, we can speed up most of our builds - in my scenario it was local builds and CI server builds (npm packages rarely change in a mature project)

This 1 line `Dockerfile` change has saved our team a few minutes per build (we had some large / slow npm dependencies for things like integration testing such as cypress)

That's all folks!
Making an HR software with Spring Boot Part I
Tags: java, mysql
Published: 2020-10-11 10:38:32

So, this other day I decided to start learning Spring Boot, and I really grew to despise the todo list tutorials people made. Of course, for beginners, they are okay. But when you're done, the question will be now what?  Hey, at least you know how to make a todo list, right?

We are going to be making an employee management system. Why you ask? Just because! 

Anyway, using Spring Boot with MySQL, we are going to build an employee management system.  This system will be for managing employees and their leave days, salaries and all of that nonsense.  It's also going to be keeping track of all their suspensions, misconducts ... etc. 

The technologies we are going to use include but are not limited to:

- Java (Spring Boot) for the API
- MySQL (Database)
- VueJs (for the front-end dashboard)
- Probably Bootstrap for the UI

Who is this tutorial for? I don't know! I just decided to make a tutorial to show how awesome I am ... or maybe how terrible I am at software development. It's up to you to pick one at the end. By the way, I'm a complete noob when it comes to Vue, so if you know a better way of doing things ...eh ... good for you!

For the lazy ones, the code is available on github, [here](https://github.com/kudzaitsapo/piqued).  And if you see the code incomplete, then hold your horses... it's still a work in progress after all. 

So, where do we begin? 

First, we'll start by describing a scenario. What problem are we solving, and why? (*the why might be a little fuzzy but hey...at least it's there*) By the way, all names specified in the scenario are purely fictional (*I made them up*), and any resemblance to actual people and organizations is purely coincidental (*it wasn't planned!*).

Congratulations, you've managed to land a job as a **software** engineer at the **Dull Company (Pvt) Ltd**. Now, before you came along, the Dull Company was spending millions of dollars annually on a crappy outsourced software called **Aware**. The system didn't work 99% of the time, and when it did, it was mostly due to a bug. However, because it was recommended by a previous manager, the company stuck with it. The  CEO was outraged when he realized that they were spending that much money on a stupid, non-working program. Being the genius that he's not, he told the company to hire a software engineer to develop and manage internal systems. This is where you come in.

We are not going into the details of how you got the job, but after you come in, your first project is to develop a system for managing employees. This software is supposed to replace **Aware**. 

Now, we are not going to go through the entire SDLC, and of course we are going to assume that you're given all the requirements. (*Don't ask me why?*) Anyway, we are going to jump in head first and develop the darn system for Dull Company (Pvt) Ltd. The first thing we are going to do is to design the database, and we are going to do this in the next article. So, go ahead and prepare your mind, it's going to be a long journey ahead.
"this" in javascript
Tags: javascript, react, 100daysofcode
Published: 2020-10-11 10:29:47

***For many Developers "this" keyword has been a nightmare as the usage of "this" sometimes leads to unknown bug***.


####In this article we will explore what "this" keyword is.

First, let's review what javascript objects are for the sake of better understanding.

### Object

*** Object is a collection of `key: value` pairs and more complex entities (methods, nested objects).

###### syntax

```
const person = {
   firstName:"John", // firstname = KEY , John = value
   lastName:"Doe"
}
```
Objects with complex entities

```
const person = {
   firstName:"John", // firstname = KEY , John = value
   lastName:"Doe",
   autoIntro:function(){
             console.log("Hello nice to meet you!!")}
}
```
In the above code 

* `firstName` also known as property of an object.
* `autoIntro` is a method of an object.

To access property and method 

```
person.firstName // John
person.autoIntro() // Hello nice to meet you!!

```
Let's take a case here !!

What if we make our intro more dynamic 
like this `Hello myself John Doe, nice to meet you!! `.

we can achieve this with "this".

 ```
const person = {
firstName:"John", // firstname = KEY , John = value
lastName:"Doe",
autoIntro:function(){
console.log(`Hello ${this.firstName} ${this.lastName},nice to meet you!!`)
}
}
 ```
 `person.autoIntro()` will generate our desired output.

### Explanation 
`this` always refers to the object "Before dot".

`person.autoIntro()`
 Here `this` refers to the person object before dot `.`

 so when we use `this` in method body it actually referring to the person object.

`this.firstName` == `person.lastName` 

#### `this` value always evaluated at run-time depending upon the context.

```
let userOne = { name: "John" };
let userTwo = { name: "Max" };

function sayHi() {
  alert( this.name );
}

// use the same function in two objects
userOne.f = sayHi;
userTwo.f = sayHi;

// these calls have different this
// "this" inside the function is the object "before the dot"
userOne.f(); // John  (this == userOne)
userTwo.f(); // Max  (this == userTwo)
```  

#### `this` in arrow function

In arrow function, this keyword has no value .
"this" keyword always refer to the outer scope.

For example :

```
let user = {
 name:"john",
sayhi:function(){
  let sayName = ()=>{
  console.log(this.name) // this == user
}
sayName();
}
}
user.sayhi(); // john
```

In the above code, "this" keyword refers to the outer scope function  `sayhi`.

lets change `sayhi` to arrow function and remove inner function.

```
let user = {
  name: "john",
  sayhi:()=> {  
      console.log(this.name); // this == undefined
  }
};
user.sayhi(); // error Cannot read property 'name' of undefined
``` 
so here "this" is `undefined` because as we know in arrow function `this` has no value.

Moreover, there's lot more about "this". 

[This keyword](https://www.w3schools.com/js/js_this.asp)

"Happy coding":heart:
🚀Closure in Javascript👨‍💻 
Tags: javascript, beginners
Published: 2020-10-11 10:22:47

Hello World!

##What is Closure?

*A _closure_ is the combination of a function and the lexical environment within which that function was declared.*

Closure is an inner function that has access to outer(enclosing) function variables.

Closure has 3 scope chains:

 - has access to Own scope
 -  has access to Outer function variables
 -  has access to Global variables

*we can access variables which are outside of function*

## Using closure

Closure are used for data privacy. When you use closures for data privacy, the enclosed variables are only in scope within the containing (outer) function. You can’t get at the data from an outside scope except through the object’s **privileged methods**.

let  see example of  closure :

   ````javascript
  function User(name){ 
     let displayAge = function(age){
	    console.log(name + " is "+age+" year old.");
	    }
	  return  displayAge;
	 }
	
  let user1 = User("John");
  user1("22") // Output : John is 22 year old.
````

In above example , `User()` is the outer function that returns  inner function `displayAge()`. Inner function has access to outer scope variable even though outer function is returned.

## Conclusion 
Closure are nothing but the inner or nested function that has access to variable that are in outer scope.
Using pyenv to install Python and create a virtual environment
Tags: python, development, pyenv, virtualenv
Published: 2020-10-11 10:21:26

---
title: Using pyenv to install Python and create a virtual environment
published: true
description: How to use pyenv to install a specific version of Python and create a virtual environment with that version
tags: python, development, pyenv, virtualenv
//cover_image: https://direct_url_to_image.jpg
---

A few days ago [Python 3.9.0](https://docs.python.org/3/whatsnew/3.9.html) has been released and I really wanted to test ist latest features (maybe I will do a separate post to talk about them) without messing my system with another Python version.

To manage my Python versions I've been using [pyenv](https://github.com/pyenv/pyenv) for a while and once configured, it's very easy to install a new Python version.

## Make sure your pyenv is updated

You should have at least **pyenv 1.2.21** if you want to test Python 3.9.0

In case you haven't updated it and you are using MacOS, you can do it with this command:

```
brew update && brew upgrade pyenv
```

once installed you should see the latest version:

```
pyenv --version
pyenv 1.2.21
```

## Install Python 3.9.0

To install Python 3.9.0 you only need `pyenv install 3.9.0`:

```
pyenv install 3.9.0
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.0.tar.xz...
-> https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz
    Installing Python-3.9.0...
    python-build: use readline from homebrew
    python-build: use zlib from xcode sdk
    Installed Python-3.9.0 to /Users/andrea/.pyenv/versions/3.9.0
```

## Set Python 3.9.0 as the local version

Now that the version you want has been installed, you need to tell pyenv you want to use it:

```
pyenv local 3.9.0
pyenv which python
/Users/andrea/.pyenv/versions/3.9.0/bin/python
```

You can find the rest of the tutorial on my blog https://www.andreagrandi.it/2020/10/10/install-python-with-pyenv-create-virtual-environment-with-specific-python-version/
📽 2 videos about rust code coverage in VSCode
Tags: rust, vscode, coverage
Published: 2020-10-11 10:18:28

---
title: 📽 2 videos about rust code coverage in VSCode
published: true
description: 
tags: rust, rustlang, vscode, coverage
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/9avpvhnlmf8qzrglkvbd.png
---

# Useless personal stuff
  It's several years now that I feel the need to share what I learn with other people.
  I gained so much value from free online content that at this point I consider
  immoral for me to not give back something to the community.

  I started my sharing process one year ago with my [personal website](https://www.marcoieni.com/) and it has
  been great!
  However, in general I prefer videos to text, because I can watch them on the
  go, while I am eating something and so on.
  Making videos is something I wanted to do for a long time and now finally I
  declare procrastination over (at the moment, at least 😅).

# Code coverage in VSCode
  We will use the following three tools:

  - [cargo tarpaulin](https://crates.io/crates/cargo-tarpaulin): analyzes your rust code and gives you code coverage data
  - [cargo watch](https://crates.io/crates/cargo-watch): run =cargo tarpaulin= every time we save the file
  - [coverage gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters): show covered lines on VSCode

## First video: basics

{% youtube 6pDku63JNYQ %}

   In the first video I explain the basics that will allow you to display which
   lines are covered by your tests in VSCode.

## Second video: let's automatize the process

{% youtube JEgrkmEAHjA %}

   I shot the second one after some really helpful feedback by some [reddit](https://www.reddit.com/r/rust/comments/j0ribi/rust_code_coverage_in_vscode/) users.
   I show how to automatize the process with cargo watch.

# Give me feedback!

  These are one of my first videos and as you can hear my English is far from
  perfect, but I'm trying to improve.
  Please give me feedback regarding any aspect of these videos that you think I
  can improve.

  Anyway, I was very happy to receive users feedback after my first video:
  it looks like sharing what you know is a really good way to learn what you don't. 😉

  I hope my two cents will be useful for someone, bye! 😀
Kotlin MPP: Unable to compile C bridges
Tags: kotlin, multiplatform, android, fixbug
Published: 2020-10-11 10:10:18

We've come across this problem several times, and for the first time, it was a bit problem to find what's wrong.

Basically, it's missing `libncurses5` which you can simply install on Ubuntu/Debian:

```bash
apt-get install libncurses5
```

This problem usually hits us on CI/CD, where you are in a clean environment. The last time, it was with Github Actions after moving our runner to a new set of servers. 

This one is just a quick tip that can save you nerves eventually :-).

---

**This post was originally published on [Localazy blog](https://localazy.com/blog).**
React code... Navid Mansuri
Tags: hacktoberfest, github, javascript, html
Published: 2020-10-11 09:45:42

The quickest way to start learning React is to write React directly in your HTML files. Start by including three scripts, the first two let us write React code in our JavaScripts, and the third, Babel, allows us to write JSX syntax and ES6 in older browsers. You will learn more about JSX in the React JSX chapter.
Expat to Canada ?
Tags: career, vue
Published: 2020-10-11 09:41:01

Hi everyone,

After going to a job fair recently, I stumbled across a proposal of expatriation to Canada to find job and get a better quality of life as a developer in Vue/Nuxt/PHP.


So my question here will be : 
Has anyone did that ? Expat from a country to Canada and got an actual better quality of life ?

How was it ? What are the main difference / difficulties ? Is the market big enough for it ?

Is it better to wait the end of Covid to plan anything like that ?

Thanks for any of your answers 😉
React, Prisma, GraphQL Boilerplate
Tags: react, javascript, graphql, hacktoberfest
Published: 2020-10-11 09:37:19

# Introduction

I find myself often recreating simple landing pages, login, logout, signup flows and I got really tired of it. Especially when its for small projects.

I decided to make a nice easy to use boilerplate accessible for all.

{% github crimson-med/react-prisma2-graphql-boilerplate no-readme %}

This project is open to Hacktoberfest contributions as long as the `CONTRIBUTING.md` is respected.

# Quick Start

First:

```
git clone https://github.com/crimson-med/react-prisma2-graphql-boilerplate.git
```

Then follow the following instructions.

Open two terminals and follow the following commands:

---

| Terminal 1   | Terminal 2   |
|--------------|--------------|
| cd backend   | cd frontend  |
| yarn install | yarn install |
| yarn dev     | yarn start   |

---

That's it you are up and running!

# Frontend

In this frontend we leverage React for all the rendering. We also user OvermindJS for state management and ApolloClient for GraphQL interactions.

# Backend

An implementation of a GraphQL server with an email-password-based authentication workflow and authentication rules, based on Prisma, graphql-yoga, graphql-shield & Nexus Schema. It is based on a SQLite database.

Since we are using prisma the database can easily be switched to anything (postgre, mysql, etc.)

# Screenshots:

Homepage:

![homepage](https://dev-to-uploads.s3.amazonaws.com/i/x90n00esuivurl7ykay9.png)

Login:

![login](https://raw.githubusercontent.com/crimson-med/react-prisma2-graphql-boilerplate/master/doc/login.png)

Signup:

![signup](https://raw.githubusercontent.com/crimson-med/react-prisma2-graphql-boilerplate/master/doc/signup.png)

Dashboard:

![dashboard](https://raw.githubusercontent.com/crimson-med/react-prisma2-graphql-boilerplate/master/doc/dashboard.png)

---

Burlet Mederic
https://medericburlet.com
https://mederic.me
https://twitter.com/crimson_med
How to extract streaming URLs from ThopTV APK?
Tags: android, apk
Published: 2020-10-11 09:32:26

[ThopTV APK](https://apkbucket.net/thoptv-apk-ipl-2020-download/) streams live cricket matches and a lot of other TV channels. I am trying to extract the streaming URLs but I am having some troubles. Is using a network sniffer a better idea or should I decompile the APK find the URLs from the source? Please help.
Helm Chart Demo - How to create your first Helm Chart?
Tags: kubernetes, devops, linux, docker
Published: 2020-10-11 09:29:13

{% youtube 2dqQcou_MCU%}

In this session "Building first helm chart with spring boot" we are going to see 

1. Installation of Helm Chart
2. Create your first Helm Chart
3. Structure of Helm Chart
4. $ helm template - To view helm template filled with original values
5. $ helm --debug --dry-run
6. $ helm install
7. Verify helm installation
8. Upgrade helm release
9. Rollback helm release
10. Delete helm release
Helm Chart Explained | Configure and Manage Kubernetes Deployment
Tags: kubernetes, devops, docker, linux
Published: 2020-10-11 09:27:48

{% youtube pHGc87zHLlo%}

In this session "Getting started with Helm" we are going to focus on 

1. What is Helm Chart?
2. How to Install Helm Chart?
3. Talking in-depth about charts.yaml, template and values.yaml
4. Comparing Kubernetes deployment with Helm Chart release
5. Advantages of usign helm chart for managing Kubernetes cluster and deployment
6. At last, we will create a demochart for doing some hands-on with Helm Chart.