Posts

Randomly Return Rows in EFCore with Postgresql

Currently working on a random list motorcycles to display on my front. At the moment don't have any priority listening on my site for clients other than the list of bikes I'm trying to sell personally as a source of income. For now this is what I did and its just these two parts to get things going.

something.OrderBy(r =>Guid.NewGuid()).Take(3) If you don't already have the extension this command will check and install for you.

CREATE EXTENSION IFNOTEXISTS"uuid-ossp";

Entity Framework: ToListAynsc & WhereAsync

When upgrading aspnet mvc applications I like to take a look on how I can convert the api's to async. This sometimes is really easy but as things get more complex my queries do as well. So this is a list of ways you can form a where clause on top your async but note not all solutions take advantage of it.
Notes on EFCore Entity Framework Core provides a set of asynchronous extension methods that can be used as an alternative to the LINQ methods that cause a query to be executed and results returned. Examples include ToListAsync(), ToArrayAsync(), SingleAsync(), etc. There are not async versions of LINQ operators such as Where(...), OrderBy(...), etc. because these methods only build up the LINQ expression tree and do not cause the query to be executed in the database. https://codereview.stackexchange.com/questions/32160/filtering-a-collection-by-an-async-resultFiltering a collection by an async result, built an extension method called WhereAsync.publicstatic async Task<IEnumerable…

Bootstrap3 - Radio Nested/Collapsible

Last year I create a login page which I'm very happy to say I built it just how I wanted it. A rare thing if you've ever had to deal with management. Since the page only existed within sharepoint I want to keep things simple. So I went with jquery 2.x and bootstrap 3.3.7. Oldies But Goldies; so a few things I didn't want to create a lot of jquery code. So I had to really use the bootstrap collapsible component as much as I could without breaking it.

Examples
Bootstrap PixKrh7Su5Bootstrap Fdjc8kQiER
Disable collapse for link in a data-toggle element
You need to add a class for those elements that you don't want to fire the collapse event and then stop the event propagation via javascript. So... here is the correct answer. <divclass="panel panel-default"><divclass="panel-heading"><divclass="panel-title"data-toggle="collapse"href=

Gitlab: Switching to Access Tokens with Your Repos

If you haven't yet switch to using Access Tokens for your repo clone. Enable your Two-Factor Authentication and create an access token under your profile. I've done this with my gitlab and keep forgetting the quick way to update the path/command.

Go to https:///YOURGITLAB.com/profile/two_factor_authThen go to https:///YOURGITLAB.com/profile/personal_access_tokens create a token with the api setting.Now switching your remote url for your git is simple. Using this command..
git remote set-url origin http://USER:TOKEN@YOURGITLAB.com/repo.git If you have multiple origin urls you might have to remove them and add back an origin upstream and reset the origin master as the default upstream. This doesn't normally happen but I had a unique case where I had multiple urls for the origin where I was pushing to multiple repos for the same code. This probably won't be your case but I figure I might add this bit in.

Angular 1.X Filter by Properties

Filtering By Nest Property
$scope.list = [ { 'Name': 'A', 'Manager': { 'Name': 'X' } }, { 'Name': 'B', 'Manager': { 'Name': 'X' } }, { 'Name': 'C', 'Manager': { 'Name': 'Y' } }]; <ul> <li ng-repeat="e in list | filter: {Manager: {Name: filter.key}}"> {{e.Name}} (Manager: {{e.Manager.Name}}) </li> </ul>
Filter not equals<liclass="list-group-item"ng-repeat="question in Questions | filter:{ Id: '!-1'}"><divhref="#"editable-text="question.Text">{{question.Text}}</div>