« first day (1643 days earlier)      last day (3295 days later) » 

2:00 PM
Reminds me of this
 
user559633
amazing. that dog was born to be in a black metal band
 
he's probably really good at growling, he can be the singer
 
Found this odd
>>> "{0:.2f}".format(30.005)
'30.00'
 
user559633
2:18 PM
I find that odd too. I'd expect 5 to ceiling and not floor
 
@IanClark I think it rounds it
>>> round(0.005)
0.0
 
user559633
Yeah, it does do a rounding.
 
@thefourtheye Yeh, sorry - should have been more explicit, the direction of rounding surprised me
 
user559633
Oh, is it floating point?
 
yah
 
2:21 PM
Could this be one of those times where 0.005 is internally represented as 0.004999999999999?
 
user559633
Exactly. This would have bit me too, I hate to admit.
 
@tristan Doc says
> For the built-in types supporting round(), values are rounded to the closest multiple of 10 to the power minus ndigits; if two multiples are equally close, rounding is done toward the even choice (so, for example, both round(0.5) and round(-0.5) are 0, and round(1.5) is 2). The return value is an integer if called with one argument, otherwise of the same type as number.
 
Bloody hell. Just had a 20 minute phone call with a recruiter. It got to the point that I had to say "Okay I'm going now as it's going on too long"
 
>>> import decimal
>>> decimal.Decimal(30.005)
Decimal('30.004999999999999005240169935859739780426025390625')
 
She wanted to ask me every single detail from every single thing I've ever done.
 
2:21 PM
@thefourtheye did you see my python script?
 
@Ffisegydd vultures :D
 
user559633
@Ffisegydd that's absurd, but she might have been filling in fields in her recruiting CRM
 
@AvinashRaj No da.. Which one?
 
>>> round(30.005, 2)
30.010000000000002
 
She was following a script, and hadn't read my CV at all.
 
user559633
2:22 PM
Probably wanted to make sure she could call you for a ton of open slots so she could get paid.
 
She was shocked when I mentioned that I'd just done a PhD.
 
user559633
Oh, then she's useless and I would have ended the call
 
Likewise, 30.01 can't be exactly represented internally.
If you can't express your number as the sum of a finite number of powers of two, you're gonna have a bad time.
 
user559633
@thefourtheye Cheers, yeah, I went and read that. I fully understand why nearest even (avoidance of other floating issues?)
 
Wat - "rounding is done toward the even choice"
 
2:24 PM
Wait, that is Python 3.x behaviour
 
In Python 2.x Docs ,
 
user559633
 
> if two multiples are equally close, rounding is done away from 0 (so, for example, round(0.5) is 1.0 and round(-0.5) is -1.0).
 
user559633
Huh.
 
2:26 PM
So round(2.5) has a different effect depending on version. I'll have to keep that in mind for the next "How do I tell what Python version I'm using?" SO question. "It's easy, just do major_version = 5-round(2.5)"
 
user559633
Why would this be changed in python3 to do the even choice?
 
@AvinashRaj Cool :-)
 
Wild guess: it's more efficient this way
 
training intern is hard :\
 
May I suggest a rolled-up newspaper
 
2:28 PM
19
A: Rounding error in Python with non-odd number?

Sven MarnachPython 3.x, in contrast to Python 2.x, uses Banker's rounding for the round() function. This is the documented behaviour: [I]f two multiples are equally close, rounding is done toward the even choice (so, for example, both round(0.5) and round(-0.5) are 0, and round(1.5) is 2). Since float...

 
that worked to get him out of the habit of chewing up the books and pooping on the carpet, but probably won't work for teaching JavaScript
 
Oh there's good reason for the even choice. It stops bias. This came up at work not too long ago.

Or at least I think it does, let me do some mathcraft.
 
user559633
Huh. I wonder why they switched to it though
 
DSM
Morning cabbage.
 
Consider a method avg(a, b) which finds the average of a and b, rounded to the nearest integer (2 decimal places is more realistic, but this is easier)
 
2:31 PM
@IanClark My opinion of third party recruitment companies is such that I cannot express it in a public forum.
 
user559633
@Ffisegydd What, that they're overpaid leeches on the tech industry?
 
@Ffisegydd lol - I really struggle to put up with the ones that also clearly have no understanding of the tech or your skills, and they're like ".NET stack with MS SQL - sounds like you, no?" "...no"
 
They're a bunch of <REDACTED> money-grabbing <REDACTED> who haven't got a <REDACTED> clue what they're talking about tech-wise and would sell you their Grandmother's <REDACTED> for the chance to swindle some company out of some money.
 
Then avg(1, 2) is 2. avg(2, 3) is 3. avg(3, 4) is 4, &ct. There's an upwards bias here. So if you were to add up the results you get weird properties.

If you use python 3 rounding, you end up with
avg(1,2) = 2. avg(2, 3)=2. avg(3,4)=4.

It's weird, but it more closely approximates the idea that a + b = 2xavg(a,b)
 
DSM
@QuestionC: why doesn't next do what you want in your question?
 
2:34 PM
@DSM Because the programmer in question doesn't really understand next? I'm a noob.
 
@thefourtheye Thanks na. I'm at the beginning stage in jquery.
 
The point of that program is to learn python better.
 
@Ffisegydd tell us all about it
 
user559633
@Ffisegydd Yeah, that's approximately my thoughts as well. Also, the agencies have optimized their internal hires towards the notion that programmers are easily bullied or would cut their nose off for the chance to interact with a moderately attractive woman.
 
@AvinashRaj Two suggestions. 1. Don't mix print and print(..) 2. Use line breaks wherever you feel necessary. That will improve the readability
 
user559633
2:36 PM
@QuestionC The idea is that given a sample, the floating error is normalized?
 
I had a company who was very, very keen on hiring me (or anyone qualified) because their project was very behind (what a good sign). They offered me the job on a Thursday, and I agreed with the recruitment consultant that I would respond with a decision on the Monday.
Later that day, and twice the next day, the consultant tried to get in touch to get me to decide earlier.
As though that would make any difference.
 
@tristan I don't know what normalize means in this context, so maybe?
I like to imagine that the python 3 rounding change was motivated by the plot of Office Space.
 
I love it when they say "Okay yeah we'll put your CV forward" then you never hear from them again. Ever.
If they'd have been fair about it and took the time to contact me, I'd have been more willing to work with them in the future.
Now, if they came to me again, I'd find the name of the company then just apply myself. Which I should do always really.
Unless reasons.
 
user559633
@Ffisegydd if you haven't signed anything, and the law works like it does here in the states, you should abuse those recruiting firms to get salary and benefit details, then sidestep the agency and ask for 5-10% more from the actual company
 
user559633
only potential for that to backfire is if the company has entered an agreement with the recruiting firm and all candidates flow through the recruiting firm anyway
 
2:41 PM
Yeah
 
user559633
(or the hiring manager has a buddy at the recruiting firm (you don't want to work in one of these places anyway))
 
Or the recruiting firm finds out and triggers provisions in some other agreement they have with the company
 
user559633
But that last bit is up to the company.
 
user559633
I used to manipulate details out of aggressive/shady recruiting firms and then offer targeted consulting services to the companies directly.
 
Oh if it's consulting that's different
Probably
 
2:44 PM
It's easier to do that when you have a job already, so something to bear in mind for the future.
 
I haven't tried consulting directly as I'm too worried that I won't set up pension etc correctly.
 
@thefourtheye please edit the script na.
 
@AvinashRaj I can? o.O How?
 
DSM
@QuestionC: yeah, next returns the next object yielded by an iterator. So if you write a genexp which gives only the ones you want, something like
>>> next(p for i in reversed(range(10)) for p in map(intify, pandigitals(i)) if is_prime(p))
7652413
 
ohh, i forget that. Since i create the script in sublime, it doesn't create any problems..
 
DSM
2:49 PM
Then you should be able to get what you want. (I haven't looked at your logic to see whether I agree the first one will be the biggest, or whatever, because I'm not sure what conditions apply.)
 
user559633
@RobertGrant for consulting, i'd just wait and pay myself once every quarter after paying estimated taxes/other obligations
 
I've very much been enjoying map(int, my_list) when my_list is an integer list from a textual source. Obvious, but very nice.
@tristan yeah, but now you're moving overseas do you have some interesting tax times ahead?
 
user559633
@RobertGrant it will literally be the worst
 
2:52 PM
After 6 years, Co-Op finally releases a new episode.
 
Sounds like Gabe just won a bet.
 
user559633
I don't know what Co-Op is
 
@thefourtheye edited na. Please check that.
 
Four guys from EGM made a video company, and had a podcast about videogames.
 
@DSM Yea, has to be biggest, order matters. Copy-paste that as an answer and you'll at least get an upvote =)
 
2:53 PM
It was on Revision3 when that was still relevant.
 
user559633
I don't know what revision3 is, but I'm watching that video and I appreciate you sharing
 
Diggnation? The Totally Rad Show?
Revision3 was created after TechTV went bad, by a bunch of the guys from the good old shows like The Screensavers.
 
@tristan I had nice hassles with HMRC, and eventually, because I didn't want to permanently leave the UK in terms of tax etc, just employed an accountant in the UK who sorts it out for me. About 100GBP/year.
 
user559633
@davidism Don't know any of those. Into this video though -- getting exposure to new things
 
user559633
@RobertGrant that's a good deal. my plan is to come back and forth from the US and only establish citizenship when I'm near done paying off my apartment -- then I can let my income drop to almost nothing while I hack on passion projects
 
2:58 PM
Nice
How's the sekrit project coming?
 
Fun fact: I was on the backstage of The Screensavers when I was a wee lad.
 
They had a Tux penguin in an automatic potato peeler, where the potato usually goes.
 
user559633
@RobertGrant Haven't worked on it in a month. Feel terrible about myself :)
 
I was at a live Diggnation episode in the front row, I was on camera for a couple seconds during a pan across the seats.
 
3:00 PM
@AvinashRaj better da :)
 
@tristan I have a tool for architects etc to keep track of building projects languishing on heroku. I know the feeling :)
 
@tristan I highly recommend their previous seasons as well, even though the games are old now: youtube.com/user/area5media/…
 
I think Hacker News changed their HTML layout... None of my userscripts for the site are working.
Man, now I have to do maintenance work :-(
 
user559633
@RobertGrant Yeah, I have tickets for work that needs to be done and it's down to a slight re-skin, a little DB work, some unicode stuff (site is translated to a handful of languages), and some elasticsearch stuff. It's just about peeling away 10 hours a week to sit down and actually do it.
 
They like to keep you on your toes. Constant vigilance!
 
user559633
3:02 PM
@davidism bookmarked
 
changelog: changed class of story links from story to Story, just to mess with Kevin.
 
@tristan that's cool. Get to it!
 
user559633
i also have an exquisite corpse video game to finish (caution: kind of nsfw surrealist drawing on page)
 
user559633
speaking of video games: ps4 is coming out with a 4k version at the end of the year, right?
 
Dunno
You'll be waiting 9 years for those textures to stream off Bluray, I know that.
 
user559633
3:06 PM
I heard that some exec at NetFlix accidentally let slip some inside information
 
wim
%&(*@#&%#(@
site is pissing me off
 
Got another phone interview tomorrow.
 
@Ffisegydd redirect that call to my number.
:)
 
For a data science role.
 
wim
</rant>
 
3:18 PM
@wim scratch that user to unaccept my answer.
unaccept my answer and accept wim's... — Avinash Raj 13 secs ago
:-)
cool, i don't care about accepting or upvotes..
 
How I wish I could step through userscripts with firebug :-(
No, it's fine, I'll just add a zillion console.log("This line is being executed") lines everywhere
 
user559633
there's not an interactive debugger for javascript?
 
The Firefox dev tools have step over, into, and out.
 
user559633
Would that not work for userscripts?
 
3:25 PM
@Kevin There are other ways to code? :P
 
@PM2Ring no, let me check.
 
wim
its funny we can't delete accepted answers
anyway it doesn't matter, it's maybe good to have an clear and shining example of the trap
I have done this before with calling set(L) in a list comprehension , ouch
 
Ah, a TextNode containing only whitespace, and so doesn't show up in some DOM explorers. We meet again, my eternal nemesis.
Breaking my brittle little node.parent.nextSibling.childNodes[1] chains, I see.
 
cbg
 
Question - I'm on triage flagging. Come across a question which is basically tech-support
What's the best flag for it?
(Ie, using VS2012, and it's crashing with this error code. Halp)
 
wim
3:30 PM
have u tried turning it off and on again
 
Ok, Firefox's devs tools get a point over firebug because it actually shows me the stack trace for crashing user scripts.
Instead of, well, nothing.
 
user559633
@IntrepidBrit link to question?
 
-1
Q: Adding a wsdl stops visual studio

Rex  Ji want to create a webservice client using C# in visual studio 2012, for a webservice written in java. but whenever i try to Add service reference, Visual studio stops working. and Windows show message box Microsoft Visual Studio 2012 has stopped working and View Problem Details says : Problem ...

 
user559633
question is too broad, so it's not one of those subtle "yeah, i guess that's related to programming"
 
user559633
that's just "thing happened, halp"
 
DSM
3:31 PM
It's not a great question because of reproducibility, but subject-wise it's on-topic.
 
@PM2Ring it's very very very very very simple using regex module.
 
Thanks folks. I couldn't decide between off-topic or too broad
 
but i don't know whether op loves a regex module based solutionor not.
 
@AvinashRaj Post it anyway. :)
 
user559633
 
3:35 PM
rhubarb
 
oh, i need to read the regex module doc.
 
@AvinashRaj you could be less pushy about them ...
 
Also you need to remove the comment after it is accepted ;)
Aargh! I made a statement Note that map is microscopically faster than a list comprehension and was asked for proof!!!
Thank god
 
3:52 PM
I think my awesome points/answers ratio stat is ruined :/
 
4:16 PM
@ZeroPiraeus i'll post the comment like these only, if 1, he post comments like "thanks it works" 2, And the op was new to this site .
 
Cabbage. I'm pretending to be a Python programmer again this morning, so thought I'd come hang out with the real ones.
 
@Avinash I also sometimes post a link to the "how to accept" page, but a bare "Accept if this helps" sounds like an instruction (from a high-rep user, which gives it even more force), and you use that exact wording a lot.
 
@WayneConrad I'm pretending to be a Ruby dev by deciding to switch to Python. ;-)
 
@BhargavRao You're not comparing fairly; switching the list comprehension to a compiled regex makes it win significantly on my test
morning cbg all
 
@ZeroPiraeus most of the time, i'll post comments like , "Since you're new to SO, i suggest you to read this how to accept an answer page"
 
4:25 PM
Yep, that's a lot better.
 
but sometimes, it's because of rush i did post like "Accept if this works".
 
"If one of the answers helped you, please consider accepting it." After a reasonable amount of time (more than a day) has passed.
Why are you rushing? What's the hurry?
 
@davidism You're even worse at pretending than I am ;)
 
@davidism +1 ... that's informative, and doesn't sound like you're hustling for an accept on your own answer.
 
@PM2Ring this regex101.com/r/dO6bK8/4 is the PCRE regex for that question. But regex module developers failed to implement this (*SKIP)(*F) and \K features.
 
4:30 PM
404 not found with Flask-PyMongo example code based on comments to answer, posted code doesn't actually describe the problem
(could have sworn I posted that second one already, but don't see it)
 
voted. I'm constantly astounded by how many people expect psychic debugging to work
 
Now entering "how did this code ever work?" mode...
while(curTarget != null){, followed by a loop where curTarget never changes
 
magic.gif
 
@tzaman Was just comparing orlp's method
 
@Kevin In my world that's a substate of "who wrote this noise?," often uttered when reading whatever I wrote last week.
 
4:41 PM
Same, except I wrote this last year
And it worked. For a year.
 
My code decays faster. It's eco-friendly.
10
 
@tzaman There you go! The secretive reason why I compiled it. If orlp, does the same, I'll gladly delete my answer. Ty — Bhargav Rao 13 mins ago
@tzaman
:D
 
@BhargavRao yeah, saw :) I'll drop a comment on his answer to suggest compilation
 
what's wrong with python packaging:
pypa
 
@tzaman Can we somehow remove that lambda from my answer, if so, it'll become super fast
 
4:44 PM
@BhargavRao yes
@BhargavRao methodcaller
 
Help @AnttiHaapala
Python coder in distress
 
>>> op.methodcaller('group')(42)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'int' object has no attribute 'group'
from operator import methodcaller
test though
 
yeah
just what I was going to suggest
map(methodcaller('group'),filter(None, map(pat.search,s)))
haven't timed it yet :)
 
though I do not like your solution since it is python 2 only :D
 
4:46 PM
anw the OPs code confuses "matches" with "contains" etc.
clearly the example iks about contains
for that you need to use fullmatch (python 3.4)
or a regex anchored to end$
with match
and the perfect answer should mention that
 
uff! The time has actually increased
I better leave that answer untouched
 
@BhargavRao and:
 
op edited the question.
 
you'd not actually use group()
that's just plain silly
 
How?
 
4:48 PM
instead you'd use the actual string which is there in match too
 
@davidism I often post such comments to the question instead of my answer too, to make it sound less pushy in my own favor.
 
@BhargavRao why wouldn't you use "map with or"
map(lambda s: pat.match(s) or foo)
but in any case it would probably lose anyhow
the accepted solution will be faster if you precomp the pattern
 
Since you are comparing the loop time, you shouldn’t just use a set with a length of 3.
 
and use m = pattern.match
and then drive against m(x)
in any case the map will be slower for this case...
 
Yeah
 
4:51 PM
@AnttiHaapala op edited the question with completely a different case as example.
 
How we deal with that.
 
Shall I click on delete
?
 
No, keep it.
 
4:52 PM
It’s still a good answer that does it differently.
Variety is good. Makes people stop copy/pasting everything blindly.
 
Yeah! Then I just leave the ques -Or- Think over how to improvise on it
2nd is the natural choice
:)
 
i'm ready to provide a solution for his update..
 
@BhargavRao anw in this case you'd return m.string instead of m.group() because it is about "strings that contain/match the regex"
 
Yep
I'll change it
 
@BhargavRao You're a wizard ;)
 
4:58 PM
>>> s = "a : <<a : b> c> : <a < a < b : b> : b> : b> : a"
>>> [i for i in regex.split(r'(<(?:(?R)|[^<>])*>)|\s*:\s*', s) if i]
['a', '<<a : b> c>', '<a < a < b : b> : b> : b>', 'a']
Oh, what happens?
i saw some floating text.
 
@Kevin You absolutely can.
 
My usual debugging procedure is: Open firebug, open "Script" tag, click dropdown list that contains the names of all script resources on the page, select whichever one has the code I want to debug, click on line of interest to establish breakpoint.
This procedure breaks down at "select whichever one" for user scripts, because the script is not listed in the dropdown.
(To be clear, when I say "user script" I mean, Greasemonkey scripts)
 
rhubarb
 
@DonkeyKong Lol! Why?
 
hrm, I know why I got the first 2 downvotes on this answer, but not sure why I needed to get a third downvote (converting an upvote to a downvote even).
 
5:12 PM
Ufff! That long an answer
 
@MartijnPieters The question
has too many
 
@Kevin Since userscripts run in the scope of the browser chome, you cannot debug them through the normal website-limited debugger. But you can debug them with the browser chrome tools.
 
line feeds
 
@BhargavRao That comment :P
 
@DSM: it goes to show that my combinators isn't too strong. I'm sure the answer does cover the bases now.
@WayneConrad edited already.
 
5:13 PM
why doth mongo torment me so?
 
In Firefox, goto about:config, enable devtools.chrome.enabled to get access to the browser console. Enable devtools.debugger.remote-enabled to turn the browser console into the browser toolbox. That’s essentially a full devtools environment connected to your browser chrome using remote debugging.
But be careful, chrome debugging can be a bitch.
 
why are the people who do not understand anything about packaging the people who always are doing the packaging tools :D
 
@MartijnPieters Much better. But I don't know why you got a third downvote.
 
Drive-by pile-on downvoters are the worst
 
@MartijnPieters The answer is perfect. I gues you gotta leave ur usual comment there!
 
5:16 PM
@BhargavRao it was incomplete the first time around.
 
@tzaman All the answers have dvs. So ur assumption is quite accurate!
 
@BhargavRao not all answers..
 
@MartijnPieters Then I guess u've gotta wait till they revert
Yep there is an up on 1 of them
So now we gotta look at the timeline
:)
 
Ok, I now see about a thousand .js and .jsm files, I guess that's an improvement...
 
DSM
@MartijnPieters: okay, that looks better. (Not that I was one of the downvotes-- I always comment instead -- but to be fair, it was wrong twice before being right. :-)
 
5:22 PM
@DonkeyKong By vks?
 
@poke That did it, thanks very much :-)
 
@BhargavRao Yessir. I was amused.
 
I was going to answer it, but the second google result for os.rmdir caught my eye... :-(
 
@DonkeyKong I entered this room after calling @poke as a stalwart. Today someone called me a wizard. Life's a circle!
 
5:37 PM
@DSM It was, as I said.
the third downvote came well after being right, which was surprising, that's all.
 
@davidism is there any good pattern for this many-to-many pattern in sqlalchemy
we're mirroring pypi metadata, and we want to codify the trove classifiers internally as integers, so we have int->name...
would love it to work so however that on insert, we'd have list of trove classifiers as text, instead of resolving each individually by hand
 
So you want to set and get strings in your code, but store integers?
 
yes...
or at least, when we get the data from PyPI, the troves are strings, and we'd get a new integer for any id that is not known to us yet...
 
@BhargavRao Pop quiz: what two-syllable word matching ^.*ar?$ are you? I call "bulwark".
 
5:43 PM
Ah, I was about to suggest just mapping them ahead of time, but that doesn't work for new classifiers.
 
hmm I guess the first example in association_proxy docs
is about this?
 
yep
Create a relationship to a Classifier model with an id and a name, create an association proxy to the name.
 
@ZeroPiraeus You make me search for words matchin that other than stalwart! :(
 
Just be sure that the model has some sort of unique cache so that you use the same object for the same name.
 
There is Steward!
\o/
 
5:45 PM
association_proxy('classifiers', 'name', creator=lambda x: Classifier.get_unique(name=x))
 
ahhh :D
the sqla-fu is strong in this one :D
 
Might be useful to set collection_class=set on the relationship as well.
Although that's not strictly necessary, SQLA will detect duplicate instances in the default list.
 
Actually Bulwark is indeed a good word. Have any of you heard of Rahul Dravid, nick-named as The Wall?
 
did i need the eq mixin too?
 
Only if you want to collect instances in a set.
Otherwise you end up getting different instances with the same data.
 
5:51 PM
@BhargavRao I figure it must be appropriate, because I often hear people saying "bulwarks" under their breath when I'm dispensing wisdom ...
 
> noun bul·wark \ˈbu̇l wərk, -ˌwȯrk; ˈbəl wərk; sense 3 also ˈbə-ˌläk\. : something that provides protection for or against something
:)
 
Rocky and Bulwarkle, I loved that show.
 
@davidism thanks :d
 
watermelon
btw, what is the :d emoticon? Thumbs up?
 
A lazy way of writing :D I guess
 
5:57 PM
I have always parsed it as "tongue extended and pointed upwards"
Conveying the message of "mm this meal is delicious" which admittedly doesn't make much sense in this context.
 
DSM
Delicious!
 
Mabe we're looking at it from the wrong angle. Maybe it's someone wearing an upside down ball cap.
(-:d
 

« first day (1643 days earlier)      last day (3295 days later) »