<havenwood>
I've never actually seen GetoptLong used. ¯\_(ツ)_/¯
pastorin_ has quit []
duckpuppy has joined #ruby
Psybur__ has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
Psybur_ has quit [Ping timeout: 264 seconds]
duckpuppy has quit [Ping timeout: 264 seconds]
<RedNifre>
Well, I just want to do `encode --deck french52 "Some Text"` and `decode --deck quartett A4 C2 E1 B1 B2 ...`
<RedNifre>
(It's a program to use decks of cards as a storage medium for unicode text)
SeepingN has quit [Quit: The system is going down for reboot NOW!]
jottr has quit [Ping timeout: 260 seconds]
banisterfiend has quit [Ping timeout: 246 seconds]
<weaksauce>
RedNifre don't think either of those can do what you want really... optionparser can't handle the script.rb some verb --extraoptions "some option" style iirc
<RedNifre>
Yeah, they looked too complicated so I just go with ARGV
beremenushka2 has quit [Ping timeout: 256 seconds]
beremenushka2 has joined #ruby
banisterfiend has joined #ruby
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jcarl43 has quit [Quit: WeeChat 2.0.1]
jcarl43 has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
cagomez has joined #ruby
sameerynho has joined #ruby
cdg_ has quit [Remote host closed the connection]
<RedNifre>
Almost done... if I have an array of strings of size 2 each, how do I uppercase the first and lowercase the second letter?
nachoman has quit []
<RedNifre>
never mind
<RedNifre>
there's a method for everything :)
herbmillerjr has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
sameerynho has quit [Ping timeout: 264 seconds]
Psybur__ has quit [Ping timeout: 264 seconds]
banisterfiend has quit [Ping timeout: 260 seconds]
jackjackdripper has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
am55 has quit [Quit: am55]
gbaptista has quit [Read error: Connection reset by peer]
<nymous>
if i'll try to run this lib on 1.9.3 i get unknown method
<nymous>
this is what i want to fix with less effort
<darix>
nymous: probably the lib requires a newer ruby version
<nymous>
own ruby package might work though
<nymous>
omnibus or something
<darix>
well depending on your platform ... your distro might also support newer versions
<darix>
or there is a newer version of your OS which comes with a newer ruby version
<Ethan>
nymous: that's a very old version of Ruby. What OS are you running?
<nymous>
debian wheezy
<darix>
is that even still supported?
<nymous>
i think not
<Ethan>
may I ask why you're running a 5 year old version of debian?
<nymous>
i don't have time to upgrade 80 servers though
<Ethan>
Wheezy LTS support ends May 31st
<Ethan>
so if you care about the security of your servers, you'll want to reconsider.
<darix>
"I will upgrade after I got hacked through a bug that would be fixed in a supported debian version"
<gray_-_wolf>
so he's still good for 16 days ^_^
<darix>
gray_-_wolf: 2.5months
<Ethan>
TIME TRAVELLER!
<gray_-_wolf>
f... May X March... my English sucks
terens has joined #ruby
<nymous>
the problem is, these servers were supposed to be disabled in 2016, but real life is a little bit more complicated
<darix>
nymous: so maybe use the next 2.5months to port your app to a newer ruby version and test the upgrade
<darix>
nymous: if you leave them on, you also have to do the tasks that come with it. which includes updating :P
<nymous>
my is already running on newer server with newer ruby
<darix>
there is no free lunch
ltt has joined #ruby
hfp_work has quit [Quit: bye]
<Ethan>
hey look the sysadmin I'd never want to work with
<nymous>
but this bunch of old servers which i was unwilling to touch now need this script too
<gray_-_wolf>
nymous: I think best solution here (assuming upgrading servers is not an option) is to make own ruby package; if possible it's probably better than monkeypatching it
<darix>
Ethan: huh?
<darix>
Ethan: I dont blame him
<darix>
might be management problem
<nymous>
my current setup runs latest debian stretch with ruby2.3
<nymous>
so no problem here
<darix>
nymous: which configuration management thing do you use?
<nymous>
it's just a bunch of old servers which were supposed to be disposed 2 years ago, but in the middle of the process management said, stop, we are ok with that
hfp_work has joined #ruby
<nymous>
so blame me or not, it's real life
<nymous>
darix: puppet before, chef now
<darix>
then you can automate the updating easily :P
za1b1tsu has quit [Quit: Leaving]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<nymous>
i can spend couple of days upgrading them and they would be disposed a week later
milardovich has joined #ruby
<nymous>
idk
<nymous>
jessie to stretch upgrading was relatively easy, but wheezy to jessie means porting sysv stuff to systemd etc
xuyuheng has quit [Ping timeout: 276 seconds]
<darix>
nymous: or in 2 years you will be running the same servers
<nymous>
yes, idk
milardovich has quit [Ping timeout: 245 seconds]
xuyuheng has joined #ruby
<nymous>
the bad thing is that i'm using another networking virtualisation setup for my current servers, so i want them to be the same as the newer ones, i have to redone networking, which is pain and downtime
<nymous>
*if i want
ltt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
terens: Please make a habit to a) use a .rb file extension to enable syntax highlighting and b) fix your indentation issues. You are using mixed space and tabs.
<dminuoso>
terens: Don't share your gist until you looked at your gist, and determined that is clean and easy to read.
<dminuoso>
(Or perhaps its just some copy paste error - either way)
duckpuppy has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
sidx64 has quit [Read error: Connection reset by peer]
ltt has quit [Client Quit]
sidx64 has joined #ruby
tockitj has joined #ruby
<tockitj>
how to let drb instantiate new object on each client connection? So far I was able only to expose a class.
workmad3 has joined #ruby
jameser has joined #ruby
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
KeyJoo has joined #ruby
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sidx64 has joined #ruby
sidx64 has quit [Client Quit]
tvw has joined #ruby
guacamole has joined #ruby
guacamole has quit [Client Quit]
rikkipitt has quit [Quit: Leaving...]
jrafanie has joined #ruby
Burgestrand has joined #ruby
catphish has joined #ruby
pugcs has quit [Ping timeout: 260 seconds]
ltt has joined #ruby
<catphish>
is the bundler gem dead? i see bundler in rubygems
_whitelogger_ has joined #ruby
kt2 has joined #ruby
n0m4d1c has quit [*.net *.split]
graft has quit [*.net *.split]
jordanm has quit [*.net *.split]
AgentVenom has quit [*.net *.split]
gray_-_wolf has quit [*.net *.split]
X-Jester has quit [*.net *.split]
iNs has quit [*.net *.split]
n13z has quit [*.net *.split]
jp has quit [*.net *.split]
segy has quit [*.net *.split]
kt has quit [*.net *.split]
psmolen has quit [*.net *.split]
noizex has quit [*.net *.split]
mlehrer has quit [*.net *.split]
CalimeroTeknik has quit [*.net *.split]
kloeri has quit [*.net *.split]
stairmast0r has quit [*.net *.split]
Bish has quit [*.net *.split]
shadeslayer has quit [*.net *.split]
sjums has quit [*.net *.split]
Drakevr has quit [*.net *.split]
izaac has quit [*.net *.split]
tycoon177 has quit [*.net *.split]
ptx0 has quit [*.net *.split]
hsiktas has quit [*.net *.split]
Yonk has quit [*.net *.split]
deimos has quit [*.net *.split]
koenrh has quit [*.net *.split]
mitsuhiko has quit [*.net *.split]
caw______ has quit [*.net *.split]
justache has quit [*.net *.split]
devyn has quit [*.net *.split]
pizzaops has quit [*.net *.split]
S007 has quit [*.net *.split]
levifig has quit [*.net *.split]
ozzloy has quit [*.net *.split]
cout has quit [*.net *.split]
cjohnson has quit [*.net *.split]
mnemon has quit [*.net *.split]
flips has quit [*.net *.split]
ccooke has quit [*.net *.split]
ljarvis has quit [*.net *.split]
flips_ is now known as flips
koenrh_ is now known as koenrh
jp| is now known as jp
CalimeroTeknik_ is now known as CalimeroTeknik
deimos_ is now known as deimos
pizzaops_ is now known as pizzaops
tycoon177_ is now known as tycoon177
mitsuhiko_ is now known as mitsuhiko
hsiktas_ is now known as hsiktas
justache_ is now known as justache
segy_ is now known as segy
jordanm has joined #ruby
WebDawg has joined #ruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
octomancer has joined #ruby
_derpy has joined #ruby
cjohnson has joined #ruby
mikkel-_ has joined #ruby
mlehrer has joined #ruby
v0n has joined #ruby
Dark_Arc has quit [Ping timeout: 260 seconds]
AJA4350 has quit [Ping timeout: 260 seconds]
llua has quit [Ping timeout: 260 seconds]
dviola has quit [Ping timeout: 260 seconds]
Gnut has quit [Ping timeout: 260 seconds]
mozzarella has quit [Ping timeout: 260 seconds]
MarcWeber has quit [Ping timeout: 260 seconds]
mikkel- has quit [Ping timeout: 260 seconds]
knight_ has quit [Ping timeout: 260 seconds]
herbmillerjr has quit [Ping timeout: 260 seconds]
rwb has quit [Ping timeout: 260 seconds]
snapcase has quit [Ping timeout: 260 seconds]
ablackack_ has quit [Ping timeout: 260 seconds]
xsdg has quit [Ping timeout: 260 seconds]
nymous has quit [Ping timeout: 260 seconds]
foxxx0 has quit [Ping timeout: 260 seconds]
vdl has quit [Ping timeout: 260 seconds]
ericmathison has quit [Ping timeout: 260 seconds]
russt has quit [Ping timeout: 260 seconds]
Fraeon has quit [Ping timeout: 260 seconds]
DEac-_ has quit [Ping timeout: 260 seconds]
caw_______ has joined #ruby
Yonk_ has joined #ruby
mlehrer has joined #ruby
justache has joined #ruby
koenrh has joined #ruby
hsiktas has joined #ruby
Drakevr_ has joined #ruby
deimos has joined #ruby
pizzaops has joined #ruby
naquad has joined #ruby
`derpy has quit [Ping timeout: 260 seconds]
naquad has quit [Ping timeout: 260 seconds]
koenrh has quit [Changing host]
Yonk_ has quit [Changing host]
pizzaops has quit [Changing host]
justache has quit [Changing host]
caw_______ has quit [Changing host]
hsiktas has quit [Changing host]
deimos has quit [Changing host]
mlehrer has quit [Changing host]
AJA4351 is now known as AJA4350
mozzarel1 is now known as mozzarella
_whitelogger has quit [Remote host closed the connection]
rwb1 is now known as rwb
schneider has quit [Ping timeout: 276 seconds]
mnemon has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
mnemon is now known as Guest64122
za1b1tsu has joined #ruby
ramfjord has joined #ruby
tomphp has joined #ruby
naquad has quit [Ping timeout: 260 seconds]
naquad has joined #ruby
tomphp has quit [Read error: Connection reset by peer]
tomphp has joined #ruby
qba73 has quit [Remote host closed the connection]
xorgnak has joined #ruby
qba73 has joined #ruby
ramfjord has quit [Ping timeout: 264 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pugcs has left #ruby [#ruby]
pugcs has joined #ruby
dr3w_ has joined #ruby
sidx64 has joined #ruby
pugcs has quit []
tomphp has joined #ruby
schneider has joined #ruby
pugcs has joined #ruby
duckpuppy has joined #ruby
Cavallari has joined #ruby
halbbalda has quit [Ping timeout: 240 seconds]
ltem_ has joined #ruby
qba73 has quit [Ping timeout: 264 seconds]
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<WhereIsMySpoon>
yeah im trying to play with easy audio but i cant seem to get it to output to a file or to a stream
<WhereIsMySpoon>
it just outputs straight back to speaker
oetjenj has joined #ruby
<terens>
recording doesnt work?
<WhereIsMySpoon>
recording works, i just cant work out how to make it record to a file/stream
<Burgestrand>
WhereIsMySpoon so did you install ffi-portaudio before you tried it, or how'd you attempt to install the portaudio that you linked to?
<WhereIsMySpoon>
rather than just record-playback
karapetyan has quit [Remote host closed the connection]
<WhereIsMySpoon>
Burgestrand: I installed portaudio via brew
terens has quit [Quit: Leaving]
<Burgestrand>
WhereIsMySpoon because ffi-portaudio and portaudio there are two different things
<Burgestrand>
WhereIsMySpoon that's only the C library, not the ruby library that you showed us
<Burgestrand>
(you need both)
<WhereIsMySpoon>
right
<WhereIsMySpoon>
ah, i think i installed the gem ffi-portaudio
<WhereIsMySpoon>
not the ruby lib i linked
<WhereIsMySpoon>
how do i install that ruby lib?..
<WhereIsMySpoon>
or do I need to download the file and use it directly?
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
karapetyan has joined #ruby
<Burgestrand>
ffi-portaudio might be sufficient, easy_audio appears to use that too
<Burgestrand>
… actually, maybe not.
<WhereIsMySpoon>
easy_audio seems to be nicer
<Burgestrand>
I did a bunch of audio driver work in ruby a while back, it was bad enough that I pretty much had to write my own…
<WhereIsMySpoon>
if i could get it to output to file/stream
alfiemax has joined #ruby
<Burgestrand>
Ah, yes, it does use ffi-portaudio, never mind!
anisha has quit [Quit: This computer has gone to sleep]
AndroUser has joined #ruby
<WhereIsMySpoon>
Burgestrand: :) so I dont want portaudio ruby lib or ffi-portaudio
<WhereIsMySpoon>
easy_audio will work?
<Burgestrand>
Yeah, easy_audio also includes ffi-portaudio so you can drop down to the harder-to-use API if needed
<WhereIsMySpoon>
Right, and can you help me understand how to record to a file/stream?
<WhereIsMySpoon>
using easyaudio?
<Burgestrand>
I'm trying to read it, but I'm not sure that easy_audio can output to anything other than a portaudio device (and I'm not familiar enough with portaudio to know if you can create a "file" device)
alfiemax has quit [Ping timeout: 240 seconds]
<Burgestrand>
I'm fairly sure you'll get uncompressed PCM samples, what kind of input is your google speech thing expecting?
kapil___ has quit [Quit: Connection closed for inactivity]
<WhereIsMySpoon>
uhhh
sidx64 has joined #ruby
alfiemax has joined #ruby
<Burgestrand>
Maybe they can accept raw audio, there seems to be an encoding option in google speech thingy :)
<WhereIsMySpoon>
Burgestrand: yes, it can
<WhereIsMySpoon>
raw, flac, ogg
<WhereIsMySpoon>
at least those
<WhereIsMySpoon>
so whats a pcm sample?
<Burgestrand>
Yeah, I'm not entirely sure `raw` is actually a format
<WhereIsMySpoon>
linear16
<WhereIsMySpoon>
is what it uses for RAW files
<Burgestrand>
WhereIsMySpoon it's typically what speakers/microphones produce/consume, essentially a way to encode audio into digital format
<WhereIsMySpoon>
in the examples at least
<Burgestrand>
WhereIsMySpoon you can think of it as an array of numbers
<WhereIsMySpoon>
ahh, is it an array of frequencies?
<WhereIsMySpoon>
i have some experience with signals and audio, i did electronics at uni
<Burgestrand>
Not quite, but you can analyze the frequencies using fourier transforms
<WhereIsMySpoon>
bit hazy now :P
<WhereIsMySpoon>
I see
<WhereIsMySpoon>
and the numbers are the output of those transforms?
mtkd has quit [Ping timeout: 245 seconds]
<Burgestrand>
WhereIsMySpoon so when you're dealing with raw PCM data, you typically need to know how many channels there are (i.e. 1 (mono), 2 (audio)) and the sample rate (i.e. 44.1kHz, playback speed) and the size of the samples (16bit?)
AndroUser has left #ruby ["退出消息"]
<WhereIsMySpoon>
google cloud can only analyze 1 channel audio
AndroUser has joined #ruby
<Burgestrand>
Maybe something more too, I might have forgotten…
<Burgestrand>
Cool, so if your mic is giving you multiple channels we can probably just throw one away
<WhereIsMySpoon>
it has inputs for sample rate
mtkd has joined #ruby
<WhereIsMySpoon>
right, so how do I get easy_audio to output this raw data to a variable or file
<Burgestrand>
… also important to know if the channels come interleaved or some other way
<Burgestrand>
Not for google audio, but for when you're getting the data from the microphone
<Burgestrand>
You can probably configure it to just give you a single channel, too :)
Psybur__ has joined #ruby
<Burgestrand>
WhereIsMySpoon you do it yourself, you can pass a block to the EasyAudio::Stream.new, and that will get a buffer and a description of the contents of the buffer (sample rate, channels)
<WhereIsMySpoon>
right so this: EasyAudio.easy_open(in: true, out: true, latency: 1.0) { current_sample } will do what? Output the mic input into current_sample?
<Burgestrand>
WhereIsMySpoon keep in mind all of the audio stuff I'm explaining to you I've kind of taught myself through trial and error, there might be inconsistencies or gaps or straight out errors in what I say :)
<WhereIsMySpoon>
better than what ive got :D
KeyJoo has quit [Ping timeout: 248 seconds]
<WhereIsMySpoon>
this is all for a personal project so no biggie
<Burgestrand>
Oh, wow, no I wouldn't use EasyStream
<Burgestrand>
Well, depending on the hardware you're running on it might not be a problem
<WhereIsMySpoon>
macbook air
<WhereIsMySpoon>
i have gotten it to record and playback my voice already
<WhereIsMySpoon>
just only ina direct input -> output
<WhereIsMySpoon>
not storing the data
<Burgestrand>
WhereIsMySpoon yeah, I think just use a regular stream with a block, so you get the samples chunked, that way you'll buffer the writes to file and it'll perform better :)
<Burgestrand>
WhereIsMySpoon if I'm reading the source correctly, then if you return a symbol from the processing block it'll simply ignore whatever output device is configured
<Burgestrand>
Naw, this is some complex stuff, plus the code is old and documentation could be better :)
<WhereIsMySpoon>
I dont mind complex
apeiros has quit []
<WhereIsMySpoon>
As long as I can say stuff into my mic and I can throw it at google cloud speech :P
<Burgestrand>
WhereIsMySpoon yeah, I'm playing a bit with the code at the moment, just writing up a basic project to see if I can get it to read my mic
<WhereIsMySpoon>
ok :)
roshanavand has quit [Ping timeout: 256 seconds]
AndroUser is now known as edfk2012
konsolebox has quit [Ping timeout: 276 seconds]
<WhereIsMySpoon>
im not sure theres a way of changing the output
<WhereIsMySpoon>
i may need to download this file and integrate it with my project and change teh code
<WhereIsMySpoon>
or just not use this project
<WhereIsMySpoon>
and use something else
<Burgestrand>
Appears that the released gem also doesn't contain the latest code
<CalimeroTeknik>
oh, nice. as expected of ruby, the trick always exists
<dminuoso>
CalimeroTeknik: I personally like to think of Ruby values as _all_ being Maybe wrapped.
<dminuoso>
Since generally any method could somehow produce a nil back.
<CalimeroTeknik>
indeed
nowhere_man has joined #ruby
<dminuoso>
CalimeroTeknik: However, in a different perspective, your previous code does the same thing.
<dminuoso>
Maybe models exceptions.
<dminuoso>
If you think about it, the Maybe monad represents a failable computation, that once a failure occurs propagates the failure until someone cares about it. All the computation in between is shortcircuited.
<dminuoso>
That is just an exception.
<CalimeroTeknik>
admittedly, the point is to not use the rescue structure; I wanted the same semantics, but in the form of an expression
<dminuoso>
CalimeroTeknik: Just for giggles, Array#flat_map is >>= for Array =)
<dminuoso>
CalimeroTeknik: It may possibly be cleaner to do this
<dminuoso>
CalimeroTeknik: So they are not completely unordered.
ramfjord has joined #ruby
<Burgestrand>
WhereIsMySpoon you can read the samples from the `buffer` (which is essentially a struct with some data), the samples you're after are inside `buffer.samples`, which is an array of floats
<Burgestrand>
WhereIsMySpoon now, GCS expects 1-channel 16-bit little endian integer PCM data, so unfortunately we can't just pack the array of floats into a string and then save it, we need to convert it a little bit
<WhereIsMySpoon>
sorry im a bit lost, where does buffer come from and how do i use it
<Burgestrand>
WhereIsMySpoon EasyAudio::Stream.new(format) { |buffer| *code* } <- there is the buffer
<WhereIsMySpoon>
right
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<WhereIsMySpoon>
im still lost :P
<Burgestrand>
WhereIsMySpoon where?
<WhereIsMySpoon>
what is format supposed to be and what do i do with buffer
<Burgestrand>
WhereIsMySpoon what format you want depends a bit, I just set it to the default, but made sure to specify that the number of input channels is 1 (most important)
ramfjord has quit [Ping timeout: 256 seconds]
<dminuoso>
CalimeroTeknik: Oh and the regular usage of `.` equals to fromJust by the way - blowing up when nil comes along (kind of)
<WhereIsMySpoon>
ok, so EasyAudio::Stream.new(in_chans: 1)
qba73 has quit [Ping timeout: 265 seconds]
<WhereIsMySpoon>
and then what do i do with buffer
<dminuoso>
(Also in a weird way)
qba73 has joined #ruby
<Burgestrand>
WhereIsMySpoon buffer.samples is an array of floats, that's where the audio data is, so that's the thing that you need to save before the block returns
<WhereIsMySpoon>
EasyAudio::Stream.new(in_chans: 1) { |buffer| a.push(buffer) }.start gives me an invalid memory address error
<WhereIsMySpoon>
i made a an empty array
<WhereIsMySpoon>
ah, right, all i want to do is store buffer.samples in a
<WhereIsMySpoon>
not push it to a
<WhereIsMySpoon>
but still, i get invalid memory error
<WhereIsMySpoon>
paNoError
<WhereIsMySpoon>
irb(main):053:0> invalid memory write at address=0x00000000000000
<Burgestrand>
WhereIsMySpoon ah yes, make sure your block returns :paContinue
<WhereIsMySpoon>
oh wait itll be a variable on easyaudio somewhere
<WhereIsMySpoon>
right?
psychicist__ has joined #ruby
<Burgestrand>
WhereIsMySpoon if you return a symbol inside the block, EasyAudio will assume that's the return value of the entire audio processing callback, and will not send it to the speakers
<Burgestrand>
WhereIsMySpoon so yeah, just make :paContinue the last line of the block
leitz has quit [Quit: Nappy time]
<WhereIsMySpoon>
hm...nope
ltt has joined #ruby
<WhereIsMySpoon>
that isnt working
<WhereIsMySpoon>
ive required ffi-portaudio in my irb
<WhereIsMySpoon>
irb(main):005:0> invalid memory write at address=0x00000000000000
<Burgestrand>
Ah. Indeed, I'm using the easy_audio from github, not the release from rubygems, because the one in rubygems doesn't allow _not_ echoing to the speakers again :(
<WhereIsMySpoon>
ahh
<WhereIsMySpoon>
Burgestrand: I can grab the source, how do I put it in my project so I can just require it like i would a normal gem
<Burgestrand>
WhereIsMySpoon are you using bundler for your project?
sidx64 has joined #ruby
<WhereIsMySpoon>
i have bundler installed
<WhereIsMySpoon>
i certianly can use it
<WhereIsMySpoon>
ive used it before, but only for simple bundle install/bundle exec stuff
<Burgestrand>
WhereIsMySpoon as long as you're not making a gem of this we're all good :)
<WhereIsMySpoon>
nope
<WhereIsMySpoon>
i wont be :)
<Burgestrand>
WhereIsMySpoon call `bundle init` and then open the `Gemfile` that's created, and then you need to insert the name of all gems you'll be using in there
<WhereIsMySpoon>
ive got a gemfile
<Burgestrand>
WhereIsMySpoon for specifically easy_audio, you can insert: `gem "easy_audio", github: "lsegal/easy_audio"`
shinnya has quit [Ping timeout: 265 seconds]
<WhereIsMySpoon>
oh!
<Burgestrand>
WhereIsMySpoon … and then bundle install :) when you run your project make sure you use either `bundle exec` or you `require "bundler/setup"` somewhere in your code
<Burgestrand>
WhereIsMySpoon all of this can be read about in http://bundler.io
<WhereIsMySpoon>
how do I require easy_audio in irb now? :P
Ltem has quit [Quit: bye]
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Burgestrand>
WhereIsMySpoon same as before, just make sure you either launch IRB with bundler or require "bundle/setup" once you're in IRB
<WhereIsMySpoon>
ah i need to..yeah
<WhereIsMySpoon>
got it
duckpuppy has joined #ruby
<WhereIsMySpoon>
>_>
<WhereIsMySpoon>
i crashed irb
<WhereIsMySpoon>
EasyAudio::Stream.new(in_chans: 1) { |buffer| a = buffer.samples; :paContinue }.start seems to block
<WhereIsMySpoon>
and ctrl-c doesnt stop it
rafik has joined #ruby
sidx64 has joined #ruby
<Burgestrand>
I've had it deadlock on me a few times too
<Burgestrand>
It's not consistent
<WhereIsMySpoon>
ah, pushing buffer.samples to a as an array seems to work
karapetyan has joined #ruby
rwb has joined #ruby
<WhereIsMySpoon>
Burgestrand: right, I have a very large 2d array
<WhereIsMySpoon>
im not sure what it contains
<WhereIsMySpoon>
loads of numbers
<WhereIsMySpoon>
what do i do with it now :)
<Burgestrand>
WhereIsMySpoon hehe, buffer.samples is an array, so it's probably an Nx256 (i.e. each element is an array of 256 decimal numbers)
Guest94022 is now known as S007
S007 has quit [Changing host]
S007 has joined #ruby
<WhereIsMySpoon>
right
<Burgestrand>
WhereIsMySpoon I'm fairly sure that each float you have there is an amplitude value for each sample, between -1 and +1, does that look about right?
jamied has joined #ruby
<Burgestrand>
WhereIsMySpoon (a float is a decimal number)
<WhereIsMySpoon>
im aware what a float is :) yes i think so
duckpuppy has quit [Ping timeout: 240 seconds]
karapetyan has quit [Ping timeout: 260 seconds]
DTZUZO has quit [Ping timeout: 240 seconds]
bmurt has joined #ruby
<Burgestrand>
WhereIsMySpoon yeah, alright, so I think GCS only accepts integer format audio, so you need to convert each -1 to +1 float into a -32768 to 32767 (i.e. minimum and maximum value of a 16-bit integer)
<WhereIsMySpoon>
i suppose this involves bit shifting
<WhereIsMySpoon>
or are there built in ruby tools for this :D
<Burgestrand>
Well, maybe it could, but we're doing audio processing in ruby so we've already abandoned most of the efficiency requirements anyway :)
<WhereIsMySpoon>
:D
<Burgestrand>
(i.e. traditionally you don't want to allocate memory inside the audio processing callback, we're kind of screwed since we're using a ruby block as the callback)
<Burgestrand>
WhereIsMySpoon so, well, easiest conversion is something like this: int16_sample = (float_sample * 32768).to_i
Dimik has joined #ruby
am55 has quit [Quit: am55]
tomphp has joined #ruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SteenJobs has joined #ruby
tomphp has quit [Client Quit]
<Burgestrand>
WhereIsMySpoon and once you've done that, there's only one step left, and that's converting the samples into a string of bytes, which you can do using Array#pack
<Burgestrand>
WhereIsMySpoon I read that GCS wants 16-bit signed little-endian integers, so it'd look something like this:
xuyuheng has quit [Quit: Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<WhereIsMySpoon>
Burgestrand: 32767 or 32768 for the multiplier :P
<WhereIsMySpoon>
7 right?
<Burgestrand>
WhereIsMySpoon minimum value should be -32768 but maximum value should be 32767
<WhereIsMySpoon>
right, so its (el*32767).to_i
synthroid has joined #ruby
<Burgestrand>
WhereIsMySpoon nay, 32768 (i.e. 2^16 / 2), but add a check to make sure you don't go out of bounds
cschneid has quit [Ping timeout: 264 seconds]
<Burgestrand>
WhereIsMySpoon i.e. if it's above 32768 then set it to 32768, and vice versa for negative
Rapture has joined #ruby
<WhereIsMySpoon>
im confused. so I need to do el = (el*32768).to_i; then do that check?
<Burgestrand>
Oh, sorry, 32767 is upper limit, not 32768 :)
<WhereIsMySpoon>
right
<WhereIsMySpoon>
thats what i thoguht :P
<Burgestrand>
Indeed, do it first and then constraint the result just to be sure
am55 has joined #ruby
<WhereIsMySpoon>
ok
<WhereIsMySpoon>
i think that worked
netherwolfe has joined #ruby
<WhereIsMySpoon>
at least i have a 2d array of integers
<WhereIsMySpoon>
ah now to pack it
<Burgestrand>
WhereIsMySpoon aye indeed
<WhereIsMySpoon>
its packed
<Burgestrand>
WhereIsMySpoon if you still have an array like so: [[…], […], […]] you'll need to pack each one and then concatenate
<WhereIsMySpoon>
yep
<WhereIsMySpoon>
did that
<Burgestrand>
+1
<Burgestrand>
That should be all
<WhereIsMySpoon>
b = b.map! { |arr| arr = arr.pack("s<256")}
<Burgestrand>
You have the raw data for your file
<WhereIsMySpoon>
i didnt need to do b = but whatever :P
<WhereIsMySpoon>
ok
<Burgestrand>
Either save it, or if you're using the GCS API then you can wrap it in a stringIO right away: audio = speech.audio StringIO.new(audio_data), encoding: :linear16, sample_rate: 44100, language: "?"
<Burgestrand>
WhereIsMySpoon oh, keep in mind that the result of map! is now just an array of strings, but you can create a single string from them easily with `output_data = output_data.join`
<WhereIsMySpoon>
i think i did something weird with the array last time to get such a huge one, this time its a small 1d array
<Burgestrand>
WhereIsMySpoon the code you have there should be an array of arrays, i.e. [[…], […], […]], but then your map treats it as an array of floats
<WhereIsMySpoon>
it is a 1d array
<Burgestrand>
WhereIsMySpoon you also never start the stream; not sure if that's needed to be frank though :)
<WhereIsMySpoon>
Burgestrand: ive updated it
<WhereIsMySpoon>
with outputs too
oleo has joined #ruby
<Burgestrand>
WhereIsMySpoon if I run your code it throws an error in the map, so something sounds off
conta has quit [Quit: conta]
<WhereIsMySpoon>
thats weird
<WhereIsMySpoon>
this time its a 2d array
rikkipitt has joined #ruby
<WhereIsMySpoon>
wtf
duckpuppy has joined #ruby
tomphp has joined #ruby
conta has joined #ruby
terens has quit [Ping timeout: 240 seconds]
conta has quit [Client Quit]
<WhereIsMySpoon>
one moment :P
conta has joined #ruby
lele` has quit [Ping timeout: 256 seconds]
v0n is now known as vdl
alfiemax has quit [Remote host closed the connection]
rwb has quit [Ping timeout: 260 seconds]
duckpuppy has quit [Ping timeout: 240 seconds]
memo1 has quit [Quit: WeeChat 1.4]
memo1 has joined #ruby
roshanavand has quit [Quit: Leaving.]
roshanavand has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<WhereIsMySpoon>
this gives me an empty array from the recognize, which is probably correct since i probably didnt record anything
<Burgestrand>
WhereIsMySpoon 32767 should be 32768
<WhereIsMySpoon>
wut
<WhereIsMySpoon>
i thought you said upper was 32767
<Burgestrand>
WhereIsMySpoon yeah, but lower is -32768
<WhereIsMySpoon>
oh xD
qba73 has quit [Remote host closed the connection]
<Burgestrand>
WhereIsMySpoon probably no biggie, but it shifts the amplitude (?) of the recording
<WhereIsMySpoon>
right, so how do i record more
qba73 has joined #ruby
karapetyan has joined #ruby
Puffball has joined #ruby
<Burgestrand>
WhereIsMySpoon don't start and then close right away, put a sleep in there for a few seconds perhaps?
<WhereIsMySpoon>
start doesnt block
<Burgestrand>
Which is exactly the problem :)
<WhereIsMySpoon>
and im copy-pasting these commands
<WhereIsMySpoon>
hm
<Burgestrand>
If you start and then close you'll only be recording inbetween, which means for a miniscule amount of time
<WhereIsMySpoon>
so if i just run stream.start, speak to my mic, then close, i should get something?
rikkipitt has quit [Remote host closed the connection]
<Burgestrand>
WhereIsMySpoon so I'd suggest something akin to stream.start; sleep 5; stream.close
<Burgestrand>
WhereIsMySpoon and then you have five seconds to speak to your computer, I don't know about you but I got some weird looks here in the office
<WhereIsMySpoon>
XD
<WhereIsMySpoon>
im on a hack day
milardovich has quit [Ping timeout: 240 seconds]
tomphp has quit [Client Quit]
<WhereIsMySpoon>
Burgestrand: irb(main):013:0> a.map { |arr| arr.map { |el| if (el < -32768) { el = -32768} elsif (el > 32767) { el = 32767} } }
<WhereIsMySpoon>
is this correct?
<WhereIsMySpoon>
for correction
<Burgestrand>
WhereIsMySpoon yup, should be alright!
<Burgestrand>
WhereIsMySpoon oh, keep in mind, your assignment `el = ` does nothing, `map` only cares about the return value of the block
<WhereIsMySpoon>
i copied a into b just in case i fucked it up :P
tomphp has joined #ruby
<WhereIsMySpoon>
irb seems to think im still inside one level of block
<Burgestrand>
WhereIsMySpoon yeah, well, ruby does not do curly braces for if-statements
<WhereIsMySpoon>
oh
<WhereIsMySpoon>
oops :D
Puffball has quit [Remote host closed the connection]
<Burgestrand>
WhereIsMySpoon (and they end with… well, `end` ;))
jobewan has joined #ruby
pastorinni has joined #ruby
IshMael_ has joined #ruby
rabajaj has joined #ruby
rabajaj has quit [Read error: Connection reset by peer]
rahul_bajaj has joined #ruby
<c_nick>
The user interface for my web app is done using Slim in which i am creating a row (td) and dumping the data from a config file in it. Now I want to color the content dynamically
<Burgestrand>
c_nick could you elaborate on `dynamically`?
suukim has quit [Quit: Konversation terminated!]
rikkipitt has joined #ruby
<c_nick>
lets say i have a config file - data.yaml which has contents text="This is a sample text" and in my data.slim i am doing td = "#{@yaml.text}"
<Burgestrand>
WhereIsMySpoon didn't want to post it until you got it working yourself :)
<c_nick>
Burgestrand, Now in my yaml file i want to do something like text = "sample data" <but hey! this should be in red> something like that
<WhereIsMySpoon>
Burgestrand: whats this frame size?
<Burgestrand>
WhereIsMySpoon I believe it's how many samples portaudio buffers up before calling the callback
<elomatreb>
c_nick: You mean syntax highlighting?
<Burgestrand>
WhereIsMySpoon the frame size tells you how long the buffer.samples array is
<WhereIsMySpoon>
i see
hanmac has quit [Ping timeout: 240 seconds]
<Burgestrand>
WhereIsMySpoon default value is 256, but I used it in the pack-format so I figured I'd specify it explicitly :)
<c_nick>
elomatreb, yeah a protocol .. so that in user.slim i can understand and color it while in configuration file i define it
rwb has quit [Ping timeout: 265 seconds]
<WhereIsMySpoon>
fair :)
pugcs has quit [Ping timeout: 240 seconds]
<WhereIsMySpoon>
cheers man, you’re the best
<WhereIsMySpoon>
:D
<Burgestrand>
WhereIsMySpoon it was fun!
<elomatreb>
c_nick: It sounds like you want a syntax highlighter, possibly with your own color theme. There are quite a few options, both server-side and client-side
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<c_nick>
server side for me .. i want to communicate from yaml to my web app to color the text
<WhereIsMySpoon>
Burgestrand: definitely :D
jeffreylevesque has joined #ruby
rahul_bajaj has quit [Quit: Leaving]
headius has left #ruby [#ruby]
rwb has joined #ruby
<dminuoso>
16:12 Burgestrand | WhereIsMySpoon yeah, well, ruby does not do curly braces for if-statements
<dminuoso>
Haha. I could have sworn it did.
<c_nick>
elomatreb, i guess this will work for me text {#formatting option}
<dminuoso>
But it's kind of hard to remember in which special cases ruby requires {} and where it disallows them.
<c_nick>
and in my web server i will try to search if there is any {} and dump the contents in a span style
<Burgestrand>
WhereIsMySpoon I don't think so, but I can't really say with an acceptable degree of confidence
<WhereIsMySpoon>
hokay
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has joined #ruby
schneider has quit [Read error: Connection reset by peer]
schneider has joined #ruby
reber has joined #ruby
riotjoe has joined #ruby
tomphp has joined #ruby
leitz has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
riotjones has quit [Ping timeout: 264 seconds]
alfiemax has quit []
desperek has joined #ruby
<leitz>
The other day someone said Ruby wasn't under a dictatorship anymore. Did I miss the memo?
qba73 has quit [Remote host closed the connection]
qba73 has joined #ruby
tomphp has quit [Client Quit]
alfiemax has joined #ruby
karapetyan has joined #ruby
duckpuppy has joined #ruby
karapetyan has quit [Ping timeout: 252 seconds]
Strepsils has joined #ruby
riotjoe has quit [Remote host closed the connection]
riotjones has joined #ruby
<WhereIsMySpoon>
Burgestrand: I guess the next thing to do now would be instead of stream.start and stream.stop, to just have it listening all the time and have it clear and analyze the output whenever the amplitude is above a certain number
<WhereIsMySpoon>
Burgestrand: those numbers from -1 to 1 that I get iniitally, what are those again
psychicist__ has quit [Quit: Lost terminal]
<Burgestrand>
WhereIsMySpoon I _believe_ that's amplitude
tomphp has joined #ruby
<WhereIsMySpoon>
right
ltt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
c_nick has joined #ruby
<Burgestrand>
WhereIsMySpoon i.e. you can graph it over time and you'd get the waveform
roshanavand has quit [Ping timeout: 240 seconds]
<Burgestrand>
WhereIsMySpoon which is why you need to use an FFT to get the frequency
<c_nick>
hi again , name {color:red} how to extract just color:red from this text
<Burgestrand>
s/frequency/frequencies
duckpuppy has quit [Ping timeout: 240 seconds]
<WhereIsMySpoon>
Burgestrand: I see
<c_nick>
\{\.*\} still gives the \{ \}
<WhereIsMySpoon>
Burgestrand: and the el * 32768 .to_i and then bounding it is that fft?
<Burgestrand>
WhereIsMySpoon no :)
<WhereIsMySpoon>
:D
eckhardt_ has joined #ruby
deathwishdave has joined #ruby
<Burgestrand>
WhereIsMySpoon that's converting float PCM data into int16 PCM data
<WhereIsMySpoon>
ok
<Burgestrand>
WhereIsMySpoon you're aware of that sound is essentially a bunch of different sine waves played on top of each other?
<WhereIsMySpoon>
yes
roshanavand has joined #ruby
<Burgestrand>
WhereIsMySpoon FFT is a mathy thing to extract the individual sine waves from the combined one
<WhereIsMySpoon>
ah right
<WhereIsMySpoon>
so if i have the amplitude
<Burgestrand>
(or, well, FT => fourier transform, the extra F is because it's FAST!)
<WhereIsMySpoon>
im reading that dB = 20 * log10(amplitude)
cagomez has joined #ruby
llua has joined #ruby
<Burgestrand>
WhereIsMySpoon unfortunately I can't help you in figuring out the amplitude from the raw data, that's a little bit outside of what I've done before plus I'm leaving in like 3 minutes :)
<WhereIsMySpoon>
:D
<WhereIsMySpoon>
ok man, you’ve helped enough anyway
chouhoulis has quit []
<Burgestrand>
Good luck!
n0m4d1c_ has quit [Remote host closed the connection]
schneider has quit [Ping timeout: 240 seconds]
terens has quit [Ping timeout: 240 seconds]
synthroid has quit [Remote host closed the connection]
jeffreylevesque_ has joined #ruby
<leitz>
c_nick, I'm not a great rubyist, but I'd get the index of the colon and the index of the closing brace, and then: mystring[colon + 1 .. closing_brace -1 ]
Strepsils has quit [Read error: Connection reset by peer]
chouhoulis has joined #ruby
<leitz>
There are probably better ways, though. That would expand if you had other needs.
marxarelli|afk is now known as marxarelli
<c_nick>
leitz, yes thats a good one .. i am somehow hell bent on regex .. its like drugs
<c_nick>
cooked up something like data.scan(/\{(.*)\}/).flatten.first
jeffreylevesque has quit [Ping timeout: 240 seconds]
<leitz>
In a python book I read "First you start with a problem. You try to solve it with a regex. Now you have two probelms." :)
<c_nick>
as scan gives u an array of all the groups in arrays and flatten will knock off the first array and first will get the value within
<c_nick>
:-P
mikecmpb_ has quit [Quit: inabit. zz.]
<c_nick>
leitz, but its super cool
<c_nick>
unless u reach level 2
llua has quit [Quit: <Rudolph> shell code is what greycat reads to kids when he tucks them in]
mikecmpbll has joined #ruby
llua has joined #ruby
jeffreylevesque_ has quit [Ping timeout: 240 seconds]
<phaul>
ule: i guess I could do something like that, although I liked the idea of having a separate tags per gem and load what's needed in the project
mikecmpbll has quit [Quit: inabit. zz.]
chouhoul_ has joined #ruby
schneider has quit [Ping timeout: 240 seconds]
<phaul>
so vim-bundler makes the promise of populating your tags vim option based on your bundled gems. That way you only generate tags when you install a gem. bit like rdoc/ri sits in $HOME/.gems
<phaul>
altough it doesn't work for me :)
IshMael_ has quit [Ping timeout: 246 seconds]
chouhoulis has quit [Ping timeout: 246 seconds]
clemens3 has joined #ruby
<ule>
Yeah, in my case there I'm creating ctags based on all installed gems. "bundle --list"
duckpuppy has joined #ruby
karapetyan has joined #ruby
oncall-pokemon has joined #ruby
am55 has quit [Quit: am55]
duckpuppy has quit [Ping timeout: 246 seconds]
am55 has joined #ruby
robscomputer has joined #ruby
apeiros_ has joined #ruby
memo1 has quit [Ping timeout: 260 seconds]
eckhardt_ has joined #ruby
jottr has joined #ruby
chouhoul_ has quit [Remote host closed the connection]
chouhoulis has joined #ruby
jottr has quit [Ping timeout: 260 seconds]
TomyWork has quit [Ping timeout: 240 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
qba73 has quit [Ping timeout: 240 seconds]
qba73 has joined #ruby
lytol has joined #ruby
chouhoulis has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
qba73 has quit [Remote host closed the connection]
Beams has quit [Quit: .]
karapetyan has quit [Remote host closed the connection]
jottr has joined #ruby
mtkd has quit []
robscomputer has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
robscomputer has joined #ruby
bocaneri has quit [Remote host closed the connection]
jottr has quit [Ping timeout: 240 seconds]
andikr has quit [Remote host closed the connection]
mtkd has joined #ruby
terens has joined #ruby
marxarelli is now known as marxarelli|afk
graft_ is now known as graft
<graft>
what is the deal with URI.encode? are we supposed to use it? not use it? why can't we encode brackets? must I take up an 'addressable' dependency?
<graft>
et cetera
kapil___ has joined #ruby
rwb has quit [Ping timeout: 264 seconds]
milardovich has quit [Remote host closed the connection]
jamesaxl has quit [Quit: WeeChat 2.0.1]
jottr has joined #ruby
jamesaxl has joined #ruby
mgraf_ has joined #ruby
<morfin>
huh
<apeiros_>
graft: hm? why do you think you're supposed to not use it?
<apeiros_>
oh, I should not answer when going afk soon :(
apeiros_ is now known as apeiros
* apeiros
afk for a bit
leotaku has joined #ruby
mgraf has quit [Ping timeout: 268 seconds]
jottr has quit [Ping timeout: 264 seconds]
mgraf_ has quit [Ping timeout: 240 seconds]
ltt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ta__ has quit [Remote host closed the connection]
n008f4g_ has joined #ruby
mtkd has quit []
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
milardovich has joined #ruby
im0nde has joined #ruby
milardovich has quit [Remote host closed the connection]
cagomez has quit [Remote host closed the connection]
marr has joined #ruby
jottr has quit [Ping timeout: 264 seconds]
duckpuppy has quit [Ping timeout: 248 seconds]
allcentury has quit [Ping timeout: 240 seconds]
cagomez has joined #ruby
jinie has quit [Client Quit]
cagomez has quit [Remote host closed the connection]
jinie has joined #ruby
cagomez has joined #ruby
arand has joined #ruby
leah2 has quit [Ping timeout: 240 seconds]
cschneid has joined #ruby
robscomputer has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
leah2 has joined #ruby
karapetyan has quit [Remote host closed the connection]
jottr has joined #ruby
marr has quit [Remote host closed the connection]
cschneid has quit [Ping timeout: 240 seconds]
cagomez has quit [Remote host closed the connection]
terens has quit [Read error: Connection reset by peer]
terens has joined #ruby
desperek has quit [Quit: xoxo]
jottr has quit [Ping timeout: 264 seconds]
<arand>
Being quite new to ruby, I have been using exclusive ranges x = y[a...-b] in order to extract "middle parts" of things, but this only works if b > 0, is it common to use inclusive syntax x = y[a..-(b + 1)] to avoid this edge case or is there a neater way?
cagomez has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
netherwolfe has quit [Ping timeout: 264 seconds]
<weaksauce>
arand perhaps doing it that way is not quite the ruby way unless you have a really specific need
<weaksauce>
what are you doing that requires extracting the middle... maybe someone knows of a better method to do what you want?
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Dimik has quit []
clemens3 has quit [Ping timeout: 264 seconds]
<apeiros>
arand: huh? exclusive ranges work fine with negative end offset
<apeiros>
>> [1,2,3][1...-1]
<arand>
In a communications protocol I have a frame with a header, data field and a trailer, and I want to extract the data field.
* apeiros
pokes ruby[bot]
<havenwood>
#=> [2]
<apeiros>
>> [1,2,3][1..-1]
<apeiros>
# => [2, 3]
<havenwood>
#=> [2, 3]
<arand>
>> [1,2,3][1...-0]
jottr has joined #ruby
<apeiros>
arand: misunderstanding on your part
<havenwood>
#=> []
<apeiros>
-0 == 0
<havenwood>
#=> true
<apeiros>
if you read the docs, it tells you that if N is negative, it's interpreted as length+N
<apeiros>
and hence -1 is the last offset
<apeiros>
(since length-1 is the last offset)
bmurt has joined #ruby
<havenwood>
-0.negative? #=> false
<arand>
Yes, and if the offset is variable, exclusive syntax cannot be used if the variable could conceivably be 0.
<eam>
>> -0 == 0
<havenwood>
#=> true
<eam>
o is the thingy not running?
<apeiros>
arand: sounds like "I can't use this if I have a logic error in my code", and why, yes of course.
<havenwood>
eam: I'm trying to fill in. ;-P
<eam>
haha ty
<eam>
integers shouldn't have a negative zero, but floats should
<eam>
ints don't have a way to store it
* havenwood
pokes ruby[bot]
<eam>
which is why integers can store one more negative number than positive (not counting zero)
reber has quit [Remote host closed the connection]
karapetyan has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
jrm has quit [Quit: ciao]
ruby[bot] has joined #ruby
<apeiros>
eam: floats have
<apeiros>
>> -0.0.equal?(0.0)
<havenwood>
-0 #=> 0
<eam>
however ... in Ruby it looks like maybe -0.0 is equal to 0.0
<arand>
apeiros: My question is, is there a prettier way to write x = y[a..-(b + 1)] without the "+ 1"?
<apeiros>
arand: seems like you indeed have the case I said. you have size, not offset, so you should use slice!(offset, length), not slice!(0...offset)
<apeiros>
ah, though, second is the size of the suffix. could remove that instead of the middle.
jottr has quit [Ping timeout: 240 seconds]
nowhereman_ has quit [Ping timeout: 240 seconds]
<zenspider>
also remove line 6 and the assignment on line 5. no value
<zenspider>
I would also remove all slice! and other destructive/mutative methods
duckpuppy has joined #ruby
<arand>
Other than documentation no, does excess copies like that add cost in ruby?
<zenspider>
you're using ruby. you don't care about cost until you measure
edwardly has joined #ruby
edwardly has quit [Changing host]
edwardly has joined #ruby
n008f4g_ has quit [Ping timeout: 246 seconds]
<arand>
I do want to mutate @data though.
<zenspider>
I recommend you don't
<zenspider>
you can choose to ignore that advice... that's fine.
<zenspider>
I charge a LOT for my debugging services. ;)
roshanavand has quit [Quit: Leaving.]
roshanavand has joined #ruby
<arand>
@data is the buffer for the yet-unproccessed data.
yokel has quit [Remote host closed the connection]
duckpuppy has quit [Ping timeout: 264 seconds]
pastorin_ has quit [Remote host closed the connection]
<zenspider>
I'm not confused about what @data is.
yokel has joined #ruby
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jamiejackson2577 has quit [Ping timeout: 260 seconds]
<weaksauce>
another option is to use StringIO if you want a stream to do variable length reads from without having to do all that intermediate splicing.
<zenspider>
weaksauce: StringIO on a stream? or StringScanner?
<zenspider>
(I dunno... maybe you can use StringIO on a stream? no clue, but that could be cool)
jottr has joined #ruby
<weaksauce>
depends on what @data is actually i suppose
<arand>
I removed the second slice!, that was indeed pointless.
rfoust has joined #ruby
<zenspider>
half your returns can go. you need not pass anything to super unless you're changing the args, still not sure why you're insisting on using ranges instead of lengths
jottr has quit [Ping timeout: 240 seconds]
le0taku has quit [Ping timeout: 246 seconds]
<zenspider>
and to be clear: there's a semantic difference between super() and super
<zenspider>
arand: you seem stuck on that. not sure why
guacamole has joined #ruby
guacamole has joined #ruby
guacamole has quit [Changing host]
Guest27029 is now known as mrush
<arand>
I'm using ranges instead of lengths since that means I don't need to calculate the length.
alfiemax has joined #ruby
<zenspider>
*sigh* you ARE calculating the length.
<zenspider>
I think I'm done. I don't understand your pathology.
ccooke_ is now known as ccooke
memo1 has quit [Ping timeout: 246 seconds]
n0m4d1c has quit [Remote host closed the connection]
Psybur has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
n0m4d1c has joined #ruby
milardovich has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
n0m4d1c has quit [Read error: Connection reset by peer]
<arand>
I guess there's no point further explaining that then. I should definitely read up on 'super' since I have basically just cargo-culted its use from other similar protocols so far. I guess by removing returns you mean using just the naked variable, which I conceede is just a non-idiomatic-roby-beginner taste of mine.