teleren/devto huggingface dataset:
My 5 late ideas for the 'Blog More' challenge on CNC2018
Tags: discuss, cnc2018, misseddeadline
Published: 2018-01-29 15:52:11

---
title: My 5 late ideas for the 'Blog More' challenge on CNC2018
published: true
description: I always want to write but never gets to it... Time to change that
tags: discuss, cnc2018, missed deadline
---

So here is a mix of 5 ideas which is a mix of some old and new ones for posting (those in ***bold*** are locked for the next phase):

 - ***1/ Making a PWA in Elm: I made a small tabata/interval trainer app in Elm that runs with Webpack and cordova. How to make and deploy an app with that stack, how to make a PWA with lightbox, some personal experience and why I would skip cordova if I was to start again***
 - 2/ Playing with SVG and animation in Elm: still about this tabata app, I've made a few unsuccessful attempts to get a nice animation while working out and resting. Comparing generating an animation tag in SVG vs regenerating the SVG itself from Elm (latter is the best solution IMO but... I'd started with the other one first)
 - ***3/ The carbon cost of emails. I recently switched from gmail to lilo.org's mail solution, it's a carbon-compensated solution and that got me to think of a few costs of emailing, problem is there isn't enough good numbers on it.***
 - ***4/ Some kind of shortish "biography" on how I went from an engineering school in France to freelancing from the North of Sweden and focus on a few pointers to start as a freelancer and of what I would do different.***
 - 5/ Another Elm article about some of the tools in the ecosystems that I recently discovered hoping other Elm enthusiast will get to know them if they haven't already (mainly elm-lens & elm-analyse to provide the next level of code quality for your elm projects). 


So I've got the 3 posts I needed! Thanks to all of you for helping!
Friday Blast #19
Tags: fridayblast, links, post
Published: 2019-01-20 15:21:43

---
title: Friday Blast #19
published: true
tags: friday_blast,links,post
canonical_url: https://horia141.com/friday-blast-19.html
series: "Friday Blast"
---

[A brief history of select(2) (2016)](https://idea.popcount.org/2016-11-01-a-brief-history-of-select2/) - covers the history of the `select` syscall. Early Unixes were very basic.

[Select is fundamentally broken (2017)](https://idea.popcount.org/2017-01-06-select-is-fundamentally-broken/) - the follow-up to “A brief history of select(2)”, this covers why `select` isn’t that good, performance wise, and how `poll` and `epoll` try to fix some of it’s issues.

[Race condition vs data race (2011)](https://blog.regehr.org/archives/490) - on the topic of things that can go wrong in concurrent programs. Race conditions are any error which occurs under specific timing in the application, whereas data races are explicit cases where two writes write several shared memory locations without any synchronization. They are distinct and one can have one without the other. The neat thing is that data races can be detected automatically, and programs without data races actually have some nice properties.

[Falsehoods programmers believe about [video stuff] (2016)](https://haasn.xyz/posts/2016-12-25-falsehoods-programmers-believe-about-%5Bvideo-stuff%5D.html) - there’s a cottage industry of these “falsehoods programmers believe about X” and this article has “X = video stuff”. In truth, there’s a lot of these things, and some of them are quite scary. Well worth a read if you’ve ever had to interact with video.

[Everything sysadmin: are you load balancing wrong? (2016)](http://queue.acm.org/detail.cfm?id=3028689) - there’s two uses for load balancing - to provide extra capacity or to provide resilience. Your team needs to be clear how you’re using yours. For example, if you’re using them for extra capacity, you might expect the shards to be at almost full capacity. And when one breaks, the others might not be able to handle the extra traffic. If you think you’re doing it for reslliency, you’re going to have a bad time.

[Why aren’t application downloads routinely done over HTTPS? (2012)](https://security.stackexchange.com/questions/18853/why-arent-application-downloads-routinely-done-over-https) - the bottom line is that you basically only need authenticity, not prevention of MITMs or any other stuff HTTPS provides. Furthermore, due to the way downloads are done (with mirrors etc), you need some extra infrastructure on top of that as well.

[Little’s Law (2017) #own](http://horia141.com/littles-law.html) - this is one of my own from the last week. It’s about a nice result from queuing theory with many applications in building distributed applications.
React Quick Tip: Use Class Properties and Arrow Functions to Avoid Binding `this` to Methods
Tags: react, javascript, tips
Published: 2018-01-29 15:19:11

---
title: "React Quick Tip: Use Class Properties and Arrow Functions to Avoid Binding `this` to Methods"
published: true
description: When you want to access `this` inside a class methods of your React component, you need to bind it to your method, but this is completely unnecessary, extra code! You can use class properties and arrow functions to avoid binding `this` to methods.
cover_image: https://thepracticaldev.s3.amazonaws.com/i/gk0hsv0qsfcwgx00rpyx.png
tags: React, JavaScript, Tips
---

When you want to access `this` inside a class methods of your React component, you need to bind it to your method:

```js
class Button extends Component {
  constructor(props) {
    super(props);
    this.state = { clicked: false };
    this.handleClick = this.handleClick.bind(this);
  }
  handleClick() {
    this.props.setState({ clicked: true });
  }
  render() {
    return <button onClick={this.handleClick}>Click Me!</button>;
  }
}
```
Binding this to `handleClick` in the constructor allows us to use this.setState from `Component` inside `handleClick`. Without this binding, `this` is re-scoped for `handleClick` and loses context of the component’s `setState` method.

But this is completely unnecessary, extra code!

You can clean up this ugliness by using some new ES6+ features. Here is the same component, rewritten using class properties and arrow functions to avoid binding `this` to `handleClick`:

```js
class Button extends Component {
  state = { clicked: false };
  handleClick = () => this.setState({ clicked: true });
  render() {
    return <button onClick={this.handleClick}>Click Me!</button>;
  }
}
```

**Note: You must have transform-class-properties enabled in your own Babel config in order to use class properties. If you’re using Create React App, this is already enabled for you.**

## Why Does This Work?

This works because of two reasons:

1. Arrow functions, by their nature, do not re-scope `this`, so we don’t need to bind `this` in the class constructor.
2. JavaScript has first-class functions, meaning functions are treated the same as data. So arrow functions can be assigned to variables, or in this case, to class properties.

---

## Bonus Tip

Notice in the second example, I defined state as a class property as well, negating the need for a constructor.
Working on Schema based database first time.
Tags: rdbms, nosql, mongodb, mysql
Published: 2018-01-29 15:09:15

---
title: Working on Schema based database first time.
published: true
description: It is based on my own experience. 
tags: #RDBMS #NoSql #mongo  #Mysql
---

Started career one and half year back never touched the SQL database in there. so I decided to check it out for a curiosity, my previous experience was on Google Datastore, MongoDB it is my first time on a schema based Database, coding is my hobby and I'm finding happiness in that, I have few projects on gitlab, so I pulled one of my MongoDB based projects and started changing code base the starting was port 27017 to 3306. mongo repository to crud repository and few annotations. 

After the basic setup, I just found the use of use of Hibernate annotations which I terrible missed on MongoDB. such as

@OneToOne               @ManyToOne	@OneToMany	@ManyToMany	@PrimaryKeyJoinColumn	@JoinColumn	@JoinTable	@MapsId.

will keep update here once I can able find the huge differences on that.
Hosts which offer OSS discounts?
Tags: discuss, opensource, fundossdiscounts
Published: 2018-01-29 13:44:58

---
title: Hosts which offer OSS discounts?
published: true
description: Do you know any places like the old Rackspace OSS discounts?
tags: discuss,oss,fundoss discounts
---

Hey Dev community,

Alas I was reading about Rackspace ending their OSS discount program for new applicants, and wondered - what other options are available with similar discounts?

I’m personally in search for an affordable host to host my entirely open source project, so I thought I’d ask the community if they know of any!

Cheers
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2018-01-29 12:22:40

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xsr1z6iqv0pd7p3s6ns3.png
---

#1. ES6 Listicle of Tips & Tricks

Sam shares a list of ES6 tips that might make your code cleaner and easier to read. Meaning, aka ways to make you and future you and collaborators happy. 

{% link https://dev.to/samwsoftware/make-your-code-cleaner-shorter-and-easier-to-read-es6-tips-and-tricks-2k37 %}

#2. 😱 Sublime Text > Visual Studio Code 😱

Andrew used Visual Studio Code for over a year and decided to Sublime Text. In this post, he shares why he made the switched. 

{% link https://dev.to/restoreddev/why-i-switched-from-visual-studio-code-to-sublime-text-28k0 %}

#3. Git going already

A detailed walkthrough on how to set up git on your OSX, Windows, or Linux machine. 

{% link https://dev.to/landonp1203/how-to-properly-set-up-git-on-your-computer-33eo %}

#4. ✨**S**ituation **T**ask **A**ction **R**esult✨

Aga shares resume writing tips that use software development metaphors so we, uh, get it.

{% link https://dev.to/agazaboklicka/how-to-write-a-solid-dev-resume-to-be-2018-star-3h8a %} 

#5. "a phenomenon of mass psychosis"

If we could explain the success of JavaScript with just one word what would it be?

{% link https://dev.to/remojansen/the-most-important-lesson-that-the-success-of-javascript-has-taught-us-4ike %}

#6. Optimize that workflow!

This article illustrates artifact-based deployment in simple terms, through a practical example.

{% link https://dev.to/kmaschta/configurable-artifacts-how-to-deploy-like-a-pro-4fhk %}

#7. Scrape away

Aurel provides an introduction to web scraping by...scraping this site 🙃

{% link https://dev.to/aurelkurtula/introduction-to-web-scraping-with-nodejs-9h2 %} 

_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Monday!_
Evening Rust: Episode 8: A snakes-like Tron game?
Tags: video, coding, rust, competition
Published: 2018-01-29 08:20:26

---
title: "Evening Rust: Episode 8: A snakes-like Tron game?"
published: true
description: A flood-filling, path finding bot.
tags: video, coding, rust, competition
cover_image: https://thepracticaldev.s3.amazonaws.com/i/gaz2cng9ltjtux5snvwh.jpg
---

{% youtube Pz__OZMOHd0 %}

We try our hand at writing a snaking AI to tackle the Tron challenge. Surprisingly just encoding the basic rules get us through the two basic leagues. Then we perform quite well using my initial idea of a flood-fill / A* style scoring algorithm. 

Come watch and see how far we get!

Subscribe to my [Twitch Channel](https://www.twitch.tv/mortoray) to watch live.
How to organise NPM scripts in package.json?
Tags: node, npm, javascript
Published: 2018-01-28 20:21:12

---
title: How to organise NPM scripts in package.json?
published: true
description: 
tags: node, npm, javascript
---

I love using npm script as my build tool. By doing so, we could make sure the scripts are not sooooo complicated and easy to read (comparing to gulp/grunt in my opinion).

But as the project grows larger, there are more and more scripts that are added to `package.json` and things become less and less maintainable.

You probably tried adding empty lines in between scripts, but figure `npm install` will just remove your empty lines and leave you with only disappointment.

Here is a little trick which allow us to, kind of, group our scripts into categories.

```javascript
{
  "scripts": {
    "test": "nyc mocha --recursive",
    "preversion": "git checkout master && git merge --squash dev && npm test",
    "version": "git add -A",
    "postversion": "git push && git push --tags && git checkout -",
    "\n# TESTING SCRIPTS:": "",
    "createTestPages": "node ./scripts/createTestPages.js",
    "test:watch": "mocha --recursive --watch",
    "coverage": "nyc report --reporter=lcov > coverage.lcov && codecov",
    "lint:js": "eslint .",
    "\n# HUSKY GIT HOOKS:": "",
    "precommit": "lint-staged"
  }
}
```

The trick here is to define some category keys. By adding `\n` to the front of the key, we would get a pretty darn neat `npm run` result.

```
> npm run
Lifecycle scripts included in grab-lyrics:
  test
    nyc mocha --recursive
  preversion
    git checkout master && git merge --squash dev && npm test
  version
    git add -A
  postversion
    git push && git push --tags && git checkout -

available via `npm run-script`:
  
# TESTING SCRIPTS:
    
  createTestPages
    node ./scripts/createTestPages.js
  test:watch
    mocha --recursive --watch
  coverage
    nyc report --reporter=lcov > coverage.lcov && codecov
  lint:js
    eslint .
  
# HUSKY GIT HOOKS:
    
  precommit
    lint-staged
```

One thing to keep in mind is to always put NPM lifecycle hooks at the top of the script because NPM will just grab them and put them at the top.

What do you think about this trick?
Recommend me a Node.js framework.
Tags: discuss
Published: 2018-01-29 06:01:34

---
title: Recommend me a Node.js framework.
published: true
description: I want to change Django for Node.js
tags: discuss
---

I'am a Django developer, and I really love this framework, specially the Django-ORM. But, I've been discarding several parts of Django for years.

I completely eliminated the use of the template system, and practically Django has stayed only to create WEB APIs (Django REST Framework, and now Graphene/GraphQL).

I'm focused on migrate my backend to JavaScript/Node, and now I'm looking for the best technologies for create Web APIs in Node.

Basically, a ORM (I take a look to Sequelize and Waterline) and Controller framework (I take a look to Express.js and Sails). The idea is to find something that also gets along well with GraphQL.

We use Vue on the frontend.

What do you think? Node is a new world for me.
I moved on & need help in configuration!! 😞
Tags: discuss, code, atom
Published: 2018-01-29 05:44:46

---
title: I moved on & need help in configuration!! 😞
published: true
tags: discuss #code #atom
---

I hereby, decided to shift to VS Code from Atom Editor after having some performance issues with her (Atom).

So, I'm now into Code. What are some great Editor theme - Syntax theme - Font type and other extension for a web developer. I can't find Emmett in VS Code till now. The Fira Code ligratures are also not working in Code. 

The languages I work on are PHP & JavaScript.

I'm sorry atom. We really had a good relationship. It's time for me to move on. 

I'll still love you. ♥
Hyperledger Fabric Architecture: Explained in detail
Tags: blockchain, hyperledger, distributedledger
Published: 2018-01-29 04:29:34

---
title: "Hyperledger Fabric Architecture: Explained in detail"
published: true
description: If you’re very new to blockchain and building your first network with Hyperledger fabric, I’d strongly suggest you read this article so to understand the architecture of the framework and the components involved.
tags: blockchain, hyperledger, distributedledger
---

![Hyperledger Fabric Architecture](https://d33wubrfki0l68.cloudfront.net/1f4d7932dd80030947c2a10baac3aea8b4d70c3a/b23c4/svrmedia/heroes/f/1-1.jpg)

### DOMAIN
This is the top-level namespace for your project. Say you’re building a network for a supply chain, then usually the project name or the domain name is used as the Hyperledger Fabric’s domain.

### ORDERERS
Under a domain, there are orderers (can be multiple instances) who are responsible for making sure that all the peers in the network have committed a transaction. When a transaction is proposed and committed by a peer, the orderer is informed about the new transaction and it forwards and commits this block to all adjacent peers.

Note: Orderers are not dependent on one organization. However, it is suggested to have multiple orderers to reduce failure rates.

### ORGANIZATIONS
Organizations are the containers for the peers and respective certificate authorities (CA). Each organization has its own CA and a list of peers. Usually, organizations are used for physical separation of the blockchain network where each organization who uses your product can set up their physical machines and join your network.

### CERTIFICATE AUTHORITIES
The certificate authority is responsible for creating users certificates. It is used for verifying ownership in the network. Each certificate authority is tied to an organization.

### PEERS
The peers are nodes which are connected to clients and are responsible for committing transactions to the world state. Each peer has its own copy of transactions in a `couchdb` database. An organization can have more than one peer. Though it is advised to have multiple peers in an orderer to avoid data loss, having more than 3 or 4 peers might result in higher latency rates.
Named functions vs Functions as variables in JavaScript
Tags: discuss, javascript
Published: 2018-01-29 04:28:50

---
title: Named functions vs Functions as variables in JavaScript
published: true
tags: discuss,javascript
---

Took a quick 10m google to find a debate on this idea, but wasn't able to find anything. 

So really, which is more readable to you:

This? (named function)
```js
function foo (bar) {
    //some code
}
```

Or this? (function as a variable)
```js
const foo = bar => {
    //some code
}
```

Keep in mind having other variables in the same scope along with these functions and trying to debug it!

Personally, where I currently work, we keep a strict concern about the main script functions (ones not inside of a scope) to be what I called `named functions`. I've been with the team for ~6 months, and we've had people who originally argue for functions as variables change their stance to that named functions are more readable.

What's your stance?
Linuxbrew as a font manager
Tags: linux, desktop, font, linuxbrew
Published: 2018-01-29 04:12:14

---
title: Linuxbrew as a font manager
published: true
description: 
tags: 
- linux
- desktop
- font 
- linuxbrew

---

In macOS we have a useful  font manger homebrew with caskroom/homebrew-fonts, you could install various fonts with a command;

```
$ brew tap caskroom/fonts
$ brew install font-inconsolata
```

While in Linux we have a fork of homebrew named `linuxbrew` and it doesn't supports caskroom. Today I propose you using new solution that is asciian/homebrew-fonts tap.To intall new font, you can just type;

```
$ brew tap linuxbrew/fonts
$ brew install font-inconsoltata --HEAD
```

After the installation, we apply fonts into your system.

```
$ ln -s ~/.lixnubrew/share/fonts ~/.fonts
$ fc-cache -fv # Don't forget this!
```

I wrote a Cask parser with `parslet` in Ruby and it translates Casks to Formulas. I would update this repository by the updates of caskroom/homebrew-fonts. If you want me to add new font, then you could submit the upstream caskroom/homebrew-fonts. I follow you by the updates of the upstream repository. Please check it out! Thank you.

- [linuxbrew/homebrew-fonts](https://github.com/linuxbrew/homebrew-fonts)
- [linuxbrew/brew](https://github.com/linuxbrew/brew)
Quitting a git GUI habit
Tags: longs, original, dev
Published: 2020-07-07 09:34:16

---
title: Quitting a git GUI habit
published: true
date: 2018-01-29 00:00:00 UTC
tags: Longs,Original,dev
canonical_url: 
---

I’ve been a user of source tree but it has let me down many times (crashes, high memory usage).

I’ve recognized that i really don’t know that much about git. I should learn at least the commands I use the most.

![](https://blog.pitermarx.com/wp-content/uploads/2020/04/0aYhAWTgPt1Ama_O2.png)

I’m a windows user so [posh-git](https://github.com/dahlbyk/posh-git) is a must have. There are [great docs](https://git-scm.com/docs) for git but they can be a bit overwhelming and have a lot of detail that is not needed 90% of the time. So, here it is, my 7 item git jump-start list:

1. [git checkout](https://git-scm.com/docs/git-checkout) <branch>

The most basic command for switching branches. You can use -f to throw away any local changes

2. [git fetch](https://git-scm.com/docs/git-fetch)

Used to update the remote status. Useful to know if i need to pull. Use -p to remove any remote-tracking references that no longer exist on the remote

3. [git pull](https://git-scm.com/docs/git-pull)

Pulls latest commits from origin. Use -r to rebase changes that are not yet pushed

4. [git add](https://git-scm.com/docs/git-add)

Adds changes to the staging area. Use -a to add all changes.

5. [git commit](https://git-scm.com/docs/git-commit) -m “<message>”

Commits currently staged changes. Use -a to stage all changes before committing.

6. [git push](https://git-scm.com/docs/git-push)

Push currently committed changed to origin.

7. other stuff

I’m already cheating about the 7 items but now I’m getting into less used commands. [git stash](https://git-scm.com/docs/git-stash), [git merge](https://git-scm.com/docs/git-merge), git commit with amend, git push with force are all great tools to know about.

I cannot get my head around [git diff](https://git-scm.com/docs/git-diff). I still use GUI tools to handle conflicts and to review changes before committing.

That’s it. This list should be enough to keep me from using a GUI to interact with git most of the time.
入門自然言語処理 pp.118-195
Tags: nlp, python, reading
Published: 2018-01-28 23:17:24

---
title: 入門自然言語処理 pp.118-195
published: true
description: 
tags: nlp, python, reading
---

4章はほとんどPythonの基礎なので、読み飛ばし。

5章はタグ付きコーパス。5.1 でタグ付けの方法を紹介。
Links in an inline code don't link
Tags: meta, bug, markdown
Published: 2018-01-28 22:50:37

---
title: Links in an inline code don't link
published: true
description: 
tags: meta, bug, markdown
---

There is a bug in the markdown parser that does not hyperlink links from within an inline code block.

Code:

```
`[DOM Standard](https://dom.spec.whatwg.org/)`
```

Real:

`[DOM Standard](https://dom.spec.whatwg.org/)`