Questions

How to extract request http headers from a request using NodeJS connect

I'd like to get the "Host" header of a request made using Node JS's connect library bundle. My code looks like: ``` var app = connect() .use(connect.logger('dev')) .use(connect.static('public'))...

30 Oct at 21:30

Altering a column to be nullable

I want to alter a table column to be nullable. I have used: ``` ALTER TABLE Merchant_Pending_Functions Modify NumberOfLocations NULL ``` This gives an error at `Modify`. What is the correct syntax...

6 Mar at 14:12

How to fix: "No suitable driver found for jdbc:mysql://localhost/dbname" error when using pools?

I am trying to create a connection to my database, when I put test my code using the main method, it works seamlessly. However, when trying to access it through Tomcat 7, it fails with error: ``` No...

In Python, how do you convert a `datetime` object to seconds?

I have a bunch of datetime objects and I want to calculate the number of seconds since a fixed time in the past for each one (for example since January 1, 1970). ``` import datetime t = datetime.datet...

29 Dec at 00:54

How to use sudo inside a docker container?

Normally, docker containers are run using the user . I'd like to use a different user, which is no problem using docker's USER directive. But this user should be able to use inside the container. Thi...

7 Apr at 18:13

Reading string from input with space character?

I'm using Ubuntu and I'm also using Geany and CodeBlock as my IDE. What I'm trying to do is reading a string (like `"Barack Obama"`) and put it in a variable: ``` #include <stdio.h> int main(void) {...

17 Jun at 16:41

Compare two columns using pandas

Using this as a starting point: ``` a = [['10', '1.2', '4.2'], ['15', '70', '0.03'], ['8', '5', '0']] df = pd.DataFrame(a, columns=['one', 'two', 'three']) ``` which looks like ``` one two three 0 ...

28 Oct at 00:11

Vue.js redirection to another page

I'd like to make a redirection in `Vue.js` similar to the vanilla javascript ``` window.location.href = 'some_url' ``` How could I achieve this in Vue.js?

25 Nov at 05:52

How can I view an old version of a file with Git?

Is there a command in Git to see (either dumped to stdout, or in `$PAGER` or `$EDITOR`) a particular version of a particular file?

16 Jul at 11:30

How do I convert a string to a double in Python?

I would like to know how to convert a string containing digits to a double.

17 Jun at 13:24

How do I upgrade to Python 3.6 with Conda?

I want to get the latest version of Python to use [f-strings](https://en.wikipedia.org/wiki/Python_(programming_language)#Expressions) in my code. Currently my version is (`python -V`): ``` Python 3.5...

21 Feb at 01:3

Random number between 0 and 1?

I want a random number between 0 and 1, like 0.3452. I used `random.randrange(0, 1)` but it is always 0 for me. What should I do?

15 May at 18:44

Adding days to $Date in PHP

I have a date returned as part of a MySQL query in the form `2010-09-17`. I would like to set the variables $Date2 to $Date5 as follows: `$Date2 = $Date + 1` `$Date3 = $Date + 2` etc., so that it retu...

26 Jan at 14:22

How to check Oracle database for long running queries

My application, which uses an Oracle database, is going slow or appears to have stopped completely. How can find out which queries are most expensive, so I can investigate further?

29 Sep at 14:54

How to resize an image with OpenCV2.0 and Python2.6

I want to use OpenCV2.0 and Python2.6 to show resized images. I used and adopted [this](http://opencv.willowgarage.com/documentation/python/cookbook.html) example but unfortunately, this code is for O...

Finding all possible combinations of numbers to reach a given sum

How would you go about testing all possible combinations of additions from a given set `N` of numbers so they add up to a given final number? A brief example: - `N = {1,5,22,15,0,...}`- `12345`

List of Stored Procedures/Functions Mysql Command Line

How can I see the list of the stored procedures or stored functions in mysql command line like `show tables;` or `show databases;` commands.

mongo - couldn't connect to server 127.0.0.1:27017

I am coming from riak and redis where I never had an issue with this services starting, or to interact. This is a pervasive problem with mongo and am rather clueless. Restarting does not help.I am n...

9 Nov at 16:48

jQuery on window resize

I have the following JQuery code: ``` $(document).ready(function () { var $containerHeight = $(window).height(); if ($containerHeight <= 818) { $('.footer').css({ position...

15 Dec at 12:19

Format date in a specific timezone

I'm using [Moment.js](http://momentjs.com/) to parse and format dates in my web app. As part of a JSON object, my backend server sends dates as a number of milliseconds from the UTC epoch (Unix offset...

7 Dec at 01:0

Getting java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory exception

i am executing simple Dependency Injection program of spring & getting this exception. I have already included common-logging1.1.1.jar and spring.jar file. Could you please help to out? ``` Exceptio...

11 Oct at 21:11

How do I know the script file name in a Bash script?

How can I determine the name of the Bash script file inside the script itself? Like if my script is in file `runme.sh`, then how would I make it to display "You are running runme.sh" message without ...

21 Dec at 23:57

plot a circle with pyplot

surprisingly I didn't find a straight-forward description on how to draw a circle with matplotlib.pyplot (please no pylab) taking as input center (x,y) and radius r. I tried some variants of this: ``...

9 Feb at 17:23

Git: Merge a Remote branch locally

I've pulled all remote branches via `git fetch --all`. I can see the branch I'd like to merge via `git branch -a` as remotes/origin/branchname. Problem is it is not accessible. I can't merge or checko...

23 Jul at 11:4

How to change the button text of <input type="file" />?

``` <input type="file" value="Browse" name="avatar" id="id_avatar" /> ``` I tried to modify the `value`, but it's not working. How to customize the button text?

21 Jan at 12:10