This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn- get-chars | |
"gets the next char(s) in the sequence" | |
[s offset] | |
(if (>= offset (count s)) | |
(let [div-val (dec (int (/ offset (count s)))) | |
mod-val (mod offset (count s))] | |
(apply str (get-chars s div-val) (get-chars s mod-val))) | |
(subs s offset (inc offset)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def chars "abcdefghijlkmnopqrstuvwxyz") | |
(defn get-chars | |
"gets the next char(s) in the sequence" | |
[s offset] | |
(if (>= offset (count s)) | |
(let [div-val (dec (int (/ offset (count s)))) | |
mod-val (mod offset (count s))] | |
(apply str (get-chars s div-val) (get-chars s mod-val))) | |
(subs s offset (inc offset)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/clj | |
(use 'clojure.contrib.str-utils) | |
(def breads ["rye" "whole wheat" "pita" "pancake" "pumpernickel" "olive loaf" | |
"nut loaf" "egg loaf" "sweet potato" "ice cream" "wheat gluten" | |
"banana" "sprouted grain"]) | |
(def toppings ["bleu cheese" "jalapeno" "olive" "maple syrup" "cucumber" | |
"chipotle" "onion" "mushroom" "swiss cheese" "cheddar cheese" | |
"pickle" "head cheese" "hot dog" "bratwurst" "mustard" "ketchup" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/clj | |
(use 'clojure.contrib.str-utils) | |
(def breads ["rye" "whole wheat" "pita" "pancake" "pumpernickel" "egg loaf" | |
"sweet potato" "wheat gluten" "banana" "sprouted grain" | |
"ice cream"]) | |
(def toppings ["bleu cheese" "jalapeno" "olive" "maple syrup" "cucumber" | |
"chipotle" "onion" "mushroom" "swiss cheese" "cheddar cheese" | |
"pickle" "hot dog" "bratwurst" "mustard" "ketchup" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class T { | |
public static void main(String[] args) { | |
Thread t = new Thread(new Runnable() { | |
public void run() { | |
int i = 5 / 0; | |
} | |
}); | |
t.start(); | |
System.out.println("Oh I'm... I I... I'm still alive"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class T { | |
public static void main(String[] args) { | |
Thread t = new Thread(new Runnable() { | |
public void run() { | |
int i = 5 / 0; | |
} | |
}); | |
t.start(); | |
try { | |
Thread.sleep(1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class T { | |
private static class ThreadWithArg extends Thread { | |
private int x; | |
public ThreadWithArg(int x) { | |
this.x = x; | |
} | |
public void run() { | |
System.out.println("x = " + String.valueOf(this.x)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class T { | |
public static void main(String[] args) { | |
int x = 3; | |
final Object[] foo = { x }; | |
Thread t = new Thread(new Runnable() { | |
public void run() { | |
System.out.println(String.valueOf(foo[0])); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
class FileRead { | |
public void readEachLine(String filename) { | |
try { | |
// Open the file that is the first | |
// command line parameter | |
FileInputStream fstream = new FileInputStream(filename); | |
// Get the object of DataInputStream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
travis@travis-desktop:/tmp/menu$ cat MenuItem.java | |
class MenuItem { | |
private String item; | |
public abstract void run(); | |
public MenuItem(String item) { | |
item = item; | |
} | |
} |