Questions

How to open the Chrome Developer Tools in a new window?

When I try to use the Chrome Developer Tools, it seems I can no longer view it in a new window. Is this a bug or was that really an intended change in an update? How can we open the Chrome Developer...

Calling async method synchronously

I have an `async` method: ``` public async Task<string> GenerateCodeAsync() { string code = await GenerateCodeService.GenerateCodeAsync(); return code; } ``` I need to call this method from a...

What is the difference between `sorted(list)` vs `list.sort()`?

`list.sort()` sorts the list and replaces the original list, whereas `sorted(list)` returns a sorted copy of the list, without changing the original list. - - - `list.sort()` --- [Why do these list...

13 Sep at 17:20

Get the time difference between two datetimes

I know I can do anything and some more envolving Dates with momentjs. But embarrassingly, I'm having a hard time trying to do something that seems simple: geting the difference between 2 times. Examp...

What is the difference between JOIN and JOIN FETCH when using JPA and Hibernate

Please help me understand where to use a regular JOIN and where a JOIN FETCH. For example, if we have these two queries ``` FROM Employee emp JOIN emp.department dep ``` and ``` FROM Employee emp JOI...

7 Feb at 09:2

Add a custom attribute to a Laravel / Eloquent model on load?

I'd like to be able to add a custom attribute/property to an Laravel/Eloquent model when it is loaded, similar to how that might be achieved with [RedBean's](http://redbeanphp.com/manual/models_and_fu...

2 May at 10:12

Regex for string not ending with given suffix

I have not been able to find a proper regex to match any string ending with some condition. For example, I don't want to match anything ending with an `a`. ``` b ab 1 ``` ``` a ba ``` I know...

1 Nov at 15:31

python pandas remove duplicate columns

What is the easiest way to remove duplicate columns from a dataframe? I am reading a text file that has duplicate columns via: ``` import pandas as pd df=pd.read_table(fname) ``` The column names...

20 Feb at 17:53

Twitter bootstrap modal-backdrop doesn't disappear

I am using the Twitter bootstrap Modal dialog. When I click on the submit button of the bootstrap modal dialog, it sends an AJAX request. My problem is that the modal-backdrop doesn't disappear. The M...

15 Feb at 22:24

How to cast int to enum in C++?

How do I cast an int to an enum in C++? For example: ``` enum Test { A, B }; int a = 1; ``` How do I convert `a` to type `Test::A`?

28 May at 12:40

JavaScript code to stop form submission

One way to stop form submission is to return false from your JavaScript function. When the submit button is clicked, a validation function is called. I have a case in form validation. If that conditi...

27 Jan at 18:26

How to convert enum value to int?

I have a function which return a type int. However, I only have a value of the TAX enumeration. How can I cast the TAX enumeration value to an int? ``` public enum TAX { NOTAX(0),SALESTAX(10),IM...

16 Nov at 19:53

Is there a way to automatically generate getters and setters in Eclipse?

I am working on a new `Android` project (`Java`), and created an Object with a large number of variables. Since I am planning to add getters and setters for all of them, I was wondering: is there a sh...

How to redirect 'print' output to a file?

I want to redirect the print to a .txt file using Python. I have a `for` loop, which will `print` the output for each of my .bam file while I want to redirect output to one file. So I tried to put: `...

17 May at 10:42

Get commit list between tags in git

If I've a git repository with tags representing the versions of the releases. How can I get the list of the commits between two tags (with a pretty format if is possible) ?

31 Mar at 12:25

What's the valid way to include an image with no src?

I have an image that I will dynamically populate with a src later with javascript but for ease I want the image tag to exist at pageload but just not display anything. I know `<img src='' />` is inval...

25 Apr at 05:24

PHP Redirect with POST data

I did some research on this topic, and there are some experts who have said that it is not [possible](https://stackoverflow.com/questions/3045097/php-redirect-and-send-data-via-post), so I would like ...

1 Aug at 16:50

Collections.emptyList() vs. new instance

In practice, is it better to return an empty list like [this](http://download.oracle.com/javase/6/docs/api/java/util/Collections.html#emptyList%28%29): ``` return Collections.emptyList(); ``` Or li...

4 Jun at 08:13

Parallel.ForEach vs Task.Factory.StartNew

What is the difference between the below code snippets? Won't both be using threadpool threads? For instance if I want to call a function for each item in a collection, ``` Parallel.ForEach<Item>(it...

JAX-RS — How to return JSON and HTTP status code together?

I'm writing a REST web app (NetBeans 6.9, JAX-RS, TopLink Essentials) and trying to return JSON HTTP status code. I have code ready and working that returns JSON when the HTTP GET method is called fr...

23 Apr at 11:55

How do I check the difference, in seconds, between two dates?

There has to be an easier way to do this. I have objects that want to be refreshed every so often, so I want to record when they were created, check against the current timestamp, and refresh as neces...

24 Jun at 20:1

Avoiding "resource is out of sync with the filesystem"

I develop Java code with Eclipse and regularly get this message: > resource is out of sync with the filesystem. Right-click > Refresh will always clear this. But why can't Eclipse refresh automati...

9 Jun at 10:14

MySQL: is a SELECT statement case sensitive?

Can anyone tell me if a MySQL `SELECT` query is case sensitive or case insensitive by default? And if not, what query would I have to send so that I can do something like: ``` SELECT * FROM `table` W...

27 Feb at 21:9

What is the difference between C# and .NET?

May I know what is the difference between C# and .NET? When I think of C#, right away I would say it is a .NET language, but when I search for job posts, they require candidates to have C# and .NET ex...

17 Jul at 17:8

How to timeout a thread

I want to run a thread for some fixed amount of time. If it is not completed within that time, I want to either kill it, throw some exception, or handle it in some way. How can it be done? One way of...

26 Feb at 17:20