apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
burns180 has joined #ruby
bwlang has joined #ruby
Clordio_ has joined #ruby
SphericalCow has joined #ruby
SphericalCow has joined #ruby
swarley has joined #ruby
<sam113101>
how do I set cookies before getting something with Net::HTTP::get or get_response
<sam113101>
I can't find anything
seanstickle has joined #ruby
<swarley>
hai
<swarley>
i think im going to fork rdoc
<seanstickle>
YARD did that I think
<swarley>
i want to make it so you can do something like
<swarley>
and it will change the main text under the header
<swarley>
idk
<swarley>
maybe, maybe not
jcromartie has joined #ruby
bogwonch has joined #ruby
nikhgupta1 has joined #ruby
keymone has joined #ruby
ZachBeta_ has joined #ruby
shevy2 has joined #ruby
shadoi has joined #ruby
batmanian has joined #ruby
Soliah has joined #ruby
denysonique has joined #ruby
ZachBeta has joined #ruby
welterde has joined #ruby
CheeToS has joined #ruby
frishi has joined #ruby
Guedes has joined #ruby
Behi has joined #ruby
<swarley>
banisterfiend, anymore ideas as to what i should to now? :p
rohit has joined #ruby
Behi has joined #ruby
burns180_ has joined #ruby
Behi has joined #ruby
Beoran__ has joined #ruby
wroathe has joined #ruby
ben_alman has joined #ruby
fixl has joined #ruby
zigidias has joined #ruby
tommyvyo has joined #ruby
ZachBeta has joined #ruby
bugtranscriber has joined #ruby
brugtranscriber has quit [#ruby]
Cache_Money has joined #ruby
<otters>
does ruby have a lib for mouse control in OSX
philips has joined #ruby
stephenjudkins has joined #ruby
iamjarvo has joined #ruby
scholar01 has joined #ruby
<scholar01>
I'm a bit annoyed at building rubygems right now. I was using Jeweler with great success until recently, when I started running into all sorts of conflicts with rake and ruby versions. So, what should I be using to package gems, interface with github, and test my modules?
Azure has joined #ruby
banisterfiend has joined #ruby
liluo has joined #ruby
rohit__ has joined #ruby
rohit__ has quit [#ruby]
Azure has joined #ruby
Azure|dc has joined #ruby
fmcgeough_ has joined #ruby
ank_ has joined #ruby
_null has joined #ruby
dv310p3r has joined #ruby
stephenjudkins_ has joined #ruby
<sam113101>
is there an equivalent of http_build_query for ruby?
<pyreal>
scholar01: bundler
<pyreal>
i'll get you a link to a great series that takes you through it all
<pyreal>
scholar01: np.. i followed almost exactly the same steps writing my first gem lasts weekend.. only discovered the article after i had it written lol
<robert_>
hm.. anyone here have much experience with TCPServer?
radic_ has joined #ruby
<swarley>
robert_, i kind of do
<swarley>
depends on what you want done
<robert_>
I just rewrote a threading server I found online (under my own power) to a select() server and now it ain't accepting clients. it's just stuck at select()
<Dexx1_>
is this a typo in M. Hartl's RoR tutorial ? --> no_email_user.should_not be_valid
<sbussi>
hi, i need some help setting up rvm in ubuntu 10.04
jcromartie has joined #ruby
<swarley>
robert_, source please?
<robert_>
swarley: was actually in the process of doing that. :D
<banisterfiend>
swarley: congrats on the pull request!
<swarley>
robert_, eventmachine can make things more event based and i think its threaded
<swarley>
thanks :D
<swarley>
im going to work on the history writing
<robert_>
swarley: I see. :D
<swarley>
banisterfiend, what issues did pry-coolline have?
<swarley>
i prefer using TCPServer
<banisterfiend>
swarley: just that uparrow/downarrow didnt work
<swarley>
because i feel like i actually worked more to make it work
<swarley>
og
<swarley>
oh*
<swarley>
the history doesnt seem to be working for me
fbernier has joined #ruby
<swarley>
like, previous use history
<banisterfiend>
swarley: yeah pry-coolline probably needs to wire up old readline history to its own history
<banisterfiend>
i havent done that yet
<swarley>
well
<swarley>
i mean
<swarley>
i need to make it work
<swarley>
its not working for coolline period
<swarley>
so im going to look at it
<swarley>
should be an easy fix
<banisterfiend>
swarley: in what sense? that was the whole point of uparrow/downarrow i can access previous history *in the same session* using pry-coolline
<banisterfiend>
but i cant access history from the saved history file
<swarley>
yes
<swarley>
i can do history from the instance
<swarley>
but not over multiple uses
<banisterfiend>
Yeah, that's the job of pry-coolline i think
<banisterfiend>
not coolline itself
<swarley>
oh
<swarley>
i see
<swarley>
well then
<swarley>
nevermind
<swarley>
lol
<banisterfiend>
:)
<swarley>
banisterfiend, any more ideas i could work on?
<banisterfiend>
swarley: well you could make that search-method code an actual pull request on pry, put into the appropriate command set, formatted correctly (i fix your weird indentation! :)) and add support for searching code snippets too
<swarley>
oh, okay
<swarley>
i'll add support for looking through snippits
qos has joined #ruby
<banisterfiend>
swarley: Yeah, cool. Add C support for extra coollness :)
<banisterfiend>
I mean, let it search through C method source code
<swarley>
XD yeah i'll work on it
<swarley>
im not sure as to how to find the source code in the first place
<banisterfiend>
swarley: look at how show-method can access C source
<swarley>
lol
<banisterfiend>
for an idea of how to do it
<banisterfiend>
but it's not so important
<banisterfiend>
just focus on ruby stuff
<banisterfiend>
and ill add C support later on
<banisterfiend>
otherwise you might end up reinventing wheels :)
<swarley>
kk
<swarley>
banisterfiend, what file is show-method in?
<banisterfiend>
swarley: you can use: show-command show-method
looopy has joined #ruby
<banisterfiend>
swarley: show-command shows the source for a command
<banisterfiend>
swarley: if u want to jump to definition of show-method in an editor, then install the pry-developer_tools plugin
<banisterfiend>
and type: edit-command show-method
<basdfasdf>
swarley: also u can join #pry if u like
<Dexx1_>
basdfasdf: :( .. nothing yet. if you could peak at it it would be great. My guess is that its something small
wroathe has joined #ruby
alx- has joined #ruby
edogawaconan has joined #ruby
freeayu has joined #ruby
ZachBeta has joined #ruby
ZachBeta has joined #ruby
dfamorato has joined #ruby
mikeric has joined #ruby
tk___ has joined #ruby
davidcelis has joined #ruby
chimkan___ has joined #ruby
CheeToS has joined #ruby
dfamorato has joined #ruby
rippa has joined #ruby
SegFaultAX has joined #ruby
albemuth has joined #ruby
nari has joined #ruby
ZachBeta has joined #ruby
akemrir has joined #ruby
nfluxx has joined #ruby
rtdp has joined #ruby
rohit has joined #ruby
chimkan_ has joined #ruby
ringotwo has joined #ruby
burns180_ has joined #ruby
alek_b has joined #ruby
jehoshua02 has joined #ruby
jehoshua02 has quit [#ruby]
zealinux has joined #ruby
c0rn has joined #ruby
nikhgupta has joined #ruby
nikhgupta has joined #ruby
pu22l3r has joined #ruby
Banistergalaxy has joined #ruby
pu22l3r has joined #ruby
PaciFisT has joined #ruby
santos_jt has joined #ruby
looopy has joined #ruby
santos_jt has quit [#ruby]
<shevy2>
gah
<shevy2>
why is there no simple ruby GUI toolkit
hooper has joined #ruby
<basdfasdf>
shevy: why dont u like QT ?
<shevy>
qt is huge man
<shevy>
and qt4-qtruby-2.2.0 fails to compile for me too :(
blueadept has joined #ruby
blueadept has joined #ruby
<basdfasdf>
shevy: what GUI toolkit were you using before?
cobragoat_ has joined #ruby
j3r0m3 has joined #ruby
<basdfasdf>
i remember seeing some gui stuff u did
<shevy>
ruby-gtk
<basdfasdf>
shevy: why did u choose that shevy
<shevy>
but now with the new gtk versions, ruby-gtk chokes on what I have
<shevy>
it sucked less than the others, had better documentation
akemrir has joined #ruby
pdtpatr1ck has joined #ruby
JeremyEvans_ has joined #ruby
<JeremyEvans_>
Anyone having trouble updating ruby on rails to version 3.2.3? I'ved tried gem update rails and it's still showing rails -v 3.2.2 for some reason.
sirdeiu has joined #ruby
h4mz1d has joined #ruby
<akemrir>
Did you updated Gemfile?
<rohit>
!rubyonrails
<rohit>
!rails
artm has joined #ruby
<TTilus>
shevy: so ruby-gtk needs patches/pullrequests ;)
weirdpercent has joined #ruby
<basdfasdf>
TTilus: do u wrestle?
<basdfasdf>
TTilus: : do you wrestle?
<TTilus>
do i need to?
senthil has joined #ruby
* TTilus
prefers parkour
<weirdpercent>
hey guys, I have one long text file I want to split into many separate files. the separator between each file is a date in the format of January 1, 2012 and the EOF separator is "End of Session". Right now I'm just trying to match the month so I can recognize the date of the session, how do I do this with a regex?
<TTilus>
it helps when u wanna avoid wrestling
<TTilus>
weirdpercent: .scan might be your thing
LeNsTR|e has joined #ruby
<TTilus>
weirdpercent: with something like /^\w+ \d\d?, \d{4}/
krz has joined #ruby
<TTilus>
weirdpercent: mm, or just .each_line and a .match inside loop that controls a statemachine (within session or not)
<weirdpercent>
TTilus: thanks I will try that and see what happens
burns180 has joined #ruby
vandemar has joined #ruby
buschhardt has joined #ruby
Sgeo_ has joined #ruby
Rezwan has joined #ruby
Chryson has joined #ruby
greenarrow has joined #ruby
thatdudeguy has joined #ruby
<shevy>
TTilus well my C knowledge is basically 0 :(
x0F_ has joined #ruby
Notimik has joined #ruby
nopolitica has joined #ruby
jmfcool has joined #ruby
sako has joined #ruby
maletor has joined #ruby
<senthil>
you know what's wrong with most intro books? they don't teach you to use the debugger from page 1
<shevy>
or
<shevy>
these languages are too complex
<shevy>
then again, what belongs to a debugger? In Io you can introspect any method at run-time, would that not be debugging too?
jmfcool has joined #ruby
tommyvyo has joined #ruby
<senthil>
if you can stop each line and inspect vars, then yea
burns180 has joined #ruby
<shevy>
hmm not sure Io allows that
tommyvyo has joined #ruby
<senthil>
what exactly does "introspect" mean
maletor has joined #ruby
<TTilus>
repl should be on page one
<TTilus>
intercepting/introspecting runnin program (with whatever tools available) should be there, but maybe not on page one
<shevy>
(1) gather which objects you want to process (and which not) (2) pass these objects to a tiny method
ghostlin1s has quit [#ruby]
<dankest>
shevy: thanks. I like that latter solution
maletor has joined #ruby
<shevy>
the advantage of using methods is that you can build components of your code, and can re-use them (or change them) lateron very easily too
mfridh has joined #ruby
<shevy>
and code can evolve on its own that way. like, when you write a class and maintain this class over the years
nemesit has joined #ruby
h4mz1d has joined #ruby
maletor has joined #ruby
blacktulip has joined #ruby
apeiros_ has joined #ruby
freeayu_ has joined #ruby
ph^ has joined #ruby
hakunin has joined #ruby
hakunin has joined #ruby
qos_ has joined #ruby
falena has joined #ruby
savage- has joined #ruby
dyeske has joined #ruby
atani has joined #ruby
mikeric has joined #ruby
looopy has joined #ruby
<pcboy_>
Hi guys. I've an encoding problem. I'm unmarshalling objects saved with ruby 1.8 in a membase db. The strings seems to be in ASCII encoding. The truth is that it's UTF8 strings. I know that I can do a .force_encoding 'UTF-8', but I want a dry way to do that. I've tried Encoding.default_external = Encoding::UTF_8 and Encoding.default_internal = Encoding::UTF_8 that doesn't work. Why are my strings setted in ASCII and not UTF-8 by default?
<pcboy_>
It's the dalli gem who makes the Marshal.load().
<swarley>
did you try
<swarley>
# encoding: UTF-8
<swarley>
oh
<swarley>
uhh
<pcboy_>
Yeah I tried.
<apeiros_>
pcboy_: why don't you write a one-off script that converts all data in your membase db?
<pcboy_>
There is a fair amount of data. That more complicated than it seems.
sj26 has joined #ruby
<apeiros_>
fair amount of data just means that it'll take a while to run…
<swarley>
lol
<pcboy_>
The only way to do that correctly would be to first having the list of the keys. And I don't have these. You must use the TAP interface of membase to do that. If I can find a better way I would be happy.
somazero has joined #ruby
<pcboy_>
And btw my objects are complex. I don't want to do that on each of their attributes.
ringotwo has joined #ruby
prometheus has joined #ruby
Nss has joined #ruby
liluo has joined #ruby
jnraine has joined #ruby
batmanian has joined #ruby
<pcboy_>
There should be a way to do that. My strings shouldn't have .encoding because they are from 1.8, so the .encoding method is added. So there should be a way to force the encoding to utf-8.
<apeiros_>
it is more likely that if no encoding is stored in the serialization, marshal defaults to binary. it it's not unlikely, that there's no way to override that default.
KL-7 has joined #ruby
<apeiros_>
you can try adding a marshal_load method to String
<apeiros_>
beware, if it works, it'll most likely reduce performance a good bit
<pcboy_>
It's strange that there is no way to override that. The Encoding.default_internal/external should be used.
<apeiros_>
no, they shouldn't
justinmcp has joined #ruby
<pcboy_>
Why ?
<apeiros_>
marshal is a binary serialization. there's no point in applying encoding.
<pcboy_>
Mh, yeah, fair.
bjensen has joined #ruby
two- has joined #ruby
jonteru has joined #ruby
shruggar has joined #ruby
crodas has joined #ruby
sdeobald_ has joined #ruby
bier has joined #ruby
banisterfiend has joined #ruby
<banisterfiend>
artm: ping
<artm>
pong
twinturbo has joined #ruby
<banisterfiend>
artm: you were talking about ease of re-editing methods in a repl (irb or pry) and your frustration at having to re-type the method definition every time you wanted to change something?
<banisterfiend>
artm: in pry, you can just ytpe: edit-method method_name and it'll let you edit the current method as it is
<banisterfiend>
you dont have to retype the whole thing
<artm>
hang go /me 's going to try
* artm
's going to pry
<banisterfiend>
artm: you may have to properly configure your Pry.editor
<banisterfiend>
but it should work ok, if you're already in a *nix
<banisterfiend>
artm: this functionality only works in ruby 1.9+
<artm>
(in that window)
<banisterfiend>
artm: why are you still in 1.8 ? :)
<artm>
I see
<banisterfiend>
artm: yeah it's 1.9 only
<artm>
it's system ruby on my macbook
<shevy>
:)
<banisterfiend>
artm: btw unless you have good reason, you really shouldn't be using 1.8 :) (for the good that you unnecessarily miss out on a lot of cool 1.9 only stuff)
<banisterfiend>
artm: yeah, you should setup rvm, srsly
<artm>
I use rbenv
<banisterfiend>
rbenv too, whichever
<banisterfiend>
but set your default to 1.9
<banisterfiend>
artm: anyway, let me know how you get on in 1.9
<artm>
it's just that my irc instance of pry was open with system ruby
<artm>
no, I will not default to non-system ruby
<banisterfiend>
artm: everyone else does :) System ruby is out of date :)
qos has joined #ruby
<banisterfiend>
artm: the only people i know who actually use the the version of ruby that comes bundled with macosx are noobs who just dont know any better yet
<artm>
not everyone else
<artm>
exactly, you're talking about my clients
<banisterfiend>
argh, poor you. oh well
<artm>
not really. i write simple things in system ruby, so that don't need to upgrade ruby for simple things
<artm>
for complex things I use 1.9 and ... I have no strategy for deploying it yet :)
<artm>
yep, edit method opens it in vim
<artm>
nice
<artm>
thanks
<banisterfiend>
np
ephemerian has joined #ruby
ephemerian has quit [#ruby]
qos has joined #ruby
rubicon917 has joined #ruby
atani has joined #ruby
krzkrzkrz has joined #ruby
basdfasdf has joined #ruby
davidpk has joined #ruby
williamcotton has joined #ruby
ewokchewy has joined #ruby
ewokchewy has quit [#ruby]
dv_ has joined #ruby
rohit has joined #ruby
wilmoore has joined #ruby
nikhgupta has joined #ruby
cha1tanya has joined #ruby
liluo has joined #ruby
basdfasdf has joined #ruby
thecreators has joined #ruby
rodayo has joined #ruby
<rodayo>
I'm using this: "lut = Hash.new { |h, i| h[i] = i.to_s(2) }" to generate a sequence of binary strings...how can I make the strings a fixed length of 8 bits? Right now they vary from 1 to 8 bits as I go from 0 to 255
<apeiros_>
use String#%
<apeiros_>
"%08b" % i
basdfasdf has joined #ruby
<rodayo>
apeiros, I haven't seen that before could you explain it?
Azure|netbook has joined #ruby
<apeiros_>
you know printf?
<rodayo>
yes
<apeiros_>
String#% is just sprintf
<apeiros_>
in a bit more OO fashion
pzol has joined #ruby
<rodayo>
In my case I tried "08b" % lut[2].to_i but it output "00001010"
basdfasdf has joined #ruby
<apeiros_>
…
<apeiros_>
I thought it was obvious what you should replace i.to_s(2) with "%08b" % i
<apeiros_>
there's a reason I used the same var-name as you…
d3c has joined #ruby
<rodayo>
apeiros_, my bad, thx
<apeiros_>
if your hash isn't sparse (i.e., all keys from 0 to 255 are present), then you should use an Array
atani has joined #ruby
<rodayo>
it's some performance critical thing....i'm just using this to generate a bunch of VHDL code that I'd rather not type out
<apeiros_>
array lookup by index is faster than hash lookup by key
liluo has joined #ruby
<rodayo>
*it's not
nikhgupta has joined #ruby
<apeiros_>
what makes you think it wasn't?
<apeiros_>
(because you're provably wrong)
hiland has joined #ruby
<apeiros_>
you're probably thinking of finding a value in an array, which is O(n) and indeed slower than a key lookup in a hash
<apeiros_>
but accessing an array by index is O(1), same as a Hash, but with a lower k (it doesn't need to calculate a hash. index + address calculates the position of the item directly)
robotmay has joined #ruby
shruggar has quit [#ruby]
venkatk_ has joined #ruby
<rodayo>
apeiros, i know what hashes and arrays do...
<apeiros_>
then why do you think a hash lookup was faster than an array lookup?
<rodayo>
my point is it's a one time script and there's no need to optimize it
<rodayo>
apeiros_, i didn't...i just thought it up and used it
n1x has joined #ruby
<apeiros_>
errr, you just said "it's some performance critical thing" before…
<rodayo>
<rodayo> *it's not
<apeiros_>
well, whatever…
<apeiros_>
ah, the "it's not" was related to your own statement, not to mine about lookup performance. ok.
<rodayo>
hahaha sry about that
eldariof has joined #ruby
ikaros has joined #ruby
francisfish has joined #ruby
bluOxigen has joined #ruby
<apeiros_>
so, my mbench and pbench methods finally use cpu time instead of realtime
MrGando has joined #ruby
LowKey has joined #ruby
rtdp has joined #ruby
<rtdp>
count
d3vic3 has joined #ruby
nikhgupta has joined #ruby
mcwise has joined #ruby
nikhgupta has joined #ruby
Guest83733 has joined #ruby
Foxandxss has joined #ruby
emmanuelux has joined #ruby
kirun has joined #ruby
buschhardt has joined #ruby
Houdini has joined #ruby
Trumma has joined #ruby
arvidkahl has joined #ruby
artm has joined #ruby
kaneda has joined #ruby
bjensen has joined #ruby
luckyruby has joined #ruby
kaneda__ has joined #ruby
kidoz has joined #ruby
waxjar has joined #ruby
becom33 has joined #ruby
scalebyte has joined #ruby
lottadot has joined #ruby
mrwalker has joined #ruby
pyreal has joined #ruby
rohit has joined #ruby
<pyreal>
I'm writing a class that has a .to_html method. I want to do a similar method that generates plain text. Is it canonical to use the to_s method for this or should I use the more explicit to_text? any opinions?
Natch| has joined #ruby
dbgster has joined #ruby
gtuckerkellogg has joined #ruby
mcwise has joined #ruby
mengu has joined #ruby
arvidkahl has joined #ruby
Morkel has joined #ruby
<pyreal>
I think i'll use .to_text (and the accompanying .custom_text), and then alias .to_s to .to_text
<pyreal>
too early on a Saturday morning for that much of a brain-twister :P
<scalebyte>
pyreal: but if you help me I will get myself a job :)
<canton7>
scalebyte, don't you think's it's, well, cheating, to ask for answers to job questions on here?
<pyreal>
heh and what will i get? a headache?
<canton7>
you told us these were homework questions the other day
<pyreal>
the job is helping the teacher clean the chalkboard? :P
<scalebyte>
canton7: Yes only if I do homework well will I get a job :)
<scalebyte>
pyreal: canton7 seriously send me the solution with your email ID and you guys could seriously stand a chance to win an Amazon Kindle fire !!
<scalebyte>
scalebyte: This is part of their talent hunt.. I will take the job and you guys can take home kindle :)
<canton7>
scalebyte, but you're not really demonstrating your talent, if you get us to do it :)
<scalebyte>
canton7: this is how you help humanity brother.. I will prepare for the interview.. my mother is poor and sick I need to support her and get a job fast
<canton7>
scalebyte, franky, I've worked alongside people who weren't competant enough for their role. I wouldn't wish that on anyone else. For the sake of your future co-workers, I'm not going to help
<scalebyte>
canton7: you never wanted to help :)
<scalebyte>
canton7: nobody wants to help me and my mother
<pyreal>
i have actual code to deliver and already have multiple kindles :P
<canton7>
yeah, the kindle fire's never tempted me. The e-ink ones, though, are gorgeous :P
<scalebyte>
canton7: pyreal :( :'(
jonteru has joined #ruby
<apeiros_>
scalebyte: stop playing on the heart strings
<scalebyte>
apeiros_: you are blessed amen :)
<apeiros_>
scalebyte: you mistake "help" and "doing your work". we do help. we do *not* do your work.
arvidkahl has joined #ruby
<scalebyte>
apeiros_ : That's a sad thing
<apeiros_>
and if you keep asking like that, I'll kickban you.
<apeiros_>
scalebyte: work on the problem, try to solve it yourself, and if you have a specific question, ask. but stop asking people to do the work for you.
<scalebyte>
apeiros_: the think is I have 5 challenges and just 1 hour and 48 minutes left to complete all.. I cant finish that in this time.. I need help thats why I am asking for help.. unlike your misconception that I am lazy.. Your Honour
<canton7>
scalebyte, the majority of that question isn't ruby-specific at all -- it's sorting out the algorithm. This channel's name is #ruby -- this is a hint to which bit we'll help out with
<scalebyte>
canton7: I need to write the program in any language.. ruby is also allowed
<apeiros_>
scalebyte: again, you weren't asking for help, you were asking for people to do it for you. and you running out of time is not our problem.
<scalebyte>
apeiros_: agree ...
buschhardt has joined #ruby
<apeiros_>
with N = 10, there's 4**9 permutations for the operators, sadly with the parens, that gets increased quite a bit
<apeiros_>
the operator permutation part is probably not too difficult, but the parens make it somewhat difficult
<scalebyte>
apeiros_: hmmm
<scalebyte>
apeiros_: finding it damn tough
atmosx has joined #ruby
<canton7>
would postfix notation help? I'm thinking it might allow you to avoid the brackets
<Tasser>
apeiros_, gimme op and I'll fix that for you ;-)
<apeiros_>
Tasser: ?
kidoz has joined #ruby
<apeiros_>
canton7: don't have experience with postfix notation :-/ might be that a different way to present the problem makes the solution more obvious
<apeiros_>
Tasser: I'm not ready to kickban him yet. I do believe him that he genuinely seeks help.
goganchic has joined #ruby
<Tasser>
aww :-(
<scalebyte>
Tasser: apeiros_ is my friend we know each other for quite some time now.. He is not that bad at heart to ban me all right !!
<apeiros_>
scalebyte: I'm sorry, but I don't think we're friends
<apeiros_>
(tasser otoh is a friend of mine)
<scalebyte>
apeiros_: we are aquaintances
<apeiros_>
which I still owe a visit :)
<apeiros_>
acquaintance is acceptable
etehtsea has joined #ruby
<apeiros_>
scalebyte: given that it seems that you can't solve many of those questions by yourself - aren't you aiming a bit too high?
schovi has joined #ruby
<scalebyte>
apeiros_: not really its too high with the given time.. i work hard.. got award last year for my work on semantic analysis and web apps on RoR.. I am not as bad as you think :)
chimkan has joined #ruby
<apeiros_>
ah, hm, instead of thinking in parens, just think in precedence
<apeiros_>
there's 9! possible orders of execution with 9 operators
<Tasser>
how do I take one element from an interator? #first doesn't seem to remove it
<apeiros_>
so we have 4**(N-1) * 9! possible calculations with N digits
<apeiros_>
and a naive solution to that isn't that hard
<apeiros_>
Tasser: drop
<apeiros_>
but I think that returns an array (which is a shame)
<Tasser>
which kinda sucks, because I've got ary.cycle
<apeiros_>
I've a reimplementation of drop lying around, which returns an enumerator again
<apeiros_>
and of course I didn't file it correctly… gah
<Tasser>
crap, that crashed my machine
<Mon_Ouie>
Wouldn't it rather be Enumerator#next that you're looking for?
<Tasser>
likely
<apeiros_>
oh, right, that exists too…
<Tasser>
but I need to wait until oom_killer sets in :-(
<Tasser>
indeed
<apeiros_>
hrm, 95_126_814_720 is quite a lot possible permutations, ruby won't be fast enough for inputs with N = 10
<shevy>
I know that this is neither a Hash nor an Array
<shevy>
also the two classes are the same, if you load the second file, I think it will overrule what is written in the first file (in regards to class Test)
<shevy>
if you want persistent variables in classes, make them instance variables like @foo
<shevy>
detail = {
<shevy>
to
<shevy>
@detail = {
dbgster has joined #ruby
basdfasdf has joined #ruby
td123 has joined #ruby
rtdp has joined #ruby
<becom33>
shevy: I'll tell you the base Idea , yes two classes are the same . that the way it has to be . I want the hash vlaues in the those two classes to come to the emtpy arrays in the Read the class
<shevy>
your base idea will be better when your implementation detail is correct. right now that is not even ruby code
<shevy>
it's really easier to build slowly what you need and proceed from there, solving one problem at a time
<becom33>
ok I'll ask you one by one. gimme a idea I'll code n you can tell me weda Im doing that correctly
<shevy>
and for instance, you write:
<shevy>
"detail = () # i want to have the above files details hash 'detail' key value in this detail array"
<shevy>
but that is neither valid ruby syntax, nor could you use an array like a hash in ruby
sepp2k has joined #ruby
<shevy>
and then you also use things like:
<shevy>
#include Notifier
<shevy>
if this is not important for the problem you solve, it is better to omit this entirely
fr0gprince_mac has joined #ruby
<becom33>
ok firstly I have few ruby files in a folder , all the classes in the files are the same except the details inside the class .
<becom33>
the problem I have is I need to write a another classes to go to that folder read those all files
<becom33>
then add those details into defferent defferent arrays
<shevy>
I am quite sure your problem is easy, but I still did not understand it, sorry
<becom33>
shevy: did u underatnd what I said before
<shevy>
no :(
<becom33>
above ?
<becom33>
ok
<becom33>
umm
ryanRT has joined #ruby
<shevy>
The only thing I understand is that you have two different .rb files with both having one class defined, class Test
<becom33>
I have two folders named 'rubyone' 'rubytwo' ok ?
<shevy>
directories
<shevy>
ok so you have:
<becom33>
yes
<shevy>
rubyone/
<becom33>
sorry
<shevy>
rubytwo/
<shevy>
so far I understand
wilmoore has joined #ruby
<shevy>
continue :)
<becom33>
and I have files with the same class and same stucture
<shevy>
in those directories?
<shevy>
rubyone/file1.rb
<becom33>
but the details in those files are deffrent
<becom33>
yes
<shevy>
rubytwo/file2.rb
<shevy>
ok
<shevy>
hmm what details
<shevy>
only in "def initialize" ?
<becom33>
shevy: in the paste I showed u before
<becom33>
yes only in def initialize
<shevy>
well that paste is odd
<shevy>
you pass an argument called "com"
<shevy>
but you never use it
buschhardt has joined #ruby
<shevy>
ok, so we have ... rubyone/file1.rb and rubytwo/file2.rb with class Test. both files have another def initialize way
<becom33>
class names are the samet too
<shevy>
actually, my first question:
<shevy>
Why dont you use the same class?
<shevy>
because both seem to be initialized via a hash anyway
<becom33>
I do use the same class
<shevy>
so the only thing you would have to do is pass the correct information to def initialize
<becom33>
shevy: im sorry I dont undertand .
<shevy>
you write the class Test twice
<shevy>
I dont understand why you must do this
<shevy>
the only thing that differs is the data you pass
<becom33>
yes
<shevy>
hmm a moment
<becom33>
and I have file called read.rb in the root directry of this two /rubyone /rubytwo
<shevy>
it's not good to do this manually, usually
<becom33>
aww like that
<shevy>
read.fileread <-- this is not needed, unless you want to pass some different base directory to read from
<shevy>
like...
<shevy>
read.fileread('/tmp/bla/')
<shevy>
which could designate another base directory you want to read from
<shevy>
but you see, you can tie all the logic you need into your class, right?
<shevy>
I have to go afk for ~20 minutes, sorry, need to prepare something for university
<becom33>
yes I guess :/
arturaz has joined #ruby
n3m has joined #ruby
<becom33>
ok have a good day . plase lemme know when u come back
havenn has joined #ruby
ginsun has joined #ruby
maletor has joined #ruby
senthil has joined #ruby
senthil has quit [#ruby]
senthil has joined #ruby
PragCypher has joined #ruby
kevinbond has joined #ruby
Drewch has joined #ruby
iamjarvo has joined #ruby
kaneda__ has joined #ruby
LBRapid has joined #ruby
tobago has joined #ruby
BigJasonWebb has joined #ruby
maletor has joined #ruby
vju has joined #ruby
kaneda has joined #ruby
CheeToS has joined #ruby
ZachBeta has joined #ruby
savage- has joined #ruby
sdwrage has joined #ruby
blueadept has joined #ruby
s0ber has joined #ruby
y3llow has joined #ruby
zakwilson_ has joined #ruby
Deesl has joined #ruby
_ack has joined #ruby
seanstickle has quit [#ruby]
ZachBeta has joined #ruby
wracoon has joined #ruby
jarred has joined #ruby
fayimora has joined #ruby
ananthakumaran has joined #ruby
artm has joined #ruby
Drewch has joined #ruby
cha1tanya has joined #ruby
pdtpatr1ck has joined #ruby
shruggar has joined #ruby
sdwrage has joined #ruby
nytfox has joined #ruby
<becom33>
shevy: :)
fully_human has joined #ruby
Guest35671 has joined #ruby
jnraine has joined #ruby
jnraine has quit [#ruby]
havenn has joined #ruby
NeV3rKilL has joined #ruby
wallerdev has joined #ruby
rpgsimmaster has joined #ruby
adamkittelson has joined #ruby
sand1 has joined #ruby
mbriggs has joined #ruby
<fully_human>
Hello. I'm trying to install rvm. I get to the step "bash <(wget -qO- https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) stable" but I get an error saying "mkdir: cannot create directory `/usr/share/ruby-rvm': Permission denied" Anyone know what's wrong?
<shevy>
yo
kaneda__ has joined #ruby
<shevy>
becom33, I am googling "how to make a gem" again :D
wallerdev has joined #ruby
<shevy>
I tried 4 times before to make a gem, but the projects always were too complicated
sako has joined #ruby
<shevy>
I never figured out how to distribute yaml files with a gem so far
<mbriggs>
fully_human: did you put sudo in front of the command?
NeV3rKilL has joined #ruby
<mbriggs>
fully_human: it looks like its trying to run as root and do a system install
<fully_human>
mbriggs: No, because if I do I have a whole host of problems later on. Is it supposed to be run as root?
<mbriggs>
fully_human: not unless you are running it on a server
bayashi__ has quit ["Leaving..."]
<mbriggs>
fully_human: i would open a bug
<shevy>
fully_human well you lack permissions to open /usr/share/ruby-rvm I suppose. you can ask the #rvm guys too
<mbriggs>
fully_human: it looks like it thinks its running as root even though it isnt
sdwrage has joined #ruby
<fully_human>
I know what it means...I've been using LInux long enough to know about permissions. :)
<pyreal>
shevy: i used almost exactly the same process to build a gem last weekend.. only saw the article after i had it done, but it's almost step for step what i did
rpgsimmaster_ has joined #ruby
maletor has joined #ruby
sand1 has joined #ruby
io_syl has joined #ruby
wtfisgoingon has joined #ruby
davidpk has joined #ruby
<shevy>
hehe so you didnt build with bundler? :)
mikeycgto has joined #ruby
mikeycgto has joined #ruby
<becom33>
shevy: I was waiting till you come
<any-key>
that's what she said?
<shevy>
wat
<shevy>
you need to make your brain the best teacher
<shevy>
brain + practice
<any-key>
brainpractice is best practice
<pyreal>
shevy: yes i built with the rake tasks provided by the bundler bootstrap… releasing gem is as easy as rake release
<apeiros_>
that doesn't raise? I'd expect const_set to require 2 args…
<wroathe>
I'm just practicing theory right now. I'd never do this in practice.
<wroathe>
I haven't tested it
RBK_ has joined #ruby
friskd has joined #ruby
<wroathe>
Consider the above to be pseudocde
<wroathe>
pseucode
<apeiros_>
wroathe: erm, yeah, no. won't work.
<wroathe>
pseudocode*
<apeiros_>
you have to set the constant to a value.
<apeiros_>
and since it is a constant, it should be *the* value.
<apeiros_>
otherwise, *don't use a constant*.
<apeiros_>
(constant in ruby means that it will always reference the same object, technically this can be circumvented, but shouldn't. it doesn't mean that the object it references is immutable, though)
pyreal has joined #ruby
<wroathe>
In theory I was trying to initialize those constants and then loop through that array and initialize classes from those new constants
<wroathe>
But, again, that would defeat the purpose of constants.
<wroathe>
I'm moreso just messing around with irb right now.
<apeiros_>
you know that a class doesn't need to be referenced by a constant, right?
<wroathe>
Meaning?
<wroathe>
I thought a class with assigned to a specific constant at all times
<apeiros_>
my_classes = [Struct.new(:a, :b), Class.new, Class.new(Foo::Bar)] # <-- valid, the array contains 3 classes, none referenced by any constant
<wroathe>
Ahh
SphericalCow has joined #ruby
<wroathe>
apeiros_: Thanks :)
<apeiros_>
x = my_classes.first.new("value for a", "value for b")
<apeiros_>
classes are objects
<RBK_>
I am a beginner in ruby . i am using <%= error_messages_for(:album)%>
<RBK_>
but its giving error "undefined method `custom_error_messages"
<RBK_>
does this method exists in ruby ?
<wroathe>
RBK #ror
<senthil>
RBK_: that's rails helper method
<shevy>
RBK_ if it was defined somewhere
<apeiros_>
their only 2 specialities are: a) they can be instanciated, b) they can host/contain instance methods
<wroathe>
This is the ruby channel, you're looking for the #ror channel
waseem_ has joined #ruby
<senthil>
prob. ActionView
<RBK_>
ok
<wroathe>
Also, I don't believe you can reference AR objects in templates with symbols
<wroathe>
error_messages_for(@album) if you've got @album in your controller action somewhere
<wroathe>
Correct me if I'm wrong (not saying it's impossible, just that typically you use either local or instance variables)
<wroathe>
apeiros_: I think I knew that, I just keep on forgetting that technically everything in Ruby is an object
<apeiros_>
not everything. but almost.
<wroathe>
So in my mind I keep glorifying classes as something special
<apeiros_>
they are
<apeiros_>
I even specified their speciality ;-)
<apeiros_>
though, one of them they don't get from Class but from Module
<wroathe>
Technically you can instantiate an object with object.dup
ghanima has joined #ruby
<apeiros_>
that's not instanciation
<apeiros_>
the class of the duplicated object is the same as the originals
<apeiros_>
if it was instancation, then object.dup.class == object
dgynn has joined #ruby
<RBK_>
@ wroathe : its giving the same error .. using @album ..
<RBK_>
actually i want to use tht method for my database :album
<wroathe>
error_messages_for is expecting an active record object of some kind
<wroathe>
And from what I gathered you're trying to use it in a template
<wroathe>
So you need to have access to that specific object
waxjar has joined #ruby
Blaster has joined #ruby
<wroathe>
If you're trying to get access to that object's error messages you can do something like @object.errors.full_messages.each do |err|
yannis has joined #ruby
welliwanttobe has joined #ruby
nikhgupta has joined #ruby
<wroathe>
Also, error_messages_for is apparently deprecated in favor of that syntax I just used.
kesor_ has joined #ruby
<apeiros_>
also, this is still a rails topic in #ruby…
<wroathe>
true. I wanted him to leave but I settled for helping him :P
<wroathe>
Guess I shouldn't feed the troll
<apeiros_>
he's a troll? (I didn't follow the discussion)
<wroathe>
I was using it more metaphorically to say that I shouldn't feed into his questions as he'll keep coming back for more (much like I've been doing over the last half hour)
fubhy has quit [#ruby]
<shevy>
yah man hey
<shevy>
if you help em all here
<shevy>
they dont have an incentive to go to #rubyonrails :(
<shevy>
wroathe your punishment shall be YOU MUST FOLLOW #rubyonrails FOR TWO HOURS
cynthiak has joined #ruby
<wroathe>
That shouldn't be too difficult as #rubyonrails is basically an empty channel :) #ror is the one you're looking for.
yannis_ has joined #ruby
SphericalCow has joined #ruby
SphericalCow has joined #ruby
<cynthiak>
Hi, have a method that takes in a String Argument, however, just the first string it read by the method, the rest are ignored
<apeiros_>
if you try that method yourself in irb, you'll see that what you say ain't true
<wroathe>
Also, use << instead of +
<cynthiak>
Ok,let me try that
<shevy>
cynthiak what means "first string it read by the method"
<shevy>
what is the first string
<apeiros_>
it won't change anything. as said, what you experience doesn't happen in the code you pasted.
<cynthiak>
Still get's just the first String with <<
<wroathe>
I know it won't change anything
<wroathe>
That wasn't a fix
<wroathe>
It's an optimization
<wroathe>
+ instantiates a new string from the two
<apeiros_>
cynthiak: your terminology is wrong also, "This is title" is *one* string, there is no "first string" in that. you mean the first word of the string.
<fowl>
apeiros_ do you think that anybody whos ever came in here looking for rails help actually read the topic and go to #rubyonrails
stringoO has joined #ruby
<cynthiak>
yes, the first word in the String
<apeiros_>
fowl: we'll never no, since those never would have asked
<apeiros_>
never *know
<delinquentme>
getting the name of a file from within that file?
<apeiros_>
__FILE__
<apeiros_>
assuming you mean *ruby* file
<apeiros_>
but hey, nowadays, we don't have to be specific in our questions, for irc'ers can read yer mind!
<apeiros_>
the only value belonging to the attribute 'data-original-title' is 'this'. the rest are flags of their own.
<wroathe>
in this case <|> would just be [self, args.first][(rand * 2).to_i]
<apeiros_>
quote your attribute data.
<fowl>
wroathe if you poke around you'll find the 1.9 version
<fowl>
its on a branch of a fork or something
<wroathe>
Whoops, my math on that rand was an epic fail.
stephenjudkins has joined #ruby
h4mz1d has joined #ruby
bwlang has joined #ruby
<cynthiak>
apeiros_: Thanks, fixed it
zunnyohno has joined #ruby
<fayimora>
Do you guys think Ruby is easier to pick up compared to Python?
twinturbo has joined #ruby
<shevy>
fayimora depends
<shevy>
you can use only a small subset of ruby
<fayimora>
:(
<shevy>
then the answer would be yes
<shevy>
but I think ruby as a whole is more complex than python
kevinbond has joined #ruby
<fayimora>
Oh ok understandable
<shevy>
it's partly because of the philosphoy. there is more than one way to do it also includes creative thinking
kevinbond_ has joined #ruby
<Norrin>
for that reason, i think python vibes with my learning process better. i'll do whichever one gets me a higher salary though
<shevy>
hehe
<shevy>
enter the PHP
<Norrin>
because of rails, i'm basically looking into ruby. because rails seems so much more dominate than django
<arturaz>
i'd disagree
<arturaz>
as knowing both python and ruby
<arturaz>
i'd say that ruby just felt a lot more natural to me
<arturaz>
I usually could just write ruby code and it would work
<arturaz>
whereas with python I always had to consult with the docs
<CrazyPickles>
Ruby is just the coolest visual ever made in programming
<CrazyPickles>
ontop of the great little gems
<CrazyPickles>
I'm an addict an obession over languages like this
cobragoat has joined #ruby
wilmoore has joined #ruby
<shevy>
I cant stand some decisions in python
<shevy>
explicit self is one
<CrazyPickles>
Python is amazing <3
<CrazyPickles>
its like the snakest beast of programming I love python so much god I'm such a fan
<shevy>
you like every language anyway
<CrazyPickles>
I know lopl
<CrazyPickles>
I know*
<CrazyPickles>
I try to like every language as much as possible <3
<shevy>
I dont have a strong hate against requiring indent ... but from a purity point of view, I really dont think programming languages should care about indent at all. that a program refuses to run with the wrong indent, really sucks from this point of view
<apeiros_>
shevy: so you don't like haml?
<apeiros_>
or yaml?
<apeiros_>
s/or/and/
<shevy>
well I dont program in yaml
<shevy>
I already hate that wrong indents cause yaml to choke :(
<CrazyPickles>
what a stupid name for programming language tho
<CrazyPickles>
I think I don't like yaml
<shevy>
it is better than XML
<CrazyPickles>
maybe I like it more now lol
<CrazyPickles>
so what do you use to make guis in ruby shevy?
<CrazyPickles>
I use WxRuby
<wroathe>
Requiring indent is actually an amazing way to teach beginning programmers to respect whitespace.
<wroathe>
Honestly if I ever am in the position where I need to teach beginners my craft I'd use Python.
<CrazyPickles>
ahh I guess I would teach them the basic foundation of C++ then let them explore it
<shevy>
CrazyPickles, still mostly ruby-gtk
<CrazyPickles>
gtk you use linux <3
thone_ has joined #ruby
<CrazyPickles>
I'm on gayindows :P
<shevy>
wroathe, you dont think it feels dirty that a highly sophisticated language REQUIRES indent to make sense of itself?
<shevy>
CrazyPickles, but ruby-gtk works on windows too
<shevy>
I know because my ruby-gtk things work on windows
<shevy>
for the most part
<shevy>
windows sucks indeed
<CrazyPickles>
Oh :P I shall take alook then I love gui's
<shevy>
but it is not total suckage
<wroathe>
I have a variety of thoughts on this topic but my core thing is that first and foremost your role as an educator is to get people excited about this industry.
<CrazyPickles>
C++ is the biggest pain in the world to start on but thats what programming is at its core pain
<wroathe>
Sure. That lesson is valuable but in order of precedence I think getting excited should come before feeling pain.
<CrazyPickles>
I agree in some ways :)
<CrazyPickles>
is there a way to use win32 in ruby?
<wroathe>
Because feeling pain immediately will strip away all but the most dedicated (which can be good and bad)
<CrazyPickles>
but isn't that what the programming people want
<shevy>
wroathe hehe you are thinking tactically, I like that :D
<CrazyPickles>
people who are capable of going through the hardships of programming
<shevy>
yes
<shevy>
Java
<CrazyPickles>
I think boths sides win in some ways
<CrazyPickles>
its about balancing them both
<shevy>
wroathe, for me it was the matz philosophy that won me over
<wroathe>
But at the beginning of your programming career (or potential career) you and everyone else aren't in a position to decide whether or not you'll be a good programmer.
<CrazyPickles>
I dabbled in php and ruby then went into c++ personally
<wroathe>
So dragging them through an intense gauntlet is a good way to lose potentially GREAT programmers.
<CrazyPickles>
thats true in minors ways
<CrazyPickles>
minor*
<wroathe>
That will never ever return to the practice because of their first bad experience.
<wroathe>
SO your role as an educator should be, "HEY, look at how EXCITING this can be." before "HEY, lets talk about efficiency differences between compiled and interpreted languages"
<apeiros_>
ze funk!
<CrazyPickles>
hmm balance them both you win both ways :)
<wroathe>
Education is not really concurrent Crazy :)
<wroathe>
You have to learn a before you can get to b
<CrazyPickles>
then innovation must come ! :D
<shevy>
I think CrazyPickles is really crazy
<CrazyPickles>
I actually am lol apprently alot of people say I am ;(
wmoxam has joined #ruby
<shevy>
if we ever are in desperate war, we have to call him
<wroathe>
I like this guy. He's got a good stink eye.
<shevy>
it would be a win-win. it cant get worse, but it could get better :)
<wroathe>
We'll need that in a vicious cock fight
<shevy>
haha
<CrazyPickles>
I would sit there and talk it out then fight it out as much as possible who likes a fight really?
adamkittelson has joined #ruby
<wroathe>
shevy: What do you mean about the Matz philosophy?
artm has joined #ruby
<wroathe>
For me my learning path went C++ -> HTML/CSS -> Javascript -> PHP -> Python -> Ruby
banjara has joined #ruby
<wroathe>
I suspect it will eventually circle back into C++ someday.
cynthiak has quit [#ruby]
banjara has quit [#ruby]
<shevy>
wroathe, that a programming language should try to make programmers happy, and that happy programmers should try to make people happy
<shevy>
I never ever had this with i.e. Java or PHP
Foxandxss has joined #ruby
<wroathe>
The thing is that that doesn't have to just be a Ruby thing. You can teach C++ or Java in a fun way.
<wroathe>
And you can use either to make fun things.
<CrazyPickles>
trying to get another type of irc client this one sucks so many shades of leaf
<shevy>
wroathe, even the best teacher goes only so far to make up for deficiencies of any language
Imapickle has joined #ruby
<wroathe>
Well I think the best way to go about teaching advanced topics is to present the why and the how before the way.
<wroathe>
Get people excited about what it could be used for before diving into theory.
<wroathe>
before the what*
<wroathe>
now the way*
<wroathe>
not the way*
<wroathe>
wow I fail today
<wroathe>
on so many levels
dfamorato has joined #ruby
<CrazyPickles>
someone say something?
<CrazyPickles>
testing out irc client colours
<CrazyPickles>
ahh nvm fixed it :)
fbernier has joined #ruby
sdwrage_ has joined #ruby
dbgster has joined #ruby
<fowl>
wroathe did you check out superators
Chryson has joined #ruby
prometheus has joined #ruby
apok has joined #ruby
ph^ has joined #ruby
cloke has joined #ruby
lkba has joined #ruby
MrGando has joined #ruby
PragCypher has joined #ruby
n1x has joined #ruby
Foxandxss has joined #ruby
mdw has joined #ruby
delinquentme has joined #ruby
davidcelis has joined #ruby
forest| has joined #ruby
chessguy has joined #ruby
mythmon has joined #ruby
web0 has joined #ruby
mdw has joined #ruby
Sailias has joined #ruby
td123 has joined #ruby
<delinquentme>
what ruby tool can I use to check for headers from a webpage ? Im trying to verify that pages are XML formatted
wroathe has joined #ruby
forest| has joined #ruby
looopy has joined #ruby
<apeiros_>
net/http
jgrevich has joined #ruby
jgrevich has joined #ruby
xsdg has joined #ruby
jgrevich_ has joined #ruby
jgrevich_ has joined #ruby
bricker881 has joined #ruby
rdegraci has joined #ruby
rdegraci has quit [#ruby]
rushed has joined #ruby
srnty has joined #ruby
<delinquentme>
how does the &operation work in ruby?
<fowl>
delinquentme: do you know how to define a method that takes a block like def foo(a,b, &block) ?
<delinquentme>
... no .. but it looks like you just showed me? =]
<fowl>
thats only half of it tho
lewis1711 has joined #ruby
<delinquentme>
oh
<delinquentme>
nope .. this is a unary? operator?
<fowl>
when you call a method like fun_time &something ruby will expect `something` to be a proc/lambda
<fowl>
now, if it isn't a proc/lambda ruby will try to call #to_proc on it
<delinquentme>
and then test that all values are true
<delinquentme>
or !false
srnty has joined #ruby
<apeiros_>
all you need in the array is the year.
<fowl>
i hope that's not how you check for a match in nokogiri
<fowl>
if so thats some ugly stuff <_<
<apeiros_>
using `.class ==` is fail anyway
<apeiros_>
.is_a?
<delinquentme>
why is that?
<delinquentme>
i was trying out a few ways to test those
<delinquentme>
.is_a? is another option that i used elsewhere :D
<apeiros_>
or rather, .instance_of?, if you don't accept descendants as valid
kvirani has joined #ruby
Nisstyre has joined #ruby
<delinquentme>
soooo
<delinquentme>
the drying?
<apeiros_>
I think I told you?
<apeiros_>
not obvious enough?
<fowl>
here's a hint
<fowl>
nvm
<fowl>
im not giving out hints today
Faris has joined #ruby
pac1 has joined #ruby
<shevy>
lol
<apeiros_>
foul!
<fowl>
lol
cobragoat has joined #ruby
<fowl>
well..if it was me..since the only thing that changes in the 4 array items is the year, so i'd iterate on that with (2009..2012).map { build your expression here }
carlyle has joined #ruby
Vert has joined #ruby
<fowl>
but then you have to run 2011 twice and skip 2010 so its probably not worth it
forest| has joined #ruby
<delinquentme>
i like the ()
<delinquentme>
and map
iocor has joined #ruby
syamajala has joined #ruby
CheeToS has joined #ruby
syamajala has joined #ruby
startling has joined #ruby
* davidcelis
prepares himself for a murder most fowl
<wroathe>
I get it.
<apeiros_>
fowl: if 2010 really should be in twice, just use an array instead of a range
<apeiros_>
it's not like 4 4 digits ints would make for a huge array…
<fowl>
apeiros_ i was just saying that because of the first example
<apeiros_>
smaller than his current one anyway…
<fowl>
er his pastebin or whatever
<shevy>
is it size comparison time again
<apeiros_>
shevy: no, golf time
<apeiros_>
what's your handicap?
<shevy>
it's right in front of me
<davidcelis>
ಠ_ಠ
robotmay has joined #ruby
lewis1711 has quit [#ruby]
mikos has joined #ruby
startling has quit [#ruby]
<rTypo>
for a newbie, should i consider using Apache or Thin for a ruby web server?
<rTypo>
if this can/should be answered ~easily
<rTypo>
i'm starting a medium sized project while learning ruby. so only if the server matters
<davidcelis>
rTypo: I've had good luck with thin
<davidcelis>
rTypo: You might also want to check out puma
<rTypo>
great. it's nice to escape from apache a bit and learn some other server
fixl has joined #ruby
<rTypo>
should be a fairly scallable web application in the end
<apeiros_>
rTypo: thin works easily with a rackup file. apache is a bit more to configure, but still reasonably simple. depends a bit on your aims and requirements.
<apeiros_>
using rack, you don't have to care much for the webserver anyway. you can change it any time.
<rTypo>
that would be my purpose
<rTypo>
i have to focus on the app more
<apeiros_>
then use rack.
<davidcelis>
To be honest, I have no info on the scalability of thin or puma
<davidcelis>
I know that the more popular choices for production environments are apach2/passenger, or nginx/unicorn
<davidcelis>
I haven't really heard of a production Ruby web app using a standalone server rather than a wrapper/interface to a more established web server like apache or nginx
<apeiros_>
you can run your app on a wide range of servers with it
* apeiros_
uses a standalone drb server for some things
mcwise has joined #ruby
<apeiros_>
it's not exposed to heavy load, though. not yet at least.
<rTypo>
davidcelis: it's not for a production env, but for my faculty graduation
<rTypo>
so i'm more flexible with the choice'
<fowl>
use sinatra then
<rTypo>
fowl: i'm a bit scared of frameworks since i'm doing something a bit unusual, and i tried to learn RoR a few days
<fowl>
to hell with rails
<rTypo>
... and i failed to see how i'll use RoR and gave up (though i liked it)
<rTypo>
yeah, but i'm afraid to spend too much time on learning a framework. i'm a bit late already
Clordio_ has joined #ruby
<rTypo>
apeiros_: thanks, it seems like i'll use rack
sdwrage has joined #ruby
<apeiros_>
rTypo: you can pick up sinatra in a couple of minutes. at least the basics. rack is quite on the metal (easy to understand too, though)
<rTypo>
apeiros_: isn't it too hard to do something unconventional with a framework (esp. for a newbie)
<rTypo>
i mean, i have exp in learning languages, but not frameworks
<rTypo>
i can build an app with a new language
<apeiros_>
depends. but yes, that's possible.
<apeiros_>
on the metal, you can do about anything you want.
<rTypo>
i'll check sinatra too. i'll try it one day and see how it works
<rTypo>
but i still like to know everything underneath (college student, eh.. :D)
<apeiros_>
sure. rack is nice. and as said, easy enough.
<rTypo>
great
<rTypo>
this should be fun (that's why i picked ruby amongst other languages)
<rTypo>
having too much options (anything, really) was so stressful
<apeiros_>
I mean, the minimal rack app looks something like: proc { |env| [200, {"content-type" => "text/plain"}, ["Hello World!"]] }
<apeiros_>
meh, misses the run
<rTypo>
i'll go with rack for the server interface
<rTypo>
i'll also check sinatra tomorrow
<rTypo>
and start reading a ruby book
<gogiel>
anyone recommend good json serializator/builder?
<wroathe>
multi-json?
basdfasdf has joined #ruby
<rTypo>
apeiros_: sorry. now i've read again. picking up sinatra in minutes? hmm...
<rTypo>
then how is sinatra compared to rails?
<rTypo>
in terms of learning
<rTypo>
because rails seemd pretty complex for me to do crazy things with it (couple of days of learning)
mikeric has joined #ruby
<wroathe>
That would be a better question for #ror
<rTypo>
i'm trying to figure out if i have enough time to learn sinatra (~3 mo to finish the project)
<wroathe>
And I'm trying to direct you to #ror
<rTypo>
sorry, i was writing
<apeiros_>
rTypo: rails is largely opinionated software. i.e., it prescribes a set path. follow it and you gain a ton of tools and pre-done things
<rTypo>
wroathe: you're right. i'll ask them tomorrow after i check sinatra
<apeiros_>
it comes at the price of having to learn and understand that set path
<rTypo>
apeiros_: yes, i got that feeling too
<apeiros_>
sinatra has a very easy & quick start. it doesn't provide you with such richly pre-done things.
<apeiros_>
with it too, you'll have to work harder the further you deviate from the norm
<rTypo>
that's a risk to consider
<rTypo>
depends on my specific app from now on
<rTypo>
i'll check and see how it goes
<rTypo>
apeiros_: thanks for the help
<apeiros_>
I think you can hook a plain rack-app into a sinatra app
<apeiros_>
you can for sure hook a rack-app anywhere within your rack-app (sinatra is a rack-app)
<apeiros_>
so there's also always the option of doing some hybrid. sinatra for the easy, standard stuff, metal for the freaky non-standard things
d2dchat has joined #ruby
<rTypo>
that's nice! it alleviates the risk of stalling mid-way with sinatra
choffstein has joined #ruby
Banistergalaxy has joined #ruby
zunnyohno has joined #ruby
vitoravelino has joined #ruby
Faris1 has joined #ruby
JNZ has joined #ruby
wroathe has joined #ruby
<gogiel>
is it possible to see which method is exectued at runtime? i try to find which to_json method my application uses
<apeiros_>
method(:to_json)
<apeiros_>
in 1.9, Method has quite a couple of introspective methods in it (sadly no #source)
<apeiros_>
especially .owner and .source_location are of interest