« first day (1606 days earlier)      last day (3567 days later) » 

13:00
@Gordon do you have an example of how to log something in Something?
@FlorianMargaine The fact that it's a decorator implies that the subject does not directly log things
ah.
any example?
If the subject needs to log things directly then the relationship would need to be reversed (or circular). A decorating logger only logs the input/output data, nothing intermediate.
@FlorianMargaine ...of the decorator?
of the decorator and the usage, yeah
in a nutshell:
class GenericLogger
{
    private $loggable, $logger;

    public function __construct($loggable, $logger)
    {
        $this->loggable = $loggable;
        $this->logger = $logger;
    }

    public function __call($method, array $args)
    {
        $this->logger->log("Called $method with args " . var_export($args));
        return call_user_func_array([$this->loggable, $method], $args);
    }
}
13:10
oooh I see
the typed alternative would be to have the Decorator implement the interface of the decorated instance.
e.g. class LoggingSomething implements SomethingInterface
yup, of course
RetryingCachingRateLimitingSlowLoggingTwitterService
13:11
so that you can inject it to other places
yes
I use that Decorator approach for simple caching, too
pastebin.com/0L2L5mMV @FlorianMargaine (somewhat redundant but I wrote it out now :-P)
you can also use it for authenticated service
new Authorized(new Something)
and of course you can assemble them as you see fit, e.g. new Cached(new Authorized(new Logging(new Something)));
I would usually choose the new Kittenifier(new Cached(new Authorized(new Logging(new Something)))) approach
13:28
so fun trivia for the day, apparently .io email addresses don't work with the mailing list software
what, ezmlm?
yeah
If I send something to internals-query@lists.php.net from a .com address, I get the expected reply (whether or not I'm subscribed), but there's no reply if I send from a .io address
That guy has sent a few mails to the list over the years it's been going into my Gmail so I'm guessing it works for him
re side projects: github.com/m6w6/pharext -- comments, flames?
More likely there's some issue with that specific address/domain (i.e. on a blacklist)
13:35
My domain uses gmail under the hood, and mxtoolbox isn't showing a blacklist
@m6w6 amazing
@mikedugan May be an internal blacklist within ezmlm, I know it has them but I don't know who maintains them or how they operate
@m6w6 I don't have time to look at that properly, but have you been talking to Pierre about his 'Pickle' (not a euphemism), or is this a completely different use case?
who knows. S'pose I'll just switch back to gmail for the internals list
geekly amazing? :)
@Danack It doesn't do all that things that pickle does, pickle can do a lot more I suppose
I brought up the general idea of packing extensions as phars in #pickle but there wasn't any response, so I had to see myself if it makes sense
13:39
@m6w6 does it mean we can distribute ext/mysql through a phar?
^ why??
@FlorianMargaine well, yes? but that would feel like having done a life support system :)
what problem is this solving ?
@JoeWatkins none
it's a toy
13:42
Solving problems is for other people. I prefer creating them.
@JoeWatkins composer can be native while keeping the distribution model
the life does not only consist of problems to solve :)
cool
at a glance
windows support is missing (and probably pointless, but worth mentioning)
there is no support for additional ini entries to be written to the ini file, is helpful to put defaults in there I guess ...
hehe, pointLESS
I didn't even want to implement INI activation, just print "Don't forget to enable the extension in your php.ini", but I figured, I could not meet pecl_http's configure checks, if the installed dependencies were not immediately enabled in php.ini...
Can anyone help me, I am looking for a way to run an AJAX request to run some PHP code on a separate page. I also need to pass variables from the current page to the PHP page I am trying to run.
13:49
You know what'd be nice? An implicit public static function new($params...) : self on every class.
Can anyone help me, I am looking for a way to run an AJAX request to run some PHP code on a separate page. I also need to pass variables from the current page to the PHP page I am trying to run.
@DanLugg ...why?
^^ Reflection
newInstanceArgs()...?
13:51
@AshSimpson what have you tried?
WHAT'S GOING ON?
@DaveRandom Yes, but to generalize it
Anthony's CAPS LOCK, is what.
@DanLugg eeeeeeeeeewwwwwwwwww
If you could reflect the constructor, and it returned an instance when invoked, that'd be fine too
13:51
lol
whoops
@DanLugg inb4 stupid people doing horrible stuff
Nah, that can be argued about anything
@SebastianBergmann EVERYONE KNOWS CAPS LOCK IS SYNONYMOUS WITH COOL
@SebastianBergmann CRUISECONTROL FOR COOL
Back when BTX was a thing, maybe.
13:52
If people doing stupid stuff was reason enough not to implement something...
CruiseControl was NEVER cool.
@DanLugg :P
@SebastianBergmann You're just not cool enough to understand ;)
@PeeHaa I can live with that.
@DaveRandom Yes, but you can't $inst = $rc->getConstructor()->invoke();
13:54
@DaveRandom OH THANKS, I DIDN'T KNOW THIS WAS A KEY. MUCH EASIER NOW.
Actually, you can't do that anyway because ReflectionMethod::invoke expects an instance to bind to
@DanLugg Because a constructor is a return-less function. It doesn't return an instance. The new keyword does though…
@bwoebi Right, er go, making new a static method with a return.
@DanLugg Yeh, but if you are getting the ctor for a class then you already have a reference to the class...
@DanLugg yeah. no.
13:55
@DaveRandom Yes, but the boilerplate to circle that clusterfuck is a PITA.
new'ing something is a static operation anyway
/me is obviously missing something
I'm on the train of generalizing the instantiation process.
If you can reflect a constructor and invoke with return (or something like that), then it's no different than any factory operation.
So you can treat function () { return new Poop(); } equally.
...isn't that what new $className is for?
And by implicitly copying the signature into new you can maintain reflectability for injection purposes
Yes, new is a static operation. The constructor isn't though. The constructor is just the first method called after the object was instantiated by new.
13:57
So given public static function new($implicitParamsFrom__construct) : static, you wouldn't need to jump through flaming hoops to perform DI
@DanLugg do you have a concrete example of somewhere it would reduce boilerplate?
@DaveRandom Yes, but I'm still working on it because boilerplate :-P
@DanLugg you… want to hardcode the DI into the class to instantiate? wut.
^^ No.
Well, that's what you're proposing…
13:59
I want a unified operation that returns an instance of its type as an alternative constructor
So basically a method which hides Singletons behind new?
Again, no. There's no state.
final public static function new(...$params) {
    return new self(...$params);
}
The only problem is carrying the method signature from __construct to new
As if we needed more proof that Open Access must be mandatory: Johannes Ott, who wrote to internals earlier, wrote his thesis on "Test-Driven Development of a PHP Framework with Type-Safety". I asked him for a PDF and he is not allowed to give it to me.
final public static function new(...$params) {
    return self::$instance;
}
Such that reflectability is maintained
14:01
That's what I mean.
Yea, that's not what I mean
But what else would you need it for… give me a concrete code example.
So that you can detach the constructor from a type, and pass it around.
I don't have a concrete one on hand, but I think the intent is pretty clear.
14:04
@SebastianBergmann where is it published?
function ctor($class, $params) { return function() use ($class, $params) { return new $class(...$params); }; }
@NikiC Apparently nowhere because of an NDA imposed by a company that funded it.
Arguably, ReflectionClass::getFactory() : callable would be fine too, where the returned callable is just an on-the-fly anonymous factory.
@m6w6 That'd be fine too, but if you reflect the returned closure, you have no param information.
Or, nevermind; different intent.
aren't those some props of the closure?
No, they need to be reflected from __construct
14:06
I hope that things like peerj.com/cs/25e1f2603a take off.
@SebastianBergmann shit like that should be illegal
@ircmaxell Exactly.
Research should be publicly accessible.
The only reason why I pay the ACM and IEEE membership fees is to have access to most publications relevant to me.
But … then how do you make money from it?
14:08
@SebastianBergmann In Germany? That does not sound legal.
@Gordon ideas are worthless. Implementations are worth money
iirc dissertations in germany must be published (at least in a limited form)
@ircmaxell the time I spent into research has to be compensated!
@NikiC Dissertations yes, but I think his is a bachelor or master thesis.
@SebastianBergmann oooh, sorry I missed that
14:10
But I heard about at least one PhD thesis that was made non-public when I was still studying. Funded by the German goverment, research done in cooperation with Deutsche Telekom, ...
Basically, if this
class Foo
{
    public function __construct(Bar $bar, Qux $qux) { }
}

$f = (new ReflectionClass('Foo'))->getFactory();

var_dump((new ReflectionFunction($f))->getParameters());
Produced this
array(2) {
  [0] =>
  class ReflectionParameter#1 (1) {
    public $name =>
    string(3) "bar"
  }
  [1] =>
  class ReflectionParameter#3 (1) {
    public $name =>
    string(3) "qux"
  }
}
That'd be swell.
what now?
getFactory?
Yea, I'm just being crazy.
@DanLugg getFactory()? or ReflectionMethod on __construct?!
@bwoebi But $f could be called to return a Foo!
Such that $foo = $f(new Bar(), new Qux());
14:13
ohhhhh
Detaching a constructor into a factory function.
How is that better than function getFactory($class) { return function(...$args) use ($class) { return new $class(...$args); }; } ?!
@bwoebi Reflectability.
(new ReflectionFunction(getFactory('Foo'))->getParameters() using your version will yield no relevant signature.
@DanLugg for reflectability, you just look at the ctor?
@bwoebi Hoops man, hoops.
The returned function should have all the info; its a "detached constructor", and having to pass out-of-band info around to make it usable isn't that helpful
14:15
meh…
bwoebe, meh... $ai = new Provider\AI; $ai->lookAtTheCtorDamn()
:)
I mean yea, you could wrap that into a type, but blah.
I just don't get why we'd need that factory func at all?
@bwoebi Because it's easier to deal with one thing than several; rather than having to accommodate reflected types with newInstance, or methods, or blah, blah, blah; all you need to do is call $f()
With params.
14:20
@DanLugg Yeah, you just want to shift userland work into internals?
@bwoebi Some of it? Yes.
Because some of it shouldn't be userland to begin with IMO.
Same with disambiguating between different callable types.
What we'd rather need is something to forward args with Reflection support
14:38
Good morning!
@ircmaxell Let me guess; they didn't measure properly before deciding PHP was too slow?
@LeviMorrison that was the least of their mistakes with the project
can't wait for the annual April 1st RFC
what if it's a very good idea RFC?
I'll propose union types on April 1st.
100% seriously.
14:53
\o/
I'm going to write an RFC to throw away php-src and replace it with HHVM
It has to be believable to be a good April fools - you can't just troll.
@Danack That is, if I can find time >.<
for example: "I, ircmaxell, withdraw the type hints RFC" is a good april fools.
14:59
@ircmaxell Screw that, just push a commit to master that replaces the entire tree with a single text file saying that PHP has now been superseded by Python
hehehe
@FlorianMargaine it would be merged by that point
posted on March 10, 2015 by kbironneau

/* by baandrzejczak */

@DaveRandom No… we all believe asm must be the best because it can be the potentially fastet
@bwoebi Real men write machine code
@DaveRandom not readable.
15:07
Real men don't need to read the code they've written.
/me will stop now before this gets ridiculous
i'll just leave this here...xkcd.com/378
@DaveRandom The Story of Mel
But I sometimes wish I were that insane and could read hexdumps byte by byte and understand what's going on…
@bwoebi you usually get that knowledge by working on projects requiring this kind of skill
15:14
@FlorianMargaine or by watching 50 shades of gray and deciding you want to be a masochist
grey*
50 shades of gray doesn't make sense
we're talking smut now? Bleh
That book is a nasty...each
Thanks @irc
*@ircmaxell
Can't agree more with you ;)
@mikedugan This isn't masochism…
15:27
Can anyone help me with detecting if the page was called by AJAX?
AJAX Post
I have tried this but it always returns false...
if (filter_input(INPUT_SERVER, 'HTTP_X_REQUESTED_WITH') === 'xmlhttprequest')
I give up
Seeya
@AshSimpson is your XHR code adding this header? did you see the header in the ajax request sent in dev tools?
No..
I got that code from a question in Stackoverflow.
@AshSimpson You can not unless you pass extra headers or some other identifier
HTTP_X_REQUESTED_WITH is something added by libraries
So how can I stop people running my script?
15:30
You cannot
Can I run a check to check where the request came from?
Put it behind login
Is that the closest I can get?
@AshSimpson Not reliably
What is the most reliable way of doing it?
15:31
Also XY problem
look it up
As I can't just leave my AJAX open to anyone to run.
hello
I think the most safe way is to check if the user is logged in to my website.
And it is coming from my website.
how can i delete all duplicate content in one mysql query
i want to keep rows that only lists once
if there is a duplicated rows , it should be removed (not keep one)
can i do this in one mysql query ?
yes @Bassem
To do this check for items with the same value for what you call 'duplicate'
15:33
Did someone mention fifty shades of grey?
@ashsimpson , ok i can get rows that listed more than once but it will having count (*) > 1 , i can't execute delete with having
Hey I am trying to call a JS function in a PHP echo.. Is there any way of doing this, I am trying to also pass params but I can't echo the params....

 echo "
 <div class='btn btn-success' onClick='addCorp(".$row['id'].", '".$row['b_name']."','','');'>Accept</div> / <a href=''>Decline</a>
</div>

</div>";
@AshSimpson Search the site
the onClick function.
What for.. exacly?
I don't even know where to start.
what I think needs to be taught in schools: troubleshooting skills, how to Google effectively, regex, and writing bug reports
15:48
ohgod someone is echoing js inside echoed html
I am grabbing a row from MySQL and I need a button to accept or delete that value... So it is in a while mysql_fetch_assoc
How can I run a JS function with parameters inside a PHP echo?
/me cringes
@AshSimpson php.net/mysql_fetch_assoc do you notice something on that page?
/me Wonderd why
DEPRECATED..
But I am only using this for educational purposes.
I shall be updating to MySQLi
soon
no, use pdo and named params instead
15:51
Okay.
But can you help me with my problem?
do you always educate yourself with wrong things?
There is no educational value in starting with mysql_* and "moving to something else later"
Calling JS function within PHP echo.
If you're learning something that's deprecated then why not just learn the new one instead?
@AshSimpson a) read Patrick's link and start using the pdo funcs. b) learn the difference between client and server. The PHP is completely rendered before it ever hits the client (where javascript is run).
so you cannot "call a js function within a php echo"
15:52
I am writing a link in PHP echo..
To call a js function onClick
would be nice to have a bot in here, one that could handle stuff like: !tutorial pdo
user895378
morning
I have updated to PDO
I thought he was just using PHP to write the argument into the javascript function call
15:53
@rdlowrey morning
@AustinBurk I am echo'ing a <a href=""> link.. that calls a js function onClick
but I am having problems writing the functions in the echo.
@AshSimpson I think your problem is deeper than PDO...rather, I don't think you understand what you're trying to do
onClick="addCorp('.$row['id'].', null, null, null);"
Now do you understand?
@AshSimpson you are mixing html, js and php all in one file. It is much better to separate those 3 instead.
@rdlowrey o/
echo "<a href="" onClick="addCorp('.$row['id'].', null, null, null);">";
@AshSimpson all those double quotes are going to erupt in flames if you don't use some singles or escape the inner double quotes
How will I do that?
I am brand new to JS and others.
Some help would be nice
righteo, it's time for i.imgur.com/gOZSs.gif
I would suggest you go find some articles/videos on beginner level PHP and Javascript and read/watch them
You obviously don't understand what I am trying to do
15:58
yo
you obviously don't understand how web development works
@AustinBurk wtf
ThW
ThW
@AshSimpson Don't call JS from HTML elements, use data attributes and bind event handlers to the elements.
@DaveRandom what
user895378
@JoeWatkins jo
16:00
did I misread something
user895378
@JoeWatkins What's your feeling on anon classes passing this time? Any idea? I'm hoping yes ...
"I think you're hot"
"What did you say?"
"I SAID I THINK YOU'RE HOT"
"WHAT?? YOU NEED ANOTHER SLOT? TRY THE NEXT CABINET."
lol
Oh yeah the book
@rdlowrey well there isn't much different about the patch ... so I dunno ...
I can't guess how internals will work
That showed up on r/sysadmin a few weeks ago, apparently it's really stupid
The comment thread was excellent however, reddit.com/r/sysadmin/comments/2vwr9l/…
16:04
alias please="sudo";
^ I am doing this immediately
alias sudo='echo "where are your manners?"'
I do alias fuck="sudo";
$ service apache2 restart
$ fuck !!
"fucking" might be good
@DaveRandom not very English ...
That'll make bash_history interesting
16:06
alias sorry=sudo ftw
$ shutdown
Permission denied.
$ fucking shutdown
System is gong down for shutdown NOW!
2
user895378
$ phacking shutdown
I'd rather use something I can use with !! following
I'm way too lazy to write shutdown twice
I need an command "bye-bye-sudo" which allows you to do sudo without password and installs sudo -i in the bashrc…
@FlorianMargaine dammit possibly
16:08
@bwoebi look up "NOPASSWD" in the sudoers.
At that point you might as well just log in as root
so node.js has a competitor now: infoq.com/news/2015/03/JXcore-OpenSource
@Gordon iojs?
@FlorianMargaine yeah… nopasswd… but then I still need to prefix sudo, no?
16:09
halt is four characters shorter..
@bwoebi yeah
I'm not sure it'd work, but you could add yourself to the root group
@FlorianMargaine nah, euid is important, not (e)gid
@FlorianMargaine jxcore. apparently a fork
depends for what... Iguess
@Gordon oh, another fork?
@FlorianMargaine idk how many there are. i stopped caring when there was ten new frameworks a day
16:11
Bastemar went on to say this was not the sole reason for the open source move, citing also JXcore's small team, and there being both a lot to achieve and many things to do beyond their limited resources.
lol
he thinks open source will give him more manpower...
@Gordon there's only node.js, and a couple months ago io.js was created. That's all.
So I joined Nintendo's faux-social network, called Miiverse. The moderators are infamous for blanket banning certain terms, sometimes regardless of context, and all bans are two weeks long
It's like, social network for kids or something
So I've started to write posts and slip in key terms that they can't really get me in trouble for
that's because it is
it's a limited system for discussing video games, intended to be kid-friendly
And they're damn right to be ban friendly then.
I started writing a story for fun, you can only put four hundred characters in each post
I'm going to slip in the
*slip in the occasional questionable word, like "hell", for example
We'll see what happens, ha.
16:21
@FlorianMargaine Yeah
@FlorianMargaine it's ridiculous, really, I got banned before my first post there
Nintendo have been a little heavy-handed in the past, but it's clear why they do things
user895378
@bwoebi yeah ... php has never actually done this correctly if a server requires clients to present certificates. I meant to make this work in 5.6 but forgot about it because it's not something I've actually needed in my own work. I'll try to add support for it and push it up to 5.6/master.
For example, they shut down Swapnote (aka Nintendo Letter Box in Europe) because it was used by Japanese paedophiles
@Andrea they don't let me put more than five numbers into most text boxes because a phone number could be put in there
16:23
@rdlowrey That moment… when you just realize that you've delayed work on Aerys even more. :-D
@AustinBurk heh
reminds me of how Fiverr.com is paranoid whenever I say "email"
user895378
@bwoebi lol, this one is pretty simple. should only take an hour or so to do everything and add tests.
That's the entire console, too, excepting long text boxes like in the web browser.
and reminds me that I must NOT communicate with buyers or exchange payment details outside Fiverr
@rdlowrey then it's acceptable :-D
16:24
Nintendo's being a parent
They have to be.
Too much of one. I'm 18; they should at least make better parental controls..
it's not about you harming yourself
it's about you harming others
you being over 18 doesn't negate the fact that many users aren't
I understand that, and I agree, they do need to do what they're doing, but it's seek
*still rather ineffective
Back to PHP ~
@AustinBurk Well, that's half an hour I'll never get back
16:34
You didn't keep the receipt?
Jan 7 '14 at 0:40, by DaveRandom
> Time is an illusion. Lunchtime doubly so.
Good morning
Did anyone work with amqp? For some reason I'm getting true when publishing messages to exchange, but they are not appearing in queues. And same code works fine on another VM. So - if no ideas why - may be ideas how to debug? Because it's just pure end lib calls, and I hve no idea how to debug it..
@DaveRandom @AustinBurk oh my
Rest assured, I have contacted the author and warned her against fucking about in the server room. Seriously, she got SEMEN in the SERVER ROOM. And knocked a rack of Windows Server Disks onto the ground!
Unix gone wild: 50 shades of graybeard.
Is there a general correct behavior that should happen when some code calls setFontFamily() with a font family name that does not exist? i.e. the two options of throwing an exception, or silently failing seem to not be optimal in different circumstances.
If you like it then you should have put a chown on it.
16:49
@AlmaDo @PaulCrovella Has some experience with rabbit. He may be your best bet in here.
@Danack That's an exceptional situation IMO
user895378
Don't make a joke about @Fabor's mom having some experience with rabbit. Don't do it. Don't do it. Don't do it.
heh
She's got a fair amount of experience with queue management as well, some times it stretches round the block
user895378
dangggggg
16:51
oh no he di'nt
dammit, not only is this API SOAP it just generally makes no sense and is entirely undocumented apart from the auto-generated stuff
@ircmaxell lol @ your mail :D
well, it's true :-)

« first day (1606 days earlier)      last day (3567 days later) »