teleren/devto huggingface dataset:
Javascript Arrays for Absolute Beginner
Tags: javascript, beginners, 2020, webdev
Published: 2020-01-03 14:01:41

Assuming we want to keep the record of available cookies in a grocery store, where we have multiple values of available cookies, we have lots of lollipops, ice-creams, vanillas and more all available in the store. 
Assigning each available values to a variable is fine if we only have few available cookies in the store.

Let cookie1 = “strawberry-cookies”
Let cookie2 = “Stick-sweets”

All variables store each values of all the available cookies separately in the memory of the system, and makes our program more complicated and unclean.

 What if we have more available cookies ? Then, we need an array, we need a collection of all the available cookies. An Array is basically the collection of values as explained.

Cookies = [“strawberry-cookies”, “Stick-sweets”, “Lollipop”, “Kolas“, “Pinky” ]

all the available cookies are all stored in a single variable name, they are stored and can access with their index.


Array are collection of values, An array is also a special variable, which can hold more than one value at a time.
In javascript array values are stored and accessed through the index, javascript is a zero based programming language so, in an javascript array the first value is stored on the 0 index.

Arrays are a special type of objects. The typeof operator in JavaScript returns “object” for arrays.
But, Javascript arrays are still best described as arrays.


Array in javascript have lots of built-in methods that makes the concept productive enough and fun to use.


Creating an Array in Javascript

To create an array in javascript we can use the new array keyword 

 let cookies = new Array(“strawberry-cookies”, “Stick-sweets”, “Lollipop”, “Kolas“, “Pinky”)

or we assign a square bracket to a variable, both way works fine but like this below is more efficient and clean 

 let cookies = [“strawberry-cookies”, “Stick-sweets”, “Lollipop”, “Kolas“, “Pinky” ]

As said earlier, everything in an array can be changed or manipulated thru its index, for example if we want to change the color pinky to ice-creams ?
we will have to access the value thru its index which is the 4th index of the cookies array

cookies[4] = ‘ice-creams’

Arrays can be used for lots of purposes in our program.

We have lots of built-in methods in javascript, let check them out and build a fun project.
Shalom
Blockchain Snippets [0]
Tags: blockchain, beginners
Published: 2020-01-03 13:58:20

Unspent Transaction Output (UTXO) is an important concept of a bitcoin network and other blockchains. It defines an output of a blockchain transaction that has not been spent. 

UTXOs are referenced as inputs in a transaction and also used as output in a transaction on the network. 

The concept of UTXo defines the inputs and outputs of transactions in the blockchain. 


<small><i>Source:</i></small> <kbd>Blockchain Basics, University at Buffalo, The State of New York</kbd>
Can not subset ranges from another range set

Tags: awk, r, sed, python
Published: 2020-01-03 13:48:30

Ca21chr2_C_albicans_SC5314	2159343	2228327	Ca21chr2_C_albicans_SC5314	636587	638608
Ca21chr2_C_albicans_SC5314	5286	50509	Ca21chr2_C_albicans_SC5314	634021	636276
Ca21chr2_C_albicans_SC5314	1886545	1900975	Ca21chr2_C_albicans_SC5314	610758	613544
Ca21chr2_C_albicans_SC5314	1919115	1930649	Ca21chr2_C_albicans_SC5314	606248	608308
Ca21chr2_C_albicans_SC5314	590278	603163	Ca21chr2_C_albicans_SC5314	1554724	1556511
Ca21chr2_C_albicans_SC5314	267403	279993	Ca21chr2_C_albicans_SC5314	1547799	1548998
Ca21chr2_C_albicans_SC5314	1611869	1622753	Ca21chr2_C_albicans_SC5314	1519257	1520960
Ca21chr2_C_albicans_SC5314	1479229	1490747	Ca21chr2_C_albicans_SC5314	1514712	1516178
Ca21chr2_C_albicans_SC5314	157814	166956	Ca21chr2_C_albicans_SC5314	897896	900774
Ca21chr2_C_albicans_SC5314	2148223	2149627	Ca21chr2_C_albicans_SC5314	890821	892818
Ca21chr2_C_albicans_SC5314	1041578	1051493	Ca21chr2_C_albicans_SC5314	588237	589598
Ca21chr2_C_albicans_SC5314	736894	745664	Ca21chr2_C_albicans_SC5314	557079	558713
Ca21chr2_C_albicans_SC5314	618550	627903	Ca21chr2_C_albicans_SC5314	7510	8043
Ca21chr2_C_albicans_SC5314	1116919	1125425	Ca21chr2_C_albicans_SC5314	922654	924717
Ca21chr2_C_albicans_SC5314	1262940	1271939	Ca21chr2_C_albicans_SC5314	1778986	1779687
Ca21chr2_C_albicans_SC5314	288630	296284	Ca21chr2_C_albicans_SC5314	795730	798201
Ca21chr2_C_albicans_SC5314	1250513	1258731	Ca21chr2_C_albicans_SC5314	766651	768309
Ca21chr2_C_albicans_SC5314	1499806	1508334	Ca21chr2_C_albicans_SC5314	763501	765159
Ca21chr2_C_albicans_SC5314	98269	105803	Ca21chr2_C_albicans_SC5314	758203	758733
Ca21chr2_C_albicans_SC5314	1604362	1611315	Ca21chr2_C_albicans_SC5314	700893	702539



This is a snippet of my data. What I want to do is to find out if the range of column 5 and column 6 is a subset of the range between column 2 and column 3. The data in column 2 and 3 are longer than data in column 5 and 6. A script has to scan through columns 2 and 3 in totality for every range defined by column 5 and 6. How do I do it. Any awk, sed, r, python scripts? I am sorry if I did not follow the forum's rules, this is my first time using it.
Tip 3: Create a `tmp` Alias
Tags: linux, dotfiles
Published: 2020-01-03 13:35:13

Nobody ever tells you this, but it's true for everyone ... you'll need to trust me...

There's going to be a time in your life when you create a directory called `stuff` (or `things`, or `tmp`, or `delete-me`, and so forth) to perform some random crappy test.

You'll **never** delete this directory. Honestly. You'll end up putting it in some `archive` directory and it'll live forever.

Well, enough is enough.

Create this alias. Now.

Use it with the same glutenous desire you feel when you're reaching for that last piece of chocolate, from the bag you opened three and a half minutes ago.

You're welcome


```shell
alias tmp=' cd $(mktemp -d)'
```
Package: react-style-classes
Tags: kontentino, package, library, classes
Published: 2020-01-03 13:30:41

Every one of us knows the case when you need to add more class names to style your component depending on some conditions, but you do not want to have negative boolean values in className prop.

In [Kontentino](https://www.kontentino.com/?home), we had the same issue.

So, what are you going to do if you need to solve a problem like this?
Probably, the first option that are you going to do is find the library which will help you.
Another option is to write your own library. This is what we did and also what we do! We develop our own libraries.

We wanted to solve the issue, that if we have class names depending on the condition of state like:

```javascript
state = { isModalShown: false };
...
<div className={[!this.state.isModalShown && style.item, this.state.isModalShown && style.activeItem]} />
```

The result of this example is `["item", false]`. It is something that you do not want to have in className prop. So we needed to remove boolean values if it equals false, and put class name if the condition applies.

We coded our own package!

One of our first libraries is named [react-style-classes](https://github.com/kontentino/react-style-classes) and this library solves the problem with boolean values in an array of styles. It is a package for merge arguments of component style class names.

If you are interested in how we wrote this helper, you can join us on Github. [https://github.com/kontentino/react-style-classes](https://github.com/kontentino/react-style-classes)

More interesting articles coming soon at [kontentino.engineering](https://kontentino.engineering/)
🧰 DevilBox: A containerized PHP dev environment (Part 1)
Tags: devilbox, docker, php
Published: 2020-01-03 13:29:46

---
title: 🧰 DevilBox: A containerized PHP dev environment (Part 1)
published: true
description: Reproducible and identical development environment for all host operating systems with zero configuration requirements.
tags: devilbox, docker, php
cover_image: https://thepracticaldev.s3.amazonaws.com/i/2oid2aka66nlf9e456nk.png
series: DevilBox, local development for PHP
---
**UPDATE (01/15/2020):** fixed some typos and started writing **part two**.

This year for me, is a year to share and what better way to start it than with this amazing tool.

When I took the leap from .Net development to PHP back in ~2011 the easiest way to set-up a local development environment on windows was using WAMP. (Just to be clear, I love GNU/Linux but just the CLI 😅)  

By the end of 2017 I discovered [DevilBox](http://devilbox.org/)
> Reproducible and identical development environment for all host operating systems with zero configuration requirements.

I've been using it since then daily, it uses docker so you can use on the OS of your choice, as the author describes it:
> The Devilbox is a modern and highly customisable dockerized PHP stack supporting full LAMP and MEAN and running on all major platforms. The main goal is to easily switch and combine any version required for local development.

You can choose between `Apache` and `Nginx` as your web server, Almost any version of `PHP`(for those pesky clients that refuse to let go 5.4), `MySQL`, `Percona` or `MariaDB`, `PgSQL`, `Redis` and finally `MongoDB`...  
It comes with its own DNS Server so you can easily use URLs for local development.
![Local URL](https://thepracticaldev.s3.amazonaws.com/i/gp4nltfdjinbqpnq3mwt.png)

And the thing I like the most is a 'Email catch-all' so you can send emails from your apps and see them inside the dashboard without running the risk of sending real emails (using postfix of course). 

The installation is pretty straightforward, basically:
```bash
# Get the Devilbox
$ git clone https://github.com/cytopia/devilbox

# Create docker-compose environment file
$ cd devilbox
$ cp env-example .env

# Edit your .env file to select the versions needed, or just
# start all container
$ docker-compose up
```

#### Smallest stack
This is the smallest possible and fully functional stack you can run 
![Small Stack](https://raw.githubusercontent.com/devilbox/artwork/master/submissions_diagrams/cytopia/02/png/architecture-small.png)  


#### Full stack
To better understand what is actually possible have a look at the full example
![Full stack](https://raw.githubusercontent.com/devilbox/artwork/master/submissions_diagrams/cytopia/01.old/png/architecture-full.png)


---

If you are interested in learning more about it or going deeper into the configurations, just let me know. I would happily write a post or two going in depth about it.
ShowDev: I've put together a free writing course for developers
Tags: writing, showdev
Published: 2020-01-03 13:11:33

I've put together a free course for developers who want to become better writers, teachers, and experts. 

It's called zero-to-10, designed to help you write your first (or next) 10 articles. You can start lesson 1 instantly here: 

# [Zero-to-10: A Writing Course For Developers](https://glennstovall.com/zero-to-10/)

If you want to see some of my work about writing for developers, I have a few other posts here: 

{% link /gsto/choose-your-next-article-topic-with-this-exercise-17m2 %}

{% link /gsto/should-you-write-longform-articles-or-a-shortform-series-reader-question-1b5j %}

{% link /gsto/how-do-i-complete-against-other-better-bloggers-reader-question-5f7j %}

{% link /gsto/what-s-the-best-publishing-cadence-5dhn %}

{% link /gsto/writing-tools-12-tools-i-use-for-publishing-content-today-2kee %}

And if you have any questions about the course, or writing in general, hit me up in the comments below!
Refactoring Angular Apps to Reactive Architecture
Published: 2020-01-03 13:00:33

As an Angular consultant, the main problem I see new Angular developers have is how to use RxJS efficiently in Angular apps. In other words, how to use it to create a scalable and maintainable reactive architecture. What I see instead is an abuse of RxJS, which is a completely natural thing to do, when you don’t know how to use it efficiently. This blog post will shed some light on this and will show you why and how to refactor your Angular apps to use a reactive architecture.

#The problem with imperative programming
By definition, imperative programming means to use statements to change a systems state. In this way of programming, you will be setting data properties and maintaining the state explicitly through commands. The problem with this, might not be obvious once the app is small but might be the biggest root of Angular bugs as the app grows.

Read more [here](https://christianlydemann.com/refactoring-angular-apps-to-reactive-architecture/).
ANSIBLE ARCHITECTURE & WORKING
Tags: devops, python, linux
Published: 2020-01-03 12:44:49

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/skvvt051gys64k62ez0h.png)

Hey guys! Let's look on Ansible architecture and it's working.


Terminologies in Ansible:

Control node

Any machine with Ansible installed. You can run commands and playbooks, invoking /usr/bin/ansible or /usr/bin/ansible-playbook, from any control node. You can use any computer that has Python installed on it as a control node - laptops, shared desktops, and servers can all run Ansible. However, you cannot use a Windows machine as a control node. You can have multiple control nodes.

Managed nodes

The network devices (and/or servers) you manage with Ansible. Managed nodes are also sometimes called “hosts”. Ansible is not installed on managed nodes.

Inventory

A list of managed nodes. An inventory file is also sometimes called a “hostfile”. Your inventory can specify information like IP address for each managed node. An inventory can also organize managed nodes, creating and nesting groups for easier scaling. Inventories can be of two types static and dynamic, dynamic inventory can be covered while you go through Ansible thoroughly.

Modules

The units of code Ansible executes. Each module has a particular use, from administering users on a specific type of database to managing VLAN interfaces on a specific type of network device. You can invoke a single module with a task, or invoke several different modules in a playbook. 

Tasks

The units of action in Ansible. You can execute a single task once with an ad-hoc command.

Playbooks

Ordered lists of tasks, saved so you can run those tasks in that order repeatedly. Playbooks can include variables as well as tasks. Playbooks are written in YAML and are easy to read, write, share and understand. 

WORKING:

We can classify the Ansible architecture into 3 sections
1. Ansible Users and Playbooks
2. Ansible Engine
3. Hosts and Networking

     The Ansible Engine consists of Inventory, API, Modules and Plugins. A user writes playbooks i.e. set of tasks, then the playbook scans the inventory and matches for the listed hosts or IP addresses where the tasks must be executed. Ansible copies all the modules to the managed node and using Python API calls and plugins Ansible completes the given tasks. Once the tasks are completed/executed all the modules are destroyed on the Managed Nodes. Ansible on linux executes the modules on managed hosts using SSH.

Please feel free to correct ;)
#automation #devops #ansible #discuss #linux
Soi cầu dự đoán Soi cầu Miền Bắc 4/1/2020 (Thứ 7 – 04/01/2020)

Tags: soicau, xoso, soicau767, atrungroi
Published: 2020-01-03 12:36:26

Soi Cầu Dự đoán Miền Bắc 4/1/2020, soicau767.com dự đoán kết quả đài Miền Bắc hôm nay, soi cầu Miền Bắc ngày 4-1-2020, chốt số lô giải tám, đặc biệt đầu đuôi, bao lô 2 số chính xác nhất.
Dự Đoán Miền Bắc 4/1/2020
Hãy cùng chuyên gia SOI CAU 767  dự đoán Miền Bắc 4/1/2020 hôm nay siêu chuẩn với các kết quả dự đoán giải đặt biệt đầu đuôi, giải lô tô 2 số, lô xiên chính xác nhất.

Để kết quả dự đoán được chính xác. Bạn nên tham khảo lại kết quả Xổ số Miền Bắc các kỳ trước để có cơ sở so sánh và đưa ra quyết định chọn con số phù hợp, có cơ hội trúng giải cao nhất.

Chốt số lô dự đoán Miền Bắc 4/1/2020
🌟 Đặc biệt: đầu, đuôi: 12
🌟 Lô tô 2 số chắc về: 79 - 55 - 09
🌟 Loto xiên: 03 - 27 - 53
=> Xem trực tiếp kết quả XSMB

Soi cầu Miền Bắc 4/1/2020
Để có kết quả soi cầu miền bắc 4/1/2020 các chuyên gia giỏi nhất của sOICAU767 phải tổng hợp dữ liệu các con số trúng giải của hơn 5 năm và dùng nhiều thời gian để phân tích học thuật xác suất thống kê để đưa ra các con số may mắn nhất cho quý đọc giả.

Các kết quả dự đoán Miền Bắc được cập nhật lúc 18h mõi ngày và hoàn toàn miễn phí. Quý đọc giải có thể tham khảo thêm phương pháp soi cầu của dự đoán xoso.me, xsmn.me, Miền Bắc Minh Ngọc, Rồng Bạch Kim, giovangchotso, lodeonline, miền Bắc 366, win2888, win2888asi ... để có được những con số dự đoán Miền Bắc ngày 4/1/2020 chính xác nhất.

⚡⚡⚡ Lưu ý: Các bộ số chỉ dùng cho mục đích tham khảo, bạn nên cân nhắc trước khi chơi và không chơi lô đề vì đó là bất hợp pháp, chỉ nên chơi lô tô do nhà nước phát hành vừa vui vừa đảm bảo ích nước lợi nhà bạn nhé ⚡⚡⚡

Nếu bạn có kết quả dự đoán khác về kết quả xổ số Miền Bắc hôm nay, mời bình luận chia sẻ để mọi người tham khảo.
Github private package with CI/CD
Tags: github, npm, devops
Published: 2020-01-03 12:33:28

With the newly created <a href="https://github.com/features/packages" target="_blank">Github Package Registry</a>, you can store your private packages in the same place as your code.

Deploying packages and use them inside a `package.json` file is very simple. When it comes to use them in a CI/CD environment it's a bit tricky.

First, we need to provide our ci/cd environment a secure way to retrieve packages from our private repositories. Using the classic `npm login` is secure but not very handy. So the **TOKEN** approach is what I chose. See more info about creation <a href="https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line" target="_blank">here</a>. You only need to provide **read access to packages**.

Then we need to set a reference to our private repositories for npm to resolve and find it. The easiest way is to set an **.npmrc** file at the root of your project and put things this way :

```bash
registry=https://registry.npmjs.org/
@owner:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
```

The trick here is to indicate the default registry (registry.npmjs.org) for all other public packages you want to use.

Be sure to replace `owner` by your organisation name. The `GITHUB_TOKEN` is stored as environment variable (you have many ways to hide it on your machine and in some ci/cd tools, don't need to hardcode it).

Hope it helps !
20+ Useful jQuery Code Snippets for Web Developers in 2020
Tags: jquery, javascript
Published: 2020-01-03 12:29:36

---
title: 20+ Useful jQuery Code Snippets for Web Developers in 2020
published: true
description: jQuery is one of the top javascript library in the world. I have been using this jQuery library for the last 10 years. Im going to share most useful jquery code snippets where you can copy and use it in your projects immediately without reinventing the wheel. These jquery code snippets are easy to use and I hope it will adapt to match on your requirements
tags: jQuery, Javascript
cover_image: https://w3lessons.info/wp-content/uploads/2019/12/pablo-1.png
---

jQuery is one of the top javascript library in the world. I have been using this jQuery library for the last 10 years. I’m going to share most useful jquery code snippets where you can copy and use it in your projects immediately without reinventing the wheel. These jquery code snippets are easy to use and I hope it will adapt to match on your requirements.

By using these code snippets you can save your pretty valuable time when developing user interfaces. Just copy the jquery code snippets and make your website with pretty nice effects

[Read More](https://w3lessons.info/top-20-useful-jquery-code-snippets-web-developers/)
Introduction to Node.js
Published: 2020-01-03 12:11:03

Introduction:

As per the Node.js official documentation, Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Before you mess up with the terms used here, let me explain what the official definition actually means by breaking it into small parts. When we run a JavaScript code or work with any JavaScript frameworks, the code gets executed in the browser. So, in that case our browser is the JavaScript runtime.  The JavaScript(JS) code is converted into machine code with the help of a JavaScript parser. In case of Google Chrome, it's V8, for Firefox it's SpiderMonkey and for Microsoft Edge it's Chakra. There are couples of libraries on which Node.js depends to work properly.
Most important are: Chrome's V8 & LIBUV.
If V8 was not there then Node.js had no way to understand, the JS code we write in the Node.js environment. LIBUV is an opensource library with strong focus on asynchronous I/O. this gives access to OS, file system, networking and more. This is also responsible for 2 main features of Node.
1. The Event Loop.
2. The Thread Pool.
Apart from all of this, Node.js also depends on:
1. http-parser for parsing http.
2. c-ares for some DNS request staff.
3. OpenSSL for cryptography.
4. zlib for compression.
We will discuss all of the above points in the upcoming posts. But let us first focus on the primary idea.
In simple words, Node.js lets developers use JavaScript to write command line tools and for server-side scripting-running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser.

Characteristics of Node.js:

1. Fast, efficient and highly scalable.
2. Event driven, non-blocking I/O Model.
3. Asynchronous in nature.
4. Single Threaded.
5. It's Open Source.
6. We use only one language at both ends of the website.
To read more visit : https://learnnodeonline.blogspot.com/
The Thread Pool in node.js 
Published: 2020-01-03 11:52:46

When we run Node.js in our computer, it's a process which runs in our computer.The process is nothing but an executing program which gets executed in our local computer. When such a process runs, it runs in single thread. Thread is nothing but a sequence of instructions, which are dedicated to perform a given task. But let us remember that as Node.js runs on single thread we must try not to block the thread, no matter how many users or clients access our web application.
When a program is initialized, all the code gets executed apart from the codes , which are inside any callback functions. All the necessary modules are required and the callbacks are registered. Thereafter, the event loop starts running. Thought this event loop will be discussed after this, but for now keep in mind that the "Event-Loop" is the heart of the entire Node.js architecture. It is responsible for major tasks performed in our application.
But sometimes, the tasks are too heavy to be performed by the main thread of Node.js instantly and it then tends to block the execution. The solution to this is the "Thread Pool". It is basically a set of 4 additional threads provided by the LIBUV library. When a heavy task appears, the main thread offloads it to the additional threads to execute it. The heavy tasks like dealing with file system API, compression, cryptography and DNS lookups are offloaded generally. All of these are handled by Node alone. I hope now you have a little idea about the Thread Pool.
https://learnnodeonline.blogspot.com/
Blanka - a Flexible CSS Grid Layout
Tags: codepen, html, css, layout
Published: 2020-01-03 11:25:03

Just a little fiddle with CSS grid and Flexbox to create an interesting layout that pushes all header and footer content into a sidebar for wider resolutions, compressing down to standard stacked layout for mobile. 

Chose the name because I happened to look at the Street Fighter glass on my desk! :)

{% codepen https://codepen.io/abeeken/pen/ExabXrB %}