« first day (3860 days earlier)      last day (1311 days later) » 

00:28
cbg
what does cool cloud mean?
It means a cloud that is cool
00:45
I should have expected that
01:23
Anyone know if there are any signifiant performance differences from submitting functions to a ThreadPoolExecutor vs just creating threads for them? Assume the tasks are long running, not actual short tasks. I like the executor API, but not sure if it's really semantic for launching long-running tasks.
Hello, Christ is Risen.

Can I use python requests module to catch the response header? (only the header not the content because one url of the list is a radio stream, and the code "pause" there? For now i want only, the header.
I use sub_page = requests.get(url,stream=False,timeout=10), but it pauses there...
Yep, just send requests.head(...) rather than requests.get(...)
Nice!
Works!
Thank you.
 
5 hours later…
06:00
@aeyalcinoglu I'm not even sure why you would need asyncio for that. The closest thing to "streams" in Python are generators/iterators, which you get out-of-the-box with syntax support. There's no need for libraries, other than the I/O parts.
@alkasm They're pretty much the same for any significant work. concurrent.futures has some overhead because it has a tiny scheduler in front of everything, but when "tasks are long running" that is negligible.
Does anyone of you guys knows, or has hints on how to compare output of computations done with an identical model, with the same parameters, but on different machines, or using different compilers, in order to validate the reproducibility of the results.
The models may, or not, show chaotic behavior.
Is there a name assigned to this problem?
Is there a recemmended approach?
Is there a library that tries to address it?
Can this be benchmarked in another domain?
Working on comparing the output of climate models that are currently running on CPUs, with their output running on GPU clusters, in order to validate the results from the GPUs and give an indication that the model was correctly ported. This cannot be compared bit to bit for the reasons mentioned above.
The output consists of arrays of time values for a set of variables that are calculated by the model.
06:27
Struggling watching a YT tutorial on AWS DynamoDB, where the instructor consistently pronounces it "die-NAM-oh-dee-bee".
that is not how it is pronounced? O_0 time to check Emma Saying
@ReblochonMasque Knee jerk reaction: either 1. seed the randomness to make it deterministic if possible or 2. re-run multiple times on different environments and compare the statistics on the aggregations of the results. (mean, std etc). The assumption being, that the model with same params, if ported correctly, shouldn't vary drastically if you aggregate many runs
06:49
Yes @ParitoshSingh, good suggestions, thank you. Of course the randomness is seeded, this is a staple of reproducibility. Yes, comparing the aggregates, etc. is a possible crude approach; I was looking for a name for the problem (to have a handle on it), and hints to a generic approach; surely, if this is not a solved problem yet, there must be work and research going on that I could consult.
yeah im personally not sure whether it has a name or not. my google fu is failing me, though i did find a rather esoteric paper. (this one)
heres another
my best keywords to searches seem to be around "non deterministic code"
@python_user I don't think I know whether English is your first language, but the stress is on "DIE" for Dynamo
amusingly enough, this is one of those rare instances where apparently even american and british english are in agreement
@ReblochonMasque FWIW I'm not aware of such a tool. Usually, if I need to check behaviour of heuristics, I'm usually buried in CSVs and end up going through line-by-line to check logic. I don't think there's a good way to check non-deterministic models (and my god, you're trying to predict weather??) but I'd be interested if you find something
I don't know whether you can track convergence with your model? I'm usually guided by a cost function so you can look at the convergence profile of the cost function. What you describe might be more like CFD but I think that also has a convergence metric
Climate, not weather @roganjosh - yes, I am trying to skip the staring contest with massive csvs!
07:03
Ah, apologies, I've conflated them!
Yes, thanks for your input @ParitoshSingh & @roganjosh, appreciate it.
I am looking at your linked papers @ParitoshSingh :)
forgive my ignorance, what's different between climate and weather?
"The difference between weather and climate is a measure of time. Weather is what conditions of the atmosphere are over a short period of time, and climate is how the atmosphere "behaves" over relatively long periods of time."
https://www.nasa.gov/mission_pages/noaa-n/climate/climate_weather.html
Today's climate forecast: Same as yesterday
@roganjosh I see (and heard) the difference now, and English is not my first language :)
07:15
haha, that's the most likely @Aran-Fey
07:38
@ParitoshSingh I believe climate refers to standard environmental conditions whereas weather is refering to the current conditions
ah got it
 
1 hour later…
08:59
@Aran-Fey ah, yes. Persistence prognosis. Works on most days.
 
1 hour later…
10:29
I've just thought of a small optimization that cuts ten characters off a particular code recipe I use quite frequently. But I have a bad feeling that I've discovered this before, and then forgotten about it.
Optimization...ten characters?
Did you use the wrong metric? :P
#in no particular order, pair each element with its neighbor, and act as though the last and first elements are neighbors
cyclic_pairs = [(item, seq[(i+1)%len(seq)]) for i, item in enumerate(seq)]

#if only out-of-range indices wrapped around the end of a list, I wouldn't need modulus here...
#but wait, they _do_ wrap around. But only on the left.
cyclic_pairs = [(seq[i-1], item) for i, item in enumerate(seq)]
Correction: a staggering 11 characters
It's also one dunder method call shorter, and one Standard Obfuscation Unit smaller
Why are the pairs reversed? :P
ah, that's the point
both have pretty high SOU
The output isn't exactly the same, but it preserves the quality I'm most interested in
@AndrasDeak A staggering reduction in obfuscation from 1.001 kiloSOU to 1.000 kiloSOU ;-)
The next time I forget about this and reinvent a cyclic pair algorithm, I can search the room and see this message from Past Me saying: get some new material
Searching for "cyclic pair" now, this is apparently the first time I've done this
11:26
@python_user Don't know man, this is the name of my YouTube channel that I came up with when I was small? Prolly immature, so keeping it everywhere now :P
Experiment complete. In this image, the red shape is the result of tkinter's create_poly method with smooth=True. The blue shape is my own custom quadratic bezier spline poly. They overlap with near-pixel precision, so most likely the underlying algorithm is the same. Source: pastebin.com/E4HgFURH
I wanted to go whole-hog and let the user click on the image to add and drag around points for the polygon, but it's a pain. Feel free to make your own shapes the hard way by changing the assignment statement points = example_square()
the rounded square was inside you all along
11:35
def example_poly(n):
    assert n >= 3; return [Point(size/2, size/2) + Point((radius:=size/2 - margin)*math.cos((theta:=i*2*math.pi / n)), radius*math.sin(theta)) for i in range(n)]
Here's a quick method that will let you make hexagons and such
I'm really warming up to the walrus operator for writing code that doesn't need to be understandable
7
@Kevin Was going to ask that :P
If you want to undersstand it, it's basically just finding N equidistant points on the circle using the magic of trigonometry
Even if I wanted to, I couldn't, yet. Hopefully sooner
@Kevin ugh
:^)
11:39
I mean people come here
@CoolCloud now I am curious to go check that :p
Kevin upholding our reputation in the wrong direction :P
My real code has a sensible design but it's more fun to run it through the sausage machine before showing it
@python_user Nothing really, haven't uploaded anything in years now. You just have to type the name in YT. Thankfully it recognizes me.
Though I do aspire to make python tkinter tutorials after school or at some point. None of the videos I have watched explains the real concepts of mainloop and events in GUI programming, which is so important
yeah that worked, I know what I am going to spend time on this evening
11:42
@python_user Its no entertainment :p
I will let the actual on going productive convo continue now :D
~> which productive-convo
which: no productive-convo in /room/6
Well, technically producing confusion is still production
Ah, the "double a coordinate to make it a straight line" convention is indeed a natural consequence of the algorithm. It works for my custom version without me having to special-case it.
I was 90% sure of that halfway through implementation but I wanted to test it empirically
huh
Does the algo work with a 3-length moving window?
11:46
makes sense to me - a quadratic bezier curve is a straight line if its control point is collinear with its end points
@AndrasDeak If I understand what you're asking, yes
Happy to know yesterdays convo lead to these :p
OK, then I understand how
quadratic implies a 3-length window, cubic would be a 4-length
I thought it would separate even and odd points.
@Kevin the question was more about the moving window but you answered anyway
I wondered if it was doing even/odd as well, but I decided it wasn't when I drew the rounded triangle last night
... Although we may be asking different questions with similar presentation
For polygons with an even number of sides, you could move the window in increments of 2 and use only vertices as inputs for the bezier function, rather than vertices and midpoints.
Here it is, in red. A bit more football shaped than I imagined...
11:54
Rugby... :p
12:06
@CoolCloud Sounds like a fun project. If you want code review for that, give me a ping. I promise not to use the walrus operator.
Standing offer, in case it takes you a couple years to get around to it
@Kevin True, it is going to take a while. NGL, I was planning to ask someone to check for a review.
I will be happy to indoctrinate all of gen Z with my personal design philosophy >:-)
I draw a line in the sand and say, this far and no further, never again shall we do my_button = Button(root).pack()
Never
Literally atleast a single question a day will be, "Why am I getting NoneType object has to attribute insert" :/
12:16
Relatable
Unrelated topic. I understand why a lattice of points in 2d space can be generated by an arbitrary number of fundamental pairs, but it's surprising to me that there's no apparent way to get the "most fundamental pair".
Intuitively, when I look at the diagram of the blue and pink parallelograms on that page, the blue one seems "more" fundamental to me than the pink one. Is there no way to formalize this? Maybe something like "the parallelogram that most resembles a rectangle"
Maybe that's a valid objective criteria, but nobody uses it because it's really hard to calculate?
12:34
Yammin' wikipedia, can't even explain what a lettuce is in simple terms
Let me try. Draw any parallelogram you like. Then, tessellate it all over the 2d plane. The points where the corners meet are a lattice.
The simplest lattice would have the unit square as a parallelogram, and its points would be (i,j) for any integers i and j
What I don't get is why the two complex numbers are an ordered pair? How does swapping them affect the lettuce? (I'm gonna keep calling it lettuce out of spite until I understand it)
Wonder if I could use that concept to enhance my field plot design plugin which is only a grid of rectangles made from four reference points.
Also can't wrap my head around how the pink parallelogram is equivalent to the blue one
Good question. For all the ways I've been utilizing lattices in my projects, swapping the order of the pair would not have any impact at all.
12:39
Hmmm we had lattice in chemistry, basically the arrangement of atoms on 3d space
@Aran-Fey Try erasing the edges after you tessellate, leaving only the points. Then the blue and pink should have identical results.
I can construct a simpler example in paint, let's see...
Paint and Kevin, a better love story than twilight :P
Ah, now I get it. I couldn't figure out how you can reach the point w1+w2 if the formula for the lettuce is n*a1+m*a2, but that's just 2*a1-1*a2 (I'm pretty sure)
@Kevin yeah, probably no point trying
@Kevin at least in physics there is zero significance to the choice of basis vectors and corresponding unit cell
each gives a consistent description of the lattice
You could always go for things like "smallest relative circumference" to get a unique(ish?) choice, I bet.
12:49
@Kevin one thing we do use, but unrelated to the basis vectors, is the concept of a Wigner--Seitz cell. You'd call that a Voronoi cell in other contexts. That will give you squares here, although centered on lattice points.
I'm trying to see if "parallelogram with smallest dot product" is something I can derive in finite time
and it won't be rectangular in the general case
@AndrasDeak Promising, since the subjective thing I'm optimizing here is closely related to the concept of "closeness". Voronoi is all about closeness.
Yup. And we love the Wigner--Seitz cell because it reflects the symmetry of the lattice. For your case it's a square (four-fold rotational symmetry). If the parallelograms were rhombi with 60-degree acute angles then the Wigner--Seitz cell would be a hexagon.
i.e. when a1= [1, 0] and a2 = [1/2, sqrt(3)/2] in lattice constant units
Makes sense. put in a tessellation of equilateral triangles, get out a honeycomb
This reminds me of the concept of duals of polyhedra.
12:56
Now that you mention it, the dual space of the lattice is called the reciprocal lattice, which underpins the entirety of solid state physics (my broader field). And the Wigner--Seitz cell of the reciprocal lattice is called a Brillouin zone.
Very useful stuff :P
Must be Tuesday, I'm poorly reinventing the underpinnings of hundred year old fields
For what it's worth this is early to mid 20th century :D
(although the math for part of it might have been there for centuries beforehand)
I'll take it.
Maybe I should go up the XY problem ladder by one rung and explicitly define my "most fundamental lattice" as "whichever lattice ensures that all points within a rectangular region form a connected graph"
Wait, are you looking for lattices or lattice vectors?
Choice of points or choice of parallelograms?
Because I don't get your definiition
@AndrasDeak Choice of parallelograms.
I already know what my lattice is, now I want to find a "nice" fundamental pair for it
My Paint diagram is perhaps not totally rigorous because it doesn't stop you from drawing a region that contains one or zero points, and declaring Most Fundamentalness regardless of your choice of pair
13:11
hmm, I have a hunch something's missing here
Perhaps it is better to say that the traversibleness quality must be guaranteed for all regions of the plane
"arbitrary rectangular region" sounds way too general
Ugh, I have lost atleast 500 rep to this
Luckily you don't need to iterate over all aleph-2 regions (or however many there are), because any region that fully contains your fundamental vectors will always produce a traversible graph
@CoolCloud Relatable
I agree that "arbitrary rectangular region" could stand to be less general, ideally down to something finite and countable. But my brain is having trouble climbing that particular greased pole
Hmm, just knowing that a region is traversible if it contains both fundamental vectors, is useful for a question I had on a higher XY problem rung
Just wanted to share the following job opportunity in Texas or RTP. Great job and excellent company.
13:24
Ooh, I'm pretty sure there's no Most Fundamental pair for the lattice formed by the unit square rotated 45 degrees. I think my ship is sunk.
@Kevin you didn't specify the orientation of the arbitrary rectangle
and you can always orient your coordinate system such that one nearest-neighbour pair is horizontal
i.e. choose a1 to point along a first nearest neighbour
Right.
Well, the general case is doomed, but I think I have enough information to climb up another XY rung.
Actually, how hard is it to find the nearest neighbor(s) of the origin point? Maybe I can do something interesting with that.
Well, how is your lattice defined?
simple equivalent of gradient descent should work (you always have 2 directions to step in: always step in a direction that decreases distance)
I was toying around with an approach like that, but I had a nagging feeling that I could get stuck in a local minima somehow
I couldn't come up with an example though
en.wikipedia.org/wiki/… mentions "NP Hard", which is scary, but maybe it's still tractable for the 2D case
Superpolynomial big O complexity isn't necessarily so bad when N=2 :-)
@CoolCloud Damn, DELETE CASCADE
13:36
Oh hey, that page links to en.wikipedia.org/wiki/Lattice_reduction, which quite resembles what I'm looking for
"determining the shortest basis is possibly an NP-complete problem". So what you're saying is... There's a chance :B
@Kevin I doubt it
2d is key
> For a basis consisting of just two vectors, there is a simple and efficient method of reduction closely analogous to the Euclidean algorithm for the greatest common divisor of two integers. As with the Euclidean algorithm, the method is iterative; at each step the larger of the two vectors is reduced by adding or subtracting an integer multiple of the smaller vector.
I suspect the n in O(n!) is the number of dimensions here
Oh, nice. I was thinking earlier "I wonder if a GCD-like approach is possible" but I got tangled up in the extra dimension
I.e. the connectivity of your graph. In 2d you have pretty simple topology.
I thought I was doomed because scalar numbers are totally ordered, but two-element tuples aren't
Well, I guess there's lots of ways to define a total ordering of the complex plane. But they're less... Semantically meaningful than the number line's ordering?
morning cabbages, folks!
13:48
It's not an ordered field. Thank you google.
anyone here live in LA?
Anyway. At this point it seems quite likely I don't need an ordered field to do gradient descent, so now I have a useful avenue to explore
Hello people
14:07
@Avataar17 hello. Please don't ask for help here with fresh questions on the main site as per our rules
Thank you for pointing out. Sorry for inconvenience.
No worries, thanks for understanding :)
Hey Andras, MrBean Bremen helped me solve this as I code I wrote was fundamentally incorrect. He advised me to delete the post as it was not suiting to this platform. I am now not able to delete the post you just moved to another chat (python ouroboros).
Is it possible for you to delete it ?
moving to that other room is, for all practical purposes, similar to deletion for us. don't worry, already done
Thank you for help.
14:14
@Avataar17 yeah, you can just delete your question if there are no answers on it
having a link in our Knives room is harmless
If you really want the message deleted you can leave a custom moderator flag on the message, asking for it to be deleted.
can users who can see deleted posts vote on that post?
Let's see... "This post has been deleted; deleted posts can't be voted on"
Why would you be able to vote on a post that has been deleted for a reason anyway?
To twist the knife :-)
thanks Kevin, I sometimes find good answers and it suddenly disappears, maybe OP thought it was bad, if I could I would probably upvote
but I cant see deleted posts, and I got confirmation now that is not possible
AAB
AAB
15:07
cgb all,
I have a django app to submit posts. I want the text formatiing to be preserved.
Do I need a rich text editor plugin for this?
A google search leads me to tiny.cloud
any other alternatives folks here would suggest.
15:26
@python_user I mean it wouldn't make a change. The rep wont change at all.
15:45
Hmm, wordy, likes to correct other people... There are similarities, certainly.
But I have never used RedHat Enterprise 5, and I would not willingly touch the Windows protocol handler interface with a ten foot pole as long as an alternative exists. Let's call him a kindred spirit.
Oops, WM_DELETE_WINDOW isn't specific to Windows. Call it the "window protocol handler", then.
I suppose I don't have anything against the protocol per se, I just don't want to unwrap the abstraction layer that tkinter applied so diligently around the event loop, as long as it's not getting in my way
Same reason I don't embed C or asm in my Python scripts
@MisterMiyagi Thanks for the answer. The task I mentioned: github.com/devsbb/grover-engineering-recruitment/tree/master/… (no worries, I already sent my solution, just trying to learn) - Would you suggest doing this with generators/iterators?
16:06
@aeyalcinoglu Yeah, at a glance you can do all of them by a single sweep over the input. For example, for the first task you would iterate over the csv (using the csv module or the file directly), and write out each entry again immediately; the only persistent data would be a dict from rings to id – when you've seen a rings before, use the stored id, otherwise store the next id and use that.
Wow, even with the go-ahead to "feel free to make assumptions", I'd think thrice about even touching that task. What the heck is a "streaming application"? Why on earth does it need to be concurrent?! None of it makes any sense
Have you never forced yourself to execute a bad idea just to see how bad it is?
I couldn't take the responsibility of the architecture and put that csv file to a kafka producer, then handled/consumed it with Faust and then defined the [writing to a csv file] as a sink to that resulting stream. @MisterMiyagi This sounds much better. @Aran-Fey I am still trying to understand that, yeah, I hope I get a feedback from them.
they dont want you to use external databases, but they are ok with Kafka?
I often wonder how many ambiguous coding challenges are intentionally ambiguous as a way of gauging the coder's ability to infer sensible requirements, and how many are just poorly written. I also wonder if it really matters what the intent was.
16:11
@python_user I don't know, that's a good point.
@aeyalcinoglu Don't get me wrong, perhaps your approach is exactly what they were looking for. Since I'm paid to keep the lights on, I prefer to have as few lights as possible.
"I know, I won't specify which tech stack the applicant can use, because I want to reward a coder that chooses a tech stack that's appropriate for the scale of our business, both in terms of traffic load and available IT maintenance man-hours"
In theory this gives you an extra metric to judge on, but in practice it just gives your applicants an ulcer
Can one reasonably expect applications to just guess the appropriate tech stack these days?
Nope :-D
nothing is stoping the applicants from asking their experienced dev friends for the stack
16:17
@Kevin It also gives the applicant the opportunity to point out the firm's outdated tech stack.
Consider also the related approach, "I want the applicant to use the tech stack our business runs on, but I want them to figure it out on their own by googling our company's name and reading our 'about us' page"
"Work Hard and Happy Eyeballs"
"Ahem, I think COBOL is the way to go... coupled with dot-matrix printers and corkboard"
Challenge level varies from 2 to 9 depending on whether they need to figure out that you use Red Hat based on how long the beards are in the dev team's photos
Really long beards may indicate Fedora
16:21
tips hat
m'linux
@Kevin :P
 
3 hours later…
19:22
@MisterMiyagi thanks, confirmed my suspicions here.
@Kevin I mean, this is a reasonable thing to do in interviews right?
 
2 hours later…
21:02
Hello,
would like to know if anyone has an idea about an issue I’m having.
I have a python script where I convert an SVG file into a PNG using CairoSVG library. There is a custom font in the SVG file that I’d like to preserve when the conversion is done, so when creating the docker image (ubuntu as OS) I’m copy-pasting the font in the path usr/share/fonts and refreshing the font cache, but after that when the python script runs and does the conversion from SVG to PNG the font is not preserved. any ideas on what might be happening?
21:19
My money's on "the font wasn't installed properly"
the weird thing is that when I print all files in the fonts directory (usr/share/fonts) I do see font the added there, but I'm unsure if there is anything else I should do to actually have the font installed
Have you seen this?
that fc-list is promising
 
2 hours later…
23:55
New major versions of all the Pallets projects, including Flask 2.0, have been released! twitter.com/PalletsTeam/status/1392266507296514048
14
@Aran-Fey interesting, was able to list the font using fc-list but the text stills not being preserved when converting from svg to png. Found the same issue here but haven't been able to solve the issue github.com/Kozea/CairoSVG/issues/136

« first day (3860 days earlier)      last day (1311 days later) »