d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Seeking Ruby On Rails Partner
Add Reply New Topic New Poll
Banned
Posts: 179
Joined: Nov 5 2011
Gold: Locked
Trader: Scammer
Warn: 10%
May 18 2013 01:14pm
Looking to learn ruby on rails. Tutorials or a programming buddy would be great.

Would pay for lessons if well versed.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
May 18 2013 01:36pm
what is your current programming background? do you already know ruby? or any language?
Banned
Posts: 179
Joined: Nov 5 2011
Gold: Locked
Trader: Scammer
Warn: 10%
May 18 2013 03:44pm
i know c basic and java a little php too
Member
Posts: 16,450
Joined: Mar 25 2012
Gold: 158.71
May 18 2013 04:42pm
from abduct:

currently banned, but i am pretty well versed in ruby so just post your questions and ill try to answer them in a timely manor.

as for tutorials google "Why's (Poignant) Guide To Ruby" for a dumbed down guide to ruby with lots of comic pictures. i would also read up on ruby-docs which is the #1 resource for any ruby programmer.

ruby overall isnt that hard to learn if you have some programming background although its OOP idioms will be a challenge to get a hang of. i just finished writing up a 700 line multi client chat server with its own custom protocol few days ago as well as a simple ruby wrapper to axel which queries a web directory for downloadable files and then sends each one to axel sequencially, as well as lists the download speed, current file, and all the files completed.

Code

require 'net/http'
require 'uri'
require 'cgi'
require 'pty'

def print_table( table )
listing = 0
length = 0
table.push "" unless table.length.modulo(2).eql? 0

 table.each do |file|
   next if file.empty?
     length = file[:name].length unless length > file[:name].length
   end

format = "%-#{length}s"

 table.each do |file|
   next if file.empty?
   print "[*] File: "
   print format % file[:name]
   print " -> Completed: %-#{3}s" % file[:complete]

   if listing.eql? 1
     print "\n"
     listing = 0
   else
     print "\t"
     listing += 1
   end
 end
end



exit unless ARGV.length > 0

url   = 'http://.net/dl/'
anime = ARGV[0]
files = []

uri      = URI.parse("#{url}#{anime}/")
http     = Net::HTTP.new( uri.host, uri.port )
request  = Net::HTTP::Get.new( uri.request_uri )

puts "Server: #{url}"
puts "Anime: #{anime}"
puts 'Grabbing file listings...'
response = http.request(request)

response.body.each_line do |line|
 arr = line.scan /(".*?")/
 next if arr.empty? or arr.last.include? "\"/dloads/\"" or arr.last.include? "\"-//W3C//DTD HTML 3.2 Final//EN\""
 name =  arr.last.to_s[4..-5]
 hash = {:name => CGI.unescape(name), :url => "#{url}#{anime}/#{name}", :complete => "No"}
 files.push hash
end

puts 'Grabbed file listings!'
puts 'Starting downloads in 3 seconds...'
sleep 3

files.each_index do |index|
 begin
   PTY.spawn "axel -n 12 #{files[index][:url]}" do |stdout, stdin, pid|
     begin
             stdout.each do |line|
         next unless line.include? "["
         puts "\e[H\e[2J"
         print_table files
         puts "\n\n"
         puts "Server: #{url}"
         puts "Anime: #{anime}"
         puts "Current file: #{files[index][:name]}"
         puts "\n"
         puts line
       end
     rescue Errno::EIO
     end
   end
 rescue PTY::ChildExited
 end

 files[index][:complete] = "Yes"
end



[*] File: 01 Blue Snow.mkv          -> Completed: No    [*] File: 02 Runaway.mkv            -> Completed: No
[*] File: 03 Hunted.mkv             -> Completed: No    [*] File: 04 Friends.mkv            -> Completed: No
[*] File: 05 And Then....mkv        -> Completed: No    [*] File: 06 Dimension of Tears.mkv -> Completed: No
[*] File: 07 Precious Person.mkv    -> Completed: No    [*] File: 08 Secrets.mkv            -> Completed: No
[*] File: 09 Beyond Time.mkv        -> Completed: No    [*] File: 10 A Stormy Night.mkv     -> Completed: No
[*] File: 11 Out of Sync.mkv        -> Completed: No    [*] File: 12 Battle.mkv             -> Completed: No
[*] File: 13 Wish.mkv               -> Completed: No    [*] File: 14 Memories.mkv           -> Completed: No
[*] File: 15 Shangri'la.mkv         -> Completed: No    [*] File: 16 Repeat.mkv             -> Completed: No
[*] File: 17 Dilemma.mkv            -> Completed: No    [*] File: 18 Nightmare.mkv          -> Completed: No
[*] File: 19 Reminiscence.mkv       -> Completed: No    [*] File: 20 Once More.mkv          -> Completed: No
[*] File: 21 Illusion.mkv           -> Completed: No    [*] File: 22 To The Future.mkv      -> Completed: No
[*] File: 23 The End.mkv            -> Completed: No    [*] File: 24 The Beginning.mkv      -> Completed: No

Server: http://.net/dl/
Anime: Noein
Current file: 01 Blue Snow.mkv
[  0%]  .......... .......... .......... .......... ..........  [ 529.6KB/s]



[*] File: lol1 -> Completed: No    [*] File: lol2 -> Completed: No
[*] File: lol3 -> Completed: No    [*] File: lol4 -> Completed: No
[*] File: lol5 -> Completed: No    [*] File: lol6 -> Completed: No
[*] File: lol7 -> Completed: No    [*] File: lol8 -> Completed: No
[*] File: lol9 -> Completed: No
Server: http://.net/dl/
Anime: test
Current file: lol1
[ 86%]  .......... .......... .......... .......... ..........  [ 474.8KB/s]
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
May 18 2013 04:44pm
Quote (dolarsignzeroxeighty @ May 18 2013 06:42pm)
from abduct: currently banned


did he post malicious hello world samples in assembly again?
Member
Posts: 16,450
Joined: Mar 25 2012
Gold: 158.71
May 19 2013 07:22pm
Quote (carteblanche @ May 18 2013 06:44pm)
did he post malicious hello world samples in assembly again?


pm'd

This post was edited by dolarsignzeroxeighty on May 19 2013 07:25pm
Member
Posts: 11,610
Joined: Oct 28 2008
Gold: 1,795.00
May 20 2013 11:50am
Quote (dolarsignzeroxeighty @ May 19 2013 08:22pm)
pm'd


would also like to know
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll