teleren/devto huggingface dataset:
This is Me Getting to Know Servers Pt 2
Tags: webdev, learning, tutorial, devops
Published: 2018-01-08 19:40:18

---
title: This is Me Getting to Know Servers Pt 2
published: true
description: Follow along with me as I get more familiar with managing my own servers on DigitalOcean.
tags: webdev, learning, tutorial, devops
---

> Subscribe to my YouTube channel for [more tutorials on working with VueJS and AdonisJS -- an MVC framework for NodeJS](https://www.youtube.com/channel/UCF5w1QdWroWOoxxXMgp88AQ?sub_confirmation=1)!

## About This Series

Follow along as I get more familiar with managing my own servers. In this series I'll be using DigitalOcean as my playground and learning how to setup Nginx, MySQL, NodeJS, firewalls, etc.

## Covered in this post:

* Creating your first DigitalOcean Droplet
* Authenticating with a new SSH key
* SSHing into the server box
* Creating a non-root user and some simple security tweaks.

To follow along you can find my [server setup cheat sheet](https://gist.github.com/patrickodacre/ae40f0dcf794f05baaf7959e872a4fd1) on GitHub.


## Enjoy:

{% youtube F2dJExG9fWQ %}

## BuildtoLearn.io

Growing developers need the opportunity to practice taking a full app from zero to production and entrepreneurs need inexpensive ways to test their app ideas.

At Build to Learn I'm producing tutorials and full courses where you can challenge yourself and gain valuable insight into what it's like to build full applications using Vue.JS and Node.JS.

Visit [Build to Learn](http://buildtolearn.io) and sign up if you want to keep up to date with tutorials and course releases.
I hate front-end build processes
Tags: help, discuss
Published: 2018-01-08 19:16:15

---
title: "I hate front-end build processes"
published: true
description: "Requesting tips to tame front-end builds"
tags: #help #discuss
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xduh9oasttbef6cesof0.gif
---

I've been developing web apps for many years. Back when I started, Javascript was too limited to build a full app. Instead web apps were entirely server rendered, maybe with some JS sprinkles for mouse-overs (before CSS :hover existed) and other minor effects.

As the balance has shifted toward browser-based front-ends, I have transitioned too and been happy for it. However, one thing irritates me about them: the build process. You see, with managed languages on the server (and .NET in particular), __the build process was not a thing__ I had to worry about.

When doing server-side web apps with Visual Studio (WebForms, MVC), I never had to setup any build process. It was setup and maintained mostly automatically for you under the covers through the GUI solution explorer, which doubled as a file manager. This has negatives, but generally works well. When I was a junior dev I was not even aware of the build configuration/processes, because it just worked so I didn't have to know. (CI tools also used the project files to build and run tests.) _Edit: removed extraneous details._

The first "modern" front-end project I did, I setup a build script with gulp to bundle and minify JS/CSS. I went from builds not even being a thought in my head to having to code the entire build process myself. I got it to work, but I was incredulous that it was worth the effort and abandoned it. For a while, I got by on VS plugins which would minify or bundle automatically on save.

Fast forward to today. I have created a bunch of front-end apps using webpack to build. I find a starter project that is close to what I want, then spend some time tweaking it to suit my needs. I've had to do this for most new projects... either because I learn new things or webpack version upgrades or template stops being maintained. It still feels like a waste of time and brain cells to futz with. Especially because my needs are simple: compile to js / css, bundle and minify, link in an index page. Yet I have to deal with the intricacies of webpack and a handful of loaders and plugins to accomplish this. And I still haven't figured out some things related to building multiple (Elm) apps which share common code.

There has got to be a better way. So what am I missing? Is there a tool I can use to make build setups easier? It could be a VS Code extension or different build program (i.e. not webpack) or whatever. Does anyone else have awareness or even care that front-end builds are a pain compared to what else is out there?
The best questions to ask in your job interview
Tags: discuss, career, culture, tips
Published: 2018-01-08 19:13:22

---
title: The best questions to ask in your job interview
published: true
description: A resource for anyone wanting to stand out from other candidates while also getting information about the companies they might join.
tags: discuss, career, culture, tips
---

The one question *every* interviewer asks is, "Do you have any questions for me?"

Most of us forget to prepare questions, so we make up generic ones on the spot, or say, "Mmm... well... no, I think you covered everything!"

It's an incredibly important part of the interview, which I why I went ahead and compiled thoughtful questions for you!
 
**Culture Queries gives you [the best questions to ask your interviewer](https://www.keyvalues.com/culture-queries).**

Here's an example:
👎 **Don't ask**: "Is there work/life balance here?"
👍 **Do ask**: "How responsive are people to emails/Slack over the weekends and after 6pm?"

Why? Because some interviewers will interpret the first question as an unwillingness to work hard. Plus, a yes or no question that is so direct will almost certainly get you a canned response. Instead, ask a more specific question that gives you an idea of what the expected working hours are and how team members communicate with one another *without* sounding like you're already trying to cut corners.

I'm still making improvements and adding content, but I hope it'll be a useful resource for anyone preparing for interviews. [Culture Queries](https://www.keyvalues.com/culture-queries) is made for developers, by a developer (aka me 🙋🏻), so all feedback (good, bad, ugly) is welcome and appreciated.

Good luck on all of your interviews! And remember: you're evaluating the company as much as they're evaluating you. 🙌
Firebase Cloud Messaging with Golang
Tags: go, fcm, notification, google
Published: 2018-01-08 18:49:19

---
title: Firebase Cloud Messaging with Golang
published: true
description: 
tags: golang, go, fcm, notification, google
---
![](https://cdn-images-1.medium.com/max/1600/1*kkxZDEVuorkFfGwpE56LOw.png)

I needed to create a microservice for manage communications in my app, emails, SMS, and notifications with FCM.

So I decided to create a lib in for FCM for use en my app.

Example:

```go
package main
import (
	"log"
	"github.com/douglasmakey/go-fcm"
	)
func main() {
	// init client
	client := fcm.NewClient("ApiKey")
	
	// You can use your HTTPClient 
	//client.SetHTTPClient(client)
	
	data := map[string]interface{}{
		"message": "From Go-FCM",
		"details": map[string]string{
			"name": "Name",
			"user": "Admin",
			"thing": "none",
		},
	}
	
	// You can use PushMultiple or PushSingle
	client.PushMultiple([]string{"token 1", "token 2"}, data)
	//client.PushSingle("token 1", data)
	
	// registrationIds remove and return map of invalid tokens
	badRegistrations := client.CleanRegistrationIds()
	log.Println(badRegistrations) 
	
	status, err := client.Send()
	if err != nil {
		log.Fatalf("error: %v", err)
	}
	
	log.Println(status.Results)
}
```

[the source](https://github.com/douglasmakey/go-fcm)
Useful Linux Security Tricks To Harden Your System
Tags: security, linux
Published: 2018-01-08 17:17:16

---
title: Useful Linux Security Tricks To Harden Your System
published: true
description: 
tags: #security #Linux
---

In a previous post, we talked about Linux network commands and we saw some useful examples used to troubleshoot your network, today we will talk about some Linux security commands that you will need to harden your system.

New vulnerabilities are discovered a lot these days, exploits are immediately built on those vulnerabilities after being discovered.
1 Securing the Terminal
2 Change Your Password Always
3 sudo Notification
4 Securing SSH
5 Securing SSH Using Google Authenticator
6 Intrusion Detection with Tripwire (Monitoring Filesystem)
7 Using Firewalld
8 Returning to Iptables
9 Restricting the Compilers
10 Awesome Immutable Files (Prevent File Modification)
11 Managing SELinux with aureport
12 Using sealert Tool
https://likegeeks.com/linux-security-tricks/
Tahnks in advance.
Python Programming Basics With Examples
Tags: python, coding, tutorial, programming
Published: 2018-01-08 17:14:32

---
title: Python Programming Basics With Examples
published: true
description: 
tags: #python #coding #tutorial #programming
---

Python is a popular and a powerful scripting language that can do everything, you can perform web scraping, networking tools, scientific tools, Raspberry PI programming, Web development, video games, and much more. With Python programming, you can do even system programming regardless the platform you are using.

Machine learning work can be done using some Python libraries like TensorFlow which is used in many artificial intelligence projects.

1 Manipulating Strings
1.1 String Concatenation
1.2 String Multiplication
1.3 Concatenate with Non-string
1.4 Search for a Substring
1.5 Get Substrings
1.6 Replace strings
1.7 Strip Strings
1.8 Change Character Case
1.9 Convert Strings to Numbers
1.10 Count Strings
1.11 Iterate over Strings
1.12 Encode Strings
2 Manipulating numbers
2.1 Round Numbers
2.2 User-defined Precision Numbers
2.3 Generate Random Numbers
3 Manipulating Dates and Times
3.1 Format Date and time
3.2 Create Date from String
4 Dealing with File System
4.1 Copy Files
4.2 Move Files
4.3 Read and Write Text Files
4.4 Creating Directories
4.5 Get Access & Modification & Creation Time
4.6 Iterating Over Files
4.7 Serializing Python Objects
4.8 Compressing Files
4.9 Parse CSV Files
4.10 Parse Excel Files
5 Networking and Connectivity
5.1 Reading an E-Mail from POP mail server
5.2 Reading an E-Mail from IMAP mail server
5.3 Sending an E-Mail
5.4 Web Crawling
5.5 Post to a Web Page
5.6 Create a Mini Server
6 Threading in Python Programming
7 Using Raspberry PI
7.1 Reading from the Raspberry Pi’s GPIO

https://likegeeks.com/python-programming-basics/

Thanks in advance.
Spark UDFs to migrate from other SQL dialects
Tags: spark, scala
Published: 2018-01-08 15:20:24

---
title: Spark UDFs to migrate from other SQL dialects
published: true
description: 
tags: spark, scala
---

*This article originally appeared [on my blog](http://wrschneider.github.io/2017/12/05/spark-udf-for-sql.html)*

I found it helpful to create Spark UDFs to make it easier to migrate logic in SQL from another database like SQL Server.

SQL Server defines several string functions like `LEN`, `REPLACE` and `CHARINDEX`, which are not available in Spark by default.  Fortunately these are easy to implement in Spark with UDFs:  

```
spark.udf.register("len", (s: String) => s.length())
spark.udf.register("replace", (orig: String, toReplace: String, replaceString: String) => orig.replace(toReplace, replaceString))
spark.udf.register("charindex", (substring: String, str: String, startPos: Int) => str.indexOf(substring, startPos - 1) + 1)
```

These are all thin wrappers around native Scala string functions.  These will now be available for use in Spark SQL queries: 

```
select len('foo bar') as len_test,
     replace('foo bar baz', 'bar', 'quux') as replace_test,
     charindex('.', '1.2.3', 3) as idx_should_be_4,
     charindex('.', '1.2.3', 0) as idx_should_be_2,
     charindex('@', '1.2.3', 0) as idx_should_be_0  
```

This makes it a little easier to copy-paste queries from SQL Server to Spark, if the syntax is otherwise standard.

The one downside is that Spark UDFs are functions, not methods, and as such [do not allow for default argument values](https://stackoverflow.com/questions/25234682/in-scala-can-you-make-an-anonymous-function-have-a-default-argument).  So you would have to explicitly add a `0` as the third argument for `CHARINDEX` wherever it's missing.
Install Sublime-Text-3
Tags: install, linux, editor
Published: 2018-01-08 14:15:16

---
title: "Install Sublime-Text-3"
published: true
description: Note - Install Sublime-Text-3 via PPA
tags: Install, Linux, Editor
---

```shell
➜  ~ sudo add-apt-repository ppa:webupd8team/sublime-text-3 
```

```
➜  ~ sudo apt-get update
```


```
➜  ~ sudo apt-get install sublime-text  
```
Protect Forms Using Honeypot Laravel Spam Protection Technique
Tags: laravel, php, coding, tutorial
Published: 2018-01-08 14:07:05

---
title: Protect Forms Using Honeypot Laravel Spam Protection Technique
published: true
description: 
tags: #laravel #php #coding #tutorial
---

Laravel framework has a powerful protection from CSRF, XSS, and SQL injection, but there is no built-in Laravel spam protection.

If you need to protect your form from spam bots, you can use something like Akismet or reCaptcha which provide strong spam protection.

OK, but your users maybe don’t like it because of the nag images that may appear from time to time or solving those puzzles to submit the form.

https://likegeeks.com/laravel-spam-protection/

Thanks in advance.
16 Useful Linux Command Line Tricks
Tags: linux, bash, tutorial
Published: 2018-01-08 13:59:52

---
title: 16 Useful Linux Command Line Tricks
published: true
description: 
tags: #Linux #Bash #tutorial
---

We use the Linux command line every day, and due to the little practicing, we may forget some of the Linux command line tricks. In this post, I’m going to show you some of these Linux command line tricks that you might forget or maybe new to you, so let’s get started.

1  Display Output as a Table
2  Run Until Success
3 Sort Processes by (Memory – CPU) Usage
4 Check Your Architecture
5 Monitor Multiple Log Files Concurrently
6 Return to Your Previous Directory
7 Make Non-Interactive as Interactive Shell Session
8 Watch Command Output
9 Run Your Program After Session Killing
10 Answer bot Using Yes & No Commands
11 Create a File With a Specific Size
12 Run Last Command as Root
13 Record your Command Line Session
14 Replacing Spaces with Tabs
15 Convert Character Case
16 Powerful xargs Command

https://likegeeks.com/linux-command-line-tricks/

Thanks in advance.
SQL Injection Best Solution
Tags: webdev, php, sql
Published: 2018-01-08 13:56:00

---
title: SQL Injection Best Solution
published: true
description: 
tags: #webdev #PHP #SQL
---

Before we talk about how to prevent SQL injection, we have to know the impact of SQL Injection attack which is one of the most dangerous attacks on the web.

The attacker can steal your data or even worse, the whole web server can be stolen from one SQL injection vulnerability.

I wrote this post to show you how to prevent SQL injection.

If you need to know more about SQL injection itself and its types and all other stuff, you can do a simple search on google if you want.

The solution is to clean the request parameters coming from the user.

https://likegeeks.com/prevent-sql-injection/

Thanks in advance.
Explain Calling And Setting Getters And Setters Like I'm Five
Tags: explainlikeimfive
Published: 2018-01-08 13:26:24

---
title: Explain Calling And Setting Getters And Setters Like I'm Five 
published: true
tags: explainlikeimfive
---

Could someone explain to me in detail as to why we can do these two specific things with the get and set methods?

So I understand how to define the get and set methods. What I am confused at is why we don't invoke them like normal methods? For instance, as you see in the examples below given from the mdn docs. They call the set method by defining it as an object property with a value?  ```javascript language.current = 'EN';``` And then when we are calling the get method we end up calling the method again as if it was a property on the object instead of invoking a method on the object?  ```javascript language.log``` Hopefully this makes sense it was just something iam not quite grasping the concept of what is happening.



```javascript
var obj = {
  log: ['a', 'b', 'c'],
  get latest() {
    if (this.log.length == 0) {
      return undefined;
    }
    return this.log[this.log.length - 1];
  }
}

var language = {
  set current(name) {
    this.log.push(name);
  },
  log: []
}

language.current = 'EN';

console.log(language.log);

```
Small company vs large company?
Tags: discuss, career, job
Published: 2018-01-08 12:33:55

---
title: Small company vs large company?
published: true
tags: discuss, career, job
---

Currently I'm working in a small company (3 developers).
I think these are the pros and cons:

pros:
- Freedom (we can choose the stack, the tools, etc.)
- There is no overtime
- I'm familiar with the code base (because I wrote half of them)
- I see and experience every part of software development (design, implementation, testing, deployment)
- There is no useless meetings and other interruptions

cons:
- Worse salary (than in a big company)
- There is not many people to learn from

What do you think about it? What do you prefer?
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2018-01-08 11:51:00

---
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. Don't have a meltdown!

An [#explainlikeimfive](https://dev.to/t/explainlikeimfive) about the meltdown security vulnerability...and a great metaphor for the CPU 🍔

{% link https://dev.to/isaacandsuch/how-meltdown-works-28j2 %}

#2. 𝖋𝖚𝖓 𝖙𝖔𝖔𝖑 𝖆𝖑𝖊𝖗𝖙

Vicky walks us through how she created uni-pretty, a tool that lets you convert characters into unicode characters. You'll learn about the Caeser Cipher and how it came in handy to prevent a bunch of hard-coding.

{% link https://dev.to/hivickylai/a-unicode-substitution-cipher-algorithm-59gm %}

#3. Lead by example 

Douglas shares eleven ReactJS projects of varying degrees of complexity. Each project has a detailed readme and uses typical React structures and configurations to help newbies get settled into the ecosystem.

{% link https://dev.to/drminnaar/11-react-examples-2e6d %}

#4. Make your life easier.

Use git hooks for linting, tests, commit formatting, and more! Federico explains how to set up git hooks and shares three examples he uses on the day-to-day.

{% link https://dev.to/fedekau/using-git-hooks-to-improve-your-day-to-day-workflow-4nl5 %}

#5. New year, new copyright!

In the discussion following this post, we learn that you might not need to have a copyright date on your app _at all_. BUT, if you're someone who needs to update that footer at the start of every new year, this post has a great suggestion for you.

{% link https://dev.to/michael/future-proof-your-footers-copyright-date-with-the-current-year-3a35 %}

#6. TDD _in theory_ vs. TDD _in practice_

Jason shares his five major takeaways from practicing test driven development for 100 days. Hint: you don't need to test _everything_.

{% link https://dev.to/gonedark/100-days-practicing-tdd-4d5m %}

#7. Morning miracles ☀️

Why waking up early improved this developer's life, and their side projects. Like Benjamin Franklin said, “Early to bed and early to rise makes a (wo)man healthy, wealthy, and wise.”

{% link https://dev.to/_patrickgod/the-miracle-of-a-morning-routine-1eho %}


_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!_
Azure Active Directory — Authentication OAuth 2.0 — Type Password
Tags: azure, oauth2, activedirectory, tutorial
Published: 2018-01-08 11:24:21

---
title: Azure Active Directory — Authentication OAuth 2.0 — Type Password
published: true
description: 
tags: Azure, OAuth2, Active Directory, Tutorial
---

https://medium.com/@JoaoMarcal/azure-active-directory-authentication-oauth-2-0-type-password-e119f9a5ad4c
Design Patterns and Practices in .Net: Fluent Builder Test Pattern
Tags: dotnet, designpattern, unittest
Published: 2018-06-07 02:55:36

---
title: "Design Patterns and Practices in .Net: Fluent Builder Test Pattern"
published: true
tags: dotnet,DesignPattern,UnitTest,
canonical_url: https://www.matheus.ro/2018/01/08/design-patterns-practices-net-fluent-builder-test-pattern/
---

The unit test’s arrange phase is where we write more code.&nbsp;Coding data creation can be cumbersome. The worst scenario happen when we have to fill all class’ properties, even though, we’re only using one property in the test. Besides being tedious, the data creation process can have a lot of code, resulting in less readable and maintainable tests.

To address this problem, we can use the Builder Pattern. The pattern is described in the book design patterns, and solve problems like:

- How can a class create different representation of a complex object?
- How to simplify a class which creates a complex object?

The Builder Pattern brings more flexibility in a complex object’s creation, by delegating the construction of the complex object to a builder object. The builder object can create different representations of the same complex object.

In this post I’m focus on the unit test side, and I’m gonna show you a different version of the Builder Pattern, the&nbsp;Fluent Builder Test Pattern.

The main goal of the Fluent Builder Test Pattern is to facilitate the test data creation. Joining the Builder Pattern and the Fluent Interface Pattern makes the complex object’s creation straight forward.

[Continue Reading...](https://www.matheus.ro/2018/01/08/design-patterns-practices-net-fluent-builder-test-pattern/)
There are STILL not enough messaging applications
Tags: messaging
Published: 2018-01-08 09:35:27

---
title: There are STILL not enough messaging applications
published: true
description: A look at how the most popular alternatives fall short
tags: messaging
---

Every single service nowadays has private messaging. Twitter, Facebook, Reddit, Steam, etc. Every single programmer just learning about Tcp wants to make a simple one. Yet there are still not enough.

Alright, since there are so many services I am going to filter them by a simple requirement:
 - One server can have multiple channels.

If you don't get what I mean by that, I mean basically something like IRC.
Who meets the requirement? IRC, Discord, Slack, Mattermost. Those are the only ones I know of. Now let's check how each individual one falls short:

Discord:
 - Electron
 - Client side validation
 - Huge cache files
 - Not following the XDG standard (cache files should be in ~/.cache)
 - Using regex over linkify
 - Closed source
 - Stores currently written message in the JS local storage for every single keypress

*The main reason Discord has so many points here is because it's what I've been using (and suffering from) the most.*

Slack:
 - Electron
 - Closed source
 - Only stores the last 10 000 messages

*I have never tried Slack. This is all I know.*

Mattermost:
 - Electron
 - Channel join/leave system is kind of useless
 - Can only use one server at a time

IRC:
 - Difficult
 - No real message storage
 - No real authentication system apart from unofficial NickServ
 - No real bot API

One thing that hurts me a lot here is how many of these are using Electron. Is programming GTK+ really so difficult that you have to steal all the client's CPU? Discord is using 7% CPU idle for me. Sure, Electron is easy and looks good, but it's also the biggest hack ever made. Launching an independent web browser copy because you want to look professional having an EXE file for your webapps... really?

So what I'm trying to say, is that if any of you feel urged to make a chat application but aren't because of how many there already are... think again. We need more alternatives out there.
Myself, I've been [writing one](https://github.com/synac-chat/) that's currently in beta. Although it's been a useful experience for me, it's not very fun at times.

And of course, if any of you know an alternative (even if you made it yourself) that seems to be what I'm looking for, please do link it in the comments!