Beware sharp tools

1,554 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,554
On SlideShare
0
From Embeds
0
Number of Embeds
137
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Beware sharp tools

  1. 1. Beware: Sharp Tools
  2. 2. Tools
  3. 3. Languages Java, PHP, Ruby
  4. 4. Frameworks Spring, Zend, Rails
  5. 5. Command Line Tools grep, awk, sed, ls, rm, find, ...
  6. 6. Source Control cvs, svn, perforce, git, mercurial
  7. 7. Editors/IDEsnotepad, pico, emacs, vim, eclipse
  8. 8. <bean id="application" class="org.springframework.richclient.application.Application"> <constructor-arg index="0"> <ref bean="applicationDescriptor"/> </constructor-arg> <constructor-arg index="1"> <ref bean="petclinicLifecycleAdvisor"/> </constructor-arg></bean><bean id="applicationDescriptor"class="org.springframework.richclient.application.support.DefaultApplicationDescriptor"> <property name="version"> <value>1.0</value> </property> <property name="buildId"> <value>20041025001</value> </property></bean><bean id="petclinicLifecycleAdvisor”class="org.springframework.richclient.samples.petclinic.PetClinicLifecycleAdvisor"> <property name="windowCommandBarDefinitions"> <value>org/springframework/richclient/samples/petclinic/ui/commands-context.xml</value> </property> <property name="startingPageId"> <value>ownerManagerView</value> </property></bean>
  9. 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>();
  10. 10. java, spring, svn, xcode, objc
  11. 11. java, spring, svn, emacs notepad
  12. 12. ruby, git, vi
  13. 13. rubyoptimised for programmer happiness
  14. 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. 15. class RedBlackTree RED = 0 BLACK = 1 attr :colorpublic def initialize(val = nil) @left = nil @right = nil @val = val @color = RedBlackTree::RED endend
  16. 16. compiletype checking
  17. 17. rm -fr /
  18. 18. <murder`> lol i just got the rot password to the linuxmachine running the network im on<m0zzie> you mean root pass?<murder`> yea whatever its called do u know some coolcommands like to hack ppl?<m0zzie> try this one.. rm -rf /etc<phoenix> rofl<murder`> that one just paused for ages and came up with afew forbidden msgs http://bash.org/?34315
  19. 19. <murder`> got any better ones?<m0zzie> hmm.. try rm -rf /root<murder`> that one just paused for a bit again, dont uknow any to really hack someone?<agent3> lol<m0zzie> ugh, ok I guess youre gonna keep harrassing usuntil we tell you how to hack people arent you?<murder`> yep http://bash.org/?34315
  20. 20. <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> Im a bastard. http://bash.org/?34315
  21. 21. git update-index --remove -- $(git ls-files *.o)
  22. 22. git update-index --remove -- $(git ls-files *.c)
  23. 23. $ git pushTo git@github.com:myrepo ! [rejected] master -> master (non-fast-forward)(Oh come on, just do it, we’re on a deadline)$ git push -f
  24. 24. class String def malkify self.gsub(/w+/g, “Malkovich”) endendputs “Have you seen the film?”.malkify=> “Malkovich Malkovich Malkovich MalkovichMalkovich?”
  25. 25. class Fixnum def +(other) self * other endendputs 2 + 2=> 2
  26. 26. def add_to_cart_or_checkout(widget, in_cart = true) if in_cart cart.checkout else cart.add(widget) endend
  27. 27. def add_to_cart_or_checkout(widget, in_cart = true, discount_offer = true) if in_cart cart.checkout elsif discount_offer cart.add(widget, widget.price *widget.discount) endend
  28. 28. def add_to_cart_or_checkout(widget, in_cart = true, discount_offer = true, discount = 0.65) if in_cart cart.checkout elsif discount_offer cart.add(widget, widget.price * (discount !=1.0 ? discount : widget.discount) endend
  29. 29. def add_to_cart_or_checkout(widget, in_cart = true, discount_offer = true, discount = 0.65, coupon = “”) if in_cart cart.checkout elsif discount_offer cart.add(widget, widget.price * (discount != 1.0 ? discount : widget.discount)) if coupon != “” cart.apply_coupon(coupon, (discount != 1.0 ? discount : widget.discount)) end endend
  30. 30. def add_to_cart_or_checkout(widget, in_cart = true) if in_cart cart.checkout else cart.add(widget) endend
  31. 31. def add_to_cart(widget) cart.add(widget)enddef checkout() cart.checkout()end
  32. 32. # this code processes the payroll# and sends itprocess_payroll()
  33. 33. process_payroll_and_send()
  34. 34. payroll.process()email_to_all_staff(payroll)
  35. 35. def process(q) p = 17 # this is the price of the # object cart.price += p * qend
  36. 36. def process(quantity) p = 17 # this is the price cart.price += p * quantityend
  37. 37. def increment_price(quantity) p = 17 # this is the price cart.price += p * quantityend
  38. 38. def increment_price(quantity) price = 17 # this is the price cart.price += price * quantityend
  39. 39. PRICE_OF_AIRCRAFT_IN_MILLIONS =17def increment_price_in_cart(quantity) cart.price += PRICE_OF_AIRCRAFT_IN_MILLIONS * quantityend
  40. 40. class Cart def increase_price_of_product(product, delta) unless product.price > MAX_PRICE product.price += delta end endend
  41. 41. class Cart def increase_price_of_product(product, delta) product.increase_price(delta) endendclass Product def increase_price(delta) unless self.price > MAX_PRICE self.price += delta endend
  42. 42. ...F......................................
  43. 43. ...F..................F...................
  44. 44. ...F..................F.......F.....F.....
  45. 45. ...F...FFFFFFFF.FF.FF.FFFFFF....
  46. 46. F

×