« first day (3338 days earlier)      last day (1600 days later) » 
00:00 - 19:0019:00 - 00:00

7:00 PM
@JonClements I have a Total Perspective Vortex right here, which will tell you exactly where you are if you place a bit of fairy cake in the scanner and step inside...
Oh, and sign the liability waiver first
 
What, if anything, can be done with the following? Now that downvotes are clamped at going below 0, we'll get confusing titles from things like this already-closed-as-dupe question Adding different elements to the list with conditions Python - return a tuple whose real intent was "check if a string contains Cyrillic characters". SO search will become ever more congested..
 
@smci "downvotes are clamped at going below 0", no they aren't
 
... with low-relevance question titles. Presumably this ain't gonna improve Google indexing of SO either. Should that question title be left as is?
 
unless I missed something huge
 
7:05 PM
Proposal: clamp question scores above zero, but all questions start at 10
 
@AndrasDeak Ok I misspoke. Anyway I'm asking, given the title is way offtopic to the question intent, and is going to generate lots of false-positive matches on anything related to 'list', 'tuple','condition', 'string', should we edit the title or downvote? (if the poster who identified it as a (near-)dupe hadn't also posted an answer which said it's a dupe, this would get auto-deleted if downvoted)
@Kevin Seriously though. Do we clean up junk question titles like that?
 
is there a canonical dupe for "missing global after overwriting in a function"?
 
Old hands will know that a Q with a score of 5 is not worth their time, but the neophyte question asker will be pleased that they're so far in the positives. Everyone wins :-P
 
this convoluted question appears to simply miss a global numbers declaration
 
@MisterMiyagi Hmm there are lots of similar questions on scoping. Also need dupes.
 
7:07 PM
@smci What about just editing the title?
 
I usually prefer not polishing sand
 
@AndrasDeak Try excessively compressing ;)
 
@Code-Apprentice Yes, that's what I'm asking the room consensus for. In the past I would edit misleadingly broad/vague/false-positive-match titles like that, but a handful of users would object. I'm asking for the consensus here on whether to edit title/ downvote/ ignore.
 
@smci No reason you can't do 2 of 3.
 
@Kevin You and Andras are misunderstanding my question. I'm not asking "Was this question worth answering". I'm asking "Which of those actions (edit title/downvote/ignore) can/should we take to prevent offtopic titles from generate lots of false-positive matches on anything related". Because this will degrade search and inbound Google indexing even further.
 
7:12 PM
I'd ignore closed questions unless they can be reopened after the edit.
That's my answer.
 
I understand the question. I elected not to answer it, and instead went on my own tangent brainstorming unrelated site administration policies.
Ok, now I am electing to answer it. I vote for "edit title".
 
@smci my general inclination is to edit the title to be more specific
 
Oh boy
 
...with that said, I also understand the argument to leave it be if it's not well received.
 
"Oh boy" what? I'm just polling people's recommendations.
 
7:25 PM
I'm just being enthusiastic
 
Oh boy, oh boy, oh boy!
 
Heya, maybe I shoud ask this in a html/js group but..

I'm trying to use BeautifulSoup4 to extract urls from a specific element in webpages.
The url is part of an <a> tag, that looks like this in chrome dev-tools

`<a href="www.the_url_I_want.com" class="result-card__link">`

I can get that specific element in bs4:

`soup.find_all('a','result-card__link')[0]`

Then, the output looks like this:

`<a class="result-card__link" href="{{searchResult.url}}">`

Is that some kind of django template tag? Can beautifulsoup get me that href? Or am I going to need to use selenium to 'simulate' browsing
 
AFAIK Template engines typically don't send template information to the client's machine, so it should be impossible for requests or urllib2 or whatever to access it. For that reason I suspect {{searchResult.url}} is not a django template tag.
 
Okay, so instead the data is being populated with javascript, then?
 
wim
Oh good, they changed "Put on hold" back to "Closed"
 
7:40 PM
By the way, will the regex-based test for Cyrillic be faster than than non-regex (neglecting the once-off time to compile the regex)? i.e. bool(re.search('[а-яА-Я]', name)) vs if [all(c in '[а-яА-Я]') for c in name]
 
Google tells me that there are several clientside templating languages written in js: slant.co/topics/30/~best-client-side-templating-libraries. So it does seem likely that the href is being populated by js after initial page load.
Perhaps you can look at the scripts tab of your browser developer tools and see which js library they're using, if any. Vue, Handlebars, etc.
 
wim
@Kevin I can tell you the "answer" here, but it might be a spoiler. let me know.
 
@wim Well, it wouldn't be a spoiler for me, since I solved the problem (via non-numpy means) a little bit after that conversation. And it's a problem from 2015, so I don't think anyone else is invested in preserving their knowledge purity. So I think you're in the clear
@MitchellvanZuylen ... But regardless of what kind of templating they're using, it probably won't be easy to get the value with just BeautifulSoup. Unless your reverse-engineering analysis goes real smoothly, it would probably be easier to just use Selenium.
The best case scenario is the searchResult is the response payload from an AJAX call, and you can determine searchResult.url by making the same http request that the AJAX call is making.
 
@Kevin Thanks, I'm gonna try mess around with the dev tool and then probably just resort to Selenium
 
7:54 PM
@smci why arent you using unicodedata
 
8:09 PM
I have a very esoteric SQL question, if anyone wants to take a crack at it
let's say I have two tables: A and B. For the purposes of this exeercise, let's say the have the same columns, but possibly different rows. So for example, they could be personnel information for different regions. But since people move, some might appear in both tables, while others may appear in only one.

Both have personnel_id as keys. So, that's what I'll join on
select *
from A
LEFT JOIN B
on B.personnel_id = A.personnel_id
does that give me everyone in A, but not in B? or everyone in B, but not in A?
notice that the table order in comparison is inverted, as compared to the selection order
 
@inspectorG4dget I've seen stackoverflow.com/a/4715847/5067311
Ah, I see. Is it expected that = might be non-symmetric?
 
nono. = is symmetric. But I want to know whether LEFT and RIGHT are assigned by SELECT order or by comparison order
 
I don't know any sql but it starts with select * from A
if it does anything other than select only items from A it was designed by a madman
 
I'm 90% sure that on B.personnel_id = A.personnel_id has the same behavior as on A.personnel_id = B.personnel_id, and that what matters is the from A LEFT JOIN B order
 
though I guess this reasoning would disqualify A right join B...
so back to the SQL people
 
8:17 PM
that's what I thought as well. I'll check with the SQelites! Thanks :)
 
@AnttiHaapala How would you test for specifically Cyrillic, as opposed to just any non-ASCII characters? Would you need to do something like this?
 
wim
@Kevin OK, so - often when you want to get the neighborhood around a point it's because you want to do something similar like a convolution. but most of those ops will support a "mode" argument to take care of the bounds how you want (e.g. scipy.signal.convolve2d and specifying the mode="same" kwarg)
in the case that you want to do something weird and non-linear with the neighborhood, you can usually just np.pad the input with the half-width of the kernel (as I think @JonClements was already alluding to)
 
@inspectorG4dget, here is a little test sample that may be helpful.
 
wim
it's a bit tricky to explain but if you check my aoc2015/q18.py you'll see it in practice - no manual bounds checking to be found.
 
When I was poking around google, I did see a solution that used convolve... I think their particular cellular automaton had wrap-around behavior
 
8:25 PM
@Kevin ooh! thanks
 
wim
@toonarmycaptain yes. it's super handy.
 
It was this one iirc
 
wim
yeah conways game of life had an AoC puzzle one year too
I forget which year/day
 
That's the one I was working on :-) it's from 2015.
 
wim
ahh, it was exactly that
you're right. 2018/12/11 and 2018/12/18 were also convolution puzzles.
 
8:32 PM
2018 day 12 bothered me because the second part isn't necessarily solvable in a reasonable amount of time for arbitrary inputs. Some automata, such as Rule 110, are Turing complete, so there can't be a way to jump to some far-future state in constant time.
I suspect that none of the starting states and rules given as input are capable of simulating Turing machines, but I like that kind of detail to be guaranteed in the problem description
 
wim
yeah that was one of those ones where you had to find a short-circuit wasn't it
 
Yeah.
 
wim
the first time he used that trick it really threw me for a loop (no pun intended). but after the 3rd or 4th time seeing the same trick, I kind of got used to it...
in 2019 it will be wise to get a bit familiar with intcode and have a good IntComputer because you can bet there will be some optimization puzzle soon where we're going to need to monkeypatch intcode
 
I'm tempted to write up a nice intcode GUI so I can inspect program state more easily
Unfortunately you can't unambiguously decompile the ints into human-readable instructions/parameters, because an integer could easily be both at different times, or neither
You can make some educated guesses though. A number like 23 can't be an instruction... Yet.
 
wim
@Kevin someone already did a js GUI for it on reddit
a good old import logging and throwing a log event into the main loop was enough inspection for me.
my IntComputer is still very ugly but it works for both day 2 and 5 for now, I'll clean it up later
 
8:48 PM
I wouldn't mind someone checking out my intcomputer: view spoiler
 
My intcomputer is just a big switch if-elif block. If it's good enough for Python's bytecode executor, it's good enough for me.
 
wim
@Arne very! great minds...
 
Who needs OOP when you can write a really really long function
 
@wim our run methods are nearly identical.. including the name
 
wim
8:50 PM
our handling of the instruction pointer seems to be the main difference
you didn't refactor your day 2 to use the emulator?
 
no, but I used it's tests to debug my day5 =D
 
I'm amused by raise IntComputer.CatchFire
 
wim
yeah it overheats a little easily. by design, not a bug.
 
so I theoretically could just drop it in and it should work. but yeah, my handling of the pointer might have been a mistake, since the execution order in the op_funcs is now relevant =/
 
I didn't bother to retrofit my day 2 solution either. I'm probably going to have half a dozen increasingly sophisticated versions by the end of this.
 
8:57 PM
it seemed like a good idea to pass in the modes as a generator, I regret that now
still looks fancy though
 
wim
I was thinking to override __getitem__ so that I can just reference registers relative to the current instruction pointer position (and also handle the POSITION/IMMEDIATE mode thing directly in there)
not sure if it will DRY things up, or just make things worse for later...
 
like self[idx]?
 
Perhaps self[idx] can refer to absolute position idx, and self[:idx] can refer to the address instruction_pointer+idx
Cross your fingers that you won't need actual slicing behavior later
 
I'm wondering what y'alls thoughts are about how these AoC problems and professional employment compare. I'm cognizant that programmers won't be solving these sorts of problems in their day jobs often, but in terms of the problem solving/debugging skillset to solve these problems and the within-a-day cadence, if tehre any relation?
I'm wondering how close I am to being hirable, or if I'm probably employable right now, lol.
 
9:12 PM
My IntcodeInterpreter is basically the same as everyone else's. Except you Kevin...
 
@smci your problem is rather simpler...
 
@smci
>>> class UnicodeNamePrefixTester(dict):
...     def __init__(self, prefix):
...         self.prefix = prefix
...     def __missing__(self, key):
...         self[key] = unicodedata.name(key).startswith(self.prefix)
...         return self[key]
...
>>> cyrillic = UnicodeNamePrefixTester('CYRILLIC')
>>> cyrillic['й']
True
>>> cyrillic['a']
False
 
wim
@KieranMoynihan nice one
 
wim
9:32 PM
gone, maybe you can return the and delv in here stackoverflow.com/questions/12332975/…
everything except the answer from user Aaron de Windt can go.
 
@wim protected,
@wim this one is fine too: stackoverflow.com/a/58040520/918959
 
@wim that's not how it works but I'll take a look
 
wim
@AnttiHaapala I don't think so. Management of dependencies and using the dependencies needs separation of concerns, I can't think of any good reason to have them in the same .py module.
 
@AndrasDeak you can downvote everything that doesn't have sys.executable, all of them are bs.
@wim I've done that many times
it is the odd one file util somewhere :D
instead of telling ppl "install this that that, take the requirements.txt, blahblah, whatever" i just say "just run it"
@AndrasDeak also, downvote anything that says _internal.
 
wim
if someone ever tells me to "just run it" on a script which attempts to pip install code on my machine, I will throw it back at them
 
9:42 PM
@wim I got one more -1
 
wim
even one file utils should have the project metadata, should they have 3rd party dependencies needed.
 
@AnttiHaapala I like the one that does sudo pip install via os.system
 
@wim except that practicality beats purity :P
anyway, I got some more to sub-zero
installer = lambda : pip.main(['install', str(e)[15:])
WAT?!
 
wim
@AnttiHaapala so....was it you that put the python3-dateutil and jeIlyfish onto PyPI, then? ;)
 
@AnttiHaapala needs more asspressions
 
9:46 PM
@wim if the maintainer is ztane then yes, otherwise no.
 
For pip 9.1.1 and python 2 only this works — Mr Alexander May 20 at 12:54
comment from this May, what the yam
 
wim
@AnttiHaapala haha, that one is hilarious
also importer = lambda x : __import__(str(x)).import_module()
what is even the .import_module() part
yo dawg we herd you like import errors
 
I added a bounty
 
then you better favourite it because in the next week everyone and their hairdresser will want to add their two cents
 
yes, I'll be actively downvoting them
@wim actually there is not a single answer that is correct.
In fact this answer is wrong too. You must use check_call or similar to find out whether it actually succeeded ;) — Antti Haapala 10 secs ago
 
10:01 PM
@AnttiHaapala Neat, please post that as an answer to one of the questions I cited and I'll upvote. We need up-to-date answers.
 
@smci it is not that the others are not correct.
unicodedata.name has been around for quite a time.
but it is difficult to deduce the script used from the unicodedata.name...
 
rhbrb all :)
 
rbrb
sssh, let him figure it out
plus it's the season for riddles :P
 
@KieranMoynihan thanks for clarifying. i meant if i typed any digits so the program will not printing the error MSG
 
sniff is someone making a caesar salad?
Rhubarb I'm going home, best of luck ;)
 
10:14 PM
@AnttiHaapala Yes I'm aware of that. But it's the more elegant Pythonic solution, so it deserves to also be shown, and upvoted.
 
@smci well it is there now.
 
wim
@AnttiHaapala Good point, I just edited it. And removed all the cruft referencing to other answers.
 
@wim actually the -m pip is not correct either :P
because it will add the current working directory into the Python search path...
and will import whatever garbage is there...
 
wim
@AnttiHaapala nah that's ok since everything pip imports will be under _internal or vendored
 
so you just need to make a temporary directory then cd to it and run pip from there.
... except all the system modules...
 
wim
10:29 PM
hmmm. let me see if I can reproduce a pip failure due to stdlib name collision
hmm, yep, you were right
echo "assert 0" > locale.py
python -m pip --help
breaks "python -m pip" but doesn't break "pip"
 
You probably haven't noticed but we're helping you.
 
wim
I think running from a temporary directory is overkill though, the failure mode here will be pretty obvious and if you leave stdlib name collisions lying around in your project directory you are stupid anyway.
 
@wim that second part isn't really applicable on SO. Think of all these
 
wim
what's not applicable?
 
OK, not second, but last part, about collisions lying around and being stupid
a lot of people make stupid mistakes, and a lot of people create colliding module names
 
wim
10:35 PM
maybe all those people are stupid :D
 
@wim it need not be in your project directory, but current working directory.
 
@wim for the purpose of this discussion that is irrelevant :P
 
wim
@AnttiHaapala yeah, I get it.
heading out, bye!
 
and when I pointed out that adding the current working directory to the module search path for -m is IMO a rather stupid security bug...
 
I remember that one
 
There's a job advert asking for "Strong experience in one or more high-level data-oriented languages (e.g. Python, Go, etc.)". Would you really group Python and Go here? I thought Go was for concurrency
 
I don't know, but one could argue that python itself is not data-oriented (either)
 
Also true; I assume it means the ecosystem in that case. I've seen some impressive stuff in Go so I was wondering whether it had expanded into things that e.g. numpy/pandas does
 
@roganjosh Go is commonly used for backend dev, so overlaps with Django or Flask in Python.
 
A nice-looking job, though. At some point, I fear I'll have to go back to London (I'm not eligible for that job) but the wages are just so disproportionate.
 
11:07 PM
what's it take to get a work visa there?
 
From where?
 
I'm in the US
hmm...what's a "data-oriented" language, anyway?
 
I suspect that would be about as easy as it gets in visa terms
 
WTF does that even mean?
I think that company is making up "buzz words" for the job description.
But is it a buzz word if no one else uses it?
 
That makes it novel
They're cutting-edge, you see
 
11:10 PM
> A natural ability for ETL -- doing this in your sleep
Had to Google ETL
 
Yeah, that's where my credentials fell apart (though I do dream about coding)
 
I have done so as well...but not recently
I had a dream about coding in ColdFusion once...more like a nightmare
 
Well, you're not equipped to synergise their backwards overflow, sorry
 
@roganjosh I think I'd qualify...
 
Probably. With that kind of salary, it wouldn't even be worth contracting, you might as well take the employment perks
 
11:15 PM
isn't 150k in london like peanuts
 
Not outside of finance
Up north, that's just silly money. I don't think it's possible to get a job up here on that salary without being a director. That's part of the reason that England is such a divided mess
 
well, I could contract for them for that 150k gross, almost.
though I do not want to do ETL.
.. but ETL and pipelines has been the tshi I've been doing lately. :(
 
Let's just say that I contracted at close to that amount and then found out people were charging double
The project was... interesting. They decided to pull things in-house to avoid the extortionate fee they were paying for software. More than half of the "in-house" staff were contractors. Bonkers.
 
@Code-Apprentice fortran, MATLAB. Latter is also high-level.
 
11:33 PM
@roganjosh isn't that standard
 
Possibly, but it caused them to go through a boom-bust cycle because they're reliant on contractors
It's a false economy; just increase the salary of actual staff rather than keep it low, find nobody to take the position, and then have to take on contractors who can walk away any day.
 
Stupidity tax comes in many forms
 
They had to lay off 1200 just as I started. Fantastic company to work for, but every ~4 years they hit a problem
 
not so perfect for retirement :D
 
Nope :)
This kind of logic is everywhere. Only today, I went to the shop across the road and suddenly he's decided that he's going to charge me for using my card for purchases under £5. Not only do I think that it's actually illegal, but I'll just make sure I never have to go back there again. I spend at least £10 a day there on cigs. So, a baseline £3650 revenue lost
 
11:47 PM
you could also group your daily purchases together and pay more than 5 quid per visit :P
but I understand the sentiment
 
Another example: the place I'm currently working. People were taking lots of breaks and the supervisor got yammed-off. Under the current system of people taking too many breaks, they made sure that the machine was covered so it could run. To stamp the problem out, the supervisor decided that the machines should stop, to force people to take breaks at the allotted time
So now they pay people exactly the same wage but the machines have to physically stop. But, damn it, they're doing as they're told <slow clap>
 
This is probably related to the philosophy of quality assurance. Some people prefer reproducible mediocrity to something that is sometimes brilliant and sometimes terrible, others don't.
 
@AndrasDeak so those are examples which kindda helps to clarify. What does the term "data-oriented" actually mean?
 
It doesn't mean anything
 
@Code-Apprentice I agree it doesn't make unambiguous sense. But if I had to make sense of it, I'd understand it as "languages where multidimensional arrays are first-class citizens". Your mileage may vary a lot.
this says more about my experience than about the meaning of the term, really
 
00:00 - 19:0019:00 - 00:00

« first day (3338 days earlier)      last day (1600 days later) »