« first day (1525 days earlier)      last day (3417 days later) » 

2:00 PM
@MartijnPieters said all I really wanted to say, just didn't want to sprawl all over the SO thread more than we had. Should I delete the comments now I've updated the answer?
@JonClements Sadlt it seems according to shop.oreilly.com/category/… that you still have to buy the book. I'll have to see whether authors are allowed to issue freebs
 
Damn, I hate the way DELETE with no focus acts like the back button, an excrescence. I think I'm about to edit a question, and suddenly find myself looking at the previous page
 
@holdenweb We can clean that up, yeah.
 
@MartijnPieters Cool!
 
Hi guys, im a .net developer soon making a switch to python for a couple of projects. So i have some major refreshing to do. Does anybody know a good site or whatever that blasts through the basics of python and some more advanced stuff? any recommendations?
 
2:07 PM
@Ronny wiki.python.org/moin/BeginnersGuide/Programmers has some links to guides for people with previous programming experience.
 
@holdenweb You sound awfully one-sided there now..
 
@MartijnPieters There where? One-sided? What?
Ah, you mean on teh training page?
Nope, still not got it
 
Thanks, editied to fix — holdenweb 3 hours ago
And below
 
@Ffisegydd thanks for the tip i'll check that out
 
@matsjoyce chuckle
@Ffisegydd cbg, Fizzy
 
2:12 PM
cbg @holdenweb :P all good over the pond?
 
When I left, yeah. Currently in London
 
Ah cool. Home for Christmas, or business?
 
rbrb for now guys - something's come up
 
@Ffisegydd Bit of both, but mostly Christmas/sweetheart/family. Also put a tentative toe in the training water
 
Dang, the SO question "share" box is dynamically generated. So much for easily adding a markdown version label to it.
 
2:18 PM
I'd like to propose CEP 0, which should state that "The Cabbage Enhancement Proposals shall be numbered starting with zero."
11
 
:-)
 
This is, of course, completely in the spirit of CEP 7
 
Is 0 considered even, odd, or neither? never mind, it's even.
 
I was originally going to suggest it should call for numbering to start at 1, but I thought that might be too contentious
 
Well, if you take up CEP 0, practically it will start from 1?
 
2:21 PM
Given CEP 5 I now realize it would have been perfectly permissible
Even better, perhaps, to phrase it as "CEP 0: there shall be no CEP 0"
 
Added
 
Making the document as confusing and self-contradictory as possible, seems to be in the spirit of the document.
 
Gah! Markdown formats the 0 to be 1
And the 1 to be 2, etc
 
Heh, that's right. Markdown completely ignores your numbers.
 
@Ffisegydd Damn, that didn't work out too well, did it?
 
2:25 PM
That's better, I'm adding the CEP in
 
And now CEP 5 has become CEP 6 and is even-numbered. PARADOX!
 
Fixed.
 
Much better!
OK, gonna rhubarb up the road for a late pub lunch. Think they have wifi there, if so will return
 
user2555451
cabbage all!
 
@holdenweb rhubarb, enjoy the lunch!
cbg newcomers
 
user559633
2:28 PM
sup nerds
 
;-;
 
user559633
aww, don't cry, you're so ugly when you cry
3
 
Trying to develop a sensible api/signature for this class.
 
Hmm, I wonder if I can monkeypatch js click events.
 
user559633
i figured out the secret to the coffee that i get from my (new) favorite cart - he puts a little bit of black tea in the canteen
 
2:36 PM
Not really a programming problem. I've voted it off-topic as server related here.
 
user559633
done -- voted not about programming
 
Ok, programmatically altering the "share" box on SO posts is beyond my abilities.
 
user559633
Thanks for "sharing"
 
I even tried giving 110%, but that doesn't seem to have done anything.
 
user559633
i love how your "110%" is "giving up after fiddling with it for a bit"
 
user559633
2:50 PM
"look, all i'm saying is that maybe man isn't meant to travel by water"
 
110% is basically me clenching every muscle simultaneously. It generally doesn't help.
 
Yes PyCharm I know I'm shadowing some builtin functions. No I'm not going to change it because I'm an adult and I can do what I like!
 
user559633
Whose muscles?
 
Every.
Did you not feel it?
 
user559633
please to not touch the tristan
 
2:52 PM
All muscles I have access to. So, usually just my own.
But if I have a lab animal handy with implanted brain electrodes, I'll switch those on as well.
 
user559633
You work in a lab?
 
user559633
Does everyone have a smart person job but me?
 
You don't need to work in a lab to have lab animals ;-)
3
 
user559633
Also, argh, I can't tell if I just introduced breaking changes or my ec2 instance is just being awful
 
user559633
That's the spirit!
 
2:53 PM
(please don't tell the authorities)
seriouspost: no, I don't work in a lab. I work in an office building.
 
I need to convert the range [0, 1) to the range [min, max).
Also I really feel that we need an sopython lawyer.
 
user559633
That reminds me of what my legal guardian used to tell me at the orphanage for sick children: "you don't need friends to have fun!"
 
user559633
Why do we need a sopython lawyer?
 
@ffisegydd, ah, the old range interpolation question.
It's quite frequently asked, but nobody knows the word "interpolation", so it's hard to google
IIRC the solution is
def interpolate(x, min, max):
    return (x * (max-min)) + min
 
Yeah I had something like that in my head, just trying to find some paper to sketch it out
And need to check it works for negative values etc
 
2:59 PM
It should, yeah.
My only concern is, the question is usually asked with inclusive bounds.
I don't know whether interpolate(1-epsilon) will translate exactly to max-epsilon, if that matters.
 
It doesn't matter as much, I basically want to take the result from random.random and transpose it to whatever.
 
Tkinter documentation grievance: neither of the two most detailed doc sites, effbot and new mexico tech, mention the meaning of the arguments passed to the callback registered byIntVar.trace.
> FIXME: describe the mode argument and how the callback should look, and when it is called.
Thanks, effbot -_-
 
user2555451
@Kevin - You could show the output of help(tkinter.IntVar.trace) in the post. It has at least some information.
 
@Kevin I declare that function a success.
 
Huzzah!
exercise: write a version that interpolates from an arbitrary range, to (0,1). Then write a version that interpolates from one arbitrary range to another.
 
3:06 PM
In [45]: interpolate(np.array([0,1]), 0, 1)
Out[45]: array([0, 1])

In [46]: interpolate(np.array([0,1]), 0, 2)
Out[46]: array([0, 2])

In [47]: interpolate(np.array([0,1]), 0, 10)
Out[47]: array([ 0, 10])

In [48]: interpolate(np.array([0,1]),3, 10)
Out[48]: array([ 3, 10])

In [50]: interpolate(np.array([0,1]),-9, -10)
Out[50]: array([ -9, -10])

In [51]: interpolate(np.array([0,1]),-9, -1)
Out[51]: array([-9, -1])
 
user559633
I need a new joke domain
 
user559633
was thinking freeganfriedchicken.com
 
Good morning guys.. Quick question...
 
user559633
EarthBound as in the game?
 
You've got a double quote in the middle of your string
 
3:13 PM
i know there have been questions around this on stack overflow but most of them mentioned about quotes.. or so.
well, no i don't have
 
" retrieve "/private/var/mobile/Media/FactoryLogs/Earthbound/EarthboundLog.tgz "
-----------^
 
ahhh
dammit
you guys rock
and i think i need coffee.. sitting on this Mac from last 30 hours
 
If you're sitting on your computer, you're doing it wrong.
 
hahahha
 
These bugs can usually be more easily diagnosed if you paste your code into an IDE that supports syntax highlighting. Then it is easier to see where string literals begin and end.
 
3:16 PM
sure, thanks Kevin.. I will make sure to do that
 
Ex. In notepad++, " retrieve " is grayed out, and /private/var/mobile... is black. The color change is a dead giveaway.
 
mm... i am working no color scheme vim.... thats why... got fix this color scheme
 
Or in kdevelop, you'll get red underlining all over the path.
 
mm hmm...
 
Interestingly, /private/var/mobile/Media/FactoryLogs/Earthbound/EarthboundLog.tgz is perfectly valid syntax
Which is why it didn't give you a helpful line number in your error message.
 
3:17 PM
@Kevin not really, because you cannot start an expression with /.
 
"I don't know why you're dividing by all these identifiers that don't exist, but sure, go crazy", says the interpreter
 
@MartijnPieters There was " retrieve " before
 
@MartijnPieters Errata: a string literal, followed by /private/var/mobile/Media/FactoryLogs/Earthbound/EarthboundLog.tgz, is perfectly valid syntax
 
Bit like pathlib in python 3
 
user2555451
Does anyone know of a way to get all of the valid extensions for Python in a list? I mean, I could do: ['.py', '.pyw', '.pyd', ...] but is there a simple function I could call?
 
3:23 PM
Not that I am aware of.
 
I doubt it, as if you call a file t.txt, you can still run it with python. Seems to be more convention based.
 
@Kevin yes, with a prefix that is valid syntax :-P
 
user2555451
Right...ok, thanks. I was filtering directory listings to only include Python-related stuff. I wasn't going to consider .txt files since they are probably malformed anyways. :)
 
My intentionally user-hostile Python implementation, KPython, only accepts files with the .vbscript extension. This isn't documented anywhere, except in this chat message.
 
@iCodez inspect uses a combo of imp.get_suffixes() and hardcoding.
 
3:27 PM
@iCodez But you only want source files, right =, not .py[oc] files, for example? Because .pyd is a compiled extension, IIRC
 
Heh. python my_work.doc
 
>>> import imp
>>> imp.get_suffixes()
[('.so', 'rb', 3), ('module.so', 'rb', 3), ('.py', 'U', 1), ('.pyc', 'rb', 2)]
but .pyo is missing from that.
 
user2555451
@holdenweb - No, I want anything you can import.
 
user2555451
3:29 PM
@MartijnPieters - That looks cool, I'll look into it some more.
 
@Ffisegydd Mjölnir strikes again.
 
user2555451
@MartijnPieters - Do you know if that function exists outside of the deprecated imp module?
 
@iCodez Looking now; that function is used an awful lot throughout 2.7 for something that is deprecated..
 
user2555451
Woah, check it out:
 
user2555451
>>> import importlib
>>> importlib.machinery.all_suffixes()
['.py', '.pyw', '.pyc', '.pyd']
>>>
 
user2555451
3:33 PM
That is almost what I need.
 
user2555451
in fact, I'd say that is perfect.
 
user2555451
.pyo is rare anyways.
 
@iCodez Doesn't look like it.
 
user2555451
Well, I could always append the .pyo extension.
 
@iCodez ah, you should've mentioned Py3.
 
user2555451
3:35 PM
Sorry. I use that version be default nowadays. :)
 
Once more Kasra answers a poor question.
 
with an answer that doesn't actually meet the requirements given.
25 characters is bigger than 18, and 25 + len("from collections import Counter") is even bigger than that!
 
@iCodez: I also see docs.python.org/3/library/…
(and related)
basically, .pyo is missing because you are not running Python with -O or -OO.
but you can just add importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES if it is missing (e.g. when importlib.machinery.BYTECODE_SUFFIXES is equal to importlib.machinery.DEBUG_BYTECODE_SUFFIXES).
 
user2555451
@MartijnPieters - Yea, I just discovered those when I was looking for imp.get_suffixes() in importlib. Thanks for the idea! I spurred me to go digging through the std lib.
 
@iCodez Is this code intended to be cross-platform? Because then you will have to consider the Unix-flavor extensions such as .so
 
user2555451
3:50 PM
@holdenweb - Thankfully, I am just building a library for personal use on Windows. :-)
 
@holdenweb that's where using the importlib-supplied info is so helpful.
it'll automatically include .so suffixes in the list when on a platform that supports those.
On my Mac:
>>> import importlib.machinery
>>> importlib.machinery.all_suffixes()
['.py', '.pyc', '.cpython-34m.so', '.abi3.so', '.so']
when running with -O the pyc is replaced by pyo.
 
4:06 PM
@iCodez: One selfie hat on its way!
Did you post that from a mobile app?
 
user2555451
Nah, I did it from my normal computer. :(
 
user2555451
I actually was looking for a question to self-answer. I did on about a week ago, but it was just outside Winterbash and I was like "AH! If only I had waited!". But now it's in the bag!
 
user2555451
Nobody post a better answer to that!!
 
@iCodez better take my feedback into account then! :-P
 
user2555451
@MartijnPieters - I will. Could you check my comment though?
 
user2555451
4:14 PM
I think I'll put them in a set then.
 
@iCodez done.
I discussed this in the chatroom earlier too.
Tomorrow a new hat: Treasure Hunter.
We'll see how well it'll fit the Ninja.
 
Let's hope the parrot fits on your shoulder.
 
@MartijnPieters Seems an odd one to be able to predict. Are you a very small number of widgets from a milestone?
 
@AirThomas gold tag badge for JSON.
I was a few votes short, my most recent answer pushed me comfortably across (together with a few votes received earlier in the day).
 
user2555451
@MartijnPieters - Sorry to bother, but would importlib.machinery.all_suffixes() + importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES every return two .pyo values? I want to make sure I address this in my answer if so.
 
4:28 PM
How you manage to carry so many mythical hammers at once is beyond me.
 
@iCodez yes, it would.
Use python3 -O and rerun that code.
 
user2555451
Right, I'll make that a set too then.
 
user2555451
Thanks.
 
@iCodez: and .pyc will be missing.
 
user2555451
Boom, Selfie! Now I am complete. ^_^ Well, until the next hat...
 
4:38 PM
That's a good selfie, too. I would go for it myself but I don't have anything useful in mind and forcing it seems like a bad idea.
 
guys, can i paste a small piece of code and ask question?
 
user2555451
Sure. Just as long as it is small. :)
 
before i ask question, can you tell me how to format it here?
 
On the left side of your sent message is an arrow you can click to edit.
 
4:40 PM
indent all lines by four spaces.
 
Edit, highlight all the code, and press CTRL + K
 
perfect thanks..
so i hope this code is not big..certainly not cimplicated
but why doesn't the if loop work.. and i am not even trying to print this..
By the way, thanks a lot for encouragement for asking questions..
actually, output looks like
 
I don't know much about popen, but perhaps you should be using check_output instead.
 
My gut reaction is that using Popen here might be overkill
 
@Jon @davidism am adding the data to mongodb, emails may start flying.
 
4:44 PM
now just to test, this path for ls wrong.. so hence it should always be inside that if check
 
I'm guesing p.stdout.read() is returning an empty string
Since the message is actually being printed to the screen, there's nothing left in the buffer to read from.
 
mmm...apparently it prints something but not this
 
Or perhaps "No such file or directory" is being printed to stderr, not stdout
 
You killed it before you read from stdout?
 
It is an error, after all
 
4:46 PM
yeah, i checked stderr too but its None
 
Hello
 
when i print the logs, it shows
 
Sup @Owatch
 
Hey.
Could you help me out Ffisegydd?
 
Depends, ask your question dude and we'll see what we can do.
 
4:48 PM
and this line with dashes is p.stdout.read()
 
I'm trying to win NSChat Bingo in room 15942, but I need someone to pop in and ask for help with a view controller.
 
lmao. I was not expecting that.
 

NSChat

Rules → spiff.io/nschat.rules —  Discussion for iOS and OS X ...
It would be awesome if you could.
 
@Owatch What is this I don't even
 
Just something generic, like "I need help with a view controller please"
 
4:49 PM
Surely it'll be obvious though?
 
Yes.
I just want to win.
 
so somehow stdout has something else and this line "....No such...." is getting printed anyways and i still can't check it.. wonderful start of the day
 
It's all good fun
 
When they say "What part do you need help with?" and I say "I don't even know what a View Controller is"
 
Do it.
 
4:52 PM
Done.
 
Thank you.
 
No problem :D
 
anymore suggestions guys?
 
@AjGauravdeep Unrelated to your specific problem I'm sure, but do you have a Kanzi as well as a kanzi or is that a typo?
In print "Logs don't exist for ", Kanzi, ": ", kanziToUDUD.get(kanzi)
 
If you were curious about the bingo board: dropbox.com/s/35e6qlztvck90c6/…
 
4:54 PM
good question.. yes those things are fine. i abhor tried to print those values and they work.. if that was the case, the whole command won't work..
imagine camtool as an API which runs commands on other devices attached through USB
and imagine that USB here is equivalent to kanzi
 
So the log exists on the device, if at all? Not locally?
 
yes
logs exist in that path of ls...or not...
this functions should return true or false if log exist in that path of the device
KanziSWD-001060 : confidential number
this is what that line prints
:(
 
Perhaps you could use a different command than ls
and that would make your life easier?
 
mm...well in the end, goal is to get output of command
isn't that the problem here, not being able to capture output
 
Well, it appears to be, but sometimes we are misled by our expectations
If you are stuck, try something different, and maybe it will reveal a bad assumption
 
5:02 PM
this function works
in the end kanziFolderNames is what i expect it to be
 
Well the difference that stands out to me is your test for stdout
But I have to admit I am not that comfortable with subprocess module to begin with.
 
Incidentally, if you're going to work with Python, please try to follow PEP8 for naming.
 
mm..
PEP8, sorry was not aware on that.. will read that up.. i am new to python.. started 2-3 days back
 
Yeah no problem :) but it's a good thing to follow if you can.
 
definitely. i like good naming in someone's code.. so why not mine.
 
5:07 PM
There's more to PEP8 than naming obviously
 
You will get more accurate syntax highlighting if you follow PEP 8 as well
For classes vs other objects, at least
 
i get your point, @Ffisegydd. Definitely
could it be possible that
ls is run on a remote machine and not this machine
which is why it can't get the stdout?
maybe... coz the other code i referred, that command runs on this machine and not on remote device.
 
That could be it.
Your subprocess p is running camtool but not ls?
 
yes
camtool runs ls picking the device through -t kanzi
 
Yeah.
That could very well be it.
 
5:12 PM
but the thing is if i run this command i get this output on this machine.
hello
 
Incidentally, your test in the working function if p.stdout == '' looks suspicious. That should be a file object, not a string.
 
sorry had to get rid of the code, it was kinda confit..
hold on
 
>>> p = subprocess.Popen('', shell=True, stdout=subprocess.PIPE, bufsize=0)
>>> p.stdout
<open file '<fdopen>', mode 'rb' at 0x7fe413ad79c0>
>>> p.stdout.read()
''
 
yes exactly.. which is why i am using .read
no idea @davidism
 
5:15 PM
@AjGauravdeep In the other function, the one that's working
 
ignore that function..
i will have to run it again.. i wrote that 30 hours before...
 
Ok :)
 
@AjGauravdeep I wasn't asking for ideas, I was asking for close votes, that's what means
 
and i havents lept in those 30 hours so i might be delusional :)
okay.. so back here.
doesn't it show that that it returns output to this machine?
when i was printing p.stdout, i thought only get the second line... and not first
and if i get first, my this problem will be solved
 
Perhaps the second line is overwriting the first somehow
If they are being sent separately?
I don't know.
 
5:18 PM
anybody else pleas?????
mm..
 
I'm back from getting lunch. Did you try check_output yet?
 
nope..i forgot about that
let me see
yehahhhhhhhhhhh it workksssss
my my...
Kevin, why did i ignore your comment :(
so lunch makes you somewhere in East coast?
thanks all the way.
 
Philadelphia, yeah
 
Silicon valley.
 
@Kevin Your profile must be out of date
 
5:25 PM
@AirThomas
Thanks a lot for your patience and time
 
I'm going to blame everyone else's avatars for being sexier and more eye catching than mine. That's why you didn't see my comment.
 
@AjGauravdeep Of course. Sorry I wasn't more helpful. :)
 
i thought you were just some Kevin...
but you were THE Kevin of Philadelphia
 
Oh, haven't you heard? This is the One True Kevin.
 
since i was a kid, i always wanted to visit Phili
 
5:27 PM
Kevin, lord of the stars.
 
before new york, before paris, before anything else, maybe Norway, but phili is what i wanted to visit
 
@AirThomas Because it says New Jersey and not PA? I live very close to the Delaware river, so my time is evenly split between the two.
 
my favorite TV show was from that neighborhood..
Boy meets world :)
 
@Kevin Ah. Sometimes I forget how close together everything is on the East Coast. I'm losing my roots!
 
There aren't many TV shows I like that take place in NJ.
A bunch of Kevin Smith movies, I guess?
Bob's Burgers takes place in an oceanside town that shares many similarities to Ocean City NJ, but I think they're canonically in Delaware. So close!
On-topic chat. I think this guy is asking "why doesn't if return True: work?", but he really needs to include more detail.
 
5:34 PM
Eh, that post make's my brain hurt.
 
I suspect he was reading this part of the specifications and misunderstood it.
Conditional expressions dictate how a if b else c expressions work, not if b: a; else: c statements
Or maybe he was looking at the expression ::= conditional_expression | lambda_expr line, and was confused by the admittedly non-descriptive names.
conditional_expression matches expressions of the form a if b else c, but it also matches an or_test expression by itself, which happens to match virtually all other kinds of expressions, not just a or b expressions.
Expression parsing is ridiculously circuitous, but it's still the easiest way for the parser to implement nice precedence handling.
 
5:58 PM
How can I publish messages to N threads, confirming they all receive each message (without knowing the message in advance)?
I know it can be done with queue-per thread, any solution without queue per thread?
 
@Kevin I've added the code from the comments to that question, might help with decoding what he meant.
 
Aaaand the code runs fine on my machine.
I don't know what his functions are supposed to actually do, but I'm guessing the answer is going to be "you forgot to return anything in the last two conditional blocks of your prime function"
That's the old "forgetting to put a return before your recursively invoked function" problem
 
Truly @Kevin your Google-fu is strong.
 
Thanks. My query was "def thing_two", for the curious.
 
user2555451
I wonder, are default arguments considered assignments in Python? If so, then you could technically do an inline assignment.
 
6:09 PM
You could always call the update method of locals()
(but if you do, I'll beat you about the face and neck with a garden hose)
(well, not really, as I have weak arms, so it would be ineffective. But you still shouldn't do it)
(this is the general "you", by the way, not any specific member of this discussion)
 
user2555451
Whew. I was getting worried. :) Also, updating locals() is not guaranteed to work. You should update globals().
 
ok.
I feel a little bad because my original comment on that question said "The code appears to be from this mid term", which casts the OP in a much worse light than "...from this sample midterm"
 
Fusion is the thing used to make flash games, right? That just sounds downright impossible to integrate with Python.
 
To answer my own question: it can make flash games, but that's not all it makes. And it's not the only software that makes flash games.
Nonetheless their product page says "With Multimedia Fusion 2 there is no complex programming language to master. Learn the basics within an hour!" so I'm going to continue assuming that it isn't compatible with Python.
Yep, "no coding allowed" surely is a highly desirable feature of any game engine.
 
Can't have any errors without code, makes perfect sense to drop the code!
 
Just select "breakout ripoff" from the dropdown list and press "build", and boom! You're a game developer!
 
6:39 PM
I'd swear there was more to it than that, but you've got 20k+ rep so you must know what you're talking about!
 
The real money is in writing a script which will select from the drop down list and click the button for you.
 
The real money is in an ATM that just has a button you press labeled "MOAR"
But who cares? There's another machine right next to it that dispenses pie instead. Money is just a middleman for pie.
 
what's guys.
up*
I'm using django-allauth for login user on my website.. however, when I go to the facebook and remove app from my account I'm still logged in and still as I got all permission..
how could I check wether user has accepted all required permission or not ?
 
I'm grumpy today because tomorrow I'm going to visit some distant relatives and watch them watch football, instead of staying in bed and watching cartoons like I wanted.
 
or how can I detect if u user has removed app .
 
6:49 PM
Hmm, dunno. I've never used django.
 

« first day (1525 days earlier)      last day (3417 days later) »