teleren/devto huggingface dataset:
Create out of curiosity
Tags: xml, javascript, java, android
Published: 2020-06-10 15:58:58

I remembered back then when I was first given an assignment to do up a calculator in Android. I think it was my first Android project.

I remember using XML to design the interface and I thought, wow, this was very restricting. We were given the whole semester(?) to do it but I was done by the second week. I focused on the logic more than the design. I was stuck on something for quite a bit. I think I was being super ambitious. But I just had fun helping my friends throughout the course.

Such simple times when there was literally no pressure to create. I was creating out of curiosity. Be like, what would it be like to create a Twitter clone or a Tinder clone?

We learned JSP and I was literally like sky-high with confidence because I remember I wanted to create web applications. I just didn’t know where to start at that time. There were a lot of tech around. I really thought I had to learn jQuery and PHP to start. But JSP came and I had Java knowledge already, so why not?

I wanted to go back to my roots and just create out of curiosity. I think that's a beautiful first step.
How to create Your first Chrome Extension
Tags: javascript, chrome, extension
Published: 2020-06-10 15:50:25

---
title: How to create Your first Chrome Extension
published: true
description: "Chrome extensions are a greate thing to have on your chrome browser."
tags: ['javascript', 'chrome', 'Extension']
//cover_image: ![chrome Extension](https://dev-to-uploads.s3.amazonaws.com/i/smc0m4dawrw2x03ab5bk.jpeg)
---
 ![chrome Extension](https://dev-to-uploads.s3.amazonaws.com/i/smc0m4dawrw2x03ab5bk.jpeg)

Chrome extensions are a greate thing to have on your chrome browser.

In this article we are going to create our first chrome extension and install it on our chrome browser.

First lets make a folder that will contain our files.

[Countinue reading.....](https://codetuts.netlify.app/how-to-creat-your-first-chrome-extension/)
loi ich cua Bep tu nhat noi dia
Published: 2020-06-10 15:43:40

Sử dụng công nghệ biến tần inventer tiết kiệm điện năng hơn 50% so với dòng bếp từ thông thường. Khi đun một nồi nước bếp từ Nhật nội địa sẽ hoạt động hết công suất trong 5 phút đầu sau đó tự động hạ công suất để duy trì nhiệt độ sôi của nồi.

Nấu mọi thứ với bếp từ nội địa nhật: Với cấu tạo gồm 3 loại bếp, bếp từ, bếp hồng ngoại và bếp nướng. Bạn có thể nấu được tất cả các món ăn từ món chiên xào, món hầm, món rang, đến nướng bánh kể cả nướng cá cũng rất nhanh chóng với hương vị giống hệt khi nướng bằng than đá.

An toàn hơn với người già và trẻ nhỏ: Vì sử dụng nguyên lý truyền nhiệt bằng cảm ứng điện từ trường nên bếp từ Nhật nhập khẩu sẽ không tạo ra nhiệt lượng trực tiếp trên mặt bếp, do đó hạn chế được khả năng bị bỏng nếu không may chạm phải. Ngoài ra bếp từ Nhật nội địa còn được trang bị tính năng khóa trẻ em, khi bật tính năng này trẻ em sẽ không sử dụng đươc bếp.

Hiệu suất đun nấu cao: thời gian nấu nướng vượt trội hơn hẳn so với bếp Gas, 1 lít nước sẽ đun sôi trong vòng 1 phút 30 giây, tiết kiệm điện năng và giảm thời gian  đun nấu.

Kiểm soát nhiệt độ dễ dàng với 10 mức nhiệt trên bếp từ, 3 mức nhiệt trên bếp hồng ngoại và 3 mức nhiệt trên bếp nướng.

Dễ dàng vệ sinh khi dính bẩn: thiết kế đơn giản nhưng không kém phần tinh tế, mặt bếp được làm bằng kính ceramic chịu nhiệt, chịu lực cao. Mỗi khi muốn vệ sinh chỉ cần lấy một chiếc dẻ, lau mặt bếp là được.

Độ bền cao: Nhật là đất nước nổi tiếng với những sản phẩm chất lượng với những sản phẩm lên tới hàng chục năm. Được sản xuất với những tiêu chuẩn rất cao của người nhật, tất cả các bếp từ nội địa nhật đều phải đảm bảo độ hoàn hảo cực cao trước khi được đưa ra thị trường.
xem them tai: https://dienmayhieunga.com/bep-tu-nhat.html
Quick Tip: Checking if a file exists before requiring it, using node.js
Tags: node, javascript
Published: 2020-06-10 15:32:55

> Quick tips are small snippets that come up again and again in my work, for which I want a permantent and central place to retrieve them.

Here's the situation: You want to `require()` a `.json` file that might or might not yet exist.

```javascript
const jsonContent = require('path/to/fileThatMightNotExist.json')
```

If it exists, this will work fine, if it doesn't, this will blow up. To make sure that is exists before you load it up, simply add the following:

```javascript
const fs = require('fs')

if (!fs.existsSync('path/to/fileThatMightNotExist.json')) {
  fs.writeFileSync('path/to/fileThatMightNotExist.json', JSON.stringify({}))
}

// now exists, despite the name
const jsonContent = require('path/to/fileThatMightNotExist.json') 
```

Now, regardless of the environment this is run in, everything should work fine.
.Net core host builder for Xamarin? Yes please!
Tags: cshar, dotnet, xamarin, mobile
Published: 2020-06-10 15:25:29

This year I decided to embark on the journey of developing a .Net Core style host builder for Xamarin. I had previously seen examples using the `HostBuilder` provided by the .Net Core framework. While this approach was perfectly fine and works as intended, I found myself wanting something a little more integrated with Xamarin. Enter [Hostly](https://github.com/hostly-org/hostly), a framework that provides end-users with a custom `Ihost` tailored to `Xamarin.Forms`. It's as simple as running a few lines of code in your entry class (`FormsAppCompatActivity` in Android, or `FormsApplicationDelegate` in iOS):
```csharp
new XamarinHostBuilder().UseApplication<App>()
.UsePlatform(this)
.Build()
.StartAsync();
``` 

Using Hostly opens up access to a rich set of useful features when developing a Xamarin app. A few of those being:
- Navigation Middleware
- Lifecycle Middleware (In progress)
- Dependency Injection
- EF.Core
- Hosted services

Try it out for yourself [here](https://github.com/hostly-org/hostly)
Story: Is it worth it to outsource tech in low cost countries ?
Tags: javascript, startup
Published: 2020-06-10 15:21:52

Depends.

Story time.

Friday evening, we got an **emergency** call from one guy in Netherland.

He is building a **remote web platform for school exams**. Covid & lockdown, Perfect time for it. **He already signed schools**. First real use Monday, National TV will be there to do a reportage on his solution.

Just a small issue, the app use 100% of the CPU. Impossible to type constantly. It was so bad that even my MacBook Pro was **melting after 2min** using the app.

As he is not a tech guy, he though it was a minor perf issue easily fixable. We accepted to help him on the weekend to try to solve this.

The code and engineering part was **awful**. Angular 2 stack, but the guy behind it have no clue about what he was doing. The product was visually ok, but behind the scene, just **chaos & pure garbage**. We made a quick fix to improve performances up to 70% on Mac, but we were unable to do more since everything was technically incorrect. That was still not enough for slower student computer.

He had to call school & TV to **cancel the exams**. All momentum lost.

As you imagine, the guy was demoralized.

Curious about how he ended up having such a bad tech, we asked him a bit more about his team. He was working 3 Pakistani guys for **6 months, and 6 others months** were planned to finish the product. He spend **10k** on his own fund with them. We advised him to stop the cost as soon as possible. I like to think we helped him to save another **10k for nothing**.

Looking at the features, we would have price the whole product at **25k to 30k max**, result guarantee, and ready to use in **3 to 4 months**.

My advise: Don’t go with cheap guy on « complex » app when you don’t have the **ability to control their work & quality**.
STUN,TURN and ICE servers - NAT traversal for WebRTC
Published: 2020-06-10 15:10:45

Because of the absence of IP address space and the need to keep a hidden system's engineering obscure to outside clients, NATs are utilized. These decipher inside private IP delivers to outside open IP addresses.Approaching traffic into the private system is steered through an open location restricting that happens on the NAT gadget. This coupling is made when an inside machine with a private IP address attempts to get to an open IP address (through the NAT).

VoIP and WebRTC requires to pass media packets like video/audio into two peers which needs to pass external packets into internal networks.For these situation webRTC needs mechanisms like STUN , TURN and ICE server. Whats these do ! going forward.

We know webRTC is p2p connection. So in a private network connection between two client don't need any server.

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

But when a client A from private network need to connect to Client B who is in a public network , it gets block by NAT firewall and it doesn't know the public ip to connect. TO rescue first see how STUN server do.

Client query the STUN server for his public ip and STUN provides public IP.With this provided public IP Client A can connect to Client B .

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/46cy9n130sjgia38kdc0.jpg)

SO, problem solved! Not yet ! STUN servers doesn't provide same public IP if the client call in different servers. so the bindings is not unique. Thats a problem ! another life-saving mechanism is TURN server.

TURN server actually don't provide any Public IP , its relays media . it takes media from client A and provide to client B , without looking the packet. Compare to STUN server it's very much operation expensive. To reduce cost both STUN and TURN can be use in case of STUN server failure . 

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

These STUN and TURN servers has dawbacks.STUN is backend inexpensive but doesn't work always . TURN server is reliable but backend expensive .Finally ICE servers comes handy !

What ICE server do , its holds everything , its a collector . It collects local IP , STUN server's reflexive IP , TURN sever's relay media addess and stored in a remore peer via Session Description Protocol (SDP) . WebRTC client receives the ICE address of itself and the peers and send media through connectivity checking .

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

Thats all upto ICE server which is used in most of the WebRTC implimentation . Good news there more optimized WebRTC Natting named ICE Trickle . Maybe talks about it some other day . Happy learning !
Doodling in C# at Quora
Tags: csharp
Published: 2020-06-10 15:06:08

Today I tried answering some questions over at [Quora](https://www.quora.com/). They were questions about words and I answered them with word lists and then the C# code I cooked up to generate them. In each case I used a "linuxwords" word-list from [Duke University](https://users.cs.duke.edu/~ola/ap/linuxwords).

The first was asking for [5-letter words starting with 'R'](https://www.quora.com/What-is-a-5-letter-word-starting-with-R/answer/Bruce-Axtens). I had intended originally simply to use a programming language of some sort (C# or maybe [deno](https://deno.land/) (seeing as I've just started learning it)) and post the result but someone beat me to it, so I thought I'd add some value by posting code. After that I figured I'd post code every time.

The second question asked for [7-letter palindromes starting with 'R'](https://www.quora.com/What-starts-with-r-and-ends-with-r-and-has-7-letters-and-is-the-same-spelled-backwards-or-forwards/answer/Bruce-Axtens). The result set was very small: two words.

[The third question](https://www.quora.com/Suppose-that-a-word-is-any-string-of-seven-letters-of-alphabet-with-repeated-letters-allowed-how-many-words-begin-with-AAB-in-some-order-How-many-words-have-exactly-one-vowel/answer/Bruce-Axtens) was poorly worded so I made some guesses about what that OP wanted, implemented those guesses and posted the code. I'm still having this thing with Linq so the code is probably wordier than it could be. Hopefully someone (here or there) will demonstrate a better way.

Have a wander around Quora yourself and see if there's anything there you can solve with some code. It's fun and you may learn something along the way. Maybe have a go at [What are 10 letter words with no repeating letters](https://www.quora.com/What-are-10-letter-words-with-no-repeating-letters).
How to use Custom User Snippets with VSCode
Tags: vscode, tutorial, devtips, developers
Published: 2020-06-10 14:41:25

Learn how to use User Snippets in this video and start making your own custom snippets!

User Snippets allow us to define shortcuts to generating repetitive code. With VSCode you can define your own snippets for multiple programming languages!

If you'd like to see more of my videos, [head over to Youtube!](https://www.youtube.com/channel/UCWaB4SBBUCvhYb91fz5Vidg) 

For more content, stay tuned! A follow/sub comes a long way to show support 

Follow and connect with me on:
----------------------------------
🐦 Twitter: https://twitter.com/coderarchive
📚 Github: https://github.com/luvuong-le
💼 LinkedIn: https://www.linkedin.com/in/lu-vuongle/
📷 Instagram: https://www.instagram.com/coderarchive/
📝 Dev.to: https://dev.to/coderarchive
Beginner Python tips Day - 07 Counter
Tags: python, codenewbie, beginners, tips
Published: 2020-06-10 14:34:09

```python

# Python Day -07 - Counter

# useful dict subclass for counting it's elements
# element can be a string, dictionary, or keyword args

from collections import Counter

string_counter = Counter('aasddhhssdhdhdd')

print(string_counter)
# Prints Counter({'d': 6, 'h': 4, 's': 3, 'a': 2})

print(string_counter.most_common(2))
# Prints [('d', 6), ('h', 4)], the most common elements
# with element and element count tuple

print(list(string_counter.elements()))
# Prints ['a', 'a', 's', 's', 's', 'd', 'd', 'd', 'd', 'd', 'd', 'h', 'h', 'h', 'h']
# all the elements

print(string_counter['d'])
# Prints 6, count of element d

print(string_counter['w'])
# Prints 0 as there is no element w
```
When parallelStream is not a big deal in Java
Tags: java
Published: 2020-06-10 14:29:19

To understand when you should use or avoid the use of parallelStream is important to understand the concept of **stateful** and **stateless** in java streams.
## Stateful
Whenever an action in a stream needs to keep a state to finish its works, the operation would be considered a stateful operation, these actions would be the invocation of operations like:
```java
distinct()
sorted()
limit()
skip()
```
And many others conditions that you can put in your code and will make it stateful. For a fast way to determine if an operation is stateful I use the documentation when I'm not sure:
![parallelSkip](https://dev-to-uploads.s3.amazonaws.com/i/clqihfc4nljfdmjrtybu.png)

A stateful operation should not be used in parallel, it will kill performances!

## Stateless
Stateless operations keep no state during the pipeline execution, because of this characteristic those operations is much more performative.

## Nondeterministic values
Because of the stateful behavioral, it's not possible to determine the execution result when running it in parallel, let's see an example in code:
```java
for (int i = 0; i < 5; i++) {
    Set<Integer> alreadySeen = new HashSet<>();
    IntStream stream = IntStream.of(3, 4, 1, 2, 1, 2, 3, 4, 4, 5);
    int sum = stream.parallel().map(
            // Here we add a stateful behavioral parameter.
            value -> alreadySeen.add(value) ? value : 0).sum();
    System.out.println(sum);
}
```
And here is the output:
```
16
15
15
19
15
```
This result is nondeterministic, you gonne receive a different result for each execution you do, so to make it correct we gonna change our code taking off the parallel():
```java
for (int i = 0; i < 5; i++) {
    Set<Integer> alreadySeen = new HashSet<>();
    IntStream stream = IntStream.of(3, 4, 1, 2, 1, 2, 3, 4, 4, 5);
    int sum = stream.map(
            // Here we add a stateful behavioral parameter.
            value -> alreadySeen.add(value) ? value : 0).sum();
    System.out.println(sum);
}
```
Now we can see a correct result that will be expected to be equal in all new execution:
```
15
15
15
15
15
```
This is because when executing an action in parallel, it is not possible to guarantee a correct validation with a previous state.

### Workarounds

There're some workarounds that would help us with this, but these fix would undermine the benefits of parallelism.
Use of a synchronizedSet:
```java
Set<Integer> alreadySeen = Collections.synchronizedSet(new HashSet<>());
```
Another one is to use distinct() that will keep the operation stateful, but is safe and deterministic:
```java
int sum = stream.parallel().distinct().sum();
```
The use of parallel can speed up processing, but it can also cause problems in the application, so it’s important to know if we’re in a stateful or stateless flow to know how to handle it.
What difference window.ready with document.ready
Tags: javascript, tips
Published: 2020-06-10 12:24:25

---
title: What difference window.ready with document.ready
published: true
description: window.ready vs document.ready
tags: Javascript, Tips
---

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

`JQuery` are basically used in project, aways defined **events** callback like  `$(document).on('ready', function(){})` when document reday. but there has one things Interest me, what is different  `window.onload ` with `document.ready` ?

### window.onload

This event must wait for all elements on the page to loaded then execute this function after rendering

### document.ready

This event be executed as soon as the dom is loaded ignore other **Asset(images,videos)** if ready

Also confuse? let's talk a simple example

### Simple example

We create new chrome tab with url request page, this page havs many images.

When the page **DOM**  are loaded but images, `window.ready` won't be trigger until images loaded browser will trigger this callback

As long as page **DOM** is loaded even if image is not loaded browser will trigger  `document.ready`

### One words

`window.ready` : trigger when page all **DOM** and **Asset(images, videos)** are rendered ready

`document.ready` trigger when page loaded render process rendered even if **Asset(images, videos)** not ready

Hope it can help you :)
Hodan abdirahman - Jacaylkii Dhabi Ma Dheelmado Heestii 


Tags: hodan
Published: 2020-06-10 14:23:01

hodan abdirahman - Heestii Ay Xaajigeeda U Qaaday - Kama Dhofin Official 2020 https://youtu.be/OrrV8e1YRx4
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4hvv4xng7ycf01h43xkn.png)
SignalR Negotiation Failure : net:: ERR:SSL_PROTOCOL_ERROR (https?)
Tags: signalr, typescript, websockets
Published: 2020-06-10 14:20:50

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

From what we've seen in the "regular" failed HTTP requests a status code of zero usually means two things:

- The server is down
- Authorization didn't happen.

In this case we saw the negotiation request sent, with an immediate failure.  Our server was up and running and we had set up CORs.  We were stumped.

Indeed the seemingly ubiquitous nefarious ugly and mystery error showed: 

🍋🍋🍋🍋🍋

>
<span class="unpublished">
Failed to load resource: net:: ERR:SSL_PROTOCOL_ERROR
</span>

We see the Websocket failure in this trace:

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

Its content showed this:

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

Not much information here. Let's look at backend. The output window showed this interesting clue.

```
2020-06-10T09:50:48.3243364-05:00 | [Warning]
Message: Authorization failed for  at RouteEndpoint

```
This Error is instantly painful when it happens because the journey to solve it is difficult. 

- This error does not deal with non secure requests. If you are running an http site, not https, websockets is still able to connect, so we know that SignalR works on both schemas. However, if you are running just http then be aware that you need to add redirect middleware.

We never figured the root cause of this error, but we did find a solution. We made sure our site was using HTTPs, this fixed the problem.
6 Python Built-in Modules You Need To Know About
Tags: python, shell, module
Published: 2020-06-10 14:15:03

# 1. Convert Python2 code to Python3 with 2to3

How many times did you turn down a python script just because it was written in Python2? 2to3 converts Python2 code to Python3.
```bash
2to3 -w example.py
```
<center>Before | After</center>
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/s3fv2sz0jw8ahy7d9exp.png)

# 2. Create an HTTP server with http.server

Place your index.html file and start a local webserver.
In the same directory as the index file, run:
```bash
python3 -m http.server 8000
```
Now you can visit [localhost:8000](localhost:8000).

# 3. Pretty Print JSON using json.tool
I like to deal with most of my developer things inside the terminal, as it is generally faster to implement. Ever had to deal with JSON in your terminal? You must have if you used `curl` before.

```bash
curl -s https://dev.to/api/articles\?username=mithil467
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/x51dl6e39asnk7rr556w.png)

The output is not pretty printed and it's impossible to make anything out of the result. Python's json.tool has got your back!

```bash
curl -s https://api.github.com/users/Mithil467 | python -m json.tool
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qwl3vz712gqls55ynfky.png)
I further piped the output to `pygmentize -l javascript` for better visual impact.

#4. Better text wrapping with textwrap

Back then when I was developing [Mitype](https://github.com/mithil467/mitype), I had this exact problem. I had to do text wrapping based on the width of the terminal.
I ended up writing my algorithm, but now I have found this!
```python
S = "I have started my journey into blogging! Can I call myself a writer now?"
S_wrapped = textwrap.fill(S, width=14)

I have started
my journey
into blogging!
Can I call
myself a
writer now?
```

#5. Print tokens for your code with tokenize

Tokenizing is a stage in the compilation phase where source code elements are converted into tokens. Let's tokenize the same file that we used in our 2to3 example.
```bash
python3 -m tokenize app.py
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/fq1m4uiprfspws0f8p57.png)
You might want to have a look at some more builtin modules here  https://docs.python.org/3/py-modindex.html

| Cover pic by Chris Ried on Unsplash
Your favourite blockchain projects as a programmer
Tags: discuss, blockchain, hobby
Published: 2020-06-10 14:07:16

There are many blockchain projects out there. NEO, EOS, ETH, LISK, STX etc etc

The race is on for these projects to attract as many developers or partners to grow their ecosystem.

In the following are my favourite projects, where I also program small things from time to time.

<b> 1# Blockstack - User owned internet </b>
+ Good quickstart, easy to implement/learn, great dev help, good docu

<b>2# Utrust - Payment platform </b>
+ Good quickstart, easy to implement, good docu

<b> 3# Etherum - Dapps </b>
+ Good quickstart, easy to learn, good docu, fat helpful community 


<i> These are the only 3 that I "actively" program and subscribe to in my spare time. </i>

<b> Tell me yours please ?</b>