Questions

When should TaskCompletionSource<T> be used?

AFAIK, all it knows is that at some point, its `SetResult` or `SetException` method is being called to complete the `Task<T>` exposed through its `Task` property. In other words, it acts as the produc...

How to get all registered routes in Express?

I have a web application built using Node.js and Express. Now I would like to list all registered routes with their appropriate methods. E.g., if I have executed ``` app.get('/', function (...) { ... ...

16 Jan at 14:2

How to see the CREATE VIEW code for a view in PostgreSQL?

Is there an easy way to see the code used to create a view using the PostgreSQL command-line client? Something like the `SHOW CREATE VIEW` from MySQL.

1 Sep at 03:37

Replacing Pandas or Numpy Nan with a None to use with MysqlDB

I am trying to write a Pandas dataframe (or can use a numpy array) to a mysql database using MysqlDB . MysqlDB doesn't seem understand 'nan' and my database throws out an error saying nan is not in th...

4 Jan at 12:20

Create Directory When Writing To File In Node.js

I've been tinkering with Node.js and found a little problem. I've got a script which resides in a directory called `data`. I want the script to write some data to a file in a subdirectory within the...

15 Jan at 08:0

Set attribute without value

How do I set a data attribute without adding a value in jQuery? I want this: ``` <body data-body> ``` I tried: ``` $('body').attr('data-body'); // this is a getter, not working $('body').attr('dat...

18 Sep at 13:14

ERROR: there is no unique constraint matching given keys for referenced table "bar"

Trying to create this example table structure in Postgres 9.1: ``` CREATE TABLE foo ( name VARCHAR(256) PRIMARY KEY ); CREATE TABLE bar ( pkey SERIAL PRIMARY KEY, foo_fk ...

How can I bind to the change event of a textarea in jQuery?

I want to capture if any changes happened to `<textarea>`. Like typing any characters (deleting,backspace) or mouse click and paste or cut. Is there a jQuery event that can trigger for all those even...

6 Jun at 14:34

How to force HTTPS using a web.config file

I have searched around Google and StackOverflow trying to find a solution to this, but they all seem to relate to ASP.NET etc. I usually run Linux on my servers but for this one client I am using Win...

3 Dec at 22:59

What are the git concepts of HEAD, master, origin?

As I'm learning about git, I keep coming across the terms HEAD, master, origin, and I'm not sure what the differences are. If I understand correctly, HEAD is always equal to the latest revision? And i...

15 Jan at 23:53

How do I get the AM/PM value from a DateTime?

The code in question is below: ``` public static string ChangePersianDate(DateTime dateTime) { System.Globalization.GregorianCalendar PC = new System.Globalization.GregorianCalendar(); PC.C...

How to wait for 2 seconds?

How does one cause a delay in execution for a specified number of seconds? This doesn't do it: ``` WAITFOR DELAY '00:02'; ``` What is the correct format?

25 Apr at 15:37

How to restore to a different database in SQL Server?

I have a backup of from a week ago. The backup is done weekly in the scheduler and I get a `.bak` file. Now I want to fiddle with some data so I need to restore it to a different database - . I have...

24 Nov at 14:14

Passing an array by reference

How does passing a statically allocated array by reference work? ``` void foo(int (&myArray)[100]) { } int main() { int a[100]; foo(a); } ``` Does `(&myArray)[100]` have any meaning or its...

8 Nov at 20:40

jQuery: how to get which button was clicked upon form submission?

I have a `.submit()` event set up for form submission. I also have multiple forms on the page, but just one here for this example. I'd like to know which submit button was clicked without applying a...

10 Feb at 10:49

How can I find and run the keytool

I am reading an development guide of Facebook Developers at [here](http://developers.facebook.com/docs/guides/mobile/#android.) It says that I must use keytool to export the signature for my app suc...

16 Mar at 14:26

Get a list of all git commits, including the 'lost' ones

Let's say that I have a graph like this: ``` A---B---C---D (master) \ \-E---F (HEAD) ``` If I do `git log --all --oneline`, I will get all six of my commits. But if the graph is ``` A-...

28 Jul at 13:6

Android SDK Manager Not Installing Components

Not sure what I'm doing wrong here. I installed the Android SDK Manager, and am now trying to install a platform like the Android Dev website suggests. Once I clicked install I got an error stating th...

18 Oct at 18:5

What is the use of ObservableCollection in .net?

What is the use of ObservableCollection in .net?

30 Jan at 18:57

Javascript seconds to minutes and seconds

This is a common problem but I'm not sure how to solve it. The code below works fine. ``` var mind = time % (60 * 60); var minutes = Math.floor(mind / 60); var secd = mind % 60; var seconds ...

2 Nov at 08:2

SQL Server: What is the difference between CROSS JOIN and FULL OUTER JOIN?

What is the difference between CROSS JOIN and FULL OUTER JOIN in SQL Server? Are they the same, or not? Please explain. When would one use either of these?

Java: how can I split an ArrayList in multiple small ArrayLists?

How can I split an ArrayList (size=1000) in multiple ArrayLists of the same size (=10) ? ``` ArrayList<Integer> results; ```

25 Mar at 09:21

MySQL: How to copy rows, but change a few fields?

I have a large number of rows that I would like to copy, but I need to change one field. I can select the rows that I want to copy: ``` select * from Table where Event_ID = "120" ``` Now I want to...

6 May at 17:33

How to initialize array to 0 in C?

I need a big null array in C as a global. Is there any way to do this besides typing out ``` char ZEROARRAY[1024] = {0, 0, 0, /* ... 1021 more times... */ }; ``` ?

10 May at 18:51

How to bind multiple values to a single WPF TextBlock?

I'm currently using the `TextBlock` below to bind the value of a property named `Name`: ``` <TextBlock Text="{Binding Name}" /> ``` Now, I want to bind property named `ID` to the same `TextBlock`....