Verify a method call using Moq
I am fairly new to unit testing in C# and learning to use Moq. Below is the class that I am trying to test. ``` class MyClass { SomeClass someClass; public MyClass(SomeClass someClass) { ...
jQuery .live() vs .on() method for adding a click event after loading dynamic html
I am using jQuery v.1.7.1 where the .live() method is apparently deprecated. The problem I am having is that when dynamically loading html into an element using: ``` $('#parent').load("http://...")...
- Modified
- 6 Jan at 01:48
Spring MVC - How to get all request params in a map in Spring controller?
Sample URL: ``` ../search/?attr1=value1&attr2=value2&attr4=value4 ``` I do not know the names of attr1, att2, and attr4. I would like to be able to do something like that (or similar, don't care, ...
- Modified
- 6 Dec at 13:39
How to set a cookie for another domain
Say I have a website called `a.com`, and when a specific page of this site is loaded, say page link, I like to set a cookie for another site called `b.com`, then redirect the user to `b.com`. I mean...
- Modified
- 26 Jul at 06:18
Converting a Date object to a calendar object
So I get a date attribute from an incoming object in the form: ``` Tue May 24 05:05:16 EDT 2011 ``` I am writing a simple helper method to convert it to a calendar method, I was using the following...
- Modified
- 31 May at 10:5
Where is Xcode's build folder?
Before Xcode 4 the build used to be created in the root folder of my project. I can no longer find it. Where can i find the build folder?
How do I install a module globally using npm?
I recently installed Node.js and npm module on OSX and have a problem with the settings I think: ``` npm install [MODULE] is not installing the node.js module to the default path which is /usr/local...
Is there a CSS selector for text nodes?
What I would like to do (not in IE obviously) is: ``` p:not(.list):last-child + :text { margin-bottom: 10px; } ``` Which would give a text node a margin. (Is that even possible?) How would I get ...
- Modified
- 30 Mar at 06:39
Size-limited queue that holds last N elements in Java
A very simple & quick question on Java libraries: is there a ready-made class that implements a `Queue` with a fixed maximum size - i.e. it always allows addition of elements, but it will silently rem...
- Modified
- 21 Aug at 21:42
How to run a class from Jar which is not the Main-Class in its Manifest file
I have a JAR with 4 classes, each one has Main method. I want to be able to run each one of those as per the need. I am trying to run it from command-line on Linux box. ``` E.g. The name of my JAR is...
- Modified
- 29 Mar at 15:2
How to subtract date/time in JavaScript?
I have a field at a grid containing date/time and I need to know the difference between that and the current date/time. What could be the best way of doing so? The dates are stored like `"2011-02-07 ...
- Modified
- 14 Aug at 13:59
How do I use the lines of a file as arguments of a command?
Say, I have a file `foo.txt` specifying `N` arguments ``` arg1 arg2 ... argN ``` which I need to pass to the command `my_command` How do I use the lines of a file as arguments of a command?
- Modified
- 1 Sep at 16:3
how to mysqldump remote db from local machine
I need to do a mysqldump of a database on a remote server, but the server does not have mysqldump installed. I would like to use the mysqldump on my machine to connect to the remote database and do th...
- Modified
- 21 Feb at 00:23
is of a type that is invalid for use as a key column in an index
I have an error at ``` Column 'key' in table 'misc_info' is of a type that is invalid for use as a key column in an index. ``` where key is a nvarchar(max). A quick google search finds that the maxim...
- Modified
- 15 Oct at 23:25
How can I tell how many objects I've stored in an S3 bucket?
Unless I'm missing something, it seems that none of the APIs I've looked at will tell you how many objects are in an `<S3 bucket>/<folder>`. Is there any way to get a count?
- Modified
- 23 Oct at 06:20
Curly braces in string in PHP
What is the meaning of `{ }` (curly braces) in string literals in PHP?
How can I escape a single quote?
How can I escape a `'` (single quote) in HTML? This is where I'm trying to use it: ``` <input type='text' id='abc' value='hel'lo'> ``` The result for the above code is "hel" populated in the text box...
Difference between File.separator and slash in paths
What is the difference between using `File.separator` and a normal `/` in a Java Path-String? In contrast to double backslash `\\` platform independence seems not to be the reason, since both version...
- Modified
- 21 Aug at 07:29
Return positions of a regex match() in Javascript?
Is there a way to retrieve the (starting) character positions inside a string of the results of a regex match() in Javascript?
- Modified
- 19 Feb at 10:45
How to format a DateTime in PowerShell
I can format the [Get-Date](https://technet.microsoft.com/en-us/library/hh849887.aspx) cmdlet no problem like this: ``` $date = Get-Date -format "yyyyMMdd" ``` But once I've got [a date](https://ms...
- Modified
- 14 Jan at 06:6
How to increase storage for Android Emulator? (INSTALL_FAILED_INSUFFICIENT_STORAGE)
I get this sometimes(not often) for one of my projects, couple of classes only `Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE` How do I increase emulator's storage?
- Modified
- 3 Jun at 08:20
What is the difference between conversion specifiers %i and %d in formatted IO functions (*printf / *scanf)
What is the difference between `%d` and `%i` when used as format specifiers in `printf` and `scanf`?
- Modified
- 14 Oct at 14:54
Can you create nested WITH clauses for Common Table Expressions?
``` WITH y AS ( WITH x AS ( SELECT * FROM MyTable ) SELECT * FROM x ) SELECT * FROM y ``` Does something like this work? I tried it earlier but I couldn't get it to work.
- Modified
- 11 Nov at 20:45
Extract part of a regex match
I want a regular expression to extract the title from a HTML page. Currently I have this: ``` title = re.search('<title>.*</title>', html, re.IGNORECASE).group() if title: title = title.replace('...
- Modified
- 27 Jul at 10:7