How to concatenate text from multiple rows into a single text string in SQL Server
Consider a database table holding names, with three rows: ``` Peter Paul Mary ``` Is there an easy way to turn this into a single string of `Peter, Paul, Mary`?
- Modified
- 20 Aug at 16:15
"implements Runnable" vs "extends Thread" in Java
From what time I've spent with threads in `Java`, I've found these two ways to write threads: With `Runnable` ``` public class MyRunnable implements Runnable { public void run() { //Code ...
- Modified
- 17 Aug at 09:22
Importing files from different folder
I have this folder structure: ``` application ├── app │ └── folder │ └── file.py └── app2 └── some_folder └── some_file.py ``` How can I import a function from `file.py`, from wit...
- Modified
- 28 Aug at 02:26
PostgreSQL: Show tables in PostgreSQL
What's the equivalent to `show tables` (from MySQL) in PostgreSQL?
- Modified
- 31 May at 14:55
Iterate through object properties
``` var obj = { name: "Simon", age: "20", clothing: { style: "simple", hipster: false } } for(var propt in obj){ console.log(propt + ': ' + obj[propt]); } ``` H...
- Modified
- 13 Mar at 10:58
What is the copy-and-swap idiom?
What is the copy-and-swap idiom and when should it be used? What problems does it solve? Does it change for C++11? Related: - [What are your favorite C++ Coding Style idioms: Copy-swap](https://stacko...
- Modified
- 4 Jul at 21:56
Showing which files have changed between two revisions
I want to merge two branches that have been separated for a while and wanted to know which files have been modified. Came across this link: [http://linux.yyz.us/git-howto.html](https://web.archive.org...
- Modified
- 28 Dec at 17:17
How do I set a variable to the output of a command in Bash?
I have a pretty simple script that is something like the following: ``` #!/bin/bash VAR1="$1" MOREF='sudo run command against $VAR1 | grep name | cut -c7-' echo $MOREF ``` When I run this script ...
- Modified
- 11 Apr at 11:54
How do I escape curly-brace ({}) characters in a string while using .format (or an f-string)?
Non-working example: ``` print(" \{ Hello \} {0} ".format(42)) ``` Desired output: ``` {Hello} 42 ```
- Modified
- 22 Jan at 04:25
JavaScript check if variable exists (is defined/initialized)
Which method of checking if a variable has been initialized is better/correct? (Assuming the variable could hold anything (string, int, object, function, etc.)) ``` if (elem) { // or !elem ``` or ```...
- Modified
- 12 Apr at 01:7
How do you parse and process HTML/XML in PHP?
How can one parse HTML/XML and extract information from it?
- Modified
- 24 Dec at 15:45
What is a JavaBean exactly?
I understood, I think, that a "Bean" is a Java-class with properties and getters/setters. As much as I understand, it is the equivalent of a C `struct`. Is that true? Also, is there a real differenc...
- Modified
- 12 Oct at 12:25
Vim clear last search highlighting
After doing a search in Vim, I get all the occurrences highlighted. How can I disable that? I now do another search for something gibberish that can't be found. Is there a way to just temporarily di...
- Modified
- 8 Jun at 20:42
What is the best way to give a C# auto-property an initial value?
How do you give a C# auto-property an initial value? I either use the constructor, or revert to the old syntax. ``` class Person { public Person() { Name = "Initial Name"; } ...
- Modified
- 3 Mar at 11:48
Get int value from enum in C#
I have a class called `Questions` (plural). In this class there is an enum called `Question` (singular) which looks like this. ``` public enum Question { Role = 2, ProjectFunding = 3, Tot...
How to write a switch statement in Ruby
How do I write a `switch` statement in Ruby?
- Modified
- 26 Nov at 20:20
Limiting floats to two decimal points
I want `a` to be rounded to . I tried using [round](https://docs.python.org/2/library/functions.html#round), but I get: ``` >>> a 13.949999999999999 >>> round(a, 2) 13.949999999999999 ``` --- [How...
- Modified
- 23 Sep at 14:4
Are double and single quotes interchangeable in JavaScript?
Consider the following two alternatives: - `console.log("double");`- `console.log('single');` The former uses double quotes around the string, whereas the latter uses single quotes around the string. ...
- Modified
- 27 Jan at 05:37
How to convert a string to an integer in JavaScript
How do I convert a string to an integer in JavaScript?
- Modified
- 9 Nov at 01:5
How to exit in Node.js
What is the command that is used to exit? (i.e terminate the Node.js process)
- Modified
- 14 Aug at 03:9
Remove duplicate values from JS array
I have a very simple JavaScript array that may or may not contain duplicates. ``` var names = ["Mike","Matt","Nancy","Adam","Jenny","Nancy","Carl"]; ``` I need to remove the duplicates and put the un...
- Modified
- 27 Dec at 00:58
What is 'Context' on Android?
In Android programming, what exactly is a `Context` class and what is it used for? I read about it on the [developer site](https://d.android.com/reference/android/content/Context), but I am unable to...
- Modified
- 4 Nov at 11:11
How do I get the number of elements in a list (length of a list) in Python?
How do I get the number of elements in the list `items`? ``` items = ["apple", "orange", "banana"] # There are 3 items. ```
Interfaces vs Types in TypeScript
What is the difference between these statements (`interface` vs `type`) in TypeScript? ``` interface X { a: number b: string } type X = { a: number b: string }; ```
- Modified
- 14 Sep at 11:1