C# equivalent to Java 8 "method reference"
I recently had the opportunity to tweak some Java code and was able to take advantage of some new Java 8 features. In one particular case I needed to get a List of (String) `.Name` properties from a L...
Swagger-Codegen custom settings
I am using `swagger-codegen` to generate my client-side C# classes. It does the job, but there are a few things I'd like to customize: 1) Most importantly, how I tell it which namespace, or perhaps...
- Modified
- 3 May at 18:34
Events and multithreading once again
I'm worried about the correctness of the seemingly-standard pre-C#6 pattern for firing an event: ``` EventHandler localCopy = SomeEvent; if (localCopy != null) localCopy(this, args); ``` I've r...
- Modified
- 23 May at 12:1
angular-cli server - how to proxy API requests to another server?
With the `angular-cli` `ng serve` local dev server, it's serving all the static files from my project directory. How can I proxy my AJAX calls to a different server?
- Modified
- 26 Jul at 12:41
.NET Core/EF 6 - Dependency Injection Scope
I am currently working on setting up a .NET Core application using EF 6, and am having some trouble understanding the appropriate use of the various dependency registration methods. As I understand i...
- Modified
- 12 May at 14:58
Create a cryptographically secure random GUID in .NET
I want to create a cryptographically secure GUID (v4) in .NET. .NET's `Guid.NewGuid()` function is not cryptographically secure, but .NET does provide the `System.Security.Cryptography.RNGCryptoServi...
How to combine AutoDataAttribute with InlineData
I heavily use the Autofixture AutoData Theories for creating my data and mocks. However this prevents me from using the InlineData Attributes from XUnit to pipe in a bunch of different data for my tes...
- Modified
- 11 May at 17:9
Alert Dialog in ViewModel - MVVMCross
In the `ViewModel`, I have `Save` method where I check `isValid` property. If `isValid` is `false`, then I want to display an error message. Since `AlertDialog` is platform specific, I wonder how d...
How to make EF-Core use a Guid instead of String for its ID/Primary key
When I look at the ASP.NET 3 Identity it uses a `string` and not a `Guid` for the unique primary key. In my `Entity Framework` `code first` Users' `ApplicationUser` class I inherit the Identity clas...
- Modified
- 9 Sep at 13:27
is there any alternative for ng-disabled in angular2?
I am using angular2 for development and was wondering if there is any alternative for `ng-disabled` in angular2. For ex. below code is in angularJS: ``` <button ng-disabled="!nextLibAvailable" ng-c...
- Modified
- 24 Aug at 13:26
Replace multiple Regex Matches each with a different replacement
I have a string that may or may not have multiple matches for a designated pattern. Each needs to be replaced. I have this code: The problem is that when I have several matches the first is replaced a...
Angular 2: Passing Data to Routes?
I am working on this angular2 project in which I am using `ROUTER_DIRECTIVES` to navigate from one component to other. There are 2 components. i.e. `PagesComponent` & `DesignerComponent`. I want to ...
- Modified
- 11 May at 09:5
Wordpress plugin install: Could not create directory
I'm using WordPress on centos 6. I try to install a plugin. But I got this error: > Installing Plugin: bbPress 2.5.9 Downloading install package from [https://downloads.wordpress.org/plugin/bbpres...
Best Practice for Use HttpClient
I'm using HttpClient to make request to WebApi. I have written this code ``` public async Task<string> ExecuteGetHttp(string url, Dictionary<string, string> headers = null) { us...
- Modified
- 23 May at 11:47
ERROR: Error cloning remote repo 'origin'
Tried with the configure option, not able to find the tools configuration option and the git executable section. Seems like it occurs after a successful build only. Please help. Here's the output I r...
- Modified
- 31 May at 09:32
angular-cli server - how to specify default port
Using angular-cli with the `ng serve` command, how can I specify a default port so I do not need to manually pass the `--port` flag every time? I'd like to change from the default port 4200.
- Modified
- 6 May at 04:39
ASP.NET 5 Policy-Based Authorization Handle Not Being Called
Following the docs here I tried to implement a policy-based auth scheme. [http://docs.asp.net/en/latest/security/authorization/policies.html#security-authorization-handler-example](http://docs.asp.net...
- Modified
- 17 May at 18:26
Avoid repeating the defaults of an interface
I have an interface with default parameters and I want to call the implementing method from the implementing class (in addition to from outside it). I also want to use its default parameters. Howev...
- Modified
- 29 Mar at 08:43
Session expiry value starts off ok, then changes to default
I have a special case when I'm trying to set my session to expire in 30 minutes. My code that saves the session looks like below. When I set a breakpoint here, the value of the variable is what I want...
- Modified
- 10 May at 20:9
Is it possible a class to inherit only some(not all) base class members?
Is there a way that a derived class could inherit only a few of all the base class members..in C#? If such maneuver is possible, please provide some example code.
- Modified
- 6 May at 07:25
How to handle git gc fatal: bad object refs/remotes/origin/HEAD error?
I randomly hit this today while trying to run Git : ``` $ git gc fatal: bad object refs/remotes/origin/HEAD error: failed to run repack ``` How do I deal with this?
- Modified
- 6 Jun at 19:2
Change Datarow field value
First I have last update file from DB ```csharp DataTable excelData = ReadSCOOmega(lastUploadFile); ``` after this iterate over this data ```csharp foreach (DataRow currentRow in rows) { ...
Is __init__.py not required for packages in Python 3.3+
I am using Python 3.5.1. I read the document and the package section here: [https://docs.python.org/3/tutorial/modules.html#packages](https://docs.python.org/3/tutorial/modules.html#packages) Now, I ...
- Modified
- 8 May at 03:13
Difference between ToCharArray and ToArray
What is the difference between `ToCharArray` and `ToArray` ``` string mystring = "abcdef"; char[] items1 = mystring.ToCharArray(); char[] items2 = mystring.ToArray(); ``` The result seems to be th...