« first day (1853 days earlier)      last day (3318 days later) » 

00:05
if someone would like to help me test my notification system, I'd really appreciate a comment on any one of my posts
ok my dumb question of the day ... sqlite3 does not enforce types ... so even though a column is defined as INTEGER it is in the database as "123" ... is there a query to tell sqlite3 to convert all values in that column to ints?
hmmm maybe its the python sqlite3 binding that is casting to int ...
no its me Im dumb I guess ...
00:41
Hi folks, I had a numpy question. I have a nested loop that I am using to calculate a surface area and I would like to vectorize it for performance but having trouble doing so. Anyone think they could help?
nah, sqlite is pretty dumb too but I think that's the point - dumb but simple fast and simple.
Here's a pastebin with the code. It's not long: pastebin.com/x4zAM7Sb
 
1 hour later…
01:49
Is there anyway to make matplotlib's draw only redraw an image rendered with imshow, instead of re-rendering all the axes, etc?
02:00
awww no one's around :(
user559633
anyone on python 3.4.2+ on mac osx that can run:

import platform
platform.mac_ver()

for me?
yep
hold up
user559633
Python 3.4.2 (default, Oct 19 2014, 17:52:17)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.mac_ver()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/platform.py", line 675, in mac_ver
    info = _mac_ver_xml()
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/platform.py", line 647, in _mac_ver_xml
user559633
Cool, thanks @idjaw
ok I'm not getting that on 3.4.3
np
@tristan ('10.10.5', ('', '', ''), 'x86_64')
user559633
02:12
wanted to make sure it was a local issue and not all of 3.4.x
FWIW, works in 3.4.2
user559633
02:33
Much appreciated, thank you
03:33
@KevinGuan If I may, I'd recommend a higher bar for editing someone's answer, particularly if it sort of goes against the author's intent.
@TigerhawkT3 Oops, because I think that's just a small edit...
A single small formatting change might not be enough reason to edit someone's answer (as far as I understand). Additionally, in this case, I was referring to the data the user is asked for, not the name of the saved reference.
@TigerhawkT3 Ah, next time I'll remind me this. Thanks.
 
1 hour later…
05:02
hey, I think I"m getting crazy
A function that worked perfectly always, and physically I have "proof" that it should always be possitive just returned this: -1.16415321827e-10
(it should return >= 0). - What is the floating point epsilon in python, and can I get that in code (I can easily use as input pi/2 + epsilon instead of pi/2 to prevent rounding errors)
05:19
Looks like rounding errors are turning what should be zero into "almost zero." If you need precise figures, you might consider the decimal library instead of relying on floating-point math.
@TigerhawkT3 I kind of need floating point math since it's a physical problem...
But it seems like math.sin(x) creates quite a few artifacts around "pi" - a 6-7 orders of magnitude larger than the floating point epsilon (so about a million time as inaccurate as I would expect from floats)
A zoomed in image: i.imgur.com/55AIaGJ.png
Should be a perfectly smooth curve touching "0"
@paul23 "floating point epsilon"?
@AnttiHaapala the maximum accuracy based on the IEEE specifications of the 64 bit floating point (52 bits mantissa etc)
That's not what I mean by "floating-point math."
but it is not a single number
05:25
Nope, that's why I wish to get it programmically
"what's the minimum number that can be added to this value to make a difference"
meaning: increase mantissa by 1
>>> math.pi.hex()
'0x1.921fb54442d18p+1'
>>> math.pi.fromhex('0x1.921fb54442d19p+1')
3.1415926535897936
>>> math.pi
3.141592653589793
Well it doesn't really matter anyways - I just noticed the sine function error is magnitudes higher than the floating point error in the my case
you're doing 32-bit sin :P
So now I'm at the point where I wonder what the inaccuracy in the sine function is.
math.sin
sin function depends on the platform
in newer processors it is written in software
05:29
Can I get that accuracy?
Kind of need it for my root finding algorithm - to stop trying to find an 'impossible' root.
Again, try the decimal module instead of floating-point math.
decimal doesn't make sense in the field of orbital mechanics..
@TigerhawkT3 -1
there is no sin for decimal
05:32
Ah.
I guess you're stuck with floating-point, then.
How many decimal places should I take when doing calculates with orbits that are millions of meters, but have eccentricity between 0-1
Btw I try to solve this: wolframalpha.com/input/?i=A*%281-%20B%5E2%29%20%2F%281%20%2B%20B%20*%‌​20cos%28T%2Bx%29%29%20*%20sin%28x%29%20%3D%20R%20solve%20for%20x function numerically
Maybe you could do as much as possible in decimal and then convert to float as needed?
ok
there I broke the link
@TigerhawkT3 again, no
the rounding errors are minuscule compared to the sin
though...
05:35
@paul23 [ caption goes here ] ( url goes here ) without spaces
Does that work in chat too?
anyways works now :P
(just to show the equation, ignore the actual solution wolfram gives, I do not want to type that in python)
nice solution :D
why not :D
Numpy has some easy numerical solutions, and from physics I know the solution is between 0 < x < pi/2
the image I posted above is one special case that broke everything (here a lot of solutions converge to the same point).
then just assume if it is like pi/2 / 10 ** 9 from 0 it is ok too
so you're using numpy?
yes
10**-9 you mean?
Well ideally I would put that number at a "known point" where it is known the trigonometry functions start behaving badly.
Funny, this started at kerbal space program
05:42
again, where would cos or acos behave badly?
(nowhere)
maybe you need a better sin/cos
4
Q: sin, cos, tan not accurate

ScottDWhy does sinl give incorrect results when the argument is near a non-zero multiple of pi? Why does sinl give incorrect results when the argument is large? The following code illustrates. Note that the digits used to initialize variable pi do not exactly match any 64-bit long double value. The com...

with me deciding: "hmm I really don't want to launch a satellite and discover later I have too few batteries, let's actually solve the equations - I've done often in the past"
Then realizing I only did it for neat circular orbits - where the algebraic solution is very very straight forward. And then I thought: well if calculus fails - numerics starts!
And that took me a week, now I"m working on the edge cases since I can't stand even personal code not being robust
Still need to launch that KSP satellite though
@AnttiHaapala Well I know I had the same problem in C once, that's why I"m anxious: randomascii.wordpress.com/2014/10/09/… That error hitted me like a week before I had to deliver the results of a project.
hello, i want to find the lenght of a word containing € len('h€llo') is egal to 7 i want the € charactere to be count as 1 charactere
i use this l = []
193 for i in range(len(str)):
194 l.append(str[i:len(str)] + str[0:i])
195 return l
I have no idea how that is related to what you asked
05:57
this is what I get here
>>> f = open('Test.txt', 'r')
>>> data = f.read()
>>> data
'h\x80llo'
>>> len(data)
5
>>> l = []
>>> for i in range(len(data)):
...     l.append(data[i:len(data)] + data[0:i])
...
>>> l
['h\x80llo', '\x80lloh', 'lloh\x80', 'loh\x80l', 'oh\x80ll']
not sure what you're trying to do though
str is the variable containing "h€llo", in my script it seems that the charactere € is count like \xac\xe2\x82
yes I know, it is just that you should not name it str because this can interfere with the function str()
but about the characters, I guess I don't have enough experience to help you there :(
Hmm sounds like a unicode encoding problem
But doesn't python keep all strings UTF-8 in memory?
I would guess so too, because it's working fine on my end, and I don't think there should be any difference on a french machine =/
(that is the UTF-8 representation)
06:05
@supertrainee use python 3
@supertrainee you're a newbie to python, you should be using python3, not python 2
@AnttiHaapala Tell that to the spyder people btw.
@paul23 no
@supertrainee it is true, you're using python 2 and str is a byte string with 8-bit octets, h€llo has 7 of them
for unicode data in python 2 you'd use an unicode string, u'h€llo'.
hmm, the code I ran above was on 2.7
well,
@Jerry...
:)
06:07
you have \x80
that is not proper €
you're using winblows
that matters? xD ok
Oh I actually notice that spyder since this year supports python 3.4. Time to tell my prof to start using 3.x and stop their forcing of us to deliver all results in python 2.7
it matters since you're not even saving in utf-8 but some microsoft crap
ahh, I saved in utf-8 and it gets way longer
yea ANSI, I didn't pay attention
see, you cannot even get things right by default in windows
@Jerry the utf-8 is broken as well
06:09
I get it 10 now :( yea, looks broken
it has the "utf-8 bom"
oh nvm opencv is still not updated to python 3
sigh
microsoft really sucks hard
@paul23 put pressure on them
So many unofficial ways to let opencv work. And everytime I push the opencv they (forum people) just tell me the unofficial ways...
But I can't say that to a university: "hey here you have a hackish way to make opencv work, it's unsupported though"
06:10
@paul23 which package?
oh I see why it is 10. MS added a BOM
opencv
@Jerry it is because MS cannot do anything right
@AnttiHaapala i had a question 4 you
ahhh oh yeah
@JoranBeasley and now you don't? :D
please do ask :D
06:12
opencv 2 btw. Not 3, that removes quite some features (which returned in a paid version I believe)
why is nginx > apache? in 3 sentences or less? :P
removed the BOM manually in N++ and finally gets 7
well I do not know :D
lol dang
because I've used them both. Apache is more configurable
06:12
MS seems to work fine for me.
and Nginx is supposedly more streamlined
For encoding stuff, I use Notepad++.
bah
you sound like me trying to explain why we should change to nginx
I thought someting something websockets something persistent connections
well apache has mod_wsgi which can be good under certain circumstances - no need for external server
but then google couldnt tell me much
06:13
best I found is this: code.google.com/p/pyopencv
But that's not made by the opencv people
apache has many MPM models and nginx just 1
nginx supposedly handles the 10k problem!
10k consecutive users?
lol
@paul23 anw, which pypi package are you talking about if any, for python2
connections
this is for maybe 5 ... on a very busy day
so you'd hardly care
06:14
yes
that falls into the ain't broke, don't fix.
bah then theres really no reason to change
yeah exactly
ok now onto the real reason I swung in here
Bedtime for me :P
I suck at sqla .... how consider the following
7 am
spent another night fixing bugs
06:16
groups have many roles , roles have a many to many relationship with users
how can I map a relationship field through this?
groups:roles is 1:N?
yes
and a user would only have one role within one group
but could have many groups (and by proxy many roles)
user wuold oly have one role within one group?
even though 1 group can have many roles?
06:18
yes
1:N groups:roles
N:N roles:users
1:N user:group
that magic thing looks cool
thank you
u'€' worked
leet= {'a':['a','@','4'],'e':['e','3',u'€'],'i':['i','!','1'],'l':['l','L','('],'o':['‌​o','0','ô'],'s':['s','$','5'],'-':['-','_']}
i think something like relationship("User",backref="groups",secondary=UserRoles,<some crazy sh*t goes here>
but i havent quite got the brackets right ;P
@supertrainee seriously
did you get my message about using python 3
I <3 Python 3.
there is no point in using python2
06:25
yes i will
lol I found this
2
Q: Entity -(many-to-one)-> related-table -(many-to-one) -->attribute mapping does not work

MaxI have mapping problem in a rather simple case. Can anyone help? Here are the DTOs: class AttributeDTO(object): id = None name = None class RelationDTO(object): id = None name = None attribute = None # one attribute per relation class EntityDTO(object): id = None na...

not very hopeful
so you'd have an association table for user, role, group
with user, role being a foreign key of user, role association table
and role, group being a foreign key of role, group association table
and unique constraint on user, group on the first table :D
oh I see that makes some sense ... but I feel like i should be able to do it without another associationtable
thus: predicate logic: has_role_in_group(user, role, group); has_role(user, role); group_role(role, group)
@JoranBeasley you can... possibly
you can use user, role
with a function that gets the group for a role
can I just add a group_id to my existing user2role table
06:31
then you have unique functional constraint
so 1 role has only 1 group?
bah that wont work i dont think
1 role has only one group
if 1 role has only 1 group, then you can use the (group, role) as the foreign key to role table
and then you cn do the unique (user, group) constraint
huh you lost me I need to think about that a bit
so, now you have: "role_id references role(role_id)"
so you'd want foreign key (role_id, group_id) references role(role_id, group_id) and the role table shouldn't have any association table for group since it is 1:N
and then an unique constraint for the group id
yeah role has group_id and its just a map
1:N to group
there is a user2groups assoc
06:36
but then you'd need some magic for sqlalchemy if (role_id, group_id) is not primary key
yes, that would have another foreign key alreay there, so basically 2 foreign keys would validate the group_id
user_roles = db.Table('user_roles',
    db.Column('role_id', db.Integer, db.ForeignKey('role.id')),
    db.Column('user_id', db.Integer, db.ForeignKey('user.id')),

)
so that'd change to
ForeignKeyConstraint(['role_id', 'group_id'], ['role.role_id', 'role.group_id'])
oh i c
whoah
thats crazy
simplest sqla that I've made in ages :D
in django that'd be impossible already
can I just remplace my role_id rule with that?
or add a 3rd group_id column
and then add that rule as just the constrain
bah dumb question
06:42
so you'd have Column('role_id', Integer, nullable=False), Column('group_id', Integer, nullable=False) and ForeignKeyConstraint(['role_id', 'group_id'], ['role.role_id', 'role.group_id'])
also you'd want to have nullable=False for that user too
unless you like null-users
yeah this is more in the get it working phase
:P
was searching about that and found you
lol imagine that :P
that happened at work the other day
a colleague was stumped
and didnt want to bother me so he googled it
top hit was my answer to a SO question :P
thanks for giving me the answer :)
tomorrow Ill try and get it actually working :P ... im gonna play a little fallout b4 bed
07:43
Cabbage
stackoverflow.com/questions/33666410/… duplicate… (stupid 3.x badge… >_<)
is python completely open source like Ruby?
yes
where is the souce code? Also its written over C or which language? @poke
github.com/python/cpython (that’s just a mirror repository though)
The “real deal” is on hg.python.org
poke its c implementation of python and not python i Guess?
07:53
There is a core part that’s written in C, but most of the standard library is written in Python.
However I think Python is not completely open source
I have done python
I am moving to Ruby
just because its completely open source. Why don't they make Python completely open source. Python not Cpython
@AbhimanyuAryan “I think is not completely open source”? Well, then you are thinking wrong. What do you mean?!
Trolling?
I don't understand the difference b/w Cpython and python
can you make me understand that?
Python is a specified language, CPython is that reference implemention of that language. It is the normal Python implementation people mean when they refer to Python. But there are other implementations.
07:56
is it like jRuby
I've always thought of as "Python" as a design. CPython is someone taking that design and making it.
JRuby is an implementation of the Ruby programming language atop the Java Virtual Machine, written largely in Java. It is free software released under a three-way EPL/GPL/LGPL license.
Both are completely open source
@AbhimanyuAryan Yeah, kind of
so if I want to see the code of input() method in Python. Is it available on Github Python open source repo? or some other git repository hosting?
07:59
Yeah, as poke has already linked to you
@AbhimanyuAryan There.
@Ffisegydd cv pls? q_q
@Poke but I see its not input method

static PyObject *
builtin_input_impl(PyModuleDef *module, PyObject *prompt)
/*[clinic end generated code: output=b77731f59e1515c4 input=5e8bb70c2908fe3c]*/
{
its builtin_input_impl()
That’s what the function is called, yes.
I was asking for the source code of this method: docs.python.org/2/library/functions.html#input
That is the source code for that function (for the Python 3 one though)
08:07
@AbhimanyuAryan python 3 is the python. For python2, say "python 2"
Can you make me understand. I am little bit confused. So, in Python the method is called input() so the interpreter some where in bottom calls that C written function builtin_input_impl() Right ?
There is a line, that links the Python function input with that C implemention.
In Python 2 and 3, the method input is the C function
08:10
So when you type input(), the code I linked is executed.
@Antti Can you hammer this question please?
Can I see that doing interpret executes this code. Some how. Like in Java we can see Bytecode with -p command. Some how I can relate this stuff very well?
@AbhimanyuAryan this is the
builtin input in python 2
@AbhimanyuAryanno.
@AbhimanyuAryan You can look at the bytecode with the dis module, but for the print function, you will still only see a “call function with name ‘print’”.
@AnttiHaapala what if some day when I am an extremely amazing Python programmer. Can I contribute to the repo? So, may be i can include my own python library for Artificial Intelligence. Is that possible. And I would like to write that in C not Python. Like input function. Just because I want the code to be fast
@AbhimanyuAryan please do.
anw, the difference between java and cpython is that
in java almost all of the standard library is written in java
08:16
@AbhimanyuAryan You could write a PEP to propose your idea, and then get the support of the core team to get it included in the standard lib.
and please do not star every second message on the chat :D
But usually this requires that you already have the module completed and it’s working well and is well-adopted. Because the thing is, you can absolutely write external modules in C. There is a powerful C API that allows you to write native modules. So you don’t need to touch the core code just to write libraries in C.
we reserve the starboard for funny and interesting messages ;)
For example, the numpy library is probably the best known library for Python that gives you native performance—because it’s written in C.
and that is how many of the things land in the standard library in the first place
08:18
@vaultah Thank you my hero.
@poke ah sorry about that too
my browser crashed so I forgot that q :D
@AnttiHaapala Ok I thought the star button is a substitute for Like button :p
it is
but it is more spammy than the FB like
it will replace all the funny lines on the left-hand side with our typoed answers
@AnttiHaapala *right side ;)
08:23
is it :d
Can anyone link me to the best Django learning tutorials? I have learnt little bit of Ruby on Rails but couldn't finish them. I wish to master Django. I learn by watching more than reading. I'll read documentation later but for now. I wish to watch all of it. Payed tutorials will also work.
any company like Bloc.io or some other company teaching full stack development in Django
yɒlqƨib ym bɘɿoɿɿim ɘv'I ʞniʜƚ I ƨqoO
@AnttiHaapala looɔ
@AbhimanyuAryan I found this page. But I don’t know any good resources myself; I don’t use Django.
me neither
@Poke you don't like to develop for web?
08:26
I think most of the people here are more Flask persons :P
most but not all
@Antti I wrote “most” :P
though I am more Flask- than Django :d
Flask is better than Django?
apples to oranges
I do web applications.
Django could be my choice if I made a simple CMS or something
08:28
is it(flask) MVC based?
Flask is more a minimalistic and simplistic framework. It doesn’t enforce a lot of things, so you have a lot of flexibility—but also not much strict guidelines you can use to go forward. Some people like that, some others prefer a more complete framework that gives a stronger foundation (like Django)
but flask has some opinions... even though it pretends it does not have to
like... you really need to use Jinja2 with Flask
I can easily live with that. Jinja is pretty much the best templating engine I know :P
Found these https://vimeo.com/gettingstartedwithdjango/videos

Amazing tutorials
Why don't google remove Java from android and switch to Python. Its there own language. Plus its easy.
so many advantages over Java.
also Java is Oracle product. Google can't control Java development the way they want
I read there are some disputes b/w Oracle and Google.
08:44
@AbhimanyuAryan Python doesn’t belong to Google.
It was developed in Google?
no
by one of there engg.
Guido was working for Google at some point, but Python is much older than that.
Ohh but I read it somewhere that it was developed by Google engineer. So, I though its a Google product and that is why they take it very seriously
08:48
Python is older than Google :)
Really. Lol I didn't knew that. Thanks for the info
Is it older than Java as well?
It actually is
Python is from 1991
Wow
and java was somewhere around 95's
right?
I met someone who worked with Guido long time ago, apparently he used to distribute the latest version of Python using floppies
yeah
08:50
sneakernet ftw
really? @metatoaster good to now. I will star it now. I think its funny
yes. back when he worked at CWI
Software distribution was like that back then. Making floppy disks, and sending those per (physical) mail :)
Anyway, back in a bit
CWI: centrum wiskunde & informatica?
or in their case walk down the office, and yes, that's the one.
and IIRC Java's original development was done well before 95
yeah, according to wiki it was also 1991
09:00
I think google should switch to python for android app development. Its nearly impossible but there will be hell lot of development for android if they do so. Even kids can program in python. And apple made a smart move bringing swift they saw kids are making apps. So they brought more easy and secure language swift
"Nearly impossible" is putting it mildly.
so? It should be absolutely impossible?
If I were at Google. I would have worked 18+ hours a day. To bring that chance. Apple is doing that. Wrapping old Obj C libraries onto swift. They will convert all the APIs in near future.

This way they will get long term support for there platform.
So why should they try to do something that's nearly impossible if there's little benefit to it? Java is an extremely popular language, and starting from scratch is rarely a good idea.
Java is dying here in India. They call it Ram Eater
I understand that you like Python - so do I - but throwing Android in the garbage and building a brand-new platform would be a terrible decision that would probably kill Google's mobile business.
09:06
People are learning Python or if they want compiled languages they choose C/C++
If you really want to compile Python for use on Android devices, you could look into Kivy.
Yaa I know Kivy but it has very less support.
as if now
09:27
cbg
@AbhimanyuAryan I think Java is more popular, and static typing is a benefit too.
10:14
python is future
thats why even now google released a machine learning library based on python
As much as I like Python, saying “Python is [the] future” is naive.
from __future__ import self

« first day (1853 days earlier)      last day (3318 days later) »