« first day (3124 days earlier)      last day (1816 days later) » 

5:00 PM
@lmao mostly experience and practice, lots of practice.
 
@Kevin: Thanks for that link, read it.
@Code-Apprentice: I concur. But, how to do things like that stack-thing, kevin just posted. Do I need to strengthen my understanding of OS along with one language of my choice?
 
experience and practice are good, but you also have to have a way of discovering new stuff - I learned a lot about the standard library (itertools, shlex, contextlib, pathlib, ...) from being active on SO, for example
 
The stack-thing I posted doesn't have much to do with OSes. Quite a lot of C is platform-independent.
 
which reminds me that we haven't had any puzzles/coding challenges in a while, which is kind of a shame
 
I learned a bunch about Python and Pandas by asking questions on SO. then at some point I thought I would give back to the community by answering questions. I learned soon after that that answering questions taught me more than anything else I've ever done.
 
5:09 PM
@lmao start with a basic understanding of stacks, possibly by implementing one and using it in an algorithm
 
@piRSquared: You are right, I should start answering, that way I will dig things deeper
 
A lot of my current learning is from reading documentation to find a solution to a current problem. I stumble on things that I note will be useful in the future.
 
You'll learn from the good answers. You'll learn from the bad answers. You'll learn from your own answers.
5
 
@Code-Apprentice: That stack implementation, doing it today itself! :)
 
Hmm, it seems I haven't posted this one yet:
# What's the output of this code?

class Mystery:
    def __init__(self, *args):
        if args:
            print(args[0])

obj = Mystery()

class Unknown(obj):
    pass
difficulty: very(?) hard to understand, but not overly difficult to guess
 
5:18 PM
@Kevin Tell that to Vim :P
 
Inheriting from something that isn't a class object seems... Foolhardy.
 
Seems interesting. Also seem like it should work?
 
We're only doing it for educational purposes. No code base has been harmed in the creation of this code snippet.
It does indeed "work", i.e. not throw an exception
 
docs.python.org/3/reference/… indicates that "a base that appears in class definition [and] is not an instance of type" is legally allowed tho
 
Yes, it won't throw any error
 
5:21 PM
I don't think obj has a __mro_entries__ method, and I'm unclear what happens in that case
 
hmm, is the sopython spoiler obfuscator broken?
I'm clicking "encode" but nothing's happening
 
Same.
 
ah well. This'll do as a hint, then: stackoverflow.com/q/100003/1222951
 
yeah
it appears to be, as they say, broke
 
Clicking on previous "view spoiler" links in the transcript still leads to the correct unspoilered text, so that part is working at least
If Firefox hadn't disabled all of my user scripts this morning, I bet I could use my embedded spoiler button as usual
 
5:29 PM
is that because of the "I disabled all your addons because they're not signed" thingy?
 
Yeah.
 
rip addons 2019-2019
;(
 
I found a workaround for that
copy/paste the JS code and it's all bueno again
 
My other laptop spontaneously re-enabled all of my userscripts after a day or so, so I assume the same will happen on this one at some point
 
@Aran-Fey and also building a strong foundation in data structures and algorithms (cc: @lmao)
 
5:32 PM
I'm still lacking in the algorithms department :(
 
@Kevin I used a workaround using tests
 
@Code-Apprentice: I hope people keep posting and answering such puzzles...I will be super intelligent Uncle Bob then :)
 
@lmao if you are interested in puzzles, check out Advent of Code
Project Euler and rosalind.info are both good sources for puzzles
 
Hmm, still unsure how metaclasses fit into this puzzle since there's no __metaclass__ = ... or class Whatever(metaclass=...) in it
 
2018 AoC was fun, but i'm a noobie so I couldn't complete a lot of it
 
5:38 PM
I thought maybe that obj was getting passed in the bases tuple to type(), but when I try to invoke that behavior directly via type("Dunno", (obj,), {}), it crashes with TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
Maybe bullet point #3 of docs.python.org/3/reference/… indicates how a metaclass can be provided without being explicit about it
 
@Code-Apprentice: Thanks for the Advent of code, really like their editor like look.
 
Ok. Unknown inherits from obj, and in the absence of an explicit metaclass, Unknown tries to derive one from its bases. type(obj) is Mystery, so Unknown uses Mystery as its metaclass. Then at step docs.python.org/3/reference/…, Mystery gets called with the arguments (name, bases, namespace, **kwds).
 
@Kevin ding dong!
I award you an Unknown number of quatloos :P
 
cbg
 
5:50 PM
@Aran-Fey: Do you regularly post those puzzles?
 
there was a short time (a month or two maybe?) when I did, but I ran out of ideas
I had hoped to start a trend, but other than me and wim nobody's posted any, I think :(
 
Oh, ok. I thought I will go through yesterday's chat history to find others as well.
 
I post a terrible riddle once a month or so
 
@Kevin: Please do it more often...they are very helpful
 
The rate is entirely dependent upon the frequency with which I discover weird behavior
 
5:58 PM
I wasn't aware of these riddles. Could you possibly dig up a link to one of them?
 
I hope degree of weirdness keeps expanding just like universe
 
thanks, I'll have a look
 
woah
this is cool!
 
chat.stackoverflow.com/transcript/message/42750397#42750397 chat.stackoverflow.com/transcript/6?m=33494553#33494553 and that's all I can find by searching through my own transcript for "riddle"
 
6:05 PM
No mentions of He Who Must Not Be Named?
 
...who?
 
you're doing great!
 
I wasn't aware we had ties to Voldemort
 
Voldemort was defeated in '98 and therefore has little bearing on my puzzles. Zalgo is present in all points in spacetime but you have to r͏ȩad͘͘ ͟͜b͟et҉we̶e҉n̷ ̷͠t̡he͞ ̕l̸͜͢ì̀nes to see Him
 
6:07 PM
I literally only just got the joke
@AndrasDeak Sorry for ruining your joke with my stupidity
 
There wasn't much to ruin
@Kevin literally!
 
I'm sensing a pattern of "add code after this return statement" in these puzzles (:
 
"Sometimes code doesn't evaluate top-to-bottom" is a rich vein of weirdness
When the sphinx asks a riddle, the answer is usually "man". When Kevin asks a riddle, the answer is usually "yield makes it into a generator"
 
this one's got me stumped, I have to admit
assuming the solution isn't checking __name__
 
yep that one got me :(
 
6:18 PM
That one has one foot in the category of "you won't deduce the answer unless you already know the trick"
 
Oh, that's clever. Nice one
(I cheated btw)
 
It's about sys.exit isn't it?
 
;-)
 
Oh, I'm gooood
 
This bimodal distribution of "stumped or gets it immediately" is indicative of the puzzle's "you have to know the trick" structure
 
6:24 PM
It took me about five minutes :(
 
it's pretty hard to design a programming puzzle that's not like that, honestly
that's why hints are a good idea sometimes
 
so, what does sys exit do that makes it behave like that? atleast in the main script, i guess its raising an error
 
IIRC, sys.exit causes the program to exit by raising an exception. Uncaught exceptions usually cause the program to print a stack trace, but SystemExit is special-cased to be silent.
This is arguably a quirk about the environment in which a program runs, rather than a quirk about the language itself. So in a way it's "less fair" than the other riddles, which only require knowledge about how individual syntactical elements work
 
ah i see
thanks, interesting quirk to know
 
user7437554
Hi guys, I've tried some solutions you offer but it doesnt work yet,
 
user7437554
6:35 PM
Here is a piece of the code pastebin.com/3kGG930M
 
user7437554
if anyone can give me some guideline of what's going on
 
The score method defined on line 10 probably doesn't work because it passes a list as the parameter cmd to the function shell, which does cmd = cmd.split(). lists do not have a split method, so it probably crashes at that point.
Maybe you could modify shell so it does cmd = cmd.split() if isinstance(cmd, str) else cmd
 
user7437554
yes that's the error but I cant see why it happens
 
cmd = cmd.split() is a big no-no. Better would be cmd = shlex.split(cmd)
Better yet: don't set shell=True and don't pass in a string, ever
 
Alternative design: delete the split entirely and just leave cmd the way it is. If the user tries to call shell with a string, then maybe something bad will happen. But that's their fault and it's their responsibility to pass in a list instead.
 
user7437554
6:41 PM
Fine I'll leave the working function
 
user7437554
it may not work in windows but at least I can see how it works
 
user7437554
and try to learn about subprocess in the meanwhile
 
If you're saying "I'll just leave shell the way it is and use the score method defined on line 23", I don't think that's what me and Aran-Fey were hoping for, but do what you gotta do I guess
 
you should remove that leading space in ' --autobox_ligand' by the way
 
user7437554
Well yes but I can't follow you, it's not a lack of will
 
user7437554
6:43 PM
I see cmd is a list, but not more than that
 
user7437554
should the elements of the list be joined?
 
Nah. subprocess.call's first argument should be a list.
making cmd into a string is the opposite of what we want
 
user7437554
uhmm
 
"cmd is a list" is perhaps misleading because the type of cmd is different depending on how shell is called. If you call it from line 13, it's a list. If you call it from line 27, it's a string.
 
user7437554
yes, I understand that
 
6:48 PM
More specifically, cmd is that type right up until cmd = cmd.split() executes. If you call it from line 13, it crashes. If you call it from line 27, it becomes a list.
 
user7437554
yes and if I call from line 13 it crashes because a list can't be splitted
 
Right.
 
user7437554
and :(
 
user7437554
cmd.split() should be removed?
 
That is my preferred option, yes. This will cause the score defined at line 13 to work, and the score defined at line 27 to not work.
 
user7437554
6:51 PM
Should I change the name cmd?
 
user7437554
because cmd seems to refer to a string...
 
If you're saying "I feel weird having a list named cmd because cmd feels more like a string-y sort of name", then feel free to change it to something more list-y.
Popen itself uses the name args to refer to its argument sequence, so that's not a bad choice
 
user7437554
Fine, it works. There were some other calls to shell but now they are lists
 
user7437554
@Kevin thanks for the patience
 
6:58 PM
@AndrasDeak That reminds me of another riddle I once posed: create a tuple x such that x is x[0]
This is a mean riddle because when I wrote it I was pretty sure there was no solution
 
I vaguely remember that
 
I forget if we ever determined otherwise. I want to say "not without ctypes abuse"
I think at one point I tried to twiddle the bits of a pickle dump, without much success
Either I couldn't get the reference pointers right, or I could but pickle barfed trying to reconstruct it anyway
 
>>> pickle.loads(b'\x80\x03)q\x00h\x00a.')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'append'
:(
 
Basically that, yeah.
 
TIL every program where I wrote try: pickle.load(...) except pickle.UnpicklingError: is broken and can crash. Thanks, pickle
things like this are why I use except Exception: all the darn time
 
7:15 PM
>>> import ctypes
>>> x = (1,)
>>> ctypes.pythonapi.PyTuple_SetItem(id(x), 0, id(x))
0
>>> x is x[0]
True
[I sprinkle a circle of salt around this code, lest its Taint spread]
 
hax!
 
Here's a baffler:
>>> import ctypes
>>> x = (1,)
>>> ctypes.pythonapi.PyTuple_SetItem(id(x), 0, id(x))
0
>>> x is x[0]
True
>>> x is x[0]
True
>>> ctypes.pythonapi.PyTuple_SetItem(id(x), 0, id(x))
0
>>> x is x[0]
False
>>> x
('x',)
 
heh, print(x) crashes the interpreter
 
I know from github.com/kms70847/KevinScript/issues/1 that recursion-detecting print functions don't just fall into one's lap
 
@Aran-Fey I hope you're being serious with this because I get a pang of guilt every time I use it, but my mentality is always "I just don't care why this has happened, but keep your ill-formatted garbage CSV file to yourself. I reject it." and wanna leave it at that.
 
7:19 PM
yeah, but I thought maybe they'd re-used the list.__repr__ code
 
*** WARNING *** PyTuple_SetItem does not increment the new item's reference
count, but does decrement the reference count of the item it replaces,
if not nil.
From github.com/python/cpython/blob/master/Include/tupleobject.h#L16. Perhaps this explains the weirdness of my second code block.
 
@roganjosh I am, sadly. I'd rather not do it, but sometimes python doesn't make it easy to list all possible exceptions that could arise...
 
@Aran-Fey I also thought that, actually. hg.python.org/cpython/file/03c65fc349c0/Objects/object.c#l2358 belongs to the object class so it should be accessible to both list and tuple... Curious.
I guess "is accessible to" doesn't imply "is actually called by"
 
hey i'm back thank's alot @Kevin i've fixed the question and i guess it's more readable now
i'm new to the website do ppl still answer down voted questions ?
 
7:25 PM
github.com/python/cpython/blob/master/Objects/… appears to implement recursion protection in tuple.__repr__, so maybe it does work for actual naturally created self-referential tuples, and only fails because we screwed up the reference count or something.
 
should i just delete and re-write it ?
 
@Aran-Fey it the case of uploaded files to my site, I cannot conceive of any way to really fix any issue even if I caught the specific exception, so it's always going to have to be kicked out. I log the traceback, but I can't fix the code to do anything but kick the upload
 
@za001a Sometimes. I typically don't take score into account when I judge whether I should answer a question.
 
yeah well sometimes ... means i should re write it right ?
 
That said, I might wait until the question falls off the main page so I don't get downvotes from the brigade of people that yell "how dare you have a different opinion than me about whether this question can and should be answered"
 
7:28 PM
lol
 
Well, I can't fix the code in terms of it parsing its way out of the hole, it's always going to take manual intervention each time the error arises. Of course, if they didn't choose to keep adding columns to the agreed uploaded format... But that's a different thing :)
 
ok then since i just don't give a rate's leg about the votes or the score or whatever , i'm just trying to reach my end goal and get my problem fixed , i should just re-write it
 
@za001a almost 2 days after that comment you still don't have a full traceback in the question. Just a bunch of distracting boldface.
 
@AndrasDeak what full track back ?? what do u mean by that ?
 
also unless there's serious black magic going on, test1 is an undefined name
 
7:31 PM
@AndrasDeak trust me , it's just the code as it's
 
Traceback (most recent call last):
  File "foo.py", line 4, in <module>
    foo()
  File "foo.py", line 2, in foo
    return 0/0
ZeroDivisionError: division by zero
 
it's very weird
 
The full traceback is the error message that appears when your program crashes. It typically starts with "Traceback (most recent call last): and ends with the exception type and message.
Many users consider the traceback to be the sine qua non of a problem. If you don't have one, they'll downvote you, regardless of how clear you think the issue is
 
ah ok so u guys read that load of cra* to debug anything ?
 
@za001a no, that text is only there for the sole purpose of filling your screen
 
7:32 PM
Yes. That load of cra* contains many useful clues to the right reader :-)
 
Yes. All the time
 
@za001a also, I still don't believe you
test1 has to come from somewhere, right? From the global scope at worst.
 
@AndrasDeak lol im might be dum but i'm very honest
let me run it real quick and give the "trackback"
 
Remember that you can only delete and re-post your question a certain number of times before you are question-banned. So if you do delete/repost, you should do your best to get it right the second time.
 
@za001a Honest or not, we spent half an hour trying to debug your weird issue where a call to python gave you a windows command-line error (and it turned out to be a copy-paste mistake on your side, despite your saying otherwise at first)
you're a liability when it comes to debugging information, like it or not
@za001a trace back, not track back (it's written right there on the first line)
Also don't post it here, update your question with all necessary information. See also meta.stackoverflow.com/help/mcve
 
7:38 PM
sure no problem and yes that was my bad , that happen because i don't just work as a programmer i do many things and sometimes when i cam back i fall into the newbiest sh** i know it's my problem and i should have been more careful , sorry about that
i really appraciate ur help , i'm working on imporving my attention to details along with my programming skills
 
I'm just explaining why I'm skeptical about your input
 
i appraciate it thank you ! , i don't like to be more pain in the "head" than iam sometimes specially to the nicest people in the programming field
 
just pay attention, make an effort to be as not-confusing as possible and learn as much as you can along the way
 
sure !
 
On the traceback; Python does not make an effort to just throw garbage at you on an error. The traceback is not a "copy/paste this to our engineers" but, rather, as much info as it can give on what is actually causing the issue, instigated by your own code in some way. We can help decipher it until you get more used to it, but don't dismiss this info
 
7:45 PM
ooh i see
 
It is a "show this to our engineers" kind of output... but the thing is, you are the engineer
 
@EthanFurman peer-pressure success
 
i thought it's just show some failed codes in some files which is helpful if we are Developing Python's update or a patch or something
sorry my laptop was out of juice
 
Nope. It's telling you how your code interacted with a library in a bad way
Maybe not bad, "unexpected" may be a better word
 
too exceptional ;)
 
7:51 PM
^
@AndrasDeak I feel I have gained something here. I can now mask my except Exception guilt with feedback to the user that their file upload was "too exceptional". World peace being built brick-by-brick
 
8:05 PM
that's kinda odd but the error have changed from my tablet to my laptop O.o , i will update the question with the current situation along with the traceBack
 
I kinda half fixed my phantom file issue today anyway by going in at 6am on a Bank Holiday. There's a Catch22 on Werkzeug; either you get caught by this issue that I mentioned to ThiefMaster with a "fix", and that error will crash the entire server, or you have the issue I'm now facing since I modified Werkzeug source not to crash on these parse errors. Flask-Session with file-based sessions is broken
And Werkzeug has deprecated their file-based session code
 
done
 
There is a tendency for the cache to write invalid pickle files, for whatever reason, but they've dropped support of the code that supports flask-session too, so it seems pointless to try understand the reasons
It still doesn't explain why I have files that I can't physically delete from the file system, but the setup looks dead going forwards
But the Bank Holiday was important because one of the users seems to have been running some strange program that was querying the site and the traffic has stopped since they shut their computer down. A mediocre end to my saga
 
@za001a NameError: name 'test1' is not defined
 
Any idea how can I get data/parameter after # in a url using Django (v2.1) for a view? E.g: http://www.domain.com/callback#foo=1&bar=2. I don't mind if I get #foo=1&bar=2 as a single parameter or foo=1 and bar=2 as separate parameters, I can handle that. Also, I can add a / or '?' between site and #foo=1&bar=2, but I can't modify anything after the # (including the # itself). I have tried with path('callback/<str:call>') but it gives error when the url contains a #.
 
8:13 PM
you know what that means?
 
@EnderLook How is the GET request sent from your template?
 
@AndrasDeak what are u trying to say ? test1 was defined by
x = {table:db.Table(table,db.metadata,autoload=True,autoload_with=engine)
for table in engine.table_names()}
how come it's not defined now ?
 
@roganjosh It isn't sent from me. It's sent by a third-party website. I've no control of how they send me.
 
m8_
@AndrasDeak and @Kevin, my final implementation:
        `try:
            df.loc[:, 'Initial Percent'] = df.loc[:, 'Initial Percent'].apply(lambda x: x/100 if (isinstance(x, int) and x > 1) else x/100 if (isinstance(x, float) and x > 1) else x)
        except:
            AttributeError`
 
You must have designed the site they're interacting with, no?
 
m8_
8:20 PM
I needed the try because on top of getting mixed numeric types, they also throw in strings
 
How are they sending GET requests otherwise?
 
@za001a that line only defines x.
@m8_ OK, though I wasn't paying close attention to your problem
 
Or is it purely API-based? What is the setup here?
 
oh, this was the "hit the person giving you bad data until they stop" thing
 
m8_
ha yes
 
8:22 PM
I'm trying to learn how to use an api.
I make a simple website in Django. When I open website, it redirects me to a 3rd-party oAuth2, and when I sign up there, they redirect me to my own website using that url.
 
Ok, but that would be via POST, surely
 
btw when i tried
print(f'\n\n test1 = {x[test1]} \n\n')
NameError: name 'test1' is not defined
i'm trying to extract the tables structure from the database :S
 
I think communication might be getting a bit mixed up here
 
should i just re post the question since it's downvoted ?
 
@za001a not yet, you're still confused and reposting it will get you new downvotes
 
8:25 PM
@za001a I suggest you don't do that for now.
 
Anyone here?
 
@roganjosh And post aren't handled through urls.py?
 
@0x45 no
 
@za001a Never do that. I did it once... and people got very angry.
 
@AndrasDeak what is the confusing part of it ?
 
8:26 PM
@EnderLook I'm a Flask user, not Django, so take it with a pinch of salt. Yes, they are, but POST data is not included in the URL
 
@za001a You are confused.
 
I need help with some little abstraction... im quite new to coding...
So my problem is: I got 2 classes (A,B). They both got the same methods.
Just one method slightly differs in calling another method of class C.
So basically class A calls Method C.1
Class B calls Method C.2

Class A:
def foo(self):
print(C.1)

Class B:
def foo(self)
print(C.2)
What is this scenario called?
 
@EnderLook Your data is being passed in the URL string. It should not have a '#'. That is how the request is sent, not how it is processed by your server.
 
@AndrasDeak i have to be confused i'm trying to be a programmer .. it's learning to speak to an alien ..
 
@roganjosh No? but if it isn't inside the url how they send me that? I know that I receive something like this http://www.domain.com/callback#foo=1&bar=2. because when I log in that 3rd-party website they redirect me towards that link.
 
8:27 PM
but seriously are u able to read the problem through my post easily ?
 
#foo=1&bar=2 is a GET request
Even if the # shouldn't be there. A POST request would not show foo and bar in the URL
 
@za001a yes, the problem is that you don't define the test1 name before using it.
 
So we go back to how your template works to submit that form, even if it's a user sending the request, or just how you're testing this request out
 
@roganjosh So they are sending me a GET request?
 
Yes
 
8:29 PM
@AndrasDeak do u know how i can do that ?
 
Do what?
Perhaps when you write test1 you mean x['test1'] but I can't be sure what you're trying to do. And do you see now that my skepticism was well-founded?
 
@AndrasDeak I don't think explaining the problems with an answer and asking the author to remove the answer (when it cannot be improved) is peer pressure. Ganging up with orchestrated down-votes would be peer-pressure (thank you for stopping that), or having a bunch of people comment on the answer about deleting it would be peer-pressure.
 
I don't think peer pressure is necessarily a bad thing. But you may be right regarding terminology, I'm not a native
 
@roganjosh When I open http://www.domain.com/index my Django execute the following line return HttpResponseRedirect("https://auth.mercadolibre.com.ar/authorization?response_type=token&client_id=123456789") which redirects my website towards their website. Then, using their page, I insert username and password from that site and then redirect me to my website http://www.domain.com/callback#foo=1&bar=2
 
foo and bar are not your credentials, right?
I don't understand the setup here. What is the context?
What is domain.com?
 
8:34 PM
@roganjosh They are access_token=APP_USR-A_LOT_OF_NUMBERS&expires_in=10000&user_id=123456&domains=mydomain.com
 
The place where you host your site?
 
Right, so you are logging in to the host of your own site server. What does this have to do with API requests?
 
@roganjosh I am not loggin in my page, I am login in their page. Then, they send me an access_token in order to use their api
 
@AndrasDeak Peer pressure has the connotation that someone is giving in to the group even though that person doesn't agree with the group's decision/perspective/argument/whatever.
 
8:41 PM
I see. Well, we can't know if you've convinced them ;) Thanks for the explanation.
 
I am not following at all. The question opened with some question on how to parse a URL that contained '#', under the premise of testing an API, but that's a redirect for you to your own site, right? They're redirecting you to the site you're hosting there after a login?
What do foo and bar mean to your site? It's a get request, probably a redirect. It's not clear why you need to extract any information from that
 
@roganjosh Maybe I have explained myself wrong. I asked how to parse an URL that contained '#' because I though that would be the solution to my problem. From my website I move to their website and then, they re-send me to my own website plus foo and bar, which are the access_token and expiration time of the token, so I can use their api. Or at least that is what I though I had to do
I need foo and bar to make GET and POST request to their page... later (I still didn't figure how to do that, I am working on steps)
 
I find that suspect, but possible. If that really is the case, then I don't know how it all links up, sorry
 
Any linux experts have an idea what could cause my /etc/rc.local file to not be executed? (That's the Y of my XY problem - the X is "I need to run echo $device > /proc/acpi/wakeup every time my PC boots up because I can't suspend it otherwise")
 
Ok, thank you. I'm sorry for had wasted your time
 
8:48 PM
You haven't wasted my time. What are the doc's you're going off here?
 
@Aran-Fey Is it executable?
 
@AndrasDeak Oof, no, no it isn't :/
 
(⌐■_■)
 
@roganjosh Sorry, that phrasal killed me. No idea what means going off. (is doc's = documents?)
 
@EnderLook It means "which documents are you using for your information".
 
8:52 PM
"doc's" seems off to me
 
@EnderLook Yes, doc's should have been "docs" (I'm a native speaker, so the shame is on me) and it's documentation
@AndrasDeak It is off. I thought I'd purged myself from the Facebook nonsense posts, but the apostrophe got out :'(
 
@roganjosh The documentation of the api, which doesn't explain much since it's supposed I should already know about it (it's for professionals, not just random people like me) and a basic introduction to oAuth2. But all are in spanish
 
@roganjosh it's called a "greengrocer's apostrophe", right?
 
Sorry, I ran to the shop before it shuts. I was asking what documentation you were using to set this up. I think you've got wires crossed because none of this appears to have anything to do with your django app
 
not exactly, because there's also abbreviation going on, but close
 
8:57 PM
@AndrasDeak Impressive, I always learn something new each time I open SO chat
 
Possibly. Sometimes it is needed, but I'd have to think of an example. "docs" is not one of them, but there are some. But it's a massively common mistake in English these days to just throw an apostrophe on a word when it isn't required
So is starting a sentence with "But", but I'm not shooting for 100% formal English :)
But away with the apostrophes :)
 
@AndrasDeak Indeed. It used to be conventional in English to use an apostrophe when making the plural of an abbreviation, and that's only changed in recent decades. When I went to school, "photo's" was quite acceptable.
 
@roganjosh I didn't know that phrases could start with but, is that the formal or informal way?
 
@EnderLook I made a deliberate effort to start several sentences with "but" :)
 
Stepped outside my comfort zone and answered a Python sans Pandas question. >.< Please check that I sound sane. stackoverflow.com/a/56012306/2336654
 
9:02 PM
The modern style prefers "photos", but that style arose primarily to make the pluralization rule simpler, in an effort to discourage the greengrocer's apostrophe.
 
just turn that list into a Series :D
 
lol
 
@PM2Ring Was this a formal effort?
Now it's reversing, and I see "photo's" as a misuse of the language
 
If photo's / photos make some much trouble, why not use pictures? ;)
 
If it goes just by consensus then it's interesting how fast that pendulum swings
 
9:05 PM
@EnderLook because paintings and drawings are also pictures
 
@AndrasDeak I see... image?
 
@EnderLook Traditionally, it was considered bad grammar to start a sentence with a conjunction, but that's a rule from Latin which was imposed on English a couple of centuries ago. So you should avoid it in formal writing, if you want to look classy. But it's perfectly fine in more informal contexts. ;)
 
@EnderLook same
 
@piRSquared I'd prefer if you used set(x) instead of the cryptic {*x}, but more importantly I don't think your code works correctly - check('ab', 'aab') returns False, for example
The question's also a dupe btw
 
@PM2Ring Thay may explain why I didn't learn it from school. There we only learn how to use formal English. Except for a single chapter where we learn about chat abreviations... so funny...
 
9:07 PM
@Aran-Fey edited out the {*x}
 
@AndrasDeak oh
 
And if you have the target handy, I'll close it
 
@EnderLook I didn't know you weren't a native speaker btw
 
already closed it :)
 
Your right about the test case... dang it
 
9:09 PM
@roganjosh I am not. That is why I didn't learn informal english. In school, we only learn formal "British" english
 
hey is it possible to have custom incrementation function for Counter() ?
 
But I'm saying that I couldn't tell. Your typed English is better than at least 50% of the population (I'm not kidding)
@Suisse What are you trying to do?
 
wow, that's a lot of deleted answers on that dup
 
@roganjosh That may be because when I type wrong, they lower my grades at school!
 
@roganjosh I want to calculate a ratio.. like this:
pos_neg_ratios = Counter()
 
9:11 PM
@roganjosh Unlike French, English doesn't have an official standards body. We just have authoritative sources, like dictionary makers and other prominent publishers, eg Oxford University Press. Modern linguistics prefers to be descriptive of the rules that writers & speakers actually use, rather than imposing rules prescriptively. I'm pretty sure that the trend of writing "photos" started in America.
 
and there is:
pos = Counter()
neg = Counter()
 
WAT! TIL that you can check if x in iterator and it progresses the iterator. Thx @wim
 
now want to calculate the ratio of the counters
 
But I might ask about the history of that on the XKCD Linguistics forum.
 
@PM2Ring That is strange. In Spanish we have the RAE, which in English is "Royal Spanish Academy", it tries to regulate Spanish.
 
9:12 PM
and the function for the ratio is this:
positive_counts[word] / float(negative_counts[word]+1)
 
@Suisse Rather than a piecemeal question over several messages, can you please collect into a single MCVE on pastebin or the like?
 
@PM2Ring ?
 
@PM2Ring Oh man, I hope I'm not mentally correcting people with American English :/
 
pos_neg_ratios = Counter()

pos = Counter()
neg = Counter()

#how to iteratre over pos and neg to calculate its ratio with this formula: pos[word] / float(neg[word]+1)
and save it in pos_neg_ratios?
@roganjosh thx you are right
 
@EnderLook In English, we have the problem that there are significant differences between American and British English, and it would be politically impossible to have one body enforcing a single set of rules. And then there are all the minor variations in the former British Commonwealth countries. I guess it'd be easier if the differences were so great that we could just class the different types of English as separate dialects. ;)
 
9:18 PM
Have an idea.. I will test (about my Counter() thing)
 
@Suisse pos_neg_ratios = {pos[k]/neg[k] for k in pos.keys().union(neg)} should work, though I'm too lazy to test it and pos_neg_ratios won't be a Counter
 
And then txt spk, the ruiner of all
 
@Aran-Fey thx, yeah without Counter its another task :P
 
if it absolutely has to be a Counter, just do pos_neg_ratios = Counter(pos_neg_ratios) ¯\_(ツ)_/¯
 
pos_neg_ratios = pos #just save the pos in the pos_neg_ratios
for idx, word in enumerate(pos):
    pos_neg_ratios[word] / float(neg[word]+1)
 
9:20 PM
@Aran-Fey speaking of keepin' it cryptic {pos[k]/neg[k] for k in {*pos}.union(neg)}
 
piR just lovin' that {*pos} syntax :)
 
OTOH, I'm kind of grateful that the situation with English isn't as complicated as what's happened in Spain. :) en.wikipedia.org/wiki/Languages_of_Spain
 
@PM2Ring I know: center and centre, or metre and meter. They are so awful! Or flat and apartment! I prefer apartment... but the First exam is British, nor American, so I'm trying to get used to it :(. I have installed an app in chrome to automatically hint me the American style to the British one..
@PM2Ring Oh yes, we have a lot of problems
 
Flats are smaller and cheaper than apartments. Hope that helps
 
@roganjosh Sure? In school they said me that flat was British and apartment was American, I can't believe they lied me again!
 
9:25 PM
They probably have some legal difference buried somewhere but, in spoken English, a flat is considered cheap and an apartment a luxury. It's to do with space, but there just is no threshold
 
Great!
 
Flats are large expanses of land with near zero curvature
 
@PM2Ring You could argue that regional dialects are practically different languages...
@roganjosh I've never heard anyone in America refer to any kind of rental unit as a 'flat'
unless they're trying to evoke the Queen's English
 
@EnderLook flat/apartment distinction is probably buried in like 60's history of building highrise, Brutalist buildings. If you called something an "apartment" to someone who lived in a "flat" they would probably take it as a light-hearted joke. But nobody in the room would know the difference beyond intuition.
 
Interesting
 
9:33 PM
Englishmen going out of their way to make English even more difficult confusing than it already is.
 
I think I discovered what was going wrong with my problem with the API. I was doing a server-side work with a client-side API, that is why nothing worked... now I must find how to configure from client to server API! (they have both)
 
I assumed as much :)
You need to find out how to expose your endpoint (pardon me) on the server
The login credentials have nothing (I don't think) to do with your own app
 
With the server-side is different. They will redirect me to http://mydomain.com/site?code=SERVER_CODE, and then I must make a POST with the code in order to get the token.
 
@WayneWerner Almost! On the XKCD forums, there have been great discussions about those regional differences. Sometimes, it's just a simple difference, like "soda" vs "pop" vs various other terms popular in different regions. But some of the differences can be more subtle, and hard to notice if they aren't pointed out.
Those of us outside America get exposed to American English via movies, TV, and music, so we feel familiar with the terms & phrases that Americans use that we don't use. But it's hard for us to notice the stuff that Americans don't say, like "flat" instead of "apartment".
 
A flat is very distinct, though, while apartment is also fully in the English English language. A flat really does convey minimalism to live, like many high-rise, and I guess we pinched the "apartment" from Americans to describe something bigger
 
9:45 PM
@PM2Ring do we really need to list the words Americans don't say
 
Two-pronged attack, I'm from the UK :)
 
@piRSquared Cute, although with many of those terms it's pretty obvious that they're Aussie terms, or maybe of Cockney origin. At least, they should be obvious to Australians. :)
 
"Bloke" exists well here. Quite a few of them do, actually
"Brick **** house" must come from the UK
 
@roganjosh Also, "flat" tends to imply that it's rented, not owned by the occupant. In Australia, an apartment owned by the occupant is often called a home unit. But I guess younger people may call them apartments these days, since the influence of American English is getting stronger.
 
@roganjosh Which is ironic, because in many highly concentrated cities "apartments" in the US are less than 500 sq ft
 
9:55 PM
They wouldn't call them apartments here, I assure you. "Council flat" is a really well-known word. Maybe in different parts of the country, but not here
And even with Grenfell, I think they refer to them as flats
 
I've actually heard and used flat in the context of living space when I was younger. I remember it meaning a large space with little to no walls. Kind of like a studio apartment but much larger. Kevin Bacon in Quicksilver. I think they will mean different things in 30 years and our kids will dictate what that is exactly
 

« first day (3124 days earlier)      last day (1816 days later) »