Questions

Get the week start date and week end date from week number

I have a query that counts member's wedding dates in the database. ``` SELECT SUM(NumberOfBrides) AS [Wedding Count] , DATEPART( wk, WeddingDate) AS [Week Number] , DATEPART( year, WeddingDate)...

Joining two table entities in Spring Data JPA

I want to write a query like `SELECT * FROM Release_date_type a LEFT JOIN cache_media b on a.id=b.id`. I am new to Spring Data JPA. I don't know how to write entities for Join query. Here is an attemp...

23 Oct at 17:15

multiprocessing.Pool: When to use apply, apply_async or map?

I have not seen clear examples with use-cases for [Pool.apply](https://docs.python.org/2/library/multiprocessing.html#multiprocessing.pool.multiprocessing.Pool.apply), [Pool.apply_async](https://docs....

DataGridView.Clear()

Here comes the trouble. I want to delete all rows from datagridview. This how i add rows: ``` private void ReadCompleteCallback(object clientHandle, Opc.Da.ItemValueResult[] results) { foreac...

12 Aug at 20:30

Passing A List Of Objects Into An MVC Controller Method Using jQuery Ajax

I'm trying to pass an array of objects into an MVC controller method using jQuery's ajax() function. When I get into the PassThing() C# controller method, the argument "things" is null. I've tried thi...

6 Nov at 00:56

How to sort a list of lists by a specific index of the inner list?

I have a list of lists. For example, ``` [ [0,1,'f'], [4,2,'t'], [9,4,'afsd'] ] ``` If I wanted to sort the outer list by the string field of the inner lists, how would you do that in python?

13 Nov at 22:0

Does not contain a static 'main' method suitable for an entry point

I began organizing my code to day into seperarate .cs files, and in order to allow the methods that work with the UI to continue to do so I would create the .cs code under the same namespace and publi...

17 Mar at 00:13

Random integer in VB.NET

I need to generate a random integer between 1 and n (where n is a positive whole number) to use for a unit test. I don't need something overly complicated to ensure true randomness - just an old-fashi...

16 May at 22:5

LIMIT 10..20 in SQL Server

I'm trying to do something like : ``` SELECT * FROM table LIMIT 10,20 ``` or ``` SELECT * FROM table LIMIT 10 OFFSET 10 ``` but using SQL Server The only [solution I found](http://blogs.msdn.co...

23 Sep at 17:16

Get the first element of each tuple in a list in Python

An SQL query gives me a list of tuples, like this: ``` [(elt1, elt2), (elt1, elt2), (elt1, elt2), (elt1, elt2), (elt1, elt2), ...] ``` I'd like to have all the first elements of each tuple. Right n...

15 Dec at 16:22

Copying a local file from Windows to a remote server using scp

I try to transfer a folder of files from my local computer to a server via `ssh` and `scp`. After getting `sudo` privileges, I'm using the command as follows: ``` scp -r C:/desktop/myfolder/deployment...

3 Dec at 10:27

numpy division with RuntimeWarning: invalid value encountered in double_scalars

I wrote the following script: ``` import numpy d = numpy.array([[1089, 1093]]) e = numpy.array([[1000, 4443]]) answer = numpy.exp(-3 * d) answer1 = numpy.exp(-3 * e) res = answer.sum()/answer1.sum()...

5 Jan at 17:15

Casting a variable using a Type variable

In C# can I cast a variable of type `object` to a variable of type `T` where `T` is defined in a `Type` variable?

7 Oct at 13:42

concatenate two database columns into one resultset column

I use the following SQL to concatenate several database columns from one table into one column in the result set: `SELECT (field1 + '' + field2 + '' + field3) FROM table1` When one of the fields is ...

21 Jun at 15:21

TypeScript: Creating an empty typed container array

I am creating simple logic game called "Three of a Crime" in TypeScript. When trying to pre-allocated typed array in TypeScript, I tried to do something like this: ``` var arr = Criminal[]; ``` wh...

26 Feb at 05:2

Using a dictionary to count the items in a list

Suppose I have a list of items, like: ``` ['apple', 'red', 'apple', 'red', 'red', 'pear'] ``` I want a dictionary that counts how many times each item appears in the list. So for the list above the r...

31 Jul at 21:6

JavaScript: How can I generate formatted easy-to-read JSON straight from an object?

> [How can I beautify JSON programmatically?](https://stackoverflow.com/questions/2614862/how-can-i-beautify-json-programmatically) I know how to generate JSON from an object using JSON.stringify, ...

Copy files from one directory into an existing directory

In bash I need to do this: 1. take all files in a directory 2. copy them into an existing directory How do I do this? I tried `cp -r t1 t2` (both t1 and t2 are existing directories, t1 has files ...

20 Oct at 16:28

Why avoid increment ("++") and decrement ("--") operators in JavaScript?

One of the [tips for jslint tool](http://www.jslint.com/lint.html) is: > `++``--` The `++` (increment) and `--` (decrement) operators have been known to contribute to bad code by encouraging excessive...

MongoDB what are the default user and password?

I am using the same connection string on local and production. When the connection string is `mongodb://localhost/mydb` What is the username and password? Is it secure to keep it this way?

31 Jul at 22:50

How do I use the conditional operator (? :) in Ruby?

How is the conditional operator (`? :`) used in Ruby? For example, is this correct? ``` <% question = question.size > 20 ? question.question.slice(0, 20)+"..." : question.question %> ```

How to decrypt a password from SQL server?

I have this query in sql server 2000: ``` select pwdencrypt('AAAA') ``` which outputs an encrypted string of 'AAAA':

8 Oct at 14:48

Why would you use String.Equals over ==?

I recently was introduced to a large codebase and noticed all string comparisons are done using `String.Equals()` instead of `==` What's the reason for this, do you think?

20 Oct at 17:59

Python wildcard search in string

Lets say that I have a list ``` list = ['this','is','just','a','test'] ``` how can I have a user do a wildcard search? Search Word: 'th_s' Would return 'this'

11 Jul at 06:54

React: why child component doesn't update when prop changes

Why in the following pseudo-code example Child doesn't re-render when Container changes foo.bar? ``` Container { handleEvent() { this.props.foo.bar = 123 }, render() { return <Child b...

11 Aug at 09:40