Posts

Showing posts from 2019

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>

Aspetcore: NLog with Postgresql

This Article is base ASP.Net Core 2 and the latest version of Nlog.

1. Install NLog and the Postgresql Package Using NuGet to install the package into your ASP.NET Core project: PM > Install-Package NLog.Web.AspNetCorePM > Install-Package Npgsql3. Register NLog Add in your Startup.cs  publicvoidConfigure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { ... env.ConfigureNLog("nlog.config"); ... // make sure Chinese chars don't fk up Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); //add NLog to ASP.NET Core loggerFactory.AddNLog(); //add NLog.Web app.AddNLogWeb(); }4. Add to Your Controller Add a logger object to your Controller. private readonly ILogger<YourController> _logger; Modify the constructor to use it publicYourController(ILogger<YourController> logger = null) { if (null != logger) { _logger = logger; } }5. Use Logging APIs Now, you can use the loggin…