teleren/devto huggingface dataset:
تحلیلی بر entity framework core 2
Tags: entityframework, تحلیلیبرentityfra
Published: 2019-07-29 09:06:59

---
title: تحلیلی بر entity framework core 2
published: true
tags: Entity Framework,تحلیلی بر entity fra
canonical_url: https://ghorbani.dev/%d8%aa%d8%ad%d9%84%db%8c%d9%84%db%8c-%d8%a8%d8%b1-entity-framework-core-2/
---

## تحلیلی بر entity framework core 2

 آموزش عملی در اعماق Entity FrameWork Core 2نویسنده محمد قربانی

Entity Framework Core چیست ؟ EF Core چه مزیت هایی دارد ؟  ORM چیست ؟ روش Code First چیست ؟ روش Database First چیست ؟ به چند روش می توانیم Entiry Framework Core را توسعه دهیم ؟

EntityFramework Core یک ORM  چند سکویی (Cross Platform) هست که به ما این امکان را می دهد که بتوانیم با بانک های اطلاعاتی مختلف مثل SQL Server از طریق اشیاء NET. کار کنیم. این نسخه Entity Framework که بعد از Entity Framework 6 معرفی شد هم Open Sourse هست و هم Cross Platform و علاوه بر این سبک و قابل گسترش نیز هست خب حالا شاید این سوال برای شما پیش بیاد که ORM چیست ؟

**خلاصه ای از بخش های مختلف کتاب تحلیلی بر**  **entity framework core 2**  **نوشته محمد قربانی**

 ![تحلیلی برEntity FrameWork Core 2](https://ghorbani.dev/wp-content/uploads/2019/07/TAHLILI-BAR3.jpg)

تحلیلی برEntity FrameWork Core 2

- شروع به کار و مقایسه EntityFramework 6x و [EntityFramework Core​](https://en.wikipedia.org/wiki/Entity_Framework)
- ایجاد کنترلر و ویو
- ایجاد پروژه
- بررسی تغییرات ایجاد شده در کنترلر ها و افزودن مدیریت خطا در اکشن ها
- کد نویسی مقدار دهی اولیه Database با استفاده از DbInitializer
- امکان مرتب نمودن داده ها در ایندکس و افزودن باکس جستجو
- ایجاد قابلیت Sorting و Filtring در View
- صفحه بندی و شخصی سازی View
- ارایه و معرفی انواع روشهای اعمال Migration در پروژه ( در Package Manager Console و در محیط داس ویندوز Command Prompt)
- Migration و امکان مشاهده و سابقه مهاجرت
- کامپلکس دیتا مدل و پیاده سازی اتربیوت و آپدیت دیتا بیس
- بررسی چگونگی تعریف اتریبیوت برای Property ها با استفاده از FluentApi
- بررسی مزایا و معایب روش FluentApi نسبت به  روش اتریبیوت دهی Property ها به صورت معمولی
- افزودن کلاس های پروژه و برقراری ارتباط بین کلاس ها
- بررسی بازسازی پروژه و مایگریشن و ارتباطات چند به چند
- کار با ViewModel ها در Entity Framework Core
- خواندن دیتا از بانک اطلاعات به روش Eager Loading
- خواندن دیتا از بانک اطلاعات به روش Explicit Loading
- شخصی سازی در آپدیت اطلاعات
- پیاده سازی مبحث مهم ارث بری در Entity Framework Core
- استفاده از Inheritance جهت جلوگیری از تعریف Property های تکراری در Entity  ها
- بررسی مباحث پیشرفته
- بررسی Commmand Qurery در EF Core
- و دیگر نکات حرفه ای

The post [تحلیلی بر entity framework core 2](https://ghorbani.dev/%d8%aa%d8%ad%d9%84%db%8c%d9%84%db%8c-%d8%a8%d8%b1-entity-framework-core-2/) appeared first on [Mohammad Ghorbani](https://ghorbani.dev).
4 Attempts at Packaging Python as an Executable
Tags: python, packaging, docker, build
Published: 2019-07-31 01:18:20

---
title: 4 Attempts at Packaging Python as an Executable
published: true
tags: python, packaging, docker, build
canonical_url: https://tryexceptpass.org/article/package-python-as-executable/
cover_image: https://tryexceptpass.org/images/package-python-as-executable.webp
---

A few years back I researched how to create a single-file executable of a Python application. Back then, the goal was to make a desktop interface that included other files and binaries in one bundle. Using PyInstaller I built a single binary file that could execute across platforms and looked just like any other application.

Fast forward until today and I have a similar need, but a different use case. I want to run Python code inside a Docker container, but the container image cannot require a Python installation.

Instead of blindly repeating what I tried last time, I decided to investigate more alternatives and discuss them here.

[Read On ...](https://tryexceptpass.org/article/package-python-as-executable/)
Ubuntu upgrade button does nothing
Tags: ubuntu, upgrade, 2011macbookpro15
Published: 2019-07-28 03:58:53

---
title: Ubuntu upgrade button does nothing
published: true
description: Nothing happens when you click on ubuntu upgrade button.
tags: #ubuntu #upgrade #2011MacBookPro15
---

For about a month I have been getting bombarded with notifications to upgrade to Ubuntu 19.04 from 18.10, so I finally got around to do it only to find the "Upgrade" button in the software-updater did nothing.

So I started googling what needs to be done. Everything pointed me to update the installed software packages with 

```
>  sudo apt-get update && sudo apt-get upgrade
```

That seemed to return "0 newly installed, 0 to remove and 1 kept back". In this case it was libodbc1 was kept back, The libodbc1 package had to be force installed using the below command. 


```
>  sudo apt-get install libodbc1
```

Only after which the upgrade button in Ubuntu started working. At this point I've not been able to figure out why it was not upgraded the normal way but in case any one is in such a pickle where the Ubuntu upgrade button just closes the window and does not do anything, it more often than  not has to do with updating packages. If there are any packages that are kept behind or not upgraded, they will have to be individually installed.
🔑🏄‍♀️ Keyboard and Mouse 🐭
Tags: discuss
Published: 2019-07-28 00:05:43

For most programming activities, having a hand or a pair of hands is fairly important. Looking after them should be a top priority. I am unfortunate enough to have convinced myself that a magic mouse and Apple keyboard look great on my desk so I don't get the feeling that my hands are well looked after, infact most of the time they are really sore.

Day to day I will frequently squeeze my hands together in an attempt to curve the repetitive strain, nobody will see me doing this so that I still look as cool as my desk set-up. 🤫

### My questions to you are:
- What is the best keyboard and mouse you have ever owned? 
- Was your mouse wireless or wired?
- Have you used ergonomic stuff?
- Did you use a mechanical or membrane keyboard?
- Have your MacBook Pro switches fallen off yet?
- Do you use macros?
- Will we write code differently in the future?
- What would you do if you couldn't use your hands anymore?
Do you wear earplugs at loud music events?
Tags: watercooler, discuss
Published: 2019-07-28 03:15:46

---
title: Do you wear earplugs at loud music events?
published: true
description: Do you wear earplugs at loud music events?
tags: watercooler, discuss
---

Whenever I go to a loud music event (by that I mean going on a night out, going to a music festival etc), I dread that horrible ring (tinnitus) you get in your ears for the next day.

Earplugs seem the obvious solution to help with this, and yet for some reasons, I feel like not many people seem to wear them when they go to these events! Why do you think that's the case?
What are the most efficient decentralized database solutions?
Tags: discuss, opensource, help, github
Published: 2019-07-28 03:10:32

Github is blocking Iranian users from using many of their services. Some repositories were removed without prior notice even for people who are not living in Iran (follow [#githubForEveryone on Twitter](https://twitter.com/hashtag/githubForEveryone)).

Of course, Github could have handled it better - as GitLab did:

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">We can’t access <a href="https://twitter.com/gitlab?ref_src=twsrc%5Etfw">@gitlab</a> too, but there are 2 important differences:<br>1- gitlab informed users about the issue but <a href="https://twitter.com/github?ref_src=twsrc%5Etfw">@github</a> blocked us without any prior notice <br>2- gitlab didn’t disable any repo but github disabled everything &amp; didn’t give us a chance to download copy of our data <a href="https://t.co/JObPk4ehtr">pic.twitter.com/JObPk4ehtr</a></p>&mdash; Hamed Saeedi (@Hamed) <a href="https://twitter.com/Hamed/status/1154500430317182976?ref_src=twsrc%5Etfw">July 25, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

However, this episode shows us how much we're dependent on American companies (and, therefore, having to comply with US laws). Most of our code and databases are hosted on Amazon, Google, or Microsoft.

How can we find some alternatives? I know many people will say Blockchain for decentralized data but it feels like the technology is not there yet (it's not very efficient).

What would you recommend for having decentralized hosting and databases to prevent our projects from being blocked by any government in the world?
When 2080 is undervolted+underclocked to in shape 1650-s performance?
Published: 2019-07-28 02:38:54

GPU-s mentioned are just an illustration but can be anything as long as one has more cores of anykind/ higher memory bandwith that can be capped.

I have been wondering about heat output of mobile GPU-s. Most laptops seem to be performance limited by cooling. So today I found myself wondering how to get the most performance out of such a system. And if you constantly run the thing at 80-90 degrees gaming that cant be too good if u want to keep the thing for a while.

So I have been thinking of getting a new laptop and I started to wonder if I should get one that has top of the line GPU in it even if the laptop cant run it at 100%.

Given 2 identical laptops. One has lets say 1650 in it and the other has 2080.

Shader Processing Units= 896 vs 2944

Texture Mapping Units= 56 vs 184

Render Output Units= 32 vs 64

So for the same performance you can undervolt+underclock the GPU a lot more and in total should generate much less heat.

Now what I have been trying to figure out if that is even true and if it is then how much is the differnace.
5 Desk-Accessories for a Web Developer
Tags: webdeveloper, tools, desk
Published: 2019-07-28 14:42:35

---
title: 5 Desk-Accessories for a Web Developer
published: true
tags: #Webdeveloper #tools #desk
canonical_url: https://theworldwidecode.com/blog/2019/5-desk-accessories-for-a-web-developer/
---

nowadays web developers must have some accessory with them to make life a bit easier and feeling comfortable, beside a monitor and keyboard
I Passed 3,000 Follows on Dev! 🎉🙌🎊🙌🏿🎆🙌🏾
Tags: writing, blogging, celebrate, milestone
Published: 2019-07-28 00:24:19

---
title: I Passed 3,000 Follows on Dev! 🎉🙌🎊🙌🏿🎆🙌🏾
description: Thank you so much for all of your support and kindness on this journey!!
published: true
tags: #writing #blogging #celebrate #milestone
---

Everyone on DEV is lovely, even if you don't think you are. Thank you all so much for your support, comments, reactions, and reads! I have never in my entire development career, met such a wonderful and supportive group of creatives, craftspeople, and innovators! I have tried many many times to get into blogging before and always quite because I felt that nobody cared about the content (yes, I am that insecure 😝). But with DEV, I was continually encouraged and motivated to, not only improve my writing, but my craft as a developer. Thank you all so much to this incredible community, the creators of the platform, maintainers and contributors to its OSS code, moderators who keep trolling to the lowest levels I've ever seen on a similar platform, and everyone else who makes a difference, whether you get paid to or do it for free! I encourage everyone who reads this to please leave a comment talking about their blogging journey, on DEV or off, and whether you are brand new or a seasoned veteran so that we can share our journeys together!
Kured: Restart your Azure Kubernetes Service Nodes
Tags: azure, kubernetes, kured, aks
Published: 2019-07-28 19:32:03

---
title: Kured: Restart your Azure Kubernetes Service Nodes
published: true
tags: azure, kubernetes, kured, aks
canonical_url: https://carlos.mendible.com/2019/07/28/kured-restart-your-azure-kubernetes-service-nodes/
---

Two weeks ago I got an email message from Microsoft Azure explaining that Azure Kubernetes Services had been patched but that I had to restart my nodes (reboot the clusters) to complete the operation.

![The Microsoft Azure email explaining that I had to reboot my clusters](https://carlos.mendible.com/assets/img/posts/aks_update_kured.png)

The first thing you need to know is that, when things like this happens, the Azure platform creates a file called `/var/run/reboot-required` in each of the nodes of your cluster.

The second thing is that a Kubernetes Reboot Daemon named [Kured](https://github.com/weaveworks/kured) exists and if installed in your cluster will run on each pod watching for the existence of the `/var/run/reboot-required` file. [Kured](https://github.com/weaveworks/kured) then takes care of the reboots for you so only one node is restarted at a time.

So how do you install it and check what’s going on with your nodes? Let’s see:

## 1. Check the nodes

* * *

Damn I was running the affected kernel version: 4.15.0-1049-azure.

```
kubectl get nodes -o wide


NAME STATUS ROLES AGE VERSION EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
aks-agentpool-14502547-0 Ready agent 3d v1.12.8 <none> Ubuntu 16.04.6 LTS 4.15.0-1049-azure docker://3.0.4
aks-agentpool-14502547-1 Ready agent 3d v1.12.8 <none> Ubuntu 16.04.6 LTS 4.15.0-1049-azure docker://3.0.4
aks-agentpool-14502547-2 Ready agent 3d v1.12.8 <none> Ubuntu 16.04.6 LTS 4.15.0-1049-azure docker://3.0.4

```

## 2. Install [Kured](https://github.com/weaveworks/kured)

* * *

```
kubectl apply -f https://github.com/weaveworks/kured/releases/download/1.2.0/kured-1.2.0-dockerhub.yaml

```

## 3. Check the nodes again

* * *

```
kubectl get nodes -o wide

```

You can se that the first two nodes already restarted and the second has scheduling disabled cause it was still in the process.

```
aks-agentpool-14502547-0 Ready agent 3d v1.12.8 <none> Ubuntu 16.04.6 LTS 4.15.0-1049-azure docker://3.0.4
aks-agentpool-14502547-1 Ready agent 3d v1.12.8 <none> Ubuntu 16.04.6 LTS 4.15.0-1050-azure docker://3.0.4
aks-agentpool-14502547-2 Ready,SchedulingDisabled agent 3d v1.12.8 <none> Ubuntu 16.04.6 LTS 4.15.0-1050-azure docker://3.0.4

```

To learn more about [Kured](https://github.com/weaveworks/kured) and the features it offers, please check [here](https://github.com/weaveworks/kured).

Hope it helps!
Why you should not build your own authentication system?
Tags: api, authentication, basics
Published: 2019-07-27 23:00:20

---
title: Why you should not build your own authentication system? 
published: true
description: You should not roll your own authentication system for many reason, here are a few of those reasons.
tags: APIs, Authentication, Basics
canonical_url: https://blog.richardkeller.net/why-you-should-not-build-your-own-authentication-system/
cover_image: https://blog.richardkeller.net/wp/wp-content/uploads/2019/07/code-codes-coding-207580.jpg
---

Now I know why people always say: “don’t roll your own authentication system.” Unless you want to create an authentication system for fun, I would advise against it.

Complexity
-----------

First of all, it’s a full-time job to create a robust authentication system. For example, you need many API routes, knowledge of encryption, a server to host the API, and a database server. That is just the minimum. Authentication systems are much more complicated than they seem.

Security & Multi-level dependencies
-----------------------------------

You also need to keep up with security patches for your authentication systems application dependencies. Also, you need to keep up with the dependencies of the software you are using to build your application.

The Wheel argument
------------------

Another reason to avoid creating an authentication system is that there are already great ones available. Just take your pick:

1. Auth0
2. Firebase
3. Google Login
4. Facebook Login
5. Twitter Login
6. Github Login

All of these applications can be used as an authentication system for your application for minimal cost or free.

Give it a try
-------------

For me, I’ve always wanted to write an authentication system from scratch, and so I have written a few. It is a good idea to create an authentication system as a programming exercise, but you should use an existing authentication system for a production application.

The two reason to create your own authentication system:

1. Programming exercise
2. You want to build an authentication SaaS product.

To conclude, you should “roll-your-own auth.” It’s usually very complex, there are many security dependencies to worry about, and there are already great solutions available. So build your application and integrate it with an existing authentication system. You’ll thank me later!
A Video Intro to Boost Your Coding Fu with VSCode and Vim
Tags: vscode, vim, productivity, webdev
Published: 2019-07-27 21:09:22

---
title: A Video Intro to Boost Your Coding Fu with VSCode and Vim
published: true
description: A Video Intro to Boost Your Coding Fu with VSCode and Vim
tags: vscode,vim,productivity,webdev
---

Yo! I made an intro video to [Boost Your Coding Fu with VSCode and Vim](https://www.barbarianmeetscoding.com/boost-your-coding-fu-with-vscode-and-vim). Hope you like it!! :D

**UPDATE**: I made a sliiiightly improved video:

{% youtube zQ6Ua-8pM9g %}
Ignoring Files In Git Diff
Tags: git, todayilearned
Published: 2019-11-19 13:23:05

---
title: Ignoring Files In Git Diff
published: true
date: 2019-07-27 21:08:00 UTC
tags: Git,Today I Learned
canonical_url: https://stuartwelham.com/ignoring-files-in-git-diff/
---

Recently whilst running a git diff, I noticed my difftool was getting stuck. I discovered there was a file containing a large binary causing the issue. I didn't need to see the changes in this file, so I started looking for ways to ignore it.

It turns out there is a handy syntax called a pathspec which can be used to filter out files and directories.

This is passed directly into the diff command.

<!--kg-card-begin: code-->
```sh
$ git difftool origin/master ':(exclude)test_data/data.json'
```
<!--kg-card-end: code-->

With this in place, the `data.json` file will be excluded from the diff, allowing my difftool to easily handle the rest of the files.

Pathspecs can also be used with other git commands. To see other ways to use them, take a look at the [pathspec section](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) of the git glossary.
Why Curiosity is Dangerous
Tags: career, beginners, productivity, inclusion
Published: 2019-07-27 20:29:23

Nitrogen is a necessary element for plant growth. Nitrogen forms amino acids, which forms plant protein, which forms plant tissues such as chlorophyll, which is imperative for photosynthesis.

Nitrogen can kill plants, too. Excess quantities fuel the proliferation of larger foliage and leaves, which redirects energy originally purposed for flower growth. Without adequate flowering, plants will not reproduce.

Curiosity is no different.

Curiosity is necessary for learning. Consider the scientific method: Question; Hypothesize; Test; Analyze. The very first step demands the curiosity to ask _why_.

But curiosity can prevent learning, too. It's oft easier to ask a question than answer one, so before long, questions pile up. Like profuse foliage prevents flowering, asking too many questions betrays finding answers.

---

I owe everything I know to curiosity. It's the fuel for my engine, it's what turns my wheels everyday to face what I don't understand. It's very hard for me to approach the unknown, to acknowledge my ignorance. Curiosity pulls me through that.

Curiosity has also broken me down; put me on the side of the road with conniptions about how _I don't know anything_ and _I should have pursued botany instead_. Plants are easy, plants are simple. They don't have problems like I do.

---

The internet brings a wealth of information to our fingertips. That, and the realization of just how little we know. Programming exists on the internet; It is where it operates, where it is taught, and where it is learned.

And while programming can be so tremendously difficult to learn, it can be so extraordinarily easy to become overwhelmed. Sought answers to seemingly simple questions are quickly obfuscated by torrents of suggested methods, ideologies, best practices, patterns and anti-patterns...

These people aren't wrong, either. They have reputation, renowned jobs, years of experience. There _are_ lessons in what they recommend. And so, our backlog of _things we don't know but should_ grows. And grows.. And grows...

---

I find solace in the strange idea that none of us really know anything, or can ever know anything. That is, I mean, _anything_ in the scope of _everything_. Even by the time our peepholes close, we will still be left with questions. 

All we can do is be satisfied with wondering, satisfied by asking questions and only finding some answers, and satisfied looking at the clouds, wondering which looks most like a dog, or butterfly, or dinosaur, but not about whether it will rain.

...


**TL;DR**: Ask questions, but not too many. Be satisfied wondering, because you will never know everything. Learn to get smarter, but be happy being dumb.
Predicting Global Video Game Sales With a Linear Regression Model
Tags: python
Published: 2019-07-27 20:08:00

Welcome back!  It's currently the end of week 3 of my Lambda School journey and I thought I'd provide an update on the data set [we used two weeks ago](https://www.kaggle.com/rush4ratio/video-game-sales-with-ratings). This week, we'll look at some additional visualizations of the data plus a simple linear regression model (which uses some of the pre-course work for the course).

First, let's clean up the data a bit.

```
video_game_ratings = video_game_ratings.dropna(subset=['User_Score', 'Critic_Score', 'Year_of_Release'])
video_game_ratings = video_game_ratings[video_game_ratings['User_Score'] != 'tbd']
video_game_ratings['User_Score_Numeric'] = pd.to_numeric(video_game_ratings['User_Score'])
video_game_ratings['Critic_Score_Numeric'] = pd.to_numeric(video_game_ratings['Critic_Score'])
```

Next, let's look at some scatterplots to see if we can identify a relationship between the variables we are interested in.

![user_score](https://dcj24-storage.s3.amazonaws.com/lambda/images/user_score.png "Global Sales by User Score")

![critic_score](https://dcj24-storage.s3.amazonaws.com/lambda/images/critic_score.png "Global Sales by Critic Score")

We see that there is a slight positive relationship between user and critic scores and global sales.  This is what we would expect.

Before we actually do the linear regression, let's be sure to check for correlations between our two variables.

![user_score_by_critic_score](https://dcj24-storage.s3.amazonaws.com/lambda/images/critic_score_user_score.png "User Score by Critic Score")

It looks like there is a pronounced positive correlation between user score and critic score (which is what we would expect).  We can confirm this by calling `.corr()` on the required feature set:

![corr](https://dcj24-storage.s3.amazonaws.com/lambda/images/corr.png "Correlation between Critic Score and User Score")

Since we don't want to do a multiple linear regression with correlated features, we'll do individual regressions of global sales on both critic score and user score.

For a regression on user score, we get a `beta_0` of `-0.11201624` and a `beta_1` of `0.01213527`.  For our training data, we get a mean absolute error of `0.762`, while for our test data, we get a mean absolute error of `0.8202`.

For a regression on critic score, we get a `beta_0` of `-1.54676995` and a `beta_1` of `0.03283348`.  For our training data, we get a mean absolute error of `0.745`, while for our test data, we get a mean absolute error of `0.8095`.

We see from our models that there is (as expected) a positive relationship between both critic and user scores and global sales.  We also notice that critic score is the better predictor of the two features.

And that's it!  You can find the completed Google Colab notebook [here](https://colab.research.google.com/drive/1Jq1QLC9x7PoovRdJbLKi_Pj_pm9l-6No). Hope you enjoyed this dive into simple linear regression.  See you next time!