Questions

Awaiting multiple Tasks with different results

I have 3 tasks: ``` private async Task<Cat> FeedCat() {} private async Task<House> SellHouse() {} private async Task<Tesla> BuyCar() {} ``` They all need to run before my code can continue and I ne...

FB OpenGraph og:image not pulling images (possibly https?)

Facebook cannot grasp my `og:image` files and I have tried every usual solution. I'm beginning to think it might have something to do with `https://...` - [http://developers.facebook.com/tools/debug](...

Can a class member function template be virtual?

I have heard that C++ class member function templates can't be virtual. Is this true? If they can be virtual, what is an example of a scenario in which one would use such a function?

Using Mockito to mock classes with generic parameters

Is there a clean method of mocking a class with generic parameters? Say I have to mock a class `Foo<T>` which I need to pass into a method that expects a `Foo<Bar>`. I can do the following easily en...

30 Oct at 22:48

How do I use reflection to invoke a private method?

There are a group of private methods in my class, and I need to call one dynamically based on an input value. Both the invoking code and the target methods are in the same instance. The code looks lik...

12 Dec at 14:18

What are the differences between delegates and events?

What are the differences between delegates and an events? Don't both hold references to functions that can be executed?

30 Sep at 15:9

How do I Pandas group-by to get sum?

I am using this dataframe: ``` Fruit Date Name Number Apples 10/6/2016 Bob 7 Apples 10/6/2016 Bob 8 Apples 10/6/2016 Mike 9 Apples 10/7/2016 Steve 10 Apples 10/7/2016 Bob 1 Ora...

@ViewChild in *ngIf

## Question What is the most elegant way to get `@ViewChild` after corresponding element in template was shown? Below is an example. Also [Plunker](http://plnkr.co/edit/xAhnVVGckjTHLHXva6wp?p=previ...

Is __init__.py not required for packages in Python 3.3+

I am using Python 3.5.1. I read the document and the package section here: [https://docs.python.org/3/tutorial/modules.html#packages](https://docs.python.org/3/tutorial/modules.html#packages) Now, I ...

8 May at 03:13

Difference and uses of onCreate(), onCreateView() and onActivityCreated() in fragments

What are the differences between `onCreate()`, `onCreateView()`, and `onActivityCreated()` in fragments and what would they each be used for?

Facebook Graph API v2.0+ - /me/friends returns empty, or only friends who also use my application

I am trying to get my friend name and ids with Graph API v2.0, but data returns empty: ``` { "data": [ ] } ``` When I was using v1.0, everything was OK with the following request: ``` FBReques...

Auto reloading python Flask app upon code changes

I'm investigating how to develop a decent web app with Python. Since I don't want some high-order structures to get in my way, my choice fell on the lightweight [Flask framework](https://flask.pallets...

12 Jan at 21:9

Getting rid of \n when using .readlines()

I have a .txt file with values in it. The values are listed like so: ``` Value1 Value2 Value3 Value4 ``` My goal is to put the values in a list. When I do so, the list looks like this: `['Value1\n', ...

31 May at 13:26

How to get time in milliseconds since the unix epoch in Javascript?

> [How do you get a timestamp in JavaScript?](https://stackoverflow.com/questions/221294/how-do-you-get-a-timestamp-in-javascript) [Calculating milliseconds from epoch](https://stackoverflow.com/...

23 May at 11:47

Spring RestTemplate GET with parameters

I have to make a `REST` call that includes custom headers and query parameters. I set my `HttpEntity` with just the headers (no body), and I use the `RestTemplate.exchange()` method as follows: ``` H...

13 Nov at 15:4

Find size of Git repository

What's a simple way to find the size of my Git repository? And I don't mean `du -h` on the root directory of my repository. I have a lot of ignored files, so that size would be different from my tota...

25 Mar at 23:31

What is the difference between git clone and checkout?

What is the difference between `git clone` and `git checkout`?

13 Sep at 03:15

Write to file, but overwrite it if it exists

``` echo "text" >> 'Users/Name/Desktop/TheAccount.txt' ``` How do I make it so it creates the file if it doesn't exist, but overwrites it if it already exists. Right now this script just appends.

25 Feb at 03:1

What is the use of static constructors?

Please explain to me the use of static constructor. Why and when would we create a static constructor and is it possible to overload one?

20 Mar at 16:15

XPath contains(text(),'some string') doesn't work when used with node with more than one Text subnode

I have a small problem with XPath contains with dom4j ... Let's say my XML is ``` <Home> <Addr> <Street>ABC</Street> <Number>5</Number> <Comment>BLAH BLAH BLAH <br/><br/>AB...

24 Feb at 17:17

Clear the entire history stack and start a new activity on Android

Is it possible to start an activity on the stack, clearing the entire history before it? I have an activity stack that either goes A->B->C or B->C (screen A selects the users token, but many users ...

14 Aug at 09:18

What's the most efficient way to test if two ranges overlap?

Given two inclusive ranges [x1:x2] and [y1:y2], where `x1 ≤ x2` and `y1 ≤ y2`, what is the most efficient way to test whether there is any overlap of the two ranges? A simple implementation is as foll...

17 Nov at 09:44

Remove duplicates in the list using linq

I have a class `Items` with `properties (Id, Name, Code, Price)`. The List of `Items` is populated with duplicated items. For ex.: ``` 1 Item1 IT00001 $100 2 Item2 ...

22 Oct at 12:26

What is the difference between NULL, '\0' and 0?

In C, there appear to be differences between various values of zero -- `NULL`, `NUL` and `0`. I know that the ASCII character `'0'` evaluates to `48` or `0x30`. The `NULL` pointer is usually defined...

10 May at 13:40

Loop backwards using indices

I am trying to loop from 100 to 0. How do I do this in Python? `for i in range (100,0)` doesn't work. --- `range`[Why are slice and range upper-bound exclusive?](https://stackoverflow.com/questions...

4 Jan at 04:22