« first day (1505 days earlier)      last day (3428 days later) » 

4:46 AM
Cbg all
 
 
4 hours later…
8:52 AM
Cbg
 
9:04 AM
........(cbg)
This should look like a tumbleweed
 
9:20 AM
I see. Well thanks for explaining that :p
 
:D
 
 
1 hour later…
10:55 AM
 
 
2 hours later…
12:28 PM
cbg
 
1:07 PM
Cabbage
 
cbg cbg
 
I want to go to bed again…
 
it's the weekend, do whatever you want \o/
 
Today I am cooking to cook brownies and a roast dinner.
In that order, but not eaten in that order.
 
1:22 PM
@Martijn you’re slacking off :P
 
1:37 PM
@poke You were doing such a great job, I thought I just sit back and relax and work on list comprehension answers instead.
 
Haha :D
Guess I’m done now, rewriting all of OP’s code… xD
 
hi everyone :)
 
@MarkF6 cbg
 
It’s another one of these “while I write my answer, Martin already posted his and earned three upvotes” situations… ;D
 
I've got a question: how can I assign colors to numbers? More concret, let's say my minimal value is -22 ; my maximum value is 46. I'd like to print objects with higher values green (46 should be green, 16 more green than red), and objects with lower values red. I know this works using colormap; but how exactly? I didn't get it yet :(
 
1:43 PM
Since you seem to have a discreet set of numbers, you could simply create a dictionary that maps each number to some color value. For example:
colors = { -22: 0xFF0000, -21: 0xEE1111, …, 46: 0x00FF00 }
 
hm yes, but I'd like to implement my code for a variable number of elements (values). Is this possible, too?
so, there could be much more than 2, 3 values; and the values can also vary...
 
You could automatically calculate those values too, you should probably use HSL values then. You could use a fixed S and L, and then just have a linear function that decides on the hue.
For example green is HSL(120, 100%, 50%), and red is HSL(0, 100%, 50%). So you would map -22 to a hue value of 0, and 46 to a hue value of 120.
 
Hm, I have absolutely no experience with that :/ could you please show me a little example how to use this? It would be ok just for 2, 3 values..
 
So for a number i (that’s between -22 and 46), you would get a hue value of (i + 22) * 120 / 68
General formula being (i - minIndex) * (maxValue - minValue) / (maxIndex - minIndex) + minValue
So that gives you the hue, combined with the fixed saturation and value values, you could use the colorsys module to get an RGB value if you need that.
 
2:06 PM
thanks a lot! I have to think a bit how I can implement this...I'll write later
 
Sure, you’re welcome :)
 
2:29 PM
cbg
 
Cabbage Jon
 
how goes it?
 
I’m trying to make a game.
 
Ooo... ears perk up what kind of game?
 
I played a simple card game with friends yesterday, and now I want to make it a digital card game :P
 
2:43 PM
phew - more straight-forward than the next Far Cry then :p
 
xD
 
3:03 PM
@JonClements have you tried cooking the HP's ButterBeer?
 
@Peter can't say I have...
 
Right now I'm visiting to shops, to buy all the ingredients ;)
it looks delicious
 
You had me thinking there... as HP is a brand name over here :)
 
@JonClements Harry Potter, you..
 
@Peter yeah... I got it... just threw me off for a moment: heinz.co.uk/en/Products/HP-Sauce
 
3:05 PM
@JonClements :)
I want to cook this for the christmas party, but I want to test it first..
so I'm going to do it today..
 
Should be interesting - let me know how it goes
 
/me is going to report back
 
@MartijnPieters yeah, I watched almost 20 recipes, since it is "fictional" it is very hard to decide which one is the "official one"
:)
but for what you have linked was the plan B
(I heard there is an official "two broomsticks" in the US, where they server "the official butterbeer", and people kept saying the huffintonpost's recipe is the closest one to that)
 
3:24 PM
Is there any advantage of using filter(function, iterable) over [item for item in iterable if function(item)]?
cbg!!
 
Not really, no.
 
thanks poke!
 
Except in 2.x filter will return the same type as a sequence
 
You mean as a generator instead of a list, right?
 
And if the function is a builtin, it can be faster... but for keeping 2.x/3.x compatibility, it's really not worth worrying about
 
3:32 PM
I was just working with some old code which had everything as list comprehensions... Was wondering if it would help replacing those with filters... Hmm... looks like not much of a use... thanks anyway!
 
Well, if you wanted to filter out vowels or something, then filter(set('aeiou').intersection, 'the quick brown fox') will a string without you having to do vowels = set('aeiou'); result = ''.join([ch for ch in 'the quick brown fox' if ch in vowels])
 
cbg one more
 
@Ffisegydd!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@rvraghav93 but ultimately - don't worry about it :)
 
Hmm... yea :)
 
4:16 PM
stackoverflow.com/questions/27203674/… "how do I make this look nicer" is opinion
 
@davidism They got their question cleaned up a bit; I think it is answerable.
E.g. it is no longer off topic, as they put the self argument back in.
 
ok, it's a little better now
 
5:03 PM
cbg all!
 
I'm currently creating an open source community website in Django and part of this has a page where people write tips/advice for things. I'm trying to figure out a good way of keeping track of revisions in case I need to roll back spam/vandalism/etc and I was thinking it might be a good idea to leverage an existing version control for this. Has anyone used something like git to do something like this? Good idea/ bad idea?
Oh and this information is stored as markdown which is rendered later, in case that's relevant.
 
I'd not go this route at all.
VCS systems deal with files on a filesystem, not records in a database.
 
I was hoping that you would comment. What do you think is a better approach?
 
Django works best with a database.
 
5:10 PM
ok
 
Stack Exchange just use a new revision for a post.
 
Oh so just store the whole new post?
 
So you have a post entry, and revision entries that store the actual post body.
 
ok awesome, I'll do that.
That actually sounds a lot easier come to think of it.
 
And I'd pre-render the markdown.
Store both the source and the rendered post.
 
5:11 PM
It is pre-rendered upon save to help reduce load on serving the pages.
 
Much faster to serve that way; the rendering is not going to change once the source has been saved.
 
Ok, thanks for the advice!
 
5:26 PM
@JonClements I bought all the ingredients -- and also bought Bertie Bott's Beans
have you ever tried those?
 
Nope - can't say I have
 
omg.. there are soap, vomit, rotten egg, sausage, earthworm, grass, bogger and earwax flavours
(ofc there are normal flavours as well)
it is just terrible :)
 
I am laughing on myself for the whole time traveling home
buying these candies.. and being sick of the rotten egg flavour
:)
I can only imagine the pain of the employee, who had to taste the flavour of the vomit and the rotten egg every time they've made a change
 
Had our department Christmas meal last night. The food was pretty awful. Just done our own roast beef dinner with the missus. Absolutely banging.
 
5:31 PM
yeah, but they were being paid to eat them, not paying to eat them :p
 
@JonClements how idiot I can be.. :)
 
@Ffisegydd sounds awesome. Not bothering with a roast day, got sweet chilli sausages, mash and beans for later
 
I can't remember the last time I cooked a roast. Probably 7 years ago.
 
@shuttle87 im making a note taking application and storing data in a db, i might have use for a revision system is it bsd?
 
@Ffisegydd I quite enjoy cooking a roast - but only bother when I have guests - otherwise, it's just really pointless for one
 
5:44 PM
I might start doing it in the future and keeping the beef for sandwiches.
If I get a big joint, I could get beef baps for lunch for a week.
 
Well, chicken's generally good as you can have a roast, then make a salad/sweet and sour from it, as well as some sarnies, then boil the rest to make soup
(well, stock for soup anyway, then throw in left over chicken and veg and stuff...)
 
Learned something new again.
Mac OS X 10.10 Yosemite required changes to Python.
 
Well, upvoted the Q and your A - that Q definitely deserves a few upvotes - that'll no doubt come in very useful for others later
 
bah, humbug.
Not sure why that was necessary.
@JonClements The same applies to 2.7, all the way up to 2.7.8.
2.7.9 needs releasing...
 
I thought 2.7.9 was out?
(last couple of days)
ahh, that's the rc1
nvm
 
5:55 PM
@Kevin Hmmm, is that you?
user image
5
 
@Arden Are you possibly wanting to reuse this?
 
@JonClements nvm, I was wrong, the fix is in 2.7.8.
 
ooo, but ensurepip is backported to 2.7.9 - that's sweet
 
@shuttle87 , reuse or extend, or help develop sure
 
Right now it's all very much integrated into an existing Django app. I could try to break it out into it's own project. I almost always go for GPL licenses though.
I think that breaking it out would be a good idea as it fits in with a few other project ideas I have.
I might get started on that today and put it up on github or something.
 
6:16 PM
I'm not sure how davidism is planning to manage the sopython wiki revision control. He may be able to suggest something.
We store the data in postgresql though.
 
@thefourtheye can't stop laughing..
 
6:35 PM
@shuttle87 i need bsd, just because i want to keep my options open. let me know what you decide
@Ffisegydd theoretically one could make it db independant quite easily no?
 
Well we use SQLAlchemy so the DB doesn't really matter.
 
license?
 
We need a canonical dupe target for if something != onething or something != anotherthing.
People don't understand boolean..
 
@Martijn surely there must be one on programmers.se?
 
@Arden I imagine I'd only want to make something that's a library thing like this under a GPL license. I don't have any issues with people making money off such a product or integrating it into their own product but I don't like the idea of people not pushing changes upstream.
Why exactly would you need this part of the code to be BSD?
 
6:55 PM
@JonClements Perhaps, but that won't let us close posts on SO.
basically a resource request:
 
@MartijnPieters I know... but it might be worth finding one as a "template" as it were
 
7:17 PM
Thoughts on this regex to match Python doc urls? regex101.com/r/gI7mJ5/3
 
7:42 PM
Argh it's not working 100%
It's matching fullstops at the end of sentences.
 
8:02 PM
There's an answer in that question with the bool misunderstanding stackoverflow.com/questions/27205611/strange-error-in-python3 that I'm curious about. Is there a performance/readability difference between if bus not in {"5", "6"}: and if bus not in ("5", "6"): that should lead me to use one form over another?
 
Sets are faster but you probably won't see any difference between a set of 2 and a 2-tuple.
 
ok
 
Added a python_docs_url function github.com/sopython/nidaba/commit/…. Whilst I understand that regex has its uses, and is powerful, I still hate it :P
 
8:35 PM
TIL spoken language is incredibly irritating to process
 
hi everybody, is there anyone which knows a bit the module "networkx" ?
 
 
2 hours later…
10:30 PM
Just ask Mark
 
is anyone here experienced with scrapy framework?
 
time to knock off. Cheers everyone!
Rhubarb from the ninja.
 
10:52 PM
Nevermind, solved stupid mistake. Was overwriting parse function and crawler was not following links
 
11:06 PM
can I append a number to a variable name like (number + i) would be number1 if i == 1
 
@shuttle87 my understanding was bsd was similar to gpl in the sense that you have to push changes upstream. I want to have the option to use a plugin without having the obligation of making my program open souce (which gpl does), mainly because i'm not sold on the opensource business model right now. I like open source alot and have started turning parts of my program into reusable open source api snippets. for one it helps me right better code but it also gives back to the community.
@shuttle87 had friends come over before sorry about the delay
@lramos15 what are you trying to acheive? Normally there is a better way, you would use the builtin eval function
 
dpaste.com/1E057F9 This keeps just freezing when run in terminal
When I do Ctrl+C it says it is stuck on the first if statement in EncodeNumber
@Arden I just got around it by using if statements.
 

« first day (1505 days earlier)      last day (3428 days later) »