« first day (1383 days earlier)      last day (3565 days later) » 
00:00 - 17:0017:00 - 00:00

5:01 PM
I'm on Windows. So just install some C compiler, pip uninstall SQLAlchemy, then pip install SQLAlchemy? Never used C.
 
I have no idea on windows. Don't worry about the c extensions, they are just speedups and are not necessary for most cases.
 
Okay. Not worrying about it. Thanks again for the tips.
Starting the alchemy tutorial now, and going to start watching the loooong lecture video tutorial tonight.
 
DSM
5:15 PM
I just spent ten minutes explaining P=?NP to the intern, with a brief Lucy Liu epilogue. It's that kind of Wednesday.
 
Haha.
 
What was the Lucy Liu epilogue?
 
I just spent twenty minutes reading a transhumanist's blog describing the many unhappy endings that the human race may encounter. I want to have a lie down now.
 
What is P=?NP?
 
The P versus NP problem is a major unsolved problem in computer science. Informally, it asks whether every problem whose solution can be quickly verified by a computer can also be quickly solved by a computer. It was introduced in 1971 by Stephen Cook in his seminal paper "The complexity of theorem proving procedures" and is considered by many to be the most important open problem in the field. It is one of the seven Millennium Prize Problems selected by the Clay Mathematics Institute to carry a US$1,000,000 prize for the first correct solution. The informal term quickly used above means th...
 
DSM
5:17 PM
@Ffisegydd: it was used in an Elementary plotline.
@Kevin: bring on the goo. "If I can keep down Arby's, I can keep down you!"
 
God I'm young
Never heard of that
I'm finishing my project soon, then I'll have some life and will go deeper in science.
 
I was reading about the Monty Hall problem again earlier, but this time in terms of Bayesian theory.
A damn good problem, mainly because so many people (me included when I first read it) get it wrong.
 
DSM
Reading Jaynes changed my life. (I should do infomercials.)
 
@DSM Less "death by grey goo", more "malthusian catastrophe". The former is less depressing at least, since I'll be too dead to rue the fall of mankind.
 
5:27 PM
My buttons are redirecting me to the same url but it's now blank
 
DSM
@Ffisegydd: yep. I almost flunked my second stats course because it seemed very arbitrary. Once I encountered Bayesian approaches via Jaynes, I realized it felt arbitrary because it was, basically. Then the world made sense again.
 
We didn't do much stats at uni, which I now regret.
 
DSM
To go on-topic for a second: anyone want to take this one on? The OP's just gone off the rails a bit.
 
I think you already cover it..
 
DSM
In Julia, the r prefix is used as a regex constructor, so it's not a crazy guess.
(Not sure if there are other languages which do the same.)
 
5:37 PM
map-territory confusion detected. There's nothing you can do to a string to get repr(mystring) to start with an r and not a quote mark.
 
DSM
@Kevin: oh, man, I missed a chance to use that phrase. And you even brought it up the other day. :-(
 
This question is too twisty for my brain, and I suspect the OP is fibbing about his "current output" since printing a string doesn't show the quote marks unless they're actually part of the character sequence.
 
might be a silly question but what is most pythonic/djangoish way to forward to a different page in django in {% else %} tag
 
Why don't you redirect outside the template?
 
hence i am asking for most optimal way
basically its a page that load if you are logged in and if you are not it should send to login
 
5:48 PM
You don't redirect in the template, that logic belongs in the view.
 
ya, figured.. was wondering if there are other options
 
Or actually before the view, using the login_required (or whatever it's called) decorator
no, don't do anything but that
 
@d
@davidism I am actually resolving that without a decorator but on the page with {% if user.is_authenticated %}
 
I think you're confused. The login_required decorator automatically redirects, if you don't want to do anything for not authenticated users. The is_authenticated property is for doing different things based on the authentication status.
 
@davidism very true, i was confused
 
Does anyone have any tips on organising .py files and classes for a web app? Right now I have one massive main.py because I've put off organising it better while I contemplate the best structure...

e.g. - all db.Model classes in one file, handlers in another, etc. - or one db.Model class per file along with all handlers/other functions that relate to it?
 
@OllieFord take a look at github.com/sopython/sopython-site
 
"one class per file" is my usual organization system. (handlers can go in the file with their target class too)
Although I am a lowly non-web developer, so your mileage may vary
 
is there a way to run 2to3 during pip3 ?
 
2
Q: Is there a way to run 2to3 with pip install?

eigeneinI'm trying to maintain dependencies using pip install -r requirements.txt. However, some of required packages do not support Python 3 directly, but can be converted manually using 2to3. Is there a way to force pip to run 2to3 on those packages automagically when doing pip install -r requirements....

 
6:43 PM
@Ffisegydd silly me, danke
 
@Kevin I tweaked my code for my to-do list a bit, but it's still not saving or loading properly
 
@Peter szívesen
 
Did Google Translate do good? Or is that gibberish? :P
 
nope, it is good
 
6:45 PM
@annabananana7 I'm willing to look, although I won't be able to diagnose any Django-specific problems. Everything I know about that framework could be written on one side of an index card with a thick marker.
 
@Ffisegyd - that's helpful, cheers
 
Aaaaaaaand the answer was written by Martijn and then edited by Jon.
 
^ yepp ;)
 
It always amuses me when I randomly find a question by one of the regulars. (also known as The Dark Council )
 
anyway, I thought pip3 would only contain packages which are maintained/tested
 
6:46 PM
No unfortunately not IIRC
 
@Kevin ok, maybe you could look over the python code: dpaste.de/aH6k
 
Ffisegydd's Project Ideas That He'll Never Actually Get Round To Doing #73: I wonder what percentage of the chat is on/off-topic. I should take a sample over a few days and see...
Unfortunately I don't think there's a way to test it automatically.
Unless you put together a set of words associated with Python and then looked for whether they included them. There'd be some false-positives/negatives but would probably be ok over all.
Now just need to work out a BS script to scrape the transcript...
 
@annabananana7 Looks like well-formed code to me. Other than the fact that addItem returns None when the request method is POST and the form isn't valid. Dunno if that's relevant
 
@Kevin well, I'm getting a blank page when I attempt to save a to-do item
 
I don't know why that would be the case.
 
6:56 PM
Maybe it's something to do with the django and html portion?
 
That's possible.
 
My form's action is to redirect to the /create/ page:
<form action="{% url 'todo:create' %}" method="POST">
 
7:21 PM
@Ffisegydd I like how "look at sopython-site" is already an answer.
 
@davidism I'm open to any other tips/advice too ;) - but seeing code from someone much more experienced is obviously helpful.
 
It's (mostly) my code, I support the recommendation.
 
7:42 PM
Has anyone here ever implemented LDA?
i.e. without using gensim libraries etc
I'm trying to implement it but keep getting stuck over the math
A lot of the particular components are really straightforward and codeable but otherwise I'm really not sure
(LDA = Latent Dirichlet Allocation)
 
Not me
 
user559633
is there a way to write a class that acts as an arbitrary interface to other scripts (e.g. I have a class running in the background that I want to interact with via some other program i write)
 
user559633
phrased otherwise: suggestions on how to talk to a running python program from a shell script?
 
user559633
i could just accept input from stdin or w/e, but that sounds hackish
 
pipes?
 
7:46 PM
@tristan you could open a named pipe and pass commands over it
so the program would create a pipe when it starts, and other programs could put stuff in the pipe
 
user559633
good call @davidism
 
@tristan see quodlibet for an example off the top of my head
 
user559633
thanks @davidism.
 
user559633
/me adds davidism to christmas card list
 
7:51 PM
\me ponders what he could do to get on the Christmas card list...
 
user559633
done. added.
 
In lieu of a card, please mention me during the Festivus traditional List Of Grievances.
If I have not yet disappointed you this year, let me know. I'm sure I can whip something up.
 
user559633
i'm disappointed that you haven't disappointed me
 
7:57 PM
I'm disappointed in myself that I didn't suggest that disappointment.
But let's save this for December.
 
DSM
I'm still disappointed that Kevin couldn't follow the "open web site/the site will then crash" instruction. Does that count?
 
Yes, disappointment is a purely subjective experience, so all of its forms "count".
 
There'll be a new hat this Christmas: "You have successfully disappointed Tristan Tristanson this Advent, have a Head Crusher"
 
ouch
 
DSM
It's lame to reread chatroom transcripts and be amused at things you've said in the past. So I didn't just do that.
 
8:01 PM
They did torture properly back in the good old days, none of this "waterboarding" crap.
 
@DSM That's like 90% of the reason I try to write amusing things.
 
user559633
I find it deeply weird that when I have a child, he will be named $Firstname Tristanov $Surname. With the dollar signs and all. Boy, Russian names are weird!
 
DSM
How are you so sure it won't be Tristanova?
 
user559633
There's a well nearby.
 
DSM
.. question withdrawn.
 
8:05 PM
how about hermaphrodites in russia?
tristanovix?
 
DSM
In English we use the "ix" suffix for women, although it sounds very old-fashioned. "Aviatrix", for example.
 
or dominatrix
or asterix and obelix
 
user559633
@AnttiHaapala well, I suppose I'll cross that bridge when I get to it.
 
user559633
[actually, i'd name shim 'Truckasaurus von Autobot' because maybe an awesome name will overset some of the related troubles]
 
starworthy line by itself
 
8:13 PM
Cabbage all! :D
 
user559633
yo @Iplodman
 
@tristan Hey! :D
Chrome has an 'australian scrolling' option. It does nothing for me.
 
user559633
does it just scroll in reverse because of their location in relation to the equator?
 
Yep. when you turn it on all the blood flows to your head.
 
Ask Vol
 
8:16 PM
Vol?
 
user559633
Vol Kolmer, he was in Bortmon Forevor
 
Aha Stewie. I gotcha'.
@tristan That helps me none ;-;
 
user559633
csv.reader returns a generator. mind blown a little
 
DSM
8:20 PM
If the question is concrete and can be answered with three or four lines of code correctly, it's hard to see how it can be too broad.
 
@DSM bc of the wording :P
like "are there any methods that make this easier"
 
user559633
because rarrgle blarrge i have all these flags about and i'll be damned if i don't use em
 
There's probably a duplicate somewhere, but it's not too broad...
 
Cabbage All
 
user559633
Cabbage @abhi
 
DSM
8:21 PM
Ehh. I'd still let it go.
 
How does one call a wcf service from python? So far I got suds working, but when it comes ot complex types, suds is NOGO. :(
I am now weeping at my keyboard. :sad:
 
0
A: Find colour based on brightness in python

Antti HaapalaIn Python there is the standard library module colorsys. What you want is the HSL colour coordinates; then your "brightness" is the luminance. The values used by the module are 0..1 for each component. [ Notice that whereas the standard order is HSL, in python it is HLS. ] Thus to get fully satu...

 
user559633
wcf?
 
like this one, python stdlib has everything...
 
and soapPy is giving all sorts of different errors.
yes. WCF - Windows Communication Foundation
This is a SOAP based service
but it is an Unflattened one
 
8:22 PM
Eugh, if I could get Codeanywhere to let me preview executed HTML it'd be my best friend forever.
 
user559633
8:33 PM
import misfits as work_music
 
DSM
Just got a random SO-based employment poke. This must be what Martijn feels like on the hour.
 
user559633
Well, all hours except midnight -- as a Python process, Martijn fails to do work at UTC 0:00.
5
 
DSM
Okay, I had to laugh at that one, because I actually got the reference. :^)
 
I'm going through the SQLAlchemy tutorials and I have one question:
Is there a way to get the full SQL statement, before executing it? Just before calling execute()? I know you can get it--in SQLite anyway--with .schema or .dump, or something similar.
 
user559633
ooohh yeah @aliteralmind one second.
 
8:39 PM
Can you get it with an SQLAlchemy function call?
 
just print the query
you cannot (easily) get the actual SQL being sent, because the dbapi is doing that, not sqlalchemy
you can also turn on engine.echo to see all activity on the connection
7
A: SQLAlchemy: print the actual query

zzzeekNote: this answer is being maintained on the sqlalchemy documentation. first off, for those finding this question, note that the "stringification" of a SQLAlchemy statement or Query in the vast majority of cases is as simple as: print str(statement) this applies both to an ORM Query as well a...

by the author of sqlalchemy
 
user559633
models.Whatever.query should have a str representation
 
Excellent. How would that work here, for example?
>>> find_it = select([Department.id]).where(Department.name == 'IT')
>>> rs = s.execute(find_it)
>>> find_john = select([Employee.id]).where(Employee.department_id == 1)
>>> sqlString = find_john.getSQLString()      //<--Something like this
>>> rs = s.execute(find_john)
 
print find_it
 
Or print find_john.
Sweet.
Thank you.
(Or, in 3, I believe: print(find_john))
 
8:44 PM
The tutorial code has little toggles that show the sql being executed
 
user559633
you can also jump around by setting a pdb breakpoint and stepping through it
 
Thanks @tristan and @davidism. I'm out of gas for today, but I'm liking SQLAlchemy so far. Tables as objects and columns as sub-objects, instead of long SQL strings.
 
user559633
To each his/her own, but glad you're having fun :)
 
Today after wasting more than 6 hours of my precious time -- I come to the conclusion that fuck screw the "don't invent the wheel again" strategy. In theory it sounds so great, that you just use others "well-written" modules and libs but in real-life if a project depends on more than 3 external projects it will most likely fail as hell to compile or work out-of-the-box
I think I totally understand the companies who invest money to develop their in-house stuffs
instead of patching FOSS
 
user559633
or your systems engineer team sucks. you shouldn't have to go external for deps
 
DSM
8:52 PM
Depends entirely on the libraries and tools in question. I'm assuming you didn't reimplement a browser to post that..
 
user559633
no, he called his SO agent to send it...wait, how do you use the internet?
 
Cbg :)
 
DSM
I move beads on an abacus. The resulting arrangement is then copied to a scroll and carried by raven.
 
well -- the specific library is the G* stuffs (gtk,gst,gobject, etc)
 
@IanClark Cabbage! :D
 
8:54 PM
Has anyone had the mispleasure of having to deal with BT? Zomg! :@
 
BT?
 
Yo @Iplodman :)
 
user559633
yesss got tickets to mr. scruff
 
British internet provider (formerly British Telecom)
 
It's not still British Telecom?! mind blown
 
DSM
8:55 PM
> 'Damn and blast British Telecom,' shouted Dirk, the words coming easily from force of habit.
 
ah, then no, I have the displeasure of choosing between a couple of the most hated companies in America
 
@davidism hah, yeh to be fair I hear you guys have an equally shite deal
 
TWC: 56/100 vs. ATT: 65/100
 
8:57 PM
Unless the sites I follow just underrepresent reporting of UK shite deal compared to US (perfectly possible), I think they have an even shiter deal
 
@OllieFord nah, all of these "B<char>" companies (BT/BA/BP...) were all state owned and dropped the formal "British" once they privatised
 
All this with Verizon/Netflix, and the like.. the rage over 'net neutrality' doesn't seem to have crossed the border, but thankfully doesn't seem to have needed to.
 
Yeh, and the Netflix ordeal where they publically blame Verizon (IIRC) is pretty funny
 
@IanClark Makes sense, I just didn't realise they changed name. I'm sure they still use 'British Airways'? (searching..)
 
@OllieFord yes, you're right - they do
 
9:00 PM
@IanClark I have been through that experience when BT was ruling the roost in 2001.
 
but I was (poorly) generalising, there's lots of other cases. Kind of 70s privatising wave
 
That was in Barking, London.
 
@IanClark You are right about BT though, 'BT Group Plc trading as BT'
 
@OllieFord yeh, don't ask me to come up with many on the spot, also got BP so 2/3 ;)
I literally had to phone up an Indian call centre 5 times to report that my HD subscription for the entertainment channels wasn't working - spent about 2.5 hours of my life for a fucking flag in a DB
And they always asked me "but do the rest of your channels work" - it only occurred to me yesterday what an absolutely ridiculous question that is. Why on earth would you say "my entertainment HD channels aren't working" if you meant "all my channels, both SD and HD, aren't working"
 
DSM
To be fair, people on SO say things like "my function isn't working" when they mean something more like "Python isn't installed on my computer".
 
9:04 PM
@DSM hah, yeh perhaps I'm being too generous to the general population
 
Had my first bad experience with Google customer support a couple of days ago.. The guy told me (by which I mean pasted a generic response which said) to restart my phone three times.

In my original email I clearly stated that I had already factory reset it - never mind restarted it. I'm sure even my grandmother would restart her iPhone (yes..) before emailing CS...
 
user559633
i didn't know there was google customer service
 
@tristan for specific things yes - in this case the Nexus programme
@tristan it used to be amazing (I'm on my second free replacement Nexus 4..)
 
@OllieFord yeh that's always hugely frustrating
 
user559633
ah. thanks.
 
9:07 PM
@DSM That sounds embarrassingly familiar.. stackoverflow.com/questions/11596839/…
@DSM oh not quite actually, I did at least not just say "pycrypto function doesn't work"
 
@OllieFord I don't think that's the same at all - yeh maybe you could have looked into it more. But it doesn't say "you need this package here" - lots of the time googling -> SOing a traceback is useful and even if the answer is pretty simple it'll still save a lot of people a lot of time
 
Rhubarb all!
I may be on in a bit.
 
DSM
@OllieFord: heh. I assure you that wasn't deliberate, and since it got so many upvotes there must have been a lot of people in similar situations. Going in, there was no reason to think that half the stuff you'd need wouldn't be in the standard install.
Rhubarb, Iplodman!
 
@DSM Rhubarb! :3
 
Bai!
 
9:16 PM
I spent a few minutes thinking that "lettuce 'cabbage' and 'rhubarb'".. I'm pleased to say that I found it without asking for asparagus.
And now I feel bananas... in more languages than one.
 
9:28 PM
just had a pretty creepy experience with crows. No longer a crow
 
@OllieFord ;)
 
@aliteralmind as I said, the con is that after you have used SA enough, everything else will be sh*t compared to it.
@corvid eh?
 
my dog was scheduled to be put down today (she was very old). Woke up to a ton of crows cawing. It was reeeeally eerie... do not like.
 
user559633
10:03 PM
the crowned crow crows
 
she sells sea shells by the sea shore
 
user559633
that's a tongue twister. my sentence was a valid expression of the myriad of meanings and word stems with crow
 
the crowned crow's crownies crow
 
user559633
fantastic.
 
user559633
oh whoops, i forgot i was spamming the UDP server i created
 
10:15 PM
Rhubarb all! :)
 
rhubarb!
 
user559633
10:39 PM
on namedtuples, is there a simple way to do a lookup a la dictionaries for a column?
 
user559633
e.g.

from collections import namedtuple

def info(): print "info"
def io(): print "io"

socket_data = namedtuple('MessageClass', 'subclass message')
socket_data('info', info)
socket_data('io', io)

sock_recv = ('info', ('127.0.0.1', 64467))
socket_data.subclass.get([sock_recv[0]])
 
(yourclass).__dict__['yourkey']
 
user559633
namedtuples don't have dict proxy...
 
@tristan Like in _replace() here: docs.python.org/2/library/… ?
 
user559633
seeing if i can make that work
 
user559633
10:45 PM
isn't that just mapping over all vals?
 
user559633
f it. dictionary it is

def info(): print "info"
def io(): print "io"

socket_data = {'info': info, 'io': io}
sock_recv = ('info', ('127.0.0.1', 64467))

socket_data[sock_recv[0]]
 
okay then _asdict()
 
Sorry, I totally misunderstood
 
user559633
no need to apologize :)
 
user559633
was just trying to shoehorn in a namedtuple i think
 
user559633
10:51 PM
really no need for it
 
I'm sure there used to be an 'unlisted' option on non-paid github accounts?
 
user559633
unlisted how?
 
user559633
for repo or for user?
 
i.e. somewhere between 'public' and the 'private' of paid accounts
sorry, repo
 
user559633
not sure about that.
 
10:57 PM
I want to be able to synchronize a complex data-structure between two machines. I would prefer high-leveler control than import socket or import socket-server. Preferably I would like it to give me the option of how often to sync and between which IP, but that is about it. Any ideas?
 
user559633
bitbucket does free small private repos
 
Neat, thanks
 
@AnttiHaapala Good first impression so far. That's for sure.
 
lol @ bitbucket 'setting an SSH key sounds complicated (and it is), but we will walk you through it in about five minutes'

where "walking me through it" consists of a prompt saying 'paste your key here:'
 
00:00 - 17:0017:00 - 00:00

« first day (1383 days earlier)      last day (3565 days later) »