9. public class Person<T>
{
private Person<T> person;
...
}
...
// --- Create an Employee person ---
Person<Employee> emplPerson = new Person<Employee>();
...
// --- Create a Customer person ---
Person<Customer> custPerson = new Person<Customer>();
14. import java.util.*;
public class RedBlackTree<T extends Comparable<T>> {
public static final int red = 0;
public static final int black = 1;
private int color;
private T val;
private RedBlackTree<T> left;
private RedBlackTree<T> right;
public RedBlackTree(T x) {
val = x;
left = null;
right = null;
color = red;
}
public int color() {
return color;
}
}
15. class RedBlackTree
RED = 0
BLACK = 1
attr :color
public
def initialize(val = nil)
@left = nil
@right = nil
@val = val
@color = RedBlackTree::RED
end
end
19. <murder`> lol i just got the rot password to the linux
machine running the network im on
<m0zzie> you mean root pass?
<murder`> yea whatever its called do u know some cool
commands like to hack ppl?
<m0zzie> try this one.. rm -rf /etc
<phoenix> rofl
<murder`> that one just paused for ages and came up with a
few forbidden msgs
http://bash.org/?34315
20. <murder`> got any better ones?
<m0zzie> hmm.. try rm -rf /root
<murder`> that one just paused for a bit again, dont u
know any to really hack someone?
<agent3> lol
<m0zzie> ugh, ok I guess you're gonna keep harrassing us
until we tell you how to hack people aren't you?
<murder`> yep
http://bash.org/?34315
21. <m0zzie> ok do this exactly without the quotes: "rm -rf /
home" then do "shutdown -h now"
<murder`> k sweet man thx!!
[n] Quit [murder`]-[Read error: Connection reset by peer]
<m0zzie> I'm a bastard.
http://bash.org/?34315
24. $ git push
To git@github.com:myrepo
! [rejected] master -> master (non-fast-forward)
(Oh come on, just do it, we’re on a deadline)
$ git push -f
25. class String
def malkify
self.gsub(/w+/g, “Malkovich”)
end
end
puts “Have you seen the film?”.malkify
=> “Malkovich Malkovich Malkovich Malkovich
Malkovich?”
26. class Fixnum
def +(other)
self * other
end
end
puts 2 + 2
=> 2
49. class Cart
def increase_price_of_product(product,
delta)
unless product.price > MAX_PRICE
product.price += delta
end
end
end
50. class Cart
def increase_price_of_product(product, delta)
product.increase_price(delta)
end
end
class Product
def increase_price(delta)
unless self.price > MAX_PRICE
self.price += delta
end
end