Questions

HTTP headers in Websockets client API

Looks like it's easy to add custom HTTP headers to your websocket client with any HTTP header client which supports this, but I can't find how to do it with the web platform's `WebSocket` API. Anyone ...

30 Mar at 01:12

I get exception when using Thread.sleep(x) or wait()

I have tried to delay - or put to sleep - my Java program, but an error occurs. I'm unable to use `Thread.sleep(x)` or `wait()`. The same error message appears: > unreported exception java.lang.Int...

7 Nov at 16:52

DatabaseError: current transaction is aborted, commands ignored until end of transaction block?

I got a lot of errors with the message : ``` "DatabaseError: current transaction is aborted, commands ignored until end of transaction block" ``` after changed from python-psycopg to python-psycopg...

5 Jul at 05:13

Batch script loop

I need to execute a command 100-200 times, and so far my research indicates that I would either have to copy/paste 100 copies of this command, OR use a `for` loop, but the `for` loop expects a list of...

13 Jan at 09:43

Enum Naming Convention - Plural

I'm asking this question despite having read similar but not exactly what I want at [C# naming convention for enum and matching property](https://stackoverflow.com/questions/495051/c-naming-convention...

How to check if mysql database exists

Is it possible to check if a (MySQL) database exists after having made a connection. I know how to check if a table exists in a DB, but I need to check if the DB exists. If not I have to call another...

8 May at 09:22

How to disable all div content

I was under the assumption that if I disabled a div, all content got disabled too. However, the content is grayed but I can still interact with it. Is there a way to do that? (disable a div and get ...

12 Mar at 19:58

Search text in fields in every table of a MySQL database

I want to search in all fields from all tables of a MySQL database a given string, possibly using syntax as: ``` SELECT * FROM * WHERE * LIKE '%stuff%' ``` Is it possible to do something like this?...

30 Jul at 12:49

How do you perform a left outer join using linq extension methods

Assuming I have a left outer join as such: ``` from f in Foo join b in Bar on f.Foo_Id equals b.Foo_Id into g from result in g.DefaultIfEmpty() select new { Foo = f, Bar = result } ``` How would I ...

15 Apr at 08:9

Detect the Internet connection is offline?

How to detect the Internet connection is offline in JavaScript?

VSCode Change Default Terminal

I am using Visual Studio Code on my Windows 10 PC. I want to change my default terminal from Windows PowerShell to Bash on Ubuntu (on Windows). How can I do that?

why should I make a copy of a data frame in pandas

When selecting a sub dataframe from a parent dataframe, I noticed that some programmers make a copy of the data frame using the `.copy()` method. For example, ``` X = my_dataframe[features_list].copy(...

10 Jul at 20:39

docker: executable file not found in $PATH

I have a docker image which installs `grunt`, but when I try to run it, I get an error: ``` Error response from daemon: Cannot start container foo_1: \ exec: "grunt serve": executable file not ...

26 Nov at 21:18

Apply pandas function to column to create multiple new columns?

How to do this in pandas: I have a function `extract_text_features` on a single text column, returning multiple output columns. Specifically, the function returns 6 values. The function works, however...

fetch in git doesn't get all branches

I have cloned a repository, after which somebody else has created a new branch, which I'd like to start working on. I read the manual, and it seems dead straight easy. Strangely it's not working, an...

11 Jan at 15:12

How to sort an array of objects by multiple fields?

From this [original question](https://stackoverflow.com/q/979256/178383), how would I apply a sort on multiple fields? Using this slightly adapted structure, how would I sort city (ascending) & then ...

23 May at 10:31

Most efficient way to prepend a value to an array

Assuming I have an array that has a size of `N` (where `N > 0`), is there a more efficient way of prepending to the array that would not require O(N + 1) steps? In code, essentially, what I currently...

10 Aug at 22:15

How do you connect localhost in the Android emulator?

I have made a php script inside and I am connecting that with `httpClient` but I am getting a problem. Please tell me how can I connect to a php file at from the emulator?

Show Image View from file path?

I need to show an image by using the file name only, not from the resource id. ``` ImageView imgView = new ImageView(this); imgView.setBackgroundResource(R.drawable.img1); ``` I have the image img1...

How can I clone an SQL Server database on the same server in SQL Server 2008 Express?

I have an MS SQL Server 2008 Express system which contains a database that I would like to 'copy and rename' (for testing purposes) but I am unaware of a simple way to achieve this. I notice that in ...

27 Nov at 22:21

Fastest way to convert JavaScript NodeList to Array?

Previously answered questions here said that this was the fastest way: ``` //nl is a NodeList var arr = Array.prototype.slice.call(nl); ``` In benchmarking on my browser I have found that it is mor...

28 Oct at 02:4

How to concatenate two dictionaries to create a new one?

Say I have three dicts ``` d1={1:2,3:4} d2={5:6,7:9} d3={10:8,13:22} ``` How do I create a new `d4` that combines these three dictionaries? i.e.: ``` d4={1:2,3:4,5:6,7:9,10:8,13:22} ```

3 Mar at 04:30

Optimal number of threads per core

Let's say I have a 4-core CPU, and I want to run some process in the minimum amount of time. The process is ideally parallelizable, so I can run chunks of it on an infinite number of threads and each ...

20 Jul at 18:46

How to get the max of two values in MySQL?

I tried but failed: ``` mysql> select max(1,0); ```

24 Apr at 14:12

Find out if string ends with another string in C++

How can I find out if a string ends with another string in C++?

21 Mar at 14:24