Questions

How to convert a double to long without casting?

What is the best way to convert a double to a long without casting? For example: ``` double d = 394.000; long l = (new Double(d)).longValue(); System.out.println("double=" + d + ", long=" + l); ``` ...

21 Sep at 20:39

How to store image in SQLite database

In my application I am uploading an image from gallery and I want to store this image in the SQLite database. How do I store a bitmap in the database? I am converting bitmap to a string and saving it ...

12 Feb at 03:42

"psql: could not connect to server: Connection refused" Error when connecting to remote database

I am trying to connect to a Postgres database installed in a remote server using the following command: psql -h `host_ip` -U `db_username` -d `db_name` This is the error that occurs: > psql: could not...

2 Mar at 20:32

Entity framework linq query Include() multiple children entities

This may be a really elementry question but whats a nice way to include multiple children entities when writing a query that spans THREE levels (or more)? i.e. I have 4 tables: `Company`, `Employee`,...

28 Apr at 13:9

Change bar plot colour in geom_bar with ggplot2 in r

I have the following in order to bar plot the data frame. ``` c1 <- c(10, 20, 40) c2 <- c(3, 5, 7) c3 <- c(1, 1, 1) df <- data.frame(c1, c2, c3) ggplot(data=df, aes(x=c1+c2/2, y=c3)) + geom_bar(sta...

3 May at 21:21

Display date in dd/mm/yyyy format in vb.net

I want to display date in 09/07/2013 format instead of 09-jul-13. ``` Dim dt As Date = Date.Today MsgBox(dt) ```

9 Jul at 11:1

Implementing INotifyPropertyChanged - does a better way exist?

Microsoft should have implemented something snappy for `INotifyPropertyChanged`, like in the automatic properties, just specify `{get; set; notify;}` I think it makes a lot of sense to do it. Or are t...

node.js hash string?

I have a string that I want to hash. What's the easiest way to generate the hash in node.js? The hash is for versioning, not security.

21 Feb at 17:50

Can two applications listen to the same port?

Can two applications on the same machine bind to the same port and IP address? Taking it a step further, can one app listen to requests coming from a certain IP and the other to another remote IP? I ...

10 Nov at 20:34

JavaScript style.display="none" or jQuery .hide() is more efficient?

``` document.getElementById("elementId").style.display="none" ``` is used in JavaScript to hide an element. But in jQuery, ``` $("#elementId").hide(); ``` is used for the same purpose. Which way ...

23 May at 12:9

How to do joins in LINQ on multiple fields in single join

I need to do a LINQ2DataSet query that does a join on more than one field (as ``` var result = from x in entity join y in entity2 on x.field1 = y.field1 and x.field2 = y.field2 ``...

23 May at 12:10

How to know user has clicked "X" or the "Close" button?

In MSDN I found `CloseReason.UserClosing` to know that the user had decided to close the form but I guess it is the same for both clicking the X button or clicking the close button. So how can I diffe...

2 May at 17:46

Iterate over array of objects in Typescript

I need to iterate over the array of objects in angular 2 and limit the string length display for a particular key in the object. ``` this.productService.loadAllProducts(product).subscribe(data => { ...

21 Jul at 15:22

Calling a method inside another method in same class

In page 428 (the chapter about Type Information) of his "Thinking In Java, 4th Ed.", Bruce Eckel has the following example: ``` public class Staff extends ArrayList<Position> { public void add(St...

6 Sep at 20:30

React setState not updating state

So I have this: ``` let total = newDealersDeckTotal.reduce(function(a, b) { return a + b; }, 0); console.log(total, 'tittal'); //outputs correct total setTimeout(() => { this.setState({ dealersOv...

18 Nov at 08:12

Quick way to list all files in Amazon S3 bucket?

I have an amazon s3 bucket that has tens of thousands of filenames in it. What's the easiest way to get a text file that lists all the filenames in the bucket?

26 Jul at 18:43

CSS - How to Style a Selected Radio Buttons Label?

I want to add a style to a radio button's selected label: ``` <div class="radio-toolbar"> <label><input type="radio" value="all" checked>All</label> <label><input type="radio" value="false">Open<...

21 Jul at 19:10

Visual Studio debugging/loading very slow

I'm at wit's end. Visual Studio is painfully slow to debug or just plain load ("start without debugging") my ASP.NET MVC sites. Not always: at first, the projects will load nice and fast, but once th...

Declare an empty two-dimensional array in Javascript?

I want to create a two dimensional array in Javascript where I'm going to store coordinates (x,y). I don't know yet how many pairs of coordinates I will have because they will be dynamically generated...

10 Aug at 15:30

Creating a "logical exclusive or" operator in Java

## Observations: Java has a logical AND operator. Java has a logical OR operator. Java has a logical NOT operator. ## Problem: Java has no logical XOR operator, [according to sun](http://jav...

8 Apr at 11:34

python max function using 'key' and lambda expression

I come from OOP background and trying to learn python. I am using the `max` function which uses a lambda expression to return the instance of type `Player` having maximum `totalScore` among the list `...

23 Jul at 15:43

Null check operator used on a null value

I am new to `Flutter` I got this error when I run my simple flutter APP. I could not figure out why this error occurred. `Null check operator used on a null value` My code in main.dart ``` import 'pa...

16 Jun at 09:10

Dockerfile if else condition with external arguments

I have dockerfile ``` FROM centos:7 ENV foo=42 ``` then I build it ``` docker build -t my_docker . ``` and run it. ``` docker run -it -d my_docker ``` Is it possible to pass arguments from ...

27 Apr at 10:5

How to get the excel file name / path in VBA

Say, I'm writing a VBA inside my excel file . Now I want to get the of in my VBA. How do I do it?

9 Jul at 19:34

What is "git remote add ..." and "git push origin master"?

Quite often, Git and [Ruby on Rails](https://en.wikipedia.org/wiki/Ruby_on_Rails) looks like magic... such as in the [first chapter of Ruby on Rails 3 Tutorial book](http://ruby.railstutorial.org/chap...

13 Jun at 16:40