When is DbConnection.StateChange called?
I have the following code: ``` class Program { static void Main() { var connection = new SqlConnection("myConnectionString"); connection.Open(); connection.StateChange...
- Modified
- 25 May at 16:32
Is it ok having both Anacondas 2.7 and 3.5 installed in the same time?
I am using currently Anaconda with Python 2.7, but I will need to use Python 3.5. Is it ok to have them installed both in the same time? Should I expect some problems? I am on a 64-bit Win8.
- Modified
- 29 Aug at 14:35
OrmLite query to select some of the columns from each of 2 joined tables
Following on from [this comment](https://stackoverflow.com/questions/37416424/how-do-i-join-2-tables-in-servicestack-ormlite-and-select-both-classes/37420341?noredirect=1#comment62383922_37420341), ho...
- Modified
- 23 May at 11:48
How to mock a method returning Task<IEnumerable<T>> with Task<List<T>>?
I'm attempting to set up a unit test initializer (in Moq) where an interface method is being mocked: ``` public interface IRepository { Task<IEnumerable<myCustomObject>> GetSomethingAsync(string ...
- Modified
- 25 May at 13:47
When using servicestacks's DynamoDbCacheClient, what is the suggested way of cleaning old sessions
We have just switched from using the ServiceStack MemoryCacheClient to using the DynamoDbCacheClient to store authenticated user sessions, and the switch was very smooth. ServiceStack is storing auth...
- Modified
- 25 May at 13:32
How can I find out what version of Log4J I am using?
As we all know, at least four or five Log4j JAR files end up being in the classpath. How can I tell which version I am using?
How to use systemctl in Ubuntu 14.04
I try to perform the following command in Ubuntu 14.04: ``` systemctl enable --now docker-cleanup-dangling-images.timer ``` I also tried it with sudo, I tried to replace systemctl with service and ...
- Modified
- 25 May at 13:25
Convert string to buffer Node
I am using a library which on call of a function returns the toString of a buffer. The exact code is ``` return Buffer.concat(stdOut).toString('utf-8'); ``` But I don't want string version of it....
- Modified
- 25 May at 12:29
Get all keys from Redis Cache database
I am using Redis cache for caching purpose (specifically `stackexchange.Redis C# driver`. Was wondering is there any ways to get all the keys available in cache at any point in time. I mean the simila...
- Modified
- 25 May at 11:57
Proper way to restrict text input values (e.g. only numbers)
Is it possible to implement an `input` that allows to type only numbers inside without manual handling of `event.target.value`? In React, it is possible to define `value` property and afterwards inpu...
- Modified
- 18 Oct at 21:55
matplotlib: how to draw a rectangle on image
How to draw a rectangle on an image, like this: [](https://i.stack.imgur.com/KWG46.jpg) ``` import matplotlib.pyplot as plt from PIL import Image import numpy as np im = np.array(Image.open('dog.png')...
- Modified
- 9 Jul at 16:7
Correct way to push into state array
I seem to be having issues pushing data into a state array. I am trying to achieve it this way: ``` this.setState({ myArray: this.state.myArray.push('new value') }) ``` But I believe this is incorr...
- Modified
- 25 May at 11:8
How do you get ServiceStack.ToJson to *sometimes* ignore properties?
I have a ServiceStack DTO: ``` [Route("/images", "POST")] public class PostImageCommand { public string Notes { get; set; } public byte[] Image { get; set; } //other properties removed fo...
- Modified
- 25 May at 09:35
How to Validate on Max File Size in Laravel?
I'm trying to validate on a max file size of 500kb in Laravel: ``` $validator = Validator::make($request->all(), [ 'file' => 'size:500', ]); ``` But this says that the file should be exactly 5...
- Modified
- 28 Nov at 15:52
Why do we need backing fields in C# properties?
This is a question about auto-implemented properties. Auto-implemented properties are about properties without logic in the getters and setters while I stated in my code very clearly that there is s...
- Modified
- 23 Oct at 22:25
Why IReadOnlyCollection has ElementAt but not IndexOf
I am working with a `IReadOnlyCollection` of objects. Now I'm a bit surprised, because I can use `linq` extension method `ElementAt()`. But I don't have access to `IndexOf()`. This to me looks a bit...
- Modified
- 23 May at 11:44
ASP.NET Core HTTPRequestMessage returns strange JSON message
I am currently working with ASP.NET Core RC2 and I am running into some strange results. So I have an MVC controller with the following function: ``` public HttpResponseMessage Tunnel() { var mes...
- Modified
- 25 May at 16:25
Error MSB3027: Could not copy "C:\pagefile.sys" to "bin\roslyn\pagefile.sys". Exceeded retry count of 10. Failed
I am consistently getting this error with VS 2013: > Could not copy "C:\pagefile.sys" to "bin\roslyn\pagefile.sys". Exceeded retry count of 10. Failed. Unable to copy file "C:\pagefile.sys" to "b...
- Modified
- 9 Apr at 20:21
How to properly apply a lambda function into a pandas data frame column
I have a pandas data frame, `sample`, with one of the columns called `PR` to which am applying a lambda function as follows: ``` sample['PR'] = sample['PR'].apply(lambda x: NaN if x < 90) ``` I the...
Check if variable exist in laravel's blade directive
I'm trying to create blade directive which echo variable (if variable defined) or echo "no data" if variable undefined. This is my code in `AppServiceProvider.php`: ``` <?php namespace App\Provider...
Unreported exception java.lang.Exception; must be caught or declared to be thrown
I tried compiling the below but get the following around m16h(x): ``` Line: 16 unreported exception java.lang.Exception; must be caught or declared to be thrown ``` Not sure why though. I've tried ...
- Modified
- 25 May at 11:55
Why do I have to place () around null-conditional expression to use the correct method overload?
I have these extension methods and enum type: ``` public static bool IsOneOf<T>(this T thing, params T[] things) { return things.Contains(thing); } public static bool IsOneOf<T>(this T? thing, p...
- Modified
- 24 May at 21:3
Moq Expression with Constraint ... It.Is<Expression<Func<T, bool>>>
Ok, I am having a hard time trying to figure out how to setup a moq for a method that takes in an expression. There are a lot of examples out there of how to to It.IsAny<>... that is not what I am aft...
If async-await doesn't create any additional threads, then how does it make applications responsive?
Time and time again, I see it said that using `async`-`await` doesn't create any additional threads. That doesn't make sense because the only ways that a computer can appear to be doing more than 1 th...
- Modified
- 24 May at 16:51
readFileSync is not a function
I am relatively new to Node.js and have been looking around but cannot find a solution. I did check the require javascript file and it does not seem to have a method for "readFileSync". Perhaps I don'...
- Modified
- 1 Jul at 10:6