Questions

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...

30 Oct at 17:7

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 ...

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...

16 May at 10:56

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 ...

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_...

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'); ```...

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?

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?

11 May at 08:7

How to change color of Android ListView separator line?

I want to change color of `ListView` separator line.

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...

Get table column names in MySQL?

Is there a way to grab the columns name of a table in MySQL using PHP?

27 Oct at 21:26

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...

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....

27 Jun at 23:30

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 ...

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 ...

21 Mar at 06:29

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']; ...

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 ...

28 Jan at 00:28

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...

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...

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`.

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...

19 Aug at 13:8

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...

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 ...

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?

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...

5 Jan at 13:59