teleren/devto huggingface dataset:
How to follow Crypto news
Tags: blockchain, bitcoin, cryptocurrency, ethereum
Published: 2021-01-12 19:13:38

---
title: How to follow Crypto news
published: true
date: 2021-01-09 07:13:27 UTC
tags: blockchain,bitcoin,cryptocurrency,ethereum
canonical_url: https://medium.com/coinmonks/how-to-follow-crypto-news-94a35c06e41c
---

[![](https://cdn-images-1.medium.com/max/987/1*IHVmDfN2R8C1tgllxZxVXw.png)](https://medium.com/coinmonks/how-to-follow-crypto-news-94a35c06e41c?source=rss----721b17443fd5---4)

Depending on how plugged-in you are to the crypto space, you may be familiar with some or all of these happenings in the past 180 days:

[Continue reading on Coinmonks »](https://medium.com/coinmonks/how-to-follow-crypto-news-94a35c06e41c?source=rss----721b17443fd5---4)
Python List vs NumPy Array
Tags: python, numpy, machinelearning
Published: 2021-01-09 07:05:14

---
title: Python List vs NumPy Array
published: true
description: 
tags: Python, NumPy, MachineLearning, ML
//cover_image: https://direct_url_to_image.jpg
---
I will try to explain why NumPy is more powerful and efficient compare with Python List. 

First we will see basic definition of the list vs Array programming terminology

Lets see basic data structures **arrays** and **lists**

**Arrays:** are used to store  *homogeneous* data (same data type) of *fixed* size storing in *sequential* order in memory
**Lists** are used to store data of *growing* in size and storing this data in available place *anywhere*(not sequential) in the memory.

Almost same logic applies to Python List and NumPy Array. You can see in the below picture, how list and array stores data in memory.

![Python list and NumPy array](https://dev-to-uploads.s3.amazonaws.com/i/767ysmx0hpyq62ba89uh.png)

**Python List:**
1. Able to store different data types in the same list
2. Storing each item in random location in the memory
3. Good for the scenario where list can grow dynamically
4. Inbuilt data type.
5. It has more inbuilt functions 
6. Appending will take less time in O(1) time

**NumPy Array:** 
1. Can store only one data type in an array at any time
2. Storing each item is sequential  which makes array more effective in processing.
3. Good for the scenario where the items are fixed size and same data time
4. Need to install external library NumPy
5. No extra functions, so it will not more memory store.
6. Appending elements will take more time in O(N) time



Happy Learning!!!
JAVASCRIPT STRING METHODS and PROPS
Tags: javascript
Published: 2021-01-09 06:40:08

##Java script String Methods


**length property**
```
"abc".length
> 3
```
---

**indexOf() method**
```
"abc".indexOf("b")
> 1
```
**indexOf() method**
```
"abc".indexOf("i")
> -1
```
**indexOf() method**
```
"abc".indexOf("")
> 0
```
---

**lastindexOf() method**
```
"abcb".lastIndexOf("b")
> 3
```

**indexOf() method**
```
"abcb".lastIndexOf("i")
> -1
```

**indexOf() method**
```
"abcb".lastIndexOf("")
> 4
```

---

**search() method**
```
"abc".search("b")
> 1
```

**indexOf() method**
```
"abc".search("i")
> -1
```

**indexOf() method**
```
"abc".search("")
> 0
```
---

**slice() method**
```
"abc".slice("1")
> "bc"
```

**slice() method**
```
"abc".slice("5")
> ""
```

**slice() method**
```
"abc".slice("")
> "abc"
```

---

**substring() method**
```
"abc".substring("1")
> "bc"
```

**substring() method**
```
"abc".substring("5")
> ""
```

**substring() method**
```
"abc".substring("")
> "abc"
```

---

**replace() method**
```
"abc".replace("a","e")
>> "ebc"
```

---

**toUpperCase() method**
```
"abc".toUpperCase()
>> "ABC"
```

---

**toLowerCase() method**
```
"ABC".toLowerCase()
>> "abc"
```

---

**concat() method**
```
"ABC".concat(",", "b")
>> "ABC,b"
```
---

**trim() method**

```
"  ABC abc  ".trim()
>> "ABC abc"
```
---

**charAt() method**

```
"  ABC abc  ".charAt(4)
>> "C"
```

---

**charCodeAt() method**
```
"  ABC abc  ".charCodeAt(4)
>> 67
```

---

**split() method**
```
"a,b,c".split(",")
>> ["a", "b", "c"]
```

**split() method**
```
"a b c".split(" ")
>> ["a", "b", "c"]
```

**split() method**
```
"a b c".split("")
>> ["a", " ", "b", " ", "c"]
```

---
My javascript / tech / web development newsletter for 09-01-2021 is out!
Tags: javascript, tech, webdev, discuss
Published: 2021-01-09 06:26:38

---
title: My javascript / tech / web development newsletter for 09-01-2021 is out!
published: true
description: A roundup of all the best javascript, tech and web development links posted to my linkblog in the past week
tags: javascript, tech, webdev, discuss
---
In this week’s edition:

Github darkmode, BBC cloud, linux5.11, crypto, APIs, Twttr&pods, free AWS training, Asahi Linux M1, new GPT3 AIs, IoT, tag clouds, OSSinWH, freelancing, NodeJS strategy, Notion, multicloud, pods&vids

https://markjgsmith.substack.com/p/mark-smiths-podcast-09-01-2021

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
Custom validation error message using Laravel blade component
Tags: laravel, html, bladecomponent, php
Published: 2021-01-09 06:07:15

There are multiple ways to display a custom error message for a failed validation in **Laravel**. We can even use the blade component to achieve this.

Just put this component below the input you want to validate. Pass the name of the input to the **for** attribute and your custom message to the **custom-message** attribute. Boom you are done!!

**Usage:**
```
<x-input-error for="foo_name" custom-message="Foo is required" />
```

**Component:**
```
@props(['for', 'customMessage'])
@error($for)
<p {{ $attributes->merge(['class' => 'text-sm text-red-600 mt-1']) }}>{{ $customMessage ?? $message  }}</p>
@enderror
```
Logical Assignment Operators
Tags: javascript, webdev
Published: 2021-01-09 05:58:54

Javascript (ES2021) now supports the ability to combine logical operations and assignment with the new operators `&&=`, `||=`, and `??=`.  Previously, compound assignment operators were only possible with mathematical and bitwise operations.

## Logical AND assignment `&&=`

The logical AND assignment `x &&= y` operator performs assignment only if `x` is truthy.  For example:

```
let a = 1;
let b = 0;

a &&= 2;
console.log(a); // output: 2

b &&= 2;
console.log(b); // output: 0
```

#### Short-circuit evaluation

If the left-hand expression is falsy, it is short-circuit evaluated and the right-hand expression is not evaluated, so the value of `b` is not reassigned because 0 is falsy.  

`a &&= 2` is equivalent to `a && (a = 2)`, and the value of `a` is reassigned because it was originally truthy.  

## Logical OR assignment `||=`

The logical OR assignment `x ||= y` operator only assigns if `x` is falsy.

```
const a = 50;
const b = '';

a ||= 10;
console.log(a);  // output: 50

b ||= 'string is empty.';
console.log(b); // output: "string is empty."
```

#### Short-circuit evaluation

From the above example, `a ||= 10` is equivalent to `a || (a = 10)`, but because the value of `a` is truthy, it is short-circuit evaluated and the right-hand assignment is not evaluated.

If you are checking against a falsy value such as an empty string or 0, `||=` must be used, otherwise the logical nullish assignment operator `??=` should be used to check for `null` or `undefined` values.

## Logical nullish assignment `??=`

The logical nullish assignment `x ??= y` operator only assigns if `x` is `null` or `undefined`.

```
const a = { limt: 50 };

a.limit ??= 10;
console.log(a.limit); // output: 50

a.speed ??= 25;
console.log(a.speed); // output: 25
```

#### Short-circuit evaluation

A logical nullish assignment expression is short-circuit evaluated to the left-hand side expression if the left-hand side is neither `null` nor `undefined`.  

In the above example, the reassignment of `a.limit` is not performed because its value is defined as 50, which is not `null` or `undefined`.  

`a.speed` would initially evaluate to `undefined`, so the right-hand expression is evaluated, which is equivalent to `a.speed = 25`, and now `a = {limit: 50, speed: 25}`.
What are List and Keys in React?
Tags: javascript, react, webdev, codenewbie
Published: 2021-01-09 05:32:24

In JavaScript, if you want to create a new array from an  available array by converting each element of the original array to  create the corresponding element of the new array, you can use **map()**  method.

Keys help React distinguish items in a list.  It helps  React manage the changed items, new items added, or items removed from  the list.

---

We can output **lists** <u>JavaScript arrays</u> and the **map()** function. The map() is used to traverse through an array. Below basic list component that accepts an array of number and outputs a list of elements. 

```js
function Numberlist (props) {
    const numbers = props.numbers; 
    
    const listItems = numbers.map((number) => 
       <li key={number.toString()}>{ number }</li>
     ); //listItems becomes a list of numbers (or an array of 5 <li> tags)
     return (
     <ul>{ listItems }</ul>
     ); 

}

const numbers = [1, 2, 3, 4, 5]; 
ReactDOM.render(
     <NumberList numbers={numbers} />, 
     document.getElementById('root')
); 

```

A key is a special <u>string attribute</u> you need to include when creating lists of elements, as you must have also seen in the last slide. Keys help React identify which items have changes, are added, or are removed. Keys should be given to the elements a stable identity. 

When you don't have stable IDs or a suitable property to be used as key for the rendered items, you may use the item <u>index</u> as a key as last resort: 

```js
const todoItems = todos.map((todo, index) => 
     <li key={index}>
       { todo.text }
     </li>
); 
```



---

📘Thanks For Reading | Happy Coding ⚡


<a href="https://www.buymeacoffee.com/rahxuls" target="_blank"> <img src="https://res.cloudinary.com/rahulism1/image/upload/v1608182430/bmc_nbxakd.png"></a>
Loops in Python
Tags: python
Published: 2021-01-09 05:25:09

Loops are very used in programing when is necesary repeat a instruction x times. Some examples : search a number in a list or wait for a specific input.

In python the most important loop is **"while"**, while a condition is met then the block of code inside of itself continue executing.

Syntax

```python
example_number = 0

while example_number < 3 :

	print(example_number)
	
	example_number = example_number + 1

output : 
0
1
2
```
Useful when we dont know the exact number of iterations. If we have the number of iterations defined then **"for"** is better than while loop.
Example : count odd numbers in a list

```python
for i in range (5):

	if i % 2 != 0:
		print(i)
		
output : 
1
3
```
Also exist **"for each"** with this loop is possible iterate in a list and the iterator will be each element.
Example: print each element of a list
```python
example_list = ['house', 'apple', 1]

for element in example_list:
	print(element)
	
output : 
house
apple
1
```
I TRIED CLONING THE GOOGLE STOPWATCH/TIMER 👨‍💻
Tags: react, programming, node, beginners
Published: 2021-01-09 05:21:29

I have been learning React for about a week now. Recently I came across the google stopwatch and timer and thought of cloning it. You can try it yourself here [GOOGLE STOPWATCH/TIMER](https://codesandbox.io/s/google-timerstopwatch-zc1z7).


THIS IS HOW THE CODE WORKS:

![CODE DEMO](https://s8.gifyu.com/images/GOOGLE-TIMER.gif)
Believe?
Tags: you, human, earth, milkywaygalaxy
Published: 2021-01-09 05:15:52

What do #you want as a #human living on #Earth in the #MilkyWay #Galaxy?

Don't factor in your life, country, religion, money, government, age, DNA, possessions

Believe you survive 2021?

Believe #Humanity survives?

Believe we step foot on #Mars in the next ~10 years?

Want to?
Git/Github - Making the Switch from Master to Main
Tags: github, git
Published: 2021-01-09 05:09:20

## Why Should I do this?

Bottom Line, the industry is making the shift of naming a project's default branch, "main", from the prior standard, "master". The change has already been happening so the sooner you get all your settings to change the less tricky it will be to make the adjustment later. So here are some steps in order to make the shift.

## Changing Your Default Github Branch Name

Head over to account settings, then to the repositories section, and change the default branch name for new branches to main. Done!

## Changing your local Git default branch name

As long as your git version 2.28 or above

```git --version```

[Guide to Upgrade Git on Ubuntu](https://www.tipsonunix.com/2020/07/install-git-2-28-0-in-ubuntu-20-04-linux-mint-centos/)

then you can run the following command

```git config --global init.defaultBranch main```

after this command anytime you make a new repository the initial branch will be called main instead of master.

That's it, you are all set to go!

## While we're configuring git...

- [You may want to set up a global gitignore](http://egorsmirnov.me/2015/05/04/global-gitignore-file.html)

- for bash/zsh you may want to add the following function to your configuration to easily push up to git.

```bash
pushy(){

git add .
git commit -m "$1"
git push $2 $3
}
```

the syntax to use...
```pushy "message" remote branch```
Full Tutorial #2: Setting Up TypeORM with MySQL | Microservices Chat App Using React, Node.js, TypeScript and GraphQL
Tags: react, node, webdev, javascript
Published: 2021-01-09 05:05:22

**About Me:** I've been a professional web developer for just over 10 years now. I'm currently the lead web development instructor at [Better Coding Academy](https://codebetter.com.au), and as part of what I do, I post videos on our YouTube channel at [https://www.youtube.com/c/BetterCodingAcademy](https://www.youtube.com/c/BetterCodingAcademy).

_(Subscribe for awesome web development content!)_

Part 2 of the Microservices Chat App is here! In this episode, I set up TypeORM with MySQL inside of a Docker container, and demonstrate how to set up a database connection, our first migration, as well as an entity to represent our data.

{% youtube 3SfBMeVSVtg %}

Happy coding!

Source code: [https://github.com/lucaschen/microservices-chat-demo](https://github.com/lucaschen/microservices-chat-demo)
Pantang menyerah dalam kerja tim
Tags: softskill
Published: 2021-01-09 04:35:22


  Bekerja sendiri sangat lumrah mudah dikerjakan oleh sebagian besar orang didunia, alasan utamanya mungkin karena dapat memprioritaskan kehendak sendiri tanpa harus berunding dengan orang lain, wait!! Bagaimana untuk pekerjaan yang rumit dan kompleks ? masih bisa kerja sendiri ?

  Nah dari sinilah kerja tim sangat diperlukan dimana setiap individu bekerja untuk suatu goals yang sama. Tetapi tidak semua pekerjaan dalam tim dapat berjalan sesuai planning yang sudah ditentukan sebelumnya. Masalah dapat datang kapan saja dan dari aspek mana saja, sehingga setiap bagian tim harus tetap solid agar tercapainya sebuah goals.

  Begitupun dengan tim kami. Tim kami dibentuk sekitar 2 minggu sebelum audisi lomba diadakan. Seharusnya itu waktu yang cukup untuk mengerjakan ketentuan - ketentuan audisi. BUT kami punya satu masalah yang bisa memperlambat kinerja tim kami. 
 
  Kami hidup di Ponpes, ada peraturan yang berbenturan dengan kepentingan tim, sehingga proses pengerjaan hanya ketika di sekolah. Di Sekolah pun hanya 3 hari dalam seminggu dengan durasi beberapa jam saja. Hal ini terjadi dikarenakan pandemi covid-19 yang melanda. Jadi praktis proses pengerjaan hanya 6 hari saja. 

  Walaupun begitu, kami tetap tidak menyerah dengan keadaan yang terjadi. Kita tetap mengerjakan ketentuan - ketentuan lomba yang ada. Tim kami berjumlah 5 orang dimana masing masing mendapatkan task sehingga setiap hari ada progres pengerjaan. 

  Kami selalu bertukar pikiran terhadap tugas - tugas yang ada, walaupun setiap anggota tim punya tugas masing - masing. Sehingga kesolidan tim tetap terjaga demi tercapainya goals - goals yang ada

  Nah itulah pentingnya pantang menyerah dalam tim walaupun dikejar - kejar deadline. Hard Skill atau talent murni diperlukan oleh seseorang tapi soft skill juga sangat dibutuhkan ketika kita bekerja dalam tim.
[Kotlin 1.4] Suspend conversion on callable references is supported
Tags: kotlin
Published: 2021-01-09 04:49:18

From Kotlin 1.4, **suspend conversion on callable references** is supported 🎉 [Release note](https://kotlinlang.org/docs/reference/whatsnew14.html) doesn't say much about this feature but it's really helpful when you use `Flow#combine()`.

Let's pretend you want to combine two flows and use them in `collect()`. Before Kotlin 1.4, you may write code like this:

```kotlin
suspend fun before4_1() {
    combine(
        flowA, flowB
    ) { a, b ->
        a to b
    }.collect {
        val a = it.first
        val b = it.second
        println("$a and $b")
    }
}

val flowA = flowOf(1, 2)
val flowB = flowOf(3, 4)
```
This code is kind of redundant and doesn't look great (too much `a`s and `b`s! 😩) 

From Kotlin 1.4, you can simplify the above code.

```kotlin
suspend fun from1_4() {
    combine(
        flowA, flowB, ::Pair
    ).collect { (a: Int, b: Int) ->
        println("$a and $b")
    }
}

val flowA = flowOf(1, 2)
val flowB = flowOf(3, 4)
```

Before Kotlin 1.4, this code causes compile error because the type of the 3rd parameter of `combine()` is **suspend function**. `Pair` class constructor is not a suspend function so compile error will occur. From Kotlin 1.4, this 3rd parameter lambda will be converted to `suspend function` automatically and work fine.

Bounus: I use [destructuring declarations](https://kotlinlang.org/docs/reference/multi-declarations.html) for the parameter of `collect()`.
```kotlin
    ).collect { (a: Int, b: Int) ->
```
We can name values of `pair.first` and `pair.second` here. Type definition can be omitted but `()` is necessary.
1st major update on Virtual Studio
Tags: mmhmm, streamyard, zoom
Published: 2021-01-09 04:46:09

---
title: 1st major update on Virtual Studio
published: true
description: 
tags: mmhmm, streamyard, zoom 
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/5de5zk4bllsdwtmq57fu.gif
---

We are building an web application & mobile app that makes it super easy to broadcast/record a professional presentation. 

It currently supports rtmp, so you can broadcast the content to YouTube Live, Facebook Live, Twitch, Periscope and other platforms that offers rmtp.

Virtual Studio is also capable for collaboration by inviting guests to your studio space like #streamyard.

We are now planing to build an application that turns Virtual Studio into virtual camera, like #mmhmm. It allows us to feed Virtual Studio to Zoom, Teams, and other video chat services too.

Please let us know if you have any questions or requests by comments!! 

▼Please upvote us on Product Hunt🙏
https://www.producthunt.com/posts/virtual-studio
Advent of Code 2020: Day 1 Python Solution
Tags: adventofcode, beginners, 100daysofcode, python
Published: 2021-01-09 04:42:45

While learning python, I was searching for learning more complex problems to get adventure of exercise and then I found the [AdventOfCode](https://adventofcode.com/2020). Although the challenge has already been completed, I heard from a friend that this challenge will take our way of solving problems to higher. 

Each day has 2 problems to solve and each part has a story too.

## Part 1
Finding the product of 2 numbers in a file that sums to 2020. I started by writing small block of code. And testing my code with the given example data and if it works fine then I test it with my input.

Prepare data directory.
```python
data_dir = "Data/"
```

Import regular expression to find digits and place them on a list.
```python
import re
day1 = open(data_dir+"day1_test.txt").read()
nums = [int(i) for i in re.findall(r"[0-9]+", day1)]
```
Find two numbers which sums up to 2020. I am lucky that there are only 2 numbers.
```python
sol = []
for num in nums:
    if 2020-num in nums:
        sol.append((2020-num, num))
sol = sol[0]
print(f"Two numbers that sum to 2020 are {sol[0]} and {sol[1]}. Their product is {sol[0]*sol[1]}")
```

### A function for part1

```python
def solve_day1_part1(filename="day1_test.txt", data_dir = "Data/"):
    day1 = open(data_dir+filename).read()
    nums = [int(i) for i in re.findall(r"[0-9]+", day1)]
    
    sol = []
    for num in nums:
        if 2020-num in nums:
            sol.append((2020-num, num))
    sol = sol[0]
    print(f"Two numbers that sum to 2020 are {sol[0]} and {sol[1]}. Their product is {sol[0]*sol[1]}")
solve_day1_part1(filename="day1.txt")
```

### Function for part2

```python
def solve_day1_part2(filename="day1_test.txt", data_dir = "Data/"):
    day1 = open(data_dir+filename).read()
    nums = [int(i) for i in re.findall(r"[0-9]+", day1)]
    
    sol = []
    for num1 in nums[:-2]:
        for num2 in nums[1:]:
            if 2020-num1-num2 in nums:
                sol.append([num1, num2, 2020-num1-num2])
    print(sol)
    sol=sol[0]
    print(f"Three numbers that sum to 2020 are {sol[0]}, {sol[1]} and {sol[2]}. Their product is {sol[0]*sol[1]*sol[2]}")
solve_day1_part2(filename="day1_test.txt")
   
```

**I am updating my [GitHub Repository](https://github.com/iamdurga/Advent-Of-Code-2020) after each solution I tried.**
Go R1 Day 25
Tags: tech, development, 100daysofcode, go
Published: 2021-02-09 22:58:19

---
title: Go R1 Day 25
published: true
date: '2021-01-09 04:40:03 UTC'
tags:
  - tech
  - development
  - 100DaysOfCode
  - golang
canonical_url: 'https://www.sheldonhull.com/microblog/go-r1-day-25/'
---

## Day 25 of 100

## progress

- Worked with Gorm, my first experience with ORM based querying.
- Used `gofakeit` with gorm to connect to MSSQL Server in Docker and randomize name entries.
- Learned a bit about `Context` package and how it helps with propagation of cancellation.
- As a new user to this, the examples were very confusing as it mixed up go-mssqldb along with examples using just gorm. As I get better with it, I'll try to log better introductory examples.

## links

- [Gorm](https://gorm.io)
- [Gofakeit](https://github.com/brianvoe/gofakeit)
Introduction to Android Lifecycle
Tags: android, beginners
Published: 2021-01-09 03:48:32

The android activity lifecycle includes the following callbacks: `onCreate()`, `onStart()`, `onResume()`, `onPause()`, `onStop()`, `onRestart()`, and `onDestroy()`.

![Activity Lifecycle](https://dev-to-uploads.s3.amazonaws.com/i/kzr2v0idc98mkk6tc98v.png)

onCreate()
----
The lifecycle of an android activity begins here. This is where any layout resources (Buttons, textViews, editText, etc.) and background threads are initialized. 

onStart()
----
Called right after onCreate(). In this state the activity becomes visible to the user.

onRestart()
----
Called after an activity has been stopped. This call reverts the activity to its visible lifetime.

onResume()
----
Called when the user returns to an activity after briefly exiting it. The app stays in this state until something happens to take focus away from the app. Such an event might be, for instance, receiving a phone call, the user’s navigating to another activity, or the device screen’s turning off.

onPause()
----
Called when the user leaves the current activity to another activity or leaves the app for a while. It indicates that the activity is no longer in the foreground and certain processes that are not needed while the activity is not in the foreground will be stopped.   

onStop()
----
Called when the activiy becomes invisible to the user. The activity and its resources may still be running in the background even though it is not visible. After onStop() is called, the activity will call onRestart() if it needs to be loaded again.

onDestroy()
----
The end of the activity lifecycle. This activity is used to stop all resources and tasks started in onCreate(). After onDestroy() is called, the activity will call onCreate() if it needs to be loaded again.
The system invokes this callback either because:
1. The activity is finishing (due to the user completely dismissing the activity or due to finish() being called on the activity), or
2. The system is temporarily destroying the activity due to a configuration change (such as device rotation or multi-window mode)

You can learn more about android life cycle [here](https://developer.android.com/guide/components/activities/activity-lifecycle#java) !