Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
<Hanmac>
i would do snake tocamel so: s.split('_').each.with_index.map {|o,i| i.zero? ? o : o.capitalize}.join
<any-key>
Hanmac: I like that solution better
<Hanmac>
my or yours?
<any-key>
mine was silly and created a variable when it shouldn't have :|
<any-key>
Hanmac: yours
<any-key>
waxjar: so now you've got everything you need!
<Hanmac>
hm was the ruby way snake or camelcase?
<any-key>
snake
<any-key>
camel for class names
<any-key>
snake for everything else
<any-key>
basically: if it's capitalized, camel case it, else snake case it
banisterfiend has joined #ruby
iocor_ has joined #ruby
<Hanmac>
hm ... maybe i need an converter, because my method missing is used with Camelcase proberties, (so it mimic attr methods) maybe i add snake case detection
gregoryf has joined #ruby
pu22l3r has joined #ruby
<any-key>
you definitely should; snake case is how most ruby is done
mxweas_ has joined #ruby
minijupe has joined #ruby
orospakr has joined #ruby
rickmasta has joined #ruby
wookiehangover has joined #ruby
twelvechairs has joined #ruby
Pip has joined #ruby
<artOfWar>
having trouble installing mysql2 gem in ruby, I faintly remember coming across some tool like rvm which can be used to install but cannot remember, any help?
dmn001- has joined #ruby
twelvechairs has joined #ruby
pu22l3r has joined #ruby
fayimora has joined #ruby
randym has joined #ruby
seanstickle has joined #ruby
mxweas_ has joined #ruby
orospakr has joined #ruby
andman has joined #ruby
Ammar01 has joined #ruby
unixjazz has joined #ruby
Willejs has joined #ruby
y3llow has joined #ruby
eignerchris has joined #ruby
voodoofish430 has joined #ruby
nfluxx has joined #ruby
ed_hz_ has joined #ruby
philips has joined #ruby
nyrb has joined #ruby
elliot98 has joined #ruby
v0n has joined #ruby
ElderFain has joined #ruby
voodoofish has joined #ruby
d34th4ck3r has joined #ruby
ReachingFarr has joined #ruby
theishi has joined #ruby
wvdschel has joined #ruby
heftig has joined #ruby
soulcutter has joined #ruby
Kageroc has joined #ruby
Tick-Tock has joined #ruby
vandemar has joined #ruby
dfr has joined #ruby
eregon has joined #ruby
jbpros has joined #ruby
iaj has joined #ruby
indeterminate has joined #ruby
JonSchuff has joined #ruby
lavaman has joined #ruby
araujo has joined #ruby
khem_ has joined #ruby
dhodgkin has joined #ruby
Fraeon has joined #ruby
Guest23751 has joined #ruby
milkshak1s has joined #ruby
beernutty has joined #ruby
jhowarth has joined #ruby
alaska has joined #ruby
tomaw has joined #ruby
ec has joined #ruby
tshirtman has joined #ruby
sebastian_pl has joined #ruby
pkondzior has joined #ruby
Veejay has joined #ruby
thomasfedb has joined #ruby
kuzushi has joined #ruby
Drakevr has joined #ruby
froy has joined #ruby
joschi has joined #ruby
marienz has joined #ruby
aef has joined #ruby
<etrece>
what error are you getting?
denom has joined #ruby
y3llow has joined #ruby
looopy has joined #ruby
mitchty has joined #ruby
hadees has joined #ruby
beernutz has joined #ruby
pabloh has joined #ruby
rbarrero has joined #ruby
<rbarrero>
hi all
<rbarrero>
I'm new to Ruby and i'm trying to write a chef recipe
<rbarrero>
so far so good, but I need access to data that lies outside the recipe
<rbarrero>
and later using like this #{ip_address}
<rbarrero>
but it's value is: false
Willejs has joined #ruby
nyuszika7h has joined #ruby
mattonrails has joined #ruby
ascarter_ has joined #ruby
ZachBeta has joined #ruby
<banisterfiend>
pabloh: no
<banisterfiend>
pabloh: they're scoped to top level
<pabloh>
banisterfiend: ok, thx
<pabloh>
if just one main object per running script then?
<pabloh>
s/if/its
<banisterfiend>
pabloh: Yes
headius has joined #ruby
vraa_ has joined #ruby
replore has joined #ruby
<cloke>
is there a more concise way to write "a << x.y if x.y" I feel like I shouldn't have to check for each one
<banisterfiend>
cloke: google for andand
<cloke>
banisterfiend: thanks, that looks interesting
`brendan has joined #ruby
<Eiam>
I've got a regex i want to run on a file that rubular helped me figure out.. but i've got no idea how to get ruby -ne to.. act on whats piped in?
<Eiam>
i tried cat file | ruby -ne 'print $1 if $_ =~/[0-9]{7,8}/' but no dice
<Eiam>
(i want all 7-8 digit numbers in the file
<Eiam>
)
Pip has quit ["It's not your problem."]
<moshee>
Eiam, use $< or $stdin
laen_ has joined #ruby
stephenjudkins has joined #ruby
randym has joined #ruby
tectonic has joined #ruby
Karmaon has joined #ruby
caiges has joined #ruby
<Eiam>
hmm no dice… cat all.txt | ruby -ne 'print $1 if $stdin =~ /[0-9]{7,8}/' > anotherTest.txt
<Eiam>
the regex matches fine in rubular
<Eiam>
(on the same dataset)
Indian has joined #ruby
<moshee>
try grep? lol
<Eiam>
=(
sythe has joined #ruby
sythe has joined #ruby
KL-7 has joined #ruby
mikepack has joined #ruby
adeponte has joined #ruby
neurodrone has joined #ruby
neurodrone has joined #ruby
dagnachewa has joined #ruby
ZachBeta has joined #ruby
gregoryf has quit [#ruby]
werdnativ has joined #ruby
Guest84974 has joined #ruby
alup_ has joined #ruby
a215 has joined #ruby
a215 has joined #ruby
TheTFEF has joined #ruby
<Hanmac>
hm what is the diffrence between rb_string_value_ptr and rb_string_value_cstr? ... currently none of them works currect for me :(
<banisterfiend>
Hanmac: what are you trying to do piggy
<Hanmac>
using an ruby object as wxInputStream child
jetblack has joined #ruby
<banisterfiend>
Hanmac: i use RSTRING_PTR
<banisterfiend>
the macro
_|christian|_ has joined #ruby
libertyprime has joined #ruby
looopy has joined #ruby
laen_ has joined #ruby
yawniek has joined #ruby
jetblack has joined #ruby
rbarrero has quit ["Leaving"]
Wandering_Glitch has joined #ruby
<Hanmac>
hmmm ok i tryed it but for some reason wx does not read it currectly ... maybe i should ask the wx guys ... :/
khakimov has joined #ruby
marknyc has joined #ruby
jetblack has joined #ruby
kiggyd has joined #ruby
<kiggyd>
anyone here watching the debates right now? our startup is doing this live dial testing (just go on your smartphone or tablet to m.heartbyte.com and tune into CNN). we publish the results to our blog www.heartbyte.com/blog
<seanstickle>
There's a debate?
<seanstickle>
Again?
<kiggyd>
seanstickle: yup
<seanstickle>
They gotta stop having those.
Targen has joined #ruby
CreativeEmbassy has joined #ruby
<td123>
presidential candidate debates.. I would love them to throw some actual hard questions at them and not be afraid of checking facts and calling bullshit
patrick99e99 has joined #ruby
<td123>
if a real debate like that actually happened, I would get the dvd and watch it live :P
<patrick99e99>
is there any way to yield a block to an object? in other words.. foo = Foo.new; foo do |blah| ... Is there any ruby magic that would allow this sort of thing?
philcrissman has joined #ruby
nari has joined #ruby
liluo has joined #ruby
banisterfiend has joined #ruby
DeeJayTwo has joined #ruby
briankbuckley has joined #ruby
dotnull has joined #ruby
<twelvechairs>
patrick99e99: sure you can do 'def doo(&block); yield' but whats the use-case.... is this the right way to do it?
<td123>
huh, I didn't know you can define a method and a variable with the same name :)
<td123>
and they will be seperate
<banisterfiend>
td123: Yeah
<patrick99e99>
twelvechairs: hmmmmm yeah might not be the right way to do it...
<banisterfiend>
patrick99e99: what you trying to do homie
jergason has joined #ruby
<patrick99e99>
banisterfiend: well I have config data for a rails app, and right now it's in a constant.. APP_CONFIG[:foo] for example.. but I was just dealing with some nested config options and had some thing like a_method APP_CONFIG[:foo][:bar], APP_CONFIG[:foo][:baz], APP_CONFIG[:foo][:lol]
ta8let has joined #ruby
<patrick99e99>
and I was thinking, it sure would be nice if I just had a method that I could do something like app_config(:foo) do |config| ...
<patrick99e99>
and be able to just do config[:lol], config[:baz], etc within that block
ta8let has quit [#ruby]
kiggyd has quit [#ruby]
<patrick99e99>
and was just trying to imagine how I might do that...
kerframil has joined #ruby
daniel_hinojosa has joined #ruby
<banisterfiend>
def app_config(key); yield APP_CONFIG[key]; end
<patrick99e99>
but I am not too crazy about having a global object method doing that...
<patrick99e99>
banisterfiend: is it kind of evil to have that method just existing in .. what? MAIN? it would be somewhere out in the top-level-land...
M- has joined #ruby
<banisterfiend>
patrick99e99: if you just defined it on top-level that's ok
philcrissman has joined #ruby
Evixion` has joined #ruby
<banisterfiend>
but if you defined it on Object that's not so cute
<patrick99e99>
banisterfiend: hmm.. ok..
<banisterfiend>
patrick99e99: to define it on top-level use: def self.app_config; end
<banisterfiend>
to define it on Object use def app_config; end
<twelvechairs>
patrick99e99: of course you can do it, but that sounds like a lot of hassle for little gain to me...
<twelvechairs>
banisterfiend: whole new methods just to avoid a few [:foo]s?
<banisterfiend>
twelvechairs: i often write tiny little helper methods to make my code cleaner
macmartine has joined #ruby
<banisterfiend>
though in his case he could get by with just a local
<banisterfiend>
my_foo = APP_CONFIG[:foo]
<banisterfiend>
my_foo[:bar]
chrxn has joined #ruby
<twelvechairs>
banisterfiend: well, its hard to know without the specifics really. may end up with more lines of code, may end up with fewer. May end up with clearer code, or it may just obfuscate the structure... 's all i am saying.
werdnativ has joined #ruby
emmanuelux has joined #ruby
ZachBeta has joined #ruby
randym_ has joined #ruby
ekaleidox has joined #ruby
CheeToS has joined #ruby
ZachBeta has joined #ruby
fermion has joined #ruby
TheTFEF has joined #ruby
andrewhl has joined #ruby
MasterIdler_ has joined #ruby
Hanmac1 has joined #ruby
pu22l3r has joined #ruby
mickn has joined #ruby
<banisterfiend>
twelvechairs: do you use ruby-debug
frishi has joined #ruby
alanp has joined #ruby
dv310p3r has joined #ruby
PragCypher has joined #ruby
randym has joined #ruby
idletom has joined #ruby
philcrissman has joined #ruby
chrxn has joined #ruby
andrewhl has joined #ruby
sythe has joined #ruby
sythe has joined #ruby
pdtpatr1ck has joined #ruby
phantomfakeBNC has joined #ruby
tomzx has joined #ruby
vraa__ has joined #ruby
v4n_ has joined #ruby
<v4n_>
hi
<v4n_>
is there a pure ruby alternative to mechanize?
jcromartie has joined #ruby
<v4n_>
I'm bored about compiling nokogiri with libxslt etc just to parse a single HTML page
sythe has joined #ruby
sythe has joined #ruby
mattonrails has joined #ruby
minijupe has joined #ruby
sythe has joined #ruby
pu22l3r has joined #ruby
sythe has joined #ruby
sythe has joined #ruby
IceD^^ has joined #ruby
bigkm has joined #ruby
adamkittelson has joined #ruby
cook1es has joined #ruby
havenn has joined #ruby
milkpost_ has joined #ruby
mxweas_ has joined #ruby
mikepack has joined #ruby
Shin-LaC has joined #ruby
<Shin-LaC>
guys
<Shin-LaC>
let's say I want to associate a value with an arbitrary object
<Shin-LaC>
actually, with many such objects
<Shin-LaC>
I might use a dictionary with the objects as keys
notjohn has joined #ruby
<Shin-LaC>
but can I have weak references there?
<Shin-LaC>
wait, why didn't I google this
ZachBeta has joined #ruby
wyhaines has joined #ruby
no-name- has quit ["Leaving"]
namidark has joined #ruby
<Shin-LaC>
hmm
<namidark>
So I wanted to start doing some data mining into some h5 files (from the million song dataset) and I can't find anything from a few google searches for ruby that can read .h5 files -- does anyone have any pointers?
<Shin-LaC>
I could have a hash full of WeakRefs
<Shin-LaC>
but then the WeakRef objects would stick around
<Shin-LaC>
even if the referred objects themselves got gced
blueadept has joined #ruby
blueadept has joined #ruby
<Shin-LaC>
basically, I want to attach some value to exceptions as they are raised
<Shin-LaC>
but the raised object can be anything
<Shin-LaC>
not necessarily an exception
<Shin-LaC>
so adding a variable to the Exception class may not be enough
<Shin-LaC>
I could add a variable to the object, if it's not an instance of Exception
<Shin-LaC>
but maybe the best approach is to associate the value with the object indirectly
<Shin-LaC>
using a hash
<Shin-LaC>
what might be the best way of doing this?
radic has joined #ruby
ZachBeta has joined #ruby
macmartine has joined #ruby
_srp has joined #ruby
MissionCritical has joined #ruby
ZachBeta has joined #ruby
manizzle has joined #ruby
rohit has joined #ruby
mikepack has joined #ruby
adeponte has joined #ruby
kawa_xxx has joined #ruby
rohit has joined #ruby
havenn has joined #ruby
crankycoder has joined #ruby
whh has joined #ruby
al3xnull has joined #ruby
twelvechairs has joined #ruby
anahue has joined #ruby
IAD has joined #ruby
rickmasta has joined #ruby
maletor has joined #ruby
coreydaley has joined #ruby
_srp has joined #ruby
waxjar has joined #ruby
strife25 has joined #ruby
anahue has quit [#ruby]
jcromartie has joined #ruby
ElitestFX has joined #ruby
ElitestFX has joined #ruby
Karmaon has joined #ruby
Karmaon has joined #ruby
jergason has joined #ruby
savage- has joined #ruby
TooR4u has joined #ruby
<TooR4u>
Hi .. i am new to ruby. Installed RVM and ruby1.9.2. Now i am trying to set the default version to 1.9.2 by using the following command.
<TooR4u>
rvm --default use 1.9.2
<TooR4u>
but i am getting the following error
<TooR4u>
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
<TooR4u>
btw, i am using the rvm from /usr/local/rvm/bin
mdesrosiers has joined #ruby
bigkm has joined #ruby
ElitestFX has joined #ruby
bigkm has joined #ruby
td123 has joined #ruby
gianlucadv has joined #ruby
pen has joined #ruby
Seisatsu has joined #ruby
apok has joined #ruby
tomoyuki28jp has joined #ruby
<tomoyuki28jp>
Is there a way to do it in a shorter way: params[:foo] && params[:foo][:bar]
pp01bit has joined #ruby
munx has joined #ruby
Ankhers has joined #ruby
ed_hz_ has joined #ruby
<rohit>
TooR4u: I suggest asking RVM related questions #rvm lots of helpful folks there
badabim has joined #ruby
sdfsdsf has joined #ruby
<TooR4u>
rohit, Thank you .. :)
<banisterfiend>
rohit: you're a helpful character
i8igmac has joined #ruby
pencilcheck has joined #ruby
looopy_ has joined #ruby
Targen has joined #ruby
mikepack has joined #ruby
_srp has joined #ruby
mohits has joined #ruby
SegFaultAX has joined #ruby
n3m has joined #ruby
_srp has joined #ruby
nfluxx has joined #ruby
mdesrosiers has quit [#ruby]
Deele has joined #ruby
randym has joined #ruby
nfluxx has joined #ruby
dipix has joined #ruby
CacheMoney has joined #ruby
stephenjudkins has joined #ruby
examancer has joined #ruby
Divinite has joined #ruby
ameba has joined #ruby
charlenopires has joined #ruby
vraa__ has joined #ruby
sabooky has joined #ruby
charlenopires has joined #ruby
sabooky has joined #ruby
<sabooky>
I want to do the equivalent of a string.scan(/regex/) but instead of getting strings back I want to get matchData object back.
<sabooky>
Need to walk a file backwards using regex, noting the location of the match, then removing the match
<sabooky>
hmm... string.scan(/regex/) {|x| p $~ } seems to work
sonkei has joined #ruby
gianlucadv has joined #ruby
<ReinH_>
why not just use #match ?
gokul has joined #ruby
tonini has joined #ruby
Divinite has joined #ruby
afex has quit [#ruby]
rohit has joined #ruby
x0F_ has joined #ruby
djdb has joined #ruby
asuka_ has joined #ruby
rramsden has joined #ruby
<CacheMoney>
I have [master] $ in my command prompt after the directory name. I'm not sure how I did this, how do I remove this Git versioning control?
<scalebyte>
RubyPanther: you could help me out probably...
<RubyPanther>
serialize sucks
<scalebyte>
RubyPanther: i havent done serialize at all.. need help to complete the task !!
<examancer>
only because it defaults to YAML... yuck for serializing into a database column
<scalebyte>
i can give the ryt answer reputation in so worth 500
<scalebyte>
RubyPanther: You can be up for a so rep worth 500 !!
<RubyPanther>
scalebyte: You're using procedural design instead of OOP, that is why it is not easy
<RubyPanther>
I have no idea what you're talking about
<scalebyte>
RubyPanther: i am working on rails... what i need is each other has userpreference corresponding to him so it has to be displayed and he needs to update it using checkboxes and then the updated values needs to be updated to db using form and submit tag
<scalebyte>
user*
thone_ has joined #ruby
<scalebyte>
RubyPanther: could u help me firstly with how I can convert the attribute names of a class into string array
zakwilson_ has joined #ruby
kawa_xxx has joined #ruby
porco has joined #ruby
<scalebyte>
RubyPanther: cud u help me ?
rippa has joined #ruby
bluOxigen has joined #ruby
randym has joined #ruby
odinswand has joined #ruby
leon1024 has joined #ruby
startling has joined #ruby
Mohan has joined #ruby
kawa_xxx_ has joined #ruby
eldariof has joined #ruby
<pen>
what does =~ means?
<pen>
I saw some people wrote @var =~ 'blah
<pen>
'
<pen>
@var =~ 'blah'
Alantas has joined #ruby
scalebyte has joined #ruby
<scalebyte>
RubyPanther: anyidea hw could i fetch the names of all the attributes of a class into string ?
<RubyPanther>
pen: it is like a magic flying whale that examines your data and gives it a number if it is happy
<RubyPanther>
scalebyte: what are you talking about?
<RubyPanther>
scalebyte: try it and lets see what you get first
<RubyPanther>
scalebyte: I already told you, you're using procedural design instead of OOP, that is why you are flailing
<scalebyte>
RubyPanther: so hw should be my approach ?
<scalebyte>
RubyPanther: help me hero !!
<RubyPanther>
scalebyte: you need to actually read a Ruby book before you even get started, and then get a rails recipes book so you have someplace to start from on this stuff
twelve_chairs has joined #ruby
<RubyPanther>
grasshopper, I cannot drink for you, I can only show you the water
<scalebyte>
RubyPanther: i understand bt for now i need to get this done or else il b fired :(
CheeToS has joined #ruby
csprite has joined #ruby
Mekkis has joined #ruby
ostapbender has joined #ruby
<RubyPanther>
scalebyte: how did you get the job?
undersc0re has joined #ruby
<RubyPanther>
Is there a reason for sympathy? Was it supposed to be a Java job?
<scalebyte>
RubyPanther: after my engineering interview test and what not.. I am not bad bt they expect more in less time
<RubyPanther>
Surely you understand at least what OOP means.
<scalebyte>
RubyPanther: i am not a java developer i love java but nw i work with ruby on rails
<scalebyte>
RubyPanther: i do... but u cud help a newbie a lil so that i could learn !!
<csprite>
man seems easier to install ruby on windows than nix
<RubyPanther>
do I get half the pay?
<scalebyte>
RubyPanther: sure.. :0 just give ur account number
<bairui>
hi, guys. any pointers to current materials on using gtk2 from ruby?
<bairui>
in particular, i want to use glade
davidcelis has joined #ruby
Ripp__ has joined #ruby
nemesit has joined #ruby
sprysoft_david has joined #ruby
ephemerian has joined #ruby
darthdeus has joined #ruby
Kambus has joined #ruby
visof has joined #ruby
visof has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
Caius has joined #ruby
skim1776 has joined #ruby
<skim1776>
which tool is used for bug tracking in the ruby world?
undersc0re has joined #ruby
johndbritton has joined #ruby
kawa_xxx has joined #ruby
<Tasser>
skim1776, github issues ^^
<skim1776>
Tasser, I mean, is there some kind of a tool for managing bug database during the dev process?
adeponte has joined #ruby
<shevy>
bairui you can use ruby-gtk
<shevy>
also there are glade bindings
<shevy>
but I dont know how well they work as I dont use XML shit
csherin has joined #ruby
<bairui>
thanks, shevy... i just found that libglade was deprecated in favour of GtkBuilder... I'm looking in to that now...
<shevy>
ah yes
<shevy>
depends on what version you use
<shevy>
libglade/ directory is still there in rubygnome2-0.19.4
znow has joined #ruby
<znow>
im getting errors when I do "$ rvm install ruby-1.9.3-p125" .... Error with bunzip2
<bairui>
hmm... this sounds... messy
<bairui>
i might have better luck shelling out to gtk-server
<Tasser>
skim1776, tests? :-)
<shevy>
bairui why? works for me, I just compiled it and ran a sample
<shevy>
the main reason it was deprecated was because ruby-gtk is lacking manpower
<shevy>
so it is easier for kou to maintain less things (that are more important)
<bairui>
with different versions using different interfaces... i am not sure if my dev env (arch) is using the same EVERYTHING as my target env (puppy)
NotreDev has joined #ruby
<NotreDev>
how do i output a value in a block that would be appended to an array?
<rippa>
what?
<rippa>
explain
<davidcelis>
NotreDev: be more explicit
<NotreDev>
well i know that i can create an array before hand, and use the block to append to the array, but i thought i remembered a convenience to build an array from a block
<NotreDev>
sorry i spend 99% of my time in python, though blocks are enjoyable, i never remember the right keywords to google
<Tasser>
NotreDev, rubydocs.info/frames/core
virunga has joined #ruby
<NotreDev>
:)
<NotreDev>
cheers
odinswand has joined #ruby
ameba has joined #ruby
dreamr has joined #ruby
skim1776 has quit [#ruby]
bluenemo has joined #ruby
bluenemo has joined #ruby
jbw_ has joined #ruby
dazoakley has joined #ruby
<undersc0re>
NotreDev: Ruby!
<undersc0re>
I'm an ex-pythonist
<undersc0re>
Ruby is my preferred sex toy
<NotreDev>
ruby's definitely interesting
<undersc0re>
yep
havenn has joined #ruby
<undersc0re>
I'm not a "professional" Rubyist or anything but..
<undersc0re>
I love it
<undersc0re>
NotreDev: Ruby has some nice Qt bindings
emmanuelux has joined #ruby
<undersc0re>
Except I seem to be the only one who ever messes with hose
<undersc0re>
s/hose/those/
jlebrech has joined #ruby
<NotreDev>
i have played with qt bindings in a long time, and it thrills me
<NotreDev>
*haven't :)
<undersc0re>
lol
<Alantas>
I took Qt/Ruby for a spin a few months back, but I'm sticking with Gtk.
<undersc0re>
lol Gtk
<undersc0re>
Alantas: I personally prefer toolkits that look fabulous on any OS.
<undersc0re>
I'm into the whole multi-platform development thing
<Alantas>
So you're into Java?
* Alantas
hides!
<undersc0re>
.
<undersc0re>
Ya ok
<undersc0re>
I was going to take a Java class for lulz this year
<Alantas>
I'm only tinkering with it for personal-use projects anyway. (Or, put another way: I'm not making stuff for just any OS. Hehe.)
<undersc0re>
I could have taken a C# class too!
<undersc0re>
Alantas: same here
Divinite has joined #ruby
<undersc0re>
My attention span can't stay long on one project tbh
<undersc0re>
Every time I start a project, a couple weeks later it dies
Mohan has joined #ruby
ameba has joined #ruby
<undersc0re>
but then again, I've stayed with Ruby longer than any other language.
<omry_>
whats the standard way of running on ruby script from another?
tayy has joined #ruby
<Alantas>
Same here. If it isn't done by the time my initial enthusiasm goes away, *it* does.
<undersc0re>
omry_: ?
<undersc0re>
Could you please go into detail
<Alantas>
omry_: You can 'require' the other script and incorporate its functionality into your program, if that's what you're after. Otherwise, probably just invoke it with the shell, like any other program.
<undersc0re>
yeah, thats what I was thinking Alantas
<undersc0re>
Depends on how he wants to do it
virunga has joined #ruby
<undersc0re>
I should work on my IRC logger bot
Mekkis has joined #ruby
<Hanmac>
but if you have >1.9 then PLEASE use require_relative
<NotreDev>
I have a MySql::Result, and I'm expecting a scalar (one value returned). The docs i'm looking at aren't incredibly helpful. How would I get this one value as an integer? (docs: http://tmtm.org/en/mysql/ruby/)
workmad3 has joined #ruby
<undersc0re>
Alantas: thats one of the many ways to do that
<undersc0re>
:p
<omry_>
Alantas, thanks. I`ll probably do that.
<omry_>
undersc0re, just writing a few simple scripts, and I want to call one from the other in a loop. I guess shell execution is the way to hgo
<omry_>
go
<Alantas>
NotreDev: So, it's a table with one column? Or one row? Or both? What?
<undersc0re>
I usually use: Dir["./src/*.rb"].each { |file| require file }
kiela has joined #ruby
<Alantas>
undersc0re: That's relative to the calling directory, not the directory of the script file itself.
<undersc0re>
oh
<undersc0re>
yeah
kerframil has joined #ruby
<NotreDev>
qr.fetch_row()[0].to_i
<undersc0re>
Alantas: I was just showing that because it depends how he wants to do said thing
<omry_>
undersc0re, will require work if I call it multiple times?
<omry_>
(for the same file)
<undersc0re>
omry_: Well, it requires all the files that are in Dir["My_Dir/*.rb"]
<undersc0re>
since I did Dir["./src/*.rb"].each
<Alantas>
omry_: Call it in a loop? What does it do? If it's a method or something, you can just 'require' it once and call it directly.
<undersc0re>
yeah
<omry_>
Alantas, think bash scripts, but in ruby. just a bit of code I want to call
<omry_>
Alantas, what you propose is fine for real code, just a bunch of silly one time scripst :)
daglees has joined #ruby
daglees has joined #ruby
Mekkis has joined #ruby
ameba has joined #ruby
TheTFEF has joined #ruby
TheTFEF has joined #ruby
tvo has joined #ruby
tvo has joined #ruby
c0rn has joined #ruby
<Tasser>
hm, how do I convert a string to an integer (codepoint, not parse) again?
<linduxed>
ok so let's say i want to describe fruits
<linduxed>
one fruit might contain vitamin E in a quantity of 50g
<Stefunel>
that's one badass fruit
<undersc0re>
yea
<linduxed>
another fruit might contain vit A _and_ vit E in 20g and 70g
<linduxed>
Stefunel: yeah i know :-P it's just an example
<Alantas>
Tasser: In pre-1.9, use array indexing to pick out the byte.
<Stefunel>
maybe mg :)
tatsuya_o has joined #ruby
<Tasser>
Alantas, yeah, but I'm not one of the ancient arts
<linduxed>
so the point is that some might contain x in amount y and some might contain a,b in amounts c,d
<Hanmac>
i would use an hash to store this
<undersc0re>
yeah
randym has joined #ruby
<undersc0re>
Tasser: use a hash to store this data
<linduxed>
i don't want every fruit to store the possibly-zero amount of vit a,b,c..., so how should i store this info?
<Alantas>
linduxed: Hash. If the amount is zero, then you'd simply not add a key for it in the hash.
<undersc0re>
set the fruits that don't contain said vitamin to nil?
<undersc0re>
well 'nil
<Alantas>
You can set a Hash's default value to 0, too.
<linduxed>
but that is the question, should i include nil-vitamins?
<linduxed>
it that safer in a way?
soulcutter has joined #ruby
<linduxed>
or is it just a waste of space?
<Tasser>
" Die # I wonder why the first char won't be stripped away - [194, 160, 68, 105] # codepoints
<Hanmac>
linduxed: you dont need to include nil vitamins, the Hash takes care of this
<Alantas>
linduxed: What do you mean? If it only has vitamin Q, then that's all you'd set in the hash.
<Alantas>
vitamins["Q"] = 50
ameba has joined #ruby
<linduxed>
Alantas: ok, i was thinking of doing vitamin["A"] = 0
<Hanmac>
IMO symbols are better: vitamins[:Q] = 50
<linduxed>
Hanmac: yeah that's an idea too i guess
<Hanmac>
linduxed: no you must not if you use Hash.new(0)
<Alantas>
linduxed: That would set a key. If the hash's default is 0, then it's superfluous to set it explicitly.
eldariof has joined #ruby
<Alantas>
Hanmac: There's no harm in it, it's just unneeded.
<Alantas>
Well, no harm beyond giving the hash more to keep track of. You'll get the same result out of ["A"] either way.
<Alantas>
If you're reading from a file or from user input or something, you could just make the assignment conditional: vitamin[name] = value unless value == 0
<Hanmac>
hm but normaly if you parse a string you only need to put this keys in for them you have values
QaDeS has joined #ruby
<Alantas>
Unless you've got zillions of fruits and/or vitamin types, it's not really that big a deal to add more keys.
<linduxed>
Alantas: well... i'm writing this rails thing, and i'm trying to figure out how i should write the model. actually it's not fruits it's all about, but ores and minerals, but fruits was a simpler real world example. the problem i face is that while i easily filled my database with the mineral details of name and price (which would correspond to my previous example as vitamin name and... price/gram... i guess
<linduxed>
:-P), i'm being a lot more hesitant as to how to fill the database with this info: http://joonicks.eu/eve/oretab
<Alantas>
dotemacs: That's a pretty fugly way to do it. You could just do it as a bunch of one-liners.
<Alantas>
def to_cyr arg; convert(arg, Latin, Cyrillic); end
<Alantas>
Or whatever the logic is.
<Alantas>
One line apiece. And perhaps some alias()ing so to_cyr() and po_vuku() are the same.
Spockz_ has joined #ruby
<dotemacs>
Alantas: yea, it was like that originally, but I switched to using method_missing then added a few more methods... but you are right, I'll revert it back
<dotemacs>
thanks
serpa has joined #ruby
<Alantas>
In the middle of that would be to use case/when in method_missing.
<Alantas>
case arg; when /^(to_cyr|po_vuku)$/ then convert(dup, Latin, Cyrillic); when etc
<Alantas>
Or, for that matter: case arg; when "to_cyr", "po_vuku" then ...
<dotemacs>
yea, i thought of that, but the fuglyness factor still remains, i thing reverting back to methods might be nicer on the eye
<dotemacs>
thanks again
<dotemacs>
oops /thing/think/
* Alantas
nods.
<Alantas>
linduxed: Well, looking at that table, there's few enough entries on the X axis that you might just as well give them all explicit 0s.
gyre007 has joined #ruby
<Alantas>
Even so, it'd work most naturally as a Hash, which already allows for sparse storage in this case, by setting a 'default' of 0.
Cypher has joined #ruby
<Alantas>
If there's a meaningful difference between "this is a legitimate mineral to have, it just doesn't have any" and "this isn't a legitimate mineral to have", though, then you'd probably want to stick with the default-default (nil) for the latter and explicit 0 for the former.
<znow>
ERROR: Error running 'bunzip2 < I get this when I do rvm install ruby-1.9.3-p0 ???
<Alantas>
(I'm thinking, maybe your system doesn't have bunzip2, but then, that'd be pretty rare.)
briankbuckley has joined #ruby
twelvechairs has joined #ruby
TheTFEF has joined #ruby
<Alantas>
It says, in the same line: please read /usr/herp/derp/extract.log.
tayy has joined #ruby
<znow>
Alantas: okay.. errhh so... what do I do?
<dotemacs>
znow you read it :)
<dotemacs>
and see what is says
<znow>
dotemacs: wow... but nothing in it
<dotemacs>
ok
<dotemacs>
do you have permissions to write to the destination directory?
<znow>
im on root user
<dotemacs>
ok, are you overwriting an existing rvm install
<dotemacs>
?
tvw has joined #ruby
<znow>
could be... but when i wanted earlier to do rvm use bla bla, it said rvm wasnt installed
<dotemacs>
can you do mv /usr/share/ruby-rvm /var/tmp/ruby-backup
<dotemacs>
and try again?
etehtsea has joined #ruby
<znow>
dotemacs: yes, sec
tvo has joined #ruby
<dotemacs>
type rvm info in your terminal and see what that gives you, as in is rvm there
<dotemacs>
'rvm info'
havenn has joined #ruby
<znow>
dotemacs: its printing endles loop of lines out
<dotemacs>
what is, 'rvm info' ?
<znow>
dotemacs: /usr/bin/rvm: line 54: /usr/share/ruby-rvm/scripts/rvm: No such file or directory just continuing to output this line
pen has joined #ruby
<dotemacs>
then you haven't installed rvm properly
<znow>
dotemacs: oh sec
<znow>
dotemacs: yeah but if I do rvm install ruby-1.9.3-p125 it outputs the line aswell in an endless loop
<Alantas>
You told him to move /usr/share/ruby-rvm, and the script is (duly) saying there's nothing in it.
<dotemacs>
znow do this: move /usr/share/ruby-rvm
<dotemacs>
then install rvm from the start
<dotemacs>
following the official web site
<znow>
yeah sec
ikaros has joined #ruby
<dotemacs>
once you have it up and running
<dotemacs>
do rvm info
<dotemacs>
if you are getting 'healthy' output
<dotemacs>
then proceed with the install of ruby
Deele has joined #ruby
<znow>
dotemacs: yeah alot better now, sec
<znow>
configuring - looking bright
timonv has joined #ruby
<dotemacs>
ok, so from the sounds of it, you didn't install rvm right the first time around
Mon_Ouie has joined #ruby
<znow>
dotemacs: apparently not, but my apps went running fine... :p
<dotemacs>
ok, thats strange
<znow>
dotemacs: yeah.
<shevy>
haha
<shevy>
do you have more than one ruby installation?
<znow>
shevy: not that I know of
<dotemacs>
znow run 'which ruby'
timonv has joined #ruby
<znow>
dotemacs: its compiling ruby atm
<dotemacs>
ok, but can you do it anyways, that way if you do have a ruby version installed that wasn't installed by rvm, you'll find out where it lies
timonv has joined #ruby
<dotemacs>
if nothing returns, then what probably happened, you started your apps via some version of ruby, then when you 'messed' up rvm, the paths were lost, but the executable was still in memory and running
<znow>
dotemacs: okay... it takes ages for it to compile ... :S
<dotemacs>
did you run 'which ruby' while the compile is running?
<dotemacs>
just for curiosity sake
JStoker_ has joined #ruby
<dotemacs>
if you do it, you'll win :)
<znow>
dotemacs: now I did :) which ruby Install of ruby-1.9.3-p125 - #complete You have new mail in /var/mail/root root@danielg:/var/www/apps/advicecapital/current# which ruby /usr/bin/ruby root@danielg:/var/www/apps/advicecapital/current#
<dotemacs>
ok, so you do have system ruby
divout has joined #ruby
Spockz has joined #ruby
<znow>
but but
<dotemacs>
if this /usr/bin/ruby is what 'which ruby' returned
<znow>
dotemacs: but it seems to be using 1.8 gemspec gems or what its called
<znow>
dotemacs: Retrieving rubygems-1.8.17 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 246k 100 246k 0 0 601k 0 --:--:-- --:--:-- --:--:-- 2936k Extracting rubygems-1.8.17 ... Removing old Rubygems files...
hukl has joined #ruby
hukl has joined #ruby
<dotemacs>
ok, is this undesirable ?
<dotemacs>
gems version and ruby version are two different things
<znow>
well it wont let me install therubyracer , it fails Installing therubyracer (0.9.10) with native extensions
<znow>
oh okay
<znow>
dotemacs: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
<dotemacs>
you can and probably will have ruby 1.8 with gems 1.8; also ruby 1.9.3 with gems 1.8
<znow>
ok
<dotemacs>
znow that was a gems build error for the gems themselves or for a particular gem?
<dotemacs>
ok, so run sed in that directory not /var/lib...
<dotemacs>
do you know what that sed command actually does ?
<dotemacs>
if you understand that, it'll help
<znow>
dotemacs: nope
tayy has joined #ruby
<dotemacs>
sed takes the 00:00... string and removes it from all the gems under a 'dir'
<znow>
ah ok
charlenopires has joined #ruby
rohit has joined #ruby
<znow>
dotemacs: so... what to do with this whenever?
<dotemacs>
znow: what i think is happening with your setup is: you have a system ruby and rvm ruby and each one of these have their own gemsets (or they should) so ...
milktrader has joined #ruby
<dotemacs>
i think that you are using gems from the system ruby for a application that's meant to use the rvm ruby and its gems
<znow>
dotemacs: okay, how can I remove the system ruby??
<dotemacs>
don't, leave it
<znow>
dotemacs: okay
<dotemacs>
just make sure you use the rvm ruby and its gems
<znow>
okay
<dotemacs>
compare the output of rvm's gemset and which 'some executable'
<dotemacs>
im saying, try to troubleshoot it a bit by yourself :)
<znow>
dotemacs: got no clue on where to start, what to do if I get started or anything, really :(
<znow>
dotemacs: just needed to get my whenever gem working :p
randym has joined #ruby
<dotemacs>
ok, you want to run whenever gem, and that is a executable ruby script
<jroes>
it's been a late night, this might be a stupid question. is there a stdlib method to pull back Hash entries where key.include? [ :some, :list, :of, :keys ] ?
<jroes>
seems like h.assoc is close
<dotemacs>
this will be installed in a certain path
<znow>
dotemacs: yes... well I need it to work with crapistrano aswell.... so it runs my cron rake task
Sliker has joined #ruby
<dotemacs>
ok, step one, can you run that whenever command as a user from the command line ?
<linduxed>
just a name thing, if i write out a bunch of "Scenario: runs on the toaster" without any actual testing, would those be called "test stubs" or "story headlines"?
<Tasser>
znow, ls -a /var/www/apps/advicecapital/shared/
<dotemacs>
maybe try to run the whenever command after the use_sudo directive?
<znow>
all though, ive been told to use "clockwork" gem instead of whenever...
<znow>
dotemacs: yeah sec, ill change that
Guest53368 has joined #ruby
chellomere has joined #ruby
<znow>
dotemacs: same error
<chellomere>
can you get an array or object or something containing the variables available in the current scope?
ameba has joined #ruby
<Tasser>
chellomere, local_variables
<chellomere>
Tasser, thank you
<Tasser>
chellomere, why doy ou want them?
<dotemacs>
can you do something which will spit them out to stdout
<dotemacs>
then you'll see what the issue is
<banisterfiend>
Tasser: hey tassy what's the dilly
<chellomere>
Tasser, because I have two situations where I want to validate a rails record differently, and I want to see if there's a way I can differentiate them
<Tasser>
chellomere, kind of argh
<Tasser>
banisterfiend, more canadian beer ;-)
<dotemacs>
znow: the issue is this, you are running a command and appending to a file, a user executing the command does not have the permissions to write to the cron.log
<banisterfiend>
Tasser: are you swiss-german, swiss-french or swiss-italian
<Tasser>
banisterfiend, make a guess
<dotemacs>
znow: you need to find out what user is executing the whenever command
<banisterfiend>
Tasser: Jew.
<dotemacs>
znow: try to execute 'echo $USER' if you can
<znow>
dotemacs: yeah okay... i will try the clockwork gem, and see if that works :) ill tty in a bit
tuxaddicted has joined #ruby
<chellomere>
Tasser, yes, it's not an optimal situation :(
<Tasser>
banisterfiend, I still have my prepuce
<dotemacs>
znow: that's not solving the issue
<dotemacs>
:)
<znow>
dotemacs: hmm... still about the cron.log stuff?
<dotemacs>
yea
pu22l3r has joined #ruby
<Tasser>
banisterfiend, so you're the kind that would kill a thousand jews and a clown?
tvo has joined #ruby
tvo has joined #ruby
<dotemacs>
guys dont joke about stuff like this, you'll get barred from entering the US :)
<chellomere>
Tasser, instance_variables is what I wanted, googling local_variables made me find it, thank you :)
<Hanmac>
i understand why the clown, but why the jews?
<Tasser>
Hanmac, see? no one cares about the clowns ^^
wenbert has joined #ruby
<Hanmac>
i readed that they have tested children, and clowns are one of the most feared things
<Tasser>
Hanmac, s/readed/read/
pdelgallego has joined #ruby
rohit has joined #ruby
<Tasser>
sorry, I'm in a linguistics lecture :-)
<Mon_Ouie>
You are a lecture?
<Tasser>
they don't write, so I'm not
norex has joined #ruby
norex has joined #ruby
nanderoo has joined #ruby
tvo has joined #ruby
tayy_ has joined #ruby
akem has joined #ruby
vootey has joined #ruby
p0y has joined #ruby
hSATAC has joined #ruby
<znow>
dotemacs: so I need to edit the perms of shared/log yeah or?
<dotemacs>
znow: sorry
<dotemacs>
?
<znow>
dotemacs: for the cron.log file
<dotemacs>
make sure you can write to it
<dotemacs>
from the gem
<dotemacs>
any way you can
<dotemacs>
that will give you a hint on how to proceed
<znow>
well as per the capfile
milkpost_ has joined #ruby
<znow>
set :user, "deploy" set :use_sudo, true set :admin_runner, "root"
<znow>
and deploy could create a file within log/
jcromartie has joined #ruby
notjohn has joined #ruby
zomgbie has joined #ruby
fermion has joined #ruby
niklasb has joined #ruby
Spockz has joined #ruby
arussel has joined #ruby
justfielding has joined #ruby
<arussel>
I have data in a bytea in postgres, I want to create a jpg from. ATM, i write to the file opened with "wb", but without success.
`brendan has joined #ruby
M- has joined #ruby
statarb3 has joined #ruby
<`brendan>
morning
<arussel>
the output is bytes (0->f) when the jpeg would look like "
<arussel>
any idea ?
havenn has joined #ruby
hSATAC has joined #ruby
BiHi has joined #ruby
QaDeS has joined #ruby
Indian has joined #ruby
ryannielson has joined #ruby
davidpk has joined #ruby
philcrissman has joined #ruby
strife25 has joined #ruby
linoj has joined #ruby
lateau__ has joined #ruby
anderse has joined #ruby
Foxandxss has joined #ruby
kawa_xxx has joined #ruby
pi3r has joined #ruby
codebeake has joined #ruby
<codebeake>
anyone know why sometimes test::unit loses dots under 1.9.x ?
glosoli has joined #ruby
<codebeake>
I've heard it can be because of timecop, but I don't use that Gem
waxjar has joined #ruby
nowthatsamatt has joined #ruby
dazoakley has joined #ruby
neurodrone has joined #ruby
<znow>
dotemacs: so what should I do?
Mon_Ouie has joined #ruby
tommyvyo has joined #ruby
shlevy has joined #ruby
<shlevy>
In YAML, how do I represent the string 1234,5? it always gets translated as the fixnu 12345
<codebeake>
"1234,5"
<shlevy>
codebeake: That wont't include the quotes?
<codebeake>
"\"1234,5\"
<codebeake>
whatever you need
<codebeake>
also check yamllint.com
<shlevy>
codebeake: Thanks
<codebeake>
(Formatting a european currency amount?)
rippa has joined #ruby
tcurdt has joined #ruby
<shlevy>
Nope, escaping it doesn't work
<shlevy>
codebeake: No, string-encoded parameter list in a legacy app :(
<codebeake>
ah
<shlevy>
1st param is 123, second is 4
<codebeake>
so what *exact* format are you looking for ?
<apeiros_>
shlevy: that's definitively not yaml doing it
<apeiros_>
YAML.load(%{"1234,5"}) # => "1234,5"
<apeiros_>
(using %{} for the string to make quoting clearer)
shell0x_ has joined #ruby
runa has joined #ruby
<shevy>
yeah for strings in yaml, enclosing in "" is enough
<runa>
heyas. I have "class Foo < Array" but Foo.new.map{...} returns an Array, not a Foo. any hints?
<apeiros_>
runa: you'll have to define map in terms of your Foo class
<shlevy>
Hmm, strange
<runa>
apeiros_: like def map; foo = self.class.new; self.each{|x| foo << yield x}; end ?
<runa>
erm, return foo at the end
<shlevy>
apeiros_, shevy: Thanks
<shevy>
yay shlevy! we conquer the ruby!
hSATAC has joined #ruby
fxn has joined #ruby
<apeiros_>
shlevy: for example, yes
p0y_ has joined #ruby
banisterfiend has joined #ruby
<runa>
apeiros_: is this a bug or a feature? :)
<apeiros_>
you can also use replace(super)
<apeiros_>
runa: the superclass does not and should not know about subclasses
<apeiros_>
so it is how it should be. neither bug nor feature.
<runa>
apeiros_: well, it didn't sounded too complicated to do a 'self.new' instead of 'Array.new'. thanks anyway!
MrGando has joined #ruby
Paul-Atreides has joined #ruby
<apeiros_>
runa: you should think a second more about how Array#map is actually implemented
<CannedCorn>
is there anything better than sinatra for ruby in terms of micro frameworks
visof has joined #ruby
visof has joined #ruby
Jackneill has joined #ruby
pdtpatr1ck has joined #ruby
<sergeykish>
I want to debug rails application. It should be easy to set breakpoints with rdebug and run some code in console. But things are really complicated. `bundle exec` calls Kernel.exec, `rails c` calls Kernel.exec. Each exec call drops debug. And it's hard to find them - 'b Kernel.exec' doesn't breaks. What can I do?
<CannedCorn>
i find the whole thing somewhat lame, we get it, the guy was a singer
<canton7>
omry_, it all depends on how you wrote your yaml file. Yours is written with a list at the top-level, so YAML::load gives you an array as the output. Had your yaml file had a set of key/value pairs at the top level, as on the site you linked, YAML::load would have given you a hash
<omry_>
canton7, gotcha
<omry_>
makes sense. I would rather get a standard node type, but it is what it is :)
zommi_ has joined #ruby
Paul-Atreides has quit [#ruby]
Sailias_ has joined #ruby
zomgbie has joined #ruby
theRoUS has joined #ruby
csexton has joined #ruby
<Kageroc>
hello community... I am trying to write a script that logs into a cisco device looks at some things and outputs some things based off what it found. I knot thats very vaugh :) I am looking for someone who would write this for me and I will pay very well! I would like it done in ruby. Anyone willing to assist?
<theRoUS>
ruby 1.8.7: is there any way to hook variable access via '@'? i.e., intercept a reference such as '@foo = 12' ?
<banisterfiend>
theRoUS: no, but u can hook accessors, like self.foo = 12
<banisterfiend>
just do that instead
fermion has joined #ruby
<theRoUS>
banisterfiend: understood, but i would like to have the variables be special objects and control all access to them to keep them from being overwitten
<theRoUS>
too bad @ doesn't invoke instance_variable_get/set ..
<banisterfiend>
theRoUS: too bad i guess
tomzx has joined #ruby
<CannedCorn>
guys, is there anything better than sinatra out there in terms of micro frameworks for ruby?
_obiJuan has joined #ruby
c64 has joined #ruby
arussel has quit ["ERC Version 5.3 (IRC client for Emacs)"]
<codebeake>
I can debug *anywhere* Except the methods they use as callbacks
orange33 has joined #ruby
<shevy>
omry_ start irb
<omry_>
done
<shevy>
then load the file into the x variable
<shevy>
require 'yaml'; x = YAML.load_file("name_of_your_yaml_file_here.yml")
<shevy>
then do require 'pp'; and ... pp x
<omry_>
dnoe
<shevy>
do you see the data structure of x?
<omry_>
yes
mklappstuhl has joined #ruby
<omry_>
now, how do I access the key name?
<mklappstuhl>
Hey
<omry_>
as I said, the key is not hard coded.
<omry_>
its not
<banisterfiend>
codebeake: i got it working by removing the &
<shevy>
x is a Hash
<orange33>
Is there a one-liner that will let me init an array based on a range, then remove a couple of elements and return the result? Like (1..5).to_a.slice!(1,2) to return [1,4,5]?
<codebeake>
yeah, likewise -
<codebeake>
damnit
<shevy>
omry_ you can iterate over a hash by using .each_pair for instance
<shevy>
x.each_pair {|key, value| puts key}
<orange33>
And really I'd rather not use the index, I'd rather specify the actual values I want removed. Both slice() and delete() of course return the affected elements and not the original array.
<codebeake>
ahh, one thought - maybe test::unit is being loaded before debugger
<omry_>
okay. gotcha
<omry_>
thanks shevy
<codebeake>
so it's a noop when the proc is made from the method, verrryy early in the bootup
<orange33>
Like if delete() took an array. But it appears to only take a single value.
_pdelgallego has joined #ruby
tayy has joined #ruby
<banisterfiend>
codebeake: oh i know why
<banisterfiend>
codebeake: duh
<banisterfiend>
:)
<shevy>
omry_: there are also other ways. you can get all keys by doing x.keys too. but as you want to iterate, you can use .each or .each_pair (this is part of the module Enumerator by the way, very typical of ruby code to use .each to iterate over a collection)
Drewch has joined #ruby
<banisterfiend>
codebeake: push(block) not push(&block)
<banisterfiend>
codebeake: push doesnt take a block so it's being ignored
<codebeake>
yep, but they're not doing that, that's my mistake
<orange33>
So a one-liner that gives me an array of 1 to 10, but deletes 4 and 5, for example. I can do it in two lines but I'm trying to find one.
<banisterfiend>
codebeake: ?
<banisterfiend>
codebeake: with that change it now works for me, anyway
<codebeake>
which is a shame, because that's *not* woking in test::unit
<sergeykish>
hi! how can I break on Kernel.exec in rdebug? 'b Kernel.exec' doesn't work
<banisterfiend>
codebeake: are you sure? i bet it's a similar bug
<codebeake>
I guess not in my, and only my copy of test::unit :)
<banisterfiend>
codebeake: show your code
<codebeake>
it's a rails project, which `rake test` only outputs the `P` (skipped), summary and "Loading suite....." lines
<codebeake>
everything else, dots and failures are skipped
<codebeake>
so I'm spelunking around in the Test::Unit gem trying to figure out why
<banisterfiend>
codebeake: what is your native language btw?
<codebeake>
English, yours ?
<banisterfiend>
english
<codebeake>
ok, (am I using bad grammar toda?t)
<codebeake>
today* sorry
<banisterfiend>
no, it's more, you didnt provide nearly enough information in your problem description for me to make sense of what u were talking about
Jooka has joined #ruby
<banisterfiend>
so i figured there was some kind of language/cultural barrier
<codebeake>
but - like I said, right now i'm working under the assumption that Kernel.debugger in 1.9 is a noop, and that when the method is captured into the proc, and pushed to the list, it's being pushed with noop debugger implementation, before ruby-debug loads and qualifies the whole thing
<codebeake>
(investigating now)
<Kageroc>
Does anyone in this chat room have spare cycles write a script for me? I would pay well.
<banisterfiend>
codebeake: try pry then
<banisterfiend>
codebeake: just put binding.pry where u had debugger
<banisterfiend>
not because pry is better, but just to rule out debugger being the culprit
<codebeake>
weird thing, and somehow off topic - is that I can modify that implementation to have `exit 1`, and still run the tests, and they still pass
<codebeake>
it's like changing the source code of that method body has no effect
cousine has joined #ruby
luxurymode has joined #ruby
snip_it has joined #ruby
<Tasser>
codebeake, so it's not called
<codebeake>
Tasser, cheers - we worked that out with banisterfiend - but there's something weird in test unit still
<codebeake>
(and, no way to turn a proc back into code, right?)
<codebeake>
not even some weird AST or something simiar
<Tasser>
codebeake, nope, it's not stored
<banisterfiend>
codebeake: if the proc is defined in a file you can
<banisterfiend>
codebeake: pry can do that, your_proc.source
<codebeake>
well, I've reloaded the proc.source_location, and it's *defininitely* got a debugger in there :)
<codebeake>
but I think its' somehow the Kernel.debugger (which I believe is a noop, but haven't verified yet)
<banisterfiend>
codebeake: then verify it
<codebeake>
ok "undefined local object or variable debugger" (out of the box)
<codebeake>
so I'm straight out of ideas :S
<codebeake>
gonna take a walk, then try pry
<codebeake>
ping you if I find anything interesting though banisterfiend
<banisterfiend>
im not really looking at it
<banisterfiend>
sorry, ive got my own annoying problem
<silverhand>
What regex method returns the substring it finds?
<canton7>
#match returns a match object which contains it. You can use string#[] with regex and an offset to get a match also (e.g. "hello"[/(el)l/, 1] )
jergason has joined #ruby
renan_saddam has joined #ruby
briankbuckley has joined #ruby
kf8a has joined #ruby
<renan_saddam>
Is normal that "Hey John" =~ /^Hey/ returns 0 and "\nHey John" =~ /^Hey/ returns 1 ?
<apeiros_>
shevy: a) .each_key, b) .each { |key, value|
p0y has joined #ruby
_srp has joined #ruby
cloke has joined #ruby
milkpos__ has joined #ruby
cloke_ has joined #ruby
cloke_ has joined #ruby
moshee has joined #ruby
skitrees has joined #ruby
<willej>
cheers for the help
<ReachingFarr>
Is anyone here running Ruby on Windows?
marcamilly has joined #ruby
youdonotexist has joined #ruby
drknus has joined #ruby
<willej>
you've cleared the room by mentioning windows… ;)
<ReachingFarr>
willej: It appears so.
araujo has joined #ruby
araujo has joined #ruby
SebHK has joined #ruby
enherit has joined #ruby
davidcelis has joined #ruby
forever-d has joined #ruby
<Sailias_>
ReachingFarr, i used to, but just ask your question. If someone can help they will
albemuth has joined #ruby
<ReachingFarr>
Sailias_: I need to know the format of the output from the `caller()` function.
<shevy>
ReachingFarr well a bit, I am just making sure that my projects work on windows too. but windows is so annoying...
andrewhl has joined #ruby
<shevy>
["caller_to_block.rb:10"]
<shevy>
caller() returns an array with strings, limited with : to show the line number of the call
briankbuckley has joined #ruby
<ReachingFarr>
shevy: Right, but shouldn't there be a drive letter at the beginning of the file path?
<shevy>
there is no file path AFAIK, just the filename foo.rb
<ReachingFarr>
And is there ever anything like "caller_to_block.rb:10:somethingelse"?
<shevy>
oh
<shevy>
you are right
<shevy>
I invoked from / and it gives me the full path
<ReachingFarr>
shevy: OK, so there is a drive letter, but nothing after the line number, correct?
<shevy>
is there a drive letter? I dont know
<shevy>
but here, there is nothing after the line number
<shevy>
I'd need to test on my laptop, but it's downstairs, and I am lazy ;-)
pdtpatr1ck has joined #ruby
<ReachingFarr>
shevy: OK, thanks. Someone submitted a patch to my project to make it work under Windows but I have no way of testing it :-(
forever-d has quit [#ruby]
Helius has joined #ruby
<shevy>
WHERE ARE THE WINDOWS RUBY USERS HERE!
<shevy>
that should help :)
<shevy>
but I think they are hiding
anderse has joined #ruby
<Hanmac>
why dont know how irc works
herbnerder has joined #ruby
adeponte has joined #ruby
znow has joined #ruby
eignerchris has joined #ruby
<robacarp>
ruby works on windows?
crdueck has joined #ruby
<znow>
when I run sudo god etc to start god it fails, but when I run god without sudo I get: Daniel:advicecapital znowm4n$ god -c config/ac.god -D I [2012-02-23 18:26:08] INFO: Loading config/ac.god E [2012-02-23 18:26:08] ERROR: Failed to create pid file directory: Permission denied - /var/www <- how can I fix the permission for this?
<robacarp>
windows works for something?
kr1shnak has quit [#ruby]
undersc0re has joined #ruby
<robacarp>
znow: uh, you should probably change the pid director to /var/run
maletor has joined #ruby
<znow>
robacarp: ah okay, sec!
<robacarp>
or, more likely, /var/run/god/ or somethin
blueadept has joined #ruby
<crdueck>
how can i pass a global variable from ruby into a bash command like this: "$rubyvar = xxx ... %x[bash_command $rubyvar]"
<znow>
robacarp: atm its PID_DIR = "#{RAILS_ROOT}/log" <-
<znow>
so I just change it to /var/run/god or?
marcamilly has joined #ruby
briankbuckley has joined #ruby
soulcutter has joined #ruby
Eiam has joined #ruby
<robacarp>
znow: aaahh, okay, well...so your rails app is in /var/www then?
<shevy>
crdueck dont think there is a way. but you could generate a shell script, and load that from another shell script
tayy has joined #ruby
<robacarp>
since I delt with god scripts
marcamilly_ has joined #ruby
<znow>
robacarp: oh hehe
skim1776 has quit [#ruby]
<crdueck>
shevy: well i need to use ruby specific methods, and then i need to call a bash function. i dont think i can do it just in bash
<robacarp>
znow: well, your god script is going to try and run the clock.rb as user 'appuser'
<znow>
robacarp: oh okay... so I can change that to another user?
<robacarp>
well, you can just change that in th egod script on line ~22. But I don't know that you should change it.
nixmaniack has joined #ruby
<znow>
aaaaaah fuck... ive must have been shithigh right now..... ive made my god script for my server, not for my local machine... wtf
SegFaultAX|work has joined #ruby
<robacarp>
the question is, who owns the app directory /var/www/apps/advicecapital/current/log
<znow>
and im trying to run it on here
<robacarp>
oh, well that would do it
<znow>
ffs....
<znow>
xD
<znow>
ok give me a sec
pdkl has joined #ruby
<krusty_ar>
ReachingFarr: shevy, look for a Luis Lavena
pdkl has quit [#ruby]
lkba has joined #ruby
looopy has joined #ruby
stkowski has joined #ruby
billy_ran_away has joined #ruby
z3r has joined #ruby
<znow>
robacarp: ah alot better, all though appusetr etc doesnt exist, can I use root?
havenn_ has joined #ruby
apok has joined #ruby
csherin has joined #ruby
<robacarp>
znow: well I don't really see why not, but unless you need it for some reason I wouldn't do it as root in production
<robacarp>
and pid file permissions isn't really a good reason...
<znow>
robacarp: can I use my deploy user?
<robacarp>
in fact that is probably exactly what you sohuld do.
<robacarp>
becaues the directory structure will be owned by that user
vjacob has joined #ruby
<znow>
robacarp: ah yeah
Araxia has joined #ruby
hasrb has joined #ruby
etehtsea has joined #ruby
munx has joined #ruby
mxweas_ has joined #ruby
paTimu has joined #ruby
paTimu has quit [#ruby]
badabim has joined #ruby
<dotemacs>
znow: most of the issues you seem to be hitting are unix related rather than ruby related. Invest some time in learning about unix/linux, then try puppet/chef, it will help you out a lot
<znow>
dotemacs: yeah, hehe know what you mean, all though I got it working now :-)
<robacarp>
good advice, even if it does come from an emacs user :-P
<znow>
edited the appuser to my deploy user, and it seems to load find. well im on osx ;)
<cloke_>
if I have a nested hash and some values in the hash are arrays of hashes themselves, is there an easy way to just retrieve all values of the hash?
munx has joined #ruby
<dotemacs>
ok, but what happens now when you have to change something? this is where puppet/chef come in, look into it when you get some time, you'll find it useful/helpful
<znow>
dotemacs: true that :-)
<robacarp>
cloke_: .keys
emocake has joined #ruby
macmartine has joined #ruby
<skitrees>
hmm, is there a way to figure out if an error was thrown during throw/catch?
<cloke_>
robacarp: I'm looking for the values, which .values works, but the nested arrays aren't flattened into values themself
<skitrees>
begin/rescue/end may be too much for what I need, but throw/catch looks like it will be too little
headius has joined #ruby
<skitrees>
I basically want to be able to get out of a deeply nested situation (which throw/catch is good for) but I also want to report on what the particular problem was, I also need to see if there *was* a problem, or whether the block ended successfully
<robacarp>
cloke_: well, you can .flatten them....but without actually looking at the dataset I've no idea what you're really after
seagreen has joined #ruby
<seagreen>
ad
seagreen has quit [#ruby]
<dotemacs>
cloke_: theres array1.flatten, you can use on the arrays
<skitrees>
also, where do I find the list of possible exceptions
<skitrees>
also, given that I can raise "some string"
<skitrees>
what do I use to catch said exception?
<skitrees>
if I raise a string, is it just the general exception class?
coreydaley has joined #ruby
eignerchris_ has joined #ruby
<cloke_>
robacarp: {"a" => "b", "c" => [{"d" => "e", "f" => "g"}]} and I want to convert that into ["b", "e", "g"]. all I care about are the values in the hash
<cek>
ROB
aprescott has joined #ruby
aprescott has quit [#ruby]
shobhitg has joined #ruby
briankbuckley has joined #ruby
<crdueck>
how can i pass a global variable from ruby into a bash command like this: "$rubyvar = xxx ... %x[bash_command $rubyvar]"
<canton7>
cloke_, is there meant to be an array in there?
eldariof has joined #ruby
mxweas_ has joined #ruby
shobhitg has joined #ruby
<robacarp>
cloke_: well, so what you want is not the keys but the values, but you need to flatten it first.
<cloke_>
canton7: yeah, it will be an array of hashes, but I didn't want to keep typing :)
nfluxx has joined #ruby
<canton7>
cloke_, will any of the sub-hashes have hashes as a value in them?
shobhitg has joined #ruby
<robacarp>
skitrees: there are a handful of standard ruby exceptions available
<cloke_>
canton7: basically I am trying to take a response from mongo and get all the values in a document and all the values from the embedded documents
<robacarp>
cloke_: well, if you want to live dangerously you could write a recursive function...but you didn't hear that from me.
<cloke_>
robacarp: that's what I have now. just thought I would ask as I don't like that solution
bglusman has joined #ruby
ed_hz_ has joined #ruby
mgraham has joined #ruby
<robacarp>
yea, truth be told you're probably fine running it that way....but when it gotcha's its going to really gotcha
<cloke_>
canton7: thanks, that is slightly better than what I have
booginga has joined #ruby
rbennacer has quit ["Leaving"]
<canton7>
cloke_, line 10 should probably be another call to rec_flatten, looking at it
iocor has joined #ruby
<canton7>
cloke_, updated
cbuxton has joined #ruby
tvo has joined #ruby
sterNiX has joined #ruby
adamkittelson has joined #ruby
ascarter has joined #ruby
Targen has joined #ruby
kenichi has joined #ruby
<robacarp>
the first rule of recursive programming is to remember that you've already written the program you are about to write.
ph^ has joined #ruby
<canton7>
hehe
Sailias_ has joined #ruby
undersc0re has joined #ruby
gianlucadv has joined #ruby
voodoofish430 has joined #ruby
glosoli has joined #ruby
danishkhan has joined #ruby
geekbri has joined #ruby
hooper has joined #ruby
shadoi has joined #ruby
aldodelgado has quit [#ruby]
eignerchris has joined #ruby
kadema has joined #ruby
hron84 has joined #ruby
shadoi1 has joined #ruby
<Hanmac>
shevy dont use php ... it cant calc with hex numbers ... "echo (0x00+2);"
Targen has joined #ruby
<tshirtman>
php is full of braindead things like this…
lorandi has joined #ruby
tymelx has joined #ruby
minijupe has joined #ruby
<minijupe>
is the variable _ used internally for anything in ruby?
<minijupe>
I find myself wanting a short default variable in constructs like this: collection.select {|_| permitted_to? :create, _ }
TaTonka has joined #ruby
<minijupe>
Is there any default variable defined so I can skip the |var| declaration or is there any reason not to use _ ?
lorandi has joined #ruby
<any-key>
what's wrong with |var| ?
<any-key>
for single function calls you can do &:whatever
<any-key>
so like foo.map(&:id)
<matled>
Hanmac: what does php print for you in this case?
<any-key>
and you've got yourself a combinator :)
<Hanmac>
matled: 4 but it should print 2
<matled>
% php -r 'echo (0x00+2)."\n";'
<matled>
2
<minijupe>
any-key: I was familiar with the &: but I was just hoping that (and I hate perl) there was some default var defined so I could skip the |var| bit of those blocks
<any-key>
take a look at the $ variables (globals)
<any-key>
although they suck and you should avoid them
<undersc0re>
^^
<any-key>
being a little verbose is a good thing
<any-key>
if I saw you use a $ variable like that I'd punch you in your silly face :P
medik has joined #ruby
<Hanmac>
matled whats your php version?
<matled>
PHP 5.2.6-1+lenny16 with Suhosin-Patch 0.9.6.2 (cli) (built: Feb 3 2012 08:19:55)
arussel has joined #ruby
<heftig>
PHP 5.3.10 with Suhosin-Patch (cli) (built: Feb 6 2012 19:22:23)
<matled>
oh, you're right. on another machine i get this too
fridim_ has joined #ruby
<Hanmac>
hm i tiinnk the bug is new in 5.3
<matled>
PHP 5.3.3-7+squeeze8 has this problem for me too
<arussel>
We put the content of a JPEG into a postgres DB, how can create a JPEG back in ruby ?
<arussel>
I tried this: image = Image.from_blob(tuple['data'])
<arussel>
but got: no decode delegate for this image format
<arussel>
with and without: SET bytea_output = 'escape';
zuymanto has joined #ruby
CodeZombie has joined #ruby
<minijupe>
What is the default behavior of _ in an enumerable block. This seems to indicate that it is the first element of the enumerable? http://pastie.org/3439536
cook1es has joined #ruby
stephenjudkins has joined #ruby
visof has joined #ruby
n3m has joined #ruby
Mrono has joined #ruby
Mrono has quit [#ruby]
davidpk has joined #ruby
idletom has joined #ruby
bagratte has joined #ruby
thebope has joined #ruby
jergason_ has joined #ruby
nfluxx_ has joined #ruby
Jackneill has joined #ruby
stephans has joined #ruby
Ankhers has joined #ruby
Speeda has joined #ruby
zuymanto has quit [#ruby]
Sailias_ has joined #ruby
hukl has joined #ruby
pggbee has joined #ruby
hobodave has joined #ruby
<whitenoise>
ActiveRecord question: how do you handle migrations, etc, if you aren't in a Rails application and using rake for it?
odinswand has joined #ruby
dreamr has joined #ruby
Karayusuf has joined #ruby
ephemerian has joined #ruby
tayy has joined #ruby
vraa has joined #ruby
shobhitg has joined #ruby
mengu has joined #ruby
JohnBat26 has joined #ruby
<RubyPanther>
whitenoise: the simplest thing is to just install rails and not use the server, but still have the generators, console, etc
viuo has joined #ruby
<apeiros_>
whitenoise: just invoke migration.up/.down
<whitenoise>
apeiros_: and i see I can make a Rakefile where I can actually manipulate the database as usual
<apeiros_>
of course
<whitenoise>
so, question
<apeiros_>
not much magic there
<whitenoise>
basically, a while back I made a MUD library. Now, I'm rewriting it to use a database, and the lib is a framework rather than coded values, reads a config for behavior rather than just execute, etc.
<whitenoise>
so basically, i took a lib and turned it into a framework.
malkomalko has joined #ruby
<whitenoise>
I'm wanting to add in a 'web' functionality with an ajax client and all, and I want the website for the app to read from the same database as the application.
<whitenoise>
should I have two different Rakefiles and setups for that?
<whitenoise>
and, if I do something like rake db:migrate in one, is it going to trash the app's tables from the web, etc, even though they don't reference the same tables?
<whitenoise>
or can those two things co-exist
ttm has joined #ruby
<epochwolf|vps>
whitenoise: you'll need to run the migration in both applications to update db/schema.rb
<whitenoise>
epochwolf|vps: but theres nothing wrong with the logistics of ActiveRecord outside of Rails for the app, and in the web/ directory of the app lies Rails for the website
<epochwolf|vps>
whitenoise: as long as the models are the same, it should be okay.
<whitenoise>
epochwolf|vps: well, the app will have models that the web doesn't and vice versa, but they will be tied with a common model.
<epochwolf|vps>
eh, just be careful then
luckyruby has joined #ruby
<whitenoise>
or, really, I guess they could both have the same models
<whitenoise>
I would just never call the Rails models from the app
<epochwolf|vps>
whitenoise: I've done two rails apps out of the same database.
<epochwolf|vps>
it worked fine.
workmad3 has joined #ruby
imsplitbit has joined #ruby
<whitenoise>
ok
Karmaon has joined #ruby
hadees has joined #ruby
Drewch has joined #ruby
ed_hz_ has joined #ruby
ctp has joined #ruby
Jay_Levitt has joined #ruby
hadees has joined #ruby
hadees_ has joined #ruby
hadees__ has joined #ruby
<whitenoise>
epochwolf|vps: i grabbed a Rakefile from the internet and set up a database.yml, but its not working
<whitenoise>
its telling me to install activerecord-mysql-adapter gem?
<whitenoise>
which is not a valid gem.
<epochwolf|vps>
whitenoise: you need the mysql2 gem.
hadees__ has joined #ruby
gabeh_ has joined #ruby
<epochwolf|vps>
whitenoise: active record needs a the proper database client gem. It doesn't install one by default.
<whitenoise>
mysql2 gem seems to be broken?
<epochwolf|vps>
whitenoise: not sure. I use postgresql.
<epochwolf|vps>
I do know that rails 3 requires the mysql2 gem.
<whitenoise>
i guess i could always just require 'rails'
<whitenoise>
instead of just 'active_record'
<whitenoise>
but that seems like a huge waste
<epochwolf|vps>
whitenoise: you're using 1.9.3-p0, I'm not sure the mysql2 gem can compile with that ruby version.
<epochwolf|vps>
whitenoise: some research shows you're trying to compile the gem with a 64 bit flag against a 32bit mysql
virunga has joined #ruby
fayimora has joined #ruby
kirun has joined #ruby
<whitenoise>
epochwolf|vps: ah..how would I undo that via the gem install command?
<epochwolf|vps>
whitenoise: you need to reinstall mysql.
<whitenoise>
ew
vraa has joined #ruby
<epochwolf|vps>
your ruby is most likely compiled 64bit.
<epochwolf|vps>
your gem will need to be compiled the same way.
<epochwolf|vps>
so you need to reinstall mysql with a 64bit version.
al3xnull has joined #ruby
<whitenoise>
my ruby is x86_64, yep
<whitenoise>
so i would need to install a 64 bit version of MySQL
* Hanmac
thinks if ruby would be currect configured then you could install ruby for amd64 and i386
<robert_>
shevy :D
<epochwolf|vps>
Hanmac: whitenoise is using a mac.
<epochwolf|vps>
there is no amd64
<epochwolf|vps>
It
<epochwolf|vps>
It's either 32bit or 64bit
<Hanmac>
you know what i mean
<epochwolf|vps>
Hanmac: you really don't want to be doing that with rvm. It will still trying to compile everything 64bit because that's the system default.
<epochwolf|vps>
you'll need to have compile flags on everything.
zomgbie has joined #ruby
<Hanmac>
*come to the multiarch side, you can be both 32 and 64 bit*
<epochwolf|vps>
Hanmac: osx runs both 32 and 64 bit applications. You just can't use libraries that are different archs.
<epochwolf|vps>
can't compile against*
babyboom has joined #ruby
<Hanmac>
with linux i can install diffent archs
<babyboom>
Hi
<whitenoise>
epochwolf|vps: the gems i installed previously will be fine, yes?
<epochwolf|vps>
Hanmac: you can do the same with a mac.
<epochwolf|vps>
whitenoise: no, you'll have to recompile them.
<whitenoise>
Hanmac: mac is just a pretty overly friendly linux
<whitenoise>
i used linux exclusively for about 5 years
<whitenoise>
then when I got a job in web development/design, I got a Mac
kickinChickenz has joined #ruby
<Hanmac>
in my first job they asked me if i want an windows or linux pc ... i chouse the last linux one
justinmcp has joined #ruby
* epochwolf|vps
works on mac, deploys to linux.
stephenjudkins has joined #ruby
<whitenoise>
epochwolf|vps: now its telling me i don't have libyaml
<whitenoise>
blehh
* epochwolf|vps
blinks
thebope has joined #ruby
<Hanmac>
epochwolf|vps i requested in ruby-dev to make the ruby lib multiarch in debian ... but i get no answer
strife25 has joined #ruby
<shevy>
whitenoise how do you like linux vs. mac so far?
<shevy>
I am on linux since 7 years
<shevy>
before that, windows. never touched a mac so far
<epochwolf|vps>
Hanmac: uh… ruby and debian don't like eachother.
<robert_>
hii shevy :D
<shevy>
yo robert_ whatcha hacking on?
<robert_>
a project using sequel.
Evixion has joined #ruby
<whitenoise>
shevy: i love mac. the hardware is great (its a solid system). it's user-friendly in a good way, no clutter like in Windows, it's pretty streamlined and customizable. and then you have your terminal. configuring things can be a little weird, because the file structure is openbsd, rather than the linux one. caused a few issues when configuring mysql and php and all that.
<whitenoise>
shevy: but, basically, I paid $2000 for 1) a really nice system, 2) a crazy warranty 3) and a nice OS
<shevy>
hehe
<whitenoise>
there are the negatives, of course, like the security vulnerabilities of Macs. They have yet to beef them up at all. I use a nice firewall config and ClamXAV
* epochwolf|vps
purchased his MBA for $900 from a guy in chicago >.>
<shevy>
ok I can't compete with that. my box here has cost around 250 euro (excluding monitor though which is another +120, mouse and keyboard for +20)
<whitenoise>
also, all the software and OS updates are really cheap, compared to Windows. In Windows where you might pay $200-250 for something, you pay $30 on Mac.
<whitenoise>
I still have a $1700 main system I built. i7 proc, 16GB of ram, 500GB drive, 30GB SSD for OSs, 1GB Nvidia, lots of fans
<whitenoise>
it runs Linux.
<shevy>
wow
<shevy>
that's a lot of ram
<whitenoise>
yes
<shevy>
my cheap machine here is already so blazingly fast, I am content :)
<whitenoise>
I do a lot of information security stuff, and in my scenarios I use a lot of Virtual Machines.
<whitenoise>
so its not uncommon for me to eat 10GB of RAM just from virtualized systems
<shevy>
wow
<shevy>
and people laugh when I say I want a RubyOS
<kapowaz>
anybody know of any library for generating random numbers that conform to a given distribution (e.g. normal)?
MasterIdler has joined #ruby
hasrb has joined #ruby
Divinite has joined #ruby
<Divinite>
Hey all, I'm having some trouble compiling native extentions.
<gaspar|work>
Hey guys, I'm running ~7 sinatra apps on my server (1.9.3) with virtually no traffic, they have 3000 daily visits combined. My memory usage is close to 1GB, is there any way to optimize it?
<shevy>
link does not work use pastie.org instead ?
<gaspar|work>
I'm running 1.9.3 via rvm with passenger
hadees has joined #ruby
rushed has joined #ruby
<Divinite>
Hmm
<Divinite>
shevy: What about now?
<shevy>
works now
<shevy>
man, debian and their naming scheme ... /usr/lib/libruby1.8.so.1.8
jgrevich_ has joined #ruby
jgrevich_ has joined #ruby
<shevy>
can someone explain why it uses the same number TWICE?
<shevy>
interesting Divinite
<shevy>
my ruby uses no libruby*.so*
<Divinite>
Yes...
startling has joined #ruby
<Hanmac>
but i want install my libruby.so in both archs
<shevy>
hmm
<td123>
shevy: debian probably pkgs ruby1.8 and 1.9
<shevy>
but td123 they could use libruby.so.1.8 or?
<td123>
shevy: libruby -> 1.9 libruby1.8 -> 1.8
jacktrik has joined #ruby
<shevy>
I need to test that hypothesis :)
<td123>
shevy: how would you disambiguate -lruby ?
<shevy>
anyone of you has a debian system with ruby 1.9.x ?
<td123>
sorry, just arch here
<whitenoise>
from googling and tinkering, looks like mysql 2.8.1 gem is broken.
kickinChickenz has quit ["Leaving"]
<whitenoise>
which means raking with mysql is broken.
<whitenoise>
or activerecord period, i guess
<Divinite>
shevy: So.. Compile ruby myself?
Tripp has joined #ruby
<shevy>
Divinite well I dunno
<shevy>
I always compile ruby myself
<shevy>
others are using RVM
<shevy>
you could try that
Tripp has quit [#ruby]
<Divinite>
I like compiling it myself. But should I 'destroy' Debian and install Ubuntu?
<td123>
you shouldn't switch to an os just to get a programming working
<td123>
s/an/another/
<td123>
and I meant program
<td123>
fail
ephemerian has joined #ruby
udante has joined #ruby
daniel_hinojosa has joined #ruby
tripp has joined #ruby
<shevy>
Divinite well good question
<Divinite>
What'd you think?
<shevy>
Divinite you could always do this:
<shevy>
compile ruby into a prefixed directory
hadees has joined #ruby
<shevy>
for instance, ruby-1.8.7p358 I compile via "./configure --prefix=/Programs/Ruby/1.8.7p358"
jergason has joined #ruby
<Divinite>
Alright, I'll try!
<shevy>
you could then use that ruby to check if the compilation continues with that problem you had
<shevy>
RVM is doing something somewhat similar btw, it compiles into its own managed directory afaik
undersc0re has joined #ruby
Gekz has joined #ruby
Deele has joined #ruby
prakriti has joined #ruby
<Divinite>
shevy: It's going to take a while, memory problems
<Hanmac>
divinite on what system did you build? (sorry if i ask again)
<Divinite>
Hanmac: Debian.
havenn_ has joined #ruby
<Divinite>
I didnt build it. apt-get install ruby.
workmad3 has joined #ruby
<epochwolf|vps>
yikes
<Hanmac>
ruby is only an meta package ... i think you need ruby1.8 or ruby1.9 ... ?
ajourc has joined #ruby
gayasentinel has joined #ruby
<Divinite>
I'm building now.
<shevy>
Divinite you and your memory problems!
<shevy>
who else has memory problems
<Hanmac>
me, but i am an heavy internet browser, so FF and eclispe are eat my ram(en)
imdude has joined #ruby
daglees has joined #ruby
daglees has joined #ruby
<undersc0re>
Hanmac: lol firefox
<undersc0re>
it's the slowest browser now!
<undersc0re>
IE9 is faster
<Hanmac>
but Ie9 is not safe enough
<Hanmac>
and has not the great extendsions i need
imdude has quit [#ruby]
remink has joined #ruby
munx has joined #ruby
<startling>
Hanmac: aurora or nightly might be a little nicer to your machine
<heftig>
aurora eats 1180MB here
<Hanmac>
i have an nightly trunk ... but i think currently not running ...
<Hanmac>
my current firefox version is 11
<shevy>
Hanmac whoa eclipse
<shevy>
that thing EATS RAM LIKE CHILDREN
<ajourc>
Is there any synonym to "$_" (bash) for the last object used ? :P
<heftig>
irb has _
<ajourc>
heftig: so goood !
<ajourc>
thanks
<Hanmac>
shevy yeah it is, but currently an good thing is you have more then one big lib where you are working on
<Hanmac>
currently firefox needs ~600MB ... (ok many tabs open) ... the ugly thing is that Xorg needs >350MB oO
vraa has joined #ruby
willej has joined #ruby
<ajourc>
heftig: Do u know where can I find the doc about "_" ?
<heftig>
probably none
hadees has joined #ruby
<ajourc>
:(
<heftig>
it's set by irb, not ruby
<ajourc>
Oh ok ...
<ajourc>
heftig: So, it's impossible to write : "puts a if _" :-(
hasrb has joined #ruby
<heftig>
sure, but _ will be the result of whatever you last wrote in IRB
<barnex>
But I don't really get where the name used to require the gem comes from.
<heftig>
also, using camelCase for anything but class names mostly considered bad style AFAIK
<canton7>
yeah, ruby's very keen on snake_case
<canton7>
(for everything but class and module names, where it becomes CamelCase)
<barnex>
Could you point me to some resources about this or explain it? The gem name is capistrano-mycorp and it can be required as 'capistrano/mycorp'... is there some convention saying that - will translate to /?
tommyvyo has joined #ruby
<heftig>
barnex: no.
<barnex>
So where does the capistrano part comes from in this gem? I believe the mycorp part comes from the directory name used in /lib/
<barnex>
what is used when I do "require 'gem-x'"? the name from .gemspec?
<heftig>
no, it should just be searched for in the include paths ($:)
rushed has joined #ruby
Ripp__ has joined #ruby
simao has joined #ruby
sarkis has joined #ruby
<burgestrand>
barnex: often, if it’s inside the lib/ dir of a gem, it will be required
<sarkis>
is it always a good idea to go with gemsets for everything?
arckie has joined #ruby
<sarkis>
im thinking some gems like vagrant should be available always
<burgestrand>
barnex: assuming you have lib/boogieboogieboo.rb in a gem, even if the gem is named bonkers, you can require 'boogieboogieboo'
macmartine has joined #ruby
havenn_ has joined #ruby
liluo has joined #ruby
CannedCorn has joined #ruby
senthil has joined #ruby
<senthil>
do we test what error msg is raised in rspec or simply that a error class is raised?
kylemcgill has joined #ruby
<senthil>
i.e. expect {}.to raise_error(OpenAuth2::UnknownProvider)
emocake has joined #ruby
ChloeD has joined #ruby
simao has joined #ruby
<burgestrand>
senthil: I don’t test exception messages anymore, they’re not the important part and I find they change and break tests that should not have needed breaking
emmanuelux has joined #ruby
<senthil>
burgestrand: you're prob. right
Toerkeium has joined #ruby
<Toerkeium>
hello guys
<canton7>
if everything throws Exception with varying messages, and you want to check that the right exception is thrown, then I guess it's worth checking. If you throw meaningful exceptions, though, I can't see the point
<barnex>
the gemspec uses git to determine files, I guess it does matter :o
<barnex>
but it haven't solved the problem
hck89 has joined #ruby
<banister`sleep>
burgestrand: seems very good
samsonjs has joined #ruby
<burgestrand>
barnex: show the Gemfile
<senthil>
canton7: the error in question was unnamed constant, i was including a list of included modules in the msg and was trying to decide if to test that or not
<banister`sleep>
burgestrand: for the wiki though it doesnt appear u have a landing page with links to the other wiki pages?
<barnex>
burgestrand: the Gemfile that I use to require this gem?
<barnex>
or the one inside the gem?
<burgestrand>
barnex: yeah
<burgestrand>
banister`sleep: ah yes, I haven’t looked at the other wiki pages in ages :x
<burgestrand>
banister`sleep: I should probably do that, thanks :)