« first day (1207 days earlier)      last day (3967 days later) » 

14:00
@hakre if you report that to seldaek, he'll insta-delete them :P
@rdlowrey no, it's just manual wiring
user895378
Interfaces by definition aren't manual.
@dyelawn because that's probably the only job of a factory
user895378
You're making interfaces out of implementation details.
user895378
And wiring is always an implementation detail.
user895378
Which reduces to my orginal point:
user895378
14:01
FactoryInterface is bad OO design.
@rdlowrey I'm not saying that FactoryInterface returns a FooFighters instance. It returns mixed
FactoryInterface is a base component of a container that uses callbacks as wiring mechanism, where FactoryInterface is simply one specific case
so there's nothing bad in defining how a factory must look like to be recognized by that particular container
user895378
The flaw in the logic is that there's nothing bad about using a container in that way.
I'm not building an interface for the object that builds FooFighters, I'm building an interface for an object that can build anything
user895378
None of this obfuscation is necessary if you write actual object oriented code, though.
@Ocramius i'd argue that the factory should also handle some configuration, but to-may-to to-mah-to
14:03
@Ocramius wait, you're saying that FactoryInterface should return some other Interface? :D
@rdlowrey there is no obfuscation
@AlmaDo no, it returns mixed
I like this debate. It is interesting.
user895378
5 mins ago, by Ocramius
class FooFactory implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $sl)
    {
        return new FooFighters($sl->get('audio-device'));
    }
}
user895378
^ I call that obfuscation.
@rdlowrey yes, this is an impl. of FactoryInterface
user895378
14:04
Unobfuscated API looks like:
user895378
class MyClass {
    function __construct(RealDependencyNotSomeContainer $obj)
}
@rdlowrey no, you're not getting it
class FooFighters actually looks like that
I'm not injecting the container
user895378
I am getting it. Factories are always implementation details. They shouldn't be interfaces.
user895378
callable is enough.
class FooFighters { public function __construct(SoundDevice $device) {...}}
14:05
@Ocramius wow first I guess I need a local backup over here of these. I will ask the comitting developer and hopefully get an answer to this.
Otherwise Insta-Del sounds like the right answer.
callable doesn't express how the end user is supposed to build the factory, @rdlowrey
that's why the interface exist (over making the lookup over the codebase simpler)
user895378
The end user shouldn't know how to build the factory.
@rdlowrey why? The end user is building/wiring things
user895378
9 mins ago, by rdlowrey
Objects are a black box.
yeah
user895378
14:06
9 mins ago, by rdlowrey
Not an opportunity to swap out every conceivable line of code with your own injected parameters.
@rdlowrey where does your black box come from?
@rdlowrey that line in particular makes no particular sense to me, needs more explanation
user895378
It comes from new. And if you need to be fancy it comes from a factory. A factory is nothing more than a callable. As such there is no need for an interface to define it.
@rdlowrey the interface is a utility that is used to dictate parameters for the implementor
Okay, okay, what if you have the interface there so that in the future you merely need to implement that interface and you'll know what the method name you're building the objects is, is called?
So it's for collaboration between developers
And yes, callables work as well btw
user895378
14:09
I understand that. But if you know what parameters you need to create the factory to create the object you've exposed too much information about the innards of the object.
@rdlowrey ok, so here's the catch
I'm willingly coupling that code with that container
user895378
Then you have to have it because you've made a bad design decision.
to make its usage explicit, documented (inherited doc) and recognizeable at first glance
user895378
This is the start of the argument against SL.
user895378
Now you're locked into vendor code that you shouldn't be locked into.
14:10
no, it's not a bad design decision, it's perfectly ok to have that particular code being coupled to the framework, because it is instantiation logic that will be thrown away if you change framework
it is even simpler to find that out
@Jimbo kinda, yes
user895378
@Ocramius That logic breaks because once you've employed it the cost of changing the framework is now prohibitive.
where i've found interfaces most useful is as a kind of replacement for static typing. if i know your class implements the interface, i know it does some things. i don't see a reason to need to know that your class calls up an alias from the service locator
@rdlowrey no, that factory is part of service definitions, and service definitions change at every change of dependencies
@Ocramius: Also für phpcb kann ich keine alternative auf packagist finden, aber bei einigen andern wie zB. doctrine-migrations-bundle sieht das anders aus. Davon bin ich aber nicht betroffen ich habe wohl nur das eine phpcb Packet da.
Evtl. ist das aber auch bei PHPUnit mit drin seitdem die auf composer migriert sind?
@dyelawn you're probably missing the scope
user895378
14:12
Service is the word frameworks use to mask bad practices.
maybe. what scope?
@hakre was ist phpcb?
@rdlowrey gosh, no, lol
@rdlowrey you talk as if you've only used the FWs that were forced upon teresko :P
@dyelawn that factory is just a named closure used to build a "FooFighters" instance in a particular application
user895378
Yes: if you choose to use a SL then FactoryInterface makes sense. Otherwise it's completely unnecessary.
user895378
Static coupling is bad. If you can avoid it, you should. If not, you're locked-in to those dependencies/couplings.
user895378
Some people are okay with this because they'll never migrate away from a framework.
user895378
14:15
The argument is often made for this. I just don't buy it.
No, even if I'd migrate to a different FW, that replacement is just a single refactoring
@Ocramius what are you doing with it after you build it?
user895378
Only if the new framework engages in the same bad practices.
user924016
=]
@dyelawn you don't know - its only job is to provide you with an instance of FooFighters
user895378
14:15
This is the fallacy. That by standardizing the anti-pattern the anti-pattern becomes okay.
user895378
The anti-pattern doesn't get better -- the frameworks are just all enforcing equally bad design.
@rdlowrey it is not a bad practice to have manual wiring - I've been "advertising" autowiring via constructor injection for a while, and then I found out that I was debugging wiring more than coding
@Ocramius could i not get that just by injecting it as an argument in the constructor of whatever context i'd like to use it in?
so yeah, using SL + factories that consume it turned out to save me a lot of time
@dyelawn yes, but then you'd be coupled to that particular instance and instantiation logic
@dyelawn while a factory can be replaced
user895378
That argument is a non-starter. "I drove a crap car therefore all cars are crap"
14:17
@rdlowrey no, it's "I drove a space-ship, then I decided that doing repairs in space is not viable, so I went back to driving a car"
Autowiring (with logging) is awesome... I can create a new set of classes, slot them in, then typehint for one of the "services" in my controller and BOOM. Instant access. Wish you could do that with women other frameworks. I'm going back to my work now
user895378
@Ocramius I genuinely appreciate that we can have discussion on things like this without anyone getting upset :)
@Ocramius packagist.org/packages/covex-nn/phpcb - PHP_CodeBrowser, I suspect this is a former Pear Package, Mayflower has it on Github: github.com/Mayflower/PHP_CodeBrowser
@Ocramius there are better ways. I hope you find it :)
14:18
@Ocramius yeah, but i'm going to have to replace everything involved with the factory, too, since all the interface does is call up an alias
@dyelawn yes, that's the point - factories are part of your service definitions
user895378
@Ocramius It's really nice as compared to say ... internals ... where people immediately go off the deep end when there's disagreement about the right way to proceed :)
I need an honest opinion: Fetch all QA Tools as Dev dependencies via composer?
its not like that interface is ensuring that what i get back is an object that can playSomeHardcoreRockTunes() and handleSoftAcousticSettingsIfNeedBe()
@hakre I do that, yes
because otherwise I'm gonna have to use PEAR on every second system
which is crap
user895378
14:19
^^ That's something everyone can agree on.
@hakre unless project is only within your team and you enforce them to install all the tools globally
@rdlowrey I am still in favor of auto-wiring, but for practical purposes in my current apps I really had only trouble with that (whatever container I used), because code is never what you'd expect
the division X from company Y that built package Z that I need to use will likely be incompatible with my container and stuff
user895378
class Wrapper {
   // ...
}
so yeah, I ended up using factories + sl and having clear documentation on BC breaks in service definitions
@Ocramius So if there is no issue with pear, this ain't an issue and is just not necessary?
14:21
@rdlowrey I'm not paid for writing wrappers all day ;)
user924016
I am..
@RonniSkansing lucky :D
wrappers are okay if the Interface is not bloated
user924016
haha
user895378
@Ocramius lol I get it. At the end of the day, best-practices are great, but homey gots to get paid!
user895378
14:22
$$$$$$$$$$$$$$ €€€€€€€€€€€€€€€€€€
@rdlowrey well, yes, plus I see changes in my factories in diffs
which is also working great for me
where's the bitcoin unicode
@hakre well, it is not an issue if you expect your code to run always on the same box
user895378
@Ocramius Will doctrine models break if I instantiate them using reflection to bypass the protected constructors?
user895378
(was wondering about that)
14:24
@Ocramius or to have Q&A under configuration management.
@rdlowrey which models?
Quick sanity check if you gentlemen would oblige.... I have my domain model built up like this.
$productMapper = new ProductMapper(new ProductStoragePDO(new \PDO($dsn, $username, $password)));
As CM is missing this might be a way to go. I chew on it a bit, at least I can see the reason.
And I use like:
$productMapper = new ProductMapper(new ProductStoragePDO(new \PDO($dsn, $username, $password)));
$product = $productMapper->getById(10);
// do something with product
$productMapper->save($product);
user895378
@Ocramius I dunno, I've just had complaints from people trying to auto-instantiate doctrine things with auryn because inexplicable protected constructors.
14:25
@rdlowrey ah, yes, the EntityManager won't work there
@rdlowrey you must use EntityManager::create()
oh, by the way, talking about this
user895378
Does it rely on some static thing though or is it just a stylistic choice? I.E. can it be worked around since I already have a reflected ctor that I can make accessible?
I had a funny autowiring config some time ago
@rdlowrey it was an old stylistic choice to ease use for newbs
Yeah, we talked about this
user895378
BTW this protected constructor thing makes steam come out of my ears :)
I had to alias the constuctor to ::create for EntityManager
14:27
shouldn't they just set a shared EntityManager @rdlowrey
WHy would you protect a constructor?
Is this sane? Storage layer is basically just performs crud operations given an array.... and Mapper communicates with Storage layer via keyed arrays.
this is a terrible example that I had to tweak for auto-injections on some software - I used it as an example to play around, if I look at it now I wanna cry
@Fabien no public instantiation
@Fabien Singleton is the only reason I can think of
user895378
14:27
@andho One would think.
@Orangepill no, there was another one, but I can't really remember it... will ask
user895378
@Ocramius It's okay ... any code I wrote more than ~6 months ago makes me want to cry.
@rdlowrey interesting. for me it's about 2 months
user895378
Well most of it, anyway. Sometimes I'm pleasantly surprised and I give myself a virtual high-five.
I wish I could get 2 months out of my code :)
14:29
@rdlowrey this is how I used the static create to get PHPCR running: github.com/Ocramius/ZfPhpcrOdm/blob/master/config/…
@Orangepill You're mapper feels like a Repository. And why do you have a new PDO connection for each Mapper? In terms of AggregateRoots that makes sense though
maybe would be the same with your container
user895378
@Ocramius Ah yeah, you could do that ... but it should be unnecessary if you have a public ctor :)
@andho I was just illustrating that the pdo object is an injected dependency ... in most cases it would be a shared instance.
@rdlowrey yes, but this is not the case :)
same for factories that do fancy stuff
user895378
14:31
lol full circle
@Ocramius that looks like code to me haha
user895378
Okay chaps, the dependency discussion was fun. Gotta go write some code.
Well, here's another example
this is a bit more than just container auto-wiring, heh
it's a bit scary seeing this in a heavily used Library
@andho why so?
I mean, we have different "glue" modules/bundles for symfony and zf that provide just container/config stuff
14:34
I only expect to see SL (never?) in application code. So seeing it in a Module is unsettling
this code is not nice and probably will never be
@andho it's a factory (again)?
I should do more coding to get my head around this stuff. I feel like I'm getting irrelevant.
@andho more like you missed the previous comments :)
@Ocramius so in this case you would pass it a PDOFactory that implements the ServiceLocatorInterface?
@Orangepill no, the locator probably uses a factory to build the PDO instance at github.com/doctrine/DoctrineORMModule/blob/…
14:39
@Ocramius nop i've been following keenly
PDOFactory - dunno, it would probably just sanitize the config before building a new PDO, for example - the locator would most probably be unused in that factory, @Orangepill
Hmm, problem is if composer fails to install dev-requirements
Which is just the case... argml.
@hakre can happen
@hakre missing requirements?
Nope, just PHP ZipArchive short on Windows OS.
pdepend
14:42
it therefore does not make much sense to commit composer.lock with dev requirements.
setup up a local repo for dev deps @hakre
I just have to fix a bug.
It's only across the whole applications.
I think I will use a global include path that can be configured via php.ini
morning
@happy morning
@Orangepill thx
I discovered "Beats Antique" music group not so long ago and I must say it is very good, especially while I am programming
14:55
@crypticツ There's a bug in the opcache around the config settings - Joe tried to fix it, but couldn't provide an example that didn't involve pthreads, which was one of the reasons the PR wasn't accepted. Do you see that in standard PHP with a standalone example?
@Ocramius: Is it suitable to only use dev-deps in build, but to have composer locked to non dev for the dependency/ies?
@rdlowrey I'll try to have a look at the Doctrine entity manager problems, and also raise a couple of issues that should be at least thought about before a 1.0.0. However I also have a large refactoring to finish off and see if it's acceptable. Basically splitting the injector class into two parts:
hi
i) The actual injector that does the injecting.
ii) The bit that hold info about what should be injected - which would allow people to use their own totally custom class for this, rather than having to sub-class the already very complicated injector class.
15:05
hi @NikiC!
user895378
@Danack Yeah sounds good :) I know we're all busy ... I'm particularly bad about trying to focus on about 10 projects at once. We'll get the auryn stuff to v1 eventually.
user895378
@NikiC hi!
Anyone can recommend me a new webserver? I am using a crap one atm
Why is it crap?
♫ All that she wants... is another baby ♫
howdy y'all!
15:19
Anyone an idea why gzdecode() error can't be suppressed?
$torrent = (@gzdecode($torrent) !== false) ? @gzdecode($torrent) : $torrent;
I know it's not fast as it calls it twice, just wondering why the @ is still throwing an error that my logger is catching
@Jimbo Because that is what it is supposed to do: php.net/manual/en/language.operators.errorcontrol.php
:14494259 $value = @$cache[$key];
// will not issue a notice if the index $key doesn't exist.
I'm still getting that error with @gzdecode(), it's not being suppressed... hmm
If it is only your error logger that is catching it and the error isn't getting displayed then it is doing exactly what the docs say it does
"If you have set a custom error handler function with set_error_handler() then it will still get called..."
Crap, I need it to ignore it :/
The decoded string, or FALSE if an error occurred.
Just trying to grab that false
[insert rant about crap PHP error handling here]
15:28
a wild E_ appears
@CarrieKendall It's not very effective.
@Danack F* that it's super effective atm
@Fabien It just is. So buggy :P
@Jimbo You could always just check in your error handler if error_reporting is 0 and bail out of the error handler early.
Hi all
m59
m59
15:38
If anyone has node vs apache perspective: I've got my root node server running and it serves my static files (like apache would). With apache, I had an api folder with index.php which ran all the server-side logic for the api, found at root/api/(index.php)
I'm confused as heck about how to do that with node.
@cspray Unless there's a nicer way to see if something is gzencoded
Anyone here good with DOMDocument issues?
user895378
The only comparison between apache and node: two aren't remotely similar. The logic you use for a php apache app likely has zero correlation to node.
@Jimbo Not that I'm aware of.
@Styphon I've used DOMDocument a bit
@Styphon WHat's the issue?
m59
m59
15:39
I'm having trouble seeing how node is that awesome if it can't dynamically serve a resource like this..
user895378
It can. It's an application server. It doesn't treat a request as a map to a file.
@cspray ever heard of $dom->createElement('description', $sanitizedVar); not applying the value?
user895378
So you get a request in node and it's not going to map to a file somewhere. It maps to a callable in your application that's expected to respond.
Every time I output my XML Description is empty
m59
m59
I have the static server setup, so it does serve static files
15:40
@Styphon Have you tried var_dumping it? @Styphon
but if I var_dump($sanitizedVar); the text is there
How are you checking whether it is created?
user895378
static files have nothing to do with serving an application resource.
m59
m59
Maybe I need an abstraction of sorts....
maybe I should setup the root to attempt to load some server js at that location and otherwise 404?
If I var_dump($description); after $description = $item->appendChild($dom->createElement('description', $sanitizedVar)); then it's created, but the value field is empty
user895378
15:42
@m59 Honestly? I wouldn't go near node for serving static files.
m59
m59
well, it's not static in this case.
But @PeeHaa The whole lot is returned via Ajax, I can see the whole XML string, and <description></description> is there, but no value inside
@Styphon How are you seeing the string? The raw data or the rendered data?
user895378
Node is never going to take a file on the file system and "execute" it like apache. You actually have to code something like that as part of the application.
m59
m59
I can't code it to, you mean? Or are you just saying that I need to code it to?
15:44
Also can you make a fiddle as demo? @Styphon
I love those new gTLD
user895378
@m59 Honestly you probably need to start with a node framework like express instead of going full on with vanilla node
@PeeHaa Both, I can see the raw data in the console from the Ajax call and the code output on the page
I made a script for generatig random codes
m59
m59
I'm a big fan of things existing because they exist. If I add the api folder and it has server code in it, I want that to be available automatically. I don't mind writing some logic to make it happen.
user895378
No, you can't do that.
How can I make sure that I have no duplicates?
they all should be unique
m59
m59
fail.
if (bin2hex(substr($torrent, 0,2)) == "1f8b" || substr($torrent, 0,3) == 'BZh' )
@PeeHaa you can see it for yourself here - mercury.demomycms.co.uk, just put something in the cart, go to checkout step two, fill in some random details and choose SagePay as the PSP.
15:46
@Duikboot uniqid. also don't do that :/
== (likely) gzipped
user895378
Node isn't going to load a script when a resource is requested and execute it. It loads all code when you start the server. It's an application that doesn't reach out to the file system to load "executable" scripts.
@Styphon Nope. Please make an isolated example on eval.in
user895378
That's what I mean by "your application has to respond to the request." It doesn't map to the filesystem to get a script on a per-request basis.
What is worng with my code? :)
m59
m59
15:47
yeah, I get it. I just don't like it =D
You wrote it @Duikboot
@PeeHaa There is too much code to make an isolated example. It's several hundred lines of code.
thank you thank you
@Duikboot what is good about it?
ooohh
15:47
;-)
user895378
I get it. It's a more difficult paradigm to work in. You're sacrificing the dead-simple ease-of-use you get from something like PHP for massive performance and scalability gains.
So how would you organize it @happy
user895378
There's definitely a learning curve for writing self-contained in-memory web applications if you're used to the PHP web SAPI.
m59
m59
It feels non-modular.
@Duikboot hastebin.com/takibemimi.php lol. If you are able to generate duplicate with uniqid you win a price.
user895378
15:50
It's no less modular. You're just shifting the organization from the file level to the code level. It requires a much greater level of rigor in your programming because if you do something wrong in your application you crash the entire app and not just the single request.
user895378
This is part of why PHP is awesome ... you can write crap code and totally get away with it :)
@Styphon Well there is your problem
Hahha
m59
m59
What I mean is, it sounds like if I add/change/remove something from the server, I'm messing with the very script that causes other things to exist.
15:51
I have to create 2000 of them
8 charachters with letters and numbers
Because under normal circumstances it should just work eval.in/97904
m59
m59
if (req === api/) {
  route to api
}
//other stuff
"Warning
This function does not create random nor unpredictable string. This function must not be used for security purposes. Use cryptographically secure random function/generator and cryptographically secure hash functions to create unpredictable secure ID."
user895378
Welcome to application programming :)
@m59 E_MISSING_LEADING_SLASH :)
m59
m59
15:52
lolz
that was pseudo heh
user895378
Writing long-running programs that don't crash is a completely different animal than short-lived processes where it doesn't matter that much if you do something wrong because the process will die in a few milliseconds anyway.
@Duikboot you asked unique, not random or secure ;)
unique - 8 characters - numbers and letters :P
@Duikboot You need openssl_random_pseudo_bytes function for that,
user895378
15:54
This is one of the best arguments for PHP as a web technology. It's so easy to do that the performance cost (if you can write good PHP code) is almost completely offset by ease-of-use in large environments.
m59
m59
Well, my ajax calls to the php api take 50ms.
I feel like that's pretty good?
user895378
But, if you have good programmers who really know what they're doing you can get crazy performance and scalability (read: way lower costs) gains from an application server approach.
user895378
@m59 Depends on what they're doing. I can guarantee that number would change if you had 1,000 simultaneous users :)
When using that I retrieve very long strings :p
m59
m59
I'm writing node to practice for a job
I'm just not sure it makes sense for this project.
15:56
@rdlowrey If you handle large images even with Imagick your server freezes sometime.
@BasicBridge I guess it depend on the hardware it rely on
@happy So with unique ID i should be able to limit it to 8 charachters ?
@PeeHaa Here you go, a quick and dirty sample of my code, with the same problem -> eval.in/97909
user895378
@BasicBridge This is the other side of the coin with a PHP web SAPI approach ... you have a limited number of processes/threads that can be responding at once. This instantly turns into a major bottleneck if you have synchronous IO or seriously CPU intensive work. Reddit effect? Your server will be toast.
Although the actual code is a lot more complex, and items is an array of class objects with a lot more info
15:58
@Styphon You realize you are overwriting the item variable in the loop right?
@Duikboot What is the trouble with this code, hastebin.com/lirehefono.php it's more truly "random" alpha-numeric string.
user895378
And it's a cascading effect ... users sit for half a second then get trigger happy and start clicking "refresh" ... and this only exacerbates the issue further because now you have lots of TCP connections constantly closed and opened and your server just blows up.
@PeeHaa, I append several items

« first day (1207 days earlier)      last day (3967 days later) »