Posted by: americarocksdude | February 20, 2014

Surfer — A Web Searching Ruby Program

Hello World!

I am about to begin on a new ruby project which will be utilized in console for the purpose of searching and saving information on webpages. Here is the basic concept of my program.

The user enters a website to search, followed by a word (or words) to search for.

For each word(s) found a portion of padding around the object will be written into a text file named … site + “-” + idea + “.txt” . I have yet to decide if this program will be verbose(that is, SHOW what it is saving, or not.. as of now im going with not)

One problem I am expecting to encounter will be the “padding” size. Should I write the entire paragraph the term is found it? This is something I will have to decide once my output is received and I have the ability to look at how the results are coming out.

This is a very very simple structure and thus I am going to add a few features after the initial program is created to add some functionality and possibly even accept regex!!!

I will be sure to upload my code as soon as I am finished, If you have any ideas or thoughts PLEASE comment!

Trent

Posted by: americarocksdude | February 18, 2014

Introducing www.thewitchcove.com

Hello There everyone!!!

I would like to introduce you to my newest .com and project, http://www.thewitchcove.com

As of now I am unsure of what I am going to do with this site, currently it is just contains pictures ive taken (Which are very cool so make sure to check out the pic section ūüôā )

My goal is to drive traffic to the site to make money using google adsense. I applied for adsense yesterday but was denied because of the lack of content on my site( i dont blame them)

Google analytic is set up and working great!! What a wonderful and simple program for tracking web traffic and stats! If you have not yet checked out analytics make sure you give it a try! I believe that in order to use adsense you are forced to use google analytic, but you may be able to use a 3rd party analytic program (or none at all).

Here are a couple ideas for what http://www.thewitchcove.com will become

1. Show listings for Sacramento . Bay Area , California

2. A musician finder website for northern California

3. a free porn site (hey sex sells!)

4. A consulting website for linux/ruby/network security

 

I am very very open to ideas and would LOVE a team to work on this project with. If you have any experience or are just interested in being a part of this please feel free to email me!!!

trentont101@gmail.com

Any comments are greatly appreciated!!!

This is a very very simple program designed for guitar players to save their links, tabs, songs, notes. The program has tons of room for improvement so please feel free to add on to it as you wish. This program is a great example of what you can do with information fresh from most beginning ruby tutorials. All of this syntax should be familiar, and using the menu of this program you should be able to skeleton an endless of amount of useful programs from this format. Feel free to leave comments or questions!

def space
¬†puts ” “
¬†puts ” “
end

# MAIN MENU

def main_menu
 space
 space
 space
¬†puts ”¬†¬†¬†¬†¬†¬†¬†¬†¬† WELCOME TO RIFFBOOK¬†¬†¬†¬†¬†¬†¬†¬†¬† “
¬†puts ”¬†¬†¬†¬†¬†¬†¬† 2014 — AMERICAROCKSDUDE¬† ¬†¬† “
 space
¬†puts ” PLEASE MAKE A SELECTION [ 1 – 5 ]¬†¬†¬†¬† “
 space
¬†puts ” [1] ————– TAB ARCHIVE¬†¬†¬†¬†¬†¬†¬† “
¬†puts ” [2] ————– CHORD LISTING¬†¬†¬†¬†¬† “
¬†puts ” [3] ————– SONG WRITING¬†¬†¬†¬†¬†¬† “
¬†puts ” [4] ————– MUSICIAN NOTEPAD¬†¬† “
¬†puts ” [5] ————– HELPFUL LINKS¬†¬†¬†¬†¬† “
¬†puts ” [6] ————– QUIT RIFFBOOK¬†¬†¬†¬†¬† “
 space
 space
 
 answer = gets.chomp.to_i
 
 case answer

 when 1
  space
  archive

 when 2
  space
  listing

 when 3
  space
  creation

 when 4
  space
  notepad

 when 5
  space
  links
 when 6
  exit
end
end

def archive
 space
¬†puts ” ——————— TAB ARCHIVE ———————–“
¬†puts “Would you like to [write] to the tab archive, [read] it, or [delete] it?”
 space
 answer = gets.chomp.downcase
 space
 case answer
¬†when “read”
  space
¬† File.open(“RIFFBOOK-DATABASE.txt”, “r”) do |f|
  contents = f.read
  puts contents
  end
  space
  space
¬† puts “Press enter to return to the main menu”
  answer = gets.chomp
  space
  main_menu
¬†when “write”
  writing = true
  while writing
¬† puts “Please enter the name of the song you wish you add to the database”
  space
  name = gets.chomp.downcase
  space
¬† puts “Please enter the link for #{name} tabs.”
  space
  link = gets.chomp.downcase
  space
¬† name_link = name + ” : ” + link
¬† File.open(“RIFFBOOK-DATABASE”+ “.txt”,’a’) do |f|
  f.puts name_link
  space
¬† puts “Would you like to continue working in the songs? [y] or [n]”
  space
  answer = gets.chomp.downcase
  space
¬†¬† if answer == ‘n’
    writing = false
    main_menu
   else
    archive
end
end
end
end
def listing
 space
¬†puts ” ——————— CHORD LISTINGS ———————–“
¬†puts “Would you like to [write] a chord listing or [read] the list?”
 space
 answer = gets.chomp.downcase
 space
 case answer
¬†when “read”
  space
¬† File.open(“RIFFBOOK-CHORDBOOK.txt”, “r”) do |f|
  contents = f.read
  puts contents
  end
  space
  space
¬† puts “Press enter to return to the main menu”
  answer = gets.chomp
  space
  main_menu
¬†when “write”
 writing = true
 while writing
 space
 space
¬†puts “Please enter the notation of the chord”
 space
 chord_name = gets.chomp
 space
¬†puts “Please enter the 6 digit chord pattern”
 space
¬†puts “EXAMPLE XX0032 OR 0032010 OR 777987¬† “
 space
 chord = gets.chomp
¬†chordlisting = chord_name + ” : ” + chord
¬† File.open(“RIFFBOOK-CHORDBOOK”+ “.txt”,’a’) do |f|
  f.puts chordlisting
  end
  space
¬† puts “Would you like to continue working in chords? [y] or [n]”
  space
  answer = gets.chomp.downcase
  space
¬†¬† if answer == ‘n’
    writing = false
    main_menu
   else
    listing
end
end
 end
end
end

def creation
 space
¬†puts ” ———————- SONG WRITING ————————“
¬†puts “Would you like to [write] a new song [read] all song entries?”
 space
 answer = gets.chomp.downcase
 
 case answer
 
¬†when “write”
  writing = true
  while writing
  space
¬† puts “Please enter a title for the song..”
  space
  title = gets.chomp.downcase
  space
¬† puts “Please enter the lyrics of the song..”
  space
  lyrics = gets.chomp.downcase
  space
¬† puts “Please enter the chords of the song..”
  space
  chords = gets.chomp.downcase
  time = Time.now.to_s
¬† File.open(“RIFFBOOK-WRITING”+ “.txt”,’a’) do |f|
  f.puts space
¬† f.puts “Created at : ” + time
¬† f.puts “Title : ” + title
¬† f.puts “Lyrics : ” + lyrics
¬† f.puts “Chords : ” + chords
  f.puts space
  end
¬† puts “Would you like to continue working in songs? [y] or [n]”
  space
  answer = gets.chomp.downcase
  space
¬†¬† if answer == ‘n’
    writing = false
    main_menu
   else
    creation
   end
   end
 
¬†when “read”
¬† File.open(“RIFFBOOK-WRITING.txt”, “r”) do |f|
  contents = f.read
  puts contents
  end
  space
¬† puts “PRESS ENTER TO RETURN TO MAIN MENU”
  answer = gets.chomp
  space
 end
  main_menu
end

def notepad
 space
¬†puts ” ——————— NOTEPAD ———————–“
¬†puts “You can [write] a new note or [read] existing notes”
 space
 answer = gets.chomp.downcase
 space
 case answer

¬†when “write”
 space
¬†puts “Please enter your notes, press enter to save”
 space
 notes = gets.chomp.downcase
 time = Time.now.to_s
¬†File.open(“RIFFBOOK-NOTES”+ “.txt”,’a’) do |f|
 f.puts space
¬†f.puts “Note created at ” +¬† time
 f.puts notes
 f.puts space
 end
¬†puts “Would you like to continue working in notes? [y] or [n].”
 space
 answer = gets.chomp.downcase
 space
¬†if answer == “y”
  notepad
 else
  main_menu
 end
¬†when “read”
¬†File.open(“RIFFBOOK-NOTES”+ “.txt”,’r’) do |f|
 contents = f.read
 space
 puts contents
 end
 space
¬†puts “PRESS ENTER TO RETURN TO MAIN MENU”
 answer = gets.chomp
 space
 main_menu
end
end

def links
 space
¬†puts ” ——————— LINKS ———————“
¬†puts “Would you like to [write] or [read] current links?”
 space
 answer = gets.chomp.downcase
 space
 case answer
¬† when “write”
   space
¬†¬† puts “Please enter the name of the website..”
   space
   name = gets.chomp.downcase
   space
¬†¬† puts “Please enter the url of the website..”
   space
   link = gets.chomp
   space
¬†¬† the_link = name + ” : ” + link
¬†¬† File::open(“RIFFBOOK-LINKS.txt”,”a”) do |f|
   f.puts space
   f.puts the_link
   end
   space
¬†¬† puts “Would you like to continue working in links? [y] or [n].”
   space
   answer = gets.chomp
   space
¬†¬†¬† if answer == “y”
     links
    else
     main_menu
   end
¬† when “read”
   space
¬†¬† File.open(“RIFFBOOK-LINKS.txt”,”r”) do |f|
   contents = f.read
   puts contents
   end
   space
¬†¬† puts “PRESS ENTER TO RETURN TO THE MAIN MENU”
   answer = gets.chomp
   space
   main_menu
end
end
end
 
main_menu

 

Posted by: americarocksdude | February 11, 2014

Lexington Kentucky

Lexington Kentucky

Posted by: americarocksdude | February 11, 2014

The Witch Cove, California

The Witch Cove, California

Posted by: americarocksdude | February 11, 2014

Murphreesboro Tennessee

Murphreesboro Tennessee

Posted by: americarocksdude | February 11, 2014

Austin Texas

Austin Texas

Posted by: americarocksdude | February 11, 2014

Flagstaff Arizona

ImageFl

Posted by: americarocksdude | February 11, 2014

Tombstone Arizona

Tombstone Arizona

Posted by: americarocksdude | February 11, 2014

Simple Ruby Program Ideas

Hello Fellow People Of the Ruby Empire.

Here are some ideas for some very simple ruby programs that can be made immediately after if not during your ventures into the beginning ruby tutorials such as….

https://www.ruby-lang.org/en/documentation/quickstart/

http://www.codecademy.com/tracks/ruby          **** THIS SITE IS EXTREMELY SUGGESTED LEARNING MATERIAL!!

http://tryruby.org/levels/1/challenges/0              ** VERY FUN!

 

At some point you may think to yourself  OK !!! I GET IT!!! The syntax makes sense, but that the hell can I do with this. How can I use this in my life?

Here are some ideas for a few programs you are made all by your little lonesome. If you have any questions about how to get started, or problems with parts of them or ideas of your own, PLEASE post and let me know!!!! Thank you kindly for your time!

I would suggest doing these in a text document and running them from a terminal. But do as you please, just no IDE questions please.

1. Develop a generic menu  (this menu will be used in the remainder of your projects)

2. A simple calculator

3. A text based adventure (try using classes, arrays for inventory, if/else, and loops for combat)

4. A guitar player database and song writing program (title, lyrics, chords // song title, tab link ) – Save each separately to a file!

5. Think of a scenario in your life that could use a little organization and database it!

6. extra credit !! Check out gtk for ruby and create a “secret message” gui. Have button that when pressed displays a secret message to the console!

 

Have fun and let me know if anyone needs help!

Older Posts »

Categories