« first day (2134 days earlier)      last day (2814 days later) » 

user6568562
12:01 AM
You can google : Free eye exam in <your region> and start from there
 
@randomhopeful I do not know if cheap doctors in my place could be of help. They would just advise you to wear glasses, no cure or what so ever to prevent it from worsening. I need healthy eyes for work, you know, earn a living.
starts googling
 
user6568562
To my defense, the keywords don't match the ones I gave you
 
user6568562
Time to get some sleep. Good night everybody [ :
 
user6568562
@JGreenwell Thanks again for your time [ :
 
no problem, good night
@Ralf17 just fyi, if you insist on asking this on a SE network - you might want to ask on health.SE - not Stack Overflow
read their tour first though
 
12:09 AM
@JGreenwell I think I need some retinol (Vitamin A). I will try that first. Thanks for the web surfing advice (i.e. google scholar, health.se)
Ralf flies away
 
I'm probably pushing my luck, but I added a for-else example to my meta answer.
 
12:28 AM
stupid for/else :P
 
I admit that part of my motivation was to have code (and about a wtf python feature!) in a meta answer and hopefully get away with it:D
I know the outer if makes it less life-like, but I found it satisfying that this way you can "fix" the else clause in two ways that are both wrong
strictly professional satisfaction, of course
 
of course
and commented cause I can
 
12:44 AM
hmm...I haven't considered fortran to be such a case, but you're right
good night:)
 
yep, and good night
 
 
1 hour later…
1:45 AM
@WayneWerner COBOL can (since 2002) be written free-form or column based (fixed-format), and is now much more likely to be free-form - so I wouldn't count it in the whitespace is significant
do not ask how I know that
PIC 9(4) and PIC 99/99/9(4) still haunt me
 
Heh.
Well... I know the who-knows-how-many-lines of Cobol that we used when I was at my first job was fixed format (at least, the comment character was what, 7? and 8+ were actual code lines...)
 
comments moved to just >* in 02 but like all things COBOL it took a while to be adopted (you'll still find fixed-format) but its rare
you want to have nightmares? keep talking about COBOL, a language where GOTO is a required programming practice cause there is only one loop
I give you some nightmares >:)
 
2:10 AM
My favorite part is how in order to call a program you pass it your memory (I mean, you could make a copy of it, but why bother?). So not only are your variables global anywhere in your program, they could be changed in any program you called, woo woo!
 
mmm, greasy!
 
at least 02 got rid of ALTER X TO PROCEED TO Y....the only thing worse then GO TO
woohoo for self-modifying code
 
I kid you not, I once dealt with a program 4 programs that all modified the same memory, they just called it different things. So A had logic in it that would set some variable, and then if something else happened to it it would do some new thing. But for that other thing to happen, A would call B which would do something based on that variable, and then call C which would do something based on the thing that B did based on that variable and then D would do something based on what C did...
 
@corvid that is one thirsty individual
 
2:14 AM
Finally, after D was done, then C would decide what to do, which would change how B did something, and that would change how A reacted. All based on the same memory, wooooo!
 
did you purify it with fire, @WayneWerner?
cause I would have
 
I tried, so hard.
Oh yeeeaaah
now I remember. That was the program where the "rules" were in a spreadsheet.
Except the were a lie, compared with the Cobol rules, which were the actual rules.
And I was re-writing that part in C#
 
actually at that point I kinda wonder if you wouldn't have heard some sparking as the HDD ate itself in pain and the CPU commited hara-kiri in disgust....and then would come the flames
 
and because we couldn't use 3rd party modules, I basically ported the logging module to .NET
I needed that, because the application would actually spit out log messages based on what it did...
"This reweigh was < 100 lbs, so we reject it"
 
2:19 AM
I've only lit one computer on fire with a program - and it deserved it and it was COBOL
 
that way our end users could just run the app and know why something happened. They would also always ask questions like, "If that had been over 100lbs, would the reweigh have applied?"
 
(granted it was actually a capacitor in the old monitor blowing that caused it but the timing was perfect)
 
heh. Nice.
That was one of the times that I kept a tally on my whiteboard: Headdesk count
The number of times that the code was so, so bad that my only reaction could be introducing my head to my desk
The other one was our delightful god-collection-object
but that one was in .NET by someone who wasn't a programmer who wrote a very very large application
that was probably about 10x larger than it needed to be
ahhh, the misery. So glad I don't have to deal with that anymore
 
seriously perfect timing - a VP that I hated, and all of MIS hated, was visiting at the time and was convinced from then on that he had better be really nice to me or I'd blow up his computer
 
user559633
user image
4
 
user559633
2:22 AM
uhhhhhhh holy shit
 
Well then.
 
Teething baby cbg
 
cbg @RobertGrant - the struggle is real
 
Tis a noble fight
 
that is insane
@WayneWerner that sounds like 1/2 of my job right now :\
and it was the job I did in '99-05 too :|
stupid schools need to reply to my applications soon
also good luck with the teething @RobertGrant I promise it does pass :)
 
2:30 AM
Thanks :-)
Next time wife and I talk about it I'll just intone "ALL THINGS SHALL PASS" and pretend to roll over and go to sleep. Because it's 3am that idea's making me laugh
 
user559633
>>> if all('things'): pass
...
 
user559633
it is known
 
Nice
 
3:01 AM
@RobertGrant 5 minutes later my wife sent mine in here. And 5 minutes after that he passed out, tired guy.
Enjoy the sunset. I did ;)

rbrb
 
Rbrb :)
 
rbrb Wayne
 
Where would be a good place to start learning basic algorithms in python? With examples/notes?
 
 
3 hours later…
5:47 AM
morning everyone
im trying to do 0 * log(0). I know it gives math error, but is there any way to get around this error? because techincally 0 * n = 0.
my code is this
def entropy(no, yes, total):
	return ((-no/total) * math.log(no/total, 2)) - ((yes/total) * math.log(yes/total, 2))


print(entropy(5, 0, 5))
 
6:06 AM
cbg
 
6:45 AM
nice
nice nice nice, just perfect
in this one project I've been "hardcoding" some texts in Finnish since "ok the i18n is not of utmost importance right now"
now, they asked me to create a demo account for a certain customer
... and then after I had created they say: "so now, we need to demonstrate the program in English, wouldn't take too long right? You have one hour"
they're not hardcoded per-se
but I didn't have i18n framework in place then so they're written in Finnish in places that should be in English and translated to Finnish
 
7:01 AM
Amateur hour.
 
Morning
@Ffisegydd yes, a few hours ago
 
Heh, yeah.
I told them to go away.
"I scraped Github for Python code and found you towards the bottom of the pile."
I understand it was a startup, but that was not much money, especially if you had to move to Paris.
 
cbg
 
7:21 AM
cbg
 
naturally I explained that in the sprint meeting on wednesday
but naturally no one cares to come to those useless sprint meetings
@Ffisegydd paris is the *sshole of Europe
 
anybody has beginner tutorials on TDD?
 
I've only ever been to Charles de Gaulle Airport.
Once had to spend the night there sleeping on the floor.
Whole airport got snowed in, they had to bring in charity organisations to bring beds and blankets for people.
 
7:49 AM
@khajvah are you already using a test framework? I have a few slides on unittest that demonstrate a TDD approach, but nothing that specifically teaches it.
 
Not for me, I already suggested a book
"The are of unit testing"
 
nice
 
I'm really interested in pypy, but I'd never drop to python2 to use it, so I think it's great!
 
8:04 AM
isn't 3.3 supported?
 
I like pure-python in general, which is why I'm the world's only Waitress fan
Yeah, but not 100% I don't think
 
wait, is it written in python?
 
Now that I think about it, I've no idea how a pure-python python interpreter would even work. I get how you do that sort of thing with compiled languages (write a compiler in existing language, write compiler in new language, compile new compiler with first compiler, now you're compiling your language using a tool written in the same language)
But given Python's interpreted, I don't know how pypy works
@khajvah yes, unless I've massively misunderstood many, many things
 
it should run on top of CPython then
I don't understand
 
Yeah that's what I'm wondering, but who knows :)
 
8:09 AM
It's written in RPython
which compiles stuff to C I think
 
RPython is a restricted (subset) dialect of Python that can be efficiently compiled. They used bootstrapping from CPython, first of all building an RPython compiler in CPython. They then ran the compiler through itself. Tadaa.
But nowadays PyPy is a multi-faceted project that demonstrates Python is a good language-implementation language.
 
Python seems to be good at everything
the only remaining question is, how the hell does it support packages written in C
 
@khajvah I think it doesn't, basically. Those are CPython-specific.
Which is a bit like having a java library that only works with the Sun Java Compiler and not OpenJDK
 
> C extensions need to be recompiled for PyPy in order to work. Depending on your build system, it might work out of the box or will be slightly harder.
At least they are working on it
without C support this won't have much success.
 
8:25 AM
Yeah, although ideally all packages would be pure python, and the language itself would support more $things they need to run super fast
Plus C packages don't benefit from Pypy's pluses
@holdenweb thanks - have never even heard of that before
 
8:37 AM
@holdenweb yeah I saw that - I can understand it's nicer to built 80% interpreters of multiple languages than 100% interpreters of different versions of a single language
(Slightly unkind and handwavey, that. I probably don't mean it. Either way they're doing a lot more than I am, so no judgey :))
 
I believe that Michael Foord did some bizarre experiment that allowed C-object interchange between CPython and PyPy, but I could be mistaken (might have been IronPython)
 
8:53 AM
Cabbagey Morning
 
@IntrepidBrit cbg!
 
cbg
@IljaEverilä cabbage
 
How does one get a room unfrozen?
 
@IntrepidBrit you don't
@IljaEverilä any ideas how to fix that ^
the problem is that the error is raised in property.__set__ or property.__del__
which doesn't know the name of the property... :/
 
8:56 AM
Oh.
 
seems that a mod can do it, so ping joncle, martijn
 
Not any good ideas
There are libraries that use descriptors and metaclasses that set the name of the attribute to said descriptors, but that doesn't apply :\
 
Thanks for that Antti.
 
So type would have to do the same, i.e. during class creation have a special treatment for property objects where it sets the names, but I have no idea if that is even possible (or sane).
 
@IljaEverilä it is not even possible to do like that
the same property can be tied to different property names
e.g.
@property
def foo(self):
     ...
 
9:08 AM
On the other hand it does have the wrapped functions doesn't it? And they have a name?
 
bar = foo
 
user6568562
Cbg [ :
 
they might have the name... or not
 
Which also nullifies using the function names
 
9:09 AM
beause you can always write
foo = property(p_get, p_set, p_del)
 
Aye
In case of setattr(), have it wrap the exception? :P
 
>>> dis.dis(foo)
  2           0 LOAD_GLOBAL              0 (sadf)
              3 LOAD_GLOBAL              1 (bar)
              6 STORE_ATTR               2 (baz)
              9 LOAD_CONST               0 (None)
             12 RETURN_VALUE
 
raise AttributeError(...) from ...
 
but it doesn't work either :D
 
Ah yes
 
9:11 AM
yeah that could work...
but ...
the message still would be confusing
if there is a setter
and the setter tries to delegate to another object
and that fails...
also I'd like to subclass attributeerror .. :D:
 
ok celery is not as comfy as I thought
 
@Ming no, not technically. Technically 0*log(0) = 0*inf = undefined. But the limit of x*log(x) in x->0 is 0.
and only because log(x) has a weaker singularity than 1/x: x*(1/x^2) -> inf even though it's also 0*inf type
just explicitly handle the x=0 case for the entropy
if you use numpy (with entropy it should be probable), you can use np.where for instance, or just setting the nans to 0 in a second step
 
@wim You have never tried Lounge<C++>, have you?
 
9:27 AM
Hooray, trivialities in HNQ again (as always?)
it's C++, but still
 
> 9 upvotes
 
that's just a specific calculation of the limit:P
 
ok this is weird. Celery config points to a redis server but it still tries to send through amqp
 
@khajvah nothing in Celery can amaze me.
 
9:34 AM
this never happened to me
 
@AndrasDeak it is :P
but I didn't test but could be applicable in the original context
 
Probably, yes. Although the limit doesn't exist from the left side.
 
launch might clear things up
 
@AndrasDeak ah no, not applicable :D
it needs to be differentiable on the both sides.
 
yeah, and the result would be 0*1/x:D
 
9:36 AM
I guess
 
oh, no, that would be for fractions
 
but you can apply L'Hôpital repeatedly
 
the thing is, there are corner cases of L'Hospital which can screw you over, and I can never remember the full conditions for it
so I just ignore L'Hospital altogether
 
hmm just realized that in English there are the words Hostel and Hotel
which... are just old and new French spelling for the same word :D
 
yup:D
 
9:43 AM
and then people argue about what is a hostel and what is a hotel :(
 
Non non non, the English argue
 
user6568562
Well, hostels usually refer to places where the stay is usually long. Hotels are just inns that offer more comfort than inns
 
@randomhopeful not here...
 
Hostels have a ratio of total backpacks to total guests of over 0.8:1; everything else is a hotel
 
a hostel is pretty much a youth hostel here. just like @RobertGrant said.
 
user6568562
9:46 AM
@AnttiHaapala I see, kind of what the french call auberge : P
 
user6568562
Which English translate to inns, which is heresy
 
@randomhopeful here no one wants to stay in a hostel
it is a place to sleep.
@randomhopeful "non non non"
google.fi/search?q=hostelli these are the "hostels"
 
user6568562
Stay = Duration not the physical act of being there
 
no, no one would stay for long.
a hostel here makes the army barracks feel homey :d
 
user6568562
Yes, you use it to sleep. I get that [ : And it's generally overcrowded and not holiday oriented. It's more like a dorm with a reception
 
9:51 AM
 
user6568562
@AnttiHaapala Haha : D You should check the ones in Tunisia. More like an optional prison
 
Finnish army barracks (usually there are 2-decker beds tho, seems they've got extra space in here, probably for NCOs.)
a "hostel" - yes, a "dorm" with reception, or more like a concentration camp.
 
Oh, where you send kids to concentrate on their schoolwork?
 
@randomhopeful so which one would you want to stay at? :D
 
user6568562
@AnttiHaapala Well, if you're inviting me to choose : A manor with dozens of girls happy that I'm joining them. I would be forever grateful to you : P
 
9:55 AM
no between those 2 pictures above^
remember one of them you're paid to stay at, the other you must pay. One has free laundry as well, and meals :D
 
user6568562
Well, certainly not the bunk beds, one. Too depressing. The idea of being surrounded by three dudes is already giving me nightmares conway's game related
 
@randomhopeful lol
Depending on who you sleep near you could end up pregnant or dead?
 
Guys - you're thinking too small
Last time in London I stayed in a nightclub hostel
It was ... an experience
 
user6568562
@RobertGrant lol, you with your accuracy again. Stop being so perceptive : D
 
user6568562
But you're right, can't argue with that
 
user6568562
10:01 AM
I don't wanna be dead nor pregnant
 
i'd rather be pregnant
could earn a fortune with interviews.
dead, not that much.
 
Anecdotal evidence: I went to London once for a student conference, and got accommodation at The Generator hostel. It was so bad, we quickly dubbed it Degenerator
 
user6568562
@IntrepidBrit Hostel clerks used to wake you up with beat drops ?
 
user6568562
Laters [ :
 
see you
 
10:26 AM
Python is missing this: tostring :(
 
30
Q: What is the purpose of __str__ and __repr__ in Python?

DanielI really don't understand where are __str__ and __repr__ used in Python. I mean, I get that __str__ returns the string representation of an object. But why would I need that? In what use case scenario? Also, I read about the usage of __repr__ But what I don't understand is, where would I use them?

 
@khajvah For json
 
what you mean?
 
Sth like __toJson()
Without encoders
 
@VeeeneX ...
so what does have that?
 
10:30 AM
:D
PHP
 
:D
 
__toJson??
 
Nope, but json in php can serialize an object
 
5 mins ago, by VeeeneX
Python is missing this: tostring :(
I only looked at the link there
 
JSON is too specific use case to have smth like that
 
@VeeeneX json in python can serialize objects too
 
json.dump will serialize it for you
 
@AndrasDeak not sure <server.application.Application object at 0x7fc6f8502c18> is not JSON serializable
 
then again this might just be a W in an XWYZ problem
@VeeeneX is that a json object?
doesn't quack like a duck
 
No, It's class
 
10:33 AM
@VeeeneX of course. json can't magically know how to serialize everthing
 
:( no
 
hint: it can't serialize elephants either
 
@khajvah :( it would be awesome if it could
 
@VeeeneX it is impossible
 
facepalm
 
10:34 AM
@AndrasDeak noooooo
 
and yet you're surprised that you sometimes get accused of trolling..
 
I'm just new to python :D, came from php
 
I don't see how that matters
 
can PHP magically serialize everything?
 
of course,
 
10:36 AM
I've never used JSON, not in python or elsewhere. Yet I don't expect a tool to be magically applicable outside its clearly intended scope
 
it will not do what you wanted but it can serialize everything
 
yeah that would be a useless feature
 
@VeeeneX there's pickling if you just want to serialize elephants
 
Anyway my project is crazy, I'm running two py applications and they are communicating over zeromq :D
 
That's not that crazy.
 
10:54 AM
@Ffisegydd But it's not bidirectional communication
And I don't know how to achieve that
 
Cabbage
 
@PM2Ring Hm?
 
Don't you just send a message from the other system to the first?
 
@VeeeneX If you want Python's json encoder to handle objects that it doesn't know how to serialize you just have to tell it how you want the object serialized. You do that with a default method. "If specified, default should be a function that gets called for objects that can’t otherwise be serialized. It should return a JSON encodable version of the object or raise a TypeError."
 
Two zeromqs?
 
11:01 AM
This is current architecture
@PM2Ring Thanks :)
@holdenweb Hm, I need sth with auth, stats, etc...
 
I'm very interested in ZeroMQ
 
Good afternoon all
Quick question, so I'm looking at some equations, where one of them is for example X x Y, the 'x' denoting * or multiply
Then I've another which is
x . y
How should I perceive the '.', as my understanding is a . can also denote multiply, but in this scenario is clearly does not
 
11:18 AM
what are the objects?
although dot product and matrix product should be equivalent in reasonable contexts, so probably not that
I think I'd need some more specifics to be able to answer that one
 
@randomhopeful Wake up? You think we slept?!
 
Ah, hi @AndrasDeak. I'm looking at objects relating to stocks
 
maybe the writer was lazy and incosistent, and denoted multiplication with both x and . ?
 
That seems reasonable
 
whoever denotes multplication with x in a (semi-)scientific context is capable of other crimes as well
 
11:21 AM
I am uneasy with uncertainty, I know the the process to calculate this but am unsettled when it seems he/she might be stating something else
And lol @AndrasDeak yes
Okay cheers
 
well there can be some advanced stochastic stuff, like discrete stochastic integrals or correlations or whatnot, but they should specify if they're denoting something special like that
 
Yeah I'll just go with what I know
I shoot myself in the foot with small details a lot of the time!
 
well you can run into pitfalls, so it's better to be careful
 
You may find it's an × ("\N{MULTIPLICATION SIGN}") and not an x
 
I stand by my statement:P
also, nice trick with \N
>>> "\N{PILE OF POO}"
'💩'
didn't know this:)
I'll try to abuse this in the future
 
11:29 AM
@holdenweb yes it is raised from the line like you've shown
 
so it's only half a crime
 
Should I treat this differently from standard multiplication?
 
depends on context
 
It's multiplying two sets
 
I could imagine it to be X_i × Y_j, then later X.Y might denote a scalar product
@cardycakes now that's tricky, you can do that in many ways
 
11:31 AM
Yes Andra, exactly the former as you have stated there
 
OK, I guess it would mostly mean a Cartesian product...
but yeah, context
 
Okay great, knowing the distinction is good enough to go forward. Thanks so much @AndrasDeak
PS @AndrasDeak so re the problem last night, I went with the following
A dictionary for index, a dictionary for columns, then created n lists, that I reference with the dict values
i.e. my_data[idx['APPLE']][cols['JUICY_LEVEL']]
I found it cleanest overall
 
OK:P
I'm not sure I was involved with this, at least it doesn't sound familiar
oh, right, juicy level
yeah, I didn't pay attenion
 
Okay maybe you weren't, I just remember you being around last night haha, never mind!
Unless there are 2 Andras on here.......
Oh you remember the juicy_level, cool
 
@AndrasDeak FWIW, you can do the reverse lookup using the 3rd-party unicodedata module:
>>> import unicodedata as ud;s='\U0001F602';print(s, ud.name(s))
😂 FACE WITH TEARS OF JOY
 
11:44 AM
:D haha, thanks
new sport: guessing unicode character names
 
 
BALLOT BOX WITH X
 
odd that there's a 'radio button', but no 'check box'
🐉
the tiniest dragon in the world
that's a flying snake with legs, so it's almost on topic
 
Cabbage
 
Here's some code I wrote a couple of months ago that converts emojis to names, which can be handy when you're using a font that doesn't have emojis. stackoverflow.com/a/37530609/4014959
 
11:55 AM
I have a numpy array that I want to slice, so that each item is at the center of a square slice, however when these slices overlap the edges numpy returns an empty array. How do I work around this?

I want the opposite of periodic boundary conditions...
 
I don't get it
 
Slowly creeping up on 9,000 rep, and in the top 1% for August. Funny how performance can vary with little change in effort
Very much doubt I would use mod privileges when I get them, though, so not in any particular rush to 10K
 
@Jacobadtr so you want a square slice, but if the actual slice would be smaller than the intended square, you want an empty matrix instead?
 
@An
 
11:59 AM
so in a 10x10 array, a 3x3 slice around element [4,4] should be a 3x3 array, but one around [1,1] should be empty?
 
oops, no if the slice overlaps the edges of the array, I want the contents of the slice, not just an empty arrau
 

« first day (2134 days earlier)      last day (2814 days later) »