Earthlings, tonight Jupiter and Venus will look beautifully close in the sky, visible to the naked eye. Here is Celestia and Stellarium showing a preview. If it’s cloudy, or if you’re not in the mood to glance the sky, don’t worry, you may have another opportunity in 24 years..
Instagram: http://ift.tt/1CHCuJk


The Great Stalacpipe Organ at the Luray Caverns in Virginia. The keys in the console control solenoids which strike the stalactites with rubber mallets. The selected 37 stalactites spread over 3.5 acres (~14000 square meters), maybe the largest musical instrument by area. Created by the mathematician and scientist Leland W. Sprinkle in 1956..
Instagram: http://ift.tt/1GJYELJ

Regex with negatives lookahead and lookbehind

"Looking different directions" by Paul Kline at (https://www.flickr.com/photos/paulelijah/6717953239/)
“Looking different directions” by Paul Kline.

Problem: Match strings that contains a single quotation mark ('), but not multiple ones together.

Solution:

(?<!')'(?!')

This is a regex for a single quotation mark with a (?<!') in the left and a (?!’) in the right. The (?<!') is a ?< look behind if not ! a single quotation mark '. The (?!') is a look ahead ? if not ! a single quotation mark '.

Java code:

import java.util.regex.Pattern;

public class RegexProblem {
  public static void main(String args[]) {
    Pattern single_quote = Pattern.compile("(?<!')'(?!')");
    String[] phrases = {
      "",
      "'",
      "a'a",
      "aaa",
      "aa'aa",
      "aa''aa",
      "aa'''aaa",
      "aaa''''aaa"
    };
    for(String phrase: phrases){
      System.out.println(String.format("For %s is %s.", phrase,
            single_quote.matcher(phrase).find()));
    }
  }
}

The output is:

For  is false.
For ' is true.
For a'a is true.
For aaa is false.
For aa'aa is true.
For aa''aa is false.
For aa'''aaa is false.
For aaa''''aaa is false.