teleren/devto huggingface dataset:
My Journey of learning software development
Tags: developer, dotnet
Published: 2019-09-10 09:03:31

Through the coming series of posts, I will be documenting my journey of learning software development. For now, my focus would be on dotnet development and Linux.

Till now I have been trained in mechatronics engineering, during which I learned about different electromechanical systems, modern and classical control systems methodologies, sensor and instrumentation. During my masters and bachelor degrees, I did get a chance to learn some C, C++ and C# programming and while learning these languages and using them for some software development I always felt that I should learn more and use it more than I did in my coursework. 

My last few experiences with programming have been with C# and dotnet platform and I have observed that in last few years dotnet platform has grown a lot and now it's possible to do development on Dotnet platform on Linux and Mac systems and not just windows system. 

In the coming series of post, I will document the steps I am going to follow to setup my system and the software development I will be doing. The aim is to learn the very fundamentals of backend development of any software application.  Another aim is to use technologies and tools like git, Github etc, which are used in a collaborative programming environment in any software firm or during any collaborative software project.

click on the link below for the next post in this series:
https://dev.to/mechatrona/task-1-install-ubuntu-on-windows-laptop-2p8
Meet Olli 2.0-Future Of Transportation
Published: 2019-09-09 12:29:36

“The future is here” said by John B. Rogers ( Jr, co-founder, and CEO of Local Motors) while introducing Olli 2.0. Local Motors is an Arizona-based automotive OEM which developed autonomous shuttle Olli 2.0 predecessor of Olli. Olli 2.0 uses the advanced 3D printing techniques, along with electric, and self-driving module

The Olli 2.0 is designed for local commute, campuses and urban city centers as a smart, safe, sustainable transportation option. As opposed to its predecessor, Olli, Olli 2.0 not only uses 50% less parts but also it’s production time is reduced by 50%.

First, 3D printed, self-driven shuttle

Olli was first introduced in 2016 as an on-demand, self-driving shuttle capable of transporting up to 12 passengers for short traveling which was enabled by additive manufacturing, more specifically, a Big Area Additive Manufacturing(BAAM) 3D printer and an IBM Watson IoT platforms. This vehicle can be 3D printed and assembled in under 10 hours.

Moreover, Olli is equipped with 360-degree LiDAR scanners which can sense it’s surroundings in all the directions. As a result of 3D printing, the vehicle can be customized for different environments and as per needs. Numerous road tests, including Olli on the streets of Berlin in collaboration with Deutsche Bahn, has led to the 3D printed shuttle’s recent deployment at the Sacramento State University.

For more details about the Olli 2.0:- https://codersera.com/blog/meet-olli-2-0-future-of-transportation/
状态即服务（StaaS）和社交网络
Tags: tanmer, staas
Published: 2019-09-10 07:57:17

---
title: 状态即服务（StaaS）和社交网络
published: true
description: It is a truth universally acknowledged, that a person in possession of little fortune, must be in want of more social capital
tags: tanmer, StaaS
---

![Tanmer.com](https://thepracticaldev.s3.amazonaws.com/i/8ruuoali1q30y44gnl5b.png)

### Status-Seeking Monkeys

“这是一个普遍公认的真理，一个拥有少量财富的人，必须缺乏更多的社会资本。”

所以，简奥斯汀写道，或者她想，如果她记录了我们现在的年龄（相反，我们有泰勒洛伦兹，并且感谢上帝）。

让我们从两个原则开始：

人是寻求地位的猴子*

人们寻求最有效的途径来最大化社会资本

*状态 - 寻求猴子也将是我的独立乐队的名字，如果我学会弹吉他并开始乐队

我从这两个人性观察开始，因为很少有人会对它们产生争议，但我很少看到社会网络，一些世界历史上规模最大，发展最快的公司，在地位或社会资本方面进行了分析。

这部分是衡量问题。数字提供了合法性和可信度。我们有长期的方式来计算和衡量金融资本及其流动。整个网站，报纸部分和大量机构都会精确地报告货币的价格和变动情况。

我们没有这样的方法来衡量社会资本的价值和流动，至少在准确性或精确度方面都没有。研究的主体既宽广又微薄。如果我们除了用户数量之外还有更好的衡量标准，那么这件作品和其他许多内容将充满图表和图表，为分析增添了一种智慧感。会有一些名为“社会状态”的年度报告类似于Meeker的互联网趋势报告，或者可能是她年度报告的50页子部分。

尽管如此，我们研究的大多数社交媒体网络产生的社会资本远远超过实际金融资本，特别是在早期阶段; 几乎所有这些公司都已经内化了硅谷的一个流行真理，即在早期，公司应该推迟创收，转而采用快速的网络扩展。社会资本有很多话要说社会网络为什么会失去热量，失速，有时甚至完全消失。而且，虽然我们可能无法量化社会资本，但作为高度协调的社会生物，我们可以感受到它。

在许多方面，社会资本是金融资本的主要指标，因此其性质受到更严格的审查。它不仅是良好的投资或商业实践，而且分析社会资本动态可以帮助解释各种在线行为，否则这些行为似乎是不合理的。

在过去几年中，分析软件即服务（SaaS）业务取得了很大进展。在社交网络上没有那么多。在保罗罗默关于内生技术变革的论文之前，对社会网络的分析仍然让我感觉像经济增长理论。但是，如果我们将它们视为SaaS业务，我们就可以开始揭开社交网络的神秘面纱，但是它们提供了地位，而不是软件。这篇文章深入探讨了我称之为状态即服务（StaaS）业务。

把这篇文章想象成一系列强烈的假设; 如果不能访问我甚至不确定存在的数据类型，就很难确定。和往常一样，我的智慧读者会像往常一样增加或推迟。

### 社会网络的传统网络效应模型

成功社交网络的基本教训之一是，当用户很少时，他们必须首先吸引人们。通常，这是通过某种形式的单用户实用程序完成的。

这是社会的经典冷启动问题。传统的鸡蛋问题的答案实际上是可以回答的：首先是一只鸡，然后是另一只鸡，然后是另一只鸡，依此类推。问题的难度更大的原因是为什么第一只鸡在没有其他鸡的时候来到这里，以及为什么其他鸡会跟着。

第二个基本的经验教训是，社交网络必须具有强大的网络效应，以便随着越来越多的用户加入，网络进入正增长的飞轮，正面网络效应的复合价值导致曲棍球棒增长，使美元符号成为可能投资者和员工的眼睛。克里斯·迪克森（Chris Dixon）写道，“为这个工具而来，留在网络中”，或许是最令人难忘的格言。

甚至在社交网络之前，我们就电信网络制定了梅特卡夫定律：

电信网络的价值与系统连接用户数的平方成正比（n ^ 2）

这彻底地移植到社交网络。它是直观的，它包括诱人的数学公式，解释了为什么社交网络的增长曲线在经典增长S曲线的脚踝处急剧弯曲。

但是深入挖掘并留下许多问题。为什么一些大型社交网络突然消失，或者输给新的小网络？为什么一些拥有优秀单人工具的新社交网络无法转变为网络，而其他具有看似无聊目的的社交网络却实现了飞跃？为什么有些网络在添加更多用户时有时会失去价值？是什么决定了为什么不同的网络在不同的用户群规模下失效 为什么有些网络容易跨越国际边界，而其他网络则锁定在特定国家/地区 为什么，如果Metcalfe的法律成立，Facebook的许多其他社交网络功能的克隆失败，而有些成功，如Instagram故事？

将这些解释中的许多解释在一起的是社会资本理论，我们如何分析社交网络应该包括研究社交网络对社会资本资产的积累以及其状态博弈的性质和结构。换句话说，这些公司如何有意或无意地利用人们寻求地位的猴子这一事实，总是试图以最有效的方式寻求更多的东西？

用Nicki Minaj的话来说，“如果我是假的，我不会注意到因为我的追随者不是。”
Different Ways of Running Postman Script
Tags: rest, api, postman, newman
Published: 2019-09-10 07:15:54

Hi Folks, in this story I have talked about different ways of executing a Postman test script. Have a look.

https://medium.com/@Raghwendra.sonu/different-ways-of-running-postman-script-a2f1d7235a6d
Recursion, draw a tree with Python Turtle
Tags: python, turtle
Published: 2019-07-08 13:54:27

---
title: Recursion, draw a tree with Python Turtle
published: true
description: python, turtle
tags: python, turtle
---
You can use recursion to draw your shapes. Recursion is when a function calls itself with a stopping condition.

A famous example of recursion is the "droste effect", but unlike recursion in programming there is no stopping condition. It keeps going on forever.

<img src="https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FuudNRE0I3Ehyg%2Fgiphy.gif&f=1">

Ok, so say a tree. A tree has branches, each branch has branches. Those branch have branches and so on.

A recursive function can draw itself, its branches, their branches. It's clear you need to use recursion to draw a tree with all its branches.

The code below is an example of that:

    #!/usr/bin/python3
    from turtle import Turtle, mainloop
    
    def tree(plist, l, a, f):
        """ plist is list of pens
        l is length of branch
        a is half of the angle between 2 branches
        f is factor by which branch is shortened
        from level to level."""
        if l > 5: 
            lst = []
            for p in plist:
                p.forward(l)
                q = p.clone()
                p.left(a)
                q.right(a)
                lst.append(p)
                lst.append(q)
            tree(lst, l*f, a, f)
         
        
    
    def main():
        p = Turtle()
        p.color("green")
        p.pensize(5)
        
        p.hideturtle() 
        p.speed(100)
        p.left(90)
        p.penup()
        p.goto(0,-200)
        p.pendown()
        
        t = tree([p], 200, 65, 0.6)
    
    main()

![](https://thepracticaldev.s3.amazonaws.com/i/7z9b6ww3z0q2b0r4sodn.png)    

The turtle was hidden with

    p.hideturtle() 

without that line, the tree looks nicer:

![](https://thepracticaldev.s3.amazonaws.com/i/p11jbip76qwfh2izla7r.png)

Related links:
* <a href="https://en.wikipedia.org/wiki/Recursion">Recursion</a>
* <a href="https://pythonprogramminglanguage.com/">Python tutorial</a>
* <a href="https://pythonprogramminglanguage.com/functions/">Functions</a>
Filemanger In Laravel 5.8
Tags: laravel
Published: 2019-09-10 04:10:29

Installing laravel-filemanger

# composer require unisharp/laravel-filemanager

Config file config/app.php

//providers add line two
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,

//aliases add line
 
'Image' => Intervention\Image\Facades\Image::class,

if version Laravel > 5.5, you don't command install

# php artisan vendor:publish --tag=lfm_config
# php artisan vendor:publish --tag=lfm_public

Delete cache:
# php artisan route:clear
# php artisan config:clear

You can set chmod folder upload images in config/lfm.php

Installing auth in laravel

# php artisan make:Auth 

//confing web.php

Route::group(['middleware' => 'auth'], function () {
    Route::get('/laravel-show', function(){
      return View('filemanager');
    });
    Route::get('/laravel-filemanager', '\UniSharp\LaravelFilemanager\Controllers\LfmController@show');
    Route::post('/laravel-filemanager/upload', '\UniSharp\LaravelFilemanager\Controllers\UploadController@upload');
    
    // list all lfm routes here...
  });

You need create file in folder views/filemanger.blade.php 

<script src="//cdn.ckeditor.com/4.6.2/standard/ckeditor.js"></script>
<textarea id="editor" name="content" class="form-control"></textarea>
<script>
  var options = {
    filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
    filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token=',
    filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
    filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token='
  };
  CKEDITOR.replace('editor', options);
</script>

Install filemanger in laravel success
# php artisan server

You need before login in laravel, aften then you can open brower
http://localhost:8000/laravel-show/
 

Post:http://hoanguyenit.com/filemanger-in-laravel-5-8.html
Clojure Bits: Working with JSON
Tags: clojure, json
Published: 2019-12-08 18:11:51

---
title: Clojure Bits: Working with JSON
published: true
date: 2019-09-10 04:00:00 UTC
tags: clojure,json
canonical_url: https://alexanderoloo.com/blog/2019/09/10/clojure-bits-working-with-json.html
---

Clojure Bits: bite-sized and human friendly bits of Clojure. Today, let’s chat about JSON, the backbone of the internet. I’ve written a ton of web applications in Clojure and so far my favourite library for working with JSON is Cheshire. It’s simple to use and fast. Really fast. Here’s how you can get started with it.

_(This was first published on [medium.com](https://medium.com/@alekcz/clojure-bits-working-with-json-d93660e7b99f))_

## Installation

To install cheshire, add it to you list of dependencies in `project.clj` like so

```clojure
:dependencies [ ...some dependencies...
                [cheshire "5.9.0"] ; installed!
                ...more dependencies...]

```

It’ll download when you use `lein` to run your program or start the REPL .

## Using it

Start by adding cheshire to the current namespace. You can do this in two ways depending on whether you’re working in the REPL or in a file.

```clojure
In a file => (:require [cheshire.core :as json])
In the REPL=> (require '[cheshire.core :as json])

```

## The API

### Clojure map to JSON

```clojure
(json/encode {:message "build passing"})
;; "{\"message\":\"build passing\"}"

```

### JSON to clojure map

```clojure
(json/decode valid-json-object)
;; {message "build passing"}
;; notice the map doesn't have keywords

```

### JSON to clojure map with keywords

```clojure
(json/decode valid-json-object true)
;; {:message "build passing"}
;; Yay, much nicer!

```

Cheshire can do a lot more than this. But this is all you need 99% of the time.

_May your build always pass._

_Alex_

## References

- [https://github.com/dakrone/cheshire](https://github.com/dakrone/cheshire)
- Countless hours of debugging
Testing React Native Apps ? WtfReactNativeTesting
Tags: react, reactnative, test
Published: 2019-09-10 03:18:57

## What are we unit testing exactly ? :rotating_light:

We're using **"unit testing"** to refer to tests of functions and plain JavaScript objects, independent of the React Native framework. This means that we aren't testing any components that rely on React Native.

For example, a unit could be individual methods and functions in classes or really any small pieces of functionality. We mock out dependencies in these tests so that we can test individual methods and functions in isolation.


These test are written using testing frameworks and for this article i will be using [Jest](https://jestjs.io/), javascript testing framework together with [Enzyme](https://airbnb.io/enzyme/) and [React Native Testing Library](https://github.com/callstack/react-native-testing-library).


View all on my repo [WtfReactNativeTesting](https://github.com/tuantvk/WtfReactNativeTesting)
Add to a Dictionary in D
Tags: dlang, tutorial
Published: 2019-09-10 02:47:34

Dictionary, hash table, associative array, map it has many names. The main challenge with dictionary adds is more around nested associative arrays, are you going to be annoyed if I select a different name every time?

```dlang
int[string] dict;
dict["Key"] = 55;
```

There is a Dictionary literal in D. 

```dlang
auto data = ["key" : 55]
```

but this is not good for adding data as it will replace the variable with a new object. However if you're nesting and the inner dictionary might be null it can be good to use for starting a dictionary.

```dlang
string[int][string] data;
data["hello"] = [95: "value"];
```
เข้าใจเรื่อง EventBus ใน 3 นาที
Tags: android
Published: 2019-09-10 02:31:32

รู้ว่าอ่านเองมันยาก เราเลยสรุปให้ อ่านเสร็จมาม่าสุกพอดี

ถ้าคุณอยากโยนค่าอะไรไปซะอย่าง โดยไม่ต้องรู้จักกัน ขอแค่ส่งไปแล้วได้รับก็พอ
ถ้าคุณอยากโยนค่าอะไรไปซะอย่าง โดยที่ไม่ต้องมานั่ง check ตลอดเวลาให้วุ่นวาย

## EventBus เธอคือคำตอบ เพราะอะไรหล่ะ?
สมมุติเราส่งของให้ลูกค้า โดยมีตัวกลางอย่างพี่แมสเป็นคนส่ง ซึ่งตัวกลางอย่างพี่แมสก็ต้องมีระบบรับของจากเราและส่งของไปให้ลูกค้า ทำให้ลูกค้าตามพัสดุจากพี่แมสได้ และรู้ว่าของถึงแล้วเมื่อพี่แมสโทรมาบอก

![image](https://raw.githubusercontent.com/greenrobot/EventBus/master/EventBus-Publish-Subscribe.png)

จากในแผนภาพนี้มีการทำงานดังนี้

1. ตกลงกันก่อนว่าจะส่งอะไร เช่น event ชื่อพัสดุ
2. จากนั้นคนส่งจะส่ง event โดยการ post
3. พี่แมสหรือ EventBus รับ event ที่ว่า
4. พี่แมสเอาไปส่งให้คนรับ
5. คนรับจะได้รับ event ตอนที่ subscribe เรียบร้อยแล้ว

### มาใช้งาน EventBus กันเถอะ

ก่อนอื่น ใส่ลงไปใน dependency เสียก่อน
```gradle
implementation 'org.greenrobot:eventbus:3.1.1'
```

อ้างอิงจาก [https://github.com/greenrobot/EventBus](https://github.com/greenrobot/EventBus)

พออ่านๆพบว่าใน README.md อ่านแล้วจะงงๆเพราะไม่ได้บอกถึงขารับ ดังนั้นสรุปการใช้งานดังน้ี

กำหนด **Event** ที่จะรับ อาจจะสร้าง model class มาตัวนึง เช่น
```kotlin
class MessageEvent(val message: String)
```

**ฝั่งขาส่ง** อยากจะส่งอะไรก็ใช้เจ้า post พร้อมแนบ event ไปด้วย เช่น
```kotlin
EventBus.getDefault().post(MessageEvent("ReceivedGoods"))
```

**ฝั่งขารับ** เราต้อง *register* มันก่อน มักจะใส่กันที่ `onCreate()`
```kotlin
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    EventBus.getDefault().register(this)
}
```
และ *unregister* ด้วย มักจะใส่ที่ `onDestroy()`
```kotlin
override fun onDestroy() {
    super.onDestroy()
    EventBus.getDefault().unregister(this)
}
```

จากนั้นฝั่งขารับสร้าง function เพื่อ Subscribe Event ที่เราจะรับ โดยการใส่เจ้า `@Subscribe` และตามด้วย `threadMode`

*ข้อควรระวัง function ที่รับ Event นั้น ต้อง public เท่านั้น ไม่งั้นแอป crash เพราะมันหาไม่เจอจ้า*
```kotlin
@Subscribe(threadMode = ThreadMode.MAIN)
fun onMessageEvent(event: MessageEvent) {
    ...
}
```
ลองเอาไป run ดู พบว่าทำงานได้แล้ว เย้ๆๆๆๆ

#### อ่านเพิ่มเติม
[How to get started with EventBus in 3 steps](http://greenrobot.org/eventbus/documentation/how-to-get-started/)


---
When The Swarm Isn't Enough (An Incredible Journey)
Tags: docker, kubernetes
Published: 2019-09-10 02:21:26

# Exit Docker Swarm

  About 2.5 years ago I was tasked with an impossible mission, much like John Wick. My task was to take a monolithic system and attempt to break it into pieces and convert those pieces into micro-services. Well there were a couple problems with that.

1. There was so much cross pollination of the database you would of thought growing a super weed was inevitable. In other words, developers were going around the service api and DAO layers and interacting with the database direct.
2. Written using Java 1.2 Standards need I say more
3. Unit/Functional/Integration tests were shit
4. There is more but I don't want to list it out.


So we decided to rewrite the whole application from scratch, we used OpenApi Spec to define our API calls, we used Java Spring Architecture for each micro-service. We even created a few JS micro-services that use express and some other npm packages. 

At the time were were told the micro-services needed to be deployed as VM's in openstack (I will admit it wasn't fun this approach). Then we got our first customer and we had 2 weeks to deploy our application into a customer VMware environment. This means no openstack, yeah oh shit! So what did we do? 

Well I was experimenting with use Docker Compose at the time and we took the container nestle tea plunge and deployed our app using Docker Compose. This actually worked out pretty well minus the scalability being static. 

We then took the natural next step and enable Docker Swarm and scaled up our services. We have manager nodes and worker nodes and the application is working quite alright. One major issue we have found with Docker Swarm is utilizing its ingress networking. We are finding stale DNS entries. In addition there isn't elastic horizontal scaling. So we started our search. Enter K8's........

## Enter Kubernetes

We spoke with our group and everyone was on board with making the move to Kubernetes. So me and my architecture team got together and we enlisted the help of a consulting firm. We worked for 10 weeks with a brilliant group of 4 people (6 of us total) to learn how to do infrastructure as code in AWS(cloud formation, terraform), to setup vertical scaling and horizontal scaling. We even in a matter of 4 weeks out of the 10 were able to do a bare metal deployment using kubespray. 

The rebuilding of the application, CI/CD, Container orchestration all happened over the past 2.5 years. I have learned so much about dev ops, application threads, and shared memory. There are so many 3rd party products we use it is incredible. It's a wonder I feel like my head is full everyday.

Thanks for taking the time to read my incredible journey.
A better way to add URL params
Tags: javascript
Published: 2019-09-10 02:00:18

---
title: A better way to add URL params
published: true
description: A better way to add URL params
tags: javascript
---

Let's say you are building a filter component for a search page. To achieve this, you might use template strings to build you url params.


```javascript
const urlParams = `?checkin=${filter.values.checkin}&checkout=${filter.values.checkout}`;
```

This might look ok but it can get a bit difficult to read when it gets more values.


An alternative way is to use [query-string](https://github.com/sindresorhus/query-string). It provides a stringify function that allows you to pass an object and it generates the url params for you.


```javascript
import queryString from 'query-string';

const urlParams = queryString.stringify({ 
   checkin: filter.value.checkin,
   checkout: filter.value.checkout
})

```


The result is a way of generating your URL params without having to manually add &. It is also easier to read when you have to pass multiple values.
Building A Reliable And Performant Router For Observability Data - Episode 97
Published: 2019-09-10 01:30:44

<p>The first stage in every data project is collecting information and routing it to a storage system for later analysis. For operational data this typically means collecting log messages and system metrics. Often a different tool is used for each class of data, increasing the overall complexity and number of moving parts. The engineers at Timber.io decided to build a new tool in the form of Vector that allows for processing both of these data types in a single framework that is reliable and performant. In this episode Ben Johnson and Luke Steensen explain how the project got started, how it compares to other tools in this space, and how you can get involved in making it even better.</p><p><a href='https://www.dataengineeringpodcast.com/vector-observability-data-router-episode-97/'>Listen Now!</a></p>
Think about how things can go wrong
Tags: letterstoanewdev, edgecases, howcanthingsgowr, questions
Published: 2019-10-12 14:31:33

---
title: Think about how things can go wrong
published: true
tags: letters to a new dev,edge cases,how can things go wr,questions
canonical_url: https://letterstoanewdeveloper.com/2019/09/09/think-about-how-things-can-go-wrong/
---

Dear new developer,

Think about the edge cases.

This is one of the primary ways you can add value. Think about what happens when things go wrong. It’s usually relatively straightforward to consider the happy path. Let’s take the example of a relatively simple ordering application. People can login, see their orders, and can change certain aspects of their orders (their address, perhaps) before a product is shipped.

Begging the question of why aren’t you using an open source solution like Magento or a off the shelf saas solution like Shopify, there are other things to be aware of.

- What happens if the user wants to ship some orders to one address and some to another?
- What does the user see when they login but have no orders?
- What happens when they change their address?
- What kind of validation is needed?
- How do we know when a product is shipped? What do we do if a user wants to change their address but the product has shipped?

These are all edge cases around the happy path of login -> change address -> exit. But they are all going to affect the user experience, and so are worth thinking about.

I prefer to do it at the spec time, but any time to ask these questions is a good one. Otherwise, you’re either going to have:

- the edge cases pop up and be handled poorly,
- or developers making up the answers while coding

So, new developer, when you get a change to talk about a feature, think about the happy path, the expected path, to be sure. But also think about how things could go wrong.

Sincerely,

Dan
capybara find.text method ignore newline (convert to a space)
Tags: capybara, rspec, rails
Published: 2019-09-10 00:14:53

---
title: capybara find.text method ignore newline (convert to a space)
tags: capybara, rspec, rails
---

## 🔗 Parent Note
{% link https://dev.to/n350071/my-capybara-note-2gp3 %}

## 🤔 Situation
The find method automatically **convert the '\n' to a space**, so test will be false.

```ruby
target = 'hello\nworld'

p target
#=> "hello\\nworld"

find('div.target').text
#=> "hello world"

expect(find('div.target').text).to eq target
#=> false 😅
```

## 🎉 Solution
There is `Capybara::RSpecMatchers#have_content` method.
- ⭕️ It judges the page or the node has the text. 
- ❌ It ignores HTML tag, so if you want to test include HTML tag, you shouldn't use this.

```ruby
expect(find('div.target')).to have_content(target)
```

📚 [Capybara::RSpecMatchers](https://rubydoc.info/github/jnicklas/capybara/master/Capybara/RSpecMatchers#have_content-instance_method)
Fetch API data in React using useEffect hooks
Tags: react, javascript, tutorial, webdev
Published: 2019-09-14 06:35:27

---
title: Fetch API data in React using useEffect hooks
published: true
tags: ['react', 'javascript', 'tutorial', 'webdev']
canonical_url: https://learnwithparam.com/videos/react-useeffect-to-fetch-api/
description: Lets learn to fetch countries REST API using react useEffect and browser fetch API.
series: Small steps on React
---

{% youtube ZUs7z7jxSH0 %}

##### References

- [https://restcountries.eu/](https://restcountries.eu/)
- [https://restcountries.eu/rest/v2/all?fields=name](https://restcountries.eu/rest/v2/all?fields=name)