:: (double colon) operator in Java 8

:: (double colon) operator in Java 8

I was exploring the Java 8 source and found this particular part of code very surprising://defined in [email protected] final OptionalInt reduce(IntBinaryOperator op) { return evaluate(ReduceOps.makeInt(op));}@Overridepubli

Generic htaccess redirect www to non-www

Generic htaccess redirect www to non-www

I would like to redirect www.example.com to example.com. The following htaccess code makes this happen:RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]But, is there a way to do this in a gen

How do you read from stdin in Python?

How do you read from stdin in Python?

I'm trying to do some of the code golf challenges, but they all require the input to be taken from stdin. How do I get that in Python? 1:You could use the fileinput module:import fileinputfor line in fileinput.input(): passfileinput w

Is there a function to extract a 'column' from an array in PHP?

Is there a function to extract a 'column' from an array in PHP?

I have an array of arrays, with the following structure :array(array('page' => 'page1', 'name' => 'pagename1') array('page' => 'page2', 'name' => 'pagename2') array('page' => 'page3', 'name' => 'pagename3'))Is there a bui

onClick within Chrome Extension not working

onClick within Chrome Extension not working

This seems to be the easiest thing to do, but it's just not working. In a normal browser the .html and .js files works perfectly, but in the Chrome extension the onClick function is not performing what it's supposed to do..js file:function

What is the Windows version of cron?

What is the Windows version of cron?

A Google search turned up software that performs the same functions as cron, but nothing built into Windows.I'm running Windows XP Professional, but advice for any version of Windows would be potentially helpful to someone.Is there also a w

What is the rationale for all comparisons returning false for IEEE754 NaN values?

What is the rationale for all comparisons returning false for IEEE754 NaN values?

Why do comparisons of NaN values behave differently from all other values?That is, all comparisons with the operators ==, <=, >=, <, > where one or both values is NaN returns false, contrary to the behaviour of all other values.I suppose th

generate days from date range

generate days from date range

I would like to run a query likeselect ... as days where `date` is between '2010-01-20' and '2010-01-24'And return data like: days----------2010-01-202010-01-212010-01-222010-01-232010-01-24 1:This solution uses no loops, procedures, or

In JavaScript can I make a “click” event fire programmatically for a file input element?

In JavaScript can I make a “click” event fire programmatically for a file input element?

I'd like to make a click event fire on an tag programmatically.Just calling click() doesn't seem to do anything or at least it doesn't pop up a file selection dialog.I've been experimenting with capturing events using li

Get selected element's outer HTML

Get selected element's outer HTML

I'm trying to get the HTML of a selected object with jQuery. I am aware of the .html() function; the issue is that I need the HTML including the selected object (a table row in this case, where .html() only returns the cells inside the row

How to avoid having class data shared among instances?

How to avoid having class data shared among instances?

What I want is this behavior:class a: list = []x = a()y = a()x.list.append(1)y.list.append(2)x.list.append(3)y.list.append(4)print(x.list) # prints [1, 3]print(y.list) # prints [2, 4]Of course, what really happens when I print is:print(x

What does “Could not find or load main class” mean?

What does “Could not find or load main class” mean?

A common problem that new Java developers experience is that their programs fail to run with the error message: Could not find or load main class ...What does this mean, what causes it, and how should you fix it? 1:The java

Can PHP PDO Statements accept the table or column name as parameter?

Can PHP PDO Statements accept the table or column name as parameter?

Why can't I pass the table name to a prepared PDO statement?$stmt = $dbh->prepare('SELECT * FROM :table WHERE 1');if ($stmt->execute(array(':table' => 'users'))) { var_dump($stmt->fetchAll());}Is there another safe way to insert a table

How can I read inputs as integers?

How can I read inputs as integers?

Why does this code not input integers? Everything on the web says to use raw_input(), but I read on Stack Overflow (on a thread that did not deal with integer input) that raw_input() was renamed to input() in Python 3.x.play = Truewhile pl

How to make good reproducible pandas examples

How to make good reproducible pandas examples

Having spent a decent amount of time watching both the r and pandas tags on SO, the impression that I get is that pandas questions are less likely to contain reproducible data. This is something that the R community has been pretty good abo

Which is the Spring equivalent for the CDI @Produces annotation?

Which is the Spring equivalent for the CDI @Produces annotation?

When I was working with CDI, I could use the @Produces annotation to create a producer method to be called to choose which bean that implemented an interface would be injected by the @Inject annotation .Now I am working with Spring, but I d

remote debugger over internet

remote debugger over internet

my setup is as flows: Local development PC: x86 vista with visual studioClient server: x64 server 2008 r2 with static ip and internet.Currently I connect with it using Remote desktop. Can i configure remote debugger to this setup? if so, ho

In C++11, can the characters in the array pointed to by string::c_str() be altered?

In C++11, can the characters in the array pointed to by string::c_str() be altered?

std::string::c_str() returns a pointer to an array that contains a null-terminated sequence of characters (i.e., a C-string) representing the current value of the string object.In C++98 it was required that "a program shall not alter any of

Android custom widget styles: how to put them into a namespace?

Android custom widget styles: how to put them into a namespace?

In the ApiDemos, there is a view example called Gallery1 which declares a custom style in attrs.xml, as such: now, I want to do the same thing for my widgets, but using a different namespace. However, as soon as I replace the android: na

How to configure Hudson and git plugin with an SSH key

How to configure Hudson and git plugin with an SSH key

I've got Hudson (continuous integration system) with the git plugin running on a Tomcat Windows Service. msysgit is installed and the msysgit bin dir is in the path. PuTTY/Pageant/plink are installed and msysgit is configured to use them. W

I want to get number of weeks in a particular month

I want to get number of weeks in a particular month

i want to get number of weeks in current month.That including the previous month's days in the last week and the first week days in the next month.Something like this:Simple Isnt it? http://i50.tinypic.com/5ml2de.pngI want to use this in a

Does Content Security Policy block bookmarklets?

Does Content Security Policy block bookmarklets?

Does Mozillas CSP block to execute Javascript from a bookmark by default?Can it be configured to do so? 1:As of 2017, the answer is still a definitive "maybe" - just like when this answer was originally posted in 2011. The specification

Java 8: Class JavaLaunchHelper is implemented in both

Java 8: Class JavaLaunchHelper is implemented in both

I'm trying to launch Cassandra and I'm running into an issue with JavaLaunchHelper being located in two places. I'm running Java 8. Here's the exact error:objc[413]: Class JavaLaunchHelper is implemented in both/Library/Java/JavaVirtualMach

C++ “Object” class

C++ “Object” class

In Java, there is a generic class called "Object", in which all classes are a subclass of. I am trying to make a linked list library (for a school project), and I have managed it to make it work for only one type, but not multiple, so is th

.htaccess: Redirect without changing url

.htaccess: Redirect without changing url

I would like to have a URL be redirected to a different page on the same domain but without the browser changing the URL. So the page www.mydomain.co.uk/tour/ should point towards www.mydomain.co.uk/ but without changing.I have looked at a