teleren/devto huggingface dataset:
Why I wrote Real Tough Software
Tags: webdev, career, codenewbie, writing
Published: 2020-01-26 08:07:18

---
title: Why I wrote Real Tough Software
published: true
description: For some people, software development is simply a career choice. For me, it saved my life. 
tags: webdev, career, code newbie, writing
cover_image: https://thepracticaldev.s3.amazonaws.com/i/oo5tkivmtofgmha4klh1.jpg
canonical_url: https://realtoughcandy.com/real-tough-software/
---

> It’s the data that we’re after. The **data**!” -Tom

##So goes the epigraph of my newest book _Real Tough Software_.

See, Tom was my old boss. He owned a data company and made most of his fortune on proprietary software. Despite not knowing much about the web, he understood that the money had shifted: peoples' entire lives and livelihoods were now online. So although I was a code newbie assuming the role of a senior developer at Tom’s company, he had trusted that I’d be able to mesh his legacy with the wild, the new, and the open-source.

I write a lot about Tom and his company in my book. I write a lot about coding and freelancing. But _Real Tough Software_ isn’t about Tom. It isn’t even about software, really.

**It’s about somebody who refused to take no for answer.**

**It’s about having faith that things will get better.**

**It’s about making a life change and finally seeing a win.** Sometimes all it takes is just that one win to change everything.

###I wrote _Real Tough Software_ as a testimony.

For some people, software development is simply a career choice; it’s a 9-to-5 thing that pays the bills. For me, it sorta saved my life.

This is my 4th book, and it’s my most personal, insightful, and engaging one yet.

Out today (Jan. 26), it was a #1 new release on the Amazon charts before it was even published:

![Real Tough Software in number one slot on Amazon](https://thepracticaldev.s3.amazonaws.com/i/h9gpx1wguai99k6xjtsu.png)

This book is for people who are on the fence about entering software as a career. Whether it’s the web, desktop, IoT, the cloud, even game development – this book is for you. I felt a tug towards programming since I was a teen, but was convinced for years it wasn’t for me. 

_It was boring._ 

_It wasn’t a good culture fit._ 

_It was uncreative._ 

How wrong I was about all of that.

This book is for career changers. It’s for people who’ve had more jobs than birthdays. It’s for people who’ve felt hopeless, helpless, and future-less. It's for people who've been harassed for making a positive change. I’ve been all of those things. But as you’ll read in _Real Tough Software_, nothing has to be permanent.

Check out _Real Tough Software_ by RealToughCandy on Amazon. Available on Kindle (and Kindle Unlimited) and paperback: https://amzn.to/2sFxFHu
What local dev environment do you currently use?
Tags: webdev, discuss
Published: 2020-01-26 06:24:40

---
title: What local dev environment do you currently use?
published: true
description: 
tags: webdev, discuss
---

I first started with XAMPP, then Vagrant and also tried Docker. 

The current solution is based purely on Laragon. It's an awesome environment due to it's speed, portability and simplicity.

What's your setup and reasons behind it?
January 25th: Week in Review 
Tags: weeklyretro, career, watercooler
Published: 2020-01-26 00:19:57

I would have posted a review for last week but I was out camping 🏕️ 🔥, and camping is cool.

It's the last weekend of January 2020, we made it! 


Some things I learned/did this week: 
- [Glide.js](https://glidejs.com/) is a thing (made a note of it for future projects for sure).
- Being totally isolated from my profession and the rest of the world is a great mental reset for the beginning of the year, highly recommend winter camping if you can manage. ☃️
- In Angular, you can't import the same component into two sibling components, move that import into the parent one of course!
- A talk submission of mine got accepted for an internal conference my job is putting on next month. 🎉🎉


Some interesting articles I read: 

- [A Personal Website Journey](https://dev.to/adrianbdesigns/my-personal-website-from-zero-to-hero-in-5-years-12bl) from [Adrian Bece](https://dev.to/adrianbdesigns). It's cool to see someone's style evolution over time, not to mention the neat tech behind each of them.
- [Some good advice on how to NOT read tech books](https://dev.to/mlimonczenko/4-ways-not-to-read-programming-books-2j28) by [Miranda](https://dev.to/mlimonczenko). It was a good reminder to not make reading tech books a slog (I like to finish books I start but tbh most tech ones are really dry). 
- I've seen this one going around the past week but finally got around to reading it. [Goodbye, Clean Code](https://overreacted.io/goodbye-clean-code/), a short anecdote on why clean code isn't always the best code. 


Hope everyone has a great next week 🌵🤠
How interested are you in working remotely?
Tags: saas, api, serverless, opensource
Published: 2020-01-26 04:44:07

Lately, I've been having some fun pushing the limits of Typeform's free tier with the goal of doing some market research for [Saasify](https://github.com/saasify-sh/saasify).

Since we're really all about helping developers launch their own remote passive income streams, I'd love it if some of you fine folks took a few minutes to help me with some [market research](https://travisfischer.typeform.com/to/yOo9Wb). (10 questions, ~2 minutes)

**And because your time is valuable**, if you fill out the survey and respond to this thread pointing me to a project of yours, **I will personally review your project / website / landing page / idea** and give you the best feedback I can offer. Maybe it'll be worthwhile, maybe it won't but I promise that I'll try to help you out with targeted feedback.

Also, if any hackers out there have had success with their own forms of market research, I'd love to hear what's worked for you.

Thanks! ❤

[![Survey preview](https://thepracticaldev.s3.amazonaws.com/i/lsqzn4m36hdqkp0qya44.png)](https://travisfischer.typeform.com/to/yOo9Wb)
What is the ideal length for a technical blog post?
Tags: discuss
Published: 2020-01-26 04:17:59

Today, I drafted a technical blog post on a topic I had been thinking about all week.  

As of now, I am at 1600 words, including code samples which _seems_ long.

This has me thinking about the balance between being concise and detailed enough to be useful. 

What are your thoughts?
Documenting SQL with Markdown and Diagrams
Tags: sql, python, documentation, productivity
Published: 2020-01-26 04:15:34

## Nobody seems to document SQL codes

I find that SQL code is often undocumented. A lot of SQL code don't get the *sweet documentation love* that python and javascript codes so often do.

Some commented out lines of code, which supposedly apply a particular business rule over another, are left hanging without what they were supposed to do. Some comments allude to warnings about the consequences of changing particular join conditions, without an explanation as to why.

Many SQL codes can go over a dozen layers of join paths deep, with multiple subqueries, badly written split-apply-combine methods, and inexplicably named aliases.

## Someday that might bite us on our backsides

Executives of the business may one day get an automatically generated report one day and question "how the figures were generated" (Think "why is this number so low?"). With people moving from one job to another, undocumented SQL code jibberish is all that the analyst has to go by (*if* the analyst is given access to code at least).

A lot of data pipelines rely on SQL, and they really should be documented better - explain to the user the code that they are looking at. Throw in a diagram perhaps.

## Let's use markdown in a comment block

But we shouldn't have to write a separate document that does these things. Separating the documentation from the code increases the chances that the documentation will not be updated. Documentation should really live in the code as comments. I like the simplicity of markdown, and think it would be nice if I could use markdown within the comment block of the sql to document the code.

## There's a tool for that.

A little while ago, I posted about documenting Python code for data science. I had built a package called [mindoc](https://minchulkim87.github.io/mindoc/) that allowed me to document my pipeline code using markdown within my code.
{% link minchulkim87/documenting-python-data-science-code-with-mindoc-25b %}

Now I have expanded the tool to help document SQL code and added support for diagrams (using mermaid js)!

See this github page for how it works: https://minchulkim87.github.io/mindoc/
Mocking Platform.Version with Jest
Tags: reactnative, testing
Published: 2020-01-26 04:08:51

# TL;DR;

If you want to mock Platform.Version in Jest (or any other class where you need to mock the result of getter), you can write the code below to override the getter

```js
  const Platform = jest.requireActual('Platform')
  Object.defineProperty(Platform, 'Version', {
    get: () => 13,
  })
```

# Overview

I wanted to write a unit test written in `jest` for my react-native app that stores `Platform.Version` for analytics purposes.

## Issue

According to `@types/react-native`, Platform.Version returns a `number | string` type. Since I want to store it in `string` format, I've written the code below to always get the string.

```js
  const platformVersion = Platform.Version.toString()
```

The Problem is, in Jest, with `react-native` preset, Platform.Version returns undefined.

That means, when I run the unit test for my method, it fails because I'm trying to call `toString()` of `undefined`.


## First Attempt

I thought to myself, "well, that's easy. I just need to mock the value of Platform.Version"

So I wrote a code like this in my jest code.

```js
beforeEach(() => {
  jest.mock('Platform', () => {
    const Platform = jest.requireActual('Platform')
    Platform.Version = 13
    return Platform
  })
})
```

But when I run the test code, I get the following error.

```
TypeError: Cannot set property Version of #<Object> which has only a getter
```

It seems that I can't just replace a result of getter with a value.


## Second (and Final) Attempt

After hours of googling, I've found that only reliable way of mocking getter is by actually mocking a getter (duh!).

So, I went back to my javascript 101, and overwritten the getter method of the `Platform.Version`

```js
  const Platform = jest.requireActual('Platform')
  Object.defineProperty(Platform, 'Version', {
    get: () => 13,
  })
```

After that, all my tests has passed. I've grabbed my evening tea and went to sleep peacefully.
Securing endpoints in NGINX with Basic Authentication
Tags: basicauthentication, nginx
Published: 2020-01-26 00:00:00

---
title: Securing endpoints in NGINX with Basic Authentication
date: "2020-01-26T00:00:00.000Z"
tags: ["basicauthentication", "nginx"]
---

Let's begin by stating that [Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#Basic_authentication_scheme) is _likely_ not the authentication method you're looking for. It has a number of shortcomings, not least of which is it __transmits the password__.

Granted, it base64 encodes the username and password first but this is _reversible encoding_.

Caveats aside, it does still have its uses - perhaps you want to restrict casual access to files or web applications available on your internal network only without the complexities of OAuth, Active Directory integration, or similar. 

To secure endpoints in NGINX using Basic Authentication, follow these steps:

1. On the NGINX host, type the following in your terminal:

~~~bash
# Substitute {USERNAME} for the one you want to use e.g. 'admin'
printf "{USERNAME}:`openssl passwd -apr1`\n" >> .htpasswd
~~~

Enter an appropriate strength password when prompted. For simplicity, consider creating this file in an appropriate location e.g. `/etc/nginx/sites-available`.

2. Update the NGINX configuration(s) for each endpoint you wish to secure:

~~~nginx
location / {
	# Display a title on the Basic Authentication browser challenge dialog (if supported)
	auth_basic "Administration Area"
	# The absolute path to the .htpasswd file
	auth_basic_user_file /etc/nginx/sites-available/.htpasswd;
}
~~~

3. Ensure the `.htpasswd` file is readable by NGINX workers:

~~~bash
chmod 644 .htpasswd
~~~

4. Verify the NGINX configuration and reload/restart:

~~~bash
sudo nginx -t -c /etc/nginx/nginx.conf
sudo service nginx reload
~~~
Assincronismo, concorrência e paralelismo
Published: 2020-01-26 02:53:34

<img style="width: 100%" src="https://thepracticaldev.s3.amazonaws.com/i/ds6168je46jjo8d8q5ox.png"/>

Antes de prosseguirmos, vamos esclarecer o que é uma __thread__: Segundo o Wikipedia, thread é um "_fio de execução_, também conhecida como _linha ou encadeamento de execução_". É um fluxo de execução independente que roda de forma assíncrona em relação à outras threads, intercalando as execuções entre elas quando houver um único núcleo, ou executando cada uma em um núcleo separado quando houver mais de um (ou uma combinação dos dois - o que é mais frequente, pois o número de threads geralmente excede o número de núcleos). Em resumo, conceitualmente um grupo de threads em execução rodam de forma independente e ao mesmo tempo.

Algo que pode gerar confusão é que assincronismo, concorrência e paralelismo não são necessariamente exclusivos. Uma atividade paralela também é concorrente, o que por sua vez também é assíncrona. Um é subgrupo do outro, conforme mostra a imagem acima. Vamos esclarecer um a um, do mais geral ao mais específico.

__Assincronismo__: É qualquer atividade onde a ordem das operações não pode ser determinada. Pode ser duas threads em execução, mas também pode ser uma única thread consumindo eventos de uma fila como, por exemplo, uma aplicação de interface gráfica. Nesse caso, a ordem dos eventos depende do usuário e o programa age de forma diferente dependendo se o próximo evento é uma tecla digitada, um movimento do mouse ou uma ação de fechar.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/srbq0rqfoj5iqo1fqtph.png)

__Concorrência__: Refere-se à várias threads em execução simultânea, podendo estarem rodando em núcleos distintos ou intercalando as execuções em um único núcleo. Dois processos executando em um sistema operacional são dois _fios de execução_ concorrendo por clocks da CPU.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/6ie0r8os0w3em3x8zoiw.png)

__Paralelismo__: Refere-se à várias threads executando em núcleos distintos. Dois processos executando em uma CPU dual-core, cada uma em um núcleo, são _dois fios de execução_ executando de forma paralela.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/gs6y3jog4ntynsh52k5j.png)
Construct Binary Tree from Inorder and Postorder Traversal
Tags: python, leetcode, beginners, computerscience
Published: 2020-01-26 02:29:05

This is part of my series where I memo learning from Leetcode. If you have better solutions or ideas, please leave a comment!

## Problems

[Construct Binary Tree from Inorder and Postorder Traversal](https://leetcode.com/explore/learn/card/data-structure-tree/133/conclusion/942/)


We want to return the binary tree by given inorder and postorder Traversal.  

## Approach

Postorder is `left->right->root` and inorder is `left->root->right`, so the root of tree is the rightmost of postorder traversal and we can get to know the subtree of it by checking inorder traversal.  

For example:
inorder = 9,3,15,20,7 (left->root->right)
postorder = 9,15,7,20,3 (left->right->root)

The root is `3` because it is the rightmost in postorder traversal and the left subtree is `9` and the right subtree is `15, 20, 7` because in inorder Traversal, `9` is left of `3`(=root) and `15, 20, 7` is right of `3`. The next root is 20, and the right subtree is `15` and the left subtree is `7`.  
So we are able to solve this question by repeating this process.

## Solution
```python
class Solution:
    def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
        def helper(left_end, right_end):
            if left_end > right_end:
                return None
            
            value = postorder.pop()
            root = TreeNode(value)

            index = index_map[value]
 
            root.right = helper(index + 1, right_end)
            root.left = helper(left_end, index - 1)
            return root
        
        index_map = {val:idx for idx, val in enumerate(inorder)} 
        return helper(0, len(inorder) - 1)
```

Thank you for reading this article!
I always welcome your feedback, question, and idea.
How to pretend you are an Awesome UX Designer (funny) Part 2
Tags: uxdesigner, ux, funny, jokes
Published: 2020-01-26 01:59:32

This is supposed to be a funny video, I don't want to offend anyone or anything.

[Part 1](https://dev.to/eleftheriabatsou/how-to-pretend-you-are-an-awesome-ux-designer-funny-part-1-4fbp)

Enjoy :)



--
**Thank you for taking the time to watch my video.**

*Would you like to get me a coffee?!☕️
You can do that here → paypal.me/eleftheriabatsou
But If you can’t, that’s ok too 😍.*

It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.
[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/elef_in_tech/)
My First Month Learning Python
Tags: python, student, udemy
Published: 2020-01-26 01:25:08

Using a Udemy Course, [The Modern Python 3 Bootcamp](https://www.udemy.com/course/the-modern-python3-bootcamp/) by Colt Steele, I started to learn Python in my free time. Python is not my first programming language, I have some previous experience with Java, C, C++, and JavaScript. Through college courses, I learned the previously stated programming languages, while also learning about some foundational topics. 

My first impression of Python was that it was noticeably different from both Java and C. 

The syntax was not something I was used to. While I'm used to coding standards – keeping everything organized and easy to read –  Python requires you to keep track of tabs in place of the usual semi-colons like in other languages. 

With things like for-loops and while-loops, in Java and C, the curly brackets is the one the holds everything in place. Instead, in Python, a colon introduces you to its contents. Here's an example of what I mean.

Java
```Java
int sum = 0;
for(int i = 0; i < 10; i++) {
    sum += i;
}
```

Python
```Python 
for i in range(10):
    sum += i
```

Even with a few lines of code, there are a lot of differences.

 
The way variables are defined are also different. In Java and C, you have to explicitly state what kind of variable it is, unlike Python, where it's more like JavaScript., the type of variable isn't explicitly stated and can change depending on how you set its value. 

There's also list and dictionary comprehensions, something Java doesn't have. It's another way to iterate through lists or dictionaries.

So far, while different from what I am used to, Python is something that I am able to quickly get used to. 

The Udemy course that I follow goes into depth, giving exercises about each new topic it introduces. After following the course through completion, I plan to take another course about AI in Python, to supplement the college course and independent research I have already done.
So I tried Kotlin in Eclipse, and here's what happened
Tags: kotlin
Published: 2020-01-26 01:02:37

For some odd reason, Eclipse kept complaining that the Kotlin section of preferences had invalid values... no idea why. Right-clicking to convert Java code to Kotlin works great though. Off to a good start!

Also been reading the documentation. Kotlin Native looks quite helpful for my use case in particular. Not a fan yet, but... it sure has potential.
Running a successful tech study group (Help) 
Tags: help
Published: 2020-01-26 00:59:19

Hi everyone,

I was wondering if anyone on the platform has any experience cultivating a tech community. I tried to follow a format somewhat similar to [Peer 2 Peer University Learning Group](https://www.p2pu.org/en/). Basically you find a MOOC and invite people to come study with you. 

Over the summer I created a Javascript learning group where we just followed the FreeCodeCamp curriculum. I'm glad the people showed up consistently but no one retained knowledge of anything from the curriculum. People were just going through the material and they did not know how to apply it to their own projects. I want to try doing it again this summer. I was hoping anyone could give me advice on how to become a better facilitator/teacher? I guess that's what I'm trying to say.
Got paid $0 for a 3 months client project
Tags: podcast, beginners, sideprojects
Published: 2020-01-26 00:27:44

I share a story of how I did not get paid for doing a 3 months long project for a client.

Has anyone else here had freelance foes like this? My goal is to prevent others from making the same mistakes that I did because I have heard similar stories from my friends.

This is from [Sunny Commutes podcast episode 75](https://sunnycommutes.fm/episodes/75-got-paid-usd0-for-a-3-months-client-project-Kq5xjK).
Why Choose NgRx?
Tags: discuss, ngrx, angular, javascript
Published: 2020-01-26 00:17:48

---
title: Why Choose NgRx?
published: true
description: A discussion on reasons to use NgRx for your enterprise applications.
tags: discuss, ngrx, angular, javascript
---

I am doing research for an upcoming talk on this idea of NgRx being a reactive platform. If your company is using NgRx in your enterprise Angular applications can you chime in below and list the company name and a quote about why you chose this for your app?

If so, you will be featured in the slide deck in my talk at DevIntersection this April in Orlando, FL! 

Added bonus: Three random commenters will also receive some sweet NgRx swag!

Thanks in advance!
When to use python's enumerate() instead of range() in loops
Tags: python, beginners, learning
Published: 2020-01-26 05:56:33

---
title: When to use python's enumerate() instead of range() in loops
published: true
date: 2020-01-26 00:00:00 UTC
tags: python, beginners, learning
canonical_url: https://wangonya.com/blog/python-enumerate/
---

The `range()` function is often useful when iterating over a set of integers:

```python
for n in range(50):
    ...

#

for n in range(10, 30):
    ...
```

or a list of strings:

```
for fruit in ["apple", "mango", "banana"]:
    ...
```

Now, say you want to iterate over the list of fruits and also show the index of the current item in the list. Using `range()`, this might be done like this:

```python
fruits = ["apple", "mango", "banana"]

for i in range(len(fruits)):
    fruit = fruits[i]
    print(f"{i}: {fruit}")

# Output:
# 0: apple
# 1: mango
# 2: banana
```

It gets the job done, but not very pythonic. You have to get the length of the list to keep track of the index, then index into the array to get the current fruit - which makes the code more verbose and harder to read.

## A better way: `enumerate()`

```python
fruits = ["apple", "mango", "banana"]

for i, fruit in enumerate(fruits):
    print(f"{i}: {fruit}")

# Output:
# 0: apple
# 1: mango
# 2: banana
```

Numbering can also be set to begin at any desired number.

```python
fruits = ["apple", "mango", "banana"]

for i, fruit in enumerate(fruits, 7):
    print(f"{i}: {fruit}")

# Output
# 7: apple
# 8: mango
# 9: banana
```