How do I split a string with any whitespace chars as delimiters?

How do I split a string with any whitespace chars as delimiters?

What regex pattern would need I to pass to the java.lang.String.split() method to split a String into an Array of substrings using all whitespace characters (' ', '\t', '\n', etc.) as delimiters? 1:Something in the lines ofmyString.split

Create a dictionary with list comprehension in Python

Create a dictionary with list comprehension in Python

I like the Python list comprehension syntax.Can it be used to create dictionaries too? For example, by iterating over pairs of keys and values:mydict = {(k,v) for (k,v) in blah blah blah} # doesn't work 1:In Python 2.6 and earlier, the

How to get UTF-8 working in Java webapps?

How to get UTF-8 working in Java webapps?

I need to get UTF-8 working in my Java webapp (servlets + JSP, no framework used) to support äöå etc. for regular Finnish text and Cyrillic alphabets like ЦжФ for special cases.My setup is the following:Development environment: Windows XPPr

How to close current tab in a browser window?

How to close current tab in a browser window?

I want to create a link on a webpage that would close current active tab in a browser without closing other tabs in the browser. When user clicks close link, an alert message should appear asking user to confirm with two buttons, "YES" and

PHP + curl, HTTP POST sample code?

PHP + curl, HTTP POST sample code?

Can anyone show me how to do a php curl with an HTTP POST?I want to send data like this:username=user1, password=passuser1, gender=1To www.domain.comI expect the curl to return a response like result=OK. Are there any examples? 1:<?php/

Java: splitting a comma-separated string but ignoring commas in quotes

Java: splitting a comma-separated string but ignoring commas in quotes

I have a string vaguely like this:foo,bar,c;qual="baz,blurb",d;junk="quux,syzygy"that I want to split by commas -- but I need to ignore commas in quotes. How can I do this? Seems like a regexp approach fails; I suppose I can manually scan a

Local variables in Python nested functions

Local variables in Python nested functions

Okay, bear with me on this, I know it's going to look horribly convoluted, but please help me understand what's happening.from functools import partialclass Cage(object): def __init__(self, animal): self.animal = animaldef gotimes

console.log() async or sync?

console.log() async or sync?

I am currently reading Async Javascript by Trevor Burnham. This has been a great book so far.He talks about this snippet and console.log being 'async' in the Safari and Chrome console. Unfortunately I can't replicate this. Here is the code

What are the best JVM settings for Eclipse? [closed]

What are the best JVM settings for Eclipse? [closed]

What are the best JVM settings you have found for running Eclipse? 1:It is that time of year again: "eclipse.ini take 3" the settings strike back! Eclipse Helios 3.6 and 3.6.x settingsalt text http://www.eclipse.org/home/promotions/frie

How to append text to an existing file in Java

How to append text to an existing file in Java

I need to append text repeatedly to an existing file in Java. How do I do that? 1:Are you doing this for logging purposes? If so there are several libraries for this. Two of the most popular are Log4j and Logback.Java 7+If you just need

Is quitting an application frowned upon?

Is quitting an application frowned upon?

Moving on in my attempt to learn Android, I just read the following: Question: Does the user have a choice to kill the application unless we put a menu option in to kill it? If no such option exists, how does the user terminate the app

Is there any available API to represent various units of item like KG, Litre, Metre, KM, etc

Is there any available API to represent various units of item like KG, Litre, Metre, KM, etc

In my project, somewhere I have to work with a unitOfIssue of Items. Now, various items of course can have different units of representation. So, I was searching for some API or some way, to elegantly handle this situation.Is there any avai

Upload to heroku without git

Upload to heroku without git

Im making a tiny web app, really just for personal testing, the app is built with php / mysql, i plan to host it on heroku, but i was wondering is it possible to host stuff on heroku without pushing from git. I am not too keen on using git

Android widget not showing up on the list after developed

Android widget not showing up on the list after developed

I'm upgrading my app with widget. It's not the first widget I've done. I was always encountering weird issues, but the widget was shwoing up on the list eventually.Here is what I've done so far:Created widget_layout.xmlCreated widget_info.x

WkHTMLtoPDF not loading local CSS and images

WkHTMLtoPDF not loading local CSS and images

I've seen multiple questions that are very similar to this one, so I was hesitant at first to post it. But nothing suggested resolved my issue and I can't seem to figure out what's wrong myself.For a project I made for one client they wante

Check if a collection contains an object, comparing by reference

Check if a collection contains an object, comparing by reference

The Collection.contains() method check if a collection contains a given object, using the .equals() method to perform the comparison.From Java7 Javadoc: boolean contains(Object o) Returns true if this collection contains the specified

-webkit-linear-gradient causes banding in Chrome/Safari

-webkit-linear-gradient causes banding in Chrome/Safari

The title prettymuch says it all. The first picture below is a screenshot when the whole page is about 8000 pixels tall, taken in the latest version of Chrome:while this picture is for a different page (using the same CSS) which is about 80

Escape pound or number sign in Github issue tracker

Escape pound or number sign in Github issue tracker

If I type #1 when creating an Issue in Github, it will reference to Issue ID 1. Is there a way to avoid this by escaping the # sign? I just need it to be regular text. 1:TL;DR—my personal favouriteseither type#1or#1or#1In the lat

Do collaborators have commit access on GitHub?

Do collaborators have commit access on GitHub?

One thing I noticed: Using the GitHub UI, I added a collaborator to a repository. I saw that they committed changes without any authority / approval from me. It was a private repository.With private repositories, how do I give someone read

Random chat with 2 users at a time (Socket.io)

Random chat with 2 users at a time (Socket.io)

I just started learning NodeJS and Socket.io... Until now I have this demo code, from official socket.io site:http://socket.io/demos/chat/I am able to get the unique client's ID of each user (socket) which connects, I am still trying to fig

Replacing values in one column with another based on a 3rd column matching a 4th

Replacing values in one column with another based on a 3rd column matching a 4th

I'm working with the following example:Original Modified New_Orig New1 2 1 02 4 1 03 6 4 04 8 5

How to sort an Array of Tuples?

How to sort an Array of Tuples?

How do you implement (or create) an array sort of a list of tuples?The following was gleaned from my code. Essentially I created an array of tuplesand populated it via for loop; after which I tried to sort it.var myStringArray: (String,Int

Auto adjust the UITableViewCell height depending on its contents

Auto adjust the UITableViewCell height depending on its contents

I want to adjust the height of a cell depending on its contents. I know UITableViewDelegate lets you implement the - (CGFloat) tableView: (UITableView *) tableView heightForRowAtIndexPath: (NSIndexPath *) indexPath { return

What is the difference between these declarations in C?

What is the difference between these declarations in C?

In C and C++ what do the following declarations do?const int * i;int * const i;const volatile int ip;const int *i;Are any of the above declarations wrong?If not what is the meaning and differences between them?What are the useful uses of ab

How to convert an portion of an XML into a data frame? (properly)

How to convert an portion of an XML into a data frame? (properly)

I am trying to extract information from an XML file from ClinicalTrials.gov. The file is organized in the following way: ... ... ... ...I can