« first day (2967 days earlier)      last day (1984 days later) » 

12:47 AM
any(map(table.__contains__, ('ping', 'pong')))
 
1:33 AM
I'm unable to import matplotlib ` from matplotlib import (
ImportError: cannot import name 'get_backend'`. I'm on python 3.6.7 & matplotlib 3.0.0 . looks like a related but I don't understand it at all https://github.com/matplotlib/matplotlib/issues/12601
getting error: `from matplotlib import (
ImportError: cannot import name 'get_backend'`
I'm in a virtual environment and every other package is behaving normally
 
1:56 AM
hi everyone I need some help with a simple resizing script. Can anyone help?
 
 
2 hours later…
3:52 AM
@Ayrad you should check the room rules (specifically the part about asking your question)
@pyeR_biz are you trying to import get_backend? It's not entirely clear to me
 
 
1 hour later…
5:05 AM
Hey I don't understand this sum(1 for x in range(5))
It should return me sum of 0 + 1 + 2 + 3 + 4 and adding 1?
 
5:36 AM
cbg
 
@AbhimanyuAryan nope 1 + 1 + 1 + 1 + 1 -> 5
 
 
2 hours later…
7:25 AM
guys... if we pickle a data in python is it usually end up with a list ???
 
7:42 AM
@AkhilAlexander usually pickling means converting a data structure such as list into a character stream..
 
@Tyto hey
 
@WayneWerner I just did "import matplotlib" and got the error. Found a temporary solution by downgrading matlplotolib to 2.2.3 There is some compatibility issue going on btw Python>3.6.6 and matplotlib 3.0...
The issues are in matplotlib GitHub page
 
@Tyto I was pickling a numpy array there
 
 
2 hours later…
9:53 AM
cbg
I was running an optimization code for around 3 hours and my colleague accidentally moved the file to a different directory. The scipt seems to be running on terminal, but can this cause some problems?
 
 
1 hour later…
11:09 AM
Hey guys, question about list comprehension.

I thought the next snippet would print the same thing twice, but I'm wrong. I don't understand why.

data = [(0,0,0),(1,1,1),(2,2,2)]

for x,y,z in data:
print(x)
[out] 0
[out] 1
[out] 2

x,y,z = [(x,y,z) for x,y,z in data]
print(x)

[out] (0, 0, 0)
 
11:22 AM
Presumably you're assigning (x,y,z) to x in that last statement
Because (x,y,z) is the first element of the list you're creating
So you're printing the first element, which is (0,0,0)
The upper loop you're looping over (0,0,0), (1,1,1), (2,2,2) and printing the first element of each
 
12:02 PM
Afternoon cbg
 
How is everyone today?
 
user6718998
Hi guys. I have some logic issue. How can I make sure that a function will run a specific value only one time ever ? (working with recursivity)
 
12:20 PM
@Thewise can u show us the code where you are having the difficulty..
 
user6718998
oh boi
 
@Withnail going good
 
Grand. :) I'm working on a new deployment of a thing, so a lot of my time is being spent waiting on stuff running today. Filling the time with python chat and an O'Reilly book...
 
user6718998
So what I am trying to do is print all accounts from where money went on a ether network. It start from the given account and I want to show all accounts where money went. Now I am doing it for the first account where money was ever sent and then by applying recursivity, I am using the first account money was sent to and show his first account where money was sent and so on..
 
user6718998
But I noticed some account can send money back from the person they received and I don't want those to be taken into parsing again cuz I would be in an infinite loop pastebin.com/517PWXLi
 
12:43 PM
Hello, given myList = [0, 1, 1, 1, 10, 100] what's the easyest and fastest way to visualize its histogram using plt.hist(myList)? I want to be able to see ALL different numbers in the list and their corresponding frequency
 
@Thewise, in your tmp_tx list you are only returning the values which have a tx_receipt _status as not 0. so why can't use some other unique identifier at this point itself to not receive money back from the same account?
 
user6718998
@Tyto i don't like use of many variables
 
user6718998
haha
 
user6718998
so I did it that way for now
 
@Thewise, surely we could come up with some other solution as well...
 
1:17 PM
@Thewise you can hack it with a cache
def recursive_func(arg, seen=set()):
    if arg in seen:
        return  # skip arguments that were already seen
    seen.add(arg)
    # run recursive logic
    recursive_func(other_arg_maybe, seen)
only works if your input parameters can be hashed though
ahh, I think I mistyped up there.. that's what I get for avoiding the use of mutable default arguments.
Yeah, you don't need to pass seen in the recursive call
 
jjj
1:48 PM
@Employee so what's wrong with plt.hist() in your case?
 
2:32 PM
cbg
 
cbg
 
jjj
cabbage
 
2:50 PM
Recently I got tripped up on variable assignment, where I have a variable foo which was a class attribute (e.g class.foo = 1) in one program and a second program where foo gets updated. The second program was imported into program 1 and I did not realise that foo was also being updated but this variable foo was passed back into the first program altered. Looking back it makes sense but does anyone have a pointer on where I can read up on this?
 
cbg \o
 
@cd123 there's usually just one object for any given Python module in a Python process, meaning there's usually one class object for any class definition
 
Hi everyone, I'd like to have little help to implement a stiffness solver in Python as shown here. I tried it with my code but I get a few errors I haven't had before trying to implement the solver like "float is not subscriptable. I can share you my code using Pastebin if it's ok for you.
 
@vaultah Could you expand on that further?
 
Hi all
Does somebody get why this code is so weirdly written?
vmin = -extents[i] / 2
vmax = extents[i] / 2
if vmax - vmin > 0:
a = 1.0 / (vmax - vmin)
b = -1.0 * vmin / (vmax - vmin)
`vmin = -extents[i] / 2
vmax = extents[i] / 2
if vmax - vmin > 0:
a = 1.0 / (vmax - vmin)
b = -1.0 * vmin / (vmax - vmin)`
 
3:07 PM
@Hakaishin 'why is it written so weirdly' is such an odd question... I don't understand what kind of answer you are hoping for?
 
why not just use if extents[i] > 0
 
Someone wrote it that why, and only that someone can tell you why they did it that way. Sure we can guess on why but at the end of the day we can't read minds :\
 
this is how I would write that
I mean it seems so odd to half it and then add it again
and the person is not reachable for months so no I can't ask the person who wrote it
btw how do i code format? I thought it was `
 
The past version of me has written some stuff that present me can't figure out why. And most of the time, past me isn't available to answer questions.
8
 
3:10 PM
Also maybe they want to take decimal division to check accuracy (not sure why)? so like 1/2 could = 0.5 on python 3 or could be 0 in python 2?
 
Here is my previous working normally. And this one is after the changings as mention in the post I'm using to implement the solver. Any help will be very appriciated.
 
It is always a float division so it can't be that
 
@Hexacoordinate-C no clue what a stiffness solver is so pass from me :\
 
vmin = -extents[i] / 2
vmax = extents[i] / 2
  if vmax - vmin > 0:
    a = 1.0 / (vmax - vmin)
    b = -1.0 * vmin / (vmax - vmin)
 
@Hakaishin literally still don't understand what you want us to do. Help you brainstorm a million reasons on why someone did something until we hit a possible acceptable reason ?
 
3:13 PM
Why so aggressive?
Does my question bother you?
If you don't know just don't answer. I'm sure there is a reason for this construct it was written by an electrical engineer at nvidia so I would assume it is not just random code obfuscation
 
@MooingRawr this is a way used to solve differencial equations or system of differential equations which are to harsh to solve numerically with "basic" methods.
 
Some other people might know this construct some others don't so that's that.
 
@Hakaishin I apologize if I seem agressive, not my intent, but I'm generally curious on what you are hoping for ? if I hit the nail on the head then okie, that's fine, hopefully others can chim in.
 
@MooingRawr If you'd prefer to have a better explanation of what it is here are some more explanations
 
@Hexacoordinate-C hmm something to read at lunch, thanks.
 
3:17 PM
There's a reason why an electrical engineer's job isn't to write software
 
^^
 
I had the pleasure of seeing a PHD in computer science candidate's code, and it was no better than an undergrad.
 
True, I am especially appaled at the fact that this person has allegedly a bsc and msc in computer science. But there are so many basic violations of good practice that I am starting to think there are there on purpose to slow down people trying to reproduce the results
So nobody could scoop him I guess
 
n8_
@W.Dodge, I had a missing parentheses in my formula. Everything is working fine now. Thanks again for your help!
 
I'm happy to hear that :)
 
3:31 PM
@Hakaishin I think Hanlon's Razor applies here: Never attribute to malice that which can be adequately explained by incompetence.
 
3:44 PM
I never understood why people believe in the hanlon's razor and not in the opposite. There should be one named that says exactly the opposite. A prior neither makes more sense
 
n8_
because human nature attempts to demonize rather quickly
 
it is based on two premises, people are generally good and stupidity is more common
3
 
n8_
or, people tend to dehumanize
 
4:01 PM
1 is debatable and not even so well defined as one might think and for 2 I have kind of hard time right now since I can not understand what this is even supposed to mean...
since something can only be stupid with respect to an average, there can be no such thing as stupidity being more common. Except if of course one takes different vantage points for what is stupid. Meaning one thinks one is ahead of the curve, which given the sector might be a valid assumptions I guess. But I'm still not sure how valid 2 is, since any malice can once the person is being pressed very often be converted into stupidity so the actual amount of malice in the world
might be severly underestimated
 
4:33 PM
cbg
 
hey, I want to click on this attach icon on WhatsApp using python script which uses selenium library: drive.google.com/file/d/1ZNtERw5VhklnDccpUN4JXKcFpOYSnqOO/…
can you help me with finding its class
another thing is I am unable to inspect the first purple icon. why is that?
what I want is to click on this attach icon so that these 4 icons appear. then click on the purple icon.
 
5:10 PM
hello :-(
 
morning cabbage
 
morning
can you help me with it?
 
 
1 hour later…
6:19 PM
I did it
Now this box appears
how can I control this book and navigate to my desired location and click open?
this box*
 
I suggest you google it
something like "selenium file chooser"
 
7:03 PM
cbg, back from hiatus
@NaufilMuhammad If on Windows, I have in the past used ptfb
 
7:57 PM
Cbg
This question. Should it be raised on Meta (it's now deleted by the author)? I can't see how it happens unless someone is trying to develop a spam bot or something. How do you accidentally post lorem ipsum?
 
8:12 PM
recbg
@roganjosh yes, that is very odd
how do you accidentally post a paragraph of lorem ipsum?
 
Raised: meta.stackoverflow.com/questions/377319/… but I can't include the content because I can't see the post anymore
I also really don't know the meta tags so please edit as necessary
 
Is it accepted in 'ask questions' to ask how the program is working (a dash visualization). I've made it work for my case and now need to modify it to suit my needs. But I can't do that if I don't understand how it works. I've written some of the intermediate data structures and to text files, trying to read which DS is doing what. But I don't see much.
 
8:37 PM
@pyeR_biz You should ask specific questions like "what does xyz do?"
 
@Code-Apprentice Hmmm, luckily while looking at the DS's right after my above comment found some sense in the code, eventually I'm hoping to be as specific as I can.
 
8:56 PM
Meta is just depressing.
Closed as a dupe about spam... that's voluntarily removed by the author. Fun times.
 
@roganjosh no, that's not for meta
Flag
 
I did flag
I can't see the post any more, it's impossible (I think) to raise my suspicions now
I also mention in my post that I don't know whether such flags persist
 
I could screenshot but no point. Category of garbage or spam seed.
 
@roganjosh What are your concerns and how would posting a question on meta help?
 
Maybe I need to make it clearer that the OP self-deleted
That someone is penetration-testing SO filters for such things.
 
9:11 PM
59
A: Is a post like 'assdddsssafffwq' spam?

Undo Note that this represents my opinion on the matter. It isn't an official stance, and shouldn't be taken as such. Additionally, this doesn't completely apply to cases of already-established users posting gibberish. It's probably better to flag those as NAA and give them the benefit of the ...

Same thing ^
Not official stance but Undo has become a mod and a very good one since
 
Ok, I bow to public opinion. I cba fighting my corner. Something didn't seem right to me, I raised it, it will be voted on or dismissed as appropriate.
 
My point is just that meta is needless here. Flagging for spam is enough, or custom mod if you're concerned
Whatever needs done can be done by a mod, this is what they're for
 
I can only say that it's completely at odds with every spam post I've encountered, considering I've seen thousands, but it can go to moderator judgement or SO employee consideration who have seen orders of magnitude more posts
@AndrasDeak probably right. I also covered in a comment. I could faff and try to find the exact channels on a broken phone and just lose the link
Bleurgh. I don't mean I've seen thousands of spam posts :P
*Thousands of posts, and from those, it doesn't gel with the spam posts I've seen
 
What Andras said. It definitely warrants a flag, to alert mods of possible proto-spam, or robotic posting. But it's of zero concern for meta. OTOH, the SOCVR are interested in tracking potential spammers.
 
Fair enough
 
FWIW, I've flagged proto-spam that looked less suspicious than that, & I've never had one of those flags rejected.
 
Yeah, reasonable doubt is usually helpful
 
@AndrasDeak Ah, right. I get them mixed up because I learned about Charcoal in SOCVR.
 
Yeah, and Smokey runs in SOCVR
 
@roganjosh Did you manage to flag it before it was self-deleted?
 
9:27 PM
Yes, as spam
 
Oh, good. So there's nothing more we normal users need to do about it.
 
It's not self-deleted, it's rude/spam deleted
no, you're right
 
Well it wasn't originally, unless I'm going mad
 
Weird how the content is hidden
Might be a side-effect of active spam flags marked auto-helpful
 
Or I did a good. In the ambiguity of that situation, I'll just pretend I wore a cape and saved everyone from a baddie :P
 
9:33 PM
Nah, you did
OP did self-delete, but it looks like spam deletion. They may have even gotten -100 rep
 
On a related note I was reviewing posts in the queue the other day and came across a post in Arabic. I marked it as “Needs Editing.” It turns out the post was a test to see if I was paying attention and should have been marked as spam. My thought was that the post simply needed to be translated but apparently I’m supposed to be able to detect spam in languages other than English.
 
I just got home from a week-long trip abroad so I can't care too much ;)
@W.Dodge we don't translate posts
 
Okay, good to know
 
There's also a meta for that...
Spam/abusive flags is debated. I usually just close these.
If the audit rejects a close decision you could debate it on meta
 
I just felt it was presumptuous to mark something as spam simply because I can’t read Arabic. I have no issue moving forward.
 
Sam
9:48 PM
hello all
@AndrasDeak Good time?
 
Does anyone think it's a terrible idea to use attribute names like 'type' and 'vars' in classes?
Like, I know they're builtins, but I'm not really using them within the context of the class
 
Sam
@malan Probably not a good idea no
 
Why not?
 
Sam
Isn't it always a bad idea to copy built in names?
What if another developer reads the code and doesn't realise initially
 
It's just annoying how generic they are when I need a generic name like type of vars because it's useful in my program
type or vars*
But they're also functions that aren't used within classes, right?
 
9:52 PM
@Sam if there's a chance that you shadow a built-in name, yeah that's a bad idea
No such shadowing occurs here
 
Like you might say type(g) to find out what class it is, but do you ever say g.type?
 
Sam
@vaultah Fair enough :)
 
It's fine. There's no possibility of shadowing. You can see even the language core reusing built-in names as method names, like float.hex reusing the hex name.
 
I know I've seen ORMs use id as an attribute name
 
👍 Awesome
 
9:55 PM
Sure, they don't shadow, but they can confuse simplistic syntax highlighters (like the one I use), so they get coloured as if they were a built-in name
 
Yeah, that's what I've been doing (I'm asking this in the context of sqlalchemy)
And yes, vim-python highlights those words, which is how I recognize them as builtins
 
A good synonym for "type" is "kind".
 
Lol, yeah, I used to use that to avoid overwriting type, but I'm starting to get annoyed with it, since my variable is literally the name of a type()
 
Also see the zillion functions and methods named open.
 
Sam
I'm running an API in Flask, currently just as localhost. If I want to allow multiple devs (who work remotely) work on the front-end and allow them to make requests to the server, am I right in saying I need to buy a domain? Or is there some free way I can do this whilst in development?
 
9:59 PM
There are free domain services
 
Naming a local variable the same thing as a built-in is pretty consistently a bad idea, though.
 
Because bad coding practice?
 
@Sam no, you don't need to do that if you're on the same network
 
@Sam yeah. Productive is probably a better word though
 
Sam
@malan I've seen some free ones, my worry then is that I'd need to secure the network from the outside world.. wondered if there was a different way
@AndrasDeak Working holiday? :P
Oh you had a conference?
 
Conference and collaboration visit
 
Sam
Ah, I remember you mentioning. Fun fun
Attending the conference or presenting?
@roganjosh Thanks I'll take a read
 
Aaand, I need reading lessons because "remotely" is crucial. Sorry.
 
@Sam Is there a problem with letting them run the backend each on their own development machine?
 
@Sam more like a workshop. Had a poster. And gave a talk at a group seminar
 
10:03 PM
@Sam don't bother unless there's a way to do it via a VPN. That's my bad, sorry.
 
Sam
@Code-Apprentice Keeping a consistent database I guess
@AndrasDeak Nice. Sounds like fun
 
One possible solution is to host it on your own machine. You don't need a domain name necessarily. You can just use a raw IP address.
 
Especially within network. That's what I do. I dev on a machine putty-ing into a laptop that has the actual code and software on it
 
of course, you'd still have all the same security issues.
 
Sam
@Code-Apprentice I had considered this. A draw back seems to be developers will only be able to connect when my machine is turned on
 
10:05 PM
But doing all that out of network is dangerous
VPN?
 
@Sam yes, you will need to leave the host machine running whenever developers are expected to need it.
 
@Code-Apprentice I'd honestly be terrified of hosting a development app like that (Not talking about a development server)
 
Sam
I wonder if these free server providers will allow me to blacklist all connections and only allow IP's I specify
 
@malan Virtual Private Network
 
Yeah, that's what I'm suggesting to skirt security issues on opening a flask dev server to remote connections
If you're accessing from outside network
 
10:09 PM
Oh, I thought you were asking about the acronym, sorry
 
Np
 
... why do they need to have access to some live server in the first place?
 
Sam
Working on a side project with one of my uni pals and we don't live in the same place
 
Or, a central server, might be a better question
So run it locally
They can just run it on the development server
 
Sam
What about databases?
 
10:13 PM
Is that absolutely crucial to all your development?
Unless you're changing tables and schema, I don't see how the database needs to be real-time
 
Sam
I mean, it's not crucial because each developer can just create their own content whilst developing
I was just curious if there was a way of doing so
 
Well, I'm on a lone sailor for most of my coding time so I'm probably not the best person to answer this, but I really wouldn't be looking to expose an endpoint on the interwebs for development before considering other options
 
Sounds to me like you both need to set up self-contained development environments. It shouldn't be difficult to set it up so that you each run your own database, backend, and frontend for development.
In fact in many ways this is preferred for development so that you aren't stepping on each other's toes by modifying data that the other is using.
 
Sam
@Code-Apprentice Yeh I think I'm edging toward this. I suppose if I wanted us to have the same data, I could write a script to pre-populate the DB and get all of the developers to execute the script
But yeah, @roganjosh you are right, it isn't a crucial requirement
@Code-Apprentice Fair point.
 
@Sam I don't know how flask manages this, but with Django, there is a command to export data to a JSON file then anyone can load that data into their own dev environ. This is incredibly useful when you want to start from a pristine dataset.
 
Sam
10:19 PM
Yeah there is bound to be something similar. Thanks both
 
@Code-Apprentice I'm not sure what that means? You can sync a database by some external source in django?
If that exists it will be really helpful for me to know the django function, I didn't really envision it existed
None of my code fits an ORM, I could use alembic otherwise and flask-migrate, but it sounds like you're hinting at something different
 
@roganjosh yes, you can dump a database to JSON file and import data from a JSON file
The commands are ./manage.py dumpdata and ./manage.py loaddata. Both have many commandline args, so you should check the docs for all the options.
 
10:35 PM
Does anyone drink and code?
 
@malan No.
 
Hahaha, I love xkcd
 
@roganjosh I've used this to create a sample dataset. Then you can easily reset the dev environment to a known pristine condition.
 
@malan Here's the forum thread, if you're interested forums.xkcd.com/viewtopic.php?f=7&t=13306
 
@PM2Ring It's 117 responses long!
 
10:49 PM
.. I'm sat in a pub looking at my phone. Definitely, never, ever, try to write code on a smashed screen while imbibing </sarcasm>
 
So you're saying it's a good idea
 
It's an idea, I'm not judging it either way
@Code-Apprentice I'll have to look into those commands, thanks. I have a feeling that you're using some kind of database management to make that work, though
I'm currently writing my own migration scripts before pushing to production but I think I need something a tad more sophisticated :)
 
@roganjosh with django?
what kind of migrations? Are you adding tables or modifying columns? If that is all, then you can do ./manage.py makemigrations to generate the migration scripts for you. If you have more complex data modifications, then you probably need custom scripts.
The dumpdata and loaddata commands are built into django. The only database management I'm using is whatever magic django does.
my use case for both of these commands has only been for my dev environ. I'm not involved in deployment.
 
11:05 PM
Yo guys, no idea about the rules for the chat; can I ask some stuff here too, or nah?
 
@SBernal A link to the rules is in the top right corner of this window. You could start by clicking that.
(assuming you are viewing the desktop version of chat)
 
Well, rubarb, guys. I've got a bottle of wine with my name on it.
 
11:20 PM
@Code-Apprentice no, I use Flask, but I appreciate you giving me the django version, which will help me find the terms I need to find the equivalent
My migrations, without an ORM, are pretty ugly
Dumping to pickles for backups before deleting whole tables etc. It's a good learning experience of how not to do things from the start :)
 
@roganjosh I lost track of this conversation...or rather I thought more people were involved in it. Anyways, Django does a lot of the magic for me as far as migrations
 
:) but it relies on an ORM for the magic?
Almost everything I see about django is for an ORM whereas, what I've built is basically a control panel with 100s of buttons for simulation settings and I just can't conceptualize it in that format. But changes to database schema are ugly
Knowing a bit about how you'd handle it in django is not wasted info for how I might handle it in flask. It just gives me more angles to research because I'm still very much a learner
 
rbrb
 
11:39 PM
@roganjosh django has its own orm
in one project that I work on regularly, we declare model classes in python code. Django generates migrations from these. Which in turn modify the database as necessary.
the entire database schema is defined from the model classes. We do not mess with the schema at any lower level than that.
 
Yep, so we could do the same in flask with alembic via flask-migrate if I was following the ORM model
I guess my choice is to understand that paradigm enough to see my project fit it or just shut up and put up :P
 
you can always build your own ORM
 

« first day (2967 days earlier)      last day (1984 days later) »