Questions

Remove duplicate dict in list in Python

I have a list of dicts, and I'd like to remove the dicts with identical key and value pairs. For this list: `[{'a': 123}, {'b': 123}, {'a': 123}]` I'd like to return this: `[{'a': 123}, {'b': 123}]`...

11 Jan at 11:12

Fastest way to reset every value of std::vector<int> to 0

What's the fastest way to reset every value of a `std::vector<int>` to 0 and keeping the vectors initial size ? A for loop with the [] operator ?

9 Jul at 15:5

How can I compare software version number using JavaScript? (only numbers)

Here is the software version number: ``` "1.0", "1.0.1", "2.0", "2.0.0.1", "2.0.1" ``` How can I compare this? Assume the correct order is: ``` "1.0", "1.0.1", "2.0", "2.0.0.1", "2.0.1" ``` The idea...

27 Oct at 03:9

How can I make setInterval also work when a tab is inactive in Chrome?

I have a `setInterval` running a piece of code 30 times a second. This works great, however when I select another tab (so that the tab with my code becomes inactive), the `setInterval` is set to an id...

20 Apr at 00:26

Constructor of an abstract class in C#

Why is it possible to write constructor for an abstract class in C#? As far as I know we can't instantiate an abstract class.. so what is it for? You can't instantiate the class, right?

15 Mar at 12:41

Android: TextView: Remove spacing and padding on top and bottom

When I have a `TextView` with a `\n` in the text,, on the right I have two `singleLine` `TextView`s, one below the other with no spacing in between. I have set the following for all three `TextView`s....

30 Dec at 09:59

java: Class.isInstance vs Class.isAssignableFrom

Let `clazz` be some `Class` and `obj` be some `Object`. Is ``` clazz.isAssignableFrom(obj.getClass()) ``` always the same as ``` clazz.isInstance(obj) ``` ? If not, what are the differences?

18 Oct at 06:19

Boolean vs boolean in Java

There are discussions around `Integer` vs `int` in Java. The default value of the former is `null` while in the latter it's `0`. How about `Boolean` vs `boolean`? A variable in my application can ha...

24 May at 01:19

How to plot two histograms together in R?

I am using R and I have two data frames: carrots and cucumbers. Each data frame has a single numeric column that lists the length of all measured carrots (total: 100k carrots) and cucumbers (total: 50...

10 May at 14:0

What version of javac built my jar?

How can I tell what version of the Java compiler was used to build a jar? I have a jar file, and it could have been built in any one of three JDKs. We need to know exactly which one, so we can certi...

19 Apr at 21:37

How to change the timeout on a .NET WebClient object

I am trying to download a client's data to my local machine (programatically) and their webserver is very, very slow which is causing a timeout in my `WebClient` object. Here is my code: ``` WebClie...

24 Nov at 11:59

static const vs #define

Is it better to use `static const` vars than `#define` preprocessor? Or maybe it depends on the context? What are advantages/disadvantages for each method?

29 Oct at 08:38

Shell script "for" loop syntax

I have gotten the following to work: ``` for i in {2..10} do echo "output: $i" done ``` It produces a bunch of lines of `output: 2`, `output: 3`, so on. However, trying to run the following: ...

19 Jan at 22:8

How to make my font bold using css?

I'm very new to HTML and CSS and I was just wondering how I could make my font bold using CSS. I have a plain HTML page that imports a CSS file, and I can change the font in the CSS. But I don't know...

22 Nov at 17:26

How many threads can a Java VM support?

How many threads can a Java VM support? Does this vary by vendor? by operating system? other factors?

6 Aug at 16:18

Quick easy way to migrate SQLite3 to MySQL?

Anyone know a quick easy way to migrate a SQLite3 database to MySQL?

20 Aug at 19:49

How to resolve symbolic links in a shell script

Given an absolute or relative path (in a Unix-like system), I would like to determine the full path of the target after resolving any intermediate symlinks. Bonus points for also resolving ~username n...

29 Jul at 04:29

How to read file with async/await properly?

I cannot figure out how `async`/`await` works. I slightly understand it but I can't make it work. ``` function loadMonoCounter() { fs.readFileSync("monolitic.txt", "binary", async function(err, da...

11 Jul at 14:26

React: why child component doesn't update when prop changes

Why in the following pseudo-code example Child doesn't re-render when Container changes foo.bar? ``` Container { handleEvent() { this.props.foo.bar = 123 }, render() { return <Child b...

11 Aug at 09:40

CGRectMake, CGPointMake, CGSizeMake, CGRectZero, CGPointZero is unavailable in Swift

After converting code to latest swift 3.0 I am shown this error. [](https://i.stack.imgur.com/yvqDR.png)[](https://i.stack.imgur.com/IsyeI.png) Also tell me solution for `CGSize = CGSizeMake(0,0)` ...

9 Nov at 05:2

"Gradle Version 2.10 is required." Error

As I've been using ``` classpath 'com.android.tools.build:gradle:+' ``` In the file, I got the following error since has been released. The error is : > Warning:Gradle version 2.10 is required....

Retrofit 2 - Dynamic URL

With Retrofit 2, you can set a full URL in the annotation of a service method like : ``` public interface APIService { @GET("http://api.mysite.com/user/list") Call<Users> getUsers(); } ``` How...

14 Sep at 07:29

Error: unable to verify the first certificate in nodejs

I'm trying to download a file from jira server using an URL but I'm getting an error. how to include certificate in the code to verify? ``` Error: unable to verify the first certificate in nodejs at...

6 Apr at 09:20

Material effect on button with background color

I am using Android v21 support library. I have created a button with custom background color. The Material design effects like ripple, reveal are gone (except the elevation on click) when I use the ...

15 Dec at 20:33

Migration: Cannot add foreign key constraint

I'm trying to create foreign keys in Laravel however when I migrate my table using `artisan` i am thrown the following error: ``` [Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: ...