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
<shevy>
man
<shevy>
there are a lot of ` characters here
looopy has joined #ruby
llaskin has quit [#ruby]
chico`` has joined #ruby
moshee has joined #ruby
zakwilson has joined #ruby
strife25 has joined #ruby
mikepack has joined #ruby
ctwiz has joined #ruby
QaDeS_ has joined #ruby
banisterfiend has joined #ruby
bitsquad has joined #ruby
snip_it has joined #ruby
brngardner has joined #ruby
UsmanA has joined #ruby
snip_it has joined #ruby
zakwilson_ has joined #ruby
shevy has joined #ruby
igotnolegs has joined #ruby
pedm has joined #ruby
pdtpatr1ck has joined #ruby
hSATAC has joined #ruby
banisterfiend has joined #ruby
bawer has joined #ruby
looopy has joined #ruby
nif has joined #ruby
garyDemilo_afk has joined #ruby
banisterfiend has joined #ruby
pygmael has joined #ruby
jwang has joined #ruby
GitNick has joined #ruby
__main__ has joined #ruby
mbriggs has joined #ruby
alexonthemoon has joined #ruby
tommyvyo has joined #ruby
<alexonthemoon>
hey guys, I'm trying to run a pretty simple script: http://pastebin.com/fdUZD8QR ; problem is, in between line 41 & 45, it just randomly submits the form. Was wondering if anyone has had this problem
<alexonthemoon>
in general
rramsden has joined #ruby
<alexonthemoon>
any help, guys? :(
<banisterfiend>
alexonthemoon: rails?
<alexonthemoon>
banisterfiend: nope, just a ruby script
Boohbah has joined #ruby
BrianE has joined #ruby
<alexonthemoon>
banisterfiend: I'm trying to print out the keyword, council, question to a form & click submit myself
<alexonthemoon>
banisterfiend: only problem is, it's submitting the question itself right after it enters in the question, keyword & council in steps 40-43
v4n_ has joined #ruby
prometheus has joined #ruby
<GitNick>
Iam trying to build a native extension for windows. I have it working on mac, but for some reason I can't get the extconf.rb find_library call to recoganize the lib. Heres a gist: https://gist.github.com/2440705
adamkittelson has joined #ruby
mistergibson has joined #ruby
<banisterfiend>
GitNick: afaik you dont like against .dll files
<banisterfiend>
link
nif has joined #ruby
<mistergibson>
Question: with respect to file modes: is it ultimately a question of either text or binary mode? if binary is not specified, is it automagically going for a text mode variation?
Clordio has joined #ruby
<banisterfiend>
GitNick: the dll file is there to dynamically load at runtime, but iirc, you dont link against it during teh compilation process on windows
<GitNick>
banisterfiend: hmm
mrwalker has joined #ruby
<banisterfiend>
GitNick: unlike linux, it's not just a single .so that you both link against and load at runtime, there's like a two pronged approach on windows where you link against one library (i think it's a .lib but im not sure) and then at runtime you also need the .dll
<banisterfiend>
GitNick: also, i would be using $CFLAGS and $LDFLAGS to setup the load path
<GitNick>
banisterfiend: ok, that may help. I do see that in the same place as the dll, i have a .lib as well
uris has joined #ruby
<GitNick>
(you can probably tell this is my first ruby ext) :)
<banisterfiend>
GitNick: windows is a pain
<banisterfiend>
GitNick: but if u can it's best to distribute precompiled binaries as some windows users dont have devkits installed
<GitNick>
I was trying to to cross-compilation on my mac with rake-compile, but I couldn't get past compiling a windows ruby, rake-compile cross-ruby.
<banisterfiend>
GitNick: persist with that approach
<banisterfiend>
building on windows is even more of a pain
<GitNick>
banisterfiend: you really think cross compilation would be better? I wouldn't mind because then I could keep all my development on my dev machine
savage- has joined #ruby
kil0byte has joined #ruby
<banisterfiend>
GitNick: Yeah, much better. If your'e having problems with rake-compiler consider filing issues on the git repo
<banisterfiend>
or i think there's a mailing list
adamkittelson has joined #ruby
<GitNick>
banisterfiend: The compiler error I got looked like a bug in gcc
<GitNick>
banisterfiend: ok, thanks
marknyc has joined #ruby
nif has joined #ruby
fbernier has joined #ruby
banister_ has joined #ruby
pygmael has joined #ruby
SolarisBoy has quit [#ruby]
rdjenk has joined #ruby
rdjenk has quit [#ruby]
thams has joined #ruby
banister_ has joined #ruby
quest88 has joined #ruby
zakwilson has joined #ruby
sroy2_ has joined #ruby
__class__ has joined #ruby
thams has joined #ruby
radic_ has joined #ruby
<mistergibson>
Question: with respect to file modes: is it ultimately a question of either text or binary mode? if binary is not specified, is it automagically going for a text mode variation?
<banister_>
mistergibson: file modes are abstract concepts they dont really need or appreciate any respect you want to show them
ryan_dev70 has joined #ruby
<mistergibson>
banister_: it is not all that -- I want to determine the *exact* way ruby deals with it w/o inspecting the ruby source code ...
<mistergibson>
laziness mostly
<banister_>
mistergibson: what about reading ruby docs
sifue has joined #ruby
<mistergibson>
oh, right -- like I never think of that. Reading ruby docs often turns out to be like playing poker with a chinaman that can drink you under the table and never piss. YES -- it really is that vague or limited sometimes.
<mistergibson>
that is where I find the community collected wisdom or knowledge is far more comprehensive than the rather inadequate docs
<mistergibson>
I've read the docs, the class rdocs, etc ... it has information but it does not characterize certain things
<shevy>
I think 90% of the time folks will use only w, w+, a or a+
<shevy>
hmm
<shevy>
perhaps even the + versions 90%. I cant remember when I last used the non + variants
<mistergibson>
shevy: I wonder then, what is the diff between 'r' on linux, and 'br' on winderz?
youdonotexist has joined #ruby
<mistergibson>
the appear to be the same
<shevy>
No idea. I don't really use it. You want to read in a file? I usually just call File.readlines('bla.txt')
ctwiz has joined #ruby
<heftig>
you should really use "b" when writing or reading binary data
<heftig>
since ruby 1.9 it also sets the encoding to binary
<mistergibson>
heftig: even on linux?
<heftig>
yes.
<mistergibson>
heftig: ok, that actually makes me feel better
<mistergibson>
shevy, heftig: thanks for your help on clarification -- I got it now :)
zakwilson has joined #ruby
pygmael has joined #ruby
Crazyglue has joined #ruby
<shevy>
heftig is the 300 pounds ruby gorilla
<shevy>
when it comes to ruby, he breaks it and knows it
<mistergibson>
nice
<shevy>
even zenspiders shuts up when heftig talks
<heftig>
i'm not that good :p
<mistergibson>
heftig: if no 'b' is specified, will the 'r' also silently imply or use 't' ?
<heftig>
no b means text mode
<mistergibson>
heftig: I understand
<shevy>
mistergibson, I am surprised file modes keep you fascinated for so long ;)
<mistergibson>
shevy: I'm odd that way
<mistergibson>
shevy: I started in computers when a seller's manual actually included the phase latch specs in the docs ... I've been like that ever since.
ctwiz has joined #ruby
Crazyglue has quit [#ruby]
kaneda has joined #ruby
rushed has joined #ruby
dv310p3r has joined #ruby
looopy has joined #ruby
TheIronWolf has joined #ruby
luckyruby has joined #ruby
andrewhl has joined #ruby
ringotwo has joined #ruby
<shevy>
I only want to create cool things and if I can get away knowing only the absolute minimum in order to achieve that then I'll never learn more than exactly that
<mensa180>
Hello, what would be a good gui for creating a sudoku game in ruby?
<mensa180>
Something where it would display a grid, don't care if I have to photoshop the board or whatever, and can just type in their numbers in each cell.
<banisterfiend>
mensa180: gosu
<mensa180>
thanks I will look at that.
<mensa180>
curious: would something like shoe or rubygame work?
moshee has joined #ruby
moshee has joined #ruby
<mistergibson>
banisterfiend: how does gosu compare to wxwidgets? ever compare the two?
<banisterfiend>
mistergibson: gosu is not a GUI toolkit, it's a game programming library
<rking>
Hrm. What's the Ruby equivalent of perldoc perlre?
<rking>
I've been using random Google searches, and that works to some extent, but I'm sure there is some official doc thing on the CLI.
<rking>
Hrm. Maybe there's a gem or something I need to install. (BTW, I don't only mean the docs on Ruby REs, that's only an example. Basically I'm wondering if there's a doc system on the language itself.)
deobald has joined #ruby
johnste has joined #ruby
tk___ has joined #ruby
<banisterfiend>
rking: i like to use pry, personally :) it shows me both docs and source code :D
<rking>
banisterfiend: Yes, but like.. I was wondering how to backref named captures. I found it easily enough on a Stackoverflow post after a Google search, but what it means is there is more regex syntax I don't know.
<rking>
banisterfiend: A guy can spend a week in perldoc perlre. I want to be spending a week on Ruby stuffs. =(
* rking
does <3 pry.
<banisterfiend>
rking: oh, there is a website for learning regex in ruby
<Sou|cutter>
banisterfiend: I have an irbrc helper that prints docs for me
<Sou|cutter>
but yeah, pry is awesome
<banisterfiend>
rking: rubular.com i think
<rking>
banisterfiend: Ok, hrm. Well, I'd like that site, but this is a general pattern. Another one was using & to procify - I saw an example that did arr.map &:to_s and I realized I had forgotten that syntax.
<rking>
Basically, I am getting better at navigating the class docs, but the language stuff is still a disorganized mess of Google searching for me.
<banisterfiend>
rking: are you saying the stdlib/core docs are incomplete?
<rking>
banisterfiend: Yeah, I like rubular.com. I actually am making a Vim script to be like that but inside vim.
<banisterfiend>
cos they are really
<banisterfiend>
rking: i recommend getting a book
<banisterfiend>
rking: "the ruby programming language" is pretty great
<rking>
banisterfiend: OK, that's fair enough.
<banisterfiend>
Sou|cutter: how does your irbrc helper work ? (curious)
<eam>
how do I call Kernel.exec and guarantee I bypass the shell? I may have a command without arguments
<rking>
banisterfiend: The O'Reilly one?
<banisterfiend>
rking: yeah
<Sou|cutter>
banisterfiend: one sec, I will gist it
<rking>
k, thanks.
<rking>
eam: I'm pretty sure exec always bypasses the shell.. what are you trying to do?
<eam>
Kernel.exec is like the perl CORE::exec in that it runs a shell if given one arg (and does not if given >1)
<rking>
BTW if you want a puzzler do: gem search --remote my_string # (The answer is that someone used "my_string_extend" as an example in a blog post of how to make gems.
<rking>
)
<Sou|cutter>
ignore the local_methods method
<eam>
but I can't find a way to bypass this behavior for a single-arg command
<Sou|cutter>
banisterfiend: as you can see it just calls 'ri'
<rking>
eam: Oh, yes, you're totally right. Hrm.
<banisterfiend>
Sou|cutter: ah ok. problem with 'ri' is you need to always generate docs when gems install, or generate them later, which takes ages and is kinda annoying IMO
<Sou|cutter>
yup
<Sou|cutter>
that is an issue
<Sou|cutter>
pry is better than irb 100%
<eam>
in perl I can exec { "argv0" } @argv
<eam>
but I don't see a way to get that behavior from ruby
<banisterfiend>
Sou|cutter: we finally added support for show-doc to show class docs (and show-source to show class code too). So hopefully it's just as powerul (but a lot faster) than ri now
<rking>
eam: Is sanitizing the string an option?
<rking>
eam: Or.. passing a dummy arg? =\
<eam>
I'd really rather not, there are corner cases with things like bash functions that can't be avoided
<eam>
and I don't know which programs will be run, this is a generic pass-through thing
<eam>
do I need to implement my own version of exec()?
<rking>
eam: I doubt it.
<rking>
eam: This is a common sounding problem.
<Sou|cutter>
banisterfiend: you work on pry?
<banisterfiend>
Sou|cutter: i started the project :)
<Sou|cutter>
oh, forgive my ignorance :) it's a great project!
<Sou|cutter>
you put my humble sax parsing gem to shame :P
<rking>
banisterfiend: Is there any way to follow the C code down? E.g., if I do $ exec I see that it calls rb_exec_arg_addopt(), at that point do I need to use vim on a source tree?
Hsparks has joined #ruby
<eam>
rking: how do you see that?
<rking>
eam: pry
<rking>
eam: gem install pry then you can do "? something" to see the docs, like "? [].sort" to see Array#sort docs, or "$ something" to see the source. If you also "gem install pry-doc" it goes into the C.
<rking>
eam: But I think you have to follow-on with "vim -t"
<eam>
rad thanks
<rking>
...which actually would be a decent .pryrc thing. Make it "cd ~/wherever/ruby/is/; vim -t #{the_func}"
<rking>
(assumes you have the Ruby source tree unpacked into ~/pkg/ruby/, and that you've run 'ctags -R' from the top level)
<banisterfiend>
rking: not bad, but not everyone wants to use vim. But yeah our solution would use CTAGS 4 sure
<rking>
banisterfiend: I think something that resolves along the lines of ${VISUAL:-${EDITOR:-vim}} is good, though then you'll have to figure out the args for the result (vim is -t, and I didn't see an easy command-line way with emacs, but it's probably like -e "(etags-fooey '$1')")
drake10 has joined #ruby
<rking>
So yeah, maybe it's better to keep it all inside the pry CLI.
<pdtpatr1ck>
Could you guys please recommend some good quality Ruby tutorial videos/screencasts. Paid or unpaid - i just care about quality. Thanks
fukushima has joined #ruby
<mensa180>
Hi guys, I'm having trouble finding good ruby tk documentation. http://codepad.org/98WgbiUx -- How would I make it so that entering a value into any of those entry widgets procs a command? Goal: enter a number and a label updates telling whether or not you won/ had a correct value (tbd), the game is sudoku. also is there a better method of setting up the grid?
GitNick has joined #ruby
<GitNick>
has anyone recently compiled a cross ruby (post 1.9) for windows on mac 10.7 using rake-compiler?
<mensa180>
Hi guys, I'm having trouble finding good ruby tk documentation. http://codepad.org/98WgbiUx -- How would I make it so that entering a value into any of those entry widgets procs a command? Goal: enter a number and a label updates telling whether or not you won/ had a correct value (tbd), the game is sudoku. also is there a better method of setting up the grid?
<matled>
rking, banisterfiend: vim and emacs work with $EDITOR +12 some-file to start editing in line 12
<rking>
matled: So... do the tags file lookup externally somehow?
<matled>
rking: I dunno, I don't even understand what you were talking about, I just thought you were looking for a way to start an editor at a certain position independent of the editor
<rking>
...which wouldn't be 100% trivial, since a tags file is actually a list of patterns to match, not a list of line numbers.
cwill747 has joined #ruby
<rking>
matled: Close, but no. At a certain tag. Emacs has "etags" IIRC.
<mensa180>
Hi guys, I'm having trouble finding good ruby tk documentation. http://codepad.org/98WgbiUx -- How would I make it so that entering a value into any of those entry widgets procs a command? Goal: enter a number and a label updates telling whether or not you won/ had a correct value (tbd), the game is sudoku. also is there a better method of setting up the grid?
<mensa180>
And if there is a better toolkit or gui to use with ruby than tk for my project please point me towards it, because this is miserable.
<Aristata>
mensa180: I have no idea, but I can tell you that code could be about 1/8th the size if you did a loop
platzhirsch has quit [#ruby]
platzhirsch has joined #ruby
<mensa180>
I would be incredibly grateful if you told me how precisely, I don't know how to define multiple variables in looping process.
<vatzec>
Hi. :) I have a website in Ruby and it uses bcrypt passwords (I think). How do I generate a bcrypt password hash outside of Ruby?
<vatzec>
... so that I can put it in a mysql db?
<vatzec>
(I'm not a Ruby programmer and I'm modifying somebody else's script)
<GitNick>
trying to compile a windows binary. But I keep getting errors saying "error: expected ‘;’, ‘,’ or ‘)’ before ‘-’ token" from in the ruby.h. They started appearing after my last attempt to compile against a .def/.dll
<MarcWeber>
How can I dynamically create a class Module.Classname ? something like Module["Classname"].new ?
<banisterfiend>
MarcWeber: what does Module.Classnam mean
<banisterfiend>
MarcWeber: you mean MyModule::MyClass ?
<banisterfiend>
MarcWeber: like this: MyModule.const_set :MyClass, Class.new { def hello; end }
<GitNick>
banisterfiend: I got a cross-ruby installed on my mac, but now I get errors from inside ruby.h. I tried adding a $CFLAGS line with --def and -I flags, no cigar.
<MarcWeber>
yes I meant ::
<MarcWeber>
I'll assign the class instance to the option, not its name. Then it'll work as well.
Gadgetoid has joined #ruby
driftcrow has joined #ruby
bawer has joined #ruby
Indian has joined #ruby
ukd1 has joined #ruby
ukd1_ has joined #ruby
gmci has joined #ruby
ukd1 has joined #ruby
Mon_Ouie has joined #ruby
changedNicks has joined #ruby
Beoran__ has joined #ruby
ChampS666 has joined #ruby
ananthakumaran1 has joined #ruby
mrwalker has joined #ruby
KL-7 has joined #ruby
LMolr has joined #ruby
ephemerian has joined #ruby
replore_ has joined #ruby
schovi has joined #ruby
mdw has joined #ruby
russel_brand has joined #ruby
<Kovensky>
hmm
visof has joined #ruby
ahmd has joined #ruby
<Kovensky>
what exactly is an iterator in ruby
<Kovensky>
for instance, String#chars docs say that it either yields each character to an associated block or "returns an iterator" if there is none
<Kovensky>
err
<Kovensky>
enumerator
justinmcp has joined #ruby
nikhil_ has joined #ruby
<burgestrand>
Kovensky: it’s just a regular object
<nyuszika7h>
When I tried to pastebin the file, I realized it had a different name
dv310p3r has joined #ruby
pac1 has joined #ruby
Clordio has joined #ruby
<nyuszika7h>
I wanted to make a program that calculates the factorial of a number and ended up in making one that calculates the Fibonacci value, and of course the library file was saved as factorial.rb :P
<niklasb_>
nyuszika7h: :D
abra has joined #ruby
<nyuszika7h>
And I did require 'fibonacci.rb' which didn't exist
<shevy>
I always tell people that they must decide on their own
<polishguy94>
i am having problems with ajax post requests
<shevy>
either they use [insert distribution here], or they don't. but if they use the distribution, they must solve distribution-specific packages on their own
<polishguy94>
there are pasted only relevant pieces of code
<banseljaj>
"The Power is Yours"
<shevy>
*problems, not packages
<canton7>
polishguy94, it lokos like a datamapper issue, not an ajax one
<banseljaj>
I like managing ruby with rvm
<polishguy94>
so there's is no mistake of mine?
<waxjar>
rbenv :3
<banseljaj>
cuz distro specific gems and libraries are too old
<niklasb>
banseljaj: then you're out of the reach of the package manager anyway
<banseljaj>
Which is how i want everything to stay.
<banseljaj>
I was just wondering why there are gem haters
<banseljaj>
Maybe they should bundle rvm with next ruby release. :D
<shevy>
no
<shevy>
I dont want to be forced to use rvm
<shevy>
I use ruby from the sources always
<niklasb>
shevy: "bundle" would mean to add a single shell script
<niklasb>
I don't think that's too intrusive
<shevy>
I hate shell scripts
<banseljaj>
rvm compiles from sources
<shevy>
banseljaj and i do too!
<niklasb>
shevy: ah ha.
<polishguy94>
Any users of OpenShift?
<waxjar>
doesn't rvm do some nasty stuff to cd or something?
mpereira has joined #ruby
<banseljaj>
shevy: did shell scripts ever touch you in a place that made you uncomfortable?
<shevy>
all my rubies go into /Programs/Ruby/VERSION_HERE
<shevy>
banseljaj not anymore, I kill them when I see them :)
<banseljaj>
:D
<niklasb>
polishguy94: I tried it once
<shevy>
but most of the time when I spend my time trying to understand shell scripts written by others
<banseljaj>
shevy: that is a good solution, if inelegant
<shevy>
I find shell scripts to be a true abomination
<polishguy94>
niklasb: what do you think?
<shevy>
the more ruby I can use, the better
* banseljaj
thinks he shouldn't mention writing shell scripts
<niklasb>
polishguy94: it's nice
<shevy>
what is the default compile --prefix target for rvm? into $HOME?
darthdeus has joined #ruby
<banseljaj>
shevy: $HOME/.rvm
<niklasb>
shevy: i think it shuffles everything into ~/.rvm
<shevy>
ok
<polishguy94>
so why you aren't using it now?
<shevy>
never heard of OpenShift
<niklasb>
polishguy94: because I have no app I could deploy :)
<niklasb>
shevy: free web app hosting
<banseljaj>
niklasb: what do they support?
<polishguy94>
everything
<polishguy94>
you are given a shell access
<banseljaj>
I only knew about Heroku and EnYa
<niklasb>
banseljaj: you oculd.. visit their website :)
<polishguy94>
but no superuser
<banseljaj>
I am. I wanted a faster answer. :P
<polishguy94>
It means you can deploy even Meteor apps
<niklasb>
banseljaj: the most popular stuff
<niklasb>
no haskell, unfortunately :(
<banseljaj>
A friend of mine is trying to create a Haskell app hosting thingie
nerdy has joined #ruby
<banseljaj>
I am pushing him to use ruby to create it :3
<banseljaj>
<------Scumbag banseljaj
HashNuke has joined #ruby
<niklasb>
banseljaj: that doesn't sound sensible.
<polishguy94>
i've got a rvm on my account :>
<shevy>
haskell is scary
<banseljaj>
shevy: in start, yes.
<waxjar>
haskell seems like a really cool language
<polishguy94>
it's as scary as erlang :D
<niklasb>
oh no, we had that before
<banseljaj>
But I'm trying to get into it
<shevy>
I always ask haskell guys to explain why a monad is needed in one sentence
<banseljaj>
My third try
Drewch has joined #ruby
<banseljaj>
shevy: I think that's unreasonable
<niklasb>
shevy: it's only "needed" if you don't have side effects
<niklasb>
which isn't the case anywhere else
<banseljaj>
FP is very different from OOP
<polishguy94>
no shit :D
<banseljaj>
So you can't hold them to the same standards
<polishguy94>
what was your first programming language?
<shevy>
BASIC
dql has joined #ruby
<niklasb>
Visual Basic
<waxjar>
php :(
<polishguy94>
javascript
<banseljaj>
BASIC
* banseljaj
shuns waxjar
<banseljaj>
You are not one of us!
<banseljaj>
:P
<polishguy94>
when i was 11 i asked my mother to buy me a PHP book and she did
ikaros has joined #ruby
<polishguy94>
luckily It wasn't appealing to me enough to start coding
<banseljaj>
I have sworn off php
thams has joined #ruby
<banseljaj>
And now i have a project for WP. :(
<shevy>
I came from PHP too
<banseljaj>
PHP sucks.
<banseljaj>
:(
<banseljaj>
Makes me cry
<shevy>
yeah but you can get results in your browser
<shevy>
that somehow helps
<shevy>
rails always felt so much more complicated
<shevy>
that alone I have to understand all those terms used... what is a controller, why do I need it
<shevy>
and this embedded ruby thingy... erb or what's its name, is so ugly
<waxjar>
ruby has a steep learning curve compared to php
<shevy>
yeah
<niklasb>
shevy: rails *is* complicated compared to other web frameworks
<niklasb>
not only PHP ones
<banseljaj>
I prefer a steep learning curve to uniform complexity
<polishguy94>
there's so much magic behind the rails
<banseljaj>
Also, use sinatra
<banseljaj>
if you don't like rails
<polishguy94>
sinatra inhertis the compliacation of Rack
<banseljaj>
or django. :P
<waxjar>
cuba seems like a really interesting alternative to sinatra
<waxjar>
really tiny, apparently really fast too
<banseljaj>
polishguy94: Sinatra has a big rack, you mean to say?
bluOxigen has joined #ruby
<banseljaj>
Don't you have to worry about fidel, in cuba?
<davidcelis>
any-key: it sounds like he still wants the other values as well
<n00by>
davidboy, aaah... thanx
<n00by>
davidcelis, yeah, just a sec, I'll put smth on pastie
nif has joined #ruby
<n00by>
nah, screw pastie, this is utterly simple
<n00by>
e.g. I have this foo = { a: 6, b: 35, c: 'foo' }
<n00by>
and I want to get this foo = { a: 6, b: 35, c: 0 }
ephemerian has joined #ruby
<any-key>
map
<n00by>
any-key, I'm already using map
grin has joined #ruby
<any-key>
then what's the issue?
andrewhl has joined #ruby
<n00by>
aaah, okay, I wasn't wrapping it in Hash
<n00by>
=)
<n00by>
thanx davidcelis, any-key
bondar has joined #ruby
<arturaz>
n00by, or you could use #each_with_object
<Mon_Ouie>
Or you could just use #[]=
<Mon_Ouie>
There's no reason to explicitly iterate over the whole array
<Mon_Ouie>
hash*
sorin has joined #ruby
<sorin>
Hi.
<sorin>
Does RVM screw up the Zsh $PROMPT for anyone else?
v4n_ has joined #ruby
johnloy_ has joined #ruby
Vainoharhainen has joined #ruby
Vainoharhainen has joined #ruby
Poapfel has joined #ruby
Poapfel has joined #ruby
francisfish has joined #ruby
<Mon_Ouie>
How does it "screw it up"?
Bosma has joined #ruby
bluenemo has joined #ruby
looopy has joined #ruby
ryan0x2 has joined #ruby
luckyruby has joined #ruby
ananthakumaran has joined #ruby
<shevy>
sorin no idea. I always compile from source, everything, with ruby scripts (in case of bootstrapping ruby, it's a shell script). I'd not want to spend time to understand in what ways RVM messes up my system, I'd simply not use it.
<mmajchrzak>
How I can make Math.sqrt on a really big number ?
Jake232 has joined #ruby
jgrevich has joined #ruby
jgrevich has joined #ruby
<rippa>
mmajchrzak: огые вщ ше
<rippa>
*just do it
waxjar has joined #ruby
kjellski_ has joined #ruby
__main__ has joined #ruby
madsgraphics has joined #ruby
John_P has joined #ruby
sorin has quit [#ruby]
mucker_ has joined #ruby
Azure has joined #ruby
<shevy>
cool
<shevy>
I tried to get a huge number into it
<shevy>
(irb):7: warning: Bignum out of Float range # => Infinity
<shevy>
I reached Infinity
<shevy>
twice :)
<Mon_Ouie>
BigDecimal#sqrt allows to get the square root of arbitrarily large (or small) numbers
ukd1 has joined #ruby
Ttech2 has joined #ruby
<mmajchrzak>
Using bigDecimal on a small numbers makes ruby slower?
mucker_ has joined #ruby
<shevy>
mmajchrzak very slow
<shevy>
so slow that you can't use it anymore
<shevy>
enter C
<shevy>
bye mmajchrzak!
<Mon_Ouie>
BigDecimal will definitely be slower than floats, but sometimes you need such precision
mucker_ has joined #ruby
mucker has joined #ruby
ctwiz has joined #ruby
emsilva has joined #ruby
nemesit has joined #ruby
monokrome has joined #ruby
Azure_ has joined #ruby
affix has joined #ruby
Valkyrie^ has joined #ruby
mdw has joined #ruby
btaitelb has joined #ruby
Clordio has joined #ruby
pen has joined #ruby
Indian has joined #ruby
pdtpatr1ck has joined #ruby
mucker has joined #ruby
mcwise has joined #ruby
Russell^^ has joined #ruby
alem0lars has joined #ruby
tommyvyo has joined #ruby
zakwilson has joined #ruby
Progster has joined #ruby
mborromeo has joined #ruby
mucker has joined #ruby
jmcphers_ has joined #ruby
Bauer1 has joined #ruby
agilobab1e has joined #ruby
dbgster_ has joined #ruby
tdubellz has joined #ruby
tdubz has joined #ruby
somnium has joined #ruby
exoa has joined #ruby
ukd1_ has joined #ruby
ex0a has joined #ruby
cb_ has joined #ruby
Evixion` has joined #ruby
classix_ has joined #ruby
dubellz has joined #ruby
multi_io_ has joined #ruby
warebec|1at has joined #ruby
phreax_ has joined #ruby
filier has joined #ruby
tomb_ has joined #ruby
zmoazeni_ has joined #ruby
__null has joined #ruby
Xylo1 has joined #ruby
wwkeyboard has joined #ruby
__null has joined #ruby
fr0gprince_mac has joined #ruby
Russell^^_ has joined #ruby
araujo_ has joined #ruby
__null has joined #ruby
daveecee has joined #ruby
__null has joined #ruby
_main_ has joined #ruby
Russell^^_ has joined #ruby
starburst has joined #ruby
__null has joined #ruby
__null has joined #ruby
davidcelis has joined #ruby
mucker has joined #ruby
peterhil has joined #ruby
moted has joined #ruby
pdtpatr1ck has joined #ruby
Mon_Ouie has joined #ruby
mucker has joined #ruby
d3c has joined #ruby
machine1 has joined #ruby
dubellz has joined #ruby
rramsden has joined #ruby
DarthGandalf has joined #ruby
ezra has joined #ruby
twinturbo has joined #ruby
peterhil` has joined #ruby
machine2 has joined #ruby
Synthead has joined #ruby
k_89 has joined #ruby
kanzure has quit [#ruby]
FACEFOX-DOT-COM has joined #ruby
<k_89>
hey ... a noob question whats :: in ruby??
Notimik has joined #ruby
<shevy>
k_89 scope operator
<shevy>
module Foo; class Bar; end; end; x = Foo::Bar.new
<k_89>
ok , thanks a lot
<shevy>
you see that Bar resides within module
<k_89>
yeah
dubellz has joined #ruby
<k_89>
i tried something like this in irb module A; def fn: 1+1; end end
<k_89>
i wasn't able to access fn like A::fn
<k_89>
i had to include A and then call fn
<k_89>
to get that
<k_89>
2
eph3meral has joined #ruby
snip_it has joined #ruby
<rippa>
k_89: def self.fn
<k_89>
oh
dubellz has joined #ruby
<k_89>
so that means because of what i had done, i had defined a function which exists in the scope of that module, but is not really a part of that module, right??
xpot-mobile has joined #ruby
n1x has joined #ruby
seungers has joined #ruby
<k_89>
cool, reopen classes and modules
giftfrosch has joined #ruby
<rippa>
k_89: you defined instance method
luckyruby has joined #ruby
<k_89>
a module also has an instance??
<k_89>
rippa, can you explain a little more
<rippa>
if you include a module in a class
jimeh has joined #ruby
FACEFOX has joined #ruby
<rippa>
module's instance methods become classes'
<k_89>
ok,
snearch has joined #ruby
<k_89>
trying out a few more stuff in irb to get this whole module thing
kidoz has joined #ruby
nilg has joined #ruby
<k_89>
whats an instance of a module ... does including a module means creating its instance ??
jhunter has joined #ruby
<k_89>
also ... can i call an instance method of a module from a module's method?
loyboy has joined #ruby
dubellz has joined #ruby
<shevy>
you cant instantiate a module
<shevy>
they are like crippled classes
sguy has joined #ruby
nerdy has joined #ruby
<davidpk>
i have an alist and i want to change it to a hash. how do I do that?
<shevy>
what is an alist?
<davidpk>
association list
<davidpk>
eg
<davidpk>
[[key1, val1], [key2, val2]]
<davidpk>
which should become {key1 => val1, key2 => val2}
<k_89>
shevy, is the concept of modules similar to the concept of abstract classes in other langs??
<yxhuvud>
Hash[*alist.flatten(1)]
<k_89>
it seems a lot like that
Cache_Money has joined #ruby
<shevy>
k_89 I have no idea what abstract classes are. for me, modules are crippled classes
affix has joined #ruby
<davidpk>
yxhuvud: thanks!
<k_89>
shevy, abstract classes in java and php are classes which cannot be instantiated, however can have static methods/properties and can be inherited by other non-abstract or abstract classes
mucker has joined #ruby
<shevy>
somewhat similar
<shevy>
you cant inherit from a module however
<shevy>
you can mixin its functionality
<k_89>
yeah .. the mixin thing is unique to ruby i think
<sguy>
Can someone point me to a tut that tells how to write ruby wrappers for perl code ?
<shevy>
ewww
dubellz has joined #ruby
kevinbond has joined #ruby
khakimov has joined #ruby
mistergibson has joined #ruby
<Tasser>
sguy, huh?
nobitanobi has joined #ruby
nobitanobi has joined #ruby
<sguy>
I have a perl library that I'd like to use with ruby
octobrainz has joined #ruby
justinmcp has joined #ruby
giftfrosch has joined #ruby
giftfrosch has joined #ruby
giftfrosch has joined #ruby
<banseljaj>
sguy: o.o
<banseljaj>
ewwww
tijmencc has joined #ruby
nobitanobi has joined #ruby
<sguy>
haha, I didn't write it and I intend to port it but right now I don't have the time
Carlito__ has joined #ruby
Carlito__ has quit [#ruby]
<banseljaj>
shevy: what would be a great way to squash two arrays into a hash?
Paradox2000 has joined #ruby
Paradox2000 has joined #ruby
<banseljaj>
making one array the key ans the other value?
nielsk has joined #ruby
<nielsk>
hi
<nielsk>
I'm using only the xcode-command line tools on OS X (no xcode installed) and when I want to install some gems I get the error-message that no xcode-folder is set. What can I do?
igotnolegs has joined #ruby
adamkittelson has joined #ruby
<Tasser>
banseljaj, #zip
<banseljaj>
Tasser: that returns an Array of Arrays
<platzhirsch>
darkf: though not sure how to do it with reduce, with inject I could do: arr.inject { |sum, n| sum + n ** 2 } but how to add the the square?
EddieS has joined #ruby
<y3di>
darkf: I'm completely new to json? how do you convert stuff to json? i got the json gem, is it just json.generate(data)> #this is what I'm going to try
QKO has joined #ruby
wereHams1er has joined #ruby
mpereira1 has joined #ruby
<y3di>
also, i'm getting a weird undefined method '-' error
<shevy>
platzhirsch take the .inject example I gave, but I think, reduce is an alias to injekt
<shevy>
*inject
<y3di>
does ruby not have subtract...?
<shevy>
y3di, pls dont be silly :P
<y3di>
oh nvm i have to convert the int from a string lol =p
_main_ has joined #ruby
<waxjar>
isn't it just data.to_json ?
<shevy>
musee that does not work because the method that you call resides in another class
<shevy>
what you could do is def self.foo
<shevy>
and BigClass.foo
<shevy>
rather than foo()
<musee>
can I just call BigClass.foo?
<shevy>
if you did self.foo
<shevy>
if not, then you must go via .new and call .foo on your object
tommyblu` has joined #ruby
PhilK_ has joined #ruby
jonathanwallace has joined #ruby
l3ck has joined #ruby
<rosslazer>
Any mongo people out there?
kah_ has joined #ruby
ryanf has joined #ruby
<y3di>
waxjar: to_json dones't work it returns "#<PG::Result:0x9a7a464>"
<y3di>
json.generate() errored out
<burgestrand>
y3di: convert it to a regular ruby type before you to_json it
<burgestrand>
y3di: perhaps .to_a.to_json, or .all.to_json or whatever the call might be
<Squarepy>
tommylommykins, you have to require 'rdoc/markup'
machine1 has joined #ruby
zakwilson has joined #ruby
<tommylommykins>
ohh
<Squarepy>
tommylommykins, you have to require 'rdoc/markup/to_html'
<Squarepy>
both of them
<tommylommykins>
:D
<Squarepy>
:p
<robdodson>
i'm reading the ruby pickaxe book and I'm on to the section about fibers and threads. Are threads used a lot or is it more of a language feature that I might only run into every once in a while? trying to figure out how much of this chapter I should be really committing to memory
<tommylommykins>
hmm, is there a shortcut for this? require 'rdoc/*' or 'rdoc/all' or anything like that?
baroquebobcat has joined #ruby
<Squarepy>
robdodson, running paralllel stuff is not needed in general, IMHO
<tommylommykins>
actually, English is only a list of aliases
<tommylommykins>
but there is still no documentation for it
<banisterfiend>
tommylommykins: probably because it contains no methods classes
<banisterfiend>
tommylommykins: it just defines some global variables
<banisterfiend>
so it's impossible to document normally (except by a long boring readme)
caiges has joined #ruby
prometheus has joined #ruby
mistergibson has joined #ruby
brngardner has joined #ruby
zakwilson has joined #ruby
Prometheu5 has joined #ruby
Sou|cutter has joined #ruby
Drewch has joined #ruby
netrealm has joined #ruby
atmosx has joined #ruby
Boohbah has joined #ruby
<mensa180>
dumb question: I have a variable, I want to define a second variable to have the same value as the first, but not change when the first does, how can I do this?
<mensa180>
e.g. I have @grid, I tried @orig_grid = @grid, but @orig_grid changes with @grid.
<mensa180>
I want to keep @grid 's original value.