« first day (3995 days earlier)      last day (936 days later) » 

2:01 AM
^ already closed :D
 
 
3 hours later…
4:48 AM
hey guys have someone scraped the contact details of ceos and cfos ,leads
 
5:03 AM
Guys can someone help me out with this question: stackoverflow.com/questions/69284858/…
Let me know if any further details required
 
5:46 AM
@senarijit1618 "Unable to call" isn't very informative, explain what happens, include error message, etc.
 
6:04 AM
Cbg
 
6:51 AM
@senarijit1618 please don't cross post fresh questions from main site here as per our room rules
cbg
 
7:27 AM
cbg guys, is the accepted answer here the only way even now? have things changed? was trying to answer a question on main and stumbled upon this
 
@MisterMiyagi what do you mean by this? I can't control click the string and it shows me the fixture
Also importing the fixtures shows me import not used
 
8:01 AM
I'm trying to create a simple test once with selenium headless once with ui. But I get AttributeError: Subrequest object has no attribute param. Is there a way to directly parametrize fixtures?
import pytest
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options


@pytest.fixture(scope="session")
def driver(request):
    options = Options()
    options.headless = request.param
    driver = Firefox(options=options)
    return driver


@pytest.fixture
def login(driver):
    driver.get("http://localhost")
    args = parse_args()
    driver.find_element_by_name("username").send_keys(args.username)
    driver.find_element_by_name("password").send_keys(args.password)
 
@Hakaishin It should at least be able to match the parametrize options to their respective parameters. Certainly does checking and inference for them.
Is there a good dupe for people trying to use multiprocessing but calling the target instead of passing it on?
 
Hmm I have to also add driver to the test params then I can parametrize it, bit odd since login calls driver already but welp that worked
 
Can someone suggest the best way/platform for deploying a Mask RCNN model onto the web for others to use for inference, please? It is trained so I need inference only but the weights are 172mb which is above PythonAnywhere's file size limit and I can't for the life of me get Linode working. It works as local Flask app just fine, but deployment is causing me problems.

RAM limitations are also a concern as it uses around 1GB when run locally.

Thanks!
 
8:45 AM
@PM2Ring huh, cmb visualizations then are VERY misleading. Good to know, I was always wondering why it's not uniform, but it is it's just that everything becomes weird if you zoom far enough in
Also I totally missed yesterdays awesome discussion dang it. @Kevin What's the dark forest theory? I saw isac asimovs youtube thumbnail about it but didn't watch it
 
 
1 hour later…
10:06 AM
cbg
 
10:54 AM
cbg
120 python questions to go to catch up with java! stackoverflow.com/tags
 
Not sure whether that's a good thing…
 
"We're as confusing as Java!" :/
 
Haha!
 
Pffft, that's not how it works. All programming languages are confusing, especially to people who've only learned bits and pieces of the language from some random youtube videos
 
11:04 AM
Yeah,
 
 
1 hour later…
12:34 PM
Does somebody know the answer to this question: stackoverflow.com/questions/38316402/… The answer doesn't work for me, I just get an empty canvas
 
Hi all.
I'm trying to build a 1D CNN in Tensorflow to classify time series data.
I already have a working 2D CNN with 98% accuracy
Do I just replace every Conv2D layer in my network with a Conv1D? Is it that easy?
 
12:50 PM
@rb3652 I don't know much about time series and ml, but it's never that easy :D
 
@Hakaishin The universe is like a dark forest, and every spacefaring species is a hunter. They move quietly, doing everything they can to avoid being detected by other hunters. If they see another hunter, they do everything they can to kill that hunter before they're seen.
 
@Kevin Meh, I don't buy it, they would kill themselves before becoming spacefaring
 
If you're imagining that they kill because they're bloodthirsty, not necessarily. Perhaps most hunters are basically good, and act only in self-defense, out of fear of the actual bloodthirsty hunters that will kill them if they let their guard down.
Perhaps every hunter is basically good, and the idea of a bloodthirsty hunter is only a rumor. Even if every hunter suspects this, they can't let their guard down. The bloodthirsty hunter may have started rumors that he doesn't exist so that it's easier for him to hunt the basically good hunters.
 
and there go the nukes :)
 
This doesn't happen on a smaller-than-civilizational scale because it assumes that there are a lot of hunters with access to instant-kill technology that can't be defended against. Nukes are fast and hard to defend against, but only half a dozen world leaders have access codes. If everybody got nukes tomorrow... Yeah, we're toast.
Back to the metaphor. Even if a hunter walks into the middle of a clearing, drops all the weapons that they appear to be carrying, and yells "hey, who wants to team up and wipe out all the bloodthirsty hunters once and for all?", nobody will step forth. The hunter in the clearing may be a bloodthirsty hunter, who has crafted this cunning ruse in order to flush out basically good hunters, and obliterate them with a secret weapon hidden under his cloak
 
1:05 PM
In a way we are really lucky nuclear physics is way harder than regular bomb making which in my understand basically needs just some poo and baking soda :D
@Kevin how do you know your coworker is not planning the same thing?
@Kevin I kinda find these thought experiments unbelievable because they seem to imply to me that there can be no collaboration, which the real world refutes, but maybe size of collaboration does indeed play a role, although I would like to think that laws governing human psychology are invariant to the scale we measure at, which I know is wrong so hmmm, maybe you can only not trust your 1112th coworker but the ones before you can XD
 
He doesn't have access to secret weapons. Not even a powerful black market gun really qualifies, because there are scenarios where I see him getting ready to fire, and successfully avoid it or incapacitate him. Granted, I'm not an action hero, so there aren't many scenarios, but just a handful is sufficient to keep it from being a proper dark forest setup
Compare to say, a million ton asteroid accelerated to 0.9c and aimed at earth from beyond the Oort cloud. We can't see it coming, and even if we could, we can't do anything about it.
 
@Kevin So you are saying the only thing differentiating the office from a dark forest is your ability to run away or kill a guy who could be carrying a gun in his jacket? I find that hard to believe
 
Pretty much
 
And that civilizations csn afford to act in a fully utilitarian manner
 
@AndrasDeak can you elaborate?
 
1:13 PM
No hard feelings, suspicious radio blip from 20 light years away
 
Keeping in mind that if the attacker has a superweapon, then not only am I totally helpless, but so is every person that might try to defend me. All of my coworkers, and everyone else in the building, and everyone else in the city, and all of the police in the state, and every army in the world, is mere dust before his superweapon.
 
@Hakaishin "we should kill all other civilizations because this is how we can guarantee that other players with the same purely logical approach don't kill us first" is 100% utilitarian decision-making. No ethics or other silly things involved. If we don't kill all other civilizations: we might be OK or profit, but we could also die by their hands (which has -infinity utility). If we kill all other civilizations, we definitely won't die by their hands (which has finite utility).
 
Yeah it's the Nash Equilibrium, IIRC
 
@AndrasDeak assuming you value not existence at -inf. Is that an actual assumption utilitarianism makes?
 
@Kevin yeah, everyone would have to change strategies simultaneously, which is a no-go
@Hakaishin I've explained my stance
 
1:18 PM
@AndrasDeak Ok so it's your stance, I was wondering if this your assumption or a common utilitarianism assumption in general
 
Negative utilitarians put nonexistence at zero, I think. But I suspect the math still works out the same even so.
 
@Hakaishin I don't know what utilitarianism is
 
Utilitarianism is a family of normative ethical theories that prescribe actions that maximize happiness and well-being for all affected individuals. Although different varieties of utilitarianism admit different characterizations, the basic idea behind all of them is to in some sense maximize utility, which is often defined in terms of well-being or related concepts. For instance, Jeremy Bentham, the founder of utilitarianism, described utility as "that property in any object, whereby it tends to produce benefit, advantage, pleasure, good, or happiness...[or] to prevent the happening of mischief...
wasn't that what you meant?
 
Game theory typically requires a "rational agent", which in practice looks a lot like utilitarianism.
Actual biological humans are not very good rational agents because we often make decisions against our best interest. But on a large enough time scale, the dark forest can whip all of its lousy hunters into shape by natural selection -- the irrational ones get atomized before they can flourish, and the gene pool gets a little smarter.
 
Regarding the Dark Forest scenario, in Guns, Germs, and Steel, Jared Diamond claims that when two solitary hunters in the New Guinea highlands accidentally meet outside their home territories, they immediately start reciting the names of their ancestors / kin. They're hoping to find proof that they're related, so that they aren't obliged to try and kill each other.
 
1:29 PM
The moment has come! is second place now! stackoverflow.com/tags
Passes java on the number of questions!
 
you're probably the only one who cares
but, congratulations I guess
 
Haha
Yeah
 
The author of The Dark Forest gives an interesting illustrative example of how a hunter can ethically justify their actions. He shows an alien in charge of his species's superweapons. When his alien-detecting radar goes off, he says, "oh, it's a young species that doesn't know the rules yet. I better grant them a quick painless end before someone bloodthirsty comes along and does something real nasty to them"
 
Sometimes, people do some pretty irrational, dysfunctional stuff, without totally wiping themselves out. Eg, en.wikipedia.org/wiki/Nongqawuse
 
@PM2Ring interesting and very weird
@Kevin I just wonder if that logic were true, why is there even civilization at all? Why is it not chaos and everybody killing everybody, so that the other person doesn't kill me?
 
1:35 PM
Another important aspect of the Dark Forest is that it's talking about aliens. They might be utilitarian, or whatever, but their values & beliefs are bound to cover a broad range. Whereas humans share a common humanity, despite the weird & wonderful variations across the globe and through history.
 
@PM2Ring Another example: the Heaven's Gate cult left behind two members to keep their website updated. Not even a community based around the thesis of "let's all kill ourselves" had a 100% lethality rate.
@Hakaishin It's hard to give anybody a quick painless end, for one thing
 
"I was a suicide cultist... but I got better"
@Hakaishin you're missing the point that humans are not rational agents or utilitarians or whatever. If everyone were a sociopath then it could go differently.
and the aliens wouldn't (have to) be rational agents or utilitarians individually
it's the emergent property of civilization preservation in the face of potential threats from outside that leads to this logical choice of extermination of everything
And civilizations don't have to make this choice. The theory is just a possibility that sufficiently logical supercivilizations might reach this game theoretical conclusion.
At the end of the day The Dark Forest is science fiction.
 
@AndrasDeak so somewhere between 1 and x humans this property must kick in, I wonder when
 
you're still missing the point, this is not about killing other humans
 
TVTropes has a nice page on really alien aliens: tvtropes.org/pmwiki/pmwiki.php/Main/StarfishAliens
 
1:41 PM
if you had 100 surviving humans in possession of technology that allows killing other civilizations, odds are they would use it to protect what's left of them
 
Do go on please, folks. 🍿
 
This ties into the idea of eusociality, where animals will cooperate with one another for the greater good, even if it's not so good for their personal outcome. For example, a bee that sacrifices its life to sting something near the hive.
Natural selection can promote eusociality because dying to protect your family will give your brothers and sisters a better chance to pass on their genes, and half of those genes are your genes. So their kids might have the eusocial gene too.
 
wait in once sentence you say it's not about killing humans in the next you say they would use their tech to kill other civilizations? How are other civs not composed of humans?
I mean I get that you want to apply your theory to humans and aliens, but it looks like it fits just humans vs humans aswell
 
Perhaps the other civs are composed of little green men. (not sarcasm)
Just going by natural selection and eusociality, humans would probably be more reluctant to use their superweapon on other humans, compared to using it on aliens. All other things being equal.
 
So, about that Dark Forest… if it's the size of galaxies, then that Hunter would be pretty tiny or rather schizophrenic, no?
 
1:49 PM
@Kevin For sure that's a given. But so is there a genetic similarity we got to have so that we don't start killing other humans?
 
I mean, delay between left and right hand at galactic hunter scale would be pretty crazy, eh?
 
@MisterMiyagi I think that's part of the metaphor
You expect the dark forest to be empty. If you hear a sound in the dark... that's not a good sign.
 
@Hakaishin Not really, but we're more likely to see humanoid (or at least mammalian) aliens as potential comrades, compared to insects or starfish.
 
NB I haven't read any of the three-body problem books
 
In the book, there's a little bit of FTL tech so that the alien race that's hunting earth can talk to us without signal delay. But most of the other species don't seem to bother with that kind of thing.
So yeah, there's quite a bit of delay between a species first noticing radio broadcasts of I Love Lucy, and the arrival of their 0.9c relativistic payload @MisterMiyagi
 
1:54 PM
I just don't see how any of the hunting or shotgunning works at that scale.
 
The effective size of the galaxy depends on your technology. If there's FTL technology that lets you cross the galaxy in a week, it's a rather different situation to a galaxy with no FTL that takes a million years (possibly time dilated) to cross.
 
There's a good chance that your left foot is just as alien to you as the guy hiding behind the next tree.
 
@MisterMiyagi I read it as just an explanation of the logical conclusion, in human terms
what really happens is that if you see any sign of intelligent life, you kill it ASAP
 
@MisterMiyagi Yeah. If you see a blip on the alien radar somewhere in your oort cloud, you're going to shoot first and ask "oh, was that one of our asteroid mining vessels?" later
 
@AndrasDeak except if human, right?...
 
1:57 PM
@AndrasDeak Ah, well, my point being at that scale either you're as tiny to be insiginificant, or big enough to be your own sign of other intelligent life.
Damn martians alpha centaurians can't be trusted, I tell you…
 
@AndrasDeak Me neither. But FWIW, there's a current question on SF&F about possible internal inconsistency in Death's End scifi.stackexchange.com/q/254110/116908
 
If the question is "how do large civilizations keep track of what belongs to them once they own more than one planet?", it's at least easy to keep tags on the big properties. The guy in charge of superweapons probably has a database of planets that he shouldn't atomize.
 
@Hakaishin humans are dead
 
And little things like asteroid mining vessels can signal their allegiance with an encrypted signal on a narrowly-focused beam aimed at the civilization
 
I think this works exactly because civilizations are far apart
 
2:03 PM
You wouldn't want to blast "hey, I'm a perfectly defenseless mining vessel" in all directions, but you can have a little wedge of radio that won't leave the solar system
 
Well, as most people in this room should know by now, "one guy at the center making all the decisions" just doesn't scale.
So you would naturally have many guys and gals making all the decisions.
 
It's hard to get your head around just how empty the galaxy is. I give some relevant numbers here: astronomy.stackexchange.com/a/41005/16685
 
Don't see how that works without inherently trusting BusyBomb293 not to nuke you from 14 parsec away.
 
@MisterMiyagi and florbs
 
Poor florbs never getting any credit for their hard work. :(
Better nuke them before they get any ideas!
 
2:07 PM
IIRC, during a description of one of the few alien races that are depicted in any detail, there's an offhand mention that they're very adept at genetic engineering, and actively promote traits that improve cooperation within the civilization
 
That sounds rather anti-climatic from a story-telling perspective.
 
That part might be intentional, because the passage as a whole is trying to convey how banal most civilizations regard their superweapon policies
The alien with his hand on the trigger is basically swiping through facebook while he atomizes potential targets. He gets annoyed that he has to use an extra-strength superweapon on one of them, since it hurts his chances of getting a holiday bonus.
0.9c asteroids are cheap, but they're only good at destroying civilizations that are dependent on their home planet for survival. If the target might have space colony tech, you need something that can knock out a star.
 
I still don't get how any of that would work without some FTL shenanigans, aka Space Magic.
At that scale, you just cannot do anything "at once".
 
hey guys, quick question, is [1] in {'a': [1], 'b': [2]}.values() is not a constant time look up?
 
So no eradicating the florbs with the press of a button.
@python_user Values aren't set-like, so a linear scan is needed.
That it works for unhashable types should give you a hint.
 
2:18 PM
@PM2Ring Yeah, I found that section pretty implausible while I was reading it. But the precise mechanism is basically set dressing -- you could swap that chapter out with something that uses more mundane science, and the plot resolves the same way
A really big black hole would probably suffice, for example
 
@MisterMiyagi thank you MM, got it, if my values are unique and hashable, would it still be a linear scan, does python special case this?
 
@Kevin Ok. I don't mind a bit of weird maths in science fiction, but I get annoyed if it's not at least internally consistent.
 
@python_user It's still going to be linear. Values always start with the same layout; to make the scan non-linear would first require a linear scan to find out that this works.
If you know they are hashable and need to look up several things, of course you can manually convert the values to a set to "let Python know" that this works.
 
ok got it, I will let you guys with the cool aliens / science talk :D
 
The casual reader probably wouldn't even notice that the two instances of "2D tech" in the story don't quite work by the same rules. They're separated by quite a few chapters, and I don't think it's ever explicitly said that they both exploit the same principle
@python_user If both keys and values are guaranteed to be hashable and unique, perhaps you could construct a simple "bidirectional map" class that has efficient lookups in either direction.
 
2:27 PM
that also came across in my searches stackoverflow.com/questions/3318625/…
 
hello how can i access request metadata en django im using drf
i want to access it inside view
 
It's easy enough to project the surface of a 3D object to a plane, eg josleys.com/show_gallery.php?galid=363 But I don't think you can project an actual solid in the way described in Death's End
 
Yeah, I got to the part where it said "every flattened object was still recognizable as what it used to be" and I immediately thought "no it wasn't"
 
:)
 
@python_user here is a quick and dirty two-way dict prototype.
 
2:38 PM
thanks Kevin I will look at your approach, I dont see any dunders other than init so its already a lot clearer for me to understand :D
 
Ha, I was about to apologize for not going to the trouble of prettying it up with dunders
It's a little clunky to use IMO because you can't write d["a"] = 1, but it's still just as functional
 
if it makes me understand it, I can probably spend a couple minutes (or hours) to dunder it up
 
@RayRojas Sorry, I don't know Django. What sort of metadata do you mean? Response header fields? docs.djangoproject.com/en/3.2/ref/request-response
 
Hard mode: make it work with slice notation so that print(d["b":]) finds the value associated with key "b", and print(d[:1]) finds the key associated with value 1
 
if I get around that I will ping you :D
 
2:47 PM
Unrelated topic. I happened to be outside last night at midnight, and I was confused to see that the full moon was not directly overhead. I assumed that it would pass through the zenith during the equinox. Upon consideration, I guess that's only the case if you're on the equator.
Wikipedia tells me that the sun and the moon are never directly overhead if you live north of 23ish° N, which includes all of the continental United States. I feel like I remember seeing the sun being pretty much overhead, here in Jersey. Maybe it's a false memory implanted by the government.
 
And if it's near eclipse season. Our Moon is a bit unusual in that its orbital plane is inclined about 4° to the ecliptic, rather than being near the equatorial plane. There are some relevant diagrams here: en.wikipedia.org/wiki/Lunar_precession Also see en.wikipedia.org/wiki/Lunar_standstill
 
Part of me wishes our Moon wasn't so eccentric, so we'd get an eclipse every lunar month. But another part of me thinks that the eccentricity is what makes it special :'-)
 
Actually, it's more like 5°. I should've checked Wikipedia first. :) The eccentricity doesn't matter, it's the inclination. So if that inclination angle were 0° we'd get a solar & a lunar eclipse every month.
 
Which is not to say that the Moon would cease to be special if it had a flat orbital plane. The Moon has nearly the same apparent size as the sun -- call it "the size of a quarter held at arm's length". Most planets don't get to enjoy a clear view of their star's corona during a solar eclipse.
 
3:03 PM
I lived near the equator (Darwin) for ~18 months when I was a kid. The sunsets were amazing, but twilight was very short. I've lived most of my life out side the tropics, generally at ~34°S, but also 7 years at ~30°S. So the Sun gets pretty high around noon. But I've never experienced the long twilights that higher latitudes get.
I bet our solar eclipses are pretty rare. If there were galactic tourism, our eclipses could be a major attraction...
But maybe intelligent life only arises on planets that have spectacular solar eclipses. ;) (I think we had that discussion here a few years ago).
 
Here at 40ish N, the twilights are noticeably long around solstice time. At 9:00 PM you still might have enough light to read by.
I don't know how typical that is, or how much it varies by latitude. I don't travel outside of 40ish N that often.
 
Here in Sydney, even near the summer solstice, with Daylight Saving, it's pretty well fully dark by 8 PM or so.
 
@PM2Ring Thank you
 
No worries. I'm glad my guess was helpful. :)
 
ha
 
3:22 PM
A few days ago, I learned about some remarkable algorithms from 1972. An algorithm for computing logarithms and arctangents by B. C. Carlson. PDF. It uses a modified arithmetic-geometric mean, combined with Richardson extrapolation to accelerate the convergence. It uses 1 square root per loop, and a single division at the end. So it's rather useful for arbitrary precision calculations
The main loop doesn't need any actual divisions, just bit shifts. I'll try to post a demo implements it with the decimal module. The demo code computes pi, using the Machin formula, pi/4 = 4*atan(1/5) - atan(1/239)
 
Whenever I feel a bit of pride for knowing how to implement a linked list, I think of papers like these, and my humility is restored
I wonder if all of the inventors of difficult algorithms hang out together in a chat room. And somebody like me comes in asking "are there any good Youtube tutorials for computing logarithms and arctangents using a modified arithmetic-geometric mean combined with richardson extrapolation?". And they all sigh and say "the link is in the room title"
 
I've read a few articles about Richardson extrapolation, but I must confess that I don't really understand it. The same goes for elliptic integrals / functions. Fortunately, I can use them without fully understanding them. :)
 
@Kevin Don't forget to wiggle the rear view mirror.
 
"Let me Arxiv that for you"
 
Gauss did a whole bunch of stuff with the arithmetic-geometric mean AGM. The standard AGM loop is simple: a, g = (a + g) / 2, sqrt(a *g). Carlson's variant is just a = (a + g) / 2; g = sqrt(a *g). The d array stuff is the Richardson extrapolation.
 
3:39 PM
Hi all. I've been trying to create a functioning 1D CNN for Time Series Classification for a long time now (last few weeks). Does anyone has any experience in this?
 
No, but I'm rooting for you
 
Using the AGM, Gauss was able to discover / prove the main properties of elliptic integrals. But the AGM wasn't used much for computation back in the old days because it mixes addition with square roots & multiplication, which is a bit painful when you do calculations with logarithm tables. But it's become much more popular in the computer age.
 
Haha, thanks @Kevin
 
I tried reading about neural networks and I got as far as "you can use them to find the coefficients of a linear equation using only a few thousand data points". Or, I could find the coefficients with two data points and a notepad window.
 
The 3rd party mpmath module has some Richardson functions that you can pass a slowly converging series to, and it'll do the necessary work to accelerate it for you. When I first encountered it, it seemed like magic. :)
 
3:45 PM
I suspect this is equivalent to saying "what's all this hubbub about human brains? Neurons can only receive and send electrical impulses. Why spend a million years evolving that when I could buy a copper wire that does the same thing?"
 
Getting a linear equation from two points is easy. Getting a good linear equation from a thousand points is a bit harder.
 
My infuriating 101-level suggestion is, just do least squares to it
 
Numpy has a function that does the matrix maths to fit a plane to a bunch of points. I guess it works with higher dimensions as well, but I've only tried it on a plane.
 
With my fresh ideas, we should be able to knock out generalized image recognition in two or three months
 
I expect it's possible to create a ML based compressor that's specialized at compressing cat pictures (borrowing techniques from Deep Fakes) that does significantly better than JPEG. But if you give the cat compressor a photo of a fish, it will fail miserably. ;) — PM 2Ring Sep 14 at 8:03
 
3:55 PM
I'll set aside a couple weekends to make a compression algorithm that compresses all possible inputs
 
well, at the very least you'll have compressed your schedule
 
The pigeonhole principle states that it's easy to compress images of cats and fish, but not pigeons or holes. But it's nothing that a little elbow grease can't overcome.
 
The universal compressor is the programming equivalent of squaring the circle. It can be difficult to convince some people that it can't be done...
 
Yeah. The problem with "for any nontrivial compression algorithm, there's at least one string that stays the same size or gets larger" is that it doesn't give a constructive approach for finding that string
 
Just send the data through CERN's mini-black hole, easy. Steins;Gate did it
 
4:07 PM
For relatively simple schemes like run length encoding, it's not too hard to play with examples and come up with something. But the more sophisticated the algorithm gets, the harder it is to attack
Or, hmm
 
I guess if the crackpot has gone to the effort of actually implementing his algorithm, you can just run it on 257 distinct two-byte inputs, and discover at least one that doesn't compress to a one-byte output
 
@Kevin Yep
Here's that Numpy program that fits a plane to points. There's a link to a Math.SE post that explains the algorithm. chat.stackoverflow.com/transcript/message/53089072#53089072
Grrr. The transcript doesn't work. You have to go to the live version of the Sandbox.
 
Only for PM will I go to the effort of clicking my mouse three times to see a cool demo
 
Hi, I wonder if it is possible to convert this code from two lines to one liner? Because I will have many line like this. This code makes list of SQLAlchemy filters.
```python
if category_id:
filters.append(self.model.category_id == category_id)
```

all filters (I currently need two lines per each):

`
if category_id:
filters.append(self.model.category_id == category_id)
if query:
filters.append(self.model.search_vector.match(query))
if is_enabled is not None:
filters.append(self.model.is_enabled == is_enabled)
 
4:18 PM
@Kevin Thanks. :) It's not that cool, but it does have an interactive 3D graph.
 
@KarolZlot Yes, you can put an if statement and its block on the same line. In other words, if a: b.foo(c), all on one line, is valid syntax.
 
@Kevin this is what I needed, thank you!
 
I usually do it the long way anyway because I like the way it looks, but your mileage may vary
 
One line if is more compact, but it can make the code too condensed, which can be harder to read. But I must admit that I occasionally do it, eg for a break at the end of a loop.
 
4:25 PM
I wonder if SQLAlchemy has any cool filter control tricks that would let you filter any number of filters with a constant amount of code... It seems like something that would come in handy
 
Yes, it is kind of weird now, I will probably stick with two lines
I had this before:
 
@Kevin That's basically how the field started out. I don't remember what uni, what there was a hilarious story that a IT professor tried to solve the field with some phds and students in a summer school, after a long summer they realized there is more to it then what they thought :D
 
helloo
 
quite hacky because I couldn't cancel filter with None
 
4:29 PM
@Hakaishin High levels of the three virtues there -- the lazy professor asks his students to solve the problem, and in their hubris they reply it will be easy, and they're all impatient so they agree to finish it in one semester
 
Nice, my tests finally fail successfully. At first they passed without me having implemented the task :D
 
The Internet tells me that the anecdote is ahistorical or perhaps just very embellished, but a good fable is a good fable
 
@Kevin what's reality anyways :P
maybe stories are more real than actual events, think about it :)
 
Everything is equally fake because I am a butterfly dreaming that I am a person
 
He said and jumped and was gone: readthesequences.com/The-Simple-Truth
I should finish the sequence at some point, I got to the interesting part and kinda stopped, not sure why
 
4:34 PM
@PM2Ring well, it also had the merit of making me realize plane actually meant plane and not plane, so pretty cool 3d graph is pretty cool :)
 
@Kevin But it's kinda close to the true story: en.wikipedia.org/wiki/Georgetown%E2%80%93IBM_experiment Well publicized by journalists and perceived as a success, the experiment did encourage governments to invest in computational linguistics. The authors claimed that within three or five years, machine translation could well be a solved problem.
@FélixAdriyelGagnon-Grenier Oh, good. :)
 
more like plain amirite #englishIsHard
 
@Kevin what SQLAlchemy API/syntax would you expect to make filtering easier?

"any cool filter control tricks that would let you filter any number of filters with a constant amount of code."

I ask because I may try to make demo implementation of it.
 
@KarolZlot I don't have anything specific in mind. I'll page through the docs and let you know if I see something.
 
@FélixAdriyelGagnon-Grenier See youtu.be/agL9ftHYrRQ
 
4:37 PM
I did NOT expect that, what a legend that guy!
 
Great fun
We don't get many French language pop songs on Australian radio, but that one did pretty well here.
 
nice! I'm still having a hard time grasping the aesthetics of the crowd in that video. it is amazing.
in a very "we're all high as kites" kind of way
 
@Kevin if you can better than this then I am interested :)

But don't worry about it, it's your precious time, I don't want to waste it
 
@KarolZlot ugh do types look ugly
 
4:44 PM
@Hakaishin Ah, if only all of the sequences had funny illustrative stories. Some of them are just math and I can't get emotionally invested.
 
@Hakaishin what do you mean, how can I improve this?
 
@Kevin yeah, I kinda glossed over the entropy one. I got the gist, but I don't need to know the math. Nah I'm at the language chapter, should be interesting, but also all of it feels a bit obvious
 
I never got through the whole thing myself >_>
 
@KarolZlot by not using types (: but that's just a strong preference I have, keep doing what you think is right
 
I listen to a bit of French music, but I generally prefer more relaxed stuff, eg youtu.be/4w38oeyQQ5M
Tatiana also sings in English, eg youtu.be/jlVzlB6K6ps
 
4:47 PM
@Hakaishin I see. I like having python types because vscode is detecting more bugs thanks to them, I think it saves me time.
 
5:11 PM
halp, the editor doesn't work at all on mobile (Firefox on iPhone 12 mini)
halp, the editor shows you a margin but then (misleadingly IMHO) renders newlines as actual line breaks
 
 
1 hour later…
6:23 PM
@KevinC maybe those resource will help you:

https://ep2019.europython.eu/media/conference/slides/KNhQYeQ-downloading-a-billion-files-in-python.pdf

https://pypi.org/project/aiomultiprocess/
 
7:04 PM
is there a way to turn the string '1/6' into a float without eval?
from fractions import Fraction
float(Fraction('1/6'))
python -c "import os; os.system('say \"get some\"')"
 

« first day (3995 days earlier)      last day (936 days later) »