teleren/devto huggingface dataset:
A simple way to detect devtools.
Tags: javascript, webdev, security
Published: 2020-01-06 05:20:37

After I made this implementation, I found related issue on stack overflow.

{% stackoverflow 41629072 %}

but this code is just a showcase. I will show you how to really detecting devtools for all major browsers.

If you know `debugger`, You're all set!
this statement will active when devtools opened, no any other cases.
many people found difficult ways to find to detect devtools, but these have been blocked by latest browsers. so it's only, simple way to detect devtools for protect your webapps, **maybe**.

here's the code. insert this `<script>` to bottom of `<body>` in your webapp, and run it.

```js
!function() {
  function detectDevTool(allow) {
    if(isNaN(+allow)) allow = 100;
    var start = +new Date(); // Validation of built-in Object tamper prevention.
    debugger;
    var end = +new Date(); // Validates too.
    if(isNaN(start) || isNaN(end) || end - start > allow) {
      // input your code here when devtools detected.
    }
  }
  if(window.attachEvent) {
  	if (document.readyState === "complete" || document.readyState === "interactive") {
    	detectDevTool();
      window.attachEvent('onresize', detectDevTool);
      window.attachEvent('onmousemove', detectDevTool);
      window.attachEvent('onfocus', detectDevTool);
      window.attachEvent('onblur', detectDevTool);
    } else {
    	setTimeout(argument.callee, 0);
    }
  } else {
    window.addEventListener('load', detectDevTool);
    window.addEventListener('resize', detectDevTool);
    window.addEventListener('mousemove', detectDevTool);
    window.addEventListener('focus', detectDevTool);
    window.addEventListener('blur', detectDevTool);
  }
}();
```

you can see demo how it works: https://jsfiddle.net/composite/3r6dq51y/

that's all. but remember, you can detect only devtools, not security concerns.

happy coding!
What is your prototyping stack?
Tags: discuss
Published: 2020-01-06 05:15:59

If I ever need to put together a PoC or test out an idea I generally tend toward using React (for anything visual), Go + Gorilla (api/web server stuff) and Heroku for hosting. (Although now I've started leaning toward DigitalOcean even though it takes slightly longer on the config side)

What's your preferred 'playground' tech stack?
The Ultimate Guide to Linux Command Line
Tags: linux, ubuntu, tutorial, beginners
Published: 2020-01-06 04:48:47

## The Ultimate Linux Command Line Walkthrough

### The Ultimate Linux Command Line Walkthrough. Learn how to install Linux on a Virtual Machine. Learn essential Linux terminal commands. Gain a familiarity with the Linux operating system

Linux is the leading Cloud operating system that runs the world of IT.
You can't avoid it, even if you try hard.
Linux is everywhere
This is your opportunity to become a professional in the Linux OS and terminal.
Since studying can be fun and shouldn't be hard, we're offering you an easy route to the Linux terminal and command line.

In this course you learn the following:
* Installing Linux
* Using the Linux terminal
* Commands for manipulating files, directories and a lot of important commands

What you'll learn
* Learn how to install Linux on a Virtual Machine
* Learn essential Linux terminal commands
* Gain a familiarity with the Linux operating system

{% youtube _gklYRQV9ag %}
Docker Redmine
Tags: redmine, docker
Published: 2020-01-06 04:48:39

# Redmine

### require
> - database : mysql , postgres , ...

### Step Docker Run
#### Step 1 Install postgres
```sh
$ docker run -d --name postgres --network some-network -e POSTGRES_PASSWORD=secret -e POSTGRES_USER=redmine postgres
```

#### OR Step 1 Install Mysql
```sh
$ docker run -d --name mysql --network some-network -e MYSQL_USER=redmine -e MYSQL_PASSWORD=secret -e MYSQL_DATABASE=redmine -e MYSQL_RANDOM_ROOT_PASSWORD=1 mysql:5.7
```

#### Step 2 Install Redmine
```sh
docker run -d --name redmine /
--network redmine-network /
-e REDMINE_DB_POSTGRES=postgres /
-e REDMINE_DB_USERNAME=redmine /
-e REDMINE_DB_PASSWORD=secret /
redmine
```

### Step Docker-compose
#### Mysql
```yml
version: '3.1'

services:

  redmine:
    image: redmine
    restart: always
    ports:
      - 8080:3000
    environment:
      REDMINE_DB_MYSQL: db
      REDMINE_DB_PASSWORD: example

  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
      MYSQL_DATABASE: redmine
```

#### Postgres
```yml
version: '3.1'

services:

  redmine:
    image: redmine
    restart: always
    ports:
      - 8080:3000
    environment:
      REDMINE_DB_POSTGRES: postgres
      REDMINE_DB_USERNAME: redmine
      REDMINE_DB_PASSWORD: secret

  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER: example
      POSTGRES_PASSWORD: redmine
```

#### Volume
```sh
$ docker run -d --name redmine /
-v /my/own/datadir:/usr/src/redmine/files /
--link postgres:postgres /
redmine
```
Why did this change fix the issue? 
Tags: git
Published: 2020-01-06 04:14:43

When I posted about rebase I noted that understanding a commit is different from understanding how a commit addressed an issue.

I'm not saying you shouldn't seek to learn such an answer. But usually when you're in this situation you've tried 15 other things some of which may have been committed.

So here is the hard part, you need to identify the minimal modification to address your issue. This is not to say the other changes were not valuable or important, or even unnecessary to make the change which fixed the issue; what it is saying is it is important to talk to what each change did to benefit the product. 

I've done it, made so many changes, including ones I didn't know I was making and it leads me to the wrong conclusion about other changes I've made.
O(log n)? Huh?
Published: 2020-01-06 04:14:03

Log n? What the heck is that? Honestly I hadn't touched logarithms since high school, and it took me quite a while to get my head around this particular time complexity, especially since how we use them to describe time complexity is not 100% the same as how they are discussed in your typical math class. I'm hoping that writing this out will help solidify the concept in my brain.

First, I'll discuss what logarithms are in math. According to the Merriam-Webster dictionary, a logarithm is "the exponent that indicates the power to which a base number is raised to produce a given number." Those words are honestly kind of confusing gibberish, so let's try to break it down.

The way I look at it, a logarithm is the opposite of an exponent. An exponent tells you how many times to multiply a base number to achieve a specific product. For example. In 10<sup>3</sup>, '3' is the exponent, and you solve to get 10<sup>3</sup> = 1000. 

Logarithms go the other direction. You start with a base and a product, and ask what the exponent must be. Using the numbers I just used, 10<sup>x</sup> = 1000. What should 'x' be? You would write the logarithm like so: log<sub>10</sub>(1000)  = 3. Thus 3 is the number that 10 needs to be raised to to get 1000.

Mathematically, logarithms can be applied to any base. In programming, however, the base is typically assumed to be 2. This is in keeping with the binary nature of computers, of course. So when you see O(log n), the logarithm is really log<sub>2</sub>n.

The best example of an algorithm with an O(log n) is a binary search. [This post](https://hackernoon.com/what-does-the-time-complexity-o-log-n-actually-mean-45f94bb5bfbf) breaks down what's going on there pretty clearly, but the basics is that you are cutting the data in half repeatedly to look at smaller and smaller chunks. Therefore in order to calculate the worst case run time, in which the very last element is the one you wanted, you need to know how many times you need to divide the data set in order to get down to one element. 

Thinking of that in reverse, how many times do you need to multiply by 2 in order to get n? That's log<sub>2</sub>n, baby! 

For visual simplicity we write that just as log n, and there we have O(log n).

So there you have it. This is beginning to settle in my brain more - I'm always so satisfied when I know _why_ something is done the way it is. On to the next challenge! 


(Completely unrelated, but as I wrote this and wrote 'algorithm' and 'logarithm' over an dover, I realized they are anagrams for each other? What does it all mean... *Insert Illuminati or X Files or something here.)
IntelliJ IDEA for Beginners - Learn IntelliJ IDEA from Scratch
Tags: java, tutorial, beginners, webdev
Published: 2020-01-06 04:07:46

## Complete IntelliJ IDEA Course for Beginners

### IntelliJ IDEA for Beginners - Learn IntelliJ IDEA from Scratch

#### How to become an expert IntelliJ IDEA Developer

This course takes is specifically designed for developers that either don't have any previous experience using an Integrated Development Environment (IDE) tool or experienced IDE developers new to Intellij IDEA (e.g. experienced Eclipse developers).

With that said, even if you're an experienced Intellij IDEA developer you might still get something out of the course. This is specially true since this course is (almost exclusively) based on version 2019 which introduced features that you may not yet me familiar with. So please still check it out!

Also, no particular programming language knowledge is assumed since Intellij IDEA is pretty much language agnostic and supports many different programming languages.

Sections I, II and III are mandatory and must be taken in order.

Section IV is specifically designed for experienced Eclipse developers interested in a quick migration path to IntelliJ

The rest of the sections (V, VI, VII and VIII) can be taken in any order as they're self contained. I highly recommend that you still taken them all, particularly if you don't have any previous Intellij IDEA experience.

{% youtube _wb8AzWcX8o %}
The Collab Lab Week 3 - Sync
Tags: collablab, pairprogramming
Published: 2020-01-06 04:07:40

We had our weekly sync today. Both of the stories were complete and merged to master this week on time. On odd numbered weeks, after demos we get to learn from a mentor presentation on a topic. It was pair programming this week. 

I'm looking forward to implementing what I just learned about planning the work and switching between driver and navigator in a pairing session. 

{% youtube B86j8CWflHw %}
CSS Tip of the Day
Tags: css
Published: 2020-01-06 03:24:26

---

title: CSS Tip of the Day
published: true
description: Daily CSS Tip for at least the month of January!
tags: CSS
canonical_url:
cover_image: 

---

I'm a self-described CSS evangelist. I know a lot of people don't like it very much for a whole range of reasons, but I really do think it's a wonderful language.

While I realize this won't convert everyone, I thought it'd be fun to highlight some fun things we can do with CSS, as well as show some of the newer things that CSS has on offer that make our lives a lot easier, so I've decided to start the **#CSSTipOfTheDay**.

Originally I wasn't sure if I'd just do this for only January, but we're only 5 days in and the reception has been so good I feel like I need to try and see if I can't pull this off for all of 2020. 

![Tip of the day #5: blending modes](https://thepracticaldev.s3.amazonaws.com/i/dxvemd92p3flhit1whku.jpg)

There are easily enough awesome things we can do with CSS that I should be able to pull it off for the entire year!

I'll occasionally be posting roundup some of the more popular ones here, as well as over on [my website](https://www.kevinpowell.co), and I might do a video roundup of them on [YouTube](https://youtube.com/kevinpowell) from time to time as well.

If you don't want to miss out on any of them though, I'd encourage you to give me a follow over on [Twitter](https://twitter.com/KevinJPowell) or [Instagram](https://instagram.com/kevinpowell.co), where I'm posting the tips daily. 

![Tip of the day #5: scroll-behavior: smooth](https://thepracticaldev.s3.amazonaws.com/i/a1d2hmwgmkk2h5inqm04.jpg)

If you know of any awesome CSS tips that you think I should share, please leave a comment below. I have a file with a tonne of them already planned, but if I'm going to hit 365, I'd be a fool not to accept community suggestions as well 😂

I realize that little tips like this won't really help people grasp CSS if they've been struggling with it, but hopefully, it can help people see what it's capable of and maybe inspire them to dig a little deeper!
I'm a professional React developer, and here's how I deploy React/Node.js Microservices to AWS using Terraform. #1
Tags: react, node, webdev, javascript
Published: 2020-01-06 03:11:04

**About Me:** I've been a professional web developer for just over 10 years now. I'm currently the lead web development instructor at [Better Coding Academy](https://codebetter.com.au), and as part of what I do, I post videos on our YouTube channel at [https://www.youtube.com/c/BetterCodingAcademy](https://www.youtube.com/c/BetterCodingAcademy).

_(Subscribe for awesome web development content!)_

In a previous video series, I built a classifieds app with a microservices architecture using React, Node.js, GraphQL and Docker; you can find the dev.to article on that [here](https://dev.to/bettercodingacademy/i-m-a-professional-react-developer-and-here-s-how-i-set-up-react-node-js-microservices-using-docker-and-graphql-20gk).

Now, I'm deploying that application onto [AWS](https://aws.amazon.com/) using [Terraform](https://www.terraform.io/), and this is part 1 of that tutorial.

I hope you enjoy!

{% youtube TMWOdaO8_Is %}

Happy coding!

Full source code: [https://github.com/parkroolucas/microservices-demo](https://github.com/parkroolucas/microservices-demo)
Node.js for Beginners - Learn Node.js from Scratch (Step by Step)
Tags: node, javascript, webdev, tutorial
Published: 2020-01-06 03:05:48

## Node.js for Beginners
### Learn Node.js from Scratch (Step by Step)
Welcome to my course "Node.js for Beginners - Learn Node.js from Scratch". This course will guide you step by step so that you will learn basics and theory of every part. This course contain hands on example so that you can understand coding in Node.js better. If you have no previous knowledge or experience in Node.js, you will like that the course begins with Node.js basics. otherwise if you have few experience in programming in Node.js, this course can help you learn some new information . This course contain hands on practical examples without neglecting theory and basics. Learn to use Node.js like a professional. This comprehensive course will allow to work on the real world as an expert!
**What you’ll learn:**
* Basic Of Node
* Modules
* NPM In Node
* Event
* Email
* Uploading File
* Advance Of Node

{% youtube tX-Wt6H_QFk %}
How To Make Dev Better In 2020
Tags: python, productivity, watercooler, discuss
Published: 2020-01-06 01:33:33

Today I'd like to discuss the 5 ways we can make dev a better place in 2020, and I already broke number 1. 

## 1. Stop with the "...in 2020" posts (no clickbait titles).

Seriously, they also aren't new to 2020, it seems that going back we've had a ton of posts that have to do with the year that it is. It doesn't matter. And a lot of times it's just pushing your high horse views. Which brings me to my next point

## 2. get the hell of your high horse

Maybe you've been a developer for 40 years. Maybe it's been 5 years. Maybe you're a hobbyist. Dev.to is literred with high horse people. My post is meant to break both of the above points, to give an idea. It's like seeing that kid who took a Java class in HS giving coding tutorials on YouTube because he got an A. I'd rather here is experiences then have him think he can teach (giving experiences is still teaching, just indirectly). But this all gets into my next point. 

## 3. no, we really don't need a 'python for beginners' made by every single person ever.

Stop. It's not just python. But it's always the big languages, and it's never anything new. but it's also always different (and not in a good way). In some ways we have a reverse stack overflow here. No one's asking, everyone's offering.

## 4. let's diversify the front page a bit, huh? 

I'm not a web developer. I think everyone and their mother is on here. My language of choice happens to be python, and IL be damned if there's a decent python post that isn't about Gatsby. 

## 5. stop coming here with "how to self promote your blog" or "how to deal with writer's block" etc. 

This IS a blog (in a sense), but that doesn't mean we need to have 60000 posts about how to be a better writer. And for that matter, I don't need to hear yet again how to be a better coder either. 


I believe there's immense power in this platform. But there's also a severe deficit. I'm tired of seeing the same damn posts. We don't need a 101 on a given language 101 times. Especially if you bring nothing new to the table.


So what do I propose we post more of instead? Experiences. What was YOUR experience in implementing a feature in your application? Even if it's something that's common, maybe it was your first time implementing it. Talk about it. Chances are there ARE people looking for it. 

But chances are that people on dev.to aren't looking for a python tutorial. Or how to get 60000 looking at their blog in 2020. 

We're developers. From all walks of life, all experiences, all ages, all types (hobbyist, careerist, etc). We don't have to stoop to such levels for clicks. Because it's kind of disheartening, and makes it so I hardly check Dev.to these days.

I was going to wait before I made this post but right now the top 3 posts on dev.to are "...in 2020" and they break 1 of the other 5 points as well. 

Take my points or leave them. But please, for the love of all that's good...stop teaching dev.to how to get input from the user.
Add progress bars to any command
Tags: showdev, devops
Published: 2020-01-06 00:29:27

---
title: Add progress bars to any command
published: true
description: Tools like gzip and friends are great, but they don't have a progress bar.
canonical_url: https://github.com/Xowap/dev-blog/blob/master/articles/showdev/spybar.md
cover_image: https://thepracticaldev.s3.amazonaws.com/i/7huj3b9zy7m6dyva8amc.jpg
tags:
    - showdev
    - devops
---
Have you ever tried to compress a huge file, waited a bit in front of your terminal and wondered if you should go get a coffee or if it's just about to finish?

After spending some time dealing with huge files and trying to figure out how much I advanced, I ended up discovering tricks that I decided to industrialize. Enter [Spybar](https://github.com/Xowap/Spybar).

![`spybar gzip -c that_big_file.dat`](https://thepracticaldev.s3.amazonaws.com/i/iz3lys4p1q42xki0el0d.gif)

It's a simple Python script that you can get with a

```
pip install spybar
```

If you prefix a command with it, it will start it and display the progress bar. You can also attach to an existing PID. Everything is explained [in the readme](https://github.com/Xowap/Spybar).

This article is however not about the usage of the tool. It's about how it works.

Let's first state that it's only compatible with Linux. It could be that there is some way to do this in other operating systems but this article is not about that.

In Linux, there is a special directory, `/proc` which contains a directory for each running process.

Suppose that you are working on process `42`, you can list all the files open by a process by doing

```
ls -lsh /proc/42/fd
```

When you open a file, in C, you get an integer which is the file handler. All those integers are listed in the `fd` directory. They all are symbolic links to the actual file that they open. Using `ls`, once you've located the file you want, you can note down its number. Suppose that you're interested in number `3`.

There is a different folder which contains some meta-information about those handlers. Which you can simply access by doing

```
cat /proc/42/fdinfo/3
```

You'll get something alike of this:

```
pos:    569573376
flags:  0104000
mnt_id: 28
```

Including the `pos` line which indicates us where exactly the handler is pointing to.

Then you just need to know the size of the file and there you go, you know both the current position and the file size, that's all you need to generate a progress bar.

After doing this for a while I figured that I'd write that little tool so here we are. Thank you for reading!
Monthly review: December
Tags: rust, sponsorships
Published: 2020-01-06 20:27:40

---
title: Monthly review: December
published: true
date: 2020-01-06 00:00:00 UTC
tags: rust, sponsorships
canonical_url: 
---

## New Sponsors

I’m incredibly thankful to the following people for sponsoring my open source work this past month: [@repi](https://github.com/repi), [@oli-obk](https://github.com/oli-obk) and [@yaahc](https://github.com/yaahc).

If you like what I’m doing and want to support my work, please [consider sponsoring](https://phansch.net/thanks) :heart:

## What I’ve worked on

If you’re familiar with how this website looks, you can probably tell that it has a slightly new look. Also, if you were to look into my personal documents directory, you could most likely tell that it had been recently cleaned and organized …again. Hello procrastination!

Looking at [the November review](https://phansch.net/2019/12/02/monthly-review-november/), I have to admit that I didn’t follow through with all the goals I wrote down:

- I absolutely did not continue with the tiny compiler. I’m currently stuck on implementing the visitor and I’m honestly not sure if it’s worth it to continue
- I reviewed _some_ Clippy PRs, but I’ve felt a lack of motivation in reviewing for some reason. I also didn’t contribute as much as I used to

I did a few other things, though:

I now have a [Patreon page](https://www.patreon.com/philhansch)! Setting up Patreon required a lot more work than setting up GitHub sponsoring and I’m still not 100% happy with it. I would like a nicer header image and improve on the goals a bit as well.

Apart from the Patreon page, I’ve been working through Ralf Jung’s [Rust 101](https://www.ralfj.de/projects/rust-101/main.html) course to check up on my Rust fundamentals. What I like most about this course is the focus on exercises. As a result of the course I created about 25 new flashcards mostly around raw pointers and `std::sync`.

I also [updated the Clippy changelog](https://github.com/rust-lang/rust-clippy/pull/4911) for Rust 1.39 and 1.40.

## Reflections & Goals for January

**This January** I want to try and find my Clippy/Rust motivation again. I think, after we finished completing the [rustfix testing issue](https://github.com/rust-lang/rust-clippy/issues/3630) in September, I was lacking a new clearly defined goal.

To put down some more precise goals:

- I want to try out embedded rust development to see how it feels and possibly contribute back some documentation
- I want to fix [a bug](https://github.com/rust-lang/rust-clippy/issues/4917) where Clippy never stops running.
- I want to continue with [splitting up Clippy’s UI test files](https://github.com/rust-lang/rust-clippy/issues/2038) to make the output more manageable.

That’s all I have for now. See you here for the January review!