Created
February 20, 2012 08:18
-
-
Save DouglasAllen/1868386 to your computer and use it in GitHub Desktop.
Some debugging techniques that I'm learning to use.
This file contains 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/rvm/rubies/ruby-1.9.3-p125/bin/ruby | |
# a neat trick to block with. | |
=begin | |
[code ruby] | |
It never hurts to document your code | |
vars | |
a_word = "" # a nill string | |
words = [] # an empty array for input and sorting | |
words2 = [] # an empty array for output and sorting | |
j = 0 # inner iterater counter | |
b=word = '' # was used but not now | |
i = 0 # outter iterator | |
[code] | |
=end | |
#~ puts "Type your word and then press <Enter>. When finished just press <Enter>." | |
puts "debug line 17 #{words = []}" | |
#~ a_word = "" | |
#~ while a_word != "" | |
#~ a_word = gets.chomp | |
#~ if a_word != "" | |
#~ words.push a_word | |
#~ i = i + 1 | |
#~ end | |
#~ end | |
#~ puts i # nill? okay, we're out of scope range. | |
#~ # what if i = nill? | |
#~ words = [] | |
words = %w( ant bat cat dog about dot com ruby loops) | |
i = words.length | |
puts "debug line 33 #{i}" | |
words2 = [] | |
puts "debug line 37 #{words}" | |
until i == words2.length | |
a_word = words[0] | |
@sort_index = 0 | |
#=begin | |
# not yet working, why? | |
for j in 0..i | |
puts "debug line 48 #{words[j]}" | |
puts "debug line 49 #{a_word}" | |
if a_word > words[j] # compare the two words | |
a_word = words[j] | |
@a_index = j | |
puts "debug line 54 #{@sort_index}" | |
end | |
end | |
#=end | |
puts "debug line 59 #{@sort_index}" | |
words2.push a_word # push smallest word onto new array | |
words.delete_at(@sort_index) # delete the lowest element in the original array | |
end | |
puts "debug line 64 #{words2}" | |
=begin | |
this is my test run | |
kb9agt@mepis1:~/Documents$ ./ok_scope | |
debug line 17 [] | |
debug line 33 7 | |
debug line 37 ["ant", "bat", "cat", "dog", "about", "dot", "com"] | |
debug line 48 ant | |
debug line 49 ant | |
debug line 48 bat | |
debug line 49 ant | |
debug line 48 cat | |
debug line 49 ant | |
debug line 48 dog | |
debug line 49 ant | |
debug line 48 about | |
debug line 49 ant | |
debug line 54 0 | |
debug line 48 dot | |
debug line 49 about | |
debug line 48 com | |
debug line 49 about | |
debug line 48 | |
debug line 49 about | |
./ok_scope:51:in `>': comparison of String with nil failed (ArgumentError) | |
from ./ok_scope:51:in `block in <main>' | |
from ./ok_scope:46:in `each' | |
from ./ok_scope:46:in `<main>' | |
kb9agt@mepis1:~/Documents$ | |
=end |
Author
DouglasAllen
commented
Feb 24, 2012
via email
P.S. Are you the guy I chatted with about organizing bookmarks?
Take a look at this:https://www.google.com/search?q=how+to+organize+your+bookmarks&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a#q=how+to+organize+your+bookmarks&hl=en&safe=off&client=firefox-a&hs=JuO&rls=org.mozilla:en-US:official&prmd=imvns&tbo=u&sa=X&psj=1&ei=lAdIT6SXIPGpsAKu9ZzrCA&ved=0CIYBEM0V&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=239ed407df9948f7&biw=1024&bih=619
I get 3,230,000 hits.
We sure could use a simple program hint hint.
No i am not the guy. Well dont you too much worry about the editor.
Use whatever is available to you. For python i used Geany.
On Sat, Feb 25, 2012 at 3:33 AM, Douglas Allen < ***@***.*** > wrote:
P.S. Are you the guy I chatted with about organizing bookmarks?
Take a look at this:
https://www.google.com/search?q=how+to+organize+your+bookmarks&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a#q=how+to+organize+your+bookmarks&hl=en&safe=off&client=firefox-a&hs=JuO&rls=org.mozilla:en-US:official&prmd=imvns&tbo=u&sa=X&psj=1&ei=lAdIT6SXIPGpsAKu9ZzrCA&ved=0CIYBEM0V&bav=on.2,or.r_gc.r_pw.r_cp.r_qf
.,cf.osb&fp=239ed407df9948f7&biw=1024&bih=619
I get 3,230,000 hits.
We sure could use a simple program hint hint.
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1868386
##
Edwin.A.Rozario
Software Engineer - Production & Telephony
MobME Wireless Solutions Pvt. Ltd.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment