« first day (1496 days earlier)      last day (3462 days later) » 

11:00 AM
@Ja͢ck it is accepted?
 
ah right, besides being accepted, sorry :)
 
not sure. can you link me to it please?
 
@Gordon link
I've told the user to flag their answer, but was curious to see if there are any other reasons that would prevent a user from doing the deletion themselves :)
Aaaaand it's gone :)
 
@Ja͢ck yeah, I deleted it already. Might be privilege problem. OP only got 11 rep
 
It's a privilege to remove your own things? ;-)
 
11:04 AM
49
A: Understanding IoC Containers and Dependency Injection

laforPut simply (because it's not a problem limited to OOP world only), a dependency is a situation where component A needs (depends on) component B to do the stuff it's supposed to do. The word is also used to describe the depended-on component in this scenario. To put this in OOP/PHP terms, consider...

^ Uses a service locator and advocates pimple, and he reads fowler and clean code. cough, splutter
 
Pimples are bad, chicks don't like pimples.
 
@Ja͢ck tbh Idk for sure
 
@Fabor Useful info, thank you. ;)
 
@Leri No worries. If you are considering travel stuff just ask. Wife works in the industry and is quite knowledgeable.
 
11:20 AM
> Take care when driving and if possible avoid driving at night.
This is certainly not true. You should avoid driving in Tbilisi. ^
 
Teresko's helpful tip o the day:
You are completely wrong. — tereško 20 secs ago
 
> Personally, I believe as much logic as possible should be in the controller & as little logic as possible in the view. (source)
 
:D
 
Oh man.
 
Nope
 
11:24 AM
Dat 3-3 vote on safe casts.
It would be 3-4, but Derick hasn't actually voted.
 
Here we go
Very interesting question! But, in real-life, it's totally irrelevant, as masses of excellent applications have been built with basically every framework. Don't get stuck at the "doing it correctly" thing, you'll end up in endless discussion with self-claimed theoretical "experts". — Panique 55 secs ago
 
Loading assets on wiki.php.net results in connection time out for me and styles are all messed up
Is that just me?
 
@Leri Nope, shared.php.net has fallen over.
 
@Leri not here .. though I am getting:
> downloadable font: OS/2: bad weight: 350 (font-family: "Fira Sans" style:italic weight:normal stretch:normal src index:2)
source: http://php.net/fonts/Fira/woff/FiraSans-BookItalic.woffhttp://php.net/fonts/Fira/woff/FiraSans-BookItalic.woff
 
@tereško @LeviMorrison ^^
 
11:31 AM
oh btw @Ocramius doctrine-orm.readthedocs.org/en/latest/tutorials/… is the bomb. I want to use it all over our app. thanks for that.
 
@AndreaFaulds I can make it 4:3 if you like. :)
 
@salathe please do :p
 
Morning
 
Oops, I meant 3:4 :P
 
@salathe :(
 
11:32 AM
moonings @PeeHee
 
You'll need to adblock shared.php.net for the page to even load, though.
 
@tereško tl;dr?
 
@tereško Messaged you on Skype.
 
you don't say ..
 
11:35 AM
w/e Skype is crap. I didn't see the reply :P
 
@Gordon You used embeddables then? They're awesome for value objects
I have, an IpAddress value object which contains the different parts of it, and that's embedded within another object
I was like whoahhh, I love Doctrine :-)
 
@Jimbo not yet. But just looking at the docs makes me want to. we got a couple of way too big entities that could use it
 
how does it work in where clause?
 
@Gordon Actually, I think I found it. Here's the question in case you want to take a look at a concrete example:
3
Q: Using @Embedded / @Embeddable with Doctrine 2.5 and Unique Constraints

Jimbo Doctrine 2.5 allows @Embeddable and @Embedded annotations - giving developers the ability to create Entities alongside Value Objects. If you are using composer, as of May 2014, you need to have: "minimum-stability": "dev" in your composer.json to use it. I have a Server entity, and I'm tryin...

 
@DaveRandom Y U NO IN ROOM?
 
11:38 AM
Ah actually I got it
 
@Jimbo yeah, seen it already yesterday
 
@Gordon hehe, it's indeed quite neat :P
 
@Panique , the only person that I am harassing is you. — tereško 17 secs ago
 
Ah man xD, panique always comes on and spouts rubbish about mvc and then has a go at experts
 
@tereško actually, you shouldnt be harrassing anyone
 
11:44 AM
actually, I am not .. but his comment was too good to ignore
 
@AndreaFaulds, @JoeWatkins ping
 
yeah, I am going to delete the comments. most of the are not constructive
 
.. which is why I tagged it for [cv-pls] before even the first comment/answer was written
 
For anyone interested in authoring on the Room 11 blog just let me know.
ATM we're setting stuff up but I can at least get author invites out.
 
Damnit the SO people are pouring a crap redesign into main soon instead of fixing actual issues people have been posting on meta over the years :(
 
11:51 AM
@Leri hi
 
@AndreaFaulds Morning.
Is it doable to implement (desirable, extend Closure class) to provide information about its body, parameters and return type?
 
@Jimbo You use Auryn actively right?
 
@Leri It's something I've thought about. I suppose we have ReflectionFunction already though.
 
Good example is System.Linq.Expressions.Expression<TDelegate> from .NET
 
@Fabor I think there are more people (including me) who use it actively.
 
11:54 AM
@Fabor In that silex-auth-skeleton, which I actually use for projects, yeah. When my company shifts over to Symfony 2 and I'm the one leading it, Auryn'll be integrated too (slash auryn equivalent clone, can't remember what license is) ;)
 
So all the info you're looking for is probably available through ReflectionFunction.
 
@AndreaFaulds Not enough for me. I am more interested in function's body at user-land
 
@Leri Why do you want that?
 
@bwoebi Ah fair enough. I can ask generally. Do your IDEs still do the 'click to definition' with it?
 
@AndreaFaulds That would give me flexibility to create something like type-providers or fluent query builders
 
11:56 AM
@Fabor well, where? If you specify a string/array callback obviously not...
 
@Leri Converting PHP code to SQL?
@Leri You could use PHP-Parser.
 
@bwoebi as in ->make('Shift/Click/Me'); // Clicking there.
 
Bear in mind PHP doesn't store the parsed form of the code beyond the compilation stage.
All we store is opcodes.
 
To open the file
 
(And prior to PHP 7, there wasn't a parsed form anyway)
 
11:57 AM
@Fabor Usually you'd ->make(Shift\Click\Me::class) and then it works again.
(You anyway need to because namespacing, if you don't want to always print the FQN there)
 
@AndreaFaulds Yes, and not only.
 
@Leri Use PHP-Parser.
Or the AST extension once that becomes available in 7, even.
 
@AndreaFaulds Which AST ext?
 
@bwoebi The one that lets you view PHP's AST
 
@AndreaFaulds Someone's writing one?
 
12:00 PM
@AndreaFaulds I thought about that but I don't want to rely on that for 2 reasons: 1. two different parsers in one project. 2. Performance.
@AndreaFaulds I've never heard about that.
 
@bwoebi I think @NikiC is.
 
@AndreaFaulds Didn't know…
 
@Leri Current PHP has no AST at all, PHP-Parser is your only option.
@Leri In PHP 7 there will be an AST, for which there'll be an extension that lets you read it.
 
@AndreaFaulds Not really, I could actually hook inside opcode-s and expose it to user-land but it was really painful.
 
@Leri I mean, only realistic option.
 
12:07 PM
btw, does @NikiC have any plans of making the parser into an extension and contribute it to the core?
ah, nvm. It's in PHP7 apparently
very nice
 
@Gordon hmm??
 
11 mins ago, by Andrea Faulds
Or the AST extension once that becomes available in 7, even.
 
@Gordon Yep, she means it's still not written.
 
You get to read a looooooot of bad code when merging PRs for a dozen projects...
 
@bwoebi well, would be cool if.
@Ocramius you can achieve the same by just keeping all the code you've written over the years ;)
 
12:15 PM
@Gordon it's a lot nastier here, I fear
 
although sometimes I marvel at some of my own old code. happens rarely, but it does. I guess that's early hints of my genius shining through⸮
 
@Gordon Are you getting delusional? :P
 
@Gordon I have experienced that only with my JS code, because I use it only in short bursts. And I actually see it a worrying sign, because it indicates that my JS skill has a habit of devolving.
 
12:32 PM
@Fabor Why'd you ask about auryn?
Oh, I only need to use it in the controller resolver
Anything from then onward (IE, not framework stuff, your actual code) is DI'd and your ide then doesn't see any issues
 
Hello.
 
I just realized that I didn't prepare slides for today's talk
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF...
 
go go beamer
 
...uuuuuuuuuuuuuuuuuuuuuuuuuuuuuu...
 
@LeviMorrison The more I write PHP code, the more I want return types and nullable typehints...
I want a parameter to be nullable but not optional. argh
 
12:41 PM
@Jimbo Just about how your IDE supports 'Click to definition' on the ->make('suff')
 
Oh man, PHP has by-value array comparison? <33333333333
 
lol
 
@Fabor It doesn't unless I put a phpdoc @var above it. But then again like I said, I don't use it to create objects manually any more, it's all done automatically so it's a null point for me :-)
 
hm
I can't find where fpm loads all the pools conf files
 
12:49 PM
with it's extremely over complicated config parser, of course ...
 
@Fabor I'm by the way using Auryn in combination with Arya which is an ideal combination I think.
 
not even talking about that... just the fopen...
 
@bwoebi Hmm, I should familiarise myself with Arya.
 
how do you call this part: "key" => "value" in and array like: array("key" => "value");
"how do you call this part: "key" => "value" in an array like: array("key" => "value");" an not and
 
1:05 PM
I don't think array('this' => 'part'); has a specific name. Just refer to it as the arrays keys and values.
 
:P
 
okay thanks @Fabor
Than another question
I am making an array of $tables which contains queries only.
Can I do something like $tables[] = "name" => "query"
 
@Fabor @MikeM. I'd call it key-value pair.
 
@bwoebi Allright and with my other question I hope you can answer me that aswell :)
 
1:12 PM
@MikeM. you mean $tables["name"] = "query"; ?
 
not really
 
:P
 
I want to loop through the key-value pair.
 
huh?
 
on a normal way it would be: $tables = Array("name" => "value");
 
and then foreach($tables as $key => $value);
 
Hey guys; I'm a TOTAL PHP and MySQL noob; I've got a MySQL query cobbled together that's not yet working. My table name is cms_testimonials, and I want to output a number that counts how many rows have the value "1" in the column "approved"

<?php mysql_query=("SELECT approved, COUNT('1') AS count FROM 'cms_testimonials' WHERE approved = '1' GROUP BY `approved`";); ?>
 
I want to do the same but withouth giving it an index.
 
I know it's probably some syntax thing, but I haven't done enough of this to know what's wrong with it
 
@MikeM. I suggest you go to CodePad and fiddle around with array structures.
 
1:14 PM
@Fabor \o/ trials
 
@PeeHaa It's a crazy easter egg if you manage to watch the whole thing.
 
@Fabor What us codepad for? XD
 
@Fabor Yes if you use the Dynamic Return Type Plugin PHPStorm understands the make function returns an object of the type it's making if you add:
{
    "methodCalls": [
        {
            "class": "\\Auryn\\Provider",
            "method": "make",
            "position": 0
        }
    ],
    "functionCalls": [
    ]
}
 
@MikeM. You could guess until you get the right answer... or click the link.
 
hmmm
 
1:15 PM
Danka Danack
 
to a file named dynamicReturnTypeMeta.json in the root of your project. /cc @Jimbo
 
So anyone has an idea what I mean?
this: "$tables = Array("key" => "value");"
needs to be into:
$tables[] = "key" => "value";
but is that possible?
 
@MikeM. How about buying or downloading a book on "how to program in PHP" rather than asking people basic syntax questions?
 
@PaulGrant first of all, you should probably use PDO instead of the old mysql_query() functions (nobody has maintained them since before americans invaded Afganistan)
 
@Danack I don't think that's in a book like how I want it.
 
1:17 PM
Oh, I know nothing about PDO
 
I neither think doing stuff like I ask the question for is in the range of "basic"
 
@MikeM. If you knew the basic syntax of how to use arrays in PHP, you wouldn't be asking that question.....
 
@Danack Do you know it then?
 
2 mins ago, by Danack
@MikeM. How about buying or downloading a book on "how to program in PHP" rather than asking people basic syntax questions?
 
@Danack That's not what I asked, I ASKED you a BASIC YES/NO question.
So once again: Do you know it then?
 
1:19 PM
Yes thank you.
 
@bwoebi I think it is this tho' XD
@Danack Was that hard?
 
@PaulGrant well .. you know nothing about the old mysql_* function either .. so ... I see no problem =P
 
@bwoebi I am pretty sure it is :P
 
Hah!
A valid point
Yes, I'm reading on PDO now
 
@PaulGrant I kinda got with this related to PDO:
3
Q: Opinion on this PHP PDO Class

Mike M.I have my PDO Wrapper class and would love to get some more tips/opinions about what you think. This is my first class and I basically put my time into making it as logical and standardized as possible. I know I need to add comments. <?php /* COPYRIGHT © SIMPLEBB.NET CREATED BY: MikeM. ...

 
1:23 PM
@Danack Installed and added that json file to the root of my project, is there anymore setup?
 
@Fabor Shouldn't be - but possibly needs a restart of PHPstorm.
 
Hmm, no joy. Probably something I am doing wrong though.
 
Just to be clear, it doesn't make the string clickable, it make the object that is created once it is made be clickable.
 
@tereško Holy crap, presentation objects!?
 
@Fabor hehe fun
 
1:28 PM
@Jimbo have been using them for UI logic, that tends to repeat: like navigation
here, a method from one of the view's I currently have:
public function element($response)
{
    $builder = $this->templateBuilder;

    $mainMenu = $this->presentationFactory->create('menu');
    $mainMenu->setCurrentItem('main', 'constructor');

    $subMenu = $this->presentationFactory->create('menu');
    $subMenu->setCurrentItem('constructor', 'exercises');

    $exercise = $this->presentationFactory->create('exercise');
    $exercise->prepare();

    $this->layout->addParameters([
        'mainmenu' => $mainMenu,
        'submenu' => $subMenu,
 
@tereško in the example you give here: http://stackoverflow.com/questions/5863870/how-should-a-model-be-structured-in-mvc
I understand that you pass the view a ServiceFactory. Then depending on the information the view needs, it creates a Service using the Factory and then this service on the other hand knows how to instantiate DOs and DMs using the appropriate factories. Am I write in my understanding of the workings, and additionally why do you call the DO and DM factories to instantiate objects inside the mapper. Can't you just use new with the necessary mapper, domain object in this cas
 
emm .. wat
you seem way too focused on mimicking
 
not really?
I am trying to understand why you have decided to pass the service DO and DM factories
to make new instances of User
instead of calling just new UserMapper
 
yes
technically you can do that with DI Container instead
 
ok, thank you, I am just trying to understand how things work
 
1:35 PM
@bwoebi it was indeed that. Thanks man.
 
@Jimbo well, it is kinda complicated. Mostly I decided to use them because my views started to become way too large. I needed to extract the repeating bits somewhere. So, I created a Layout class for assembling templates and populating values. And moved the UI logic to the presentation objects.
my current project stands at 32k lines of code and I suspect that the final result will be close to 45k
 
Thanks @Jimbo for you comment, I already understood that XD
 
@tereško Man, I wish you wrote blog posts -.-
 
@Jimbo many people do this. Usually you have a layout where you have a wrapper template, in that template you have 2-3 different sections (Depends on the design) but usually there is a menu and maybe a column with information and a general content
you can basically split and nest the rendering of those things
 
well .. here is the layout's definition:
 
1:43 PM
and then write 'widgets' which are more or less generators for repeatable view code
 
public function buildLayout()
{
    $builder = $this->templateBuilder;
    $layout = new Layout($builder->create('structural/container'));

    $layout->arrange([
        'base' => [
            'alerts', 'main' => ['navigation', 'layout']
        ]
    ]);

    $layout->setTemplates([
        'base' => $builder->create('structural/base'),
        'main' => $builder->create('constructor/main'),
        'alerts' => $builder->create('alerts'),
        'navigation' => $builder->create('widgets/navigation'),
 
well at least that is how I handle it
@tereško looks neat
 
the usability seems ok-ish
it tends to get confusing if I need to render "list of elements containing lists"
 
@AlmaDo Strongly no for me. There are times when the judicious use of a global variable is appropriate - particularly for debugging or an elegant hack. Making it harder to use globals won't make people write better code, it will just make it harder to write legible code.
 
@Danack I've never ever seen somewhere where global was good
 
@Jimbo s/good/less worse than the alternative.
 
lol
Let them stick with legacy code, and PHP 5.x then
 
the Yii framework uses a singleton to keep the application instance which is also used for Service Locator -> yiiframework.com/doc-2.0/yii-baseyii.html#app-detail
nice mix of two anti patterns
 
1:57 PM
Nah not legacy - I've linked this before but this hack allows me to write example code once, and be able to write an example that looks like it's just emitting an image to the output, but can actually be used to write the image to disk with the appropriate file extension.
 
Bring back the cane - teachers should hit pupils who write bad practice code. They'll soon learn
Death sentence for facades.
 
@Jimbo In my experience teachers don't know how to write code unless it is cobol
 
Or Fortran 77
 
@Jimbo the problem is that many times people have personal opinion on what good code practices are and there aren't always many set guidelines how to do it. It's not law or finance to have well established rules
 
chmod 777 = (new ElectricChair($user))
@ziGi This is a fair point - hence experts prove their opinions with long articles and examples
/cc @MartinFowler
 
2:02 PM
+ the fact that teacher's knowledge is somewhat different from what you usually can learn from doing and checking what other people are doing
@Jimbo I tried to reproduce part's of the example code Martin Fowler is presenting in the book in PHP and sometimes it doesn't make sense because it is lacking some parts
if you ask me why I do that, the only reason is to feel how the whole thing fit together, you know that when you write something, it is easier to understand
 
I still lack comprehension on many of the patterns since it is much easier for me to understand with more meaningful and not so scattered examples
 
@ziGi In general it works better to just write code and you will use patterns automagically
 
@PeeHaa yeah, that is what I started doing but I get confused sometimes :D
and if I try to ask people, they need a lot of context to comprehend what is happening
 
Again imho this is because you are trying to force patterns into your code just because
 
2:13 PM
Actually what I do is I try thinking in layers and SoC
 
@ziGi keep in mind that when PoEAA was written, web was still static
there were no "single page applications"
 
true
Can you guys recommend a sample project that I can use as an example of well implemented code (the whole process, from making a request to outputing the properly formated data)
 
I just want to see how it can be done properly
 
nope
 
2:21 PM
no such thing
 
also, I cannot even share anything of min because the only project of min which is publicly available was rushed and kinda bad
problem with code is that your understanding of what counts as "well written" changes
 
Hah, thank you teresko, I am not asking you to do so, I was just wondering
that is true
my idea of good code changed quite a lot the past few years
and the problem is there are a lot of people writing articles that are BS but they truly believe themselves
 
well , that publicly available sample can be found here, but currently I would describe it as "kinda crap"
@ziGi that's because they never attempt to defend their ideas
 
so no critical thinking basically
 
that's not really it
every time you write something and someone either disagrees or asks questions, it is an opportunity to examine your own idea
 
2:27 PM
btw Dan told me that passing a DIC as a Dependency is a bad practice since it hides the dependencies used in the class that are being used
doesn't the same apply for passing factories
 
basically: your idea is a "hypothesis" and people taking it apart is the "experiment" which either proves or disproves the hypothesis
 
@ziGi That is called a service locator not a dic
 
^ that
 
Good Q, depends if you're typing a string to get what you want from the factory: ::build('something') ---- opinions on this?
 
@Jimbo saw it floating around. It's bullshit
 
2:30 PM
If by "Dan" you mean me, then yes: a "dynamic factory" which is intended to be used as a DIC, when passed around becomes a service locator. It's usage, not implementation.
 
hey guys any good pagination script do you have ?
 
@DipaliPatil there is no pagination, only zuul
 
@DipaliPatil you are asking the wrong question
 
Morning.v2
 
what you should be asking is: how do you make a simple pagination widget
 
2:32 PM
yeah
 
@tereško Just curious, why do you $builder = $this->templateBuilder; -- for brevity?
Rather than $this->templateBuilder->method()
 
H
 
@RonniSkansing Morning
 
@DanLugg because I hate writing 10 times $this->
 
I'm a fan of that style. If you make the templateBuilder an argument to the method, then it's only 1 line to change.
Also that ^
 
2:34 PM
I'm a fan of that style only when over the rule of 3
 
Hey @PeeHaa, what are you doing today?
 
If I'm going to write $this-> more than 2 times, it becomes a local var
 
I need to limit the info upto 5 matching names and then show another 5 matching names info
 
@Jimbo the code sample you are referring to have not been cleaned and/or refactored
 
@RonniSkansing Nothing much. Was a bit ill today for the first time in years, so just working finishing feedr now
 
2:35 PM
@tereško Nah, I wasn't referring to the code sample, merely voicing my opinion alongside others
 
Fair enough. I really only do it where technical constraints are the problem; such as callables.
Like, $this->callback() not working (yet)
Although, I guess it'll be ($this->callback)()
 
@PeeHaa hope you get better soon. Is feedr basicly a rss for super packages?
 
@Dan, so basically people should always pass dependencies. What happens if you have one too many to pass. I guess usually in such cases there is a big chance that you violate SRP inside a class using that many dependencies
 
^
 
Ok, I see
 
2:38 PM
@teresko so do u've any kind of script for it ?
 
@RonniSkansing What it does ATM is that it creates feeds for repo releases
 
@ziGi Pretty much, refactor into a component that hooks some of them together
 
Gotta be careful though, if you change one of those objects out, you want to be able to only change the one thing in the refactored class, not the other one you put with it
 
@PeeHaa cool [= +1
 
2:44 PM
@DipaliPatil not really. It's just something you usually write on the spot, because there are multiple ways to implement pagination. Can you show what the end result should look like?
are there only "next" and "previous" buttons? or maybe it shows all the numbered pages ? or it shows part of the numbers and "first"/"last" buttons? ... are you might have noticed by now, there are many ways to do this thing: dribbble.com/tags/pagination
 
@Jimbo but then there is something still bothering me. If we have a Mapper class used to retrieve and persist data. Then aren't there two responsibilities. Because the class can change if the retrieving of information changes, and then the class changes if persisting the data changes
 
jeeej... jquery site is down, just when I need something ><
 
@Naruto try vanilla-js.com
 
Would being able to typehint a numeric range or enum be a useful thing? int $size = [1,2,3]
 
@tereško just looking up syntax of a function.. + some more info
 
2:47 PM
@ziGi Generally you'd persist your data where you'd also want to retrieve the data from?
 
but SO seems to have the perfect answer for me :)
 
"Let's save this data in db"... waits... "Why the shit is there no text file with the passwords in them?"
 
context?
 
@Jimbo that is true but then you have 2 reasons to change the class.
if the Domain object changes, then you have to edit the save() and the get() functions of the mapper
 
emmm .. no
 
2:50 PM
@ziGi there are no silver bullets, sometimes it makes sense to split it sometimes it does not. It is very context dependent
 
you might have to change the mapper only is the public interface of the domain object changes
if the changes are in the logic inside, then that has no effect on the mapper
also, keep in mind that, if two objects have different public interfaces, then they are instances of two different classes
 
imo it makes no sense to look discussing advanced architecture and design, when you are building a tree house.. I made that mistake and hopefully will not do that again.
 
TreeHouseInterface
 
:D @RonniSkansing in a way you are right, I am just trying to understand the concepts
 
@RonniSkansing it kinda depends
if you are making the treehouse for yourself, it actually is the best place where to explore new ideas
 
2:56 PM
Because if you fuck it up you don't want some kittens dying, just you
Don't sacrifice kittens
 
What if it was to save two kittens?
 
one more thing, how do you thing is more logical to separate files logically i.e.:
Entities
    Article
    User
Mappers
    Article
    User

Or modularly i.e.:
Article
    Entities
    Mappers
User
    Entities
    Mappers
 
<3 kittens. @tereško sure [= I just get this feeling of "emperor's new clothes". (sorry If that is a unknown ref, it is a danish one...)
 

« first day (1496 days earlier)      last day (3462 days later) »