« first day (2284 days earlier)      last day (2664 days later) » 

11:00 AM
it doesn't work ...
 
They are very good at resisting suggestions
 
very good
 
OMG it's even hard to listen and understand to me
 
Anonymous
!!wotd
 
rectitude: rightness of principle or conduct; moral virtue.
 
Anonymous
11:01 AM
@brzuchal say again?
 
That PHPClasses talks are hard to listen and understand.
:D
 
Anonymous
oh. I thought you were talking about you. I was trying to be funny.
 
Yeah I know, I was trying to be more understabable.
 
@DaveRandom can I just add the same key I use on my machine for you?
 
@samayo did you set assert.exception in php.ini to 1? See the manual for assert()
PSA: For just $12, get XCOM 2 (MSRP: $59.99) in February's Humble Monthly
 
11:11 AM
Hey All. I have some models that have a relationship. Example: Bookshelf => array with type of Book.

What is the best OOP approach to add those Books into the array in Bookshelf? Should Bookshelf->GetAll() also get the books, or how should it work?
 
$bookshelf = new Bookshelf(); $bookshelf->add(new Book("Some Title")); perhaps?
or, if you will only ever access books through a bookshelf: $bookshelf = new Bookshelf(); $bookshelf->add("Some Title"); where add() internally creates a book object
as for getAll(): depends on why you would ever need to get all the books instead of telling the bookshelf what to do with them
@ErwinOkken ^
 
Yes, I get them both from the database multiple times. So then everytime I need to "add" them manually?
I have a BookshelfRepository->GetAll() that gets all bookshelves and BookRepository->GetAll() that get's all books. Is it "fine" to get all the data at the start and "prepare" it? So get all bookshelves and all books. Then loop through all books and assign it to the bookshelve with the right ID?
 
hmm, you asked about OOP not about databases :)
 
=)
It is OOP, but they are from the database. :P
 
@ErwinOkken depends on your application, if bookshelf and book are part of the same aggregate, then you only have one repository
 
11:18 AM
Nothing to do with databases actually, but I'm not sure WHERE I should couple those data.
 
yes, there is usually a mismatch between OO structures and DB structures
 
@Patrick Will google aggregate ;D having only 1 repository for book and bookshelve looks weird to me
 
@ErwinOkken if you need to be able to query books separately, then they are 2 separate aggregates and need their own repository
 
Instead: $moduleRepository->GetAll(true); // where true stands for getting exercises aswell. But I don't have a reference to the exercises repository in my modulerepository.. :(
Yes, seperate aswell
I know an ORM will fix this, but I want to fix it plain myself
 
$bookRepository->findByBookshelfId($bookshelfId)
 
11:21 AM
if you want to do it yourself, I recommend getting a copy of POEAA as it contains most of the patterns you'll find it an ORM
 
I've got that one. But querying the database for 50 modules, isn't that bad? :P
// I fancy ASP.NET Entity Framework. It makes it so easy ;D
 
@ErwinOkken maybe look into CQRS? usually the domain is for managing state changes, if you just need to read a bunch of data then you can just bypass the domain model and create a much simpler read model without all the logic
 
Thank you for that link, I will definitely try it out! (Even if it's after this project)
 
A lot of problems come from mixing the write and read logic together
 
And again something I didn't knew. Thanks for that!
 
11:24 AM
> Is it "fine" to get all the data at the start and "prepare" it? So get all bookshelves and all books. Then loop through all books and assign it to the bookshelve with the right ID?
 
I already created something that looks like a ORM but I'm not quite sure what the rules are when we're talking about references.
 
regarding the quote: depending on the amount of data, that sounds like a bad idea
 
At 1 page, I actually get ALL info
I actually NEED all info.
 
usually you only need a subset of your entire database in your app at any given time
 
Well, I have 3 tables for now. And on 1 page, I need the whole collection of 2 tables.
All modules and exercises. (To create a weekly planning)
 
11:26 AM
how many data items are we talking about?
 
modules (parent category) : ~ 40
Exercises (): ~ 120
 
oh. ok. that's not much. I guess you can easily load that into memory then
 
But I need to reference/couple them. Should I do that on the page itself at the start, or do it within the repositories?
 
it's very hard to say without really knowing your app
 
I thought it was more of a OOP decision
:P
$modules = //get all modules
$exercises = // get all exercises
// loop through exercises, and assign them to the right module.
// So I can use $module->GetExercises

// ^ So do it on the page itself
 
11:30 AM
General responsibility assignment software patterns (or principles), abbreviated GRASP, consist of guidelines for assigning responsibility to classes and objects in object-oriented design. The different patterns and principles used in GRASP are: controller, creator, indirection, information expert, high cohesion, low coupling, polymorphism, protected variations, and pure fabrication. All these patterns answer some software problem, and these problems are common to almost every software development project. These techniques have not been invented to create new ways of working, but to better document...
 
When I'm not doing it on the page but inside the repositories, I need a "IExerciseRepository" in the "IModuleRepository". Yet another dependency :(
 
OOP decision: If your application is simple CreateReadUpdateDelete then simple repository which returns Bookshelf with Books when dealing with such small amount of objects IMFO would be enough
In other case POEAA: Aggregate, CQRS; DDD etc.
 
or just use Doctrine for now
 
Thanks. But that means when I do $bookshelfRepository->GetAll(), that it also uses the $bookRepository to get all modules to assign them to the right one. So also a "sort" function in the repository? Doesn't it become ugly :D
 
> My BT Home Hub 5 just wasn't up to scratch. Every few hours it would drop connection - and in some areas of the house there was little to no connection at all. It was time for a new router. Also I had my suspicions the Home Hub was sleeping with my wife
 
11:40 AM
Use Doctrine run query and retrieve entities with their relations
 
@ErwinOkken maybe. but I wouldn't care about that now. Just get something done and then assess the solution. you can still refactor/improve it later
 
Then instead I would just do the "coupling" outside the class and only do it when I need it. If I see some bad OOP habits, I'm not happy. Obviously I don't know everything but I want to do it right :p
So I avoid doing it really bad. :D
Thanks for now guys, got a lot of links to read ^^
 
@ErwinOkken bad and working beats good and unwritten ;)
 
;-)
 
don't get caught in Analysis Paralysis
 
11:47 AM
Too late :p
 
simple crud with [table data gateway](https://www.martinfowler.com/eaaCatalog/tableDataGateway.html)
crud with anemic domain model (use doctrine or some crappy active record)
ddd with cqrs
pick one
 
I want to know how I should do it myself. No offense though
 
I would avoid the anemic one since its too much for a simple CRUD and not enough if you need more
@ErwinOkken which one do you want to do yourself?
 
Solving the problem without using an ORM
Do it manually first
So I know what the problems are when you would do this manually
 
table data gateway and ddd work better without an orm
what does OOP mean for you btw? Seems like you are leaning towards entities and repositories?
 
11:57 AM
I want to create things the good way. So not failing at DependencyInjection, coupling problems and that sorta things.
$allmodules = $moduleRepository->GetAll();
foreach($allmodules as $module)
{
	$exercises = $exerciseRepository->GetByModuleId($module->id);
	$module->AddExercises($exercises);
}
That's what I'm using now. So just when I need it
 
@PeeHaa yes, I think I added another one, those are the only 2 that matter
 
Not what I want in the end, but it works for now
 
if it works, it's good enough. there is no need to nail the code in the first attempt. don't be afraid of making mistakes. it's how you'll learn.
 
I know. This is decent enough for now. :)
 
@ErwinOkken psr2
 
12:00 PM
I only need them coupled on 1 page, and it works so. Later on I'll fix it
4 spaces instead of tabs. Please :(
 
@ErwinOkken it really doesn't matter, but everyone using the same standards is a good thing
 
What's wrong with my example then? :p
 
$allModules = $moduleRepository->getAll(); etc
 
Yes, you are right. Will fix that one :)
 
oh, tabs versus spaces does matter. It separates the heathens from the righteous. and when you are in the righteous group you get to hunt the heathens with pitchforks and torches. needless to stay, using tabs makes you a heathen. obviously.
 
12:03 PM
@ErwinOkken Just get a plugin for your IDE/editor that applies them when you save. Problem solved forever :)
 
I will get crazy when I'm programming with spaces instead of tabs :(
 
@ErwinOkken no you wont
provided that you configure your editor to insert 4 spaces when you press tab
 
@ErwinOkken make your pick: getting crazy or getting hunted with pitchforks and torches :)
 
Why on earth do I want to type 4 spaces everytime when I can just press tab (what I'm already doing automatically without thinking)
I never ever heard this before so I think I will be fine tbh :')
It's not that I don't respect you guys helping me, but spaces,.. that's like quiting sex for me :D
 
@ErwinOkken none of us actually types four spaces. any decent IDE will just insert four spaces when you hit tab
 
12:06 PM
But the only reason is version control right?
 
Tab is variable width
 
@ErwinOkken mixing tabs and spaces is bad. Picking one or the other works. The PHP community has settled on spaces (same with most other languages)
 
Anonymous
@Gordon thanks
 
@DaveRandom kk
 
12:10 PM
@ErwinOkken you'll find tons of discussions and arguments for tabs versus spaces. it's one of these religious wars between developers. though of course the spaces users are right.
3
 
@Gordon hahahah
 
I come into your software at night and mess up the place by inserting tabs 2 spaces wide
 
@Gordon Hahaha, nice. I feel that way =D
I'm working with my Macbook a lot. Use ASP.NET and I'm using tabs.
Should use that as my tinder message.
 
If you used spaces you wouldn't be on Tinder, just sayin ;)
 
;-DDD
 
Anonymous
12:14 PM
@ErwinOkken ^^ to clarify.. if you use spaces, @Leigh's interested.
 
God, someone help me out of this heeh
 
Anonymous
he's not that bad.
 
Fun room to hang out. Will keep it open in my browser :)
 
@JayIsTooCommon Certainly not interested in tabs users. ASP.NET devs also need not apply
 
!!remind sausages at Monday 12:35:00
 
12:16 PM
Reminder set.
 
Would be an interesting straw poll, uses tabs/spaces vs tinder/not
5
 
@ErwinOkken Macbook, Asp.NET, tabs?
wow.
 
Hey, I'm working on PHP right now and I'm in a PHP chatroom. My first move.. c'mon!
 
Anonymous
at least he's making an effort
 
@ErwinOkken Welcome!
 
12:17 PM
@Leigh You think there's any relationship? With a 95% chance I bet there is! ;-D
 
How about correlated with Tinder v Grinder?
 
Anonymous
moin madarapoo
 
Would be an interesting straw poll, uses tabs/spaces vs tinder/not
 
@ErwinOkken I bet there is. You could even just do it with preferred lang vs tinder. I bet Java devs trend strongly towards having grandchildren while ruby devs trend heavily towards "never enough clean socks"
 
Anonymous
12:19 PM
Has anyone taken or gotten near to the Symfony Certification?
 
Anonymous
My exam is in two months, and I have questions
 
lmaoo
So basically you're saying ASP.NET isn't that bad after all right? =)
 
nobody would ever say that ... out loud anyway ...
 
Maybe I should not try to get any support for ASP.NET in a PHP chatroom ;D
What was I thinking
 
C# is sexilicious. ASP.NET is a big bag of horror.
but then PHP is also a big bag of horror, it's just a different shape
 
12:22 PM
I don't hate C# ... that's as far as I'll go ...
 
stupid question, is everything nullable in c# like it is with java?
 
Structs aren't
 
@FélixGagnon-Grenier yes. Actually some years ago it occupied the spot of my favorite band
 
primitive scalars are effectively structs
 
12:25 PM
uhh like... type MyInt struct { value uint64 } ... yep you're right, primitive scalars are effectively... primitive structs :p
 
Although you can have an explicitly nullable type int? IntOrNull
 
I am mostly worried about type hinting, thats the main thing that kept me from switching to java (and why I am quite happy with php 7.1)
 
I dislike untyped stuff
 
I still want to be able to do:

class Meh
{
     public Type $var;
}
 
some day ... quite soon, I guess ...
 
12:28 PM
I can only pray!
 
what a waste of time that would be ...
 
hehe
 
@Patrick honestly I don't worry about it. R# is very good at pointing out obvious nullability problems, and fooOrNull?.Member covers basically everything else
 
someone people are working on a patch, no need to rely on magic ...
 
It's reasonable to say that if you start passing in nulls to APIs that don't say they accept nulls, weird shit will happen and it's your fault
 
Anonymous
12:29 PM
@JoeWatkins s/magic/bullshit
 
(IMO)
 
it's had work today actually, the typed properties patch ...
 
@JoeWatkins hmm? … did I hear typed props?
 
I see dmitry doing stuff
oh he's just updating your master branch
guess in prep for some work though ?
 
@JoeWatkins guess so
 
12:32 PM
Maybe he can work on zend_namespace next ;)
 
Can we please avoid trying to waste Dmitrys time?
 
lol
 
Getting rid of the ridiculous magic behind namespaces isn't really a waste of time
 
@JoeWatkins sausages
 
@Jeeves thanks
 
12:35 PM
@JoeWatkins You're welcome!
 
!!remind sausages are done at Monday 12:41:00
 
Reminder set.
 
@JayIsTooCommon well I feel stupid
 
Anonymous
@DaveRandom how does it feel to be on the other side for once?
 
for once?
 
Anonymous
12:38 PM
I was flirting.
 
I feel stupid literally all of the time
 
ThW
@Gordon :-)
 
Anonymous
I've started to lick windows so that I fit in with others with my mental capacity
 
@DaveRandom could you try to login to gitamp.audio please?
 
Anonymous
!!reminders
 
12:40 PM
Registered reminders are:
• @⁠DaveRandom http://chat.stackoverflow.com/transcript/message/33706606#33706606 → Id: :33706826 → Saturday, 29th April 2017 12:01 (UTC) - Set by Gordon - Seconds left: 8896828
• sausages are done → Id: :35124818 → Monday, 16th January 2017 12:41 (UTC) - Set by Joe Watkins - Seconds left: 28
@JoeWatkins sausages are done
 
@PeeHaa works
ty
 
\o/
 
where's the app?
 
/opt/gitamp
 
^
 
12:42 PM
ha!
Can't touch me
:P
 
:D
 
@Jeeves thanks
 
@JoeWatkins You're welcome!
 
bah! I hate writing php. it always segfaults and and you always need macros galore to make it work in php 5.3 to 7
 
/me needs to do figure out the heck (else) is wrong in a non namespaced app
 
12:44 PM
@Gordon php ?
 
oh interesting
 
Anonymous
Can someone ELI5 BCmath?
 
To be completely honest @DaveRandom. I haven't even had an actual good look at the problem myself. Because you are great and all. The problem we are hitting is that DNS somehow fucks up
And after that it's all fucked
 
@PeeHaa @Ekin afaik IPv6 is essentially completely untested
 
Is that a sufficient problem description :P
 
12:45 PM
you may have an entirely new issue :-P
 
That doesn't sound promising :D
 
wait but... but I don't remember any IPv6 there
 
@JoeWatkins yeah, see. that's why I usually use "php c" but when I call it that people also complain.
 
oooh. I see it indeed has
 
daverandom@ubuntu-1gb-nyc3-01-gitamp:~$ nslookup www.daverandom.com
Server:         2001:4860:4860::8844
Address:        2001:4860:4860::8844#53
I assume that amp is picking that config up
yeh that's what's in resolv.conf
 
12:47 PM
!!dad
 
Why couldn't the bicycle stand up by itself? It was two tired
 
@Ekin if you reconfigure the server to use 8.8.8.8/8.8.4.4 only that might "fix" it
 
ugh that must be some automagical thing on new droplet spin up?
 
@Jeeves lol
 
@Linus I don't.
 
12:48 PM
@Gordon have you tried complaints > /dev/null ?
 
> # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
 
@samayo It's bad and should be avoided. Use GMP if you can
 
no idea what that actually means in practice, you will have to google I think
However if you switch to using IPv4 then I suspect that the problem (if it is what I think it is) will go away
and the work that needs to be done in amp/dns will be a proper fix
however I could be wrong about the problem anyway so...
 
Yeah, @Dave, I thought you wanted to invest some time…
 
Anonymous
@Leigh Ok, but I'm preparing for some exam and they ask questions about what xy extensions does or is
 
12:50 PM
@bwoebi yes I do
 
then invest it too instead of just wanting :-)
 
@samayo ok, so it's a largely unoptimised (almost) arbitrary precision arithmetic ext
 
2 days ago, by DaveRandom
@JayIsTooCommon yeh just had a lot of shit on. Christmas holidays really threw a whole bunch of stuff out, I essentially lost 2 weeks of working hours in the middle of some critical projects at work, plus some shit has been on fire. I got probably til the middle of next week of madness, then I'm going to take a couple of days to not think, then I'm going to try and organise my life a bit
I have had >30 phone calls so far today :-(
 
@DaveRandom is that why you ignored me plea for help earlier ?
 
Anybody understand what that manc guy is trying to say / can translate for me?
:P
 
12:51 PM
@JoeWatkins no I just missed that entirely
linky?
 
3 hours ago, by Joe Watkins
oh hey @DaveRandom
 
Alright, I'll see what I can do about that in a bit. What if I just somehow delete the ipv6 interface? :P
 
@JoeWatkins oh yes sure
what issues are you having?
 
"it doesn't work"
 
@JoeWatkins hahahaha\
 
12:52 PM
:-P
 
for some reason inbound connections are being rejected at random, on different interfaces ...
 
@Gordon You probably want to drop support for 5
 
sometimes a route can't even be found
 
@Leigh I don't have the luxury of want :)
 
@JoeWatkins woah wut
 
12:53 PM
need
 
@Gordon must
 
@DaveRandom yeah I know, I may be cursed ...
 
Is that for multiple internal machines?
 
@Ekin askubuntu.com/a/484487/367158 but I don't dare to run it :P
 
so why would this segfault: zval *errors; array_init(errors);
 
12:53 PM
FWIW, dropped PHP 5 support on most libs that I get my hands on
 
Anonymous
@Leigh So in laymans terms, what is the use of bcmath against a ram output of calculation in PHP? (i.e. without float/ceil)
 
@DaveRandom multiple adsl lines
2 days ago, by Joe Watkins
!!get http://86.178.168.218
 
@Ocramius you apparently don't need to make money from it ;)
 
@Gordon php version ?
 
@JoeWatkins Well, but from a given IP, it will either always reach or not reach your internal network… not too random
 
12:55 PM
well it doesn't matter
 
@JoeWatkins OK so the very first thing to check for when stuff starts happening at random is a switching loop. Make sure you don't have a switch/router plugged into itself or multiple links between devices, or a ring (router -> switch1 -> switch2 -> router)
 
errors is not alloc'd
 
@samayo I actually don't know what you're asking.
 
@JoeWatkins PHP 7.0.10 (cli) (built: Aug 24 2016 17:35:36) ( NTS )
 
Anonymous
@PeeHaa lol
 
12:55 PM
Also if you have any switching devices that know how to STP then turn it on
/brb tea + smoke, 5mins
 
@JayIsTooCommon :D
 
@DaveRandom I really don't, there are two adsl routers (bt hub5, and bt "smart" pfft hub), plugged into an asus router, that's as far as I got, there's nothing else plugged into adsl routers ... (also have switch to go in) ... and I have no clue what STP is ...
 
Anonymous
@Leigh That is because I don't know what it exactly does and reading doesn't help. I didn't go to UNI, I have only basic understand of math... maybe that's why
 
Anonymous
I understand things with realworld examples.
 
@Gordon Uhhh... try zval errors; array_init(&errors);
 
12:57 PM
I'll just set up a teamviewer and you can have a look at their config ...
@Leigh yes, this, sorry distracted @Gordon
 
@JoeWatkins @Leigh thanks
 
@Gordon Do you understand why that? ^
 
@Leigh no
 
:D
 
apparently array_init doesnt take a pointer
 
12:58 PM
@Gordon no, it's libraries, it's mostly wasted time
 
but a reference
 
So I optimize for reducing wasted time
 
@Ocramius I knew it
 
You can pay me though
 
So your way you were just declaring a pointer, a pointer to what? It was uninitialised, no mem allocated. This way you are declaring a struct (so the full size is allocated) and then you pass the memory address of it
 
12:59 PM
paying me will grant you the privilege of insulting me when I upgrade dependencies
but nothing more
 
@Leigh how do I then get a pointer out of it? because I need one later to pass it to implode
 

« first day (2284 days earlier)      last day (2664 days later) »