Questions

How do I get the SharedPreferences from a PreferenceActivity in Android?

I am using a PreferenceActivity to show some settings for my application. I am inflating the settings via a xml file so that my onCreate (and complete class methods) looks like this: ``` public clas...

Animate change of view background color on Android

How do you animate the change of background color of a view on Android? For example: I have a view with a red background color. The background color of the view changes to blue. How can I do a smo...

What are the differences between WCF and ASMX web services?

I am totally confused between WCF and ASMX web services. I have used a lot of web services in my earlier stage, and now there is this new thing introduced called WCF. I can still create WCF that fun...

20 Aug at 02:45

FileSystemWatcher Changed event is raised twice

I have an application where I am looking for a text file and if there are any changes made to the file I am using the `OnChanged` eventhandler to handle the event. I am using the `NotifyFilters.LastWr...

15 Jun at 15:13

Exact time measurement for performance testing

What is the most exact way of seeing how long something, for example a method call, took in code? The easiest and quickest I would guess is this: ``` DateTime start = DateTime.Now; { // Do some ...

30 May at 09:27

Equation for testing if a point is inside a circle

If you have a circle with center `(center_x, center_y)` and radius `radius`, how do you test if a given point with coordinates `(x, y)` is inside the circle?

23 Jun at 15:30

HTTP vs HTTPS performance

Are there any major differences in performance between http and https? I seem to recall reading that HTTPS can be a fifth as fast as HTTP. Is this valid with the current generation webservers/browse...

15 Jul at 18:39

How to round up the result of integer division?

I'm thinking in particular of how to display pagination controls, when using a language such as C# or Java. If I have items which I want to display in chunks of per page, how many pages will be nee...

10 Apr at 04:1

FileProvider - IllegalArgumentException: Failed to find configured root

I'm trying to take a picture with camera, but I'm getting the following error: ``` FATAL EXCEPTION: main Process: com.example.marek.myapplication, PID: 6747 java.lang.IllegalArgumentException: Failed...

23 Oct at 09:39

Can Windows containers be hosted on Linux?

Is it possible to run Windows containers on Linux? The scenario is based on an application written in (old net) and the that wants to run this with Docker needs to provide a `net462` written API on ...

Programmatically navigate using react router V4

I have just replaced `react-router` from v3 to v4. But I am not sure how to programmatically navigate in the member function of a `Component`. i.e in `handleClick()` function I want to navigate to `/p...

Removing packages installed with go get

I ran `go get package` to download a package before learning that I needed to set my `GOPATH` otherwise that package sullies my root Go install (I would much prefer to keep my Go install clean and sep...

9 Dec at 21:54

How to easily initialize a list of Tuples?

I love [tuples](http://msdn.microsoft.com/en-us/library/system.tuple.aspx). They allow you to quickly group relevant information together without having to write a struct or class for it. This is very...

11 Feb at 08:38

What is Java Servlet?

I read many articles to understand Java servlet but I did not succeed. Can you please give brief introduction of Java servlets (in easy language). What is a servlet? What are the advantages? I can't u...

28 Sep at 08:44

JavaScript hide/show element

How could I hide the 'Edit'-link after I press it? and also can I hide the "lorem ipsum" text when I press edit? ``` <script type="text/javascript"> function showStuff(id) { document.getElementById...

8 Oct at 12:44

Javascript Equivalent to PHP Explode()

I have this string: > 0000000020C90037:TEMP:data I need this string: > TEMP:data. With PHP I would do this: ``` $str = '0000000020C90037:TEMP:data'; $arr = explode(':', $str); $var = $arr[1].':'....

4 Apr at 07:37

How to run a Runnable thread in Android at defined intervals?

I developed an application to display some text at defined intervals in the Android emulator screen. I am using the `Handler` class. Here is a snippet from my code: ``` handler = new Handler(); Runna...

5 Sep at 11:14

MongoDB: Is it possible to make a case-insensitive query?

Example: ``` > db.stuff.save({"foo":"bar"}); > db.stuff.find({"foo":"bar"}).count(); 1 > db.stuff.find({"foo":"BAR"}).count(); 0 ```

8 Dec at 05:18

Flatten List in LINQ

I have a LINQ query which returns `IEnumerable<List<int>>` but i want to return only `List<int>` so i want to merge all my record in my `IEnumerable<List<int>>` to only one array. Example : ``` IEnume...

26 Jan at 10:31

JavaScript global event mechanism

I would like to catch every undefined function error thrown. Is there a global error handling facility in JavaScript? The use case is catching function calls from flash that are not defined.

20 Jan at 19:29

Find records from one table which don't exist in another

I've got the following two tables (in MySQL): ``` Phone_book +----+------+--------------+ | id | name | phone_number | +----+------+--------------+ | 1 | John | 111111111111 | +----+------+----------...

14 Jan at 14:21

When should you use 'friend' in C++?

I have been reading through the [C++ FAQ](http://yosefk.com/c++fqa/) and was curious about the [friend](http://yosefk.com/c++fqa/friend.html) declaration. I personally have never used it, however I am...

15 Jun at 18:54

How can I align one item right with flexbox?

[https://jsfiddle.net/vhem8scs/](https://jsfiddle.net/vhem8scs/) Is it possible to have two items align left and one item align right with flexbox? The link shows it more clearly. The last example is...

2 Mar at 14:57

How to UPSERT (MERGE, INSERT ... ON DUPLICATE UPDATE) in PostgreSQL?

A very frequently asked question here is how to do an upsert, which is what MySQL calls `INSERT ... ON DUPLICATE UPDATE` and the standard supports as part of the `MERGE` operation. Given that Postgre...

Scripting Language vs Programming Language

Can anyone explain the difference between Scripting Language and Programming Language please? Also can you state some examples for each. I have Googled a lot but I always find the best answers from St...