yankeefan04 has quit [Remote host closed the connection]
sepp2k has quit [Remote host closed the connection]
jfredee has joined #ruby-lang
mossplix has quit [Read error: Connection reset by peer]
marr has quit [Read error: Connection reset by peer]
mossplix has joined #ruby-lang
mbj has joined #ruby-lang
mrfelix has quit [Quit: Computer has gone to sleep.]
idkazuma has quit [Remote host closed the connection]
idkazuma has joined #ruby-lang
r0bgleeson has joined #ruby-lang
idkazuma has quit [Remote host closed the connection]
krohrbaugh has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
mossplix has quit [Read error: Connection reset by peer]
krohrbaugh has quit [Ping timeout: 252 seconds]
brianpWins has joined #ruby-lang
tylersmith has joined #ruby-lang
mossplix has joined #ruby-lang
krohrbaugh has joined #ruby-lang
hramrach has quit [Ping timeout: 276 seconds]
hramrach has joined #ruby-lang
myappleguy has quit [Quit: Leaving.]
myappleguy has joined #ruby-lang
sailias has joined #ruby-lang
mossplix has quit [Read error: Connection reset by peer]
jfredee has quit [Remote host closed the connection]
dhruvasagar has joined #ruby-lang
Gaelan has quit [Remote host closed the connection]
aemeredith has joined #ruby-lang
Gaelan has joined #ruby-lang
tsion has joined #ruby-lang
tsion has quit [Changing host]
tsion has joined #ruby-lang
retro|cz has quit [Ping timeout: 245 seconds]
baba has joined #ruby-lang
Gaelan has quit [Remote host closed the connection]
security has quit [Ping timeout: 248 seconds]
Gaelan has joined #ruby-lang
krohrbaugh has quit [Quit: Leaving.]
brianpWins has quit [Quit: brianpWins]
krohrbaugh has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
tylersmith has quit [Quit: tylersmith]
krohrbaugh has quit [Quit: Leaving.]
asahi has joined #ruby-lang
Domon has joined #ruby-lang
<asahi>
hello, how can i remove a forward slash if it exists at the end of a string?
<tsion>
asahi: str.chomp('/')
<asahi>
tsion: thanks!
<tsion>
No problem.
jgoss has quit [Ping timeout: 256 seconds]
roz has quit [Ping timeout: 276 seconds]
srbaker has joined #ruby-lang
Gaelan has quit [Remote host closed the connection]
Gaelan has joined #ruby-lang
Gaelan_ has joined #ruby-lang
mwjcomputing has joined #ruby-lang
Gaelan has quit [Ping timeout: 252 seconds]
srbaker has quit [Quit: Computer has gone to sleep.]
aemeredith has quit [Remote host closed the connection]
pkrnj_ has joined #ruby-lang
nertzy2 has quit [Quit: Leaving]
pkrnj has quit [Ping timeout: 240 seconds]
pkrnj_ is now known as pkrnj
pkrnj has quit [Quit: Computer has gone to sleep.]
Gaelan_ has quit [Remote host closed the connection]
srbaker has joined #ruby-lang
srbaker has quit [Client Quit]
nertzy has joined #ruby-lang
pkrnj has joined #ruby-lang
aemeredith has joined #ruby-lang
dhruvasagar has quit [Read error: Connection reset by peer]
bzalasky has quit [Remote host closed the connection]
dhruvasagar has joined #ruby-lang
srbaker has joined #ruby-lang
srbaker has quit [Client Quit]
krohrbaugh has joined #ruby-lang
tsion has quit [Quit: Leaving]
hakunin has joined #ruby-lang
krohrbaugh has quit [Ping timeout: 252 seconds]
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
synthetix has joined #ruby-lang
pasties has quit [Ping timeout: 240 seconds]
mwjcomputing has quit [Quit: Leaving]
pasties has joined #ruby-lang
r0bgleeson has quit [Ping timeout: 245 seconds]
bzalasky has joined #ruby-lang
aemeredith has quit [Remote host closed the connection]
slightair is now known as slightairx
slightairx is now known as slightair
lcdhoffman_ has joined #ruby-lang
lcdhoffman_ has quit [Client Quit]
quazimodo has quit [Ping timeout: 276 seconds]
lcdhoffman has quit [Ping timeout: 258 seconds]
Gaelan has joined #ruby-lang
Gaelan has quit [Ping timeout: 258 seconds]
kuja has quit [Ping timeout: 245 seconds]
dhruvasagar has quit [Ping timeout: 264 seconds]
ryez has joined #ruby-lang
lsegal has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
totallymike has quit [Ping timeout: 240 seconds]
kuja has joined #ruby-lang
andersbr has joined #ruby-lang
Gaelan has joined #ruby-lang
quazimodo has joined #ruby-lang
baba is now known as hack
divout has joined #ruby-lang
kuja has quit [Excess Flood]
Gaelan has quit [Ping timeout: 246 seconds]
aemeredith has joined #ruby-lang
aemeredith has quit [Remote host closed the connection]
aemeredith has joined #ruby-lang
bzalasky has joined #ruby-lang
chendo has quit [Read error: Operation timed out]
bzalasky has quit [Remote host closed the connection]
kuja has joined #ruby-lang
chendo_ has joined #ruby-lang
chendo_ has quit [Changing host]
chendo_ has joined #ruby-lang
quazimodo has quit [Ping timeout: 256 seconds]
brianpWins has joined #ruby-lang
asahi has quit [Quit: Leaving.]
chendo_ has quit [Ping timeout: 246 seconds]
chendo_ has joined #ruby-lang
chendo_ has joined #ruby-lang
chendo_ has quit [Changing host]
andersbr has quit [Quit: andersbr]
hack is now known as megha
User48583_ has joined #ruby-lang
User48583 has quit [Ping timeout: 260 seconds]
bzalasky has joined #ruby-lang
aemeredith has quit [Remote host closed the connection]
sush24 has joined #ruby-lang
aemeredith has joined #ruby-lang
tomzx_mac_ has joined #ruby-lang
tomzx_mac has quit [Ping timeout: 258 seconds]
brianpWins has quit [Quit: brianpWins]
macmartine has joined #ruby-lang
dc5ala has joined #ruby-lang
Domon has quit [Remote host closed the connection]
sush24 has quit [Quit: This computer has gone to sleep]
macmartine has quit [Quit: Computer has gone to sleep.]
brianpWins has joined #ruby-lang
krohrbaugh has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
aemeredith has quit [Remote host closed the connection]
krohrbaugh has quit [Ping timeout: 252 seconds]
bzalasky has joined #ruby-lang
aderyabin has joined #ruby-lang
mbj_ has joined #ruby-lang
mbj has quit [Ping timeout: 256 seconds]
tylersmith has joined #ruby-lang
dc5ala has quit [Quit: Ex-Chat]
mistym has quit [Remote host closed the connection]
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
<yorickpeterse>
hai
Domon has joined #ruby-lang
mistym has quit [Ping timeout: 246 seconds]
tylersmith has quit [Quit: tylersmith]
aemeredith has joined #ruby-lang
aemeredith has quit [Remote host closed the connection]
aemeredith has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has quit [Changing host]
nofxx has joined #ruby-lang
rolfb has joined #ruby-lang
nignaztic has joined #ruby-lang
heftig has quit [Quit: Quitting]
aemeredith has quit [Ping timeout: 246 seconds]
<charliesome>
yorickpeterse: yo
<charliesome>
yo, rick
nignaztic has quit [Client Quit]
User48583_ has quit [Remote host closed the connection]
mhi^ has left #ruby-lang [#ruby-lang]
<yorickpeterse>
never heard that one before
<charliesome>
i'm thrilled i'm witty enough to make that joke to you for the first time ever
retro|cz has joined #ruby-lang
Gaelan has joined #ruby-lang
mossplix has joined #ruby-lang
jg has joined #ruby-lang
Gaelan has quit [Ping timeout: 245 seconds]
krohrbaugh has joined #ruby-lang
kith_ has joined #ruby-lang
mossplix has quit [Ping timeout: 252 seconds]
cored has quit [Read error: Operation timed out]
|Vargas| has joined #ruby-lang
|Vargas| has quit [Changing host]
|Vargas| has joined #ruby-lang
kith has quit [Ping timeout: 245 seconds]
krohrbaugh has quit [Ping timeout: 245 seconds]
quazimodo has joined #ruby-lang
cored has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
<yorickpeterse>
So C question, because my C is rusty as fuck: is there a particular benefit to using `const char *foo` instead of `char *foo`?
<yorickpeterse>
seems to primarily be used for some compiler optimizations but the info so far has been a bit vague
apeiros has quit [Remote host closed the connection]
mossplix has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
tomzx_mac_ has quit [Quit: return 0;]
tomzx_mac has joined #ruby-lang
dhruvasagar has joined #ruby-lang
aemeredith has joined #ruby-lang
aemeredith has quit [Remote host closed the connection]
aemeredith has joined #ruby-lang
<yxhuvud>
yorick: you can't rewrite it by accident.
<yxhuvud>
which is a pretty nice property
<truls>
yorickpeterse: const is treated as a slightly different type than non-const versions, so you get some type checking for if the data is modifiable or not
<truls>
yorickpeterse: so you can tell from return values or parameters if the data is modifiable or not (or at least the intention)
<truls>
im pretty sure google and stackoverflow has a lot better answers than mine though
Mon_Ouie has quit [Ping timeout: 255 seconds]
symm- has joined #ruby-lang
krz has joined #ruby-lang
<yorickpeterse>
hmm
<truls>
remember that string literals are placed in a part of memory not meant for modification
<truls>
so having them as const char* is useful to protect you from trying to modify it unintentionally
<charliesome>
yorickpeterse: it's mainly as a hint to other programmers i believe
<bnagy>
nothing in C is a hint to other programmers. C is write only code.
<charliesome>
bnagy: take that back!
<bnagy>
shan't
nXqd has joined #ruby-lang
<charliesome>
:<
tomzx_mac has quit [Ping timeout: 258 seconds]
rippa has joined #ruby-lang
tonni has quit [Remote host closed the connection]
<yorickpeterse>
right, now I just need to figure out how to get column numbers in ragel when using C
noop has joined #ruby-lang
vlad_starkov has joined #ruby-lang
aderyabin has quit [Remote host closed the connection]
aemeredith has quit [Remote host closed the connection]
solars has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 260 seconds]
aemeredith has joined #ruby-lang
aemeredith has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
aemeredith has joined #ruby-lang
aemeredith has quit [Remote host closed the connection]
aemeredith has joined #ruby-lang
tonni has joined #ruby-lang
symm- has quit [Ping timeout: 258 seconds]
dr_bob has joined #ruby-lang
nofxx has quit [Remote host closed the connection]
aemeredith has quit [Remote host closed the connection]
Caius has quit [Ping timeout: 252 seconds]
krohrbaugh has joined #ruby-lang
benlovell has joined #ruby-lang
Guest2782 has joined #ruby-lang
krohrbaugh has quit [Ping timeout: 276 seconds]
mytrile has joined #ruby-lang
<whitequark>
truls: no, not really, unfortunately
<whitequark>
C standard does not require that string literals be placed into .rodata.
<whitequark>
on linux, they are; on win32, they are not (not necessarily? I stumbled into that).
<whitequark>
the standard defines write access to the content of a string literal as "undefined behavior".
Guest2782 has quit [Excess Flood]
Ca1us has joined #ruby-lang
kxra has joined #ruby-lang
Ca1us has quit [Changing host]
Ca1us has joined #ruby-lang
<whitequark>
... another place when the standard mindlessly slaps UB onto something implementation-defined in practice.
<kxra>
so, im new to ruby and writing a simple grep program, and can't figure out what's wrong with it searching file names rather than within files
dr_bob has quit [Read error: Connection reset by peer]
<injekt>
kxra: want to provide a little more info if you're looking for help?
<kxra>
injekt: sure, like what? i can just show you my code so far
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
maxmanders has joined #ruby-lang
mjio has quit []
kith_ is now known as kith
solars has joined #ruby-lang
<kxra>
manveru: thanks. how does that avoid loading it into memory? what does it do instead?
<apeiros>
manveru: why chomp?
celinedior has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
mossplix has quit [Ping timeout: 240 seconds]
<shachaf>
apeiros: Presumably because puts already adds a newline. And the weird behaviour where it checks if the string ends with a newline is awful and we'd all rather pretend it didn't exist.
<whitequark>
yorickpeterse: what do you mean by "shit"?
xxaM has joined #ruby-lang
swav has joined #ruby-lang
<whitequark>
stuff on left is desktops; useful. stuff on right is tray; also useful. stuff in the middle is i3's default which I can't be bothered to change.
El_loco has joined #ruby-lang
heftig has quit [Ping timeout: 245 seconds]
<kxra>
manveru: okay i made lots of changes, but now i also want it to be able to check for regexps
<yorickpeterse>
why do you need ipv6 info in there?
<yorickpeterse>
or your local ip
<wnd>
i3status has that by default
charliesome_ has joined #ruby-lang
<whitequark>
yorickpeterse: um, local ip is useful...
charliesome has quit [Disconnected by services]
charliesome_ is now known as charliesome
mossplix has joined #ruby-lang
<yorickpeterse>
I just don't see how you need that all the time
TheNotary has quit [Ping timeout: 258 seconds]
skade has joined #ruby-lang
noop has quit [Ping timeout: 255 seconds]
<whitequark>
yorickpeterse: as said: I'm too lazy to reconfigure it
jbsan has quit [Quit: jbsan]
chessguy has quit [Remote host closed the connection]
kain has joined #ruby-lang
<whitequark>
grrr, rails autoloader is an incredible piece of shit
TheNotary has joined #ruby-lang
<whitequark>
why the fuck is it even active in production (and why does it fail in multithreaded environment)
<injekt>
what autoloader?
krohrbaugh has joined #ruby-lang
<judofyr>
I thought it used a preloader in prod
Axsuul has quit [Ping timeout: 264 seconds]
<whitequark>
hahaha no
<judofyr>
but hey, I also thought Rails wouldn't allow running remote code as a part of query parsing, so yeah
<whitequark>
well yes, but the preloader sucks. and because of that autoloader is also used
<whitequark>
lemme find the issue
<whitequark>
#7770
<judofyr>
how's the Rails issue tracker btw?
<judofyr>
468 open issues
<judofyr>
jesus
<whitequark>
what the fuck who closed it
<whitequark>
"not reproduced in master" have he tried actually reading the comment?
<whitequark>
grrr.
beiter has joined #ruby-lang
<mbj>
whitequark: +1 regarding rails autoloader is shit.
<mbj>
whitequark: One of the reasons I moved away from rails
krohrbaugh has quit [Ping timeout: 252 seconds]
<charliesome>
rails has some great stuff
noop has joined #ruby-lang
<charliesome>
but god damn if it doesn't shit me all the time
<whitequark>
^
<injekt>
+1
<charliesome>
an example:
<mbj>
The whole concept of autoloading just tries to fix a symptom not the root problem.
<lianj>
are slow loading tests one of the great features?
<charliesome>
is there a way to change how a model object is parameterized without defining a to_param method on the model?
<whitequark>
mbj: a symptom of using ruby, indeed
<mbj>
whitequark: ^
<injekt>
charliesome: probably not, to_param is defined on Object (I believe as an alias for to_s) and it's used everywhere
<charliesome>
injekt: that's horrid
<injekt>
charliesome: yup
<whitequark>
charliesome: why?
<charliesome>
routing concerns don't belong on the model
<charliesome>
they belong in the router
<judofyr>
one day I'll release/finish my framework. and you will all rejoice!
<whitequark>
oh, all this "decouple routing from models" talk
<whitequark>
please proceed to play in the sandbox
<injekt>
the rails router is incredibly dumb
<charliesome>
whitequark: ?
<ddfreyne>
What does the rails autoloader do?
<injekt>
ddfreyne: autoloads!
<charliesome>
i'm not regurgitating some blog i read, it's something that i've decided really annoys me
<ddfreyne>
go back to bed, injekt!
<injekt>
ddfreyne: :D
<whitequark>
charliesome: so far, every "better" solution included writing 5x more code for every single link
<injekt>
ddfreyne: config.autoload_paths
<whitequark>
because, supposedly, architecture and so
<judofyr>
injekt: I love how you define Rails routes in a nested-structure, which is then flattened into a list of regexps, which is then parsed by Journey, which re-creates a nested structure for performance \o/
<whitequark>
charliesome: one thing you can do with that is combine multiple incompatible frameworks in one app
<whitequark>
eg suppose if Rails had to_param and Sinatra did too, they *could* conflict. but that is entirely theoretical.
<charliesome>
sure
<whitequark>
not sure if it is ever useful in practice.
<charliesome>
i don't actually have any reasons why to_param on the model class is evil and shit
chessguy has joined #ruby-lang
<charliesome>
but it annoys me because i know that's not where it belongs
security is now known as megha
<whitequark>
one of these issues. "it's bad but not enough to warrant a change."
<injekt>
there's a lot of those
<charliesome>
it's sort of the same as how you *can* do something like User.current safely and correctly
<charliesome>
but you don't because it's not a very good idea
Gaelan has joined #ruby-lang
<whitequark>
Thread.current[] yeah
<charliesome>
sure
<whitequark>
it's bad not because lolarchitecture, but because this way you couple current user to a thread
<injekt>
I think I've only used that for a multi-tenant app, and didn't even really need it there
<charliesome>
but it breaks the whole point of trying to do mvc in the first place
<whitequark>
this has very real, practical implications
<charliesome>
whitequark: you could argue that that's a lolarchitecture reason
<charliesome>
coupling a user to a thread is bad architecture
<whitequark>
charliesome: I have a bug because of that in the app I'm currently working on
<charliesome>
it's the same as coupling a user to anything else that doesn't really have much to do with user
<whitequark>
not specifically User.current, just coupling of in-flight req data to thread.
<whitequark>
so it's not lolarchitecture :)
mossplix has joined #ruby-lang
<charliesome>
do you mind if i ask what it is?
<whitequark>
add thread pools and the user gets reused
<whitequark>
(pun not intended)
<charliesome>
no i mean, what your specific in flight req data is
<whitequark>
ah. it's Honeybadger.context() in sidekiq
glebm has quit [Quit: Computer has gone to sleep.]
<whitequark>
hb doesn't clear context at the start of sidekiq job, despite claiming integration with sidekiq
<charliesome>
ah right
<whitequark>
it's not really about rails but it's the same issue
<charliesome>
so i think if it's something like that, it's acceptable to stick shit in Thread.current
Gaelan has quit [Ping timeout: 255 seconds]
<whitequark>
well, I'd say it is acceptable too. but you need to know what you're doing. this is why Thread.current is a bad solution.
kith has quit [Read error: Connection reset by peer]
kith has joined #ruby-lang
toretore has quit [Read error: Connection reset by peer]
dagobah_ has joined #ruby-lang
<charliesome>
Thread.current is a poor man's dynamic scoping
toretore has joined #ruby-lang
<whitequark>
hmmm no, I disagree
<whitequark>
dynamic scoping, by itself, doesn't play well with multithreading
pasties has quit [Ping timeout: 240 seconds]
dagobah has quit [Read error: Connection reset by peer]
<charliesome>
whitequark: sure it can
<whitequark>
charliesome: your code needs to be explicitly aware of the threading environment
<whitequark>
in order to use dynamic scoping
<charliesome>
not necessarily
<charliesome>
there's no reason the dynamic scoping mechanism can't be thread aware
<whitequark>
exactly
<whitequark>
it *needs* to be thread aware
<whitequark>
whereas lexical scoping doesn't
<charliesome>
so *your code* doesn't need to be thread aware
<whitequark>
I'm talking about implementation, ofc
<charliesome>
the implementation of the dynamic scoping needs to be
<charliesome>
but i would expect that
<charliesome>
lexical scoping also has threading issues
<charliesome>
if two threads see the same binding
<whitequark>
charliesome: no, that's an issue with threading and closures
<whitequark>
specifically, that closures are not always reentrant. if they depend on a value from a mutable binding.
chessguy has quit [Remote host closed the connection]
<charliesome>
same difference
<charliesome>
i don't see your concerns about dynamic scoping and threading though
El_loco has quit [Remote host closed the connection]
<whitequark>
charliesome: "same difference"?
<charliesome>
my point is
<whitequark>
C's lexical scoping, for example, doesn't interact with multithreading in any way
pasties has joined #ruby-lang
<charliesome>
most lexical scoping doesn't care about threads at all
<charliesome>
except perl's
<whitequark>
yea
<charliesome>
if there was a language with dynamic scoping and threads, i would expect the dynamic scoping to be implemented in a threads aware way
<charliesome>
and if it wasn't, then that's a major WTF in my books
<whitequark>
concerns about dynamic scoping and threading: for example, I don't like how most variables throughout the program can become a point of contention in a multithreaded environment
<whitequark>
it depends on implementation details, of course
<whitequark>
for example you can implement it so that all variables are looked up in thread-local storage
<whitequark>
no "a = 1; Thread.new { puts a }" for you, then
<charliesome>
whitequark: well in that case a is a lexical binding so that'd work
<charliesome>
dynamic scoping is very useful, but it should be opt-in
<manveru>
oh, i don't do rails
<manveru>
so no that wasn't me
<whitequark>
manveru: didn't you hate rails routing?
<whitequark>
and praise ramaze's
mossplix has quit [Ping timeout: 240 seconds]
<whitequark>
I'd expect you hate url_for for much the same reasons as well :)
GarethAdams has joined #ruby-lang
<whitequark>
charliesome: yeah, with opt-in it's easier
<charliesome>
there's still that edge case though
<whitequark>
however I somewhat dislike how your suggestion binds two not clearly related concepts together
<charliesome>
what should 'local a = 1; Thread.new { puts a }' do?
<whitequark>
I mean you now have to remember not just how threading works and, as a distinct collection of facts, how dynamic scope works
<whitequark>
but a 'dot-product' of threading ∙ dynamic scoping
arsemyonov has joined #ruby-lang
glebm has joined #ruby-lang
<whitequark>
charliesome: I think that a naive Thread.current implementation, coupled with just as naive dynamic scoping (def dynscope(var, value); oldvalue = T.c[var]; T.c[var] = value; yield; ensure; T.c[var] = oldvalue; end) is the best solution here
lupine has joined #ruby-lang
<whitequark>
not extending the language itself in any way
mossplix has joined #ruby-lang
<whitequark>
grrr, I want TracePoint to be FASTER
<judofyr>
whitequark: is it noticeable in Racc?
<whitequark>
5.9 second tests with TP; 2.4 seconds without
<whitequark>
judofyr: the problem is that it instruments all the code, not just racc
<whitequark>
and the hottest is in the lexer, where I don't need it at all
<judofyr>
whitequark: why do you need to enable it when running tests?
<whitequark>
judofyr: erm... to collect coverage for .y files?
<judofyr>
Monpoke: nope, it's a slice. it takes a subset of the string from `i` to the end
<Monpoke>
Hum, okay, so it's seem like substr
<Monpoke>
Okaaay ^^
<judofyr>
I would guess: subtr($str, $i)
<Monpoke>
I think that is : substr($str, $i, -1) in this case ^^
<Monpoke>
I will try
<Monpoke>
XD
<GarethAdams>
I think this is more a question for a ##php channel
sush24 has joined #ruby-lang
<judofyr>
Monpoke: looking at php.net/substr: "If length is omitted, the substring starting from start until the end of the string will be returned."
<judofyr>
GarethAdams: well, this channel isn't exactly crowded :)
<judofyr>
I think we'll sort it out
<GarethAdams>
:)
<GarethAdams>
I wouldn't wish the depths of the PHP documentation on anyone, but each to their own
mbj has quit [Quit: Lost terminal]
<Monpoke>
GarethAdams: It's more a ruby question ^^
<Monpoke>
judofyr: Thanks, it's work ^^
<judofyr>
Monpoke: anything else?
<Monpoke>
For the moment no :)
nkr has joined #ruby-lang
<Monpoke>
code[i..-1], Like you start from $i character, and you get -1 character, it is like $str[$i-1] ^^
<Monpoke>
Thanks :)
<judofyr>
Monpoke: (a..b) is a Range in Ruby. in this case it's a range from i to -1, which then means "from character i to the end of the string" on code[]
<Monpoke>
Aaaahh xD
<Monpoke>
Okaay ^^"
postmodern has quit [Quit: Leaving]
<Monpoke>
Sorry, so it's substr function usefull ^^"
<judofyr>
Monpoke: this will do the same: a = (i..-1); code[a]
mossplix has quit [Ping timeout: 264 seconds]
<judofyr>
Monpoke: which can be a bit surprising. String#[] is quite powerful.
<lupine>
just beware encoding and ruby version differences
<judofyr>
lianj: now you're just complicating everything with map and send and blocks and whatnot
* lupine
wonders if ruby1.8 is going to be the IE6 of its day
swav has quit [Remote host closed the connection]
<lianj>
judofyr: :p
<lupine>
oh, and for range addressing in ruby, if you might at some point have a range with zero elements, don't forget to use ... rather than ..
<Monpoke>
Syntax seem not easy ^^'
srbaker has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
<Monpoke>
And this, chunk[/\A([a-z]\w*)/, 1], The "1" represents what ? ^^
<lianj>
first match
Mon_Ouie has joined #ruby-lang
<Monpoke>
Okaay :)
<Monpoke>
Thanks :)
<lianj>
s/match/capture
<judofyr>
Monpoke: as I mentioned, String#[] is very "overloaded"
<Monpoke>
Yes I see that ^^"
<lianj>
yea, i think not many use it for regexp
mossplix has joined #ruby-lang
<judofyr>
lianj: I use it often for regexp
divout has quit [Remote host closed the connection]
<Monpoke>
^^'
krohrbaugh has joined #ruby-lang
mossplix has quit [Quit: mossplix]
myappleguy has quit [Quit: Leaving.]
vlad_starkov has joined #ruby-lang
retro|cz has joined #ruby-lang
mossplix has joined #ruby-lang
krohrbaugh has quit [Ping timeout: 276 seconds]
totallymike has joined #ruby-lang
mbj has joined #ruby-lang
pskosinski has joined #ruby-lang
mytrile has joined #ruby-lang
Gaelan has joined #ruby-lang
benlovell has joined #ruby-lang
* whitequark
coughs
<whitequark>
18>> p () {}
<eval-in>
whitequark => /tmp/execpad-063a1c0dfa35/source-063a1c0dfa35:2: warning: don't put space before argument parentheses ... (http://eval.in/16407)
<eval-in>
Monpoke => /tmp/execpad-7f2481979ef6/source-7f2481979ef6:2:in `<main>': ok (RuntimeError) (http://eval.in/16434)
alessio_rocco has quit [Ping timeout: 256 seconds]
madb055 has quit [Ping timeout: 256 seconds]
dhruvasagar has quit [Ping timeout: 264 seconds]
erpuds has joined #ruby-lang
<zzak>
inkjet D:
outoftime has joined #ruby-lang
<whitequark>
ugh, the insane static env-snooping behavior first appeared in 1.9.3
<whitequark>
we should totally have flat versioning for ruby. 192. 193. 200. etc.
nertzy2 has joined #ruby-lang
dustint has quit [Ping timeout: 252 seconds]
nertzy has quit [Ping timeout: 240 seconds]
rippa has quit [Ping timeout: 240 seconds]
beiter_ has joined #ruby-lang
totallymike has quit [Quit: WeeChat 0.4.0]
<zzak>
you're about 20 years too late
<whitequark>
zzak: that was intended as a humorous remark, not an actual suggestion.
totallymike has joined #ruby-lang
<zzak>
same
<whitequark>
:D
<whitequark>
in unrelated news... I'm not sure if I want to write ruby code anymore. srsly.
beiter has quit [Ping timeout: 245 seconds]
beiter_ is now known as beiter
twintail has joined #ruby-lang
mistym has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
<whitequark>
the mental image of the parsing process doesn't want to go away. and it is not pretty.
<zzak>
you need to take a break
<whitequark>
yea. with a flamethrower
<zzak>
go fishing, thats what i did :D
<whitequark>
fishing with a flamethrower! yay!
<zzak>
probably have better luck than i did haha
<whitequark>
it's an optimization: the fish is already cooked when/if you catch it
* whitequark
sighs
<whitequark>
if I ever want to overflow ryan's inbox, I have an almost unlimited supply of RP bugs now
<zzak>
hes usually pretty good about responding
<zzak>
which is impressive considering the number of projects he maintains
rolfb has joined #ruby-lang
<whitequark>
you mean responding like "no, ignore him"?
<zzak>
sometimes you gotta be the bad guy
<zzak>
but give him some credit ;)
<whitequark>
sometimes I wonder about the true extend of stockholm syndrome in this community. but it's unrelated.
<whitequark>
he didn't respond for most of my RP filings but I can totally understand him here, at least
<whitequark>
I think the easier way to fix RP is to deprecate it :)
alessio_rocco has joined #ruby-lang
<zzak>
not stockholm, its called respect, and i think he's earned it anyways
<judofyr>
stockholm is a nice city
<injekt>
what about london syndrome
mbj has quit [Quit: Lost terminal]
<whitequark>
everyone can write a lot of code. not everyone can ensure others contribute to their code. it needs work
dustint has joined #ruby-lang
<whitequark>
otherwise you end up spreading your time between seventy-five projects you have to maintain yourself.
madb055 has joined #ruby-lang
<judofyr>
I have seventy-five dormant project that I don't have to maintain :D
<whitequark>
though I do respect the dedication required for doing that for almost ten years.
<judofyr>
sigh. sometimes I wish I were better at completing projects
<zzak>
thats the role of the maintainer, just because he's not merge happy doesn't make him a bad maintainer
beiter_ has joined #ruby-lang
dvorak has quit [Ping timeout: 252 seconds]
beiter has quit [Ping timeout: 245 seconds]
beiter_ is now known as beiter
tonni has quit [Remote host closed the connection]
<judofyr>
whitequark: btw, do you have any thoughts on I/O in Ruby? blocking, non-blocking, co-routines, streams etc?
dvorak has joined #ruby-lang
<whitequark>
zzak: compare with Linux maintenance culture. they're not merge-happy yet that does not mean all trivial contributions are rejected just because. quite the opposite in fact
<whitequark>
judofyr: use JRuby+netty if you care about IO, otherwise it doesn't matter.
<zzak>
whitequark: i think youll find his demeanor much different when theres actually a patch presented
<zzak>
but anyways
<judofyr>
whitequark: hm. what interface to work with it? streams? callbacks? coroutines? promises?
io_syl has quit [Ping timeout: 245 seconds]
andersbr has joined #ruby-lang
<whitequark>
judofyr: whatever's more convenient with you?
<judofyr>
whitequark: e.g. you stream a file from one server to the other. how do you avoid filling up the write-buffer if the receiver is slower than the sender.
<judofyr>
whitequark: that article was way above my head
<whitequark>
judofyr: same
<whitequark>
hmmm
kristofferrr has joined #ruby-lang
<judofyr>
whitequark: e.g. if you have a WebSocket-endpoint that streams data continually, you don't want someone to be able to DDoS it by just connecting and not reading any data.
<whitequark>
judofyr: when the buffer is filled the call either blocks or returns -EAGAIN
<whitequark>
plus epoll has bits for readability and writabbility
<whitequark>
local TCP buffer, that is.
<judofyr>
well, EM/Node.js has its own local write buffer
<whitequark>
the whole "if the receiver is slower than senver" is handled by the TCP stack and its congestion control algorithm
<whitequark>
judofyr: yeah. you need to bypass that.
<whitequark>
I'd be... not... surprised if node did not have a way to do it
<zzak>
whitequark: isolated incident, but yeh, he should have done that from the get go
wallerdev has joined #ruby-lang
<judofyr>
whitequark: well, how does that actually work in code without using blocking calls? e.g: sender.on('data', function(chunk) { receiver.send(chunk) })
<judofyr>
whitequark: Node.js lately introduced the Stream interface which solves that
<whitequark>
zzak: I guess "Send a PR" is so much harder to write than "No".
<judofyr>
or, that's one of the problems it solves: http://nodejs.org./api/stream.html
<whitequark>
or rather WaitReadable or something like that. it also clears method caches :p
<whitequark>
(headius fixed it in MRI though)
<judofyr>
whitequark: hm. then you'll always have to worry about #send raising an error though :/
<whitequark>
judofyr: yep that's how nonblocking IO works all the way down to the POSIX
<whitequark>
well
<whitequark>
you can also snoop the epoll()-returned status
<zzak>
whitequark: youre focusing on one incident
Monpoke is now known as Monpoke`Away
wyhaines has joined #ruby-lang
<judofyr>
whitequark: well sure, but it's much nicer to work with a local write buffer. but then you still need another way to figure out "this connection is stalling"
<whitequark>
judofyr: ie only send data when it returns the readable bit
swygue has quit [Read error: Connection reset by peer]
<whitequark>
zzak: from what I see here, it forms a pattern. however I won't convince you of anything even with enough data points, so let's finish this discussion
<zzak>
yeah, its not really fair to either party
swygue has joined #ruby-lang
gnufied has quit [Quit: Leaving.]
<judofyr>
whitequark: I am aware, yes, but I don't find that a friendly model to deal with in my programs. I'd rather have an abstraction on top that adds a buffer so I can always just #send data. but then I still need a way to communicate the "stop, this guy can't handle it anymore"
<whitequark>
judofyr: you'd just make a bad rewrite of TCP in your program
<judofyr>
whitequark: that might be true, but it's better than dealing with WaitReadable at *every* place where you send data
<whitequark>
you want exactly the same interface, but "with my own buffer" for some reason
* whitequark
shrugs
<whitequark>
wrap IO#send in something else
<judofyr>
well yes, but I still haven't figured out a good way to communicate the backpressure :(
Monpoke`Away has quit [Ping timeout: 245 seconds]
<judofyr>
I guess I should look at how other projects handle it…
<whitequark>
zzak: there's also the fact that substantial refactoring of any seattlerb project is pretty much impossible without involving ryan, and he's got 75 projects. so...
krohrbaugh has joined #ruby-lang
<whitequark>
I don't see how I would improve RP despite 1) wanting to 2) being able to contribute enough time to make a complete rewrite 3) being ok with occasional "fuck off" thrown at me, etc.
io_syl has quit [Quit: Computer has gone to sleep.]
<whitequark>
other large-ish communities solve this by decentralizing control (KDE) or making it hierarchical (Linux)
<whitequark>
(the former doesn't have an SPOF, for the latter it's Linus but a patch travels at least 2-3 levels before going to him)
<zzak>
RP has quite a few less contributors than KDE or Linux
kogent has quit [Ping timeout: 245 seconds]
<whitequark>
RP is also much smaller than KDE or Linux
celinedior has joined #ruby-lang
<whitequark>
4-6 orders of magnitude :)
beiter has quit [Ping timeout: 246 seconds]
<zzak>
yarp
krohrbaugh has quit [Ping timeout: 252 seconds]
beiter has joined #ruby-lang
<whitequark>
besides, I'm not talking about just RP but all the projects together
srbaker has quit [Quit: Computer has gone to sleep.]
<whitequark>
more precisely, hostile forks only work in rather extreme circumstances.
carloslopes has quit [Remote host closed the connection]
gnufied has joined #ruby-lang
twintail has quit [Quit: Leaving.]
<whitequark>
what you're saying is like "oh you don't like how ruby's Encoding is screwed up? sure, the core team probably isn't going to take your suggestions into account anyway, move to Python"
<whitequark>
the fact that it is true does not make that any less sad.
idkazuma has quit [Remote host closed the connection]
<whitequark>
maintaining OSS projects is 10% writing code, 90% working with people whose suggestions you often don't like but need their work anyway.
mistym_ has joined #ruby-lang
mistym_ has quit [Remote host closed the connection]
sailias1 has quit [Ping timeout: 255 seconds]
<whitequark>
(well, you can disregard that but then your project is mostly dead.)
beiter_ has joined #ruby-lang
beiter has quit [Ping timeout: 245 seconds]
beiter_ is now known as beiter
beiter_ has joined #ruby-lang
arsemyonov has quit [Quit: arsemyonov]
jg has quit [Quit: Leaving]
thebastl has quit [Ping timeout: 245 seconds]
beiter has quit [Ping timeout: 256 seconds]
beiter_ is now known as beiter
judofyr has quit [Remote host closed the connection]
rippa has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
beiter_ has joined #ruby-lang
beiter has quit [Ping timeout: 252 seconds]
beiter_ is now known as beiter
sailias has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
apeiros has quit [Remote host closed the connection]
anjen has joined #ruby-lang
swav has quit [Remote host closed the connection]
anjen has quit [Client Quit]
retro|cz has quit [Ping timeout: 258 seconds]
Gaelan has quit [Remote host closed the connection]
swav has joined #ruby-lang
nXqd has quit [Ping timeout: 240 seconds]
bzalasky has joined #ruby-lang
thebastl has joined #ruby-lang
snarfmason has joined #ruby-lang
sush24 has joined #ruby-lang
smt has quit [Quit: Konversation terminated!]
benlovell has quit [Quit: Computer has gone to sleep.]
bzalasky has quit [Remote host closed the connection]
tonni has joined #ruby-lang
sandbags2 has joined #ruby-lang
bzalasky has joined #ruby-lang
erpuds has quit [Quit: erpuds]
tonni has quit [Ping timeout: 255 seconds]
dhruvasagar has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
<whitequark>
so that commit adds def foo(**kwrest)
<whitequark>
and then there's an exponential explosion of rule count
<judofyr>
whitequark: I meant the presence of "1ab3974b0efea5155da005ec08a1feee90023d98" in the TODO.md doesn't really help me. *opens every link in a new tab*
<judofyr>
whitequark: also, where's %i/%I?
<whitequark>
which clearly shows you should not use LALR(1) grammars, but that's unrelated
<judofyr>
yfeldblum: it's not quite comparable though. if MySQL adds support for some SQL all of the drivers don't have to be updated
<yfeldblum>
judofyr, i guess what i'm looking for are how stable & reliable are a) mysql-gem and b) mysql2-gem
<judofyr>
yfeldblum: huh, mysql has recent releases too
<judofyr>
yfeldblum: but both are production-ready. Rails depends on mysql2, so everyone using Rails 3+ and MySQL uses it
<judofyr>
whitequark: btw, how would I pass along the line-number information from the lexer?
io_syl has quit [Ping timeout: 252 seconds]
TheNotary has joined #ruby-lang
wesside is now known as wes|away
mwjcomputing has joined #ruby-lang
arsemyonov has joined #ruby-lang
io_syl has joined #ruby-lang
anonymuse has quit [Quit: Leaving...]
gearaholic has joined #ruby-lang
gearaholic has joined #ruby-lang
marr has joined #ruby-lang
vlad_starkov has joined #ruby-lang
mossplix has quit [Ping timeout: 245 seconds]
ryanf has joined #ruby-lang
nazty has quit [Read error: Connection reset by peer]
workmad3 has joined #ruby-lang
nazty has joined #ruby-lang
Guest88304 has quit [Read error: Connection reset by peer]
Guest88304 has joined #ruby-lang
<whitequark>
judofyr: hm?
<whitequark>
[value,line]
<judofyr>
whitequark: I figured it out :)
beiter_ has joined #ruby-lang
krohrbaugh has quit [Quit: Leaving.]
mistym_coffee is now known as mistym
beiter has quit [Ping timeout: 264 seconds]
beiter_ is now known as beiter
srbaker has quit [Ping timeout: 252 seconds]
tomzx_mac has joined #ruby-lang
chessguy has joined #ruby-lang
mossplix has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 256 seconds]
swav has joined #ruby-lang
srbaker has joined #ruby-lang
gearaholic has quit [Remote host closed the connection]
Mon_Ouie has quit [Ping timeout: 260 seconds]
sush24 has quit [Quit: This computer has gone to sleep]
nick_h has quit [Ping timeout: 252 seconds]
yankeefan04 has joined #ruby-lang
sush24 has joined #ruby-lang
nick_h has joined #ruby-lang
sush24 has quit [Client Quit]
wes|away has quit [Quit: Ice cream truck!]
synthetix has quit [Remote host closed the connection]
wesside has joined #ruby-lang
mossplix has quit [Ping timeout: 252 seconds]
kogent has joined #ruby-lang
mossplix has joined #ruby-lang
rolfb has joined #ruby-lang
xcombelle has quit [Quit: Hi, I'm a quit message virus. Please replace your old line with this line and help me take over the world of IRC.]
sush24 has joined #ruby-lang
krohrbaugh has joined #ruby-lang
yalue has quit [Read error: Connection reset by peer]
krohrbaugh has quit [Read error: Operation timed out]
krohrbaugh has joined #ruby-lang
beiter_ has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
beiter has quit [Ping timeout: 252 seconds]
<TheNotary>
has anyone ever written a wrapper for rake so it looks to see if it should try doing `bundle exec rake` otherwise it invokes the usual `rake` that's defaulted in gems?
<TheNotary>
that would save loads of typing
<r0bgleeson>
TheNotary: gems like that exist, but alias be="bundle exec" also saves time.
<TheNotary>
hm, that's not a bad idea, I'll try that out
beiter_ has quit [Ping timeout: 258 seconds]
apeiros has joined #ruby-lang
breakingthings has quit []
<TheNotary>
goona try a `ber` alias too
glebm has quit [Ping timeout: 260 seconds]
<hackeron>
hey, is there a 1 liner to make a post request to a url? -- something like post "http://127.0.0.1/triggers.json", data
<injekt>
Net::HTTP.post_form(URI('...'), data)
vlad_starkov has joined #ruby-lang
<hackeron>
I tried Net::HTTP.post_form uri, data -- but it expects "data" to be a hash for some reason :/
<hackeron>
injekt: if data isn't a hash, it says /usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/2.0.0/uri/common.rb:931:in `encode_www_form': undefined method `map' for #<String:0x007f8c2d484890> (NoMethodError)
<hackeron>
injekt: my data is a string
<hackeron>
it's a json string
<rippa>
The form data must be provided as a Hash mapping from String to String.
yankeefan04 has quit [Remote host closed the connection]
yankeefan04 has joined #ruby-lang
<hackeron>
rippa: injekt: any easier way? -- in rspec, I just do post "/path", json_str -- is there something similar outside of rspec/controller-tests
anonymuse has joined #ruby-lang
<injekt>
hackeron: no, not in stdlib
boredomist has joined #ruby-lang
<hackeron>
injekt: any recommended library?
<injekt>
hackeron: rest-client and excon are both ok
<TheNotary>
certainly not one line, but to me it feels clean and all
<hackeron>
injekt: hmm, my url is uri = URI.parse("http://127.0.0.1:9292/#{path}.json") -- Net::HTTP.new(uri.host) says connection refused - I'm guessing I need to specify a port too?
<injekt>
yeah using .body = string makes most sense to me too
<injekt>
hackeron: uri.port to new
dustint_ has joined #ruby-lang
<injekt>
new(uri.host, uri.port)
<hackeron>
hmm, I think I do actually want Net::HTTP.post_form uri, data -- that almost works. My rails app gets some of the params, but the nested hash looks wrong. I get my params like this: "path"=>"/api/v1/triggers", "portal_name"=>"demo1", "token"=>"xanboxid1", "trigger"=>"{\"type\"=>\"motion-start\", \"date\"=>\"2013-04-12 14:25:17 +0100\", \"sname\"=>\"roman-room\"}"} --- notice "trigger" => stuff is wrong
dustint has quit [Ping timeout: 255 seconds]
<hackeron>
if I do Net::HTTP.new(uri.host, uri.port).request(Net::HTTP::Post.new(uri.path), JSON(message)) then none of my params appear right, rails sees it as a long string
madb055 has quit [Ping timeout: 264 seconds]
pskosinski has quit [Ping timeout: 256 seconds]
<hackeron>
RestClient.post "http://127.0.0.1:9292/#{path}.json", message << works beautifully :D
<hackeron>
injekt: thanks for the suggestion :)
<injekt>
hackeron: np!
vbatts|work has quit [Quit: MeSoChatty 0.3.8]
dustint_ has quit [Ping timeout: 264 seconds]
mossplix has quit [Ping timeout: 252 seconds]
sush24 has quit [Ping timeout: 245 seconds]
carloslopes has quit [Remote host closed the connection]
sush24 has joined #ruby-lang
nXqd has joined #ruby-lang
zanegray has joined #ruby-lang
zanegray has quit [Client Quit]
sailias has quit [Ping timeout: 260 seconds]
pib1978 has joined #ruby-lang
dustint_ has joined #ruby-lang
mossplix has joined #ruby-lang
Nisstyre has quit [Quit: Leaving]
pskosinski has joined #ruby-lang
workmad3 has quit [Read error: Operation timed out]