Mongoose: findOneAndUpdate doesn't return updated document
Below is my code ``` var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/test'); var Cat = mongoose.model('Cat', { name: String, age: {type: Number, default: 20}, c...
Do zombies exist ... in .NET?
I was having a discussion with a teammate about locking in .NET. He's a really bright guy with an extensive background in both lower-level and higher-level programming, but his experience with lower ...
- Modified
- 24 Feb at 04:29
How to verify a method is called two times with mockito verify()
I want to verify if a method is called at least once through mockito verify. I used verify and it complains like this: ``` org.mockito.exceptions.verification.TooManyActualInvocations: Wanted 1 time...
How to secure an ASP.NET Web API
I want to build a web service using ASP.NET Web API that third-party developers will use to access my application's data. I've read quite a lot about and it seems to be the standard, but finding a ...
- Modified
- 29 Apr at 08:11
Exception 'open failed: EACCES (Permission denied)' on Android
I am getting > open failed: `EACCES (Permission denied)` on the line `OutputStream myOutput = new FileOutputStream(outFileName);` I checked the root, and I tried `android.permission.WRITE_EXTERNAL_...
- Modified
- 18 Apr at 03:34
SQL Server - Return value after INSERT
I'm trying to get a the key-value back after an INSERT-statement. Example: I've got a table with the attributes name and id. id is a generated value. ``` INSERT INTO table (name) VALUES('bob'); ```...
- Modified
- 27 Oct at 14:46
How to find list intersection?
``` a = [1,2,3,4,5] b = [1,3,5,6] c = a and b print c ``` actual output: `[1,3,5,6]` expected output: `[1,3,5]` How can we achieve a boolean AND operation (list intersection) on two lists?
- Modified
- 11 Jul at 08:25
What are the differences between ArrayList and Vector?
What are the differences between the two data structures and , and where should you use each of them?
How to change color of Android ListView separator line?
I want to change color of `ListView` separator line.
- Modified
- 17 Feb at 16:48
Get a filtered list of files in a directory
I am trying to get a list of files in a directory using Python, but I do not want a list of ALL the files. What I essentially want is the ability to do something like the following but using Python a...
- Modified
- 17 Jan at 23:58
Get table column names in MySQL?
Is there a way to grab the columns name of a table in MySQL using PHP?
What's the difference between interface and @interface in java?
I haven't touched Java since using JBuilder in the late 90's while at University, so I'm a little out of touch - at any rate I've been working on a small Java project this week, and using Intellij IDE...
- Modified
- 19 Feb at 07:49
Send email using the GMail SMTP server from a PHP page
I am trying to send an email via GMail's SMTP server from a PHP page, but I get this error: > authentication failure [SMTP: SMTP server does no support authentication (code: 250, response: mx.google....
How to use OrderBy with findAll in Spring Data
I am using spring data and my DAO looks like ``` public interface StudentDAO extends JpaRepository<StudentEntity, Integer> { public findAllOrderByIdAsc(); // I want to use some thing like this ...
- Modified
- 15 Dec at 16:7
React ignores 'for' attribute of the label element
In React (Facebook's framework), I need to render a label element bound to a text input using the standard `for` attribute. e.g. the following JSX is used: ``` <label for="test">Test</label> <input ...
Remove all elements contained in another array
I am looking for an efficient way to remove all elements from a javascript array if they are present in another array. ``` // If I have this array: var myArray = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; ...
- Modified
- 14 Apr at 11:23
How do I debug error ECONNRESET in Node.js?
I'm running an Express.js application using Socket.io for a chat webapp and I get the following error randomly around 5 times during 24h. The node process is wrapped in forever and it restarts itself ...
What is the correct syntax of ng-include?
I’m trying to include an HTML snippet inside of an `ng-repeat`, but I can’t get the include to work. It seems the current syntax of `ng-include` is different than what it was previously: I see many ex...
- Modified
- 30 Nov at 21:40
How to create a Custom Dialog box in android?
I want to create a custom dialog box like below ![enter image description here](https://i.stack.imgur.com/zu0ss.png) I have tried the following things. 1. I created a subclass of AlertDialog.Buil...
- Modified
- 31 Jul at 07:18
npm - how to show the latest version of a package
How do I use npm to show the latest version of a module? I am expecting something like `npm --latest express` to print out `v3.0.0`.
- Modified
- 4 Nov at 09:1
Getting "Lock wait timeout exceeded; try restarting transaction" even though I'm not using a transaction
I'm running the following MySQL `UPDATE` statement: ``` mysql> update customer set account_import_id = 1; ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction ``` I'm not usin...
Remove everything after a certain character
Is there a way to remove everything after a certain character or just choose everything up to that character? I'm getting the value from an href and up to the "?", and it's always going to be a diffe...
- Modified
- 11 Jan at 09:19
brew install mysql on macOS
I'm trying to setup up MySQL on mac os 10.6 using Homebrew by `brew install mysql 5.1.52`. Everything goes well and I am also successful with the `mysql_install_db`. However when I try to connect to ...
- Modified
- 21 May at 11:11
Does MySQL ignore null values on unique constraints?
I have an email column that I want to be unique. But I also want it to accept null values. Can my database have 2 null emails that way?
- Modified
- 1 Nov at 10:53
Getting full URL of action in ASP.NET MVC
Is there a built-in way of getting the full URL of an action? I am looking for something like `GetFullUrl("Action", "Controller")` that would return something like `http://www.fred.com/Controller/Act...
- Modified
- 5 Jan at 13:59