« first day (1887 days earlier)      last day (3067 days later) » 

8:10 PM
@DanLugg burgers
 
Abe
@NikiC also on linux: Warning: PHP Startup: Invalid library (maybe not a PHP library) 'php_popov.dll' in Unknown on line 0 getting the same error on windows too (enabled display_startup_errors)
 
Did anyone use protocol buffers so far? How do you check if all required fields exist? required is no longer a thing in proto3.
 
@Abe Windows: dll, Linux: so
 
Abe
@NikiC yes, it only changes that in the error message
omg i'm an idiot
 
8:27 PM
@DanLugg big bottle of water with lemon juice in (it's got electrolytes) and then go sit in a sauna.
 
@kelunik Is there any reason why they removed that?
 
Abe
I DID IT!
sorry for vamping guys, will eventually become autonomous :B
 
@Abe vamping about creating extensions is more than welcome here :-P After all that's what the chat is about… helping people interact with Zend php-src.
That we occasionally discuss about doing things in PHP is a side effect of our working on PHP.
 
Abe
eheheh :D
current status:
we're gonna need a bigger monitor
 
8:43 PM
or a better tab management :p
 
Abe
also "works" on linux
 
9:03 PM
Do anyone here use some kinda of tab management?
 
wats that
other than ctrl maj w not really :p
 
Can I use "package" instead of "inbox" ?
 
... not sure what you mean but those are two different words. Can I use table instead of elevator?
Some days ago there were some talk about decorators and templates. I don't want to get back on the __toString abuse or not, rather on the correct understanding of what decorating means. For instance, when using forms. One state presents an entity, another one presents this entity, but modifiable, through a form. Is a valid use of decorator to wrap the base entity in a class that would present it's base properties inside form inputs?
 
@Andrea Yours should be real soon, I'm looking forward to it. I've saved them all to my iPad to rewatch one weekend
Going to have a phpnw marathon on my own with a beer. How lovely.
 
9:18 PM
More exactly, I have a renderer rendering a template from an object with a getTitle() method. I can either render it with the base entity, showing the title, or the decorating entity, showing this title in a modifiable input.
 
@FélixGagnon-Grenier I think the 'correct' pattern is to use a factory that takes the 'Entity' and returns a new object that is a "RenderableEntity". That is not decoration really (as the new object is not a sub-class of the old type, but instead is encapsulation.
 
Interesting too - some people are in the school of thought to provide an entity to the template to be rendered
I prefer explicitly providing scalars to the template to be rendered
Perhaps providing the entities to a View, which then provides scalars to the Template. Gah, we've talked about this before, but I've yet to see a super simplified example that I can take away and expand on
 
seems like an extra step, no? the receiving an object to produce scalars part, that is
sounds good @Danack
 
@FélixGagnon-Grenier also, I think you always want to do this encapsulation/transformation as late as possible. Otherwise you end up passing around objects that you 'think' other objects need, which makes stuff more complicated as is a violation of the law of Demeter
 
@FélixGagnon-Grenier The reason is, what if you want to provide that data as a response to an API call, or JSON for a cli output?
All the code is identical, except you substitute what the last bit is
 
9:30 PM
yeah...but that's a slightly different use case isn't it? converting objects to pure data, and then rendering that data to xml/json is different from rendering HTML...usually.
 
If you provide only scalars as your output, no matter what that use-case is, then anything can use it, right?
Just some thoughts, I haven't put this into practice just yet :-)
In fact, I haven't seen anyone use Views yet apart from Danack. Wasn't too simple an example though :P
Sorry, hijacking the convo
 
please hijack to your heart desire. I don't think either me or Danack are feeling ill in this regard
it also is a public chat, iirc
p
 
@Jimbo the issue with that is that you then need to know how the 'View' wants to display stuff....which is probably bad thing. For example if the object has a date field in it, that could be displayed as a "10th July" or unix epoch or "10:20am" or any other way.....If you pass the object to the view layer, the view can choose the appropriate renderer for that object, that formats the date precisely how the view wants it, without anything else needing to know how the view renders stuff.
 
Abe
viewmodel ftw
 
> the appropriate renderer for that object
 
9:43 PM
@Abe Calling stuff a 'viewmodel' is just trying to avoid saying the name HTMLTemplate, because viewmodel sounds more computer-sciency imo.
 
Abe
was talking of cqrs / mvvc
 
that renderer actually then 'depends' on the rendered object. doesnt'it? it would be that factory you were speaking of @Danack
or were you actually really meaning renderer as in renderer. mustache, php or twig renderer
 
"that renderer actually then 'depends' on the rendered object." - no, it depends on the object and a factory to create the formatted object.
For simple cases you don't need to actually create a new object, you can just render it correctly in the template:
{inject name='formatter' type='UnixDateFormatter'}
{inject name='blogPost' type='BlogPost'}

{$formatter->formatDate($blogPost->date)}
For more complicated things you might want to use a full-on factory to do the transformation.
 
@Danack But I'm passing entities to the view. Objects. Like a \DateTime. Isn't it then fine for the view to say "Okay, I'm rendering to HTML this time, I'm turning this \DateTime object into XY format, before I pass it to the template renderer as a string". Meh, I'm not getting it
 
{inject name='factory' type='SummaryFactory'}
{inject name='blogPost' type='BlogPost'}
{$summary = $factory->create($blogPost)}
{$summary->render()} <!-- Only prints out the first 200 characters of a blog post -->
@Jimbo That means that if your web monkeys front-end developers need to change how something is displayed, they need to touch the back-end as well, and I think that is something to be avoided.
 
9:50 PM
Agreed, hmmm
 
It really boils down to how much power you want to give to your front-end developer.
 
back laters, need to eat and put a templating library documentation site online.
 
Zero, to be safe
 
Abe
with viewmodel you'd have the entities with all the stuff ready to use
 
@fiurtod Or how much you want to restrict them, but in a way that doesn't limit their ability to do their jobs.
 
9:52 PM
You provide entities to the template, those entities would have to be immutable then?
 
Abe
it's a total separation of model in read-model (view model, pretty much dumb objects) and write-model (the one that contains logic)
 
Does anybody know what's the correct format for subjectAltName in openssl_csr_new? Or is there something different I miss, because the extension is not listed, it's just merged into the subject.
 
Abe
@Jimbo asking me?
 
@Abe Just generally thought throwing to anyone
 
Abe
in my latest project view model entities are immutables, they just have getters, everything is localized, dates are already formatted etc. the only thing i'm not sure about yet is if they should also escape html
 
9:56 PM
@Jimbo Just to be safe: make them an immutable clone of the real entity that gets discarded after parsing/rendering the view
 
lol that saxophone player towards the end youtube.com/… solo at 2:10 is priceless
 
@fiurtod Thinking that, because I know people like to add plenty of setters and things on these objects :)
 
@Jimbo Yeah, and expose save() to the view for good measure ^^
 
@fiurtod Or just don't use any activeRecord bullshit, and avoid that problem in the first place.
 
@FélixGagnon-Grenier haha, the bass player leaning away: "watch that fire!"
 
Abe
10:00 PM
@Jimbo how it goes with the ddd reading?
 
Finished the book, really good read, ordering the red one just so I can say I've read it
You got the blue one?
 
Abe
i have both
but i'm not sure i actually read them :D surely i could get something from them. will eventually read them again
i skipped too many things before i realized they were telling important stuff :B
 
Some of it went over my head, there needs to be a re-read
 
Abe
prezi.com/hi2dmhfej9zu/ddd-cqrs-sample anyway, this is the cqrs stuff i was talking about (you can zoom in the player)
(but i found overkill trying to share data between the two models)
 
I'm off for the night, cya guys
 
10:08 PM
Night
 
Hi all. How do I need to escape various characters to make this work?

find . -name '*.php' -type f -exec sed -i 's|require("$incDir/header.php")|require("$incDir/header.php");\n\necho '<article>'|g' {} \;
 
Abe
the result is great. when i write the domain logic i don't need to care at all of displaying stuff. the write model is specifically designed to maintain the business domain and nothing else.
 
Abe
next time will also try event sourcing :D still havent wrapped my head around that though
 
10:13 PM
fuck I forgot to download that featured poker gif just there, and now it seems dead
 
@Abe Separating services into Application and Domain layers helped me allow different things like CLI / HTTP use the same codebase, just go through a different part of the application layer
 
Abe
yeah that's useful :p
it's not just services though, the application has its own model (domain model & application model)
i need an interesting project to try some stuff out
and twice the time i have currently
:D
another thing i want to try is applying cqrs also to services. separating the "obtaining the data from the repositories" from the "doing stuff with them"
 
Isn't that just injecting a repository, and an object that does something with the data from the entities, into a service, that uses the repository to get the entities (say, with some specific query), which then passes it to the doing thing object
class Service { public function __construct(Repository $r, MessageSender $c) { } }
 
Abe
yes thats what you usually do today, but i want to have service methods obtaining already fetched data, rather than initiating themselves the read from the database
 
Got a simple example like mine above you could change it to to demonstrate this?
 
Abe
10:26 PM
function doStuff($id, $stuffParam){
$stuff = $this->repo->fetchStuff($id); // i want to do this in an earlier moment
$stuff->doStuff($stuffParam);
}
$stuff is the ar
 
0
Q: Generate CSR with subjectAltName extension

kelunikI'm currently using the following code to generate CSRs with subjectAltName for additional domains. $domains = ["example.com", "www.example.com"]; $san = implode(",", array_map(function ($dns) { return "DNS:" . $dns; }, $domains)); $csr = openssl_csr_new([ "CN" => reset($domains), ...

Just in case somebody knows how OpenSSL CSRs in PHP work.
 
Abe
the problem with that code is that sometimes you can't reasonably wrap the service method (in some outer service method) without messing up things with database transactions, row locks and stuff
not sure if i'm being clear enough @Jimbo sorry :( my english is usually bad but is especially bad when i'm tired
 
So, how I see it possibly working out, is that your controller would garner the id from the request, ensure it's valid as in non-domain-logic wise (it's an integer, for example) and then pass it to your application layer, which takes the integer, uses the repository to convert it to a business object, then passes the business object to your domain layer to do stuff with it
 
man. the hardest thing with all this is to keep thing in what's doable in a day.
 
I see the separation defined by constructor parameters... the application layer takes simple scalars, nothing to do with business objects. The domain layer asks for business objects
(DI wise)
That's what I got from the book, could be complete bollocks :P
 
Abe
10:32 PM
in this case i'm inventing stuff @Jimbo it's not something i did read in the books
 
@Abe It's alright man, I might be too
Interpreting it wrong that is
 
Abe
but yeah that's how we do it currently
 
@Abe What, how I explained it?
You know when you have a tonne of services? You should partition them like this. #php #ddd http://t.co/4DoIAPdQus
That above helped me with that ^
 
Abe
but i was mainly focusing on the service method, rather than how data gets inputted to them
function doStuff($id, $stuffParam){
$stuff = $this->repo->fetchStuff($id); // i don't want the service method to actually "fetch" here. the repo must have Stuff with id $id already in memory
$stuff->doStuff($stuffParam);
}
 
@Abe Yeah, that seems right to me...
You're saying that's wrong or not the best way of doing it?
 
10:37 PM
lol. for a moment there I understood something about partitioning a disk. and was somewhat put off by what I was seeing :p
 
Abe
@Jimbo it may seem right but that's not how it is usually done, afaik...
i'm saying that "fetchStuff($id)" is ending up to be a query to a database
 
off-topic - Just got this...
@Abe If you interface your repositories, it could get it from a DB, or http request, or cache...
 
@Jimbo you've got to be kidding
 
Abe
what i want to do instead is (totally made up code):
$someServices->prepareRequirementsForAddToCart(....);
$someServices->addToCart(....);
@Jimbo i'm clearly failing at explaining it :B
 
I don't know what that code does without parameters
@FélixGagnon-Grenier Nope, just seen it now haha. Great spam...
 
10:42 PM
Sometimes, when I realize programmers, probably even some of them we speak with daily here on so, do shit like this, extorting, spamming, I get filled with rage and hatred.
At least that one sucked.
 
Abe
$userServices->prepareRequirementsForUpdateUsername($userID); // fetches the user $userID and keeps it into the repo, locks the row for writing
$userServices->updateUsername($userID, $newUsername);
so updateUsername would fail if i didn't previously fetched the user by calling that method
 
Why not...

$user->updateUsername($username);
$repo->save($user);
@Abe That requires the user to have called that previously though
 
Abe
@Jimbo yes
 
What if they forget? Isn't that a more fragile api?
 
Abe
i don't know how to do it properly yet, that was just an example
and, you should get rid of doctrine for once :D
 
10:46 PM
Haha, you're probably right
It's saved me so much time though
 
Abe
@Jimbo because that's bad :B
 
and with PHP 7, which I haven't gotten yet
Hmmm, so you're suggesting... UserUpdateService::updateUsername($id, $name)
You always need to find the id beforehand though
Be nice to have the object you're updating
@Abe I think you're right, we need some concrete examples and links on this. Is this what CQRS is talking about?
 
Abe
we are not communicating :D
but it's my fault
will show you some code once i write it..
 
Nah, we're both tired :-)
Up until 2am, star wars at 12:01am
 
Abe
the ultimate goal of that is fetching requirements of a transaction in a predetermined order, so that i can avoid deadlocks entirely (99% of times, actually :B)
 
10:49 PM
What are these requirements of a transaction?
Like, that the row isn't already locked?
 
Abe
data to fetch from a database
 
Ah okay
ORMs handle that for you don't they?
Cough
 
Abe
In concurrent programming, a deadlock is a situation in which two or more competing actions are each waiting for the other to finish, and thus neither ever does. In a transactional database, a deadlock happens when two processes each within its own transaction updates two rows of information but in the opposite order. For example, process A updates row 1 then row 2 in the exact timeframe that process B updates row 2 then row 1. Process A can't finish updating row 2 until process B is finished, but process B cannot finish updating row 1 until process A is finished. No matter how much time is allowed...
@Jimbo don't need them, it's just about writing an api that doesn't suck :D
back to C. i'm getting an *uninitialized* and i have no idea what it is
 
another way to avoid deadlocks is to not do transactions :p
 
Abe
lol
 
11:03 PM
Meh, just block while you wait for others to complete
:D
 
wow. You know, when eating barbecued peanuts messing your hands?
Well, I just got smarter
I took a spoon.
 
Or just pour them from the bag directly into your mouth.
Param naming time: I'm serving up some Javascript files that get packed together into a single request with a URL like /js/file1,file2,file3 which matches a route like: /js/{$whatIsAGoodNameForThisParam}
 
i use /javascripts/{which}
but I associate which with file1,file2 in a ini file. so the request is more like /javascripts/default, javascripts/backend
/js/{$files}
 
Abe
/js/{$commaSeparatedJSFiles}
need to find a game to play while compling. i'm in that club too now
 
11:21 PM
so we received the files from the designers. I was anxious, now I'm scared. two months now seem very very short.
you into rpgs @abe ? dragon age origins : binding of isaac.
 
Abe
compile takes few minutes, need some stupid flash game or something :B
 
> binding of isaac.
there's a web version
 
Abe
checking
lool
 
Abe
11:39 PM
how do i get the name of an opcode?
 
@Abe zend_get_opcode_name
might be it?
 
Abe
checking
 

« first day (1887 days earlier)      last day (3067 days later) »