« first day (1622 days earlier)      last day (3333 days later) » 

1:51 AM
Got it request.is_xhr
 
guess google doesn't have that much confidence in Chrome
 
2:06 AM
or that the need for more security updates is impressive
@corvid seriously, I had to explain to users that more security updates is not equal to more secure
 
 
3 hours later…
6:06 AM
cbg
 
6:36 AM
Cbg
 
7:10 AM
Hey up
 
cbg
What's the constant for true and false? True doesn't work, I think I screwed up the casing here...
 
True and False, should be
 
That's weird.
Oh wait, it's my fault.
sorry!! runs away
 
user4433485
Good morning everyone!
 
Morning!
 
user4433485
7:17 AM
I am so screwed today
 
What's wrong?
 
user4433485
I need to finish my project today on my internship
 
user4433485
but somethings wrong, can't fix it
 
7:37 AM
♫ Everything is wrong, truly wrong, everything is wrong ♫
 
user4433485
Hi Vaultah:)
 
Hi \o/
 
user4433485
Everyone else is sleeping or working
 
There are other possibilities as well.
 
user4433485
8:03 AM
Perhaps
 
8:17 AM
@AnttiHaapala Sowwy. But do try to keep up!
:-P
 
> change -38580
:d
 
user4433485
O helllo @MartijnPieters
 
@MartijnPieters grrgrr
 
Cbg ;)
 
Heh
 
8:23 AM
thnks ..Mine does elementary multiplication and not matrix..but I get the error as operands could not broadcast where my dimension is (3x150) *(150x150)...I'm stuck with this error..plz help.. — Pooja 2 hours ago
@Ffisegydd ^
doing PCA, needs "elementwise multiplication" - woot
 
@AnttiHaapala there there.
Gordon is still beating me with his shotgun answer approach.
 
we need to ask back the "lacks minimal understanding"
 
He needs to post about 40 answers per day to get his 15 accepts / day average.
I only need to post 14 / day to get my 10 accepts / day average.
 
No way I am going to exhaust myself to try and meet that.
 
8:25 AM
I need a tool
to track users that "lack minimal understanding"
so I can avoid them
the question seemed really reasonable: "what does * do in numpy - how do I do dot product of vectors, how matrix multiplication"
 
user4433485
Nice answer @AnttiHaapala, learned again
 
but the problem is that the OP has no clue about math at all it seems
 
F4z
How would I generate a number between 1 and 10 and not get a repeating number? say i want to generate 7 numbers from 10 but how do I make sure that those 7 numbers will not have any one of them repeating each other?
 
@F4z between 1 and 10 or 1 and billion?
for between 1 and 10 use:
 
F4z
8:34 AM
@AnttiHaapala 1 and 10
 
random.sample(range(1, 11), 7)
 
I havent done enough random
 
I had an answer on this recently
 
8:44 AM
@Ffisegydd so copy it to get rep
 
On my phone and can't be bothered.
 
@AnttiHaapala some sort of Greasemonkey script that adds hover text to SO usernames to show your notes about them? :)
 
^ That question seems to be some kind of wrongness magnet.
A wrongnet.
 
Woohoo another job offer! Except it's in Coventry
 
9:24 AM
Cabbage!
 
Cbg poke
 
user4433485
Hey @poke
 
user4433485
9:42 AM
 
@AnttiHaapala thanks for that ini file answer; I didn't see it when I searched! That's cool, and exactly what I wanted!
 
The idea of this^ appeals to me ... not altogether convinced by the decisions it makes (in pep8 mode) based on ten minutes playing, but tweaking options might fix that.
 
@RobertGrant again the ini is just one component, if you use the pshell, pserve mechanisms
you can use it or not use it
(however if you don't use it, pserve and pshell needs an in anyhow)
but you can give your configuration in in any other way;
 
Yeah it's just a dict, right?
 
9:48 AM
yes
the one passed to the configurator in settings=settings
 
So you could have a Django-like settings file
 
pyramid is built for extendability :D
 
But I'll stick with ini and see how I go
 
yeah, if you are crazy
 
Also, I am crazy
 
9:49 AM
ah crazy and stupid :d
 
Crazy stupid
 
Hrmz, I need to find some bounties to keep Gordon off my back for the quarter.
3
I'd like to stay ahead; last day of the month is my birthday so I'll not be around to fight for the quarter then.
 
@RobertGrant well in your ini you could do:
py_settings = %(here)/settings.py
then make a simple 1 method func into main
 
@Katherina Good job :D
 
load_settings(settings) before Configurator construction
 
user4433485
9:52 AM
=D
 
def load_settings(settings):
    with open(settings['py_settings'], encoding='UTF-8') as f:
        code = compile(f.read(), settings['py_settings'], 'exec')
        exec(code, settings, settings)
and now you have django style settings, only better :D
took what, 3 minutes.
 
Cool :)
 
the problem with django is that
they use lots of code to do simple things in a complicated and slow manner
there is no "mastermind" I get...
 
Ubuntu's Python APIs are non-existent.
 
10:08 AM
@AnttiHaapala off for lunch, but I have a question for when I get back :) - from my POV the Django way of doing it is fine/I didn't notice a problem; what would you say is wrong with it?
 
cbg all :)
 
Django works for the CMS, or so...
I am not interested in only CMS :D
the problem with django is the NIH attitude, they need to replicate all existing features
 
@Katherina: there are other DOM implementations apart from the one in your browser; Python has xml.minidom which is a partial implementation.
The DOM standard is... verbose... however.
because it is aimed at compatibility with different languages. Java and C don't have the various niceties that Python has so the interface defined for the DOM is cumbersome.
 
user4433485
But why should I use DOM ?
 
If you are parsing XML and need to manipulate it or extract data.
But in Python, you'd use the ElementTree API instead since it is more Pythonic.
 
10:21 AM
element tree is frankly horrible :d
dom to element tree is like cyanide to kool-aid spiced with cyanide.
too bad that most of the python stuff assumes "small documents", like the JSON... then need to use something else for the big stuff.
 
user4433485
its quite the same as JSON indeed
 
user4433485
atleast, what i've read about it
 
10:34 AM
@AnttiHaapala yeah, ElementTree is unfortunately half baked and very rough in places.
The LXML implementation is a lot better.
Both the stdlib and LXML have an iterative parsing mode however.
 
Anyone got a good Counter letter count dupe?
 
2 answers, I see no point in closing it now
 
Yeah Martijn's answer gives all the necessary detail so no need for a dupe.
 
ah no
 
10:43 AM
Surprised we don't have a dupe in the canon though, it's a common Q.
 
@Ffisegydd so make that cannon :D
 
I'll dupe it if there is a good target.
 
Your answer covers all the bases, can add it to the canon unless we find another better target.
 
how about writing a canon question and answer with images for the "python the interpreter is not the command line"
 
cbg
 
myaut's link looks good, but I guess Martijn's answer is better as it covers everything in one answer. stackoverflow.com/questions/10806866/…
 
@PM2Ring downvoteable answer: stackoverflow.com/a/28361141/918959
I'll leave a comment
 
But that ` # to form new dictionary formed from` comment from the OP of the canonical post is a bit strange.
 
@Ffisegydd it takes of pixels?
 
10:51 AM
if martijn will be accepted, I would backdupe
 
@AnttiHaapala I'll leave a comment with the fix. Maybe we should fix the answer?
 
httplib throws socket error. Strange...
    http_connection.connect()
  File "/usr/lib/python2.7/httplib.py", line 772, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known
 
naah, op's original works, and the answer, which is 3 years late, does not
 
I would have expected only a HTTPException
 
that answer does not deserve any reputation
@thefourtheye ofc
bc it is not a http error
http errors only happen after you start talking http
 
10:56 AM
@thefourtheye normally get that if you're missing off the scheme...
 
@AnttiHaapala Right, but when I use a module, I would be handling only the exceptions thrown by that module. This would be surprise in the production if it happens, no?
 
@thefourtheye why... it could throw KeyError or ValueError - they're not in the module :p
 
so, nothing ever throws typeerror, nullpointerexception etc
socket.gaierror is an ioerror
 
@JonClements But, isn't that the responsibility of the module to get them and throw exceptions specialized for that module?
 
| gaierror
| error
| exceptions.IOError
| exceptions.EnvironmentError
| exceptions.StandardError
| exceptions.Exception
| exceptions.BaseException
@thefourtheye no, socket error is not a HTTP error
 
10:58 AM
@thefourtheye nope... because then you're going to end up hiding the real exception
 
if I cannot speak to you because I have strep throat, it does not mean that my language skills suck
 
@AnttiHaapala Yup, my brain accepts it but my mind is not quite agreeing with that :(
 
@AnttiHaapala Fair point. I didn't notice that that last answer was added 3 years latter.
 
why would I throw an EnglishSpeakingException
I am not speaking anything, I have a sore throat...
 
Are we on the verge of inventing stack traces? :) Or exception chains, or whatever.
 
11:00 AM
@JonClements Hmmm, that would be bad. How will I handle this then? :(
 
in this case gaierror happens in DNS, there is no http being talked at all
@thefourtheye if you do IO you catch IOError
also when you are using .read
it can throw IOError
everything can throw an IOError
 
@AnttiHaapala Ah, except the broader error. Cool :-)
 
EnglishSpeakingException -> SoreThroatException -> ChewedGlassException
 
@thefourtheye yup... do the specialised errors first... then IOError - same as you would for any other exception handling...
 
@AnttiHaapala Good analogy
 
11:02 AM
@AnttiHaapala marked as accepted.
 
@JonClements Hmmm yeah... That makes sense. Thanks puppy. Thanks @AnttiHaapala :-)
 
@AnttiHaapala Funnily enough, having a bad throat/cough is a prerequisite for speaking Welsh.
 
@Ffisegydd also Afrikaans
 
I think I am doing a lot of Java lately... So my mind is filled with ideas similar to that.
 
@thefourtheye bad excuse
with docs.oracle.com/javase/8/docs/api/java/net/URLConnection.html URLConnection you are forced to catch IOException
when using read()
 
11:06 AM
Ha ha ha, I don't really know Java. I hardly have seen the docs. Whatever my boss says, I do that.
 
@thefourtheye 1 point would be that the python docs are notoriously bad at documenting the range of possible exceptions
 
But, they explicitly say that you have to catch IOException. That is actually better.
 
@MartijnPieters Maybe add an example using setdefault to keep Padraic happy. :)
 
Is there any markdown for strikethrough?
 
---like this---
 
11:11 AM
<s>works</s> better
 
test
 
<s>works</s>
not in here
but on main
 
Oh, in chat? no way?
 
I use it for codeblocks too
as jon clements said
 
yay :-)
 
11:13 AM
number of the slashes shall be 3, not 4, nor 2 excepting that followed by three. 5 is right out
----foo----
 
11:35 AM
Ni.
 
Visual Studio was halting my virtual machine completely at 1% processor use for 10 minutes now.
Took me this long to navigate to the task manager and kill it.
Now everything is working fine again.
what?
 
@poke that's nice of it? :p
 
How can a process render the computer completely useless though when it uses neither CPU nor RAM?
 
windows :d
 
I rather blame TFS.
 
11:42 AM
@poke so - it can just be generalised to blaming M$ then? :p
 
no :(
that’s not fair.
 
Well - I'm happy with it :p
 
def construct_menus(new, old=[]):
    if old == new:
        return

    old[:] = new
 
uhh
 
Is it okay to maintain old values like this?
 
11:47 AM
what
I’d say no because construct_menu(newMenu, ['haha, got you!'])
 
Old values like calling Microsoft "M$"? :)
 
+1
 
@poke True... I ll change it. Is there any better way to maintain old values?
 
@thefourtheye keeping state is really what classes are for? :)
 
But I am afraid of classes :(
Anyway, changing it to a class only :(
 
11:52 AM
You can also just store it at module level if it’s a module-level function.
 
Ah.. I hate my code now... :'(
 
And there you further slip into the dark side my evil twin :p
 
It already has got 5 functions and it is still growing... I thought I could keep it simple...
 
Uh oh... appears they reckon the co-pilot deliberately crashed the aircraft
 
Last I heard they didn't know if it was deliberate or not.
Just that the pilot couldn't get hold of him through the door.
Could be he passed out?
 
11:59 AM
nope - new official theory apparently... given the pilot trying to get back in
 

« first day (1622 days earlier)      last day (3333 days later) »