Questions

Enabling HTTPS on express.js

I'm trying to get HTTPS working on express.js for node, and I can't figure it out. This is my `app.js` code. ``` var express = require('express'); var fs = require('fs'); var privateKey = fs.readFile...

8 Dec at 12:29

Convert decimal to binary in python

Is there any module or function in python I can use to convert a decimal number to its binary equivalent? I am able to convert binary to decimal using int('[binary_value]',2), so any way to do the rev...

4 Oct at 13:26

Android: combining text & image on a Button or ImageButton

I'm trying to have an image (as the background) on a button and add dynamically, depending on what's happening during run-time, some text above/over the image. If I use `ImageButton` I don't even hav...

30 Dec at 12:5

How to access the request body when POSTing using Node.js and Express?

I have the following Node.js code: ``` var express = require('express'); var app = express.createServer(express.logger()); app.use(express.bodyParser()); app.post('/', function(request, response) { ...

24 Jun at 05:27

Setting WPF image source in code

I'm trying to set a WPF image's source in code. The image is embedded as a resource in the project. By looking at examples I've come up with the below code. For some reason it doesn't work - the image...

11 Jan at 07:3

HttpClient won't import in Android Studio

I have a simple class written in Android Studio: ``` package com.mysite.myapp; import org.apache.http.client.HttpClient; public class Whatever { public void headBangingAgainstTheWallExample () ...

What does numpy.random.seed(0) do?

What does [np.random.seed](https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html) do? ``` np.random.seed(0) ```

20 Jun at 03:18

Dealing with commas in a CSV file

I am looking for suggestions on how to handle a csv file that is being created, then uploaded by our customers, and that may have a comma in a value, like a company name. Some of the ideas we are loo...

20 Apr at 21:7

Difference between malloc and calloc?

What is the difference between doing: ``` ptr = malloc(MAXELEMS * sizeof(char *)); ``` And: ``` ptr = calloc(MAXELEMS, sizeof(char*)); ``` When is it a good idea to use `calloc` over `malloc` or vic...

3 Feb at 01:6

"No X11 DISPLAY variable" - what does it mean?

I am trying to install a Java application on my Linux machine (Slackware). I have received the following error, and I do not understand it. Could you advise me how to approach the problem? Thank y...

23 Apr at 20:40

JavaScript click event listener on class

I'm currently trying to write some JavaScript to get the attribute of the class that has been clicked. I know that to do this the correct way, I should use an event listener. My code is as follows: ...

3 Sep at 08:32

How to Refresh a Component in Angular

I am working on an Angular project. I'm struggling with refresh action in a component. I would like to refresh the router's components on button click. I have refresh button when I click on it the co...

14 May at 14:48

How do I escape a single quote ( ' ) in JavaScript?

I want to give an updated answer to this question. First, let me state if you're attempting to accomplish what I have below, I recommend that you manage events by [adding event listeners](https://dev...

6 Mar at 02:29

z-index not working with fixed positioning

I have a `div` with default positioning (i.e. `position:static`) and a `div` with a `fixed` position. If I set the z-indexes of the elements, it seems impossible to make the fixed element go behind th...

30 Jan at 01:18

Comparing date part only without comparing time in JavaScript

What is wrong with the code below? Maybe it would be simpler to just compare date and not time. I am not sure how to do this either, and I searched, but I couldn't find my exact problem. BTW, when I...

22 Jun at 06:59

CSS scrollbar style cross browser

How can I define a CSS scrollbar style cross browser? I tested this code, it only works in IE and opera, but failed in Chrome, Safari and Firefox. ``` <style type="text/css"> <!-- body { scro...

22 Sep at 02:23

Plot a horizontal line on a given plot

How do I add a horizontal line to an existing plot?

16 Jun at 20:48

Git push error '[remote rejected] master -> master (branch is currently checked out)'

Yesterday, I posted a question on how to clone a [Git](http://en.wikipedia.org/wiki/Git_%28software%29) repository from one of my machines to another, [How can I 'git clone' from another machine?](htt...

23 May at 10:31

Standardize data columns in R

I have a dataset called `spam` which contains 58 columns and approximately 3500 rows of data related to spam messages. I plan on running some linear regression on this dataset in the future, but I'd...

13 May at 09:23

How to urlencode data for curl command?

I am trying to write a bash script for testing that takes a parameter and sends it through curl to web site. I need to url encode the value to make sure that special characters are processed properly...

26 Jul at 14:6

How to align texts inside of an input?

For all default inputs, the text you fill starts on the left. How do you make it start on the right?

23 Feb at 12:42

C# code to validate email address

What is the most elegant code to validate that a string is a valid email address?

10 Jul at 15:48

Html.ActionLink as a button or an image, not a link

In the latest (RC1) release of ASP.NET MVC, how do I get Html.ActionLink to render as a button or an image instead of a link?

11 Oct at 00:24

How do I enumerate the properties of a JavaScript object?

How do I enumerate the properties of a JavaScript object? I actually want to list all the defined variables and their values, but I've learned that defining a variable actually creates a property of ...

1 Jun at 22:50

MySQL error 2006: mysql server has gone away

I'm running a server at my office to process some files and report the results to a remote MySQL server. The files processing takes some time and the process dies halfway through with the following e...

11 Nov at 06:4