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/
tshauck joined #ruby
ethndbst joined #ruby
ethndbst joined #ruby
obj_lesson joined #ruby
pabloh joined #ruby
Synthpixel_ joined #ruby
vitoravelino joined #ruby
happynoff joined #ruby
<happynoff>
Hi. How would you test a method supposed to call require ?
<happynoff>
(Using rspec)
timonv joined #ruby
macmartine joined #ruby
Know1edge1 joined #ruby
milkpost_ joined #ruby
heftig joined #ruby
andyparsons joined #ruby
looopy joined #ruby
Knodi joined #ruby
hadees joined #ruby
GreaseMonkey joined #ruby
<burgestrand>
happynoff: test just that
pantsman joined #ruby
pantsman joined #ruby
<happynoff>
burgestrand: ok but that's the point :/ I don't know how to test it
<burgestrand>
Oh, I see
<happynoff>
I tried Kernel.should_receive(:require)
hadees_ joined #ruby
<burgestrand>
And the result?
<happynoff>
called 0 times
<happynoff>
but the script is loaded
<burgestrand>
*shrug*
obj_lesson left #ruby
<happynoff>
And google is not my friend tonight :(
<burgestrand>
How about you require a certain file that declares something, instead?
burgestrand joined #ruby
<happynoff>
I tried to think about it
<happynoff>
a constant is not an option
<burgestrand>
Hm, I ponder, since the method is on Kernel, you might need to mock it out in the object calling require
<happynoff>
I thought about a method but it didn't work and I would have to undef the method before each test if it worked
<happynoff>
mocking Kernel ?
<happynoff>
or just stubbing :require
<burgestrand>
No, the object the method is defined on
<happynoff>
I just stubbed require on the object and it worked \o/
<happynoff>
thank you burgestrand !
Synthpixel joined #ruby
<burgestrand>
:)
stephenjudkins joined #ruby
axilla joined #ruby
<happynoff>
have a good day/night
minijupe joined #ruby
esparkman joined #ruby
araujo joined #ruby
wyhaines joined #ruby
ognevsky joined #ruby
MekkisFreenode joined #ruby
JumpMast3r joined #ruby
Ankhers joined #ruby
wilmoore joined #ruby
QaDeS_ joined #ruby
colloquialismic joined #ruby
colloquialismic joined #ruby
linoj joined #ruby
apok joined #ruby
s0ber joined #ruby
<marcamilly>
aren't .first and .count Ruby methods? even for version 1.8.7?
<marcamilly>
i am pulling data from an API, and I stored a collection in a variable
<marcamilly>
and when I try variable.first and variable.count
<marcamilly>
it keeps giving me nil
<marcamilly>
but when I do variable
<marcamilly>
it shows me all the items in the collection
<marcamilly>
thoughts?
badabim joined #ruby
maletor joined #ruby
<atmosx>
marcamilly: it's an array?
<marcamilly>
it returns this: => #<OpenStruct total=253,
<marcamilly>
ahh, you are right
<marcamilly>
so it's not is it
<marcamilly>
hrmm, so I should declare the variable an array and then set them in there?
<atmosx>
type puts variable.class
<marcamilly>
ruby-1.8.7-p302 > q.class
<marcamilly>
=> OpenStruct
<atmosx>
depends the most common mistake is that you create an array of arrays
<marcamilly>
that's what i see when I do .class
<atmosx>
marcamilly: array.first is available only in ruby19
<marcamilly>
ok
<marcamilly>
what about array.count
<marcamilly>
same?
<atmosx>
same
<marcamilly>
hrmm
<marcamilly>
damnit
<atmosx>
what os are you at?
<atmosx>
I write code only 1.9 so I was not sure but just checked
<marcamilly>
i am on OS X
<atmosx>
these methods are not supported
<marcamilly>
but the weirdest thing
<atmosx>
okay, then install macports, or rvm or brew
<marcamilly>
so some of the stuff I am seeing says it supports only 1.8.7
<raz>
marcamilly: sort of, i'll sketch something up
<raz>
thx for the pointer
<marcamilly>
k, np
Synthpixel joined #ruby
Manhose_ joined #ruby
Tasser joined #ruby
luckyruby joined #ruby
looopy joined #ruby
mxweas_ joined #ruby
syamajala joined #ruby
CannedCo_ joined #ruby
<rcs>
Anyone have a nice way to do something like ary.slice(1,ary.count-1) ? Something like ary[1..] or ary[1..inf] ?
erenrich joined #ruby
Manhose joined #ruby
daed joined #ruby
<flazz>
rcs: first, *rest = ary
<flazz>
rcs: rest = ary[1,-1]
krz joined #ruby
<heftig>
you mean [1..-1]
sythe joined #ruby
sythe joined #ruby
rushed joined #ruby
jwmann joined #ruby
linoj joined #ruby
Mahoek joined #ruby
<rcs>
flazz: Yeah.
<rcs>
heftig: Yeah.
<rcs>
Thanks both of you.
<flazz>
heftig: yep
sbanwart joined #ruby
Adept` joined #ruby
mickn joined #ruby
sdwrage joined #ruby
sbanwart_ joined #ruby
poindontcare joined #ruby
jimmy1980 joined #ruby
mickn joined #ruby
Cerales joined #ruby
stephenjudkins joined #ruby
mxweas_ joined #ruby
Araxia_ joined #ruby
sbanwart__ joined #ruby
Sliker joined #ruby
<Cerales>
Is it possible to have subclasses modify class constants without it affecting the constants in the superclass?
creativeprodigy joined #ruby
sdwrage joined #ruby
<Cerales>
I'm trying to write a superclass that has an array as a constant, then a bunch of subclasses which push additional values to that array, but I only want the subclasses to have those other values. i thought this was pretty trivial subclassing behaviour, but i can't get it to work without all the values being global across the classes
<Stuffness>
What's a way to check if a string is one of the names of the subclasses of a certain class
banisterfiend joined #ruby
chessguy joined #ruby
x0F__ joined #ruby
flip_digits joined #ruby
headius joined #ruby
wyhaines joined #ruby
<shevy>
Stuffness what
<shevy>
if a string is what?
<shevy>
can you give an example data
JumpMast3r joined #ruby
rpowell joined #ruby
Seisatsu joined #ruby
p1d_ joined #ruby
<Stuffness>
shevy, let's say I get a string from the user, "Wheel". I want to create a new Wheel object, but only if it's defined as a subclass of my Car class. What's the best way to check this
<erwinpdev>
rippa: that's what I tried but I got the feeling something is going wrong. It's a xorkey in this case and I am not getting the results I was expecting.
iocor joined #ruby
<abonec>
banister_, hah, pry -r it was i actually try find, but it not work as 'pry -r file.rb', only for 'pry -r ./file.rb', thx
pete__ joined #ruby
<banister_>
abonec: yeah taht's a ruby 1.9.2 thing
Telling joined #ruby
pencilcheck joined #ruby
<apeiros_>
erwinpdev: maybe show a simple xor example. input and expected output.
<erwinpdev>
Hmm, I marked it private by mistake, are you able to see it?
<apeiros_>
erwinpdev: simplify it down. I'd suggest to make an example based on `bytes[0] ^ xorkey.to_i`
<apeiros_>
i.e., what do you expect 'a'.bytes.to_a[0] ^ -91 to be
<erwinpdev>
Good question I only got input and output for the whole algorithm and not for this specific step
<apeiros_>
erwinpdev: as I understood, you have the same algorithm working correctly in C#?
<erwinpdev>
Yes
<erwinpdev>
But it's not mine, only trying to implement it in Ruby
Nss joined #ruby
<apeiros_>
yes, but you got the C# code, so you could see what individual steps result in…
jensn joined #ruby
Morkel joined #ruby
<apeiros_>
one thing that could be a problem is that ruby has no upper limit on integers, so a negative integer in binary in ruby basically has an infinite number of 1's at the beginning
<apeiros_>
(if I remember correctly) so when you do >> 4 on a 16bit int in one language, you get at least 4 zeros at the most significant bits. you don't get those in ruby.
aod joined #ruby
<erwinpdev>
Ah, ok. Is there any way to get the same behaviour?
<apeiros_>
use unsigned arithmetic
<apeiros_>
you can & 0xffff the negative number to get its equivalent
<erwinpdev>
So, shouldn't I do & 0xff in that case?
<apeiros_>
also, why do you pack("U*") at the end?
S1kx joined #ruby
<apeiros_>
yes
<erwinpdev>
To convert the decimal ascii values back to ascii/string
<rippa>
U is utf-8
<apeiros_>
you want C, not U
<apeiros_>
also, are you sure your algorithm is correct otherwise?
<apeiros_>
because you access array indices that aren't set…
<apeiros_>
(ruby won't complain upon that, it'll return nil, and nil responds to ^ too…)
<erwinpdev>
I probably mixed it up the pack bit.
<erwinpdev>
The original code reads the password as a byte array in UTF8
<erwinpdev>
and outputs the result in ASCII
TMM joined #ruby
<apeiros_>
erwinpdev: I'm talking about your first for loop
<apeiros_>
line 12
<apeiros_>
you access index 1 of the array, but in the case of 'a' as input, you do not have an index 1
<MHD0>
man, ruby is great
<apeiros_>
your array consists of a single element at index 0…
<erwinpdev>
Hmm, yeah you are right. I have to have another look at the original code
<erwinpdev>
I see the difference now. I come from a C background myself, so I am used to writing the for loop conditions myself. So basically it should something like for (int i; i < bytes.length; i++)
<apeiros_>
for i in 1...bytes.length
<erwinpdev>
where int i = 1 btw
<apeiros_>
though, for-in loops are actually rarely used in ruby code…
<erwinpdev>
Ok, but is it < or <=, because that's an important difference in this case?
<apeiros_>
... means end of the range is excluded
<apeiros_>
for i in 1..10 will have start with i = 1 and end with i = 9
<erwinpdev>
Ok, so it should read for i in 0...bytes.length in Ruby?
<erwinpdev>
Ok, I get it.
<apeiros_>
yes, as I pasted :)
<apeiros_>
so for a string 'a', the loop won't be executed
<erwinpdev>
Sorry, you were just a bit quicker then me ;)
<apeiros_>
for 'aa', it'll be executed once, with i = 1
<apeiros_>
you probably want the same in the second loop…
<erwinpdev>
yes, that's the way it should be. Thanks, I'll change it.
<apeiros_>
beware, the conditions is only evaluated once…
<apeiros_>
though, since you keep increasing the size of the string, that's probably what you want…
<erwinpdev>
What would be the Ruby way to do this, because you said for loops are rarely used?
<shevy>
In ruby code you rarely find for loops because other ways are more natural
chessguy joined #ruby
<apeiros_>
well, I'd stick with the for-in for now and first fix the algorithm
<erwinpdev>
yeah
_debo joined #ruby
<apeiros_>
but we use things like 1.upto(bytes.length) do |i| … end
<apeiros_>
actually, `1.upto(bytes.length-1) do |i| … end` here
<erwinpdev>
What's the backtick for?
<apeiros_>
delimiting the code within my irc message
<apeiros_>
it's not part of the code.
<erwinpdev>
ah, ok ;)
<erwinpdev>
Is there a way to make line 3 read the string as UTF8? I played around with the pack option, but only received errors?
<apeiros_>
you want unicode codepoints?
<apeiros_>
unpack("U*")
<apeiros_>
but unicode codepoints are not restricted to 8bits…
<erwinpdev>
sorry, working with Ruby 1.8.7 here, so no codepoints
<apeiros_>
ruby 1.8 has no issues with that
<apeiros_>
1.8 is just encoding unaware. but it can very well unpack("U*")
<erwinpdev>
I thought it didn't support codepoints
<apeiros_>
it doesn't understand encodings.
<apeiros_>
that is, a string is always just an array of bytes to ruby 1.8.
<apeiros_>
but as said, unpack("U*") exists in ruby 1.8.
<erwinpdev>
I know
<erwinpdev>
I changed it now to bytes = string.bytes.to_a.pack("U*")
<apeiros_>
that makes no sense…
<apeiros_>
you unpack a string, not an array.
<apeiros_>
string.unpack("U*"),
<apeiros_>
-,
Manhose joined #ruby
Pip_ joined #ruby
<apeiros_>
but again, as I understood, you want to do arithmetics on a per-byte basis, not a per-unicode-codepoint basis.
<apeiros_>
the former is guaranteed to be always 1 byte, the latter can go much higher
<erwinpdev>
Yes, per-byte as far as I know.
<apeiros_>
then you do not want unicode codepoints.
<apeiros_>
bytes = string.unpack("C*") (the same as bytes = string.bytes.to_a)
<apeiros_>
ruby doesn't care whether your string contains unicode or not.
<erwinpdev>
Ok
io_syl joined #ruby
<erwinpdev>
So now I need to add & 0xff to the xorkey variable
<kke>
corkey
<kke>
life goes on
<apeiros_>
erwinpdev: http://pastie.org/2964231 is what I tried, but I think the loop is still not quite correct. result is correct for 'a' as input, but longer strings are wrong.
<apeiros_>
care to show the original C# code?
workmad3 joined #ruby
mk03 joined #ruby
<erwinpdev>
I'll have a look at your code to see where it differs from mine
shevy joined #ruby
vmatiyko left #ruby
king-of-spain joined #ruby
martisj joined #ruby
sj26 joined #ruby
wyhaines joined #ruby
<erwinpdev>
I changed the xorkey, but mine and your code show different results
<erwinpdev>
while I can't find any real difference in the code.
<apeiros_>
also check for common ancestors and/or included modules.
<alexhanh>
apeiros_: yes :) the thing is that it took me a long and painful road to discover all of these various exceptions
Codif joined #ruby
<apeiros_>
alternatively: rescue the exceptions that you actually can handle
<apeiros_>
what sense is there in rescuing exceptions you can't actually handle?
Pip joined #ruby
ezkl joined #ruby
<Tasser>
apeiros_, I once saw 'rescue Exception' a piece of code...
<apeiros_>
if you really want to rescue all, even if you don't handle it - rescue the ones you do handle first, then rescue StandardError
<apeiros_>
Tasser: I do that too. but then again, I know what I do :-p
Nss_ joined #ruby
<alexhanh>
I guess I'd want Net lib to throw exceptions with better names and with unified namespace
<alexhanh>
we have libraries such as HttParty, but for some reason they don't address this issue
<alexhanh>
maybe I'm thinking fundamentally wrong here
<apeiros_>
alexhanh: well, all Errno' errors are thinly wrapped exceptions from the underlying C code
Pip joined #ruby
Pip joined #ruby
jimmy1980 joined #ruby
jetblack joined #ruby
Manhose joined #ruby
fetimo joined #ruby
<Tasser>
apeiros_, I'm pretty sure the guy didn't.
<apeiros_>
well possible
vmatiyko joined #ruby
<Tasser>
apeiros_, and I assume the fact that you're op here and don't have tits should give you enough reputation to be allowed to use 'rescue Exception' ;-)
<alexhanh>
I think majority of the time when people fetch something with http, they are mostly interested whether the request was succesful and *maybe* handle different http errors
<apeiros_>
I liked the idea of having to declare all exceptions your method could raise (including those raised by methods you use within your method)
<apeiros_>
but I think that'd lead to other atrocities…
<alexhanh>
but now, it's not possible to do rescue Net/SocketSpecificException => be done with it
<apeiros_>
alexhanh: as said, `rescue => e` then
<apeiros_>
though, Timeout isn't a StandardError, which is slightly mean
<apeiros_>
so `rescue Timeout::Error, StandardError`, should have you covered.
<apeiros_>
alexhanh: also be happy you have exceptions.
* apeiros_
fiddles with C, exception handling *sucks*
Araxia_ joined #ruby
Tuxist joined #ruby
mickn joined #ruby
<alexhanh>
well, catching StandardError is almost like a 'catch all exceptions'? I mean we want to filter out socket/net/http specific errors and bubble the rest up.
<apeiros_>
it's not all, but close to it, yes
Jake232 joined #ruby
<alexhanh>
and the thing is, I haven't seen one place that would list all of these various exceptions (Errno, SocketError, EOFError, HttpError, etc.) that the openUri.open actually can throw
<apeiros_>
alexhanh: and you solve that by limiting your begin/rescue block to the relevant code
<apeiros_>
instead of putting just *all* code in there.
<alexhanh>
like how the hell I'm supposed to know all of those?
<apeiros_>
s/throw/raise/, throw means something different in ruby.
dv310p3r joined #ruby
<apeiros_>
you can't be sure with large blobs of code whether the origin is really net/http anyway
<alexhanh>
oh, good point.. hmm, maybe it's not openuri.open that throws all of those
<apeiros_>
or how do you know your EOFError is not caused by nokogiri?
ethndbst joined #ruby
<apeiros_>
but yes, I'd like ruby to have a proper attribution of something like 'packages', which could be extended to exceptions and warnings.
mikewintermute joined #ruby
<alexhanh>
Well, Nokogiri throwing anything except EOFError doesn't make sense.. so we are left with Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, SocketError, Timeout::Error and OpenURI::HTTPError
ethndbst joined #ruby
deadlock joined #ruby
Manhose_ joined #ruby
enikar joined #ruby
idoru joined #ruby
timonv joined #ruby
linoj joined #ruby
<alexhanh>
rest-client gem seems to patch things up
<alexhanh>
For the more common http error situation, they provide more specific exceptions, otherwise they give you RestClient::Exception
Manhose joined #ruby
<alexhanh>
that's my point, majority of the time, we are not interested what the cause of failure is if it's not httperror.. we just want to handle that case (and for example, re-queue the http get for later)
pen_ joined #ruby
jimmy1980 joined #ruby
<alexhanh>
but still bubble up other, non-http/network/socket specific exceptions
<HNDavid>
gets through boston globe's leaky paywall. i wrote it out of annoyance :)
<shevy>
hehe
esparkman joined #ruby
DMKE joined #ruby
Sliker joined #ruby
akem joined #ruby
Manhose_ joined #ruby
robotmay joined #ruby
Morkel joined #ruby
jonegg joined #ruby
Kn|t3 joined #ruby
headius joined #ruby
pantsman joined #ruby
<jonegg>
hello, I'm new to the Ruby community and I'm looking for a solid web framework. Not too huge (Rails) and not too small (Sinatra). Fast and clean. Any suggestions?
pantsman joined #ruby
<apeiros_>
are you intentionally removing the two best options from the list of available frameworks? :)
<jonegg>
that's why I ask
dagnachewa joined #ruby
<yxhuvud>
ramaze? padrino?
<jonegg>
Rails seems to be dirty and slow
<jonegg>
and Sinatra doesn't quite provide all tools I need
<jonegg>
but maybe my intention is wrong
<jonegg>
I'll take a look at Ramaze and Padrino
<jonegg>
something with REST would be beautiful
RomD joined #ruby
<jonegg>
or what do good ruby developers use for medium sized projects?
excelsio1 joined #ruby
banisterfiend joined #ruby
Eucharis joined #ruby
Kn|t3 joined #ruby
<jonegg>
I come from PHP and I'm used to that the framework includes everything (Validation library, ORM, email-library). Is this even required in Ruby with the Gems? Is it a good idea to use Sinatra and install a couple of gems for the rest?
kaneda joined #ruby
<wookiehangover>
jonegg: in that case, its a good idea to look into rails
<wookiehangover>
but beware that "learning rails" can be distinct from "learning ruby"
<jonegg>
but precisely because Rails includes everything, I perceive it as dirty
<wookiehangover>
I'd call it mature
ognevsky joined #ruby
<wookiehangover>
it has *just enough*
<jonegg>
It doesn't feel natural
<nelsnelson>
A dirty old man?
<wookiehangover>
eh, any mvc framework regardless of language can "have too much"
<nelsnelson>
JBoss has wayyyyyyyy too much. For instance. (Not a mvc fw, admittedly.)
<wookiehangover>
just because people have made tooling for common tasks doesnt necessarily mean that its bloated
<nelsnelson>
Spring is a better example of a bloated mvc framework.
<wookiehangover>
sure
<nelsnelson>
Coming from a Java world, rails is pristine.
<wookiehangover>
but rails is really great in terms of rapid productivity, finding answers for common problems, etc
<wookiehangover>
its still really easy to create a bloated rails app
Codif joined #ruby
<wookiehangover>
but that comes down to the person(s) writing the code ;)
<jonegg>
so rails isn't as bad as his image?
<wookiehangover>
exactly
<HNDavid>
what did you use in PHP?
<jonegg>
Kohana
<HNDavid>
mm, don't know of it
<wookiehangover>
but for the same reason that jquery is becoming the lingua franca for interacting with the DOM in javascript, Rails solves a lot of common problems and has a LOT of people actively testing each release in production
<jonegg>
or FuelPHP
<jonegg>
and Lithium seems also interesting
<wookiehangover>
which is an easy point to miss when using stuff that's less widely adopted or "rolling your own"
<wookiehangover>
ya I used to do Zend framework stuff in php land
lennyks_ joined #ruby
<jonegg>
my intention was that Rails is not really good, but Ruby developers were too lazy to build something better and just use rails
spike2251 joined #ruby
<jonegg>
apart from Rails, there aren't many popular Ruby web frameworks
dyer joined #ruby
<wookiehangover>
only if you adjust your definition of "popular"
nachtwandler_ joined #ruby
cdepue joined #ruby
katselphrime joined #ruby
<jonegg>
Should a ruby framework include everything or nothing and you have to install a bunch of gems?
cook1es joined #ruby
<wookiehangover>
IMO there's a fine balance between framework bloat and gem bloat
<Mchl>
there's sinatra that is gaining some popularity
<wookiehangover>
sinatra has been popular for a while
<wookiehangover>
padrino is great, IMO
<Mchl>
oh... so it's in fact losing popularity now? ;P
<jonegg>
Sinatra looks good, but I'd have to install gems for everything
<Mchl>
I'm always a step behind everyone it seems
<jonegg>
and because I'm new in Ruby, I don't know the "best practice" gems
<yfeldblum>
the last time someone thought "Rails is not really good, let's build something better", they did - and then refactored Rails to be that better thing
<wookiehangover>
jonegg: padrino solves a bunch of that
<bpfh>
jonegg, what changes do you propose to make rails better?
<wookiehangover>
yfeldblum: merb ;)
<wookiehangover>
jonegg: but if you're just getting started... learn about sinatra and rack
<yfeldblum>
yep, the merb crew were like: "this is how rails should be"; the rails crew were like: "please make rails that thing"; problem solved
<jonegg>
bpfh, I guess it looks less dirty and huge if it gets faster and more modular
<wookiehangover>
and make sure you have familiarity with the ruby runtime (dependency loading, configuration, classes, modules, etc)
<yfeldblum>
obviously, glossing over 99.9% of the history
<wookiehangover>
yfeldblum: and yehuda was like "sure"
<wookiehangover>
similar story with sprockets / tilt
dotnull joined #ruby
quest88 joined #ruby
linkz0r joined #ruby
<wookiehangover>
"rails frontend support is garbage, lets fix that"
<yfeldblum>
wookiehangover: what's this sprockets/tilt story now?
<wookiehangover>
just an example of a psuedo game-changing external project getting pulled into rails
fetimo_ joined #ruby
<jonegg>
I heard that Rails merged with Merb. So Rails 3 is something completely different than Rails 2?
<wookiehangover>
and generally making things better
<wookiehangover>
jonegg:
<wookiehangover>
yes
macmartine joined #ruby
<wookiehangover>
and rails 3.1 is much improved from rails 3
<jonegg>
ok, I'll take a serious look at Rails, I hope it turns out that it's not as bad and huge as I think
<wookiehangover>
its really
<wookiehangover>
not
<wookiehangover>
but watch a few railscasts to get started
QaDeS joined #ruby
<jonegg>
is it easy to replace the ORM used in Rails?
<wookiehangover>
jonegg: yes, but activerecord is really nice
<wookiehangover>
IMO you'd only need to use something else if you're planning on using mongo or couchdb
<yfeldblum>
yes; the rest of rails depends on the ActiveModel public API, not on ActiveRecord; so any ORM/ODM which exports that public API will integrate perfectly with your app
linkz0r left #ruby
Tachyon joined #ruby
<yfeldblum>
ActiveRecord implements the ActiveModel public API; so does Mongoid and many other ORM/ODM's
<bpfh>
jonegg, can you point us some framework that represents, in your opinion, a faster and and more modular software than rails or you think rails is dirty and huge based on your subjective impressions?
<yfeldblum>
and that's all ActionController/ActionView need
thone_ joined #ruby
bruegel joined #ruby
<jonegg>
bpfh, it's based on my subjective impression and what I've heard, I have't took a serious look at rails yet, but Kohana or FuelPHP are good frameworks in my opinion which would be even better if everything would be modular. node.js is kind of nice because it includes nothing and the express framework is extremely clean, mostly because it's quite new
<jonegg>
I guess Rails just has to improve his image
<jonegg>
Can I replace every component in Rails with another Gem?
<Norrin>
at the rate cpus get faster, and if rails/ruby can become more multi-threaded, the perceive performance issues should fade into the past
decoy_octopus joined #ruby
<jonegg>
Rails feels bloated because it cuts off bad in performance comparison
<decoy_octopus>
hello
<jonegg>
*does poorly
<wookiehangover>
jonegg: performance problems in rails are generally a non issue
linoj joined #ruby
<wookiehangover>
i mean, you're gonna be let down if you want to do tons of real time shit
<Norrin>
wookiehangover: true that twitter dropped rails for performance issues?
<wookiehangover>
eg) live chat
<lennyks_>
jonegg, I agree, if you have seen talk by Aaron Patterson, he shows how bloated the middleware stack is in Rails 3, 30% slower performance than Rails 2.3.8
<wookiehangover>
Norrin: they didn't drop is per se, they just had to start augmenting it because they had really insane needs
<Norrin>
insane eh? like the need to be profitable?
<apeiros_>
Norrin: even if they *did* ditch it, people forget that it enabled them to become that big in the first place.
<wookiehangover>
500-1000 of anything PER SECOND qualifies as insane to be
<Norrin>
apeiros_: true. it's a good start, even if it has to be ditched alter
<Norrin>
later*
<wookiehangover>
s/be/me
<wookiehangover>
github is still largely rails based
<apeiros_>
of course, you can design every little poop-ass website to handle a couple of thousand requests per second, but then you'd probably be obsolete by the time you're done…
<wookiehangover>
granted, there are like 30 separate apps in there
<wookiehangover>
but twitter is a really special case in terms of performance
<wookiehangover>
rails experience very few traffic issues with "normal" amounts of load--meaning what most developers will experience on a given project
<Norrin>
its a company based on a web application. if the app is going to be computational, i can't say that's an insane case
<lennyks_>
twitter still doesn't scale, 'fail whale' occurs quite often in hight pick times
<Norrin>
groupon is a sales company, so twitter's needs are insane to groupon. but they're different type of companies
<Norrin>
seems normal for a computational website is what i mean
<shevy>
titter
<wookiehangover>
ok, gotcha
<wookiehangover>
but I'd even say that groupon's needs definitely exceed what's considered normal
<Norrin>
seems normal for a company that's actually going to make money
decoy_octopus left #ruby
<wookiehangover>
hold on, groupon makes money?
<wookiehangover>
;)
Indian joined #ruby
<wookiehangover>
I thought they just bought out entire consulting shops and then had IPOs
<Norrin>
i wouldn't lump every individual devs test projects into this pool of what's considered average. those aren't sites/apps that actually earn anything
<wookiehangover>
Norrin: that's a bit cynical, but I see your point
<yfeldblum>
Norrin: same applies w.r.t. every language/framework
<wookiehangover>
i'm just saying that rails is really good for the majority of people's needs
MHD0 joined #ruby
<wookiehangover>
and then there's a lot that can be done in terms of optimization, if your traffic warrants it
Beoran_ joined #ruby
<wookiehangover>
so IMO it has nothing to do with the ability to make money
Mahoek joined #ruby
JumpMast3r joined #ruby
<shevy>
RAILS IS FOR MONEY
<jonegg>
is there a ruby framework with a really good architecture? Modular, fast, REST, good OOP (DI etc.)?
<shevy>
jonegg they all suck
<shevy>
also "fast"
<shevy>
this is ruby man!!!
<wookiehangover>
shevy's right
<shevy>
Modular. Fast. Rest. OOP. Ponies.
<shevy>
decide!!!
<wookiehangover>
jonegg: and they're all on teh githubz
<shevy>
oh
<Norrin>
as up and coming sites/companies run into rails performance issues, i think hardware will eleviate those problems in the future. pressure will be applied to rails core-team to improve performance also. so probably a good idea to use rails for what its good at. making ideas into reality quickly
<jonegg>
Ruby frameworks don't use good OOP?
<shevy>
perhaps github is a good framework
<wookiehangover>
so you can read the code and figure out if they meat yr REST, good OOP (DI etc.) needs
<shevy>
jonegg I don't know what you mean with "good OOP"
<shevy>
is Java good OOP? C++?
<yfeldblum>
jonegg: DI is great for Java, but kind of useless for Ruby
<wookiehangover>
shevy: objects, lots of them!
<shevy>
what is DI?
<shevy>
ah
<shevy>
Dependency Injection?
<jonegg>
I'm still used to the PHP "OOP" and DI isn't bad there, but rarely used
<shevy>
I am writing classes in ruby, then translate this into PHP as much as possible :)
<shevy>
one day I need to write a code-converter ...
<jonegg>
I need to write my own Ruby framework.
<yfeldblum>
jonegg: as opposed to writing an app?
<jonegg>
This was irony, just to be clear. I expected far faster reactions to this.
excelsior joined #ruby
<apeiros_>
we use ruby. we're supposed to be slow.
<jonegg>
The thing is it seems I can't befriend me with the existing ruby frameworks, but the language is beatiful
<jonegg>
*beautiful, not beatful
ryanf joined #ruby
<bpfh>
just out of curiosity, does anyone here make a living programming ruby and not rails?
<Norrin>
any language that can perceive what the author's intent is as well as ruby is going to be slower. a framework built on that language is going to be slower. why does it matter?
<Norrin>
either you want very readable code, which fewer lines than most, or you want to have to be very specific in your code. have to choose
<Norrin>
s/which/with
hadees joined #ruby
<jonegg>
I want clean code and no black magic.
<Norrin>
try jsp
<Norrin>
or .net
<Norrin>
magic isn't real however. its just the stuff is predefined in rails. lots of stuff. all documented however - no magic involved
<jonegg>
I don't like this link_to_xyz thing
<yfeldblum>
bpfh: i use ruby for multiple things: automating infrastructure with chef, various scripts, etc
<Norrin>
that's deprecated syntax i think
<yfeldblum>
bpfh: and rails
<tommylom1ykins>
is there a preferred way of executing shell commands in ruby? is `command` generally acceptable?
<jonegg>
I'll learn Ruby and rack from ground up and start experimenting with Rails and Sinatra soon, then I can choose
jbpros joined #ruby
<bpfh>
yfeldblum, nice but in this case for me you're still a rails programmer :)
otakutomo joined #ruby
<apeiros_>
jonegg: any sufficiently analyzed magic is indistinguishable from science…
sorin joined #ruby
otakutomo joined #ruby
jonegg joined #ruby
<jonegg>
nah, IRC-client crashed. Thank you for your help and suggestions.
<yfeldblum>
bpfh: or did you mean "does anyone program webapps in ruby with other-than-rails?"
raythecat joined #ruby
DDAZZA joined #ruby
<bpfh>
no, I meant someone that codes(in ruby) things unrelated to webapps and makes a living of it
pen joined #ruby
Zal joined #ruby
Zal joined #ruby
Indian joined #ruby
banisterfiend joined #ruby
<Zal>
Hello, any particular tutorial/book recommendations for an experienced python programmer to learn ruby?
<Zal>
also, which ones should I avoid? ;)
Codif joined #ruby
banisterfiend joined #ruby
<shevy>
Zal if the python programmer in question is experienced, that person won't need any books!
<shevy>
Zal that python programmer should read through http://pine.fm/LearnToProgram/?Chapter=00 at least once. It won't be any challenge but that python programmer will understand most about ruby afterwards
<Zal>
shevy, excellent, thanks.
mikepack joined #ruby
wyhaines joined #ruby
looopy joined #ruby
CannedCorn joined #ruby
<bpfh>
Zal, why are you learning ruby?
GoldenPie joined #ruby
<Zal>
bpfh, for a job
<Zal>
bpfh, probably eventually to use RoR
<Zal>
I like coming at frameworks from the language up, rather than learning the language through the framework, generally.
p1d joined #ruby
h4mz1d joined #ruby
<Zal>
bpfh, is that what you wanted to know? :-)
<bpfh>
yes
<Zal>
Any tips are appreciated.
axilla joined #ruby
<apeiros_>
Zal: many people new to ruby seem to like the ruby koans
<Zal>
in python, string concatenation works but is frowned upon for all but the simplest joins. Is it more freely used in ruby?
ycy joined #ruby
<ycy>
hi
<ycy>
when using 'case x', where x is an instance of Integer, is it possible to specify a condition like '<= 10' in the 'when' cause?
Codif joined #ruby
johntitor joined #ruby
<Guest81719>
ycy, no, but you can use Ranges
mksm joined #ruby
<ycy>
mksm: what if I do not now the inferior range?
p1d joined #ruby
BrianE joined #ruby
Manhose joined #ruby
daed joined #ruby
jonegg joined #ruby
incluye joined #ruby
tomzx joined #ruby
<tommylom1ykins>
'require 'FileUtils'' ==> cannot load such file
Targen joined #ruby
<tommylom1ykins>
(1.9.3-p0 via rvm)
<tommylom1ykins>
any clues?
<shevy>
Zal string concatenation is just sending a message to String objects in ruby. You use it whenever you need it. In the simplest form, in Ruby you use "<<", which means append, more or less. So for instance, x = "foo", and then x << "bar"
MHD0 joined #ruby
ycy left #ruby
Asher joined #ruby
dbgster joined #ruby
Morkel joined #ruby
<Zal>
shevy, gotcha, thanks. I just read that strings are mutable in ruby, so that pretty much answers my question too.