teleren/devto huggingface dataset:
ASP.NET MVC 5 Create Shared Layout Razor & ViewStart
Tags: csharp
Published: 2019-10-12 02:48:55

In article, I have shared way create Layout Razor and ViewStart in ASP.NET MVC 5, we can configuration the interface layout for the website
+ Views/Shared: you need create Shared foler in View directory. Shared folder, using display View in multiple Controller, using Configuration the interface for the website
You to Views/Shared directory, create new _LayoutPage1.cshtml file and pass the following below code
![ASP.NET MVC 5 Create Shared Layout Razor & ViewStart](https://thepracticaldev.s3.amazonaws.com/i/wnnu2ip0zpji3st1g9wc.jpg)
```html
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
</head>
<body>
    <div>
        @RenderBody()
    </div>
</body>
</html>
```
The @RenderBody():using display content in multiple controller to View
Example you can fixed (Header/Footed) the interface for the website, only change content in RenderBody(), (header/footer) is not change
```php
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
</head>
<body>
    <div class="header">
        <!--code header fixed-->
    </div>
    <div>
        @RenderBody()
    </div>
    <div class="footer">
        <!--code footer fixed-->
    </div>
</body>
</html>
```
So you have fixed the (header/footer) for the website. 
Okay, you need using _LayoutPage1.cshtml, so you to Views/Home/index.cshtml opent it, pass the following below code
```html
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutPage1.cshtml";
}
```
Okay, You are create layout razor success!

+ _ViewStart.cshtml: used to define the layout for the website, you can set the layout settings as well, if HomeController using Layout _LayoutHome.cshtml or AdminController is _LayoutAdmin.cshtml

```php
//Views/ViewStart.cshtml
@{
    Layout = "~/Views/Shared/_LayoutPage1.cshtml";
}
```

You can configuration _ViewStart.cshtml the following below code:
```php
@{
    
    string CurrentName = Convert.ToString(HttpContext.Current.Request.RequestContext.RouteData.Values["Controller"]);
    string clayout = "";
    switch (CurrentName)
    {
        case "Home":
            clayout = "~/Views/Shared/_LayoutHome.cshtml";
            break;
        default:
            //Admin layout  
            clayout = "~/Views/Shared/_LayoutAdmin.cshtml";
            break;
    }
    Layout = clayout;
    
}
```

![ASP.NET MVC 5 Create Shared Layout Razor & ViewStart -  hoanguyenit.com](https://thepracticaldev.s3.amazonaws.com/i/u8q009ha5i0uhew2oj59.png)

You can run browser:
**http://localhost:49763/Admin/Index** or **http://localhost:49763/Home/Index**

Post:
+ [ASP.NET MVC 5 Create Shared Layout Razor & ViewStart](https://hoanguyenit.com/aspnet-mvc5-create-shared-layout-razor-and-viewstart.html)
+ [ASP.NET MVC 5 Hello World](https://hoanguyenit.com/aspnet-mvc5-hello-world.html)
[git] change remote repository url
Tags: git
Published: 2019-10-12 02:05:00

---
title: [git] change remote repository url
tags: git
published: true
---

## 🤔 Situation
- changed remote repository url
- changed GitHub user name

## 👍 Solution for a few repositories
```sh
git remote -v
git remote set-url origin git@github.com:new_name/repository_name.git
git remote -v
```

## 🦄 Solution for many repositories
```sh
echo "git remote set-url origin git@"$(git remote -v | grep fetch | cut -d ' ' -f 1 | cut -d '@' -f 2 | sed -e 's/old_name/new_name/g') | bash
```

If `remote -v` shows multiple remote repositories, i.e. origin, github, gitlab.., please adjust the grep command.


## 🔗 Parent Note
{% link n350071/my-git-note-5259 %}
Start.
Published: 2019-10-12 01:52:46

Hello, world.

Saturday twelfth. I decided to make a new medium, where I documenting my journey pursuing a new career.

My plan is following p1xt's guide, improving the fundamentals and become more of an "engineer" than just a "coder", be a better creator than just a curator.

My name is Fierdy Pandu, and I commit myself to go down this career path, as a software engineer.
Gherkin Dialects
Tags: cucumber, bdd, softwaredevelopment, selenium
Published: 2019-10-12 01:47:07

---
title: Gherkin Dialects
published: true
description: This post introduces Gherkin Dialects supporting over 70 spoken languages for expressing the behaviour of the software  
tags: cucumber, bdd, software development, selenium
---

One of the core principles of Behaviour Driven Development (BDD) is having meaningful conversations to describe the behaviour of the software with concrete examples.

> …having conversations are more important than capturing conversations is more important than automating conversations. – [Liz Keogh](https://lizkeogh.com/2014/01/22/using-bdd-with-legacy-systems/)

BDD practitioners have a choice to select a language that is commonly used and understood by the team to describe the behaviour of the software.

Gherkin, the ubiquitous language used by BDD practitioners to describe the behaviour of software, has been translated to over 70 languages.

In order to allow Gherkin to be written in a number of languages, the keywords such as Feature, Background, Scenario, Scenario Outline, Given, When, Then, And, But, Examples have been translated into multiple languages.  Find more about the languages supported by Gherkin and keywords translated in these languages at [https://cucumber.io/docs/gherkin/reference/#overview](https://cucumber.io/docs/gherkin/reference/#overview)

Some of these keywords have more than one translation to improve readability and flow.

Let’s take a personal loan calculator application. The feature and scenario are described in the English language as below:

![Feature in English](https://thepracticaldev.s3.amazonaws.com/i/ql54ai5coowodg8qirqh.png)

Now, let’s translate the behaviour of a personal loan calculator in Hindi (one of my native languages):

![Feature In Hindi](https://thepracticaldev.s3.amazonaws.com/i/stxnlh5wwth3q5at7nwm.png)

##Automating conversations with Cucumber

Cucumber framework, the widely used tool by BDD practitioners supports Gherkin dialects.

A `# language:` header on the first line of a feature file tells Cucumber what spoken language to use while generating step definitions. 

To automate this feature and scenario, Cucumber will generate step definitions in the selected language. In this example, it uses Hindi as shown in below code:

![Cucumber-JVM Step definitions](https://thepracticaldev.s3.amazonaws.com/i/1okcs5td32wqb6ruiaz3.png)

In this case, both Cucumber and Java support internationalization and example is automated with Selenium WebDriver, navigating to the Hindi version of the personal loan calculator and checking the behaviour of the software.

Along with Java, the Gherkin dialect (i18N) support is available in supporting programming languages such as Ruby, Python, Go, DotNet, etc.

The working example is available in GitHub Repo [https://github.com/upgundecha/cucumber-gherkin-hindi
](https://github.com/upgundecha/cucumber-gherkin-hindi)
Top 10 Workstation Every Developer Likes
Tags: develop, design, computerscience, javascript
Published: 2019-10-12 01:43:09

Considering developers spend so much time at your desk, it’s important to create a space that not only works for you and aids your productivity but is also an area you actually enjoy being in. Yes, here’s an awesome collection of items, accessories and other things that developers recommended for a sweet desk setup: 

# 1. One Monitor
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/oz2rzfcez2ac12xpu872.jpg)


# 2. One Vertical and Two Horizontal
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ccwk6z9buo37osy5t6tx.jpg)

# 3. Neon Light Desktop
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/zjbns5yi9rt95a9ado4u.jpg)

# 4. Three Monitors in Studio
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/wpqhpltl1oj55gf3ayft.jpg)

# 5. One iMac and Macbook Pro and Mac Display
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/eew7fftvughyidv7dj16.jpg)

# 6. One foot long Monitor with Mac
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/vv8sub3l60ghdc7y8x5u.jpg)

# 7. One Mac Display plus Macbook Pro
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/cfd14rsvn4oyngapb7u1.jpg)

# 8. One Surface plus blend Display
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/4lafb66ek7lc4ps4hs8h.jpg)

# 9. Three Vertical Setup Monitor 
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/c6ugz0ids1dix0kwjzz0.jpg)

# 10. Two Dell Display plus one iMAc
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/93al6dpzbysft5wxouxy.jpg)

Leave your comment or which one you like the best.
Python Training Kit!
Tags: python, training, teachers, students
Published: 2019-10-12 00:20:17

If you want to learn, review or teach the Python programming language, download our python training kit from https://www.siraoops.com today!  The full version of our program has over 400 exercises.  This includes complete instructions for the exercises and the program code.  This is a valuable resource for those who use the Python programming language.  All of the exercises are listed by category or program name.  

The Python Training Kit contains many interesting and unique exercises.  All of the instructions and exercises were prepared by our staff.  Check it out today!

John Sirabella
www.siraoops.com

Click on the downloads tab to get your copy of this program today!
Install Fonts in Linux
Tags: dotfiles, font, linux, unix
Published: 2020-01-15 15:39:39

---
title: Install Fonts in Linux
published: true
date: 2019-10-12 00:00:00 UTC
tags: dotfiles, font, linux, unix
canonical_url: https://tech.serhatteker.com/post/2019-10/install-font-linux/
---

There may be different directories on different systems/distributions to install your fonts.

To get the list of font files and paths that your OS uses:

```sh
$ fc-list -f '%{file}\n' | sort
```

If we take Ubuntu as an example, paths will be like:

* `~/.local/share/fonts/` — fonts for particular user, local user
* `/usr/local/share/fonts/` — fonts for all users, systemwide

Copy your fonts under one of the directories above and reboot the system. If you don't want to reboot, cache them manually by running:

```sh
$ sudo fc-cache -fv
```

Also many fonts are packaged for Ubuntu available via the "Fonts" category of the "Ubuntu Software Center". If you prefer `apt-get`, search for packages starting with "otf-" or "ttf-" and install them.

You can also double-click on the font file (or select "Open with Font Viewer" in the right-click menu). Then click the "Install Font" button.

After installation you can confirm they are installed correctly:

```sh
$ fc-list | grep <name-of-font>
```

You may need to restart some programs, like Visual Studio Code, before they actually show the new fonts. Usually such programs are caching the font list when they start up.

OK, All done!
KubeAdvisor helps DevOps adopt best practices for Kubernetes
Tags: kubernetes, docker, devops, productivity
Published: 2019-10-11 23:47:43

KubeAdvisor helps teams adopt best practices to accelerate the adoption of Kubernetes, and optimize their existing stack, with machine learning. KubeAdvisor scans K8s to make infrastructure and cloud-native applications reliable, resilient, and observable.

If interested learn more here at https://docs.magalix.com/docs/your-first-recommendations
A [Very] Simple Approach to Pointers in Go
Tags: go, pointers, beginners
Published: 2019-10-11 23:45:04

This is in no way an all encompassing view on pointers, and there are one or two areas where the explanation in this post doesn't quite cut the mustard, but I found it much easier to view pointers in this way, so thought I'd share.

Pointers can be tricky to understand. They are used mostly when we want to **overwrite** some data, rather than using Go's inbuilt actions of making a **copy** of some data once we decide to modify it (by default, Go passes by value). 

Anything which is a **value** type will utilise Go's inbuilt copying functionality, in order to preserve the data. Anything which is a **reference** type object will be modifiable and will overwrite original data.

`&` refers to the address of a value
`*` refers to the value at that address

For example;

```go
package main

import "fmt"

type house struct {
	occupant string
}

func (houseLocation *house) changeTenant(newTenant string) {
	(*houseLocation).occupant = newTenant
}

func main() {
	bensHouse := house{occupant: "Ben"}
	fmt.Printf("The tenant is: %v \n", bensHouse)
	houseAddress := &bensHouse
	fmt.Println("Changing tenant.....")
	houseAddress.changeTenant("Paul")
	fmt.Printf("The tenant is: %v \n", bensHouse)
}
```

Let's start with the **main** block.

bensHouse is of `type` *house* and has one occupant, me (Ben).

Now, my landlord owns 100 houses (he lives on a tropical island, drinking cold beers all day). The rental agency cannot ring him and say "there is an issue with Ben's house", he doesn't know which one that is! Instead, they have to get the address of my house, they do that using `&bensHouse`. 

So, the value at houseAddress might now be:

35 Winecask Road
Richmond
Melbourne
3012
Australia

The rental agency needs to change the tenant, as I'm moving out. They do that by running the `changeTenant` function on the address of the house.

They pass my address (`houseAddress`) in to the `changeTenant` function, which expects to be passed an address (`houseLocation`) of the **type** *address of a house* (`*house`); when we pass a function something of type `*`, that function expects a description of that type, which in this instance is the address of the house. 

```go
(*houseLocation).occupant = newTenant
```

We want to change the values of the house, so we access the `value` at the address we passed to the function (`bensHouse{occupant: "Ben"}`) and change the tenant to be the `newTenant`, in this case, Paul.

```
> go run main.go
The tenant is: {Ben} 
Changing tenant.....
The tenant is: {Paul} 
```
🥳 Top 10 projects I wish existed (and I could work on)
Tags: webdev
Published: 2019-10-11 22:55:26

These are my career goals from this month. What do you want to do when you grow up?

🚗 An in-car proximity based web shopping experience (great for parking your car and crashing your car).
💪 A fully web based os that was actually successful.
🌌 Smart mirror home assistant
🚜 Universal Automotive UI OS
🛸 Hacking an alien space craft to save the world with Will Smith
🚛 A commercial vehicles configorator
🏚️ Theme park VR thing
🏎️ Games, all of the games!
🧬 Crisper.js
☠️ Robots with emotions
Day 10 : The Life
Tags: hiphop, code, coding, lifelongdev
Published: 2019-10-11 22:40:57

_liner notes_:
- Professional : Pretty much got the last feature worked out on the project assigned to me on Monday. It requires some reformatting of some of the code I already wrote, but it wasn't much. I kind of left it open to be able to be do that. Still need to figure out how I can get both the React app and the Express app working in one Glitch project. Also got to attend a DevRel happy hour hangout thing that the team does every Friday. Cool chance to talk with everyone outside of work.

- Personal : Totally forgot that I am writing these blog posts in the evenings now and for some reason thought last night was the last post for this week. Today, got my laundry done earlier and started putting together tomorrow's radio show. Digging the remote life.

![Photo of the Mountains in Silverton, CO, United States](https://thepracticaldev.s3.amazonaws.com/i/6slni0ehg2f08h0flfon.jpg)

Plan for the weekend is still the same. Radio show on Saturday. Coding and Anime on Sunday.


Again, have a great weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube CkrdiABTcaI %}
WordPress Fallback CSS
Tags: wordpress, css, javascript, customproperties
Published: 2019-10-11 22:24:10

I'm writing a WordPress theme. In it, I make liberal use of [custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/--*). I don't want to completely leave IE users in the cold, so as part of my build process I'm using a modified `postcss-css-variables` to generate fallback values.

I initially baked all this into the stylesheet, but that proved excessive. Plus, I don't want to penalize users of modern browsers. So now I'm building two stylesheets as part of the build process: one which uses custom properties, and one which contains static, fallback values. The question now is how best to load the best one for each user.

I rather like the approach that the folks at CodyHouse use for their [framework](https://github.com/CodyHouse/codyhouse-framework):

```html
<script>
  if('CSS' in window && CSS.supports('color', 'var(--color-var)')) {
    document.write('<link rel="stylesheet" href="assets/css/style.css">');
  } else {
    document.write('<link rel="stylesheet" href="assets/css/style-fallback.css">');
  }
</script>
<noscript>
  <link rel="stylesheet" href="assets/css/style-fallback.css">
</noscript>
```

Unfortunately, it's not possible using WordPress's `wp_enqueue_style` method to load a stylesheet inside a noscript tag. The approach I'm taking right now is the reverse of the above: I'm loading the modern stylesheet by default, then running some js to detect browsers that aren't supported:

```js
if ( ! ( 'CSS' in window && CSS.supports('color', 'var(--color-var)') ) ) {
	const css = document.getElementById( 'screen-css' );
	css.href = css.href.replace( 'screen', 'screen-fallback' );
}
```

This will replace the stylesheet with the fallback if custom properties are not supported. This results in no change of experience for modern browsers (aside from a little snippet of js), while IE users will get a brief [FOUT](http://www.paulirish.com/2009/fighting-the-font-face-fout/) while the stylesheets are swapped.

So given the limitations of how WordPress loads stylesheets, can this be improved?
Storybook : develop React components in isolation | Part-1
Tags: react, storybook, design, designsystem
Published: 2019-10-11 21:51:24

Storybook is a tool for developing UI components.

The tool enables developers to create components independently and showcase components interactively in an isolated development environment.

Storybook runs outside of the main app so we can develop UI components in isolation without worrying about app specific dependencies and requirements.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/cw8750i7h5khytioofow.png)

After running, Storybook looks like this :point_up:
Here, `Button` is a component.

We will see how we can setup Storybook application for React components.
I will use CRA(create-react-app) tool to bootstrap the react app with webpack build and enable Storybook to it.

If you already have `npm` installed on your machine, then you can run
```npx create-react-app sb-ui```

After running successfully, we will see the simple react app created.

Now we will enable Storybook to this app. For this, I will run-
```npx -p @storybook/cli sb init```

After executing, if we open our app with VSCode( or any editor ) we will see -
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/wlecmp8musolekk0v2nn.png)
`.storybook` directory was created and it has 2 files.
Also if we check package.json file, we can see 2 commands were added in scripts section-

```javascript
"storybook": "start-storybook -p 9009 -s public",
"build-storybook": "build-storybook -s public"
```

Now, we can run `yarn storybook` or `npm run storybook` and it will open the Storybook app in the default browser.
Awesome :tada:
Now our fresh Storybook app is up and running.

`.storybook/addons.js` file is used to keep all the addons we use for the Storybook(I will talk about addons in one of the later parts).

`src/stories/1-Button.stories.js` file has 2 sample test stories to show how we can add stories(it was added by Storybook tool)

```javascript
export const text = () => <Button onClick={action('clicked')}>Hello Button</Button>;

export const emoji = () => (
  <Button onClick={action('clicked')}>
    <span role="img" aria-label="so cool">
      😀 😎 👍 💯
    </span>
  </Button>
);
```

Here :point_up:,`Button` is the sample react component which is used to see inside Storybook UI.

In Part-2, I will show how to create a new component and add it to Storybook.

Till then, Cheers!
:wave:

UPDATE: [<b>Storybook : develop React components in isolation | Part-2</b>](https://dev.to/destro_mas/storybook-develop-react-components-in-isolation-part-2-gn)

As I am trying to contribute contents on the Web, you can buy me a coffee for my hours spent on all of these ❤️😊🌸
<a href="https://www.buymeacoffee.com/destromas" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>

My Blog: https://shahjada.me
The simplest way to mimic HTMLEncode in your browser
Tags: javascript, html, encode, decode
Published: 2019-10-11 21:21:07

I was working on a simple textarea based input field with a preview-feature the other day and got to a point where I wanted to render the HTML written in the textarea as written, not parsed as HTML. I was mildly surprised to see that JavaScript did not have it included by default, unlike PHP and most other server-side languages.

Looking into the issue I discovered a trove of plugins and modules for solving the matter, but that felt a bit heavy handed for my use case. I wanted something simple, fast and really small.

Doing some more research and playing around, I discovered someone who used built-in features of the browser to sole the problem, in a most ingenious way using jQuery. That library was totally unneeded for the job though, and I present to you the "vanilla" version.

Behold:
```javascript
function htmlEncode(input) {
  var el = document.createElement("div");
  el.innerText = input;
  return el.innerHTML;
}
```

And the inverse:
```javascript
function htmlDecode(input) {
  var el = document.createElement("div");
  el.innerHTML = input;
  return el.innerText;
}
```

Be aware though that this encodes everything HTML-related, so if you are using this on a Markdown-source, you will break your block-quotes. 

Thank you for your attention!

-Morten