teleren/devto huggingface dataset:
Get your C# WebAPI controller to keep processing a request after returning 200 OK
Tags: dotnet
Published: 2020-09-11 02:38:48

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9anbym0kkcay7es6fmlo.png)

Ever needed a "fire and forget" solution where a client calls a C# WebAPI controller that does something long running, but doesn't really care about the result? 

For example, say you have a job scheduling system that runs a series of tasks and one of them is a call to a C# WebAPI service to create something like an export of data from a SQL Server table to a file. 

###Problem 
The table is large and the export will tie up the job scheduling system from running the rest of the tasks in the process, or timeout the job scheduling process. And the result of the WebAPI service doesn't mean anything to the end result of the process, with the WebAPI reporting errors in another way such as by email. 

###Solution
Make the C# WebAPI report a HttpStatus code of 200 OK and say that the request is complete to the calling client, while still continuing to work on the request in the background.

For this fire and forget functionality, in your WebAPI controller, do this:

```
public async Task<IActionResult> Post(string id)
{
    try
    {
        return Ok("Request submitted successfully");
    }
    finally
    {
        Response.OnCompleted(async () =>
 	    {
		    await DoProcessing(id);
	    });
    }
}
```

The key is the "Response.OnCompleted" part, which allows your code to execute even after reporting HttpStatus 200 OK to the client.
September 10th, 2020: What did you learn this week?
Tags: weeklylearn, discuss, weeklyretro
Published: 2020-09-11 02:29:08

It's that time of the week again. So wonderful devs, what did you learn this week? It could be programming tips, career advice etc.

<center>

![Yoda wooping someone's butt](https://media.giphy.com/media/yDYAHbqe5DfyM/giphy.gif)
</center>

Feel free to comment with what you learnt and/or reference your TIL post to give it some more exposure.

{%tag todayilearned %}

And remember, if something you learnt was a big win for you, then you know where to drop it as well.👇👇🏻👇🏼👇🏽👇🏾👇🏿

{% link https://dev.to/devteam/what-was-your-win-this-week-3fe0 %}

<center>

![Little kid making a fist as if to say "Yes!"](https://media.giphy.com/media/6brH8dM3zeMyA/giphy.gif)
</center>

Photo by [twinsfisch](https://unsplash.com/@twinsfisch?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/learning?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
I built my own little JIRA alternative
Tags: showdev, productivity
Published: 2020-09-11 02:27:47

---
title: I built my own little JIRA alternative
published: true
description: How I built my own JIRA alternative
tags: #showdev #productivity
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/7m2uria4cxroidk7c1my.png
---

Since I built my job boards ( eg https://fullstackjob.com ) it's now over a year passed and I also built my social media post/schedule tool [Kunvenu](https://kunvenu.com) which I daily use for my #go posts via [@golangch](https://twitter.com/golangch), reaching 5000 followers about 2 weeks ago.

What I worked on over the weekends for the last 4 months is my own Project Management Tool, named [omnited](https://omnited.com) 
It's a Project and Task management, where you can define eg what kind of Status, Priorities and Issue Types you want (on the project, folder, and list level). 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3dja0i9dp03rla0i0uhs.png)

You have a List of Peoples working in your company (where not all must be Users) and can invite new ones via the app.
As a User or Project Manager, you have now 2 different types of Issue Views, List, and Board.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6jsczm38if8xoy7706os.png)

I built the tool with the following Stack:
- Go backend, Chi Router, own auth/authz implementation
- ArangoDB and Redis for data
- Nsq for queueing
- Frontend Vue, Vuex, Bulma (with Buefy components)
- Hosting on own Server with Rancher 1.x/Docker

I use the tool now for the planning of my new project I started last weekend, which is named nBoarding and is a tool that helps founders and mainly small business owners and team leaders to onboard new staff members or freelancers with automatable predefined workflows.
Here I will use the first-time Nuxt for Frontend. Let's see. SSR is cool, but has a cost :-)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1ct1pt342ja7himq90fr.png)

If you want to be my Beta Tester I have a Lifetime Deal running on https://omnited.com

Cheers 
Stefan
[altafino](https://altafino.com)
React Wizards with State
Tags: showdev
Published: 2020-09-11 02:18:44

![UclusionWizard](https://dev-to-uploads.s3.amazonaws.com/i/4a0xazc4zr201e72p1pc.png)
Hi,
Over at Uclusion, we have a fairly large amount of information required to properly set up a Workspace (or Dialog, or Initiative). As we talked about in [Wizards aren't just for Hogwarts](https://dev.to/uclusion/wizards-aren-t-just-for-hogwarts-14kd), to make sure our users aren't hit with too much information at once, we've converted all of our top level creation flows to Wizards.

While doing so we discovered that the most annoying part was keeping track of the form state that the user had entered, and making sure the user could resume if they had to reload or just set down work.

To make sure YOU don't have to go through the same annoyance, we're open sourcing [react-formdata-wizard](https://github.com/uclusionopensource/react-formdata-wizard), which will maintain all the state transitions, form data, resets, etc, all in one easy to deal with package. 

Unlike other react wizard projects we _do not_ render any UI or nav buttons, but instead provide you with the properties you need to make your own. That keeps state management separate from UI, the way it should be.

Enjoy, and expect more changes as time goes on. We're busily rebasing the entirety of the wizard flow on this package.
What if I need to make a change in node_modules?
Tags: node, electron, npm
Published: 2020-09-11 01:46:49

I have an application build on top of node/electron, and recently, because of an update in the electron, some dependencies have broken down, preventing me to upgrade to the newer versions while keeping all functionalities.

In such cases, the correct behavior would be to reach out to the dependency, and open an issue, or even submit a Pull Request, but what if your dependency is not maintained anymore, or the development process on such repository is stalled or slow, and you really need to move on with your development?

That was the scenario I was facing. The change I needed was very localized, but I could not, in a million tries, get to make it work on my fork of the dependency. To make things worst, the last commit on the repository was over 6 months ago, and no sign of a reply on the issue I opened in a week.

That's when I found [patch-package](https://github.com/ds300/patch-package), a package that lets app authors instantly make and keep fixes to npm dependencies.

{% github ds300/patch-package %}

The [README](https://github.com/ds300/patch-package/blob/master/README.md) has all the information you'll need, but I'll summarize here the idea: 

1. Install patch-package (using npm or yarn)
2. Update the `scripts` rule on your `package.json` to include a call for patch-package:

    ```
     "scripts": {
    +  "postinstall": "patch-package"
     }
    ```

3. Do the change you need on the dependency, directly on node_modules
4. Call patch-package specifying the package you modified:

    ```
    (npx | yarn) patch-package package-name
    ```

    The last command will create a patch file (a diff) in `patches/`, which is a diff between the public dependency and your changed version.

5. Commit the changes, including the new patch file and everything will be working as expected.

Now, whenever you (or someone) calls install on your repository, patch-package will be called, applying that change on it.

![Win!](https://media.giphy.com/media/5oGIdt1xapQ76/giphy.gif)

Problem solved!

What about you? Have you ever needed to take a similar action?
Using multiple footnotes in float environments
Tags: latex, footnote, float
Published: 2020-09-11 01:06:50

# The problems

I was writing my MSc thesis when I just tried to add two footnotes in the captions of two subfigures. The result of my first try was something like this:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5cyikcxvns5fqj69zjyw.png)

Well, the problem is that I expected the footnotes to be at the bottom of the page. And I solved it quite fast by using `\footnotemark[...]` and `\footnotetext[...]{...}`. However, another problem arose: only the label of the last footnote was linkable and I wanted both to be linkable.

# The fix

I googled a lot but no solution was good enough to solve both problems. I found some solutions proposing using the `footnotehyper` package but they did not help with the first problem. After some hours I found this 2012 [post](https://texblog.org/2012/02/03/using-footnote-in-a-table/) showing the `savenotes` environment of `footnote` package. It did not solve my second problem, but I realized that the `footnotehyper` could be based on the `footnote` so I could use the `savenotes` environment as well. And it worked finely! More about the `footnotehyper` documentation [here](https://ctan.math.illinois.edu/macros/latex/contrib/footnotehyper/footnotehyper.pdf).

# The code

```latex
\documentclass{article}

\usepackage{geometry}
\geometry{a5paper,landscape,margin=0.5in}

\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{caption,subcaption}
\usepackage{footnotehyper}

\begin{document}

\pagestyle{empty}

\begin{savenotes}
    \begin{figure}[ht]
        \centering
        \caption{Animals.}
        \label{fig:animals}
        \begin{subfigure}[b]{0.48\textwidth}
            \centering
            \caption{A cat.}
            \label{fig:cat}
            \includegraphics[width=\textwidth]{cat.jpg}
            \caption*{Source: \href{https://unsplash.com}{Unsplash}\footnote{Source: \href{https://unsplash.com/photos/kjERLXaHjXc}{https://unsplash.com/photos/kjERLXaHjXc}.}.}
        \end{subfigure}
        ~
        \begin{subfigure}[b]{0.48\textwidth}
            \centering
            \caption{A dog.}
            \label{fig:dog}
            \includegraphics[width=\textwidth]{dog.jpg}
            \caption*{Source: \href{https://unsplash.com}{Unsplash}\footnote{Source: \href{https://unsplash.com/photos/N04FIfHhv_k}{https://unsplash.com/photos/N04FIfHhv\_k}.}.}
        \end{subfigure}
    \end{figure}
\end{savenotes}

\end{document}
```

# The result

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zw1n9pu5ki5lztzi4vfp.png)

# References

 - I took the images of the [cat](https://unsplash.com/photos/kjERLXaHjXc) and the [dog](https://unsplash.com/photos/N04FIfHhv_k) from [Unsplash](https://unsplash.com/).
Cognitive footprint matters
Published: 2020-09-11 00:35:22

**_The thinner you spread yourself, the harder to win_**

Cognitive “footprint” is the total cognitive effort required to sustain an enterprise. In short, it is all the thinking, reasoning, learning, remembering, etc. necessary for success.

The larger an organization’s cognitive footprint, the greater the cost to maintain it. If you can achieve the same outcome with a smaller footprint, you’ll save time and money — freeing up resources for other priorities.

To minimize cognitive footprint, making your organization leaner and more competitive, you’ll first need to recognize it and interrogate it.

## Contributors to cognitive footprint

* The **difficulty of processes**: if two processes achieve the same outcome, but one is more difficult, then the more difficult process increases the cognitive footprint without benefit.
* The **scale of the skills and knowledge required** to keep the business running: the greater the number of skills needed or the more complex those skills, the greater the cognitive footprint.
* The **difficulty to acquire and maintain the necessary skills and knowledge** required to run the business: slow to learn means a bigger cognitive footprint.
* The **cognitive load carried by the work force**: cognitive load translates directly to cognitive footprint, which could be considered the sum of cognitive load over time.

If you’re not aware of and attentive to your organization’s cognitive footprint, then odds are it is much bigger than it needs to be. An oversized footprint wastes resources — including time and money — and hurts agility and competitiveness.

Why compete in **clown shoes** when you can wear a pair of Mizuno Wave Riders?

![Clown shoes may look cool, but they’re not anything you’d want to run while wearing.](https://dev-to-uploads.s3.amazonaws.com/i/yxg40887olq34o3c1aub.png)

## How to minimize cognitive footprint

The first trick to minimizing cognitive footprint is to recognize it in your organization. Begin by cataloguing everything that contributes to it. There are many things to consider:

* How much knowledge do new employees **need to learn** to be able to come up to speed in their jobs? Is that information well documented? Well indexed for rapid access? Easy to understand? Tightly focused on exactly what they’ll need rather than an everything-and-the-kitchen-sink approach?
* Look for **duplicated effort**. Do different divisions use different applications, frameworks, libraries to accomplish the same tasks? Why maintain incompatible stacks unnecessarily?
* Perhaps you keep it lean, but do you apply that to learning as well? Do your workers employ **[just-in-time learning](https://dev.to/paperhat/the-future-is-just-in-time-3m86)** or are they regularly acquiring knowledge and skills that they don’t truly need and may never use? And are you paying for it under the assumption that all learning is useful?

There is much more to recognizing, measuring, and minimizing cognitive footprint. I’ll address specific issues and techniques in upcoming essays.
Nix as development environment
Tags: nix, node
Published: 2020-08-16 05:33:33

[Nix](https://nixos.org/nix/manual/#ch-about-nix) is a purely functional package manager. It is alternative to homebrew in MacOS, every folder has its own environment with the help of [direnv](https://direnv.net), you can install any version of package on folder base.

## Table Of Contents
   * [Getting Started](#getting-started)
   * Create nix config `.envrc` and `default.nix`
   * "Hello World" Node API with Nix


### Getting Started <a name="getting-started"></a>

 * Install Nix
 ```
 sh \
  <(curl -L https://nixos.org/nix/install) \
  --darwin-use-unencrypted-nix-store-volume
 ```
 <br /> <br />
 * NOTE: this are for who have intel MacBook
 * Add nix profile in your favorite shell config
  * `~/.zshrc` or `~/.bashrc` - create if file not exist
  ```
   . /Users/<your-user-name>/.nix-profile/etc/profile.d/nix.sh
   source $HOME/.nix-profile/etc/profile.d/nix.sh
   export NIX_PATH="nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs"
  ```
 * Close your terminal to reload `~/.zshrc` or `~/.bashrc` file
 * For M1 or arm MacBook please see 
 ```
 https://nix.dev/tutorials/install-nix
 ```
 * Open new terminal, then type:
 ```
 nix-env --version
 ```
* Update all the channels [link](https://nixos.wiki/wiki/Nix_channels)
```
nix-channel --update
```
* Install [direnv](https://direnv.net/)
 * is an extension for your shell. It augments existing shells with a new feature that can load and unload environment variables depending on the current directory.
```
nix-env -i direnv
```
* Add `direnv` hook to shell config [Please see more...](https://direnv.net/docs/hook.html)
```
eval "$(direnv hook zsh)"
```
Announcing Keynote Speaker for PyCon India 2020 - Victor Stinner
Tags: python, redhat, pyconindia, community
Published: 2020-09-11 11:57:57

---
title: Announcing Keynote Speaker for PyCon India 2020 - Victor Stinner
published: true
date: 11/09/2020 
tags: python,redhat,pyconindia,community
canonical_url: 
---

We are happy to announce **Victor Stinner** as a Keynote speaker for PyCon India 2020!

Victor Stinner is a Python core developer for 9 years. He is paid by Red Hat to maintain Python upstream (python.org) and downstream (RHEL, Fedora). Author of pyperf, faulthandler and tracemalloc modules, he is working on [Python performance](https://speed.python.org/), [security](http://python-security.readthedocs.io/%20website) and stability (member of the Night's Watch, maintain Python CIs: Travis CI, AppVeyor, and the large fleet of buildbot workers). He also mentors Python contributors.

You can find him on Twitter: [@VictorStinner](https://twitter.com/VictorStinner)

![Victor Stinner](https://in.pycon.org/2020/assets/images/victorstinner.jpg)
Production Grade Development using Docker-Compose
Tags: docker, dockercompose
Published: 2020-09-15 13:58:00

---
title: Production Grade Development using Docker-Compose
published: true
date: 2020-09-11 00:00:00 UTC
tags: Docker,Dockercompose
canonical_url: https://www.loginradius.com/engineering/blog/production-grade-development-using-docker-compose/
---

Assuming that reader of this blog has fair idea of docker ecosystem! Docker has changed the world of software development! Since the last few years docker has helped the community and enterprises and startups create solutions quickly and effectively, while deployment is…

   
[Read On](https://www.loginradius.com/engineering/blog/production-grade-development-using-docker-compose/)
Что не нужно писать в it
Tags: ruby, rspec, testing
Published: 2021-01-19 11:06:40

---
title: Что не нужно писать в it
published: true
date: 2020-09-11 00:00:00 UTC
tags: ruby, rspec, testing
canonical_url: https://vasily.polovnyov.ru/posts/stop-writing-it.html
---

1. Бесполезные, общие слова, не несущие никакой конкретики:

```ruby
it "adds certain value"
it "returns correct result"
it "fails"
it "returns formatted string"
it "returns correct url"
it "is ok"
```

2. Детали реализации:

```ruby
it "changes @scheduled_on"
it "assigns @todos"
```

3. Ложь:

```ruby
it "returns time in 24-hour format" do
  expect(...).to eq "9:25"
end

it "strips leading zeroes" do
  expect(foo(" 9:25 ")).to eq "9:25"
end
```

И, пожалуйста, не тестируйте конструкторы и attr\_reader/writer/accessor: вы все равно их проверите, тестируя публичный АПИ.
Rediscovering APAs
Published: 2020-09-13 05:19:21

---
title: Rediscovering APAs
published: true
date: 2020-09-11 00:00:00 UTC
tags: 
canonical_url: https://emmas.site/blog/2020/09/11/rediscovering-apas
---

[Matt Webb describes a fever dream of an idea for a website](http://interconnected.org/home/2020/09/09/organizine) where a group of people agree to a publishing frequency, start ‘zines, and at the deadline the ‘zines are compiled and distributed to the membership.

Those are APAs (amateur press associations) except instead of the web, members were cutting and pasting zine’s and making copies at Kinko’s (remember when Kinko’s wasn’t FedEx?) to mail to or drop off at the Organizing Editor’s (OE,) who would host a compilation party where they would assemble everyone’s APA zine’s into a issue. You made as many copies of your zine as members in good standing, and a couple more for people who were on-spec.

Then the OE would mail copies to the out of town members (you contributed to a mailing fund for this) and you’d pick up your issue to take home and make notes in the margin for comments on everyone else’s zine.

And yes, APAs influenced Live Journal (and later Dreamwidth) culture.

I was a member of the Madison SciFi fan APA, _The Turbo Charged Party Animal_ for close to 10 years. [Jeanne Gomoll’s design portfolio has examples of her and her partner’s ‘zines for the APA over the years](http://unionstreetdesign.com/portfolio.html). My favorite memory was a multiple issue narrative arc about Jeanne’s Diet Coke stash. Her friends may have bought her a room full of cases of Diet Coke for her birthday one year.

Who wants to make an APA?
How to throw or show datatype errors in JavaScript?
Tags: javascript
Published: 2020-09-11 00:00:00

---
  title: How to throw or show datatype errors in JavaScript?
  published: true
  tags: JavaScript
  date: Fri Sep 11 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/throw-datatypes-errors-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-c5c9b4009cef5804072638fba129ef0f.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/throw-datatypes-errors-javascript)
  
We can use the `TypeError()` constructor function to throw or show an error when the data type doesn't match in JavaScript.

Let's consider a function which accepts values of `string` type only and wants to throw an error on an invalid type.

So let's create that function,

```javascript
// a function which accepts only
// values of string type
function iAcceptStringOnly(name) {
  // cool code goes here!
}
```

Now, To know what is the type of data, we can use the `typeof` operator. This operator will return the type as a string eg: string, number, boolean, etc,.

```javascript
// a function which accepts only
// values of string type
function iAcceptStringOnly(name) {
  // get what is the type of the parameter
  const typeOfParameter = typeof name;
}
```

Now check if the `name` variable is of type `string` using an if statement. If it is not of `string` type then it will throw a `TypeError` 🦄.

```javascript
// a function which accepts only
// values of string type
function iAcceptStringOnly(name) {
  // get what is the type of the parameter
  const typeOfParameter = typeof name;

  // check whether the name variable has type string
  if (typeOfParameter != "string") {
    throw new TypeError();
  }
}
```

The `TypeError()` constructor functions accepts:

- the error name as the first parameter
- the filename where the error occurred as the second parameter
- the line number where the error occurred as the third parameter

These parameters are optional, but it's good to define them for understanding the error.

```javascript
// a function which accepts only
// values of string type
function iAcceptStringOnly(name) {
  // get what is the type of the parameter
  const typeOfParameter = typeof name;

  // check whether the name variable has type string
  if (typeOfParameter != "string") {
    throw new TypeError("the name should be of string type", "main.js", 5);
  }

  console.log("No Error!, it's cool 🧘‍♂️");
}
```

Now try invoking the function `iAcceptStringOnly` with a number and observe the error shown.

See this example live in [JSBin](https://jsbin.com/josizejufe/2/edit?js,console).

### Feel free to share if you found this useful 😃.

---
Tip for Winning at Work
Tags: winning, coding, programming
Published: 2020-09-10 23:35:16

---
title: Tip for Winning at Work
published: true
description: 
tags: winning, coding, programming
//cover_image: https://direct_url_to_image.jpg
---
When you’re assigned a bunch of tedious repetitive coding, find a way to automate it. It’s more fun too!

Wrote a program in a day and a half that took 5 seconds to do work that would have taken me a couple weeks to type manually.

What win(s) have you had this week?
Node.js - Best Practices
Tags: node, javascript
Published: 2020-09-10 23:08:11

#QUICK Creation
1. Create a folder.
2. Init Node Project. 
> ```npm init```
3. Create app.js
> ```javascript
var express = require('express');

var app = express();

var port = process.env.PORT || 3000;

app.get('/', (req, rest) => {
  rest.send('Welcome to my API!');
});

app.listen(port, () => {
  console.log(`Running on port ${port}`);
});
```
4. Install dependencies.
> ```
npm install express nodemon
npm install --save-dev eslint
```
5. Add script to package.json
> ```
...
  "scripts": {
    ...
    "start": "nodemon app.js",
    "lint": "eslint .",
    ...
  },
  ...
  "nodemonConfig": {
    "restartable": "rs",
    "ignore": [
      "node_modules/**/node_modules"
    ],
    "delay": "2500",
    "env": {
      "NODE_ENV": "development",
      "PORT": 4000
    }
  }
  ...
```
6. Configure ESLINT
>```
npm run lint -- --init
```