teleren/devto huggingface dataset:
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2018-03-12 16:52:57

---
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. Let's see that screen grab!

Last week, [we saw everyone's terminals](https://dev.to/itsjzt/can-i-see-your-terminal--62e). This week, we want to see your desktops. 

{% link https://dev.to/itsjzt/can-i-see-your-desktop-home-screen--4ffb %}

#2. Smoosh-gate

The TC39 folks have a proposal out to rename `flatten` to `smoosh` and `flatMap` to `smooshMap`. Not sure if these methods proposed will be made the standard, but K explains what these functions actually do in this post. 

{% link https://dev.to/kayis/smooshing-javascript--5dpc %}

#3. International Women's Day

We had our annual International Women's Day celebration on dev.to where we collected stories and advice from hundreds of people from the community. Read their stories [here](https://dev.to/t/shecoded). 

Xiaowei kicked off the celebration with a reflection piece from the past year. 

{% link https://dev.to/xrwang/what-does-it-mean-to-be-a-feminist-coder-in-2018--25i3 %}

#4. Are you starting to see a pattern?

All brains are wired differently. In this post, Christian shares how the idea of `class` finally clicked for him, both conceptually and in code.  

{% link https://dev.to/chrisvasqm/how-i-finally-understood-what-a-class-is--24pl %}

#5. Level Up

Alfonso shares ten pieces of advice for young engineers to follow if they want a path towards seniority. 

{% link https://dev.to/veloceronte/the-road-to-senior-dev--b6k %}

#6. Hello, I'm John Doe!

A minimal and to-the-point landing page for developers.

{% link https://dev.to/flexdinesh/create-your-developer-landing-page-with-github-pages---42jk %}

#7. Beauty Contest Fails

Regardless of usefulness, which language fails the beauty contest the worst?

{% link https://dev.to/ben/which-mainstream-programming-language-has-the-ugliest-syntax--31l %}

_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!_
How do you handle days where you just aren't motivated?
Tags: discuss
Published: 2018-03-12 15:42:11

---
title: How do you handle days where you just aren't motivated?
published: true
description: Some days just aren't your day
tags: discuss
---

![](https://d1ejxu6vysztl5.cloudfront.net/comics/garfield/1984/1984-02-20.gif)
What do you think about the Froala Editor?
Tags: wysiwyg, richtexteditor, discuss
Published: 2018-03-12 13:14:08

---
title: What do you think about the Froala Editor?
published: true
description: A WYSIWYG HTML editor created by developers, for developers.
tags: wysiwyg, rich text editor, discuss
---

I'm one of the main developers of the [Froala Editor](https://www.froala.com/wysiwyg-editor) and I would love to hear any feedback you might have about it. Are you using it or another editor? What would you like to see implemented in Froala?
Unit Testing. Logic in Domain vs Logic in SQL
Tags: discuss, testing, sql
Published: 2018-03-12 11:04:27

---
title: Unit Testing. Logic in Domain vs Logic in SQL
published: true
description: 
tags: Discuss, Testing, Sql
---

# Unit Testing. Logic in Domain vs Logic in SQL

We have a table of 10 million records that include details of a location, a product, order date and units ordered.

We need to query this data to find the sum of units ordered by product, for a given set of locations.
We have to apply a business rule that says that if the order date is N days in the past then the ordered units are classifed as `late units` else they are classified as `pending units`.

This information will be displayed in a read on table (i.e. an onscreen report)
| Product | Late Units | Pending Units |

Our current design is to have a SQL Query that is passed the date on which ordered units should be classified as `late units`.  The logic that then aggregates the data and places the units either in "late" or "Pending" is then applied in the SQL Stored Procedure.
The query results are then placed into a Data Transfer Object (e.g. `{"product": "a", "lateUnits": 0, "pendingUnits": 100}` ) and supplied to the client application via a Web Api.

The challenge with this design is it becomes much harder to write a suite of unit tests to demonstrate the business rules are correctly applied.  At present we have created canned integration test data, then we spin up an a special integration test instance of the database and run tests against the sample data.

This allows us to take advantage of the SQL query engine for performance, whilst having a reasonable degree of testing coverage.

I'm still not 100% convinced of the approach we're taking and wonder what approach other developer's might take to solve this problem, e.g. would you load all the data into the domain and apply the logic there, apply the logic in SQL, or another approach?
How create small 'algorithm similar items'
Tags: node, showdev, postgres, javascript
Published: 2018-03-12 09:02:54

---
title: How create small 'algorithm similar items'
published: true
description: this post about a create small engine for similar items in your project
tags: nodejs, showdev, postgres, javascript
---

Hi, very long time ago i made post [small search engine](https://dev.to/gaserd/how-to-create-small-search-engine-for-your-awesome-project-40m).

And that post i use fts vector for search in your postgress database.


But in time my project needed similar items and i thought it is necessary to take some complex algorithm and implement it, but i can make small and easy for use algorithm search a similar items from my database.

I start search Google and ... oh my god, very much interest algorithms, but i dont see for NodeJS. Sorry, may be i not good use Google.

Hmmm Stop! I have fts vector and we have fast algorithm Levenstein. Yeah.

FTS vector - this is small matrix with very important word/words in your text. I have this structure in my database:

item
id | title | price | description | fts

fts vector generic sum of title and description.

We can compared this vectors in algorithm Levenstein or another. That is easy.

Okay, how start this ? 

First i writed himself algorithm Levenstein, but he is sooo slooooowwwwllllyyyyy... and i found npm-package -> [fast-levenstein](https://github.com/hiddentao/fast-levenshtein)

Okay, go write code.

```
    npm install fast-levenstein
```

Next, i created this file.

```
    var levenshtein = require('fast-levenshtein');

    var getSimilarItems = function(id,func) {
        //....
        //code of get items, sort this items
        //....

        let levenshtein_number = levenshtein.get(data[0].fts, category_items[i].fts)
        
        //compare numbers and return necessary       

    }

    module.exports.getSimilarItems = getSimilarItems
```

![JUST DO IT](https://media.giphy.com/media/14pBFSq5dRDkFa/giphy.gif)

And, thats all. What do you think about this and what i do better ?
Learning Frameworks and APIs vs Software design principles
Tags: discuss, designprinciples
Published: 2018-03-12 07:02:26

---
title: Learning Frameworks and APIs vs Software design principles
published: true
description: 
tags: discuss, design principles
---
Found it very interesting and informative to be discussed. 
Frameworks and APIs change fast. Software design principles are evergreen. Learn principles that translate across language barriers

{% tweet 972850936195543040 %}
Push, rinse, repeat, …
Tags: markentier, tech, blog, bootstrap
Published: 2018-03-11 17:15:19

---
title: Push, rinse, repeat, …
published: true
tags: markentier, tech, blog, bootstrap
canonical_url: https://markentier.tech//posts/2018/03/push-rinse-repeat/
---
_Originally posted at [markentier.tech](https://markentier.tech) as [Push, rinse, repeat, …](https://markentier.tech/posts/2018/03/push-rinse-repeat/)_

![](https://markentier.tech/posts/2018/03/push-rinse-repeat.png)

I haven't bootstrapped a blog or static site for quite some time.

With a service like netlify this becomes kind of a bearable task.

And since this site hasn't seen much popularity yet—it just exists for less than 24 hours—I can even play this game live and in production. Like the good old PHP-FTP times.

For fun I added already some meta tags for social media consumption like Twitter.

It should look like the article image.

This is just the second pretty useless post, but I think this is not so unusal for new blogs. Bear with me, actual content will follow. Hence this new site. ;-)

_Crossposted to [Medium](https://medium.com/markentier-tech/push-rinse-repeat-1e277fa35942)._
Summary of How to Idiot
Tags: developer, howtoidiot, lifelessons, rwdevcon
Published: 2018-11-11 16:24:11

---
title: Summary of How to Idiot
published: true
tags: developer,how-to-idiot,life-lessons,rwdevcon
canonical_url: 
---

I will be attending #RWDevCon this year and I was reminded of an inspirational talk from last year, “I’m an Idiot” by Rich Turton. If you missed his talk, you can [check it out here](https://youtu.be/GYgcxlZjpa8). Idiots like him are folks that I enjoy working with. Below are my takeaways from his talk. My notes serve as a good reminder that a great goal in the Tech field is the pursuit of being an idiot and being OK with it. Like Rich Turton said, it is a great feeling to leave this world a better place for future idiots who will come across your code (including your future self).

![](https://cdn-images-1.medium.com/max/1024/1*HYXtvh9zu2d7LQMmkPBsZw.png)<figcaption>Jenny Chang Ho’s Summary of <strong>How to Idiot</strong> by Rich Turton</figcaption>

In summary and in my own words, never ever leave a piece of code without fully understanding it. Take the time to rewrite it so that not only you but also the next idiot can understand it. The preference is clarity over brevity. And why do we do this? We do this to offer kindness to other idiots and most importantly to our idiot self.
Developer job application assessments are a two way thing
Tags: recruitment, discuss, career
Published: 2018-03-11 21:05:04

---
title: Developer job application assessments are a two way thing
published: true
description: When looking for a job, developers are often asked to complete an assessment to prove their competency. These tests also reflect on the company
tags: recruitment, discuss, career
---
When looking for a new developer job, a fair amount of positions require some kind of assessment by the company in order that developers can justify their claimed skills.

In my opinion, these assessments reflect on the company too. As a developer, this is an early chance to see what a company values in their developers. Having been invited to complete a number of these tests, I've seen both ends of the spectrum which adjusted my views on the company I was applying to.

These assessments can be time consuming and both sides (applicant and company) should value the time put in. The applicant should be able to get a feel for the company in what they're being asked to do. It should also be challenging so that the applicant can feel some reward in completing the assessment.

Very recently, I was asked to complete a 50 minute multiple choice test. Questions were generally around syntax of code printed in a non-monospaced font without syntax highlighting. I lasted about five minutes and even less questions before I sent an email back to the company explaining that their job spec highlighted the need for imaginative and versatile developers but their test promoted some kind of robot-like code monkey and that I wanted to withdraw my application. This response may have appeared arrogant to the company in question however if taken in the spirit it was intended, may highlight the need for a review in their hiring process.

I believe that in attempting to assess the ability of an applicant, a company can and should also impress the "spirit" of the job in that process.

My preferred method is for a project kind of problem which allows the applicant to be imaginative and to show why they should be top candidate for a role. It also allows for discussion in any further interviews around thought processes and techniques. These can often be lengthy (3 or 4 hours) but a quality application can almost secure a the role even before further interviewing.

What do you think is the ideal way for a company to assess the standard of an applicant while promoting the position and the company?
Tips For Learning Linux Servers
Tags: linux, webdev
Published: 2018-03-11 20:03:14

---
title: Tips For Learning Linux Servers
published: true
description: Four tips that will help you learn Linux more quickly
tags: linux, webdev
cover_image: https://thepracticaldev.s3.amazonaws.com/i/29etifm9b1bv20bzy4qz.jpg
---
As a web developer, I do backend programming as part of my daily work. Even though I do all of my development on a Mac, my code runs in production in a Linux environment. Even though I don’t plan to be a systems/devops engineer, I’ve always wanted to know more about Linux and how to manage it. I think it is good for any backend developer to gain some Linux knowledge, just to have more background on how code runs on a Linux server. I have focused on learning the Linux command line since most servers run without a GUI. Even though I’m no expert, here are some tips that have helped me along the way.

### Read *The Linux Command Line*
I got [The Linux Command Line by William E. Shotts, Jr.](http://linuxcommand.org/tlcl.php) on a Humble Bundle book sale and it has been my favorite book for learning Linux. The author gives away the PDF of the book for free on his website, but I recommend buying a hard copy if you have the money because it will become a handy reference. The book is very good at introducing you to the Linux philosophy as well as easing you into terminal commands and utilities used on Linux systems.

### Learning Vim
Having a good terminal text editor when learning Linux is essential. My favorite is Vim. Vim has a high learning curve, but its effective keyboard shortcuts are very performant. When working with Linux servers, you will do a lot of text editing so it helps to be comfortable with a command line editor. Other popular editors include Emacs and Nano.

### Writing Shell Scripts
Writing a handy shell script is one great way to learn more about Linux. A shell script is a code file that can be run directly by your shell (usually bash). The script is a list of commands you might type in a shell, but written down to be reused. For example, I wrote a shell script that connects to MySQL in my development environment and refreshes the database for my local setup. There are many uses for shell scripts and they are great for experimenting with Linux utilities.

### Raspberry Pi
Having a server to use can heavily reinforce your learning. The cheapest Linux server you can buy is a [Raspberry Pi](https://www.raspberrypi.org/). I bought a Pi 3 and loaded Raspbian Lite on it to use as a server on my home network. I had to plug it up to a monitor at first to set up the WiFi, but now I run it headless and SSH to it to make changes. I’m still exploring different uses for the Pi, but already I’ve set up a Python server and MySQL on it for development.

I hope these tips will encourage you to learn more about Linux. It is a really great OS and is the backbone of the internet. Getting to know it better has been really fun and increased my productivity and ability to debug website issues. Plus, the uses for Linux are endless so there is always more to learn.
Linux Expect Command
Tags: linux, bash, beginners
Published: 2018-03-11 19:37:30

---
title: Linux Expect Command
published: true
description: Automate shell scripts like magic
tags: #linux #bash #beginners
---

Expect command or expect scripting language is a language that talks with your interactive programs or scripts that require user interaction.

1 Expect Command
2 Using autoexpect
3 Working with Variables
4 Conditional Tests
5 If else Conditions
6 While Loops
7 For Loops
8 User-defined Functions
9 Interact Command

https://likegeeks.com/expect-command/

Hope you like it.

Regards,
If I know vanilla Javascript do I need a js framework?
Tags: javascript, react, angular, vue
Published: 2018-03-11 19:14:31

---
title: If I know vanilla Javascript do I need a js framework?
published: true
description: Do I really need a js framework?
tags: javascript, React, AngularJs, Vue.js
---

There are a lot of new trends and frameworks out there at the moment, but if I'm an expert with vanilla javascript do I need any of those out there?
Like Vue.js or AngularJs or React.
Is Python’s asyncio Worth It?
Tags: python, multithreading, concurrency, discuss
Published: 2018-03-11 18:54:56

---
title: Is Python’s asyncio Worth It?
published: true
description: Compared to other languages’ solutions to the same problems, it seems like a hassle
tags: Python, multithreading, concurrency, discuss
---

I’ve been a Python (2) dev for around 5 years now; I’m not here to bash Python. That being said, one of the language’s few failings is its poor concurrency/parallelism story. There have been attempts to fight the GIL before, like [Twisted](http://twistedmatrix.com/trac/), [eventlet](http://eventlet.net/), and the standard library’s [threading](https://docs.python.org/2/library/threading.html) module, but the results have been (IMO) overengineered, overcomplicated, and just not...nice.

Now there’s [`asyncio`](https://docs.python.org/3/library/asyncio.html), which seems better, but still inferior to goroutines or Clojure’s core.async (which is basically goroutines), or the plethora of options presented by e.g. Rust or Haskell.


My question to the audience is: is `asyncio` worth it? That is:

1) if you had to start a project from scratch that you knew would involve concurrency and/or parallelism and had sufficient freedom of choice, would you choose Python 3.6 and `asyncio`?
2) if you had a preexisting Python project that you had to add concurrency/parallelism to, would you choose `asyncio` (over Twisted, eventlet, gevent, etc.)? Would it be worth porting a Python 2.x project to 3.6 for?
Tutorial on using headless Chrome in a container for End-To-End user acceptance testing
Tags: docker, chrome, user, testing
Published: 2018-03-11 17:28:12

---
title: Tutorial on using headless Chrome in a container for End-To-End user acceptance testing
published: true
description: Herein I will show you in less than 6 steps how to use Chrome to emulate a user visiting a number of social media services and provide visual feedback as to what was rendered in the browser.
tags: docker, chrome, user, testing
canonical_url: https://davidjeddy.com/?p=565
---

![Docker_Puppeteer_Jest](https://davidjeddy.com/wp-content/uploads/2018/03/docker-container-fun-thingy-david.png)

Put together a tutorial on using my recently release Docker Image containing Chrome, Puppeteer, and Jest. For over a year I have wanted a way to run acceptance tests in a container w/o a UI. Finally it comes to fruition. Check it out and I hope it saves you some frustration.

https://davidjeddy.com/?p=565
High memory usage in Influxdb
Tags: influxdb, grafana, docker
Published: 2019-01-04 11:40:04

---
title: High memory usage in Influxdb
published: true
tags: influxdb,grafana,docker
canonical_url: https://jonnev.se/high-memory-usage-in-influxdb/
---

 ![High memory usage in Influxdb](https://jonnev.se/content/images/2018/03/influxdb_memory-1.png)

I recently moved my various services from a bare metal server at Hetzner to their new [cloud](https://www.hetzner.com/cloud) and a couple of different VPSes, which saves me quite a few dollars (kronor actually but...) a month. Most of my services run in Docker and I've got [telegraf](https://www.influxdata.com/time-series-platform/telegraf/) running on all servers to monitor my stuff. Mostly because I enjoy looking at all them dashboards in [grafana](https://grafana.com) :)

After my migration one of the servers started reporting very high memory usage and it turned out to be the InfluxDB container growing more or less indefinitely. I didn't have that problem before, not that I was aware of atleast, but then again I had 32GB of memory on the old server and wasn't really paying as much attention to the resource consumption of each service.

Anywho, after some research I found [this article](http://puyuan.github.io/influxdb-tag-cardinality-memory-performance) explaining the problem. The takeaway is that **Influx creates an in-memory index with all tags** and that quickly grows with a lot of data.

So how to fix? In my case I only have two services I've written myself sending data to Influx and neither were using tags excessively so I started examining the telegraf plugins I had enabled. I'm not 100% certain but I'm pretty sure the culprit was the [docker plugin](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/docker). That plugin paired with my `dokku` host which creates new containers in abundance with each deploy of a service made up for quite a lot of data. Fortunally the plugin has a setting `container_name_include = []` that accepts globs, so limiting the amount of containers reported made a big difference. Especially since the docker telegraf data has a lot of `tags` in it.

I also set a new [retention policy](https://docs.influxdata.com/influxdb/v0.9/query_language/database_management/#create-retention-policies-with-create-retention-policy) on my database like so:

```
CREATE RETENTION POLICY one_month ON telegraf DURATION 4w REPLICATION 1 DEFAULT;
```

and deleted a lot of old data, for example from the docker plugin with a simple `DROP SERIES docker` (etc, there are about 4 series).

The result? Pretty good.

![High memory usage in Influxdb](https://jonnev.se/content/images/2018/03/influxdb_memory.png)