teleren/devto huggingface dataset:
The Slack Redux Store
Tags: react, redux, slack, javascript
Published: 2020-02-24 06:10:30

The first Lamno course will teach you how to build a real Slack, and not just a toy version. As part of my research I wanted to see what the Slack Redux Store looks like. 

In order to do this, first open React Dev Tools in Chrome and select the "Client" component.

![Select Client in React Dev Tools](https://dev-to-uploads.s3.amazonaws.com/i/tfd8a7xmlr5nz0t66n6s.png)

Then switch to the console and enter: `$r.props.teamStore.getState()`. This prints out the Redux Store for the team.


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

If you want to take a closer look at the store you can convert store to JSON: `JSON.stringify($r.store.getState())`. Copy the string and paste in your favorite editor.
lam bang dai hoc uy tin gia re nhat
Published: 2020-02-24 04:58:58

Tư vấn làm bằng đại học ,cao đẳng…các anh chị vui lòng liên hệ qua mail hoặc qua số điện thoại bên dưới để được tư vấn nhiệt tình về dịch vụ làm bằng đại học hàng chất lượng và hàng giá rẻ để anh chị dễ dàng chọn làm loại băng nào của chúng tôi. https://alambangdaihoc.com/

Bật mí về dịch vụ làm bằng đại học thật: Chất liệu phôi thật tem sịn 100% của BGD Cho những khách hàng khó tính đã biết về bằng đại học và đã nhìn thấy bằng đại học thật Hay đã làm bằng đại học nơi khác rồi mà không giống bằng thật nên không lấy Vui lòng gọi qua số điện thoại của chúng tôi , chắc chắn tấm bằng của chúng tôi sẽ làm hài lòng bạn. https://lambangdaihocnhanh.com
Troubleshooting `ld: library not found for -lssl'
Tags: note, troubleshooting
Published: 2020-02-24 04:52:15

---
title: Troubleshooting `ld: library not found for -lssl'
published: true
description: 
tags: #note #troubleshooting
---

## Trouble


```
linking shared-object mysql2/mysql2.bundle                                                              
ld: library not found for -lssl                                                                         
clang: error: linker command failed with exit code 1 (use -v to see invocation)                                             
make: *** [mysql2.bundle] Error 1                                                                       
                                                                                                                            
make failed, exit code 2                            
```

I got the error during executing `gem install mysql2`. It seems that the linkable library path is not configured correctly on Mojave.

## Shooting

Invoking the command with `LIBRARY_PATH` to be able to find out the openssl library explicitly.

```
$ LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib gem install mysql2
```

That's all. 😎
A simple, practical tip to improve performance in the front-end.
Tags: javascript, webdev, beginners, tutorial
Published: 2020-02-24 04:45:56

W3C maintains a list of JavaScript best practices, one of which is an imperative to "[keep DOM access to a minimum](https://www.w3.org/wiki/JavaScript_best_practices#Keep_DOM_access_to_a_minimum)". That's all well and good, but what does it *really* mean in more practical terms? Let's explore this with a simple example.

Let's say for stylistic purposes, I would like my website to have an element I can drag around inside the window. The script might look something like this:

```js
const draggable = document.getElementById("draggable");

let isDragging = false;
let offsets = {};

// Start drag
draggable.addEventListener("mousedown", () => {
  isDragging = true;
  /* Get offset between mouse and element position here */
});

// Drag
document.addEventListener("mousemove", () => {
  if (!isDragging) return;
  /* Update top and left styles here */
});

// Stop drag
document.addEventListener("mouseup", () => {
  if (isDragging) isDragging = false;
});

```

In order for the element to be draggable around and over other elements in the same window, it would need these CSS style properties:

```html
<div
  id="draggable"
  style="display: absolute; left: 300px; top: 500px"
></div>
```

The script would work by updating the `left` and `top` properties whenever the `mousemove` event is fired.

How might you get the current `left` and `top` property values, in order to perform the necessary calculations? You might be tempted to directly access them through the element's styling, with `draggable.style.left` or `getComputedStyles(draggable).top`.

This is a trick question. You should avoid accessing the DOM at all.

Here's a better approach:
```js
const draggableCoords = { left: 300, top: 500 };
const draggable = document.getElementById("draggable");

draggable.style.left = `${draggableCoords.left}px`;
draggable.style.top = `${draggableCoords.top}px`;

// The rest of the code

```

What I did here was set the **source of truth** for `draggable`'s `left` and `top` styles *inside the script*. By making JavaScript the foundation of my application, the HTML is now dependent on the script, and not the other way around. This nicely avoids having to access the DOM altogether.

The benefit of this approach is immediately obvious. While the performance benefits for my example aren't significant, it is clear how the computational advantage would be magnified in a complex, production-scale project.
Best practices: Avoid race conditions 🚘💥🚗😰
Tags: security, ruby, database
Published: 2020-02-24 04:01:42

Here are some scenarios and tips to combat race conditions.

## Understanding Race Conditions

> A computer program is like a horse race. The computer program does several things at the same time, similarly to how several horses run at the same time in a horse race. Each horse represents what is usually called a thread of execution. That way, one such thread may handle network communication, another one may be responsible for redrawing the user interface. In the case of a race condition, the application works properly if a given horse wins the race. For example, the application may work if horse number five wins, but it will crash if any other horse wins the race. Source https://simple.wikipedia.org/wiki/Race_condition.

## Real Life Example: Many users booking the same room at the same time


Imagine you have a booking app, let's pretend you a have `Room` model. The `rooms` table stores the `user_id`.


```ruby
class Room
  def assign_to_user!(user_id)
    self.user_id = user_id
    self.save!
  end
end
```


It looks fine, right? Nope, if two users make the same reservation at the same time you are probably going to run into serious problems. Here is why..

The first user who submitted the form will **open** a database transaction and the second user who submitted a millisecond after opened another database transaction. Now we have two opened database transactions, the second transaction has overridden the first. That means, the first user has paid for the room but the second got it, LOL. Just imagine the two hosts discussing in the lobby, you will hear something like this: "No, I booked the room!".

<a href="https://imgflip.com/i/3q3dok"><img src="https://i.imgflip.com/3q3dok.jpg" title="made at imgflip.com"/></a>

To prevent this you can lock the Room table.

```ruby
class Room
  def assign_to_user!(user_id)
    # This block is called within a transaction,
    # room is already locked.
    with_lock do
      self.user_id = user_id
      self.save!
    end
  end
end

```

By locking the table, even if two requests happened at the same time the record won't be updatable UNTIL the DB lock is released, this is called **"Pessimistic locking"**.

Use **Pessimistic locking** whenever you know this kind of things are most likely to happen in your app. See full documentation and examples here: https://api.rubyonrails.org/classes/ActiveRecord/Locking/Pessimistic.html

<a href="https://imgflip.com/i/3q3hm3"><img src="https://i.imgflip.com/3q3hm3.jpg" title="made at imgflip.com"/></a>

## Other Scenarios

Here is a small list of cases where you should implement database locking to avoid unwanted race conditions.

- Money transactions
- Booking flights
- Making reservations
- Cryptocurrency transactions
- Gambling

## Conclusion & Next Steps

Think about which parts of your application deserve database locking, hopefully you can patch those areas so all your users have a great experience.

Please let me know if you have questions or want to chat about other kinds of database locking mechanisms like **Optimistic Locking**.
Utiliser son environnement de développement Waves
Tags: wavesplatform, blockchain, defi, smartcontract
Published: 2020-02-24 03:43:48

Utiliser son environnement précédemment installer et comprendre l'ensemble des fonctionnalités de Docker pour notre Blockchain privée de développement local, WAVES-RIDE le plugin qui va nous assister lors du développement et Surfboard pour la création, la compilation et un déploiement rapide de vos smart contract.

PROCHAIN VIDEO

25 février
RIDE V4 et Waves node 2.0 arrivant sous peu, nous passerons en revue l'ensemble des changements liés à ces nouvelles version, pour RIDE mais aussi pour le protocole Waves.

Suivez nous et posez toutes vos questions sur :

Telegram : https://t.me/wavesdappsFR
Twitter : https://twitter.com/WavesDevFr

https://www.wavesplatform.com
HTTP Response Status Codes In Real Life 😅
Tags: webdev, programming, developer, http
Published: 2020-02-24 01:40:46

---
title: HTTP Response Status Codes In Real Life 😅
published: true
description: I tried to implement HTTP response status codes in the real world.
tags: #webdev #programming #developer #http
cover_image: https://i.imgur.com/ZQ1MW80.png
---

Hello world!

A few days ago I was wondering how HTTP response status codes would look like in real life.

I picked up my camera and tried to implement them around me.

Well, it was an interesting experience!

Here is the YouTube video with ***these guys implemented***:
[![HTTP Response Status Codes In Real Life](https://i.imgur.com/ZQ1MW80.png)](https://www.youtube.com/watch?v=LUJx675Qiw4)
Why I Chose Flatiron
Tags: codenewbie, bootcamp
Published: 2020-02-24 03:28:14

My road to Flatiron began near the end of 2019. I applied in September, but enrollment didn't happen until the middle of December. I waited three months and I am very glad I did. I needed time to consider my options. Plus there was the matter of money.

There was no doubt I wanted to learn to code. I had done web development classes at community college and really enjoyed them. Could I justify taking out a loan, and to not work for months? It was investing in my future, but could I afford it?

All of the deliberating and work I did between September and January (4 jobs, 6 days a week) brought me to a place where I could safely say "Yes, I am ready." 

Ready for me meant being able to pay rent without full time employment, being sure that my next step was the right one, and that I was prepared for the hardships that come along with a condensed coding bootcamp. 

My preparation process involved reaching out to alumni, researching other schools, and checking that it was what I really wanted to do.

Using LinkedIn, I searched out alumni from the Seattle campus. I met over drinks, and talked to people via email. They gave me critical feedback. Shortcomings of the program, things they wish they knew before and during, but most valuably that they enjoyed their time at Flatiron. 

I met with alumni of other coding bootcamps in Seattle as well. I heard their experience and the perks of the different schools they went too. The most persuasive being that other schools offered more flexibility with scheduling, although the programs were significantly longer. 

This was necessary to build confidence in the choice I was making. I felt confident in my choice to study software development. I have a genuine interest in it. A fifteen week program sounded better than a year long program. I wanted the intensity of learning as a full time job. I would lose steam, or interest if I had to split my time between school and a job. Flatiron also offers career services which was a big motivator for me. I have yet to meet my career coach but I'm looking forward to that relationship.

During the time I was researching, and working my chops off, I began to get excited for the opportunity. I started to talk about it with my friends. I was met with support and encouragement. Four weeks into the program I am very happy with my decision.
Top Cat: A Look Back at an Early Project
Published: 2020-02-24 03:19:17

This week I thought I'd revisit one of my first programming projects  - the second one I completed in my bootcamp, in fact. This was a team project, created with Ruby on Rails. 

We made a game called [Top Cat](https://topcatapp.herokuapp.com/login) - where you compete to be the most beloved stray cat in the neighborhood. It's lacking features, its CSS is far from ideal, and I'm certain it's buggy up the wazoo. There are good reasons this one isn't listed on my resume. But I was damn proud of it when we made it, and I still think it's extremely cute. I thought I'd kind of give it a look over and talk about the things I think need to be improved about it. I must keep in mind thought - this was made over about 4 days when I was only 5 weeks into my coding journey.

First of all, the styling could use some serious polishing. In some places text is centered, in others it isn't, and in some it's just completely the wrong size, or the container for it needs to be limited to a smaller portion of the screen. I've got much more skill with CSS now, and would likely be able to fix it quite well. My next project was much better looking, if I do say so myself.

On a functional level, there were a few things we never had the chance to add in. The core function of the game was that you had a certain number of actions a day to spend visiting houses, scavenging for food, etc. If you ended a day hungry, or encountered one of the random events with something like an angry dog, you lost a life (Cats have 9 lives, and all that!). Unfortunately, we ran out of time to implement any functionality for loving all 9 of your lives! It should be game over, but as is, you'll simply slip into negative lives.

This would have to be a fairly large addition, as it would mean adding logic that cuts off access to that cat, and prompts the user to make a new one. As is, you can only make one cat. We had on our wishlist to add the ability to have multiple cats.

The biggest thing is, this program is just not at all dynamic in the ways it needs to be. Frankly, it needs some dang JavaScript. We were frustrated at the time at the static nature of Ruby on Rails pages, which limited several things we wanted to do. For instance, on the cat creation and edit pages, you choose from a drop down of different cat face avatars. If I were to make this now, with some JavaScript it would be easy to make a preview of those avatars pop up when you select them. As is, you just have to select one that sounds good and find out what it looks like when you get to your home page.  

I may make some of these changes my mission for the upcoming week!
I wonder about security of GraphQL, esp for C-UD
Tags: graphql, security, webdev, discuss
Published: 2020-02-24 02:45:57

Also,

- Risk of SQL injections
- Securing endpoints

Not directly related, but I also worry about GraphQL-NoSQL.

- What if I don't want to define a schema?

The worries come from [here](https://dev.to/jianlin/how-is-graphql-different-from-the-old-days-3clk). Why couldn't frontend dev just write SQL?
Lợi ích khi in danh thiếp bằng thẻ nhựa
Tags: inthenhua, inkythuatso
Published: 2020-02-24 02:19:10

Đổi mới là một thuật ngữ được đặt ra để mô tả một điều mới hoặc một thay đổi được thực hiện cho một mục hiện có. Thuật ngữ này đã thúc đẩy thế giới của chúng ta tiến lên và thay đổi cách chúng ta hoàn thành các nhiệm vụ hàng ngày. Nó đã giúp thúc đẩy các doanh nghiệp như Apple, Amazon và Nike trở thành những người khổng lồ mà họ có ngày nay. Đây là những công ty liên tục đánh giá lại các nỗ lực tiếp thị của họ để đảm bảo họ đang vượt qua các ranh giới. Vì vậy, khi đến lúc bạn cần làm cho doanh nghiệp của mình nổi bật, bạn có thể làm gì?

>> Xem thêm: https://inkythuatso.com/in-the-nhua/dich-vu-in-the-nhua-391.html

Có lẽ có nhiều điều bạn có thể làm để thay đổi doanh nghiệp của mình trong nỗ lực thu hút sự chú ý và thúc đẩy doanh nghiệp của bạn tiến lên. Tuy nhiên, thực hiện các điều chỉnh khổng lồ cần có thời gian và cần được nghiên cứu trước khi thực hiện. Vì vậy, hãy bắt đầu nhỏ hơn một chút và suy nghĩ về cách bạn giới thiệu mọi người với doanh nghiệp của bạn. Mỗi ngày, mọi người bị bắn phá với danh thiếp giấy trông giống nhau. Đó là một vấn đề đối với các doanh nghiệp bởi vì, giữa một biển card visit hoàn toàn giống nhau, thật khó để tạo ấn tượng mạnh mẽ giúp bạn kinh doanh.
Rất may, có một giải pháp thay thế có thể làm nổi bật công ty của bạn và cho khách hàng tiềm năng của bạn thấy sự đổi mới mà doanh nghiệp của bạn cung cấp. Sự thay thế đó là card visit nhựa . Những thẻ này đáng nhớ, có thể tùy chỉnh và khác biệt đáng kinh ngạc so với thẻ giấy trung bình được phát hàng ngàn lần mỗi ngày. Có lẽ bạn đang tự hỏi điều gì làm cho danh thiếp nhựa trở nên tuyệt vời so với card visit giấy tiêu chuẩn. Đừng lo lắng, tôi sẽ giải thích. Hãy đi sâu vào những lợi ích của danh thiếp nhựa.
In card visit nhựa là sáng tạo
Bạn có nhớ khi Nintendo Wii nổi tiếng đến mức trong nhiều tháng, các nhà bán lẻ không có đủ hàng để đáp ứng nhu cầu của khách hàng không? Wii thành công không phải vì những trò chơi đáng kinh ngạc hay đồ họa tuyệt vời, mà bởi vì bộ điều khiển chuyển động quá khác biệt so với bộ điều khiển trò chơi video tiêu chuẩn. Nó thu hút sự chú ý của người tiêu dùng và mọi người đều muốn dùng thử. Khái niệm này giống với danh thiếp; Thẻ của bạn sẽ thu hút sự chú ý của khán giả, khiến họ hào hứng dùng thử sản phẩm hoặc dịch vụ của bạn.
Chúng ta hãy đi đến câu hỏi mà tất cả các bạn đã tự hỏi, tại sao danh thiếp nhựa lại tuyệt vời như vậy? Và làm thế nào để họ thu hút sự chú ý của khách hàng của tôi? Với thẻ nhựa, bạn mở ra một thế giới hoàn toàn mới về khả năng cho danh thiếp của mình. Bạn có thể kết hợp các thiết kế tùy chỉnh, hình dạng độc đáo, màu sắc và các tính năng đặc biệt khác để tùy chỉnh thẻ của bạn theo thông số kỹ thuật chính xác của bạn. Thay vì một thẻ giấy trắng đơn giản, bạn trao cho khách hàng của bạn một trải nghiệm. Những thẻ sáng tạo này cho phép bạn có được dòng nước ép sáng tạo của mình để tạo ra một thẻ thực sự đại diện cho thương hiệu của bạn và để lại ấn tượng lâu dài.
Express.js Basic Auth: Get it out the door!
Tags: javascript, node, express, authentication
Published: 2020-02-24 01:46:51

Sometimes you need to roll out a prototype before it even has an authentication layer. Here's how to require a username and password for your application.

## Important!

If it isn't obvious, this should be ***TEMPORARY!***. A proper authentication layer should be added and sensitive data, like passwords, shouldn't be a part of an application's codebase. With that said...

## Express Basic Auth

I'm going to assume some Node.js basics and that you're working with Express.

First, install the [express-basic-auth](https://github.com/LionC/express-basic-auth#readme) dependency: `npm i express-basic-auth`.

Require the auth package where you create your `app`
```
const app = require('express')();
const basicAuth = require('express-basic-auth');
```

and tell Express your user(s)' credentials
```
app.use(basicAuth({
    users: { 'username': 'password' },
    challenge: true,
}));
```

The `challenge` option tells the browser to open a prompt so the user doesn't need to enter a URL prefix like `username:password@...`.
Also, you can add several users to the `users` object.

Simple! Now ship it.
vue.config.js  配置参考
Tags: vue
Published: 2020-02-24 01:36:08



```js
// vue.config.js
module.exports = {

  <!--所有的資源都會被鏈接為相對路徑, 此屬性相當於2.x中的 assetsPublicPath-->
  publicPath: './',
  
  <!--生產環境構建文件的目錄-->
  outputDir: 'dist', 
  
  <!--放置生成的靜態資源 (js、css、img、fonts) 的 (相對於 outputDir 的) 目錄。-->
  assetsDir: 'static', 

  <!--是否在開發環境下通過 eslint-loader 在每次保存時 lint 代碼。-->
  <!--這個值會在 @vue/cli-plugin-eslint 被安裝之後生效。-->
  lintOnSave: process.env.NODE_ENV === 'development',
  
  <!--如果你不需要生產環境的 source map，可以將其設置為 false 以加速生產環境構建。-->
  productionSourceMap: false, 
  
  <!--所有 webpack-dev-server 的選項-->
  devServer:{
    <!--端口號-->
    port: process.env.port || 9527,
    
    <!--dev-server在服務器啟動後打開默認瀏覽器-->
    open: true，
    
    <!--出現編譯器錯誤或警告時，在瀏覽器中顯示全屏覆蓋。-->
    overlay: {
      <!--不顯示警告-->
      warnings: false,
      
      <!--顯示錯誤-->
      errors: true
    },
    
    <!--如果你的前端應用和後端 API 服務器沒有運行在同一個主機上，
    你需要在開發環境下將 API 請求代理到 API 服務器。-->
    proxy: {
      '/api': {
        target: 'http:www.baidu.com', // 要代理的API地址
        changeOrigin: true, // 允許跨域
        pathRewrite: {
            <!--這裡理解成用'/api'代替target裡面的地址，後面組件中我們掉接口時直接用api代替--> 
            <!--比如我要調用'http://www.abc.com/user/add'，直接寫'/api/user/add'即可'-->
            '^/api' : ''
        }
      },
      '/foo': {
        target: '<other_url>'
        ......
      }
    }
  },
  configureWebpack: {
    name: name,
    resolve: {
      <!--設置別名-->
      alias: {
        '@': resolve('src')
      }
    }
  }
}
```

[Vue CLI3.x 配置指南](https://juejin.im/post/5e4fdd1a6fb9a07c8176106b?utm_source=gold_browser_extension)
[vue-cli3.0入门-配置vue.config.js和优化](http://www.qianduan8.com/1728.html)
[publicPath](https://cli.vuejs.org/zh/config/#publicpath)
[devServer.before](https://webpack.js.org/configuration/dev-server/)
How to Debug Angular Ivy Apps in the Browser Console With ng
Tags: angular, javascript, softwareengineering, programming
Published: 2020-02-24 18:27:45

---
title: How to Debug Angular Ivy Apps in the Browser Console With ng
published: true
date: 2020-02-24 01:34:04 UTC
tags: angular,javascript,software-engineering,programming
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/2600/1*3FynclD83RxpBjsRFbftMg.jpeg)](https://medium.com/better-programming/how-to-debug-angular-ivy-apps-in-the-browser-console-with-ng-950facb490c7?source=rss-3a534b5053e6------2)

Inspecting and modifying Angular components directly in the browser

[Continue reading on Better Programming »](https://medium.com/better-programming/how-to-debug-angular-ivy-apps-in-the-browser-console-with-ng-950facb490c7?source=rss-3a534b5053e6------2)