« first day (1648 days earlier)      last day (3300 days later) » 

DSM
3:00 PM
It's true! On the other hand, he was also right that most species look like humans in makeup.
 
@corvid ack?
 
@Martin ack indeed
 
Nice
 
Rbrb :)
 
cbg all
 
3:10 PM
cbg
 
@corvid Cool!
 
Cabbage
 
@davidism Cabbage :-)
 
DSM
End-of-morning-approaching cabbage for davidism.
 
@Kevin I was just leaving a comment in that answer :D
 
3:18 PM
Intermittent unexpected behaviour alert! (of code, not me, expect the unexpected where I'm concerned :D).
 
this one? I deleted my answer when I noticed that the OP was asking for more than just simultaneous iteration.
 
Grouping together continuous runs of similar words is harder.
 
Using SQLalchemy, matplotlib and pandas
 
Probably requires itertools.groupby.
 
3:19 PM
def plot_scatter_demo(connection):
    qstring = 'select spottime,generation, co2outputrate, co2intensity from "ENAPPSYS.CO2INST"'
    print("Submitting query " + qstring)
    df = pd.read_sql_query(qstring, connection, index_col='spottime')

    plt.figure()
    grps = df.groupby(lambda x : x.year)
    for year, group in grps:
        print "Histogramming..."
        plt.hist2d(group['generation'], group['co2intensity'], bins=100, cmap='jet', norm=LogNorm())
        plt.colorbar()
        print "And... relax... all done"
 
But OP will not understand groupby I guess :'(
 
This hangs on a particular group
 
@thefourtheye Maybe you are right, but it would still probably get some upvotes. Readers love itertools.
 
but, if I replace group['generation'] with [x for x in group['generation'] - all OK
Anyone seen that before
BTW - sorry for lump of code - thought it was shorter than that. Feel free to send it to the rotating knives or suggest I delete and I can dpaste it
 
DSM
Not every matplotlib function plays nicely with Series. Instead of using a listcomp you could always do group['generation'].values to drop down to the numpy array underlying a column.
 
3:20 PM
@JRichardSnape [x for x in group['generation']? Or [x for x in group['generation']]?
 
@Kevin The latter. How naughty of me. I'm on a run of mismatched brackets in here.
@DSM Nice - thank you. Funny that it works for the first two groups, but not the third though
 
DSM
BTW, using "jet" as the colormap is the visualization equivalent of writing something in Comic Sans. :-) It's not very popular, and for good reason..
 
@DSM confirmed values worked. jet will not be used for publication (if things get that far). TBH - I tend to avoid things that rely on Red - Green - Blue as they're not good for anyone colorblind. Can't remember why jet was in there in the first place. I tend to use intensity of a single colour where I can
 
@thefourtheye I went for the groupby solution. May as well :-)
 
DSM
Yeah, we have an R/G colour-blind guy on our team. He comes in handy to object "you can't be serious" regarding certain plots..
 
3:27 PM
When specifying types in function declaration, can I specify a class too? Like instead of def foo(something: object): can I do def foo(something: MyClass): ?
 
@Kevin You were right about the upvotes :D
 
Huzzah!
 
DSM
@Martin: sure, you can write whatever you like -- def foo(something: (MyClass, 2+3j) ) ->(1,2,'abc'): pass.
 
Anyhow - I might chase down why the straightforward passing the group to matplotlib works for some groups but hangs for others - but on the other hand, maybe life is too short...
 
Would you do this during a class declaration too?
Like if you are writing class MyClass you could do def foo(self: MyClass): ?
 
3:30 PM
@DSM The advice I recall is that color should never be the only cue. I had that hammered into me when working with two different B/G color-blink programmers.
 
Air
Do we have an election pool going?
 
@Martin I wouldn't bother typing self, it's implied that that has to be an instance of the class
 
Wait, R/G colorblind is a thing? I don't know much about colorblindness, but those are opposite ends on the color wheel.
 
DSM
One proposal we're putting in this week demands compliace to WCAG 2.0 level AA.
 
Chistmas must be so drab for him.
 
3:31 PM
Also note that adding type annotations does absolutely nothing to your code.
 
@QuestionC Sorry, I meant B/G.
 
I’m getting bad comments on my answer because I additionally included information besides the exact situation OP was asking about… what’s wrong with people?
 
The color wheel doesn't have a whole lot of basis in reality. Actual colors are arranged in a one-dimensional spectrum, after all. Regardless, R and G are still not very close together.
 
DSM
@QuestionC: yes, R/G is a thing.
 
Any io module experts that are familiar with Request feel like writing this guy a custom class? Or is there a simpler way?
 
Air
3:32 PM
I thought red-green is the most common one
 
@davidism Okay so like if I specify it should be class Whatever then someone passes another class in it Python interpreter won't care?
I'm doing it mostly for future devs though
 
@Air it is
 
right, the interpreter does nothing on its own with annotations
 
DSM
Annotations currently only exist for documentation purposes.
 
you can access them during runtime using inspect, but that's about it
 
3:33 PM
Good to know. I'll continue with it anyway for exactly what @DSM said - documentation
And for clarity for future devs
 
DSM
You could use a decorator to enforce them, I guess.
(By which I mean wrapping calls with a test.)
 
@davidism I think there i also a plan to add a decorator that checks them, but that is intended for testing only if I recall correctly
 
The idea is that a new tool like lint comes along that will analyze the annotations as a separate step.
 
@WayneConrad I reckon that's good advice. I've been told that too, both from people with color vision issues and people who've had their visualisations mangled from being forced into low res grayscale by publishers)
 
Check now please, sorry don't have an isntall to check it with — Matt Davidson 7 mins ago
 
DSM
3:35 PM
Lots of science journals charge extra if you want colour images in the printed version -- not that anyone really uses the printed versions anymore, but still.
 
@DSM Yep - that's why I'm careful with finished articles. Although, as you say, I haven't read a print journal for quite some time now.
 
From my exprience in painting little miniatures, I think the color wheel really does a good job defining which colors 'pop'. My eyes don't care about wavelenths afaik, it's all just cones.
 
@thefourtheye I saw that too. Unusual choice to answer a Python question at that exact moment, then.
 
DSM
I remember once someone was walking through her department's common room and thought she recognized a figure. Turns out one of the scribble plots Fizzy was so surprised by made the cover .-)
 
3:37 PM
Color theory is the nightmarish intersection of physics and biology.
4
 
@JRichardSnape Ya, he must be good.
 
DSM
@thefourtheye: there are plenty of online interpreters anyway, so if someone is really desperate to post but doesn't have an interpreter at hand, that's always an option.
 
@Kevin Seems so easy at first, but the problem NEVER. ENDS.
 
@DSM Yeah, I left a comment to him :-)
 
@Kevin I work in a print shop. The trouble we've seen with customers... "but I'm looking at the color you printed, and it doesn't match the PDF I sent you."
 
3:39 PM
Hey, how should we determine the perceptual difference between two colors? Pythagorean theorem? Nope, not accurate enough. Use this three page long equation.
 
Don't try to understand it. Be like Bob, just let the happy colors do their thing.
 
How do we convert from RGB to LAB color space? Depends, are we talking about monitors, paper, or textiles? And is it a thursday or full moon?
 
ExACTly
 
I worked at a print shop once, as well :-)
 
I have a performance problem in my 3D engine in python. When it loads small 3D Objects it handle it okay, around 500fps - 1000fps on my machine but when i load bigger 3D objects it could be like 10-20FPS. what should i do? :)
 
DSM
3:41 PM
Colours from Hell. (Which sounds vaguely Lovecraftian.)
 
@Emyen Don't load bigger objects
 
Reminds me of The Colour of Magic. The eponymous color, octarine, could only be perceived by wizards.
 
DSM
"Doctor, it hurts when I move my arm like this."
 
@Emyen Did you write this engine yourself?
 
3:42 PM
Yes.
 
You need space partitioning.
 
I use pygame for drawing and input and that thingy.
 
cbg
@JRichardSnape Aargh. Edit on the way
 
I second "space partitioning".
 
I don't think segregation is the way forwards guys
 
3:43 PM
The kind I am familiar with is:
In computer science, binary space partitioning (BSP) is a method for recursively subdividing a space into convex sets by hyperplanes. This subdivision gives rise to a representation of objects within the space by means of a tree data structure known as a BSP tree. Binary space partitioning was developed in the context of 3D computer graphics, where the structure of a BSP tree allows spatial information about the objects in a scene that is useful in rendering, such as their ordering from front-to-back with respect to a viewer at a given location, to be accessed rapidly. Other applications include...
 
Alls well now?
The edit makes it perfect
 
It's kind of a lot to explain, but the idea is that you split the space into smaller spaces, like a rubix cube is made of little cubes. .
 
IIRC, it's quite handy for knowing which polygons won't be visible by the camera, so you can ignore them
 
Is it sort of chunks?
 
Because rendering scales badly with number of polygons.
Yea.
 
3:44 PM
Aagh @Kevin, 9 votes!! I so wanna make it 10...
 
Readers. Love. Itertools.
 
So that you can bag 2 medals at once
 
@BhargavRao ✓
 
Hi guys, do you know about any online tutorials/PDF books .. to learn about OpenBR ? I did not find something apart from the official documentation in which there is not enough information either
 
Calling us gays?
It must be guys
 
3:45 PM
guys * sorry, English is not my mother tongue, i am sorry
 
@JRichardSnape Thanks
 
Hey [jolly people], ...
 
DSM
Unfortunately I've never heard of OpenBR until now..
 
@Nakkini You're not alone.
 
@Nakkini You can edit your comment there
 
3:46 PM
Rʜᴜʙᴀʀʙ
 
Googling OpenBR tutorials now
 
I second @DSM
 
@BhargavRao i did, thank you
 
DSM
On a typical day I think about one-third of our visitors don't speak English as their first language, and there have been times when there have only been one or two native speakers in the room.
 
3:47 PM
... Did they speak Klingon?
 
We all speak Salad, it binds us together as one community
 
RANDOM question: What's everyone's favourite "I'm going to troll you with a funny UTF character" character?
 
But could i also increase the performance speed with changing stuff in my code. Like use numpy arrays instead of lists?
 
@Emyen In my experience, the easiest way to space partition is called Binning. Basically you just evenly subdivide the 3d space. When you cast a ray, you just search each bin in the order the ray hits it.
 
@Emyen You could optimise it in many, many, many ways. But before you optimise anything, make sure you profile it
 
3:49 PM
@IntrepidBrit I'm partial to ◕ ◡ ◕ and ಠ_ಠ.
 
😸
My best
 
@BhargavRao SQUARE. Boring!
:P
 
Your browser sucks then! :P It is a smiling cat 😸
 
I use ☕ a lot. Not sure if that's trolling though
 
DSM
Yep, that's a cat.
 
3:51 PM
I like the double meaning of "square" there, meaning both "this just renders as a rectangle on my system" and "uncool"
 
Huh, if I use it in an URL, it's fine.
 
There's a "pile of poo" character, isn't there?
 
🐍 The famous snake!
Aaargh!
 
DSM
Okay, that one's a square for me.
 
3:52 PM
Snake? Snake? SNAAAAAAAAAAAAKEEEEEEEEEEEE?
NO. Not you Snape. Jeez
 
@Emyen Not really. Like, you might get a 10x speedup from switching to numpy, but 10x faster than mud is still mud. There's a complexity problem with 3d graphics that can only be fixed with space partitioning.
 
U+1F40D
 
My entire life was dominated* by snake snape references until Harry Potter came along, after which it is dominated* by professor snape refs
 
@IntrepidBrit badger badger badger badger badger badger badger badger mushroom mushroom
 
*not dominated
 
DSM
3:54 PM
Okay, I added ttf-ancient-fonts and now I see a snake!
 
@DSM Whats this --> 💩
 
A coiled up snake. Duh
 
DSM
@Bhargav: a sign of juvenile habits not yet overcome?
 
rbrb Guys. Gotta go home
 
:D
@thefourtheye So early?
 
DSM
3:56 PM
Rhubarb for thefourtheye.
 
@QuestionC But, i'm not really sure its the 3D space which is the problem. Because i am just loading one 3D object in 3D space. And the 3D object is list of mabye 10 000 vertices and mabye 6000 faces.
 
@BhargavRao ya friend is waiting
 
Rbrb then!
 
@Emyen Then make sure. Profile all the things. not trolling
I also must go! I am viewing a flat in Edinburgh, whilst crying on the inside because I could afford a really nice detached house by the coast for the same amount.
 
What do Profile all the things mean?
 
DSM
3:58 PM
And remember that numpy isn't a magic wand: it'll only speed things up when you can vectorize the operations.
 
459
Q: How can you profile a Python script?

Chris LawlorProject Euler and other coding contests often have a maximum time to run or people boast of how fast their particular solution runs. With python, sometimes the approaches are somewhat kludgey - i.e., adding timing code to __main__. What is a good way to profile how long a python program takes t...

 
@Emyen Pre-optimisation is the devil. Before you optimise something, make sure it needs to be optimised (profiling)
 
Thx
 
Use jiffyclub.github.io/snakeviz to analyze the profile after you make it.
 
Or use line_profiler
 
4:02 PM
I think it's really important to look at the complexity as the number of faces increases though. Like, how bad is it with 2000 faces, or 600 faces?
 
Interview done.
 
Congrats
 
@Ffisegydd how many is that now?
 
And it's absolutely roasting here
That's 2nd. Got one Thurs, mon, and phone interview some time next week
 
4:04 PM
I'm now sat waiting for a bus next to a KFC. Temptation, thy vile mistress.
 
@Ffisegydd Eat the Chicken
 
DSM
I know the feeling. I'm back on to a two days on, one day off gym schedule instead of my weekend-warrior habit, and resistance to the tasty can be tough..
 
I got fizzbuzzed (more like fizzybuzzed hur hur hur) in the interview
 
DSM
Heh. Did you laugh and say "Fizzbuzz, eh?"
 
I did in my head.
 
DSM
"Be more creative! I laugh at your problems!"
 
The interviewer, who was lovely, didn't know any python though so I couldn't one liner it
I knew I should have memorised Kevins version though!
 
DSM
SO slow for anyone else?
 
@DSM Yeah
 
4:12 PM
Rhubarb
:)
 
@Ffisegydd Job interview?
 
@Ffisegydd I don't know how I'd feel if an interviewer actually tried to get me to do Fizz Buzz.
 
It's a weird situation like... do you code golf it?
 
@davidism reckon I'd be a little .. erm .. disappointed shall we say
 
4:13 PM
exactly
 
I don't begrudge them for needing a way to detect people who lied about knowing how to code
 
any ideas if there's a preference for raise SomeException or raise SomeException() in the python community (in case there are no arguments)
personally i prefer it without () but with () it's a bit more consistent..
 
Right, but at least ask a different, equally easy question. At this point, Fizzbuzz is the punchline of a bad joke.
 
@ThiefMaster I like the latter, myself
 
@davidism it's a graduate scheme. You don't even necessarily need to be able to code.
It was more how I went about solving the problem.
 
4:17 PM
I think its great with FizzBuzz because then its more "fair" when the interviewer will choose the man for the job.
 
@ThiefMaster anecdotally, I've seen () more often
 
DSM
I understand the consistency argument, but TBH I never write the parentheses.
 
OTOH, a technically adept interviewer could probably figure out if you know how to code just through casual conversation.
 
If I'd been a non coder it would have been some non code task probably.
 
23
A: Is there a difference between raising an exception and exception()

Raymond HettingerThe short answer is that both raise MyException and raise MyException() do the same thing. This first form auto instantiates your exception. The relevant section from the docs says, "raise evaluates the first expression as the exception object. It must be either a subclass or an instance of Bas...

 
4:19 PM
Plus this was just the first interview. Second interview is a 2 hour interview with more technical details.
 
I've got access to how people are voting, but the resolution is a little fuzzy:
 
DSM
Heh.
 
@Ffisegyd How was the interview and did you got hard questions?
 
(credit to Travis J)
 
Freehand voting!
 
4:19 PM
Weirdly, in interviews for 4 month internships in quantitative finance, I got asked like 3 times what the runtime of Mergesort was. Only Mergesort.
 
DSM
Speaking of which, are we hosting a congratulations/condolences party?
 
Needs more red circles!
 
@MartijnPieters do you really have election data, or was that part of the joke?
I'm guessing the latter.
 
And @Emyen no the interview was great.
 
The second part of the interview is an essay question. You can choose between "How does LAMP work?" and "How does a lamp work?"
3
 
4:20 PM
@davidism what do you think?
 
I'd choose the latter.
 
Well, I already know the results, but I can't tell you yet.
 
DSM
I think I just failed the interview. :-(
 
For full credit, discuss the history of kerosene lamps and their contribution to coal miner labor unions.
 
DSM
"We dug coal together."
 
4:22 PM
Me and ol' lampy. wipes tear from grimy face.
 
For full credit of the former, sign an affidavit that php is better than python.
 
DSM
No job is worth your soul.
4
 
@Kevin Electricians would choose the second.
@Kevin Do you still work on KevinScript?
 
@Emyen No, Kevin is KevinScript. Its got sentient.
 
Yep, although I'm in the "dry spell" part of my development cycle. I expect to regain interest sometime between next week and August.
 
4:26 PM
You're a programmer. Why should we trust your estimate?
 
DSM
The languages of summer.
 
Depends on your definition of "work". Does he nurture it like a parent trying to raise a child? Most certainly.
 
I hate proxy servers and shit ...
 
@Kevin The next stage is the WET stage.
 
@Joran why?
 
4:27 PM
why am I helping someone else's IT department troubleshoot their proxy configs and firewalls to allow our software to talk to our registration server
 
@WayneConrad You really shouldn't.
 
@Joran Do you have time pressure?
 
> @Kevin The next stage is the WET stage.
@Kevin The next stage is the WET stage.
 
time pressure?
 
:-)
 
4:30 PM
Rhubarb all
 
I will have to write everything a second time, for my KSKS project, which implements KevinScript in KevinScript. That's a ways off, though.
 
DSM
What will the target be? Assembly? C? Python?
 
naw not really ... just gets annoying .... that we are helping their IT department communicate to our servers when 1000's of people connect all the time no problems
 
@Kevin My well of snappy comebacks just ran dry. Sorry. This has never happened before. No, no, it's not you.
 
It happens to lots of guys. pats you on the back
 
4:31 PM
its cause requests doesnt handle proxies quite right with lots of proxy configurations
 
Assembly(FASM) is hard 80 lines of code for things that would take 1 line in perl.
 
but i dont know enough about proxies to really do much about it ... nor reproduce it locally
 
@DSM Compiled KevinScript will compile down to C. But that's even farther away than KSKS.
 
@Kevin Are you going to make a compiler for it also?
 
As in, a compiler that outputs assembly? I don't know enough asm to even begin something like that.
 
4:34 PM
Write an LLVM frontend
 
@Kevin Is KevinScript dynamic?
 
After JKevinScript and KSKS and Compiled KevinScript, anything is possible
 
Hehe It should be a tutorial for learning how to understand the Assembler(FASM) docs.
 
@matsjoyce Yeah. Dynamic duck typing, like its daddy Python
 
@Kevin I don't think the BDFL agrees with your modifications:
>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance
>>>
 
4:37 PM
@Kevin You should make a IDE for it too. default IDE. That would be cool.
 
@matsjoyce The braces come from momma Javascript's side of the family :-)
 
Python + JS = KevinScript
 
Grandpa von Rossum will grumble, but it's alright, he grew up in a different time.
 
Is it going to include an embedded web stack?
 
It will do all things, and see all things. It will never grow old and never die.
 
4:42 PM
You make me want to BE Kevinscript.
 
The current implementation is only a rough outline of that which has always been here. It is the door, and bootstrapping is the key, to the gate that leads to the Other Side where It lies dreaming for strange aeons.
 
We need incense and tingly bells to go with that.
Where's a hippy when you need one?
 
In the forest, where there is unfortunately no Internet.
 
@Kevin Ah, no hacking and DDoS to worry about then. But no web framework.
 
Not unless you count the web of Life, man, the gossamer strands of spiritual energy that interconnect all of the beings of Nature 8-)
 
4:57 PM
Serious Talk : how do you pronounce SQL?
 
Air
"Ess Queue Ell"
 
Because it's something I've rarely heard spoken, and people always pronounce it differently to how I do in my head.
 
@Ffisegydd "Sequel" (trolling here to spite Air)
 
@Air yes! Finally!
The problem is I've heard a lot of people pronounce it sequel!
 
DSM
I say ess-queue-ell. But the database guy on our team says sequel.
 
Air
4:58 PM
Funny story: When I was hired by my current employer, as a student, I had never heard this "sequel" pronunciation
 
Ok so there's a distribution. I'm not the only one.
 
I think sequel but say ess-queue-ell
 
sea quill
 
Air
I had a first interview with supervisors, which was basically the deciding interview, and then a second "interview" with their management which was basically a meet-and-greet to get their okay
 
Squall.
 

« first day (1648 days earlier)      last day (3300 days later) »