adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 2.7.2, 2.6.6, 3.0.0-preview2: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.org | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | BLM <3
prion has quit [Ping timeout: 258 seconds]
JoshAshby has quit [Quit: WeeChat 2.9]
Intelo has quit [Quit: WeeChat 2.8]
Swyper has joined #ruby
ashby has joined #ruby
_aeris_ has quit [Ping timeout: 240 seconds]
teardown has quit [Ping timeout: 240 seconds]
iNs has quit [Ping timeout: 240 seconds]
bamdad has quit [Ping timeout: 240 seconds]
iNs has joined #ruby
bamdad has joined #ruby
_aeris_ has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
Swyper has quit [Remote host closed the connection]
teardown has joined #ruby
AndyC has quit [Remote host closed the connection]
AndyC has joined #ruby
drincruz_ has quit [Ping timeout: 240 seconds]
prion has joined #ruby
ur5us has joined #ruby
AndyC has quit [Ping timeout: 260 seconds]
teardown has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
teardown has joined #ruby
bkuhlmann has joined #ruby
icarus has quit [Ping timeout: 264 seconds]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
teardown has quit [Ping timeout: 240 seconds]
teardown_ has joined #ruby
kurko_ has quit [Quit: kurko_]
<adam12> desnudopenguino: Are the arguments for hash_secret wrong? Pretty sure it's secret,salt. https://rubydoc.info/gems/bcrypt/BCrypt/Engine#hash_secret-class_method
cloud69 has joined #ruby
<desnudopenguino> adam12: yeah, i got it figured out, the bcrypt dependency need updated initially, then i forgot to restart the rails server. all is well now.
Garb0 has joined #ruby
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
prion has quit [Ping timeout: 246 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
gix has quit [Ping timeout: 256 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
SeepingN has joined #ruby
baojg has quit [Remote host closed the connection]
factormystic has quit [Read error: Connection reset by peer]
baojg has joined #ruby
factormystic has joined #ruby
TCZ has quit [Remote host closed the connection]
TCZ has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
Swyper has joined #ruby
Swyper has quit [Read error: Connection reset by peer]
TCZ has quit [Quit: Diabe? ogonem nakry? e?]
TCZ has joined #ruby
orbyt_ has joined #ruby
Swyper has joined #ruby
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
sagax has quit [Ping timeout: 260 seconds]
postmodern has joined #ruby
SanguineAnomaly has quit [Ping timeout: 246 seconds]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kristian_on_linu has quit [Remote host closed the connection]
aremaref has quit [Ping timeout: 256 seconds]
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
bkuhlmann has quit []
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Garb0 has quit [Ping timeout: 258 seconds]
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #ruby
aremaref has joined #ruby
drincruz_ has joined #ruby
aremaref has quit [Ping timeout: 256 seconds]
ChmEarl has quit [Quit: Leaving]
k_sze has quit [Quit: ZNC 1.8.2 - https://znc.in]
k_sze has joined #ruby
orbyt_ has joined #ruby
MasterNayru has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
MasterNayru has joined #ruby
teardown has joined #ruby
elcuervo has joined #ruby
cuerbot has quit [Read error: Connection reset by peer]
teardown_ has quit [Ping timeout: 240 seconds]
swaggboi has quit [Ping timeout: 260 seconds]
swaggboi has joined #ruby
sphex has joined #ruby
rich_coldiron has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
<rich_coldiron> Hi there! I'm a returning hobbyist working through AoC 2020. Day 10 was tough! I, like others, first tried recursion, which, at O(2^n), would take... a long time. I googled around for a bit, and came across memoization to reduce complexity. I've never used it before, and ruby doesn't have built-in facilities for it, so I implemented it manually.
<rich_coldiron> Was hoping somebody would be so kind as to critique the heck out of my solution. https://github.com/coldiron/advent/blob/main/2020/10/advent_day_10b.rb
<rich_coldiron> the README in the same directory contains the problem description if you're unfamiliar
icarus has joined #ruby
<havenwood> rich_coldiron: Hi! Does the solution work? Looking to refactor?
<havenwood> rich_coldiron: You can `File.read(filename)` instead of manually opening and closing the file on lines 15 and 17.
<rich_coldiron> havenwood: It works! I'm just an "advanced novice", if you will, and I'm looking for constructive criticism - e.g., I did something that isn't "rubyish", or something like that
<rich_coldiron> oh cool, so it'll automatically close it for me? that's neat
<havenwood> rich_coldiron: A nice option in newer Rubies is to: File.read(filename, chomp: true).map(&:to_i)
<havenwood> rich_coldiron: Err
<havenwood> rich_coldiron: I meant #readlines
<havenwood> rich_coldiron: (Since you want lines)
<havenwood> but #read works too
<rich_coldiron> so #readlines lets me omit .split("\n") then, that's awesome. will change it. thank you!
<havenwood> rich_coldiron: File.readlines(filename, chomp: true)
<rich_coldiron> Great, thanks. so chomp strips the newlines? that's fantastic.
<havenwood> rich_coldiron: Yup!
<havenwood> rich_coldiron: I'd omit line 26. The assignment on line 25 already returns the value.
<havenwood> rich_coldiron: In general, avoid explicit returns unless it's an early return.
<havenwood> rich_coldiron: oh, sorry, i'm tired
<havenwood> rich_coldiron: it *is* an early return
<rich_coldiron> I did that but it doesn't like assigning to nil until it's defined
<rich_coldiron> yaya!
<havenwood> rich_coldiron: I'm tempted on line 39 to say use #fetch
<rich_coldiron> just googled that, that's cool, so I could pass the code from else as a block directly to fetch rather than having the conditional at all
<havenwood> rich_coldiron: yeah, maybe like: paths += @memo.fetch(joltage) do ...
<rich_coldiron> sweet. i'll play aroudn with that. thanks so much for the help!
<havenwood> rich_coldiron: Not sure that one works, since line 41.
<havenwood> rich_coldiron: No prob, any time!
essem has joined #ruby
donofrio_ has quit [Remote host closed the connection]
al2o3-cr has quit [Ping timeout: 256 seconds]
drincruz_ has quit [Ping timeout: 256 seconds]
al2o3-cr has joined #ruby
panorain has joined #ruby
Swyper has quit [Remote host closed the connection]
aremaref has joined #ruby
aremaref has quit [Ping timeout: 256 seconds]
plujon has quit [Remote host closed the connection]
aremaref has joined #ruby
sagax has joined #ruby
rich_coldiron has quit [Remote host closed the connection]
raj has quit [Quit: No Ping reply in 180 seconds.]
hays has quit [Remote host closed the connection]
tweaks has quit [Ping timeout: 260 seconds]
Nightmare has quit [Ping timeout: 246 seconds]
jtperreault has quit [Ping timeout: 260 seconds]
aremaref has quit [Ping timeout: 260 seconds]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
raj has joined #ruby
s_ has joined #ruby
icarus has quit [Ping timeout: 256 seconds]
tweaks has joined #ruby
icarus has joined #ruby
jtperreault has joined #ruby
Nightmare has joined #ruby
_whitelogger has joined #ruby
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
blackmesa has joined #ruby
blackmesa1 has joined #ruby
blackmesa has quit [Ping timeout: 272 seconds]
_whitelogger has joined #ruby
cd has quit [Quit: cd]
al2o3-cr has quit [Ping timeout: 256 seconds]
aremaref has joined #ruby
aremaref has quit [Ping timeout: 272 seconds]
aremaref has joined #ruby
prion has joined #ruby
ua has quit [Ping timeout: 240 seconds]
aremaref has quit [Ping timeout: 240 seconds]
akem__ has joined #ruby
ua has joined #ruby
icarus has quit [Ping timeout: 256 seconds]
akem_ has quit [Ping timeout: 272 seconds]
postmodern has quit [Quit: Leaving]
tempate has joined #ruby
<tempate> Hello. Is there a better way of writing https://dpaste.org/rUnZ ? I tried recursion but it didn't seem to be much better.
SanguineAnomaly has joined #ruby
<tempate> Stupid question; I didn't realize there was a count function. I ended up going with seats.flatten.count(state)
weaksauce has quit [Ping timeout: 264 seconds]
teclator has quit [Ping timeout: 256 seconds]
teclator has joined #ruby
lightstalker has quit [Ping timeout: 240 seconds]
canton7 has quit [Quit: ZNC - http://znc.in]
canton7 has joined #ruby
lightstalker has joined #ruby
blackmesa1 has quit [Ping timeout: 246 seconds]
prion has quit [Ping timeout: 256 seconds]
olspookishmagus has quit [Quit: All for nothing]
ta has quit [Quit: WeeChat 2.9]
ta has joined #ruby
aremaref has joined #ruby
aremaref has quit [Ping timeout: 258 seconds]
essem has quit [Ping timeout: 260 seconds]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
aremaref has joined #ruby
aremaref has quit [Ping timeout: 265 seconds]
blackmesa1 has joined #ruby
blackmesa1 has quit [Ping timeout: 260 seconds]
al2o3-cr has joined #ruby
cloud69 has quit [Quit: Connection closed for inactivity]
hiroaki has quit [Ping timeout: 246 seconds]
tempate has left #ruby [#ruby]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
hiroaki has joined #ruby
braincrash has joined #ruby
akem__ is now known as SubZero
SubZero is now known as Subzyro
<Subzyro> Hey, what's a good method to write 1 bit at a specific offset into a binary file?
<Subzyro> For a large file like 30 GB, i can't load it ofc.
<Subzyro> Ok i found online.
lucidreamachine has joined #ruby
SegFaultAX has quit [Ping timeout: 260 seconds]
G has quit [Ping timeout: 260 seconds]
prion has joined #ruby
blackmesa1 has joined #ruby
TomyWork has joined #ruby
lucidreamachine_ has joined #ruby
lucidreamachine has quit [Read error: Connection reset by peer]
SegFaultAX has joined #ruby
G has joined #ruby
blackmesa1 has quit [Ping timeout: 264 seconds]
cloud69 has joined #ruby
blackmesa1 has joined #ruby
greengriminal has joined #ruby
prion has quit [Quit: WeeChat 2.8]
blackmesa1 has quit [Ping timeout: 260 seconds]
blackmesa1 has joined #ruby
tempate has joined #ruby
<tempate> Hello. I'm trying to replace the latter method with the former but, for reasons unknown, it's not working
<tempate> This is the relevant code: https://dpaste.org/0in0/slim
cgfbee has joined #ruby
<tempate> Oh, I think I know why it's happening
iNs has quit [Ping timeout: 240 seconds]
iNs has joined #ruby
<tempate> This (https://dpaste.org/Ko50) is one step closer
<tempate> I don't seem to be able to access y from the second map though
aremaref has joined #ruby
aremaref has quit [Ping timeout: 240 seconds]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
Subzyro is now known as akem
_aeris_ has quit [Remote host closed the connection]
iNs has quit [Read error: Connection reset by peer]
iNs_ has joined #ruby
_aeris has joined #ruby
ruurd has quit [Ping timeout: 240 seconds]
_aeris is now known as _aeris_
Garb0 has joined #ruby
Garb0 has quit [Max SendQ exceeded]
rhe has joined #ruby
blackmesa1 has quit [Ping timeout: 246 seconds]
<tempate> And... https://dpaste.org/Ko8y/slim now I'm getting: undefined local variable or method `​' for main:Object (NameError); which makes no sense to me
lucidreamachine_ has quit [Ping timeout: 258 seconds]
blackmesa1 has joined #ruby
ruurd has joined #ruby
aremaref has joined #ruby
<tempate> Any help is more than welcome, of course
aremaref has quit [Ping timeout: 256 seconds]
akem has quit [Quit: Leaving]
<nakilon> wanna know a thing you didn't know?
<nakilon> &>> "a\n\nb".split("\n")
<nakilon> >> "a\n\nb".split("\n")
<ruby[bot]> nakilon: I'm terribly sorry, I could not evaluate your code because of an error: JSON::ParserError:784: unexpected token at '<!DOCTYPE html>
<ruby[bot]> <html>
<ruby[bot]> <head>
<ruby[bot]> <title>503 - Service Unavailable</title>
<ruby[bot]> <meta charset="utf-8" />
<ruby[bot]> <style type="text/css">
<ruby[bot]> body {
<ruby[bot]> background: #f1f1f1
<nakilon> LMAO
<ruby[bot]> }
<ruby[bot]> #content {
<ruby[bot]> max-width: 860px;
<ruby[bot]> margin: auto;
<ruby[bot]> font-size: 2em;
<ruby[bot]> font-family: sans-serif;
<ruby[bot]> text-align: center;
<ruby[bot]> }
<ruby[bot]> #message {
<ruby[bot]> line-height: 1.4em;
<ruby[bot]> }
<ruby[bot]> #icon {
<ruby[bot]> margin-top: 1em;
<ruby[bot]> }
<ruby[bot]> #icon > svg {
<ruby[bot]> width: 5em;
<ruby[bot]> height: 100%;
<ruby[bot]> }
<ruby[bot]> font-size: 10em;
<ruby[bot]> #cookie {
<nakilon> ok, even I didn't know this
<ruby[bot]> opacity: 0.5;
<ruby[bot]> text-align: center;
<ruby[bot]> vertical-align: middle;
<ruby[bot]> }
<ruby[bot]> @media (max-width: 360px) {
<ruby[bot]> font-size: 80vw;
<ruby[bot]> #cookie {
<ruby[bot]> }
<ruby[bot]> }
<ruby[bot]> #contact {
<ruby[bot]> font-size: 0.8em;
<ruby[bot]> color: #626262;
<ruby[bot]> text-align: center;
<ruby[bot]> padding-bottom: 2em;
<ruby[bot]> padding-top: 3em;
<ruby[bot]> }
<ruby[bot]> #contact a, #contact a:visited {
<ruby[bot]> color: ##0700C7;
<ruby[bot]> text-decoration: none;
<ruby[bot]> }
<ruby[bot]> #contact a:hover, #contact a:focus {
<ruby[bot]> text-decoration: underline;
<ruby[bot]> }
<ruby[bot]> </style>
<ruby[bot]> </head>
<ruby[bot]> <div id="content">
<ruby[bot]> <body>
<ruby[bot]> <div id="icon">
<ruby[bot]> <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 640 640"><path d="M320-.012c176.707 0 320 143.305 320 320C640 496.695 4
<ruby[bot]> 96.707 640 320 640 143.305 640 0 496.695 0 319.988c0-176.695 143.305-320 320-320zM196.042 467.332c-9.602.414-17.717-7.04-18.13-16.642-.413-9.59 7.028-17.717 16.63-18.13l.224-.012c11.34-.508 51.78-.342 97.36-.153 60.615.248 130.49.531 151.573-.744 9.602-.567 17.835 6.768 18.402 16.358.567 9.603-6.756
<ruby[bot]> 17.847-16.359 18.402-21.213 1.287-92.186 1.004-153.746.744-44.788-.177-84.52-.342-95.73.165l-.224.012zM130.655 231.9c-5.161-6.33-4.193-15.65 2.138-20.8 6.331-5.149 15.65-4.192 20.8 2.15 1.264 1.56 2.905 3.154 4.842 4.737 9.437 7.724 23.847 12.897 39.083 13.7 15.036.792 30.568-2.716 42.367-12.318 2.
<ruby[bot]> 433-1.985 4.796-4.335 7.051-7.087 5.186-6.343 14.528-7.276 20.859-2.09 6.33 5.184 7.264 14.527 2.079 20.858-3.39 4.146-7.193 7.89-11.339 11.256-18.012 14.658-40.831 20.079-62.528 18.933-21.508-1.146-42.284-8.8-56.34-20.303a62.663 62.663 0 0 1-9.011-9.036zm237.464 1.654c-6.059-7.453-4.925-18.414 2.52
<ruby[bot]> 8-24.473 7.453-6.06 18.402-4.937 24.46 2.516 1.147 1.405 2.658 2.87 4.477 4.37 9.036 7.394 22.879 12.33 37.56 13.11 14.457.768 29.339-2.586 40.583-11.728 2.291-1.866 4.524-4.099 6.685-6.733 6.095-7.44 17.08-8.539 24.532-2.444 7.453 6.094 8.551 17.079 2.457 24.531-3.496 4.264-7.43 8.138-11.717 11.634
<ruby[bot]> -18.567 15.095-42.024 20.682-64.312 19.5-22.063-1.157-43.406-9.035-57.863-20.882a66.029 66.029 0 0 1-9.39-9.401z"/></svg>
<ruby[bot]> </div>
<ruby[bot]> <div id="info">
<ruby[bot]> <h1>503</h1>
<ruby[bot]> </div>
<ruby[bot]> <p id="message">Something is missing on our end, please check back later. Take a cookie while you wait:</p>
<ruby[bot]> <div id="cookie">🍪</div>
<surrounder> ...
<ruby[bot]> </div>
<ruby[bot]> <div id="contact">
<ruby[bot]> This page won't go away? Need help? Write a <a href="mailto:me@jhass.eu">Mail</a>!
<ruby[bot]> </div>
<ruby[bot]> </body>
<ruby[bot]> </html>'
<al2o3-cr> damn!
<nakilon> jhass
<jhass> oh, ups
cybcypha has joined #ruby
<nakilon> at least it automatically highlighted you actully, lol
<jhass> better not call the bot right now :D
ruby[bot] has quit [Remote host closed the connection]
Garb0 has joined #ruby
ruby[bot] has joined #ruby
Garb0 has quit [Remote host closed the connection]
olspookishmagus has joined #ruby
<jhass> with some luck it'll only show the first line now until I manage to fix the service
cybcypha has quit [Ping timeout: 256 seconds]
blackmesa1 has quit [Ping timeout: 264 seconds]
Rudd0 has quit [Ping timeout: 256 seconds]
<rapha> sooo
<rapha> oh, wait
<rapha> what did i stumble into here? the bot is doing funny things...
<rapha> okay, actual question...
<rapha> if you have a character and what to know its unicode codepoint, you can use .encode
<rapha> but what if you want to visually see that same character in a different encoding?
TomyWork has quit [Remote host closed the connection]
TomyWork has joined #ruby
<jhass> there should be no point as the encoding only defines the semantics of the character, a font then maps that semantic meaning to the glyph
<rapha> hmm
<jhass> put what you would do is just print the properly encoded string to a output configured to render things in the right encoding
<jhass> so a html page with the right encoding tag (or http header), a terminal configured to use that particular encoding etc
<rapha> jhass: i have a character here, ỗ (bytes: [225, 187, 151]) that i know used to be, once upon a time, a ḍ ... but how it became what it is now, i have no idea.
<rapha> (i only know what it used to be because i happen to understand the word from its context)
* rapha thought this would be as simple as to apply .force_encoding or so
<jhass> mmh, my first hunch would be that it's stored as UTF-8 but interpreted as UTF-32, or something in that direction
<jhass> nvm the encodings, but basically the string was interpreted under a different encoding than what it was stored
<rapha> so you have to read the bytes, apply some offset, then try again, no?
<jhass> what I tend to do to figure that out is to loop through all encodings, Encoding.list, then for each puts .force_encoding(encoding).encode("UTF-8")
<jhass> and see for which one it looks right, if any
<rapha> aaaah you combine the two
<jhass> force_encoding changes the encoding of the string without touching the data, encode then maps the data from one encoding to another, using UTF-8 here so it looks alright in my terminal which expects UTF-8
<rapha> makes sense
<rapha> perhaps i should not try to do this with the character after it's already been extracted from a .docx file by a ruby library
<rapha> but copy-paste it out of word myself
<jhass> heh :D
<jhass> >> "a\n\nb".split("\n")
<ruby[bot]> jhass: # => ["a", "", "b"] (https://carc.in/#/r/a3iu)
<rapha> huh? is that related?
<jhass> nakilon: ^ sorry about earlier, upgraded the machine and that broke stuff in a very subtle manner
<rapha> ah, no, you were testing the bot :)
<jhass> yeah, sorry :)
<rapha> all good, t'was also funny somehow :)
jl4 has joined #ruby
maryo has joined #ruby
* jl4 Ruby newbie...
<jhass> welcome!
<jl4> i'm working on a (planned for) 2021 Jekyll (Ruby) project ...does it makes sense to start with underlying Ruby 3 or better to stick to current 2.7 stable version ?
<tempate> Hello. I'm trying to get https://dpaste.org/Ko8y/slim to work but I can't manage to do it. I'm getting: `apply_rules': undefined local variable or method `​' for main:Object (NameError). Can someone please help me out?
* jl4 notices 2.7 v was released in october ...
<jl4> Any hint is more than welcomed... ^^
<jl4> thanks jhass , btw
<jhass> jl4: usually the ruby ecosystem is pretty fast with adopting a new ruby version. But Ruby 3 features some breaking changes so it might take a little longer this time. So I would recommend you start out with 2.6 or 2.7 now (2.6 in case you get too much deprecation noise in 2.7). For a jekyll site it should be very easy to upgrade to ruby 3 once the ecosystem fully supports it
<jl4> nice to know, jhass
<jhass> >> "​".codepoints # tempate you got some weird whitespace in your source code, that's a U+200B, ZERO WIDTH SPACE
<ruby[bot]> jhass: # => (https://carc.in/#/r/a3ix)
<tempate> oh, I do?
<tempate> Hmmm
<jhass> eh, that didn't quite work out like I wanted to :D
maryo has quit [Quit: Leaving]
<jhass> vim's great at displaying this stuff for clean up :)
lucidreamachine has joined #ruby
<tempate> Marvelous
<tempate> Thank you very much
<tempate> It was driving me nuts
<tempate> I'm not sure of how efficient this is, tho
<tempate> Sorting both lists doesn't seem like a great way
<tempate> This is a more complete version: https://dpaste.org/46nG; if you can think of a more Rubic way to do it (or a better way) don't hesitate to let me know.
<tempate> eh... https://dpaste.org/46nG
<jhass> so that's just checking if all items in seats are in new_seats now?
<jhass> maybe .size == .size is enough?
<tempate> Kind of. It's creating a new list of seats based on the previous one and checking if they're the same, to avoid looping through them forever
<tempate> The problem is that all seat arrays are always going to have the same size
<jhass> are the items uniq?
<jhass> (within each list)
<tempate> They are not. The array seats is actually a two dimensional array in which every cell is one of three characters.
<rapha> jhass: found another example> "qira’at" ... again one i can understand from context; it should be "qiraʾat" (but people tend to use ` or ' instead of ʾ). seems the text is full of these. so the way it became to be like that was probably that at some point it was saved by a program that had the wrong encoding, right?
<jhass> rapha: yes, most likely
<jhass> if it's mixed wrong and mixed right, there's little chance of recovery. But especially if you suspect a mixup between unicode encodings (UTF-8, -16, -32), do check if it's not all wrong and only some stuff looks right because it's the same byte sequence in more than one of these encodings (especially likely with stuff that's in the first two planes, so in UTF-8 encoded as one or two bytes)
<rapha> jhass: so it's possible information got destroyed along the way. might it be a more sensible approach, therefore, to simply make a search-and-replace-table instead of trying to mangle them back into the correct bytes?
<jhass> hard to judge without knowing how exactly they're messed up and how much work that lookup table would be
<rapha> jhass: unlikely that it's all wrong. i have 13718829 characters in total (non-unique) and only 34 that don't fit into either the Latin, Arabic, Greek, Hebrew, or Punctuation regex groups.
<jhass> tempate: but each sub-array combination is uniq? so you got [['a', 'b' ‘c'], ['b', 'c', a']] but never [['a', 'b', 'c'],['a','b','c']]?
<jhass> rapha: well, those groups do depend on the encoding too!
<jhass> the regex engine operates on bytes, that's why regular expressions have an encoding attribute too
<rapha> jhass: but wherever i look i can read everything (at least the Latin, Arabic and Greek parts, know too little Hebrew) and it makes sense. so stands to reason it's largel correct, right?
<rapha> largely*
<jhass> so the byte sequence might for example be a valid unicode codepoint in one other UTF variant than your regex
<tempate> jhass: I'm afraid that could happen
<jhass> tempate: okay, then I don't really have an improvement :)
<tempate> and... can I maybe pass a variable by reference and change it in apply_rules_to_seat?
<tempate> To detect when there's been a change
<jhass> Ruby is entirely pass by reference, to pass a copy you would need to call .clone or .dup explicitly
<jhass> but what you're thinking of is passing a pointer to a local variable, like it's common in C APIs for in/out parameters
<jhass> you could achieve this with a small class that holds the value, but it's much much more common and idiomatic to instead return multiple values as an array like you do now
<jhass> alternatively you could wrap the whole algorithm in a small short lived class that then just keeps state common to it as instance variables
<tempate> But then... changed should be changing here, no? https://dpaste.org/ghps
<jhass> no, you need to differentiate between value and the variable its assigned to
<jhass> parameter passing always creates a new local variable, a new reference, to the same value
<tempate> Hmmm
<tempate> So how could I achieve something like it?
<tempate> Alas, I'm afraid I have to leave
<tempate> Thanks for everything
<jhass> like I wrote above, by creating a value that can change its state, or better, by moving the entire algorithm into a short-lived class so you can share state using instance variables
<jhass> you're welcome :)
<nakilon> jhass linux upgrade? ..D
<nakilon> so the thing is
<nakilon> >> "a\n\nb".split("\n")
<ruby[bot]> nakilon: # => ["a", "", "b"] (https://carc.in/#/r/a3iz)
<nakilon> >> "a b".split("\n")
<ruby[bot]> nakilon: # => ["a b"] (https://carc.in/#/r/a3j0)
<nakilon> >> "a b".split(" ")
<ruby[bot]> nakilon: # => ["a", "b"] (https://carc.in/#/r/a3j1)
<nakilon> I mean this
<nakilon> double "\n" splits twice, double " " splits once
aremaref has joined #ruby
<al2o3-cr> &>> "a\n\nb".split /\n+/
<rubydoc__> # => ["a", "b"] (https://carc.in/#/r/a3j2)
<al2o3-cr> split also takes a regexp
<nakilon> I'm not solving it, I show the inconsistence )
<nakilon> it does not reen regex when splitting by space symbol
<nakilon> *does not need
<al2o3-cr> &>> "a b".split /\P{Space}/
<rubydoc__> # => ["", " "] (https://carc.in/#/r/a3j3)
<al2o3-cr> If pattern is a String, then its contents are used as
<al2o3-cr> the delimiter when splitting str. If pattern is a single
<al2o3-cr> space, str is split on whitespace, with leading and trailing
<al2o3-cr> whitespace and runs of contiguous whitespace characters ignored.
<al2o3-cr> Y
aremaref has quit [Ping timeout: 246 seconds]
<nakilon> yeah I now see it in docs
<al2o3-cr> nakilon: it's consistent according to the docs
<nakilon> it's a special case
<jhass> nakilon: yeah, I think it's systemd but then downgrading it didn't help, only restoring the backup did :/ https://p.jhass.eu/9f.txt
<nakilon> al2o3-cr I would say it's a documented inconsistency ..D
<jhass> doesn
<jhass> doesn't help I'm using dead software for this >.>
<nakilon> there is an old centos on my server -- I try not to even breath on it
<al2o3-cr> nakilon: centos dead now?
<jhass> nakilon: this is running archlinux :D
<jhass> I never understood the idea of CentOS
<al2o3-cr> jhass: what kernel version?
<nakilon> every time I update nginx config I have to run two commands about selinux that are "documented" only by two random messages on github when people somehow have figured out they help
<jhass> I get RHEL because it's something you can buy
<jhass> oh yeah, selinux fun...
<nakilon> it's about adding a file to some whitelist and after you edit it you should rerun the whitelist and the more files you add the more log it prints ..D
<al2o3-cr> nakilon: as your colon fell over?
<jhass> al2o3-cr: 5.7.4 known working vs 5.9.13 known broken, but then I feel it's rather systemd or glibc or some of the libnss hell
<al2o3-cr> ah, in essence still a new kernel
<jhass> guess I'll have to upgrade package by package and see where it breaks
<jhass> looking at the source it's getpwnam(3) that starts to fail
braincrash has quit [Read error: Connection reset by peer]
<nakilon> jhass, idk, it was a random choice; as for today all I know is that RHEL was also an accepted choice for new server in a bank where I worked
dittonedo has joined #ruby
<nakilon> I guess it's about codereview of something
<jhass> haha, bank IT is basically a template of what to not do for personal or agile stuff :P
<jhass> it's about checklists, "yes we have support contract, yes we have someone liable in case of X"
<nakilon> it's hard to tell for sure; old technologies are old but when it's a talk about linux they tend to ask hipsters too
aremaref has joined #ruby
<nakilon> in my team they were keeping source code in Excel instead of Git, and running it on a machine with few hundreds cores and terabytes of ram
<nakilon> absolutely another world
braincrash has joined #ruby
<jhass> was it in excel because the app was written in excel macros?
<nakilon> no, the app is written in the language from 1950s and runs on some UFO architecture
<jhass> I see
<jhass> sounds pretty standard banking stuff
<jhass> from what I've heard anyway, I stay away from banking and insurance :P
<nakilon> the leading architect didn't really know even the difference between terms that mean OS, architecture, brand
<nakilon> I had a trouble when I said: "hey, Wikipedia says..."
<jhass> you know those concepts only really started to exist late 60s and took another decade or two to become ubiquitos
aremaref has quit [Ping timeout: 265 seconds]
dittonedo has quit [Remote host closed the connection]
blackmesa1 has joined #ruby
dittonedo has joined #ruby
<nakilon> suddenly I see the "SGML-style" mentioned in Funge-98 specification that tells to work with space character in such way like it's one char even if it's a sequence of them
<nakilon> I still don't know what this term is
SeepingN has joined #ruby
ropeney has quit [Quit: ZNC 1.7.4 - https://znc.in]
jl4 has left #ruby [#ruby]
icarus has joined #ruby
blackmesa1 has quit [Quit: WeeChat 3.0]
ropeney has joined #ruby
stryek has joined #ruby
TCZ has joined #ruby
dittonedo has quit [Remote host closed the connection]
prion has joined #ruby
<prion> hi
<prion> how can i get pry to show documentation for methods
<al2o3-cr> o/
<prion> like puts
<prion> show-doc puts doesn't work
<al2o3-cr> prion: have you install pry-doc?
lucidreamachine has quit [Ping timeout: 264 seconds]
<prion> hmm
<prion> is it normal to run gem install as root
<al2o3-cr> no
<prion> it fails when i don't
<prion> also does puts only add a newline when the string you pass it doesn't already end in one?
<nakilon> macOS? use brew install rbenv
<al2o3-cr> prion: it prepends a newline, yes.
<al2o3-cr> *appends
<prion> it doesn't append a newline if i write puts "Hello\n" though
<nakilon> or do export GEM_HOME=~/.gems or something
<prion> i'm on Ubuntu, im guesing i can get rbenv from the repositories
<prion> oh i already have it apparently
<al2o3-cr> prion: try `? puts`
<nakilon> do "rbenv versions" -- you'll see if you use default ruby or rbenv's
<prion> i only have system ruby installed
<nakilon> maybe default one wants sudo -- just do "rbenv install <some custom version>" and it will store everything in ~/.rbenv and will never ask for root
<prion> 2.4.1 is the latest?
<prion> or is my rbenv outdated
<nakilon> default ruby is kind of needed only if it's a container linux or for install scripts, not something complex that needs gems
<al2o3-cr> prion: what does `gem env` say
<nakilon> depends on who you ask )
<al2o3-cr> :)
<prion> gem env says i have ruby 2.7.0 but rbenv install -l only goes up to 2.4.1
<nakilon> I use 2.3.8 by default, some love to use modern version to have modern issues
<nakilon> rbenv install --list-all
<al2o3-cr> it's probably a PATH issue.
<prion> also GEM PATHS contains a user-specific one
wnd has quit [Quit: Disconnecting from stoned server.]
<prion> ~/.gem/ruby/2.7.0
<nakilon> I won't override GEM_PATH and similar variables if you discovered you already have rbenv
<prion> how old is 2.4.1
lucidreamachine has joined #ruby
<nakilon> when you do "rbenv versions" and it says you have system ruby, which version is that?
<nakilon> Wikipedia knows how old it is; it's +0.1 per year
<prion> nakilon: 2.7.0
blackmesa has joined #ruby
<prion> why Ubuntu would package 2.7.0 but only have rbenv go up to 2.4.1 idk
<prion> that seems weird
<nakilon> "rbenv install -l" shows only versions installed in rbenv I guess, not the system one
<nakilon> 2.4.1 is what you have installed using rbenv, do the "rbenv install --list-all" to list all versions available
<prion> yeah but why wouldn't debian/ubuntu include a newer version of ruby-build
<prion> yeah when i list all available it stops at 2.4.1 then it's all like jruby, rbx, etc.
<prion> well there's 2.5.0-dev
<nakilon> yeah, weird, try to reinstall rbenv according to their github readme
<nakilon> or ruby-build, whatever
ChmEarl has joined #ruby
<prion> ok here we go
<prion> thank you
al2o3-cr has quit [Quit: WeeChat 2.9]
aremaref has joined #ruby
Rudd0 has joined #ruby
aremaref has quit [Ping timeout: 260 seconds]
elcuervo has quit [Read error: Connection reset by peer]
prion has quit [Ping timeout: 246 seconds]
elcuervo has joined #ruby
prion has joined #ruby
prion has quit [Client Quit]
akem has joined #ruby
maryo has joined #ruby
impermanence has quit [Quit: Connection closed]
<jhass> nakilon: for future reference, the lowest friction solution to "I can't install gems as root" is echo "gem: --user-install" > ~/.gemrc
bvdw has quit [Quit: The Lounge - https://thelounge.chat]
bvdw has joined #ruby
cliluw has quit [Ping timeout: 265 seconds]
maryo has quit [Ping timeout: 265 seconds]
hiroaki has quit [Ping timeout: 256 seconds]
ur5us has joined #ruby
FastJack has quit [Ping timeout: 272 seconds]
FastJack has joined #ruby
aremaref has joined #ruby
<nakilon> jhass cool, didn't know that; also it may cause a problem: https://stackoverflow.com/q/55074420/322020
drincruz_ has joined #ruby
<jhass> well yeah, it doesn't play well with version managers that rely on GEM_HOME
<jhass> but I think that's obsolete these days, bundle --path does that job better
<panorain> Why can "Ruby just not dump/Ubuntu"?
lmc has joined #ruby
somazero has joined #ruby
somazero has quit [Quit: Leaving]
greengriminal has quit [Quit: Leaving]
<havenwood> panorain: I don't follow. Ruby dump Ubuntu?
<havenwood> Ah, you mean convo about --user-install on Ubuntu? Yeah, Debian and downstream packaging for Ruby hasn't been super smooth riding.
lucidreamachine has quit [Ping timeout: 264 seconds]
<panorain> I aspologize.
<panorain> Mainly I uh worked for the "rails".
ZeiP has joined #ruby
<ZeiP> Hi. I have a Ruby software that has for a while now used the Ruby Dockerhub image as a basis for the application image (as well as CI tests). Recently it's started to fail because it fails to compile libv8. Does anyone have any suggestions why that is?
<ZeiP> I tried specifying older versions of the image in my CI pipeline, and that fixed the images using ruby:2.7.1, but the ones using 2.5.8 and 2.6.6 still don't work: https://github.com/TracksApp/tracks/pull/2528/checks?check_run_id=1538693389
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has joined #ruby
phaul has quit [Ping timeout: 256 seconds]
rubydoc__ has quit [Ping timeout: 256 seconds]
phaul has joined #ruby
rubydoc__ has joined #ruby
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
<panorain> I am sorry.
braincrash has quit [Ping timeout: 260 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<panorain> I am a lightweight with (idiots - Who - Pretend - light - with MSPD or become ALIVE with KGB AND ACCORDANCE TO FSB.
<panorain> I have the documents
impermanence has joined #ruby
adu has joined #ruby
<nakilon> weird, somehow I came up with wrong link; correct one is https://ruby-doc.org/core-2.7.2/Rational.html
<nakilon> maybe Rational have moved from stdlib to core
biggtimber has left #ruby ["https://quassel-irc.org - Chat comfortably. Anywhere."]
<nakilon> old docs just had no description of the #coerce method and new docs don't have this method at all, lol, okay then
cloud69 has quit [Quit: Connection closed for inactivity]
<havenwood> nakilon: Was it ever stdlib?
<havenwood> nakilon: I've always thought of Rational as core. (No require has ever been needed.)
<havenwood> So few non-gemified stdlibs left :) https://stdgems.org/libraries/
<havenwood> nakilon: RubyDoc is a third party thing for docs that sometimes gets it wrong.
<havenwood> I wish I could tell Google to point to the official docs.ruby-lang.org docs rather than ruby-doc.org...
<nakilon> how do you know it got it wrong if ruby-lang.org docs don't go beyond 2.0? )
<havenwood> nakilon: Because we pretend there was no pre-2.0.
<nakilon> they are the same basically
<nakilon> pretending is bad
<havenwood> nakilon: I just saw you were linking 1.8. I wasn't thinking ancient Ruby. Anything before currently supported Rubies doesn't need documentation, since it's not being used. Right? Right?!?
* havenwood glares at CentOS
<nakilon> what's wrong with centos? ..D
<nakilon> old versions should not be abandoned blindly -- there is still no fxri replacement
<havenwood> nakilon: CentOS 7: ruby --version #>> ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
<nakilon> and my bug of Ruby 2.4 is still not fixed
<havenwood> 2015 is so long ago it has been buried by the sands of times.
<nakilon> don't bury things you have no replacement for
wnd has joined #ruby
<havenwood> I was actually glad to see RedHat just recently changed the CentOS release cycle to be in cycle with RHEE rather than behind it.
<havenwood> Fedora ftw.
<adam12> Perfect timing for the hundreds of machines I re-imaged from CentOS 6 to CentOS 8 :\
<havenwood> :O
<havenwood> I meant RHEL not RHEE, haha
<havenwood> RedHat Enterprise EEeeeeeee
<nakilon> no problem, RHEE made me think you know some cool stuff I didn't even hear about
<adam12> Yo dawg, I heard you like Enterprise. So you've got Enterprise in your Enterprise.
<panorain> Gnome 3 is really poor on output via "gnome Tweaks". Biopnic Beaver is not as nice as the real : openSuse
lightstalker has quit [Ping timeout: 260 seconds]
<panorain> being able. mI want to program rpm and I have no frontlist.
<nakilon> when I worked in bank our vendors gave us software for RHEL 8 while it was too new even according to the RHEL timeline in wikipedia article, and our cloud had only RHEL 7
<nakilon> I told them it's no way and vendors should try make it work on RHEL 7 (IIRC it was something about tomcat) but our cloud platform lead said "there is no problem, we have docker! docker is magic!"
<nakilon> I gave him a bunch of links explaining that even if the app runs it will fail if it tries to call RHEL 8 system call but he pretended that he has read that and there is no problem; I guess he just can't read English, lol
<nakilon> sometimes it's easier to live in the world that is smaller and lacks information and knowledge about possible issues
lightstalker has joined #ruby
dionysus69 has joined #ruby
adu has quit [Quit: adu]
hramrach has joined #ruby
cd has joined #ruby
<hramrach> hello, is there some way to iterate two files line by line?
<hramrach> like comapare each line of two files
<hramrach> there is each_line but it itreates only one file and you cannot access the lines of the other file while iterating the first file
<nakilon> something like f1.each_line.zip(f2.each_line) do |line1, line2|
<apotheon> Yeah, that's probably about as close to the canonical answer as you're likely to get.
hiroaki has joined #ruby
TomyWork has quit [Remote host closed the connection]
cliluw has joined #ruby
<adam12> Alternatively, get a handle for both files, and in a loop, retrieve each line from `handle.each_line.next`. Need to handle EOF yourself tho.
impermanence has quit [Quit: Connection closed]
drincruz_ has quit [Ping timeout: 240 seconds]
<apotheon> That seems like more work for no additional benefit except in edge cases.
BTRE has quit [Remote host closed the connection]
<hramrach> I suppose you could do f1.each_line{|line1| line2=f2.each_line.next ... }, too
<hramrach> the solution with zip looks better, though
<hramrach> thanks
<hramrach> and yes, this is for a case when I expect that the files have same number of lines and if they do not that's an error
jinie has quit [Quit: ZNC 1.8.2 - https://znc.in]
<adam12> Will `zip` not load the contents of both files into memory? I guess that would be my concern.
jinie has joined #ruby
<adam12> Maybe you could use lazy here with zip.
somazero has joined #ruby
jinie has quit [Quit: ZNC 1.8.2 - https://znc.in]
jinie has joined #ruby
cliluw has quit [Ping timeout: 260 seconds]
blackmesa has quit [Ping timeout: 265 seconds]
<hramrach> it is not my concern in this particular case
bambanx has joined #ruby
cliluw has joined #ruby
<hramrach> but there is no reason for zip to do it, either
lightstalker has quit [Ping timeout: 258 seconds]
akem has quit [Ping timeout: 264 seconds]
<nakilon> zip is lazy
jcalla has quit [Ping timeout: 264 seconds]
<bambanx> any good solution for easy fast optimize images on windows, for prepair to web ? thanks
<nakilon> I mean I guess it's lazy in block form
akem has joined #ruby
akem has quit [Max SendQ exceeded]
blackmesa has joined #ruby
akem has joined #ruby
akem has quit [Remote host closed the connection]
akem has joined #ruby
blackmesa has quit [Ping timeout: 272 seconds]
blackmesa has joined #ruby
jcalla has joined #ruby
jcalla has quit [Ping timeout: 240 seconds]
zapata has joined #ruby
Garb0 has joined #ruby
Garb0 has quit [Max SendQ exceeded]
jcalla has joined #ruby
ur5us has quit [Ping timeout: 264 seconds]
cliluw has quit [Ping timeout: 240 seconds]
lightstalker has joined #ruby
bambanx has quit [Quit: Leaving]
jcalla has quit [Ping timeout: 240 seconds]
braincrash has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blackmesa has quit [Ping timeout: 272 seconds]
BTRE has joined #ruby
braincrash has quit [Ping timeout: 246 seconds]
gix has joined #ruby
SeepingN has joined #ruby
AndyC has joined #ruby
AndyC has quit [Read error: Connection reset by peer]
AndyC has joined #ruby
blackmesa has joined #ruby
akem_ has joined #ruby
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
akem has quit [Ping timeout: 265 seconds]
braincrash has joined #ruby
lmc has quit [Quit: Leaving...]
blackmesa1 has joined #ruby
blackmesa has quit [Ping timeout: 260 seconds]
adu has joined #ruby
drincruz_ has joined #ruby
AndyC has quit [Ping timeout: 258 seconds]
aremaref has quit [Ping timeout: 256 seconds]
TCZ has joined #ruby
drincruz_ is now known as drincruz
somazero has quit [Quit: Leaving]
blackmesa has joined #ruby
blackmesa1 has quit [Ping timeout: 272 seconds]
somazero has joined #ruby
somazero has quit [Client Quit]
aremaref has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
dfucci has quit [Ping timeout: 258 seconds]
freshmaker666 has quit [Quit: ZNC 1.8.2 - https://znc.in]
jetchisel has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
icarus has quit [Ping timeout: 240 seconds]
dfucci has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
Fire-Dragon-DoL has quit [Quit: Quit]
Fire-Dragon-DoL has joined #ruby
mthello has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
mthello has quit [Quit: Connection closed]
orbyt_ has joined #ruby
dfucci has joined #ruby
dfucci has quit [Read error: Connection reset by peer]
dfucci has joined #ruby
adu has quit [Quit: adu]
dionysus69 has quit [Ping timeout: 256 seconds]
panorain has quit [Remote host closed the connection]
panorain has joined #ruby
dfucci has quit [Ping timeout: 265 seconds]