« first day (904 days earlier)      last day (4036 days later) » 

12:12 AM
Hi johan...
@JohanLundberg
you are live?
Help me on this question...
This question I want to help stackoverflow.com/questions/15857174/…
 
12:28 AM
Hi all
 
hi...
JOn
Look on this question please stackoverflow.com/questions/15857174/…
 
Just having a look at your cherrypy ;)
 
y how to prevent infinite redirecting?=
 
Well - what are you trying to do exactly?
 
import cherrypy
import urllib
#import requests

class Root(object):
@cherrypy.expose
def index(self):
jsondict = [('foo', '1'), ('foo', '2')]
p = urllib.urlencode(jsondict)
#url = urllib.urlopen("http://localhost:8080?%s" % params)
#urlVar = 1
#urlVar2 = 2
#requests.get("localhost:8080/?", params =p)

raise cherrypy.HTTPRedirect("localhost:8080/index?" + p)

cherrypy.config.update({

'server.socketPort': 8080

})
cherrypy.quickstart(Root())
with this example is valid for one variable foo
and if i have to much variables
 
12:32 AM
No - that's not what I'm asking - explain to me - what you're trying to do
 
ok...
I have the other project
the big project
Cherrypy read one file Json and save in on e variable
 
other project = some separate web app ?
 
with Mako I can pass (static) the value on the client
yes
 
also a cherrpy or different ?
 
always Cherrypy
but now I have one problem
because I don't pass the value's Mako to javascript and viceversa
ok?
 
12:35 AM
okay... keep going...
 
Then there is a mode : the passing value via Url
I want to write the variable's Mako on Url...
But this is posible with cherrypy.HTTPredirect
but I have the problem with infinite redirect
@JonClements ok?
your understand?
 
At the moment, it looks like you're expecting to take a POST and you're re-writing it as a GET...
I don't see how this other system is involved....
 
exactly...
because I don't much experience with python
 
Well - is this other cherrypy thing running on a different port ?
 
nooo
I using one server for time
the other and big project now not is important
 
12:42 AM
Err - aren't you meant to be re-directing to the big project?>
let me re-read some of this...
Okay - let's do it this way...
 
mmm i don't understand
 
Explain to me why you think you need a re-direct...
 
repeat:
I can not pass the variable is Mako Template to Javascript from the html

Example :
var hello=${json_dict}
or viceversa
but I can pass only via Get on url
ok?
 
Why only GET - you can take POST variables and use those inside a template...
 
I working on thesis
you speak with the my professor..
look on the 5 paragraph
in the site
 
12:50 AM
What does paragraph 5 have to do with this?
 
excused paragraph 5 of the site indico-software.org/wiki/Dev/Technical/UsingMako
This is not a bug, it is mentioned in ​Mako website and ​mailing list. If an assignment to a variable is found in a template, Mako assumes it is a local variable and not a parameter which was passed to a template. Therefore it does not take variable's value from the parameters passed to the template. If one needs to modify and use a variable between different templates, it is recommended to use a dictionary parameter as described in Mako documentation.
@JonClements you have any other questions?
 
Why not just take params and pass it as context to your template?
That should work for both GET and POSt
If you just wanted POST then use the cherrypy.request object
 
Because on the my thesis (other server's Cherrypy) I have to pass from server to Client.
The user change all o not all the information and after back the information and the server working and after passing of new
now I answer your question
wait
how to pass params in template?
with form using in Javascript?
Post i don't use bcause the professor not want
I am the student's university and I do the thesis...
dear @JonClements
other questions?
 
Okay - well - if you're adamant about it, then add another param in the redirect, something like: "noredirect=1", and check you don't have redirect set before doing the redirect... That means though you'll have to do something meaningful later in index though...
 
1:05 AM
oooo but where i add the variable where that I can use the condition if nodirect=1 : ???
 
Add it to your jsondict
And then check via if 'nodirect' not in params or something...
 
jsondict = [('foo', '1'), ('fo', '2'), ('nodirect','1)]
like this?
 
I meant noredirect obviously - but call it whatever you want...
 
I don't want other variable to annony to query string
on the url...
then
jsondict = [('foo', '1'), ('fo', '2'), ('nodirect','1)] is wrong
I think ...
 
Well, you can't have it both ways
Either do it properly (which apparently you can't do), or you have to live with kludging it
take your pick
 
1:10 AM
grrr...
you are expert in cherrypy?
I don't want your solution
 
not that specific framework, but several others and web development in general ;)
 
ok
but I want to work together for search the solution
now...
 
just going to get a quick bite to eat, bbias
 
jaaaaaaaaaaa
And I want going to sleep
because I am italina
'italian
and now it's the time is 03.13
@JonClements
now..
import cherrypy
import urllib
class Root(object):
@cherrypy.expose
def index(self, **params):

jsondict = [('foo', '1'), ('fo', '2')]
p = urllib.urlencode(jsondict)
print r
#url = urllib.urlopen("http://localhost:8080?%s" % params)
#urlVar = 1
#urlVar2 = 2
#requests.get("localhost:8080/?", params =p)

raise cherrypy.HTTPRedirect("/index?" + p)

cherrypy.config.update({

'server.socketPort': 8080

})
cherrypy.quickstart(Root())

if __name__ == '__main__':
r=1
I HAVE File "serv.py", line 10, in index
print r
NameError: global name 'r' is not defined
WHY?
 
In England here - so it's 2:20
because there is no r ?
 
1:21 AM
YES
if __name__ == '__main__':
r=1
 
r is defined after it's used
so there is no r at the point you're using it
And the whole if __name__ == '__main__' is pointless here, just put r = 1 at the top of your module instead
 
INDEX(.....)
r=1
if (r!=1)
r++
redirect
return "hi"
this is absolutely wrong
 
what's r++ ?
You're also setting r=1 on every access of index - so of course it's always going to be 1
 
@iabw we're talking about on this stackoverflow.com/questions/15857174/…
jaaaa
r=r+1
 
the 1 comes from outside
 
1:31 AM
is r++ on Js
 
it's r += 1 in Python btw
 
The logic is this
1) Index gets called
2) Index checks to see if r is defined - if not redirect and define r
 
I don't know where to put the control variable
 
3) do something else
 
1:33 AM
uooooooo
 
r has to be put back as a parameter
 
if r is defined?
if r is define:
how to correct
 
if there's an r in params, don't redirect, otherwise, redirect and provide r as a parameter
but this is the kludge you don't like
I suppose a session is another option, but I'm guessing that's not allowed either...
 
yes
mmm
now
there is a condition that verification if there exists a variable?
if r a define:
fpr exampe
 
if you're doing the kludge, just do if 'r' in params
 
1:36 AM
ok
I wirte other question...
if there exists the variable then enters in if
else no...
 
for example if variable is null
how...
please
 
params is a dict, which looks like {'something': 1, 'other': 2}, so to check if a key exists, then use 'something' in params` (will be True), 'r' in params will be False
if not 'r' in params: # do redirect and set 'r' to something on the new URL
 
I try...
def index(self, **params):

jsondict = [('foo', '1'), ('fo', '2')]
p = urllib.urlencode(jsondict)
try:
r
except NameError:
r=2
raise cherrypy.HTTPRedirect("/index?" + p)
else:
print "\n28"
print r
print "\n28"
but this not function...
ok you win...
 
Just put it in jsondict and be done with it ;)
 
1:49 AM
jaaaaaaaaaaaaa
thx
 
just call it something obscure like __r so it can easily be identified if needs be, or just obviously not a real parameter
 
I hate the darkness :P
Good night
 
night
 
2:22 AM
@MattH inaccuracies?
 
heya @Tshepang
 
hey, wsup
shouldn't you be sleeping!
 
not a lot...
had an early night - so woke up early
 
oh
I am struggling to keep my eyes open :)
 
go to bed then!
 
2:31 AM
soon
 
why are you still up anyway?
 
was doing a lot of 'waste time' on Hacker News
 
ahhh
 
also working on a tutorial
Pyramid
 
writing one or working through one?
 
2:33 AM
sorry, writing one; I don't know how far I'll go though
may be more than I can chew
 
I'll be interested in having a look at that - Pyramid certainly could do with a decent tutorial
 
btw, I see that Meta Stack Overflow still uses ur old gravatar: meta.stackoverflow.com/a/175443/147166
 
yeah - 'cos I forgot to use the button to sync across all networks
 
@JonClements there is a bunch already
this is an excuse for me to learn
I also find them not as gentle as I'd like
 
yeah - when I first started- I found them steep - it was only because of experience with Pylons and other stuff, that I was able to settle in
definitely not a good framework for first timers documentation wise
 
2:37 AM
but it's just a quick showcase
@JonClements I think meta.stackoverflow.com/questions/175429/… is settled now, or do you still need some input?
 
Nope - just put it there for reference for the time being - don't think it needs any further input, thank you
Think the comment to my answer made sense...
 
I think your answer is quite good.
 
I see you don't miss an opportunity to blatantly promote this room :)
 
It'd be amiss of me not to do so wouldn't it :)
 
2:45 AM
you still need to fake the feeling of such being organic
 
yeah - well it worked in nicely though
 
closing eyes
 
get some rest mate
 
 
4 hours later…
6:33 AM
anyone around?
 
7:03 AM
Hi, @DougTreadwell I am here.
 
7:15 AM
anybody here want to help me try to understand something?
 
That is an interesting question.
What exactly are you trying to understand?
 
@Tshepang that link was a bit superfluous don't you think?
 
I like it :)
Such messages would be needless if only this would get implemented:
12
Q: Room-specific welcome message for new users

ThiefMasterLots of the bigger channels have some kind of rules, stuff people are supposed to read before posting or requesting access, etc. In the topic it clutters valuable space that can be used for more useful things (regulars usually don't need a link about when to request access etc. there). When a bo...

 
8:04 AM
Interesting. I added an answer.
 
I am glad someone used a name, DISQUS, for a product. Someone would have used a generic name like Discuss (or Discourse)... not good.
@InbarRose veri naes
why the 'show to group' feature
 
So that a subset of users can be shown specific messages when they enter the room
 
but how is that useful
I wanted to hear a use-case, since I don't see it.
smells of needless complexity
 
Well.
I can give you one easy usecase
Lets say that there is a chat room with 2 owners, and there are 5 regulars, and the all the other visitors. And lets say that the owners want to inform the regulars of something. So they make a message that will display only to the regulars at their next log on to the chat.
 
8:21 AM
Shall I add that to your Answer? I suspect someone else is going to want to hear that.
 
Makes sense to me as a "nice to have"
 
I still think it's overkill, and will be surprised if someone implements it.
 
Do what you want @Tshepang
@JonClements More tools are never a bad thing.
 
I should just say: 'ask to ask' just feels polite when busy people are taking time to hold your hand
 
As long as the tools are controlled and are not constricting the current status
 
8:25 AM
We could always put a bot on sopython.com and have SE grant it write access if we were really desperate ;-)
But that floods the channel as per the js bit I guess...
 
It could be like the message that is displayed above the chat sometimes.
This hovering frame
 
@tshepang did you get any sleep?
 
I did, but was disturbed by a phone call (so I only got ~4hrs).
 
8:50 AM
Better than nothing I guess... maybe a quick siesta later or something. ..
 
yep
will do the siesta :)
 
Umm... will have a look at that later - it's not that old... (mind you - time does fly)
 
it's appears CPython policy to allow a release series to live only up to 5
except 2.7 of course
 
9:29 AM
makes me happy
-8
Q: please help, this is a homework

user2254164Write a program that calculates the equation of a straight line that best fits a given set of data points. Inputs: n number of data points {xi,yi}, where i = 1, 2,…, n. Outputs: The equation of the straight line that best fits to the given set of data points: y=ax+b where a is the slope of the ...

To see a Solicitation closed so fast!
 
RHEL support timelines are really impressive: mail.python.org/pipermail/python-dev/2013-April/125188.html
...2.6 will still be supported until 2023!
 
i wouldn't call this a good thing.
it means some developers will have to use ancient versions because they are the ones installed on some server
 
I feel sorry for such developers, but am sure they are paid for the pain.
 
I only recently was able to move to 2.7 when we upgraded servers to ubuntu 12 from 10.
Let me say.... No amount of money is worth the aggrevation
It's like you know that knives exist, and you know how to use them, but you don't have one when you need to cut an apple.
 
9:47 AM
If someone gave me $100k/month, I will happily code in Java (and Python 1.5).
I will even complain why they are paying me so much, and why they aren't asking me to code in COBOL instead.
 
I highly doubt the second part.
 
:)
 
And I do not think anyone would pay that much money for a position which uses old languages.
 
It was a response to "No amount of money is worth the aggrevation".
 
Meh, Okay - I suppose there is a line somewhere.
 
10:44 AM
@inbarrose and that Q is now deleted... :-)
 
@JonClements the luxury of being a part of SE community often results in sadness, since other communities don't have such a strong stance to moderation, not to mention the lack of SE's great tools
 
Well - I wouldn't say "strong stance" - it's more a "practical stance"
 
11:01 AM
 
Wow - I've posted 3366 messages in this room - when the hell did that have time to happen?
 
where do you get the info; my profile says "all time" so I assume it means all SO rooms
 
I just went to chat.stackoverflow.com/rooms/info/6/python and hovered over the number to the bottom right...
 
@Tshepang was not aware that global variables were more expensive to reference than local ones
@JonClements oh, I see
lots of knobs one tends to ignore
 
11:30 AM
Really doesn't feel like a Sunday today - it's weird...
 
@Tshepang Yes, in fact - it is sometimes better also to localize member variables or even arguments.
 
12:14 PM
@Tshepang So what replaces web services? json and the likes?
 
appears so, yes
@JohanLundberg interesting that you linked to a message so old; people don't often use that wonderful feature
 
I had to go there to find the last thing I wrote and who replied to it
 
damn, you have a PhD! I bow
what was that supposed to be
looked to me like fat-face waving a flag
 
something like that
 
Ummm - is the site down...
 
12:26 PM
not for me
 
Strange - I don't get a response...
yup - can't access SU or SO
 
@JonClements
Hi
I have the other solution
yeahhhhhhhhh
 
Okay - good to hear
 
If you want to see or look
 
Sure... why not - let's see what ya came up with
 
12:33 PM
you going to look on the question
Used the variable global
that I know
Yesterday I search global name variable but without the solution
and I created new question and chating woth you @JonClements
 
Okay, as long as you got a solution you're happy with ....
 
exactly...
thx
 
cool - I'll have a look later when I can actually access SO :)
 
SO is a system operating?
 
good morning gents
(even though it's evening over where I am)
@MirkoCianfarani SO stands for Stack Overflow
 
12:41 PM
for me is new stands :)
thx
 
Good afternoon Vol - long time no see buddy
 
yeah, haven't had the time to pop in all that much
I notice you've changed your gravatar again
 
Yeah - gone back to an old cute puppy I use to use before spider pig
wow - is it scary that I can't access SO for 10 mins, and I'm already starting to get withdrawal symptoms? :)
 
:P
what's wrong with your SO?
 
just won't load for some reason
 
12:50 PM
hmm, mine's working fine
anyway, you know that answer which i kept talking about before?
 
errr.... do I know the answer you were talking about before?
 
the one about print and having to call it
 
errr.... maybe? But my memory doesn't appear to work on Sundays
 
17
A: print() not working in python

VolatilityYou still have to call the function. def main(): # declaring a function just declares it - the code doesn't run print("boo") main() # here we call the function

it's gotten 17 votes now
 
Oh.... that one - yes.... It's a bit of a shocker it got more than 5 IMHO - no offense
 
12:54 PM
none taken - never imagined it would have gotten so many votes myself
 
I think I've got a 15+ and that was ironically something to do with print as a function or something....
 
just did some research
14
A: is print a function in Python?

Jon ClementsIn Python 2.x, print is a statement not a function. In 2.6+ you can enable it to be a function using from __future__ import print_function. In Python 3.x it is a function that can be passed around. Warning: using print as a function in 2.6+ code is liable to break production code (the same as us...

upvoted, so now you're on 15
 
Ahh okies - I can't access anything on SO at the moment - so I might just go have a quick pint before dinner is ready...
 
dinner?
 
bbiab
Well, lunch
roast lamb today
 
12:58 PM
Hi Folks, I'm writing a python producer-consumer variant using multithreading and want to udnerstand the following point:-
the consumer needs some time for processing of the data after it does a get using Queue.get(). But, I dont want the producer to put anything until Queue.get() has done its job
so, the default function calls in the Queue module dont seem to provide such a functionality. Is there any way I can achieve this?
 
got no idea, threading is not my area, sorry
 
then, please dont comment :)
 
1:23 PM
@GodMan Why do you say that Queue does not give you this functionality?
 
1:38 PM
WTF, How did I get a downvote for this? stackoverflow.com/a/15862870/1561176
The OP even said it is the answer. :P
Oh, someone thought it was 2 and not 3... okay
 
 
1 hour later…
2:40 PM
yello
 
2:59 PM
Howdy
 
3:25 PM
my edit privileges (spelling?) was restored when i hit 2k+ ;)
 
@limelights how did you lose those privileges?
 
@Tshepang i have no idea actually
i was on 1999 rep, my theory is one of ambiguity but im not sure
 
3:53 PM
1999 was a great year; Fight Club was released, I was happiest in school... best year of my life.
 
And then the nineties ended.
:(
 
4:10 PM
i was on 1984 rep as well, the year i was born. that was a good few hours.
 
 
5 hours later…
9:29 PM
is print seperate by commas good or bad?
@ThiefMaster what do u say?
 
I think it's ugly
 
hmm then do you advise i use join and then print but maybe the commas were created for the idea of doing the join internally .. instead of us taking one extra step to join and then print
 

« first day (904 days earlier)      last day (4036 days later) »