Questions

Appending to an empty DataFrame in Pandas?

Is it possible to append to an empty data frame that doesn't contain any indices or columns? I have tried to do this, but keep getting an empty dataframe at the end. e.g. ``` import pandas as pd df =...

1 Apr at 11:56

How to send file contents as body entity using cURL

I am using cURL command line utility to send HTTP POST to a web service. I want to include a file's contents as the body entity of the POST. I have tried using `-d </path/to/filename>` as well as ot...

24 Jan at 23:38

Rails raw SQL example

How can I convert this code to raw sql and use in rails? Because When I deploy this code in heroku,there is a request timeout error.I think this will be faster if I use raw sql. ``` @payments = Payme...

24 Apr at 23:29

Adding elements to object

I need to populate a json file, now I have something like this: ``` {"element":{"id":10,"quantity":1}} ``` And I need to add another "element". My first step is putting that json in a Object type u...

24 Aug at 20:56

How to remove indentation from an unordered list item?

I want to remove all indentation from `ul`. I tried setting `margin`, `padding`, `text-indent` to `0`, but no avail. Seems that setting `text-indent` to a negative number does the trick - but is that ...

30 Jul at 20:58

How do I update an entity using spring-data-jpa?

Well the question pretty much says everything. Using JPARepository how do I update an entity? JPARepository has only a method, which does not tell me if it's create or update actually. For example, ...

25 Sep at 06:58

Determine if the device is a smartphone or tablet?

I would like to get info about a device to see if it's a smartphone or tablet. How can I do it? I would like to show different web pages from resources based on the type of device: ``` String s="...

13 Apr at 15:37

Confirm deletion in modal / dialog using Twitter Bootstrap?

I have an HTML table of rows tied to database rows. I'd like to have a "delete row" link for each row, but I would like to confirm with the user beforehand. Is there any way to do this using the Twit...

18 Sep at 14:45

input type="submit" Vs button tag are they interchangeable?

`input type="submit"` and `button` tag are they interchangeable? or if there is any difference then When to use `input type="submit"` and when `button` ? And if there is no difference then why we hav...

How do I get the last 5 elements, excluding the first element from an array?

In a JavaScript array, how do I get the last 5 elements, ? ``` [1, 55, 77, 88] // ...would return [55, 77, 88] ``` --- ``` [1, 55, 77, 88, 99, 22, 33, 44] // ...would return [88, 99, 22, 33, 44] ...

5 Apr at 15:42

Get Context in a Service

Is there any reliable way to get a `Context` from a `Service`? I want to register a broadcast receiver for `ACTION_PHONE_STATE_CHANGED` but I don't need my app to always get this information, so I do...

Checking if an object is null in C#

I would like to prevent further processing on an object if it is null. In the following code I check if the object is null by either: ``` if (!data.Equals(null)) ``` and ``` if (data != null) ```...

21 Apr at 20:21

How to convert Set<String> to String[]?

I need to get a `String[]` out of a `Set<String>`, but I don't know how to do it. The following fails: ``` Map<String, ?> myMap = gpxlist.getAll(); Set<String> myset = myMap.keySet(); String[] GPXFIL...

12 May at 18:45

How to control the line spacing in UILabel

Is it possible to reduce the gap between text, when put in multiple lines in a `UILabel`? We can set the frame, font size and number of lines. I want to reduce the gap between the two lines in that la...

Unicode character for "X" cancel / close?

I want to create a close button using CSS only. I'm sure I'm not the first to do this, so does anyone know which font has an 'x' the same width as height, so that it can be used cross-browser to look...

18 Apr at 15:57

How to convert a UTC datetime to a local datetime using only standard library?

I have a python `datetime` instance that was created using `datetime.utcnow()` and persisted in database. For display, I would like to convert the `datetime` instance retrieved from the database to lo...

Remove all special characters with RegExp

I would like a RegExp that will remove all special characters from a string. I am trying something like this but it doesn’t work in IE7, though it works in Firefox. ``` var specialChars = "!@#$^&%*()...

18 Apr at 10:12

Display image as grayscale using matplotlib

I'm trying to display a grayscale image using `matplotlib.pyplot.imshow()`. My problem is that the grayscale image is displayed as a colormap. I need it to be grayscale because I want to draw on top...

23 Jun at 04:39

jQuery's .click - pass parameters to user function

I am trying to call a function with parameters using jQuery's .click, but I can't get it to work. This is how I want it to work: `$('.leadtoscore').click(add_event('shot'));` which calls ``` funct...

Multiple GitHub Accounts & SSH Config

I'm having some trouble getting two different SSH keys/GitHub accounts to play well together. I have the following setup: Repos accessible from one account using `git@github.com:accountname` Repos ...

21 Oct at 19:33

How to scroll an HTML page to a given anchor

I’d like to make the browser to scroll the page to a given anchor, just by using JavaScript. I have specified a `name` or `id` attribute in my HTML code: ``` <a name="anchorName">..</a> ``` or ``` <h...

28 Jul at 21:8

Is it possible to declare two variables of different types in a for loop?

Is it possible to declare two variables of different types in the initialization body of a for loop in C++? For example: ``` for(int i=0,j=0 ... ``` defines two integers. Can I define an `int` and...

22 Apr at 00:53

How to convert an integer to a string in any base?

Python allows easy creation of an integer from a string of a given base via ``` int(str, base). ``` I want to perform the inverse: , i.e. I want some function `int2base(num, base)`, such that: `...

28 Apr at 13:42

frequent issues arising in android view, Error parsing XML: unbound prefix

I have frequent problem in android view, `Error parsing XML: unbound prefix on Line 2`. ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:orientation="vertical" android:id="@+id/myScro...

Which HTML elements can receive focus?

I'm looking for a definitive list of HTML elements which are allowed to take focus, i.e. which elements will be put into focus when `focus()` is called on them? I'm writing a jQuery extension which w...

1 Sep at 15:13