teleren/devto huggingface dataset:
How to add localisation to Asp.Net core
Tags: aspnetcore, localisation, beginners, dotnet
Published: 2021-01-04 23:22:04

Hello,  i have uploaded a youtube video on How to add localisation to Asp.net  core  MVC application. 

This is a brand new Youtube channel dedicated for dotnet development. Please subscribe and watch and comment on any  topics  that you want to see. Thank you

{% youtube oZ3ADFwW5zw %}

Ps: all of the code is available in Github
https://github.com/mohamadlawand087/V2-AspNetCoreLocalization
Put up fences around your TypeScript modules
Tags: engineeringmonday, codequality, typescript, analysis
Published: 2021-01-04 23:19:59

The author says it best...

"Good Fences is a tool that allows you to segment a **TypeScript** project into conceptual areas and **manage dependencies** between those areas."

https://github.com/smikula/good-fences

Define what you import or export between Typescript files, directories and subdirectories with tagged fence.json files.

```
{
    "tags": [ "tagA", "tagB" ],
    "exports": [
        "index",
        {
            "modules": "sample_directory/*",
            "accessibleTo": "tagX"
        }
    ],
    "imports": [
        "tagC",
        "tagD"
    ]
}
 ```

And the most important feature... a human readable log with errors. 

```
Good-fences violation in src/foo.ts:
    Import not allowed: src/bar.ts
    Fence: src/fence.json
```

What are your goto tools? Have you stumbled upon anything new and added it to your arsenal? 🧠
#dohackathon: Sharli's Stuff
Tags: dohackathon
Published: 2021-01-04 23:18:23

## What I built

A small site to showcase my partners artistic talents.

### Category Submission: 

Personal Site/Portfolio

### App Link

[Sharli's Stuff](https://sharleen.dack.com.au/)

### Screenshots
![Mobile view](https://dev-to-uploads.s3.amazonaws.com/i/oipu37f2phq19v4hm7lf.png) ![Desktop & responsive mobile view](https://dev-to-uploads.s3.amazonaws.com/i/p9571a3cwn0t9t1whrox.png)

### Description
An Express/Handlebars NodeJS app using DO App Platform and Spaces to showcase personal artwork with the focus on the art. Responsive layout across mobile and desktop devices.

### Link to Source Code
[tdack/sharleen](https://github.com/tdack/sharleen)

### Permissive License
[BSD-2](https://github.com/tdack/sharleen/blob/main/LICENSE)

## Background
My partner has re-invigorated her interest in artistic pursuits in the last 2 years and has produced some awesome art work. This app was built to show case her talent and as a way for me to learn a bit more about web app development and frameworks.

### How I built it
Built using an excellent [HTML5 UP](https://html5up.net/) as the starting point. Using Express as the backend and Handlebars as the templating engine. Images & descriptions are stored using Digital Oceans Spaces. Access to edit/upload images is handled using Passport and authenticated against Google OAuth.

### Additional Resources/Info

App still needs some polishing. Uploading of images to DO Spaces could be handled better, editing of descriptions needs some work as well. However, it is functional.
Day 3 - Beautiful Arrangement
Tags: leetcode, python
Published: 2021-01-04 23:14:43

## The Problem

>Suppose you have `n` integers labeled `1` through `n`. A permutation of those `n` integers `perm` (__1-indexed__) is considered a __beautiful arrangement__ if for every `i (1 <= i <= n)`, __either__ of the following is true:

> * `perm[i]` is divisible by `i`.
> * `i` is divisible by `perm[i]`.

>Given an integer `n`, return the number of the beautiful arrangements that you can construct.

__Example: 1__

```
Input: n = 2
Output: 2
Explanation: 
The first beautiful arrangement is [1,2]:
    - perm[1] = 1 is divisible by i = 1
    - perm[2] = 2 is divisible by i = 2
The second beautiful arrangement is [2,1]:
    - perm[1] = 2 is divisible by i = 1
    - i = 2 is divisible by perm[2] = 1
```

__Example 2:__

```
Input: n = 1
Output: 1
```

## My Tests

```python
import pytest
from .Day3 import Solution

s = Solution()


@pytest.mark.parametrize("input,expected", [(2, 2), (1, 1), (3, 3), (4, 8)])
def test_gives_number_of_beautiful_arrangements(input, expected):
    assert s.countArrangement(input) == expected

```

## My Solution

```python
def check(n: int, index: int, checking: dict) -> int:
    if index == 0:
        return 1
    total = 0

    for i in range(1, n + 1):
        if (i not in checking or not checking[i]) and (i % index == 0 or index % i == 0):
            checking[i] = True
            total += check(n, index - 1, checking)
            checking[i] = False
    return total


class Solution:
    def countArrangement(self, n: int) -> int:
        checking = {}
        return check(n, n, checking)

```

## Analysis

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

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

## My Commentary

This is down as "medium" difficulty but I did find this pretty tricky. My solution could be a lot better but it's the best I was able to manage in the time I had.

I decided early on I'd need to do 2 things. I would have to iterate over the "list" and I would have to check each number against each index. 

I decided to make a map of the number `1 to n` and recursively check each number, setting a flag in a map to help skip that number in the recursive calls.

So the idea is, starting at 1, check every number in the list to see if they fulfil the requirement:

> * `perm[i]` is divisible by `i`.
> * `i` is divisible by `perm[i]`.

We set the index to `n` and decrement it in each recursive call to `check` on the number `n`. So each number `n` recursively checks against every index. Now we get a count of each time the requirements are fulfilled for a number and index all the way down to the last index. This gives us a running count of all the valid __Beautiful Arrangemnts__.
Avoid this and achieve your dev goals in 2021
Tags: productivity, codenewbie, programming
Published: 2021-01-04 23:11:17

It's that time of the year when you see a lot of public commitments to 'goals'. I think one cool thing is more and more material is made about this as time goes on. Every year someone seems to have new ideas or thoughts that build upon previous works. To me, this proves there is no one _right_ way and you need to figure out what works for you. It may be a combination of a bunch of stuff. 

I've done a lot of different variations on goals and I still change them up. I can't fully leave goals but sometimes I kind of hate them. I do agree habits and systems are critical. On the other hand, having no goals for me feels too strange. 

It is also ironic to me some goals might not get you what you wanted. There is this quote that gets attributed to various authors:

>When you get to the top of the ladder you may find it is propped against the wrong wall.

I had that and continue to have that feeling a lot. It is hard to pinpoint one 'why' perhaps you go for something because it's more of what others wanted for you rather than you. Or maybe truly you thought doing 'x' would get you to where you wanted to be but it turns out that is not it. Even if you find yourself in this position you gained some experience and wisdom and can shift your course.

Similar to software development personally I like to work inside the idea of releases. It is up to you how long to define a release there is a popular book the 90 day year by Todd Herman but for me, it feels too long. Perhaps for you, it is just right. It is trial and error until you find what you want. 

Whatever way you go about this I think these three ideas are critical to however you define success:

1) Be kind to yourself.
2) Less is more.
3) Don't fear change.

Be your best coach, friend, mentor you can be to yourself. Fuck the negative self-talk it does no good. Pretend you are talking to a dear friend or child struggling and how would you deal with that scenario?  If you fail learn from it and get back up and try again. No need to beat yourself up for failing. Ambition and dreams are awesome but in my opinion, less is more in terms of the number of 'things' your working on. You could probably do better chasing 5 things over a shorter cycle than attempting 100 goals. Finally, don't be stubborn if something is not working or if you realize you no longer want to pursue your goal. Just because you wrote something down or invested time/money in some way if it is not working change it up. Don't hold on just because. 

If you only remember one thing to take away remember this and avoid it:

> The only way you really fail is if you quit. 

Failure is not the end, bad results are not the end, keep going and getting yourself off the ground. You can do whatever it is you desire.
Reverse a Linked List - Leetcode
Tags: python, linkedlist, leetcode
Published: 2021-01-04 23:10:05

I'm sure many of you have seen this problem: reverse a linked list. When you reverse a linked list, you are essentially reversing the direction the linked list goes from. 
For example, if you have a linked list 1 -> 2 -> 3 -> 4, you want to make the linked list 1 <- 2 <- 3 <- 4.
To do this, you need a variable prev that you can set the previous value to. 
Here's my code for this problem:
```python
def reverseList(head):
        prev = None
        while head:
            temp = head
            head = head.next
            temp.next = prev
            prev = temp
        return prev
```
You first set the variable prev to None. Then you create a while loop that loops through head, which contains the first value of the linked list. You set a temp variable equal to the current node. Then you set the current node to the next node to progress through the linked list, while temp remains the current node. You set the next pointer of temp(current) equal to prev, which is at first None, but then it equals the current node afterwards. Then you repeat. 
For example, using 1 -> 2 -> 3 -> 4
temp = 1
head = 2
prev = 1
temp = 2
head = 3
prev = 2
temp = 3
head = 4
prev = 3
And that's how you reverse the linked list.
Day 2 Find a Corresponding Node of a Binary Tree in a Clone of That Tree
Tags: leetcode, python
Published: 2021-01-04 22:29:45

## The Problem

>Given two binary trees `original` and `cloned` and given a reference to a node `target` in the original tree.

>The `cloned` tree is a __copy__ of the `original` tree.

>Return a reference to the same node in the cloned tree.

>__Note__ that you are __not allowed__ to change any of the two trees or the target node and the answer __must be__ a reference to a node in the cloned tree.

>__Follow up:__ Solve the problem if repeated values on the tree are allowed.

__Example:__

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

```
Input: tree = [7,4,3,null,null,6,19], target = 3
Output: 3
Explanation: In all examples, the original and cloned trees are shown. The target node is a green node from the original tree. The answer is the yellow node from the cloned tree.
```

## My Tests

[Link to util code](https://github.com/ruarfff/leetcode-jan-2021/blob/main/src/util.py)

```python
import copy
from .util import TreeNode
from.Day2 import Solution

s = Solution()


def test_find_node():
    tree = TreeNode(7)
    tree.left = TreeNode(4)
    tree.right = TreeNode(3)
    tree.right.left = TreeNode(6)
    tree.right.right = TreeNode(19)

    original = tree
    clone = copy.deepcopy(tree)

    assert s.getTargetCopy(original, clone, tree.right).val == 3
```

## My Solution

```python
from .util import TreeNode


def search(tree: TreeNode, val: int) -> TreeNode:
    if tree.val == val:
        return tree

    if tree.left is not None:
        l = search(tree.left, val)
        if l is not None:
            return l
    if tree.right is not None:
        r = search(tree.right, val)
        if r is not None:
            return r
    return None


class Solution:
    def getTargetCopy(
        self, original: TreeNode, cloned: TreeNode, target: TreeNode
    ) -> TreeNode:
        return search(cloned, target.val)
```

## Analysis

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

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

## My Commentary

At first, I thought this one seemed a little bit too easy. I usually find most of the problems hard. Even the "easy" ones. I was a bit confused by the fact that we got the original tree. A search seemed to do the trick. I thought I got a solution pretty quickly and the analysis looked good but then I noticed the memory. I am apparently not doing good with memory usage at all. 

I didn't have much time that day so I didn't get to work on a better solution or the follow-up question.

I can only assume we can use the original tree in some way to speed it up or maybe it's just my lack of python knowledge letting me down. I am bookmarking this one to come back to later. 

 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/988m6an783grxlonfyfg.gif)
The Day After Work Eve
Tags: reorient, welcomeback, takingabreak
Published: 2021-01-04 22:13:50

---
title: The Day After Work Eve
published: true
description: A few brief tips to help re-adjust to returning from holiday. From a slightly panicked Manny to your computer screen. :)
tags: reorient, welcomeBack, takingABreak
//cover_image: https://direct_url_to_image.jpg
---
{% twitter 1345896679350956032 %}

Tips to help re-adjust on the day after "Work Eve"
- Take notes the day or two before an `out-of-office`(OOO) to review when you return
  - Make it a short story
  - Make it an outline with bullets of important aspects
- Consider scheduling a few short videos calls that can be recorded (`don't forget to ask!`) to help capture and preserve `most-important-tasks` (MITs)
- Be kind to yourself and create a simple To-do list of "chores" that can be performed when starting the return "to-work-day"

example.
 ```text
1. Clear Email
2. Remove Auto Replies
3. Standup
4. Read Slack Notes
5. Drink Coffee
```
----------------------------

I took vacation starting December 14th, 2020, and have returned to work today January 4th, 2021 and it feels like forever since I was on my work laptop.

As I was pouring my morning coffee I thought to myself, "What was I working on?" and for a moment I felt a weird panic then I realized I took a few notes for myself on SublimeText before I went on vacation and also had a recorded Zoom call with my teammate prior to going on holiday.

I felt relieved.

Thanks, Past-Manny.

Signed,
Present-Manny
Building Apple-style Navigation Bar W/ Search using HTML, CSS (Sass) and Javascript (jQuery)
Tags: html, css, javascript, tutorial
Published: 2021-01-04 22:06:00

**TL;DR:** I built **Apple-style Navigation Bar W/ Search** using **HTML**, **CSS (Sass)** and **Javascript (jQuery)** which you can use for your own projects. Tutorial video and source code available.



You can find the video on YouTube below ⬇️
{% youtube 4SRZlwv0NdQ %}

*If you like the video, don't forget to smash that like icon* 👍 *and subscribe* ❤️*. It will help a lot! Thanks!* 🙏



Source code can be found on 🔗 [GitHub](https://github.com/DC989/apple-like-nav).

Follow me on:
👉 [Twitter](https://twitter.com/CajicDusan)



Thanks for reading! I hope you find it useful.

Cheers! 🍺🍺🍺
Intro to data structures part 1 Arrays
Tags: javascript, array, beginners
Published: 2021-01-04 22:04:50

**Intro**

Data can be stored and accessed in many different ways in Javascript. In part one we will look how to store, access, and manipulate data in arrays.

**How to Store Data**

To store data in a non nested array the following syntax is used:

```
let myArray = ["basketball", 1, true ]
console.log(myArray.length); // 3
```

As you can see an array can store multiple data types such as strings, booleans, and numbers. Using `.length` you can also see how many items are in the array.

A more complex array is a nested array where the array contains another array or an object:

```
let myArray = [
  [1,2,3],[4,5],"test"
]

```

**How to Access Array Data**

In an array each array item has an `index`. The index acts as the position of the item of the array. Every array index starts at zero and is increased by one. To access the array item we use console.log, followed by the array variable name, followed by a bracket with the index inside:

```
let myArray = ["Robert","Tom","Megan"];

console.log(myArray[0]) // Robert
console.log(myArray[1]) // Tom
console.log(myArray[2]) // Megan
```

You can also set an item in an array using `bracket notation`:

```
let myArray = ["Robert","Tom","Megan"];

myArray[1] = "Tommy"

console.log(myArray) // [ 'Robert', 'Tommy', 'Megan' ]
```

**Add Items to an Array with push() and unshift()**

`Array.push()` and `Array.unshift()` are methods used to quickly add items to an array. `Array.push()` adds to the end of an array while `Array.unshift()` adds to the beginning of an array:

```
let myArray = ["Robert","Tom","Megan"];


myArray.push("Bobby")
myArray.unshift("Dwight")

console.log(myArray) // [ 'Dwight', 'Robert', 'Tom', 'Megan', 'Bobby' ]
```

**Remove Items from an Array using pop() and shift()**

If you would like to remove items from the end of an array use the `Array.pop()` method, while using the `Array.shift()` method to remove items from the beginning of an array:

```
let myArray = ["Robert","Tom","Megan"];

myArray.pop() // "Megan"

console.log(myArray) // [ 'Robert', 'Tom' ]

myArray.shift() // "Robert"

console.log(myArray) // [ 'Tom' ]
```

**Conclusion**

You are now set to create, access, and modify arrays. In part 2 we will look at more complex array manipulation, including how to copy arrays.
>~greetings 
Published: 2021-01-04 22:04:26

Hi, I'm Alex from San Francisco. I consider myself a student for life. I love to learn.

I'm currently learning some python machine learning because ML really interesting to me. I still consider myself a beginner in python since there's a lot to learn. It's hard for me to stay focused when I'm learning, there's always something else to learn and I spin away trying to learn new things. The hardest part is learning something all the way through.

I'm happy that this place exists where people can help each other out since no one is a master at everything, we're all just passing thru this thing called life.

I love traveling (except for now) and classical music (but also indie/alternative/synth pop/rock music on spotify). I play classical music on violin and piano for fun and just for myself. It's my therapy from looking at code and documentations. I also love to write screenplay scripts for fun on Final Draft, especially spec scripts (screenplays for the fun of it) of my favorite tv show: #Community. And I do my own stories for the heck of it.

I'm also currently setting up a youtube channel. I've noticed that if you want to get good at something (retaining all the knowledge/skills), you have to teach it to other people by teaching yourself as well. And by teaching other people, you understand more of the concepts.

Anyways, good meeting all of you!

-AJ
The 'one weird trick' of better coding - take breaks
Tags: watercooler, skills, video, discuss
Published: 2021-01-04 21:49:35

---
title: The 'one weird trick' of better coding - take breaks
published: true
description: 
tags: watercooler, skills, video, discuss
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/jv5msssq3ntwc29ipd8y.jpeg
---
*cover image by [Alexandra Sora](https://commons.wikimedia.org/w/index.php?curid=78763661)*

Better than stack overflow, better than mentorship, better than pairing, better than a four year comp sci degree and parents who coded on the Apollo missions: taking breaks is the secret to writing better code.

{% youtube Oc8YdqjHZk8 %}

Above all, stepping away from your desk when you are stuck gives your mind the chance to work over the other aspects of a problem. Ask for help! Study! Do the other things that help you, but never ever forget to take breaks!

How do you get through roadblocks? Let me know in the comments!
ADF-Mapping Data Flows Debug Mode
Tags: mappingdataflows, debuggingadf, adfinterview, adfinterviewquestions
Published: 2021-01-04 21:43:26

Azure Data Factory mapping data flow's debug mode allows you to interactively watch the data shape transform while you build and debug your data flows. 

1.The debug session can be used both in Data Flow design sessions as well as during pipeline debug execution of data flows.

2.When Debug mode is on, you'll interactively build your data flow with an active Spark cluster. The session will close once you turn debug off in Azure Data Factory. **You should be aware of the hourly charges incurred by Azure DataBricks during the time that you have the debug session turned on**.

3.If you have parameters in your Data Flow or any of its referenced datasets, you can specify what values to use during debugging by selecting the **Parameters tab in Debug Settings.**

4.**File sources only limit the rows that you see, not the rows being read.** For very large datasets, it is recommended that you take a small portion of that file and use it for your testing. You can select a temporary file in Debug Settings for each source that is a file dataset type.

5.**When running in Debug Mode in Data Flow, your data will not be written to the Sink transform.**A Debug session is intended to serve as a test harness for your transformations.

6.When unit testing Joins, Exists, or Lookup transformations, make sure that you use a small set of known data for your test. You can use the Debug Settings option above to set a temporary file to use for your testing. This is needed because when limiting or sampling rows from a large dataset, **you cannot predict which rows and which keys will be read into the flow for testing.** The result is non-deterministic, meaning that your join conditions may fail.

7.When executing a debug pipeline run with a data flow, you have two options on which compute to use. You can either use an existing debug cluster or spin up a new just-in-time cluster for your data flows.
Using an existing debug session will greatly reduce the data flow start up time as the cluster is already running, but is not recommended for complex or parallel workloads as it may fail when multiple jobs are run at once.
What Always Gets Me...
Tags: codenewbie
Published: 2021-01-04 21:39:49

Invariably when I am trying to do something that is new(ish) and that I don't understand it entirely, when I look up how to do it I run into the overly common roadblock of finding advice from experts that gloss over some necessary details.

30 minutes pass (sometimes hours!) then finally success is achieved after all of the various permutations of what could have possibly been missed in translation are tried and finally...I have the results I need.

*sigh*

And then, of course, I don't help the situation (because time is fleeting) by leaving those needed clarifying tidbits for the next wayward code newbie on their journey of finding an answer to their problem.

Tallyho.
mnm client v0.9
Tags: security, opensource, go, javascript
Published: 2021-01-04 21:37:28

mnm client v0.9 is released. Download for MacOS, Windows, Linux at 
  https://mnmnotmail.org/#quick-start

The __mnm__ open source project is building a legitimate email replacement — n-identity, decentralized, store-and-forward, simple protocol, open source. Contributors welcome!

Follow: [Twitter](https://twitter.com/mnmnotmail), [DEV](https://dev.to/mnmnotmail)
_\#banSMTP_