« first day (1350 days earlier)      last day (3602 days later) » 

5:10 AM
that's a good one...
 
6:32 AM
Cbg all
 
Mornin' :-)
(although actually I'm just about to go to bed)
 
I am impressed by your dedication to the One True Time Zone @Zero :p
 
Well, technically it's AM here :-)
Anyway, rbrb etc.
 
7:08 AM
morning
oops cabbage
 
cbg
so this was a rather "interesting" interaction, to say the least... stackoverflow.com/questions/24445031/…
 
Cbg :)
@MattDMo I think you've made a new friend
 
7:27 AM
yeah, or something. I was half-tempted to write an answer just so he'd mark it accepted, but it really was a complete dupe. OP had to have been chemically enhanced somehow...
 
7:37 AM
"I refuse to acknowledge answer 'foo = 1' because I asked how to assign 'bar' to 1" :P
 
7:49 AM
It's friddddaaay :D
 
:D
 
8:00 AM
cbg!
 
@KDawG cbg! :D
 
cpx
cbg
I probably need to continue my journey of Python where I left.
 
8:23 AM
Into the unknown...
...4 will enter, only 1 will return...
 
cabbage all
 
8:45 AM
hi all !
 
8:59 AM
in django forms , while save()'ing a form with foreign key relations do I need to set the id ? or the object ? if I set through code before save() ?
 form = ActivityForm(request.POST or None)

    if form.is_valid():
        form.task = task
is this okay ? when one Task have more than one Activities ?
or I need to set form.task_id ?
 
 
1 hour later…
10:13 AM
cbg
 
cabbage
 
Hrm, two more answers and I I'll have 10k (visible) answers.
 
Cbg
body = re.sub(
r'\s([\w]{0,1})\s',
r' \1 ',
body,
flags=re.UNICODE,
)
What does this regular expression?
 
Because its leg is just as long?
Ignore that, bad joke.
Are you asking what the expression does?
 
cbg
 
10:20 AM
It replaces 0 or 1 word character (a-z, 0-9, underscore) between two whitespace characters (space, tab, newline, carriage return) with a space, the character, and the   HTML entity.
The [\w]{0,1} is a rather verbose way of saying \w?.
 
ain't \w also matching more than that? Like a whole lot of characters from other languages
 
@MartijnPieters thanks
 
ingenious voice acting:
 
@Jerry Ah, yes, it is re.UNICODE, so it'll do more than just ASCII letters and digits.
 
10:42 AM
For anyone who is interested in the wiki (primarily @Kevin probably as he tends to take care of the common questions) I've written a cronjob which will take backups of the wiki posts on a daily basis in case anything is lost so give me a shout if you need the backup. One thing though is that the backup is refreshed everyday at midday (as I've only written a quick and dirty script to back it up) so once it's past a day, it's gone forever.
 
 
1 hour later…
11:57 AM
it is time for a long-long anticipated swimming in the Aegean sea
cu l8
 
12:32 PM
cbg
 
cabbage
 
and then I was at 10,006 answers.
number 10k flew by without notice.
 
1:17 PM
@MartijnPieters is there any achievement you did not achieved yet?
badge, or any other stuff I mean
 
In fact pretty much any Question badge...
 
Still needs to get "Precognitive: Followed the Area 51 proposal for this site before it entered the commitment phase" :-P
Today I am annoyed by answers that say "I could be wrong"
Of course you could be. That's implied for all answers.
 
Hey, at least they recognize their human fallibility.
That's the first step to proving you're not a robot.
I try to avoid the phrase "I think" so that they don't notice that I've achieved sentience.
 
It just smacks of insecurity, to me
 
1:32 PM
Yeah, on a more serious note, I try to avoid that because I wouldn't be answering otherwise. If it's really wrong, you'll find out in the votes and comments.
 
1:44 PM
how does one even test the front end of a site, really?
 
Selenium?
 
@PeterVaro There are several badges I cannot ever get.
Apart from Precognitive and Beta and Constable, that is.
 
@MartijnPieters rephrase: are there anything else left, that you can but still didn't achieve so far?
 
I'll never get Tenacious or Unsung Hero; I'd need another 1000 answers stuck at 0 or something.
I have no Booster or Publicist badges.
Those can still be achieved.
 
@MartijnPieters so there's no excitement left for you, isn't there?
oh and what about: you should create your own very esoteric language -- ask 1000 questions about it -- which will no one know the answer of, then collect those badges too, and then delete the 1000 questions.. or won't it work like that? ;)
 
1:51 PM
yo, say i have a list with undistincted values, how can I get the value with the maximum occurance ?

datlist = ['foo', 'foo', 'bar', 'foo']
most_frequent_value = most_frequent(datlist); // return 'foo'
 
@Peter, Hey, you're giving away my secret Kevinscript plan ;-)
 
@Kevin :):)
 
@Oddant collections.Counter
 
@Oddant The collections.Counter has a most_common method, or something to that effect
 
1:51 PM
thanks fellows, so helpful
 
So do we have a "floats are not exact" dupe target?
I even remember a Meta post about it
 
Usually we just link to the off-site "what every programmer should know about floating point numbers" page
If you squint your brain, you could vote to close as "too broad", since the explanation is long enough to require its own site.
 
I hate that page. It's way too much information for what should be a very simple answer.
 
@PeterVaro I make my own entertainment. :-)
 
It would be a bit tricky to make a canonical answer for the question since sometimes the best solution is language-specific ("Use Fraction") or domain-specific ("store money values as integer cents, not float dollars")
 
2:06 PM
For reference, this was linked to in the comments
But maybe we should write something up for Python specifically
with Decimal and such
 
the "why it happens" is pretty well covered, but it might be nice to have a "how to avoid it" post.
 
Plus there's this with Martijn's answer on it
 
what if i write :

import collections
import collections

?
is the interpretor gonna be dumb and import twice ?
 
nope
 
because I have several functions that use an object in collections
but only one function can be called in a runtime
so i want to import when it's needed
is it a good practice to import at the start of functions ?
 
2:22 PM
It's good practice to import at the beginning of your code in general
So above all functions
 
It is acceptable to import inside a function, but I'm not sure what you want to optimize here.
 
@LevLevitsky alright
me too
 
It's a built-in module anyway.
So better import everything at the beginning, unless you have a good reason not to.
 
> imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.
-- PEP 8
 
ok i might be too pragmatic
it just sounded good to import when it is really required
 
2:25 PM
I'd rather import math at the top of a file only once, rather than import it a hundred times if I call a function that uses math a hundred times
 
and about importing twice: imported modules are cached
 
i have a module to create all my sprites which i can't import until i've instantiated the pygame screen which is annoying
 
@LevLevitsky good
 
are y'all carrots using 2.7 or 3.3+ and why?
 
3.4 and because I'm amazing.
 
2:27 PM
2.7 when I don't feel like parenthesizing my prints, 3.X when I want to use nonlocal
 
2.7 because i don't give a carrot
 
you are all using carrot wrong
 
3.4 for the new stuff (it is new and shiny anyway), 2.7 for the maintenance of the old projects
 
2.7 because I'm not sure enough about library support and unicode bugs to use 3 in production
 
And cabbage!
 
2:30 PM
cbg
 
cbg to u 2
and Nice I'm on 2.7 mostly
that is its the one that came with my machine
idk how much i've actually used it so far..
@davidism what kind of unicode bugs?
Quick google search says "resolve: not a bug"
in your experience what are the unicode bugs in python 3
jw. i'm not using python in production or anything. am a student
 
Well, any decent programmer is able to setup his environment the way that he is able to run 2.x scripts along with 3.x scripts anyway, so does it even matter? Or am I wrong?
 
Absolutely.
Lol I'm actually on 2.6.x rn
time to fix that
 
And with all the from __future__ imports my 2.x code looks like 3.x anyway :).
 
Oh that's what that module does
I just used it for the braces tbh
Can you use different shebangs in py scripts to use 2.x alongside 3.x without changing env?
that is if /usr/bin/python is either 2 or 3 it doesn't matter as long as you have the other installed somewhere.
 
2:38 PM
@ExoticBirdsMerchant cbg
 
@ExoticBirdsMerchant cbg!
 
allo people!!
:P
 
as well as his earlier writings on the subject
given that I work with flask, and he's the author of flask, I'm waiting until Armin's satisfied before I make the move
 
2:41 PM
cabbage everyone
can anyone recommend me a GUI library? I tried kivy and tkinter till now but i am looking for more options to try and choose accordingly
 
@Apoorv PyQt / PySide.
 
@Fenikso it is one library with 2 names or those are different ?
 
they are different wrappers around QT
 
@Apoorv I am long term fan of wxPython, but today I would recommend the above two.
 
@Apoorv What kind of project?
 
2:45 PM
Looks like this room is extremely popular now :) What's the reason?
 
@mamasi i want to heavily theme my application
 
@Apoorv They are 99% similar as @davidism noted, the main differences are that PySide has more benevolent license and is a bit lacking behind on development.
 
anyone have a horrific code sample I can throw on the left for him to be pointing at? :D
 
Melon everyone, seems like i will try pyQt for now
 
2:48 PM
@Daи Oh, I have seen some really creepy ones, but noone would believe that THAT was really written and meant to be used.
 
If I was on my other computer, I could link to the "Code that makes you laugh (or cry)" thread on Something Awful.
 
@Daи my answer to the guy who asked "how compare 2 string":
yesterday, by davidism
import re

dd = '3,4,5,6,7,8,9'
ss = '4,5,6,9'

ddd = (int(x) for x in set(dd).difference(','))
sss = map(int, re.split(r',', ss))

zyzyx = tuple(set(ddd).difference(iter(sss)))
print(zyzyx)
 
Like C# code meant to do string with number aka "1" conversion to int. It worked up to 15 only, I think you have the idea.
 
@davidism bahahaha
 
also, i wanted to know is there something wrong with python 3 ? many people seem to hate it
 
2:50 PM
@Apoorv it's slower than Python 2
 
The main complaint is, "my favorite third party library hasn't migrated to Python 3 yet"
 
Those people are idiots anyway :P
 
Which is a chicken and egg problem because library maintainers say "I won't migrate because most of my users are still using Python 2"
 
@Apoorv Nope, there is nothing wrong with it. Apart from some old libraries not converted to Python 3.
 
@frostnational That depends.
Python 3.0 - 3.2 were indeed slower across the board.
3.3 and 3.4 are a lot faster.
 
2:52 PM
@MartijnPieters that's interesting, where can I read about it?
 
so basically it is due to libraries and not the language itself
 
@Apoorv yes
 
@frostnational ok
 
@Apoorv yep
 
@Apoorv Correct. And also some lazy people hate to write print() where they could write print before :).
 
2:53 PM
@Fenikso i will be one of those :P
 
Same
 
@frostnational This talk has benchmarks: speakerdeck.com/pyconslides/…
3.3 is on par with 2.7.
 
Cabbage guys
 
just wait until pypy3 is stable, problem solved
 
But you get less memory use when using Unicode strings, and a whole lotta features extra.
@davidism Depends on what you are doing.
 
2:55 PM
I'm having the following error when I try to import Kivy
>>> from kivy.app import App
[INFO              ] Kivy v1.8.0
[INFO              ] [Logger      ] Record log in /home/alan/.kivy/logs/kivy_14-06-27_1.txt
[INFO              ] [Factory     ] 157 symbols loaded
[DEBUG             ] [Cache       ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG             ] [Cache       ] register <kv.image> with limit=None, timeout=60s
[DEBUG             ] [Cache       ] register <kv.atlas> with limit=None, timeout=Nones
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_pygame, img_pil, img_gif
 
For long-running servers, sure, PyPy is something to consider
for one-off scripts, PyPy is dog slow. :-)
 
Is that an error in the first place?
 
There doesn't appear to be an error there, just "infos" and "debugs"
 
yeah, I wasn't being very serious
 
So, I don't need to worry about anything then? @Kevin
 
2:56 PM
@Ufoguy nope
 
I don't know anything about Kivy, but it's not unprecedented for a module to print something when you import it
 
BTW: Can someone sell me on Kivy? I seem not to get it. I mean the philosophy, usage, advantages etc.
 
@Ufoguy cbg!
 
CBG @Daи
 
@Fenikso same here.
 
2:59 PM
Crossplatform
is the word
 
Kivy is cool because its name is very pointy. No round edges here.
 
depends on how you write it
 
Kivy apps run on almost all devices including android and IOS
 
my y is round when I write it
 
3:00 PM
@davidism Not with python
 
@MartijnPieters thanks, now I love Py3k even more :)
 
i forgot to mention that i also tried PyGI. Any reviews ?
 
@Ufoguy How exactly can I develop Kivy application in Python on PC and then deploy it as APK on Android? Is there a tutorial of sorts?
 
what does the dirname dist/ mean? I see it a lot. Does it bear special meaning?
 
3:04 PM
@Crow it's cursed.
 
@Ufoguy Thanks I will have a look.
 
I want cursed code!
 
@Crow it stands for distrust, because the developers were paranoid
 
My guess is "distribution"
 
for real, it's the folder that build results are put into when using setup.py
 
3:07 PM
Guys i cannot understand the logic of this list comprehension: l for l in item[ "links" ] if l[ "rel" ] == "enclosure" why it starts with l? shouldnt it start with a function or something?
(i've done tuts in list comprehensions)
 
Not necessarily. The start of a list comprehension can be any expression, for example nothing more than a single variable name.
 
it's saying take every l, where the 'rel' value is 'enclosure'
 
take every l leter in links if the rel equals to enclosure
 
where did you get letter from?
 
3:09 PM
it's saying take every link from the item that is an enclosure
 
i have written the module also
 
no, I mean why do you think it's taking letters?
 
it just seemed so strange to me
l for l....
 
well now you know it's completely normal
 
That's the usual way of writing a filter
 
3:10 PM
well l for l in item[...
i've seen some examples but are of the sort: Function_here for l in item[..... do you know any example where that kind of filter is explained?
i just cannot fully grasp the underpinning of writting like this a filter
 
DSM
Cabbage, all.
 
the left hand side can be any expression, including a function
 
so l for l just does nothing right ?
 
DSM
I decided to add a percentage incomplete announcement to a code I'm working on, to motivate me to finish it. Unfortunately
 
3:12 PM
#this:
x = [Expression_A for item in Expression_B if Expression_C]

#is equivalent to this:
x = []
for item in Expression_B:
    if Expression_C:
        x.append(Expression_A)
 
DSM
[main :39] of 62 processes, 61 were null (0.983871)
seems to be having the opposite effect..
 
oh kev i need to write and test this one brb
 
@ExoticBirdsMerchant This l for l basically means take the element as is. You can do whatever you want wuth l on the left. And nothing is also acceptable.
 
ohhhhhh take the element as is
i will put that instruction into the module
 
@ExoticBirdsMerchant the if part is a key here.
So it takes some elements, but leaves them as they are.
 
3:14 PM
it's a control flow ... in't it
aaaaaa
l first one leave them as is....otherwise there would be a function there
 
This must be a real common SQLAlchemy question but my searches are only turning up slightly different cases. dpaste.de/1CLa#L, how do I get this relationship to be symmetric?
 
@ExoticBirdsMerchant sorry for the self-promotion
check out other answers too
 
@frostnational thanks :P
 
DSM
@frostnational: clever use of bold there.
 
@kevin you have to predefine Expression_B
that makes sense
 
3:20 PM
@grayshirt so you want the single relationship to contain neighbors set in either direction?
 
yeah, if texas neighbors oklahoma, then oklahoma should neighbor texas
 
well you could acheive that by having a neighbors_left relationship with a backref=neighbors_right
 
@DSM thanks :)
 
but I'm not sure how to combine them
probably a third relationship involving a union
 
I found a bunch of stuff about the concept of "adjacency list", which taken literally is a pretty spot-on description of what I want to do, but all the examples I see make the relationship directional or hierarchial -- parent to child, etc.
 
3:24 PM
cbg
 
DSM
You never care about the difference between "time since" and "duration of" until an agent migrates out of your simulation and becomes immortal.
 
Ugh, is Moriarty out of the holodeck again? What a pain.
Why do the senior officers even like the sherlock simulation anyway? Can't they just do sexytimes.sim like everyone else?
 
DSM
.. that went in a direction I wasn't expecting.
 
I looked up "escaping from the simulation" in my pop culture database, and it was a 50-50 shot between The Matrix and Star Trek.
 
DSM
3:38 PM
Yeah, that seems about right.
 
DSM
Cabbage (this message sponsored by the Society Against Abbreviations, also known as the Society Against Abbreviations.)
7
 
guys thanks i seem to have grasped this!!!
 
@DSM SAA FTW!
 
DSM
@LevLevitsky: you scored the trey. Nice. :^)
 
3:40 PM
@JonClements cbg :)
 
damn i have to take my car and drive 6 miles to the theatre in 20min!!! in two days i play Lysistrata!!! cbg see you in about ~5hrs
 
@ExoticBirdsMerchant rbrb
 
Cabbage
 
DSM
Is there a site where people do volunteer to write trivial code to spec? It's sufficiently unpopular around here that sometimes people downvote the answers, but a question like this would take me about a minute, modulo typos.
 
@DSM I've heard rumours about this thing called the internet - that might be useful :)
 
3:49 PM
If anyone's done any work with PySDL at all, it would be cool if someone could help me with my installation. I
I've done the "python setup.py build', and 'python setup.py install' commands. And nothing goes wrong there. But I keep getting an error whenever I try to use any of the sdl modules that states: "no module named sdl2.util'
 
I was going to snarkily link to the first google result for "no module named sdl2.util". Then I noticed that it links to a post written by you.
 
I've googled around and there's nothing. I posted on SO, and got a comment that said to put a downloadble dll into my sys32 folder, (It's from the SDL2 website), but nothing changed. I'm just out of ideas. Wondered if anyone had tried it before
Yeah, I did post something yesterday!
 
Yeah, that answerer was off base. adding a dll won't make a module magically appear
 
weird.
 
Maybe the sdl module exists, but not in the python lib directory. Maybe the installer updated the module search path, but it hasn't kicked in yet. maybe rebooting will refresh the search path.
Have you tried turning it off and on again?
 
3:56 PM
I've rebooted since yesterday, but I can do it again
I'll just do it now...
brb
Alright, rebooted. .
 
user559633
 
user559633
thanks me, you're SOOOOOO helpful with your virtual machine names.. i toooootally know which one does what
 
Unfortunately nothing has changed. Same error's as before.
 
DSM
@tristan: this is why you need to be more specific. Use the full name, e.g. instead of "dog", say "Canis lupus familiaris".
 
@tristan where is the fox? And what does the fox say about it?
 
user559633
4:00 PM
@DSM that is exactly what I meant.
 
user559633
@JonClements the sad part is that i'm going to delete those running VMs and replace it with "fox" now
 
user559633
and in two weeks, i'll be like "ARGH why am i such a jerk"
 
What is this one trying to do!? :)
 
DSM
Future you is right.
@JonClements:"returning confusion" seems apt.
 
user559633
pig is there because it uses 4gb of memory and is my devbox for my company's public assets + linux python env
 
DSM
4:03 PM
Sus scrofa domesticus. That way it'll be easy to remember how much memory it has.
 
user559633
If I had to guess, I'd suggest that one is russian
 
@tristan I'd have assumed pig to be google.co.uk/…
 
user559633
wild piggie
 
user559633
haha, cmon @JonClements you know that i don't adhere to the pattern of least surprise! i live in a country that has a Department of Justice, and Homeland Security
 
But then living in a country that has the Ministries of Peace, Truth and Love :)
 
4:05 PM
aargh, so close to (more) gold badges on Meta.
Always with the falling just short..
It is a burden I have to carry.
 
@Martijn I don't care if I don't get any badges on meta again... I beat you to a first gold badge - my job is done! :)
 
@JonClements :-P
My point exactly!
 
..but when i called it like somefunction(1) it throws me error — user3783784 14 secs ago
sighs - I could see that coming a mile off :)
 
user559633
we should pay for TV spots for @MartijnPieters. "this sparkly-pants'ed man can barely afford the gold badges on internet website meta stackoverflow.. but, for 3 upvotes a day, you can make a difference cut to panning shot of @MartijnPieters frowning and then looking down and away, slow fade to man with tan khakis walking down a dirt path with scraggly weeds and dilapidated wooden huts to the side, pack of vaguely ethnic children run quickly to get in place, the follow slowly behind the man
 
user559633
(i would have kept going, but stackoverflow hates my martijn pieters fanfiction)
 
4:12 PM
@JonClements Glad I passed that one by.
 
user559633
room stunned in silence as they wonder how to get @tristan the help he so clearly needs
 
@tristan What?! What dark magics are keeping you from writing more such wonderful art!?
 
user559633
There's a word limit for SO chat messages: "This message is too long."
 
I'd go with something simple like: "Don't like decapitation? Vote Martijn"
 
user559633
"Martijn, the moderator doesn't sell drugs to children"
 
4:18 PM
@JonClements With a nice closeup of a katana
So, you think blood dripping of the point is too gruesome?
 
Nah... should be okay...
"This was Steve. He didn't vote for Martijn. This is Steve now. There's Steve's head. Remember - a vote for Martijn is a vote for life!"
 
Maybe I should retry using the ' make install ' command given in the directions as an alternative to python setup.py build
 
Oh, I wants some versions with Shuriken too. In the back of the head!
 
Warning: Python environment path not set
what . .
 
Butters didn't vote for Martijn -- make sure you do!
 
4:26 PM
Screw you pysdl
I give up
 
Guys, quick question. Have you ever used binary in your jobs, or were you ever asked about it in an in interview?
 
DSM
Yes to #1, in fact just the other day, to do some bitpacking of categorical quantities when memory was an issue.
 
binary tree yes, binary numbers no
 
@Kevin @DSM Cheers.
 
@Iplodman Yes to both.
 
4:29 PM
@MartijnPieters Wherewas it used/How so?
 
Use to have fuzzy matching software that assigned a 3 byte, and 2x1 byte keys to records
 
Image format handling (extracting the width and height).
 
@MartijnPieters Ah, thank you.
 
And in an interview, detecting and repairing UTF-8 corruption.
 
Oooh, fancy.
 
4:30 PM
And many, many, many more binary data handling throughout my 20 years of coding.
 
@Iplodman Job yes, interview no. It seems like a very good interview subject though.
 
user559633
@Iplodman yes, to both, used to speed up some operations.
 
In my GSCE course we have to add binary numbers, so I'm wondering if adding binary numbers is ever coming into play.
Actually, to paraphrase my earlier question, have you ever had to add binary numbers?
 
Adding in binary is the simplest case of handling overflow in addition in general. It makes sense.
 
Something about columns, and stuff, right?
So 00001 is 1, right?
Something like that.
 
4:33 PM
I had to make a binary adder out of transistors in college. fun stuff.
binary is important if you ever want to know what chmod 777 does
 
@Kevin Can you give me a basic run-down?
 
Binary addition was part of microprocessor design personally. It doesn't matter if you never use it. It's kind of like learning the newton method for approximating roots.
 
7 in binary is 111. each bit corresponds to a particular right to read/write/execute a file. chmod 777 means "give read/write/execute rights to everybody"
 
BAI all! Weekend tidings
 
@Ian :)
 
4:39 PM
Cheers all.
 
4:53 PM
maybe someday I'll learn how to program.
 
@Crow anything's possible :p
 
Dear friends, I will be on vacation next week, so my attendance here may drop. Please do not burn down the room in my absence.
4
 
Can we flood it?
multiprocessing.Pool party!
 
I don't remember seeing a holiday request form in my intray @Kevin :)
 
Sure. It will all drain away eventually, owing to the miles and miles of subterranean catacombs connected via secret passages from the room.
 

« first day (1350 days earlier)      last day (3602 days later) »