« first day (2464 days earlier)      last day (2500 days later) » 

5:00 PM
You can do $foo->bar()->foo()->qux() if you return $this at the end of each of those functions, right?
Assuming they're proper methods etc. - with __set on the other hand that's not so easy.
 
yes, but that's bad
 
What am I missing? Too much time on jQuery or what? why is that bad?
 
@Julix Maybe you don't need setters?
You certainly don't need chaining magic setters?
1) why do you think you need setters?
2) why do you think chaining makes it better?
 
I do need setters for sake of this assignment, but yes, admittedly chaining magic setters is just for my amusement and anoyment of the instructor
 
What's the assignment?
 
5:03 PM
it is bad because you are changing the semantics of your api just to make it "comfortable" to use @Julix
why would Person::relocate(Address $address) return a Person i.e. $this?
 
Why would a person need a setBirthDate method to begin with?
 
Basically make a class with some private variables then use getter and setter methods (he didn't teach magic methods besides __construct, so definitively manual) to expose the power to see and change the variable. Employee (firstname, lastname, employeenumber) - and then extend the class with like a specific job and add another quality and then use it twice. It's super basic OOP intor
 
@PeeHaa i knew you would say that. it was a stupid example, yeah
 
:P
 
there.
 
5:05 PM
@Julix How are you going to typehint magic setters?
How are you going to validate?
How will your IDE react to magic?
 
yeah don't use magic
 
How would tomorrow you react to it?
 
almost them all
 
It's just such a terrible idea all the way down
 
if the assignment is "use magic" then saying "don't use magic" isn't exactly helpful
 
5:06 PM
i know they are tempting but there are so many disadvantages
 
The assignment isn't use magic :P
 
@PaulCrovella It's not the assignment :)
 
I guess if I was going to allow all you can eat style access with __set and __get (i.e. feel free to change anything) then why bother making the vars private to begin with, eh?
See the Custodian child class only has one property (certification_level) and there I find myself being fine writing

public function setCertificationLevel($value) {
$this->$certification_level = $value;
}
 
@Julix That's a valid point
The same goes for setters/getters
@Julix That should be part of the constructor probably depending on the lifecycle of the object
 
all you can eat = map
not a record/object
 
5:11 PM
But I hate the idea of having that functions like it 3 times (that all just do $this->something = bla - without doing anything else when I could have just one function that catches all three... - any more if I later add more...
 
You don't listen
You might just don't need setters
 
Sorry, didn't see the reply while typing. (sound is off as gf is sleeping) - Reading now. :) -- -- The assignment does require setters / getters
 
yes so write them for the assignment
In any real life project you don't actually have many setters so your point about "But I hate the idea of having that functions" is kinda moot
 
Yes, but it was vague enough that magic works too... "Add methods to return the properties and methods to alter the propert" -- and it would be my probably only chance to use them since anywhere else (i.e. portfolio work or production ready stuff at work) I couldn't play with such toys :D
 
@PeeHaa it is true that php is a bit too verbose (just as verbose many other languages are, though)
 
5:15 PM
If only I could chain __set then the annoyance level would be perfect :) - but yeah, I was considering briefly just doing it as he expected me to ... :D
 
you can play with magic under your covers alone at night, just don't let anyone ever see it
 
private $foo;
function __construct(Foo $foo){
    $this->foo = $foo;
}
function getFoo(): Foo{
    return $this->foo;
}

count how many times "foo" appears
a lot of our code looks like that
 
And that's just for one property... I need 4 across two classes - and yes it's not thaat much more code, but I don't remember it being that bad in JS -- though to be fair it's been a while since I did stuff there with prototype etc.
 
That's because Js is broken
It's all public
 
What am I? Nevil among the muggles? I'm coming from the dark magic of JS and I'm addicted :D
 
5:18 PM
@PeeHaa is python broken?
 
There are also people into bdsm so not really that uncommon
 
@PaulCrovella Parts of it sure
That is actually one part I don't like
 
and its type system is even stricter than php's
 
The __ convention feels just weird and lazy to me
 
5:20 PM
" public string FirstName { get; private set; }
public string MiddleInitial { get; private set; }
public string LastName { get; private set; }
"

That's already ugly to me... 3 times the same "shape" - there's got to be a better way.. what if I want to add a 4th thing? :O
 
wrong room
 
would love to have that @Julix
 
@Julix you were looking for C# chat room
 
how expensive is fulltext searches
 
That's copy from the link above
 
5:22 PM
@WesStark that would fuck up the encapsulation
 
would it be detrimental to the server?
 
@tereško no.
 
@PeeHaa I go back and forth on it. There's something to be said for the culture of "we're all adults here", but that would obviously never work in php
 
"there's got to be a better way.." getting psychiatric help for the OCD of having to optimise everything?
 
it's just sugar around getters/setters
 
5:23 PM
@Julix you want a gzip-based programming language
 
> You could also give them different keys, or call functions differently. These two ways to write a combined reducer are equivalent:
const reducer = combineReducers({
  a: doSomethingWithA,
  b: processB,
  c: c
})
 
this. haha! :) - I'm hoping hanging out here a bit will fix me, i.e. here I'm in the minority and psychological stuff (peer pressure or other heuristics) might help shape me to be a tad less lazy...
 
without looking up in the manual, no-one would guess that that is equivalent to:
function reducer(state = {}, action) {
  return {
    a: doSomethingWithA(state.a, action),
    b: processB(state.b, action),
    c: c(state.c, action)
  }
}
 
people try to get rid of important information (the visual debt thing) because they can't get rid of information that is not vital
like "function" in methods could be optional
with property getter/setters and some keywords trimming php would be much nicer
 
5:27 PM
public __construct(int $this->weight, float $this->length);
 
@WesStark Press Ctrl + K
 
@WesStark that would only encourage bad programming
 
Optimizing means lots of different things - some do it for speed or file size, I like it when visually too similar stuff doesn't repeat too much and would be to an extent willing to pay on the other two for comfort in typing and thinking
 
@Patrick lol, how?
 
you shouldn't really use setters
 
5:28 PM
...
 
and often getters would be better off being a cast to a different type instead
they do have their place though
 
Wait type casting in PHP? I thought here it's all type juggling like in JS? now type hinting mentioned earlier makes more sense... -- strike that, misunderstood what casting means... that's changing to that type?
 
achievement unlocked: killed conversation
 
when $timestamp > 1500367000, strtotime($timestamp) won't return false – #74930
 
Noticed that too. Sorry bout that
 
5:42 PM
@Julix It's ok. I blame @JayIsTooCommon
 
How? Did they have a magic method that kicks in without them being here? ;)
 
yes
 
Good. I see the dangers of magic methods now... too scary. - Trying to do it without :)
 
@Ekin hoi
 
@Julix he's trying to deflect blame
 
5:44 PM
Bhaahaha! That looks so official!
 
:P
 
I mean you can't argue with an official looking button like that, eh?
 
fulltext search isnt too bad
 
@Julix True :D
@Julix lol. You are Canadian?
 
Did my "eh" earlier give me away, or did you check out my profile?
 
5:46 PM
The first :P
 
Yup, I am. Born in Canada, grew up in Germany and back since 18 in 2010. :)
 
That's some weird travel pattern
 
Ha! You think that's weird? When I was 18 months old, I had been in 18 different countries (I was in Hawaii! and I don't remember anything!) - and as I grew more capable of remembering the frequency of flights / travel decreased drastically.
How about yourself? You travel much?
 
Nope. Not really that much. Unless it's it worth it I kinda dislike flying buses :P
 
through various states of inebriation mostly
 
5:51 PM
Yeap :)
 
Which state was most worth the trip? :P
 
I've been to turkey couple of times this year
 
The state of inebriation (where you think you're a turkey) or Turkey the place with the heat and the asshole leadership?
 
Was totally worth it, but not so much because of the country itself or most of the people in it :P
@Julix Latter
 
be honest... it was both
 
5:55 PM
Paulaner is right :P
 
@PeeHaa and @Ekin, sitting in a tree, P-R-O-G-R-A-M-M-I-N-G
 
hehehehehe
 
:D
 
function __construct($firstname=NULL, $lastname=NULL, $employee_number=NULL) {
//defaults
$this->firstname = empty($firstname) ? 'John' : $firstname;
$this->lastname = empty($lastname) ? 'Doe' : $lastname;
$this->employee_number = empty($employee_number) ? '001' : $employee_number;
}
 
wtf :P
 
5:58 PM
btw @Ekin have you got a more definite idea of whether you will be at phpnw?
 
I hope that's again a requirement for an assignment :p
 
@Julix $this->firstname = $firstname ?: 'John';
 
That's my non-magic method constructor. on the parent class. Can I add to it in the child class?
Thanks Dave, will fix :)
 
Not a "fix" as such, just readability++ IMO
 
Change then :P I like readability
 
5:59 PM
Hi,

which language would you use for PDF-Rendering? I'm thinking about using PHP. What would u pick?

Thanks!

Greetz
 
@trunco zalgo
 
@Julix relevant reading kalzumeus.com/2010/06/17/…
 
Is that an actual language?
 
@trunco wkhtmltopdf
 
It should be
 
6:00 PM
everything else is just silly.
 
@PeeHaa how would it differ from perl?
 
Why?
 
@PaulCrovella Good point
 
@DaveRandom Gesundheit!
 
why is pdf still a thing
 
6:01 PM
What else u would use? @WesStark
 
with all these open and better designed formats
 
@WesStark Like?
bmp?
 
@trunco Because drawing PDFs (or any graphics) is one of the shittiest tasks in programming, drawing stuff with HTML/CSS is waaaaaay easier, and wkhtmltopdf does a really good job.
 
well for text even doc is better than pdf
or you know, html...
 
@WesStark better how?
 
6:02 PM
it's simpler, more open. i suppose i meant docx
 
plus a lot of the time, people want things to be available as both a web page and a PDF download, and converting HTML to PDF means you only have to build it it once.
 
@DaveRandom I'm waiting for a letter of invitation or something alike. jrf_nl knows I'm going to do the visa dance soon, she was chasing that, so dunno for now but there isn't any subtle issue (yet).
 
@we
 
@Ekin k well like I say, happy to provide a reference as a UK national if that's a thing that would help (no idea how it works)
 
6:03 PM
@WesStark Thanks for the answer. The thing is I want to generate a file which I can send easily via mail... I only can think of PDF
 
what if I get naked while writing it?
2
@trunco why not just generate an HTML email?
 
@WesStark a plain text file is simpler and more open
@DaveRandom html email is the devil
 
"just" generate a html mail
 
@PaulCrovella doc has similar features to pdf
 
Also DO NOT email people word documents
 
6:04 PM
hahahahahahhaha
Good one
 
@DaveRandom thanks :-) I'll ping if it comes to that
 
so has html and css
 
@PeeHaa lol
 
I cannot stress that enough
 
@trunco html for instance can embed files, svg, pics
 
6:05 PM
@DaveRandom good point. I investigate if it can work. Thanks
 
it's much more a sensible format
 
@PeeHaa I will take MSO retarded CSS over drawing a PDF, any day of the week
 
Trust me you don't
Not with wkhtmltopdf
 
but seriously, wkhtmltopdf does All The Things
 
6:06 PM
I am agree 100%
 
if you want to share text doc is good enough. if it's a magazine then pdf is better
 
you make a thing that looks right when you print it in Chrome, then you give it to wkhtmltopdf, then ?, then profit.
 
but html and css is imho
 
2 mins ago, by DaveRandom
Also DO NOT email people word documents
 
@DaveRandom thing
 
6:07 PM
i am building my book with wkhtmltopdf. no idea if it's a good idea, but it works
 
srsly
 
why
 
Most docs I get are magnled by openoffice
Imma just say that typo was on purpose
 
Thanks for the answers!
 
any doc emailed to me I assume is a virus and delete
 
6:08 PM
has anyone used chrome headless for PDF generation yet - developers.google.com/web/updates/2017/04/…
should be available for everyone who hasn't turned off chrome updates.
 
Nope
 
@WesStark Because people emailing around MSO documents is the number 1 infection vector for badware, I spend a lot of time getting users very specifically to never open office docs that have been emailed to them
 
Should be even nicer than wkhtml
Because better support for new stuff
 
@PaulCrovella I understand the diversity of names etc. - I didn't come up with those fields, they were specifically required by the assignment. In Germany we say "firstnames" and it's common to go by any of them (i.e. I'm Hans Julian in vague honor of my Grandpa Hans-Juergen, but without hyphen so I wouldn't have to endure being called Hans at school (very old name) - so I always went by Julian.
In Canada Julian is seen as my middle name and all of a sudden I keep being called out as "Hans" at gov offices etc. was a strange feeling :D )
 
Does it do delay that you know @Danack?
As in wait for that shitty js to do it's magic
Hansel
 
6:10 PM
@Julix setting someone's last name (or first) to something arbitrary when they don't have one is kinda shitty
 
That
 
@DaveRandom does doc still have that shit?
 
Basically @Wes if you are in the habit of emailing people MSO docs, you are training people to implicitly trust any doc that look like it has come from you or worse, any word doc
@WesStark yup, and it will forever
 
@PeeHaa it's meant to have a setting for that.
 
I mean PDF is not exactly bulletproof, but it's better
 
6:11 PM
So you all would use a commandline tool instead of a specific language? Like rust, c, php, java.. etc
 
In that case I might try working with it soon @Danack
 
@PaulCrovella Good point. Because the guy's name might actually be John! -- So it should be "Unknown" or something, right? - Nevermind - Null does that just fine. Not sure why the prof had that in the example code.
 
@Julix It should never be in an incomplete state
That's what that constructor does
 
til @bwoebi can render svg in his head, by reading the code
 
This is one of those things that's actually way easier if you are on a Windows stack
 
6:12 PM
and you are worrying about pdf and doc... just buy a bwoebi
 
@DaveRandom Reading svg in your head?
 
you just generate a word doc or RTF and throw at it the inbuilt system PDF printer
 
Yeah, I really can't imagine a context where an employee table would ask for first and lastname but accept if they don't give it...
 
@WesStark wat
 
@DaveRandom i don't know. ask him. he's reading coordinates and applying optimizations
 
6:14 PM
@trunco yes, I'd use an existing tool rather than build one from scratch
 
@trunco Yes. Many things are fun to make yourself. This is not one of them
 
I can't even write a <path> without reading MDN for half an hour first
every single time
 
<path>
Not that hard
What did I win?
 
user image
3
you win that
 
a new badge!
 
6:16 PM
\o/
Shiny!
twitter doesn't do svg right?
 
how do i download @bwoebi? 16gigs will do
 
Don't think so, maybe
 
@PeeHaa Posting to Twitter failed :-( Unknown error
 
6:17 PM
See!
That new guy gets it
 
And this one - for earlier about the state thing you said -- i.e. different topic
 
I love him already more than any of you bunch
 
We could deal with that actually, imagick can do the conversion I'm pretty sure
maybe even gd
 
imagick can convert anything to anything
 
it can convert images into exploits
 
6:17 PM
sweet, can you write me a script that will convert cat shit into money?
 
Legend has it it can turn php code into a png based fractal
@PaulCrovella Even that!
And exploits into images!
@DaveRandom exec('kill cat');
 
it's more reliable at the former
 
kill `pidof cat` would actually work
 
Using salt circle runes to trap an A.I. car is possibly the most cyberpunk thing ever. https://t.co/4ckbQlMyBS
2
 
6:21 PM
:-P
 
haha - that ass salted the car!
 
@DaveRandom maybe a chance to play with github.com/jcupitt/php-vips-ext
 
@trunco it's not about the language, it's about the complexity of the problem. The existing tool has solved the problem. I'm a big fan of wheel reinvention, but PDF is a shit wheel no matter who designs it.
RL calls, bbiab
@PaulCrovella bookmarked
 
later christa
 
creators.vice.com/en_us/article/qkmeyd/… - there's a whole interview... it's not really an autonomous car, just concept art, but the idea is cool. "If a self-driving car is designed to read the road, what happens when the language of the road is abused by those with nefarious intent?"
 
7:13 PM
Nite all
Have a great Sunday
 
nite linus
 
7:37 PM
good afternoon
the fine people of r11
 
o/
 
\o
 
\o/
 
/o\
I'm going to figure this out
 
\o
 
7:39 PM
evenin
so, how's everyone been?
 
pretty good today, so far
yourself?
 
working, mostly
 
.... @tereško just the mention of you reminded me that i have a beer in the fridge
 
you're welcome, I opened mine about 5 min ago
 
chocolate porter
I'm a sucker for chocolate beers
 
7:42 PM
tried something like that few weeks ago - not for me
 
I like chocolates. Also beers. But a mix is a nope from me :P
 
chocolate stouts go well with something sweet
lol @Ekin
 
@Ekin have you tried Wexford Irish Cream Ale?
 
Don't think so, no. Any good?
 
really good
 
7:44 PM
Hey there
 
Noted :-)
 
@Tiffany I'VE FINISHED THE LOGO and i've been an alcoholic all day long
 
@WesStark that's not how "being an alcoholic" works
 
@WesStark WOOOOO
 
I have created a form in HTML with a text box and a submit button.

Can I not control the button either it is submitted or not just with

"if($_POST['submit']){
...
}" ?
isset() works but the $_POST alone is not working.
Throws "undefined index submit."
 
7:45 PM
did you bring out the champagne?
 
/o/
 
@PorFavorDama what's the HTML for that button?
 
<input type="submit" name="submit" Value="Send">
 
@tereško wanna bet? i've had 6,75 liters of any kind of wine
and soon i'll proceed to the tenth bottle :B
plus beer, but that's just for dehydration.
 
Because I've seen in a question on stackoverflow, someone suggested to check if a button is pressed like so but it is not working, which is why I'm asking.
isset() works tho. Just out of curiosity I'm asking.
 
7:48 PM
So I want to run the built-in PHP web server on a vagrantbox. Stuff I've read has said to using php -S 0.0.0.0:80 to make it run. My question is: do I need to add 0.0.0.0 anywhere to the vagrantfile to make it work? like under config.vm.network "private_network", ip: "192.168.33.10"?
 
@WesStark looks awesome 😀 congrats
 
/me has been looping
 
it's not as finely designed as i hoped it would be, but it's good enough
 
7:50 PM
allegro non molto suits your usual mood @tereško
means "happy, but not much" :B
 
@PorFavorDama when you do var_dump($_POST);, what do you see?
 
@Trowski is there any easy way to create two websockets connections with two dedicated handlers and be able to send messages over both connections from a handler?
cc @kelunik @bwoebi
 
@WesStark thanks, it's not like I have basic musical education or anything
:D
also, I have never actually described it as "happy"
I was taught that it meant .. emm ... closest in english would be "lively", I think
 
@tereško an empty array
 
@PorFavorDama are there any other elements in that form?
 
7:53 PM
 
have you actually set the form's method to be "post" ?
@WesStark yeeeeeees
 
:B
oh well i don't know if people know this stuff
 
next you will be trying to explain to me what "FF" stands for
 
i just barely know what's that too
i don't know what that means
 
forte fortissimo (not sure about spelling)
 
7:56 PM
forfour. it's a kind of automobiles. 4 seats :B
forte fortissimo. yep
 
translates as "loud as fuck"
 
pretty much :D
 
@tereško here it is codepaste.net/64rndr
 
I spilled beer all over myself, my desk and my chair :(
 
if you have doubt, ask @FélixGagnon-Grenier
 
7:57 PM
I'm more disappointed about the wasted beer
 
he's a violin playing pretentious prick :P
 
Sorry for using my native language there though I forgot to change. I can change them if you wish me to.
 
@PorFavorDama TBH, I wouldn't actually use that to detect form submission. I would instead use $_SERVER['REQUEST_METHOD']
 
people that plays classical music here is so strange,they wear strange stuff and talk strange... like they've traveled through time from 1600
 

« first day (2464 days earlier)      last day (2500 days later) »