Friday, June 22, 2012

OpenBeacon

An interesting beacon transmitter kit. I want to try this out sometime in the future when I have more time.
http://www.etherkit.com/transmitters/openbeacon.html

The following is a quote from the site.


Quick Overview

OpenBeacon is an open source crystal-controlled QRPp beacon transmitter kit which can output a variety of slow-speed modes, including QRSS, DFCW, and Sequential Multi-tone Hellschreiber. It is configured via USB port, so there are no jumpers to set and you can easily adjust all of the operating parameters via command line. Once configuration is complete, OpenBeacon may be removed from the PC and operate stand-alone.

Thursday, June 7, 2012

Replacing backslashes with something else in Java

The use of regular expression implemented in Java is messy when it comes to replacing '\' with something else. I have come across with a handy code example that shows how it could be done.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public class DoubleTheBackslash {
   public static void main(String[] args) {
      String[] inputs = {"abc\\\\def", "abc\\def\\\\ghi"};
       
      showReplacements(inputs, "(?<!\\\\)\\\\(?!\\\\)", "\\\\\\\\");
      showReplacements(inputs, "(?<!\\\\)\\\\(?!\\\\)", "$0$0");
      showReplacements(inputs, "([^\\\\])(\\\\)([^\\\\])", "$1\\\\\\\\$3");
      showReplacements(inputs, "([^\\\\])(\\\\)([^\\\\])", "$1$2$2$3");
   }
    
   private static void showReplacements(String[] inputs,
         String regex, String replaceWith) {
      for (String input : inputs) {
         System.out.println(input);
         System.out.println(input.replaceAll(regex, replaceWith));
         System.out.println();
      }
   }
}