« first day (1569 days earlier)      last day (3372 days later) » 

12:21 AM
cbg
 
1:11 AM
cbg
It now has 2 non-answers-that-are-comments-really.
One by Alex Martelli, who admits in the answer that it isn't an answer.
Another question lacking context and attracting low-quality guesses:
Resource request.
 
1:46 AM
can any body tell me why i get 2 down vote on my following answer in one time . as this answer is 100 % true ! stackoverflow.com/a/27568530/2867928
 
@KasraAD technically the keys must be a HASHABLE type, not just immutable. I can implement an immutable object but not write its __hash__ method and it can't function as a dict object.
but otherwise I have no idea, and that's just nitpicking. I voted up
 
i also flagged my answer , also in same time i get one downvote on stackoverflow.com/a/28252644/2867928
 
@KasraAD I did not vote, but there is an inaccuracy in the answer.
Keys must be hashable.
To be hashable, you would prefer an immutable type, but that's not set in stone.
The hash should not change, and the equality with other instances should not change.
 
In other news: I had entirely too much fun playing with this question asking about transforming passwords to get a set of all permutations given a set of substitutions (e.g. {'s':'$', 'a':'@'})
 
That means that whatever aspects of the object that determine the hash and and equality with other instances should not change.
Immutability makes it easy to maintain those properties.
 
1:51 AM
Thanks martin
 
Decided to take it on iteratively instead of recursively. It was fun! stackoverflow.com/a/28258570/3058609
 
@AdamSmith thanks ;)
 
I'm sure there's a better way to approach it with itertools.product or etc, but I couldn't think of a great one.
 
i will edit the answer , but
 
@KasraAD why flag it?
 
1:53 AM
because it was Mysterious
that i got 2 down vote in one time
 
Seems like a specious reason to flag to me
just taking up a moderator's time :)
 
:)
any way i think that a little mistake like this could be note with a comment !
not 2 down vote
 
Doesn't seem like a big deal to me.
In any case, my daughter wants to watch Dr. Who with me. rbrb for a bit
 
ok
thanks for help and , vote !
;)
 
@Martijn I don't know why people always ask for the most specific information. Do you want to see a picture of my computer plugged in too? — vikingcode 10 mins ago
Sure, if you think it'll help me help you..
And the comment has been removed.
 
2:06 AM
Im trying to get pillow the "PIL" fork, to divide an images width by its length. i got it to open the image and return the size, mode , and format.
from PIL import Image anim_1 = Image.open(r"textures/terrain/test.png") print(anim_1.size)
i cant figure out how to press enter without sending the code sorry about that.
ah nevermind i got it.
 
The code in stackoverflow.com/questions/27832096/pygame-maze-game seems to work. But I have created my own images as the PO did not provide them and it seems that I have another operating system.
I think that question is flawed for these reasons, but I dont have enough rep to moderate
 
@Death_Dealer you can use shift-enter to add newlines.
And when you select all text and use ctrl-k 4 spaces of indentation are added, to mark up code.
I suspect Charlie Martin is in for a nasty surprise then they return to Stack Overflow.
Last seen: about 3 seconds after posting their very, o so very wrong answer.
 
2:23 AM
@MartijnPieters thanks. @ zormit im using pillow, the "PIL" fork.
 
@Death_Dealer sorry, my question was not intended to deal with yours
 
oh sorry
im = Image.open(input)
imgwidth = im.size[0]
imgheight = im.size[1]
this is what i used:) just in case anyone was wondering.
 
2:51 AM
or imgwidth, imgheight = im.size
 
cbg
 
Thinking about learning C#. Thoughts?
 
3:10 AM
Yes, thinking about learning C# usually involves thoughts.
 
Ha :P.
Any experience in it? Tutorials you can recommend? Classes that are good? Etc etc etc...
 
Nope, sorry.
Managed to avoid that bandwagon, mostly. I may or may not have answered C# questions, though.
My, I did! 3 answers so far.
Only 1 actually involved writing C# code.
 
lol
 
DSM
3:35 AM
Brief cabbage for all.
 
ditto
 
4:04 AM
The word of the day is "Malevolent Typist For Life"! - umm... that doesn't quite work :p
 
DSM
With due respect to the MTFL, if he's listening :-), I wouldn't have added that one to the Salad page. There's more than enough room on the wiki for a glossary of phrase and memes that aren't vegetarian..
 
Puzzled why Martijn appears to be active - it's after 4am!
 
Apparently Secret Python Wizardry requires all-nighters occasionally.
 
Cbg guys
 
4:29 AM
rbrb
 
DSM
rhubarb for Adam!
 
cbg @Zero
 
DSM
5:08 AM
Off for some rhubarb. Cheers!
 
rbrb
 
user559633
:) @DSM i don't mind if mtfl falls off the salad page
 
5:43 AM
frame_rate = input("Enter a Frame Rate for water (default 2) - ")

anim_1_width = anim_1.size[0]
anim_1_length = anim_1.size[1]

anim_1_frame_length = ((anim_1_length)/(anim_1_width))

print ("Frame count is " + str(anim_1_frame_length))

for x in range(0, int(anim_1_frame_length)):
    with open (anim_1_txt, 'ab') as anim_:
        anim_.write(("%d") % (x) + ('*') + (frame_rate))
    print (("Writting Frame %d") % (x) + ('*') + (frame_rate))
i have failed at writing a file with a for loop: /
anybody know what im doing wrong here?
TypeError: 'str' does not support the buffer interface
 
You need to encode ("%d") % (x) + ('*') + (frame_rate)
 
ah ok thank:)
hmm how would i go about doing that inside the loop
anim_.write(("%d") % (x) + ('*') + (frame_rate).encode('utf-8'))
this did not work.
TypeError: Can't convert 'bytes' object to str implicitly
im a noob at coding so if i did something wrong i wouldnt knowXD
 
yay
flagged the removal of almost 20 (non)answers that had links to w3schools, this is a good start
 
user559633
6:09 AM
done
 
stackoverflow.com/a/27160713/918959 omg I had seen this same answer in 3 questions or so... all totally different :D
 
If you're only after the most common, use Counter(l).most_common(1) as the Counter class optimises that use case — Jon Clements 50 secs ago
I was writing that as an answer :(
 
@thefourtheye sorry!
 
@JonClements No problem Puppy :) I upvoted yours...
 
thank you puppy :)
 
7:02 AM
:) :)
 
put the excerpt from the source
    if n is None:
        return sorted(self.items(), key=_itemgetter(1), reverse=True)
    return _heapq.nlargest(n, self.items(), key=_itemgetter(1))
our dear heapq there again
pls cv the ones above ^
 
@AnttiHaapala Won't recommend or find a book, tool, software library, tutorial or other off-site resource option be more suitable for this?
 
@AnttiHaapala that's a good idea - thanks
 
1 said "which one should i learn first"?
anw close as you see fit :d
 
@AnttiHaapala I dup hammered that one :)
 
7:16 AM
almost verbatim copy of the other
nice
burn ze w3schools
 
@AnttiHaapala With that hate for w3schools you would end up in the dark side :D
 
haha :D
 
@Antti you should write a script for that - might make you famous on meta as well tongue in cheek...
 
:P
I have gone through answers: the following pattern occurs
"You can do this like <code excerpt>. Check more at MDN. At 11:53"
"You need w3schools/js_functions/foobar. At 11:55"
I go there, 1 get upvote, another downvote
or a flag :D
 
7:25 AM
Should this be closed as "Offtopic .. other ... deals with metaphysics rather than programming"
 
"How can I get both elements of the List to be different without using a new object?" You can't. — Antti Haapala 1 min ago
I like it :)
 
I was going to say that it is the same Elliot even if Elliots phone number is in 2 catalogues.
 
@thefourtheye well, if it's any consolation - it appears using Counter correctly isn't worthy of an accept :)
 
@JonClements :( Some people totally ignore the non-functional requirements...
 
lol
falsetru totally trolled that question :D
 
7:32 AM
I was pondering whether he posted that with serious intent :)
 
Puppy, why there is no link to source code? :(
 
"You can use max with list.count, but it's not efficient as your current solution:"
@thefourtheye since it was a paste from me
1 problem btw is that heapq is slooow and crappy
we should write a patch for heapq in C
# Short-cut for n==1 is to use max() when len(iterable)>0
if n == 1:
    it = iter(iterable)
    head = list(islice(it, 1))
    if not head:
        return []
    if key is None:
        return [max(chain(head, it))]
    return [max(chain(head, it), key=key)]
this too
only n==1 is really faster
I guess n>1 is slower than sort for 99.9 % of cases
ah
there is the C impl
 
Wow, there's with 92 questions
 
i think it is synonym of varargs
 
Morning!
 
7:43 AM
cbg
 
Yay, just reached 70,000 :-)
 
morning @Kamran
congrats @thefourtheye - have a scooby snack!
 
@JonClements :) :) :)
 
My rep/answer ratio is exactly 35 now
 
@vaultah cool
It was 34.964126 according to sopython.com/wiki/Rep:Answer_ratio
 
7:57 AM
I updated the page yesterday, yeah :P
 
8:16 AM
hello
 
cbg @Reut
 
hmm
found 1 guy who had posted some really crappy answers, deleted 5 of his answers, would have deleted more, but Stackoverflow says "You have already deleted 5 of your own posts today; further deletes are blocked".
 
@Antti I think someone got quite a strop on, on meta as they didn't see why there was that restriction
 
how can I live with myself with all this crap from 2012 :D
 
8:35 AM
You can't - end it all now :)
 
how I hate this "w3schools" being the new metavariable
stackoverflow.com/questions/21356122/… are these questions now on-topic??
 
Wow... actually found a use for string.Template :)
 
yay
it is like I told that there should be iso8601 timestamp parsing in python stdlib
 
I'm surprised the entire date/time stuff just hasn't been ditched and re-done properly
 
and someone said that "python standard lib is not supposed to have every possible obscure feature"
surely this has more use...
we should write a pep on that
 
8:42 AM
Can't say that's a library I've ever had a use for
 
9:10 AM
Umm... anyone else noticed that one of these courses seems to promote newlines at the start of a file and lots of string and superfluous ()s- like r.write(("\n")+str(name)+("\t")+str(score))
 
Is that an online learning course? Yes some of them aren't the most pythonic. My working hypothesis is that they're teaching programming, not python, and so avoid too much python magic as people may have to then go code in a language without it.
 
cbg @Ffisegydd :)
 
Cbg
 
@Ffisegydd my guess is that they are clickbaits run by advertising money
and have no relation to any education whatsoever.
 
@Antti I think I physically felt the cynicism in that... :p
 
9:20 AM
no, it is the north wind
 
i should make a script that recognizes the w3school article being linked to and proposes an alternative
Q: what is worse than PHP docs? A: w3schools articles on PHP?
 
is it?
 
I'm not sure, I'm asking. To me it seems like it is.
 
9:25 AM
yes
i'd say yes
why are some answers with vlq not removed even though helpful?
 
@AnttiHaapala They are reviewed in the Low Quality queue.
If enough Recommends Deletion votes come it it'll be auto-marked as helpful.
 
so what happens then?
 
but if the post has a positive score it'll still take a moderator to handle the actual deletion.
 
ah...
this has -5
-5
A: What are some good algorithms to find relevancy between two documents?

Kenshin HengMaybe this will help the least: var text = "text"; var othertext = "othertext"; var search = text.search("t"); var searchTwo = otherText.search("x"); alert(search); alert(searchTwo); It will search for the first "t" in both strings. I hope this helps: W3Schools Javascript RegExp Object It h...

 
Then it could be a tie.
 
9:32 AM
this was vlq-helpful
 
Hrm.
That's an attempt at answering at least.
It may be a rotten attempt, but it's still an answer.
 
attempt at an answering :D:D
 
I'd just downvote and move on.
 
it is not even an algorithm
 
It's the question that is awful too though.
 
9:33 AM
well, it's got two delete votes at the moment
 
I voted to close it.
 
closed
 
The answer is now deleted.
(Jon and my delete votes helped it out of the world)
 
thanks, bows
 
But don't expect reviewers to know something is VLQ on technical grounds.
 
9:34 AM
I know the rotten apple picture
 
However obvious to you.
 
but a rotten banana is not a rotten apple
 
I downvoted the question, the roomba will take care of it now.
 
my votelimit is full :D
some serious downvoting
I am eliminating w3schools with the Juan Valdez method :(
 
It's like you're the terminator and w3schools is your Sarah Connor :p
 
user2260218
9:50 AM
Is there a good way to access mouse coordinates in Python?
 
good try w3schools, you can only postpone the inevitable
 
@AnttiHaapala You tilting at windmills again? Isn't that Don Quixote? :-P
 
@Anthony yes, many of them...
 
@Anthony in what context?
 
@MartijnPieters wrong metaphor though
 
9:51 AM
Python on my computer cannot access your mouse coordinates even if you connected to my HTTP server, no.
 
user2260218
Any context, I'm just curious how interfacing with a mouse works.
 
@Anthony In most contexts, that wouldn't work.. are we talking on the same machine, with a GUI that handles a mouse?
 
user2260218
(I'm still very naive with regard to computer science...)
 
user2260218
@MartijnPieters Same machine, not sure about the GUI.
 
you have an XY problem here.
 
9:52 AM
ha, I didn't know about str.zfill
 
first of all, a mouse (the rat with tail or not), does not give coordinates
it gives axis velocities.
 
Not that accessing a mouse will take a research team and 5 years, but if you are new to CS be careful what you are doing. :-P
@AnttiHaapala Yeah, lets confuse the user some more.
 
user2260218
I mean I'm not terribly new, I just really don't know how to handle most situations I come across.
 
By 'position of the mouse' you presumably mean 'the position of the mouse pointer on the screen'.
 
9:54 AM
that is why there are no coordinates beyond gui
 
user2260218
Oh. I mean. Doesn't the computer access some kind of information from the mouse?
 
If your Python program using a GUI toolkit and it has focus, getting the coordinates is certainly possible.
@Anthony Yes, a physical mouse device gives the computer information.
 
What is an easy way of knowing if a script is done in a remote machine? (automatically)
 
yes, the mouse gives velocities over 2 axes
 
That infromation is relative direction.
Move up 10 units.
Move left 20 units.
 
9:56 AM
@MartijnPieters see I wasn't confusing ;)
 
@AnttiHaapala nope, you weren't, as it turns out.
 
user2260218
So by what means can I access that information?
 
user2260218
I mean like how does my computer access and use it?
 
4
Q: Get mouse deltas using Python! (in Linux)

JohnRoachI know that Linux gives out a 9-bit 2's compliment data out of the /dev/input/mice. I also know that you can get that data via /dev/hidraw0 where hidraw is your USB device giving out raw data from the HID. I know the data sent is the delta of the movement (displacement) rather than position. By t...

61
Q: Controlling mouse with Python

SashaHow does one control the mouse cursor in Python, i.e. move it to certain position and click, under Windows?

 
user2260218
Thanks.
 
9:57 AM
etc., searching for 'Python access mouse movement delta'
 
user2260218
Do you know what the C code for something like this would look like?
 
user2260218
Well thanks for those links!
 
if you are doing linux, I have played with hidraw recently ;)
 
10:07 AM
This guy is brilliant. Reminds me of a question I once saw:

Which is the best language?

1. c
2. c+
3. c++
4. Java
 
@AnttiHaapala Have time ?
cbg
 
@JonClements not sure that that is yet up to re-opening.
 
it's getting there...
 
I see no inputs and expected outputs, and no error messages or unexpected behaviour being described.
It is just a code-dump at the moment.
 
10:28 AM
Could be cruel and do something like
with open('input') as fin:
	for num, chunk in enumerate(iter(lambda: list(islice(fin, 10)), []), 1):
		with open('output{}'.format(num), 'w') as fout:
			fout.writelines(chunk)
But don't fancy explaining that one
Wow... 8 space tabs? It was 4 about 10 minutes ago - anyone else noticed that ST3 sometimes does this?
 
@JonClements ST3 has per-language and global settings.
If you opened a new tab and didn't set a language for it yet, the global prefs apply.
If your global pref is tabs to 8 columns...
 
I was in the same tab that was happy being 4 spaces
 
@JonClements flagged, voted to delete and commented.
 
10:43 AM
@Raja ?
 
I wonder where all the f.close (no call) errors are coming from. They seem to occur rather more often than mere random chance would allow.
I suspect there is a popular Python book or tutorial out there that made the mistake and now every newbie using it makes the same.
 
Yeah, I noticed that on that write N lines at a time question - although, my favourite snippet from that was open(path, 'a').close()
 
What is that supposed to do?
 
@MartijnPieters even some answers did have that...
 
@JonClements I think that's just a poor-man's touch operation.
open the file to ensure that it is created even if empty.
 
10:52 AM
@AnttiHaapala, I don't use with because I don't like the extra level of indenting. Having to write f.close is a small price to pay. — 7stud Jan 23 at 7:06
@MartijnPieters which reminds me of this:
touch(self, mode=438, exist_ok=True)
    Create this file with the given access mode, if it doesn't exist.
this is so wrong, the touch without exist_ok should not be even called touch
c.f.
NAME
       touch - change file timestamps
DESCRIPTION
   Update the access and modification times of each FILE to the current time.
 
from tkinter import filedialog
from tkinter.filedialog import askopenfilename
Isnt the second import wrong?
from filedialog import askopenfilename
 
@AnttiHaapala Responded to that piece of wisdom.
 
@Martijn try not to mince your words hey? :)
 
Ninjas don't pull punches.
 
I've come across the user before and being more subtle didn't work last time.
The 10k rep is worrying in that it gives a false sense of trust in the answers produced.
 
11:03 AM
back in a bit...
 
back in a bit...
I hav doubt in urls.py django
 
Wouldn't mind test-driving one of these maybe we can get @vaultah to get one :p
 
nuked
in 59secs
 
stackoverflow.com/a/28133538/918959 this is a cancer: ~"as per w3schools you should embed your youtube videos as below"
 
I was about to mark that as NaN, thanks to the series of cv-pls you have added
 
@JonClements umm, this thing is a bit pricey :p
 
11:29 AM
re-cbg
 
@BhargavRao yeah, that is an answer, was thinking should edit there "as per youtube"...
 
Ah, found where I encountered 7stud before: stackoverflow.com/a/16660022/100297
 
@BhargavRao No, this is about PyCharm.
Duping to a post showing other ways to pre-pend a string isn't all that helpful in this context.
 
@MartijnPieters You didnt read the dupe of this
It says i'm using PyCharm (version 4.0.3) at the start
The warning is the same
Bro, this is the problem with string concatenation. Use format always.... The problem is (I think, it considers you are doin arithmetic + and not concat and so the problem) — Bhargav Rao Jan 9 at 17:18
Both have the same tags
 
11:46 AM
@Martijn that guy didn't even get a particularly good answer - stackoverflow.com/questions/28261614/…
@Martijn oh, and 7stud has a deleted answer there as well
 
@Jon low quality questions beget low quality answers....
@BhargavRao right, I did miss that then. I'd like to think I gave a more helpful answer however. Perhaps reversing the link is in order. I won't do it myself however.
 
Steward and Marshal badges are distant dreams to me... Sighs
 
12:02 PM
@MartijnPieters links reversed
 
How do you reverse so easily? Does gold badge even allow you to remove a cv as dupe?
 
Gold tag badges enable you to insta-close as dupe, and insta-open questions closed as dupes...
 
12:19 PM
cbg
 
 
1 hour later…
1:34 PM
Whoah!
What happened here?
 
howso?
I decided to search for "[website]" and "is:answer w3schools"
 
1:49 PM
i guess ill just post questions on the site.
 
@Death_Dealer ?
bwaah I want 20k rep to delete stupid answers :D
 
@AnttiHaapala Still you can just vote to delete. It takes three people's consensus to clean it.
 
nope, cant vote to delete answers
at 10k
there are things like "Q: how do I do x in java", "A: use the preg_replace, see page at w3schools"
 
I meant, even when you have 20k, ...
 
ah :d
ofc
 
1:58 PM
There was a website against w3 schools... Let me google it
 
w3fools
it does not contain any good content anymore
 
Ah, right... MDN is the way to go
 
still almost all of the pages that I have seen linked from w3schools are soo wrong
 

« first day (1569 days earlier)      last day (3372 days later) »