Questions

Determine whether integer is between two other integers

How do I determine whether a given integer is between two other integers (e.g. greater than/equal to `10000` and less than/equal to `30000`)? What I've attempted so far is not working: ``` if number >...

8 Mar at 14:7

Error java.lang.OutOfMemoryError: GC overhead limit exceeded

I get this error message as I execute my `JUnit` tests: ``` java.lang.OutOfMemoryError: GC overhead limit exceeded ``` I know what an `OutOfMemoryError` is, but what does GC overhead limit mean? How ...

How to remove time portion of date in C# in DateTime object only?

I need to remove time portion of date time or probably have the date in following format in `object` form not in the form of `string`. ``` 06/26/2009 00:00:00:000 ``` I can not use any `string` con...

4 Dec at 13:8

How do I check if a variable is an array in JavaScript?

How do I check if a variable is an array in JavaScript? ``` if (variable.constructor == Array) ```

10 Apr at 12:59

Load data from txt with pandas

I am loading a txt file containig a mix of float and string data. I want to store them in an array where I can access each element. Now I am just doing ``` import pandas as pd data = pd.read_csv('o...

4 Feb at 07:48

Get the value of checked checkbox?

So I've got code that looks like this: ``` <input class="messageCheckbox" type="checkbox" value="3" name="mailId[]"> <input class="messageCheckbox" type="checkbox" value="1" name="mailId[]"> ``` I ...

24 Jul at 00:50

How to validate phone numbers using regex

I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following: - `1-234-567-8901`- ...

14 Feb at 19:35

Remove last item from array

I have the following array. ``` var arr = [1,0,2]; ``` I would like to remove the last element i.e. 2. I used `arr.slice(-1);` but it doesn't remove the value.

15 Aug at 10:1

<meta charset="utf-8"> vs <meta http-equiv="Content-Type">

In order to define charset for , which notation should I use? 1. Short: <meta charset="utf-8" /> 2. Long: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

30 Oct at 09:10

Static methods in Python?

Can I define a [static method](https://en.wikipedia.org/wiki/Method_(computer_programming)#Static_methods) which I can call directly on the class instance? e.g., ``` MyClass.the_static_method() ```

29 Nov at 00:11

Understanding unique keys for array children in React.js

I'm building a React component that accepts a JSON data source and creates a sortable table. Each of the dynamic data rows has a unique key assigned to it but I'm still getting an error of: > Each c...

4 Feb at 20:16

How to force Docker for a clean build of an image

I have build a Docker image from a Docker file using the below command. ``` $ docker build -t u12_core -f u12_core . ``` When I am trying to rebuild it with the same command, it's using the build c...

16 Dec at 09:3

Reading CSV file and storing values into an array

I am trying to read a `*.csv`-file. The `*.csv`-file consist of two columns separated by semicolon (""). I am able to read the `*.csv`-file using StreamReader and able to separate each line by usin...

18 Sep at 15:45

How can I match "anything up until this sequence of characters" in a regular expression?

Take this regular expression: `/^[^abc]/`. This will match any single character at the beginning of a string, except , , or . If you add a `*` after it – `/^[^abc]*/` – the regular expression will con...

27 Nov at 20:37

PHP - how to create a newline character?

In PHP I am trying to create a newline character: ``` echo $clientid; echo ' '; echo $lastname; echo ' '; echo '\r\n'; ``` Afterwards I open the created file in Notepad and it writes the newline li...

11 Jun at 05:20

How to convert a std::string to const char* or char*

How can I convert an `std::string` to a `char*` or a `const char*`?

16 May at 11:14

Create new column based on values from other columns / apply a function of multiple columns, row-wise in Pandas

I want to apply my custom function (it uses an if-else ladder) to these six columns (`ERI_Hispanic`, `ERI_AmerInd_AKNatv`, `ERI_Asian`, `ERI_Black_Afr.Amer`, `ERI_HI_PacIsl`, `ERI_White`) in each row ...

20 Dec at 13:4

Should I use != or <> for not equal in T-SQL?

I have seen `SQL` that uses both `!=` and `<>` for . What is the preferred syntax and why? I like `!=`, because `<>` reminds me of `Visual Basic`.

26 Mar at 09:48

SQL WITH clause example

I was trying to understand how to use the `WITH` clause and the purpose of the `WITH` clause. All I understood was, the `WITH` clause was a replacement for normal sub-queries. Can anyone explain thi...

23 May at 12:26

Negative matching using grep (match lines that do not contain foo)

How do I match all lines not matching a particular pattern using `grep`? I tried this: ``` grep '[^foo]' ```

14 Aug at 23:56

How to get distinct values from an array of objects in JavaScript?

Assuming I have the following: ``` var array = [ {"name":"Joe", "age":17}, {"name":"Bob", "age":17}, {"name":"Carl", "age": 35} ] ``` What is the best way to be abl...

How to find which version of TensorFlow is installed in my system?

I need to find which version of TensorFlow I have installed. I'm using Ubuntu 16.04 Long Term Support.

How do I get the query builder to output its raw SQL query as a string?

Given the following code: ``` DB::table('users')->get(); ``` I want to get the raw SQL query string that the database query builder above will generate. In this example, it would be `SELECT * FROM ...

How to create a table from select query result in SQL Server 2008

I want to create a table from select query result in SQL Server, I tried ``` create table temp AS select..... ``` but I got an error > Incorrect syntax near the keyword 'AS'

22 May at 05:5

Adding a legend to PyPlot in Matplotlib in the simplest manner possible

> How can one create a legend for a line graph in `Matplotlib`'s `PyPlot` without creating any extra variables? Please consider the graphing script below: ``` if __name__ == '__main__': PyPlot....

4 Feb at 02:39