« first day (3999 days earlier)      last day (1174 days later) » 
00:00 - 15:0015:00 - 23:00

15:03
With the help of the 2x speed setting, I have created Dvorak Symphony no. 4 [Nightcore remix]. It's not bad, it's got a beat and you can dance (frantically) to it
cabbage im back
having a strange problem. This is quite bean
theres this code
bruh
can you like, remove all of that code and put it in a gist instead?
@PeterBerrett Can you please take a look at our guide to formatting code? It makes it a lot easier to read when it's properly indented. ;)
I was about to say, now that your code has grown in complexity, it might be time to upload it to an external service such as pastebin or dpaste or gist
15:06
yeah, I really like gist.github.com when sharing different snippets that live in different files
This has the bonus effect of not mangling the important whitespace of your code, and you don't even have to read through the code formatting guide tinyurl.com/urnzp7k
when i google gist i just gastrointestinal stromal tumours
Me too, github's gist is like the fifth result
It's basically the only thing I don't like about the service
joke's on y'all, I was talking about digesting said code
Eating code seems appropriate for a language named after a snake
I think I've mentioned before, that when I am trying to understand all the moving parts of some difficult code, I imagine that I am engulfing it as if I am an amoeba
Methodically disassembling each piece until only molecular nutrients remain and it becomes a part of me
15:13
that's some next-level visualization technique
An amoeba is not what comes to mind when you think of that
I'm just built different I guess B-)
@Félix If you can get into Indian music, check out Anoushka Shankar (sitar) & Patricia Kopatchinskaja (violin): Raga Piloo. It's just under 17 minutes.
cabbage again
here's the problem nice and succint
@PM2Ring I very much can, and would say, very much am, thanks!
15:20
Watermelon
@PeterBerrett I already linked you to our room rules and specifically mentioned post length. We also have a formatting guide. Please be sure to read these before your next post
[item in file2new for item in k] doesn't look right to me. Not much point in turning k into a set if you're just going to iterate over it. Set iteration is no faster than list iteration.
Without having any understanding whatsoever of what the final goal is, I'm going to say, try [item in k for item in file2new] instead, and see if that does anything
but im iterating over example?
nd speed isnt the issue here
@Kevin I think I'm getting tired of the final goal. An MCVE has been asked for, but this problem keeps coming back
the issue is the shape of the result
the speed issue is resolved. the issue here now is why I'm getting strange results
15:27
I agree that speed isn't the issue. My point is that speed is a symptom of the fact that somewhere along the line, some wires got crossed, and a variable got put into a position where it no longer serves the purpose that it was intended for when sets were suggested.
@PeterBerrett Doing the wrong thing faster isn't a win
this is true
Have you verified that your example input gives exactly the True and False values you expect, in exactly the right position? Just looking at the shape of the results may not be sufficient
in the code and example i provided in the GIST link the example input is correct. You can see that yourself.
further down i then apply teh same subroutien to a larger dataset in my program
you can see the output. I incorporated print statements so you can see the type and shape of the variables as they are fed to the subroutine
Ok, well, go ahead and write up an MCVE that lets us replicate the problem on our machines, and I'll happily examine it further
15:32
i have a mcve for a small data set. im not sure how to replicate it for a larger dataset
it would be too big
Understandable. Making a tiny shareable dataset is one of the bigger challenges of good MCVE composition.
well ok i shall depart and try and replicate the problem in a mvce thanks
bye
Anyone ever tried to make a programming language?
Yeah
I like KevinScript
15:38
I'm unsure whether the programming language I tried to make (KevinScript) can be called "like" KevinScript. Is a thing like itself? It's a philosophical puzzle
That was a typo
I see. But I'm still going to think about the philosophy of likeness anyway
hmm
are you going to add dicts any time soon
It will probably be the next thing I add, but I don't have a deadline or a schedule for working on it
Others who can't recognize KevinScript, check Kevin's "about me"
15:42
Also I've discovered that hash tables are harder to implement than I thought
For one thing, you need a hash algorithm. Now I have to implement two whole things :-/
brb
I once made a language, and also didn't continue after lists
In the UK, we have a petition system whereby, if you get over 100,000 signatures, it has to be debated in parliament. Will you accept UUIDs for a KevinScipt petition for dicts?
I don't really understand that, can you make that clear?
I have a feeling I could muster that support...
I'm not in UK
is that a problem
15:45
@Félix For a change of pace after that sublime masterpiece, here's a bluegrass band, Mile Twelve. Their fiddle player is Bronwyn Keith-Hynes. They're performing Elton John's Rocket Man.
That was all to Kevin. However, what part is unclear for you, @WalidSiddik?
Hey can Everyone see everything in here?
I am getting confessed
Yes. It sometimes takes context to understand who is talking to who. But you're in a general chat
@PM2Ring hah, nice timing, and change :) as a suggestion of my own, I'll take your "are you into indian music" and raise you an "can you get into japanese koto music"? it's a full album 50m but there are markers for the pieces! youtube.com/watch?v=zSkcW5w_L1o
@Kevin Making hash tables is fun. ;) It's not so hard to make a good one for a particular purpose (I've done it in C), but it's hard to make a good, efficient general-purpose one, like Python sets & dicts use.
Python's hash function isn't fantastic, but it doesn't need to be. They decided it was best to keep it simple & fast, rather than to sacrifice some speed for improved pseudo-randomness. But there have been some advancements in hash functions & pseudo-random number generation (both crypto & non-crypto) since Python's hash function was developed.
@FélixAdriyelGagnon-Grenier I'll add it to my "Watch later" list. And I'll see your Japanese koto music, and raise you a Korean Gayageum. :) Luna Lee playing a very non-traditional piece: Jimi Hendix's Voodoo Chile (Slight Return)
A posted a bunch of music links here a few weeks ago. Here's some from a couple of top mandolin players. Although they started out in country / bluegrass / Americana, their both rather versatile. And they both like playing Bach. In fact, Chris did a whole album of Bach violin pieces that he transcribed to mandolin.
Sep 3 at 22:27, by PM 2Ring
A little bit of Bach on mandolin from Sierra Hull https://youtu.be/LSuUXQSMhrI Sierra with Chris Thile, showing off their superhuman speed & precision. https://youtu.be/DHznTAqc_3c
they're
16:27
@Kevin Except it wasn't, it was named after a comedy troupe. As you well know!
Python 2 was named after the troupe, but not Python 3. Yet another backwards-incompatible change
16:44
Brandi Carlile & her band (including a couple of cellos & a violin) doing an early Elton John piece, Madman Across the Water
@JonClements You may appreciate that one ^
o/
datatables.net can someone verify that this is infact down
Thanks
17:10
@FélixAdriyelGagnon-Grenier Reminds me of the time {relative} invited me to an authentic Japanese barbecue(?) place, where there's a grill in the middle of the table. The decor and food was authentic, but not so much the music. I expected something like your link, but instead I got Katy Perry.
{relative} argued that Katy Perry is probably played more often than Koto instrumentals in Japan, so it was sufficiently authentic. I was not consoled by this.
hah!
yeah, I share you unconsolement at the idea
Japanese guitar teacher, Maki Shizusawa, playing a little bit of blues, while wearing a kimono: youtu.be/33J15nBXVXw Some more blues from Maki, this time in Western clothing: youtu.be/33J15nBXVXw
My attitude towards Katy Perry in the general case is neutral-leaning-positive, so ultimately my total food experience was good anyway. Save room for the red bean paste fish-shaped cake.
I created a mental image of that place with zen little ponds and the sizzle and that sweet, perfectly cooked meats and now I kinda want to gril something.
I guess I'll head over to the JavaScript room /s
I so wanted a zen little pond, maybe some water pouring through a little bamboo aqueduct thing, into a deer scare that goes clonk every fifteen seconds
17:24
awww yisss, but I thought it was a epic-japanese-sword-fight-ambiance-enhancer
It can do both: "[These fountains were originally intended to startle [...] deer [...], but shishi-odoshi are now [...] used primarily for their aesthetic value.](en.wikipedia.org/wiki/Shishi-odoshi)";. Gotta have that aesthetic value for a proper sword fight.
Darn this finicky hyperlink markup syntax. Oh well, the link still works.
You can nest the square brackets, but you have to backslash-escape them, IIRC. Let's see... More Maki [in kimono again] doing Goin' Down
tsk, it should simply keep track of my square bracket nesting level ;-)
Or, as a more serious suggestion, seek forward until it finds "]("and treat everything before that as plain text
17:49
If a file contains only the characters [] what's the greatest number of bytes that file can contain?
However much will fit into the hard drive, I reckon
hmm, you mean if one creates a custom encoding?
what if it has to be valid json
I don't see why you'd need to create a custom encoding. file.write("["*100 + "]"*100) should work just fine with the default
Since you can arbitrarily nest JSON lists, however much will fit into the hard drive, I reckon
And it's valid json as well
17:52
oh sorry the file will only literally contain the left and right brackets once each
FWIW Python crashes on json.loads("["*(x:=1000) + "]"*x)
If the file can contain only one "[" and only one "]", I'd say the biggest file you can make is two bytes.
Is it that simple?
Unless you can do something clever with metadata...? Sort of a gray area about whether that counts, and which file systems would even let you do it
8 bytes with UTF-32
this is what I'm wondering--would a fetch request in javascript recognize a utf-32 encoded file as json parseable?
17:56
Two billion bytes with UTF-2^32, a format that I made up just now
Oooh, UTF-32 has a BOM! Nice!
I have skimmed through JS' fetch documentation for twenty seconds, and my educated guess is that you can ask the web server to give you a reply with any encoding you like, and the web server might even oblige you.
I... think the resulting Request object's json method is smart enough to look at the requested encoding before trying to parse it?
hmm it seems not
VM266:1 Uncaught (in promise) SyntaxError: Unexpected token � in JSON at position 0
it looks like fetch expects utf8?
Hm! Interesting
Yeah I guess it's not as flexible as I'd hoped
@MisterMiyagi Well, sure. The only UTF size that doesn't need a BOM is UTF-8 (& UTF-7), but some genius at a company that shall remain nameless thought it'd be a Good Idea to give it one.
18:05
There's a small chance that the server is simply poorly configured and sent you utf32 without indicating that it is utf32 in the response header. But I find it more likely that fetch is just being stubborn
(with the caveat that my psychic predictions are not well calibrated for non-Python scenarios)
I guess one can manually decode responses, but utf-32 and utf32 don't seem to be part of the TextDecoder ring: schneide.blog/2018/08/08/…
"The Unicode Standard neither requires nor recommends the use of the BOM for UTF-8, but warns that it may be encountered at the start of a file trans-coded from another encoding."
@PM2Ring heh... there was nothing wrong with EBCDIC - we should have stuck with that instead of this Unicode malarkey :p
@PM2Ring Now I'm somewhat freaked out that a text encoding "is known to have security issues". D:
en.wikipedia.org/wiki/Byte_order_mark advocates for the UTF8 BOM a little bit. Programs have an easier time guessing the format of a file if a BOM is regularly present.
@MisterMiyagi The example given on the Wikipedia page is, old versions of IE can be susceptible to cross-site-scripting if you get tricky with UTF-7. Sounds more like a strike against IE than a strike against UTF7.
I know which one I would rather keep, and which one I want to lock in a safe and drop in the Mariana Trench
18:18
IE wins in the "fond memory" category, TBH.
Those memories were implanted by a cross site scripting exploit
@Kevin it's only 6 or 7 miles deep (might have to cheat and and look that one up) - you couldn't find something else to throw it into? :p
There's the Kola Superdeep Borehole, which is 7.619 mi
It's humbling that Mt. Everest is only 5.5 miles tall
@duhaime is that the largest mountain in the world or is it that other one that's pretty much underwater but still a mountain...
K2 or something?
@Kevin That's true. The problem is that UTF-8 originally didn't have such a magic header, so by adding one, you're doing xkcd.com/927 Maybe it should have had one. Now UTF-8 is supposed to be compatible with Latin1, and it would've been easy to use a couple of invisible chars from Latin1 as a magic header. But there's this thing called CP-1252 which yams up that plan...
BOM killed the ASCII star! Oh-a oh-a!
Encodings confuse me and I'm glad that Python does 99% of the hard stuff on my behalf
@JonClements If you measure Earth mountain height from the centre of the Earth, then the winner is en.wikipedia.org/wiki/Chimborazo
Hmm, I'd say Olympus Mons is considerably farther from the centre of the earth than Chimborazo :-P
18:36
:)
Disqualified because its effective altitude keeps changing thanks to these darn epicycles
I actually did think of Olympus Mons before I submitted the previous message, but decided to keep things simple & not mention it. I should've known better. :)
I thought that you might have thought of it, so my Well Actually is more of a commentary on the difficulty of making meaningful measurements and specifications, than an earnest attempt to win pedantry points
In other words, I don't aspire to make anyone else look foolish, because it's more interesting to keep all the foolishness for myself
Meh - don't do that... that's my job! :p
@Kevin That planet distance program I wrote recently could actually plot it. But I haven't played with that aspect of Horizons yet, so I haven't studied those parts of the docs. I know you can specify surface locations in terms of latitude & longitude on bodies that have a defined prime meridian. I think you can also use named locations in some cases. You can certainly use official observatory names on Earth.
wim
wim
18:45
@Aran-Fey that is pretty funny. thanks for sharing
@JonClements Have your people call my people, we'll work out a sharing plan
FWIW, here's a plot of the Earth-Mars distance, using JPL Horizons data, for 2015-2025. The distance is between the planet centres, not surface to surface. — PM 2Ring Sep 22 at 16:59
Oh dear, I think that sine wave is ill
@wim badger badger badger (meme going through my head) - how goes it?
The velocity plot is even wonkier.
18:50
I have renewed respect for all the old-timey scientists that figured out heliocentrism using data as wonky as this
If you want to try other times, other planets, the full program is here: space.stackexchange.com/a/55061/38535
Galileo all like "the telescope got invented last Tuesday, what are we waiting for, let's crack this nut"
Well, they weren't measuring interplanetary distances. But it was still pretty tricky, subtracting Earth motion from Mars, or whatever. Fortunately, Earth's orbit is pretty circular. The eccentricity is only ~0.0167
And we've got excellent records of the Sun's apparent orbit. The Babylonian Astronomical Diaries span ~7 centuries, and they formed the basis of Western astronomical data.
...so has anyone here tried to make a proxy-using multithreaded script restart itself?
No, but there's probably plenty of material on SO on the topic of restarting a script in general. TLDR: Put a while loop around everything.
19:00
Well, yes. I have spent plenty of time experimenting with said material already.
If you want a totally clean and hard restart, maybe you could do something with subprocess... Start a new Python instance and kill the existing one with exit()
What I'm trying to do is basically to replicate ctrl+c plus running the script again from the terminal.
But I wouldn't resort to subprocess unless I had a very clear idea of what state I'm trying to reset, or what resource I'm trying to free, and why a regular loop can't do it
I'd hate to try writing something like that. It'd be very painful to test it if you messed something up & it filled up your machine with stuff that keeps restarting itself when you try to kill it.
I experimented with subprocess.Popen(), os.execv() and a bash script already. But I may be overthinking this already, missing the forest for the trees while consumed by this coding frenzy.
There is a (another) spot here for a while loop that I did not try yet, so here we go...
19:08
Do you really need the script to restart itself? Why not just have a cron job that checks to see if your script's still running, and if it isn't, the cron job respawns it. That'd be easier, and more controllable.
@PM2Ring Yes. I run everything on a Google Cloud compute instance. The one time it was apparent that there was stuff restarting, I could at least just reboot the machine quickly.
Oh, ok.
@PM2Ring The script itself does not stop. But in certain cases (too many threads not having generated any output recently, not enough data being processed per minute, too many exceptions* occurring per minute etc.), I'd like to restart the script.

* that happens rarely, only after a long time or when using too many threads
So I'm just trying to get some new ideas here or at least stop myself from fixating on a particular approach.
And you're sure it's better to add auto-restarting instead of fixing the thread-output/data-throughput/exception-frequency issues?
Is there any case in which the script is supposed to gracefully stop and stay stopped?
I've been working on the data throughput limitations the last days, as far as the software is concerned. Talked to a Google Cloud sales rep today to increase the vCPU quota, since by default one can only use up to 8 vCPUs per geographic region (hence machine). So I should be able to upgrade the hardware soon.
And the few remaining exceptions that do occur on occasion or after quite some time has passed are not particularly straightforward to deal with (since this mix of threading, selenium, virtual display and authenticated proxies is a bit of a pain).
The script needs to process about 500k rows of a .csv file with ~10 columns. Once it's finished, it should stop.
TLDR: It's needlessly painful at the moment to get the script to run for, e.g., 24 hours with no checks whether things are still running fine.
19:22
@SphericalCowboy This discussion reminded me of these Bash answers I wrote almost 7 years ago. They're only vaguely related to your problem, but they might inspire something. :) stackoverflow.com/a/26549587/4014959 & stackoverflow.com/a/26818947/4014959
@PM2Ring Thanks. I think "how ctrl+c works" would be a worthwhile read here, since ctrl+c and python3 script.py works just as intended.
Meaning, all threads/proxies are restarted/used without any issues.
If the Python program dies in case of <unwanted behaviour>, e.g. via ctrl+c, then I'd go for a shell loop.
NB: If you are already working with threads and don't need shared memory, then multiprocessing is a good alternative to scrub clean any stuck resources.
Thanks. Recently I tried to restart the script by calling a bash script (e.g., restart.sh) from within a Python script (e.g., script.py), like so:

#!/bin/bash
pkill -f script.py
sleep 10
python3 /home/.../script.py
But it seems there are still files, connections, whatever... which are still in use.
I have a question, after reading this: https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument?rq=1
Why aren't default parameter values for a function stored in its `.__dict__` if they hold state throughout all fucntion calls?
20:12
ooh , theyre stoed in __defaults__ instead.
 
1 hour later…
21:14
Can someone rewrite the 2 sections of code here web.archive.org/web/20200221224620/http://effbot.org/zone/… (under Valid Uses for mutable defaults) I have tried with the following, but dont get the abnormal behaviour the author alludes to in the first example
def hello(a,b,callback):
    print(a,b)
    callback()

for i in range(10):
    def callback():
        print("clicked button", i)
    hello("ButtonObj", i, callback)
author's explanation
That's not a mutable default though
good point, ints are immutable
You're not getting unexpected behavior there because you never use the callback function(s) outside of the loop. Try this:
functions = []

for name in ('foo', 'bar'):
    def print_name():
        print(name)

    functions.append(print_name)

functions[0]()
21:59
@Aran-Fey aran could you tell me, if you return a function as a first class object, is the function's header being executed again? (aka being redefined again)
Of course not
ok then, but why do these two objects have different defaults
def out():
    def foo(a=[]):
        a.append(5)

    foo()
    return foo

b = out()
c = out()
c()

print(b.__defaults__)
print(c.__defaults__)
>> ([5],) and >>([5, 5],)
Because you called c but didn't call b? I don't understand what's supposed to be surprising here
shouldn't a from b and c point to the same object?
No, every time you call out you create a new foo function
22:04
def foo(a=[]):
    a.append(5)
    return a

print(foo()) # [5]
print(foo()) # [5, 5]
print(foo()) # [5, 5,5]
what about this behaviour then?
You're calling the same foo function 3 times
but didnt you say that each time I do foo() I create a new foo function
No, each time you call out it executes a def foo, which creates a new function
oh hold on, misread
Because that's what def does
22:07
Oh, I see, so each time I do out() it is running def foo().. again and when I do return foo it is obviously returning the new foo function created earlier
thanks a bunch
00:00 - 15:0015:00 - 23:00

« first day (3999 days earlier)      last day (1174 days later) »