« first day (4021 days earlier)      last day (910 days later) » 

user16278360
4:18 AM
How to create individual H5 file for each video
 
6:40 AM
cbg
 
 
1 hour later…
7:52 AM
The fact that strings are immutable means that we cannot change its value right? But why are there replace methods that can change the value of the string?
 
they're immutable, but yes
 
Sorry, I was typing and hit enter by mistake :/
 
Presumably, the replace methods return a new string with the mutations.
 
Oh so the original string would remain same,
 
Did you try checking the documentation? I bet it says something like "returns a copy..."
 
7:54 AM
IDK it was so obvious, I'm being dumber by day :/
@CodyGray Yep it should, and I remembered it only after hitting the enter. Just not my day
 
8:13 AM
@Kevin why did I know you posted this, before even checking the name xD
 
8:38 AM
@HariprasathLakshmanan 1. That's way too much code for chat, 2. The answer is the same as when you last asked this chat.stackoverflow.com/transcript/6?m=52728125#52728125
Aean-Fey kindly spelled out what you have to do
*Aran, sorry
 
9:05 AM
is it normal in your last couple weeks at a work place to not be given new projects and just be told to document your prior code more?
 
@Kwsswart ...
 
dont meen new projects lol mean more like being told to not continue on the project you were on? once more just curious
 
yeah, it's a lame duck situation. not very nice for the duck, but quite common none the less
 
sigh, never a dull day on meta
 
9:21 AM
you still toying with the idea to become a mod, or why would you spend time there?
 
I kind of expected cs95 to be a late nominee, to be honest :P Glad to see that wasn't the case.
 
coldspeed is dead, long live cs95
 
sorry, edited
 
still got that snarky humor I see Andras ;)
@Arne this for me? o.o
 
ohh, I think found the drama 🌶️
@cs95 yeah it was
just beating the dead horse of "meta bad" though, so I'm not hurt if it doesn't deign a repsonse
 
9:26 AM
uh, I could've made a decent mod if I had my current level of experience and my past level of enthusiasm
The next time I nominate myself will be after rene becomes a moderator
 
good plan
 
@AndrasDeak I've forgotten how nice it feels to receive your complements
 
uhh, I just got a spam vote request on chat. never had one of those before
 
The joy of 10k...
 
10k?
it's been a while
 
9:31 AM
ah, that's why
 
With great reputation comes great responsibility.
 
on main I got a nice list with my new powers though, none of that for chat
 
@MisterMiyagi and a not so great experience if you ask Aran-Fey
 
With great responsibility comes a not so great experience.
 
 
2 hours later…
11:07 AM
cbg o/
 
Hey
 
How are you doing?
this NameError has been a trouble since last night: gist.github.com/TheLittleNaruto/…
 
@TheLittleNaruto what is the name when there's an import error at the top?
And there's no need for importlib
Ignoring errors like that, as you can see, is a bad idea
 
@AndrasDeak But then I get some dependency error(don't remember now "which"), that's why had to import this way.
 
If the import is necessary, stop if you can't import. If functionality is optional, check if the import worked when using the optional functionality (or even import inside the optional function)
 
11:18 AM
@AndrasDeak Do you mean I should print exact error rather than custom string?
 
@TheLittleNaruto I doubt that
@TheLittleNaruto you should stop execution when there's an error you can't handle
 
And yes, if you log the error yet aren't aware of the error, you're logging wrong
 
"I had to import it this way" is a weird thing to say when you did not, in fact, import it. You tried to import it and it failed
 
...And then I used importlib to import as a solution.
@AndrasDeak Noted and corrected.
Just to give you a background: I have configured flask in such a way that if request payload matches certain set of keys, then only it'll call the respective class from the module which was imported like the one in above gist. So each set has its own router class with a common function "route()"
 
11:26 AM
@TheLittleNaruto You tried to use importlib and it failed
 
There are more routers, importlib is working fine for them
Not sure why just this alone it's not working
 
If you remove the try...except you'll find out
 
@TheLittleNaruto NameError happens because the import failed, cartonCounterRouter does not exist when import failed.
 
Ok trying without try---except
 
I suspect the X in XYZ is a circular import
 
11:30 AM
Interesting
SO I removed this try_except and found, there is one module which was not installed in the virtual env where this flask code is running.
import core.utils as utils
ModuleNotFoundError: No module named 'core'
 
I bought some little bins to manage the messy piles of stuff in my office, but now I just have an additional messy pile of bins
 
@Kevin should have spent a bit more on getting a big bin - then you've only got a singleton to manage :p
 
This isn't a cryptic metaphor for the importlib problem being discussed, I'm just sharing. As much as I love cryptic metaphors.
I guess a venv is kind of like a bin...
 
the Right Way to bin your data
 
11:39 AM
Reading more carefully, I see nobody mentioned venvs before I brought it up. I guess I just assume they're involved whenever I see a problem of the form "I tried importing this thing, which definitely exists on my computer, but it can't find it"
 
you should re-read even more carefully :P
> was not installed in the virtual env
 
google.com/maps/place/Belgium/@51.0674749,3.6443286,9.71z/… can somebody recognize these lines? They look like country border lines, but are weirdly shaped, they seem to follow rivers, is there some weird law in belgium regarding state borders and rivers?
 
. o O {hmm, how can I move the goalposts here and maintain my dignity...}
virtual envs and venvs are different things!
. o O {nailed it.}
 
Could anyone help me about this question please? stackoverflow.com/q/69624969/11679204
 
Perhaps it's simply easier to form states whose border lies on a river. Then when you send the tax men out, they don't have to get their boots wet
@JeanExtreme002 I'm not familiar with that library, but I'll poke around the documentation
A return value of -1 often means "something bad happened", FWIW. Moreso in C and C-like languages than in Python, but I digress
 
11:47 AM
@Kevin so you do see what I mean? I was wondering if it's some weird rendering bug. Because the lines go away if you zoom in a bit, while other state borders stay visible. Kinda weird
 
If the question is, "are these lines some kind of territorial marking which are similar to, but distinct from, state borders? Or are they regular state borders that are buggy for no real world reason?", then I don't have much information for you
My understanding of European border lines, begins and ends at the country level
 
@Kevin or artefacts of the rendering itself and don't exist in the real world at all, but yeah they look interesting :)
 
For example I don't know whether Belgium really has "states" or if we're humorously using a US-exclusive term as a placeholder
 
They aren't closed lines
Either shipping routes(?) or just bugs
@Kevin our countries are normally states, so we have counties
 
The Internet tells me that sometimes Google Maps uses red lines to indicate transit delays due to heavy traffic or other poor conditions. Indeed, driving your car into the river is rarely the shortest path to any useful destination.
What even is a "state", officially
 
11:55 AM
Ask the state ;)
 
State - A current governing polity.
Polity - A politically organized unit; a state.
So a state is a polity and a polity is a state, thanks Wiktionary
 
I heard it defined having 3 things, people, land and borders. Although I might be wrong on the borders and those are included in land and there is a 3rd thing escaping me
 
If a state is an organized unit with recognized governing authority, then the kids playing King Of The Hill at the local park are as legitimate as, say, Norway.
Granted, only the kids playing King Of The Hill recognize the authority of the king of the hill (may his reign last a thousand years) but I don't see a requirement of universal recognition
Otherwise I could dissolve Norway by refusing to acknowledge it
Cynical definition: people, land, borders, guns
 
12:37 PM
I don't understand how a hash is not reversible. I was reading about the bit manipulation that occurs when sha 256 is performed. It's deterministic but not reversible which is hard to comprehend.
 
hash collisions exist, yes?
 
A hash function destroys information in some way or another. Imagine a hash function that takes a string as input, and the hash is simply the first 5 characters of the string. That's deterministic, but not reversible.
 
Compare hash(-1) == hash(-2)
 
what!!??
welp that's reversible
 
what is
 
12:43 PM
hash(-1) and hash(-2)
 
what is the value of hash(-1)
 
-2 and -2
 
-2 :P
 
@Dodge Is it? If the hash is -2, what was the input? -1 or -2?
 
@Dodge then what should unhash(-2) give. -1 or -2?
 
12:44 PM
I recall that there is a good reason for the hash values of -1 and -2, but I forget what it is
 
either, but I thought hash functions avoid collisions
 
Also hash((sys.maxsize-3)) == hash(0)
 
@Dodge if its "either" its not reversible, is it
 
@Kevin It's because -1 indicates an error during hashing.
 
Only two collisions out of 2^64 possible values, that's basically zero collisions :-P
 
12:44 PM
In a way, creating collisions is the whole point of a hash function
 
@ParitoshSingh you have a set, not super secure
 
morning cabbages, folks
 
@Dodge ?
i feel like youve misunderstood what reversible requires
 
Perhaps they mean "exploitable"
 
@ParitoshSingh I get it
 
12:46 PM
The CPython source code has some very good implementation notes on dict that should clear up many misconceptions about hashing.
 
but yeah, hash takes input from a larger space and cramps it into a smaller one. hash collision avoidance is a desirable property, but hashes are guaranteed to have collisions simply because its a finite smaller space.
 
Such as "similar input should have very different output".
 
a 1 to 1 relation, from a bigger space to a smaller space, such that the reverse is a one to many* (oops)
 
pigeon hole property of hashing
I guess it's clearer now
 
huh, i didn't know there was a term for it. that's kinda cool
 
12:52 PM
"If someone hands you three gloves you'll always have a duplicate for one hand", and that is why hashing is secure ladies and gentlemen :)
But a hash collision has never been found in sha 256. Back to being confused :)
 
sha 256 has an "insanely" large finite space
 
yes, and that part is clear
 
that does imply it's slower to compute, so it's essentially a tradeoff that is being made
 
they say 128 would've been fine but at some point the military wanted levels to security and created a 128 and 256
 
however yes, because it's a finite space, it's still not reversible, since collisions will exist, even if it's computationally infeasible to find one.
 
1:05 PM
It's kinda crazy how many tools exist that simply rely on hash collisions not occurring. The thought that git or even worse, a backup program like borg, could one day be like "I lost one of your files because it had the same hash as another file, teehee" is a bit sobering
 
Don't they also check things like filenames?
 
if would_collide():
    dont()
I've been informed by the git Gods that the chances of a SHA1 collision is the same as the Earth being sucked up into the black hole created by the CERN accelerator. If this is indeed true, then there's no need for that extra memcmp. , source: lwn.net/Articles/307281KurzedMetal May 3 '12 at 15:28
 
@AndrasDeak dunno. I can imagine that being the case for git, but I don't think it's possible for borg. It arranges all your data in fixed-size chunks so it can avoid storing duplicate data more than once
 
huh
 
Some of the answers in the above page suggest that git does not bother to check filenames or anything else. They don't cite their sources though.
 
1:12 PM
@Aran-Fey Are you sure the hash isn't just the bucket indicator, and there is some actual storage with metadata inside?
CEPH also uses a hashing scheme to place data, but each placement can (and usually does) have many items.
 
Hmm, I suppose that's possible. I kind of doubt it though. Just judging based on the size of my backup and a rough estimate of how much duplicate data I have...
 
Don't your duplicates have the same name? And can't it take into account changes, like git?
 
1:30 PM
While experimenting with my construction kit toy, I often need to remove some specific number of identical pieces from the storage bin. I often lose count if I'm counting manually, so I have devised an algorithm that requires no memory usage except for the target number.
 
Pencil and paper...? :P
 
1. Reach into the bin and grab X pieces, where X is the largest power of two that you can fit in your hand. In practice, this is usually 4.
2. Place the pieces in a pile on the desk.
3. While any two piles on the desk have identical size: combine them.
4. If you have enough pieces, stop.
 
That's basically "grab things until you're done", isn't it?
 
If you dump pieces into one big pile until it looks big enough, then you're depending on your brain's heuristic for guessing the exact count of items in a pile. If you use power-of-two piles, then your heuristic only needs to be closer to the correct power of two than to any other power of two.
"Does this pile have 256, 128, or 64 items?" is easier to answer than "Does this pile have 99, 100, or 101 items?"
If you're thinking "idk, sounds like a vanishingly marginal tradeoff of complexity vs accuracy?", yes, yest it is
 
I usually just dump everything on my desk.
 
1:38 PM
Valid
 
numbers bigger than 6 are a myth
 
anyone take a look at the new M1 Pro/Max chips in yesterday's launch?
 
heard reviewers are gushing over it, but i'll wait for said reviewers to actually get their hands on stuff.
 
I was motivated to find an accurate approach because picking up the bin and putting it in my lap strains my back a little, so I want to minimize occurrences of it. An accurate piece count requires one bin lift. If I guess too low, then I have to lift the bin a second time, and guess again, possibly guessing too low again and recursing indefinitely. If I guess too high, then the extra pieces will sit on my desk until the free space is too fragmented to be usable.
Defragmenting costs one bin lift and I can amortize it across about half a dozen piece allocations, so guessing too high is very preferable over guessing too low. But guessing exactly right is best of all.
 
You can solve repeated lifting issue by just getting more desks, one for each pile of contextual everything.
That's practically O(1) lifting.
 
1:45 PM
or.. you know.. just dont lift.
 
I made a little end table out of construction toys. It gives me another square foot of usable space, so I don't have to defragment as often.
 
that would be O(0), mathematicians and programmers alike would gush over this phenomenon for years to come.
 
I can't put the entire bin on top of it though because it's a spindly little thing
 
Any idea why this: nodes = subprocess.check_output("ping -c 1 172.0.0.1", shell=True).decode().split() returns:
subprocess.CalledProcessError: Command 'ping -c 1 172.0.0.1' returned non-zero exit status 1.
 
I'm unironically considering a pulley-based solution. But first I need to determine where the studs are in my walls
 
1:48 PM
@Hakaishin The Error should have an stderr field that holds the reason.
 
now I'm curious: what are you building?
 
@MisterMiyagi I don't follow? Do you mean nodes? Cause that nevers get's assigned. But os.system works, so I will use that
 
isnt that wrong for subprocess?
iirc subprocess takes arg-style commands, not a single string
 
@inspectorG4dget Whatever strikes my fancy. I put together an icosahedron the other day. About 20 inches tall. The hard part is forming an equilateral triangle from connector pieces that seemingly only allow 45 degree angles.
 
@ParitoshSingh hmmm, not according to some other piece of working code where I copy pasted this from
 
1:52 PM
@ParitoshSingh apparently no, single string is also fine
 
@ParitoshSingh For the shell=True a single string is preferable.
 
yep, i was mistaken, thanks
 
gothca
 
@Hakaishin If you catch the CalledProcessError, it should have the stdout/stderr captured so far.
 
@MisterMiyagi right
 
1:55 PM
The most versatile 2d connector has eight connection points for 0, 45, 90, ... 270, 315 degrees. Not much chance of getting 60 out of those. But I noticed something about the 3d connector...
If you place a rod in the "45 degrees about the X axis" slot, and a rod in the "45 degrees about the Z axis" slot, the resulting angle is 60. Or close enough that I could bend the plastic rods into an equilateral triangle without noticing
Exercise: find the angle between vectors U=[1, 1, 0] and V=[1, 0, 1]
 
I was just about to do that
 
:-)
 
>>> np.arccos(np.dot(v1, v2)/np.linalg.norm(v1)/np.linalg.norm(v2))/np.pi*180
60.00000000000001
ding ding ding
 
0.00000000000001 is well outside of the manufacturing tolerances for these pieces, so good enough for our purposes
 
yes, and I understand why
if you slice a cube perpendicular to a body diagonal, you can get three vertices on the slicing plane, giving you an equilateral triangle where all three sides are sqrt(2)*a long
 
2:02 PM
Very well put. And in fact this is exactly how I noticed the property myself. Although with much more confusion and ape-like grunting.
 
bah
(111) plane in a cubic crystal, top right
 
Eight year old Kevin could never crack the puzzle of the triangle, so the cheers of my inner child rang loudly
 
2:14 PM
is it possible to extract business contact data from an OCR text using primarly Named Entity Recognition? How would you train the model? Should there be multiple seperate classifiers that look only on a single data field?
The problem with regex is that due to multiple representations of contactdata and errors from OCR it cannot identify and extract data.
 
Sounds hard.
When asking "Is it possible to make an AI that solves this problem?", for any problem that a human can solve, the answer is "yes, theoretically"
 
2:32 PM
I'd recommend looking at the big book of baby names, to build a name recognition NER. Then use Google Maps API to detect addresses. And perhaps a locale-ized regex for phone number detection. In reality, you should need only two out of those three components and get the last from process of elimination
 
2:49 PM
ok but as for adresses, are there any ways without using Google as it costs. Would a model with all streets and cities be worth it? I thought of using open street map globe data and look for the street data field to train the model with it.
 
Are you sure using Google costs more than training a model "with all streets and cities "?
 
Should take about twenty million dollars and ten years
 
If the data is freely available i can use it for my algorithm, as for training, it will require some time.
 
Well, if you've already got the algorithm, and training only costs some spare CPU time, then it certainly seems worthwhile to incorporate street/city data and see if that improves your model. Why not, right?
 
Of course, better try than worry.
 
3:01 PM
Whenever I hear about machine learning systems with useful applications, it's always from FAANG or similar, improving their algorithms by a half a percent. I'd love to hear some success stories from indie developers.
 
@Kevin we do simple traffic sign monitoring with it. The machine learning part is used to make it more robust to noise(seasons, light etc.)
 
@Kevin It's used a lot in science these days. Experiment automation as in classifying and filtering data, and data analysis as well.
Not that all of these are useful, mind, but often they are more useful than alternatives.
 
if you're doing one-off 3d print jobs, it might be worthwhile to consider public libraries, etc that allow you to use their 3d printer for a nominal fee. Of course, do the math on the break-even point to see if buying the printer would be cheaper
 
If nothing else I ought to invest in a couple test runs at the library, to see if the model has the structural integrity and tolerances that I need
Browsing the comments field of related models, it seems like it's hard to get the snug fit that authentic pieces guarantee. Alas
 
Universities also allow externals to access their 3d-print infra
 
Ooh, Jet Pulverizer's website says they do 3d printing. I drive past their campus quite often on my journeys through Jersey, but I've never had opportunity to pop in. I have a severe lack of things that need pulverizing.
1-10 micron tolerance, that's about right for my needs
You know it's a high quality product when the site lists no prices, and instead says "call us for a quote"
The first challenge will be keeping them from laughing and hanging up when I explain my objective
 
4:14 PM
second challenge: avoiding the upsell
 
"Plastic is nice, but you know what's nice? Tungsten"
 
you know what's noice? Adamantium
 
@Kevin dental calculus, taxes, ennui...
 
My ennui can't be pulverized, it's more of a miasma than a solid. You may as well try to punch fog.
Perhaps I could simply trap it in the pulverization chamber, and weld the door shut
 
Isn't that how you get crystallized ennui? Doesn't sound like an improvement...
 
4:25 PM
Sounds like a problem for my distant descendants that dig it up 100,000 years from now, despite the ominous spiky earthworks marking the site as Not A Place Of Honor
 
or you just leave it there, like an immortal snail in a metal sphere
 
4:41 PM
I'd have to lease the floor space... I'll ask them if I can get a deal for becoming a long-long-long-long-term customer. Something like, 0% APR and no payments for the first 18,000 years
 
5:40 PM
ok I've been writing multiprocessing code for a long time, so I thought I'd try my hand at implementing a parfor (a parallel for loop). Could someone point out what I've overlooked here?
def parfor(iterable, func, num_procs):
    """TODO: Documentation"""
    qIn, qOut = [mp.Queue() for _ in range(2)]
    if num_procs < 0: num_procs += mp.cpu_count()

    f = driver(func)
    procs = [mp.Process(target=f, args=(qIn, qOut)) for _ in range(num_procs)]
    for p in procs: p.start()
    for i in iterable: qIn.put(i)
    for _ in procs: qIn.put(None)

    for _ in procs:
        for t in iter(qOut.get, None):
            yield t

    for p in procs: p.terminate()

def driver(func):
    def f(qIn, qOut):
 
Can you say what kind of overlooking you're looking for?
And what's wrong with multiprocessing.Pool.map? :P
 
@AndrasDeak I need more coffee XD
 
One mistake I can see is that you forgot to cram some of those loops on one line
 
@AndrasDeak not sure I follow... sarcasm?
 
don't forget the other mappy options (e.g. imap_unordered) if you don't need order
@inspectorG4dget yes :P
 
5:43 PM
much thanks. I think I need to step away for some coffee and try this again
 
have a good one :)
 
5:56 PM
Well, for one, your decorator-generated f function can't be pickled, so you have to give up on anything that dynamically creates functions. You'll need something like Process(target=driver, args=(func, qIn, qOut)) instead
And secondly, you're consuming the output queue once for each process, which makes no sense. You only need to loop over it once. Also, I don't see how there would ever be a None in there, so you'll need to think of a different exit condition
 
@Aran-Fey can't you work around that issue using an auxiliary class?
 
Yeah, you can
 
6:50 PM
@Aran-Fey can you use dill for something like this too?
Actually, it looks like it's all bundled up into pathos
 
I think dill can indeed serialize functions, but that doesn't really help here because you can't make a mp.Queue use dill instead of pickle
On 2nd thought, it might magically work just by importing dill. It can hook itself into the pickle machinery
 
I believe that import hook is one of dill's selling points
 
7:18 PM
Import with side effects? Smells like bad design
 

« first day (4021 days earlier)      last day (910 days later) »