How to test whether stringstream operator>> has parsed a bad type and skip it

How to test whether stringstream operator>> has parsed a bad type and skip it

I am interested in discussing methods for using stringstream to parse a line with multiple types. I would begin by looking at the following line:"2.832 1.3067 nana 1.678"Now lets assume I have a long line that has multiple strings and doubl

From an array of objects, extract value of a property as array

From an array of objects, extract value of a property as array

I have JavaScript object array with the following structure:objArray = [ { foo: 1, bar: 2}, { foo: 3, bar: 4}, { foo: 5, bar: 6} ];I want to extract an array containing the values of key foo, resulting in a value of [ 1, 3, 5 ].I have accom

How to remove/delete a large file from commit history in Git repository?

How to remove/delete a large file from commit history in Git repository?

Occasionally I dropped a DVD-rip into a website project, then carelessly git commit -a -m ..., and, zap, the repo was bloated by 2.2 gigs. Next time I made some edits, deleted the video file, and committed everything, but the compressed fil

Split comma-separated column into separate rows

Split comma-separated column into separate rows

I have a data frame, like so:data.frame(director = c("Aaron Blaise,Bob Walker", "Akira Kurosawa", "Alan J. Pakula", "Alan Parker", "Alejandro Amenabar", "Alejandro Gonzalez Inarritu", "Alejand

Why does jQuery or a DOM method such as getElementById not find the element?

Why does jQuery or a DOM method such as getElementById not find the element?

What are the possible reasons for document.getElementById, $("#id") or any other DOM method / jQuery selector not finding the elements?Example problems include:jQuery silently failing to bind an event handler, and a standard DOM method retu

Generate random numbers replicating arbitrary distribution

Generate random numbers replicating arbitrary distribution

I have data wherein I have a variable z that contains around 4000 values (from 0.0 to 1.0) for which the histogram looks like this. Now I need to generate a random variable, call it random_z which should replicate the above distribution. Wh

Can multiple directives for one element share an isolated scope?

Can multiple directives for one element share an isolated scope?

Two directives on the same element can not both have isolated scope, but can they both use the same scope isolated from their parent? And can they both use properties bound to the isolated scope?For example, if I have two directives on an

How to add CSS-Class to a GoogleMaps marker?

How to add CSS-Class to a GoogleMaps marker?

I want to animate (fadein, fadeout) a marker in my GoogleMaps application (Web). How can i assign any css class to a marker?Or how can i access the specific marker? Do they have selectors like :after or something? If not, whats the easies

How to use enums in Qt signals and slots

How to use enums in Qt signals and slots

I have some trouble with using enum types in signals. Basicly I have two classes, a state machine and a thread handling the state machine. When the state is changed I want to send a signal with the new state. I also want to represent the st

Finding modified date of a file/folder

Finding modified date of a file/folder

I am very new to PowerShell, and I was hoping I could get some help creating a script that tells me the modified date of a file.I wish I knew more about PowerShell, as I feel like I am asking a lot (all my free-time this week will be dedica

Left outer join on two files in unix

Left outer join on two files in unix

I need to join two files on two fields. However i should retrieve all the values in file 1 even if the join fails its like a left outer join. File 1:01|a|jack|d02|b|ron|c03|d|tom|eFile 2:01|a|nemesis|f02|b|brave|d04|d|gorr|houtput:01|a|jack

How can I construct a java.security.PublicKey object from a base64 encoded string?

How can I construct a java.security.PublicKey object from a base64 encoded string?

I have a bse64encoded string Public key from external source (Android Store) and I need to use it to verify signed content. How can I convert the string into an instance of the java.security.PublicKey interface. I am on Java 6 if that makes

Samples/tutorial for DRM framework in Android

Samples/tutorial for DRM framework in Android

Android 4.0 brings drm framework to smartphones. I'm interested to write a code that plays video protected by the DRM, but can't find enough information.Are there any tutorials on using the DRM framework? Sample code?How to set up an enviro

How can I get MIME type of an InputStream of a file that is being uploaded?

How can I get MIME type of an InputStream of a file that is being uploaded?

Simple question: how can I get MIME type (or content type) of an InputStream, without saving file, for a file that a user is uploading to my servlet? 1:It depends on where you are getting the input stream from. If you are getting it from

Python: what are the nearest Linux and OSX equivalents of winsound.Beep?

Python: what are the nearest Linux and OSX equivalents of winsound.Beep?

If one wishes to beep the speaker on Windows, Python 2 apparently provides a useful function: winsound.Beep(). The neat thing about this function is that it takes arguments specifying the exact frequency and duration of the beep. This is ex

Instagram from Android open on certain user and add caption to uploaded image

Instagram from Android open on certain user and add caption to uploaded image

Instagram for Android is very limited, from what I have seen so far. My scenario is simple: allow the user to edit a picture and when he clicks on Send:Intent share = new Intent(Intent.ACTION_SEND);share.setType("image/jpeg");Then with quer

Any tutorial for customize lock screen in Android [closed]

Any tutorial for customize lock screen in Android [closed]

I want to know that any tutorial or sample application for customize lock screen in Android? 1:Here are the links which will provide guide you on how to develop the lock screen in android 1) WidgetCatalog2) Lock Screen for Android3) Wid

sending message from IntentService to Activity

sending message from IntentService to Activity

I have an activity and an intentService in the same application. The service must keep running after the activity ends so I do not want to bind. I have been googling for hours and can't find a single good example of how to do this. I'm a

changing page url without refreshing page

changing page url without refreshing page

Is this even possible?Here's the problem:I have a keyword search with this URL(after searching) : http://localhost/thi/search?keyword=keyThen I have a slider search which uses the AjaxForm plugin (jquery)...when I perform a slider search, o

Virtual Webcam in C++

Virtual Webcam in C++

I want to write a new virtual webcam driver, which for example will take an AVI or live stream for example for screen and stream it as webcam source.I'll not have webcam really, I want to add a virtual webcam which streams desktop screen. I

Using PageObjects, Page Factory and WebDriverWait in Selenium WebDriver using Java

Using PageObjects, Page Factory and WebDriverWait in Selenium WebDriver using Java

I've been using Selenium WebDriver to implement functional tests for some projects that I've worked with. I'm trying to use the Page Object design pattern with Page Factory to factor out my locators. I've also created a static WaitTool obje

How to train image (pixel) data in libsvm format to use for recognition with Java

How to train image (pixel) data in libsvm format to use for recognition with Java

I want to make a Java application to recognize characters by using libsvm but when get into this, I do not understand how could I train the image data to use with libsvm?Recently to learn it, I made a test with existing data:I have also cre

convert keypoints to mat or save them to text file opencv

convert keypoints to mat or save them to text file opencv

I have extracted SIFT features in (opencv open source) and they are extracted as keypoints. Now, I would like to convert them to Matrix (With their x,y coordinates) or save them in a text file... Here, you can see a sample code for extracti

Finding the best matching pairwise points from 2 vectors

Finding the best matching pairwise points from 2 vectors

I have 2 lists with X,Y coordinates of points.List 1 contains more points than list 2. The task is to find pairs of points in a way that the overall euclidean distance is minimized.I have a working code, but i don't know if this is the best

WKURLSessionRefreshBackgroundTask isn't called when attempting to do background refreshes in wa

WKURLSessionRefreshBackgroundTask isn't called when attempting to do background refreshes in wa

I'm working on a complication to get scheduled data from a web service. Every 20-30 minutes (or manually), I am scheduling a WKRefreshBackgroundTask to do this. As suggested by Apple, I want the OS to handle the fetching of this data via a