Questions

Get Android API level of phone currently running my application

> [Programmatically obtain the Android API level of a device?](https://stackoverflow.com/questions/2768806/programmatically-obtain-the-android-api-level-of-a-device) How do I get the Api level...

6 Sep at 22:46

Copy Notepad++ text with formatting?

I'm using Notepad++ to write code. How do I copy code in Notepad++ along with its formatting to paste into Microsoft Word? (i.e. syntax highlights, etc)

6 Dec at 08:37

Switch statement for string matching in JavaScript

How do I write a switch for the following conditional? If the url "foo", then `settings.base_url` is "bar". The following is achieving the effect required but I've a feeling this would be more manage...

10 Nov at 02:37

How to return 2 values from a Java method?

I am trying to return 2 values from a Java method but I get these errors. Here is my code: ``` // Method code public static int something(){ int number1 = 1; int number2 = 2; return numb...

4 Oct at 14:6

How can I download a specific Maven artifact in one command line?

I can install an artifact by `install:install-file`, but how can I download an artifact? For example: ``` mvn download:download-file -DgroupId=.. -DartifactId=.. -Dversion=LATEST ```

6 Nov at 15:6

MySQL - length() vs char_length()

What's the main difference between `length()` and `char_length()`? I believe it has something to do with binary and non-binary strings. Is there any practical reason to store strings as binary? ```...

14 Nov at 14:32

How to use Java property files?

I have a list of key/value pairs of configuration values I want to store as Java property files, and later load and iterate through. Questions: - - `.txt`- -

16 Sep at 12:30

MySQL Removing Some Foreign keys

I have a table whose primary key is used in several other tables and has several foreign keys to other tables. ``` CREATE TABLE location ( locationID INT NOT NULL AUTO_INCREMENT PRIMARY KEY .....

.Net HttpWebRequest.GetResponse() raises exception when http status code 400 (bad request) is returned

I am in a situation where when I get an HTTP 400 code from the server, it is a completely legal way of the server telling me what was wrong with my request (using a message in the HTTP response conten...

28 Mar at 06:40

returning in the middle of a using block

Something like: ``` using (IDisposable disposable = GetSomeDisposable()) { //..... //...... return Stg(); } ``` I believe it is not a proper place for a return statement, is it?

C# binary literals

Is there a way to write binary literals in C#, like prefixing hexadecimal with 0x? 0b doesn't work. If not, what is an easy way to do it? Some kind of string conversion?

27 Feb at 13:26

How to prevent ENTER keypress to submit a web form?

How do you prevent an key press from submitting a form in a web-based application?

19 Dec at 13:51

Find unused code

I have to refactor a large C# application, and I found a lot of functions that are never used. How can I check for unused code, so I can remove all the unused functions?

24 Sep at 21:44

Create a CSV File for a user in PHP

I have data in a MySQL database. I am sending the user a URL to get their data out as a CSV file. I have the e-mailing of the link, MySQL query, etc. covered. How can I, when they click the link, ha...

23 Jan at 04:19

How do you truncate all tables in a database using TSQL?

I have a test environment for a database that I want to reload with new data at the start of a testing cycle. I am not interested in rebuilding the entire database- just simply "re-setting" the data. ...

19 Oct at 10:55

Is there an easy way to create ordinals in C#?

Is there an easy way in C# to create [Ordinals](http://en.wikipedia.org/wiki/Ordinal_numbers_%28linguistics%29) for a number? For example: - - - - Can this be done through `String.Format()` or are ...

26 Sep at 13:4

My position: sticky element isn't sticky when using flexbox

I was stuck on this for a little bit and thought I'd share this `position: sticky` + flexbox gotcha: My sticky div was working fine until I switched my view to a flex box container, and suddenly the ...

10 Dec at 14:53

Local function vs Lambda C# 7.0

I am looking at the new implementations in [C# 7.0](https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/) and I find it interesting that they have implemented local functions bu...

4 Jun at 09:8

Mocking HttpClient in unit tests

I have some issues trying to wrap my code to be used in unit tests. The issues is this. I have the interface `IHttpHandler`: ``` public interface IHttpHandler { HttpClient client { get; } } ``` A...

30 Nov at 16:23

TypeError: a bytes-like object is required, not 'str' in python and CSV

> TypeError: a bytes-like object is required, not 'str' Getting the above error while executing below python code to save the HTML table data in CSV file. Don't know how to get rideup. Pls help me. ``...

31 Aug at 16:27

A column-vector y was passed when a 1d array was expected

I need to fit `RandomForestRegressor` from `sklearn.ensemble`. ``` forest = ensemble.RandomForestRegressor(**RF_tuned_parameters) model = forest.fit(train_fold, train_y) yhat = model.predict(test_fold...

20 Jun at 09:12

How do I set hostname in docker-compose?

In my `docker-compose.yml` file, I have the following. However the container does not pick up the hostname value. Any ideas? ``` dns: image: phensley/docker-dns hostname: affy domainname: affy.c...

29 Jan at 18:55

How to export specific request to file using postman?

I want to export one specific request from a Postman extension (Chromium) and send it to another developer so that they can import it. How I can do this?

4 Feb at 20:8

pandas loc vs. iloc vs. at vs. iat?

Recently began branching out from my safe place (R) into Python and and am a bit confused by the cell localization/selection in `Pandas`. I've read the documentation but I'm struggling to understand t...

How to change default Anaconda python environment

I've installed Anaconda and created two extra environments: py3k (which holds Python 3.3) and py34 (which holds Python 3.4). Besides those, I have a default environment named 'root' which the Anaconda...

18 May at 02:41