« first day (2022 days earlier)      last day (2931 days later) » 

1:39 AM
-1
Q: Is this a correct place to use exec/eval?

TheInitializerSo I keep hearing everyone saying "don't use exec, don't use eval, etc." But I was wondering if it's correct to use under this cirumstance. I have multiple functions that do the same thing for different operating systems: def doCoolStuff_Windows(): # do cool stuff here, windows edition def...

Why is it so bad to use exec here?
 
 
2 hours later…
3:36 AM
cbg
 
Roh
Hi guys
Guys I need some consult.
I would like to make a proxy with PHP or Python. but there is some questions.
I want to use free web hosts then I just can use port 80. I want to write a program on the PC side and
write a program by PHP or python. in fact I want to write something like a PHProxy but with complete
service. what I mean by saying "complete service" is that e.g. as you know you can not log in or out in the websites
which you have an account by PHProxy.
what's your opinion?
Which one is better, PHP or Python?
 
4:02 AM
@Natecat: hmm, I guess it's the first time I asked that Q
Apparently, you cannot upgrade pip on travis :(
 
 
2 hours later…
6:12 AM
cbg
 
6:40 AM
Cbg
 
 
1 hour later…
7:59 AM
Morning cabbage, all
 
Cabbage
 
Was anyone else at the SO offices for their party yesterday?
 
Nice place-name-drop.
 
So subtle, I almost missed it.
 
8:11 AM
Hi Guys..Yesterday I asked a question stackoverflow.com/questions/36917865/… and got the answer. But, I am finding it pretty hard to understand the code...Could somebody help me?
Now, I want to fetch from more info from the SOAP response but finding it hard to understand the code to tweak the requirement..
 
8:23 AM
Argh I have somehow totally broken this flask app on pythonanywhere - no errors, but clicking any link doesn't work. And the code is pulled from the github, and works fine on my local machine.
 
@RamanBalyan you seriously need to be shown how to subtract two numbers?
 
@RamanBalyan SO's not the place to ask that question - try here or here.
 
We should start SoPyConsultingCo.
 
Yeah good call.
 
Rather than giving business away to airpair and codementor.
 
8:32 AM
Python, Javascript, C#, and whatever else Antti knows
 
Antti knows all.
 
Also LinkedIn API
 
Already got a logo.
And a motto: "We put the oil in Snake Oil."
 
Mornin' cabbage
 
SoaPy consulting: we'll clean your code
@RobertGrant Did it ever work on PythonAnywhere?
 
8:43 AM
Mar 15 at 19:00, by Ffisegydd
Sidebar: How much trouble do you think we'd get in if we started charging for sopython-based help? We could have a subscription model where people pay to idle in the room and learn through osmosis (today I learned how to make a gif and the major differences in swear words between UK and NA!). Could also have additional microtransactions where people ask specific questions.
 
@JRichardSnape yeah, until about 2 days ago
I did a pull and got the latest code. Big mistake.
What's weird is it's not throwing any errors
 
Hmm. Can you "retrace your steps". Ah - is it not your codebase?
No errors client side as well as server side?
 
Yep no errors anywhere at all
 
That is weird
 
My codebase is now the same locally and remotely
 
8:45 AM
Got a link?
(to the pythonanywhere one - obviously I realise it might be confidential)
I'm just bored and will happily verify clicking links does not work :D
 
Yeah it's password protected - happy to give it to you privately somehow
 
keybase!
 
Lol yeah are you on keybase?
 
I can't remember whether I signed up. Hang on
(yes, I have that much use case)
 
(I'm currently reconfiguring 3D printer space, but if JRS hasn't solved it by the time I'm finished, I'll jump in too ;))
 
8:48 AM
@JRichardSnape find robertlagrant
 
Hmm - it appears that no - I am not on keybase. Or I used a passphrase so different from my usual canon that I can't remember it.
However... I obviously haven't got anything useful on there, so maybe I'll just try starting again.
 
Woo! Keybase!
 
Hmm - It informs me I would be "#29927" in the queue, were I to sign up now. I thought I signed up ages ago, but plainly not - it knows of none of my email addresses. Hey ho. If it's not uber-confidential, you can feel free to send to my email - jsnape <at> dmu <dot> ac <dot> uk. Or not - it's not very likely I would be much help anyway.
 
@JRichardSnape hang on a second
I can send you an invite
 
OK - that sounds good.
 
9:00 AM
Sent.
That should bypass the queue.
I'd like to prove my SO account but not sure how it'd work.
 
@JRichardSnape might as well spread the keybase love :)
 
Me and Intrepid use it a fair bit.
Mostly for sending encrypted messages via one-to-one chat rooms on SO. Makes us feel cool.
 
Ha - I like the visualisation of finding prime numbers when you generate a keypair. It's like password cracking on TV circa 1986.
 
It's a nice spin on the old central servers of public keys, by attaching proof to social media profiles and websites.
 
Yeah it's a cool idea
 
9:06 AM
I wouldn't know what TV was like in '86 - I wasn't born :P
 
Wow.
 
'86 was 30 years ago now, I'm still in my 20s.
 
When are you 30?
 
Just thought I'd throw that out there. Chip away at your souls.
 
still clinging to the correct side of 30
 
9:08 AM
The correct side of 30 is so far away I can no longer see it in my rear view mirror with my aging eyes
3
 
I was born in 1989.
 
So scary
 
Pfft - you're a father, that's scarier.
 
In a couple of years there will be legal adults born in the 21st century...
 
Surely you've watch War Games, Fizzy? In which case - you know where I'm at...
 
9:11 AM
@snakecharmerb - Please leave. We don't need that kind of language in this room :P
 
Scariest one for me - I will soon be teaching students who were born after 2000
 
@IntrepidBrit The ellipsis? Check.
 
I don't think I have seen War Games. I heard the only way to enjoy that movie was not to watch.
6
 
There is that.
 
Well deserved star there
 
9:12 AM
:D
 
I'm actually on annual leave today.
Should leave the house...
 
Otherwise it'll be annual don't leave.
 
Swing and a miss.
 
Can I send a direct message in keybase, or do I need to paste it in a shared location?
 
@RobertGrant shared location IIRC.
You can encrypt on the website directly though, as peoples public keys are stored online.
 
9:15 AM
@Ffisegydd Dad jokes FTW. Mr. I'm 10 years younger than you
 
@tripleee @RobertGrant No..i dont want to see that..I am not understanding the this part of the answer:
 
It'd Dr. actually. For both of us. Keep up, old man.
 
availability = listify(
soap[env+'Envelope']
[env+'Body']
[doorway+'MultiAvailabilityResponse']
[doorway+'Availabilities']
[doorway+'Availability'])
 
@Ffisegydd My memory is failing. obvs.
 
and this for _availability in availability
for roomrate in listify(_availability
[doorway+'RoomRates']
[doorway+'RoomRate'])
for rate in listify(roomrate
[doorway+'Rates']
[doorway+'Rate'])],
key=lambda x:float(x['AmountBeforeTax'])
 
9:17 AM
@RobertGrant Although they are working on some kind of messaging system.
 
@RobertGrant As far as I can see, there's a nice screen to encrypt and sign, but then you need to paste it somewhere.
Or send it to my email, I guess.
 
Dr Fizzygood and I usually just use a private room convo
 
Although for cool points, you should definitely post it somewhere public tacitly saying come and crack me if you can.
 
wow, I'm older than Fizzy
I tend to assume fractal-like patterns to be ancient
 
@RamanBalyan do you need help understanding list comprehensions, or the ad hoc listify function, or the sorted function, or the structure of the parsed SOAP? Sounds like you should be composing a separate question to articulate how much you already understand and formulate a precise question about the part you need help understanding
as usual, stackoverflow.com/help/mcve is probably good to keep in mind
try to remove as much as possible; when you are done, perhaps you don't have any question any longer
 
10:00 AM
Bacon and brie panini. Belting.
 
Hello, can someone give me insights about NFD and NFC unicode implementation?
 
the difference is 1
oops, this is not javascript
 
@m0rpheu5 Is this in relevance to Python?
 
or matlab
 
t=yes
yes, its relevant to python
NFD unicode normalization using Python
 
10:13 AM
NFC is actually witchcraft.
 
So what do you suggest on its implementation ?
 
See if it weighs the same as a duck.
But seriously - your question is so open ended. Could you be more specific?
 
I need to implement NFC and NFD unicode normalization
 
Right, what are you struggling with?
 
I have no idea on how to do it
 
10:23 AM
@Intrepid well - you did ask :)
 
One quick google later- docs.python.org/3/library/…
Admittedly, I did immediately think that NFC was "Near Field Communications", which is something that I do have some experience with.
 
Been having "interesting" (as in "may you live in interesting times") conversations all this week and last with our founder about metadata. He is so incapable of explaining his requirements our first implementation will be a SQL table with two key columns and a JSON data string into which the metadata will be stuffed.
"Do the simplest thing that could possibly work" is a good rule
 
@AnttiHaapala could you provide an example that can't be fixed using the len(expr) check? Or your point is that there are bugs in Python implementation and therefore it is impossible to write safe code in general? — J.F. Sebastian 6 mins ago
asjfsadlkjfsadlkjfsadf
 
10:40 AM
@holdenweb Plus - depending on the DB - some of them have great functionality for querying/indexing JSON data so... if it ain't broke :p
 
I seem to recall a long trail on one of the python mailing lists about the impossibility of building a fully sandboxing in the CPython interpreter that centred around these intrinsic problems. However, my memory is hazy, probably due to initial lack of full understanding and my advancing years as Fizzy noted.
 
[{"name":"Fender","issue":"Scratch","price":2500},{"name":"Fender","issue":"Dent‌​","price":1200},{"name":"Bumper","issue":"Scratch","price":1100}] => [{"name":"Fender", "prices":[{"issue":"Scratch","price":2500},{"issue":"Dent","price":1200}],{"name‌​":"Bumper","prices":[{"issue":"Scratch","price":1100}]]
 
@JRichardSnape wonder how hard-headed one can be :d
 
Is there a pythonic way of doing this? Right now, I am running a loop and creating a dict to do this
 
of course since one bug needs a string 100000 characters long on a certain platform, then just limit the string length, problem solved <3
 
10:43 AM
Problem solved. Moving on... ;)
 
@JRichardSnape Is Fizzy being mean to you? :'(
 
Well - he gave me a keybase.io invite, so I'll take that in compensation for my failing faculties and the ridicule of my outdated cultural references.
 
On that note - I need to add you to my keybase. Gotta give you that legitimacy.
 
I'm snapey on there.
Welcome to my circle of trust :)
Or should I say "may I be admitted to your circle of trust?"
Oh - according to the docs, neither of the above. It's a bit different to the PGP web of trust I'm familiar with.
 
Yeah, it's more of a informal circle of trust
 
10:57 AM
trustno1!
 
Anyone object to me punting out a link to a PhD scholarship for some research into modelling thermoregulation in the human body. Python encouraged, although needs an ability to interface with / reimplement code in other languages. Potential downside - second supervisor would be me...
Happy not to if it's inappropriate - I'm aware it's kinda sorta like a job advert (which I wouldn't do)
 
I personally wouldn't object - but my opinion isn't worth diddly squat!
 
Ah, I wouldn't say that. Well - I gave fair chance to object I reckon.
If anyone fancies a PhD in software modelling (specifically Modelling human physiology, thermal comfort and thermoregulation) there's a scholarship available here: dmu.ac.uk/documents/research-documents/graduate-school/…
 
Ah, if only this was offered to me 6 years ago ;)
 
11:13 AM
@JonClements That would make a semi-strong password nuppy :)
 
@JRichardSnape oh lord that beard is magnificent.
 
@Ffisegydd The twitter/keybase photo? One of my better stages of beard growth, I think :D
 
Ya
 
@thefourtheye If (apart from the exclamation mark) "trustno1" wasn't a massively used password because it was Mulder's in X-Files :p
 
Dom
11:37 AM
@Anuj if you're pulling it from a DB via ORM you can create a property/method (I forget which) on the class that returns it as JSON
For example:
class Category_Item(Base):
__tablename__ = 'category_item'
id = Column(Integer, primary_key=True)
name = Column(String(150), nullable=False)
description = Column(String(400))
category_id = Column(Integer, ForeignKey('category.id'))
creator_id = Column(Integer, ForeignKey('user.id'), default=999)
creator = relationship(User)
category = relationship(Category)

@property
def serialize(self):
return {
'id': self.id,
'name': self.name,
'description': self.description
}
To call it:
category_item = session.query(Category_Item).filter_by(id=category_item_id).one()
return jsonify(category_item=category_item.serialize)
 
11:55 AM
@AnttiHaapala 165k user...took me a while to realize
also, 4-year-old post?:D
wait I've seen these posts
 
@AnttiHaapala Is that a technical Finnish word?
 
f is foreign in Finnish, isn't it?
might be a loan word from some other language, though
 
@AndrasDeak friend suggested the contents of that post as a "solution" to our problem. I politely declined.
 
Sigh, since no comment to discuss the downvote on my answer seems to be forthcoming, I'm asking the room again. What have I missed, what do you think could be improved.
 
12:12 PM
I could never upvote a man who's too afraid to show his face
 
interesting downvote
 
@MartijnPieters do you have [peer pressure] yet
 
But on a serious note - I can't see anything obviously wrong with it
 
sum_global, perhaps you meant "some"?
 
FFS @MartijnPieters, if you don't stop whingeing about one measly downvote I swear I'll downvote the answer myself
That was meant to sound friendlier than it reads ...
 
12:16 PM
Lack of smiley? :)
 
@holdenweb it is a perfectly correct answer...
 
@Antti interestingly - I wasn't taking Steve as being serious :)
 
@MartijnPieters can it not just be the user from other day who downvoted you out of spite?
 
@JonClements I am a Finn, we never joke.
4
 
Alas the perfectly correct answer was given in a sadly imperfect world where cretins are quite at liberty to downvote an answer given by the well-informed and virtuous
 
12:17 PM
Can I whine for more downvotes?
 
@AnttiHaapala Guess we'll have to start calling you Antti Humour :)
 
the whole question was about an XY problem, now I want my peer pressure
 
@AnttiHaapala I got you bud.
 
1 more
 
I remember back in the day there was some system that both Fredrick Lund (the famous effbot) and I received consistent downvotes on everything we posted, clearly by someone not well-disposed to either of us
 
12:19 PM
@holdenweb Thing is, I care about providing a good answer.
 
@AnttiHaapala heh, left a last name in one of the posts:D
maybe
or it's been changed as a joke
 
I don't get many unexplained downvotes, and when an answer is still fresh and on a question with few views, that usually means I missed something important.
 
Frankly, if that sort of passive-aggressive behaviour is the best way someone can find to criticise me I am quite happy to exercise my right to not give a shit
 
@AnttiHaapala I resisted the first time you asked, I didn't know about the Finn joking situation
 
I don't mean to winge, certainly not. I am just being bullish about making sure I get feedback so I can improve faster.
 
12:20 PM
@MartijnPieters but you make the mistake of assuming that a downvote is given because your answer was imperfect, rather than a) someone having got out of bed the wrong side, b) someone having taken an irrational dislike to you or c) someone simply being too dim to appreciate the magnificent beauty of your answer
 
@AndrasDeak Always a possibility, but it appears to be rare for me.
 
@AnttiHaapala and I'll try to understand that message of yours, I'm not sure I got that the first time:P
 
In short, I feel you might be taking this SO reputation thing a little bit too seriously
 
but now, gotta go
@holdenweb he'll never reach 500k this way;)
 
@holdenweb I am not making such an assumption. I am making the assumption that I may have missed something, and thus are asking for a fresh pair of eyes to affirm or dispell that notion.
 
12:22 PM
@AndrasDeak well, to explain why'd I comment a 4-year-old post
 
It is not the reputation I care about. I'll rep-cap today and that downvote will simply vanish into thin air.
 
@MartijnPieters that's interesting, I'd think that a diamond makes a lot of idiots want to downvote
@AnttiHaapala oooooh, OK, thanks
 
@AndrasDeak most of those idiots have < 125 points of reputation, and can't.
 
yeah I can see that, Antti:D
 
@MartijnPieters again and again and again? (I should point out I'm taking the piss here - I just happened to drop on the only two times you've done it in the last 24 hours. You have only done it twice in the last 234 hours, right?)
 
12:23 PM
so we really need a safe eval. Alas 99.999 % of those "safe evals" are not safe at all.
 
@MartijnPieters possible, I don't have much insight
just a vague comtempt for human nature
 
@holdenweb I do it once in a while. You probably got lucky with finding me do it twice in 24 hours. Was it yesterday that I did this last?
 
rhubarb
 
Who knows? Probably only you and I care ;-)
 
hi @SeanParsons
 
12:24 PM
I know I don't.
 
Well, I care about you, so now I'm going to find out!
 
I sit here nursing my measly 4,000-odd rep points having only capped out twice in my entire SO career, so I wouldn't take anything I say too seriously
 
I know I don't.
:P
 
:P
 
@AnttiHaapala I think it would be safer to never attempt to have a safe eval.
Also - what's a cap? :P
 
12:26 PM
@IntrepidBrit It's what you get for playing for your country in ruggers.
 
Now the room is a little better-populated I'll ask again if anyone else went to SO's party in London last night?
 
@holdenweb: it was Wednesday, when I was just grumbling, so I didn't link. Today I am asking for eyes to look at the post, a specific request with a link.
I'll try to keep the grumbling to a minimum. ;-)
There was a SO party in London last night?!
 
I couldn't make it, unfortunately.
 
Nope, didn't know it was a thing until holden mentioned it earlier
 
@MartijnPieters I'd assume it's some raving fan of global variables who's been programming three months. They get to vote too, right?
The answer certainly seems reasonable to me
 
12:29 PM
@IntrepidBrit the case is "user can write a mathematical non-recursive expression using the basic operations *, -, /, +, so that it can't a) exploit the server, b) DOS the server c) crash the process that is evalling it"
 
I last made such a request April 16th, I last grumbled on April 5th, then early February twice.
So, about 4 grumbles in the past quarter, 2 requests for feedback. I'll keep the grumbles down, are the feedback requests acceptable?
 
I wonder when the pycon uk schedule will be announced :/
Submissions are open until 28th June, so probably not for a while :(
 
user559633
My Significant Other didn't even tell me she was having a party. Typical.
 
How inconsiderate. Just lock the study door and put headphones on.
 
lol searched for flights oulu-cardiff, cheapest is only 366 eur there and back again.
only 3 stops :D
 
Dom
12:40 PM
@AnttiHaapala probably a silly question, but why wouldn't you handle that client-side?
 
cbg
 
@Dom it indeed is a silly question.
@Dom perhaps the data happens to be on the server side.
 
12:55 PM
@AnttiHaapala - okay. That's not so bad but I'd be tempted to completely forgo eval and write something from the ground up.
 
Dom
charming lol I can't think of many cases where you wouldn't just pass the data to the client side for the user to do with as they wish, since they are rolling their own formula anyway
 
@IntrepidBrit ofc
 
Dom
Most enterprise software/apps would likely have the formulas defined before the app is even built and the formulas would sit in the backend
 
user559633
Heh.
 
@Dom that tells more of your imagination than of my problem.
 
Dom
12:58 PM
some quite rude folks here. Just because you write Python it doesn't mean you have to be a snake.. :)
 
well, you're the one who said my problem is a non-problem.
 

« first day (2022 days earlier)      last day (2931 days later) »