teleren/devto huggingface dataset:
🐞 GitVersioning: 'ThisAssembly' Is Inaccessible Due to Its Protection Level
Tags: c, netcore, nuget
Published: 2020-06-28 03:35:40

---
title: 🐞 GitVersioning: 'ThisAssembly' Is Inaccessible Due to Its Protection Level
published: true
date: 2020-06-25 09:10:24 UTC
tags: c#, netcore, nuget
cover_image: https://i.insider.com/5593f5cc6bb3f7ac51d8d3cf?width=1200
canonical_url: https://bemnlam.github.io/posts/git-versioning-this-assembly-is-inaccessible-due-to-its-protection-level/
---

## 😨 Problem

After I installed the **[Nerdbank.GitVersioning](https://www.nuget.org/packages/Nerdbank.GitVersioning)** Nuget package in my .NET MVC app, the following error came out when I want to get the version using `ThisAssembly.AssemblyInformationalVersion`:

```bash
error CS0122: 'ThisAssembly' is inaccessible due to its protection level
```

I tried to install the package across all the projects in the same solution. It didn’t work.

I tried to uninstall and re-ininstall the package. It didn’t work.

## 😀 Solution

### .csproj

Turns out there is something missing in my `.csproj` file. I missed an `<Import>` tag at the end of the file, just before the `</Target>` tag:

```xml
<Import Project="..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets')" />
```

And in the `EnsureNuGetPackageBuildImports` target, add the following line:

```xml
<Error Condition="!Exists('..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets'))" />
```

In addition, the 1st `<PropertyGroup>` should contain a pair of `NuGetPackageImportStamp` tag:

```xml
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
```

### AssemblyInfo.cs

I also removed the following lines in `Properties/AssemblyInfo.cs`:

```c#
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
```

### version.json

At the root directory of the **project**, I added a `version.json` file with the following content:

```json
{
  "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
  "version": "1.0.0"
}
```

After that, `ThisAssembly` is back and I can read the git version info successfully.

###### 🔗 references:

- [https://github.com/dotnet/Nerdbank.GitVersioning/blob/master/doc/dotnet.md](https://github.com/dotnet/Nerdbank.GitVersioning/blob/master/doc/dotnet.md)
- [https://github.com/dotnet/Nerdbank.GitVersioning/issues/449](https://github.com/dotnet/Nerdbank.GitVersioning/issues/449)
- [https://github.com/dotnet/Nerdbank.GitVersioning/issues/404](https://github.com/dotnet/Nerdbank.GitVersioning/issues/404)

###### 🖼 cover image: 
[Grace Hopper’s operational logbook for the Harvard Mark II computer](https://www.businessinsider.com.au/harvard-mark-i-grace-hopper-bug-2015-7)
My Mom Uses ArchLinux
Tags: family, technology, linux
Published: 2020-06-25 09:07:54



It is almost impossible to install and operate Arch Linux without prior linux knowledge. So why does my mom use it?

[Check out my latest article for DSC VIT »](https://medium.com/gdg-vit/my-mom-uses-archlinux-e678f29b0df7?source=rss----7ebddf9721d---4)
Open git bash using `terminal` plugin for sublime
Published: 2020-06-25 09:06:38

// Terminal.sublime-settings
{
	// The command to execute for the terminal, leave blank for the OS default
	// On OS X the terminal can be set to iTerm.sh to execute iTerm
    "terminal": "C:\\Program Files\\Git\\git-bash.exe",

    // A list of default parameters to pass to the terminal, this can be
    // overridden by passing the "parameters" key with a list value to the args
    // dict when calling the "open_terminal" or "open_terminal_project_folder"
    // commands
    "parameters": ["-c", "cd \"%CWD%\" && \"C:\\Program Files\\Git\\bin\\sh.exe\" -i -l"]
}
Quicker Way to Seed Records in Laravel
Tags: php, laravel, webdev, database
Published: 2020-06-25 09:03:12

Sometimes, there might be a situation where you need to insert a lot of test data into the database. Usually for testing purposes and performance in laravel.

However, seeding huge amount of records can take exceptionally long time and is not ideal when you’re in a state where you have to frequently seed database.

So, let’s try to improve the seeding time so that we won’t have a hard time waiting for it to finish.

https://laravelproject.com/optimize-database-seeder-in-laravel-for-faster-seeding/
Colorful Glowing Effect on Hover using HTML & CSS
Tags: glowingeffect, gloweffect, csseffect, hovereffectcss
Published: 2020-06-25 08:50:10

As you can in the image, there are two objects with Colorful Glowing Effects. There is a one-button with hover me a text and one loader-circle with the same hover me text. Assuming Those two objects are buttons.

At first, those buttons are in the initial stage where there are no glow effects on it. But when you hover on it, it will be started to glowing in the background.

<a href="https://www.codingnepalweb.com/2020/05/colorful-glowing-effect-on-hover.html">Click here to get source codes</a>
How to get a Million of Machine Learning Predictions at the Tip of Your Fingers
Tags: machinelearning, javascript, beginners, opensource
Published: 2020-06-25 08:43:02

Ever wondered how innovation is born? No, light bulbs don't really illuminate above the head of geniuses when an epiphany strikes them. :)

## The Catalyst

To create such magic you always need a catalyst. Something to spark a reaction towards changing the status quo. Normally this thing is a problem, but not any kind - it must be a real-pain-in-the-butt kind of problem.

Maybe it is a manual task you do over and over again, a time-consuming and [seriously stressful](https://www.youtube.com/watch?v=DlcAjc0ka10) process that is just too expensive to alter and delays your progress. Or it could also be the impossibly high barrier of adoption for using modern technologies like Machine Learning and AI that diminishes your projects’ success.

Whatever it is, a problem becomes a catalyst when the lack of a solution gets unbearable.<br>

{% youtube 5iPnvIasmCw %}

## Machine Learning Made Simple - The Beginning

At SashiDo we couldn't bear seeing developers facing such limitations when it comes to innovation and using new technologies for solving complex problems. We firmly believe that Machine Learning technologies have evolved to the point when they can be integrated into any project without too much hassle and expenses.

It has always been our mission to simplify technologies and today we take on a new challenge - to **bring Machine Learning closer to single developers and teams of all sizes by making it affordable and accessible**.

We will start breaking the barrier to Machine Learning by introducing you to a fully open-sourced solution for Content Moderation that gives you **a million predictions at the tips of your fingers!**

Like and comment below if you're as excited as we are for creating better apps using Machine Learning.

The best is yet to come so stay tuned!
Instagram bot written in python.
Tags: python, codenewbie, devops, showdev
Published: 2020-06-25 08:38:50

# Instagram-bot
instagram bot written in python. 
it will work on hashtags.

## features

1) following section
2) Likes based on tags
3) Blacklist words function
4) Auto comment 


 ## Usage 
 
 python  bot.py
 
 make changes in credentials
 
 note- it uses firefox and selenium 
 
 if you use headless_browser=true then it will not open browser and work in background

## Github Link

https://github.com/raghavkhanna30/instagram-bot
 
 ## Speed-up
 
 if you increase speed it may lead to restriction by INSTAGRAM
 
 ## Like section
 
 GIVE A STAR IF YOU LIKE THIS!!
 
 ## About
 
 Find me on twitter @erRaghavKhanna
 
 or https://twitter.com/erRaghavKhanna
Amazing Transparent Login Form using HTML CSS & JavaScript
Tags: loginform, htmlform, loginformdesign, loginformhtmlcss
Published: 2020-06-25 08:36:26

A login form is a set of credentials used to authenticate a user. A Login form is used to enter the authentication credentials of the user to access a restricted page or form. The login form carries a field for the username and another for the password.

As you can see in the image, this is a cool Transparent Login Form. Javascript is only used to show and hide passwords when the user clicks. In the image form, there is an image, a form, some texts, and some social media icons. You can change this form according to your requirements if you have basic knowledge of HTML CSS.

This is a Login Form that has no backend unification. You can use PHP language to work this form in the backend. 

If you like this program (Amazing Transparent Login Form) and want source code of this program.

<a href="https://www.codingnepalweb.com/2020/04/amazing-transaprent-login-form-using.html">Click here to get source codes</a>
How-to: call() , apply() and bind() in JavaScript
Tags: beginners, javascript, webdev, stuartinhcity
Published: 2020-06-25 07:12:11

This post covers some basic concepts in JavaScript. Every JavaScript programmer must know the concept and clear

##Call()

The call() method calls a function with a given this value and arguments provided individually.

*Syntax*
*func.call([thisArg[, arg1, arg2, ...argN]])*


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



##apply()
Similarly to call() method the first parameter in apply() method sets the "this" value which is the object upon which the function is invoked. In this case, it's the "obj" object above. The only difference of apply() with the call() method is that the second parameter of the apply() method accepts the arguments to the actual function as an array.

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


##bind()

*Syntax*
let boundFunc = func.bind(context);

In JavaScript, function binding is happens using Bind() method. by this method, we can bind an object to a common function, so that the function gives different result when its need.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9q54t62pn98rnhiizol7.png)


That's all for now. Thank you for reading and I hope this post will be helpful for beginners who are facing issues regarding the apply(), call(), and bind() methods of JavaScript.
16 week streak of blogging - how to do it
Tags: career, writing, productivity, learning
Published: 2020-06-25 07:10:59

It's time to stop and celebrate my own victory, I got the 16 week streak badge after blogging for every week on dev.to. I'm happy for myself right now 🥳

![Badge](https://dev-to-uploads.s3.amazonaws.com/i/yafw9y0blj10newyty5e.png)

## How you can do the same
I didn't know I was going to aim for the 16 week streak and write one article every week 4 months from now, but after getting some badges along the way just from wanting to write articles, I decided to go for the longest streak. So the first point is that **you enjoy writing blogs**. 

I recommend writing articles because you will get a better understanding of the topic yourself, you can get feedback from the community, you promote yourself as a skilled person, you have documented something so you can easily look back and remember how it was, and you will contribute to the community.

Going for a streak writing every week, you might feel like it's going to be hard to keep up with the consistency. This helped me; **writing about learnings from your own projects**, both work and side projects. **Mix it up with some short *Today I Learned* blogs** that contain short useful information that is quick to write. After a while I created a **to-do list with ideas for articles**. Which helped me for weeks I wasn't sure what I wanted to write about. But **don't plan everything, you will get ideas along the way**. If you have a topic/project with a lot of different focus areas, you can **split the article into a blog series**. This will also help you write concise articles that are focused and easy to read. At the end I was going traveling without a computer, so **writing some articles in advance** and publishing from the mobile helped me.

Thank you for reading. And remember that the dev.to community is a kind one, so publishing content feels very safe and welcome 🤗
HTML Datalist
Tags: html
Published: 2020-06-25 06:55:16

Confession time: I have never used the Datalist before!
Therefore I thought it was about time I did some research into what it can be used for.

The Datalist specifies a list of pre-defined option which can be used for an input field.

This means it can be used as an autocomplete for input fields.

Let's see how to use it:

## HTML Structure

```html
<label for="looney"
  ><input list="looneys" name="looneys" id="looney" /> is my favorite Looney Tune!</label
>

<datalist id="looneys">
  <option value="Bugs Bunny"> </option>
  <option value="Daffy Duck"> </option>
  <option value="Elmer Fudd"> </option>
  <option value="Foghorn Leghorn"> </option>
  <option value="Marvin the Martian"> </option>
  <option value="Porky Pig"> </option>
  <option value="Road Runner"> </option>
  <option value="Speedy Gonzales"> </option>
  <option value="Sylvester"> </option>
  <option value="Tasmanian Devil"> </option>
  <option value="Tweety"> </option>
  <option value="Wile E. Coyote"> </option>
  <option value="Yosemite Sam"> </option>
</datalist>
```

Wow, that is all! Amazing right?

All we need to do is define `list=""` on our input, and then we can define a `datalist` with the same `id` as the `list`.

This will generate an input with autocomplete functionality.
Basically a better select.

You can view it in action on this Codepen.

<p class="codepen" data-height="265" data-theme-id="dark" data-default-tab="html,result" data-user="rebelchris" data-slug-hash="abdwzQQ" style="height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="HTML Datalist">
  <span>See the Pen <a href="https://codepen.io/rebelchris/pen/abdwzQQ">
  HTML Datalist</a> by Chris Bongers (<a href="https://codepen.io/rebelchris">@rebelchris</a>)
  on <a href="https://codepen.io">CodePen</a>.</span>
</p>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>

## Datalist downsides

It can not replace a select fully, so people will be able to type whatever they want in the box, and we can't stop them unless we are doing some `JavaScript` magic.

## Browser Support

To be honest, I'm quite surprised how well it is supported. We can even find a [polyfill](https://github.com/mfranzke/datalist-polyfill) for IE9<.

![Datalist support](https://caniuse.bitsofco.de/static/v1/mdn-html__elements__datalist-1593006288777.png)

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Must Have Shell Utilities
Published: 2020-06-25 06:40:10

<b><a href="https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH">Zsh</a></b> If you have bash as your default shell. I bet you would like working in zsh too. Zsh has lot of plugins which makes working in zsh fun. For installing these plugins, install <a href="https://github.com/ohmyzsh/ohmyzsh">ohmyzsh</a>. Once you install and enable ohmyzsh, your command prompt should look like this.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/fvf8gemwt1zxr9zm1gsk.png)

<b><a href="https://github.com/junegunn/fzf">Fzf command line fuzzy finder</a></b> This is great utility to have. fzf is especially useful for scanning through the command line history. When you press Ctl+R, it prompts you through the list of previously used commands from History and then you can search through the commands based on regular expressions and select it. Therefore it is a kind of autocomplete utility for history command. see more <a href="https://www.usessionbuddy.com/post/How-to-Enable-Autocomplete-For-Command-Line-History-In-Bash-and-Zsh/">here</a>

<b><a href="https://github.com/wireservice/csvkit">Csvkit</a></b> If you work with CSVs, you would love this utility. This is a command line utility to parse and do some data analysis for csv files which are small to medium size. Once you install, you would get following utilities csvclean, csvcut, csvformat, csvgrep, csvjoin, csvjson, csvlook, csvpy, csvsort, csvsql, csvstack,csvstat available in your shell environment.

<b><a href="https://github.com/rupa/z">Z</a></b> Last but not least to jump to most frequent directories in Unix, install z. Z keeps track of the directories that you visit. Z also ranks the directories. Z ranks <a href="https://www.usessionbuddy.com/post/How-to-Enable-Autocomplete-For-Command-Line-History-In-Bash-and-Zsh/">most frequent directories in Linux</a> higher. From any directory one can jump to previously visited directory which z does based on fuzzy directory name match if partial name of directory is given.
Bash Shortcut for Git Squash
Tags: productivity, trick, git, bash
Published: 2020-06-25 05:59:22

<small><i><span>Cover photo by <a href="https://unsplash.com/@moritz_photography?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Moritz Kindler</a> on <a href="/s/photos/clock?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span></i></small>

I often find myself squashing a lot of unnecessary commits. The usual way to do this is by using `rebase` or `soft reset`. I personally prefer to use the `soft reset` method.

```shell
# soft reset some commits
git reset --soft HEAD~2
git commit -m "Commit message"
```

As you can see the process is rather long. So how we can save some precious seconds ... enter bash functions!

Add this function to your `.bashrc` file:

```shell
function sq {
    if [ -z "$1" ]
    then
        echo "First argument required"
        return 1
    fi
    if [ -z "$2" ]
    then
        message="$(git log --pretty=format:"%B" -1)"
    else
        message=$2
    fi
    git reset --soft HEAD~$1
    git commit -m "$message"
}
```

And then run `source ~/.bashrc`.

## Usage

If you want to squash `2` commits with the commit message `Add tests`, run this: `sq 2 "Add tests"`.

More often than not we want the commit message of the squashed commit to be the same as the recent most commit message. In those cases, simply run `sq 2` if you want to squash 2 commits.

Sometimes we need to squash all the commits that we made after branching off from a branch. For that, add the following function to your `.bashrc` file:

```shell
function cnt {
    compare_branch=${1-master}
    git rev-list --count HEAD ^$compare_branch
}
```
This gives the number of commits made after branching off. Try running `cnt` for the number of commits made after branching off from `master` and `cnt my_branch` for the number of commits made after branching off from `my_branch`. Don't forget to run `source ~/.bashrc` after modifying `.bashrc`!

Now simply run `sq "$(cnt my_branch)"` to squash the commits made after branching off from `my_branch` with the recent-most commit message.

I hope that you have learned something useful from this post and save some seconds of your development time! Let me know if something is not clear.
Keycloak Integration in Angular Application
Tags: keycloak, angular, webdev, openid
Published: 2020-06-25 05:54:06

### What is [Keycloak](https://www.keycloak.org/)?
* An Open Source Identity and Access Management for Modern Applications and Services. 
* One of the opensource implementation of [OpenID](https://openid.net/) protocol.
* Simple Identity Layer on top of [OAuth2.0](https://oauth.net/2/) protocol

### Why do we need Keycloak in Angular?
* To secure our application from unauthorized access
* To identify who is the user of the application, to show the relevant content & authorized content.

### Prerequisites
1. Angular 6/+ Application

### Steps to Integrate Keycloak in Angular Application
1. Install Keycloak JS package
  1. `npm i --save keycloak-js`
2. Install Keycloak Angular package
  1. `npm i --save keycloak-angular`
3. Keycloak Server Configuration
  1. ![environment.ts](https://dev-to-uploads.s3.amazonaws.com/i/drvk2d85t4lhn53pinl5.PNG)
4. Keycloak Initialization
  1. Create a file AppInit.ts in the project src directory
     ![AppInit.ts](https://dev-to-uploads.s3.amazonaws.com/i/zpwwx6gwfti0qns30jzx.PNG)
5. Integrating into AppModule (Refer the image below these points)
  1. Import `KeycloakAngularModule` in `AppModule`
  2. Register Provider `KeyloackService`
  3. Register Provider of type `APP_INITIALIZER` with `initializer` we defined in `AppInit.ts`
  4. Register Provider `AuthService` (You can find the `AuthService` implementation below)
     
     AuthService
     ![auth.service.ts](https://dev-to-uploads.s3.amazonaws.com/i/3k6brdbvjw7imw8ljmf2.png)
     AppModule
     ![app-module.ts](https://dev-to-uploads.s3.amazonaws.com/i/zg2gs6gqzzkjd3uh8t5n.PNG)
     
6. Guard configuration
  1. Create a Guard `ng new g auth`
  2. Change the definition of the class as below, notice the `extends`
     ![auth.guard.ts](https://dev-to-uploads.s3.amazonaws.com/i/epeq44hfy22vzjesfhmf.PNG)
  3. Routing Module Configuration, 
     Use the `AuthGuard` for routes that you want to restrict access, 
     Assign required roles for each route in `data` attribute, `roles` parameter as an array.
     ![app-routing.module.ts](https://dev-to-uploads.s3.amazonaws.com/i/qgxw9pvxdybyhvclmmv4.PNG)
7. Start the application `ng s`, then you will have the login screen provided by the Keycloak, log in with the correct user to access your application who has the roles that are assigned in the routing configuration
   ![Keycloak Login Screen](https://dev-to-uploads.s3.amazonaws.com/i/1n0zvgoadgssgvuazvkt.PNG)