Browse Source

More fortunes in Gemini.

Brian Hauer 12 years ago
parent
commit
8157ba362e

+ 102 - 0
config/create-fortunes.sql

@@ -0,0 +1,102 @@
+DELETE FROM fortune;
+INSERT INTO fortune (message) VALUES ('An elephant is a mouse with an operating system.');
+INSERT INTO fortune (message) VALUES ('And on the seventh day, He exited from append mode.');
+INSERT INTO fortune (message) VALUES ('Another megabytes the dust.');
+INSERT INTO fortune (message) VALUES ('Any given program will expand to fill available memory.');
+INSERT INTO fortune (message) VALUES ('Any nitwit can understand computers. Many do. — Ted Nelson');
+INSERT INTO fortune (message) VALUES ('Foolproof operation: All parameters are hard coded.');
+INSERT INTO fortune (message) VALUES ('fortune: No such file or directory');
+INSERT INTO fortune (message) VALUES ('Futuristic: It will only run on a next generation supercomputer.');
+INSERT INTO fortune (message) VALUES ('God is real, unless declared integer.');
+INSERT INTO fortune (message) VALUES ('God made machine language; all the rest is the work of man.');
+INSERT INTO fortune (message) VALUES ('Hackers have kernel knowledge.');
+INSERT INTO fortune (message) VALUES ('Hardware: The parts of a computer system that can be kicked.');
+INSERT INTO fortune (message) VALUES ('A computer scientist is someone who fixes things that aren''t broken.');
+INSERT INTO fortune (message) VALUES ('A user and his leisure time are soon parted.');
+INSERT INTO fortune (message) VALUES ('Access denied — nyah, nyah!');
+INSERT INTO fortune (message) VALUES ('After enough decimal places, nobody gives a damn.');
+INSERT INTO fortune (message) VALUES ('All computers run at the same speed... With the power off.');
+INSERT INTO fortune (message) VALUES ('All computers wait at the same speed.');
+INSERT INTO fortune (message) VALUES ('All wiyht. Rho sritched mg kegtops awound?');
+INSERT INTO fortune (message) VALUES ('Help! I''m trapped in a Chinese computer factory!');
+INSERT INTO fortune (message) VALUES ('Help,MySpaceBarIsBroken!AnndMyBBackspaaceKeyyToo!');
+INSERT INTO fortune (message) VALUES ('Hit any user to continue.');
+INSERT INTO fortune (message) VALUES ('HOST SYSTEM NOT RESPONDING, PROBABLY DOWN. DO YOU WANT TO WAIT? (Y/N)');
+INSERT INTO fortune (message) VALUES ('How an engineer writes a program: Start by debugging an empty file...');
+INSERT INTO fortune (message) VALUES ('How do I love thee? My accumulator overflows.');
+INSERT INTO fortune (message) VALUES ('How do I set my laser printer on stun?');
+INSERT INTO fortune (message) VALUES ('"Virtual" means never knowing where your next byte is coming from.');
+INSERT INTO fortune (message) VALUES ('$HOME is where you hang your @.');
+INSERT INTO fortune (message) VALUES ('/Earth is 98% full... Please delete anyone you can.');
+INSERT INTO fortune (message) VALUES ('1 bull, 3 cows.');
+INSERT INTO fortune (message) VALUES ('10.0 times 0.1 is hardly ever 1.0.');
+INSERT INTO fortune (message) VALUES ('A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1');
+INSERT INTO fortune (message) VALUES ('A bug in the hand is better than one as yet undetected.');
+INSERT INTO fortune (message) VALUES ('A computer program does what you tell it to do, not what you want it to do.');
+INSERT INTO fortune (message) VALUES ('Any program that runs right is obsolete.');
+INSERT INTO fortune (message) VALUES ('Any sufficiently advanced bug is indistinguishable from a feature. — Rich Kulawiec');
+INSERT INTO fortune (message) VALUES ('APL is a write-only language. — Roy Keir');
+INSERT INTO fortune (message) VALUES ('Artificial intelligence usually beats real stupidity.');
+INSERT INTO fortune (message) VALUES ('Artificial Intelligence: Making computers behave like they do in the movies.');
+INSERT INTO fortune (message) VALUES ('As a computer, I find your faith in technology amusing!');
+INSERT INTO fortune (message) VALUES ('As far as we know, our computer has never had an undetected error. — Conrad Weisert');
+INSERT INTO fortune (message) VALUES ('As of next week, passwords will be entered in Morse code.');
+INSERT INTO fortune (message) VALUES ('Asking whether machines can think is like asking whether submarines can swim.');
+INSERT INTO fortune (message) VALUES ('Back up my hard drive? I can''t find the reverse switch!');
+INSERT INTO fortune (message) VALUES ('Enter any 11-digit prime number to continue.');
+INSERT INTO fortune (message) VALUES ('Error, no keyboard. Press F1 to continue.');
+INSERT INTO fortune (message) VALUES ('Ethernet: Something used to catch the etherbunny.');
+INSERT INTO fortune (message) VALUES ('Every program can be reduced to just one instruction — that doesn''t work.');
+INSERT INTO fortune (message) VALUES ('Every program in development at MIT expands until it can read mail.');
+INSERT INTO fortune (message) VALUES ('Every program is a part of some other program, and rarely fits.');
+INSERT INTO fortune (message) VALUES ('Everybody needs a little love sometime; stop hacking and fall in love!');
+INSERT INTO fortune (message) VALUES ('Excuse me for butting in, but I''m interrupt-driven.');
+INSERT INTO fortune (message) VALUES ('f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.');
+INSERT INTO fortune (message) VALUES ('Failure is not an option. It comes bundled with the software.');
+INSERT INTO fortune (message) VALUES ('Backup not found: (A)bort (R)etry (P)anic?');
+INSERT INTO fortune (message) VALUES ('Backups? We don''t NEED no steenking backups.');
+INSERT INTO fortune (message) VALUES ('Bad command. Bad, bad command! Sit! Stay! Staaay...');
+INSERT INTO fortune (message) VALUES ('Base 8 is just like base 10, if you are missing two fingers. — Tom Lehrer');
+INSERT INTO fortune (message) VALUES ('Best file compression around: "DEL" = 100% compression.');
+INSERT INTO fortune (message) VALUES ('Beware of programmers who carry screwdrivers. — Leonard Brandwein');
+INSERT INTO fortune (message) VALUES ('Brain fried — core dumped.');
+INSERT INTO fortune (message) VALUES ('BREAKFAST.COM Halted — Cereal Port Not Responding.');
+INSERT INTO fortune (message) VALUES ('Breakthrough: It finally booted on the first try.');
+INSERT INTO fortune (message) VALUES ('Buy a Pentium 586/90 so you can reboot faster.');
+INSERT INTO fortune (message) VALUES ('Cannot find REALITY.SYS. Universe halted.');
+INSERT INTO fortune (message) VALUES ('CChheecckk yyoouurr dduupplleexx sswwiittcchh..');
+INSERT INTO fortune (message) VALUES ('COFFEE.EXE Missing — Insert Cup and Press Any Key.');
+INSERT INTO fortune (message) VALUES ('Compatible: Gracefully accepts erroneous data from any source.');
+INSERT INTO fortune (message) VALUES ('A CONS is an object which cares. — Bernie Greenberg');
+INSERT INTO fortune (message) VALUES ('A crash reduces your expensive computer to a simple stone.');
+INSERT INTO fortune (message) VALUES ('A journey of a thousand sites begins with a single click.');
+INSERT INTO fortune (message) VALUES ('A list is only as strong as its weakest link. — Donald Knuth');
+INSERT INTO fortune (message) VALUES ('A true Klingon Warrior does not comment his code!');
+INSERT INTO fortune (message) VALUES ('Computer and car salesmen differ in that the latter know when they are lying.');
+INSERT INTO fortune (message) VALUES ('Computer chips are so small because computers don''t eat much.');
+INSERT INTO fortune (message) VALUES ('Computer programmers do it byte by byte.');
+INSERT INTO fortune (message) VALUES ('Computer: A device designed to speed up and automate errors.');
+INSERT INTO fortune (message) VALUES ('Computers are a more fun way to do the same work you''d have to do without them.');
+INSERT INTO fortune (message) VALUES ('Don''t byte off more than you can view.');
+INSERT INTO fortune (message) VALUES ('Don''t hit the keys so hard, it hurts.');
+INSERT INTO fortune (message) VALUES ('Don''t let the computer bugs bite!');
+INSERT INTO fortune (message) VALUES ('Don''t pay computer programmers too much money, it just encourages the bad ones.');
+INSERT INTO fortune (message) VALUES ('Dreams are free, but you get soaked on the connect time.');
+INSERT INTO fortune (message) VALUES ('E Pluribus Modem.');
+INSERT INTO fortune (message) VALUES ('E Pluribus UNIX.');
+INSERT INTO fortune (message) VALUES ('Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen');
+INSERT INTO fortune (message) VALUES ('Feature: A bug with seniority.');
+INSERT INTO fortune (message) VALUES ('File not found. Should I fake it? (Y/N)');
+INSERT INTO fortune (message) VALUES ('Computers are not intelligent — they just think they are.');
+INSERT INTO fortune (message) VALUES ('Computers are useless. They can only give you answers. — Pablo Picasso');
+INSERT INTO fortune (message) VALUES ('Computers make very fast, very accurate mistakes.');
+INSERT INTO fortune (message) VALUES ('Congratulations! You are the one-millionth user to log into our system.');
+INSERT INTO fortune (message) VALUES ('CONGRESS.SYS corrupted: Reboot Washington, DC? (Y/N)');
+INSERT INTO fortune (message) VALUES ('Counting in binary is just like counting in decimal if you are all thumbs.');
+INSERT INTO fortune (message) VALUES ('Counting in octal is just like counting in decimal if you don''t use your thumbs.');
+INSERT INTO fortune (message) VALUES ('Dain bramaged, dore cumped.');
+INSERT INTO fortune (message) VALUES ('Death is a non-maskable interrupt.');
+INSERT INTO fortune (message) VALUES ('Diagnostics are the programs that run when nothing else will.');
+INSERT INTO fortune (message) VALUES ('Disc space — the final frontier!');
+INSERT INTO fortune (message) VALUES ('Disclaimer: Any errors in spelling, tact, or fact are transmission errors.');
+INSERT INTO fortune (message) VALUES ('<script>alert("This should not be displayed in a browser alert box.");</script>');

+ 12 - 0
gemini/Docroot/WEB-INF/mustache/fortunes.mustache

@@ -0,0 +1,12 @@
+{{<layout}}
+{{$body}}
+<table>
+{{#.}}
+<tr>
+<td>{{id}}</td>
+<td>{{message}}</td>
+</tr>
+{{/.}}
+</table>
+{{/body}}
+{{/layout}}

+ 9 - 0
gemini/Docroot/WEB-INF/mustache/layout.mustache

@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Fortunes</title>
+</head>
+<body>
+{{$body}}{{/body}}
+</body>
+</html>

+ 57 - 0
gemini/Source/hello/home/entity/Fortune.java

@@ -0,0 +1,57 @@
+package hello.home.entity;
+
+import com.techempower.js.*;
+
+import hello.*;
+
+/**
+ * A fortune entity.
+ */
+public class   Fortune
+    extends    GhDataEntity
+    implements Comparable<Fortune>
+{
+
+  private String message;
+  
+  /**
+   * Set the message.  
+   */
+  public void setMessage(String message)
+  {
+    this.message = message;
+  }
+  
+  /**
+   * Get the message.
+   */
+  public String getMessage()
+  {
+    return this.message;
+  }
+
+  /**
+   * A visitor factory used to map this class to JSON.
+   */
+  public static final VisitorFactory<Fortune> VISITOR_FACTORY = new VisitorFactory<Fortune>()
+  {
+    @Override
+    public Visitor visitor(Fortune fortune)
+    {
+      return Visitors.map(
+          "id", fortune.getId(),
+          "message", fortune.getMessage());
+    }
+  };
+
+  /**
+   * For our purposes, the default sort order for messages of the day is
+   * sorting by the Fortune's message text. 
+   */
+  @Override
+  public int compareTo(Fortune other)
+  {
+    return getMessage().compareTo(other.getMessage());
+  }
+  
+}