« first day (1783 days earlier)      last day (3163 days later) » 

12:00 AM
inside `__init__.py it is something like:
`import logging`

`#basic config, setting formatter... that stuff`

`import mymodule`
 
and then inside each module I go:
logger = logging.getLogger(name)
The thing is thing setup works...
 
Yes, I get what you're describing, but that's not necessary. Functions in mymodule can just make logging calls, the logging doesn't need to be set up first code wise.
 
however, you can see the imports are now pushed to the bottom
 
Consider reading the howto I linked, and just trying it out. I'm not lying: programming stuff about logging does not require you to configure logging first.
 
12:04 AM
I have read those before. The reason for configuring stuff is because, I need a console and file (debug level) logging. and I need a custom format too, hence the configuring step.
 
The problem you're describing does not make sense.
 
Let me look at those docs again, to see if I can find something similar...
 
Have a look at the cookbook (very bottom link). I think the first example is what you're doing and demos what davidism is saying.
With that, I must hit the hay. Rbrb all.
 
12:39 AM
I'm streaming me working on Shanty: livecoding.tv/davidism
I'm not guaranteeing anything interesting though.
I'm going to start some music, is someone around to tell me if the volume is too loud?
 
Sure, I'm streaming it now.
What is that?
I meant what's the music :). Thanks for the inband explanation though :P.
 
1:03 AM
By the way, the volume is fine.
 
thanks
 
1:39 AM
still streaming, it's actually making me get work done
 
Woo, got my Enthusiast badge. Fanatic, here I come.. :P
 
nice, I kept forgetting on meta, but I got it eventually
 
2:32 AM
@Ffisegydd I'd tell you to tune in to the stream, but I'm eating dinner right now
 
3:11 AM
Morning all
 
cbg @vaultah
 
still streaming, I've been going over 2 hours :-/
 
3:41 AM
Small amount of cabbage. Anything interesting happening?
 
I'm still streaming coding and music
 
I see :)
I haven't had anything big enough to have to template in awhile.
 
DSM
Popping in right before bed: if we have a question about your code, davidism, do we ask here or there?
 
there
 
4:14 AM
cbg all, up early today
 
4:33 AM
@holdenweb ditto - got a pidgeon that I think quite likes me
lands on the bedroom windows, and keeps hammering away
 
4:45 AM
I think that was like 4 hours total streaming, with a food break. But the code gen actually works now.
 
5:02 AM
I missed Super Fun Davidism Streaming? ;_; curse my need for rest!
 
 
1 hour later…
6:26 AM
Morning CBG all
 
7:10 AM
g'morning
 
7:22 AM
Hello!
I have a question! I have some API keys that I have written in a script. What is the best way to write it ? I mean should I declare it private/protected/global ?
Which is the best practice ?
 
@d-coder config files.
 
Umm..
Any other way ? I paid lots of money to get those keys :P
It can be accessed as any other variable if I write in config.py file right ?
I was thinking if I make it private ?
Any comments ?
 
Accessed by whom?
 
Mostly by me. But it's safe that way ?
I mean putting it in config.py
 
well, then it's there in config.py and whoever has access to that file will get the keys.
depends on how you deploy.
 
7:31 AM
I mean server deployment
 
The primary concern is file-system access, not in-memory.
 
I'll go by what you said @bereal
:)
Thanks.
Any other suggestions ?
 
8:16 AM
Cabbage, cabbage, everywhere cabbage
 
always lots of cbg! And cbg to you JRS :p
 
Thank you @jon, may your day be full of cbg!
 
I feel it in my fingers, I feel it it my toes...
Cabbage is all around me...
 
arthritis?
 
yeah, sounds similar to cabbage, btw
 
This video contains content from Fremantle International, who has blocked it in your country on copyright grounds.
 
The UK seems like it allows loads of stuff blocked elsewhere.
 
BTW, cabbage used to be slang for money in Russia in 90's.
 
In which case, it is certainly not all around me.
 
just replace "vectron" with "cabbage" :p
 
8:27 AM
Someone stole my bike from the front garden last night :( broke the lock. At least they left the drainpipe it was locked to intact. will cost a bit, though.
 
8:48 AM
why there isn't pkcs7 module in pypi?
i can see on web, it is being used by different users.
 
@MuhammadSohail isn't it in pycrypto?
 
i don't know.
how can i find ?
ihave found these two.
from Crypto.Cipher import PKCS1_OAEP
from Crypto.Cipher import PKCS1_v1_5
there is no pkcs7
:(
 
@JRichardSnape b*tards
 
9:12 AM
Cabbage!
 
Cbg poke
 
The xkcd survey – please participate for random science :)
16
 
9:23 AM
Done
 
:)
 
Excellent diversion tool, @poke
 
:D
 
10:09 AM
ImportError: No module named 'StringIO'
how to solve this error ?
 
@MuhammadSohail, from io import StringIO
 
Literally the first link in Google stackoverflow.com/q/11914472/2301450
 
You probably use Python 3, it’s in the io module now.
 
yes i use python3
@Cyphase it worked.
thanks
 
Sure thing.
 
10:17 AM
for _ in xrange(val):
NameError: name 'xrange' is not defined
 
Are you serious? Just google it.
 
please consider reading any link by query "python 3 what's new"
 
I'm following this tutorial,
there are many errors
 
a quick question, is it always true that tmp = json.loads(jsonStr); jsonStr == json.dumps(tmp)
 
a quick answer: no
 
10:22 AM
en ,is there a detailed answer?
 
key ordering, space normalization
 
I'm listening to the "UK Top 40 Chart"...
I have no bloody idea who any of 'em are
 
jsonStr = {"a": 1} with 2 spaces between : and 1 is already a counterexample.
 
and it just sounds like noise
 
cabbage
@MuhammadSohail I haven't looked at that link, but it looks like you are trying to run code that was written for Python 2 in a Python 3 environment. So you really ought to read about the differences between Python 2 and Python 3 or you will just keep running into problems. You may find docs.python.org/2/library/2to3.html useful.
 
10:31 AM
@JonClements are you listening to this?
 
something like that - yah :(
 
:[
 
@MuhammadSohail your continuing disregard for the room is starting to be a problem. You continually fail to listen to anyone and it has now reached a breaking point. The next time you ask some simple question that could have been easily googled, you'll be kicked out. You'll then be kicked out again and again until you decide to treat other users with respect.
 
@bereal
thx
 
@Alex welcome
 
10:40 AM
@JonClements Perhaps this is more to your taste? Cowboy - Please Be With Me, featuring Duane Allman playing some of the sweetest slide in the known universe.
 
@Ffisegydd damn dude, how much garlic did you have with dinner last night? I can smell your breath in Kent :p
 
@JonClements I know most of them >_<
 
@poke young whipper snapper... always keen to snipe at the oldies hey? :p
 
:<
 
same, plus I like most of them :d @poke
 
10:52 AM
:D
 
BBC R1 is my source of new music
 
I'm an R2 and R4 listener
can't stand R1
 
Well Radio 1xtra has Rodigan
 
I used to listen to Radio 1’s Essential Mix regularly
 
(he's a reggae dj, if you're into that sort of thing)
@poke Rudimental's debut mix was pretty good
I liked it, though maybe it's because I <3 Rudimental
 
11:11 AM
Rudimental?
 
I think it’s been 4-ish years that I last listened to a essential mix..
 
11:27 AM
no idea what you guys are talking about. the best music was written before I was born :(
s/best/all decent/
 
Morning everyone
Are migrations a SQL thing or will they work with NoSQL databases too?
 
migrations?
 
As in, I update my schema to have some more data, and update my fixtures to include that data. Now I want to update it in the database without starting over completely.
 
migration is the process of writing an update process that changes an already deployed schema
It’s neither part of SQL, nor of NoSQL.
 
Yeah, currently in dev I just wipe out the database and start over when I modify schemas. It's a pretty bad idea
 
11:39 AM
I don’t think you got my point :P
 
I did, I just forgot one detail that you reminded me of
 
which is?
 
You have to define a version for each migration that has occured
 
12:00 PM
@DSM, yeah, I think the right-angle point only exists when ABC is a scalene triangle.
 
This is really strange. Can any of you try to edit the tags in this question to include map? I tried so many times but it won't allow me.
 
Nope, doesn't allow me either
 
WLOG, place A and B at (0,0,0) and (1,0,0). Construct the sphere that AB is a diameter of. Choose any point Q on the sphere and find the line perpendicular to both AQ and BQ. If I imagine correctly, that line only intersects the z=0 plane when 0<=x<=1. This means that ABC only has a right-angle point when angle CAB and angle CBA are both less than 90.
 
@thefourtheye Meta it
 
Sure. I am on it :-) Thanks for trying guys.
 
12:06 PM
By this same line of thinking, it seems that every scalene triangle has a right-angle point, though, which is nice.
I believe @bereal was trying to tell me something similar last night, so props to him
 
Ah, is tagged as a Synonym of it seems
 
12:23 PM
What the heck is AHK
 
@thefourtheye Not sure if I agree with that…
 
Why not? Aren't maps and dicts the same thing?
(in java?)
 
If we actually go by that logic, Hash Table is also a synonym?
 
Hash table is implementation detail
But imo, map is more conceptual than dictionary
 
All dictionaries are maps, and all phone books are maps, but not all maps are phone books. I see where you're coming from.
 
12:29 PM
Distributing an array of objects by arbitrary property effectively is surprisingly hard :|
 
And I would argue that map is far too ambiguous to make it a (silent) synonym for dictionary
Map vs. Map vs. Map vs. Map.
 
@Kevin I thought map was more like applying a function to everything in a collection, generically
 
Nice demonstration of the ambiguity that Poke refers to :-) I meant "map" as in "a thing that creates a one-to-one association of one collection of data with another", rather than specifically the map function found in Python.
Although map is a map, in a sense. The association being between the sequence you pass to it, and the collection that it returns.
 
@Kevin A mapping is a mathematical function, usually injective, so map running a function on every collection’s item is creating a mapping too, yeah.
 
But it tends to mean applying a function that yields a 1 to 1 association. Like "every X-Men character can be mapped to a unique mutation". A phone book kind of seems like the result of a map more than a map itself. I guess that's kinda semantics though
 
12:37 PM
Tangent: I wouldn't be surprised if there were mutant twins that had the same power.
 
the output object is not required to be unique in the result, so it’s not a 1:1 association. It’s only injective, meaning that every element from the source collection is mapped to something.
E.g. map(lambda x: 1, range(100))
 
The Summers family tends to have lasery abilities, so there's partial precedent there
 
@Kevin Deadpool and Wolverine both have advanced healing factors, does that count?
 
Not if you classify Wolverine as "healing factor and also claws"
 
Deadpool has katanas, that's close enough
 
12:39 PM
The claws are not really part of its mutation though
 
Metal claws no, bone claws yes
 
It’s more an augmentation, to introduce the appropriate term from Deus Ex.
bone claws?
 
It was in the movie... Not sure if it was ever in the comics
 
Which movie?
 
"X-Men Origins: Wolverine" at least
 
12:40 PM
I don't think Deadpool has any mutation, technically, he just got the healing factor from wolverine, so that's probably cheating
 
@Kevin The movie that took away the mouth from a comic book character referred to as "The Merc with The Mouth", probably not reliable
 
> When Magneto ripped the Adamantium off of Wolverine's skeleton in X-Men #25 (1993), it was revealed the next month, in Wolverine #75 (1993) that Wolverine, in fact, had bone claws, and that the claws must have been a part of his mutation, all along.
 
Deadpool is more of an abomination of science than a mutant, anyway
 
Just like me!
 
12:45 PM
Yeah, champ, just like you. Ruffles your hair avuncularly
Is there a formal name for this kind of assignment: x[y] = z? I went with "index assignment" in this answer but I'd prefer the official term if one exists.
Ah well, moot point. I don't think I interpreted the question right anyway.
 
I would call it item assignment
 
Yeah, that's better
 
Or list element assignment.
 
I would keep the list out because it can be a dict, or something else.
 
12:55 PM
Special method is called __setitem__
 
And x[w:y] = z is list slice assignment
 
Hrmph... if you wanted to divide a collection of items down the middle, would you just get the average and decide which "compartment" to put them in based on dividing by the average?
 
@poke Ok
 
@corvid “average”? I thought you wanted to divide it in the middle?
 
@corvid I don't think so. Consider the collection [1,2,3,9999999]. It would be hard to use the average to get two lists of two items each.
 
12:57 PM
Also, I have no idea what you want to do. Give an example?
 
In this case, each object has a mass. I want two compartments that have roughly the same mass
Given a list of objects, where each object has a mass
 
sum them all, and then solve the bin packing problem for bins of half the sum.
 
In my above example, getting roughly the same sum is impossible
 
yeah, that can happen, but ideally 1,2,3 would be in one compartment and 999999 would be in the other as the "best" solution
 
@corvid If the masses are randomly distributed (unlike Kevin's example), you can get fairly good results just by assigning the items randomly to bins. Otherwise, sort, find the average, and add items to one bin (choosing from the biggest items & working your way down) until you reach the average. Or for more exact results, follow poke's suggestion, but that generally takes a lot longer since bin packing is NP-hard.
 
1:03 PM
Yeah I think the partitioning algorithm generally assumes you should have roughly the average total in each bin
 
Your customers will ship three oranges and a grand piano just to see what happens
 
That case is handled for because you can only insert a maximum of 15 into each well on the database, worst case is you can only put a single thing in a spot
 
not sure what you said there
 
Cool, it works now... the problem seemed to be that a function called "partition" behaves oddly, but using groupBy made it work
 
1:59 PM
In today's episode of Newbies say the darndest things:
Wow thanks guys, I thought "name" has to be called name, i didnt realize it could be anything! Thanks everyone!! — Reilly Chase 56 secs ago
@MorganThrapp: Should we really be helping that leet haxor to write a password cracking program?
 
I want to eat the pretzel in my snack drawer but it will inevitably give me a stomach ache.
And yet I am considering it anyway. I think this is a good demonstration of exactly what kind of flaws my personality has.
 
@Kevin That’s why you shouldn’t keep pretzels in your drawer for 3 years.
 
It's three days old, which is about the same as three years, in terms of staleness
 
user559633
2:14 PM
"If this doesn’t fit you, can you suggest someone else ?
If it does, let’s book a brief calibration call."
lols
 
user559633
Yeah get a calibration call on my sched so we can sync up and do a 360 mind melt and find some resources that have synergies
 
Wow, you have the bandwidth for a mind-meld?
 
user559633
Yeah, I've been creatively thinking outside the box in terms of social strategies
 
For all your questions about dluat, such as "what is dluat?"
 
2:17 PM
Pretty sure it wiped Picard out for the day.
 
Today is the third time this month where I have heard someone recommend the book The Life-Changing Magic Of Tidying Up. What is the Universe trying to tell me?
Probably "tidy up, you slob". The Universe knows how to cut me down to the bone.
 
@Ffisegydd It doesn’t attribute the content appropriately.
 
@PM2Ring I mean, with how leet they are, it's only a matter of time till they figure it out anyway. I'm just hoping by helping them my bank account will be spared.
 
:)
 
If I threw out all of my possessions that don't "spark joy" I would probably end up living in a big jar on the streets of Athens.
 
2:20 PM
@poke Shocker.
 
@Ffisegydd It’s the only thing that’s wrong about it
 
cabbage
 
Would not using the Stack Overflow name also be against their copyright?
Anyway brb meeting.
 
I have filled out the survey. I laughed.
 
user559633
behind on the lol, but raw_input("Press Enter to continue...") this guy's password cracker is awesome
 
user559633
2:29 PM
it's like brute force, but requires you to sit there :)
 
cbg all
 
user559633
hey @jonrsharpe!
 
cbg
 
Is there a way to access the return value of a function that gets called in an if? Eg, I want to do if re.search as group: print(group)
 
2:36 PM
Nope
Gotta do group = re.search(...); if group: print(group)
 
Alright, I thought so.
 
I'm pretty sure GVR deliberately made setting values in if/while expressions impossible.
 
I'll put it in KevinScript for a dollar.
 
@Kevin I'll give you two if you port my code.
 
Kind of a moot point since KS doesn't have regex yet
 
2:40 PM
@davidism Yep. IIRC, that was the main reason for making assignment not be an expression.
 
Well that escalated quickly :P
 
deform+colander rules
 
How is a list not a comma-separated sequence of elements?
 
I was just about to say that.
 
@BhargavRao, that would limit me to put something at the end of the list, wait I edit my question — thewaywewalk 1 min ago
Err?
 
2:43 PM
Open-ended lists are very handy, although tricky to print
 
d'oh, that dijkstra question is awesome
 
Hello again everyone
@bereal Which is that
 
Hi JRS
 
@bereal Ah, I see - the connected roads one...
yeah - that's pretty optimistic.
 
2:45 PM
@bereal Is there a SE site where that is a valid question?
 
@BhargavRao there's no question as far as I can see...
then people are whining that SO is so unhelpful
 
True that.
 
stackoverflow.com/a/32376309/400617 naa, new question posted as answer
(and they already tried to post a new question once, it's deleted below that)
 
Antti's answer is the only correct answer there :D
 
@BhargavRao bad question
I am the only one who read it from bottom to top
 
2:54 PM
First I thought, something wrong was happening with SO, someone is testing his AI bots on it, but then I was like oh right, the school year has begun. Maybe, both things at once.
4
 
@AnttiHaapala You too read from Bottom to Top? :D Same here
 
@bereal it is the AI course at the unis
I coded a Reversi algo
 
yeah and on coursera/udacity/whatnot.
 
DSM
@Kevin: that's a similar argument to the one a colleague of mine and I worked out on the board, after I had enough examples to convince us that there were cases where you could and cases where you couldn't. :-)
 
now they do stackoveflow qa in NLP
 
2:57 PM
Oh good, independent verification :-)
 
Do we have a dupe target for this? I'm sure I've seen something similar before.
 
On a scale of 1 to 5, which number is your favorite?
1, 2, 3, 4 ,5
 
Being a programmer you gotta start from 0
 
I chose two because it's the only even prime, thus making it a -~special snowflake~-
 
answered
 
3:08 PM
But three is the first odd prime, and four is the first non-one square, and five is the first non-three odd prime, so they all have their good qualities.
 
I picked 4. I like the way it looks.
 
DSM
Three, of course. I find it hard to believe there's a question.
 
Four is the only number that has an interior section separate from its exterior.
and three is the only one with horizontal symmetry.
Unless you write 1 in sans serif
 
my handwritten 2 has 2 interior sections separate from its exterior
 
DSM
Believe it or not, on the way home yesterday I told my companion I prefer my fonts sans.
 
3:11 PM
and four has none :P
 
Out of the scope, but 8 is the only one with horizontal symmetry.
 
DSM
0?
 
it is not a digit :P
lalallallllllaaaa
 
Pffft, 0 isn't a number. Just ask the Romans.
 
Wait. Which symmetry is the one where the line lays down flat.
 
3:12 PM
@MorganThrapp you need to fix:
hmm ...
cant think of any :P
or maybe it is the onyl one with only horizontal symmetry
 
What?
 
if the top is smaller
 
@MorganThrapp How about π? ;-)
 
DSM
Thank you, Kevin "Venerable Bede" Kevinson.
 
I will respond to that once I finish reading this very long Wikipedia article.
 
3:16 PM
I quit my job today, and given that I recently received a letter commemorating 10 years at the temp job I had while at Uni, this might actually be the only time I've done so
 
DSM
Wow! On to new and more exciting adventures?
 
Hopefully!
Adventures just upstairs from Stack Overflow London, it turns out
 
stackoverflow.com/q/32379147/2301450 I think I found those posts
 
DSM
So if we have feature requests we should send them to you, and they'll mysteriously be shoved under doors?
 
Haha yes, if you like, or I could see if my new employer would be amenable to a fire pole
...now that I think about it, I may do the latter anyway
 
3:20 PM
You'll need to drill a hole in the floor anyway in order to have LAN parties.
 
That's a whole different scale, though
 
This question may be a duplicate but it is not a duplicate of that. Nowhere in that question or the answers is it mentioned creating an object before passing to the context manager vs creating an object with a function call inlined with one. — Two-Bit Alchemist 1 min ago
Sigh
 
3:39 PM
@vaultah yes, with some useless comments. Maybe I should just delete the question. — Pablo 4 mins ago
opinions?
 
user559633
What is the SO syntax for a quote? not a block quote, but that one with the yellow background
 
that is a block quote
> before each line
 
user559633
Oh, cheers -- just looks different on meta (for what it's worth, i looked here stackoverflow.com/editing-help)
 
@vaultah More suitable for a comment than answer
 
True, but then the question will be eventually auto-deleted
 
3:46 PM
@Kevin Is that the best you can come up with for poor old 5? There are 5 Platonic solids; 5 is the hypotenuse of the smallest (non-degenerate) Pythagorean triad (3, 4, 5); 5 is the smallest prime of the form 4n+1; 5 is the largest solution of n=Fibonacci(n); polynomial equations of degree = 5 can't be solved in terms of radicals but those of smaller degree can be; Etc. :)
 
Also, 5 is numberwang
 
But is it wangernum? Find out after this commercial break.
 
@vaultah It's gone now.
 
@PM2Ring five platonic solids? Tsk, people are always forgetting the teapotohedron.
 
3:50 PM
^ the answer by the op that should be an edit
 
@Kevin laurel
 
rbrb
 

« first day (1783 days earlier)      last day (3163 days later) »