« first day (1658 days earlier)      last day (3306 days later) » 

DSM
5:00 PM
@AdamSmith: hence the question. I'm not sure if it's that the OP is curious about what's going on, or wants to know how to solve it.
 
@DSM yes, imo
 
@DSM I'd say, it is answered there
 
I think it's the same answer to two different questions. Not a terrible dupe target, but not ideal
 
@AdamSmith I agree.
 
DSM
"How can i solve the problem?" isn't very helpful, unfort.
 
5:03 PM
@AdamSmith not really :D
 
DSM
Lunchtime rhubarb for everyone.
 
rbrb DSM
 
@BhargavRao why not Zoidberg?
 
the title is "finding sqrt of big integers"
 
Did you guys want to close stackoverflow.com/questions/29991205/… as a typo post?
 
5:03 PM
err, I mean... why not meta-ninja @BhargavRao
 
and the other question is "I am using this code to find sqrt of big integers, is there anything better"
 
Importing dropbox from dropbox.py.
I rather not unilaterally close such posts as that'll look like moderator oppression. :-P
 
@MartijnPieters Another way out is to search a canon for that
 
@MartijnPieters that to me seems like a duplicate :)
 
I guess it's typo-ey, voted
 
5:05 PM
@AdamSmith same question, the other OP also does "int()" of the result value...
 
If you have a good canonical duplicate target, then I'm happy to dupe it to that.
 
@MartijnPieters searching for one
 
Barely similar question. Target question wants a function that will only return perfect square roots. Source question wants to know why their math.sqrt(BIGNUM) doesn't return the right answer.
 
Searches frantically
 
sounds like an excellent canon to create if there isn't one.
 
5:06 PM
@MartijnPieters stackoverflow.com/questions/28646271/… Kinda same
 
I'm sure many many dupes exist, but the perfect one may only exist in the Realm of Ideal Forms.
 
But since target question mentions that he's concerned his implementation won't handle very large numbers, he got answers handling how to accurately square root a bignum
which is what the source question asks
 
Ideally, the canonical version wouldn't require any third party modules. It would be a script named math.py trying to import math. Or something similar.
 
@BhargavRao: I have a pile of those kinds of answers too. :-P
 
Lool
Everyone has
 
5:08 PM
haha, I don't
 
@Kevin exactly. Plus covering all bases for recovery.
 
I put in my vote to have a canon for that
 
including finding other files, that are not the script.
 
I'll ask the question if you want. :P
 
so foo.py importing math and getting the wrong thing because there is a math.py in the path.
I have answers helping debug that sort of thing (e.g. python -c 'import math; print(math.__file__)'.
 
5:09 PM
@MartijnPieters this stackoverflow.com/q/6861818/1149736 seems close enough match to cv-dupe
 
@Vyktor agree, looks good
 
@Kevin Clever guy haha
 
The hell
So many
 
@Vyktor already a bit better.
 
5:10 PM
@Vyktor does not have a tick
 
Yeah the oldest one wins
 
but still doesn't cover all the bases.
 
@AnttiHaapala wat wat wat? What tick?
 
no acceptance
 
No accepted answer
 
5:11 PM
I have to run; you fight it out amongst yourselves or create a new canonical.
 
Have you named your file pocketsphinx.py or any other file in the pwd as pocketsphinx.pyBhargav Rao Jan 8 at 18:56
Errr
Everywhere!
 
add it to sopython/canon
 
have a new one then close all these as a dupe thereof
 
@MartijnPieters Ninjas run? Thought they just teleport
 
this music video makes me want to be a pirate
 
5:16 PM
He has to [cause the streets to] run [red with the blood of his enemies].
 
I love alesorm. I can't do metal normally, but they're just so awesome.
 
Using his [blue diamond studded] hammer
 
5:30 PM
cbg
 
user559633
sup doods
 
user559633
@BhargavRao ninjas "vanish," not "teleport"
 
user559633
@Ffisegydd Are You a Nibad Enough to Rescue the President?
 
user559633
5:35 PM
 
user559633
@corvid I'm offended by their cover of this great song youtube.com/watch?v=4E45ee-1gMs
 
user559633
^^ which is a good cover a song by this guy: youtube.com/watch?v=TVY8LoM47xI
 
user559633
also: todo: memorize barrett's privateers in case it's ever in a karaoke machine
 
Thanks for sharing. I find old timey sailing music strangely endearing.
 
user559633
No problem :)
 
5:48 PM
I listened to a lot of Flogging Molly in high school.
My parents would play this on road trips when I was about four
 
user559633
Haha, that's awesomeeee
 
user559633
my parents have awful taste in music and would listen to bob dylan/the beatles/80s rock
 
user559633
haha the lyrics to this song
 
6:17 PM
@Antti ... You've got some fans here :D
@BhargavRao hi!!!!!!!!!! yups!!!! long trip :P........ stackoverflow.com/questions/29988595/… see dis!!!!!!! brilliant answer by Anti happala.......There's always something to learn from SO !!!!!!!! — vks 29 mins ago
But Bad spelling of yours there!
:D :D
 
surely lots of !!!!!
 
Correct him there!
 
Anti Happala is probably the least flattering way to typo my name, Happala sounds like "Sourhouse" :D and Anti just in front of it looks like the anti- prefix from loanwords :D
 
Go to google.in and search for happala
You'll freak out
 
ah I did
 
6:22 PM
So what'd ya find?
 
papadums :P
 
ಹಪ್ಪಾಲ
 
Anti happala .... I am against ಹಪ್ಪಾಲ
:D :D
You've tasted them? By any chance?
 
the standard issue ones from Indian/Nepali/Bangladeshi restaurants only, don't know which flour are they
 
6:26 PM
Made from Rice flour primarily
 
Mmm, I love Papadum.
 
these are not from rice flour I guess, some beans
 
Vigna mungo
flour also
 
Probably chickpea.
Or at least that's what I've seen around here.
 
Yep. North Indian restaurants make it using that.
 
6:31 PM
I mean I am not sure at all what are they using, but some say "bean flour" whatever that means :D
 
Call in vks to the room. He'll know that better
 
but rice it aint
 
Er, I'll call him. He's from north, so he'll crack it.
 
I mean I read the wikipedia article and it lists 10000 alternatives :D
 
Diversity
 
vks
6:35 PM
crack what? :P
 
Cabbage @vks
 
cabbage
we were discussing about papadums
 
I was angered at your mix spelling of @AnttiHaapala
 
vks
bean flour!!!!!!!!!!! i guess mostly wheat flour is used :P
 
vks
6:36 PM
ohhh for papad
 
can't be wheat, doesn't taste like wheat at all
 
vks
maida i guess :P
antti haapala.....is that your real name ?
 
Obviously
 
vks
ohhh cool !!!!!!
 
6:38 PM
Hey up again
 
Cbg fizzy
 
@Ffisegydd
 
@Ant
 
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ffisegydd import cbg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name cbg
 
6:40 PM
F should be in capital
Closing that as typo
:D
 
but there is a ffisegydd module installed apparently? :p
 
>>> def cbg():
...     print('Cabbage!')
...
>>> import ffisegydd; ffisegydd.cbg = cbg
there, monkeypatched you
 
buh. I can't figure out the proper way to exclude array fields from MongoDB queries effectively
 
@corvid can't you use '$not' or something?
 
6:50 PM
@Ffisegydd tried that, doesn't seem to work as intended
 
What exactly do you mean by 'exclude' then?
 
db.find({'$not': {'pet': 'kitten'}}) should exclude any results that include when pet is kitten
 
@Ffisegydd not quite what I mean, it's more of a projection than a query
 
{ '$project' : { 'name': 0 } }?
 
@vaultah the problem is, I seem to have to include the first entry I find, but then explicitly include all other fields
 
how good business model is that:
raise 311M in VC
for a product that you can't do anything with
 
if i want linux ( probably ubuntu) can someone recommend a very detailed tutorial to learn all the things i have to learn
 
or...
 
@StephanKetterer Ask Ubuntu
You get everything there
:D
 
7:01 PM
1. Make a shitty product that can't be used for anything
2. ---questionmarkquestionmarkquestionmark--- Raise 311M in VC
3. Profit!
 
@AnttiHaapala it can do things, it just does very specific things
 
thank you !
 
haha doesn't work
 
???
 
doesn't wrok there in multiline string I guess
???
 
7:03 PM
Yeah
 
something
---???---
 
@AnttiHaapala tbh, I'm much more likely to think it's me doing something wrong rather than the product I'm using doing something wrong... I'm sure it's my fault
 
@Antti good candidate for
 
of course, I am not
 
Also I got it to work, but in a really roundabout way
fields = {x: 1 for x in MySchema._schema}
fields['othercollection.$'] = 1
Things.find({
  _id: thingId,
  "othertable.id"
}, {
  fields: fields
})
 
7:26 PM
rbrb
 
cbg
@WayneConrad that comic would look a lot different if chair guy was using the thefuck library.
"Make me a sandwich." "No." "fuck" "Okay."
 
7:51 PM
nice
when I need 45 rep, what do I do: answer a C question
get 3 upvotes and accept in no time
not so with Python
 
8:02 PM
@AdamSmith :)
 
How to change a nested dict into a Ordered dict
{'a':{'b':'c','d':'e'}
'f':{'g':'h','i':'j'}}
 
What's your expected output?
 
>>> import collections
>>> d = {'a':{'b':'c','d':'e'}, 'f':{'g':'h','i':'j'}}
>>> collections.OrderedDict(d)
OrderedDict([('a', {'b': 'c', 'd': 'e'}), ('f', {'i': 'j', 'g': 'h'})])
Ta daa
 
in this particular example order happened to be same for both the dicts
 
@davidism I'm playing around with a toy flask app and trying to understand how you've set up migrations to work on sopy with alembic. Can you explain how manage.py works?
 
8:14 PM
In [9]: d = {'f':{'g':'h','i':'j'},'a':{'b':'c','d':'e'}}

In [10]: d
Out[10]: {'a': {'b': 'c', 'd': 'e'}, 'f': {'g': 'h', 'i': 'j'}}

In [11]: OrderedDict(d)
Out[11]: OrderedDict([('a', {'b': 'c', 'd': 'e'}), ('f', {'i': 'j', 'g': 'h'})])
 
@Ajay dicts have no order, so the order of the OrderedDict is arbitrary when creating it from an existing regular dict
 
@Ajay the problem is that you're building an ordered structure from an unordered structure (the existing dict)
 
I know it doesnt work because i've already invoked a dict which changes the order...but i've asked how to make an OrderedDict
 
You just did
 
key,values in tuples
 
8:17 PM
@AdamSmith I wrote Flask-Alembic to handle integrating Flask, Click, and Alembic
Did you pip install -e .? Then you'll have sopy db <command> available.
 
I'm not asking to convert a dict into OrdereredDict
I'm asking how to create an nested OrederedDIct
 
@Ajay You need to build your OrderedDict out of OrderedDicts
 
OrderedDict(('a', OrderedDict(('b', 'c'), ('d', 'e'))), ('f', OrderedDict(('g', 'h'), ('i', 'j')))
 
DSM
I sometimes sort d.items(), but that only works if there's a canonical order other than insertion. (Before passing it to OrderedDict, I mean.)
 
8:28 PM
@davidism Did it work?
 
Why are you asking me?
 
I got this error
TypeError: expected at most 1 arguments, got 2
 
OrderedDict((('a', OrderedDict((('b', 'c'), ('d', 'e')))), ('f', OrderedDict((('g', 'h'), ('i', 'j')))))
 
before posting here i tried a similar one...didn't worj for me
 
just built a fresh virtualenv for sopy, cloned repo and ran pip install https://github.com/mitsuhiko/flask/archive/master.zip, pip install -e .. pip install -e . threw an error installing psycopg2
(for some reason)
whoops, that looks like pip install -e .. but it's just a period after the code block haha
 
8:34 PM
@AdamSmith Remember that on many Linux distros you need to install the dev headers separately
sudo apt-get install postgresql-dev or something like that
 
Hacking away at lunch, so I'm on my Windows system.
which is probably why ;)
 
Yeah, have fun with that
 
haha
But I don't actually have to get it working, I'm just using it as reference and I suppose kind of a template. The setup script creates some console entry point sopy that runs sopy.manage.cli.main()?
is that right?
 
8:52 PM
yeah
 
that's the bit I missed. Trying to write my manage.py to standalone and needed to if __name__ == "__main__": cli.main().
it's a chicken/egg problem. I can't learn how to use Flask (et. al) without a project, but I can't make a project with learning the frameworks
so I'm mostly just stumbling around in the dark until I run into something interesting
 
Use the package installed in dev mode (pip install -e), don't try to modify/run manage.py.
 
I can't install the package in dev mode, remember? :) I've built a skeleton of my own app and modified my own manage.py in that way
 
Ah, I see. Consider doing it the same way in your app but not using PostgreSQL. SQLite is perfectly acceptable when starting and is built in.
 
SQLite is my plan since it's easier to migrate around. Trying to find an hour here and there to work on it on whatever computer I happen to be on at the time
git pull is easy
 
8:59 PM
There's probably windows builds available for psycopg2 too.
 
probably. I vaguely remember dealing with that crud before.
But it's not really necessary for me at the moment
Thanks for all your help, as usual @davidism
 
I think I was just telling Antti the other day that I always forget that that exists until someone links it
(gohlke, that is, not the psycopg lib)
 
@AdamSmith is that an example of the Baader-Meinhof Phenomenon?
 
Someone was just telling me about the Baader-Meinhof Phenomenon, no way!
;)
 
user559633
9:11 PM
Why wouldn't I help the tortoise?
 
user559633
stackoverflow.com/questions/29995133/… i can solve this question but i don't want to because he's probably violating the ToU for the site
 
;P
who cares... how is what we are about not why ... the right answer maybe to find an appropriate api
 
user559633
16 questions, no answer, asking about scraping == probably doing a dickish thing
 
I often am bothered when people refuse to answer a how-to question based on ethics
 
DSM
Huh?
 
user559633
9:15 PM
@JoranBeasley yeah, i understand
 
DSM
So I can skip answering a question because it bores me, but it'll bother someone if I skip answering a question because I suspect the author is up to no good?
 
yeah basically
 
user559633
@DSM you're not obligated to ever answer, but sometimes i'll skip answering a question because i suspect the author is going to use that information to annoy someone else. edit: oh, nevermind :)
 
sometimes ill skip em... but if someone asked "how can i send a request 1000's of times" I would tell them about loops even though they probably shouldnt be doing that ...
if by all other standards it was a reasonable SO question (lol sometimes that goes out the door and I answer very low quality questions)
well Im really only bothered by it when they post some comment saying something like "well I could tell you how, but since you are clearly going to use that info to do something you shouldnt I wont tell you how."
 
DSM
I probably wouldn't do that (add a comment which is mostly about me, I mean), but I think once or twice I've asked about the use case. Here the OP makes it very clear what he's up to.
 
user559633
9:22 PM
Oh, martijn answered it anyway :)
 
Does this quote:

>If you want to use it eventually, you can, but it is neither usual nor recommended.

from this answer https://stackoverflow.com/questions/7456807/python-name-mangling-when-in-doubt-do-what/7456865#7456865 refer to mangling when trying to prevent variable overriding? Or is he strictly speaking about the OP asking if he should keep everything private?
 
DSM
9:39 PM
It applies to both, but as written I think he's specifically talking about using the leading double underscore.
 
private variables in general in python i think
which is name mangling ...
 
DSM
Weekend rhubarb for all!
 
haha another downvote :D
 
hi all
 
someone must have a crush on me
 
9:49 PM
I am trying to plot an ROC curve using sklearn.metrics. But, it does not plot anything maybe you can help what I am doing wrong.
# Compute ROC curve and area the curve
fpr, tpr, thresholds = roc_curve(y_test, probas)
roc_auc = auc(fpr, tpr)
print("Area under the ROC curve : %f" % roc_auc)

# Plot ROC curve
pl.clf()
pl.plot(fpr, tpr, label='ROC curve (area = %0.2f)' % roc_auc)
pl.plot([0, 1], [0, 1], 'k--')
pl.xlim([0.0, 1.0])
pl.ylim([0.0, 1.0])
pl.xlabel('False Positive Rate')
pl.ylabel('True Positive Rate')
pl.title('Receiver operating characteristic')
pl.legend(loc="lower right")
pl.show()
Also, when I print the length of the metrics:
 print len(fpr), len(tpr), len(thresholds), len(y_test), len(y_score)
It prints 508 508 508 761 761
Does the size of y_test have to match with the size of tpr and fpr?
 
akn
10:44 PM
hello python masters
I spent many time trying to solve my problem but my python knowledge is probably to small to do it. Could you help me? Here it is: http://hastebin.com/nidumiqibe.py
I have two buttons connected to raspi. First button runs the start procedure, and the second must be a "safe stop" button and it should stop the start procedure immediately
could you suggest me any good solution?
 
What's unsafe about just pulling the plug?
 
akn
after pressing stop button program should do some more actions (playing a sound turn on red led etc). And the safe stop can affect start procedure only during the initial commands
(this program will control BMX start gate)
quote from official rules: "For safety, the stop button can be pressed at any time (up to the end of the second set of words) after the start button was pressed, to abort the sequence. A “Stand Down” tone consisting of 740 Hz for .22 seconds followed immediately by 680 Hz for 44 seconds will sound when the gate was aborted. "
 
11:05 PM
not sure what the tech limitations on the raspi is, but maybe consider running start in a separate process and have stop kill that process, then safely clean up?
 
akn
is it possibile to do it with python threads inside one application?
 
11:38 PM
It's possible to do with python processes inside one application. Use multiprocessing
@akn this answer does a decent job of explaining why you shouldn't kill a thread but you can kill a process
 
akn
thanks Adam, i will look at it tomorrow
have a good nigth! Bye
 

« first day (1658 days earlier)      last day (3306 days later) »