teleren/devto huggingface dataset:
Docker from development to deployment
Tags: help, docker, deployment
Published: 2019-01-03 06:59:34

Hi!

I've been trying to solve this for days now so I might finally just ask for help:

In my development docker-compose configuration, I have 4 containers:
  - **front**: Vue app started using `npm run serve` on port 80
  - **back**: Koa2 server for my API (Postgraphile for GraphQL)
  - **database**: Postgres container
  - **front-balancer**: Nginx server, sends `/` to **front**, `/graphql` to **back**

It works fine locally (although I probably should skip Nginx for development...)

Now I want to deploy it, and that's where my headaches began. My initial understanding is that I should not use `npm run serve` for **front** on production, but instead build my Vue app and serve the static files with Nginx. 
But does that mean I do not need my **front** container in production and can just mount the built files to my Nginx container?

Or how would you approach this?

Then comes the actual deployment. I am still at a loss as to where (DO, Heroku, AWS??) and how to deploy it (CD workflow). But that might come as a later question once I figure out the step above!

Thanks in advance!
How to be a better developer (both in the terminal and out)!
Tags: productivity, better, development, code
Published: 2019-01-03 06:47:27

---
title: How to be a better developer (both in the terminal and out)!
published: true
description: A step by step guide to become a better developer
tags: productivity, better, development, code
---

I'd like to start this off by putting a prefix on everything. This is all subjective and my own opinion. No matter where you look, there will be some shared tips and new ones so take each one with a grain of salt. 

## Think before you code

A simple but useful tip. This tip gets overlooked quite a lot because of time constraints(trust me, i've been there too)  and lack of forward thinking but the ugly truth is. Without planning, those deadlines will creep up on you alot faster so think ahead and plan a-little and what you need to make and how that thing will work with everything else.

## Look at all sides

While you look at a button that toggles something and think simple. The user on the other hand thinks the exact opposite. This is because you got to have that consideration for how the product is made and how the product will be used. If the interaction is clunky and unusable then you haven't done your job right.

## Write code that solves a problem, not creates one

This is a fairly simple concept yet alot of us are guilty at making this mistake. We write code that solves one problem, yet creates 3 issues at the same time. With every line of code, think about how this solves the problems without repercussions, if you come out of this exercise without creating headaches for someone else or yourself for that matter. Then you've done your job right.

## Document it and people will follow suite
A huge hate for alot of us is writing documentation. I know what you're thinking. Boring, useless, waste of time. I get that but at the same time, you know what makes a good product? Good documentation! If your product can explain itself easily in your documentation then more devs will adopt it and use it. It can be a few comments or a whole sentence explaining a function. No matter what it is, you're helping your fellow dev understand your code which makes their life easier and you can take ease knowing you've written quality code and documentation.

So that's it for now but let me know in the comments which one you have to adopt this year. Good luck 😃
Laravel .env Files Exposed In Browsers
Tags: discuss, laravel, webdev
Published: 2019-01-03 06:22:02

---
title: Laravel .env Files Exposed In Browsers
published: true
description: 
tags: discuss,laravel,webdev
---

What would be your secure directory structure when working with Laravel framework. The sensitive files like .env should not be exposed in the browsers. It contains sensitive information like database, mail, payment API credentials.

I just google `DB_USERNAME filetype:env` and dang hundreds of .env files are exposed in the browser. How would you save that?

I did the tweet also: https://twitter.com/_shahroznawaz/status/1080393723412967424
PHPStorm picking up wrong index.php
Tags: xdebug, php, phpstorm
Published: 2019-01-03 03:44:07

---
title: PHPStorm picking up wrong index.php
published: true
description: If you use remote environment for PHP development and using XDebug sometimes PHPStorm can pick the wrong file. Here is how to avoid such thing.
tags: xdebug, php, phpstorm, docker
---

Recently I was setting up Drupal development environment with docksal. I used traditional drupal composer setup (https://github.com/drupal-composer/drupal-project) so drupal is in the /web folder on the server.

I have mapped main root folder in PHP Storm

![default mapping](https://thepracticaldev.s3.amazonaws.com/i/q0wpkxd1vmcquzvtxta1.png)

So I was really surprised when I started my debugging session and discovered some weird file being started.

![surprise](https://thepracticaldev.s3.amazonaws.com/i/ut2pafm07oyw4e10jecf.png)

Looks like PHP Storm tries to find first index.php it can find and then starts session like it is being debugged.

Solution for this is to map folder "web" and actual index.php so PHP Storm can find proper file easier.

![proper mapping](https://thepracticaldev.s3.amazonaws.com/i/lug8293x9lrv6km7yjpd.png)

![explicit index.php](https://thepracticaldev.s3.amazonaws.com/i/d5jpd5uesjslt6vqrxw9.png)

As result proper index.php is displayed as being debugged.

![and now nice debugging](https://thepracticaldev.s3.amazonaws.com/i/huwhmn34zp3sz19s57jy.png)

Happy debugging!
baby steps...
Tags: beginners, python, raspberrypi
Published: 2019-01-03 01:27:05

---
title: baby steps...
published: true
description: My raspberry pi has gathered dust for long enough... time to learn to code in Python!
cover_image: https://cl.ly/1a7facdcd8c0/Image%202019-01-02%20at%208.22.24%20PM.png
tags: #beginner, #python, #raspberrypi
series: a beginner's journey into python
---
I got a Raspberry Pi 2 for Christmas... 2 years ago. And, I've not touched it since. 🙈

![](https://cl.ly/2d0c86670d88/Image%202019-01-02%20at%206.46.48%20PM.png)
<figcaption>collecting dust.</figcaption>

I had aspirations to code then, but lost interest and willpower. Just kept saying, _I'll get to that eventually_.

Well, guess what? It's 2019 🥳, eventually is here, and I'm going to get somewhat serious! I'm going to learn to code something for my pi in Python. 🐍 

But... I could probably use a hand here. I'm new to programming and don't exactly know where to start, just know that I _need_ to start. I chose Python because I have a friend that lives nearby who codes regularly and suggested it. I figured we could do a bit of paired work and perhaps that'd help with learning.

I also stumbled upon this recent helpful discussion here:

{% link https://dev.to/juliatorrejon/what-are-the-best-python-projects-for-beginners-1h57 %}
... which points to some great resources for beginner-level Python projects.

🐍  🐍  🐍 

As well as this post here:

{% link https://dev.to/jessicagarson/resources-for-learning-python-hd6 %}
... that seems to scratch my itch for some basic "just getting started" with coding in Python information.

I'm wondering is this the right way to go about it? If I plan on learning to code, do I just pick a lang and go for it? Should I backstep a bit and look at the fundamentals more? I guess I can just start flipping through these resources and Googling things when I get confused, right? Is there any one perfect place to begin? 

My ultimate goal is to code a white noise machine for my pi. I've been using [this really awesome site](https://mynoise.net/NoiseMachines/rainNoiseGenerator.php) for years and would love to recreate something like this.

I also stumbled upon this repo:

{% github https://github.com/scivision/soothing-sounds %} 
... that looked quite promising.

But for now, baby steps. Or slithers. 🐍

One of the reasons I'm writing this post is so that I actually commit to creating something. If I can code my pi into a rain-making noise machine, I'll be pretty dang happy and will definitely take you all along for the ride.

Any words of wisdom, advice, or recommendations—feel free to leave them in the comments.

Now, please don't let me drop the ball on this resolution again! 🤞
Programmer Salaries
Tags: discuss, salary
Published: 2019-01-03 00:55:31

---
title: Programmer Salaries
published: true
description: A voice from the past.
tags: #discuss #salary
---

Today, I ran across this quote, which I will surgically alter at first.

> Nowadays one often encounters the opinion that __ ___ _______ programming has been an overpaid profession, and that in the coming years programmer salaries may be expected to go down.

You might think this quote can be found in a discussion written today. But no. The words missing from the quote are "in the sixties". This quote is from a 1972 lecture entitled [The Humble Programmer](https://www.cs.utexas.edu/~EWD/transcriptions/EWD03xx/EWD340.html) given by Edsger W. Dijkstra when he accepted the ACM Turing Award.

It is interesting to note that the lecture's speculation of hardware costs going down has come to pass, and almost unimaginably so when you consider cost relative to computing power. But the cost of software development has not seemed to decrease. It seems the opposite in fact, that devs are compensated better today than back then, and even more of us are needed. And that the tech industry has mostly accepted the cost paradigm flip -- that (custom) software now costs significantly more than hardware.

Thoughts?
Changing Git Submodule Repository to other URL/Branch
Tags: git, vsc
Published: 2019-09-19 15:05:16

---
title: Changing Git Submodule Repository to other URL/Branch
published: true
tags: git, vsc
canonical_url: https://tech.serhatteker.com/post/2019-01/changing-git-submodules-urlbranch-to/
---

### List the details in .gitmodules file

```sh
$  git config --file=.gitmodules -l
```

This command  lists all the submodules present in the current repository with their paths, URL location and the branch which it is mapped in the repository.

Output will be like:

```
submodule.themes/hugo-coder.path=themes/docker
submodule.themes/hugo-coder.url=https://github.com/user/coder.git
submodule.themes/hugo-coder.branch=docker
```

### Edit the Submodule URL

This command will edit the URL of the submodule and will place it with the specified new URL repository. 

```sh
$  git config --file=.gitmodules submodule.Submod.url https://github.com/username/ABC.git
```

### Edit the Submodule Branch


```sh
$  git config --file=.gitmodules submodule.Submod.branch development
```

This command will edit the Branch `docker` of the submodule and will place it in the specifified Branch `development`.  


### Sync and update the Submodule

```sh
$  git submodule sync
$  git submodule update --init --recursive --remote
```

These commands will sync and update the submodule to the newly specified branch or URL successfully.
Privately scoped variable in `when` block
Tags: kotlin
Published: 2019-06-28 16:15:10

---
title: Privately scoped variable in `when` block
published: true
tags: kotlin
canonical_url: https://lankydan.dev/2019/01/03/storing-when-block-subject-in-a-variable
---

Super short post, on a change introduced in Kotlin 1.3 (yes I know it has been out for a while now). We will take a quick look at capturing the subject of a `when` block into a scoped variable. This is a quality of life improvement that saves a line or so of code while making the role of the variable clearer.

Below is what you would write before the change:

```kotlin
val enum = myClass.enum
when (enum) {
  MyEnum.ONE -> println(enum.propertyOne)
  MyEnum.TWO -> println(enum.propertyTwo)
  else -> println(enum)
}
```

You can now write this instead:

```kotlin
when (val enum: MyEnum = myClass.enum) {
  MyEnum.ONE -> println(enum.propertyOne)
  MyEnum.TWO -> println(enum.propertyTwo)
  else -> println(enum)
}
```

The instantiation of the `enum` variable is merged with the declaration of the `when` block. `enum` is now scoped to the `when` block and cannot be accessed outside of it. Not a massive change, but it does makes the code look a little tidier.

Let’s look at one more example:

```kotlin
val obj = someObject()
when(obj) {
  is String -> println("This is a string and it says $obj")
  is Number -> println("This is a number and its value is $obj")
  else -> println("I don't know what $obj is")
}
```

Becomes:

```kotlin
when(val obj = someObject()) {
  is String -> println("This is a string and it says $obj")
  is Number -> println("This is a number and its value is $obj")
  else -> println("I don't know what $obj is")
}
```

Not really anything else to say on this subject as there isn’t much to talk about in the first place. You probably get the picture, the example from the [Kotlin 1.3 Release Notes](https://kotlinlang.org/docs/reference/whatsnew13.html#capturing-when-subject-in-a-variable%22) might make sense to you if I have failed to explain it myself.

If you found this post helpful, you can follow me on Twitter at [@LankyDanDev](https://twitter.com/LankyDanDev) to keep up with my new posts.
[Video] The state of accessibility
Tags: webdev, a11y, chrome
Published: 2019-01-02 23:40:55

---
title: [Video] The state of accessibility
published: true
description: Nektarios Paisios is a software engineer on the Chrome Accessibility team. In this video, hear his thoughts on the state of accessibility and what resources are available for web developers.
tags: webdev, a11y, chrome
---

Nektarios Paisios is a software engineer on the Chrome Accessibility team. In this video we chat about the state of accessibility. Topics include: why a11y matters, what Chrome is doing, standardization efforts, tools/resources for web developers, and more.

{% youtube TomOQYxFnrU %}
Wellness Wednesday - New Year, Dancing, and Self Care
Tags: wellnesswednesday, selfcare, career
Published: 2019-01-02 22:59:51

---
title: Wellness Wednesday - New Year, Dancing, and Self Care
published: true
description: New year, new dev.to goals! Dance to be healthy! Take care of yourself!
cover_image: https://thepracticaldev.s3.amazonaws.com/i/rca8n0k54gmbemeupnxd.jpg
tags: wellnesswednesday, self-care, career
---

# Wellness Wednesday
Hello again! Happy New Year! Time for another #wellnesswednesday!

## S.M.A. goals
Since it is the new year, I'm sure we all have resolutions and goals all over the place. I'm also sure that everyone has heard of "Smart" goals. Every year I struggle to set goals using the framework - some times my goals are too lofty and other times they are so small they don't seem worth it on a time-scale. This year, I am focusing on just the S.M.A. part of smart goals. I want to make them specific, measureable and attainable, but since they are personal goals the relevancy doesn't really make sense to me and the time-bound is a difficult thing to come up with. What do you think about this? How do you set goals?

## Dance sometimes!
Did you know that dancing lowers the risk of dementia? Plus it can be fun, give you a nice boost of energy, and lighten your mood! Put on some good music and groove out to your favorite song. I personally like to put on some good showtunes and do some chores around the house.

## Aloe Bud
[Aloe is a self-care app](https://itunes.apple.com/us/app/aloe-bud/id1318382054?mt=8) (currently on iOS with android on the way) that uses encouragement to bring awareness to self care activities. I haven't personally used it, but I will as soon as it is on Android!

Have a good one!
Imposter Syndrome and Hero Worship: Why I Started a Podcast
Tags: career, motivation, showdev, beginners
Published: 2019-01-02 22:55:50

---
title: Imposter Syndrome and Hero Worship: Why I Started a Podcast
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/zszpc4va0ivbdhuq8fqh.jpg
tags: career, motivation, showdev, beginners
---

**tl; dr** Imposter syndrome stinks, and everyone deals with it. You can [hear some incredible engineers talk about it](https://www.devpath.fm).

There is perhaps no industry that talks about imposter syndrome quite so much as the software development industry.

We bring up imposter syndrome in blog posts and conference talks; we even build communities to help each other deal with the effects. Imposter syndrome seems to afflict every developer on this planet, at some point or another.

I think, to a degree, imposter syndrome will always be prevalent in software development (mostly because writing software is hard). However, I believe a lot of imposter syndrome is ultimately the result of misinformation.

![An imposter](https://cdn.pixabay.com/photo/2014/07/10/11/17/grimace-388987_1280.jpg)

The first year of my career as a developer was one of the most challenging years of my life. I struggled endlessly. I felt imposter syndrome daily for twelve months, and I didn't know how to get help. 

There is another epidemic the software industry deals with, that we don't talk about very much: Hero Worship.

Think about it. There are probably a handful of engineers that you hold in high esteem, above the rest.

![A real image of Kent C. Dodds](https://media3.giphy.com/media/qWoubkSvQxN1C/giphy.gif?cid=3640f6095c2d40d438774a4e5579edbe)
For me, Hero Worship made the struggle even worse.

One of the things that made my imposter syndrome almost unbearable was the feeling that everyone around me seemed to know what they were doing. Everyone else seemed to have it together.

After surviving my first year in software development, and moving to a much healthier environment, I realized just how ubiquitous imposter syndrome has become (or maybe always was).

To help combat the disconnect between our communal imposter syndrome and hero worship, I started recording conversations with experienced and well-known engineers (heroes). I've made an effort to document both their methodologies for success and their failures. 

I'm now going to start sharing the conversations I've been recording at https://www.devpath.fm. These recordings are also available on [Spotify](https://open.spotify.com/show/3pu3ehs13VeqHY1OEipkIh) and a handful of [podcast providers](https://www.devpath.fm/subscribe). 

Going into 2019, I plan to release a new interview each week. The purpose of these interviews is not only to reveal the best methods for finding success in software development but also to shine a light on the struggles and failures that plague even the most heroic of engineers.

If you're dealing with imposter syndrome or just looking for advice on leveling up your career in this industry, [feel free follow along](https://twitter.com/devpathfm). :)
A blog post About Three Reasons That Prevented Me From Shipping Product
Tags: shipping, entrepreneurship, bootstrapping, learning
Published: 2019-01-02 22:54:48

---
title: A blog post About Three Reasons That Prevented Me From Shipping Product
published: true
description: I wanted to share one of my posts on www.shipharder.com. Any feedback is welcome and much appreciated 🙌🏻.
tags: shipping,entrepreneurship,bootstrapping,learning
cover_image: https://thepracticaldev.s3.amazonaws.com/i/a9t02rgv088wqowevq1n.jpg
---

![Three Reasons That Prevented Me From Shipping Product](https://thepracticaldev.s3.amazonaws.com/i/a9t02rgv088wqowevq1n.jpg)

A lot of developers struggle with the same shit. It’s 2019 now, and it’s time to break those patterns.

If you want to create a life that's enabling you to spend your time how you want it, you need to start living up to your goals.

In my latest post I share three reasons that prevented me to ship or make a success out of my side projects:

https://www.shipharder.com/three-reasons-that-prevented-shipping-product/

Don't make the same mistakes, learn from mine.
What resources would you recommend to learn Rust?
Tags: rust, discuss
Published: 2019-01-02 22:44:14

---
title: What resources would you recommend to learn Rust?
published: true
description: 
tags: Rust, discuss
---

My primary language is Python, but I also have some experience in JS, Java and C++. I have read Rust docs a few months ago, but since then I haven't written any code so I hardly remember anything. 

I'm looking for a site/book/course with a practical approach (exercises, challenges etc.) to jumpstart my learning process this time. What would you recommend? 

Looking forward to reading your suggestions :)
Kotlin classes implementing Functions
Tags: kotlin
Published: 2019-01-02 21:54:14

---
title: Kotlin classes implementing Functions
published: true
description: 
tags: kotlin
---
Little trick that I discovered today. 

As you probably know, in Kotlin - as in Java 8 - a Function is able to implement a Single Method Interface, as follows:

```
        Assertions.assertAll(
                Executable { Assertions.assertEquals(clientId, token.client) },
                Executable { Assertions.assertEquals(userId, token.user) },
                Executable { Assertions.assertEquals(NOW, token.issued) },
                Executable { Assertions.assertEquals(NOW.plus(duration), token.expires) },
                Executable { Assertions.assertEquals(setOf(GlobalScopes.ALL), token.scopes) }
        )
```

Each of those `Executable` entries is defining a function that matches the `Executable` interface.

However, the opposite is also true. You can write a class that can be used anywhere a particular function type is expected. For example:

```
class UUIDNonceGenerator : () -> String {
    /**
     * Generate the Nonce
     * @return the nonce
     */
    override operator fun invoke() = UUID.randomUUID().toString()
}
```

An instance of this class is usable anywhere that a function that takes 0 parameters and returns a string - a `() -> String` - is accepted.

The reasoning for this is actually quite sound. The class actually implements `kotlin.jvm.functions.Function0<java.lang.String>`, which is exactly what `() -> String` means. So it's actually just a class implementing an interface. It just so happens that this works both ways, so anything that also accepts a `() -> String` actually accepts a `kotlin.jvm.functions.Function0<java.lang.String>`, and thus the types match. Voila.

Not sure how useful this is, but it's there if you need it.
What do you think about "Black Mirror: Bandersnatch"?
Tags: discuss
Published: 2019-01-02 21:36:24

---
title: What do you think about "Black Mirror: Bandersnatch"?
published: true
description: Let's discuss about this interactive movie
tags: discuss
cover_image: https://thepracticaldev.s3.amazonaws.com/i/1t59o9qbxe0t3w97asxs.jpg
---

**Spoiler Alert**
If you haven't seen Black Mirror: Bandersnatch try not to read this post, but is your decision... or not...

***

Well, I just saw this new "interactive movie" and I have to say is very unfair to show developers as people who can go crazy by the fact of using tons of `if` and `else`. And also, what about the fork** as demonic simbol?






**I'm not sure if this is the right word for the sign https://thepracticaldev.s3.amazonaws.com/i/470tecr2iggygx7ceutw.jpg
DC++ Clients (Java, Kotlin)
Tags: help, dc, java, kotlin
Published: 2019-01-02 21:23:27

---
title: DC++ Clients (Java, Kotlin)
published: true
tags: help, dc++, java, kotlin
---

Hello everybody!

I've decided to train my skills in Java/Kotlin; the topic for this purpose is DC++ client, so for now I'm wondering does anybody know whether it's possible to find any information about it?

I was trying to google, but I didn't succeed, so I'd be glad if there are examples, articles, specifications!

Thanks in advance