Questions

How do I vertically align text in a div?

I am trying to find the most effective way to align text with a div. I have tried a few things and none seem to work. ``` .testimonialText { position: absolute; left: 15px; top: 15px; width: ...

23 Jun at 16:4

Remove rows with all or some NAs (missing values) in data.frame

I'd like to remove the lines in this data frame that: a) `NA` Below is my example data frame. ``` gene hsap mmul mmus rnor cfam 1 ENSG00000208234 0 NA NA NA NA 2 ENSG00000199674 0 2...

12 Aug at 12:32

How to iterate over a dictionary?

I've seen a few different ways to iterate over a dictionary in C#. Is there a standard way?

8 May at 18:13

How can I change the color of an 'svg' element?

I want to [use this technique](http://css-tricks.com/svg-fallbacks/) and change the SVG color, but so far I haven't been able to do so. I use this in the CSS, but my image is always black, no matter w...

10 Dec at 00:53

How do I set the figure title and axes labels font size?

I am creating a figure in Matplotlib like this: ``` from matplotlib import pyplot as plt fig = plt.figure() plt.plot(data) fig.suptitle('test title') plt.xlabel('xlabel') plt.ylabel('ylabel') fig.sa...

8 Oct at 21:53

How to get the current date/time in Java

What's the best way to get the current date/time in Java?

3 May at 05:44

How do I print colored text to the terminal?

How do I output colored text to the terminal in Python?

10 Jul at 22:35

How can I get a value from a cell of a dataframe?

I have constructed a condition that extracts exactly one row from my data frame: ``` d2 = df[(df['l_ext']==l_ext) & (df['item']==item) & (df['wn']==wn) & (df['wd']==1)] ``` Now I would like to take a...

21 Aug at 19:0

How to generate a random int in C?

Is there a function to generate a random int number in C? Or will I have to use a third party library?

14 Jul at 16:39

Can't execute jar- file: "no main manifest attribute"

I have installed an application, when I try to run it (it's an executable jar) nothing happens. When I run it from the commandline with: > java -jar "app.jar" I get the following message: > no mai...

18 Apr at 11:50

How do I install a Python package with a .whl file?

I'm having trouble installing a Python package on my Windows machine, and would like to install it with Christoph Gohlke's Window binaries. (Which, to my experience, alleviated much of the fuss for ma...

15 Feb at 13:54

How can I symlink a file in Linux?

I want to make a symbolic link in Linux. I have written this Bash command where the first path is the folder I want link into and the second path is the compiled source. ``` ln -s '+basebuild+'/IpDo...

16 Nov at 23:34

How to display Base64 images in HTML

I'm having trouble displaying a Base64 image inline. How can I do it? ``` <!DOCTYPE html> <html> <head> <title>Display Image</title> </head> <body> <img style='display:block; width:100px...

25 Jul at 23:43

What is the Python equivalent for a case/switch statement?

Is there a Python equivalent for the `switch` statement?

11 May at 20:8

Converting an object to a string

How can I convert a JavaScript object into a string? Example: ``` var o = {a:1, b:2} console.log(o) console.log('Item: ' + o) ``` Output: > Object { a=1, b=2} // very nice readable output :) It...

How to get a Docker container's IP address from the host

Is there a command I can run to get the container's IP address right from the host after a new container is created? Basically, once Docker creates the container, I want to roll my own code deploymen...

8 Apr at 13:32

Writing a pandas DataFrame to CSV file

I have a dataframe in pandas which I would like to write to a CSV file. I am doing this using: ``` df.to_csv('out.csv') ``` And getting the following error: ``` UnicodeEncodeError: 'ascii' codec can'...

19 Dec at 08:51

Get int value from enum in C#

I have a class called `Questions` (plural). In this class there is an enum called `Question` (singular) which looks like this. ``` public enum Question { Role = 2, ProjectFunding = 3, Tot...

20 Feb at 10:42

Creating an empty Pandas DataFrame, and then filling it

I'm starting from the pandas DataFrame documentation here: [Introduction to data structures](http://pandas.pydata.org/pandas-docs/stable/dsintro.html) I'd like to iteratively fill the DataFrame with v...

18 Feb at 17:49

Response to preflight request doesn't pass access control check

I'm getting this error using ngResource to call a [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API on [Amazon Web Services](https://en.wikipedia.org/wiki/Amazon_Web_Services):...

How do I determine if a port is open on a Windows server?

I'm trying to install a site under an alternative port on a server, but the port may be closed by a firewall. Is there a way to ping out or in, on a specific port, to see if it is open?

3 Aug at 16:7

How to change the order of DataFrame columns?

I have the following `DataFrame` (`df`): ``` import numpy as np import pandas as pd df = pd.DataFrame(np.random.rand(10, 5)) ``` I add more column(s) by assignment: ``` df['mean'] = df.mean(1) ``...

20 Jan at 13:47

How can I replace each newline (\n) with a space using sed?

How can I replace a newline ("`\n`") with a space ("``") using the `sed` command? I unsuccessfully tried: ``` sed 's#\n# #g' file sed 's#^$# #g' file ``` How do I fix it?

6 Jan at 13:47

Sum a list of numbers in Python

Given a list of numbers such as: ``` [1, 2, 3, 4, 5, ...] ``` How do I calculate their total sum: ``` 1 + 2 + 3 + 4 + 5 + ... ``` How do I calculate their pairwise averages: ``` [(1+2)/2, (2+3)/2, (...

15 Aug at 06:35

Vanilla JavaScript equivalent of jQuery's $.ready() - how to call a function when the page/DOM is ready for it

With jQuery, we all know the wonderful `.ready()` function: ``` $('document').ready(function(){}); ``` However, let's say I want to run a function that is written in standard JavaScript with no lib...

29 Jun at 20:23