« first day (2975 days earlier)      last day (1966 days later) » 

12:31 AM
I HAVE A QUESTION.
 
OK
 
I AM USING PYTHON. I NEED TO KNOW WHERE I PUT MY CODE.
THANKS.
 
I thought the CAPS were for comedic effect. Apparently not.
@ChuckIvan are you done with your yelling requirement?
 
@ChuckIvan please try harder to communicate in a reasonable way
 
Yes. I just found out Martin Fowler published a second edition of Refactoring last week
 
12:58 AM
@ChuckIvan put your code where ever you want
 
Tough crowd.
 
I wouldn't say that. The mods are pretty permissive (this is not an invitation to try be disruptive). If you have a serious question then maybe we can help
Outside that of that, we do actually have a sense of humour
 
1:47 AM
Yeah my Dog Binning Algorithm joke yesterday went over better but I can see now my mockery isn't creative
cbg
 
 
3 hours later…
5:16 AM
back to leaderboard
 
5:42 AM
@AnttiHaapala I started late ;-(
 
@Code-Apprentice you can use SimpleNamespace to avoid all those annoying ['']
 
@AnttiHaapala That is quite a helper module you have there. Did you develop it all yourself for these problems or borrow it from somewhere?
 
all myself
and then ofc wim's aocd is what makes it truly fly
@Code-Apprentice mine is noticeably faster than yours, see this
 
5:48 AM
I think I heard someone mention wim's lib last year. I haven't looked at it, though.
so the slices make it slow?
 
slices until end. each slice needs to copy the entire tail... and then you need to pass these around.
 
I also didn't memoize results
it ran fast enough that I got an answer so I didn't go back and do that optimization
I'm doing pretty well this year. I already have more stars than I earned in each of the last two years
I'm glad to see some serious improvement in my coding skills.
 
6:07 AM
@Code-Apprentice you still have only silver star from yesterday,
 
yup, haven't finished Part 2 yet
I'll work on it some more tomorrow
 
@MarcusAndrews interesting, you're above me on the private leaderboard but not on the public
 
I'd love to see a breakdown of each person's points per problem
Is that available through the API?
yup.
its my bedtime. rbrb
 
 
2 hours later…
7:55 AM
The advent of stacks ... although @AnttiHaapala used an iterator. :)
 
 
2 hours later…
9:28 AM
Is it possible to somehow hack out some HTML to let answers link to other parts of the same answer?
 
10:03 AM
I have a stack of activation records
 
10:52 AM
@coldspeed I think you can reference the id hash e.g. #answer-53681545 on stackoverflow.com/questions/53675579/…
 
@shad0w_wa1k3r Ah, I meant linking to different parts of the same answer (imagine an answer you'd have to scroll for quite a bit), not different answers in the same post.
 
oh ... :(
 
 
3 hours later…
1:42 PM
late and buggy cbg
 
2:17 PM
anyone using Spyder IDE?
 
3:15 PM
@Aqua4 yep
 
3:33 PM
cbg
 
cbg Jon
 
how goes it?
 
I'm good thanks, you?
 
bit tired but otherwise fine and all that :)
 
lazy weekend to recharge?
 
3:38 PM
that's a plan but not one that's really working out sadly... but... shouldn't complain
 
Still time to pull things back on course :)
 
sausage roll certainly wouldn't hurt :p /me ducks and runs
 
3:54 PM
Haha. What's worse is my absence may have led you to believe I was off to fetch one. I wasn't. :P
 
Well... I hadn't presumed it was to set up a pork factory and bakery or something... so no worries :)
 
That would have been an entrepreneurial explosion in response to such a request!
 
would have certainly seemed like an over response to just popping to Greggs for sure :)
 
@ThiefMaster can you comment on github.com/pallets/werkzeug/issues/4#issuecomment-445373319 when you have a chance? Just need a push to make a decision one way or the other on those.
 
4:06 PM
is anyone using them? that comment is the first time i ever heard of them
damn, github considers .pyi files python code when searching globally...
so tons of people who committed their virtualenv folder make the search results for that useless
 
@ThiefMaster who the heck commits their virtualenv folder though? wowsers....
 
23k+ idio^W people apparently :/ github.com/…
 
how about advanced search with extension? github.com/search/advanced?l=Python&q=spam
 
now i'm getting the .py files from the same virtualenvs, and there's no negation for the "In this path" criterion
 
@ThiefMaster the problem I've found with GH search is that way too many people have just copied Werkzeug, so all it turns up is the file itself, copied, or its tests.
You can get a little better if you search, with quotes, "from werkzeug.contrib.fixers import".
 
4:15 PM
@ThiefMaster I suppose it's easy to miss a .gitignore or something :)
 
but heck, those virtualenv's must outweigh the code ratio to what's actually there on a massive scale...
 
@ThiefMaster there's no pleasing you
 
Wow, their advanced search doesn't have negation for anything. Does adding "-" in front work?
 
@AndrasDeak typical of cats - especially those with 8 legs or something - it's the puppies you can trust :p
 
4:42 PM
Hmm, I could have sworn python -m package executing package/__main__.py was a Python 3 thing, but it works in Python 2.7. Can't find the docs about that.
 
5:07 PM
I was playing with a super simple Flask app that loads an image and then shows how you can update a small box with AJAX. The image is a random cat picture I found on the internet. I'm not too hot on licensing at all; is this out of bounds for SO?
The image comes from a Google image search so, to me, it's open domain but I'd rather not contravene something I don't understand so I'll rethink my example if licensing comes into the equation at all
 
Hey guys
 
I just need some kind of static content. A cat seemed appropriate.
 
beginner to python
any good open source python packages on github that i can start contributing to ?
 
5:25 PM
Hi, How could I stop threads and remove all queues' items after something happened? I have written a brute-force script, I want to stop threads if a password was found or status code became 200
 
@A-O welcome, please read our room rules: sopython.com/chatroom
In particular, use a paste service for large blocks of code.
Also, it sounds like you're trying to crack passwords on a website. Don't do that.
 
@davidism Hmm, May I ask you why?
 
@A-O I'm not sure the ethics of such things are unclear?
 
Sorry, I misspoke. You can of course do that in general (although really, don't), just don't do it here in this room.
 
@roganjosh Hmmm, I don't know, Maybe..! You know, I think if a website hasn't done anything about its security issues there is no problem to do these kind of things
 
5:36 PM
@A-O ugh, I think you're completely missing the point
"these people left the door open, might as well walk in and take their TV"
 
I'm kinda inclined to agree, if you end up passing the result back to them to fix the issue and don't exploit it. But I have no idea who you are, so would you expect me to blindly help you on the assumption that you have good intentions?
 
(except the door was left open by the landlord)
 
@A-O if that's not the intention, then you better hope you haven't put some of your own personal details in the hands of anyone and your clone comes back to bite you. The people actually hacking accounts don't pop into the Python room and ask for tips or help.
 
well, perhaps some of them do
kid:
1. ???
2. run script
3. profit
 
Ok, well I can't say for certainty, but I'm guessing it wouldn't be so blatant :P
@AndrasDeak why is the ??? always so difficult to resolve? :/
 
5:44 PM
"I'm new to python"
 
@roganjosh Yeap :p Is the intention really important to anyone? I mean I just asked a question, Who cares what I'm going to do with the answer!
 
Yes, intentions matter.
 
I care
 
what's that sound?
/plonk
Light of the Seven from the GoT sound track. This is sooooo good.
 
@roganjosh I don't usually do hacking or something like that! Just sometimes I do things for fun :d
And of course, I want to experience new things
 
5:55 PM
Is prison on your list of things to experience?
 
you are more than welcome to do them somewhere else
 
@Code-Apprentice no kidding, that comes up in my rotation :) youtube.com/watch?v=e4eWbqAGEA4 is my new favourite with "hereafter". Certainly injects urgency into your work :P
 
Ramin Djwadi is just a brilliant composer
I love everything I've heard from him...GoT and Westworld sound tracks
 
Two Steps from Hell is great for lyric-less music too because it gets itself stuck in an internal loop. Otherwise you inevitably end up back on Coldplay.
 
@roganjosh I'll queue that up
 
6:23 PM
@roganjosh that's really good. Unlike the GoT soundtrack, I don't have any scenes that I can visualize to go with the music.
 
@Code-Apprentice odd as it sounds, I can't focus without some kind of dramatic music playing at the same time. I'm always out looking for some music to lock my mind :)
 
when I put on headphones and tune everyone else out, I definitely get more done at work
I do some hard rock and punk as well as instrumentals like this
And stuff like Elise Trouw
 
I can listen to things with words if I know the songs well enough. If I don't know the songs, I get distracted by the lyrics
Or, you know, if they're bellowing in Latin, that's fine too :P
 
yah,depends on the songs for me whether the lyrics are distracting or not. And I cannot do music videos...WAAAY too distracting. Elise Trouw's videos are amazing because she plays multiple instruments and uses a looper machine.
it's just as much fun watching her do all that as it is to listen to the music itself
 
Have you listened to The Piano Guys?
 
6:32 PM
I'm also into this instrumental guitar group named Polyphia. I'm always amazed just watching them play.
 
That's another closed loop on YouTube, it will just cycle their songs
 
I've heard of Piano Guys...I think I've listened to some of there stuff but can't remember off the top of my head
 
ooo...they have a cover of A Million Dreams from The Greatest Showman
that's a good song
 
mmm, this PC doesn't have VNC media player installed. I'm now suspicious about whether this is my main PC at all or whether it has been swapped out by the authorities for talking to our hopeful hacker
 
6:45 PM
@roganjosh I'm not familiar with the Beethoven song but I now the One Republic one
interesting combination
 
@Code-Apprentice They're pretty good at mashing things together. When I was at uni I had to move house every year and had no money for an electric piano so I let it all drop. They inspired me to go buy an electric once I got settled after.
 
cool. I don't know how to play any instruments and I'm always amazed by good musicians.
 
I used to play classical music but I do appreciate their kind of music too, which is more in the popular domain tbh
I was self-taught at that too. "Play" may be a stretch :P
I did have 4 lessons but apparently I shouldn't be trying Rach after a few weeks. Tbh the teacher was probably right but it didn't gel with me, so Rachmaninoff shall forever turn in his grave when I sit down at a piano.
 
7:16 PM
Want to know more about python -m, sys.argv, and sys.path, and the Werkzeug reloader than you'll probably ever need? github.com/pallets/werkzeug/pull/1416
4
 
Cabbage, folks. I'm somewhat confused as to what is the best way to handle this pandas question. Read on a bit, and you'll notice it at once; the post is inadvertently dealing with two questions, one of which the OP didn't ask (which also happens to be the more popular question).
I've done my best by adding a notice at the top of the post and editing the title, but perhaps something else would've been better...?
 
@coldspeed I would drop "Hello, Reader" straight away tbh. I'm not sure how your edit fits in the rules of SO (I'm not saying I disagree with it) but this immediately invokes Wikipedia-authority in my mind, and you're really not speaking on behalf of the OP or SO
In other words, it looks like a site banner atm
 
I concur
 
Yes, I'm not happy with the fact that the question is actually two questions in one.
But how should we clean it up? Should the answers be changed or the question? Is it more important to fix the question for the benefit of the long term crowd?
This would also risk invalidating a lot of the answers, including the accepted answer.
Thanks for your input, btw.
 
7:31 PM
Yup, can't touch it because if the answers don't overlap. I'd just tersely note that one of the questions is answered in [list of answers] and the other in [other list of answers]
bah, too late to edit the nonsense
 
I was afraid of that, but OK, that's good to know, thanks again :)
 
(or, you know, leave it alone, but that ship has sailed)
 
Well, at the very least, I would provide a better answer (that addresses both questions better than the other answers have), which I've done
 
7:52 PM
Cbg. I’m looking some help with AoC 7, problem one. I’ve been hacking away to no avail. I initially tried convoluted if, else type stuff but no amount of tinkering would work. I’ve now decided on a dictionary, but cannot figure out how to create a tree of some sort. If anyone could offer a hint or a bit of advice I would be grateful. Here is my current attempt: dpaste
 
you don't necessarily have to create a tree
 
yeah?
 
the dict you have is almost what you need: you probably have to invert it
 
swap keys and values?
 
instead of doing C -> [A, F] try constructing E -> [B, D, F]
i.e. instead of keeping track of dependencies, keep track of prerequisites. At least that's how it was logical to me.
hmm, I guess what you have should work too, just with different logic :)
 
7:58 PM
I have solved for test case with two buggy functions but they fail on real input.
 
in your case you'll have to loop over all the keys and check "nobody depends on this", i.e. no value corresponding to another key contains that key
 
@W.Dodge are you familiar with the AoC subreddit?
might be a good place to post a question or to do some research to see what other people have done.
 
@Code-Apprentice No, but it is listed as an option on the answer submission page. I wanted to stay out of there because I was afraid the answer would be right in front of my face. But I will go that route.
@AndrasDeak I think you've got me pointed in the right direction. I'm going to run with that. I think it will work. Thanks!
 
yah, use it with caution if you care about spoilers.
 
@W.Dodge no worries, have fun
 
8:29 PM
hey whats the library that lets me just import my aoc data?
nm
 
8:44 PM
@W.Dodge I actually put both conditions and prerequisites as values, C -> [[], [A, F]]
made the loop logic super simple
 
Rob
8:56 PM
hello world
 
@davidism That is quite good to know, since I write a lot of packages with __main__.py entrypoints, and I never ever want to hunt down this kind of bug myself
Hi rob
 
Rob
Need help with this loop I'm working on...
 
@Rob please don't paste huge chunks of code in chat
 
Rob
sorry :?
 
better to use a paste service like dpaste.com
No problem
 
Rob
9:00 PM
Here it is again: dpaste.com/2XTH1AK
 
alright, what are you trying to achieve?
 
@Rob please explain the issue
 
Rob
Sorry I'm trying to find the min and max for the two sections
 
*dt[:3] is confusing me, why are you unpacking this all the way through?
 
Rob
9:10 PM
was trying to add details, my appolgaies
well I just wanted the date part :/
 
Then your answer can likely be found here: docs.python.org/3/library/…
 
For code clarity, I'd unpack it once and assign that to a name that you can use in your conditions
 
the datetime library defines its own minilanguage which you can use to turn most kinds of date formats into a proper and well defined date object
 
Rob
@Arne
@Arne Thanks! same goes to the suggestion @ro
 
Mmm, i wish i could run it locally but im out now so maybe im off the mark
 
9:29 PM
9:30pm and the live act hasn't started in this sleepy village :/
 
Oh man, I went through the work of writing a smart solution for today's AoC
turns out the gain from caching sub-results was less than the setup to put all the nodes into node objects
I'm pretty sure I even reduced the big O complexity. Too bad wall time don't care.
 
I was gonna start AoC today but in recovering my github, turns out I've still got permissions to my old company's code base and got distracted :) great security, I've only been gone 2 years!
 
I started late today, had to go to a tire shop in the morning
 
*tyre. Pick the correct version of English :P
 
I actually wrote it as tyre first, then googled "tyre shop" and I got too few results :P
and I even knew it should be with a y but...it just looks so weird, to be honest
 
9:38 PM
Yeah, I never said it made sense :P
 
wim
@AndrasDeak actually, you don't even need a dict. view spoiler.
 
sure, but they had one to begin with
 
wim
the tree practice would come in handy for the next day though, LOL
although Antti had a nice queue-based solution without tree building!
 
I haven't implemented so many graphs in my whole life
 
 
1 hour later…
10:51 PM
hello?
is anyone here?
 
nope
 
sorry thanks
wow I didn't know that these stack exchange chat rooms are so empty
I have a large assignment due wednesday
the project uses tkinter and matplotlib
the code worked fine
but now I get kernal restarting for some reason
the program runs until it hits tkinter.Tk()
where kernal just crash
with no notice
I figured out that if I remove from matplotlib.figure import Figure, the program will run further till it hit a Figure
can you help me out here?
 
Most people are either familiar with tkinter or with matplotlib as far as I can tell. So I suggest coming up with a short MCVE that reproduces your issue.
you'll also have to clarify what "kernal" (kernel) means.
 
Im just using spyder
and it says kernal restart with no other notification
 
that might cause half your issues
 
10:59 PM
and restarts the kernal
 
have you tried running your code outside spyder?
 
(assuming it even runs outside spyder)
 
the exact text that spider gave me is (Kernel died, restarting)
 
kernel is ipython/jupyter lingo so I'd expect a more informative error message outside spyder
 
11:01 PM
you mean like in a log somewhere?
 
are you on windows or linux?
if you run your code from a terminal (or cmd) you should see error messages if the code crashes
 
I am on windows right now
true thanks
Im trying to try right now
installing dependencies
 
OK
your dependencies should already be installed...
 
but I did see some notes about deplication of library so Im quite worried about that
 
whatever python spyder uses is already there
you mean deprecation?
 
11:03 PM
yes
and I saw some time ago in github that they the priority for tkinter support is low since not many people use them so Im a bit worried
 
tkinter is standard library, so you shouldn't worry about support
 
of course you shouldn't use ancient features of ancient library versions, where deprecation warnings may come from
 
Im trying to run the program right now could I have a sec sorry
Unable to create process using '/usr/bin/env wolframscript newMain.py'
I get that message
 
wolframscript?
 
11:08 PM
I have no idea my command was py programName.py
 
so try python programName.py instead?
or python3.6 or something
or use a virtualenv...
 
oh wow I get different output
Im sorry but what is the difference?
 
no way
python is python, py is whatever was installed by something by that name
 
strange because I made a test python program and run it and it gave me correct output
that is why I was taking a bit time to run
I am seeing something strange again Im trying to verify its correct before spamming chat
 
thanks
by the way wolframscript as its name suggests seems to be an execution engine for mathematica wolfram.com/wolframscript
incidentally mathematica also uses a kernel in the same context, but I wouldn't expect it to play nicely with python code
 
11:13 PM
thanks for the info
I am observing a phenomena that I can't really explain so I am just going to tell you what I am seeing
or rather what I did
 
make sure it's informative without me having seen a single line of code yet
 
sure
so in spyder I was trying to see what was causing the kernal to die by inserting lots of print statements
I found out that all print function before tkinter.Tk() is printed out and everything after is not printed out
the program also says The matplotlib.backends.tkagg module is deprecated.
"3.0", "The matplotlib.backends.tkagg module is deprecated.") Im guessing the library I imported is saying that
so I commented out "from matplotlib.figure import Figure" then I observed print statements made after the "tkinter.Tk()" line, so I guessed that the problem is occurring in due to the imported library
 
@WantingtobeanAndroidDevelor yup, with the backend chosen by matplotlib
 
However!!! when I run it on cmd
 
(I've never seen anything imported from matplotlib.figure, by the way)
 
11:18 PM
it seems to go a lot further even when "from matplotlib.figure import Figure" is imported and gets stuck at an infinite loop at much much further part of the code
 
Be back later, got to walk the dog. Don't let this stop you from elaborating, others might also be able to help
I suspect spyder imports matplotlib (it does all sorts of weird things on its own) and chooses the tkagg backend, which doesn't happen when you run outside spyder
 
and so I am very confused, because if its the infnite loop that is causing the issue, all the print statements made after tkinter.Tk() should pop up and "from matplotlib.figure import Figure" should not make a difference
@AndrasDeak thank you very much you have been a great help
@AndrasDeak well I chose to import tkagg backend because apparently that is how you are supposed to implement matplotlib in tkinter
@AndrasDeak I fixed the problem that cmd error message told me to fix and it works on spyder fine as well now. I still can not explain the phenomena that was causing the spyder kernal to crash at much earlier line so I should recreate the phenomena and report back to spyder as it actually told me to sometimes when kernal kept crashing but Im not going to since I don't have much time right now. YOUR ADVICE SAVED MY PROJECT THX VERY MUCH
BTW the problem that cmd was able to point out is that I had infinite recursion in my setter method @a.setter a(a): self.a=a, so I don't know what made spyder fail to reach the line but its fixed now
 
11:34 PM
@WantingtobeanAndroidDevelor no problem, glad you could solve it
I've never used tkinter so the rest can easily be fine
 
Does @something.setter make the code cleaner? Because it force you to have a private and a public property of the same thing? It feels like the code becomes more complex when you used the decorator than just having a .settSomething()
 
just remember that spyder does some very surprising things (like import submodules without your knowledge) that may lead to different behaviour on spyder
 
Yes I actually prefer the default IDE I don't know why anaconda kind of force you to use spyder
I realized how dirty my code is recently
 
@WantingtobeanAndroidDevelor if your attribute is just a regular variable that you change directly there's not much point in fiddling with getters/setters in python, since there are no private variables of the usual sense
 
yes but in this case, I want it to change other attributes as well when value is set
 
11:37 PM
I've never used properties so take my impression with more than a grain of salt, but it seems to me that properties are more useful for attributes that change dynamically or have some kind of other nontrivial behaviour
@WantingtobeanAndroidDevelor ah, yes, that makes sense
 
and it seems the time at which I introduce properties become inconsistent
 
@WantingtobeanAndroidDevelor I can't comment on that, having never used them :)
@WantingtobeanAndroidDevelor I'm pretty sure anaconda doesn't force you to use spyder
how does it force you?
 
that is fine thanks but I became embarrassed when I was searching on how to make cleaner code and everyone was talking about python labels and properties and I had been ignoring them after 3 years of use of python
 
meh
 
I had a strange set up before where anaconda was shared between multiple user and the "python kernal" used was different in default IDE and spyder
Im not a CS student but I am a physics student so people around me write some disgusting code
 
11:40 PM
no kidding
do you also use MATLAB?
 
So I used to think I write beautiful code until I started my project and realized that I was wasting a lot of time debugging caused by dirtyness of my code
 
@WantingtobeanAndroidDevelor at least that's educational ;)
 
no I haven't been using matlab just matplotlib and I am writing the physics logics my self
 
OK, because some of the weirdness of spyder comes from it mimicking what MATLAB does. But then this doesn't tell you much.
So why do you want to be an android developer if you're learning physics? :P
 
yes it seems to like communicating with the developer some times
no I chose this name like 6 years ago when I actually wanted to be an android dev
 
11:42 PM
hehe, I see
you can change your username here every 30 days if you want to
 
its part of my identity now
lol
 
yeah, I understand. It was just an FYI :)
 
thanks for the helps though it was seriously helpful
 
No problem. Have fun with physics
 
do you happen to work in the programming industry by any chance?
 
11:45 PM
Nope. I'm a physicist in academia :P
 
oh wow
I hope you are not my lecturer
 
Hehe, unlikely
 
because that would be seriously awkward
 
I only teach intro maths and physics, and more importantly this is my real name
 
If you think you are good at programming, what kind of field should I look into?
 
11:48 PM
Field within physics?
 
yes, well I guess what field should you aim for would be better question
I am intrigued by relations between theoretical computer science and physics, like how Turing's machine would apply in physics etc
 
There's probably lots where you can use programming. Both experimental and theoretical
I'm in a branch of computational physics. All I do is use and write code
Though much less coding compared to a software dev job
(Hard to publish dev time)
 
Do they look for the physics knowledge or computer science knowledge more when applying for that kind of field?
The project I'm currently doing uses genetic algorithm to control an electron through some E field and B field, so I guess I'm also interested in application of machine learning in physics as well
 
Probably physics. But I often see job/phd offers from computational groups with emphasis primarily on development
But I have a very narrow perspective only on my own narrow field...
 
Thank you for the information they are really helpful for me, I have not even graduated under graduate so.
 
11:54 PM
Anyway, it's 1 AM here :) No problem, good night
 

« first day (2975 days earlier)      last day (1966 days later) »