<macmartine>
I am accessing the data of a huge binary file that I want to copy down. I assume it's best to copy it in chunks something like https://gist.github.com/1945953 ?
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
<jmontross>
pry is nice - but cant get it ito rails app from dependency problem… conflicting gems
<macmartine>
I'm trying to write binary data to a file but hitting this error https://gist.github.com/1946204 -- how can i fix that?
<lianj>
'wb' ?
<macmartine>
lianj: are you talking to me?
<macmartine>
oooh
<macmartine>
looksl ike that's working… thanks!
<lianj>
:)
aza_kibo_ has joined #ruby-lang
erpuds has joined #ruby-lang
tomzx has joined #ruby-lang
jackhammer2022 has joined #ruby-lang
erpuds has joined #ruby-lang
<jackhammer2022>
hi all
<jackhammer2022>
any suggestions for a ruby graphing library
<jackhammer2022>
i need to generate a png out of my ranking data for songs
m3nd3s has joined #ruby-lang
agilob has joined #ruby-lang
Joeysomo has joined #ruby-lang
Kuukunen has joined #ruby-lang
<countskm>
a little off topic but just curious what peoples former language experience is in the channel? mine academic c/c++/java and perl pro
Joeysomo has joined #ruby-lang
<zenspider>
countskm: yes
ascarter has joined #ruby-lang
<zenspider>
jackhammer2022: there are a lot of options. the easiest is prolly using a web service like google's
<jackhammer2022>
zenspider: i mean some gem
<jackhammer2022>
so that i can do it offline
<zenspider>
who's offline these days?
<jmontross>
countskm: i had used php and linden scripting language prior to using ruby… i doubt this is typical.. maybe php to ruby is common
<jmontross>
also html/javascript/css — mostly web things prior to ruby
Kuukunen has joined #ruby-lang
<jackhammer2022>
i am :) i am just behing a wall and i am doing numeric computations
<jackhammer2022>
*behind
looopy has joined #ruby-lang
Rakko has joined #ruby-lang
<Rakko>
Hello! How does `ary1 - ary2` determine whether two members are the same? More to the point, how I can make it so that `ary1 - ary2` ignores certain fields in elements?
<Rakko>
I've tried defining <=>, ==, and eql? on the elements' class, to ignore those fields; but it didn't work.
<zenspider>
Rakko: looks like it calls hash and eql? in ruby19
<zenspider>
I made a basic test using a subclass of BasicObject and defined method_missing on it
<Rakko>
can I see?
<zenspider>
easy enough to do yourself.
<Rakko>
ok... I see that implementing hash is what does the trick
* Rakko
looks up how to do that
<zenspider>
it's prolly doing exactly what set does, build a hash and map
Sailias|work has joined #ruby-lang
tenderlove has joined #ruby-lang
Heimidal_ has joined #ruby-lang
<Rakko>
ok, so maybe I could use a set
tjgillies has joined #ruby-lang
QaDeS_ has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
QoQOoO has joined #ruby-lang
<ryanf>
is there a way for a gem to have a binary component that's optional?
<ryanf>
like, depending on the libraries the system has installed, target platform, or whatever
Luxx_ has joined #ruby-lang
Rakko has quit [#ruby-lang]
AndChat- has joined #ruby-lang
v0yager has joined #ruby-lang
shtirlic has joined #ruby-lang
Swimming_Bird has joined #ruby-lang
nuclearsandwich has joined #ruby-lang
gregf has joined #ruby-lang
t has joined #ruby-lang
willdrew has joined #ruby-lang
Indian has joined #ruby-lang
dv310p3r has joined #ruby-lang
wallerdev has joined #ruby-lang
H2H has joined #ruby-lang
aza_kibou has joined #ruby-lang
wallerdev has joined #ruby-lang
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
Defusal has joined #ruby-lang
gnufied has joined #ruby-lang
wmoxam has joined #ruby-lang
DRCALKIN has joined #ruby-lang
pp01bit has joined #ruby-lang
<erikh>
ryanf: the sqlite gem does this IIRC for windows
wmoxam_ has joined #ruby-lang
<countskm>
zen and jmon - cool
brushbox1 has joined #ruby-lang
tenderlove has joined #ruby-lang
twelvechairs has joined #ruby-lang
ascarter has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
Lupe has joined #ruby-lang
Joeysomo has joined #ruby-lang
dajmon has joined #ruby-lang
<dajmon>
I am a master’s student performing research at the University of Texas at Austin School of Information. I am observing the channel as part of a study on Ruby culture (IRB Study Number 2011-12-0078).
<dajmon>
I am not collecting any identifying information. Please feel free to message me if you are interested in participating in a short interview.
<dajmon>
You may contact James Howison, the Principal Investigator, via e-mail at jhowison@ischool.utexas.edu or phone at (512) 232-9219 with questions, comments, or suggestions.
WillMarshall has joined #ruby-lang
Heimidal has joined #ruby-lang
coreydaley has joined #ruby-lang
<rue>
Guys, initiate protocol 5
<deryl>
initialize(6-1)
<erikh>
some one set us up the survey
<deryl>
all your surveys are belong to us
postmodern has joined #ruby-lang
leonL has joined #ruby-lang
twittard has joined #ruby-lang
jfelchner has joined #ruby-lang
headius has joined #ruby-lang
Nowaker has joined #ruby-lang
rohit has joined #ruby-lang
gentz has joined #ruby-lang
<dajmon>
no need for protocol 5
<lake>
i would like to create some code with ruby to determine whether a given image of a head was bald or not. i was considering a naive bayes classification. would some other algorithm be better suited?
<lianj>
lake: hehe, what a usecase
<lake>
just for kicks
<lake>
and learning of course!
takaokouji has joined #ruby-lang
rippa has joined #ruby-lang
gentz has joined #ruby-lang
srbaker has joined #ruby-lang
ryanf has joined #ruby-lang
brianpWins has joined #ruby-lang
QoQOoO has joined #ruby-lang
ryanf has joined #ruby-lang
dkubb has joined #ruby-lang
dkubb has quit [#ruby-lang]
khaase has joined #ruby-lang
igotnolegs has joined #ruby-lang
slimfit has joined #ruby-lang
twelvechairs has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
savage- has joined #ruby-lang
jmontross has quit [#ruby-lang]
rohit has joined #ruby-lang
takaokouji has joined #ruby-lang
macmartine_ has joined #ruby-lang
JohnBat26 has joined #ruby-lang
ilyam has joined #ruby-lang
<zenspider>
sexp_processor 3.1.0, minitest 2.11.3, hoe 2.15.0 released today
<erikh>
busy boy
x0F_ has joined #ruby-lang
havenn has joined #ruby-lang
kitallis has joined #ruby-lang
twittard has joined #ruby-lang
BadQuanta has joined #ruby-lang
QoQOoO has joined #ruby-lang
yxhuvud has joined #ruby-lang
havenn has joined #ruby-lang
rohit has joined #ruby-lang
ianm_ has joined #ruby-lang
<dominikh>
kith: got your problems sorted out?
QoQOoO has joined #ruby-lang
<kith>
yeah
<dominikh>
great
<kith>
:)
<kith>
cinch docs should perhaps be a little more clear
<dominikh>
kith: on what?
<kith>
on the prefix part
<dominikh>
heh, yeah
<ianm_>
any tips on what tech to use for adding a thread to a linux-only ruby C module?
<ianm_>
which library for threads/mutexes
|Vargas| has joined #ruby-lang
|Vargas| has joined #ruby-lang
mytrile has joined #ruby-lang
v0yager has joined #ruby-lang
dc5ala has joined #ruby-lang
QoQOoO has joined #ruby-lang
QoQOoO has quit [#ruby-lang]
takaokouji has joined #ruby-lang
achamian has joined #ruby-lang
<postmodern>
ianm_, definitely do not use 1.8.7
<ianm_>
postmodern: it needn't interact with ruby in the thread, only reading from a webcam
mytrile has joined #ruby-lang
<zenspider>
rawr
<zenspider>
anyone want some booze? I have plenty
v0yager has joined #ruby-lang
<kith>
dominikh: is it possible to make cinch reload plugins everytime its used?
<dominikh>
kith: the upcoming version does allow for unloading handlers, and by extension you can use the usual hacks to reload whole classes, but there is nothing built-in or documented on that yet as it's a work in progress
<kith>
i see
<kith>
would be convinient while writing plugins
<dominikh>
which version of cinch are you using?
toretore has joined #ruby-lang
<kith>
1.1.3
<dominikh>
okay
<kith>
so far very nice tho
<dominikh>
:)
<kith>
you're spoiling generations of nerds to come though... all writing their initiation bots with cinch :D
solars has joined #ruby-lang
<dominikh>
kith: to be honest I doubt it. a) blogs are the new hello world, not IRC bots :( b) the naive still write their own, buggy IRC libs
<kith>
*shrugs* been kidding ;)
<dominikh>
been hoping :P
<kith>
hehe
banistergalaxy has joined #ruby-lang
<kith>
now combine a peg parsing lib with cinch... could become interesting :D
<kith>
maybe i can make my cinch bot do math? :D
<dominikh>
just send your stuff through google or wolfram APIs :P
<kith>
hmmm
<kith>
geez
<kith>
google actually knows "square root 9"
<kith>
or 3 * pi
<dominikh>
sure
<zenspider>
it's had a built in calculator for a long time
<dominikh>
it also knows "3GB / 5 minutes in KBps"
<dominikh>
and most physical constants
<kith>
i thought it can only do simple computation
<kith>
like + - * /
mytrile has joined #ruby-lang
tjgillies has quit [#ruby-lang]
<banistergalaxy>
zenspider: sup spides
KU0N has joined #ruby-lang
ioga_wrk has joined #ruby-lang
achiu1 has joined #ruby-lang
frangiz has joined #ruby-lang
postmodern has joined #ruby-lang
tekin has joined #ruby-lang
<yorickpeterse>
Morning
srbaker has joined #ruby-lang
corundum has joined #ruby-lang
<TTilus>
kith: ive used google as currency converter for dunno-how-log
<dajmon>
I am a master’s student performing research at the University of Texas at Austin School of Information. I am observing the channel as part of a study on Ruby culture (IRB Study Number 2011-12-0078).
<dajmon>
I am not collecting any identifying information. Please feel free to message me if you are interested in participating in a short interview.
<dajmon>
You may contact James Howison, the Principal Investigator, via e-mail at jhowison@ischool.utexas.edu or phone at (512) 232-9219 with questions, comments, or suggestions.
<h4y4shi>
Where did you get your bachelors?
<h4y4shi>
I live in Texas UT is a nice school
jmeeuwen has joined #ruby-lang
rayners has joined #ruby-lang
<h4y4shi>
if you put an object in array, why does it have to be nested? I came to this conclusion by not being able to .concat an object into an array, I am only able to push an object into an array.
<cirwin>
h4y4shi: concat combines two arrays into one
<cirwin>
you want .push, or <<
<h4y4shi>
Doesnt push always nest though?
<cirwin>
no
<cirwin>
[1,2,3].push 4
<dominikh>
huh? an array is a collection of objects. how can an object be in an array without being in it?
<judofyr>
h4y4shi: an array is a list of values. push adds one object to the list. concat adds all the values in one array into the other array.
<h4y4shi>
so if I push an object to an array why is it always nested then?
<dominikh>
it's not...
erpuds has joined #ruby-lang
<cirwin>
h4y4shi: could you paste what you're seeing?
<dominikh>
[1,2,3].push(4) # => [1, 2, 3, 4]
<h4y4shi>
Okay I will
<judofyr>
h4y4shi: example of when it becomes nested? it's only nested if you push other arrays onto the array.
<h4y4shi>
grasses is an array, and GrassTile is a class
<dominikh>
and what makes you believe it's nested?
<h4y4shi>
dominikh: I have been trying to write some code that looks at every object in the array and if it is selected by my mouse it deletes itself. However it says the method to delete itself doesnt exist in the array. So I assumed that it was a nested array problem
SoftwarePatent has joined #ruby-lang
<dominikh>
so... you didn't understand arrays, nor nesting and assumed the latter is the cause of the former?
<darix>
dominikh: dont be so hard with him!
<cirwin>
h4y4shi: you should probably spend a bit of time in a REPL (like irb or pry), it makes it a lot easier to understand things by just playing with them
cyndis has joined #ruby-lang
<darix>
+1
<any-key>
REPLs are here to help!
<h4y4shi>
Thanks
shaman42 has joined #ruby-lang
BadQuanta has joined #ruby-lang
Heimidal has joined #ruby-lang
tenderlove has joined #ruby-lang
Sailias|work has joined #ruby-lang
andrewhl has joined #ruby-lang
flak has joined #ruby-lang
bagratte has joined #ruby-lang
rippa has joined #ruby-lang
apeiros_ has joined #ruby-lang
pogopolice has joined #ruby-lang
havenn has joined #ruby-lang
savage- has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
mssola has joined #ruby-lang
mssola has joined #ruby-lang
achamian has joined #ruby-lang
s_dana has joined #ruby-lang
mssola has joined #ruby-lang
dhruvasagar has joined #ruby-lang
<rue>
REPLs are here to read, evaluate, and print. In a loop.
jredville has joined #ruby-lang
<dajmon>
anyone interested in participating in a short interview at the minute?
brianpWins has quit [#ruby-lang]
<yorickpeterse>
dajmon: what kind of interview?
butchanton has joined #ruby-lang
<dajmon>
i'm doing a research study on programming culture and i'm hangin' out in here for a few months for some participant observation
<dajmon>
and conducting nonstructured interviews with whoever feels like taking part :)
<dajmon>
takes maybe half an hour of your time and i don't collect any personal information
<yorickpeterse>
Sure, by Email or privmsg?
<dajmon>
privmsg - one second, gotta take care of some things
<yorickpeterse>
sure
nesizer has joined #ruby-lang
<dajmon>
i gotta switch offices so i'll be back in a minute
ascarter has joined #ruby-lang
dajmon has joined #ruby-lang
savage- has joined #ruby-lang
justinxreese has joined #ruby-lang
gasbakid has joined #ruby-lang
jredville has joined #ruby-lang
pemeon has joined #ruby-lang
pemeon has quit [#ruby-lang]
gasbakid__ has joined #ruby-lang
srbaker has joined #ruby-lang
solars has joined #ruby-lang
skipper has joined #ruby-lang
h4y4shi has joined #ruby-lang
brianpWins has joined #ruby-lang
<h4y4shi>
How do I delete an object manually?
<apeiros_>
you can't delete objects
<apeiros_>
you can only stop referencing them
<h4y4shi>
sad day
<apeiros_>
happy day
<h4y4shi>
not for me
<apeiros_>
I wouldn't want encapsulation to be violated that badly
<apeiros_>
you're most likely doing it wrong then.
<yxhuvud>
well, unless he is writing a C extension
<h4y4shi>
hmm actually I just had an aha moment
<h4y4shi>
so I understand what you mean
<h4y4shi>
this is a good thing
<dominikh>
:D
wallerdev has joined #ruby-lang
<h4y4shi>
so .reject! just removes something from an array right?
m3nd3s has joined #ruby-lang
twittard has joined #ruby-lang
slimfit has joined #ruby-lang
<apeiros_>
if you call it on an array and if the block returns true for an element - yes
amerine has joined #ruby-lang
gasbakid has joined #ruby-lang
urbanmonk has joined #ruby-lang
Indian has joined #ruby-lang
srbaker has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
jredvill` has joined #ruby-lang
rob_ has joined #ruby-lang
<rob_>
hi hi
<rob_>
has anyone got any idea how to convert a day name into 3 letter name?
<rob_>
i got the name from Date::DAYNAMES[]
<whitequark>
rob_: name[0..3] ?
<whitequark>
er, 0..2.
<rob_>
i mean like sun, mon, tues, weds, thurs, fri, sat,
<rob_>
yeah that wont return 'thurs' for thursday though will it?
<yxhuvud>
thurs is not 3 letters.
<whitequark>
well, you have asked for 3 letter names
<whitequark>
"Thurs".length # => 5
<rob_>
18:38 rob_: i mean like sun, mon, tues, weds, thurs, fri, sat,
daglees has joined #ruby-lang
<rob_>
i corrected myself, sorry
<rob_>
i mean short names
<whitequark>
no default way, I think. Date::ABBR_DAYNAMES contain exactly 3 letter names
<rob_>
ahh ok, thanks
t has joined #ruby-lang
dajmon has quit [#ruby-lang]
<h4y4shi>
Is it possible to assign a method to an array?
ascarter has joined #ruby-lang
<dominikh>
"assign"?
alex_k has joined #ruby-lang
<h4y4shi>
Whenever I have objects I can write my own methods in the class. I was wondering if I could do the same thing for my arrays.
<outoftime>
h4y4shi: yes -- def my_array.your_method ... end
<outoftime>
h4y4shi: that's not a commonly-used pattern in ruby, though.
<Mon_Ouie>
There's most likely no reason you'd want to do that over your_method(array)
<outoftime>
or writing a class that encapsulates your array and defines the additional behavior you need
<h4y4shi>
okay thanks that sounds like a good idea
Tearan has joined #ruby-lang
ascarter has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
Heimidal has joined #ruby-lang
savage- has joined #ruby-lang
twittard_ has joined #ruby-lang
jredville has joined #ruby-lang
dave has joined #ruby-lang
Indian has quit [#ruby-lang]
<h4y4shi>
Is there a way to select every object inside an array?
<rippa>
select?
<h4y4shi>
I dont know how else to explain what I am trying to do.
<yxhuvud>
try. what are you trying to achieve?
slyphon has joined #ruby-lang
ascarter has joined #ruby-lang
<h4y4shi>
I have images representing every single object in my array, and I have a method written for each object called under_point? and it checks if it is being clicked on by the user. I want to pop off the object hat is under point.
<manveru>
h4y4shi: you want to remove it?
<h4y4shi>
yeah
<manveru>
arr.reject!{|o| o.under_point? }
<h4y4shi>
Thanks manveru I will try that.
amerine has joined #ruby-lang
savage- has joined #ruby-lang
Sailias|work has joined #ruby-lang
zmack has joined #ruby-lang
damien__ has joined #ruby-lang
<h4y4shi>
Im interested in extensions. Can you write a C++ extension or does it have to be written in c++
<h4y4shi>
I mean C*
Guest29433 has joined #ruby-lang
<Mon_Ouie>
You can use C++ too
mssola has joined #ruby-lang
<TTilus>
i know c, c++ and c#, byt whats c*
<Mon_Ouie>
As long as you properly export the entry point function
justinmcp has joined #ruby-lang
saLOUt_ has joined #ruby-lang
ilyam has joined #ruby-lang
jredvill` has joined #ruby-lang
bougyman has joined #ruby-lang
gix has joined #ruby-lang
SoftwarePatent has joined #ruby-lang
coreydaley has joined #ruby-lang
savage- has joined #ruby-lang
curtism has joined #ruby-lang
dv310p3r has joined #ruby-lang
virunga has joined #ruby-lang
<whitequark>
maybe anyone remembers my rant on skeuomorphs here?..
rolfb has joined #ruby-lang
JEG2 has joined #ruby-lang
futurechimp has joined #ruby-lang
sush24 has joined #ruby-lang
spap has joined #ruby-lang
twittard has joined #ruby-lang
<h4y4shi>
So if I do arr[1..-1] does that select everything in the array?
<Mon_Ouie>
No, arrays are 0-indexed
<Mon_Ouie>
(first index is 0, not 1)
SoftwarePatent has quit [#ruby-lang]
<h4y4shi>
So then would [0..-1] work/?
<Mon_Ouie>
But why would you do that?
<Mon_Ouie>
If you want to copy the array, use #dup
<h4y4shi>
I want to test if anything in the array is being clicked on by the user.
eggman2001 has joined #ruby-lang
<ben>
arr is already everything in arr
<h4y4shi>
but I cant use the method I made called under_point?
<h4y4shi>
I ddint really make it
<h4y4shi>
but I cant use it.
<eggman2001>
if I'm updating a large number of records (~500k) by iterating over them, is there a ruby way of making this go faster? would threading work in a case like this?
<outoftime>
eggman2001: are you performing the same update to each one?
Swimming_Bird has joined #ruby-lang
<eggman2001>
outoftime: no I'm not
<outoftime>
eggman2001: okay. what kind of process is this running in?
<eggman2001>
it's in the rails console, which I'm using pry for
<outoftime>
and you intend to continue doing it that way?
<outoftime>
or this is just a one-off?
<apeiros_>
eggman2001: avoid AR to speed it up
<apeiros_>
ie go directly through the database adapter, plain sql
<outoftime>
+1 apeiros_
<apeiros_>
even better if you can do an update with where to perform the same update on multiple rows
<eggman2001>
eventually, I'll use rake. not a one off
<outoftime>
so I usually go with multi-process rather than multi-threading approaches, as thread-safety is often not a high priority for ruby library developers
<eggman2001>
apeiros_: that's provided I'm doing the same update, which I'm not in this case
<apeiros_>
eggman2001: only the second part
<apeiros_>
the first part (plain-sql/directly on adapter level) can be done on individual records just fine
klarrimore_ has joined #ruby-lang
<apeiros_>
eggman2001: anyway, the less you tell us, the less we can help.
<apeiros_>
and I'd assume that there is *some* logic in it, when you update that many records.
<apeiros_>
also, depending on your db, make all updates a single commit, instead each a separate commit
<eggman2001>
basically, I'm using AR and iterating over rows. For each row, I'm performing a calculation and then updating the row attributes based on the calculation. and yes, there is some logic
<eggman2001>
and i'm using postgresql
<apeiros_>
eggman2001: is the calculation based on data coming from that row?
<apeiros_>
or rather: from data coming from the db?
<eggman2001>
apeiros_: yes it is
<eggman2001>
it's coming from that row
<apeiros_>
so much for "can't do with a single query"
<outoftime>
heh
<apeiros_>
that sounds very much like you could do it with a single query :-p
Indian has joined #ruby-lang
<outoftime>
geez apeiros_, this is #ruby-lang not #sql-lang. can't we just solve the problem with metaprogramming or something?
<eggman2001>
not sure what you mean by a single query. can you give me an example?
<outoftime>
eggman2001: can't really give you an example unless you can be more specific about what you're trying to do
<eggman2001>
do you mean a single sql query?
<outoftime>
yes
<apeiros_>
yes. meaning everything is performed by the db alone. it can do that in a couple of seconds, if not milliseconds.
<apeiros_>
outoftime: how about adding a function to postgres which is implemented in ruby?
<apeiros_>
(you can do that with sqlite & oracle, so I'd bet you can do with postgres too…)
<outoftime>
apeiros_: yes! now you're talking.
<apeiros_>
we used that to have greatest & nvl in sqlite :)
<outoftime>
i didn't realize that was possible -- pretty nifty
<apeiros_>
(I know you can rewrite nvl with coalesce - it was for a couple of things that didn't come from us)
<outoftime>
what sort of bindings to ruby do you need?
<apeiros_>
ruby-sqlite3
<apeiros_>
or is it sqlite3-ruby?
<apeiros_>
anyway, the common one
<outoftime>
you mean the gem?
<apeiros_>
for oracle, it'd be oci8, I don't think there's any other
<bradland>
eggman2001: many SQL servers have a robust set of functionality available as part of the SQL language. it is not uncommon to perform calculations as part of the query, as the database server may be more efficient at performing the operations than pulling the data in to your script and doing it there.
<apeiros_>
outoftime: yupp
<outoftime>
ah i wasn't asking about the client library -- what does it take to get sqlite3 to run ruby code?
<outoftime>
(for your custom function)
CodyD has joined #ruby-lang
<apeiros_>
it was something like define_function.
<apeiros_>
wait, I might have a snippet on this computer too…
<outoftime>
and sqlite3 has a ruby interpreter built in? or some sort of language bridge?
<apeiros_>
callback
<apeiros_>
so it's kind of bridging
<outoftime>
so sqlite3 sends the data to evaluate back to the client?
cjs226 has joined #ruby-lang
<outoftime>
sorry if i'm totally not getting it : )
<outoftime>
eggman2001: yeah, three update statements
<bradland>
eggman2001: what is the database server? MySQL?
<outoftime>
eggman2001: or maybe an update and some deletes. didn't see the monthly_data collection there. that makes it more complicated.
<eggman2001>
postgresql
<outoftime>
what's up with the throw/catch? that seems entirely superfluous...
<apeiros_>
eggman2001: postgresql even has plsql built-in, you can do pretty much everything.
<eggman2001>
outoftime: yeah, you're right
<bradland>
yea that to what apeiros_ said
havenn has joined #ruby-lang
<eggman2001>
apeiros_: thanks. I'll look into it
<bradland>
the question is whether you want to. what's the goal here, to increase performance?
CoverSlide has joined #ruby-lang
<bradland>
if you're not familiar with SQL, there's a good chance you'll shoot yourself in the foot (write something that performs poorly)
<eggman2001>
I'd like to increase performance in general for these types of operations
<eggman2001>
and i'm not familiar with sql
<bradland>
a quick performance win would be to run the app on the latest version of ruby, as the date operations are VASTLY improved in newer 1.9 releases
lbrent has joined #ruby-lang
Nisstyre has joined #ruby-lang
<bradland>
what version of ruby are you running?
<outoftime>
I'd say a good first step would be to rewrite it using basic SQL selects and updates, not any sort of fancy bulk update
<eggman2001>
1.9.2p290
<outoftime>
just getting AR out of the picture would be a huge improvement, no doubt.
<bradland>
how big is the price_data data set?
<eggman2001>
it's around 750,000
vpamulap has joined #ruby-lang
<vpamulap>
What is the best ruby webframework / server to write a quick long-polling demo
<bradland>
eggman2001: ok, so first thing i'd do is try to move to 1.9.3 for the date performance bump. because you're calling to_date on that row data, you'll likely see a big bump just from that.
<bradland>
eggman2001: also, you could memoize this call monthly_data.first.call_date
<bradland>
eggman2001: also, when using gist, name ruby files with .rb so we get syntax highlighting :) makes it easier on the eyes
headius has joined #ruby-lang
<eggman2001>
bradland: all great suggestions. thanks!
<bradland>
eggman2001: looks like telecom work. i do a lot of the same :)
Nisstyre has joined #ruby-lang
<eggman2001>
bradland: actually stock data. a bit of a hobby of mine
<bradland>
not sure if you've used CDRTool, but I wrote this to take an export of CDRs and build a time series list of concurrency for that time period. https://gist.github.com/1706903
<bradland>
ah, ok
<eggman2001>
I'll take a look at it :-) though it'll probably go over my head
ivanoats has joined #ruby-lang
davidw has joined #ruby-lang
Swimming_Bird has joined #ruby-lang
retro|cz has joined #ruby-lang
malev_ has joined #ruby-lang
brushbox has joined #ruby-lang
<jaimef>
can a rake default task be setup to provide --tasks output?
<bradland>
sounds recursive. brace for impact!
tenderlove has joined #ruby-lang
gregf has joined #ruby-lang
davidw has joined #ruby-lang
tenderlove has joined #ruby-lang
krzyhoo has joined #ruby-lang
jredville has joined #ruby-lang
<bradland>
jaimef: this is ugly, but if you just 'puts `rake --tasks`' within your default task, it works
<krzyhoo>
hey guys. i have a simple question. If I decide to save my classes, topic-wise, in a separate file, which I later include in my script using require, how to i refer to this file (what"s the proper nomenclature?)
<krzyhoo>
is it a gem?
<shevy>
krzyhoo not sure I understand this
<shevy>
no
<shevy>
a gem usually bundles together many files in one .gem "file", which is more or less an archive
<krzyhoo>
shevy: ok
<shevy>
you can distribute such a project without using gem as well
<shevy>
usually these reside under a lib/ directory
<krzyhoo>
shevy: wow you just read mz mind
<dominikh>
kyrylo: then call it Bob if you want to, doesn't change what it is though :P
<shevy>
most of the time these files are downcased, like "powercenter.rb"
<krzyhoo>
that is what i really wanted to ask :)
<krzyhoo>
shevy: appreciate it
<shevy>
and one convention is that the filename would equal to the class name used in that file (if you stick to the convention of one class per file)
<shevy>
for instance, world_domination.rb would equal to class WorldDomination
<krzyhoo>
shevy: is it a convention?
<shevy>
hmm
<dominikh>
yes.
<shevy>
dunno. it more seems to be the most often used case you'll see if you look at 100 different projects
<krzyhoo>
shevy: appreciate it a lot
<krzyhoo>
thanks
<shevy>
you can make people happy if you don't stick to it though :>
<krzyhoo>
just solved my existentional problems for today :)
<krzyhoo>
cheers
<shevy>
man that was fast
<shevy>
I struggle DAILY with my existentional problems :D
amerine has joined #ruby-lang
TOMMY-PENGAMEN has joined #ruby-lang
twittard has joined #ruby-lang
<savage->
apeiros_: are you around?
dave has joined #ruby-lang
Nisstyre has joined #ruby-lang
jmeeuwen has joined #ruby-lang
fayimora has joined #ruby-lang
<shevy>
oh
<shevy>
def test(*input = ARGV)
<shevy>
is not possible hmm
<Mon_Ouie>
input = ARGV if input.empty?
achiu has joined #ruby-lang
shtirlic has joined #ruby-lang
jmeeuwen has joined #ruby-lang
jredville has joined #ruby-lang
futurechimp has joined #ruby-lang
tenderlo_ has joined #ruby-lang
dr_bob has joined #ruby-lang
shtirlic has joined #ruby-lang
<zenspider>
grrr... I need someone to sanity check my atom feed on my blog. reeder doesn't have unique times on any of the entries and it is driving me nuts. the feeds validate fine :(
<erikh>
load it up in google reader?
<zenspider>
NNW seems happy with it
<zenspider>
reeder uses google reader... so idgi
<erikh>
oh, hrm
<erikh>
let me grab a reader
<manveru>
zenspider: which of the three feeds?
<manveru>
zenspider: you have a double http:// there
<zenspider>
any/all... should be roughly the same code with a minor tweak on what ...
<zenspider>
www shouldn't have a feed. I should nuke that entirely. sorry.
<manveru>
ohoh
<manveru>
i didn't find a link to blog. on zenspider.com
twittard has joined #ruby-lang
<manveru>
there it looks fine
<zenspider>
ok. www cleaned up
<zenspider>
that was dumb... sorry. the original idea was to launch and merge both www. and blog. and that was a logistic nightmare
<crankharder>
is there some ActiveModel based gem that uses redis as a backend?
<zenspider>
in the end I still did 900 redirects to fix MT url munging... so I guess I prolly could have just fine
JEG2 has joined #ruby-lang
spleeze has joined #ruby-lang
<apeiros_>
savage-: yes, what's up?
jasonw22 has joined #ruby-lang
<zenspider>
manveru/erikh: thanks for the help...
<savage->
apeiros_: sorry, I was running into a strange error when running ary.enum_for(:grep, /foo/).first
<savage->
apeiros_: but it looks like it only breaks when I require 'awesome_print' :-/
<savage->
so all set!
<apeiros_>
feed a banana to the monkey…
<apeiros_>
(monkey-patch)
<apeiros_>
out of curiousity, what was the error?
aroop has joined #ruby-lang
Swimming_Bird has joined #ruby-lang
blarghl has joined #ruby-lang
<blarghl>
hey all. how do i parse a time interval and add it to other time intervals? i have things like 00:03:12.42 (3 mins, 12 seconds, 42ms), and i'd like to add that to some other time interval and display how much time has elapsed in total
<blarghl>
where by 'things like' i mean 'strings like', to be precise.
Sailias|work has joined #ruby-lang
<outoftime>
blarghl: strptime
<outoftime>
blarghl: and +
<blarghl>
outoftime: that creates a date object. what i'm doing has nothing at all to do with dates, though.
<zenspider>
ok... very odd. google reader shows the same timestamps as reeder... I think this is a problem with the service, not the app :(
<outoftime>
blarghl: ok, yeah, strptime's behavior isn't very helpful there
<outoftime>
blarghl: your good friend mr. regexp is probably your best bet.
<zenspider>
blarghl: you want a function that takes the string and returns an int, and another that takes an int and returns the string
<zenspider>
I have the latter... sec
<blarghl>
zenspider: int? as in interval, not integer i assume?
<zenspider>
integer
<blarghl>
zenspider: hm yeah. convert to ms and back i guess.
<zenspider>
.42 is 420 ms btw
<blarghl>
zenspider: yes it is indeed. sorry :)
<zenspider>
time = []
<zenspider>
[ 86400, 3600, 60, 1 ].inject(seconds) { |sec,seg| time << sec / seg; sec % seg }
<zenspider>
time.shift while time.first == 0
<zenspider>
time.reverse.zip(%w(s m h d)).reverse.join
<blarghl>
zenspider: hm, thanks. let me play with that.
WillMarshall has joined #ruby-lang
Teddy2steper has joined #ruby-lang
Indian has joined #ruby-lang
<h4y4shi>
Does anyone know of an example of a array having a method?
<apeiros_>
ri Array
<apeiros_>
it has something over 100 methods…
<apeiros_>
ary.shift, ary.pop, ary.push(val), …
<h4y4shi>
I custom method I mean, I want to see an example of someone creating an array and then writing an array. I couldnt find an example of this
<h4y4shi>
A*
jredville has joined #ruby-lang
willdrew_ has joined #ruby-lang
<outoftime>
h4y4shi: I think you're confused. Array is just a class, like any other class. the Array class defines methods. arrays are objects of the Array class, which respond to the methods that the Array class defines.
<outoftime>
h4y4shi: there is no such thing as "writing an array" in the sense of "writing a class".
<h4y4shi>
So there is no way I can write a method for an array?
<h4y4shi>
sorry I am pretty slow today I have been trying to find a way to solve this problem ive been having all day and I am having trouble comprehending what you said. But I get it now lol.
<outoftime>
h4y4shi: maybe if you can explain the specific problem I can suggest something?
<outoftime>
h4y4shi: it is possible to extend the Array class with extra methods, or even extend individual array objects with extra methods. this isn't unique to Array; you can do this with any class or object. but this is almost certainly not the best approach to your problem.
<outoftime>
h4y4shi: i'm sorry -- I actually have to go right now. hopefully someone else can help
<h4y4shi>
Are you by any chance familiar with Gosu?
<h4y4shi>
I will try to find out how to extend classes with extra methods.
<h4y4shi>
Thanks.
whatasunnyday has joined #ruby-lang
<whatasunnyday>
Hi, while installing a gem, I get thrown this error: While executing gem ... (ArgumentError) invalid byte sequence in UTF-8. How do I go about troubleshooting this?
<whatasunnyday>
It doesn't return a line or where the issue is.
havenn has joined #ruby-lang
<whatasunnyday>
Well, it seems if I don't build and install the gem in the same line, I get no issue.
cjs226 has joined #ruby-lang
<whatasunnyday>
Thanks anywho.
eggman2001 has quit [#ruby-lang]
dv310p3r has joined #ruby-lang
achiu has joined #ruby-lang
<zenspider>
h4y4shi: 1) you're terrible at asking clear questions
benanne has joined #ruby-lang
<zenspider>
h4y4shi: 2) I _still_ think you don't understand OO and need to back up and work on fundamentals
shevy2 has joined #ruby-lang
<zenspider>
h4y4shi: 3) the url you provided doesn't clarify your question at all
Banistergalaxy has joined #ruby-lang
<h4y4shi>
So, you suggest I should put this on hold and learn the fundamentals?
jacobwg has joined #ruby-lang
<zenspider>
h4y4shi: I think learning how to drive a pinto before you get behind the wheel of a ferrari is a good idea