pawnbox has quit [Read error: Connection reset by peer]
hutch34 has joined #ruby
nankyokusei has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
minimalism has joined #ruby
pwnd_nsfw has quit [Ping timeout: 256 seconds]
palms has quit [Ping timeout: 260 seconds]
hutch34 has quit [Ping timeout: 245 seconds]
nankyokusei has quit [Ping timeout: 250 seconds]
astrobunny has quit [Remote host closed the connection]
lel has quit [Ping timeout: 256 seconds]
kalima32 has quit [Quit: Leaving.]
yardenbar has joined #ruby
lel has joined #ruby
gizless is now known as gizmore
ben__ has joined #ruby
threh has quit [Ping timeout: 265 seconds]
pokalyis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AndrewIsHere has joined #ruby
harai_ has joined #ruby
User458764 has joined #ruby
pawnbox has joined #ruby
pawnbox has quit [Remote host closed the connection]
ben__ has quit [Ping timeout: 256 seconds]
Joufflu has quit [Read error: Connection reset by peer]
Prawnzy has joined #ruby
chriswongxp has joined #ruby
beneggett has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
shmuli has joined #ruby
chriswongxp has left #ruby [#ruby]
vktec has quit [Ping timeout: 260 seconds]
aupadhye has joined #ruby
vktec has joined #ruby
Prawnzy has quit [Ping timeout: 260 seconds]
elenatanasoiu has joined #ruby
harfangk has joined #ruby
Xiti` has joined #ruby
Dohplay has quit [Read error: Connection reset by peer]
harai_ has quit [Read error: Connection reset by peer]
feelx has quit [Read error: Connection reset by peer]
AndrewIsHere has quit [Remote host closed the connection]
AndrewIsHere has joined #ruby
Xiti has quit [Ping timeout: 276 seconds]
elenatanasoiu has quit [Ping timeout: 265 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
TheCubeLord has joined #ruby
beneggett has joined #ruby
TheCubeLord has quit [Remote host closed the connection]
TheCubeLord has joined #ruby
CloCkWeRX has quit [Ping timeout: 265 seconds]
dextertzu has quit [Ping timeout: 260 seconds]
AndrewIsHere has quit [Ping timeout: 260 seconds]
Channel6 has quit [Quit: Leaving]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
amclain has quit [Quit: Leaving]
dnicole has joined #ruby
jenrzzz has joined #ruby
quazimodo has quit [Ping timeout: 250 seconds]
pokalyis has joined #ruby
JoshS has joined #ruby
LeBlaaanc has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jcao219 has joined #ruby
aupadhye has quit [Ping timeout: 245 seconds]
symm- has quit [Ping timeout: 244 seconds]
jeyraof has joined #ruby
Prawnzy has joined #ruby
LeBlaaanc has joined #ruby
blackwind_123 has quit [Ping timeout: 245 seconds]
blackwind_123 has joined #ruby
shayan_ has quit [Quit: shayan_]
dnicole has quit [Ping timeout: 260 seconds]
bklane has joined #ruby
kalima32 has joined #ruby
quazimodo has joined #ruby
pawnbox has joined #ruby
Helheim has joined #ruby
igniting has quit [Ping timeout: 265 seconds]
beneggett has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dhurba has joined #ruby
kalima32 has quit [Quit: Leaving.]
warrshrike has joined #ruby
<warrshrike>
How can I use ActiveRecord without rails. And also use the same database within rails....if that makes sense
<warrshrike>
I want to write a dataminer which stores results in a database through activerecord
<warrshrike>
and also want to show said data through a rails site
blackbombay_ has quit [Ping timeout: 250 seconds]
<bklane>
warrshrike: ya can just use the active_record gem
<bklane>
I have a sinatra app that writes data to db via active_record, the rails app can read it too
<warrshrike>
okay but HOW? I mean a new rails app starts with empty db and waits for migrations
astrobunny has joined #ruby
astrobunny has quit [Read error: Connection reset by peer]
astrobunny has joined #ruby
baweaver_away is now known as baweaver
foooobear has joined #ruby
bklane has quit [Quit: Leaving...]
shmuli has quit [Remote host closed the connection]
pnbeast has quit [Quit: leaving]
MrSamuel has quit [Quit: MrSamuel]
abernstein has quit [Quit: abernstein]
<warrshrike>
bklane: brother?
beneggett has joined #ruby
renderful has joined #ruby
jenrzzz has quit [Ping timeout: 276 seconds]
aidalgol has joined #ruby
LeBlaaanc has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
zukin has joined #ruby
SCHAAP137 has joined #ruby
shayan_ has joined #ruby
aupadhye has joined #ruby
renderful has quit [Ping timeout: 244 seconds]
arescorpio has quit [Quit: Leaving.]
jenrzzz has joined #ruby
Cohedrin has joined #ruby
pwnd_nsfw has joined #ruby
Cohedrin_ has quit [Ping timeout: 260 seconds]
shmuli has joined #ruby
Silthias has quit [Ping timeout: 260 seconds]
Silthias1 has joined #ruby
troys_ is now known as troys
elementaru has joined #ruby
troys has quit [Quit: Bye]
benlieb has quit [Quit: benlieb]
benlieb has joined #ruby
benlieb has quit [Client Quit]
k200 has joined #ruby
<k200>
when i do string.split(" ").each do |st| where string="one two" it gives me three output, one, two and array itself. how to avoid the last array output??
<hanmac>
k200 you need to show more of your code, but each does return the string itself, i think thats what you see
<k200>
ok. can i avoid that last array output? i am doing this in my rails view and i only want to iterate through splitted string items?
dnicole has joined #ruby
dmtd has quit [Quit: Connection closed for inactivity]
last_staff has joined #ruby
beneggett has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
conta has joined #ruby
anisha has joined #ruby
xall has joined #ruby
xall_ has quit [Ping timeout: 260 seconds]
Rickmasta has quit [Ping timeout: 260 seconds]
aupadhye has quit [Quit: Leaving]
aupadhye has joined #ruby
Rickmasta has joined #ruby
<hanmac>
k200 i think you want map instead of each
dhurba has quit [Ping timeout: 260 seconds]
xall_ has joined #ruby
zukin has quit [Quit: bsd!]
xall has quit [Ping timeout: 244 seconds]
hutch34 has joined #ruby
nankyokusei has joined #ruby
dnicole has quit [Remote host closed the connection]
dnicole has joined #ruby
nankyokusei has quit [Ping timeout: 244 seconds]
hutch34 has quit [Ping timeout: 244 seconds]
gingray has joined #ruby
dnicole has quit [Ping timeout: 245 seconds]
dnicole has joined #ruby
ben__ has joined #ruby
quazimodo has quit [Read error: Connection reset by peer]
<dminuoso_>
bobdobbs: Something has an open file handle Im guessing.
<dminuoso_>
bobdobbs: Check lsof
sparch has joined #ruby
shmuli has quit [Ping timeout: 245 seconds]
_sfiguser has quit [Remote host closed the connection]
ziarkaen has quit [Ping timeout: 250 seconds]
<bobdobbs>
dminuoso_: could it be something in the script itself? Like, is there some nuance to the ruby's file api that I need to know?
the_drow has quit [Read error: Connection reset by peer]
emilkarl has joined #ruby
flying has quit []
<dminuoso_>
bobdobbs: Have you checked my open file handle theory?
startupality has quit [Quit: startupality]
the_drow has joined #ruby
<bobdobbs>
dminuoso_: only in the crudest possible fashion...
<bobdobbs>
<bobdobbs>
I did 'lsof | grep html'. Nothing returned
jaxxstorm has joined #ruby
<dminuoso_>
bobdobbs: I got an idea.
<dminuoso_>
bobdobbs: Dir.foreach includes "." and ".."
<dminuoso_>
;-)
<hanmac>
yeah i hate this stupid dot files too :/
postmodern has quit [Quit: Leaving]
<bobdobbs>
hmmm
blockchan has joined #ruby
Gadgetoid has joined #ruby
pawnbox has quit [Remote host closed the connection]
nettoweb has quit [Ping timeout: 260 seconds]
symm- has joined #ruby
nettoweb has joined #ruby
pawnbox has joined #ruby
<bobdobbs>
oh!
<bobdobbs>
I'm stoopid
<bobdobbs>
of course it's the dotfiles
camilasan has quit [Remote host closed the connection]
gnufied has quit [Ping timeout: 245 seconds]
the_drow has quit [Read error: Connection reset by peer]
camilasan has joined #ruby
nettoweb has quit [Ping timeout: 252 seconds]
zacstewart has joined #ruby
nettoweb has joined #ruby
warrshrike has joined #ruby
<warrshrike>
Hi gentlemen
the_drow has joined #ruby
conta has quit [Quit: conta]
oyes has joined #ruby
Tempesta has quit [Ping timeout: 260 seconds]
<warrshrike>
I'm trying to run shell commands in ruby via Open3 to run a bash script and get the result back. Unfortunately, the Java based application in the script always throws an exception
<warrshrike>
I've tried exec, ``, open3, open4
<dminuoso_>
warrshrike: Dont tell me that the Java Exception propagates through the shell into Ruby!
<warrshrike>
it works okay i run it directly through bash...so I'm thinking its either a shell thingie issue
<warrshrike>
any ideas?
zacstewart has quit [Ping timeout: 265 seconds]
<workmad3>
warrshrike: well, that's exactly what I'd expect with `exec`, as that replaces the current process with the specified one
<warrshrike>
dumb it down for me?
<warrshrike>
open3 and open4 use a child process but the same error occurs
<workmad3>
warrshrike: right, but I'm betting it doesn't propagate through the ruby process then? :)
<dminuoso_>
warrshrike: Let's differentiate between two things: Propagating exceptions - and STDERR.
<warrshrike>
oh yeah it doesnt
<dminuoso_>
warrshrike: So what do you want to happen?
<warrshrike>
yes that makes sense. In this case the program terminates...in the subshell it doesnt
gnufied has joined #ruby
frozengeek has quit [Quit: frozengeek]
<warrshrike>
well I want the bash script to run without errors...
elementaru has joined #ruby
<workmad3>
warrshrike: `exec` is rarely what you want to do if you want to shell out to a command in ruby... it doesn't shell out, it replaces the current ruby program with the command you've called it with
<warrshrike>
I get the same error using system '...' with a subshell
salut has joined #ruby
<workmad3>
warrshrike: how about `system "bash -l <command>"`?
<warrshrike>
Okay so what do you suggest brother
<warrshrike>
okay lemme try
<dminuoso_>
warrshrike: if you dont want an error, fix your java app/invocation.
GinoManWorks has quit [Ping timeout: 244 seconds]
<dminuoso_>
Im absolutely unsure what the issue is.
<workmad3>
dminuoso_: it apparently doesn't error when run directly in a bash shell
blackmesa has quit [Ping timeout: 252 seconds]
<workmad3>
but does when invoked through open3/system/etc in ruby
frozengeek has joined #ruby
<warrshrike>
same error...java app is fine as it runs fine directly in bash
<warrshrike>
@workmad3: exactly
Immune has joined #ruby
hck89 has joined #ruby
the_drow has quit [Read error: Connection reset by peer]
<warrshrike>
a classpath/bash thingie error? It really should work after doing bash -l since we start the local shell
<warrshrike>
...
<workmad3>
warrshrike: yeah, no idea... maybe see if you can reproduce the error somehow in a bash terminal and then ask a java channel (or the authors of that 'Soot' library whatever it is)?
emilkarl has quit [Read error: Connection reset by peer]
gnufied has quit [Ping timeout: 260 seconds]
<dminuoso_>
warrshrike: Environment variables, wrong current working dir..
<dminuoso_>
those things come to mind.
<dminuoso_>
"Attempt to create RefType containing a / --> ../flap1.0" sounds suspciously related to relative paths.
oyes has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jaxxstorm has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<warrshrike>
man im stupid i should be beaten by a hooded guy in a back alley...I hadnt used a prior command for env vars!
<warrshrike>
okay how can I execute TWO bash commands 'concurrently' in open4
<dminuoso_>
"concurrently" ?
<dminuoso_>
open4?
<dminuoso_>
:|
<apeiros>
warrshrike: you call open4 twice
Immune has quit [Ping timeout: 260 seconds]
synthroid has joined #ruby
<warrshrike>
oh...should stdin be used?
<apeiros>
they're separate processes. they won't wait for ruby.
the_drow has joined #ruby
<workmad3>
they'll also have separate environments...
<apeiros>
how'd I know whether you should use stdin for whatever you do?
<warrshrike>
I mean pid, stdin, stdout, stderr = Open4::popen4 "artifact_path=`pwd`; export PATH=$artifact_path:$PATH"
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<warrshrike>
now...also I want the same 'shell'...I assume that means same process
<warrshrike>
so separate Open4s?
<apeiros>
you can't run processes concurrently in one shell. or at least I'm unaware of how.
Puffball has joined #ruby
<apeiros>
also iirc open4 allows you to pass an env to the spawned process. no need for export shenanigans.
<cek>
correct.
<workmad3>
warrshrike: you probably don't mean 'concurrent' btw... you probably mean you want to run something to set up an environment and then run your script... a.k.a. you want a sequential run ;)
<warrshrike>
yep.
<warrshrike>
yeah I meant sequential
<workmad3>
but you'd probably be better off using the features of open3 to set an environment
<warrshrike>
how does one use those features? There is nothing on the open4 repo...
djellemah has quit [Ping timeout: 256 seconds]
thoolihan_ has joined #ruby
uranellus_ has joined #ruby
yonatankoren_ has joined #ruby
svkurowski_ has joined #ruby
zenguy_pc has quit [Ping timeout: 276 seconds]
bogdanteleaga has quit [Ping timeout: 276 seconds]
svkurowski has quit [Ping timeout: 276 seconds]
yonatankoren has quit [Ping timeout: 276 seconds]
sonOfRa has quit [Ping timeout: 276 seconds]
flopsec has quit [Ping timeout: 276 seconds]
thoolihan has quit [Ping timeout: 276 seconds]
uranellus has quit [Ping timeout: 276 seconds]
svkurowski_ is now known as svkurowski
<workmad3>
warrshrike: I probably wouldn't use open4 btw... that seems rather ancient, and the main feature it seems to add is that it unwraps the pid (which is pretty easy to get with Open3)
brendan- has joined #ruby
zenguy_pc has joined #ruby
<warrshrike>
okay no more open4...yeah its 6 years old
the_drow has quit [Read error: Connection reset by peer]
wugy has quit []
Snowy has joined #ruby
ghostlight has quit [Ping timeout: 260 seconds]
pokalyis has joined #ruby
the_drow has joined #ruby
shmuli has joined #ruby
ramortegui has joined #ruby
ghostlight has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
pragmaticus has quit [Ping timeout: 245 seconds]
sdothum has joined #ruby
claudiuinberlin has quit [Remote host closed the connection]
shmuli has quit [Ping timeout: 260 seconds]
jphase has joined #ruby
jphase has quit [Remote host closed the connection]
claudiuinberlin has joined #ruby
djellemah has joined #ruby
jphase has joined #ruby
Puffball has quit [Remote host closed the connection]
Puffball has joined #ruby
futilegames has joined #ruby
claudiuinberlin has quit [Ping timeout: 245 seconds]
mjuxn[m] has joined #ruby
silex[m] has joined #ruby
MuffinPimp[m] has joined #ruby
madveru[m] has joined #ruby
bascht[m] has joined #ruby
shine[m] has joined #ruby
Luca[m] has joined #ruby
shiny[m] has joined #ruby
laithshadeed[m] has joined #ruby
eliotk[m] has joined #ruby
cpfeilschifter[m has joined #ruby
meaggan[m] has joined #ruby
velu_aon[m] has joined #ruby
fladson[m] has joined #ruby
mistake[m] has joined #ruby
the_drow has quit [Read error: Connection reset by peer]
jphase has quit []
claudiuinberlin has joined #ruby
chouhoulis has joined #ruby
ben___ has joined #ruby
jphase has joined #ruby
brendan- has joined #ruby
the_drow has joined #ruby
blackmesa has joined #ruby
TheCubeLord has quit [Quit: F*** This S*** Im out!]
RitterJack has joined #ruby
ferr has quit [Quit: WeeChat 1.5]
aryaching has joined #ruby
Pumukel has quit [Remote host closed the connection]
Pumukel has joined #ruby
pragmaticus has joined #ruby
malconis has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
<k200>
how cas i split "text12,134" to "text" and "12,134"
zarubin has quit [Read error: Connection reset by peer]
the_drow has quit [Read error: Connection reset by peer]
DLSteve has joined #ruby
Pumukel has quit [Ping timeout: 260 seconds]
jphase has quit []
malconis has quit [Ping timeout: 250 seconds]
galeido_ is now known as galeido
galeido has quit [Changing host]
galeido has joined #ruby
jeyraof has joined #ruby
malconis has joined #ruby
<RitterJack>
RoR question : How can I translate month name in date_select ? i added rails-i18n gem and config.i18n.default_locale = :fr but nothing change.. Thanks
<tobiasvl>
k200: something like this maybe text12,1234'.split(/([^\d]+)([^a-zA-Z]*)/)
<ruby[bot]>
RitterJack: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
<apeiros>
ljarvis: why not \D+|\d+?
<RitterJack>
apeiros, already asked, no awnser that why i try here
<apeiros>
ah, scan, not split
chouhoulis has quit [Remote host closed the connection]
lenwood has quit [Ping timeout: 265 seconds]
Derperperd has joined #ruby
<apeiros>
RitterJack: in that case:
<apeiros>
?crosspost RitterJack
<ruby[bot]>
RitterJack: Please do not crosspost without at least telling so and mentioning provided suggestions and their outcome in all channels. Experience shows that people don't do either, and not doing so is considered rude.
nettoweb1 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Immune has quit [Ping timeout: 260 seconds]
<k200>
why ruby :alpha: google search gives me results abotu Pokemon??
<apeiros>
lol
RitterJack has quit [Quit: Quitte]
<apeiros>
I guess because there's a pokemon game by the name "alpha ruby"
<k200>
:-)
<k200>
what do I search for?
Puffball has quit [Read error: Connection reset by peer]
pwnd_nsfw` has quit [Read error: Connection reset by peer]
<warrshrike>
no its static, but it isnt called static?
<warrshrike>
so*
<apeiros>
it's not static. that concept does not apply to ruby.
PaulCapestany has quit [Read error: Network is unreachable]
<apeiros>
it's at max similar to what's static in some other languages.
<warrshrike>
so it belongs to the class, rather than one of its instances?
<apeiros>
correct
emilkarl has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pwnd_nsfw` has joined #ruby
<warrshrike>
okay...
kingkong- has joined #ruby
<apeiros>
and you can define methods to access them, either via metaprogramming (the attr_* methods), or by hand
PaulCapestany has joined #ruby
<tobiasvl>
warrshrike: in ruby, classes are objects of the class Class
<warrshrike>
that confuses more...what is the diff b/w @instancedefinedinclassbody and @@classvar
<apeiros>
@@classvar has rather complex inheritance rules
<apeiros>
i.e. @ivar belongs to *one* object only. always.
<tobiasvl>
the first one you use, the second one we don't speak about
<apeiros>
@@classvars belong to a plethora of objects: the class, its descendants, its instances, the instances of its descendants.
<warrshrike>
so i can assume @@neverexisted
Derperperd has quit [Quit: Derperperd]
<warrshrike>
cool
cdg has joined #ruby
<apeiros>
and due to those rules being somewhat hard to understand, we do what tobiasvl said - we usually don't use it.
<warrshrike>
yeah makes sense. okay what is the diff between @var and normalvar in a func body
<apeiros>
normalvar's scope is limited to the method. @var is scoped to the objects lifetime.
ChiefAlexander has joined #ruby
<warrshrike>
oh!
jcao219 has quit [Ping timeout: 260 seconds]
startupality has joined #ruby
<warrshrike>
so no matter what funck @var is made in (not necessarily the cnstrtr)..it persists till end?
<apeiros>
i.e. @ivars are the object's own data. lvars are data to temporarily work with.
<warrshrike>
defined in*
<apeiros>
yes.
<warrshrike>
so theres nothing special about a cnstrtr...except the fact that it is invoked at funk birth
<warrshrike>
right?
<apeiros>
once assigned, the object in whose context the method was run will have that ivar until the object either dies or you explicitly undefine it.
<apeiros>
cnstrtr?
<warrshrike>
constructor
<apeiros>
correct. initialize is an ordinary method.
<apeiros>
the only special thing is that Class#new will call it with all the arguments passed to new right after allocating the new object.
<apeiros>
and that it's private by default.
<warrshrike>
so @var has object wide scope...and isnt limited to the function which births it?
<apeiros>
correct
<warrshrike>
makes perfect sense my man. and $globalvar is global no matter where defined?
cdg has quit [Read error: Connection reset by peer]
ych has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cdg has joined #ruby
anisha has quit [Quit: This computer has gone to sleep]
<apeiros>
yes. hence its name ;-)
Puffball has quit [Remote host closed the connection]
armyriad has joined #ruby
igniting has joined #ruby
YaknotiS has joined #ruby
AlexRussia has joined #ruby
<warrshrike>
awesome. thanks a bunch man....now I have some ruby code to rewrite....~_~
jphase has quit [Remote host closed the connection]
<warrshrike>
man sometimes I think...if my employers actually knew how clueless I am, they'd have a seizure
<apeiros>
don't worry
<apeiros>
if you knew how clueless your employers are, you'd have a seizure yourself ;-p
jphase has joined #ruby
jphase has quit [Remote host closed the connection]
jphase has joined #ruby
jphase has quit [Changing host]
jphase has joined #ruby
Puffball has joined #ruby
Rodya_ has joined #ruby
<warrshrike>
hahaa true >.<
harai_ has quit [Ping timeout: 260 seconds]
djbkd has joined #ruby
the_drow has quit [Read error: Connection reset by peer]
blackmesa has quit [Quit: WeeChat 1.5]
kalima32 has joined #ruby
dextertzu has quit [Read error: Connection reset by peer]
<warrshrike>
Hey man the @instvars we were talking about are they public by default?
<apeiros>
no
<apeiros>
you can only ever access an ivar of another object through a method
<warrshrike>
hmm..alright
ricer2 has quit [Quit: Caught SystemExit exception.]
<apeiros>
but by default, your object will have instance_variable_get
<warrshrike>
is there an equivalent to pythons static_Assert?
<apeiros>
if you want an array which enforces a class/type, you'd have to implement it yourself. IMO usually more work than it's wroth.
<apeiros>
*worth
<warrshrike>
yeah i dont really need it when in Ruby go the Ruby way I guess
<apeiros>
not knowing python well, but I don't think so.
<hardest_>
csv with ruby it is difficult :/
<dminuoso_>
warrshrike: Ruby is duck typing based.
<k200>
ljarvis: "currency amount with comma"
<dminuoso_>
warrshrike: If it walks like a duck and talks like a duck, it is a duck - even if its not a duck.
ziarkaen has quit [Ping timeout: 244 seconds]
pokalyis has quit [Read error: Connection reset by peer]
<dminuoso_>
warrshrike: The way you treat objects defines the "checking of objects" - only assert classes when there could be ambiguities that may not present themselves immediately.
<warrshrike>
python is duck typed too...but yeah i get it there is no conception of type at all.
pokalyis has joined #ruby
<warrshrike>
yeah
<dminuoso_>
warrshrike: There is a concept of type, but its not very commonly enforced.
<hardest_>
CSV.foreach(filename) do |row| p row[0] # use row here... end #for i -- my outputing is like "GOOGLE.COM", how do I remove quotes ?
harai_ has joined #ruby
<dminuoso_>
warrshrike: If you want static typing and something like Ruby, try out the Crystal language.
<apeiros>
hardest_: you probably don't have quotes and are confusing inspect and value
<apeiros>
>> x = "foo"; puts x.inspect; puts x # hardest_ check the link for the output and compare
<warrshrike>
crystal seems real cool, like a less verbose swift
<hardest_>
with inspect output is "\"GOOGLE.ZW\""
<apeiros>
then you have quotes. but in that case, it's not "csv is hard with ruby". it's you having quoted data in your csv. rather unrelated.
<apeiros>
you can either slice them away (str[1..-2]), regex replace them (str.gsub(/\A"|"\z/, ''), or find another creative way.
Derperperd has quit [Quit: Derperperd]
the_drow has quit [Read error: Connection reset by peer]
<hardest_>
apeiros: I do not have quotes
<apeiros>
hardest_: your output says you do. or you're not telling the full story.
<apeiros>
ruby's csv lib doesn't add quotes for funsies.
igniting has quit [Ping timeout: 268 seconds]
<hardest_>
I dont see any quotes opening the file even with vi
<hardest_>
how do I use counts with foreach ? I mean, for i in.. puts i
startupality has quit [Quit: startupality]
<apeiros>
foreach(x).with_index do |row, idx|
dminuoso_ has quit [Ping timeout: 265 seconds]
* apeiros
brb
ziarkaen has joined #ruby
the_drow has joined #ruby
pokalyis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
warrshrike has quit [Ping timeout: 260 seconds]
tercenya has joined #ruby
ziarkaen has quit [Ping timeout: 268 seconds]
ericwood has joined #ruby
ziarkaen has joined #ruby
Prawnzy has joined #ruby
yardenbar has joined #ruby
* apeiros
back
dionysus69 has quit [Ping timeout: 265 seconds]
<apeiros>
hardest_: re: "I don't see any quotes". well, then as said, you're not telling us the full story. because as said, ruby's csv lib does not add quotes where there aren't any.
the_drow has quit [Read error: Connection reset by peer]
GodFather has quit [Ping timeout: 256 seconds]
jsaak has quit [Remote host closed the connection]
Prawnzy has quit [Ping timeout: 260 seconds]
the_drow has joined #ruby
symm- has quit [Ping timeout: 250 seconds]
ChiefAlexander has quit [Remote host closed the connection]
the_drow has quit [Read error: Connection reset by peer]
ChiefAlexander has joined #ruby
ych has joined #ruby
shmuli has joined #ruby
cdg_ has joined #ruby
aryaching has quit [Read error: Connection reset by peer]
the_drow has joined #ruby
cdg has quit [Ping timeout: 256 seconds]
shmuli has quit [Ping timeout: 256 seconds]
abernstein has joined #ruby
nettoweb has joined #ruby
jbeeze has joined #ruby
mhib has joined #ruby
ych has quit [Read error: Connection reset by peer]
teclator has quit [Ping timeout: 260 seconds]
last_staff has quit [Read error: Connection reset by peer]
c355e3b has quit [Quit: Connection closed for inactivity]
bluOxigen has quit [Ping timeout: 250 seconds]
spectrum has quit [Read error: Connection reset by peer]
tycoon177 has joined #ruby
<tycoon177>
Is it more ruby-like to have "!some_boolean" or "not some_boolean"
<canton7>
!some_boolean
lenwood has joined #ruby
<canton7>
although also consider using 'unless' and 'until' (instead of 'if' and 'while'), so long as that doesn't make your code harder to read
tercenya has quit [Remote host closed the connection]
the_drow has quit [Read error: Connection reset by peer]
<workmad3>
tycoon177: `not` has extra concerns around precedence, so `!` is generally preferred in most situations
tercenya has joined #ruby
AndrewIsHere has joined #ruby
synthroid has quit [Remote host closed the connection]
hardest_ has quit [Ping timeout: 260 seconds]
<tycoon177>
Thanks!
<tycoon177>
Is unless just syntactic sugar for "if !"?
<manveru>
basically... yes :)
<tycoon177>
Thanks everyone! :) I'm still new to ruby and learning it for work (as well as personal use. I'm falling in love with it! :D)
the_drow has joined #ruby
mpr555 has joined #ruby
sulcino has joined #ruby
<manveru>
note that if you define !@ on your class and expect `unless x` to behave like `if !x`, it won't :P
Jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lenwood has quit [Ping timeout: 260 seconds]
<manveru>
>> class X; def !@; p :here; true; end; end; unless !!X.new; :false end
sulcino has quit [Remote host closed the connection]
djellemah has joined #ruby
sulcino has joined #ruby
ruby-lang393 has joined #ruby
GladiaTeur has joined #ruby
GladiaTeur has left #ruby [#ruby]
<k200>
ljarvis: any idea?
AlexRussia has quit [Ping timeout: 268 seconds]
kalima32 has left #ruby [#ruby]
the_drow has quit [Read error: Connection reset by peer]
kyle__ has quit [Remote host closed the connection]
kyle has joined #ruby
kyle is now known as Guest8256
<ruby-lang393>
hi i am new to ruby language so i need one help,i have installed two ruby versions in my machine,the second ruby installation path is not specified in environment variable $PATH.when i am trying to use that bundler version i am specifying the complete path e.g "/usr/local/bin/bundler exec " but somehow this command is not picking the corresponding ruby version
<ruby-lang393>
i am not sure what i am missing in this
TheCubeLord has joined #ruby
SuperLag_ has joined #ruby
teclator has joined #ruby
rafaelcosta has joined #ruby
mpr555 has quit []
|ifei5g00d has joined #ruby
the_drow has joined #ruby
rafaelcosta has quit [Client Quit]
dminuoso_ has joined #ruby
|ifei5g0_ has joined #ruby
|ifei5good has quit [Read error: Connection reset by peer]
aganov has quit [Remote host closed the connection]
SuperLag has quit [Ping timeout: 250 seconds]
k200 has quit [Quit: leaving]
rafaelcosta has joined #ruby
|ifei5g00d has quit [Read error: Connection reset by peer]
Rodya_ has quit [Remote host closed the connection]
djbkd_ has joined #ruby
blockchan has quit [Ping timeout: 250 seconds]
blockchan1 is now known as blockchan
<hardest_>
manveru: not sure how do translate what you said to this ... CSV.foreach('tld.csv', headers:true).with_index do |row, i| File.open("tld.txt", "a+") do |txt|
shayan_ has quit [Quit: shayan_]
<al2o3-cr>
hardest_: check the link
the_drow has quit [Read error: Connection reset by peer]
<al2o3-cr>
a super simple way :)
threh has joined #ruby
<manveru>
al2o3-cr: any reason you're not using the block syntax to make sure the file is closed again?
<al2o3-cr>
just for simplicity
johnny56 has joined #ruby
<manveru>
also the with_index is useless, he only wants the first value
the_drow has quit [Read error: Connection reset by peer]
<hardest_>
I think only one last question
<hardest_>
I would like to make a exception general because the scripts break when I am not able for some reason to whois
<manveru>
so just skip the line if there's an error?
<manveru>
what error do you get?
gusrub has quit [Ping timeout: 260 seconds]
Dimik has joined #ruby
lechiffre10 has joined #ruby
Prawnzy has joined #ruby
Pumukel has joined #ruby
<hardest_>
the error is /var/lib/gems/2.2.0/gems/whois-3.6.5/lib/whois/server/adapters/web.rb:34:in `request': This TLD has no WHOIS server, but you can access the WHOIS database at `http://www.nic.ar/' (Whois::WebInterfaceError) from /var/lib/gems/2.2.0/gems/whois-3.6.5/lib/whois/server/adapters/base.rb:107:in `block in lookup'
the_drow has quit [Read error: Connection reset by peer]
futilegames has left #ruby [#ruby]
brendan- has joined #ruby
whathappens has quit [Ping timeout: 265 seconds]
the_drow has joined #ruby
last_staff has joined #ruby
gusrub has quit [Remote host closed the connection]
mooru has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nettoweb has joined #ruby
pocketpr1 has joined #ruby
blackbombay_ has quit [Ping timeout: 244 seconds]
VeryBewitching has joined #ruby
User458764 has quit [Read error: Connection reset by peer]
User4587_ has joined #ruby
blackbombay_ has joined #ruby
tdy has joined #ruby
Rodya_ has joined #ruby
nettoweb has quit [Client Quit]
jcao219 has joined #ruby
c355e3b has joined #ruby
lacour has joined #ruby
igniting has quit [Ping timeout: 244 seconds]
tvw has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
z3l has joined #ruby
pocketpr1 has quit [Quit: WeeChat 1.5]
the_drow has quit [Read error: Connection reset by peer]
doadet has joined #ruby
dan_ has joined #ruby
blockchan has quit [Ping timeout: 260 seconds]
dan_ is now known as Guest56924
weemsledeux has joined #ruby
Guest56924 has quit [Client Quit]
the_drow has joined #ruby
xall_ has quit [Ping timeout: 250 seconds]
ur5us has quit [Remote host closed the connection]
<hardest_>
how to make exception of this ? /usr/lib/ruby/2.2.0/time.rb:252:in `make_time': no time information in "" (ArgumentError) from /usr/lib/ruby/2.2.0/time.rb:364:in `parse' from /var/lib/gems/2.2.0/gems/whois-3.6.5/lib/whois/record/parser/whois.nc.rb:57:in `block (2 levels) in <class:WhoisNc>'
marxarelli has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
seventy has joined #ruby
weemsledeux has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<seventy>
Hey everyone! :)
antgel has quit [Ping timeout: 256 seconds]
renderful has joined #ruby
ziarkaen has joined #ruby
modlin has joined #ruby
the_drow has quit [Read error: Connection reset by peer]
gusrub has joined #ruby
renderful has quit [Ping timeout: 260 seconds]
mooru has joined #ruby
<bougyman>
manveru: ping
dan__ has joined #ruby
<manveru>
bougyman: pong
cdg_ has quit [Ping timeout: 256 seconds]
<dan__>
if i installed rsruby like, gem install rsruby, how come when i try to load RSRuby.instance it says "R HOME variable not defined"
<bougyman>
cause I can't turn that into a DRb::DRbObject
grh has joined #ruby
djbkd has quit [Remote host closed the connection]
sparch has quit [Ping timeout: 268 seconds]
<dan__>
manveru YES!!
djbkd has joined #ruby
<manveru>
dan__: that's a "it's working now" or "that's what i just told you" yes?
<dan__>
i have R working
ledestin has joined #ruby
<manveru>
ok, and where is R installed?
gusrub has quit [Ping timeout: 245 seconds]
<dan__>
i dont get why i can install it like this, gem install rsruby -- --with-R-dir=/usr/lib/R --with-R-include=/usr/share/R/include --with_cflags="-fPIC -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wall -fno-strict-aliasing", but if i run it through bundle install, it crashes
nankyokusei has joined #ruby
nankyokusei has quit [Remote host closed the connection]
<dan__>
that installs successfully, but i use bundler, and it wont install through bundle
<manveru>
because you need to tell bundler to use that option
seventy has quit [Quit: Leaving]
<dan__>
i do, i run this, sudo bundle config build.rsruby "--with-R-include=/usr/share/R/include --with_cflags=\"-fPIC -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wall -fno-strict-aliasing\""
<dan__>
yeah so i run that command, and then bundle install, but it still wont work
<dan__>
:( :( :(
<manveru>
because you use sudo?
Felipe__ has quit [Ping timeout: 260 seconds]
<dan__>
i dont see why sudo would break it. i always use sudo. i work on this project with someone who is a better coder than me and he set it up to always use "sudo bundle install", that is the convention we use
shazaum_ has joined #ruby
<dan__>
manveru help me get it wroking ill pay you
Dohplay has quit [Read error: Connection reset by peer]
ldnunes has quit [Quit: Leaving]
grh has quit [Ping timeout: 252 seconds]
willardg has joined #ruby
djellemah has joined #ruby
alamar is now known as alabaer
alabaer is now known as alamar
shmuli has quit [Remote host closed the connection]
<al2o3-cr>
atmosx: result = r if is_palindrome?(r) && r > result yields correct result
Rodya_ has quit [Ping timeout: 245 seconds]
pandabearit_ has quit [Changing host]
pandabearit_ has joined #ruby
chouhoulis has quit [Ping timeout: 260 seconds]
tercenya has quit [Remote host closed the connection]
tercenya has joined #ruby
pandabearit_ has quit [Quit: This computer has gone to sleep]
abernstein has quit [Quit: abernstein]
harai_ has joined #ruby
bruce_lee has quit [Read error: Connection reset by peer]
pandabearit_ has joined #ruby
nopolitica has quit [Ping timeout: 244 seconds]
ojeno has quit [Quit: Leaving.]
Xeago has quit [Ping timeout: 256 seconds]
brent__ has joined #ruby
pandabearit_ has quit [Quit: This computer has gone to sleep]
Xeago has joined #ruby
brendan- has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
pandabearit_ has joined #ruby
pandabearit_ has quit [Changing host]
pandabearit_ has joined #ruby
tdy has quit [Ping timeout: 256 seconds]
djbkd_ has quit [Ping timeout: 268 seconds]
jeyraof has quit [Quit: This computer has gone to sleep]
gingray has quit [Ping timeout: 250 seconds]
BlkDynmt has quit [Quit: BlkDynmt]
franknatividad has joined #ruby
lenwood has joined #ruby
VeryBewitching has quit [Quit: Konversation terminated!]
cdg has joined #ruby
franknatividad is now known as coderfrank
pandabearit_ has quit [Quit: This computer has gone to sleep]
shayan_ has joined #ruby
BlkDynmt has joined #ruby
benlieb has quit [Quit: benlieb]
pandabearit_ has joined #ruby
pandabearit_ has quit [Remote host closed the connection]
blockchan has quit [Ping timeout: 268 seconds]
Guest66 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DLSteve has joined #ruby
<coderfrank>
exit
coderfrank has quit [Quit: leaving]
ChiefAlexander has quit [Remote host closed the connection]
jaequery has quit [Read error: Connection reset by peer]
blockchan has joined #ruby
ben______ has joined #ruby
Guest66 has joined #ruby
coderfrank has joined #ruby
blockchan has quit [Ping timeout: 244 seconds]
ben______ has quit [Ping timeout: 260 seconds]
shayan_ has quit [Quit: shayan_]
Jackneill_ has quit [Remote host closed the connection]
pokalyis has quit [Ping timeout: 256 seconds]
bkxd has joined #ruby
tristanp has quit [Remote host closed the connection]
marr has quit [Ping timeout: 256 seconds]
tristanp has joined #ruby
kirun has quit [Quit: Konversation terminated!]
pokalyis has joined #ruby
renderful has joined #ruby
kalima32 has quit [Quit: Leaving.]
troys is now known as troys_
bkxd has quit [Ping timeout: 260 seconds]
tristanp has quit [Ping timeout: 260 seconds]
Madplatypus has joined #ruby
Guest66 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
renderful has quit [Ping timeout: 260 seconds]
benlieb has joined #ruby
benlieb has quit [Client Quit]
hck89 has joined #ruby
Immune has quit [Ping timeout: 260 seconds]
Dimik has quit [Read error: Connection reset by peer]
Dimik has joined #ruby
johnmilton has quit [Ping timeout: 244 seconds]
nankyokusei has joined #ruby
weemsledeux has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
jcao219 has joined #ruby
Immune has joined #ruby
Rodya_ has joined #ruby
nankyokusei has quit [Ping timeout: 260 seconds]
<soahccc>
What is the most elegant (and performant) way to insert an element into an array at the position it would go if I would go about sorting it
solocshaw has joined #ruby
<Mon_Ouie>
Probably Array#bsearch to find the index, then Array#insert
<Mon_Ouie>
Although if you need to keep a data structured sorted, I'd consider not using an Array
<soahccc>
but a database?
Rodya_ has quit [Ping timeout: 245 seconds]
cdg has quit [Remote host closed the connection]
<havenwood>
or the newish Array#bsearch_index
<Mon_Ouie>
I just meant a binary search tree of some kind
<havenwood>
2.3+
lenwood has quit [Ping timeout: 260 seconds]
<soahccc>
Mon_Ouie: It's a daemon and I need to (re)schedule tasks. At the moment I do it very efficient in that I have hundreds of threads that just sleep :D Now I thought of one schedule thread and an array or hash [run_at, proc]. Now I can just iterate the whole array every second or I keep it sorted and shift or pop until all due entries are done
dnicole has quit [Remote host closed the connection]
whathappens has quit [Remote host closed the connection]