teleren/devto huggingface dataset:
How do you organize your code or projects before you start coding? 
Tags: beginners, codenewbie, discuss, motivation
Published: 2020-05-29 13:19:39

---
title:How do you organize your code or projects before you start coding? 
published: true
description: Answers to a question to help aspiring developers
tags: #beginners #codenewbie #discuss #motivation
---
1. Keep a repository to use as a starter template.

2. Use either old-fashioned paper and pencil or a white board and marketer to visualize the order and logic of the code.

3. Organize projects with a wire-frame so you are not building blindly. Write down what features you want. Determine what resources/tech needed for the back end, front end, server, deployment, etc.. Form an informal team of application and idea testers. Start with a README to display what the goal of the project is and all the above details.

4. Boilerplate separate from the primary functionality, test code separate from application code, property files in a resource directory. Keep a workspace directory for each team that I do work for. 

5. Trello & work directory with individual projects

Contributors:Athena Baker, Corey McCarty, Coriano Harris

Code Connector is a non-profit that's organized tech meetups to help people start their journey into tech. If you enjoy daily discussions like the above, join us on slack at: https://bit.ly/2Ywnzqc
Get real ip of Fastify
Published: 2020-05-29 13:15:18

---
title: Get real ip of Fastify
published: true
description: 
tags: 
---

```js
const app = fastify({
  trustProxy: true,
});
```

```
location / {
    proxy_pass http://cryptotako/;
    proxy_set_header X-Forwarded-for $remote_addr;
}
```
Python 3: Concept of LIST in Detail
Tags: List, python, codenewbie, beginners
Published: 2020-05-29 13:13:00


The dictionary meaning of LIST is a number of connected items or names written or printed consecutively, typically one below the other.

In the real-world, lists are considered in many ways like a playlist of songs, a collection of your favorite videos, a list of user databases, and there are many more. But, if you are given a task about handling a list of users and filter out specific users under specific conditions then it becomes a tedious job to filter the list by going through each and every user. In such scenarios, programming comes into place to make your work easier.

So, now let us understand 'What is a LIST?' in python programming. In python, the list is a mutable or changeable, ordered sequence of elements where each element or value that is inside of a list is called an item.

In string, how each value/element is represented as a character, and similarly in the list, each value/element is separated by comma where each element can be a string, variable, or constants enclosed in the [] bracket.


Syntax of List: ['LetsUpgrade', 'Batch1', B2, B3]

Nested List: ['LetsUpgrade', ['java', 'python', 'c++'], 1, 2, ['B1', 'B2'], 'Exam'] 

#Topics to be covered in the LIST are as follows:

1. Indexing Lists
2. Lists are Mutable
3. Updating and Slicing Lists
4. Use of operators in List
5. Methods used in List
6. Built-in functions in List
7. Deleting Elements from List
8. Constructing a List with List Items
9. List and Strings
10. Parsing lines
11. Objects and values
12. Aliasing
13. List arguments
14. List Comprehensions

Now, Learn it in detail👉: https://bit.ly/3gDrVCC
What Did You Learn This Week --May 29?
Tags: todayilearned, discuss
Published: 2020-05-29 13:06:59

---
title: What Did You Learn This Week --May 29?
tags: todayilearned, discuss
published: true
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--TpOOUw4B--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/i/67bb72156h4y13zl5cio.png
series: this-week-i-learned
---
Enabling DNS-over-HTTPS (DoH) in Firefox & Chrome
Tags: security, doh, firefox, chrome
Published: 2020-05-29 13:05:31

###What is DNS-over-HTTPS

DNS-over-HTTPS (DoH) sends the domain name you typed to a DoH-compatible DNS server using an encrypted HTTPS connection instead of a plain text one. This prevents third-parties from seeing what websites you are trying to access, hiding domain name lookups from someone lurking on public WiFi, your ISP, or anyone else on your local network.

###How to enable it on Firefox

You can manually enable DNS-over-HTTPS from the Firefox settings:

- Click the menu button and select *Preferences*.
- In the *General* panel, scroll down to *Network Settings* and click the *Settings…* button.
-In the dialog box that opens, scroll down to *Enable* DNS over HTTPS.

You can also select providers, between Cloudflare and NextDNS and, in case you are afraid about your personal data sniffed by these providers, Mozilla states that _"...has a strong Trusted Recursive Resolver (TRR) policy in place that forbids CloudFlare or any other DoH partner from collecting personal identifying information. To mitigate this risk, our partners are contractually bound to adhere to this policy."_

###How to enable in Chrome

To enable DNS-over-HTTPS in Chrome, paste “chrome://flags/#dns-over-https” into the address bar and press Enter.

And then click relaunch. This will relaunch Chrome with your tabs.

Keep in mind that in Chrome, there is no option to select a provider. You will have to do it yourself at your routers' settings.
Do you guys put Naming conventions in CONTRIBUTING.md ?
Tags: discuss, github
Published: 2020-05-29 12:59:24

I was reading CodeComplete the other day, learned why naming your variables, classes, packages, routines can help the make code more readable.

What I realised that this practice is not usually scene with OpenSource projects. I have seen a few big OSS where sometimes code is not readable.

### Question:
#### If you have a medium to big scale Open-source project have you ever thought of putting a Naming Convention in the contributing guidelines.

Yes/No/thoughts ?
best cryptocurrency prediction platform 
Tags: crypto
Published: 2020-05-29 12:58:57

2020 year is bringing change in blockchain innovation after big fish including oracle, SWIFT banking network, google cloud started integrating in decentralized project. in future huge growth might be happening, in which we can able to see price of moon event just like 2017-18. 
source: https://cryptocurrencypriceprediction.com/
https://chainlinkpriceprediction.com/
プリム法 (Prim's Algorithm)
Tags: プリム法, prim
Published: 2020-05-29 12:52:49

{% youtube anuJPP3FZ8c %}

## コード

```js
let input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split("\n")
let v, e, path = []

for (let i = 0; i < lines.length; i++) {
  if (i === 0) {
    [v, e] = lines[i].split(" ").map(v => parseInt(v))
    path = [...Array(v)].map(() => [])
    continue
  }
  const [s, t, w] = lines[i].split(" ").map(v => parseInt(v))
  path[s].push([t, w])
  path[t].push([s, w])
}

const parent = (i) => Math.floor((i - 1) / 2)
const leftChild = (i) => 2 * i + 1
const rightChild = (i) => 2 * i + 2

const MinHeap = function (n) {
  this.a = [...Array(n).keys()].map(v => [v, Number.MAX_SAFE_INTEGER]) // [vertex, weight]
  this.pos = [...Array(n).keys()].map(v => v)
  this.size = n
}

MinHeap.prototype.extractMin = function () {
  const [v, w] = this.a[0]
  this.swap(0, this.size - 1)
  this.size--
  this.popDown(0)
  return [v, w]
}

MinHeap.prototype.swap = function (i, j) {
  const vi = this.a[i][0], vj = this.a[j][0];
  [this.a[i], this.a[j]] = [this.a[j], this.a[i]];
  [this.pos[vi], this.pos[vj]] = [this.pos[vj], this.pos[vi]]
}

MinHeap.prototype.decreaseKey = function (v, val) {
  const i = this.pos[v]
  this.a[i][1] = val
  this.popUp(i)
}

// vertexが含まれているか
MinHeap.prototype.contains = function (v) {
  return this.pos[v] < this.size
}

// 適切な位置まで上げる
MinHeap.prototype.popUp = function (i) {
  let pi = parent(i)
  while (i > 0 && this.a[i][1] < this.a[pi][1]) { // 親が子より大きかったら交換
    this.swap(i, pi)
    i = pi
    pi = parent(i)
  }
}

// 値を取得
MinHeap.prototype.val = function (v) {
  return this.a[this.pos[v]][1]
}

// 適切な位置まで下げる
MinHeap.prototype.popDown = function (i) {
  const val = this.a[i][1]
  let candidate = null // 子供のほうが小さかったら交換
  const ri = rightChild(i)
  const li = leftChild(i)
  if (ri < this.size) { // right child exist
    if (this.a[ri][1] < val) {
      candidate = ri
    }
  }
  if (li < this.size) {
    if (candidate == null) {
      if (this.a[li][1] < val) {
        candidate = li
      }
    } else {
      if (this.a[li][1] < this.a[ri][1]) {
        candidate = li
      }
    }
  }
  if (candidate != null) {
    this.swap(i, candidate)
    this.popDown(candidate)
  }
}

function prim(n, path) {
  const minHeap = new MinHeap(n)
  minHeap.decreaseKey(0, 0)

  let total = 0
  while (minHeap.size > 0) {
    const [v, w] = minHeap.extractMin()
    // check neighbors
    for (const [next, nextWeight] of path[v]) {
      if (!minHeap.contains(next)) {
        continue
      }
      const currentWeight = minHeap.val(next)
      if (nextWeight < currentWeight) {
        minHeap.decreaseKey(next, nextWeight)
      }
    }
    total += w
  }
  console.log(total)
}

// console.log(v, e)
// console.log(path)
prim(v, path)
```

## 問題

* https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/2/GRL_2_A
May 29th, 2020: What did you learn this week?
Tags: weeklylearn, discuss, weeklyretro
Published: 2020-05-29 12:48:32

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>

![Claymation owl teacher helping a student owl](https://media.giphy.com/media/3ohzdU2IVgD2goFS3S/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/graciegregory/what-was-your-win-this-week-3j8i %}

<center>

![Winning!](https://media.giphy.com/media/OHZ1gSUThmEso/giphy.gif)

</center>
What folder structure do use for your flutter projects?
Tags: discuss, help, flutter, workflow
Published: 2020-05-29 12:44:51

Hello community. 👋
I've been learning and building flutter applications lately (newbie)  and was wondering if there is a predefined way to structure files in the lib folder.
How do you decide the structure you use? 🤔
What do you always try to avoid when using a structure?
Or if you don't use a structure at all 😁

✌ share your thoughts and workflow  in the comments below
Giving Structure to the Creative Sparkles and Spirals
Tags: devjournal, womenintech, codenewbie
Published: 2020-05-29 12:37:26

_This post was originally published on May 29, 2020 on [my blog] (https://alexlsalt.github.io/blog)._

Happy Friday, folks! Today's a pretty chill day for me - nothing too crazy to share just yet, since I'm in the very beginning stages of a big project I've been wanting to start for a while now.

It feels like something that could be a perfect combination of all of the experiences I've had in my life thus far, and I'm really excited (and nervous!) to bring it to life.

Today is about strategizing and giving some structure to all the creative sparkles and spirals that are currently mapping across my brain.

What this means is that I'll essentially pull a Dumbledore when he takes the memories out of his head with his wand and then puts them into that little fountain. (Is that how it goes??)

I'll be taking all my notes and thoughts and get them onto paper with a clear vision of what's needed and when I'd like to go it by. I love this kinda stuff!

So! I've got my mug of tea, I'm listening to some Led Zeppelin recs from my brother ... let's do today!

Cheers!

[Now let's be friends over on Twitter >>] (https://twitter.com/alexlsaltt)
Which browser for what link on macOS
Tags: macos, browser, app
Published: 2020-05-29 12:31:48

---
title: Which browser for what link on macOS
published: true
description: open the link in right browser
tags: macOS,browser,app
canonical_url: https://jma.im/posts/which-browser-for-what-link-on-macos/
---

It’s hard to split work and personal usage on the laptop at all.

I would like to open work related web pages on Google Chrome, and all others go to Safari

Before I have a [Keyboard Maestro Marcos](https://github.com/imjma/keyboard-maestro-macros/blob/master/Open%20in%20Chrome.kmmacros), I manually copy the address to clipboard and use hotkey to open it in the Google Chrome.

However, this needs two more steps that are right-clicking or selection, and the hotkey.

Then I find a few apps that can do the same with just clicking. You need to set the app as the default browser, and once you click the address, the app will help you forward to the specific app by the rule you set up.

I also made a [shortcuts](https://www.icloud.com/shortcuts/8cc83908682d4d13973c47a1f38023d1) on iOS that you can use share sheet or clipboard to open the address in Google Chrome iOS.

### [Choosy](https://www.choosyosx.com)

The only one supports Google Chrome Profile so far. So if you have multiple profiles in Google Chrome, this is the only choice for you right now. Also, it has a similar popup browser selection like [Bumpr](https://apps.apple.com/au/app/bumpr/id1166066070?mt=12).

### [Bumpr](https://apps.apple.com/au/app/bumpr/id1166066070?mt=12)

The UI is the best, especially the popup browser selection, however, once you set up the rule, you could not edit it.

### [Browser Opener](https://apps.apple.com/au/app/browser-opener/id1387480496?mt=12)

Similar to Choosy, but not support Google Chrome Profile yet

### [Finicky](https://github.com/johnste/finicky)

Very recently found this open source, you need to write a config file using JavaScript rather than GUI. However, there is a page [finicky kickstart](https://finicky-kickstart.now.sh/) that helps you generate a basic config file. Also, There is one feature that you can edit the urls before opening.

Weekly tech bookmarks [funcmarks](https://buttondown.email/func)
Matrix Calculus for DeepLearning (Part1)
Tags: machinelearning, deeplearning, matrixcalculus, mathematics
Published: 2020-05-29 12:24:28

Based on Paper [The Matrix Calculus You Need For Deep Learning](https://explained.ai/matrix-calculus/index.html) by Terence Parr and Jeremy Howard. Thanks for this paper.  

The paper is beginner-friendly, but I wanted to write this blog to note down points which would make it easier to understand the paper much better. As we learn some topics which are slightly difficult, we find it to explain to a beginner, in a way we learnt, who may not know anything in that field, so this blog is for beginner.  
Deep Learning is all about linear algebra and calculus. If you try to read any deep learning paper, matrics calculus is a needed component to understanding the concept. May be word _need_ may not be the right word to use, since Jeremy's courses show how to become a world-class deep learning practitioner with only a minimal level of calculus,\ check [fast.ai](https://course.fast.ai/) for courses.  
I have written my understanding of paper in form of three blogs. This is part1 and check this website for two more parts.
Deep learning is the basically use of neurons with many layers. what does each neuron do??

## Introduction

Each neuron applies a function on input and gives an output. The activation of a single computation unit in a neural network is typically calculated using the dot product of an edge weight vector **w** with an input vector **x** plus a scalar bias (threshold):  
z(x) = **w** · **x** + b
letters written bold are vectors. **w** is a vector
Function _z(x)_ is called the unit's affine function and is followed by a rectified linear unit, which clips negative values to zero: max(0, z(x)). This computation takes place in neurons. Neural networks consist of many of these units, organized into multiple collections of neurons called layers. The activation of one layer's units becomes the input to the next layer's units. Math becomes simple when inputs, weights, and functions are treated as vectors, and the flow of values can be treated as matrix operations. 
The most important math used here is _differentiation_, calculating the rate of change and optimizing the loss function to decrease error is the main purpose. Training phase is all about choosing weights **w** and bias _b_ so that we get the desired output for all N inputs **x**. To do that, we minimize a loss function. To minimize the loss, we use SGD. Measuring how the output changes with respect to a change in weight is the same as calculating the (partial) derivative of the output w.r.t weight **w**. All of those require the partial derivative (the gradient) of activation(x) with respect to the model parameters **w** and _b_. Our goal is to gradually tweak **w** and _b_ so that the overall loss function keeps getting smaller across all **x** inputs. 

**Wait!!** is this it???
**NO**
For complete blog look for in my website [here](https://kirankamath.netlify.app/blog/matrix-calculus-for-deeplearning-part1/)
Are you storing your files correctly? Let’s explore a real-world backend issue.
Tags: python, django, security, todayilearned
Published: 2020-05-29 12:23:10

# Let’s start with a context

A few years ago, I developed a web application that basically: It’s possible to create your user, and after logging in, you can create “locations” and upload multiple media (_images/videos/documents_) to your location.
I used **Django Rest Framework** on the backend and **React** on the front-end.

## But this applies to all backend languages.

At first, I did not set the “**upload_to**” of my FileInput field, so, **by default**, it will upload all media to the media folder.
Let’s say I upload three files. My media folder will look like:

```
- media
  - file1.jpg
  - file2.jpg
  - file3.jpg
```

That looks good; It’s working well!

![Looks Good](https://i.giphy.com/l2JJrEx9aRsjNruhi.gif)

### That’s what I thought.

Now, a few years later, with **+4k active users** and **+40k media uploaded**, I found an issue: A customer told me the picture she added a few days ago was wrong. There was another picture in place.

**After a few hours of debugging, I finally found the issue!**

## The issue

Let’s say I upload another file with the name “**file1.jpg**”. You would probably expect the server to rename the file to “**file1(2).jpg**”, right? Even because it happens on every OS! Something like:

```markdown
- media
  - file1.jpg
  - file1(2).jpg <- the new one
  - file2.jpg
  - file3.jpg
```

### But that does not occur on every backend. At least not by default.

What was happening there is: The just added “**file1.jpg**” was **overriding** the previous “**file1.jpg**”.

![Can't believe](https://i.giphy.com/3owypkSIpM8xw6p7W0.gif)

## The solution

Well, to fix that, I had to change the “**upload_to**” to use a dynamic folder with the location id and create a migration to move all the current files to its expected folder.
So now my media folder will look to something like this (e.g.):

```
- media
  - location_1
    - file1.jpg
    - file2.jpg
  - location_2
    - file3.jpg
```

For the images that were overridden, I had to find them on the database to see which user uploaded them so I could warn them.

In summary, that was a mistake I did that I lost like **two nights** to debug and fix (nights, because it’s a side project).

_I was really looking like this. The sh#t happening in production while I debug and fix it:_
![Debugging](https://i.giphy.com/13HgwGsXF0aiGY.gif)

## Don't do the same mistake
If you enable uploads in your application, try to make it's **path** or **name** unique.
It has a lot of ways to do that, and it only depends on your application:

- It can have a folder by user id;
- It can have a folder by the model id;
- You can generate a folder name using UUID;
- You can generate a new name for the file based on the timestamp/UUID (I thought about using this on the beginning, but won’t work because in my case, the file name must keep the original);

That's all folks!
I hope you guys enjoy it, and keep learning!
I am the entity Quality GameWare.
Tags: new, gamedev, webdev
Published: 2020-05-29 12:21:49

Hello, I am the primary user of the QGw DEV account, my name is Calin Z. Baenen (I do not own QGw), you may know me as another DEV, but here I am part of an entity, studio. So let's dive into it:

##<b>Who are we?</b>
Our bio is:
```
A small American game studio making small games in the attempt to
achieve quality, our games may range from small unfinished
passion projects to so much more!
```
and we are proud to start production on games, with one on the way.
<br/>
##<b>What are our goals</b>
We're just a bunch of mid-teens making games that are either passion projects, genre'd games, or even all new ideas. We will take many inspiration sources.
<br/>
##<b>Contact</b>
QGw Twitter: https://twitter.com/QGameware
QGw email: qualitygameware@gmail.com
QGw DEV: https://dev.to/qualitygameware
<br/>
Thanks for reading, and I hope you will consider following us and our twitter for everything QGw related, we promise to deliver lots.
<br/>
In the mean time, have a Katty day!
Use Node.js to build a time server and a web server
Tags: beginners, javascript, node, webdev
Published: 2020-05-30 18:24:47

---
title: Use Node.js to build a time server and a web server
description: In this fourth part of my Node.js series, we'll build a TCP time server which answers each TCP request with the current time and a web server that responds to HTTP requests with a file.
published: true
date: 2020-05-29 12:18:00 UTC
tags: beginners,Javascript,node,webdev
canonical_url: https://raddevon.com/articles/use-node-js-to-build-a-time-server-and-a-web-server/
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/f4on20a68yqxirt7ktkr.jpg
---
In this video, we’re continuing through the Learn You Node workshop. We’ll build a TCP time server which answers each TCP request with the current time and a web server that responds to HTTP requests with a file.

{% youtube xya-s672b5M %}

Video Notes
-----------

❗ If you haven’t done the other videos of this series, you might be lost. Start with the first video in the series.  
📺 [Part 1](https://raddevon.com/articles/first-steps-with-node-js-part-1/)

📝 If you need to install Learn You Node, you can get directions [on their repo](https://github.com/workshopper/learnyounode).

📅🕐 In the process of doing this, we’ll also learn to use NPM to install and manage a dependency. We’ll be incorporating [date-fns](https://date-fns.org/), a date utility library for client-side Javascript and Node.

👋 Thank you for watching and for working through the exercises with me! Look out for the final video in which we’ll work through the remaining Learn You Node exercises together.

If you're excited about your new skills and looking for a project so you can put them to good use, check out my list of [web development project ideas](https://raddevon.com/articles/10-great-web-development-learning-project-ideas/).