« first day (2167 days earlier)      last day (2782 days later) » 

12:26 AM
I have to say, this is actually a good question. OP explained what they are doing, showed the code, showed the structure and exactly what they are trying to do
Granted a very new programmer, but that does not matter. The question itself is put together nicely.
 
always nice to see - you watching the game?
 
about to...only for a bit. I actually play hockey tonight at 10 :P
 
cool, league or just for fun?
 
@idjaw Nice. Questions like that restore my faith in at least some programmers not destined for PHP
 
one day it will all be JS - for it is written And this will be a sign of the end...
 
12:33 AM
@JGreenwell tonight is for fun. It's 3 on 3. Sunday's I play in a league
 
kids started skating yet? (I always assumed that Canadians are born with a hockey stick in their hands and just play street hockey before they skate so I won't ask that question ;)
 
@WayneWerner Yep. I almost feel like telling OP they wrote a good question :P ugh...and now someone just put together a really useless unnecessary answer to just throw confusion in there
@JGreenwell haha...My son had a hockey stick before he was two...the skating not yet...I'm starting this year with my son.
 
I'm trying to get my son into sports (hockey + Florida is not an easy fit) and he is enjoying street hockey
 
@JGreenwell we tried soccer this year it didn't go well.
 
its hard to get that "don't pick the ball up" when before this every game with a ball was "catch"
 
12:36 AM
@idjaw Oh, silly posters who don't read/grok or are just trying to get rep :P
 
and the defence comes up
The reason I am suggesting this is because, he is trying to get only couple of values. If he is printing every key-value pair, the simple solution above would work. Otherwise, the above solution given is buggy. — Prabhat Ranjan 1 min ago
I had to answer back to that...
it is just so flat out wrong I could not leave that hanging there.
 
but, but...dicts have to be ordered: I mean when would you ever want an unsorted dict!?
 
why would you even want a dict
too complicated and too hard to write
 
Some people's kids :P
 
dict is terrible for this (I just keep hearing that argument from people lately)
 
12:42 AM
Heh. I wonder what their solution is
pandas.DataFrame, probably
 
ok it makes sense now
that answerer does not know how to use a dictionary
they think it has to be treated like a list
 
they just copied and pasted from the first question they found which seemed to match this one
at a guess
 
and now the overly engineered question to the learning-OP just got posted
I love this
 
I wonder if I'm being extra hard on people right now (I typically get really hard on CS students around the start of the fall semester cause I just get bombarded by requests for help that show no effort)
on and off SO
 
I think your mind is just trying to prepare you to be more selective since you will be overloaded with too many questions to handle that you need to make sure you give the right ones attention. :P
do I give up? This is getting ridiculous
I do understand how to access data in a dict. Check my solution, did I not access data in similar but more dynamic way. Although, I do get your point here that for beginners its confusing. — Prabhat Ranjan 1 min ago
 
12:59 AM
today I got asked about 12 times and 4 different ways to write a foreach loop for a student, after a lot of time working on this concept with no effort on their part.
Then I realized the code he was using already was plagarized and this person was non-chalant about it ("who cares? I won't use this again")....
so I wrote the code for him, using someList.ForEach((temp) -> { do stuff; }); instead of a for loop over an array which is what it was suppose to be, and sent a note to the professor letting him know to make the person explain the code and that extra work should be assigned to this person if he is allowed to continue
 
:)
academic life...it really never changes
on that note...time to sports
Changes Lego parts
 
I also told the kid not to use my code (it was just an example for him to "learn") and to change his other code so I gave him a chance - we will see (not much hope there)
have fun idjaw
 
Well, maybe with 3 downvotes Prabhat will self delete.

(we wish)
g'night rhubarb, goodnight moon
 
1:56 AM
@JGreenwell I tell people to basically write in english logically what they wanted to do, I found that people who can't do this can't code at all, but those who could figured out how to write the english almost always immediately figured out the coding side
gosh the recent python questions are... bleh
was hoping to find one interesting enough to look at
 
2:30 AM
Uncle Bob talks about how the number of programmers doubles every 5 years - thus we are in a perpetual state of noobness. Since Python is increasingly a first language, I wouldn't expect the average quality of the questions on Stack Overflow to improve without a change in the system.
 
2:46 AM
ffs. ask another question, immediately get a comment with factually incorrect info
we need to make a paid version of SO where only non-idiots can be. :'(
 
There are a lot of idiots with money out there.
 
then I'll separate the two, and still be happy :P
 
I have a feeling Experts Exchange has a lower quality of content than Stack Overflow, but I haven't done an impartial objective empirical analysis.
 
ffs. another different user continuing the trend
this is what I get for becoming an expert
@AaronHall don't encourage them
it's annoying enough getting shit comments, answers make it so no one else looks at it
 
They'll learn not to write bad answers when they get downvoted and contradictory comments - then they'll either fix the answers or delete them. But they'll learn.
 
2:54 AM
that's not how SO works, you know that
 
C'mon people learn, the system works, kinda, sorta.
 
 
1 hour later…
4:18 AM
Cabbage :-)
 
4:29 AM
cbg
 
4:40 AM
hyf
 
hyf to you too
 
Does anyone know anything about JWTs?
JSON Web Tokens*
 
 
1 hour later…
5:55 AM
@DSM haha that rather sounds like "aww, now how sad it is to hear that", better just say: "Otan osaa" for "I partake (in your sorrow)", i.e. "my condolences" :D
 
stackoverflow.com/questions/39608194/… I edited out the my assignment is due at 10 part...but OP is now trying to ask questions in the comments to complete assignment.
 
and cbg
@IljaEverilä do you concur^ with me
 
o/
 
(about ice hockey loss yesterday :D)
 
6:01 AM
Did not watch
 
well I know that and that wasn't what I asked
but Finland failed the chance of getting anywhere in the world cup by being defeated by Sweden 2 - 0.
now the only positive thing that can happen is that we defeat Russia, which still wouldn't mean anything
 
6:17 AM
Well, it's no news that Sweden beat us in ice hockey
The question is just "how much"
Yeppers, "otan osaa"
I must confess that I'm getting annoyed by this: stackoverflow.com/questions/39589347/…
 
ick...that's long and not fun
oh no....
LPTHW suggestion....
0
A: python script to read a file in different ways

Dinesh PundkarThere are couple of issues. As mentioned in comment, always call <ClassName.FunctionName()> not vice-versa. Second, either you have write constructor/initializer in class or you have to define all methods in class as staticmethod. Please go through this link for Object Oriented stuff. For stati...

 
@idjaw wat :D
 
6:33 AM
@AnttiHaapala That answer wouldn't make you happy. It's Python 2, and a bad Python 2 answer too.
 
argh
yeah
 
hehe I love this. Stroll in to question late....read comments...collect comments....make answer from comments....try to profit
 
Yeah, the problem with OP's code is that there is no actual class. There are just 3 functions in a class body with no apparent reason for being bundled together. — Antti Haapala 8 secs ago
@IljaEverilä you should make the exit, exit being recursive portmanteau of everilä exit.
 
Yeah...there is no need for classes, but if OP is doing classes, they should at least be taught to do it right :P
 
yeah but that is where zed a shaw starts teaching it very wrong
"classes are like mini-modules"
no they aren't
wtf this shit.
 
6:40 AM
I actually went through LPTHW several, several, several years ago. I barely remember it
I do remember at one point realizing....this is not fun...I want to do other things
ergh it's already almost 3 am what is wrong with me
OK....Antti, I leave you in charge now. Try not to burn the house down
:P
rbrb o/
 
idk what to do with it
 
Go to bed.
Have no fear, Fizzy is here.
 
oh gawd Fizzy shows up right when I'm going to bed
ok ok..screw this. I'm going.
 
I downvoted the question, the answer etc.
and cvd the question
the question is about simple typoes :D
ah well cv pls
cat_method1.Cat()
NameError: global name 'cat_method1' is not defined
one problem per question and since that is the first and foremost problem, and it is a simple typo/brainfart, then we close it, as it has been shown in the comments and answers how to do it
 
7:01 AM
cbg
 
Hi there
Noob question, but is anyone trying to deploy a simple Flask web app using Elastic Beanstalk here?
 
I'm running into some problems and could use some help!
 
user6568562
Cbg
 
o/ @RobertGrant @randomhopeful
shoot @TheStupidEngineer
 
user6568562
7:15 AM
Eyo @AndyK What up ?
 
not too bad matey. Trying to solve some of the questions on SO
 
user6568562
Nice
 
hey guys...new to python from Java background...how do you document functions? Am using PyDev plugin in Eclipse. Usually putting /** "before" function and hitting Enter used to auto populate essential doc comments like @param @return in Java. I read that we do triple double quotes inside functions. But I dont find the eclipse environment auto-generating any doc comment markup like @param , @return in case of Java.
Are we supposed to write all on our own inside """ ... """. Also is their support for some kind of html inside """ ... """. In Java we can have <ul><li></ul> inside /** ... */
 
@Mahesha999 It depends on the library you choose to use.
There are many, Sphinx is one of them (to give you something to google)
 
7:28 AM
Is sphinx is about "generating" docs? I was looking for something which will allow me to have Java like behavior. Put comments with @param and @return and then when I use that function, it will show up those stuff in popup
I mean when I do functionName. (putting dot should show the doc)
 
You'll need to see what the PyDev plugin supports. I don't know anyone that uses Eclipse for Python dev, so can't help you.
 
ohhhh so what u guys use? Also does it support what I say?
 
I personally use JetBrains PyCharm.
 
ohhh yeah JetBrains is really good even at Java
btw it is not free. what to do? only community edition is free, not professsional. Somehow I wont feel good with that...???
 
You won't feel good?
If you want to feel good and use the professional version, then pay for the professional version.
Otherwise, just use the community edition (which you're allowed to use for commercial work anyway)
 
7:37 AM
haha yess sure...
I used ItelliJ it is better than Eclipse...but then not all stuff free like eclipse...
 
I can't tell if you're being sarcastic or not.
 
I'm using the free version of PyCharm right now. And I'm loving it.
 
Typo or Cannot Reproduce Finding Total and Average Sales in Python - BRose‎ - 2016-09-21 07:40:34Z
 
I guess I will give PyCharms a try...my usual concern is hopping between keyboard shortcuts across IDEs
 
8:06 AM
Well feel free to use whatever you want, obviously, but if you do use something that nobody else uses then you can't expect much help.
 
I've used PyDev in eclipse (same background). I found it very clunky
Might be better now and maybe I didn't explore it enough.
 
8:33 AM
Morning Cbg
Pycharm's great tbh.
The best bit for me was that I've 'discovered' more and more features as I've got better at coding and wanted to do more stuff. I had a prospecting dig a few weeks ago, and had a lot of "OH, WOW" moments. Should probably have rtfm at the start tbf.
 
8:49 AM
Thanks @AndyK I'm trying to update a simple application on EB.
It consists of a Dockerfile, requirements file and a Flask hello.py file.
All I'm doing is changing the text from 'Hello World' to 'Hello, Cruel World' in hello.py, but I keep getting version errors. I'm not sure what the fix is.
 
@TheStupidEngineer are you getting them when you do docker run? Or some other time?
 
I have tried to ask a question about plotly: plotting big tables of datasets with it, but it seems no one has addressed this issue before. The problem is that if I try to plot the dataset from a .csv with over 4000 lines the resulting .html generated by Plotly does not run in browser. Maybe anyone here is familiar and can give me a tip on what am I supposed to do about it? Or if there is an alternative.
 
What does it say in developer console in the browser, anything? What have you done to try and troubleshoot?
I do love these drive-by queries...
 
9:14 AM
cbg
@Mahesha999 I use Eclipse for Java IDE, and it works quite fine to my taste, but PyDev is just horrible. PyDev can be mentioned in a same sentence with PyCharm only if the sentence has the structure "PyDev, unlike actual working Python IDEs such as PyCharm..."
 
cbg antti
Do you find it odd going from PyCharm to Eclipse? (Is that for Java Java or Android Java?)
 
javajava
and eclipse plugins
Above I am trying to paraphrase Douglas Adams, poorly.
 
@Withnail It does not say anything. The file doesn't run at all. I tried creating smaller tables and they seem to run okay, but at some point after a certain number of rows it stops working.
 
Found the original
WFT-II was the only British software company that could be mentioned in the same sentence as such major U.S. companies as Microsoft or Lotus. The sentence would probably run along the lines of "WFT-II, unlike such major U.S. companies as Microsoft or Lotus ..." but it was a start.
lol at the newly flagged post
 
So you load the file in the browser, and there's nothing in the debug console?
 
9:23 AM
@Withnail Nothing.
 
@Withnail I'm getting them when I upload the archive and deploy to Elastic Beanstalk.
Feels like I'm doing my version numbering wrong, or EB is caching a previous archive somehow.
 
9:39 AM
@Withnail maybe there is some alternative I could use which would still work with plotly features?
 
whatever I am living with PyDev currently...may be I have not reached the saturation yet to find PyDev is bad
 
I want to call method of class like class_object.metric_name.save() where save is method of some class and I want metric_name to be dynamic based on some kind of array vaue
is there any way?
 
@Mahesha999 pydev:
that would barely beat walking/running...
but a real bicycle is a different thing.
@InderpalSingh yes, there is some way.
and the best thing you can do is to a) make a detailed question with all the information and b) your best attempt at doing that along with the errors that you face and then ask it at stackoverflow.com
@InderpalSingh no, that is not a proper question
 
10:00 AM
Cabbage
 
o/
 
Welcome, @InderpalSingh Please read the room rules, in particular, the part about not linking your fresh SO questions here.
 
10:19 AM
Morning
 
I've always try to solve my own problems but since I'm here, I've taken a tougher stance , to exhaust all possible solutions before calling you. Guess what? It works. In the same time, my questions are not very sophisticated yet ;)
o/
 
cbg to everyone even the Canadians grumble hockey grumble
 
Did the USA lose at ice ball?
 
yep, was gonna congratulate @idjaw on his team but just missed him it seems
except we didn't lose, we got destroyed
 
10:39 AM
Oh Mongo, my old nemesis.
 
Le journal de Montréal today's title Bye -Bye USA
 
10:55 AM
Sorry, @InderpalSingh You need to fix your question to make it answerable.
 
Webscale NoSQL databases and whiskers on kittens,
weakly typed server languages and warm woolen mittens,
brown paper packages served up with express.js,
these are a few of THE WORST THINGS EVER.
3
 
lol
Oh, let me find that link that I thought you'd enjoy hating
 
I enjoy hating things, I do it all the time.
 
It's one of the things I hate about you
 
11:11 AM
1 hour trying to find a bug. Co-worker had typed pageid rather than pageId.
 
And your English pluralisation code is also off Yay, bug fixed
 
Read a bit of that article, vomited.
Would not read again.
 
I commented
 
Did you comment in the form of a youtube link?
 
I'd expect better from an API Development Leader
 
11:18 AM
I wonder how often we link the "Hello Darkness" Arrested Development video here
 
Cabbage guys..
Need help with Flask-Mail
I see here in the docs an example
with app.open_resource("image.png") as fp:
msg.attach("image.png", "image/png", fp.read())
 
that article has a graph that says "language trendiness".... urk
 
i replaced that code like this
with app.open_resource("C:/Users/10613527/Desktop/wsg.JPG") as fp:
msg.attach("C:/Users/10613527/Desktop/wsg.JPG", "C:/Users/10613527/Desktop/wsg.JPG", fp.read())
does not work
 
@Anarach I don't know Flask, but from msg.attach("image.png", "image/png", fp.read()) it looks like the 2nd arg of msg.attach is the file's mimetype. So why are you calling it with a filename in that arg position?
 
isn't image/png a mimetype?
 
11:29 AM
@PM2Ring my apologies, totally new to python, learning it actually not sure what you are asking :-(
what is a Mimetype
nevermind , just googled
now i see
Getting the mail but not with attachment
:-(
 
Morning all
@JGreenwell :D
 
:P
My friend who I watched it with described it as "the most one-sided game he's seen since he last saw the Harlem Globetrotters play and just as comical"
 
11:44 AM
even Phil Kessel decided to tweet which he rarely does mentioning something like he feels he had something important he should have been doing last night
 
yeah, all the papers in Chicago and Minnesota were pretty livid about the fact that the US didn't make the pre-lims (first time in almost 30 years)
....just realized that when he says "all the papers" he means "the online news articles from newspapers cause he hasn't picked up a paper in 10 years" and boogles
 
12:04 PM
cabbage
@Anarach please don't take this personally, but it is usually encouraged to first learn the basics of a language before using frameworks built upon said language. You'll find it's much easier to find your way like that:)
3
 
@AndrasDeak I understand! Thank you :-
 
@Anarach try this. I really liked it for sending email from Python :)
 
@Rishav I am actually able to send mails , no problem, But i dont know how to add attachments
 
Yeah, yagmail makes it quite simple. The readme has an example at the beginning.
 
@Rishav Thank you:-) will look into it
 
12:33 PM
C:\Users\Kevin\Desktop>ping www.google.com
Pinging www.google.com [1.1.1.1] with 32 bytes of data:
That's an interesting IP address.
 
sounds legit
you must be using google's DNS server where every IP leads to google
(yes, it works that way)
rhubarb for now
 
12:49 PM
how would I turn the number 3.5 into 3.50? ...I guess I could multiply it by 1.00...is there another way?
hm
 
3.5 and 3.50 are identical when represented by floating point numbers. You can't distinguish between the two.
 
oh
so I have to do it as a string
?
 
@Sean maybe you can format them
 
Yes, str.format does have an option to indicate how many decimal places should be displayed, but I don't recall what it is off the top of my head.
 
ah
cool
I'll check out the docs
sweet
thanks @AndyK @Kevin
'{0:.2f}'.format(x)
did the trick
 
12:54 PM
the question is why do you want to do this
for printing purposes?
 
yeah
 
morning everyone
 
If the answer is "because I'm storing an amount of money in a float and I want to display the full number of cents", then [insert lecture here about how limited-precision data types are inappropriate for storing money values]
 
morning corvid
 
o/
 
12:55 PM
:-)
ty @Kevin
 
every time I see @corvid I am reminded of Black Butler
 
@Kevin what would you use if you were storing data for money and physics precision calculation type?
 
morning corvid
@AndyK use the decimal type, or something else
 
'k @WayneWerner let me check
 
@AndyK decimal data type or don't even use a decimal point (i.e. scientific notation or * by 100 and use int) - depends on application
 
12:58 PM
For money: integers if all the money values are full cents, decimal.Decimal or possibly fractions.Fraction if there can be fractional cents. For physics precision calculation types: I don't know what those are, but if they aren't money, probably float.
 
Thanks all
 
I really really wish I could find the example - it was all additive/multiplicative operations on non-zero positive floating points and the result was zero
 
awesome guys , reading it
 
Morning cabbage.
 
Physics = use numpy and its floating point (and other) extensions
 
Floats are... Misunderstood.
 
@RobertGrant why?
 
@Kevin We need to talk about floats
 
I get that reference.
 
Specially for you
 
1:01 PM
WTF? I just had another 1 rep OP self delete shortly after I posted an answer. stackoverflow.com/questions/39616638/…
 
I like using fractions cause they are precise but it's not always possible or at least not always as easy as using float or decimal if I know I only need a certain level of precision
 
@PM2Ring that dude.tte should be banned
 
It's not a great question, but it might help a future reader. And I don't like homework cheats trying to hide the evidence.
 
@PM2Ring homework problems and people not wanting to get caught
sometimes finding those is the only reasons I even think "I might like 10k to see the dead people"
 
lol @JGreenwell
 
1:04 PM
Yes... 'cos when you delete a post - SE sends a hit squad to make sure you don't do it again? :p
 
decimal's documentation confuses me because it mentions "precision" which implies it isn't unlimited precision, but then I can do decimal.Decimal("0.1")**10000000000 no problem.
Or, hang on...
>>> decimal.Decimal("0.1")**10000000000
Decimal('0E-1000026')
On second thought, that doesn't look right.
 
nothing is unlimited precision in CS
 
arbitrary precision limited only by hard drive space, then.
 
I was not aware of that fraction thing
 
1:05 PM
and whatever you set it to
 
thanks @JGreenwell
 
So Decimal has limited precision just like floats. Why do we recommend one over the other, then?
 
@AndyK okay I came to this late but what are you trying to do (or more correctly what level of precision does your task actually require)?
cause it is more precise then float and has a few rounding error fixes @Kevin
 
Random guess: Decimal can exactly represent all numbers of the form a.bc and float can't
 
@Kevin "the decimal module has a user settable precision (defaulting to 28 places) which can be as large as needed for a given problem"
 
1:07 PM
I'm more asking @JGreenwell because there are many things I can use but the why I should use one instead of another , is sometimes lost to me
 
Guess I have to go back to all the times I glowingly recommended Decimal as the solution to all one's problems and add "... Provided one sets the precision to an amount appropriate for your use case"
 
I like that Kevin
Thanks
 
ah, well pay attention to everyone talking about precision then as this is a big "when to shift from using float to using float64 or complex even in physics, decimal, fractions, or other solutions" indicator
 
When I want lots of precision I usually use mpmath. Decimal is ok for simple arithmetic, but not if you need fancy functions: Decimal only supplies the basic 4 operations, and sqrt, IIRC.
 
And was I speaking mistruth all the times I said "Decimal(f) will show you the exact value of a float without the usual rounding that goes on during display"?
 
1:11 PM
I pretty sure you usually caveated that "you were not a mathematician" whenever you mentioned Decimal so past @Kevin should be okay
 
thanks guys for your insights. It is very useful and interesting
I need to keep reading
 
cbg
@DanielRoseman I don't want to pass metric_name as param to save() as it may be misspelled. — Inderpal Singh 3 hours ago
... sigh...
 
man I don't like jobs where people play music in the office, so much techno
 
o/ sir
@corvid where do you work ... ?
 
As in, over the radio with something like Sonos. I wish I had better taste in music, just like crazy music
 
1:19 PM
A Python float gives you 53 significant bits (it actually only stores 52 bits, since the first bit is always a 1). 2**53 = 9007199254740992, which is just under 10**16, so you can get (up to) 15 valid decimal digits out of a float, subsequent digits can be printed, but should be treated as science fiction. :)
Those digits aren't random: they are an accurate representation of what you get when you convert the binary float data to decimal, but they result from the rounding error of trying to represent a non-binary fraction in binary.
>>> print('%.60f'%(1./7))
0.142857142857142849212692681248881854116916656494140625000000
 
This guy could use some gentle assurance that loops are in fact allowed in Python.
 
Note that the decimal expansion of 1/7 repeats in groups of 6 digits: 142857
 
@PM2Ring unless you want to get very precise, usually floats are not needed then?
 
@PM2Ring not "up to", but "at least"
 
@Kevin whoever told the OP that Pythonists (is that a word?) must use "array operations" does Ruby
 
1:23 PM
To be clear, floats are a bad choice if you want to get very precise.
@JGreenwell I'm giving the benefit of the doubt and assuming that he's talking exclusively about numpy arrays. Then his mysterious mentor's advice makes a little more sense: numpy array manipulation functions are probably a lot more efficient than iterating through the array yourself, since the former is likely all in C.
 
@AndyK You will often need some way to represent non-integer numbers. The standard float is adequate for many purposes, but you need to understand a bit about how floating-point numbers work, otherwise you can do things with them that will give results that aren't mathematically valid.
 
0.5 ** 50 =
0.00000000000000088817841970012523233890533447265625
that has more than 15 precise digits
 
eh, your comment sums it up either way
 
that is: you can always get 15 precise decimal digits out of a float, but if it is an exact binary fraction, then much more.
 
@PM2Ring I found something interesting about how floating-point numbers work
 
1:27 PM
@AnttiHaapala Not "at least", "at most". When a float is initialised from a string or int, it has those 53 bits of significance, but once you start doing arithmetic with it you're bound to lose some significance, even if you're careful. And if you're not careful, you can get catastrophic cancellation.
 
In this case though I think he is trying to point him to vectorize which from the docs is:
> The vectorize function is provided primarily for convenience, not for performance. The implementation is essentially a for loop.
Yes! next comment is pointing towards vectorize, I knew it. Everyone is so used to numpy being based on C (which is cool btw) they never consider somethings are just for convenience :)
 
@AnttiHaapala Yeah, ok. You still only have 53 bits, but that can give you lots of valid decimal digits if & only if the number is actually an exact binary fraction.
 
Ok, one parting comment to point out that arrays != lists, and I'm washing my hands of the matter
 
me too, plus Edge is causing my computer to seize up (freking MS) and now its time to "turn it off and on again"
 
@JGreenwell Here we go. Tortsie and Brooksie...I love this video: youtu.be/WsrX3yr8060?t=13 (NSFW Language)
 

« first day (2167 days earlier)      last day (2782 days later) »