Coder Profile - Show off your skills, get a coder profile.  
 
 
 
Cinjection  ( Oleksi Derkatch )
Canada, Ontario
Offline

Profile Views
2,981
Send A Message
Send A Friend Invite
Add To My Contacts
Master Feed (All Of Below) master feed - compiles all the feeds below in to one feed
Overview Overview  
About Me About Me  
Articles Articles (8) articles
Source Codes Source Codes (31) source codes
Code Pin Board Code Pin Board (11) code pin board
Profile Comments Profile Comments (81) profile comments
Discussion Forum Discussion Forum (1,074) discussion forum
Custom Emoticons Custom Emoticons (1) custom emoticons
Announcements Announcements (1) announcements
Referrals Referrals (1) referrals
Portfolio Portfolio (3) portfolio
Friends Friends (71) friends
Interview Interview  
R�sum� Résumé  
Profile Overview
User Name Cinjection
Real Name Oleksi Derkatch
Location Canada
Ontario
Occupation Student/Software Developer
Gender Male
Age 18 Years Old
WebSite - - -
Post A Profile Comment
Content Distribution
  
Articles
8 Articles

 
Source Codes
31 Source Codes

 
Code Pin Board
11 Pinned Codes

 
Portfolio
3 Entries

 
Friends
71 Friends

 
Custom Emoticons
1 Emoticons

 
Profile Comments
81 Comments

 
Discussion Forum
46 Topics

 
Announcements
1 Announcements

 
Referrals
1 Referrals

 
Recently Added Friends
  view more
Relish
Itsover8000
Joshua
gregd
Greg Dash
Recent Forum Topics
  view more
Ruby/Editor Problem
Miscellaneous :: Other Languages
This is pissing me off. I'm using SciTE as my editor/interpreter for Ruby, but It's being weird. I wrote out a little Address book class and I can't see to get it to run properly.

I hit "Go" and it opens the terminal window (ruby.exe). On the side panel, my code should run. It doesn't. But the second I close the terminal window, the text that I'm supposed to see appears. It's as if the program only runs without the useless terminal window there. The thing is that without this terminal window open, the output panel on the side doesn't work.

Does anyone use SciTE and know what's up?

Here's the code:
Code DownloadOpen In New Window
  1. class PhoneBook
  2.  
  3.    def run
  4.  
  5.      showMenu()
  6.      choice = gets.gets
  7.  
  8.      while choice != "5"
  9.  
  10.        if choice==1
  11.          showAllEntries()
  12.        elsif choice==2
  13.  
  14.          print "Enter a name to search for: "
  15.          target = gets.chomp
  16.          index = findEntryByName(target)
  17.  
  18.          if (index != -1)
  19.            puts entries[index]
  20.          else
  21.            puts "Could not find an entry with the name #{target}"
  22.          end
  23.  
  24.        elsif choice==3
  25.          print "Name: "
  26.          name = gets.chomp
  27.          print "Phone Number: "
  28.          number = gets.chomp
  29.          print "Address: "
  30.          address = gets.chomp
  31.          print "Email: "
  32.          email = gets.chomp
  33.  
  34.          addNewEntry(name, phone, addr, email)
  35.  
  36.        elsif choice==4
  37.          print "Enter a name to delete: "
  38.          target = gets.chomp
  39.          index = removeEntry(target)
  40.  
  41.          if (index != -1)
  42.            puts "#{target} deleted!"
  43.          else
  44.            puts "Could not find an entry with the name #{target}"
  45.          end
  46.  
  47.        elsif choice==5
  48.          exit()
  49.        else
  50.          puts "Invalid Choice! Please try again"
  51.        end
  52.  
  53.        showMenu()
  54.        choice = gets.chomp
  55.  
  56.      end
  57.  
  58.    end
  59.  
  60.    private
  61.  
  62.    class Entry
  63.  
  64.      def initilize(name, phone, addr, email)
  65.  
  66.        @name = name
  67.        @phone = phone
  68.        @addr = addr
  69.        @email = email
  70.  
  71.      end
  72.  
  73.      def to_s
  74.        "Name: #{@name}\nPhone Number: #{@phone}\nAddress: #{@addr}\nEmail: #{@email}"
  75.      end
  76.  
  77.      def getName
  78.        @name
  79.      end
  80.  
  81.    end
  82.  
  83.  
  84.    def initilize
  85.      @entries = []
  86.    end
  87.  
  88.    def showMenu
  89.  
  90.      puts "1: Show all entries."
  91.      puts "2: Find entry by name"
  92.      puts "3: Add a new Entry"
  93.      puts "4: Remove an Entry"
  94.      puts "5: Exit"
  95.      puts
  96.  
  97.    end
  98.  
  99.    def showAllEntries
  100.  
  101.      @entries.each do |cntEntry|
  102.        puts cntEntry
  103.        puts
  104.      end
  105.  
  106.    end
  107.  
  108.    def FindEntryByName(target)
  109.  
  110.      foundIndex = 0
  111.      @entries.each do |cntEntry|
  112.          return foundIndex if cntEntry.getName.downcase == target.downcase
  113.          foundIndex+=1
  114.      end
  115.  
  116.      return -1
  117.  
  118.    end
  119.  
  120.    def addNewEntry(name, phone, addr, email)
  121.      newEntry = Entry.new(name, phone, addr, email)
  122.      entries.push(newEntry)
  123.    end
  124.  
  125.    def removeEntry(target)
  126.  
  127.      index = FindEntryByName(target)
  128.  
  129.      return -1 if index == -1
  130.  
  131.      @entries.delete_at(index)
  132.      1 #return 1 on success
  133.  
  134.    end
  135.  
  136. end
  137.  
  138. myBook = PhoneBook.new
  139. myBook.run
View Topic (5 Replies)
March Break Programming
Programming :: General Programming
For some of your guys, March Break is fast approaching! That means a lot of time without school worries. What are you guys going to be doing in terms of programming?


I will be remaking Rose in hopes of turning it from an esoteric language to a more practical language.
View Topic (9 Replies)
Consise Programming Contest - Vote
Programming :: General Programming
http://www.coderprofile.com/content/public/forum/view_topic.php?topic_id=62...
Here is your chance to vote on all of the above submissions. I will write them all here as well. Please vote only once, and no voting for yourself. Remember, you're voting for the coolest thing you think was made in < 40 lines.

Please be clear when you post your vote. I will tally the votes on Monday, so you have until then to decide.

1. IRC Bot by SpamBurger
http://www.coderprofile.com/pinned-code/147/irc-bot

2. Simple Page Caching by VBAssassin
http://www.coderprofile.com/source-code/170/simple-page-caching

3. Process Manipulator by STN
http://www.coderprofile.com/pinned-code/150/for-the-consise-programming-con...

4. Password Generator by otoom
http://www.coderprofile.com/source-code/228/pass-generator

5. Hello World Bootloader by Appie
http://www.coderprofile.com/pinned-code/152/helloworld-bootloader

6. Prime Number Lister by thoughtpolice
http://www.coderprofile.com/html-includes/bbcode-view-block.php?id=d915082d...

7. Programming Language, Rose by Cinjection ( Me! :) )
http://www.coderprofile.com/source-code/243/my-programming-language-rose-mi...

8. Text-based adventure game by Xuftugulus
http://www.coderprofile.com/pinned-code/153/my-concise-contest-entry

9. SQL Maintainence script by Ginger
http://www.coderprofile.com/source-code/283/sql-update-all-null-bit-fields-...

Good luck to all contestants!
View Topic (13 Replies)
Profile Comments
  view more
Please login to post comments.
 
Cinjection     Posted 19 Hours Ago
 
Thanks Scott. You know much I love contributing to this site :)
 
VBAssassin     Posted 22 Hours Ago
 
Hey up! Just noticed you got over 1,000 posts in the forums - there's an award
for that in the new "Achievements & Awards" section thats in the
planning. I also think you will get some others as well for some of the source codes
and articles you have done ;-)

Nice work anyway mate.

Kind regards,
Scott
 
VBAssassin     Posted 3 Days Ago
 
Liking your practice ruby scripts ;-) nice to see you doing so many instead of
writing one and getting bored like most people lol
Page  of 27  :: Next Page  >>
 
 
Part of the MyPingle Network
Make A Donation :: Our Affiliates :: Affiliation Request :: Contact Me
Development Blog :: Terms & Conditions :: Privacy Policy :: Documents
Version 1.39.05
Copyright � 2007 - 2008, Scott Thompson, All Rights Reserved