« first day (1642 days earlier)      last day (3300 days later) » 

12:35 AM
is anyone here that has the api all setup to do SO queries ... can you tell me what percentage of [asana] has accepted answers
 
@IanClark at this point, I actually don't lint that often, and usually debug by traceback :) However, if you're using ST3 (and you should be), I can't say enough good things about the Anaconda plugin (no relation to the Python distribution). It has awesome code completion, even in virtualenvs, and includes pep8, pylint, pyflakes, and pep257 linting capabilities, among other features.
It really goes a long way into turning Sublime into a Python IDE. It's easy to set up, is very configurable, is updated frequently, and the author is quite responsive to issues, at least in my experience.
And, as a quick plug, make sure you check out Python Improved for syntax highlighting - soon to be fully Unicode-aware!
Unfortunately, Sublime itself doesn't handle RTL languages well (if at all), but if you want to use z͡al͠g̛o as a variable name, pretty soon it'll be highlighted correctly.
 
1:37 AM
At any rate, I have lots of experience with Sublime, and am one of if not the top answerer in its related tags, so if you have any questions please ask!
 
2:19 AM
cbg
 
cbg @AdamSmith - you helped me with a school project in the oddest way earlier
 
@JGreenwell how's that?
 
had to write a small paper on new tools (or techniques) and their benefits - you reminded me of SQLAlchemy
"new" here being defined as "new to the student personally"
 
Wow. Of all the SQLAlchemy pros in this room. I've barely begun to use the module LOL
 
Same that's why it applied :)
 
2:23 AM
@MattDMo Really? Awesome! I use vim with the python.vim syntax file and flake8 for my dev environment. What does Sublime bring to the table that I can't do (or would be difficult to implement) in vim?
 
2:35 AM
I'm feeling guilty because I haven't been contributing to the little github repo I decided to fork and help the maintainer out on for a few days
I was bored and needed a project. He posted here with some somewhat basic question. I answered, forked the repo, and PR'd the patch to fix it
then kept updating
but I haven't been motivated to code lately =/
 
"not motivated to code"?! That's a thing! ;O
 
 
1 hour later…
3:46 AM
@MattDMo Or a better question: why does auto-reformatting my code with Anaconda leave too-long lines with lists?
 
3:59 AM
ahh...I was going to post a correction for your binary search script @AdamSmith beat me to it with the edit
 
@JGreenwell what did I miss? The __truediv__?
 
miss? That code had a lot missing: I just knew what an odd number/2 will give you in python :)
 
and your binary search is better then what I would have posted by one (used int(round()) cause I had a brain freeze on //)
 
Yeah it's homework, so I wanted to post it piecemeal so the help vampire OP would think critically about the code
There's a funky edge case where end - start == 1 so (start + end) // 2 == start. I catch it and break manually, but only because it's been too long since I've had to deal with that crap.
 
4:05 AM
Actually, I'm favoriting that post so I can use it to tutor people on binary searches (have algorithms for C, C++, and Java - never run into it with R or Python due to the tools available)
I can add an edge case later but edge cases usually just confuse beginners and I just want them to understand concepts
Also, its a good example of the difference between an answer and an education (feed a man a fish, teach a man to fish)
 
Thanks :)
 
4:28 AM
Ugh I have to be up for work in 7 hours
I think I'm gonna go hit the hay
rhubarb all
 
rhubarb
 
4:55 AM
Why is it that I've hated Macs all my life, but then when I borrow my friends Macbook Air for one weekend I cannot keep my hands off it?
I feel myself becoming a Mac user....no please God save me..
 
 
1 hour later…
6:11 AM
@RobertGrant looks interesting
 
6:31 AM
@nivixzixer is it because you've never actually used one and were simply conforming to peer pressure :p I use Windows, Mac and Linux, and Mac is definitely the best one
 
Cbg
@AnttiHaapala what does?
Oh, Hawk?
 
@Robert I was wondering that... unless Antti does just think you look interesting :p
 
Haha that's true.
gives Jon Clements an interesting look
 
gonna star that
@RobertGrant see what pyramid tries to do is:
a) be the fastest framework with
b) everything pluggable
 
/me isn't sure whether to smile/wimper....
 
6:38 AM
Hey up btw.
 
@JonClements well you pinned my Saturday cross-dressing day
 
@AnttiHaapala I think my main difficulty is, unlike learning other frameworks, there is a specific order of things you need to know to get some stuff working.
At least with permissions
 
of course since
a) pyramid does not have a general authz policy
just the quite very specific acl one,
really we should roll our own, when we know WHAT :d
 
Yeah, I was just going to say that
Because using something like django-guardian is so powerful, it's a shame to not have that easily available. Especially when it looks as though the building blocks are almost there
 
but you cannot make an SQL auth policy that is db agnostic
they are almost there, it is like 10-20 lines of authz policy and some mixins.
 
6:43 AM
But you can make a SQLA one, at least
I say that only because I don't know what that zodb is like
 
bc the zodb you can store python objects
so it is no more different than doing:
my_document.__acl__.insert(0, (Allow, 'Bob', 'edit'))
thatsit
 
I literally think it could be 1 user table, one group table (or a combined Principal table, or whatever), and a (principal, object, permission) table
Oh okay, cool
So if it worked with SQLA and zodb, then I don't see a real problem
I probably haven't thought that data structure through
 
I mean...
the problem with that is that
if you have long ACL you don't want to materialize the ACL list in memory
the problem with exactly that behaviour is that:
it is very zodb specific - you are unpickling the acl list anyhow, so you might as well provide a list.
but if you have 35 groups and 70 users who have access to resource X, you might as well ask the db if such a permission exists
but yes, the principal, object, permission: sure can do
though the question is just how to generate generic primary keys for objects
 
Don't you need them anyway for sqla?
 
there is a reason why it is easier for django: django orm cheats, it does not allow composite primary keys
all primary keys are always ints, comma, exclamation mark * 3, period.
and all "rows, tuples, whatever" have such a number
@RobertGrant so: how about, the model can have a "object_id" property say, which will return the id as a string,
so in case of company, just str(self.id)
 
6:51 AM
Yeah, but I don't think that's a terrible thing. It's a pretty reasonable constraint
 
ha? it is not
you need to make all your relational design have terrible constraints actually
for example: if you have unique connections between companies and users
 
What's wrong with an integer primary key? Doesn't stop you doing other stuff as well
 
bc you need to resolve it to do anything
 
Go on
 
^ like you have unique connections between company and user, then the natural primary key for that is the tuple (company, user); you can get them from db by (company, user), you can delete them by ID without ever fetching the record etc.
but in django you can't, you need to know the "primary key" for (company, user)
 
6:54 AM
With those unique connections, isn't it easier to store them as a link table with integer IDs rather than with composite keys?
 
composite key is natural
now you will have 2 keys: the composite key has unique index anyhow, and you're querying them by the integer keys
surrogate keys should only be used for performance
anw I have a perfect solution for this already :D
store the jsonified list of primary key values
and if it is not ok, then the model can override them by having the said property.
 
But that sounds more like an artefact of how the ORM happens to work with link tables, not a fundamental issue with company and user having integer primary keys
 
always aim for the perfect solution if the difference is 2 lines of code
you're confusing:
django forces you always to have an integer primary key on every single model, period
sqlalchemy does not force.
so to have a object permission system that forces you to have such a primary key would be stupid, can just spend 5 minutes more to think about the solution which does not place restrictions.
@Rob you forgot 1 thing
ACLs are ordered.
 
Well, I don't think it's a big deal at this stage, I'm sure if we come to it we can get sqla to tell us if and how a model is unique
 
also, if you ever update your object primary key, the permissions do not follow :D
hmm maybe we should have mixin tables for each permissioned object instead :D
 
7:03 AM
I'm not sure Django does make you have an int pk for link tables, but I dunno because it creates them itself
But it does for your models
 
it does,
it does force int pk for absolutely everything
then they have their generic key which is like ('ModelClass', pk)
but it is not even db enforced.
 
Maybe it's because they didn't think composite key URLs were a good idea
 
yes, it comes from "the most important thing is to have an admin system where the url contains the primary key"
 
Hey, even SO obeys that :)
 
7:07 AM
You need to put something there, and an int is often the nicest thing
 
there is nothing wrong with that but forcing it down ppl's throats is wrong
it is not a sound approach to database design that "urls must be nice"
instead you should be like... "how do we query this data"
and then you notice: "ok these ones we need to provide in an url"
and... "ok these we don't"
 
Cbg :)
 
new avatar
 
@AnttiHaapala it also makes link tables simpler
 
My IP is seemingly dynamic
 
7:09 AM
it does not matter
sqlalchemy can do it, no matter what
not all applications are web applications
 
Yeah obviously, I mean from a developer perspective (and if it's a huge table, a space perspective)
 
not every web application is a CMS
not a single application I have done is a CMS
even though they live on web
 
Me neither; why mention that?
 
because django forces things, it is essentially a framework to build a CMS :D
they state things like "you do not need to do complex queries, you do not need to do x anyway, you can cache your content so slow templates do not matter" blah blah blah = CMS
 
I'd have thought that with its traversal thing, Pyramid is more geared towards a CMS
That seems a pretty specialised CMSey feature
 
7:12 AM
yes, traversal is CMSey, or object-databasey
 
Way more than int pks to identify models
 
but django orm gets its design from "the Admin must work"
"whatever cannot be represented in the autogenerated Admin interface should not be available for models"
 
I wouldn't worry about where something comes from, as it's not relevant to either of us talking about it now
 
"the admin interface should be useable"
 
Neither of us cares about CMS particularly
 
7:14 AM
django was extracted from a ezine
anw, I am thinking...
I looked at ziggurat_foundations just now...
and what troubles me is that Ergo^ writes too complicated code, it is too long, has too many methods etc.
there are 50 mixins for possibly something that should have 1 or 2
 
The only concerning thing is, instead of decorating a view with (for example) @permission_required(Company, 'permission.name', 'request_field_that_contains_primary_key'), you might have to do something much more convoluted to identify the multiple fields that make up the primary key
 
no need :P
because Company does know what are its primary keys
I am worried about 2 things:
a) it should support multiple models, perms efficiently
b) it should have referential integrity
 
I mean you have to map the incoming URL parameters to the correct fields on the Company
 
@RobertGrant you don't
because your company will not have a composite primary key, you wanted it to have an int :D
 
Yeah but you're saying we can't rely on that
 
7:20 AM
of course we cannot rely on that
 
Therefore we need that syntax, and I'm saying it might be clunky
I guess kwargs could save the day
 
what I do not understand: since the request field contains a primary key
why aren't you using traversal there?
 
Oh, dunno. Not really used that yet.
 
you are essentially replicating the pyramid context system by your own decorator
 
Yeah, possibly that would do it
Does traversal cope with composite keys?
 
7:23 AM
of course it will cope with everything, all it does is to do a "__getitem__" :D
 
So is it the context that works it out?
@MartijnPieters cbg
 
so say for some reason you have key (foo, bar), and mapped in url
so you could represent it in url as /foo-bar/ or /foo/bar/, your problem :D
all pyramid does is context = root['foo-bar'] or context = root['foo']['bar']
easypeasy
 
Maybe I need to investigate that context stuff
I went for the stuff that I'm used to, views, routes, orm etc, and probably shouldn't have started there
 
it is not spelled out but the context stuff is really powerful, because it works with subclasses and interfaces and all
ah let me find for you
there was a russian guy in pyconfi giving a prez but of course we don't have a video
can find a russian version :D
 
7:28 AM
Haha
This may be the problem :)
 
Cbg :)
 
cbg @Ian!
 
Cbg @Jon :) - hows things? Lot of work for election stuff?
 
7:32 AM
hmmh maybe I should write a blog on how to map this to sqlalchemy etc :d
 
Errr.... not really... just sorting some work stuff out sadly... - how's yourself...
 
@AnttiHaapala yes please
I promise a lot of focused feedback :)
 
haha :d
 
@Ian doing better than last year in the primaries... so I'm happy... of course - @Martijn is setting the bar :)
 
@MattDMo thanks for that :) - I briefly saw Anaconda in package control, but thought it was the dist. I shall take a look :) - I opted for PyLinter plugin yesterday, found a way to reference the pythonpath and pylint paths, seems to semi-work. Doesn't follow things like Django foreign key references though so throws some erroneous warnings
 
7:35 AM
@Martijn did you see the "drama" on SF re: mod stuff?
 
@JonClements I did.
I can see why Shog9 did what he did.
 
@JonClements You're both doing really well :) - certainly both got my votes. Yeh I'm well thanks, nice that the sun is FINALLY out \o/
 
Awww.... yes.... that's the name of the big tennis ball in the sky... I keep forgetting what that's called - don't see it that often for it to stick in my memory :)
 
I do think the candidate score is making a difference to those voters that don't know whom to vote for.
The 40/40 candidates are all at the top.
 
@MartijnPieters That wasn't there last year was it?
 
7:37 AM
then 2 out of 3 39/40 candidates are in the top 9. Both 38/40 candidates are there too.
vcsjones is the odd one out there at position 17.
 
And, do you think that, that's a good thing? If it makes everyone decide simply based on that given score?
 
I don't know what to think of that.
 
Obviously whilst remaining impartial :P
 
I think it's pretty helpful, but it's like anything, it can be gamed to a certain extent, and will be every year from now
 
@RobertGrant If the criteria remains, yeh I'd expect so
 
7:39 AM
@IanClark at this stage, would it matter if I was impartial in that? :-P
 
user4433485
cbg!
 
cbg @Katherina
 
@MartijnPieters Hah, good point
 
@MartijnPieters Yep, I know (I was the one who asked this question :P)... What's not clear to me is why do accounts on different sites have different identicons. Maybe there's some sort of entropy?
 
@vaultah I think there is a per-site seed to prevent easy brute-forcing of ip addresses.
Otherwise I could try all plausible public IP addresses and hash those and see if I got the same gravatar URL.
 
user4433485
7:41 AM
Its good to be back to school:p
 
Thanks @Martijn :)
 
@AnttiHaapala while I'm looking at traversal, the short answer is: SQLA supports all sorts of primary keys, so you want to support them in a permissions system. Pyramid supports URL dispatch as well as traversal, so they also both need to be supported :)
 
8:01 AM
@poke: I suggested an edit on your StackApps.com page.
6
Q: StackExchange Election: Primary counter

pokeI want to keep an eye on the votes of the ongoing election, but the unsortedness of the list during the primary election phase makes it hard to keep track of anything. So I wrote a quick script that goes through them all and puts a short overview list at the top, sorted by the current vote count....

:-P
 
@poke can your script also show the correlation between Python and moderator ability?
 
@Martijn ooo... we've got a third of votes in the top ten between us... that's kinda cool
hurry up and get some more so we can have half :)
 
@JonClements working on it! About to break through the 3000 points lead.
This is getting ridiculous though.
Meagar would make an extremely capable moderator.
 
Oh right... now you follow me on twitter - taken you long enough :)
@Martijn well... I've made up my mind for votes already... I imagine a lot of people already have
 
8:18 AM
@MartijnPieters if you want to even things up a bit, put in your statement "A vote for me is a vote for Python!"
 
@Robert sadly... mods have to cover all tags :)
oh god... that means I might have to end up reading php posts... is it too late to withdraw!? :p
#soelection candidate dealing drugs? Shocking and slanderous rumour. Probably true. Allegedly. (Definitely true).
@Martijn ^^^ maybe #soelection wasn't a good choice of hash tag :)
ahh... 3rd edit lucky
 
cbg
@JonClements you're the 3rd
and last yr the primary top-3 were elected
 
@AnttiHaapala having read the traversal docs again, I think the reason I didn't use them is because the idea of traversal (unlimited moving from one object to another) doesn't exactly fit my incredibly simple data model. Unless there's another reason to use it that isn't in the thing I read.
 
@Antti well... that's no sign of how the actual election phase will work this time :)
 
@RobertGrant unlimited means for any N
you can use it for depth of 1
 
8:33 AM
hides the WELL DONE JON banner
 
@RobertGrant let me give you sth :P
 
@Jon @davidism how do you feel about offering to try to host disorient.ddns.net/SOVoteMonitor? JaconC has added a message asking people not to share the link as his server can't handle it, but sopython-server would be fine with it.
I suppose we'd need to get the code and see if it's something we could easily fit into Flask.
 
@JonClements too late to change that now. We'll make the tag ours instead and make the past regret their lack of foresight!
 
@Ffisegydd I did mention it to him the use of the server for something else... I think he's running tomcat for his app
 
Ah so Java effectively.
 
8:38 AM
I don't mind hosting that for a little bit... I think the other thing he wanted was something to break up the questionnaire posts/do something else blah blah... but I'm happy for sopython to be used for the above
@MartijnPieters And if they don't like it... just say - don't care: "The ninja said it was fine..."
Ahh... and you've broken the 3k mark
 
Bit early @corvid, no?
 
@RobertGrant dpaste.com/0XT29DG
I did make a generic sqlalchemy item getter wrapper
(or does not need to be an itemgetter at all)
 
Also, re. my rage and anger last night: I've contacted <COMPANY> and they've said I can do a "Statutory Credit Report" instead which requires less address paperwork crap.
 
@RobertGrant notice how I can make say a delete view that is generic for all subclasses of all classes inherited from Base; same for example for permissions etc
 
Now it's time to leave the house and get a nice bacon and egg bap with coffee. omnomnom.
 
8:47 AM
now if you have url /companies/123/edit, it will take find the /companies/*traverse route, then use the root factory to instantiate the root, then ask its getitem for '123', which does select on db, then asks its getitem for 'edit', (does not implement getitem, so stops there), puts that Company object as the context, then looks up for a view with name 'edit' that would match otherwise given the predicates and the context, finds the edit view...
and surprisingly all this is actually faster than the "simple" things that django does
haha got accepted for the "remove .0"
@JonClements your problem is that everyone who knows you pretty much knows martijn too
@JonClements they're give their 1sts to martijn and you can't win by 2nds
 
I was saying yesterday that the huge electorate overlap isn't going to be good for me
 
user4433485
My teacher just said that Python is not worth to learn because there is only a small community and that Python is dieing anyway, Should I burn him alive?
8
 
It's possible to get eliminated first I'd imagine :)
 
that's why you need to have everyone choose you first
@Katherina please
@Katherina so what should be used instead?
 
user4433485
@AnttiHaapala "php"
 
8:51 AM
@Katherina ok I take my words back...
@Katherina I think burning is not cruel enough :D
 
user4433485
haha I agree with you :D
 
well notice that this is sarcasm, I do not actually endorse lynching...
however I'd ask you, why do you call him "teacher"
what is there he could possibly "teach" you
 
user4433485
Lol that's a very good question
 
@Antti it's unlikely, but also plausible, many doesn't get as many votes as would seem reasonable, as everyone will think everyone else is going to vote for him anyway... it's going to be fun to see the elections... but I'm happy enough with my result in the primaries
@Antti PHP if she's unlucky...
 
user4433485
PHP & Java
 
8:55 AM
@Katherina would you like to retract your statement that it's good to be back at school now? :p
arhgghghg.... I hate it when I cock up a git repo... then have to fix it
 
user4433485
@JonClements haha totally :p
 
user4433485
Java..
 
user4433485
I suck at Java
 
java is actually a programming language
PHP however is not...
 
user4433485
 
8:59 AM
even though it is (possibly) turing complete.
 
user4433485
this is my opinion
 

« first day (1642 days earlier)      last day (3300 days later) »