Questions

Applying function with multiple arguments to create a new pandas column

I want to create a new column in a `pandas` data frame by applying a function to two existing columns. Following this [answer](https://stackoverflow.com/a/14603893/2327821) I've been able to create a ...

23 May at 10:31

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

Set Matplotlib colorbar size to match graph

I cannot get the colorbar on imshow graphs like this one to be the same height as the graph, short of using Photoshop after the fact. How do I get the heights to match?![Example of the colorbar size m...

20 Jun at 09:12

How to use continue in jQuery each() loop?

In my application i am using AJAX call. I want to use `break` and `continue` in this jQuery loop. ``` $('.submit').filter(':checked').each(function() { }); ```

1 Nov at 19:35

Auto-center map with multiple markers in Google Maps API v3

This is what I use to display a map with 3 pins/markers: ``` <script> function initialize() { var locations = [ ['DESCRIPTION', 41.926979, 12.517385, 3], ['DESCRIPTION', 41.914873, ...

Replacing blank values (white space) with NaN in pandas

I want to find all values in a Pandas dataframe that contain whitespace (any arbitrary amount) and replace those values with NaNs. Any ideas how this can be improved? Basically I want to turn this: ...

21 Jan at 09:25

How do you implement a re-try-catch?

Try-catch is meant to help in the exception handling. This means somehow that it will help our system to be more robust: try to recover from an unexpected event. We suspect something might happen wh...

18 Oct at 06:57

How do I resolve the "java.net.BindException: Address already in use: JVM_Bind" error?

In Eclipse, I got this error: ``` run: [java] Error creating the server socket. [java] Oct 04, 2012 5:31:38 PM cascadas.ace.AceFactory bootstrap [java] SEVERE: Failed to create world :...

How to get child element by class name?

I'm trying to get the child span that has a class = 4. Here is an example element: ``` <div id="test"> <span class="one"></span> <span class="two"></span> <span class="three"></span> <span class=...

6 Feb at 07:30

How to output a comma delimited list in jinja python template?

If I have a list of `users` say `["Sam", "Bob", "Joe"]`, I want to do something where I can output in my jinja template file: ``` {% for user in userlist %} <a href="/profile/{{ user }}/">{{ user...

9 Sep at 19:55

Find all files with name containing string

I have been searching for a command that will return files from the current directory which contain a string in the filename. I have seen `locate` and `find` commands that can find files beginning wit...

3 Dec at 12:22

How to convert integer timestamp into a datetime

I have a data file containing timestamps like "1331856000000". Unfortunately, I don't have a lot of documentation for the format, so I'm not sure how the timestamp is formatted. I've tried Python's st...

7 Jun at 21:40

Git index.lock File exists when I try to commit, but I cannot delete the file

When I do 'git commit', I'm getting the following: `fatal: Unable to create 'project_path/.git/index.lock': File exists.` However, when I do `ls project_path/.git/index.lock` it's saying the file does...

16 Feb at 05:26

How to get overall CPU usage (e.g. 57%) on Linux

I am wondering how you can get the system CPU usage and present it in percent using bash, for example. Sample output: ``` 57% ``` In case there is more than one core, it would be nice if an averag...

15 Feb at 11:49

How to cut an entire line in vim and paste it?

I know how to use the `v` command in vim, but I need something which will delete an entire line and it should allow me to paste the same line somewhere else.

7 Jan at 21:59

How I can delete in VIM all text from current line to end of file?

I have very large files (more than 10Gb). I need only some lines from the top of the file. Is it possible (in vim) to delete the rest of the file (from current line to the end of file)?

3 Jul at 12:46

Insert line break inside placeholder attribute of a textarea?

I have tried a few approaches but none worked. Does anyone know a the nifty trick to get around this? ``` <textarea placeholder='This is a line \n this should be a new line'></textarea> <textarea pl...

12 Aug at 15:0

Is an anchor tag without the href attribute safe?

Is it okay to use an anchor tag without including the `href` attribute, and instead using a JavaScript click event handler? So I would omit the `href` completely, not even have it empty (`href=""`).

20 Jan at 15:26

Set opacity of background image without affecting child elements

Is it possible to set the opacity of a background image without affecting the opacity of child elements? # Example All links in the footer need a custom bullet (background image) and the opacity ...

21 Jan at 18:8

What, exactly, is needed for "margin: 0 auto;" to work?

I know that setting `margin: 0 auto;` on an element is used to centre it (left-right). However, I know that the element and its parent must meet certain criteria for the auto margin to work, and I can...

10 Feb at 09:7

How to step through Python code to help debug issues?

In Java/C# you can easily step through code to trace what might be going wrong, and IDE's make this process very user friendly. Can you trace through python code in a similar fashion?

30 Jan at 05:16

How do I delay a function call for 5 seconds?

I want `widget.Rotator.rotate()` to be delayed 5 seconds between calls... how do I do this in jQuery... it seems like jQuery's `delay()` wouldn't work for this...

19 Jan at 17:33

The requested operation cannot be performed on a file with a user-mapped section open

Whenever I tried to copy 4 files into my bin folder, after stopping the main service, I am getting an error with one file (TexteDll). The error is: ``` Cannot copy TexteDll: The requested operation c...

17 Oct at 09:3

The type initializer for 'MyClass' threw an exception

The following is my Windows service code. When I am debugging the code, I am getting the error/ exception: > The type initializer for 'CSMessageUtility.CSDetails' threw an exception. ``` using Syste...

26 Jul at 19:33

How to change the text on the action bar

Currently it just displays the name of the application and I want it to display something custom and be different for each screen in my app. For example: my home screen could say 'page1' in the actio...

17 Jan at 10:6