teleren/devto huggingface dataset:
PostgreSQL 10.3 on OpenBSD 6.3: Install
Tags: postgres, database, openbsd
Published: 2018-10-04 16:36:16

---
title: PostgreSQL 10.3 on OpenBSD 6.3: Install
published: true
description: This post shows how to install PostgreSQL 10.3 on OpenBSD and set it up.
tags: postgresql, database, openbsd
series: Postgres on OpenBSD
canonical_url: https://obsd.solutions/en/blog/2018/10/05/postgresql-10-on-openbsd-63-install/index.html
---

This post shows how to install [PostgreSQL](https://www.postgresql.org/) on [OpenBSD](https://www.openbsd.org/) and set it up.

<center>✿ ✿ ✿</center>

## Environment

- OS: OpenBSD 6.3
- DB: PostgreSQL 10.3

<center>✿ ✿ ✿</center>

## Procedure
\* *note*: In code areas, the leading `#` means execution by superuser; It is equal to using `doas` command (as root), while the leading `$` means by general users.

### Install package

```shell-session
# pkg_add postgresql-server
```

### Init database

```shell-session
# # change user
# su _postgresql

$ # Both `--auth=md5` and `--pwprompt` are for the sake of security. 
$ initdb -D /var/postgresql/data/ -U postgres --auth=md5 --pwprompt --encoding=UTF-8 --locale=ja_JP.UTF-8
$ # or without locale: `initdb -D /var/postgresql/data/ -U postgres --auth=md5 --pwprompt --no-locale`

The files belonging to this database system will be owned by user "_postgresql".
This user must also own the server process.

The database cluster will be initialized with locale "ja_JP.UTF-8".
initdb: could not find suitable text search configuration for locale "ja_JP.UTF-8"
The default text search configuration will be set to "simple".

Data page checksums are disabled.
postgresql
Enter new superuser password: 
Enter it again: 

creating directory /var/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 30
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    pg_ctl -D /var/postgresql/data/ -l logfile start

$ exit
```

### Start PostgreSQL server

```shell-session
# rcctl enable postgresql
# rcctl start postgresql
postgresql(ok)
```

### (Finished!) Now DDL and DML are available

"`psql` is a terminal-based front-end to PostgreSQL" (from [doc](https://www.postgresql.org/docs/10/static/app-psql.html)):

```shell-session
$ psql -U postgres
```

DDL examples:

```sql
CREATE DATABASE {% database-name %};
CREATE USER {% user-name %} WITH PASSWORD '{% user-password %}';
GRANT ALL PRIVILEGES ON DATABASE {% database-name %} TO {% user-name %};

-- exit
\q
```

<center>✿ ✿ ✿</center>

Thank you very much for your reading.
I'm happy if this post helps someone in some way :)
What is a DLL in Web Development?
Tags: webdev, beginners, programming, debugging
Published: 2018-10-04 16:02:50

---
title: What is a DLL in Web Development?
published: true
description: One of the black boxes we (thankfully) don't usually have to touch.
tags: #webdev, #beginners, #programming, #debugging
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sm22ldcvz7lvf7wf78sa.jpg
---

At some point in your journey as a web developer, you'll end up doing something with the DLL files. It's really not as bad as it might sound. You just need a little understanding about how they work and what they are used for.

First off, DLL stands for dynamic link library. These files just hold instructions that other programs can use to do different things. That means multiple programs can use this same code at the same time in different ways. It saves you a lot of time as a developer.

That's how you are able to use different libraries and NuGet packages across all of your projects. Any time you have installed a new library or NuGet package, you've added a new DLL to the project that holds the code or data you need.

These files might seem simple and they can be, however they are more powerful than they seem. You usually won't have access to the code inside of the file unless and you normally don't want to make any changes to it anyways.

DLL files use languages like C or C++, although you'll see C++ more often. You can write your own DLLs to run some code you need if you're willing to learn how to do it. It could be valuable to your project and of course it could make you look good in return.

The good thing is that it is extraordinarily unlikely that you'll ever have to write a DLL file from scratch. What is likely is the chance a DLL file will cause some errors in your code.

Those NuGet packages and libraries that you'll use on your projects have their own DLL files. Problems sometimes pop up when there are version changes and you end up with an old or incompatible copy of the DLL file of that particular library.

What typically happens is one of your DLL files is dependent on another. When the independent file has an outdated version, but the dependent file is up to date, you'll start seeing obscene amounts of red text in your development window. After you've gone through all of your regular debugging steps (debugging guide), it might be time to take a look here.

Make sure all of your package and library versions are up to date and compatible before you try to dig into the DLL files. If all of the updates and installs in the world won't fix it, then it's either something else (most likely) or it's time to roll up your sleeves and work through the DLL code.

I hope that you have a better understanding of how DLL files work, what they are used for, and how you can look out for any errors they might cause. Feel free to leave a comment if you have a question or something.

<hr>

Hey! You should follow me on Twitter because reasons: https://twitter.com/FlippedCoding
The TDD Test
Tags: tdd
Published: 2018-10-04 15:27:23

---
title: The TDD Test
published: true
description: A simple test to ensure you are doing TDD correctly
tags: TDD
---

# The TDD Test

I have had some experience with co-workers who were doing TDD incorrectly.

The benefits of TDD is that it puts pressure on the developer to use employ several of the SOLID principles, to design for testability, high cohesion, low coupling, and the immediate elimination of technical debt by refactoring before checking in.

In order to underscore the TDD value proposition, I have found that adding _one simple little step_ to the TDD process helps educate developers on how to do TDD correctly.

If the developer is doing TDD correctly, then the additional step won't devalue the process.

I call this **The TDD Test**.  It tests the TDD process.

1. add a test
2. run the test - _it should fail_
3. write the code
4. run the test - _it should pass_
5. refactor the code - _eliminate newly incurred technical debt_
6. run the test - _it should pass_
7. check-in
8. **delete the test**
9. check-in

Sure, this loses the residual value of the test.  But keep in mind that 99% of the value proposition of TDD is how it guides design-in-the-small.

(The residual value of the test can be recovered from source control.  Which is why step 7 is before step 8.)

**The TDD Test** does not have to done in perpetuity.  Just until everyone understands how TDD works.

## James Coplien

At the extreme end of the unit testing spectrum is James Coplien.  In his “[Why Most Unit Testing is Waste](https://rbcs-us.com/documents/Why-Most-Unit-Testing-is-Waste.pdf)” essay, he advocates keeping tests for up to a year, and then getting rid of them.

I do not share Coplien’s opinion, however he makes an interesting case.  Depending on your software, what he advocates may be applicable to your situation.  I do not believe his advice is applicable in the kinds of software I create.

Coplien is using _waste_ in the sense of Lean’s [Muda](https://en.wikipedia.org/wiki/Muda_(Japanese_term)).  He is _not_ using it in the sense of “testing is a waste of time”.

I mention Coplien’s article because **The TDD Test** was inspired by his paper.  **The TDD Test** just changes his “...up to a year...” part into “...up to a minute...”.
What would you do?
Tags: discuss
Published: 2018-10-04 15:14:36

---
title: What would you do?
published: true
description: If you have to pick a language and IDE for desktop
tags: discuss
---


Hi everyone,

I open this post to gather some opinions and insights. The question is: ¿wich language, framework and IDE would you choose if you have to start now (October 2018) to develop desktop software running in Windows and connected to SQL Server?

Saludos,
My first post is about lambda resize images
Tags: lambda, aws, node, jest
Published: 2018-10-04 15:09:17

---
title: My first post is about lambda resize images
published: true
description: An AWS Lambda Function to resize images automatically with API Gateway and S3 for imagemagick tasks. When an image is called on AWS Api Gateway, this package will resize it and send it to the S3.
tags: #lambda #aws #nodejs #jest
---

Today I have finished another package repository for resizing images with lambda function. This feature will improve our internal work, I hope will improve yours too. Feel free to ask me something. 

Enjoy, and put a star on git ;)

[lambda-resize-image](https://github.com/apoca/lambda-resize-image)

![All tests done with jest](https://thepracticaldev.s3.amazonaws.com/i/hckk1k5euq887w9yslvc.png)

NOTE: This is my first post here I promise that the next one I´ll improve.
Compose a message through some else’s eyes
Tags: communication, criticalthinking, productivity
Published: 2018-10-07 15:29:55

---
title: Compose a message through some else’s eyes
published: true
tags: Communication,Critical Thinking,Productivity
canonical_url: https://www.briannipper.com/2018/10/compose-message-through-some-elses-eyes.html
---

Twilight Zone: The Eye of the BeholderI've always enjoyed science fiction work that intended to make the onlooker reflect on their world view, you know, really make you think about yourself. A wonderful example of that is the classic Twilight Zone: The Eye of the Beholder.Although I don't think it's needed at this point I will mention there are spoilers about this particular episode... [full article](https://www.briannipper.com/2018/10/compose-message-through-some-elses-eyes.html)
How I tested a new tool for recruiting letters
Tags: discuss, job, career
Published: 2018-10-04 14:11:49

---
title: How I tested a new tool for recruiting letters
published: true
description: Testing a new tool to combat recruitment spam :)
tags: #discuss #job #career
---

![test](https://media.giphy.com/media/gw3IWyGkC0rsazTi/giphy.gif)

A few days ago I wrote an article about the bot I made for sorting job proposals. I received a lot of comments even though it was my first post here. As I got it, the topic is pretty hot. And seems I am becoming like "anti-recruiter blogger". Ha-ha, no! I like them all, just a bit bored...

So I've decided to test the tool I was talking about lately (found it on Product Hunt Upcoming). It's called [Reply.id](https://reply.id). 

**What's that?** 

AI Gmail filter + Bot that talks to recruiters

Now all the tools are AI MACHINE LEARNING BIG DATA (you know). But let's see, what do they mean. 

**Onboarding staff**

You choose your skill set and level. You sign in with Gmail account. 

![skill](https://thepracticaldev.s3.amazonaws.com/i/6y4mn119cqdytuikrfvs.png)

Set up the questions a bot will ask recruiters.

![botquestions](https://thepracticaldev.s3.amazonaws.com/i/s35za4clnohix8ca7dnn.png)

[Here is the bot I've made on Reply.id just in a minute or so](https://reply.id/whokilledkevin). And remember 
[my bot](https://m.me/296432910906505?ref=bot1) on Messenger?

**How it actually works**

I've chosen to allow integration between Reply.id and Gmail account. When I received a letter from the recruiter, some new folder called "Job proposals" appeared.

![jp](https://thepracticaldev.s3.amazonaws.com/i/cig1ktj07soruua9hwj0.png)

So, the algorithm sees recruiters letters (so-called "AI Gmail filter") and sends them to a different folder. Alright. Afterwards, the tool automatically responds to all these letters with the link to bot and explanation (with the template I've chosen already during onboarding, so there are few of them). 

That's how you see in "Sent":

![sent](https://thepracticaldev.s3.amazonaws.com/i/zsweod9sbmuxsgbgb8xb.png)

If recruiter talks to bot, you'd see just the answers in a kind of spreadsheet. You can also open it up and see all the answers to the questions. Questions can also be added manually if needed.

![inside](https://thepracticaldev.s3.amazonaws.com/i/3bg55oi2ix62j45q8bs9.png)

So, it's a good tool for 
- those who really struggle from recruiters;
- those who somehow are ready to talk about new career opportunities (then just put the link to a bot on social media and Github);
- those who want inbox empty and structured. 


Nice.
The Basics of Array.from() 
Tags: javascript, beginners, webdev
Published: 2018-10-04 12:08:51

---
title: The Basics of Array.from() 
published: true
description: 
tags: javascript, beginners, webdev
---

**Array.from()** method allows you to create a shallow copy of:
 - Array-like objects (objects with a length property and indexed elements)
 - iterable objects (such as _Map_ and _Set_)

In order to be iterable, an object must implement the @@iterator method, meaning that the object (or one of the objects up to its prototype chain) must have a property with a @@iterator key which is available via constant Symbol.iterator:

```javascript
a = new Map([[ 1, 5 ]])
isIterable = typeof a[Symbol.iterator] === 'function'; //true


b = { 1: 5 }
isIterable = typeof b[Symbol.iterator] === 'function'; //false
```

#### Shallow Copy

A shallow copy will duplicate the top-level properties. If any of the properties are the objects, their reference addresses are copied.

Making changes to one array doesn't infect another array. Removing the last element from an original array will not change the length of the copied array, as it will remain the same.


```javascript
let arrayOne = [ 1, 2, 3 ]
let arrayTwo = Array.from(arrayOne)

arrayTwo.pop()

console.log(arrayOne) //[ 1, 2, 3]
console.log(arrayTwo) //[ 1, 2 ]
```

The exception is the objects which are shared between the original and the copied array as they're pointing to the same reference stored somewhere in memory.


```javascript
let arrayOne = [ 1, 2, [3] ];
let arrayTwo = Array.from(arrayOne)

arrayOne[2][0] = "abc";

console.log(arrayOne) //[ 1, 2, ["abc"] ];
console.log(arrayTwo) //[ 1, 2, ["abc"] ]
```


#### Map function and Array.from


Array.from() has an optional parameter **mapFn**, which allows you to execute a function on each element of the array.

Use Array.from() to create an array of the desired length, and calling a map function for every element of array to collect their squared values into a new array:

```javascript
Array.from({ length: 5 }, (v, i) =>  i * i); //[0, 1, 4, 9, 16]
```
Step by Step guide to test Rails ActiveText
Tags: rails, actiontext, trix, guide
Published: 2018-10-04 13:34:13

---
title: Step by Step guide to test Rails ActiveText
published: true
description: Step by Step guide to test Rails ActiveText
tags: rails, actiontext, trix, guide
---

## 🚧❌ EDITED ActionText is now fully released in Rails 6 don't follow this guide that was written for the preview version

You might have seen the video of DHH about ActionText upcoming feature in Rails 6. This is a step by step guide for creating the exact same example as in the video.

⚠️ If like me you never ran an edge version of Rails before and wonder how to do it then this is for you

## Create a new app from the Edge version of Rails

### Clone the Rails repo
    
```bash
git clone https://github.com/rails/rails.git
cd rails
bundle install
```

### Create a new app with Rails Edge, YABE (YABE: Yet Another Blog Example)
    
We will want to create a new app within the same directory and using the locally installed Rails generator


```bash
#move out of rails folder first
cd ..
    
#create the app with the local rails generator and the edge flag to use GH master branch
rails/railties/exe/rails new yabe --edge
    
cd yabe
```

### Start the app

⚠️ remember to always use the local rails command: `bin/rails`

```bash
bin/rails s
```
Visit `http://localhost:3000`
    
You should now have the rails startup screen showing 

**Rails version: 6.0.0.alpha** 🎉🎉


## Installing ActionText

### Add the ActionText gem (and image variants for active Storage):

```ruby
# Gemfile
gem "actiontext", github: "rails/actiontext", require: "action_text"
gem "image_processing", "~> 1.2" # for Active Storage variants
```
   
### Install gem, assets, npm dependency, and migrations

```
bundle install
bin/rails action_text:install
bin/rails db:migrate
```

### Scaffold Post
    
```    
bin/rails g scaffold post title:string
bin/rails db:migrate
```

### Add a rich text field to Post

```ruby
# app/models/post.rb
class Post < ApplicationRecord
  has_rich_text :content
end
```

Active Text brings a polymorphic model under the hood for managing `RichText` 


### Add a field to your form
    
**<%= form.rich_text_area :content %>** : rich_text_area is the new content type to display Trix

    
```erb
<%#app/views/posts/_form.html.erb %>
<%= form_with(model: post) do |form| %>
  …
  <div class="field">
    <%= form.label :content %>
    <%= form.rich_text_area :content %>
  </div>
  …
<% end %>
```

### finally, display the rich text on a page:

```erb
<%= @post.content %>
```

### Update the strong params in PostsController

```ruby
def post_params
  params.require(:post).permit(:title, :content)
end
```

### Start blogging

```
http://localhost:3000/posts
```

## My 2 cents

- My first take out was to use an edge version of Rails.
- With regards to ActiveText I am impressed with how simple it is to now add rich text editing in a Rails app. 
- I love Trix don't get me wrong but I would like to have a layer of abstraction to potentially have other front-end solution for the Editor.
A call for volunteers: ClassicPress needs your help
Tags: wordpress, opensource, php
Published: 2018-10-04 13:17:05

---
title: A call for volunteers: ClassicPress needs your help
published: true
description: WordPress (and Gutenberg) is coming in 45 days...
tags: WordPress, Opensource, PHP
---

#[We need your help - join #core &raquo;](https://join.slack.com/t/classicpress/shared_invite/enQtNDIwNjY2OTg1MjAxLWJiM2U2NmY3ZjFlZjQ4Zjk2OGI4ZTg3NzY1ZTU3NzI3OTRjMTU0YzAzOWUyZmZlODgyOWE1YTViYjcwY2Y5YzI)

The [official timeline](https://make.wordpress.org/core/5-0/) for WordPress v5 has been released (and with it, Gutenberg in core). There are only **45 days** until the Gutenberg disaster occurs. Even core WP developers are asking for Matt Mullenweg to push back this timeline, but he is pushing forward regardless.

## Gutenberg is NOT ready!

[ClassicPress](https://www.classicpress.net) is a hard fork of WordPress without Gutenberg. Our vision is to be the business-focused CMS (Powerful. Versatile. Predictable.)

We've made enormous progress, but **we need help to get ClassicPress out before WordPress v5.0**.

If you're a developer who can spare a few hours, please join us in the "core" channel on Slack and make yourself known. THANK YOU!!

#[Join us on Slack &raquo;](https://join.slack.com/t/classicpress/shared_invite/enQtNDIwNjY2OTg1MjAxLWJiM2U2NmY3ZjFlZjQ4Zjk2OGI4ZTg3NzY1ZTU3NzI3OTRjMTU0YzAzOWUyZmZlODgyOWE1YTViYjcwY2Y5YzI)
How you turn a string into a number (or vice versa) with Dart
Tags: dart, learning, beginners, webdev
Published: 2018-10-04 11:57:07

---
title: How you turn a string into a number (or vice versa) with Dart
published: true
description: How you turn a string into a number with Dart
tags: dart, learning, beginners, webdev
cover_image: https://thepracticaldev.s3.amazonaws.com/i/q1dbr8bdaqoxg6gz04i8.png
---

When you're so used to one language and you're trying to learn a new one, its likely that you'll find yourself always looking back to what you already know to find out if the new language matches up. I know I do. If I find similarities, I'm happy 🙂. If I find more features, I'm excited 😄. If the new language is lacking, I'm like, how come something so important (however trivial the thing may be) is missing 🤨 I can't work with this.

Say I needed to turn a string into a number with Javascript, there's a number of ways I could do it:
* using [`parseInt()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt)
* using [`parseFloat()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat)
* using [`Number()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)

Dart has almost similar functions to achieve the same results.

### Turning a string into a number (or vice versa) with Dart

You can try out the code snippets on [dartpad](https://dartpad.dartlang.org/)

#### String to int
```dart
// String -> int
main () {
    var one = int.parse('1');
    print(one == 1); // prints true
}
```

#### String to double
```dart
// String -> double
main () {
    var onePointOne = double.parse('1.1');
    print(onePointOne == 1.1); // prints true
}
```

#### int to String
```dart
// int -> String
main () {
    String oneAsString = 1.toString();
    print(oneAsString == '1'); // prints true
}
```

#### double to String
```dart
// double -> String
main () {
    String piAsString = 3.14159.toStringAsFixed(2);
    print(piAsString == '3.14'); // prints true
}
```

I've been wanting to take up mobile app development with flutter so I thought I'd get comfortable with dart first before diving into flutter. So far, I'm happy. Coming from Javascript, Dart is easy to pick up, and fun to learn.
Photo Editing Follows Latest Furors; Create Dead Ringer Apps (FaceApp Clone) Putting Social Media On Fire!
Published: 2018-10-04 11:53:25

---
title: Photo Editing Follows Latest Furors; Create Dead Ringer Apps (FaceApp Clone) Putting Social Media On Fire!
published: true
description: 
tags: 
---
![](https://www.itfirms.co/wp-content/uploads/2018/09/Comp-1.gif)
Impersonate pictures to resemble Robot fetishism, apps like FaceApp creates Cyborgs (cybernetic organism) likable, redefining your selfies, taking them to next level. See more [https://www.itfirms.co/photo-editing-follows-latest-furors-create-dead-ringer-apps-faceapp-clone-putting-social-media-on-fire/](https://www.itfirms.co/photo-editing-follows-latest-furors-create-dead-ringer-apps-faceapp-clone-putting-social-media-on-fire/)
Javascript framework experience required for getting a job.
Tags: javascript
Published: 2018-10-04 10:04:36

---
title: Javascript framework experience required for getting a job.
published: true
description: Help needed identifying where to incorporate one in my existing site.
tags: javascript
---

I’m broke, and need a job. To get a job, I need demonstrable JavaScript framework experience.

I have most of the technologies I can use demonstrated on my data-driven portfolio site https://money.style, however I don’t use a JavaScript framework.

I’m hoping that the good members of this community would point me in the right direction as to:

Which framework (Angular / Vue / React / Node) is appropriate given the example site?
What stands out as the most obvious place to incorporate a framework?
Would someone be willing to get me started with a code snippet?
I believe once I get started, a framework will make things easier long term. I just need a starting point.

Thanks for your attention, and any replies.

Matt
Mock an External Server with Localroast
Tags: mock, http, api, rest
Published: 2018-10-04 09:59:36

---
title: Mock an External Server with Localroast
published: true
description: tool to mock an external server
tags: mock, http, api, rest
---

[Localroast](https://github.com/caalberts/localroast) is a tool to mock an external server for development and testing.