Nov 24

Sergey Brin and Steve Horowitz demonstration of the Android, Google’s mobile platform. More videos are available at youtube’s android developers page, and there’s also a blog.
Edit: Steve Ballmer’s response, LOL.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.io.FileReader; import java.io.FileNotFoundException; public class Grep { public static void error(String msg) { System.err.println(msg); System.exit(1); } public static void main(String[] args) { BufferedReader input; Matcher matcher; Pattern pattern; String line; switch (args.length) { case 1: input = new BufferedReader(new InputStreamReader(System.in)); break; case 2: try { input = new BufferedReader(new FileReader(args[1])); } catch (FileNotFoundException e) { input = null; // silly java error("Error: " + args[1] + ": " + e.getMessage()); } break; default: input = null; // silly java error("Usage: java Grep PATTERN [file]"); } pattern = Pattern.compile(".*" + args[0] + ".*"); try { while ((line = input.readLine()) != null) { matcher = pattern.matcher(line); if (matcher.matches()) { System.out.println(line); } } } catch (IOException e) { error("Error parsing input: " + e.getMessage()); } } } |
Add the following to your .emacs file:
1 2 3 4 5 6 7 | ;; insert a comment w/ name and date (defun insert-comment () (interactive) (comment-dwim "") (insert-string "!!! ") (insert-string (getenv "USER")) (insert (format-time-string " %Y%m%d: "))) |
To use it, just type “M-x insert-comment“.
If it’s too much work for you, you can add a shortcut for it, again, in your .emacs, after the insert-comment definition, add the following:
(global-set-key "\C-xv" 'insert-comment)
Now you can insert your comment with just “C-x v“