<andrewvos>
zenspider: Guy who was in charge of Anonymous was apparently working for the FBI for a few months. Makes a difference from the Rails drama at least.
esad has joined #ruby-lang
<erikh>
a day with no rails drama?
<erikh>
you must be seriously confused
<andrewvos>
erikh: Just the one.
srbaker has joined #ruby-lang
takaokouji has joined #ruby-lang
<erikh>
erryday I'm maury-in'
<andrewvos>
??
esad has joined #ruby-lang
srbaker has joined #ruby-lang
<erikh>
maury povich. the king of drama.
<andrewvos>
Oh right right
esad has joined #ruby-lang
srbaker has joined #ruby-lang
esad has joined #ruby-lang
srbaker has joined #ruby-lang
shevy has joined #ruby-lang
amerine_ has joined #ruby-lang
tommyvyo_ has joined #ruby-lang
kain has joined #ruby-lang
<dominikh>
"in charge of anonymous"? I thought the whole idea is that nobody is in charge
<erikh>
there's no one group either
<andrewvos>
hehe
<andrewvos>
I should have put that in quotes
<injekt>
:)
<cout>
erikh: that's what they want you to believe
<zenspider>
dude... 2 spaces per indent and for god's sake refactor
<krzyhoo>
zenspider: which is what I am trying to do
<krzyhoo>
that was my question
<krzyhoo>
how would you compact the code
<krzyhoo>
am open tu suggestions
<yorickpeterse>
Dat indentation
<zenspider>
you need to make your code more presentable if you want us to be able (or willing) to read it and help
<krzyhoo>
zenspider: ok, will switch to two spaces. but do you have any other suggestions on how to make it more compact?
<zenspider>
I guess I'm not being clear... I don't want to read your code in its current state
<krzyhoo>
zenspider:
<krzyhoo>
ok. ot the message. am refactoring. do you have problem only with my idents? and god I am not being ironic. an honest to god question befor i paste it again
<krzyhoo>
zenspider, can you please take a look at it now?
<krzyhoo>
observe, the first x idents are there because i did cut it out of a more complex code structure
<erikh>
hrm
<zenspider>
line 6, 15, 28, and 37
t4nk967 has joined #ruby-lang
<erikh>
maybe use hash tables, and break out the conditional bodies into methods.
<t4nk967>
Hi, guys. I'm new to Ruby. I have a problem with hashes. Can anybody tell me what I'm doing wrong? http://pastie.org/3539602
<krzyhoo>
erikh: so passing something while result(binding) is not possible / frowned upon?
<erikh>
that's not what I'm saying. you can still use the binding, just instead of repeating yourself abstract the cut and paste job
<zenspider>
t4nk967: you've got ["a"] instead of "a" as your key
<zenspider>
t4nk967: ah. it is because your scan is using a group
<zenspider>
drop the parens
<zenspider>
t4nk967: you can simplify to phrase.downcase.scan(/[a-z0-9]+/).each do ... end
<erikh>
he could use /i there too, or was that dropped?
<zenspider>
ri String.scan to see what the parens are doing
<zenspider>
I assumed the downcase was intentional
<erikh>
oh derp
<t4nk967>
Ok thank you very much zenspider
<erikh>
missed that.
<t4nk967>
I will try
<zenspider>
good use of Hash.new 0... a lot of newbs miss that
beiter has joined #ruby-lang
<t4nk967>
Thanks
<krzyhoo>
erikh: what you mean by saying abstract?
<erikh>
krzyhoo: well,
<erikh>
take from_instance for example.
<erikh>
there's only two forms.
<beiter>
hio
<erikh>
and they always use an ivar
<erikh>
that's a place where you can simplify your code by creating another method using a conditional on a boolean.
<erikh>
to expound on that, you have a lot of additional repetition
<erikh>
most of it (if I'm reading correctly) can be grouped
<erikh>
take those groups, make methods out of them.
<krzyhoo>
erikh: will it really save some code?
<erikh>
then, instead of setting a bunch of things and calling binding, have those methods return a hash table of your values and then execute on the binding. that hash table will be available to ERB, which you can then use in your templates.
davidw has joined #ruby-lang
<erikh>
it will be more readable and save you time when you need to edit it.
<erikh>
this isn't about more/less code, really, it's about simplification.
<erikh>
(which, as confusing as it may sound, is different.)
<krzyhoo>
erikh: since I'm doing ruby not on such a regular basis
<erikh>
for example, if you need to change the string 'Source Qualifier', you need to edit in three places.
<krzyhoo>
i might habe problem with understanding what you just said
<erikh>
this is not about ruby -- this is just good programming practice
<zenspider>
krzyhoo: why don't you repeat the template 5 times, once per connector assignment?
<krzyhoo>
can you post a link to an example of what you suggest?
<erikh>
it's not going to help you if I do it
<krzyhoo>
erikh: i know
<krzyhoo>
but i could use aa link to docu which exmplains your suggestions
<krzyhoo>
zenspider: am I not doing that?? :)
<zenspider>
krzyhoo: how many times do you assign to template?
<krzyhoo>
once
<zenspider>
so why aren't you doing it 5 times?
<zenspider>
once per block of code
<krzyhoo>
maintenance in the future
<krzyhoo>
once the template changes
<krzyhoo>
would like to change it only in one place
vmoravec has joined #ruby-lang
<zenspider>
you use it 5 times... but you don't assign it 5 times
<zenspider>
why?
sandbags has joined #ruby-lang
roadkith has joined #ruby-lang
<krzyhoo>
well, what you see is just a small fragment of creating a really big dynamic XML document
<krzyhoo>
should the code for connectors change in the future
<zenspider>
you're not answering my question
<krzyhoo>
I'm affraid i will miss something while corrcting the template
<zenspider>
why do you repeat the exact same to_field assignment 5 times?
<krzyhoo>
no good reason, thist ist the only variable that stays constant
<krzyhoo>
i could cut that one out
<erikh>
thought about this while I was outside smoking: Hash#merge would be really beneficial here
<krzyhoo>
what about something like template.result(binding :param => 'Value')
<krzyhoo>
is there something like that available??
<krzyhoo>
erikh: wow
<krzyhoo>
looks great
nevynxxx has joined #ruby-lang
<krzyhoo>
i think I'll give it a shot
schroedinbug has joined #ruby-lang
rolfb has joined #ruby-lang
kitallis has joined #ruby-lang
PhilCK has joined #ruby-lang
francisfish has joined #ruby-lang
burns180 has joined #ruby-lang
rohit_ has joined #ruby-lang
dejongge has joined #ruby-lang
rohit has joined #ruby-lang
QoQOoO has joined #ruby-lang
tommyvyo has joined #ruby-lang
rippa has joined #ruby-lang
uniqanomaly has joined #ruby-lang
lsegal has joined #ruby-lang
workmad3 has joined #ruby-lang
burns180_ has joined #ruby-lang
kitallis has joined #ruby-lang
burns180 has joined #ruby-lang
dhruvasagar has joined #ruby-lang
ammar2 has joined #ruby-lang
<ammar2>
Hello, I was getting this error: "#<NoMethodError: undefined method `getbyte' for #<String:0x7fe7329e2cf0>>" and I have no idea why it is occuring as the string object does have a getbyte method(http://ruby-doc.org/core-1.9.3/String.html#method-i-getbyte)
<ammar2>
Oh. heh. Thanks, I'll go ahead and install 1.9
srbartlett has joined #ruby-lang
leriksenau has joined #ruby-lang
<zenspider>
ammar2: or you can write 1.8 code
<zenspider>
ammar2: look at String#[]
brushbox has joined #ruby-lang
<leriksenau>
Hi all, I've been struggling with my sinatra app not writing its scss stylesheets out to my css_dir - it populates the cache, but no matter what I do it won't write to the public/stylesheets dir
<reitelles_>
Gray|2: yes, a few... maybe it's not the best choice for beginners...
<reitelles_>
:) or _why, of course
<reitelles_>
by the way, hackety hack might be handy
<injekt>
I hear good things about the koans
slyphon has joined #ruby-lang
<reitelles_>
i checked koans.heroku.com, it's not very intuitive
burns180 has joined #ruby-lang
rdavila has joined #ruby-lang
<andrewvos>
Right so suddently 1.8.7 is *not* installed. Disappeared?
<andrewvos>
rvm lost it?
<injekt>
hidden it because you should be using 1.9 perhaps
<injekt>
:D
<Gray|2>
thanks guys.
<reitelles_>
Gray|2: you're welcome, that's what this channel is for, i guess ;)
<Mon_Ouie>
Or you upgraded RVM and you don't have the latest patchlevel installed and need to specify it explicitly?
<A124>
How can I define a method for an class instance, instead of the class itself? Please ^^
<andrewvos>
Mon_Ouie: Ahh yeah. Exactly that :)
<injekt>
A124: class Foo; def hello; end; end
<Gray|2>
so, if I can't achieve the results by myself. should i try find a tutor ?
<injekt>
oh wait instance of the classes class or instance of the class
<A124>
injekt: What?
<injekt>
A124: what are you trying to do?
<rue>
Gray|2: You can, but chiefly you should just start doing stuff.
<A124>
injekt: arry = Array.new; def ...
<rue>
It's hard to know what you can do when you're starting out. The only way to find out is to try
<injekt>
oh
<A124>
injekt: I want to define method only for that particular instance
<mortice>
<A124>
injekt: or other way around, to achiev the same funtionality
rdavila has joined #ruby-lang
RickHull has joined #ruby-lang
<injekt>
A124: def arry.meth; end
<A124>
injekt: Oh. That simple. Will check it out. Thanks ;)
<A124>
injekt: Oh yeah! Thank you a lot Sir!
andrewhl has joined #ruby-lang
<Gray|2>
rue: do not want to seem like a whiner :) , but i tried before learn delphi spent a lot of time, but don't understand how to develop :)
<rue>
No-one does, until they do it.
<A124>
injekt: Noone answered me this today. It's object anyway. So I'm able to define it. I haven't though of it.
<rue>
Gray|2: Nobody learns to program in a university, either, unless they do it separately
<reitelles_>
injekt: nice, i didn't know you could do that
<rue>
Sure you did
<A124>
Umm.. I have a one one little: How can I undefine a method? .. Searching doesn't help in this case :(
<shevy>
Gray|2 the only way to learn ruby is to write ruby scripts. reading books gives you only a foundation, but you should build the foundation by yourself and your brain and start to think in the ruby way practically - with real code
<rue>
You just didn't realize that def self.foo; …; end is just def anyobject.foo; …; end
<Gray|2>
deryldoucette: The most purposeful use of blocks is to abstract common types of loops into more friendly forms ... i don't understand...
<Gray|2>
:(
<Gray|2>
rue: just a function? okay, but why need function, lambdas, blocks?
<retro|cz>
Can I use Python lib from ruby?
<retro|cz>
I saw something like RubyPython
<retro|cz>
but not sure where to find
<deryldoucette>
i dont know how to explain it to you then. read the rest of that paragraph it gives an example for what he means
<rue>
Gray|2: Do the examples on that page answer the question? Canonical example is [1, 2, 3].each {|number| puts number }
<rue>
So, it's an anonymous function that's easy to pass around. (It's also a closure, but you'll learn about that later.)
m3nd3s has joined #ruby-lang
<outoftime>
Gray|2: to be clear, the things you define with "def blah" are not functions -- they are methods. the difference is that a method is always bound to an object, referred to with "self". lambdas are closer to functions, in that they do not have an idea of "self"
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
slyphon has joined #ruby-lang
<shevy>
Gray|2 did you understand what a block is?
<shevy>
yield comes afterwards when you understand a block in ruby
<outoftime>
Gray|2: "lambda", "block", "proc", and "function" are words that can be used more or less interchangeably in Ruby, although there are some subtle differences that you don't need to worry about right now.
<deryldoucette>
hrmm people can correct me if i'm wrong so i'll explain it as i understand it in my head
<outoftime>
Gray|2: do you know JavaScript?
Sailias_ has joined #ruby-lang
<Gray|2>
guys, i reply not so fast, because i need time, to translate and understand :)
<deryldoucette>
think of a ruby method (def blah where blah is the method name) see how the method is named? a block is the same thing but with no name. its a bunch of code between the { and } that you can pass around (hand off to methods ect) and yield is a keyword that, when you pass say the data returned from a method, whatever is passed in gets put where the yield keyword is
<deryldoucette>
anyone want to refine that?
<outoftime>
deryldoucette: it may not be helpful to elide the difference between methods and procs (functions)...
<deryldoucette>
*I* have a hard time understanding procs :)
<outoftime>
deryldoucette: the fact of methods being bound to objects and functions not is important, particularly with respect to Gray|2's question about why we have both
<deryldoucette>
outoftime: ok. my knowledge is a bit flaky in some areas. probably why that came out wrong
<outoftime>
deryldoucette: no worries, just accepting your invitation to refine : )
<deryldoucette>
perfectly acceptable and glad you took it up :)
<andrewvos>
This little bot makes me laugh a few times a day. Good stuff
<outoftime>
Gray|2: if you are comfortable with JavaScript, I can give you an example that may help explain what is going on inside blocks.
<Gray|2>
outoftime: no, i'm sorry, but i don't know JavaScript.
<mistym>
Is it possible to see what class an eigenclass is derived from from within the eigenclass? `self.class` from within a `class << self` block returns `Class`, not the class it's extending.
<outoftime>
Gray|2: is Ruby your first programming language?
<outoftime>
mistym: class <<""; superclass; end #=> String
<mistym>
outoftime: Thanks.
<Gray|2>
outoftime: yes.
<outoftime>
Gray|2: then I wouldn't worry too much about understanding exactly how blocks work. it's kind of advanced. just learn how to use them for their most common uses
<outoftime>
Gray|2: [1, 2, 3].each { |i| puts i } #=> prints "1", then "2", then "3"
rubyplusplus has joined #ruby-lang
<Gray|2>
outoftime: understand.
<mistym>
Hm. Though actually, it's the superclass of the class it's extending! How interesting. I'm instantiating a subclass of a class with the `class << self` stuff happening in the superclass. `superclass` in the `class << self` is returning the parent class, not the specific subclass.
<outoftime>
mistym: I think I'd need to see the code to understand what you're saying...
<outoftime>
mistym: or a reduction thereof
dlazic88 has joined #ruby-lang
<mistym>
E.g. `class A; class << self; ...; end ... class B << A; DSL goes here; end`
slyphon has joined #ruby-lang
<Gray|2>
outoftime: as i undertand if i need more than one line, i should write this: [1, 2, 3].each do
<mistym>
I'm trying to find out the name of B from within its DSL methods. `superclass`, written in A's eigenclass, returns A when accessing the method from B.
<outoftime>
Gray|2: yes, that's just two options you have for the syntax.
<Gray|2>
| i|
<Gray|2>
outoftime: okay
burns180 has joined #ruby-lang
<Gray|2>
where i can get simple more tasks for beginner?
<Gray|2>
or may be you can write 2-5 tasks for me here? if it possible.
<nofxx>
those two, you don't need any other to start, search/tuts and docs online will rescue you later
<nofxx>
with more advanced/specific topics
<nofxx>
Gray|2, dunno what you like to play with, but nice first programs with persistence are nice in ruby! try writing a simple command line that write a line to 'redis'
<nofxx>
its like, 15 lines of code...read write... nice example, there's all in the redis gem README
futurechimp has joined #ruby-lang
ttilley has joined #ruby-lang
mssola has joined #ruby-lang
pemeon has joined #ruby-lang
<Gray|2>
nofxx: what does mean 'redis' ? :)
<shevy>
it's the name of a game I suppose
<shevy>
gem install redis
<shevy>
I mean gem
<nofxx>
Gray|2, it's a simple database, easy to play/install then sqlite/mysql .....
<Gray|2>
oh)
<Gray|2>
i know sql))
<nofxx>
it's not really equal, there's no SQL.. but that not the point here
<injekt>
I have been reading facebook dev docs all day, excuse me if I sound like an asshole. Those docs make me mad :-)
<shevy>
but you can avoid using Proc for a very long time, it's really not needed to learn and understand all of ruby in one day
<nofxx>
injekt, I need to make some work with that fbgraph thing too... using it? the gem
<Gray|2>
block it's chunk of code(function) that can be passed as argument to another function
<injekt>
nofxx: I'm not now no, I'm doing all the requests myself, I got tired of all the APIs :(
<Gray|2>
shevy: okay, let me read plz
<shevy>
haha
<injekt>
nofxx: just made our work app able to accept users linking their accounts to twitter and facebook so it's posts to those too. It's a bit of a PITA
<shevy>
Gray|2 well you should understand the chapters before it though
andrewvos has quit [#ruby-lang]
<shevy>
best start at chapter 1, 2, 3, 4 ... :D
<nofxx>
injekt, I did the login with the oauth gems, working nice. Need to post some stuff now.
<nofxx>
injekt, need to get an action approved too... 'help a institution'
<nofxx>
injekt, in brazil we can donate store invoices to charity, it;s a gov thing to increase fiscal income. Some cents go to charity.
<injekt>
nofxx: neat
<nofxx>
we made a app to help donation of those online. fb looks nice to support.
futurechimp has joined #ruby-lang
seoaqua has joined #ruby-lang
gasbakid__ has joined #ruby-lang
rippa has joined #ruby-lang
Nss has joined #ruby-lang
ascarter has joined #ruby-lang
francisfish has joined #ruby-lang
apeiros_ has joined #ruby-lang
burns180_ has joined #ruby-lang
kitallis has joined #ruby-lang
RomyRomy has joined #ruby-lang
Teste12344 has joined #ruby-lang
Teste12344 has quit [#ruby-lang]
io_syl has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
slimfit has joined #ruby-lang
SuperTa__ has joined #ruby-lang
darkf has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
aza_kibou has joined #ruby-lang
morozovm has joined #ruby-lang
morozovm has quit [#ruby-lang]
<nofxx>
So, what's the ruby a like hype of the moment for mobile dev? ruboto, 3 or 4 I forget now...
morozovm has joined #ruby-lang
<nofxx>
I imagine jruby should be nice in android
tekin has joined #ruby-lang
headius has joined #ruby-lang
twittard has joined #ruby-lang
Sailias__ has joined #ruby-lang
A124 has joined #ruby-lang
<deryldoucette>
nofxx: ruboto is jruby
<deryldoucette>
see ruboto core and rubuto startup on market
<deryldoucette>
ruboto irb when launched if you look at the bottom left of your tablet/phone will show itializing jruby
any-key has joined #ruby-lang
<deryldoucette>
i use that along with TextWarrior and MobileDoc Free+Ruby1.93 stdlib docs to do stuff on my asus transformer
frangiz_ has joined #ruby-lang
heppy has joined #ruby-lang
twittard has joined #ruby-lang
krzyhoo has joined #ruby-lang
<seoaqua>
is there any site similar with tryruby.org?
arronmabrey has joined #ruby-lang
<krzyhoo>
Hey guys. How can use use group_by for nested grouping? Heres a pseudo code of what i really need
<Gray|2>
could you show simple example to understand?
<Mon_Ouie>
It just returns a string to describe the object
<Mon_Ouie>
There's an example on the page you linked
<Gray|2>
Mon_Ouie: :( i don't understand...
frangiz has joined #ruby-lang
reitelles has joined #ruby-lang
cyri_ has joined #ruby-lang
burns180 has joined #ruby-lang
Tearan has joined #ruby-lang
frangiz has joined #ruby-lang
<soahccc>
Hmm when I call something like this (with system method) it echos the -n within the log instead of applying the option to the echo command... system('echo -n "\0" > foo.log')
<soahccc>
If I paste the same thing into my terminal it works :/
zmack has joined #ruby-lang
<apeiros_>
soahccc: try reading the docs on Kernel#system
<apeiros_>
though…
<apeiros_>
soahccc: yeah, system uses sh, your terminal uses (probably) bash
<soahccc>
echo should be the same? o.O
frangiz_ has joined #ruby-lang
RickHull has joined #ruby-lang
<apeiros_>
echo in bash is a built-in and probably probably more options
<drbrain>
on linux, does bash as bash behave differently from bash as sh?
Heimidal has joined #ruby-lang
Zeitfrei has joined #ruby-lang
<drbrain>
I think most times bash and sh are hard-linked, but I can't recall if they have special behavior
Heimidal has joined #ruby-lang
curtism has joined #ruby-lang
curtism has joined #ruby-lang
Carnage\ has joined #ruby-lang
<apeiros_>
it actually interests me, but right now the apple event is more interesting :)
RickHull has joined #ruby-lang
<drbrain>
I think BSD is the only common UNIX where sh is not bash
<apeiros_>
in OSX, sh ain't bash afaik
<deryldoucette>
∴ sh --version
<deryldoucette>
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)
<drbrain>
matled: I'd be surprised if it's a sqlite database
<matled>
drbrain: why?
twittard_ has joined #ruby-lang
<matled>
just from looking at the file I think I'd be able to parse it and infere the table structure. I just thought there might be an existing parser already..
<drbrain>
matled: because sqlite uses a binary format
<matled>
drbrain: it's the content of the sqlite database in some other format
<andrewvos>
krzyhoo: You shouldn't just ask one person a question
<andrewvos>
krzyhoo: And also don't ask to ask :)
<matled>
I just don't know what format it is :)
<andrewvos>
krzyhoo: I'm not even that good at ruby
<matled>
maybe it's just something the app has implemented...
<drbrain>
matled: looks like it's a simple flat-file store
<drbrain>
but, easy to parse
<krzyhoo>
well i tried to ask the question to the general audience
<krzyhoo>
but no one came up with a solution
<andrewvos>
:/
<krzyhoo>
and this one is killing me
<matled>
drbrain: it would be nice to know the encoding rules without looking at examples :)
<drbrain>
matled: yeah :/
<andrewvos>
krzyhoo: Can you trim down the example?
<andrewvos>
krzyhoo: It's like 18:20 here and my brain is fucked
<andrewvos>
krzyhoo: meh close enough... I have to go now: a.map {|d| {d.first => d.drop(1)}}
srbaker has joined #ruby-lang
mark_locklear has joined #ruby-lang
<andrewvos>
krzyhoo: Cool?
<andrewvos>
Right I'm off peace
burns180_ has joined #ruby-lang
butchanton has joined #ruby-lang
StevenRingo has joined #ruby-lang
srbaker has joined #ruby-lang
<krzyhoo>
andrewvos: willl check it out now
brianpWins has joined #ruby-lang
<krzyhoo>
shevy: would do gladly
<krzyhoo>
but had to display the complexity
Keva161 has joined #ruby-lang
<krzyhoo>
andrewvos: it is awesome
tenderlove has joined #ruby-lang
<krzyhoo>
does the trick
wallerdev has joined #ruby-lang
Skif has joined #ruby-lang
reitelles has quit [#ruby-lang]
retro-in-better- has joined #ruby-lang
srbaker has joined #ruby-lang
publicvoid has joined #ruby-lang
srbaker has joined #ruby-lang
qpingu has joined #ruby-lang
gregf has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
srbaker has joined #ruby-lang
Technodrome has joined #ruby-lang
srbaker has joined #ruby-lang
srbaker has joined #ruby-lang
frangiz has joined #ruby-lang
srbaker has joined #ruby-lang
savage- has joined #ruby-lang
gianlucadv has joined #ruby-lang
<krzyhoo>
andrewvos: it is awesome/quit
Heimidal has joined #ruby-lang
frangiz_ has joined #ruby-lang
slyphon has joined #ruby-lang
srbaker has joined #ruby-lang
burns180 has joined #ruby-lang
solars has joined #ruby-lang
Keva161 has joined #ruby-lang
amerine has joined #ruby-lang
<rue>
Awesome, Retry, Quit? > _
srbaker has joined #ruby-lang
tyman has joined #ruby-lang
postmodern has joined #ruby-lang
tyman has quit [#ruby-lang]
pemeon has joined #ruby-lang
frangiz has joined #ruby-lang
virunga has joined #ruby-lang
virunga_ has joined #ruby-lang
justinmcp has joined #ruby-lang
Heimidal has joined #ruby-lang
lbrent has joined #ruby-lang
cg433n has joined #ruby-lang
sbabiy has joined #ruby-lang
frangiz has joined #ruby-lang
rippa has joined #ruby-lang
srbaker has joined #ruby-lang
Heimidal has joined #ruby-lang
gix has joined #ruby-lang
srbaker has joined #ruby-lang
twittard has joined #ruby-lang
slyphon has joined #ruby-lang
futurechimp has joined #ruby-lang
bnagy has joined #ruby-lang
sdeobald__ has joined #ruby-lang
srbaker has joined #ruby-lang
Sailias has joined #ruby-lang
Jake232 has joined #ruby-lang
musicmatze has joined #ruby-lang
<musicmatze>
Hi there! Can anyone help me, I want to learn how to write Ruby extensions in C.
chimkan_ has joined #ruby-lang
wdperson has joined #ruby-lang
<musicmatze>
I don't need tutorials or stuff, I can google this stuff on my own, but I need a person who can help me if I get stuck with stuff
gnufied has joined #ruby-lang
chimkan has joined #ruby-lang
<RickHull>
come back when you get stuck
gsav has joined #ruby-lang
<musicmatze>
I already got stuck... I understood how to use the VALUE stuff in C, but I didn't understood: Can I create a variable (for example a global) in C, without useing it in Ruby for writing bindings, just as I learned it in C?
<RickHull>
it's rare to get a one-on-one mentorship out of the blue. but if you have a problem that someone, most will be glad to
erics has joined #ruby-lang
<RickHull>
that someone *can help with
burns180_ has joined #ruby-lang
looopy has joined #ruby-lang
<musicmatze>
yes, thanks!
sbabiy_ has joined #ruby-lang
andrewhl has joined #ruby-lang
twittard has joined #ruby-lang
Heimidal has joined #ruby-lang
<musicmatze>
maybe my wording was odd: Can I create Variables in C as I want, without make it accessable from Ruby?
<musicmatze>
... maybe for writing bindings?
srbaker has joined #ruby-lang
<matled>
musicmatze: is it really important that it is not accessible? you can create new objects from C and unless you pass them assume that they're used only by you. if someone starts modifying the methods you use to create the object or gets your object from ObjectSpace its their own fault if things break...
srbaker has joined #ruby-lang
rippa has joined #ruby-lang
srbaker has joined #ruby-lang
<musicmatze>
The thing is, I try to write a binding to X. I have to create global variables (in C) where the Display* is stored. I want to create a class in Ruby for the Display to access the Display with the functions from Xlib. It's useless to access the C global Display* from Ruby, right... ? So I don't need to pass the variable to Ruby...
srbaker has joined #ruby-lang
<matled>
musicmatze: first of all Display* is no VALUE, i.e. it is no ruby object, secondly you don't have to store the display in a global variable in C. I think it would make sense to create a class that holds a pointer to the Display, so you can connect to multiple X servers from ruby
srbaker has joined #ruby-lang
aBound has joined #ruby-lang
<musicmatze>
You may misunderstood me! I don't want to create connections to existing X servers, I want to write Bindings to the Xlib to be able to start Displays and stuff from Ruby, to write a Windowmanager in Ruby for example!
<shevy>
yeah
<shevy>
the RubyOS is forming slowly
<chris2>
just implement x11 directly, no need to link against du libx11
<musicmatze>
chris2: what do you mean?
<dominikh>
it's a protocol, you can implement it in pure ruby
<musicmatze>
Excuse me, I'm from Germany and I'm not exercised in english language
<musicmatze>
Ouh. I think your right... I never thought about this!
srbaker has joined #ruby-lang
<shevy>
ironic thing is that chris2 and dominikh are also from Germany :D
<chris2>
musicmatze: x11 is just a network protocol
<lianj>
shevy: and you speak german too ;)
<musicmatze>
My girlfriend told me so: "Maybe the guys are also from germany, just try it!" -.-' I feel stupid now!
<Sleck>
Hello everyone, I installed haste's gem but I cannot use haste command, why ?
<Sleck>
Maybe a PATH error, I don't know so much gem.
<Sleck>
Someone can help me ?
<rue>
Omg it's a chris2
<musicmatze>
lianj: thank you for the link, too! Do you know that guy?
<lianj>
no, but i have taken part out of that lib for my own tinkering
gsav has joined #ruby-lang
andrewhl_ has joined #ruby-lang
<musicmatze>
lianj: He's writing curious Ruby code! Indention of more than 2 spaces *_*
<musicmatze>
lianj: what kind of tinkering do you do?
andrewhl__ has joined #ruby-lang
<Mon_Ouie>
He's not using spaces, he's using tabs
<shevy>
burn him!
<Sleck>
Need help
sbabiy has joined #ruby-lang
<musicmatze>
it's so ugly. I would like to fork him and fix this, but so much lines!? O_o
<yorickpeterse>
What would be a good Ruby sandbox to prevent people from being able to execute "funny" code?
Swimming_Bird has joined #ruby-lang
<yorickpeterse>
There's a bunch of GH projects but they don't seem to very active/popular
<Mon_Ouie>
It's not the convention, but it's not ugly; it's just that tabs are being displayed as wide as 8 spaces in this case
<Mon_Ouie>
Any editor can allow to reconfigure that to 2, 4, or whatever you want
Sleck has quit [#ruby-lang]
<shevy>
musicmatze well it's easy to fix the indent in the editor
<musicmatze>
right.
<shevy>
but
<shevy>
it is even easier to shoot the tab-users :>
<musicmatze>
right, too! :-D
Heimidal_ has joined #ruby-lang
cored has joined #ruby-lang
cored has joined #ruby-lang
Heimidal_ has joined #ruby-lang
<musicmatze>
allright, I'm off now! Bye
<chris2>
rue: sup dude
<rue>
chris2: Very little :) Did your 1.9 upgrade go OK?
<chris2>
yes
<chris2>
was not much work either
tekin has joined #ruby-lang
dominikh has joined #ruby-lang
cg433n has joined #ruby-lang
macmartine has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
sdeobald__ has joined #ruby-lang
sbabiy has joined #ruby-lang
benanne has joined #ruby-lang
PhilCK has joined #ruby-lang
jenrzzz has joined #ruby-lang
adambeynon has joined #ruby-lang
burns180 has joined #ruby-lang
Technodrome has joined #ruby-lang
LnxBil has joined #ruby-lang
<LnxBil>
Hi everybody! I want to regmatch an utf8-string and it doesn't work. I use /.../u and ruby 1.9.3 - Regexpr works with english letters, but not with non-english. Any ideas?
<apeiros_>
LnxBil: //u has no effect on 1.9
<apeiros_>
LnxBil: ri Regexp, it has a quite good overview of available character classes
Heimidal has joined #ruby-lang
<apeiros_>
oh, actually I have to correct myself, //u has an effect, it ensures that the encoding of the regexp itself is considered to be utf-8
outoftime has joined #ruby-lang
sheila has joined #ruby-lang
<LnxBil>
For the record, \p{word} instead of \w does the trick. Thanks apeiros_
<apeiros_>
oh, wow, if I'd had read your question properly, I could have even told you that :-S
<apeiros_>
I thought you didn't want non-english letters to match, sry :)
<LnxBil>
No problem, I found my answer :-D
davidw has joined #ruby-lang
phlipper has joined #ruby-lang
sheila has joined #ruby-lang
Kero has joined #ruby-lang
CodyD has joined #ruby-lang
gasbakid has joined #ruby-lang
DEac- has joined #ruby-lang
<Jake232>
Is there a way I can make it so that I can access my hashs values
<Jake232>
via
<Jake232>
some_hash.some_key
<injekt>
sure, but why?
<apeiros_>
Jake232: reinventing openstruct?
<apeiros_>
and yes, see Object#method_missing
<apeiros_>
alternatively see Object#define_singleton_method
slimfit_ has joined #ruby-lang
<Jake232>
I may have being thinking about this in the wrong way, pretty sure I just found a better way to do this
<kyrylo>
What's up with ruby-lang.org?
<kyrylo>
Ah, wait. Everything is ok now.
fayimora has joined #ruby-lang
<Jake232>
still down here
brushbox has joined #ruby-lang
sheila has joined #ruby-lang
<drbrain>
it's probably trying to buy the new iPad
erpelchen has joined #ruby-lang
<kyrylo>
Did they air it today?
<drbrain>
yes
<drbrain>
new iPad, new apple TV
<erpelchen>
hello everyone. im looking for advice on doing something the right way
burns180_ has joined #ruby-lang
<injekt>
erpelchen: what's your question?
retro-in-better- has joined #ruby-lang
<erpelchen>
working on a shell tool thats wrapping around another process. so i guess Id have to read and write both the in/out of my process as well as the other tools in-/output
<erpelchen>
something as simple as gets and puts is sufficient, but I have to keep them from blocking each other. from what i know and have read, threads would be an option. are there better/easier ones?
<dominikh>
IO.select
StevenRingo has joined #ruby-lang
brushbox has joined #ruby-lang
<erpelchen>
@dominikh I’ll read up on that
srbartlett has joined #ruby-lang
JEG2 has joined #ruby-lang
brownies has joined #ruby-lang
Austin__ has quit [#ruby-lang]
gsav has joined #ruby-lang
jkyle_ has joined #ruby-lang
igaiga has joined #ruby-lang
havenn has joined #ruby-lang
H2H has joined #ruby-lang
<erpelchen>
okay, so just to check if I understand: I’d give IO.select the output of the process that i monitor, and the stdin(?) of my program and would get back an array with those that have something new for me. How can I figure out which ones these are, if the actions what to do with that input differ?
virunga has joined #ruby-lang
<drbrain>
erpelchen: you see if the socket you care about is in the return set
<erpelchen>
argh. Its getting late, maybe I should continue tomorrow :D *facepalms self*
<erpelchen>
thank you drbrain and dominikh
<dominikh>
:)
burns180 has joined #ruby-lang
Swimming_Bird has joined #ruby-lang
morozovm has joined #ruby-lang
srbaker has joined #ruby-lang
leriksenau has joined #ruby-lang
yorickpeterse has joined #ruby-lang
leriksenau has quit [#ruby-lang]
QaDeS has joined #ruby-lang
<erpelchen>
If I don’t do anything unless there is any input from the terminal or output from the controlled process, do I really need the timeout for IO.select ?
t has joined #ruby-lang
<jaimef>
hate it when something works fine in irb but not irl under bundler
<wwalker>
jaimef: it's controlled by the number of seals by the pier.
<drbrain>
erpelchen: if you want user input to modify the subprocess, yes
<drbrain>
hrm, actually, no
savage-_ has joined #ruby-lang
woollyams has joined #ruby-lang
<erpelchen>
cool
<Technodrome>
so who is working on a startup?
gsav has joined #ruby-lang
<drbrain>
I worked on some startups
<injekt>
I am
<wwalker>
any recommendations for how to most cleanly handle class instance variable accessors? Currently I do: https://gist.github.com/1996998
<injekt>
class << self; attr_accessor :base_dir; end
WillMars_ has joined #ruby-lang
<drbrain>
wwalker: ^^
tla has joined #ruby-lang
<wwalker>
injekt: drbrain: thank you! Of course while writing my question I thought about it differently and then searched again with different terms and found that same thing. Would you create an instance accessor like I did, or pepper the code with "self.class.base_dir"?
<wwalker>
versus just base_idr
<wwalker>
base_dir
Mon_Ouie has joined #ruby-lang
<Jake232>
if I have ['string1','string2'], and I want to turn that to ['<p>string1</p>','<p>string2</p>'], am I better just usting the map function
<Jake232>
and appending the beggining & ens of the string?
<injekt>
Jake232: yes
ovnimancer has joined #ruby-lang
<jaimef>
wwalker: hah
<drbrain>
Jake232: I would use map too
<Jake232>
I figured map was the way to go
<Jake232>
thanks
<injekt>
wwalker: meh, that's really down to you
<injekt>
wwalker: the helper method is merely sugar, just document it so
srbartlett has joined #ruby-lang
Sailias has joined #ruby-lang
amerine has joined #ruby-lang
matti has joined #ruby-lang
srbaker has joined #ruby-lang
<wwalker>
injekt: thanks.
retro-in-better- has joined #ruby-lang
ilyam_ has joined #ruby-lang
ilyam_ has joined #ruby-lang
burns180_ has joined #ruby-lang
jenrzzz has joined #ruby-lang
Heimidal has joined #ruby-lang
achiu has joined #ruby-lang
<zenspider>
hoe 2.16.0 released
<deryldoucette>
zenspider: she's been upgraded huh? ;)