teleren/devto huggingface dataset:
Fixing Azure Functions and Azure Storage Emulator 5.8 issue
Tags: azure, serverless, storage
Published: 2019-03-19 14:38:21

---
title: Fixing Azure Functions and Azure Storage Emulator 5.8 issue
published: true
tags: azure,serverless,storage
canonical_url: https://blog.maximerouiller.com/post/fixing-azure-functions-and-azure-storage-emulator-58-issue/
---

So you've updated Azure Functions to the latest version (2.X at the time of writing this), and nothing starts anymore.

Now, when you boot the Functions host, you get this weird error.

```none
[TIMESTAMP] A host error has occurred
[TIMESTAMP] Microsoft.WindowsAzure.Storage: Server encountered an internal error. Please try again after some time.
```

There happen to be [an issue opened on GitHub](https://github.com/Azure/azure-functions-host/issues/3795) that relates to Durable Functions and Azure Storage Emulator.

The thing is, it's not directly related to Azure Durable Functions. It's related, in my opinion, in a breaking change that happened in Azure Storage Emulator 5.8 ways of responding from its API.

If you want to fix that issue, merge the following setting in your `local.settings.json` file.

```json
{
  "Values": {
    "AzureWebJobsSecretStorageType": "files"
  }
}
```

This only applies when `"AzureWebJobsStorage": "UseDevelopmentStorage=true"`.

So why should we set that? There was a change that was introduced back in September 2018 when Azure Functions V2 was released. Azure Functions store your secret on disk before 2.0. Azure Functions, when [slot swapping environments](https://docs.microsoft.com/azure/app-service/deploy-staging-slots?WT.mc_id=devto-blog-marouill#swap-two-slots), swap the content of the disk including the secrets.

What this setting does is ensure that Functions stores secrets on your file system by default. It's expected behavior when using a local development environment.

If you want to read more, there is [an entire article on that behavior](https://github.com/Azure/azure-functions-host/wiki/Changes-to-Key-Management-in-Functions-V2).

## Conclusion

To fix the issue, you can either use the workaround or [update the Azure Storage Emulator to 5.9](https://docs.microsoft.com/azure/storage/common/storage-use-emulator?WT.mc_id=devto-blog-marouill).
What's the last piece of software that you paid money for?
Tags: discuss
Published: 2019-03-19 12:50:13

---
title: What's the last piece of software that you paid money for?
published: true
description: 
tags: discuss
---

We all love free software.

Today, I got my company to spring for a license for [TablePlus](https://tableplus.io/) for me. It got me thinking about how infrequently I use anything that you have to buy. I'd have preferred to use something that was free (as in speech) but don't resent paying for something I'm going to use.

How do you choose which products to shell out for?
SOLVED X UA Compatible HTTP header via htaccess
Tags: xuacompatible, httpheader, htaccess
Published: 2019-03-19 12:19:04

---
title: SOLVED X UA Compatible HTTP header via htaccess
published: true
description: how to set up the "X-UA-Compatible HTTP header" must have the value via htaccess file, Open or create a new haccess file and add this snippet Header set.
tags: X-UA-Compatible, HTTP header, htaccess
---
Edit tmux output with Vim (or any text editor)
Tags: tmux, terminal, productivity, vim
Published: 2019-03-19 12:17:46

---
title: Edit tmux output with Vim (or any text editor)
published: true
description: 
tags: tmux, terminal, productivity, vim
---

![image](https://thepracticaldev.s3.amazonaws.com/i/q7bros6kcqvxog7r4vc8.gif)

We can scroll tmux output with `C-b [` by default, and it provides vim like key binding.

However, some bindings are different from my customized vim.

So I add some scripts and settings to open tmux output with Vim (or any other text editor).

Fortunately, tmux has a nice command `capture-pane`!

```bash
#!/bin/bash

# $HOME/bin/vim-edit-tmux-output

file=`mktemp`.sh
tmux capture-pane -pS -32768 > $file
tmux new-window -n:mywindow "vim '+ normal G $' $file"
```

`chmod +x $HOME/bin/vim-edit-tmux-output`


```bash
# $HOME/.tmux.conf

setenv -g PATH "$HOME/bin:$PATH"
set-option -g history-limit 20000

bind-key C-e run-shell "vim-edit-tmux-output"
```

Then press `C-b C-e` and you can open your tmux output!

Another nice feature is that tmux automatically closes the new pane for Vim after quiting vim.
5 courses in 1 week, a retrospective
Tags: mooc, coursera, deeplearning
Published: 2019-03-19 12:12:31

---
title: 5 courses in 1 week, a retrospective
published: true
description: 
tags: #mooc #coursera #deeplearning
---

This was a bad idea.

While I have an MSc in Artificial Intelligence, the coverage of machine learning techniques was, in my opinion, rather lackluster. There were some topics that got decent coverage, such as Monte Carlo simulation and evolutionary algorithms, but most were grouped together in an introductory course that didn't require too much understanding of the subject matter for a passing grade. Yes I am very salty about this.

So I decided to fill one big gap in my knowledge with a [5 course deep-learning specialization on coursera](https://www.coursera.org/specializations/deep-learning).

The first week was free!

I had a basic idea of what a neural network works so how hard could it be? 
I took a week off. A client I'm working for was also interested in using deep neural networks in a project, as it didn't look like it was going anywhere with hand-crafting. They paid me 2 working days to do the course, which was nice.

Armed with overconfidence, I started my binge learning experience. I felt rather drained after the second day already, but with 2.5 courses down, I was on schedule. I eventually managed to finish them all within the planned time, yesterday at 9 pm.

I *hate* neural networks now.

That feeling will probably pass in a few days. Nevertheless, I would discourage anybody from doing this. It may have gone better if the assignments were not in python, a language which I consider to have been a mistake, but realistically any course is going to have some element that just drains you, no matter how much interest you have in the subject.

So were the courses themselves any good? Surprisingly, yes, they were a lot better than I had thought. However, the assignments are very simple with respect to the subject matter. You could solve them without understanding what you are doing as they often came down to "write this formula using numpy/tensorflow/keras". The real challenge was finding the right documentation and, again, fighting against the kind of unhelpful error messages that result from python's lack of a type system and useful composition rules. E.g. `raise_exception_on_not_ok`, some failed assertion 4 layers deeper in the call stack.

Because of aforementioned ease of passing, I would not personally hire anybody based on their ability to get these certificates, even dismissing the possibility of cheating. The courses really are what you make of them, but they do contain a lot of information, so I would recommend them if you're interested in the subject. Just don't rush it.
video game ep4 levels and menus
Tags: thetealpickle, beginners, gamedev, unreal
Published: 2019-03-19 12:05:09

---
title: video game ep4 levels and menus
published: true
description: creating our level and menu
tags: #thetealpickle #beginners #gamedev #unreal
---

ep4 Levels and Menus

Creating a level !! YAS, are we game developers yet? I think so :3
Also, setting our custom level as our starting point and setting a custom menu level.


video game progress:
No progress since the last video 🙃😅
Why should we sleep? :)
Tags: dev
Published: 2019-03-19 12:00:50

---
title: Why should we sleep? :)
published: true
description: briefly about the sleep
tags: #dev
---


These days I am working on full time for the great game company from Canada but in the same time, I would love to do more in my free time as developer ånd still spend the same amount of time with family. I believe the last 10 years I became really addictive on this life style. Everything it's so progressive in web/game/machine learning, it's becoming so easy to learn how to build AI, draw in Adobe Illustrator, build robots. coursera, udemy, udacity is making our lifes easy but in the same time harder to choose the right time and course to learn because of limitation of time.

Why should we sleep while it's so much opportunity around us? :)

It's time to invent something for our brains and health to have more time for the side projects :).

Feel good anyway.
How do you incentivize developers to review Pull Requests?
Tags: discuss, practices, codereview, productivity
Published: 2019-03-19 11:35:29

---
title: How do you incentivize developers to review Pull Requests?
published: true
description: A healthy debate opportunity around pull request review practices
tags: discuss,practices,codereview,productivity
---

How does your team handle pull requests? Do you have any kind of practices around them? Do your peers usually stop whatever they are doing and prioritize reviewing open pull request or rather prefer avoiding the context-switching until they're done too?

I have some thoughts around it but I'd rather hear from the community first.
Changelog: Blogcast Liquid Tags Now Live
Tags: meta, changelog
Published: 2019-03-19 11:10:02

---
title: Changelog: Blogcast Liquid Tags Now Live
published: true
tags: meta, changelog
---

We have a new tag, the Blogcast tag!

Blogcast is a service that generates audio versions of your articles, and this tag let's you embed a player for listening to the audio version right on Dev.to

The player looks like this:

```liquid
{% blogcast 26 %}
```

{% blogcast 1 %}


To embed it in your posts, [create a Blogcast account](https://blogcast.host), then [follow the official guide for embedding on Dev.to](https://docs.blogcast.host/embeds/dev-to.html).
Getting started with React + GraphQL
Tags: graphql, webdev, beginners, react
Published: 2019-03-19 10:43:45

---
title: Getting started with React + GraphQL
published: true
description: How to implement GraphQL in a React app? It's quite easy.
tags: graphql,webdev,beginners,react
cover_image: https://thepracticaldev.s3.amazonaws.com/i/3m0gfvtdmcg6uro84rsm.png
canonical_url: https://blog.graphqleditor.com/getting-started-with-react-graphql/
---

How to implement GraphQL in a React app? Let's use [React Apollo](https://github.com/apollographql/react-apollo). This lib will allow you to fetch data from GraphQL server and use it the [React](https://reactjs.org/) framework.

## Setup a project
Before you start make sure that you have Node.js installed. To get started we first need to set up a new React project. The easiest way to do so is to use [create-react-app](https://github.com/facebook/create-react-app), which allows you to create a new React project with zero build configuration.

![Setup a react project](https://thepracticaldev.s3.amazonaws.com/i/gv3jlkn1lx4el5cwflal.png)

## Install dependencies

Once you have above done the next step will be to install dependencies. You can do it with a single NPM command which will install the following packages:

![Install dependencies](https://thepracticaldev.s3.amazonaws.com/i/rc3l7ci5zqefntoona1h.png)

- `apollo-boost`: a package with all necessary Apollo Client components
- `react-apollo`: a view layer for React
- `graphql` & `graphql-tag`: both required to parse GraphQL queries

## Create a client

Now you need to create an instance of [Apollo Client](https://github.com/apollographql/apollo-client). You can do it `App.js` by adding the following code:


![Create Apollo instance](https://thepracticaldev.s3.amazonaws.com/i/q8uzpdx8g1xo69tclbqk.png)

## Create GraphlQL Endpoint

To start with, all you really need is the endpoint for your GraphQL server. Let's assume you already have your GraphQL schema created (you can see how to do it quickly [here](https://dev.to/tomekponiat/visual-graphql-programming-38jn)). You can define it in `uri` or it will be `/graphql` endpoint on the same host as your app by default.

[![GraphQL Editor](https://thepracticaldev.s3.amazonaws.com/i/sjaue0skobsp62kedwbt.png)](https://graphqleditor.com/)


## Connect your React app with Apollo

To connect the Apollo Client to React use the `ApolloProvider` component exported from `react-apollo`. The `ApolloProvider` works similar to React’s context provider:
- it wraps your React app,
- places the client on the context,

giving you access to it anywhere in your component tree.

![Setting up the connection with Apollo](https://thepracticaldev.s3.amazonaws.com/i/6wuda3gcehqjp8xptxk5.png)

## You made it!
Your first React app with GraphQL is up and running you can start fetching some data with GraphlQL Queries!
Native Javascript element selector best practice
Tags: javascript, vue, help
Published: 2019-03-19 10:32:01

---
title: Native Javascript element selector best practice
published: true
tags: javascript, vue, help
---

Hey all,

So coming from Jquery, I was always told the best method to select an element is to give it a class name and use the $(".someElementClass") method.

However now not using Jquery in my Vue project, what is the best practice for selecting elements.

I am currently giving elements ID's and using the document.getElementById("someElementID");

Very curious to see what peoples opinions are!
NGINX: access logs – log all except 200 responses
Tags: nginx, linux, logging
Published: 2019-03-22 15:17:02

---
title: NGINX: access logs – log all except 200 responses
published: true
tags: NGINX,Linux,logging
canonical_url: https://rtfm.co.ua/en/nginx-access-log-log-all-except-200-responses/
---

![](https://rtfm.co.ua/wp-content/uploads/2012/09/nginx_logo2.jpg)The task is to save to a log file all requests excluding ones with the 200 response from the NGINX.

Using the approach described below with the `map` you can do various things, for example – chose a location to be used based on a header value. Will add such an example later.

For now, we are interested in two NGINX abilities: the _[conditional logging](http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log)_ to choose when need to save an event to a log file and the [`map`](http://nginx.org/en/docs/http/ngx_http_map_module.html) to set a variable’s value based on other variables.

### `map`

Add the `$abnormal` variable in the `http {}` block and set its value to 0 – if a response has 200 value or default value 1 – if not:

```
http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    map $status $abnormal {
        ~^200  0;
        default 1;
    }
    ...
```

### Conditional logging

Next, in the `server {}` set condition to be used for the `access.log` using the `if` condition: if the `$abnormal` variable’s value is zero – then log nothing, if 1 – to save this response to the log:

```
server {
    charset utf-8;
    listen 80 default_server;
    server_name stage.example.com;
    if ($http_x_forwarded_proto = 'http') {
        return 301 https://stage.example.com$request_uri;
    }
    set $root_path /data/projects/frontend/web;
    root $root_path;
    index index.php;
    error_log /var/log/nginx/stage.example.com-error.log;
    access_log /var/log/nginx/stage.example.com-access.log combined if=$abnormal;
...
```

Check it:

127.0.0.1 - - [15/Mar/2019:14:51:37 +0200] "GET /nginx_status HTTP/1.1" 404 153 "-" "Go-http-client/1.1"

127.0.0.1 - - [15/Mar/2019:14:51:52 +0200] "GET /nginx_status HTTP/1.1" 404 153 "-" "Go-http-client/1.1"

Done.


### Similar posts

- <small>04/12/2017</small> [NGINX: динамический upstream](https://rtfm.co.ua/nginx-dinamicheskij-upstream/)<small> (0)</small>  
- <small>03/23/2017</small> [NGINX: бан User Agent](https://rtfm.co.ua/draft-nginx-ban-user-agent/)<small> (0)</small>  
- <small>03/17/2019</small> [NextCloud: installing server on Debian behind NGINX with PHP-FPM and client on Arch Linux](https://dev.to/setevoy/nextcloud-installing-server-on-debian-behind-nginx-with-php-fpm-and-client-on-arch-linux-51bj)<small> (0)</small>  
- <small>09/20/2018</small> [NGINX: gzip и ETag weak validation](https://rtfm.co.ua/nginx-gzip-i-etag-weak-validation/)<small> (0)</small>
Theming With CSS Variables
Tags: webdev, css, design
Published: 2019-03-19 10:05:10

Theming your web application used to be very nasty, you had to use javascript to do the heavy lifting of changing the visuals of the elements or to create multiple representations for each element based on the current theme. So much clutter just for theming.

Nowadays, it is so much easier and cleaner to achieve thanks to [CSS Variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties).

# What are CSS Variables?

Actually they are much like any other variables you know from other languages. You define them as part of the CSS of an element and then they can be used in the CSS of the element itself and its children nodes.
You define a variable as follows:
```css
selector {
  --my-variable: value;
}
```
The value can be any CSS value you would like (even another variable).
Using a variable is as easy as defining:
```css
selector {
  color: var(--my-variable);
}
```

For a live example take a look below:

{% codepen https://codepen.io/idoshamun/pen/rRKgrM default-tab=css,result %}

# How to easily theme with CSS Variables?

First of all, we have to understand what are the variables we need for our theme. For simplicity sake, let's say that we have only two variables for our theme, the primary color and secondary color. In a real use case there will be much more variables probably (for example shadow, font, etc).

Second, let's define the variables for each theme (my personal preference is to define at the `html` element level but feel free to use wherever you want). We will separate the themes by classes. Again let's say that we have only two themes, default and blue theme.

```css
html {
  --my-primary: red;
  --my-secondary: blue;
}

html.blue {
  --my-primary: blue;
  --my-secondary: red;
}
```

Let's use these variables to style our element:

```css
.child {
  color: var(--my-primary);
  background: var(--my-secondary);
}
```

Now if we toggle the `blue` class in the `html` element our `child` element will change its visuals with no further effort. Very clean and intuitive code and if we would like to add a new class it is as easy as adding another class to `html`. For a full working example:

{% codepen https://codepen.io/idoshamun/pen/moKZBN default-tab=html,css,result %}


**Let the theming begin!**
The Law of Minimum Cost
Tags: tech, business, finance, costs
Published: 2019-03-19 09:59:51

---
layout: post
title: "The Law of Minimum Cost"
description: "Every software development task has a minimum cost which covers the creation of code that functions well and is bug free."
tags: [tech, business, finance, costs]
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/1zkjo9bpi7mb0rd5xbr3.jpg
---
The Law of Minimum Cost in software development relates to the financial cost, including time and materials, to *complete* a software development task.

The law states:

> Every software development task has a *minimum cost* which covers the creation of code that functions well and is bug free.

The Law of Minimum Cost has a number of principles:

- It is hard to achieve the *minimum cost*.
- It is impossible to complete a task for less than the *minimum cost*.
- Costs will grow until the software functions well and is bug free.
- If defects and maintenance are ignored costs will grow via side-effects.

Good tech teams and companies aim to get as close as possible to the *minimum cost* of development. This can take time and will require good planning, code analysis, review, and excellent testing, all executed before code is pushed to production. These steps will reduce defect density and improve quality, which means a team will get closer to the *minimum cost*.  

By contrast if a team rush tasks, cut corners and release code too early costs will spiral as they will have to fix bugs and faulty functionality which are in production. It will force the team to divert resources to maintenance and bug fixing which will reduce their efficiency. This will cause the company to hire more developers or wait longer for new functionality, and both will cost them financially.

There are also untracked financial side-effects caused by poor functionality and bugs in production. For example, they may result in fewer users interacting with the software, leading to fewer conversions. Or they may drive inefficiencies in other company departments which are reliant on the software. Overall the poorer the work and the higher the defect density the more costs will diverge from the *minimum cost*.

My advice generally is you cannot save money on a development task, you can only postpone the point at which you pay for it. I encourage all those involved in the tech industry to consider this before they plan their next development task or project.

<small>**Article Note:** This 'law' has been working its way around my head for a couple of years. It comes from my experience as a developer and manager working with companies and clients who often try to cut corners in the mistaken belief it will save them money. My aim is to arm developers with language and concepts which will help them better communicate this and other fallacies to the business and commercial people they work with. I'd really appreciate your feedback on this as a concept.</small>
Python Linux Command executor
Tags: utility, python, linuxcli
Published: 2019-03-19 09:59:04

---
title: Python Linux Command executor
published: true
description: 
tags: utility, python, linux cli
---


```python
# IMPORTING LIBRARIES 
import subprocess
import shlex

def cmdExecutor(cliCmd):
    # COLLECT THE COMMAND AND SPLIT USING SHLEX
	cmd = shlex.split(cliCmd)
    # EXECUTE THE SUBPROCESS WITH COMMUNICATE()
	process,error = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr= subprocess.PIPE).communicate()
	print("Command executed successfully")
    # DECODE THE RESPONSE FROM THE SUBPROCESS TO UTF-8
	error = error.decode("utf-8")
	if(str(error)==None or str(error)==""):
		output="SUCCESS"
	else:
		output = "ERROR => "+str(error)
	return output
```
How to poll a Gmail inbox using cypress.io
Tags: javascript, e2e, testing, node
Published: 2019-03-19 09:58:08

---
title: How to poll a Gmail inbox using cypress.io
published: true
description: How to "read" gmail inbox in e2e testing using cypress.io and NodeJS.
tags: #javascript,#e2e,#testing,#nodejs
cover_image: https://thepracticaldev.s3.amazonaws.com/i/hfkeo4ceoorkdb8p5uxj.png
---
Hey! Read about my experience writing custom tasks for the cypress framework.
Read the article on Medium: https://medium.com/@levz0r/how-to-poll-a-gmail-inbox-in-cypress-io-a4286cfdb888
The curious case of the infinite page with a footer
Tags: footer, page, neverending
Published: 2019-03-19 09:37:12

---
title: The curious case of the infinite page with a footer
published: true
description: 
tags: footer, page, never ending
---

Some websites have the brilliant way of displaying articles or images in an infinite way. Which means when you scroll to the bottom, the page automatically loads the next set of articles. 

At the moment when you are on the bottom, you see footer for a flash, but you won't be able to click anywhere, because the next set of articles is loaded already. 

So why put a footer there in the first place? It's just annoying. 

Dev.to is one of these examples, go to the homepage and experience it yourself.