ap3mantus [ap3mantus!~ap3mantus@c-98-217-179-108.hsd1.ma.comcast.net] has joined #ruby-lang
replore [replore!~replore@203.152.213.161.static.zoot.jp] has joined #ruby-lang
takaokouji [takaokouji!~takaokouj@2001:268:306:1:225:bcff:fedc:e1fe] has joined #ruby-lang
dejongge1 [dejongge1!~jonke@pD9E0DF08.dip0.t-ipconnect.de] has joined #ruby-lang
<hackeron>
hey, I have a serial device, I'm trying to open it, I can do sp.readchar to read 1 character at a time, but if I do sp.read it just hangs there - the data from the device always ends with "\u0000" - maybe I'm opening the serial device wrong? any suggestions?
tomzx [tomzx!~tomzx@dsl-156-157.aei.ca] has joined #ruby-lang
<erikh>
IO#read reads until eof
<erikh>
you're probably never getting an EOF
<injekt>
:)
<hackeron>
erikh: why would a serial device send EOF?
<erikh>
it won't most likely.
<erikh>
point is, use a buffer.
<erikh>
find a demarcation point (probably that last NULL you're getting) to stop reading.
<hackeron>
erikh: it works as expected with other serial devices, but with this one it doesn't seem to understand when it's finished reading
<hackeron>
erikh: anyway to specify to read until "\u0000"?
<erikh>
not afaik. you'll have to read it n bytes at a time
<erikh>
do you know what the structure of the messages you're getting from it are?
<erikh>
are they fixed length, null terminated, ?
<hackeron>
erikh: I'm trying to create linux software for the device - I've dumped what the windows software does, it looks like this: http://pastie.org/3210765
<erikh>
yeah that looks null terminated
<erikh>
basically, this is what I'd do, and it's naive at best
<hackeron>
erikh: so I just do sp.readchar until the last char is a "\u0000"?
<erikh>
read one byte at a time; stop reading when you receive a null
<erikh>
right
<hackeron>
right, ok, heh
<drbrain>
or "\x00" if you don't want to type as much
<erikh>
hackeron: what device is this? I'm curious now
<drbrain>
hackeron: it's more likely the device is 7 bit ASCII than UTF-8
<erikh>
^
<hackeron>
erikh: I want to make a web interface for it, so patients take a little mini PC and that device with them - they plug it in every morning and the doctor opens a Web site to diagnose remotely :P -- the windows software for it is kinda shitty and doesn't let you get the actual figures, just ready reports and charts
<hackeron>
drbrain: hmm, does it mean I need to open the serial device differently?
<drbrain>
hackeron: no
<erikh>
hackeron: have you considered a signed java applet?
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby-lang
<hackeron>
erikh: signed java applet?
<erikh>
yes, something that executes on the local machine but without installing any extra software
Xzyx987X_ [Xzyx987X_!~Xzyx987X@c-75-72-121-187.hsd1.mn.comcast.net] has joined #ruby-lang
<erikh>
dunno, just seems like a great application for something like that.
<erikh>
you hit the site, little window pops up, does the read, fires it off to a server, done
<erikh>
user experience is relatively painless
<drbrain>
hackeron: if you were comparing a character past 128 like é ruby 1.9 may complain
<drbrain>
but 7-bit ascii won't have an é
<hackeron>
erikh: most of the patients are pretty old and don't have PCs - thing thing auto switches on when you put it on your finger and when you plug it in, I want a ruby script to fetch the data and upload - I'm thinking a tiny box with 3g :P
<erikh>
ah ok
<erikh>
sorry to distract ... my brain is just moving at ludicrous speed today
<hackeron>
erikh: would a java applet even work? -- it would need to install serial to usb drivers and what not - can't even find a driver for mac
<erikh>
/dev/ttyUSB0 should work shouldn't it?
<erikh>
err, ttysxxx
<erikh>
anyhow
<hackeron>
erikh: the device isn't recognised at all on mac and the naming conventions are different so no /dev/ttyUSB even for supported devices - also what if it's a windows box
<erikh>
right
<erikh>
I get ya
<injekt>
hmm
<hackeron>
erikh: java applet may be good for facebook mass photo upload, but don't think it would work here
<erikh>
sure, I can dig it.
mkscrg [mkscrg!~mkscrg@ool-18e4f9d6.dyn.optonline.net] has joined #ruby-lang
<hackeron>
erikh: thanks for the serial help, off I go to try to get it working, heh
dnyy [dnyy!u2106@gateway/web/irccloud.com/x-skjjyobjpcywkiro] has joined #ruby-lang
<hackeron>
drbrain: thanks for that - I'll have a read through the spec, maybe I'll just implement edf myself. You have any experience with edf? - any ruby code? :P
<drbrain>
I don't, but I have experience with reading (and writing) binary data formats
<drbrain>
the example I linked comes from an arduino-based temperature monitor I built
darkf_ [darkf_!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
<hackeron>
nice :) - guess this should be quite similar
<hackeron>
I'll have a look at the spec - guess shouldn't be hard to optimise things a litle even without implementing edf
<erikh>
I keep meaning to get arduino stuffs
<drbrain>
the fields are SYNC, STATUS, [INT, INT]
<drbrain>
where [INT, INT] appears if the STATUS field is "OK"
senj [senj!~senj@S01060026f323bcdf.ed.shawcable.net] has joined #ruby-lang
<drbrain>
the SYNC field allows the program to attach to the IO and synchronize at any point in the output
<drbrain>
so if you attach during the middle of some bytes appearing it'll wait until the next packet
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
<hackeron>
it says Signals in EDF(+) are 2-byte integers and this is the full spec http://www.edfplus.info/specs/edfplus.html - will experiment - don't have much experience with binary data formats
<imperator>
gem search -r serial
<erikh>
a lot of times you can read good formats with String#unpack
<hackeron>
drbrain: I guess at least in my case it should never attach in the middle of anything as it always starts with a handshake
<drbrain>
hackeron: it shouldn't be too hard since you have a spec
<drbrain>
hackeron: yeah, my thermometer constantly streams data
<drbrain>
I didn't want to bother with bidirectional communication
<hackeron>
drbrain: so those thermometers don't use ascii? - I have a DSC alarm with thermometers - it has an ascii format where it's "checksum command value\r\n" - so I just ignore if I can't verify the checksum if I attach in the middle of a command
<drbrain>
I wrote my own protocol to minimize communication time
<hackeron>
ah, ok :)
<hackeron>
what was the project? home automation or something?
<drbrain>
the data is transferred over XBee
<drbrain>
yeah
<drbrain>
there's a README that describes all the parts at the root
<imperator>
Rich_Morin, perhaps the lockfile gem
<drbrain>
since I only have three values it wasn't hard
<hackeron>
drbrain: hmm, how much did that cost to make?
neoesque [neoesque!~neoesque@210.59.147.232] has joined #ruby-lang
<hackeron>
drbrain: oh wait, it says, heh
<drbrain>
nothing commercially available met my needs ☹
<hackeron>
drbrain: so the xbee receiver is plugged into the arduino uno and then you use a serial to usb to read from it?
<drbrain>
temperature sensor + xbee are plugged into the arduino uno
<drbrain>
and an xbee on a USB explorer is plugged into a Mac Mini
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby-lang
<hackeron>
ah, I see
vbatts [vbatts!~vbatts@hashbangbash.com] has joined #ruby-lang
<drbrain>
no need for an arduino on the receiving end
<hackeron>
is xbee secure communication?
<drbrain>
I think the ZigBee protocol has security options
<drbrain>
but I'm not seeing any encrypted communication data on the xbee page or on wikipedia
<drbrain>
ah, looks like the 802.15.4 has symmetric encryption options too
<drbrain>
I'm going to shovel some snow now
jmontross [jmontross!~Adium@static-96-236-65-137.snfcca.dsl-w.verizon.net] has quit [#ruby-lang]
<Rich_Morin>
imperator: that looks very promising; tnx!
<hackeron>
drbrain: heh, make an adruino snow shoveler thingie ;)
<zenspider>
drbrain: hah! beat you!
vbatts [vbatts!~vbatts@hashbangbash.com] has joined #ruby-lang
headius [headius!~headius@71-210-154-45.mpls.qwest.net] has joined #ruby-lang
<erikh>
someone did that a few years ago in philly
<erikh>
let me see if I can find the video
<hackeron>
erikh: neat, need to get myself an arduino
<erikh>
bah, no dice... but there are plenty of others on youtube
<erikh>
this one was the roomba of snowblowers
<erikh>
pretty awesome really
<hackeron>
link?
<erikh>
yeah I can't seem to find it
drdr [drdr!d059b08f@gateway/web/freenode/ip.208.89.176.143] has joined #ruby-lang
<hackeron>
hmm, I'm reading from the serial device and doing a sanity check - I'm doing if not o == "Handshake" raise 'Expected "Handshake" got "%s"' % o
<jaafar>
Anyone ever made an "each" method in the Embedded API?
<zenspider>
meaning an iter function?
<jaafar>
I'm not quite sure how it should work
<jaafar>
zenspider: that's right
macmartine [macmartine!~macmartin@c-24-21-112-60.hsd1.or.comcast.net] has quit [#ruby-lang]
<zenspider>
jaafar: have you taken a look at README.EXT?
<jaafar>
Tried to get SWIG to do it, but that wants to make C++ (STL) style iterators
<hackeron>
seems a bit unreliable - sometimes I get "andshake\x00" -- maybe I'm opening the serial device wrong? :/
<jaafar>
zenspider: not lately. was looking at pickaxe
<zenspider>
not much difference between the two honestly
<zenspider>
but between that and looking at the C code calling rb_iterate, it isn't hard to figure out
<jaafar>
zenspider: OK, that's in the Ruby source I guess?
<jaafar>
I can see that on a given iteration I have to call rb_yield. Just not sure how to structure the code, how I know when I'm on the first call (to init stored data etc.)
<drdr>
jaafar you trying to get ruby to work with the arduino?
<jaafar>
drdr: no, different application - C++ bindings. Just want it to look Ruby-like, so "each" instead of begin/end etc.
<drdr>
ah
* jaafar
cruises the source code
<drdr>
hmm
<drdr>
you could always have a ruby layer on top of the begin end stuff
<jaafar>
true
<jaafar>
If I can figure out how the Array primitive does it I should be golden
<zenspider>
jaafar: first call? if you're worried about knowing which is the first iteration, you're doing something wrong
<zenspider>
I have to bounce... bbiab
<drdr>
jaafar ide recomend looking at the source code
<drdr>
that or canabalizeing it from tinyruby
RomD [RomD!~Roman@nrbg-4d0760c5.pool.mediaWays.net] has joined #ruby-lang
<jaafar>
oh hey, this looks easy actually
<jaafar>
each only gets called once
<jaafar>
I thought there was some magic
<jaafar>
rb_yield calls the block
<jaafar>
and you're done
<jaafar>
I can do this
lightcap [lightcap!~lightcap@97-115-90-91.ptld.qwest.net] has joined #ruby-lang
<shevy>
hehe
* shevy
puts jaafar into a red tank.
<shevy>
drive, ruby warrior, drive!
redruby1 [redruby1!~Adium@116-90-136-55.static.dsl.unleash.net.nz] has joined #ruby-lang
redruby1 [redruby1!~Adium@116-90-136-55.static.dsl.unleash.net.nz] has joined #ruby-lang
redruby1 [redruby1!~Adium@116-90-136-55.static.dsl.unleash.net.nz] has joined #ruby-lang
redruby1 [redruby1!~Adium@116-90-136-55.static.dsl.unleash.net.nz] has quit [#ruby-lang]
<hackeron>
how would I write hex to a serial device? -- I want to write 18:43
<drbrain>
hackeron: "\x18\x43"
<drbrain>
?
<hackeron>
drbrain: hmm, it's not responding
Heimidal [Heimidal!~heimidal@c-67-165-197-126.hsd1.co.comcast.net] has joined #ruby-lang
<drbrain>
if you get back "\u0003" it may be writing funny
<drbrain>
hackeron: if you add sp.set_encoding Encoding::BINARY, do you get "\x03" instead?
<hackeron>
I get "\x04"
<hackeron>
"\x05"
<drbrain>
ok, better
<drbrain>
now you'll read and write individual bytes instead of UTF-8 codepoints
<drbrain>
it may not fix it, but it will probably help
Karmaon [Karmaon!~john@gateway/tor-sasl/karmaon] has joined #ruby-lang
elux [elux!~peter@bas17-toronto63-1128670639.dsl.bell.ca] has joined #ruby-lang
neuro_damage [neuro_damage!~neuro@c-98-234-184-142.hsd1.ca.comcast.net] has joined #ruby-lang
<hackeron>
drbrain: hmm, I get "\x04!" if I write "\x06" - weird. I suspect it's possible the binary data can only be read once - the windows software doesn't allow you to do anything once you import the data, only to wipe the device and create a new study
ilyam [ilyam!~ilyam@c-67-188-113-128.hsd1.ca.comcast.net] has joined #ruby-lang
snuxoll [snuxoll!~stefan@63.227.129.124] has joined #ruby-lang
<drbrain>
hackeron: if the entire exchange with the device is this EDF format, perhaps the documentation will explain what's going on?
<hackeron>
drbrain: what documentation, heh?
<drbrain>
heh
<shevy>
:(
<hackeron>
it's so annoying- for some things it ends with \x00 - for others it ends with your string
<hackeron>
echoing back what you sent it, grr
fritzek__ [fritzek__!~fritzek@p5DDB55E3.dip.t-dialin.net] has joined #ruby-lang
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby-lang
neuro_damage [neuro_damage!~neuro@c-98-234-184-142.hsd1.ca.comcast.net] has joined #ruby-lang
jredville [jredville!~james.dev@c-66-235-23-17.sea.wa.customer.broadstripe.net] has joined #ruby-lang
snuxoll [snuxoll!~stefan@2001:470:8077:817c:10d5:9b3f:7636:527f] has joined #ruby-lang
rpowell [rpowell!~rpowell@CPE-121-218-185-93.lnse4.cht.bigpond.net.au] has joined #ruby-lang
bglusman [bglusman!~bglusman@c-71-224-192-35.hsd1.pa.comcast.net] has joined #ruby-lang
<jaafar>
my "each" works. maniacal laugh, maniacal laugh
JoelMcCr` [JoelMcCr`!~user@pool-74-98-40-247.pitbpa.east.verizon.net] has joined #ruby-lang
JoelMcCracken [JoelMcCracken!~user@pool-74-98-40-247.pitbpa.east.verizon.net] has joined #ruby-lang
<drbrain>
jaafar: but can you .each.with_index.map ?
JoelMcCracken [JoelMcCracken!~user@pool-74-98-40-247.pitbpa.east.verizon.net] has joined #ruby-lang
<jaafar>
drbrain: that's an excellent question, and as soon as I figure out what that means I'll answer it :)
<drbrain>
jaafar: many enumerables return an enumerator when no block is given
<drbrain>
this allows you to chain them together in various handy ways
twittard [twittard!~twittard@cpe-76-169-74-39.socal.res.rr.com] has joined #ruby-lang
<drbrain>
or, use enumerable methods based off other methods than #each
<drbrain>
jaafar: there's an easy way to create it: return enum_for __method__ unless block_given?
<drbrain>
if you have arguments to each: return enum_for __method, arg1, arg2 unless block_given?
<jaafar>
drbrain: thanks, I will check that out. enabling chaining sounds like a good idea
<zzak>
so does rb_load_internal(path, 0) _not_ wrap the required source file in an anonymous module?
<zzak>
rb_load_internal(VALUE fname, int wrap)
<drbrain>
zzak: coorrect
<drbrain>
if (!wrap) { … } else { /* load in anonymous module as top-level */ … }
<zzak>
so require should leak local vars to the global namespace?
<drbrain>
zzak: no
<drbrain>
this is for constant scoping, not liar scoping
<drbrain>
if x.rb has class X and you load 'x.rb', true then you won't be able to access X from top-level
<drbrain>
local variables are never shared between files
<zzak>
so its not fair to say that "requiring a file gets executed under an anonymous module" then?
<drbrain>
no
<zzak>
and only the constants can leak?
<drbrain>
Kernel#require never wraps, Kernel#load can wrap
<drbrain>
well, and globals
<drbrain>
but that's a given
<zzak>
beautiful
<zzak>
thanks eric
<drbrain>
top-level instance variables are shared (and probably class variables)
jaisoares [jaisoares!~jsoares@bl13-197-21.dsl.telepac.pt] has joined #ruby-lang
ap3mantus [ap3mantus!~ap3mantus@c-98-217-179-108.hsd1.ma.comcast.net] has joined #ruby-lang
<jaafar>
drbrain: so I need to do this in C btw
<drbrain>
jaafar: hrm...
<jaafar>
maybe I'll look at enumerator.c
<drbrain>
jaafar: hrm, there's RETURN_ENEUMERATOR() but that's in intern.h, not ruby.h
<drbrain>
there's also rb_enumeratorize in intern.h
<drbrain>
jaafar: you can make the C method be _each and have a ruby method: def each; return enum_for _each unless block_given?; _each; end
<jaafar>
drbrain: thanks for the tips!
StevenRingo [StevenRingo!~nevets@203.41.237.118] has joined #ruby-lang
RomyRomy [RomyRomy!~stickycak@cpe-74-64-122-182.nyc.res.rr.com] has joined #ruby-lang
livinded [livinded!~lolwut@pool-108-23-242-132.lsanca.fios.verizon.net] has joined #ruby-lang
ryanf [ryanf!~rfitz@ec2-50-18-158-149.us-west-1.compute.amazonaws.com] has joined #ruby-lang
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
darkf_ [darkf_!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
rippa [rippa!~splitta@85.158.54.234] has joined #ruby-lang
<zzak>
drbrain: ping
RomyRomy [RomyRomy!~stickycak@cpe-74-64-122-182.nyc.res.rr.com] has joined #ruby-lang
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
<zzak>
drbrain: nvm, just sent a doc patch. gotta run. pzpz
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby-lang
dv310p3r [dv310p3r!~dv310p3r@c-98-203-41-91.hsd1.fl.comcast.net] has joined #ruby-lang
ksinkar [ksinkar!~ksinkar@117.195.96.90] has joined #ruby-lang
punknology [punknology!~textual@190.201.108.19] has joined #ruby-lang
cczona_ [cczona_!~cczona@108-75-73-197.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
gokulnath [gokulnath!~gokulnath@115.111.177.122] has joined #ruby-lang
vereteran [vereteran!~vereteran@static.88-198-170-117.clients.your-server.de] has joined #ruby-lang
ramonmaruko [ramonmaruko!~marco@122.52.126.66] has joined #ruby-lang
ramonmaruko [ramonmaruko!~marco@122.52.126.66] has joined #ruby-lang
tomzx [tomzx!~tomzx@dsl-156-157.aei.ca] has joined #ruby-lang
cczona_ [cczona_!~cczona@108-75-73-197.lightspeed.sntcca.sbcglobal.net] has quit [#ruby-lang]
replore [replore!~replore@203.152.213.161.static.zoot.jp] has joined #ruby-lang
replore [replore!~replore@203.152.213.161.static.zoot.jp] has joined #ruby-lang
csherin [csherin!~csherin@115.111.177.122] has joined #ruby-lang
jfelchner [jfelchner!~jfelchner@c-69-138-35-223.hsd1.tn.comcast.net] has joined #ruby-lang
kain [kain!~kain@151.64.210.200] has quit ["Sto andando via"]
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
tomzx [tomzx!~tomzx@dsl-156-157.aei.ca] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.172.247.109] has joined #ruby-lang
sora_h [sora_h!~sora_h@mayfield.privs.net] has joined #ruby-lang
ryanf [ryanf!~ryanf@207.sub-174-253-243.myvzw.com] has joined #ruby-lang
jredville [jredville!~james.dev@c-66-235-23-17.sea.wa.customer.broadstripe.net] has joined #ruby-lang
rknLA [rknLA!~rknLA@76-218-76-57.lightspeed.irvnca.sbcglobal.net] has joined #ruby-lang
artOfWar [artOfWar!~artofwar@108-205-201-30.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
yxhuvud [yxhuvud!mongo@h-85-82.a212.priv.bahnhof.se] has joined #ruby-lang
amerine [amerine!~mturner@bc171197.bendcable.com] has joined #ruby-lang
RomyRomy [RomyRomy!~stickycak@cpe-74-64-122-182.nyc.res.rr.com] has joined #ruby-lang
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
Filuren [Filuren!~Filuren@x1-6-e0-46-9a-1f-97-a2.k617.webspeed.dk] has joined #ruby-lang
<shevy>
hmm
<shevy>
is there a simple way to un-include a module? The module in question only has 3 CONSTANTS defines, which are mixed into a class. I wonder if it is easy to remove that module again
<ryanf>
shevy: not without a C extension
<shevy>
ok
solars [solars!~solars@194.208.132.118] has joined #ruby-lang
csherin [csherin!~csherin@115.111.177.122] has joined #ruby-lang
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has joined #ruby-lang
JohnBat26 [JohnBat26!~Eugene@89.175.77.79] has joined #ruby-lang
JohnBat26 [JohnBat26!~Eugene@89.175.77.79] has joined #ruby-lang
Natch| [Natch|!~natch@178.73.218.129] has joined #ruby-lang
ttilley [ttilley!~ttilley@unaffiliated/lv] has joined #ruby-lang
thone_ [thone_!~thone@g226048136.adsl.alicedsl.de] has joined #ruby-lang
heftig [heftig!~Jan@archlinux/developer/heftig] has joined #ruby-lang
gokulnath [gokulnath!~gokulnath@115.111.177.122] has joined #ruby-lang
Tanaka [Tanaka!c1342d0d@gateway/web/freenode/ip.193.52.45.13] has joined #ruby-lang
jordan` [jordan`!~gromit@posteauge.rsr.lip6.fr] has joined #ruby-lang
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
jordan` [jordan`!~gromit@posteauge.rsr.lip6.fr] has joined #ruby-lang
hagabaka [hagabaka!~hagabaka@cblmdm24-53-178-92.buckeyecom.net] has joined #ruby-lang
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
snuxoll [snuxoll!~stefan@2001:470:8077:817c:10d5:9b3f:7636:527f] has quit [#ruby-lang]
hagabaka [hagabaka!~hagabaka@cblmdm24-53-178-92.buckeyecom.net] has joined #ruby-lang
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
ramonmaruko [ramonmaruko!~marco@122.52.126.66] has joined #ruby-lang
AlHafoudh [AlHafoudh!~textual@dsl-static-173.212-5-200.telecom.sk] has joined #ruby-lang
<shevy>
yeah we all do mistakes
rpowell [rpowell!~rpowell@CPE-121-218-185-93.lnse4.cht.bigpond.net.au] has joined #ruby-lang
gnufied [gnufied!~gnufied@122.172.224.153] has joined #ruby-lang
frangiz [frangiz!~frangiz@user26.77-105-206.netatonce.net] has joined #ruby-lang
StevenRingo [StevenRingo!~nevets@ppp121-44-25-1.lns20.syd6.internode.on.net] has joined #ruby-lang
Locke23rus [Locke23rus!~quassel@188.162.162.191] has joined #ruby-lang
molgrew [molgrew!~bozo20@85.182.139.18] has joined #ruby-lang
timbleck [timbleck!u3835@gateway/web/irccloud.com/x-ihlznjgexzlurxfy] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby-lang
gnufied [gnufied!~gnufied@122.172.224.153] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.172.247.109] has joined #ruby-lang
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has joined #ruby-lang
zmack [zmack!~zmack@78.97.143.6] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby-lang
shevy2 [shevy2!~shevy@93-82-137-108.adsl.highway.telekom.at] has joined #ruby-lang
_ko1 [_ko1!~ko1@atdot.nue.ci.i.u-tokyo.ac.jp] has joined #ruby-lang
rob___ [rob___!~rob@dust.cx] has joined #ruby-lang
<rob___>
hi hi
<rob___>
i'm using sinatra and have included a ruby file that defines a class, in this class i'm trying to access sinatras 'halt' function but it seems i can only access that function in a route or in a helper method. how would i go about giving access to the halt method to my class?
S1kx [S1kx!~S1kx@ip-95-223-80-198.unitymediagroup.de] has joined #ruby-lang
S1kx [S1kx!~S1kx@pdpc/supporter/monthlybyte/s1kx] has joined #ruby-lang
<rob___>
can i somehow require my include inside the 'helper' block?
workmad3 [workmad3!~workmad3@vpn146.its.manchester.ac.uk] has joined #ruby-lang
Guest52033 [Guest52033!~davidw@host228-251-static.95-94-b.business.telecomitalia.it] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@host.62.65.124.23.bitcom.se] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@host.62.65.124.23.bitcom.se] has joined #ruby-lang
burgestrand1 [burgestrand1!~burgestra@host.62.65.124.23.bitcom.se] has joined #ruby-lang
<injekt>
rob___: you would use the 'helpers' method which would include a module
<kke>
Hash doesn't have anything like #only? like {:a => 1, :b => 2, :c => 3}.only(:a, :b)
<rippa>
what should that do?
<injekt>
which would do what? return {:a => 1, :b => 2} ?
<kke>
yeah
<kke>
there's select but it's ugly for that
<injekt>
why is it ugly? because you have to provide a block?
robotmay [robotmay!~robotmay@94.30.13.228] has joined #ruby-lang
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
<imperator>
can't say i've ever understood spreadsheets with massive numbers of rows
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
ap3mantus [ap3mantus!~ap3mantus@c-98-217-179-108.hsd1.ma.comcast.net] has joined #ruby-lang
<imperator>
is a manager really going to scan over 20k+ rows? no
<imperator>
i suppose they can then summarize them as they see fit
<imperator>
but why not just do that up front?
<imperator>
anyhoo
quatauta [quatauta!~quatauta@91-67-202-38-dynip.superkabel.de] has joined #ruby-lang
sdegutis [sdegutis!~sdegutis@unaffiliated/steven] has joined #ruby-lang
<rue>
Hooo
<rue>
imperator: They're databases that people who can't use Access (theoretically) can
<rue>
…use
tokumine [tokumine!~kunio@82-69-174-54.dsl.in-addr.zen.co.uk] has joined #ruby-lang
dbernar1 [dbernar1!~dbernar1@S0106c03f0ed8678b.wp.shawcable.net] has joined #ruby-lang
<dbernar1>
Hello. I've got a method that needs to delegate to another method of same object under a certain condition. I want to unit test that method. Using rspec, I know how to set up the condition, but how do I set up an expectation that the method is calling another method of the same object?
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby-lang
headius [headius!~headius@71-210-154-45.mpls.qwest.net] has joined #ruby-lang
<dbernar1>
Syntactically.
<robgleeson>
dbernar1: use a mock
<dbernar1>
Can you please show me the exact syntax?
<dbernar1>
Cause I do need to call the real method of that object...
<dbernar1>
But I also want to have expectations, which seem to be for mocks.
<robgleeson>
I don't use RSpec, but I think it is: .should_receive(:foo)
<dbernar1>
Do I first instantiate, then mock, set expectations, then call the method on the object, which will be the real method, and the mock will catch the expectation...
<dbernar1>
That's kind of what I don't get
<dbernar1>
I'd need an actual gist kind of a thing to really get it. I get it conceptually...
<robgleeson>
you setup the expectation at the start of your test, yeah
tekin [tekin!~tekin@host-78-151-28-217.as13285.net] has joined #ruby-lang
<dbernar1>
Do you agree that if I mock at the beginning, then instantiate, I won't be able to really call the method I am unit testing?
<robgleeson>
not if you mock the method only
jkprg [jkprg!~jarda@ip-62-245-93-150.net.upcbroadband.cz] has joined #ruby-lang
<robgleeson>
i'm not sure how RSpec does it, tbh
<dbernar1>
Oh, OK, you think you could just mock one method of a class/object
<robgleeson>
you should yeah
<dbernar1>
OK, i'll do both of those test cases.
<dbernar1>
Thank you.
<dbernar1>
I might let you know how it goes.
<robgleeson>
yeah please do
<robgleeson>
there is also #rspec for rspec help btw
tbuehlmann [tbuehlmann!~Tobias@unaffiliated/tovias] has joined #ruby-lang
<dbernar1>
Oh, cool!
<dbernar1>
One should never stop trying to long-tail on freenode like I did.
<robgleeson>
yeah but it's a low traffic channel, you're not ensured to get help ;)
<robgleeson>
worth a shot though
<dbernar1>
Exactly
<robgleeson>
i'm sure there is rspec users lurking here as well
<dbernar1>
Yeah
<judofyr>
even though we're doing our best
spectra [spectra!~spectra@debian/developer/spectra] has joined #ruby-lang
MistyM [MistyM!~mistym@50.museumforhumanrights.com] has joined #ruby-lang
RomyRomy [RomyRomy!~stickycak@cpe-74-64-122-182.nyc.res.rr.com] has joined #ruby-lang
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
RomyRomy [RomyRomy!~stickycak@cpe-74-64-122-182.nyc.res.rr.com] has quit [#ruby-lang]
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
rushed [rushed!~rushed@99-73-225-9.lightspeed.austtx.sbcglobal.net] has joined #ruby-lang
dejongge [dejongge!~jonke@pD9E0DF08.dip0.t-ipconnect.de] has joined #ruby-lang
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
mztriz [mztriz!~mztriz@nkugateway.nku.edu] has joined #ruby-lang
apeiros_ [apeiros_!~apeiros@77-58-113-31.dclient.hispeed.ch] has joined #ruby-lang
Heimidal [Heimidal!~heimidal@c-67-165-197-126.hsd1.co.comcast.net] has joined #ruby-lang
pvh [pvh!u717@gateway/web/irccloud.com/x-cqvmkpvolztsupeo] has joined #ruby-lang
timbleck [timbleck!u3835@gateway/web/irccloud.com/x-azwemrmkgternyzd] has joined #ruby-lang
<vereteran>
is there something like respond_to_instance_method? to check does instance method exists
<vereteran>
?
<apeiros_>
method_defined?
<vereteran>
apeiros_, thank you!
<apeiros_>
yw
simon_weber [simon_weber!u4119@gateway/web/irccloud.com/x-gyzhtrqggojhlfnp] has joined #ruby-lang
<ReinH>
sigh
<apeiros_>
ReinH: wuzzaaah?!
<ReinH>
so much metaprogramming
charper [charper!u1691@gateway/web/irccloud.com/x-iqssgyqjqepzhcwt] has joined #ruby-lang
<ReinH>
it makes me sad
<ReinH>
in my day, all we needed was programming
<rippa>
metametaprogramming
<rippa>
code that writes code that writes code
longtheta [longtheta!u4275@gateway/web/irccloud.com/x-hnnncncghnusxgrf] has joined #ruby-lang
<apeiros_>
rippa: don't start with quines…
dnyy [dnyy!u2106@gateway/web/irccloud.com/x-ocshmnzvlvwoztnq] has joined #ruby-lang
<zzak>
is there a way to run a specific test in ruby?
<zzak>
make test is too long
<imperator>
zzak, with test-unit i think it's --n name_of_test
<imperator>
do gists have lifespans?
heftig [heftig!jan@archlinux/developer/heftig] has joined #ruby-lang
<zzak>
imperator: you mean with testrb?
<imperator>
zzak, dunno testrb
<imperator>
fucking markdown, how does it work?
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
<zzak>
imperator: yarp, testrb is the runner for minitest
<imperator>
wow, manually spacing code in 4 spaces, that's awesome; someone kill me
<imperator>
zzak, i think it's the same, --n
<darix>
imperator: sorry. that wish is denied. we still need you. :)
<imperator>
but i haven't read the docs
Mchl [Mchl!~Mchl@188.116.55.60] has joined #ruby-lang
cesario [cesario!u2444@gateway/web/irccloud.com/x-zjmmwhdqiaixmnyk] has joined #ruby-lang
sdegutis_ [sdegutis_!~sdegutis@38.98.177.253] has joined #ruby-lang
sdegutis_ [sdegutis_!~sdegutis@unaffiliated/steven] has joined #ruby-lang
ricardov_ [ricardov_!~ricardova@177.9.136.36] has joined #ruby-lang
abuiles [abuiles!u1641@gateway/web/irccloud.com/x-vzmswvlcwuogkugj] has joined #ruby-lang
robotmay [robotmay!~robotmay@5ad8f1da.bb.sky.com] has joined #ruby-lang
amerine [amerine!~mturner@67.204.184.82] has joined #ruby-lang
nofxx__ [nofxx__!~nofxx@177.106.91.211] has joined #ruby-lang
<shevy>
muzone please
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
<wmoxam>
lol, treat IRC like facebook ftl
_darkside_ [_darkside_!~darkside@187.45.255.123] has joined #ruby-lang
senj [senj!~senj@S01060026f323bcdf.ed.shawcable.net] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@46.118.229.185] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@subtle/user/kyrylo] has joined #ruby-lang
ricardovaleriano [ricardovaleriano!~ricardova@177.9.136.36] has joined #ruby-lang
bglusman [bglusman!~bglusman@c-71-224-192-35.hsd1.pa.comcast.net] has joined #ruby-lang
<ReinH>
fail
ricardovaleriano [ricardovaleriano!~ricardova@177.9.136.36] has joined #ruby-lang
livinded [livinded!~lolwut@pool-108-23-242-132.lsanca.fios.verizon.net] has joined #ruby-lang
dre [dre!5341dce3@gateway/web/freenode/ip.83.65.220.227] has joined #ruby-lang
<dre>
hi there. is anybody here familiar with starling?
<rue>
The map/reduce thing?
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
<ttilley>
the queue system twitter wrote in scala instead of just using a real queueing system and i think later abandoned?
<dre>
ttilley: exactly
<dre>
i cant get it running. but i'm not really sure if i really need it. so i wanted to ask: which datatypes can i use for my messages?
<dre>
is it just about strings or can i pass ruby objects?
<ttilley>
dunno what it uses natively, but is it all that important when you can serialize anything to a string?
<muzone>
sorry my people
<muzone>
i just switched boxes and this one still had shameless_plug.rb playing
ricardovaleriano [ricardovaleriano!~ricardova@177.33.18.164] has joined #ruby-lang
<ttilley>
considering that it's written in scala, it will not be able to just de-marshall ruby objects if that's what you mean. you won't be able to avoid encoding overhead of some kind, even if it's hidden from you.
ylluminate [ylluminate!~ylluminat@rrcs-24-123-53-166.central.biz.rr.com] has joined #ruby-lang
<ttilley>
dre: though, really... if you're looking at a queue/message system and don't have one in place already... pick one that doesn't suck. RabbitMQ perhaps.
<dre>
okey, i'm kind of confused with it. probably i'll do best by leaving it alone ;)
Austin__ [Austin__!~austin@96.45.197.22] has joined #ruby-lang
livinded [livinded!~lolwut@76-232-200-80.lightspeed.irvnca.sbcglobal.net] has joined #ruby-lang
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
<zzak>
must have missed these, thanks
pandora17 [pandora17!~pandora17@p508D518C.dip.t-dialin.net] has joined #ruby-lang
retro|cz [retro|cz!~retro@ip-86-49-73-114.net.upcbroadband.cz] has joined #ruby-lang
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
rtmex [rtmex!~rtmex@189.130.195.71] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@202.146.7.239] has joined #ruby-lang
dv310p3r [dv310p3r!~dv310p3r@host-208-68-238-122.biznesshosting.net] has joined #ruby-lang
<rtmex>
hola, alguien sabe si la gema calendar_helper se puede modificar para que presente los nombres de los meses en espa
tokumine [tokumine!~kunio@82-69-174-54.dsl.in-addr.zen.co.uk] has joined #ruby-lang
spyvsspy [spyvsspy!~nonenone@209.145.177.162] has joined #ruby-lang
ap3mantus [ap3mantus!~ap3mantus@c-98-217-179-108.hsd1.ma.comcast.net] has joined #ruby-lang
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
<drbrain>
I could answer rtmex in English, but I don't know if they would understand ☹
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
naz [naz!~n@70.44.2.190.res-cmts.bus.ptd.net] has joined #ruby-lang
kylemcgill [kylemcgill!~kylemcgil@static-ip-202-90-56-14.watchdog.net.nz] has joined #ruby-lang
wwalker [wwalker!~wwalker@208.92.232.27] has joined #ruby-lang
<wwalker>
is there a reliable way to get the class of the calling method?
Austin__ [Austin__!~austin@96.45.197.22] has quit [#ruby-lang]
zenspider [zenspider!~user@envy.zenspider.com] has joined #ruby-lang
<drbrain>
wwalker: why do you need to know this information?
<zenspider>
what'd I miss?
<zenspider>
ged: ping
<drbrain>
… there's binding_of caller, but needing such information is generally frowned upno
<zenspider>
ged: #seattle.rb
<zenspider>
wow. it took me a good 10 seconds to realize that upno is NOT an acronym :P
<drbrain>
damn you (lack of) autocorrect
<wwalker>
drbrain: policy, which I just failed to change, is that any component that logs anything will write to it's own log file
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
<zenspider>
you know... universal patrol naval officer...
<wwalker>
I was trying to make a logger class that would automatically name the log file after the class that created it (unless the constructor is passed a filename)
spyvsspy [spyvsspy!~nonenone@209.145.177.162] has joined #ruby-lang
<drbrain>
wwalker: make a logger module that you can include anywhere
<wwalker>
s/own log file/own separate log file/
<drbrain>
then self.class.name is all you need
<wwalker>
drbrain: thank you
<zenspider>
heh. if a logger class has to use binding_of, it shouldn't be used
<wwalker>
what I really love is the concept of having to look through 50 separate log files to see the action of one application.... :(
<zenspider>
tail -f *.log is awesome :P
<drbrain>
wwalker: can you use syslog?
<drbrain>
you can have the best of both worlds!
tester [tester!d8ac1410@gateway/web/freenode/ip.216.172.20.16] has joined #ruby-lang
Transformer [Transformer!~Transform@ool-4a59e397.dyn.optonline.net] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
mztriz [mztriz!~mztriz@74-136-75-114.dhcp.insightbb.com] has joined #ruby-lang
<wwalker>
drbrain: drbrain no syslog
<drbrain>
wwalker: aww ☹
<wwalker>
drbrain: a module won't work in a slass method in the including class?
<wwalker>
class
<wwalker>
module methods only add function to instance variables ?
<drbrain>
wwalker: right, only instance variables
<injekt>
then there's extend
<drbrain>
or, you can include your Logging module in Kernel
<wwalker>
many of my components have class methods that might need to log (though most are instance methods)
<drbrain>
… but don't do that in a library
<wwalker>
no monkey patching. Rails creates enough unexpected behaviors :)
jaisoares [jaisoares!~jsoares@bl13-197-21.dsl.telepac.pt] has joined #ruby-lang
ivanoats [ivanoats!~ivanoats@pdpc/supporter/active/ivanoats] has joined #ruby-lang
tester [tester!d8ac1410@gateway/web/freenode/ip.216.172.20.16] has quit [#ruby-lang]
havenn [havenn!~skipper@rrcs-76-79-113-21.west.biz.rr.com] has joined #ruby-lang
brmouzone [brmouzone!~brmouzone@108-90-18-133.lightspeed.cicril.sbcglobal.net] has joined #ruby-lang