<drbrain>
simon_d: that installs the gems from 1.8 cache dir into 1.9
<simon_d>
ahhh nice. Right I'm going to give it a good. I'll make sure I back up cos I'm expecting to break half the stuff I've been installing the last week or so!!
<simon_d>
^ give it a go
<whitequark>
manveru: what's wrong with bundler?
<whitequark>
it's awesome imo
<bougyman>
it's bundler
<bougyman>
nuff said
darkf has joined #ruby-lang
<Harzilein>
btw, is it possible to do "real" rasterbars with opengls? probably with shaders?
<Harzilein>
opengl*
mark_locklear has joined #ruby-lang
vesan has joined #ruby-lang
S1kx has joined #ruby-lang
<lianj>
Harzilein: you can do most of the old demo effects using fragment shaders
<Harzilein>
what i want is render some white text on black background and xor r, g and b rasterbars over it, so when they meet there is a white rasterbar and black text, or if red and blue meet, there is a purple rasterbar and green text
<mrb_bk>
burgestrand: still around?
jobicoppola has joined #ruby-lang
srbartlett has joined #ruby-lang
Oloryn_lt1 has joined #ruby-lang
<erikh>
hey all; what's the new hotness regarding coverage tools? still simplecov?
<andrewvos>
Coverage is for little girls
<seanstickle>
Don't forget to use Hexawise
<erikh>
heh
<erikh>
also, I just broke reek I think
<erikh>
drbrain: rdoc -C is pretty awesome, thanks for writing it
<Asher>
what's the best way to have a gem's bin in the path?
<Asher>
like i have two CLI utilities in bin/ to use the gem
<Asher>
how should i have it auto-setup when the gem is instlaled?
<whitequark>
Boohbah: each and map are doing different things
rpowell has joined #ruby-lang
h4y4shi_ has joined #ruby-lang
<whitequark>
each returns the original Enumerable
<whitequark>
map returns the array of things which the block returned
<whitequark>
compare
<whitequark>
%w{a b c d}.each { |s| s.upcase }
<whitequark>
%w{a b c d}.map { |s| s.upcase }
dreinull has joined #ruby-lang
<josh9>
I benchmark agent.get(url) multiple times with mechanize and get about 1.5 seconds on each one. isn't mechanize suppose to persist the connection and therfore be slow only at the first run?
<Boohbah>
i like my Cards with no quotes around them
rpowell has joined #ruby-lang
flip_digits has joined #ruby-lang
<josh9>
http://pastebin.com/aD9maHpM - can someone explain those benchmarks? it looks like my connection is not persisted.
znz_jp has joined #ruby-lang
Andrevan has joined #ruby-lang
rivaler has joined #ruby-lang
MistyM has joined #ruby-lang
havenn has joined #ruby-lang
dv310p3r has joined #ruby-lang
fozze has joined #ruby-lang
fayimora has joined #ruby-lang
huxley_sparks has joined #ruby-lang
nebbie`` has joined #ruby-lang
muzone_ has joined #ruby-lang
cyndis_ has joined #ruby-lang
publicvoid_ has joined #ruby-lang
sj26 has joined #ruby-lang
dRbiG has joined #ruby-lang
sinuc has joined #ruby-lang
sinuc has joined #ruby-lang
lucas has joined #ruby-lang
jmeeuwen has joined #ruby-lang
tdubz has joined #ruby-lang
DefV has joined #ruby-lang
shyouhei has joined #ruby-lang
Tick-Tock has joined #ruby-lang
dabradley has joined #ruby-lang
Aengus has joined #ruby-lang
duckinator has joined #ruby-lang
srbaker has joined #ruby-lang
zoo-zed has joined #ruby-lang
anthony has joined #ruby-lang
rivaler has joined #ruby-lang
imperator has joined #ruby-lang
andkerosine has joined #ruby-lang
<andkerosine>
Alive?
jacktrick has joined #ruby-lang
<jacktrick>
~sNo4oKEr3*
t4nk363 has joined #ruby-lang
t4nk363 has quit [#ruby-lang]
havenn has joined #ruby-lang
savage- has joined #ruby-lang
capcook has joined #ruby-lang
gokul has joined #ruby-lang
flip_digits has joined #ruby-lang
andkerosine has quit [#ruby-lang]
flip_digits has joined #ruby-lang
rpowell has joined #ruby-lang
flip_digits has joined #ruby-lang
znz_jp has joined #ruby-lang
flip_digits has joined #ruby-lang
capn_kryptonite has joined #ruby-lang
flip_digits has joined #ruby-lang
rippa has joined #ruby-lang
flip_digits has joined #ruby-lang
gianlucadv has joined #ruby-lang
<josh9>
how to monitor open http connections that opened by my ruby script?
<josh9>
i am trying to figure out the reason for slowliness of agent.get (mechanize) and according to some devs here mechanize using a persistant connection and therefor should be faster after the first time being used. this is not what i experience in my code.
RomyRomy has joined #ruby-lang
<postmodern>
josh9, you could try using wireshark to watch network activity
RomyRomy has joined #ruby-lang
<postmodern>
josh9, also the persistent connections will only make the requests quicker, but if the server is overloaded or your connection is slow it wont help
<drbrain>
josh9: a) turn on logging in mechanize
<drbrain>
b) (not recommended) turn on raw logging in net/http/persistent
<postmodern>
josh9, also it could be your DNS server is slow at resolving the hostname to an IP
<josh9>
postmodern: drbrain ok. i'll start with logging of mechanize. thanks
<drbrain>
josh9: the first connection is going to be the same speed as open-uri
<andkerosine>
That's a method of my Subreddit class, but it only returns the data about each of the posts in a given sub. Am I going about it wrong?
<drbrain>
andkerosine: #@name bleeeeeh
<andkerosine>
Whyzat?
<drbrain>
use #{@name}, it'll save someone's sanity
<andkerosine>
Duly noted.
<drbrain>
most people don't know you can do that, and that's a good thing
<andkerosine>
Mm-hmm.
<freedrul1>
woah you can do that
<freedrul1>
?
<drbrain>
andkerosine: this seems fine, I'm unsure of your problem
<andkerosine>
Well, for instance...
<drbrain>
freedrul1: yes ☹
<andkerosine>
Right now, you can do Client.r('programming').submissions[0].body
<andkerosine>
But I'd like to be able to replace .body with .comments
<andkerosine>
Once it's converted to an OpenStruct, there doesn't seem to be a way to add to it.
<drbrain>
andkerosine: I see
<andkerosine>
At least, not without it being interpreted as a value rather than a method.
<drbrain>
I would follow a more activerecord-like pattern instead of what you have, then
nuclearsandwich has joined #ruby-lang
<andkerosine>
Alas, I'm unfamiliar with what that might constitute.
<drbrain>
instead of creating an OpenStruct, create a Submission object from s['data']
<drbrain>
the Submission object can know how to fetch comments (I'm assuming that's a separate request)
<andkerosine>
Mm-hmm.
<drbrain>
also, OpenStruct is not very suitable for Serious Business
<drbrain>
it is very, very memory heavy since it creates methods per-instance, not per-class like a Struct
<drbrain>
for throw-away scripts it's very convenient, though
<andkerosine>
Well, there'll be a lot of chaining on the user's end. I'd like for them to be ably to do .x.y.z instead of ['x']['y']['z'].
<andkerosine>
*able
<drbrain>
yeah, but since the domain shouldn't change much, making Real Objects shouldn't be too much work
<andkerosine>
Via method_missing?
<drbrain>
you can do it with a Struct and Hash#values_at
<andkerosine>
Will do, but I'm still having trouble seeing where a new method goes in. Just... reopen the Struct-created class?
<drbrain>
yes
<andkerosine>
Excellent. : )
<andkerosine>
Thank you.
rpowell has joined #ruby-lang
<drbrain>
you can also S = Struct.new :a, :b do def foo() end; end
h4y4shi_ has joined #ruby-lang
<andkerosine>
Recommended?
Tref has joined #ruby-lang
<andkerosine>
Along the same lines as bracket-lass interpolation, I mean.
<drbrain>
it's a matter of preference
<andkerosine>
*less
<drbrain>
I think either is fine
<drbrain>
you can also class S < Struct.new(:a, :b) … end
<drbrain>
just so you have options :D
<drbrain>
I often use this last one ^^
<andkerosine>
Ruby is beautiful.
<drbrain>
even though it leaves an anonymous class floating around
<Tref>
guys, I'm playing around in a rails console and trying to get comfortable with inspecting objects and such. When I set @request_struct with an initializer then call the instance from the console I see something like: "#<MLSRETS::Client:0x007fd2314ca0f8 @request_struct=#<MLSRETS::Client::Requester:0x007fd2314ca058>"
<Tref>
my question is what is that @request_struct
<theconartist>
did you just drop a triple-dot
<Tref>
it looks like an instance variable but i can't access it with client.request_struct
<drbrain>
Tref: probably something internal to the MLSRETS library
<drbrain>
theconartist: an elipsis?
<drbrain>
yes‼
<andkerosine>
It's a very useful syntactic construct.
<Tasser>
what other http post libs are out there? net/http doesn't work the server is too broken
<manveru>
oO
<manveru>
what part is broken?
<Tasser>
they don't send a response code
<andkerosine>
What does that impede?
futurechimp has joined #ruby-lang
<yorickpeterse>
The server doesn't send a response code? What moron is in control of that?
<yorickpeterse>
HTTP is pretty much useless without response codes
<manveru>
i guess your option is netcat then...
<manveru>
or a socket
<Tasser>
manveru, chromium can deal with it :-/
<manveru>
then use selenium
<yorickpeterse>
Given the server is fixed and sends status codes Net::HTTP should be fine, if you want to use less "raw" code I can recommend HTTPArty
<yorickpeterse>
* HTTParty
<yorickpeterse>
Although I'm not a huge fan of it using class methods
<Tasser>
yorickpeterse, net/http breaks
<Tasser>
manveru, curl can deal with it I suppose...
<Tasser>
so that's why I use curb
<Tasser>
yorickpeterse, "Are you uploading the file using the form?" <- first response. I didn't dig further
<yorickpeterse>
So just to recab, you're trying to talk to an HTTP server that doesn't send HTTP response codes?
<Tasser>
aye
<Tasser>
curl can deal with it, so I use curb.
<yorickpeterse>
Then it's not an HTTP server according to the spec
<yorickpeterse>
Though I find it strange that Curl can deal with that
<yorickpeterse>
I would've imagined it would just bail out like Net::HTTP
<Tasser>
it's resilient - although that guy doesn't have any clue about http as it looks like :-/
<yorickpeterse>
Given he doesn't know about status codes that seems the case
<yorickpeterse>
If possible I'd highly suggest to yell at him for that :)
<yorickpeterse>
Either way, I'm not sure if Curb is a C extension or anything but try to make sure that it's loaded in the same environment as it was compiled in
<yorickpeterse>
e.g. if it is compiled for 1.8 it will break in 1.9
<andkerosine>
It's very basic, but once you get the hang of the standard markup, everything else in your Ruby repertoire is yours to use on the Web.
<andkerosine>
I wrote a file host in ~20 lines. ^_^
<Stalkr_>
damn
<andkerosine>
I imagine it could be done in far less, really.
<Stalkr_>
Seems powerful
<Stalkr_>
I had a look at RoR - my mind was blown, just a look at the structure
<andkerosine>
It's not pleasant.
<andkerosine>
I've still not taken the plunge given that Sinatra suits all my needs at the moment.
<andkerosine>
When creating a project drops ~200 files on you by default, it's my opinion that something is wrong.
<Stalkr_>
With Sinatra, is HTML/CSS a prerequisite?
MistyM has joined #ruby-lang
<andkerosine>
Well, they're a prerequisite for the Web, so...
<andkerosine>
If you've picked up Ruby, I can't imagine HTML/CSS giving you much trouble.
ramonmaruko has joined #ruby-lang
<Stalkr_>
How about just basic HTML/CSS knowledge? Do I have to dive into books, read hundreds of pages before I can get into Sinatra?
<Stalkr_>
I don't mind reading and learning at all, I just rather do it right from start and read good stuff :)
<andkerosine>
You could probably pick up HTML in a few hours, in all honesty.
<andkerosine>
It's not "functional", it's markup. You learn when, where, and why to use certain tags, and there's little more to it.
<andkerosine>
CSS is a fair bit nastier, given the discrepancies between browsers, but it's still essentially just rote memorization mixed with a little bit of figuring out what works/"looks good".
<andkerosine>
http://tizag.com/ is an excellent resource for beginners.
<Stalkr_>
Thanks for the link, but care to explain what it is about? How do I use it? :)
dejongge has joined #ruby-lang
<Stalkr_>
Is it something like scaffold for RoR?
wyhaines has joined #ruby-lang
andrewhl has joined #ruby-lang
<burgestrand>
Stalkr_: twitter bootstrap is a set of styles, to quickly get a website up and not have it look like crap from the start, which is useful if you’re testing ideas out
sirfilip has joined #ruby-lang
<burgestrand>
Stalkr_: the link itself points to an application written in sinatra, and serves as a starting point for a new application
<burgestrand>
it’s a bit… heavy for a beginner though
<darix>
burgestrand: well beginners can copy paste from their components page :)
<burgestrand>
darix: mostly talking about the sinatra application, not twitter bootstrap :)
<Stalkr_>
I heard that Sinatra would be a better approach for a newbie than RoR
<burgestrand>
Stalkr_: indeed it is, but that particular example has a lot of things set up; some of it you don’t need, some of it is good if you learn how to do yourself
<darix>
Stalkr_: better. dunno. let's say different.
priteshjain has joined #ruby-lang
<burgestrand>
it’s like having somebody else do your homework
<shevy>
95% of the things in ruby you'll pick up automatically as you get into the habit of writing code, but without the 5% start you'll not learn much
<Stalkr_>
So if I know Ruby well enough, I will also know Sinatra well enough?
petercooper has joined #ruby-lang
tomzx has joined #ruby-lang
<shevy>
of course not
<shevy>
in order to learn sinatra, you must use it
<shevy>
but it's the same thing with rails
<shevy>
if you don't want to learn, don't :)
JEG2 has joined #ruby-lang
<Stalkr_>
I want to learn, I just don't know how to learn or rather, where to learn it :)
<shevy>
knowing ruby very well will help though
frem has joined #ruby-lang
<shevy>
there are quite some folks who use rails, but don't really know ruby
<shevy>
well write something that is useful to you
<shevy>
my first two projects in ruby were an IRC bot and a game
<shevy>
I managed to break my IRC bot ... and I tried to redesign the game and stopped in the middle :\
looopy has joined #ruby-lang
<Stalkr_>
You don't use Sinatra or Ror?
<shevy>
hmm not really
<Stalkr_>
So you just do desktop apps?
<Stalkr_>
/scripts
<shevy>
nah
<shevy>
I do everything in ruby without any limitation
<Stalkr_>
Also web apps?
<shevy>
sure
<shevy>
the core of what sinatra does is very small
<Stalkr_>
So you can write a full-blown web application (Facebook, Twitter, Google, Netflix etc) without any framework like Sinatra, RoR?
<Stalkr_>
Only with pure Ruby?
<shevy>
get '/hi' do; "Hello World!"; end
<shevy>
Stalkr_, well, what is "pure" ruby. of course I use tons of addons
<lianj>
shevy prolly still uses pure webrick
<shevy>
I hate webrick
<shevy>
it's an unusuable pile of crap
<Stalkr_>
AddOns = Gems, right?
<lianj>
shevy: orly?
<shevy>
Stalkr_ gems are just like tarballs ... foobar-1.0.0.gem
<shevy>
Stalkr_ but sure, I use Gems too
<shevy>
lianj yes! it must die
<shevy>
lianj what do you use for web stuff?
RomyRomy has joined #ruby-lang
<Stalkr_>
Let's say I have a list of URLs - at the bottom there is a form/input and a submit button. Would there be a Ruby Gem that would add the URL I entered in the form automatically to the list?
<burgestrand>
Stalkr_: no, that gem would not be awfully useful
slyphon has joined #ruby-lang
<lianj>
shevy: rack
<Stalkr_>
burgestrand
<Stalkr_>
upps, so I would have to do that myself?
<burgestrand>
Stalkr_: in addition, there comes a lot of decisions to make for even such a small thing :)
<shevy>
even in rails you'd have to do some form-thingy
<burgestrand>
Stalkr_: so while there certainly would be ways to make a gem for that, that specific gem would be useful to very few people
<shevy>
god :/ I hate things like '<%= form_tag("/search", :method => "get") do %>'
<Stalkr_>
So I would have to code a gem that myself or is it not a Gem I would for then?
<Stalkr_>
would look for*
<burgestrand>
Stalkr_: gems are more keen to what we call libraries
tekin has joined #ruby-lang
Aphelion has joined #ruby-lang
<burgestrand>
Stalkr_: they package up functionality that’s commonly used; they could provide you with a way to make a call to a website, login with facebook or lay down the foundation for creating your own website like Sinatra or RoR
<Stalkr_>
so Sinatra is a gem?
<Stalkr_>
or a framework?
<burgestrand>
Stalkr_: both :)
<Stalkr_>
o:
Spooner has joined #ruby-lang
<shevy>
gem is a way to package something for distribution
<shevy>
you can then do:
<shevy>
gem install sinatra
<shevy>
on your machine
<shevy>
and it will install sinatra
<burgestrand>
Stalkr_: gems is how you distribute things; instead of the sinatra authors giving you all of the source code for sinatra for you to put somewhere in your project, you declare that your project is using the gem 'sinatra' and you can use it from there right off the bat
<shevy>
and download sinatra*.gem into a cache dir
<shevy>
on my system this cache dir is /usr/lib/ruby/gems/1.8/cache/
<shevy>
Stalkr_ have you installed Ruby yet?
<Stalkr_>
So if I wanted to do something like above, add something to a list, it would be easier to just code it myself?
<Stalkr_>
Yes, IRB
<burgestrand>
Stalkr_: you’d most likely have to code it yourself
<shevy>
Stalkr_ ok good :)
<Stalkr_>
Would it be hard to code? Would something like that take a long time to learn?
<burgestrand>
Stalkr_: I’d say it’s the perfect starter project if you want to learn web development
<shevy>
define 'long'
<Stalkr_>
Weeks or maybe months
<shevy>
yeah
<shevy>
I'd say it takes a long time to learn :)
<burgestrand>
Stalkr_: you could get the first version up and running in under a day with some mentoring, but to build your own facebook it’d take months
<shevy>
but there are different levels to achieve
<shevy>
Level 1 Stalkr_
<shevy>
Level 2 Stalkr_
<shevy>
Level 3 Stalkr_
<shevy>
you need experience points man
<Stalkr_>
Oh, I am not interested in making something hardcore like Facebook, my project is very simple
<shevy>
ok so you only want to reach Level 1
<burgestrand>
Stalkr_: indeed, I’m just trying to put it into scope :)
<shevy>
that's not so hard
<Stalkr_>
Yeah, I guess Level 1 for know
<Spooner>
I remember when I used to mod games, the first thing newbies used to ask is "So how do I make the game into an MMO" :) FIRST THING, every time.
<Stalkr_>
Then keep on adding things for my page
<lianj>
Spooner: hehe, so how? :P
<shevy>
haha
<burgestrand>
Stalkr_: is ruby your first programming language?
<shevy>
well at least they WANT to learn
<Stalkr_>
Yup
<Spooner>
lianj: How do you get to Carnegie Hall? :D
<burgestrand>
Stalkr_: sweet, how long have you been at it?
<shevy>
oh and
<Stalkr_>
Only a few days tbh
<shevy>
Stalkr_, how did you find ruby?
<Stalkr_>
Actually, I really wanted to develop for the iPhone - I looked into Objective-C, but was told to learn a high-level language first. People recommended Python and Ruby, but Ruby stood more out for me
<Stalkr_>
So now I want to give Ruby a shot, try to do simple web apps and see how I go from there
<burgestrand>
Sound plan.
<Harzilein>
Stalkr_: ruby seems to fit a tiny bit better with wanting to learn objc too.
<Stalkr_>
I just liked the idea that everything is an object, so I thought Ruby might give a better idea of OOP than Python :) I am not saying this is true, just a thought
<Spooner>
I've started using Sinatra for the first time this week. Certainly nice and straightforward compared to Rails :)
<Harzilein>
Stalkr_: it's not _all that_ smalltalkey, but neither is python.
<roadkith>
i dont know why ppl recommend learning a high level language first
<Stalkr_>
I did take a look at C first, but I quickly NOPEd out
<Spooner>
Because starting in C++ won't reward you with anything any time soon.
<burgestrand>
I started with C back in the day, almost scared me off.
<roadkith>
hmm
<burgestrand>
Low level languages require too much effort to get something up and working. High-level languages are especially good for prototyping which is helpful when you want to see what you’re doing has some impact.
<Spooner>
I started in BASIC, then at University, Fortran! Fortran made me learn C in my spare time instead of going to physics lectures :)
thegeekinside has joined #ruby-lang
Sailias has joined #ruby-lang
<roadkith>
i learned pascal as first language
<roadkith>
then c++
<roadkith>
admittedly both pissed me off so baldy i thought i'd never programm for money :D
<burgestrand>
:p
<roadkith>
but then it helped with learning ruby
<shevy>
Stalkr_ I came from PHP. PHP kinda sucked, so I wanted a better language. The choice was between python and ruby, and an old interview by matz decided it for me back then
<roadkith>
actually made it somewhat pleasant
Sailias_ has joined #ruby-lang
<shevy>
I think we learned pascal in school back then
<shevy>
I dont remember what we had to do... some simple math calculations... circle... rectangular... some more things
<Stalkr_>
PHP seems like a horrible language to learn
<shevy>
yeah PHP is terrible. It's however also fairly easy for a newcomer and you get fast results in a browser too
<Stalkr_>
Is it easy to setup Sinatra/RoR on a web host?
<darix>
Stalkr_: depends on your webhost
Sailias has joined #ruby-lang
<shevy>
Stalkr_ it is probably easier to setup PHP on a web host
Guest35831 has joined #ruby-lang
<shevy>
so
<shevy>
learn PHP
<shevy>
:>
<shevy>
you'll switch to a better language eventually anyway ;)
<roadkith>
and i dont like php and perl for ther C-ish syntax
<darix>
shevy: you are mean!
<darix>
very mean!
<lianj>
yea
<roadkith>
why learn a high level language that tries to mimic C-ish syntax?
<darix>
Stalkr_: there are ruby specialized hosters
<shevy>
roadkith well perl has been around since the stoneages
<rippa>
С++ mimics C syntax too
<rippa>
also C is high-level language
<shevy>
almost everything mimics C-like syntax :(
<roadkith>
compared to asm :D
<roadkith>
shevy: yeah and i dont get that
<shevy>
when I first saw haskell I found the syntax very cool
<roadkith>
i thought haskell was rather cryptic
<shevy>
but soon came the monad barrier
<Spooner>
PHP is a dead end, since it is web-only. Ruby works on the Web, as well as on the CLI or in GUI apps or games (the latter, not so well, but it does work).
<shevy>
and I am too dumb to understand monads
judofyr has joined #ruby-lang
malev_ has joined #ruby-lang
<rippa>
PHP works not only on the web
<rippa>
like ruby
<roadkith>
its used mostly for web tho
bglusman has joined #ruby-lang
<Spooner>
I know you _can_ use PHP anywhere, but who the hell would?
adambeynon has joined #ruby-lang
<rippa>
like ruby
<lianj>
php-gtk must be awesome
<roadkith>
nah ruby isnt mostly used on the web i'd think
<rippa>
it is
csherin has joined #ruby-lang
<rippa>
mostly used on teh web
<rippa>
as rails
<Spooner>
I found use for Ruby a long time before Rails.
<Spooner>
And I will a long time after Rails is obsolete :D
<judofyr>
rippa: [citation needed]
<roadkith>
theres quite a few non-web related ruby projects
<rippa>
judofyr: [1]
<judofyr>
I see what you did there
capn_kryptonite has joined #ruby-lang
<skryking>
puppet as a non rails based project comes to mind.
tjadc has joined #ruby-lang
<roadkith>
limechat
seanstickle has joined #ruby-lang
<whitequark>
hm
<whitequark>
metasploit
<roadkith>
my config parser :D
<whitequark>
my static analysis framework
<judofyr>
tons of vim plugins
<roadkith>
freebsd admin scripts
<whitequark>
macosx internal tools
<roadkith>
didnt they replace perl entirely with ruby?
<whitequark>
yes
<judofyr>
and not a single brace was missed
<roadkith>
cool eh1? ;)
<Spooner>
They still only ship with 1.8.7 though :(
fayimora has joined #ruby-lang
<shevy>
oh
<shevy>
Spooner, how did you come to ruby? you used another language?
<shevy>
my long time goal is still to replace javascript as the language number one on github, with ruby
<Spooner>
I can't remember now. It was a very long time ago; maybe 10 years.
<roadkith>
brainfuck is too simple
<lianj>
shevy: you have not a single repo, get started ;)
<whitequark>
seanstickle: I don't. that note was not related to APL :)
zenChild has joined #ruby-lang
malev has joined #ruby-lang
Jake232 has joined #ruby-lang
<Spooner>
shevy: Yeah, just fork a few of the popular repos to make yourself seem like a hipster.
<shevy>
lianj hey I am doing lots of changes lately! it's just hard to integrate git into my workflow... it still seems easier to rm -rf .git which kinda defeats the point of using it heheheh
<andkerosine>
Is there no clean/clever way to alias a method several times?
<darix>
andkerosine: put the replacement in a module and include the module. then you can call the old method with super?
<csherin>
shevy: btw the slide was a nice read :)
<darix>
something like that
<darix>
shevy: nice slides
<andkerosine>
I need only alias by name.
<andkerosine>
And it's for something really trivial, so if it's not tiny and neat, no big.
<darix>
andkerosine: doesnt mean the module way wouldnt work for you
<rue>
andkerosine: Just do it?
<lianj>
"use only one dot per line" meh
matti has joined #ruby-lang
matti has joined #ruby-lang
<darix>
lianj: he violates it in the example already
<darix>
:)
<rue>
%w[name another yay wee].each {|n| alias_method n, :moomin }
<andkerosine>
Hm... didn't work with alias.
<judofyr>
yeah, alias is syntax
<andkerosine>
Ah.
<andkerosine>
No, that doesn't work.
<judofyr>
hard to meta-program with it
<rue>
andkerosine: Sure it does
<andkerosine>
Ah, comma required for alias_method but /must/ be left out for alias. That's not very least-surprise.
<rue>
One's syntax, one's a method
<tobiasvl>
andkerosine: what do you mean?
<tobiasvl>
comma just means there are two parameters?
<andkerosine>
Disregard.
<andkerosine>
Is alias_method heavy at all?
<rue>
tobiasvl: alias doesn't have a comma
<andkerosine>
I'm not trying to retain the old functionality, just offer a convenience for the end user.
<rue>
andkerosine: It's unlikely to be the bottleneck in your program, let's put it that way.
<andkerosine>
That'll do. : )
<Spooner>
andkerosine: You should use alias_method anyway. It does the same as alias, but can be hooked into and is more "normal" in syntax.
<andkerosine>
Mm-hmm. I really didn't like that lacking comma.
<andkerosine>
What's the distinction, exactly?
<andkerosine>
I can't recall any other feature of the language that behaves that way.
<Spooner>
As someone said, alias is a keyword like "if". alias_method is itself a method that uses alias.
robbrit has joined #ruby-lang
<dreinull>
wow my rack tests are 4 times slower in 1.9 than in 1.8
<shevy>
hehe
<shevy>
natural evolution!
carlosgaldino has joined #ruby-lang
<dreinull>
devolution I'd call it
havenn has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
takaokouji has joined #ruby-lang
<shevy>
:)
zmack has joined #ruby-lang
molgrew has joined #ruby-lang
looopy has joined #ruby-lang
slimfit has joined #ruby-lang
sirfilip has joined #ruby-lang
Stalkr_ has joined #ruby-lang
sirfilip has joined #ruby-lang
QaDeS has joined #ruby-lang
rippa has joined #ruby-lang
r0bby has joined #ruby-lang
r0bby_ has joined #ruby-lang
<rue>
1.9.3?
setmeaway2 has joined #ruby-lang
zigidias has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
virunga has joined #ruby-lang
Axsuul has joined #ruby-lang
darkf has joined #ruby-lang
SubSpawn has joined #ruby-lang
sirfilip has joined #ruby-lang
wmoxam has joined #ruby-lang
fayimora has joined #ruby-lang
bglusman has joined #ruby-lang
artOfWar has joined #ruby-lang
bglusman has joined #ruby-lang
macmartine has joined #ruby-lang
anjen has joined #ruby-lang
necromancer has joined #ruby-lang
<TTilus>
dreinull: have you profiled?
<dreinull>
TTilus: no, actually a good idea to do so
<TTilus>
dreinull: =D
enebo has joined #ruby-lang
<TTilus>
dreinull: my guess is a _lot_ of exceptions thrown and catched somewhere
<TTilus>
dreinull: erm, raised and rescued... of course
<dreinull>
TTilus: why?
malev_ has joined #ruby-lang
<TTilus>
dreinull: thats one of the very few thing which is significantly slower on yarv compared to mri
<TTilus>
s/thing/things/
<dreinull>
TTilus: can't think of reasons why there should be exceptions raised in my tests
<TTilus>
dreinull: you know your code, i dont, just profile and you shall know =D
ivanoats has joined #ruby-lang
tekin has joined #ruby-lang
stef_204 has joined #ruby-lang
<darix>
l
malev has joined #ruby-lang
<TTilus>
?
skiz has joined #ruby-lang
<darix>
wrong window
fayimora has joined #ruby-lang
nofxx has joined #ruby-lang
cyri_ has joined #ruby-lang
sirfilip has joined #ruby-lang
savage- has joined #ruby-lang
bglusman_ has joined #ruby-lang
dfr|mac has joined #ruby-lang
SuperTaz_work has joined #ruby-lang
<andkerosine>
My fixation on lining up comments is becoming a sickness.
<shevy>
I like code formatting
<shevy>
including comments
darkf_ has joined #ruby-lang
nuclearsandwich has joined #ruby-lang
slimfit has joined #ruby-lang
sternicus has joined #ruby-lang
deryl_ has joined #ruby-lang
chendo__ has joined #ruby-lang
nuclearsandwich has joined #ruby-lang
ihme-TTilus has joined #ruby-lang
oddmunds has joined #ruby-lang
jarib has joined #ruby-lang
curtism has joined #ruby-lang
dejongge has joined #ruby-lang
<andrewvos>
PSA: delete all the comments
<andkerosine>
But... they're so informative!
<Spooner>
x += 1; # Add one to the value x had before.
JohnBat26 has joined #ruby-lang
havenn has joined #ruby-lang
vereteran has joined #ruby-lang
<andkerosine>
# By default, build initializes a Subreddit with its about data attached as methods via Struct. /r/all, as well as any combined ('books+music') or filtered ('programming/new') names, lack about.json pages, and must therefore be built with only their names passed to the Struct. Posts and comments can still be accessed as usual.
dous_ has joined #ruby-lang
bojicas has joined #ruby-lang
Heimidal has joined #ruby-lang
gnufied has joined #ruby-lang
dfr|mac has joined #ruby-lang
quatauta has joined #ruby-lang
qpingu has joined #ruby-lang
_bryanp has joined #ruby-lang
musl has joined #ruby-lang
sirfilip has joined #ruby-lang
fayimora has joined #ruby-lang
solars has joined #ruby-lang
havenn has joined #ruby-lang
sirfilip has joined #ruby-lang
grough has joined #ruby-lang
optikalmouse has joined #ruby-lang
<Spooner>
Is there a way to clean up broken gemspecs? I have some that managed to be saved as empty files by gem, which it complained about every time I ran it, so I deleted the .gemspecs and now it won't install anything :(
<optikalmouse>
is design by contract possible in ruby?
havenn has joined #ruby-lang
<shevy>
what is design by contract
<Spooner>
optikalmouse: Yes, but people generally use tests instead.
<optikalmouse>
Spooner: okay, so it recommends using tests and rspec. I've not used rspec, is that close to design by contract at all?
sirfilip has joined #ruby-lang
<manveru>
rspec is just the slowest way to run tests :)
<Spooner>
optikalmouse: Not directly, but you can certainly do with it what you can in DBC (I haven't used DBC, but I read up about it once and may have tried to implement it in Ruby at one time, but I gave up).
<manveru>
unless you use cucumber...
dfr|mac has joined #ruby-lang
<Spooner>
I've moved around a bit in frameworks. Went rspec (too slow)->riot (terse but not that readable)->bacon (fast, but a bit basic). Still wondering if I shouldn't jump again :D
<manveru>
been using bacon for years now
<optikalmouse>
Spooner: those are all like test frameworks?
<futurechimp>
optikalmouse: people tend to use tests in ruby where people in other languages would use dbc - those are all test frameworks, yeah
<Spooner>
Yes. The other main one is Minitest which is the one included in Ruby as standard.
<Spooner>
Of course, all that does is: raise ArgumentError, "Divisor must be non-zero" unless b != 0 (which is the usual Ruby way of checking inputs).
banderson623 has joined #ruby-lang
robotmay has joined #ruby-lang
banderson623 has joined #ruby-lang
lordofthedance has joined #ruby-lang
slimfit has joined #ruby-lang
nemesit has joined #ruby-lang
Waldteufel has joined #ruby-lang
Waldteufel has quit [#ruby-lang]
symm- has joined #ruby-lang
publicvoid has joined #ruby-lang
<optikalmouse>
Spooner: that's too simple a DBC library....
<andkerosine>
It's almost a joke.
sirfilip has joined #ruby-lang
<optikalmouse>
andkerosine: it is if it refers only to the wikipedia page rather than a book ;p
<Spooner>
optikalmouse: Yes. What it needs is hooks that run during development but do nothing in the real thing. The problem is that the same thing is possible with the same amount of syntax in native ruby.
havenn has joined #ruby-lang
<Spooner>
But it is probably easier to do with testing in Ruby and you don't have to roll your own.
<Tasser>
is there an ENV variable I can specify for ruby to include into the LOAD_PATH?
<Mon_Ouie>
RUBYLIB
<outoftime>
Tasser: you can also use the -i flag, if that's more helpful
<outoftime>
Tasser: -I, that is
havenn has joined #ruby-lang
chimkan___ has joined #ruby-lang
outoftime has joined #ruby-lang
grough has quit [#ruby-lang]
Phrogz has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
<Phrogz>
I have a string of bytes in ASCII-8BIT. I have a guessed encoding (rchardet19 gem). If I force_encoding to the guessed encoding, and turns out not to be a valid_encoding?, what's my next step? force back to ascii and then #encode to the guessed with invalid:replace/undef:replace?
<Phrogz>
Or (if you have experience with this gem) will it never supply a guess that is an invalid encoding?
twittard has joined #ruby-lang
outoftime has joined #ruby-lang
andkerosine has quit [#ruby-lang]
qpingu has joined #ruby-lang
senj has joined #ruby-lang
alerticus has joined #ruby-lang
outoftime has joined #ruby-lang
benanne has joined #ruby-lang
cyri_ has joined #ruby-lang
<hagabaka>
Phrogz: data = cd.confidence > 0.6 ? Iconv.conv(cd.encoding, "UTF-8", data) : data # as in README?
<Phrogz>
hagabaka: I think not. That confidence level seems artificially high to me. Since I have *no* idea what encoding the data is supposed to be in, any guess it makes is likely to be better than mine. Further, I can't leave it as ASCII-8BIT; I have to get it into UTF-8 for pushing into the DB at the end.
<hagabaka>
so just skip the confidence check?
banderson623 has joined #ruby-lang
<burgestrand>
Phrogz: it’d be odd if it could give you an encoding that’s not valid for the string; feels like it defeats the whole purpose of encoding detection. Granted, I’ve been surprised before so don’t take my word on it.
rivaler has joined #ruby-lang
<Phrogz>
burgestrand: Yeah, I'm starting to believe that. Gonna email the author nonetheless.
<hagabaka>
I think it only does detection with basic patterns without converting the whole string, since there are other tools to convert
userbard has joined #ruby-lang
<dreinull>
Phrogz: can't you just always force it to be utf8?
<burgestrand>
I’ve had times when it guessed the character set of an UTF8 string to be some kind of russian encoding; just remember you’re likely to end up with some very funny data if you’re unlucky.
<Phrogz>
Well, at hundreds of tens of thousands of lines per day, I don't really mind if it gets a few wrong. :)
<Phrogz>
Better than me attempting it manually. :p
|bardoe| has joined #ruby-lang
BadQuanta has joined #ruby-lang
brian_anderson has joined #ruby-lang
tbuehlmann has joined #ruby-lang
<hagabaka>
iconv will raise exception if the string can't be in that encoding
<skryking>
probably not the right place to ask, but does anyone know if websockets can be client to client, or can a browser act as a server?
<burgestrand>
skryking: no, websockets are client-to-server
qpingu has joined #ruby-lang
cyndis has joined #ruby-lang
<burgestrand>
I saw something recently though that allowed client-to-client communication, if only I could find it…
<skryking>
burgestrand, is there any way to make the browser act like a server?
<Phrogz>
dreinull: I suppose I might be able to, storing the occasional string filled with ��� in my DB. It feels better, though, to at least try to get it right.
<dreinull>
Phrogz: I had so much trouble with encodings, I don't think there is a way to get it right 100%
<Phrogz>
I'm annoyed/weirded out that Ruby does not "properly" handle s.force_encoding( "foo" ); s.encode( "foo", invalid: :replace, undef: replace ) unless s.valid_encoding? though
<Phrogz>
dreinull: No, with these log files I'm sure I won't get it right. But CharDet might stumble upon a weird chinese encoding that would preserve what the user actually typed instead of me just throwing it away because I'm a dumb Unicodian.
<Phrogz>
I guess it would be hard for Ruby to be sure where to start throwing away bytes if you tried to re-encode from a bad encoding.
<burgestrand>
skryking: everything’s possible when it comes to software and limitations, but for this specific case I don’t think there’s a good way to do that, no
<Phrogz>
Danzer: Looks OK to me (except I *always* use the block form of File.open.). What *is* wrong with those lines/.
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
mytrile has joined #ruby-lang
erpuds has joined #ruby-lang
woody2shoes has joined #ruby-lang
slimfit has joined #ruby-lang
<Danzer>
Phrogz if i run that script. return to me a exception error: undefined method `[]' for nil:NilClass (NoMethodError) from line 8.
<burgestrand>
But, I’m no longer sure it was that.
djcercone has joined #ruby-lang
<burgestrand>
If you want to talk between your clients, I’d have both sides initiate a websocket connection with your server; and then have your server pass messages back and forth.
djcercone has quit [#ruby-lang]
y3llow has joined #ruby-lang
<burgestrand>
(look at, for example, beaconpush, pusherapp or pubnub for hosted versions of that)
<Phrogz>
Danzer: Pastie your entire exception and backtrace.
<skryking>
I've done that already. just being curious... no real goal at mind for using it.
<Phrogz>
Danzer: You may note that you originally asked for someone to look at lines 30-32, but you said that you're getting an exception on line 8...and yet what you just pasted shows that this error is on line 16, not line 8.
<burgestrand>
I love it when this happens!
<Phrogz>
Danzer: The error "undefined method `[]' for nil:NilClass (NoMethodError)" means that on line 16 you did something[] but something was nil. In this case, your latitude is a nil value. Debug from there.
<shevy>
Danzer use pastie.org with your full .rb script pls
<Phrogz>
Does oo.cell( 0, "k" ) work? Is it not 1-based like Excel?
<shevy>
Danzer, always make sure that the indent is coherent. it makes it easier to spot mistakes. after the line "10.upto(oo.last_row) do |line|" the indent should be 2 spaces
<petercooper>
or that. I fudged mine from the way you have to do it with ap, lol.
zmack has joined #ruby-lang
* chris2
also defines a P which does p and returns nil
chimkan has joined #ruby-lang
<Danzer>
This xls is sent monthly by a company vehicle tracking.
<Danzer>
I will use to plot on google earth. in the future, google maps api
<Danzer>
shevy thx for restructure
<shevy>
:)
ilyam has joined #ruby-lang
dr_bob has joined #ruby-lang
rushed has joined #ruby-lang
malev_ has joined #ruby-lang
savage-_ has joined #ruby-lang
Skif has joined #ruby-lang
_bryanp has joined #ruby-lang
dr_bob has quit [#ruby-lang]
robbrit has quit [#ruby-lang]
ilyam has joined #ruby-lang
roha has joined #ruby-lang
waazzuup has joined #ruby-lang
lupo20 has joined #ruby-lang
lupo20 has quit [#ruby-lang]
srbartlett has joined #ruby-lang
robotmay has joined #ruby-lang
Stalkr_ has joined #ruby-lang
tenderlove has joined #ruby-lang
rpowell has joined #ruby-lang
Wardrop has joined #ruby-lang
bradland has joined #ruby-lang
JoL1hAHN has joined #ruby-lang
andrewhl has joined #ruby-lang
<optikalmouse>
can I define functions within functions in RUby?
<optikalmouse>
or should I define a method in my class that's private?
<yxhuvud>
I'd vote for 'neither'
<drbrain>
you can put functions in functions, but what yxhuvud said
<drbrain>
just make another regular method (or object to hold a group of methods)
<yxhuvud>
or a method that takes a block.
<optikalmouse>
no blocks.
<optikalmouse>
another regular method meaning non-private.
<optikalmouse>
why not a private method if it's a helper method or something?
<drbrain>
private methods are annoying to test
<drbrain>
and (to me) indicate you have another object waiting to escape into a new class
<yxhuvud>
post what you are trying to achieve and we could give you actual hints
<outoftime>
private methods are not supposed to be tested. that's why they're annoying to test.
<outoftime>
they're implementation details.
<optikalmouse>
I don't want to test the function.
<optikalmouse>
I'm using rails and breaking out a controller action method into multiple smaller methods
<drbrain>
optikalmouse: ☹
<drbrain>
outoftime: TATFT
<outoftime>
drbrain: sorry -- not meant to be tested *directly*. the public methods that exercise them should certainly be tested.
<drbrain>
optikalmouse: an implementation detail is a just a behavior waiting to be specified
daglees has joined #ruby-lang
<drbrain>
but, usually it's specified by your users and prevents you from a sane refactoring
<optikalmouse>
drbrain: what does that even mean? lol
<outoftime>
that's like saying methods should never be more than one line long because it's hard to test the middle lines of a method.
<optikalmouse>
outoftime: they shouldn't be longer than 10lines! :p
<outoftime>
optikalmouse: quite so : )
<drbrain>
outoftime: so if you can only test private methods through their public counterpart, and a public method calls two private methods, that's 30 lines I've got to run for a test?
<drbrain>
that's ridiculous, and why so many test suites take > 5s to run
<drbrain>
"don't test private methods" is a great strategy for surfing the internet all day
<outoftime>
in my experience, lifecycle hooks and observers are why so many test suites take a long time to run.
<outoftime>
but anyway, i find this conversation a bit too baffling to continue -- let's agree to disagree.
<optikalmouse>
drbrain: I'm not doing ANY unit-testing :D
<drbrain>
optikalmouse: ☹
<optikalmouse>
it's wonderful, *goes to reddit.com for the rest of the day* ;)
<outoftime>
drbrain: sorry to hear you feel that way
<rue>
There's no sane reason not to test private methods
<rue>
Other than not having any.
<andrewvos>
hmm
<outoftime>
rue: your tests should break when your code breaks. private methods aren't part of the external interface you're exposing, so you should be able to change them as much as you want as long as your class obeys its behavioral contract by way of its public API.
<andrewvos>
rue: Wait, what?
<outoftime>
rue: again, that's not to say that the behavior encoded in a private method shouldn't be tested, only that it should be tested by way of the public API, because the public API is all that matters.
Heimidal has joined #ruby-lang
<rue>
External interface is completely orthogonal to testing
* andrewvos
steps away slowly
<drbrain>
outoftime: you seem to be proposing only Functional Testing, not Unit Testing
<outoftime>
drbrain: I think it's debatable whether unit testing includes accessing non-public parts of a class's interface, but I would concede that one can define it that way. and if you want to define it that way, then in my opinion unit testing is unhelpful. tests should only fail when your code is broken, not because you've changed an implementation detail.
<rue>
Haha, c2
<rue>
outoftime: That makes no sense
<outoftime>
rue: really?
<rue>
If #a calls #b, there's nothing stopping you from specifying what #b accepts and returns
<drbrain>
outoftime: it's not debatable, it's defined like so: "Under the strict definition, for QA purposes, the failure of a UnitTest implicates only one unit. You know exactly where to search to find the bug."
davpoind has joined #ruby-lang
<drbrain>
if you test private methods through the public interface you do not know exactly where to search to find the bug when one fails
<drbrain>
so it isn't a unit test
WillMarshall has joined #ruby-lang
<outoftime>
ok folks! let's all just keep doing things the way we've been doing them : )
<outoftime>
i get the sense that that will be the outcome of this discussion whether it ends now or in half an hour : )
slimfit has joined #ruby-lang
<yxhuvud>
it seems this discussion got a bit side tracked away from finding ways of not having to do ugly stuff like private methods :)
<optikalmouse>
private methods aren't ugly, so I'm def using them ;p
h4y4shi has joined #ruby-lang
waazzuup has joined #ruby-lang
savage- has joined #ruby-lang
fayimora has joined #ruby-lang
Carnage\ has joined #ruby-lang
gregf has joined #ruby-lang
Heimidal_ has joined #ruby-lang
dfr|mac has joined #ruby-lang
banderson623 has joined #ruby-lang
<lsegal>
gotta love when people quote wiki-style debates as evidence
<rue>
C2, dude.
<lsegal>
srsly.
burgestrand has joined #ruby-lang
bglusman has joined #ruby-lang
srbaker has joined #ruby-lang
srbaker_ has joined #ruby-lang
Slackwise has joined #ruby-lang
<shevy>
I have no idea what the discussion was about
<shevy>
but I do know that I disagree with ALL OF YOU!
Dreamer3 has joined #ruby-lang
<erikh>
shevy: I'm disagreeing with your rationale for the disagreement