teleren/devto huggingface dataset:
Road to Genius: superior #57
Tags: javascript, beginners, computerscience, codenewbie
Published: 2020-07-22 20:07:26

Each day I solve several coding challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, and you will learn a ton of new and interesting things as you go.

```JS
function swap(arr, [i, j], [m, n]) {
  const temp = arr[i][j];
  arr[i][j] = arr[m][n];
  arr[m][n] = temp;
}
function rotate(M) {
  const n = M.length;
  for (let i = 0; i < n - 1; i++) {
    for (let j = 0; j < n - i; j++) {
      swap(M, [i, j], [💚 - 💰 - 💎, n - i - 1]);
    }
  }
  for (let i = 0; i < n / 2; i++) {
    for (let j = 0; j < n; j++) {
      swap(M, [i, j], [n - i - 1, j]);
    }
  }
}
let M = [[8, 1, 1], [8, 8, 7], [8, 6, 4]];
🐼(M);
let A = M[2][0];

// 💎 = ? (number)
// 💰 = ? (identifier)
// 💚 = ? (identifier)
// 🐼 = ? (identifier)
// such that A = 4 (number)
```

We've encountered this code before several episodes ago; it's all about rotating a matrix by 90° clockwise. This time we have to fix four bugs to complete the challenge. We can either cheat by looking at the code from several posts ago, or solve it the hard way (which is quicker actually).

The first three bugs appear on the same line:
```JS
swap(M, [i, j], [💚 - 💰 - 💎, n - i - 1]);
```
The first two for-loops are rotating the matrix by 90° but their column-order won't be respected (that's what the last two for-loops are for). The bugs should be the same as its neighboring index:
```JS
swap(M, [i, j], [n - i - 1, n - i - 1]);
```
The final bug 🐼 should be a call to the function `rotate`.

![coding challenge answer](https://dev-to-uploads.s3.amazonaws.com/i/fv6guyhga8mj77zt4mii.png)

By solving these challenges you train yourself to be a better programmer. You'll learn newer and better ways of analyzing, debugging and improving code. As a result you'll be more productive and valuable in business. Get started and become a certified Codr today at https://nevolin.be/codr/
Make own Angular Searchable Component
Tags: angular, typescript, javascript, beginners
Published: 2020-07-22 20:04:44

One of my last assignments was to develop generic method to make components and templates searchable in our application. In this article, I will walk you through the process and ideas behind the decisions I made along the way.

![enter image description here](https://miro.medium.com/max/1250/1*vO046PldWNBQduGukMWcwQ.png)

As always, just to get a taste of what I’m talking about let’s first see a nice visualization of the final result:

![enter image description here](https://miro.medium.com/max/875/1*4NCCcoC121UGmrqKZtwd0A.gif)
And the markup for the code:

    <input [formControl]="searchControl">
     
    <searchable-container [searchTerm]="searchControl.value">
    
      <ul>
        <li searchable="Javascript" searchableHighlight></li>
        <li searchable="Angular" searchableHighlight></li>
        <li searchable="Typescript" searchableHighlight></li>
        <li searchable="RxJS" searchableHighlight></li>
        <li searchable="Akita" searchableHighlight></li>
      </ul>
      
    </searchable-container>

 You can full tutorial [How to Create own Searchable Component in Angular?](https://www.dasjs.com/create-own-searchable-component-in-angular/)
 There is a task for you when you complete this tutorial if you accept my challenge.
Who am I?
Published: 2020-07-22 19:42:39

#Hello!

![Angel Berlanga's logo](https://dev-to-uploads.s3.amazonaws.com/i/4jvkbdfozose7m5ljz8t.png)

I'm **_Angel Berlanga_**, and I'm a **_web developer_**.
(Here's my [GitHub](https://github.com/EddyBer16/))

I code as a hobbie, but I'm gonna start my career at high school the next month.

I love **JavaScript** and **React.js**, and this summer I'm learning **android** development.
For example, I'm learning new stuff of **Java** and **Kotlin** for Android development, then I'm gonna practice **dart** for **flutter**.
I think maybe I'm gonna use **React Native** in some occasions, but I'm not sure.

Also I want to improve my **English**, because I'm Mexican and maybe my English is not too good as a native, but I'm doing my best :)

Thanks for reading and I'll try to write more posts here :D
I'm open for some tips or recommendations, thank you so much :D
Typora: The best notebook
Tags: tyora
Published: 2020-07-22 19:27:49

Things which make Typora the best notebook for a laptop/computer user are as follows:

### 1. Markdown Support
When it comes to computer-notebook, markdown is the simplest and most efficient language ever made. And Typora supports it.


### 2. Live Markdown Preview feature
According to me, this is the best feature Typora have.
In almost all markdown editors (online or offline), you have to first write the content in markdown language, then click on preview to see how the file looks.
But Typora, you write see the preview same time you are writing your notes.
![Typora-Live_preview](https://dev-to-uploads.s3.amazonaws.com/i/8cq793itsf5lfqdem1ul.gif)
Now, you can use it just like other online editors such as OneNote, Dropbox-Paper or Google Docs.

### 3. Outline Tab
For each file, you can use "outline" tab besides file-structure inside current folder, which helps to find and organize contents according to the heading (#, ##, ###) hierarchy in the current file very easy.


### 4. Minimalist Design
Typora is created considering minimalist design, so that you can focus more on what you are writing.


### 5. Themes
For now, Typora supports very few themes (including Night-themes), but each theme is unique and beautiful which are enough for Good User Experience.


### 6. Free to use
For now, Typora is completely free to use. In future, even if you want to leave, there is nothing to loose, just get your "markdown-files" and place it in another markdown-editor of your choice.


# Extra Feature - Google Drive Sync
This is not built-in Typora, but you can use it as General.
You can connect your 'folder of notes' in computer with [Google drive](https://www.google.com/drive/download/) and now each line you typed will instantly get synced with Google Drive, this will prevent your notes from 'accidental data loss'.

# Note
Typora is the best "notes-app" I ever find for desktop (both in online and offline market), so if you find better app than this, then let me know, the comment box.
I already tried:
- Online => Evernote, OneNote, Google Docs, Dropbox Paper, StackEdit
- Offline => BoostNote
Configuer - a small Rust lib to for configuration management in your next project
Tags: rust
Published: 2020-07-22 19:22:23

Hi, really often situation in our Rust projects is when we must save some data (eg. user preferences, configuration data) and read them in the next launch of our app. Of course, we could save them to matching files and nextly read them but there is a little bit code boilerplate. I front with this problem a few times so I wrote [Configuer](https://crates.io/crates/configuer). With this lib, you can just create a struct that representing your data model, nextly you can manipulate data and save them. It's really simple. Just look at the code:
```rust
use configuer::Configuer;
use serde::{Deserialize, Serialize};

// Model must implement Serialize, Deserialize, CLone and Default. Debug is unneeded
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
struct MyData {
    opens: usize,
}

fn main() {
    let mut config = Configuer::<MyData>::with_file("myIniFileName");

    println!("You opened my app {:?} times", config.data.opens);

    config.data.opens += 1;
    config.save();
}
```
As you can see, it's very simple. myIniFileName is the name of your config data. By default Configuer using `dirs` crate and places the config file in the user home directory. You can change it through disable default features (then config file will be written just in your work dir).

You can set an `on_create` hook.

```rust
use configuer::Configuer;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Clone, Default)]
struct MyData {
    user_name: String,
}

fn main() {
    let mut config = Configuer::with_file("myIniFileName").on_create(|| {
        println!("I see you open this app very first time, please pass your name: ...");

        MyData {
            user_name: "Default user name".into(),
        }
    });

    println!("{:?}", config.data);
    config.save();
}
```

Now when the user opens our app for the first time, he will be asked about the name. Later when function returns data, it will be saved as default.

Tell me what do you think, and what could I add :D
https://crates.io/crates/configuer
https://github.com/Milesq/configuer
Weeks 8 & 9: Wrapping up my second internship
Tags: career, beginners, internship, ux
Published: 2020-07-22 19:17:55

# **HAX**
During weeks 8 & 9, I continued my work with creating the current information architecture of HAX. I have utilized some of the resources I worked with at Valley Bank, such as Miro, and brought them to use in my work with HAX. I have created a Miro board for the menu project I am working on. So far, the board has a plan/schedule, UX/UI overview, information architecture (with and without pictures), user interview insights, and user personas. I am planning on housing all of my ideas in Miro so that everything is located in one place.

![HAX Menu Miro Board](https://dev-to-uploads.s3.amazonaws.com/i/st1ql2dbeaatvkrt804f.png) 
![Board Closer Look](https://dev-to-uploads.s3.amazonaws.com/i/8wfvtkc9ecsbvr4dhl0k.png)


> Above is a screenshot of the board with all of the different components. I am thrilled with how it’s coming along so far and excited to keep on adding stuff to it 

As you may or may not know, I plan to document every step I take in the [UX/UI Menu Fix](https://dev.to/saracunn/wireframing-backtracking-22mk) series I made. I haven’t been updating it as regularly as I hoped to, but I plan to get back into that. So if anyone is interested in reading a more detailed procedure, then I recommend checking it out!

{% link https://dev.to/saracunn/wireframing-backtracking-22mk %}

# **Valley Bank**
Concluding my second to last week, I didn’t start any new projects since I didn’t have much time left. It’s pretty crazy to see that my time is up at Valley Bank. The internship was for only about a month, which is pretty short, but I learned so much. The last project I did was create a slide deck that I would present in my final week during the weekly stand up. In the presentation, I talked about my little knowledge of product management and the information I have learned from my time at Valley Bank. I broke the presentation down by projects, going through each project I worked on and what I learned. I also mentioned all of the new resources I became familiar with, like Miro, User Testing, Azure, and Kontent. I worked with new tools, but I improved myself and added traits/skills to my profile like empathy, collaboration, and self-management. I wrapped up the presentation by talking about my future as a student and my plans for going into a new career. 

![Valley Bank Final Presentation](https://dev-to-uploads.s3.amazonaws.com/i/r7cjlc8ymzqpr3shklen.png)
> Some slides from my final presentation at Valley Bank



Finishing up the internship, I am pleased with how much I learned in a short amount of time. There were some ups and downs during the internship, but I gained new insights and met amazing people. I will be bringing so much of what I learned into classes and my career. All in all, ending the internship makes me even more eager to start a career in product management/development.
Middleware
Tags: 100daysofcode, javascript
Published: 2020-07-22 19:16:28

Middleware is like a middle man in a business transaction, the only difference is middleware saves us time and money unlike middle men. It's a term coined to refer code that executes in between sending a request to a server and receiving a response. It is one way to adhere to the DRY(Don't Repeat Yourself) software development principle.

In express we use app.use ( ) to leverage on middleware function calls. We pass an arrow function to .use ( ) that takes three parameters req, res and next where next is a callback function. The callback function fires the next operation and passes the data from the arrow function.

```javascript
app.use((req, res, next) => {});
```
So now any redundant code can be bundled up in the arrow function body, and executed in between processing the request.
Change Git user for a specific repo
Tags: github, git
Published: 2020-07-22 19:01:14

Sometimes you may work on multiple projects using multiple git users. Your personal project with your personal GitHub and office GitHub with your business email. You may need to commit like someone else 🤫. There are two options to change git author of your repository.

# 1. Change without Terminal

1. Go to your repo folder & `show hidden folders`
2. Go to `.git` hidden folder and open `config` file
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ctwycwlyjlghijpf1ly5.png)
3. Add/replace the following block in the config file
```
[user]
	name = deshan
	email = deshan [at] dev.to
```

Now you can commit a new change and check author information. 


# 2. Change with Terminal 
Open the terminal and go to the repository. Enter the following command
```
git config user.email "deshan@dev.to"
git config user.name "deshan"
```


If you want to change the author for previous commits, follow this [replace-accidentally-committed-git-author-information-from-git-history](https://dev.to/deshanm/replace-accidentally-committed-git-author-information-from-git-history-15dk)
Advising CarbonDown
Tags: startup, googlecloud, womenintech
Published: 2020-07-22 18:53:52

![CarbonDown App](https://dev-to-uploads.s3.amazonaws.com/i/4dv5e8diqqg1ftjntphd.png)

I joined the Stanford-accelerator backed startup CarbonDown as their first advisor earlier this year.  We run as a ReactNative app on GCP and are launching a public beta shortly.

Read my short account - https://www.carbondownapp.com/post/advising-carbondown
Should I attend each & every training in my office❓
Published: 2020-07-22 18:46:56

Today I came up with this topic because I observed that a lot of people don't want to attend training programs organized by their firms and only a handful show interest. 

I guess a lot of people have surplus money to splurge on paid training programs and give the free training programs organized by their offices a miss. Sometimes, even if it is useful for them, they find reasons not to attend. 

They either make excuses or convince themselves by saying: 
a) it's not for us 
b) we've already learned a lot 
c) we're satisfied with the work we are doing. 

**Category one people:** 
A company announces training on advance react. People who know the basics of this topic will think it is advanced and even if I attend this, they won't be able to understand anything, so they skip it 😐

**Category two people:** 
Wow! the company is providing training on advance react. I already know the basics and whatever this session covers will benefit me. I will get to know some advanced topics as well. It will help me to get involved in react. Yeah, I will attend this.😇

In simple terms, If you don't know what you need to learn then how will you learn? Always,  try to involve in all the training programs organized by your company. Believe me, it will really help you grow.

Learning is to mind what exercise is to body. Your mind stays active when you engage it in learning something that you like. Having said this, it is not necessary that you sign up for all the training programs your office organizes. Relevance, interest, benefit, and the learning objectives are a few factors you should consider before opting for a training program. Soft skills are a completely different area and the criteria for selecting a program are very different. Most of the soft skills topics are interconnected and focus on softer aspects like personality, thinking, attitude, behavior, etiquette, and many more, hence relevance is always present for someone who wants to work on his or her soft skills and personality. In the world of soft skills, the more training programs you attend the more you learn.

What also important is protecting your learning appetite so that you can keep learning forever. Sometimes, it is recommended that you give yourself a break from learning and let your mind relax failing which you experience a loss of learning appetite. Loss of learning appetite is often a result of over or exhaustive learning. Striking the right balance is the key.

One more thing I would like to add here is please don't give an excuse such as  I am busy I don't have time to attend. Not at all! If you have time to eat, sleep, use your phone, check friend's status or stories, which are useless, then why not dedicate some time to learning. Your knowledge and skills will help you more than anyone can. Remember that.

Happy learning & attend training 😊
GitHub Profile README Showcase! 🔥
Tags: github, opensource, discuss, showdev
Published: 2020-07-22 18:31:54

In case you missed, GitHub recently launched a feature that allows users to add a README on their GitHub profiles that shows up on top of their pinned repositories. 

{% twitter 1265773172520914944 %}

To enable the feature, you'll have to create a [new repository](https://repo.new) with same name as your username and initialize it with a README.md. Then all you need to do is just edit that README according your preference - you can add anything you'd like to show off; projects, links, interests etc. ✨

I tried it out, and [here](https://github.com/marwahmanbir)'s how it looks like...

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

---

Dropping a few of the cool ones here that I recently came across:  

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

---

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

---

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

---

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

---

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

---

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

---

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

---

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

---

How did you like the idea of having a README on GitHub profiles? Did you build your profile README yet? Or did you come across any dope ones? Drop a preview in the comments below! 

Let's keep contributing to Open-Source. See you on the other side! 👋
Master your Database using C# with EF Core 5.0
Tags: dotnet, csharp, database, sql
Published: 2020-07-22 18:22:42

---
title: Master your Database using C# with EF Core 5.0
published: true
description: In this EF Core Community Standup, Microsoft engineering lead Arthur Vickers demos several of the new features available in the latest Entity Framework Core 5.0 previews.
tags:  dotnet, csharp, database, sql
---

[Entity Framework Core](https://jlik.me/h5j) is an object mapper that enables database interactions using familiar C# code. It supports multiple backend databases including SQLite, SQL Server, Oracle, PostgreSQL, MySQL and Cosmos DB. Using nothing more than LINQ queries, developers can write code that interacts with C# classes that is automatically translated into database calls.

In this episode of the [EF Core Community Standup](https://jlik.me/h5k), engineering lead Arthur Vickers walks through demos of some of the latest features that are available now in preview releases and will launch with .NET 5.0 later this year.

{% youtube 5Oow3LlFjTQ %}

Have feedback for the EF Core team? [File an issue](https://github.com/dotnet/efcore/issues/new) or join one of our many [online discussions](https://github.com/dotnet/efcore/discussions).
SDK for Private & Ethical Access to Personal Data
Tags: privacy, security, ios, android
Published: 2020-07-22 18:16:36

Hi everyone,
I am working on an SDK that allows easy and ethical access to financial, medical, health & fitness, entertainment and social media personal data.

It is available for iOS, Android & Node.js and can be used with ReactNative as well. I would love to get your thoughts and feedback on this short 10-slide deck.

https://www.slideshare.net/tarikk/digime-private-sharing-platform-sdks

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/o0cuhknqusnewq7neufa.jpg)
Install Rbenv and Ruby on elementary os, quick and dirty.
Tags: ruby, beginners, elementary, linux
Published: 2020-07-22 18:03:35

I couldn't find a solid set of instructions on how to do this so I decided to write it up quick. I did find a lot of tutorials for Ubuntu, but they seemed to encounter errors on [elementary OS](https://elementary.io). 

This is basically a lot of copy paste. I've gone through all the steps on elementary and it works like a charm. 

1. `cd`
2. `git clone https://github.com/rbenv/rbenv.git ~/.rbenv`
3. `git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build`
4. Open your .bashrc with nano `nano .bashrc`
5. make sure you type or past the following lines into the bottom of your .bashrc
```
esac
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
```
6. ctrl-o to save
7. ctrl-x to quit
6. `source .bashrc`
7. `rbenv install 2.7.1`
8. `rbenv gloabal 2.7.1`
9. Verify `ruby -v`

From here you should be able to install Rails or any other gems you wish. 

Like I said, quick and dirty. I hope this helps people so they don't have to dig around as much for instruction. 

--Cheers Tim
Simple web app to serve with go
Tags: go, tutorial, programming
Published: 2020-07-22 17:58:44

Lets us create a simple web application which will serve static files a html template using golang

Here is how the structure of my project looks like. Ignore the npm and config files.

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

Here is the full code snippets from main and handler 

*main.go*
```go
func main() {
  // parses all the html template files placed in this folder
	t := template.Must(template.ParseGlob("template/*"))
  
  // hosts the specified directory
	fs := http.FileServer(http.Dir("./ui/"))

  //maps the hosted file server to the route "/static/"
	http.Handle("/static/", fs)
  
  // moved the http handlers to a different package to keep the main clean.
  // also provided a way to pass arguments from main to handlers
	http.HandleFunc("/", handlers.Home(t))

	fmt.Println("Listening on 8000")
	fmt.Println(http.ListenAndServe(":8000", nil))
}

```

*handlers/home.go*
```go
//Home .. handles "/" route
func Home(t *template.Template) func(http.ResponseWriter, *http.Request) {
  // create a sample message struct which can be used inside the template html files
	m := Message{"Arjun", "Hello"}

  // returning a handler func
	return func(w http.ResponseWriter, r *http.Request) {
		if name := r.FormValue("name"); name != "" {
			m.Name = name
		}
    // "Execute" method will pass the message to the html template where we will use 
    // the properties of this message 
		if err := t.Execute(w, m); err != nil {
			http.Error(w, "Failed to execute the template", 500)
		}
	}
}
```

Explanations as inline comments.

Inside the html file this is how you access the properties of the model passed.

```html
<title>Hi {{.Name}}</title>
```


#### Further Reading for details on the go packages used

- [golang http package - used to create the web server](https://golang.org/pkg/net/http/)
- [template - used for passing data from the server](https://golang.org/pkg/html/template/)

*Originally Posted on [bitsmonkey](https://unrealnerd.github.io/blog/2020/07/22/handlers-with-go)*