bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
Linux_Kerio has quit [Ping timeout: 245 seconds]
bambanxx has joined #ruby
rvalue has joined #ruby
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
bambanxx has joined #ruby
aesthetikx has joined #ruby
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
graywolf has quit [Quit: WeeChat 4.0.4]
m_antis has joined #ruby
poems has quit [Ping timeout: 268 seconds]
poems has joined #ruby
CrazyEddy has quit [Remote host closed the connection]
<hexology>
are there any books, tutorials, etc. that focus on using ruby for "data processing"? like what you might otherwise use perl, awk, or python for
<hexology>
it was brought to my attention recently that ruby is supposed to be good for that kind of thing. i've historically always used python for it, but i'm interested in exploring
<adam12>
hexology: Text Processing with Ruby I think? From OReilly.
<hexology>
i like them, happy to give them my money
<adam12>
Yep. 100%
<hexology>
i assume this is not a rapidly changing domain, right? that is, this book isn't likely to go out of date quickly?
<adam12>
bbl
<hexology>
ah, ty for the advice
<adam12>
hexology: I use Ruby for scripting every day since like 2004 and I don't think anything has changed, really.
<adam12>
They even stole all the convenient command line args I was already using from Perl
<hexology>
oh nice, that's really useful
<hexology>
python needs a 3rd-party tool for things like perl -ne
<hexology>
(on the cli, i mean)
<adam12>
Nope. `ruby -ne` is built in.
<adam12>
As well as BEGIN/END and lots of other choice stuff.
<hexology>
that's very appealing. ty again!
poems has quit [Ping timeout: 256 seconds]
araujo has quit [Ping timeout: 268 seconds]
sam113101 has quit [Ping timeout: 268 seconds]
poems has joined #ruby
sam113101 has joined #ruby
fercell has joined #ruby
fercell_ has quit [Ping timeout: 255 seconds]
brokkoli_origin has quit [Remote host closed the connection]
brokkoli_origin has joined #ruby
CRISPR has joined #ruby
CRISPR has quit [Ping timeout: 252 seconds]
hansolo has quit [Remote host closed the connection]
hansolo has joined #ruby
bambanxx has joined #ruby
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
Vonter has quit [Ping timeout: 268 seconds]
bambanxx has joined #ruby
Paris has joined #ruby
Paris has quit [Client Quit]
xdminsy has joined #ruby
grenierm has joined #ruby
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
bambanxx has joined #ruby
Paris has joined #ruby
bambanxx has quit [Ping timeout: 276 seconds]
Al2O3 has quit [Quit: Good mourning, good after nun, g'nite, and goober evenings.]
Al2O3 has joined #ruby
Al2O3 has quit [Client Quit]
Al2O3 has joined #ruby
Al2O3 has quit [Client Quit]
Al2O3 has joined #ruby
Al2O3 has quit [Client Quit]
Al2O3 has joined #ruby
Al2O3 has quit [Changing host]
Al2O3 has joined #ruby
Linux_Kerio has joined #ruby
jenrzzz has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 256 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 245 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 268 seconds]
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 252 seconds]
jenrzzz has quit [Ping timeout: 252 seconds]
Paris has quit [Remote host closed the connection]
jenrzzz has joined #ruby
xdminsy has quit [Read error: Connection reset by peer]
_ht has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
araujo has joined #ruby
Starfoxxes has quit [Ping timeout: 260 seconds]
jenrzzz_ has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
jenrzzz_ has quit [Ping timeout: 245 seconds]
<rapha>
adam12: thanks for mentioning minitest-bisect ... that'll come in real handy once i'm dealing with randomized test. yesterday, my question was phrased ambiguously, i now realize. it were 2 different tests and nothing about them random. it took a good while before finding the problem. one of the models has "acts_as_paranoid", which was curious, as the Gem wasn't installed. turns out, there's a newer
<rapha>
one called "paranoia", which still uses the same method name, but other than that works a bit differently, e.g. to destroy something, *that* method is called really_destroy! And then, it doesn't cascade, but okay, riddle solved. I will never get, though, why people in the Rails world insist on monkey patching and undiscoverable magic all the time.
Starfoxxes has joined #ruby
CrazyEddy has joined #ruby
araujo has quit [Ping timeout: 276 seconds]
grenierm has quit [Ping timeout: 250 seconds]
spinningCat has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
CrazyEddy has quit [Remote host closed the connection]
MomosOrDeath1 has joined #ruby
MomosOrDeath has quit [Ping timeout: 245 seconds]
MomosOrDeath1 is now known as MomosOrDeath
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
ht_ has joined #ruby
_ht has quit [Ping timeout: 276 seconds]
ht_ is now known as _ht
Guest12 has joined #ruby
<Guest12>
hello
Guest12 has quit [Client Quit]
pgib has quit [Remote host closed the connection]
<adam12>
rapha: If you're using minitest, just be aware that tests are randomized by default.
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
dviola has joined #ruby
Aminda has quit [Quit: Default quit message is difficult to set. If you don't see me returning, ask me? You will find me, if you want to]
jas-maelstrom has quit [Remote host closed the connection]
xdminsy has joined #ruby
<rapha>
adam12: the tests i'm writing at the moment don't use any helper functions for creating things. i'm handcrafting them, which seems to be the best approach at the moment. or did you mean the order that tests are run in is randomized?
<rapha>
adam12: also, was it with you (or perhaps ox1eef_?) where we had a chat about different testing frameworks and different ways of doing fixtures a few months back? i remember bookmarking something that was very new then and that i wanted to check out again now. can't find the bookmark anymore though :(
graywolf has joined #ruby
ht_ has joined #ruby
_ht has quit [Ping timeout: 252 seconds]
ht_ is now known as _ht
<ox1eef_>
acts_as_paranoid changes the behavior of '.destroy' in a strange way (eg when you call it once, that's a soft delete, call it twice and that's a hard delete). I would look into rolling my own, or choosing an alternative. If you're stuck with it then good idea to read the docs and learn of its quirks.
jas-maelstrom has joined #ruby
<ox1eef_>
Don't recall a conversation about fixtures. I think we discussed rack-test not so long ago.
<ox1eef_>
Ah I see. You are using a fork. I'm not sure if what I said rings true for the fork, but I agree, I don't like those kind of monkey patches.
<ih8u>
what's the best way to convert a string to kebab-case?
<leftylink>
but what case did it come in? because depending on that, it could either be a join(?-) or a .tr(?_, ?-)
<leftylink>
luckily the casing part is easy since it's just a .downcase
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
Vetheon has quit [Remote host closed the connection]
Vetheon has joined #ruby
<ih8u>
is there any way to force a web page to refresh when the back button is pressed?
<ih8u>
without javascript
<Vetheon>
Are you referring to the back button of the browser, or a back button on your page?
<ih8u>
back button of browser
<Req>
I may be wrong but i think it depens on your browser in a way. What i think you are asking is... lets say you have page 1 that has a list then you navigate to page 2 to "add something to list". at which point you would want to navigate back to page one to view the list with now the +1 item listed.
<Req>
if it is the first case im not sure. You might want to create a back button on your page that takes you back to page 1. most users will likley hit the provided button rather then using the browser controls.
<Req>
The way that most browsers work is when you hit the back button it will either load the previously loaded content. basicly it re-draws the page that you were at before using the previously loaded html/etc. The second way is that it just re-navigates to the URL that you were at before.
<Req>
or just use JS
<Req>
if it is the second case then its likley becasue of how you have urls setup. you probably generate a new "page 1" each time a new item is added to it. if thats the case you will want to have a link that does not change that just points to the latest version of "page 1"
<Req>
im sure there is more professional ways that im looking up now but for now try to expand on your problem with your use case
<ih8u>
my use case is pretty straightforward
<adam12>
ih8u: Is this still Unpoly related? If it is, maybe you want to disable caching for some routes.
<ih8u>
it could be, if that's the solution
<ih8u>
unless there's a roda way to address this
<adam12>
Unpoly uses historyState, which will store in the browser cache.
<adam12>
So when you back-button, if there is a history entry with a cache page, it will use that.
<ih8u>
you're familiar with roda, right?
<adam12>
ih8u: Me? A little bit :P
<ih8u>
would you know of a way to accomplish this within roda?
<adam12>
Accomplish what?
<rapha>
ox1eef_: it's not actually acts_as_paranoid in this project, but "paranoia". which doesn't have the double thing. It still does monkeypatch #destroy* and #delete*. i think if i'd be allowed to roll my own, then i'd implement something like a #soft_destroy and not overwrite ActiveRecord.
<rapha>
we did discuss rack-test not long ago, ox1eef_. the convo about ruby testing frameworks (and that very minimal and very new one) must be half a year ago. it was with another regular here, but might have been not you or adam.
<rapha>
ah, sorry, only read your third line now.
Vetheon has left #ruby [#ruby]
<rapha>
oh, havenwood perhaps. havenwood: does that ring a bell, some new ruby testing (or perhaps just test fixtures) gem, still in the works around half a year ago?
<rapha>
be glad you're not stuck on 2.7.8 adam12 :)
<adam12>
rapha: lol. why stuck?
<rapha>
because rails6. thankfully, not for long anymore, we're seeing the light at the end of the upgrade-to-7 tunnel, and then, finally, it'll be 3+ again.
<adam12>
In my projects, I don't actually use "fixtures" anymore, but mostly each project will have a few "examples", and they are in dev/prod tool
<adam12>
s/tool/too/
<adam12>
so I might say `Models::User::Examples.active` and that would return me an active User.
<rapha>
and how do you maintain your examples? as seeds?
<adam12>
But I definitely dont' make too many variants.
<adam12>
Nah. Plain objects.
<adam12>
or maybe Sequel model instances.
<rapha>
let me rephrase, where do place those?
<adam12>
Usually inside the model class itself.
<rapha>
oh!
<rapha>
and you use Sequel in your Rails projects, too?
<ih8u>
adam12: refreshing entire page on back
<ih8u>
or certain elements, if possible
<adam12>
rapha: No. I don't use Rails much at all anymore.
<rapha>
for tha^t, i envy you adam :D
<rapha>
but i'm still a little flabberghasted
<adam12>
ih8u: First off, I'd make sure you're setting the boring old HTTP caching headers to disable caching.
<adam12>
ih8u: Then, make sure you're using POST to perform destructive actions. That will automatically clear the cache normally.
<adam12>
ih8u: Another option is to listen to an event for unpoly going back, and then maybe trigger a page refresh. I don't normally ever have to do this tho, so I'd be curious what you're doing.
<adam12>
rapha: My projects are either Roda apps, some Sinatra apps, or I've just built my own web "framework" for new projects. It doesn't have a name, and it's not really for public consumption, but its here: https://bugs.ruby-lang.org/issues/20104
<ih8u>
i have a sidebar that displays one thing if logged in and another if logged out
<rapha>
so you'll have a bunch of models, say, Car has_many Wheels, and then *in* your app/models/car.rb (or however you structure your non-Rails projects), which is *a database-backed model*, you'll have ... a bunch of example objects ... as, ur, what? @@class_variables?
<rapha>
adam12: won't #create persist that to your database? again and again, causing an error if, say, the email needs to be unique?
<adam12>
rapha: Yes. I run all my tests in a transaction that rollsback at the end.
<rapha>
but you said you use the same examples for test+dev+prod - and you can't just rollback everything in prod :P
<adam12>
rapha: I only create the record once, during test set up.
<adam12>
rapha: No, but I'm just saying, if I wanted to pre-seed a QA environment, I just ask for examples of everything
<rapha>
ah ok, so not in prod
<adam12>
It could be prod.
<adam12>
Maybe not necessarily Account, but for some items it could be.
<rapha>
sounds potentially insecure
<adam12>
It could be.
<rapha>
oh, right, for a Product in a webshop or so, it might be ok
<rapha>
am i understanding correctly that that Gist you posted would be the same code forr all environments? in that case i still don't understand how, in a non-QA environment, the #create & rollback would work?
<adam12>
rapha: Well, I don't need to rollback in those environments.
<adam12>
Those examples are only called during tests
<adam12>
or when I want something to play with on the console.
<rapha>
oooh that part of the code might just not ever be exercised in production
<rapha>
got it now
<rapha>
it's sort of amazing to have the examples for the model right there, IN the model
<rapha>
sooooooooo much pain comes from levels and levels of indirection
<adam12>
Yeah. I like at a glance looking at the shape of what the data might be
<adam12>
Especially with something like an ActiveRecord or Sequel model, which generates attributes from database tables.
<rapha>
yeah
<rapha>
and i love that gem which maintains a comment of the current state of the database table for you on top of the model file
<ih8u>
adam12: how does one "set cache-control headers"?
<ih8u>
my search is turning up explanations of what a cache-control is, but assume i know i to use them
<adam12>
ih8u: I think in my projects I just set response.headers["Cache-control"] = "some-value"
<adam12>
ih8u: I've normally just set no-cache or whatever the value is, at the top of the routing tree.
<adam12>
rapha: Yeah, I'm using tldr on one of my libraries. I like that it has a built in runner, but I had to disable the emoji output since I find it super distracting.
<rapha>
that sort of thing _is_
<adam12>
ih8u: Actually, make sure you lower-case `cache-control`. I think that's a new Rack 3 thing you might run into.
<rapha>
somehow became chic after the js hipsters took over
<ih8u>
i can't seem to get anything to work
<ih8u>
i put your code right after `route.do |r|`
<adam12>
something like `no-store, no-cache`?
<adam12>
Checked browser tools to see header being set on the response for those pages?