Questions

how to make negative numbers into positive

I am having the negative floating point number as: ``` a = -0.340515; ``` to convert this into positive number I used the abs() method as: ``` a = abs(a); ``` the result is `a = 0.000000;` But ...

29 Aug at 07:12

The apk must be signed with the same certificates as the previous version

I had uploaded my app to Google Play (back when it was called Android Market) some time ago. Today I updated the app, but I had deleted the previous keystore and created a new one. When uploading, it...

10 Oct at 11:56

How to list the certificates stored in a PKCS12 keystore with keytool?

I wanted to list the certificates stored in a PKCS12 keystore. The keystore has the extension `.pfx`

What is the difference between match_parent and fill_parent?

I'm a little confused about two XML properties: `match_parent` and `fill_parent`. It seems that both are the same. Is there any difference between them?

12 Mar at 13:35

$(window).width() not the same as media query

I am using Twitter Bootstrap on a project. As well as the default bootstrap styles I have also added some of my own ``` //My styles @media (max-width: 767px) { //CSS here } ``` I am also using...

Keyboard shortcut to comment lines in Sublime Text 3

In Sublime Text 2 it was possible to comment out a line or a block of lines with + and ++. According to the menu `Edit > Comment` these shortcuts should be valid, but in Sublime Text 3 (build 3047) t...

23 Aug at 11:10

Go to URL after OK button if alert is pressed

I need to make sure that when the user clicks OK in a JavaScript alert window, the browser moves to a different URL. Is this possible?

30 Apr at 08:21

Can constructors be async?

I have a project where I'm trying to populate some data in a constructor: ``` public class ViewModel { public ObservableCollection<TData> Data { get; set; } async public ViewModel() { ...

14 Mar at 19:29

Set the default value in dropdownlist using jQuery

I have many options in my dropdownlist like: ``` <option value="1">it's me</option> ``` I need to select the option who have value inside the tag, not by attribute like `1`. How can I do this usi...

10 Jun at 22:31

ReactJS - .JS vs .JSX

There is something I find very confusing when working in `React.js`. There are plenty of examples available on internet which use `.js` files with `React` but many others use `.jsx` files. I have read...

12 Oct at 05:11

XAMPP Port 80 in use by "Unable to open process" with PID 4

XAMPP won't work it says ``` Port 80 in use by "Unable to open process" with PID 4! 6:32:24 PM [Apache] Apache WILL NOT start without the configured ports free! 6:32:24 PM [Apache] You need ...

26 Apr at 23:25

Naming Classes - How to avoid calling everything a "<WhatEver>Manager"?

A long time ago I have read an article (I believe a blog entry) which put me on the "right" track on naming objects: Be very very scrupulous about naming things in your program. For example if my app...

Why is "except: pass" a bad programming practice?

I often see comments on other Stack Overflow questions about how the use of `except: pass` is discouraged. Why is this bad? Sometimes I just don't care what the errors are and I want to just continue ...

Regular Expression to match valid dates

I'm trying to write a regular expression that validates a date. The regex needs to match the following - - - - - So far I have ``` ^(([1-9]|1[012])[-/.]([1-9]|[12][0-9]|3[01])[-/.](19|20)\d\d)|(...

28 Nov at 15:28

How can I create a Java 8 LocalDate from a long Epoch time in Milliseconds?

I have an external API that returns me dates as `long`s, represented as milliseconds since the beginning of the Epoch. With the old style Java API, I would simply construct a `Date` from it with ```...

8 Nov at 14:43

How to sort an array in descending order in Ruby

I have an array of hashes: ``` [ { :foo => 'foo', :bar => 2 }, { :foo => 'foo', :bar => 3 }, { :foo => 'foo', :bar => 5 }, ] ``` I am trying to sort this array in descending order according t...

24 Apr at 21:59

What is the best way to conditionally apply attributes in AngularJS?

I need to be able to add for example "contenteditable" to elements, based on a boolean variable on scope. Example use: ``` <h1 attrs="{'contenteditable=\"true\"': editMode}">{{content.title}}</h1> `...

31 Jul at 15:34

pass post data with window.location.href

When using window.location.href, I'd like to pass POST data to the new page I'm opening. is this possible using JavaScript and jQuery?

3 Mar at 00:25

MySQL INNER JOIN select only one row from second table

I have a `users` table and a `payments` table, for each user, those of which have payments, may have multiple associated payments in the `payments` table. I would like to select all users who have pay...

27 Feb at 14:49

What does the question mark character ('?') mean in C++?

``` int qempty() { return (f == r ? 1 : 0); } ``` In the above snippet, what does "?" mean? What can we replace it with?

12 Sep at 16:52

What is the difference between linear regression and logistic regression?

When we have to predict the value of a [categorical](https://en.wikipedia.org/wiki/Categorical_variable) (or discrete) outcome we use [logistic regression](https://en.wikipedia.org/wiki/Logistic_regre...

HttpClient - A task was cancelled?

It works fine when have one or two tasks however throws an error "A task was cancelled" when we have more than one task listed. ![enter image description here](https://i.stack.imgur.com/zZojw.png) `...

Android Emulator Error Message: "PANIC: Missing emulator engine program for 'x86' CPUS."

I am trying to run a Android Emulator by using AVD Manager. this is my avd: [http://image-upload.de/image/fnx79V/52b0d050ee.png](http://image-upload.de/image/fnx79V/52b0d050ee.png) and this is what h...

13 Apr at 10:6

Remote debugging Tomcat with Eclipse

I can't seem to debug the tomcat application through Eclipse. I've set `CATALINA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n` and then I run `bin/catalina.sh`, where...

23 May at 11:53

Odd behavior when Java converts int to byte?

``` int i =132; byte b =(byte)i; System.out.println(b); ``` Mindboggling. Why is the output `-124`?

28 May at 23:40