<rue>
Erm, ‘blacklist-default’ meaning that if you do nothing, there's no effect… only using (ahah) use or specifying something else would toggle it into whitelisting
<rue>
Or strftime or whatever it is?
<drbrain>
WillMarshall: if you use DateTime, it'll be at midnight
<WillMarshall>
Date.new *[2012, 3, 21] does it
<WillMarshall>
Thanks!
shevy has joined #ruby-lang
}0 has joined #ruby-lang
<drbrain>
WillMarshall: actually, you'll probably want some parens to avoid the warning
<rue>
Warnings schmarnings
<WillMarshall>
1.8.7 - no warning!
<WillMarshall>
What is the warning?
<WillMarshall>
Complaining about a lack of parens?
<drbrain>
twelvechairs: to get you started, [ and ] are the characters you care about as they're the borders of your replacement
<drbrain>
but, they're also regexp special characters
<twelvechairs>
conceal_rs, : thanks. I know how to build the regular expression, just not how to extract 'variable' from the middle to keep it
<drbrain>
ah, great
<drbrain>
there's a couple ways, one is to use capturing groups
<drbrain>
with sub
<drbrain>
the other is to use split + reverse (if it'll always be those three things)
<drbrain>
here is the split way:
<drbrain>
"foo[$VARIABLE]bar".split(/(\[.*?\])/)
<twelvechairs>
drbrain, : thanks heaps. anything you know which explains the backreferences properly? Its the "(" and ")" which confuse me in that line.
<twelvechairs>
ahhh. thanks. Sorry. stupid of me to miss the core documentation! :) Wasn't expecting such a full explanation there.
<drbrain>
if you do it with sub, you put a group around the part before, a group around the middle, and a group around the part after
<drbrain>
then glue them back together in the right order
<drbrain>
twelvechairs: the docs explain how captures work, and by combining it with the String#sub and String#gsub docs, you should be much further along
jmfcool has joined #ruby-lang
<twelvechairs>
drbrain, : Thanks a lot :)
<drbrain>
twelvechairs: also, with sub, you can replace from captures in two ways
<drbrain>
with a block, like { [$3, $2, $1].join }
<drbrain>
or with a string like , "\\3\\2\\1"
ericmuyser has joined #ruby-lang
<twelvechairs>
drbrain: thanks!
shtirlic_ has joined #ruby-lang
_inc has joined #ruby-lang
headius has joined #ruby-lang
rdavila has joined #ruby-lang
Lite_ has joined #ruby-lang
wmoxam has joined #ruby-lang
_santana has joined #ruby-lang
<_santana>
hi there
<Lite_>
Nice to meet you.
gix has joined #ruby-lang
brianpWins has joined #ruby-lang
<twelvechairs>
drbrain, : nother quick question if you are able to answer. Is there a way of creating a regular expresion to capture the first of something? eg. the line 'capturethisFOOdontcapturethisFOO'. If i do /.*FOO/ it captures the whole string but I only want the first part
<drbrain>
^ anchors to the beginning of the line
<drbrain>
\A anchors to the beginning of the string
<_santana>
twelvechairs: /^(.*)FOO$/
<rue>
Also for added fun, \a
<_santana>
twelvechairs: you'll get what you want in $1
<Lite_>
The date class function... "Date.day_fraction_to_time" apparently no longer works in the current version of Ruby.
<Lite_>
It used to work for me, but after googling I read somewhere that it's now a private class, but I don't know what you have to write instead of access such a thing.
<Lite_>
to* access
headius has joined #ruby-lang
dv310p3r has joined #ruby-lang
<Lite_>
Anyone familiar with that?
krz has joined #ruby-lang
Phrogz has joined #ruby-lang
urbanmonk has joined #ruby-lang
headius has joined #ruby-lang
<shevy>
Date.day_fraction_to_time ? did this work?
<shevy>
oh indeed
<shevy>
I am on ruby 1.8.x though
srbartlett has joined #ruby-lang
<drbrain>
Lite_: what did you use it for?
<drbrain>
Lite_: you should not be calling it, and it probably doesn't exist anymore
<Phrogz>
drbrain: I need a sudo on that 'cause I guess it's going for port 80 by default.
<drbrain>
yeah
<Phrogz>
Got a variation that sets the port simply?
<swarley>
ruby -e "`sudo ngnix`"
<Phrogz>
:p
<Phrogz>
drbrain: Ouch...ctrl-c does not kill that!
<drbrain>
hrm, but it doesn't load the current directory, so: ruby20 -rwebrick -e 'WEBrick::HTTPServer.new(DocumentRoot: ".").start'
Phrogz has joined #ruby-lang
<Phrogz>
LOL note to self: when you press ctrl-z to kill drbrain's evil process, do not then mistype sudo kill 1 in an attempt to kill the job.
<drbrain>
Phrogz: yeah, but that's not really part of serving web pages now, is it?
headius has joined #ruby-lang
<Phrogz>
I mean...it's effective and all.
<drbrain>
Phrogz: LOL
<Phrogz>
drbrain: No, but it is part of quickly serving, stopping serving, and moving to another directory to serve from there.
Tukeke has quit ["Hackers and Proletarians of the World! Unite!"]
imperator has joined #ruby-lang
ericmuyser has joined #ruby-lang
<drbrain>
Phrogz: that's why I have ~/bin/webrick
bryancp has joined #ruby-lang
jalljo_ has joined #ruby-lang
ramonmaruko has joined #ruby-lang
phlipper has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
igotnolegs has joined #ruby-lang
gregmore_ has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
<shevy>
is anyone of you using ruby statically or is that possible? I seem to not have managed to compile ruby statically yet
<drbrain>
shevy: it's possible
<drbrain>
shevy: I have /usr/local/lib/libruby.1.9.1-static.a
<shevy>
cool, okies
<drbrain>
shevy: I think the static lib gets built by default
<drbrain>
there's ./configure --enable-shared to force building of the shared library
<shevy>
hmm is http://bugs.ruby-lang.org/projects/ruby/issues/new working for you? I want to report an issue but it tells me "No tracker is associated to this project. Please check the Project settings."
<drbrain>
I'm not sure how you move stuff to the ruby tracker
<drbrain>
I think it has to start on ruby-trunk
Indian has joined #ruby-lang
dr0id has joined #ruby-lang
Phrogz has joined #ruby-lang
_santana has joined #ruby-lang
rippa has joined #ruby-lang
gnufied has joined #ruby-lang
Heimidal has joined #ruby-lang
Teddy2steper has joined #ruby-lang
QoQOoO has joined #ruby-lang
ericmuyser has joined #ruby-lang
burns180_ has joined #ruby-lang
_santana has joined #ruby-lang
Heimidal has joined #ruby-lang
wyhaines has joined #ruby-lang
gaivs has joined #ruby-lang
crudson has quit [#ruby-lang]
Technodrome has joined #ruby-lang
<Technodrome>
i have something made for ruby 1.8 ….i would like to use it …i only have ruby 1.9.3 installed …how much will i probably have to change here ?
<erikh>
usually not much
<erikh>
but if you're new to ruby, it's not for the weary
<Technodrome>
i mean i'm not new but i'm not super experienced either
<imperator>
run your tests with 1.9, see what happens
<erikh>
^
<Technodrome>
my tests?
<imperator>
YES, YOUR TESTS
<Technodrome>
I did not write any tests, I didn't even create this
<erikh>
ok; do they have any tests?
<Technodrome>
I'm not sure
<Technodrome>
this is quite old
<Technodrome>
2003-2004
<erikh>
yeah. not sure what to tell you then
<erikh>
maybe start writing some
<imperator>
does it have tests?
<Technodrome>
i will just try it and see what happens
<Technodrome>
i do not see any no
<imperator>
may we ask what it is?
<Technodrome>
sure
<Technodrome>
its a web framework called cgikit
<erikh>
hrm
<erikh>
what's the attraction to such old code? legacy app @ work?
<Technodrome>
a very unique web framework
<Technodrome>
its a change erikh
<Technodrome>
erikh: do you remember apples web objects?
<erikh>
not fondly
<Technodrome>
hard to explain then
* imperator
thinks he remembers someone giving a talk on it a long time ago
<erikh>
dunno. unless you're willing to maintain that software, you're basically screwing yourself
<Technodrome>
all web frameworks are the same these days ….mvc rails style or super minimal sinatra
<erikh>
try sinatra or rails or roll something atop rack
<erikh>
or ramaze.
<Technodrome>
ramaze is ok but
<Technodrome>
same thing
<Technodrome>
cgikit is different and still innovative in my opinion
<shevy>
well rails is significantly larger
<erikh>
well, look. let's be pragmatic about this
<shevy>
it even cooks tea
<erikh>
you're going to be maintaining two things
<erikh>
this cgikit and your application.
<erikh>
if you're willing to do that, that's great, but be aware of what you're in for.
<Technodrome>
its a fairly small code base
<Technodrome>
i could get it running on rack as well
<erikh>
for a lot of good reasons I'd consider ... right
<erikh>
that's exactly what i was going to suggest.
<shevy>
2004/4/15: 1.2.0 released.
<shevy>
cgikit!
<shevy>
8 years!
<Technodrome>
before even webrick
<Technodrome>
and still there is no other component based ruby frameworks :)
<shevy>
Technodrome will you takeover cgikit and move it to github? :)
<Technodrome>
i believe so yes
<erikh>
honestly, I'd think about this a bit more if I were you
<erikh>
but I don't want to beat a dead horse.
<shevy>
cool
<Technodrome>
you must understand I'm bored to death with web dev right now
<erikh>
I was too
<erikh>
that's why I don't do it anymore.
<Technodrome>
rails ramaze even sinatra all the same thing
<shevy>
hehe
<shevy>
true
<imperator>
erikh, you don't?
<shevy>
well
<shevy>
more or less true
<Technodrome>
erikh: yes ….but cgikit is different, its like webobjects
<erikh>
imperator: nope i'm a devops guy these days
<drbrain>
erikh: I imagine the only thing that would break for code written for ruby 1.6/1.8 is the handling of String#each
<erikh>
it honestly a lot closer to my mindset than web dev ever was.
<Technodrome>
i have never saw so many brain dead frameworks …..any time i see a new framework i can almost bet its a rails clone
<erikh>
drbrain: Enumerable with hashes
<erikh>
Technodrome: totally not discouraging you. just asking you to think about it before you dive in head first
brownies has joined #ruby-lang
<drbrain>
Enumerable wasn't quite so useful back in the olden days, so you'll see much fewer uses of it
io_syl has joined #ruby-lang
<erikh>
I've taken over my fair share of dead code and it was a painful exercise.
<Technodrome>
erikh: if it was some huge web framework then of course i would think about it ….but it gives me interest in web dev
<erikh>
drbrain: fair enough.
<imperator>
drbrain, this reminds me, what's the state of Borges these days?
<drbrain>
imperator: abandoned
<drbrain>
imperator: also, callcc is largely abandoned in ruby, too
<imperator>
ah
<Technodrome>
erikh: if you would like to see another way of doing things and don't mind a bit of change in mind set on web dev, its a good way
<imperator>
hm, i guess i was thinking of patrick may's talk on narf
<drbrain>
you must require 'continuation' to get it, and there are many people reporting bugs when using it
<erikh>
honestly, for my needs sinatra is usually overkill
<drbrain>
ah, narf!
<drbrain>
bedtime for me
<erikh>
later.
<imperator>
g'night
<Technodrome>
erikh: ever use any compoenent based framework?
<erikh>
not sure
<erikh>
I'm not really interested in web dev anymore
<rippa>
so, you can't say that strabismus is not lazy eye
<erikh>
guys
<rippa>
because lazy eye refers to both
<erikh>
can we argue about whether batman or wolverine would win in an epic battle now?
<rippa>
no
<rippa>
batman would win if he was given time to prepare
<erikh>
lies.
<rippa>
and he always has time to prepare
<rippa>
but jackie chan would beat them both on a ladder factory
<erikh>
heheheheh
sora_h has joined #ruby-lang
<erikh>
<3 you.
<Technodrome>
rippa: lazy eye is when the power of the eye is lower than the other …strabismus is a muscle condition …the eye itself vision is not lazy , it can be , but you can have strabismus and have perfect vision in that eye
<apeiros_>
woah, the usual Thread.new do i += 1 end example for race conditions no longer works in ruby…
<apeiros_>
had to use something more complex than a simple +1 to get the race condition to show…
<rippa>
I thought GIL prevents that sort of thing
<apeiros_>
gil has nothing to do with that
<workmad3>
rippa: GIL doesn't stop pre-emptive context switches, it just means only one thread is ever active in the interpreter at once
<apeiros_>
the problem is that either scheduling changed, leaving a large enough slice for i += 1 to become pseudo-atomic, or that it has simply become too fast compared to the rest
<workmad3>
apeiros_: I take it that += definitely hasn't become an atomic op?
<apeiros_>
I had tried it with i = i + 1, and that already didn't work. I'd bet my money on scheduling change.
<workmad3>
monkey-patch Integer + so that it sleeps for a second before doing the addition? :)
roadkith has joined #ruby-lang
<apeiros_>
I use i = Math.sqrt(i**2).round + 1
<apeiros_>
so I still do effectively i+1, but it "burns" more time doing so
<workmad3>
that works too :)
<apeiros_>
but even with that, I still need to do more than 100K iterations for the problem to show :)
rue has joined #ruby-lang
<workmad3>
apeiros_: that makes it a perfect example IMO :)
<dominikh>
so, your race condition has a race condition now? :P
roadkith has joined #ruby-lang
<apeiros_>
my race condition had a race condition before already, ruby was just too lazy to let it show ;-)
<workmad3>
apeiros_: maybe you just needed to run it more times...
francisfish has joined #ruby-lang
<rippa>
i+=1 works for me
<rippa>
almost always returns 0
<rippa>
somehow
<rippa>
why does it return 0?
<workmad3>
i = -1; i += 1 #=> 0
fragmachine has joined #ruby-lang
<apeiros_>
not -= 1?
machine2 has joined #ruby-lang
kitallis has joined #ruby-lang
<fragmachine>
Hello I'm trying to solve some problems on Rubeque. I'm trying to write a queue class but I'm stumped on the last method. Any ideas how to get an instance of a class to retrun it's values without a method? - http://pastie.org/3646792
<injekt>
fragmachine: write the to_a method
<fragmachine>
man so obvious...
<fragmachine>
thanks haha
<apeiros_>
now I'm curious… *waits*
<injekt>
I also recommend switching arguments in your assert_equals, it's more common to use (this, that) than (that, this) and I think it's easier to read
<injekt>
ie assert_equal 5, queue.pop
<fragmachine>
ok yea that makes sense
<apeiros_>
fragmachine: you've got an answer now for a couple of minutes, and you've asked the question in another channel too… don't you think you should tell the other channel that you've got an answer?
<fragmachine>
apeiros_: Ok no worries, oops
<apeiros_>
fragmachine: I pondered whether I should ask you or just kickban you right away
<injekt>
lol
<fragmachine>
I'm not trying to upset anyone...
<injekt>
I think you got the better end of that deal
<apeiros_>
and I was --->|<---- this close to just kickban
<injekt>
wait, | would be fingers pinched
<dominikh>
injekt: "this, that"? The right term would be "expected, actual" :P
<injekt>
dominikh: this terms would be stfu
<injekt>
the
<injekt>
dammit it's too early
<dominikh>
:D
<injekt>
fragmachine: also, I dont think your push does what you think it does
<fragmachine>
doesn't it just append to the back of the array?
<injekt>
yeah, but if you feed it an array it'll push in an array, not the values inside that array (that's what #concat does)
<injekt>
that is, on line 9 you send an array to push
<injekt>
which means your queue would look something like [5,6,7,8,[4,2]]
<fragmachine>
oh that's right I forgot about that. I didn't know concat was what I was after, I was just gonna do arr.flatten!
<injekt>
:)
<injekt>
you also don't need to use slice! on line 24
<fragmachine>
how else can I grab the elements and then remove them?
<injekt>
well, you know ruby arrays have a push and pop method which work on the tail end of the array, there's also methods which work from the front of the array
<injekt>
that is, the method in question is identical to slice!(0, n)
<injekt>
in return value
<fragmachine>
ok cool, I didn't know you could do arr.shift(n)
Wardrop has joined #ruby-lang
<Wardrop>
Does anyone know if there's a way to prevent a before block running for static files? Additionally, is there a way we can prevent sessions from being loaded for static files?
<Wardrop>
I understand that a proper server like apache with phusion passenger would serve static files without touching the application, I'm just wondering if there's some way we can emulate similar behaviour on our development boxes which just run the app with Webrick.
Stalkr_ has joined #ruby-lang
<workmad3>
Wardrop: #rubyonrails
<Wardrop>
Ha? I using Sinatra (well actually Padrino)
<canton7>
Wardrop, use some rack middleware like Rack::Static maybe?
mixandgo has joined #ruby-lang
heftig has joined #ruby-lang
roadkith_ has joined #ruby-lang
roadkith has joined #ruby-lang
kitallis has joined #ruby-lang
paul0` has joined #ruby-lang
My_Hearing has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
seoaqua has joined #ruby-lang
<seoaqua>
could anyone help me to crack x-amf data of some website
havenn has joined #ruby-lang
<yorickpeterse>
what?
<seoaqua>
some encrypted flash data
<yorickpeterse>
"help me crack some encrypted flash data of some website" doesn't sound too legit