« first day (1624 days earlier)      last day (3323 days later) » 
01:00 - 23:0023:00 - 00:00

1:30 AM
@holdenweb Software raid on modern Linux actually works pretty well. Still not what you want for, say, a database, but it's plenty good for workstations.
 
 
3 hours later…
4:58 AM
Hi
 
5:27 AM
@holdenweb why do you hate software raid :? the 2 reasons to hate would be a) speed issues, b) no crash safety
 
6:06 AM
He's trying to give you a hint. :) — TigerhawkT3 1 min ago
 
6:36 AM
cbg
@AnttiHaapala: There's a stray sentence fragment at the start of this answer: stackoverflow.com/a/29314342/4014959
 
6:52 AM
cbg
@PM2Ring yeah there was :D
it is very hard to fight these fgitws
 
That's better. :)
 
the other answerer who started answering later than me got upvotes faster
 
It's good that the guy who said that dict could be a string deleted his answer. I guess he had a valid point, but IMHO his answer wasn't really helpful.
@AnttiHaapala Indeed! Minor grammatical & typography errors aren't so bad (unless you accidentally say the opposite of what you meant to say) since they're easy enough to correct. OTOH, it's a bit embarrassing if you make coding errors in the rush to get the answer in. :)
 
7:34 AM
@PM2Ring actually, the very docs.python.org/2/whatsnew/2.2.html#pep-234-iterators says key in dict is now equivalent to dict.has_key(key) (sic).
 
@AnttiHaapala I quoted the documentation and told the same, but got downvoted :'(
 
@thefourtheye this was also a comment to
I realise that this is just an example, but please don't use dict as a variable name, as it shadows the built-in dict type. The same goes for list, str, set, etc. — PM 2Ring 44 mins ago
@thefourtheye why did you ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, your post :d
I can't read it either now :D
now I cannot comment what you did wrong
my rep: 22 007 :P
license to kill -9
 
I actually quoted this section's
> In particular, dictionaries (for keys) and sets support membership testing.
and then told key in dict is similar but not the same as key in dict.keys()
and I was explaining the differences between those two in Py 2 and 3 but got downvoted :'(
 
@AnttiHaapala Yeah; that's annoying. And I'm not happy about the for line in file: example, either.
 
7:46 AM
the question is quite bad
@PM2Ring I am
file() was deprecated 1000 years ago
so the line in file is the proper way :D
it wasn't proper type ever, so it does not make sense to pretend that it is
you should upgrade to Python 3 already :d
here
When opening a file, it’s preferable to use open() instead of invoking this constructor directly. file is more suited to type testing (for example, writing isinstance(f, file)).
but the problem is it often was not file at all...
 
@AnttiHaapala Fair enough. FWIW, I don't think I've ever used the file type name - it's use was discouraged even back in ancient times.
 
see there, I think it was discouraged in 2.2
:D
even this:
" file is more suited to type testing (for example, writing isinstance(f, file))."
ducktyping anyone?
 
@AnttiHaapala I'm pretty sure you're correct, but I couldn't be bothered checking, even though I've got the 2.2 docs hiding somewhere on this HD. :)
 
ah no :d
The file() constructor is new in Python 2.2. The previous spelling, open(), is retained for compatibility, and is an alias for file().
:D:D:D
LOOOOOOL
now that's backwards
can't believe I've actually used python before iterators came into being
 
@AnttiHaapala Oh dear.
 
8:00 AM
I have close voted that wp question and flagged it as vlq after my close vote expired without it closing and it is still there
neither q and answer make any sense :D
 
@AnttiHaapala Sorry, I can't remember much about PHP, and I know next to nothing about WordPress. OTOH, all those typos / misspellings certainly make the question look low quality. You'd think if someone's having problems with something called "category.php" they'd at least take enough care to spell it properly in the question title...
 
yeah, the error is not detailed in any way
it is ~impossible to even tell whether the user gets 404 or "undefined variable"
just that cv is ok
and dv on the q :d
 
I've downvoted the question, but I don't feel qualified to vtc it.
 
8:17 AM
@AnttiHaapala Obviously I don't have the rep to delete, but I 'm tempted to dv the question & the answer. You'd think a 9.9k rep user would know better than to post a recommendation as an answer.
 
it is oooold q and answer
maybe then he was 1-repper
 
@AnttiHaapala Oh, ok. I guess recommendation questions where tolerated in the old days.
 
yeah, though it was as useless back then
and the answer too
 
:)
 
we should have the canonical answer for "FileNotFound" -> your file is in another castle
 
I tend to keep a close eye on his answers. They can tend to be naff.
 
9:34 AM
Hey up again
 
fizzygood ^
some cvs for oyu
 
Cbg all
 
@AnttiHaapala "I have files on the linux server and their file names are broken because of the middle \r character. I couldn't download those files by using WinScp or Filezilla on windows." Is that a bug or a feature? :)
 
dunno :D
but it is "a simple typo"
and I do not think posting such questions and answers to them are worth 25 rep :d
when the problem was pointed out in a comment before
ah :D no, the answer was posted 7 seconds before my comment :P
 
10:00 AM
@AnttiHaapala Agreed. I don't know if I'd class it as a typo, exactly, but it does seem like simple coding error, not a misunderstanding of what's necessary, since the OP did use the full path when doing the rename, but simply forgot to use the full path when attempting to open the new file.
I'm sure we've all made similar errors - and learning from such errors is what stops you from repeating them. Hopefully. :)
 
10:24 AM
0
Q: running pip gives UnicodeEncodeError

SeagulltownI just reinstalled python and pip, but when i run the command pip i should expect to see the help info for pip commands. instead i get this: Traceback (most recent call last): File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "C:\Pyth...

^ just use Python 3
 
 
2 hours later…
11:55 AM
s.split() without argument splits at whitespaces. — Antti Haapala 23 secs ago
 
12:34 PM
@PM2Ring I didn't think there was ever a prohibition on recommendation answers. Only on recommendation questions...
 
@WayneConrad Yeah, ok. OTOH, the recommendation is now useless, since it links to a deleted page.
 
Yeah. Link-only answers stink.
 
12:51 PM
Normally, link-only answers to other SO pages aren't as bad as external links, but they're still not good, as that example demonstrates. :) FWIW, I often do links in comments, but mostly to other SO pages or the official Python docs, and even then I try to put enough context so people can still find what I'm talking about if the link gets moved.
 
I agree. There should always be context.
My gripe this morning isn't SO. It's people who come to chat to ask a question they can't ask on SO, because it's too ill defined to be answerable and would get closed. As though asking it in chat will magically give it enough information for someone to be able to answer it.
There. I just wanted to say that. I feel better now, thanks.
 
I've just been helping a newbie convert their link-only answer into something decent. They followed my suggestions, so instead of getting a down-vote from me they got an up-vote. It's a nice feeling. :) stackoverflow.com/a/29316454/4014959
 
Nice. Here's another up vote for it. I had to read that question twice before I understood that it was something you could do with a regex. I see that nested data and think, "Oh dear... not with a regex, you don't."
 
Should I answer this stackoverflow.com/q/29317428/4014959 or just link in a comment to something like stackoverflow.com/q/207000/4014959 ? I guess it's a dupe, but the OP doesn't realise that.
@WayneConrad Ta. Yeah, using regex on stuff like that is scary, but it can work. OTOH, if it was using nested quotes instead of parentheses it'd be hopeless.
 
Ew. That Reddit explanation that confused the asker is awful. I ended up knowing less about Python when I was done reading it.
@PM2Ring I think just answer it, and perhaps link to the other answer. The questions don't look that much like dupes to me.
 
1:09 PM
@WayneConrad I suppose that Reddit explanation could be a helpful way of remembering the difference between class & instance attributes, once you understand the difference, but it's not much use as an explanation to someone who's still learning this stuff.
 
Yeah. It's only meaningful to someone who already knows it.
 
FWIW, I'm not a huge fan of "Learn Python the Hard Way". From the questions it spawns on SO I'm not convinced that it actually helps people understand Python, especially if it's their first language.
And it has crappy examples. Eg from that question: print Death.quips[randint(0, len(self.quips)-1)] Doesn't the "Learn Python the Hard Way" author know about random.choice()?
 
I've never read it, so I wouldn't know. I've always been suspicious of what I call "hipster tutorials," though. I've never figured out how adding cute cartoons to a tutorial makes it better.
Oh, that doesn't look like a hipster tutorial... I just went and looked at it.
 
1:27 PM
re-hey-up
 
He has some good ideas, but I don't think his method is as good as he thinks it is. :)
Hi, Fizzy.
 
cbg
:)
@PM2Ring Thanks
My pleasure! And now you have enough rep to vote... :) — PM 2Ring 2 hours ago
:D
 
I'm not usually that blatant, but I couldn't help myself. :) And it worked. :D
 
Naw, Even I got an upvote!!!
After you mentioned it to the OP
 
1:37 PM
Cool. It's nice to see a newbie who wants to do the right thing.
 
Whoa. This fellow edited his question to add the code, when asked. I gotta upvote that.
 
Wayne, what is the name of the animal in your gravatar?
Is it an otter?
 
Yes, a sea otter.
In your gravatar, are you the fellow on the left? What honor is being given?
 
It is me receiving the award for getting 95.25% in 12th std
I'm the guy on the left and the guy on the right is Col Lalit Rai
 
@WayneConrad Pity the indentation is off, but you can't have everything. :)
 
1:49 PM
@BhargavRao Outstanding!
@PM2Ring :D
 
@WayneConrad Ty. If I had got 1 mark more, I would have been in top 3 (CA$H award!) :(
Now only certificate!
 
@WayneConrad And now I'm obliged to link to my favourite significant otter image. :)
 
@PM2Ring Hahaha! Oh, that's great!
 
They're so cute!
@BhargavRao: The indentation is still off...
 
Yeah!
I just added the link :)
 
1:57 PM
Adding the link is helpful, not fixing the indentation while you're there is not so helpful...
 
Naw! I would never fix the indent in a py code, I usually leave a note to the OP. Who knows the error might be coz of the indent(though not in this case)! :)
 
2:10 PM
Fair enough. I guess I should be hassling Sylvian about the indentation, since he's the "culprit". Originally, the stuff under theclass statement was unindented, and the class statement itself was missing a colon. Or I should just fix it myself...
Ok. Now it's a carbon copy of the code in the link.
 
:)
cc-ing the link :D
 
Strange that the OP didn't just copy & paste the code themself...
 
@antti cbg :D
 
2:27 PM
Is there any benefit in using .capitalize() rather than .upper() on single char strings?
 
absolutely no
the whole capitalize is an abomination in itself
that is when did you actually use it?
 
That's what I thought. I only use .capitalize() when I, you know, actually want to capitalize something. Besides, .upper() is shorter to write. The reason I mention it is stackoverflow.com/q/29317937/4014959
@AnttiHaapala It's a bit odd, and rarely of use, but i don't know why you call it an abomination. I used it in a little script a few years ago to make ALL CAPS TEXT a little nicer to read.
 
Woah! The dv is from here itself. Cool to know!
@AnttiHaapala Can you give me a link as to why upper is better?
Coz, I know of neither :D
 
I mean, capitalize is a phpism
 
.capitalize() makes the first char upper case and then all subsequent letters lower case. So you really should NOT use it unless you want that functionality.
 
2:37 PM
Ey! Thanks PM. Will correct it as ap
 
@AnttiHaapala Ah. Well I guess that's enough reason to diss it. :) FWIW, I've also used .capitalize() in a MP3 filename cleaning program to fix up embedded album and artist names.
 
@AnttiHaapala I have fixed it... Just check if it is correct stackoverflow.com/questions/29317937/…
@XavierCombelle You may have a look at the edit and re-consider your downvote :)
 
@MartijnPieters done
 
@MartijnPieters ^delv above
about "best cms to do social media" :D
with dead answers
 
2:44 PM
@BhargavRao Not necessarily...
 
:)
Have edited it though! Any one can revert once they look
 
A Padraic says, it probably makes no difference in terms of performance. But style-wise, .upper() makes a lot more sense.
 
2:58 PM
rhubarb
 
@PM2Ring rbrb
 
@BhargavRao do_capitalize does not seem to have overhead over upper
 
God Damn! I was initially correct!
Antti, plz tell me what to do now.
 
no overhead but it is ugly
 
I am totally confused!
 
3:01 PM
use upper
just that I looked at the code
 
So my answer is now correct and I need not revert.
 
your answer where?
 
it is right
but my point is that ppl should unlearn the "capitalize"
also, capitalization can result in more characters :P
 
Thanks bro srsly
I owe you a nice drink
I get two upvotes in a matter of few seconds. Is it serial upvoting?
 
3:09 PM
There's one more for you. It's a good answer.
If everyone in a room upvotes something, is that parallel upvoting?
5
 
:D
Electrical Electrical everywhere!
Uff! I have now come off by 4 to a round figure. So will now add some tag-wiki's and get to the round value!
 
cbg
 
cbg, Zero :)
cbg, Jerry :)
 
melon Bharga
 
3:14 PM
*Bhargav
 
oh, my screen is too small xD *Bhargav
 
:D
Lesson Learnt - Have small names :P
 
Haha!
 
Rbrb all!
 
As a Ruby programmer, I am quite fond of Rbrb.
 
4:17 PM
@Antti Haapala: The commands for starting a new django project didn't work with 3.4. As I am following a tutorial based on 2.7 and since i'm completely new to python downgrading seemed to be the only solution. — Seagulltown 1 hour ago
OMG
that's the kind of fsckery ...
 
When I'm learning a new language from a tutorial, I usually try to get as close to the author's environment as I can. I'll have my hands full just learning new concepts; I don't want to have to adapt the tutorial's code to a version of a language I don't even know yet.
 
yeah, the problem are the countless of tutorials written for 2.7
though in this case there shouldn't be any significant difference
 
How do I sort a dictionary such that the values of my values are sorted numerically from highest to lowest and the values of the values with equal values are sorted alphabetically using keys
[('Delores', 1), ('Cassandra', 1), ('Debra', 3), ('Damon', 5), ('Abraham', 6), ('Claude', 6), ('Annie', 14), ('Chris', 19), ('Andy', 20)]
So basically this
But Delores and Cassandra should swithc places
 
result = sorted(dict.items(), key=itemgetter(1, 0))
with from operator import itemgetter
or you mean highest to lowest, now (and your example) is lowest to highest...
numerically highest to lowest you need to do slightly longer: key=lambda i: (-i[1], i[0])
 
Keeps giving me cassandra
Instead of delores
Please help me
I mean lowest to highest
Anyone here?
 
4:38 PM
I did help
 
I need help on sorting them aplphabetically too
So cassandra should be first
Then delores
Instead of the opposite
How can I do that
 
did you try my code
result = sorted(d.items(), key=itemgetter(1, 0))
this one sorts both increasing
 
Yeah I tried it
inp = input()
arr = [int(x) for x in inp.split()]
dic = {}
i = 0
while i < arr[0]:
arrr = input()
a = arrr.split()
a[1] = int(a[1])
dic[a[0]] = a[1]
i+=1
from operator import itemgetter
result = sorted(dic.items(), key=itemgetter(1, 0))
i = arr[0] - 1
while i >= 0:
if i % arr[1] == arr[1] - arr[2]:
print(result[i][0])
i-=1
My code
Dammit
Here
For a contest, organization committee wants to form k equal level groups. For this, they are putting the students in descending order according to the points they have collected. And then, first student goes to the first group and the second student goes to the second group, ... and kth student is placed to the kth group. Then (k+1)th student is again placed into the first group, and so on.

Question: Write a program that is going to read student information. Then, your program will print the people in mth group.
Exercise
Please help me
Test case 1
Did you read it?
 
12 consecutive messages with 4.5 lines per message
 
4:54 PM
Anyone here?
 
That's enough for a real SO question. Why not make one?
More people will see it that way.
 
Because I'm on a live competition
And this is exercise one
This and the last one are the only ones left for me
 
Im working on it
Maybe you can help me
Making an elevator control algorithm is a very complicated task. The main purpose of the elevator control systems is to minimize the total waiting time of the people at the corridor. People don't care about the time passed in the elevator, but they don't have any patience to wait for an elevator.

Question: You should make a program for an N-floor building to let people go to work as quickly as possible. There is only one elevator with the capacity for M people. The elevator travels between two consecutive floors in 1 second and people enter or leave the elevator in 1 second. The elevator i
Thats it
 
please use pastebin or even better if you have a substantial question then ask it on the main site
 
4:58 PM
0
A: Marking question posted with an answer with an information box

Zero PiraeusOne of the projects of the community that's developed around the Stack Overflow Python chatroom is to build a collection of canonical answers to common questions, for use as duplicate targets. A problem we face in that endeavour is that, when someone asks a question they don't know the answer to...

 
Sure
 
If you think the answer's upvoteworthy, the question could also use a little love.
 
If no-one objects, I'm going to pin that; I think it's quite relevant to one of the objectives of the room.
 
I agree. Upvoted.
The example question+answer you posted to is laudable. It's what SO should aspire to. Any rule that makes questions like that bad is a problem.
 
5:05 PM
As you might imagine, I agree :-)
The (meta) question is going to need upvotes, though, if it's not to disappear from view :-(
 
I gave that one a click, too.
I'm afraid that the "we like our rules" set is going to pound that one into the ground, though.
 
Time will tell, I guess ...
 
5:37 PM
cbv
I have upvoted both q and a
 
Hey, wait a minute. "Lack of research" is not actually a close reason on SO. It used to be one, and people like to pretend it is still one, but it isn't.
 
it even didn't use to be... there was too localized and lacks minimal understanding
 
@Martijn don't suppose you'd care to weigh in [here](meta.stackexchange.com/q/252190#comment823789_252212)? The most obvious response I can think of is that "the undisputed champion of Python on SO thought we needed a dupe target", but namedropping like that (not to mention the appeal to authority) feels a little weird.
@WayneConrad It's a legitimate downvote reason, though ... that's one reason I think the banner is useful; because "lacks research effort" isn't true in such cases, but appears to be if you're not paying attention.
 
5:57 PM
ah gosh I hate that random random guy already :d
 
Nah, he's alright.
 
@ZeroPiraeus I think we could edit the banner in your question anyhow :D
stackoverflow.com/questions/19833025/… < @ZeroPiraeus close that as a dupe?
 
6:14 PM
@AnttiHaapala I think that's a legitimate dupe, yeah :-)
rbrb / making soup
 
@ZeroPiraeus: I don't have time at the moment; your sample question is a bit short however, I actually think Random may have a point there.
I've always pointed out to self-answers that I am closing that the question still has to meet the site standards, by the way.
 
I actually think that feature request should not be implemented.
And that's from someone who's only questions are self-answers.
I have to run again, rhubarb!
 
There is no indentation error, as I just compiled that. Secondly, I didn't write f.read().split() in one line because I wanted to make it more clear for the OP. I didn't close the file, incase he wanted to do more. Lastly, less code doesn't mean better in all cases. I was emphasizing clarity for the OP, thus the reason to write out more code then needed. — Teodorico Levoff 6 mins ago
@JonClements cbg
@JonClements see that answer and how much effort OP is putting in defending it instead of fixing it :D
 
6:28 PM
I really don't know what to say to this
Because this is python and the zen of python states that simple is better than complex? — mattm 37 secs ago
 
@Antti interesting :)
 
DSM
Between-other-stuff cabbage for all.
 
@DSM cbg
 
Okay, there is no point in talking to this guy anymore...
Runtime is not the only factor when talking about simplicity/complexity of code. — mattm 4 mins ago
 
6:49 PM
@JonClements, @thefourtheye that whole question about splitting the input fields ...
the answers is again like a big experiment in Dunning-Kruger effect again :D
@thefourtheye yeah running time is not a problem up to a point
if the list is indeed fixed it does not matter, but the list.index really sounds a bad thing alread
 
@AnttiHaapala hmmm, will the text in chat change if the linked item is edited? o.O
 
I guess so
what did the unedited comment say
I am seeing the same comment there and here
@thefourtheye it is indeed true, I didnt notice you didnt put the set for lst2
if you don't do that then the runtime complexity of the 2 is equal :D
 
He said something like, Readability counts and emphasized this is python. The initial comment was something not acceptable to me... :(
@AnttiHaapala 2? Which one?
 
yours and his solution are equal in time complexity if you do not change the lst2 to set
both have O(nm)
 
Yup, that is why I included that in the Note section, I ll edit the code also, to make it clearer.
 
7:00 PM
@thefourtheye now i realized it :D
@thefourtheye we are both officially stupid :D
just use 1 set :D
 
You mean, the set2 in my answer now?
result, seen, set2 = [], set(), set(lst2)
for index, item in enumerate(lst1):
    if item not in seen and item in set2:
        result.append(index)
        seen.add(item)
print(result)
# [4, 8]
 
DSM
>>> where = {k: i for i,k in list(enumerate(lst1))[::-1]}
>>> [where[k] for k in lst2 if k in where]
[4, 8]
 
0
A: Search for same values in 2 lists but only once if duplicate

Antti HaapalaThis might be a bit ugly but it is using a list comprehension. I am abusing the fact that set.discard returns None. Basically we make a set of lst2; here we call it needles as we're searching needles in haystack. As soon as we find a value in the haystack lst1 that is also in needles, we discard ...

 
@DSM Cool :-)
 
@DSM how about also using:
 
DSM
7:12 PM
Ehh, too much storage for all the ones you don't care about. Could check that while building where but then you'd have to turn lst2 into a set to stay O(n).
 
where = {k: i for i, k in .... if k in lst2 }
 
DSM
@AnttiHaapala: see my previous comment. :-)
 
using set ofc
then you can do map(itemgetter(where), lst)
 
DSM
Okay, the town beckons. Rhubarb!
 
seeya
 
7:28 PM
@DSM Rhubarb :-)
 
cabbage everybody
 
cbg
 
Cabbage guys :-)
 
re-cbg
 
7:39 PM
I got exact 200 rep today, does it qualify for legendary badge?
 
@BhargavRao as long as you still have 200 rep when it does the counting - yeah
 
Just in line :) Crosses fingers
 
@thefourtheye why'd you remove?
the girl's solution there has now +1 like mine
:D
and hers still does not work
 
@AnttiHaapala I feel that I am still missing something... So, I opted out... :-)
 
I had an ugly answer for that.
 
7:47 PM
dunning-kruger effect eh?
 
Why down vote ? it is not working? — Vivek Sable 1 hour ago
 
those who are worst tend to overestimate their skills bc they cannot know if they're good or not bc they wouldn't recognize the good answer - and those who are good tend to think they're not that good.
 
The second question rocked
 
@AnttiHaapala Actually, after seeing DSM's solution, I started disliking my solution :D
 
both have the same complexity but yours is more readable
 
8:27 PM
rbrb
 
10:04 PM
0
A: Sqlalchemy get results in the same order

Antti HaapalaThis is very possible, though ugly with PostgreSQL 9.4+ and SQLAlchemy 0.9.7+. Basically we build a map of id -> ordinal, then use the JSONB -> operator to find the ordinal for each user id (-> requires TEXT for JSON keys id_order = dict(v, k for k, v in enumerate(user_ids)) users = User.query.f...

lol :D
 
hello
in Django how can i execute a system command?
 
like in any other python program
-> use the subprocess module
(if that's what you mean)
 
i want to do a jpeg convertion
 
then use Pillow
 
ok
 
10:16 PM
and not some external command
easier that way
 
i will take a look
thanks
 
stackoverflow.com/questions/29245234/… <- how about canonicalizing this too?
(repr inside tuples, lists, dicts)
 
01:00 - 23:0023:00 - 00:00

« first day (1624 days earlier)      last day (3323 days later) »