« first day (2756 days earlier)      last day (2178 days later) » 
00:00 - 16:0016:00 - 00:00

12:07 AM
What is the keyboard shortcut for the extended hyphen (—) on a mac?
 
ctrl+c, ctrl+v
 
okay, looked it up; it's alt + shift + minus
 
@cᴏʟᴅsᴘᴇᴇᴅ try with "en dash"
though what you have there looks like an em
 
yes, I looked up "extended hyphen" and found "em dash"
 
don't let poke see any of that
 
12:09 AM
en: –; em: —
 
well, ToS is now live. Only 30 days left to find out if we have to use snail mail :P
 
12:23 AM
while walking the dog I realized that the keyword for vote solicitation is "accountability"
 
Hah. My first thought was "stacking numbers is trivial"... look at the comments, someone's saying "this is NP-hard". I guess it's a bit unclear :D
 
I'm doing the walk of shame and going through my old crappy posts to clean them up
 
don't forget though that just because you left a crappy post might still have a valuable Q&A :P
 
yes, it's hard to advocate good content when your post history has stuff that the you of today would downvote without mercy
 
user8177336
12:36 AM
hey d u guys know How to delete a question you asked even if it has answers? SO isnt letting me do it.
 
user8177336
* i mean to say a question i asked
 
@BOi or, make a delv request here
 
you only have non-negatively scored questions, why do you want to have it deleted?
 
@AndrasDeak you just missed it, it's gone now
 
ah, sorry, thanks
 
user8177336
12:53 AM
thanks for the downvotes on that. one of my friends was trolling using my account and posted it. i realy wanted it deletede so thanks
 
those friends are the worst!
 
I don't mean to be mean but if you were careless enough with your account, you probably deserved it
 
my friends also often prank me by posting realistic questions in my name :)
 
user8177336
@cᴏʟᴅsᴘᴇᴇᴅ yeah i understand. he just goes on my laptop sometimes and i have my SO logged in all the time so he trolls people. i should probably log out :)
 
what a spectacular troll. got 'em!
 
12:56 AM
people sure use the word "friend" very freely nowadays o.o
 
@BOi You should, because you're accountable for whatever he does with your account
 
i'm sure the sock puppetry is also your friend's fault
 
user8177336
@cᴏʟᴅsᴘᴇᴇᴅ ya sorry about that. i didnt now it was happening until i got blocked 4 weeks
 
good night; try not to make a mess while I'm away
 
1:03 AM
goodnight big brain
 
Andras is going to bed? Why am I still up? What am I doing with my life?
3
 
Why am I still up? ;_;
 
Well, if nothing else, it's a good night to star gaze.
 
user8177336
1:40 AM
y'all live on the west coast ?
 
wim
2:09 AM
@wim –1 for using –1 instead of -1 — Andras Deak Dec 30 '16 at 17:48
 
2:56 AM
cbg
 
3:47 AM
Anyone have any ideas for Flask extensions. I am really struggling to find what needs to be done. Yes, I have already looked at the list of approved extensions. Just trying to get some ideas.
 
I need an extension that thinks for me.
 
I am going to take that as "implement a scikit-learn extension"
 
(-:
My apologies. I know hardly anything about flask but was desperate for interaction.
 
hahaa you are fine
What sort of things do you use Python for?
 
4:14 AM
Night time cabbage
 
Hello other people
 
Was sorta bored, so I implemented Conway's game of life. Suggestions welcome... particularly, I'd like to know how to overwrite the previous state with the next on stdout
(right now, the states print sequentially)
Hmm, I should probably open a q on code review
 
 
1 hour later…
5:28 AM
Morning cbg
 
5:52 AM
cbg
 
6:12 AM
Cabbage
@cᴏʟᴅsᴘᴇᴇᴅ On a VT100 compatible terminal you can use the reset command Esc-c to clear the terminal, so print "\x1bc". That's what I used in this simple Numpy Life generator
Have a look here for cursor control commands, etc.
 
6:27 AM
And if you're not using a VT100 compatible terminal, what are you doing with your life anyways
 
@Aran-Fey What Andras said re: accountability / traceability. Also, if I get a bunch of people to down-vote an answer by user X on a question where I (or my buddy) has a competing answer that makes my answer look better than X's, and that increased visibility may increase my answer's chance of gaining upvotes. So it's almost as bad as having a ring of people who upvote my answers.
True, deleting a competing answer can have the same effect, but people with deletion privilege are expected to be above that sort of thing, and an answer needs to be drastically bad to justify deleting it, whereas a so-so answer may legitimately earn a few downvotes without warranting deletion.
@chrisz I hear there are quirky proprietary systems that don't use a VT100 terminal. Fortunately, I'm not required to work with such systems, but some people are.
 
Also to your above point, I wonder how different SO would be with non-anonymous downvoting
 
Without anonymous voting, my guess is that SO would probably be a ghost town. ;)
 
I feel bad downvoting people even with anonymous votes
 
6:42 AM
My down-votes are mostly semi-anonymous. If the OP is genuine I try to be helpful, if they're a no-effort homework dumper, or a gimme teh codez cargo-cult coder, I DV and move on. But if I get the vibe that they really want to learn to code and to learn how SO works I'm more than happy to help them.
So if I see a question from someone who I consider worthy then I try to give constructive criticism, and only downvote if they don't do something constructive in response. Or I may comment "I didn't downvote, but you probably got those downvotes because of..."
 
The only time I ever want to downvote answers is when someone posts a bad answer, gets downvoted, then instantly posts a "don't downvote because you don't understand my answer" comment.
 
I suppose that does happen from time to time. But it's much more likely for the answerer to misunderstand the question, or for the answer to be plain wrong.
 
Yea if it's a misunderstanding it's unfortunate to see a couple instant DVs,
 
Late last night, several high rep Python regulars (myself included) responding to a fairly simple question all made a similar mistake in our answers. Our code worked correctly on the OP's sample input, but in general it could create unwanted duplicate items in the output list. And we all got hit with downvotes. My excuse is that it was 5AM in my timezone, but it's still a bit embarrassing when that sort of thing happens.
Hello, friendly puppy! It's good to see you, 4theye.
 
Is there a consensus on what rep is considered "high rep"
 
6:57 AM
huh, good question. googling 'stack overflow rep tiers' gives nothing useful
 
Hi, i have problem with data conversion. When creating a pivot table from dataframe, it converts int to float; How to avoid?
 
Can you post a small sample of your dataframe?
 
sure
 
What operation are you doing?
 
df_as.pivot_table(index='cardNum', columns='place', values='count')
 
7:02 AM
@chrisz It's a relative thing. But generally (IMHO), it means 10k+, since such users have the power to cast delete votes, and can see deleted posts.
But I guess anyone with the power to cast close votes can also be considered high rep.
 
@Vamsi can't reproduce, they stay as integers for me.
I get this
place    HOME  NEAR_HOME  OUT_AND_ABOUT  UNKNWON
cardNum
100        78         10             15      192
 
@Vamsi We prefer that you post text as actual text. That makes it easier for us to copy & paste your data if we need to. But I guess that's not so relevant in this case.
 
Yea I had to type it into a text editor like a commoner
 
let me convert the data into csv and will paste some lines here
 
cbg
 
7:08 AM
dct = {'cardNum': [100, 100, 100, 100], 'place': ['HOME', 'NEAR_HOME', 'OUT_AND_ABOUT', 'UNKNWON'], 'count': [78, 10, 15, 192]}
 
cardNum,place,count
100,HOME,78
100,NEAR_HOME,10
100,OUT_AND_ABOUT,15
100,UNKNOWN,192
100,WORK,19
201,HOME,31
201,NEAR_HOME,3
 
7:33 AM
how to resolve this?
0
Q: Json file to comma separated file via Python

userI am newbie in python world, Problem: I have some json files which I want to convert into csv, all json files are not in same structure, number of object can be different and some contains array & some not. output should look like: sqID,TID,rdID,rdTime,ccID,versionID,apps,systemDate,seq,fine...

 
@learner As mentioned in our room rules, we prefer that you don't link your fresh SO questions here. We want to concentrate the effort on your question in one place, where it's most useful.
@learner So you need to answer Ilja Everilä's question.
@learner BTW, that code by Birat Bose is not a great example. I haven't analyzed it closely, but it does a few things that are not recommended, like using the global directive, and using except without a named Exception.
 
7:57 AM
well, the comment section on that post is getting out of hand already, so we might discuss it here as well.
@learner Why do you want to convert json to csv? which information do you wish to retain?
 
Also out of interest: why are you posting that question asked by another user here?
 
@Arne It is getting out of hand, but spreading it here probably won't help. ;) But it's ok to offer meta-help here. IOW, help to make the question answerable, but please don't answer it here.
 
huh, didn't even notice they weren't the same person. Might be a lost cause then =/
@PM2Ring Will do
 
This is starting to look slightly suspicious: stackoverflow.com/questions/45163114/…
 
@Arne Me neither. In which case it kind of by-passes our "don't link your fresh SO questions here" rule. :)
Unless Ilja's suspicions are correct.
 
8:03 AM
Of course people have friends and what not :P
 
@MartijnPieters You may like to investigate this...
@IljaEverilä Indeed. We should assume good faith, until proven otherwise.
 
@PM2Ring please do flag stuff. I am about to disambark my train, and it'll be a little while before I can handle anything. Sorry.
never mind, handled.
 
8:22 AM
Thanks, @MartijnPieters
 
8:42 AM
I wish people would stop answering "Why does my code modify this list, but not this int?" questions with "because lists are mutable and ints are not". No, it's because the code is doing two different things with the two variables... (i.e. foo = bar vs foo.append(bar) or foo[0] = bar)
 
That's a consequence of mutability
 
8:58 AM
It's still wrong, and then we get 16k rep users who think an assignment makes copies of ints and strings and tuples
misleading at best and wrong at worst
Hmm, can I get into trouble for posting and deleting a bunch of comments on a low-traffic question/answer of mine to test a userscript?
 
9:25 AM
@Aran-Fey I don't see why that would be a problem. But maybe post a comment there to announce your intentions.
@AndrasDeak Kind of, in that there aren't mutation operations available to immutable objects. ;) But Aran-Fey's point is that the core issue is how name binding works.
 
Mods can see deleted comments, right? I guess adding a small disclaimer would help reduce their confusion about a wall of nonsensical deleted comments xD
 
BTW, I just noticed that your name is now in italics, @Andras. Congratulations! Sorry I wasn't around to participate in the process.
@Aran-Fey Yes, diamond moderators can see deleted comments.
 
@Aran-Fey autoflag for many comments
@PM2Ring thank you :)
 
Hmm, maybe I'll ask the JS people for help before I resort to comment spam, then
 
10:28 AM
@Aran-Fey they're helpful if you ask and respect their rules
 
I just didn't want to ask for help without a MCVE. "Hi, my userscript doesn't work on SO, but I can't reproduce the problem with my own HTML. Can anyone help?" wouldn't be a great question
 
yyyeah, no
if you download SO's html and it doesn't work you can start removing bits to see where it goes wrong
 
Hmm, I might try that, but I'm not sure if it'll help much. There's some javascript and a POST request involved, and that'll probably break if I download the webpage
 
yeah, I could see that
 
10:59 AM
@PM2Ring nice! Thanks, I'll look into that. The folks at code review have been pretty gracious with their feedback as well, I have a busy next hour or so now, great
 
For a couple of weeks now I'm running into problems with pytest and having a src layer in project. Sometimes it will find my code and sometimes it won't. I have an MCVE.
if I change the import to 'from src.test.test_module.some_file import starify', the tests run, but my IDE complains that the src part is redundant.
Am I missing something obvious?
 
pytest recommends the layout with a src directory but doesn't bother explaining how you're supposed to do your imports. Great.
 
11:22 AM
pfft
 
11:34 AM
Guess what the bug in my userscript turned out to be? It's JS inconsistency. How do you do membership testing with an array? array.includes(x). How do you do membership testing with a DOM element's class list? element.classList.contains(x), obviously. Thanks for being consistently annoying, JS.
 
so you were just using it wrong, I see :P ;)
 
n-no! My code was right, JS just interpreted it wrong!
 
typical JS
 
11:58 AM
Here's a silly calculator for the decimal digits of sqrt(2), using integer arithmetic. digits must be >= 2.
 
please format your code ;)
 
Oops! I forgot to hit ctrl-k in my rush to post the optimized version. :)
digits = 100
p, q = 1, 2
for i in range((digits * 10 // 3).bit_length() - 2):
    q2 = q * q
    p, q = p * p + q2, 2 * (p * q + q2)
print('1.', 10 ** digits * p // q, sep='')
 
12:16 PM
Quick guys - setup a Python team: stackoverflow.blog/2018/05/03/… :p
 
it costs $$$, doesn't it? :P
 
nope - free
 
huh?
 
oh.. well... to start with - ugh
 
> Get Started Now
Stack Overflow for Teams is available to everyone now — there’s a 14 day free-trial and after that it’s only $10/month for your first 10 users (additional users are $5/month)
 
12:17 PM
maybe if I asked someone nicely because it'd help with "testing" .... cough
 
give them the puppy eyes!
they should have no chance
 
okay done, with terminal refresh and colours
Thanks again, @PM2Ring
 
No worries, Cᴏʟᴅɪᴇ.
 
@Arne Who knows... if all else fails - could probably fallback to the Katana?
 
puppy eyes -> katana, sounds like a reasonable escalation.
 
12:25 PM
I wonder if they'll have 200 new teams created when someone just wanted to ask a question
Also, nice try flooding the community bulletin
 
I would not register right away just because no one else has, yet, and it'd be really boring and pointless for those 10 days before I revoke and delete to avoid paying fees
 
@Arne You're right... puppy eyes -> "Global Thermonuclear War" is probably far more sensible...
 
those nukes were just catching dust anyways
 
12:47 PM
@user2357112 I like your idea of a MCVE lesson, but I don't see how it could be implemented in an effective way.
 
fwiw, I made a post about my pytest issue.
 
sorry, but I still don't get how teams are different from channels.
is it "teams" in the sense of codewars where teams compete against each other, or is it "teams" in the sense that teams have their own personal space for internal use only?
 
@cᴏʟᴅsᴘᴇᴇᴅ it's the same thing under a new name
 
because I've been getting mixed signals hinting at both over the million and one threads on meta
 
private SO subspace for teams, née Channels
 
12:52 PM
that is way boring
I could ship the codewars thing
 
yes, but it will probably be actually useful, and will bring $$$ to the company
 
why should I be excited if it doesn't benefit me?
I guess I shouldn't.
 
yup
I hate to break it to you, but...not everything is about you :P
 
@Arne I think you should clarify that you're asking about the src directory right at the start of the question. It's pretty confusing at the moment, I think. You only mention the src directory near the end of the question, when the reader is already confused what the heck you're asking about
And I'd also consider renaming the test module to something else, because the project structure is pretty difficult to figure out when literally everything is named test or tests :P
 
@AndrasDeak I'm not saying it is, I just don't get the fuss about it
 
1:00 PM
I'd love it if somehow SO main became a secondary source of revenue and we wouldn't be forced to deal with all the crap
 
@cᴏʟᴅsᴘᴇᴇᴅ if you've ever been in a company that hosted a private "fake SO", this replaces it
 
@Aran-Fey I added a structure. Renaming the test module will take a bit.
 
The Teams thing isn't relevant to me, but I guess I'm a little curious about how it will work. The blurb says that for a Teams user their private Teams space will be seamlessly integrated into the real SO. Does that mean that rep they earn in their Team space will affect their rep on SO main? Or will it be like Meta, so you don't earn rep from Teams posts?
 
I think the seamless integration refers to the UI, but I'm absolutely sure there will be separate rep
otherwise that would basically be buying rep
there was a longer beta period, so posts tagged have some hints, such as meta.stackoverflow.com/questions/364383/…
 
@AndrasDeak Oh, good!
 
1:20 PM
\o rainy-cbg
 
cbg
 
oh that new "NEW" button baffled me on what's new. It wasn't until I realized it was a clickable thing :\
I thought there was something new on the page and I was looking around to see what changed :( Was like "where's Waldo" except Waldo is replace with something new, and that new thing was the button itself in plain sight which you wouldn't think to look at since it seem too obvious.
 
All New™ Stack Overflow© with added fibers. Now asbestos-free!
 
@davidism do we still have any sopython.com email boxes or did that go in migrating to linode?
 
We rely on 15 people to do our science. Without them matplotlib, numpy and pandas would not be maintained.
 
1:33 PM
don't tell the anti-vaxxers and the flat Earthers
 
@Andras but earth is flat... it's a disc... carried through the universe by turtles and all that...
 
forgot to add the thousand odd contributors there
dummy
 
you're probably joking but getting actual releases done and issues closed and PRs merged needs active maintainers
 
is one year worth 100.000$ ? ..isn't that a bit cheap?
 
DSM
Thursday cabbage for all.
 
1:40 PM
legal cabbage
 
cbg DSM
 
@JonClements they'll work for another couple weeks until my last WebFaction payment runs out. I didn't set up mail on Linode.
 
@AndrasDeak The tweet said 15 people "do the science", not "janitor the repository"
 
No, the tweet said "we rely on 15 people to do our science"
 
what's the difference?
 
1:47 PM
@davidism ok - thanks.
 
I guarantee if we removed the current maintainers there would be quite a lot of upset, and it wouldn't be trivial to get the project working the way it does right now
if there are core devs who are not maintainers it would be more easily salvageable
 
okay, my understanding from the tweet was that they were only crediting the core devs for the current state of these libraries and not the other countless unnamed contributors. I might be mistaken
 
The contributors are right there in the screenshot. I think you're reading too much into that tweet, it was just an expression of surprised that the foundation of these huge and ubiquitous (in scientific python) is only a handful of people each
 
DSM
Lots of life has a much lower bus factor than we'd like, of course.
(Aside: recently an architect went through some documents at NumberFirm and changed "bus factor" to "lottery factor", presumably because "bus factor" was too dark..)
 
you're welcome to take a look at contribution statistics to see how much of the codebase actually comes from the core devs; probably a lot
 
1:52 PM
I'm curious how much science is required for the maintenance of these projects, which in my mind does not include implementing new features. How often does a bugfix require you to grok the hard mathy bits, for example.
 
yeah.... I might be reading too much into it!
 
Long time, no cabbage.
 
Like this isn't a sly rhetorical jab saying "I bet they're overstating how important the science is", I actually want to know
 
cbg
 
@Kevin science is heresy!
 
1:55 PM
Let's burn all the science tools, because they make such interesting rainbow colored smoke when they go up
 
@Kevin I haven't contributed to the main libraries but, in the case of SciPy where I've wanted a particular model, it was basically donated by someone in its entirety to be absorbed into the project. It also didn't really work for me, but I suspect that if I raised it on Github, the maintainers would be pretty dependent on the originator stepping in an investigating
 
Scipy needs much more science than numpy, typically
 
On account of it being right there in the name. [nods]
 
The breadth of coverage across the library means that it's unlikely a small bunch of core maintainers could hope to tackle the math side
 
I think "integrating a new model" I would classify as a new feature
 
1:59 PM
mmm, I'm not sure the distinction could be made like this. The model I was trying to use comes under an umbrella of Combinatorial Optimisation, and this was just one of maybe 10 mainstream methods that could be employed
 
It's a pretty arbitrary distinction I admit
 
DSM
flower python- making more flowers isn't a good title, but I like it anyway. :-)
 
This pretty much answers it. In the end it was broken so they just deprecated it because nobody maintained that specific model
 
2:21 PM
Perhaps we should mail them our passwords just to be sure. — Andras Deak 3 hours ago
 
hey guys, I might have found a bug inside of django...
yesterday I wrote this question: stackoverflow.com/questions/50144740/… because I couldn't capture the page parameter
Someone reassured me that I wrote something wrong so I dug into the manage.py shell and ran some requests manually, and look what happened:
>>> requests.get('http://lx-chmmutil02:8000/.../abcd/')
<Response [200]>
>>> requests.get('http://lx-chmmutil02:8000/.../abcd/', params={"foo":"bar"})
<Response [200]>
>>> requests.get('http://lx-chmmutil02:8000/.../abcd/', params={"page":"False"})
<Response [404]>
>>> requests.get('http://lx-chmmutil02:8000/.../abcd/', params={"boo":"True"})
<Response [200]>
>>> requests.get('http://lx-chmmutil02:8000/../abcd/', params={"boo":"False"})
<Response [200]>
Any requests going to /abcd/ with parameters containing the word page dies immediately. Somewhere in a middleware or django itself, it is intercepting that key word and exploding.
 
@OneRaynyDay What happens if you give an integer value for page?
 
@Code-Apprentice I have like 50 lines of these requests to feed my sanity
 
I think this is most likely intended behavior. Django provides pagination out of the box with very little effort.
 
so yes, it breaks
if this is intended behavior they should clearly, explicitly write "YOU ARE NOT ALLOWED A QUERYPARAM CALLED PAGE!"
 
2:27 PM
oh wait...django pagination uses offset and limit as its param names
 
I have a feeling that there is a clear explicit warning not to do this, buried deep within the documentation where nobody would immediately think of looking for it
 
@OneRaynyDay what is the body of the 404 response?
 
{"detail":"Invalid page."}, which means it wasn't me who handled the error.
it HAS to be some middleware or something nefarious
 
doesn't sound nefarious...sounds like some digging into the docs is needed
 
Or digging into the source code.
 
2:30 PM
that, too
 
@Code-Apprentice if version 2.0 is the newest docs, then I have looked
grep on the word paginate and page on their entire url resolution page didn't give me much
 
@OneRaynyDay then you'll need to debug into their source code to find out where and why it has this behavior
 
Sanity check: if you navigate to http://lx-chmmutil02:8000/.../abcd?page=False in your browser, what happens?
Smart money's on "404" but I'd like to know for sure
 
@Kevin yup, still a 404 with the same error
 
Let's see if I can spin up a quick Hello World and see if this problem replicates on my machine...
[EZ listening muzak plays gently in the background]
 
2:39 PM
@Kevin To fully reproduce, I'm using django rest framework, with that specific list view in a ModelViewSet
 
Installing Django... tum tum tum, girl from Ipanema...
 
I add ThatViewSet.as_view({'get':'list'}) as the mapping in my urls.py
If this isn't a django bug then I throw in my towel and I will just change page to paginate, which seems to be working perfectly fine
 
maybe its DRF, not Django
 
@OneRaynyDay umm.... seems to me it's not django, but DRF and what's being implemented in GenericViewSet...
django generally doesn't do anything with query params... but DRF will merge it into .data and other bits and bobs
 
ah, perhaps you're right. I did suspect it was one of the middlewares in my list :P
 
2:43 PM
Having just now spun up a blank default django site, I can confirm that it handles http://127.0.0.1:8000?page=False without crashing
 
I see... :( Sorry for the inconvenience Kevin
I'm looking in DRF's docs for query params
 
@OneRaynyDay cdrf.co/3.7/rest_framework.viewsets/GenericViewSet.html is probably a good start...
 
Now installing DRF... "Add 'rest_framework' to your INSTALLED_APPS setting." My what now?
 
@Kevin open settings.py and look for the INSTALLED_APPS list
 
2:47 PM
Ah, thanks
 
I did a grep on both of those pages, didn't come up with anything. I'll keep looking
 
@OneRaynyDay I'm not sure what you grepped, but the link I gave goes directly to a section that shows how page is used in a query param...and presumably also as a param in the request body as well.
 
Yeah, I'm looking at my settings.py right now.
I'm using LimitOffsetPagination not PageNumberPagination though
 
strange
 
Here's my pet peeve of the day: using the word "output" to describe output
 
2:51 PM
@cᴏʟᴅsᴘᴇᴇᴅ I agree - everyone knows it needs a Salad name instead!
 
"indeed, this code produces output, not a flaming hot dorito."
@JonClements Might I recommend "crouton" for the job?
also, long time no bark :)
 
@Code-Apprentice headdesk I think I found the solution
 
Well I got to the end of the "Example" section at django-rest-framework.org and I can access both http://127.0.0.1:8000 and http://127.0.0.1:8000/?page=False without problems, and going any farther would entail wading way out into the deep end of the pool, so I guess I'm done.
 
@OneRaynyDay do tell
 
I had a custom paginator/permissions/preprocessing mixin base class that applied to a subset of my views. This paginator base class uses PageNumberPagination pretty much. I copy pasted the boilerplate class definition to a lot of views and before I knew it the page parameter was taken by that paginator before it gets caught in my actual view.
 
2:55 PM
now time to fix it ;-)
 
sigh :-( sorry, turns out I am the dummy
I appreciate the effort though @Kevin
 
Beats working ;-)
 
@cᴏʟᴅsᴘᴇᴇᴅ hehe... woof :)
 
cabbage all
 
amg, almost forgot, a new episode of Steins;Gate is out
 
3:07 PM
@cᴏʟᴅsᴘᴇᴇᴅ I'm recommending "fertilizer" - it being both output and stimulating further salad.
 
@toonarmycaptain really? I'd imagine "fertiliser" would be the polite salad equivalent to bad content on the site
 
You make a point, but what does bad content nurture? I suppose it nurtures conversation in the same way as output does.
 
notwithstanding the glaring issue that fertiliser isn't a component of salad (although one might argue fertiliser is used to grow whatever is put into one)
 
Anythings a component of a salad if you're brave enough
 
@cᴏʟᴅsᴘᴇᴇᴅ That was my point, lol.
 
3:26 PM
Ok, lost power there for a moment. Lost network for several moments.
Hey, does anyone produce PDFs using python? I'm library shopping, and a lot of the projects I'm looking at don't appear so well maintained.
 
I think the open source version of reportlab is the general swiss-army-knife
 
Take a look at pdfbox, and pdftotext. They're cmd line utilities you can call from python
pdfbox is used by Apache Tika, and pdftotext I have used successfully in the past, both do their job well
 
I have used Python to generate latex, and then use that to generate pdfs, depends on what your use case is.
 
Think I've also used jinja2 to generate html templates then called something or other (html2pdf?) to get something
 
I'll be creating math worksheets, so potentially needing to insert graphs/images (or images of generated graphs) and space/lay things out with some specificity. I wouldn't mind laying a watermark too.
@JonClements I was looking at something that talked about using pandas Jinja and WeasyPrint that sounds similar.
 
3:36 PM
recbg. I just posted an answer to a tricky question involving pickling an instance of a class with a __getattr__ method. My code seems to work, but I don't have a lot of info from the OP, and if anyone has any suggestions I'd be extremely grateful. stackoverflow.com/questions/50156118/…
I've played around a bit with pickle, but that was years ago, and I've never had to modify a class to make it pickleable before. Also, I'm certainly no expert on __getattr__ and friends.
 
3:48 PM
Is it just me or does that question lack a mcve?
 
@Aran-Fey Sort of. But the offending object is in a large 3rd-party library. And the offending code (the __getattr__) can be seen in the error message. Sort of. ;)
 
import pickle

class Test():
    def __init__(self,):
        self.meta = {"a": 23}
    def __getattr__(self, val):
        if val in self.meta:
            return self.meta[val]
        else:
            raise AttributeError

x = Test()
s = pickle.dumps(Test())
result = pickle.loads(s)
This has the same recursionerror that op is seeing, I think
What I think is happening is, pickle.loads creates a Test instance without calling __init__, and then tries to do an attribute lookup before meta gets created. so if val in self.meta calls __getattr__ recursively forever.
If I add this to the class:
    def __new__(cls, *args, **kwargs):
        instance = super().__new__(cls, *args, **kwargs)
        instance.meta = {}
        return instance
Then it stops crashing.
 
@Kevin Probably. I used that subclass of UserDict because I already had it sitting around, and I tested it fairly thoroughly about 6 months ago. Apart from the pickling stuff.
@Kevin That was my guess. But I didn't think to add a __new__ method.
 
[whistles nonchalantly]
 
Also, I'm a bit reticent to monkey-patch a possibly complex 3rd-party class with a __new__ method. For all I know, it's already got one. OTOH, if its developers went to the trouble of giving it a __new__ they'd also go to the trouble of ensuring that it was safe to pickle.
 
3:59 PM
Yeah, I was going to say, I don't know if this approach can be generalized in a nice way to arbitrary classes
 
@PM2Ring It's a good solution. I don't see anything wrong with it.
 
You need to know what attributes are being accessed inside the getattr method, and you need to be sure you're not clobbering an existing new
 
00:00 - 16:0016:00 - 00:00

« first day (2756 days earlier)      last day (2178 days later) »