« first day (2144 days earlier)      last day (2801 days later) » 

Jes
7:00 PM
@FélixGagnon-Grenier @Tiffany
i will try to figure it
 
Noite all o/
 
\p
 
@FélixGagnon-Grenier I need some life advice. Tacos or Pizza? What's your advice?
Quick this is important! People are hungry!
 
pizza
always pizza
 
7:06 PM
or por que no los dos and go with taco pizza
 
+1 for taco pizza
 
@FélixGagnon-Grenier You win at life!
 
ugh... now I'm hungry :D
 
Ekn
kudos a Tiffany
 
I had soylent. I'm not hungry, but I'm unsatisfied.
the taste of pizza sounds delicious, but I don't want to digest it... rofl
 
7:08 PM
for fuck sake, looks like some USA media outlets have decided to spend any of their acquired credibility on this election: youtube.com/watch?v=xHhNr5jeTIw
 
story of my life
 
IMHO, it's not even a good "all in" bet, since I can't see a win-condition
 
huffington post has been questionable anyway
more of an entertainment/tabloid news source anymore
 
@Ekn pfft. solamente porque habla espanol por una mitad oracion?
 
they're about the equivalent of Fox News for the left
 
7:10 PM
/trolling
 
Ekn
:D you didn't get any cause yer post made me hungry... and I'm lazy to prepare food
 
@tereško done. Stupid @Jeeves :-/
 
@DaveRandom tnx
 
@DaveRandom back from the station?
 
aye, not far away. Need shower shortly, been festivaling this w/e and haven't had a shower for 3 days
 
7:13 PM
@DaveRandom Imagination Festival?
 
@DaveRandom "aye" means "yes" ?
 
yes
 
colloquial, but common
 
ok :-) .. it seems to me like a child is talking :-)
 
7:14 PM
that's pretty sensible, when speaking of @Dave
 
Ekn
!!wotd
 
matriculate: to enroll in a college or university as a candidate for a degree.
 
@zhwatts no, hippy-ish small festival to which I shall not be returning. As an example of why, while queuing to buy food at one point, a woman was telling me that I should wear turquoise because it's good for the immune system
 
Jes
7:15 PM
@FélixGagnon-Grenier i tried the above
 
not music-oriented enough for me
 
@FélixGagnon-Grenier actually I think he is much older than us .. he have a child :-) take a look at his avatar ;-)
 
Jes
can you take a look
@Tiffany
 
ha! that's great
 
@Shafizadeh my mental age is roughly that of my avatar though
 
7:16 PM
@Shafizadeh well, you know, having a child doesn't mean you actually are an "adult" or "grown up" yourself. only means your basic reproducive systems are functionnal.
 
@DaveRandom haha :-)
@FélixGagnon-Grenier agreed :-)
 
@Tiffany ahh I see, it's basically the MS answer to Google Inbox?
(it seems to me)
I'm fighting what seems to be a losing battle atm to migrate our internal email to O365, which seems to be marginally less evil than the 3TB of Exchange archive files we have at the moment
Would dearly love to see the back of Outlook 2007 but I think it will be haunting me for a few years to come :-/
 
@Tiffany it's not just the ultra-left media, that's doing this. Did you hear about shit PBS pulled on Jill Stein ?
 
@tereško I have not. I suppose I should go reading...when I don't have a meeting in minutes... grumble
 
7:20 PM
@DaveRandom and yeah, I guess so, but why fuck with it? I guess I'm of the opinion that it's fine the way it is... why bork with what's not borked...
 
@DaveRandom In a certain sense she's right. Stress is bad for your immune system and if you were wearing turquoise you might not have had to deal with her bullshit.
 
@DaveRandom we switched over to O365 .... last year I think, but it wasn't much of a battle. We told users that they'd get 50GB of mail storage and they were on board.
 
@Tiffany dunno, I like what Google have done with Inbox (made it opt-in), hopefully MS will do something like that... but tbh I don't give that much of a crap because I don't use it. I barely have enough energy to care about stuff I actually use...
 
hell, server admin told me that and I was on board in seconds. I was sick of having to move shit to an inbox storage folder on my local comp
 
@Tiffany It's not so much that, it's ridiculously over-engineered and broken internal arch. It's going to take quite a lot of careful unpicking to ensure it doesn't all unravel at once
/me showers, bbiab
 
7:25 PM
@DaveRandom I like using Inbox, but only on my phone. I like being able to see all of my emails when I access it from webmail.
which I could see being the case for Outlook's "Focused Inbox" -- nice for phone, bollocks for desktop, but that's my opinion
and fair enough, I'm not sure what work was involved internally, our server admin did that. If you need help, I could see if he's willing to give some advice
he's usually nice
now time for a dreaded meeting :(
 
@Tiffany just know we love you very much. No matter what happens in the meeting, we all still love you :)
 
Ekn
:(
 
Sad, sad day...
 
Another legend gone :(
 
7:40 PM
WAT
NO
IT CAN'T BE TRUE
 
2016 is not a good year for cultural historical figures in movies/music :(
 
it really isn't
 
s/for.*/
 
I look at it like this: they were here, they left their mark, opened up a path for some new talent to come in and blow our minds
mourn the loss, but be glad they did what they did while they were here
 
I grew up on Willy Wonka :/ it's such a childhood movie for me. Granted, he was getting up there in years and it was bound to happen, like with any person, but doesn't hurt any less.
 
7:45 PM
did you like the newer version of willy wonka?
the tim burton rendition?
 
Jes
hello I did the following to merge two json array
$a1 = json_decode( $json1, true );
$a2 = json_decode( $json2, true );

$res = array_merge_recursive( $a1, $a2 );

$resJson = json_encode( $res );
the second array gets appended to the end of first array
is there any way i can replace a key and value from the first array with the second array?
i tried @Tiffany
 
@zhwatts it was alright. I prefered Gene Wilder's version of Willy Wonka versus Johnny Depp
@Jes good job, I think.
 
Jes
how do i replace the key in the first json array from the second array.. would you be able to help
 
not me, I'm bollocks at php
I'm only able to make wily use of google
I've said bollocks a lot today, but it's too fun of a word not to use
 
@tereško remember that flat earthers vid that used bollocks a lot? I think we've got an interested person right there^
 
7:55 PM
rofl
 
@FélixGagnon-Grenier you mean the debunking series?
 
yup
I think. yeah there were a few different vids in sequence about flat earthers, then some other topics iirc
 
youtube.com/… here ya go
 
@FélixGagnon-Grenier there is also youtube.com/…
(the first 3 videos do not pertain to flat earth related topics)
 
7:59 PM
> world of batshit
lovely
also damn, the music instantly gave me the urge to play banished
> Mr. Are Souls
 
yes, CHL channel is kinda awesome
 
who wants to go halvey's with me on live streaming Phish's three day concert to my house this weekend?
$70, so the more that splits it the better
I'll have popcorn to share :D
not even one person???
 
oh Cancer Man
 
RIP Gene Wilder
If you want to view paradise, simply look around and view it. Anything you want to, do it. Wanta change the world? There's nothing to it...
 
8:11 PM
From the second youtube video @tereško linked. Cancer Man comes from X-Files, basically a villain behind conspiracies
 
@Jimbo I saw that... :(
 
Cigarette Smoking Man (abbreviated CSM or C-Man; sometimes referred to as Cancer Man or the Smoking Man) is a fictional character and the primary antagonist of the Fox science fiction-supernatural television series The X-Files, at least from the second to seventh series, and again in the tenth. He serves as the arch-nemesis of FBI Special Agent Fox Mulder. In the show's sixth season, his name is said to be C.G.B. Spender, but Dana Scully suggests this is one of "hundreds of aliases"; the show's characters and fans continue to refer to him by variations of "the Smoking Man" because he is almost...
 
@Tiffany the guy who chain smoked
yeah, I remember him
 
Ekn
heh, pure imagination... living there, you'll be free, if you truly wish to be
 
we called him cig smoking man here
he died IRL at the end of that all from cancer iirc
 
8:13 PM
nope
he's still alive
he was at Chicago Comic Con
 
cool
 
I think he used herbal cigarettes
some actors opt to use those instead of actual cigarettes
 
actually, now my memories are thinking that he never inhaled the cigs in the series
he would drag them, but never inhale?
/me shrugs
 
yup
"Before joining The X-Files cast, Davis had not smoked a cigarette in twenty years. For the first two episodes he appeared in, he smoked "real" cigarettes, but later changed to herbal cigarettes, giving the reason that it was "dangerous" for his health."
 
not sure herbal were much better, heh...
I remember smoking those in college saying they weren't as harmful, but man... they would really weigh down my lungs
I just don't smoke cigs now... problem solved :D
 
8:33 PM
@Ekn Sad, that film definitely had an effect on my childhood dreams
 
Ekn
yeah on mines too... indeed very sad
 
what are some of the security flaws of using the mysql functions versus the mysqli functions?
if the mysql functions are used correctly
 
Ekn
!!canon mysql_*
 
Cannot find the canon for you... :-( Use !!canon list to list all supported canonicals.
 
@rabbitguy well, to be fair, smoking anything isn't good for you. You're inhaling hot embers down your esophagus.
But I think we can agree that nicotine cigarettes are significantly worse for one's health than herbal cigarettes.
 
8:38 PM
!!canon fire
 
Cannot find the canon for you... :-( Use !!canon list to list all supported canonicals.
 
nope
 
Ekn
:D
@Tiffany see
 
!!canon mysql
 
Cannot find the canon for you... :-( Use !!canon list to list all supported canonicals.
 
8:40 PM
!!canon list
 
The following canonicals are currently supported: errors - headers - globals - utf8 - parse html - sqli - operators
 
but that's for writing new code, which is understandable. I'm referring to older code from 2013, why would I need to change the mysql functions to mysqli, if they're already written with protection in mind?
 
@Tiffany I believe the mysql extension doesn't support prepared statements....so they can't be used safely.
> if they're already written with protection in mind
>if we had eggs we could have ham and eggs, if only we had some ham.
 
it's a question whether we should dump money on a vendor to rewrite code so that it uses prepared statements or leave it as is
 
@tereško hmm I thought @Jeeves did that now. @DaveRandom?
 
8:44 PM
nope
 
trying to find an example. a module I wrote last year is using mysqli
$query = 'SELECT DISTINCT instructor FROM '.self::table.' ORDER BY instructor';
$result = self::query($query);
$options = array();
while($row = mysqli_fetch_assoc($result))
argh
 
ctrl-k
 
basically code like that, but using mysql_fetch_assoc()
thanks @Danack
 
@Ocramius Looking at your talk from PHP UK Conference 2016 about Doctrine ORM (good talk so far!). Small question about the bit about mapping driver choice. You mention that public packages should preferably use XML mapping for flexibility, I was wondering if the same applies when you're specifically writing Entities for a OSS Symfony bundle? I've just always used the "default" of annotations for that. But now I'm starting to doubt if that is the best way.
 
@Oldskool I'd still use XML also for those
 
8:53 PM
@Ocramius Hmm, yeah I'm starting to see how it makes sense to decouple the mapping information from the entity class. Makes it more re-usable and readable (less comment/mapping clutter). Thanks for your fast reply! :-)
 
It's not about the comments or decoupling, it's about easy replaceability
a file path driver can be composed, an annotation driver... eh, not so much
 
Hmm, yeah good point :-D
 
putting logic in comments is a really bad idea
 
@Tiffany no. I'll say they both are pretty bad. So can Maryjane. I would think that vaping is honestly a really good alternative.
Though I will not state it's healthy exactly
There are side effects, regardless of any medicine you take, or drug, even, so you pick your battles
 
there's not enough evidence for the vaporization of one of the additives to determine if it's "completely safe"
and one study I read said the vaporization can actually be worse... I think it's a food-grade dye or something
but yeah
 
8:59 PM
@tereško yeah, "logic" :P
 
@tereško It's not really logic, it's metadata to guide doctrine on how to map your entities, so it's not necessarily a bad idea. But putting it into a separate file that can just be replaced with something else is easier then extending the entity and overwrite the stuff I guess :-P
 
oh well, I shouldn't even go there, will let the usual ones argue about usual stuff that they never tried
 
Go away. I sleepz
 
9:24 PM
@bwoebi I need a compelling example of multiple closures in a row.
(or at least inline functions in a row)
 
@LeviMorrison function\([^)]+\)\s*\{\s*return function mhm… I find nothing in amphp projects
 
Ah, I don't mean nested.
I mean like a filter -> map -> reduce or something.
 
none that fits one line in a sensible way and isn't an identity. Closures on the same line are usually present in code that was obfuscaded, code that was minified, etc
 
There's quite a few closures in that file, but I'm not sure if any are what what you're looking for.
 
$_ = keep_by_key(function ($key) use($expected_parameters) {
    return array_key_exists($key, $expected_parameters);
}, $_GET);

$_ = map(function($value, $key) use($validation_functions) {
    return $validation_functions[$key]($value);
}, $_, stream_keys($_));

$_ = filter(function($result) {
    return $result[0] === false;
}, $_);
 
9:35 PM
@LeviMorrison Everything I found so far is sanely using temp vars with each step on another row
 
I don't think this would be very compelling to many people.
Even if I extracted the functions to temporary variables or something.
And renamed those $_.
 
@LeviMorrison you encounter that very rarely in real code doing things
 
Yeah because our closures suck to write.
 
@LeviMorrison part of it is probably due to that, yes.
 
All that is doing is validating a form.
$keep_expected_parameters = function ($key) use($expected_parameters) {
    return array_key_exists($key, $expected_parameters);
};

$apply_validation_functions_ = function($value, $key) use($validation_functions) {
    return $validation_functions[$key]($value);
};

$invalid_entries = function($result) {
    return $result[0] === false;
};

$_ = $_GET;
$_ = keep_by_key($keep_expected_parameters, $_);
$_ = map($apply_validation_functions_, $_, get_keys($_));
$_ = keep($invalid_entries, $_);
With arrow functions:
$keep_expected_parameters = ^$key => array_key_exists($key, $expected_parameters);

$apply_validation_functions_ = ^($value, $key) => $validation_functions[$key]($value);

$invalid_entries = ^$result => $result[0] === false;

$_ = $_GET;
$_ = keep_by_key($keep_expected_parameters, $_);
$_ = map($apply_validation_functions_, $_, get_keys($_));
$_ = keep($invalid_entries, $_);
 
9:45 PM
these $_ make me insane :-P
 
The problem is that this is the traditional smushed together code:
$errors = [];
foreach ($_GET as $key => $value) {
    if (array_key_exists($key, $expected_parameters)) {
        $result = $validation_functions[$key]($value);
        if ($result[0] === false) {
            $errors[] = $result[1];
        }
    }
}
At a glance I'm fairly certain everyone would actually pick this version because it looks readable and familiar.
(Oh, I didn't copy all the code in the above examples, oops. They are missing the part that $results[1] is equal to)
 
Geeze I own a lot of crap.
 
@LeviMorrison also your validation func should either filter or map, but not both…
also, keep_by_key is really array_diff_key()
 
Except it works on not-arrays.
and "diff" isn't exactly as informative as "keep" ^_^
 
sure, but your example uses $_GET
 
9:57 PM
@bwoebi It returns a tuple like this:
[true]
[false, "Error message"]
Validation is a mapping operation...
 
Ah
 
I could use true and "Error message" but I don't think it really changes that much and I don't like it as much.
 
yeah, was confused
@LeviMorrison you could use null and "Error message" (aka has error or not)
 
null and string are still different types.
I may switch it anyway
It removes the last map operation.
 
array_filter(array_map(^$val, $key => ($validation_funcs[$key] ?? ^() => "Invalid key")($val), $_GET, array_keys($_GET)), ^$v => $v !== null);
^ that's what you want, right?
 
10:06 PM
1. I don't like them nested but
2. then useless temporaries are introduced or
3. start passing function names by strings and other silly garbage
This is basically the crux of the issue for me: we have higher order functions which is great but actually using them heavily sucks.
@bwoebi It's close.
@bwoebi Actually it's not - I looked it up just now. Diff will return the items that are different - I want the ones that are the same. So an intersection one ^_^
array_intersect_key
 
Wes
@Gordon new yorkish enough? i.imgur.com/r07Wzoj.jpg 1 million pop, even got the twin towers
 
array_filter(^&$val, $key => null !== $val = ($validation_funcs[$key] ?? ^() => "Invalid key")($val), $_GET, ARRAY_FILTER_USE_BOTH)
@Levi ^ to be very clever :-D
 
Clever and wrong - where is the array of messages?
:-D
OH wait
NO BOB NO
Modifying $_GET through reference? Naughty, naughty!
 
10:22 PM
@LeviMorrison not $_GET
I'm modifying the passed value which will be returned by array_filter
at least it should…
ugh
Bobs-MacBook-Pro-2:amp bob$ php -r 'var_dump(array_filter([0], function(&$v) { $v = 1; return 1; }));'
array(1) {
  [0]=>
  int(1)
}
Bobs-MacBook-Pro-2:amp bob$ ~/php-src-X/sapi/cli/php -r 'var_dump(array_filter([0], function(&$v) { $v = 1; return 1; }));'
array(1) {
  [0]=>
  int(0)
}
WHO DID BREAK THAT
(above is 5.5, below master)
I guess it was broken with 7.0
 
Probably.
 
and no note in UPGRADING
 
It's probably not expected since array_filter is not documented as taking its input by reference.
 
The only real docs are the code -.-
I'm not sure whether to report this as bug or fix right ahead or do nothing
 
Ask @NikiC but I think it's a bug.
Wait...
 
10:30 PM
Even if it's not a bug it's an undocumented BC break
 
I misread - I thought 7.0 on top and 5.5 on bottom.
Which is silly of me since you wrote sapi/cli/php and told me.
I believe the bottom one is correct.
 
anyone who is manipulating array values by reference with array_filter deserves what they get
 
array_filter should create a copy of the input if necessary, which happens when you iterate over the value by reference, yes?
 
@LeviMorrison array_filter is supposed to return you an array with copies of the elements of the passed array
so, if you ask for a reference, I expect to get a reference to this copy of the current element being iterated over
 
You are expecting the copy to be operated on when dropping.
(logically)
That's not the semantic.
It's copying from the input if the predicate passes.
 
10:35 PM
I.e.:
$output = [];
foreach ($input as $key => $value) {
    if ($cb($value, $key)) {
        $output[$key] = $value;
    }
}
 
I appreciate the three different results though
 
@PaulCrovella HHVM is correct in my eyes
 
or the opposite of hhvm could be
 
@bwoebi I think using the original key is the intended behavior - using anything else is sinister.
^_^
array_filter is to help avoid these side effects - yeah?
$output = [];
foreach ($input as $key => $value) {
    $p1 = $value;
    $p2 = $key;
    if ($cb($p1, $p2)) {
        $output[$key] = $value;
    }
}
Time to go update my filter implementations...
 
even if hhvm is right, I prefer 7's result
 
Jay
10:43 PM
can you create a schema from a php class which acts as a validation against the xml file being used?
 
@bwoebi I was considering adding this trait to Amp: gist.github.com/trowski/8fa7fcdf483c14e4292e8eb91e93eba4
It seems unnecessary, but I've noticed that same method over-and-over again.
 
@Trowski Are we actually using it at least once in Amp?
If yes, STAMP OF APPROVAL
 
@bwoebi In amphp/amp… no, but the pattern is used in many of the other libs.
I'm not sure Struct is used anywhere in amphp/amp either.
We could move Struct and this trait into a separate lib, amphp/tools perhaps.
 
meh, just leave it in Amp
 
Sounds good. Last thing we really need is more libs.
Actually, I can use it in amphp/amp. Perfect.
 
10:58 PM
@Trowski I'm planning to separate HPACK out into a separate lib
as it will be same for client and server
 
@bwoebi Sounds good.
 
@Trowski btw. if you ever search a challenge: make HPack::huffman_lookup_init() faster
it currently takes about 88 ms on my local machine
 
@bwoebi This is probably better, since it caches the reflection object: gist.github.com/trowski/8fa7fcdf483c14e4292e8eb91e93eba4
@bwoebi Alright.
 
@Trowski [But that's really if you have nothing else more interesting to do]
@Trowski not worth it IMHO … the Closures should be cached in a property anyway
 
@bwoebi This way only one instance of ReflectionClass is ever made for the lifetime of the program.
 
11:03 PM
@Trowski oh, it's static
yeah, fine then
 
Would be great to even cache the ReflectionMethod objects too.
 
Just make the name longer to avoid accidental collisions
 
@tereško so... after that, chl speaks of this insanity is sanity thing. at this point, I really can't take this seriously. this is surely a joke. please. tell me it's a joke. a really bad joke.
 
11:26 PM
@NikiC you worked on the changes in PHP 7 for arrays, right? The way refcounts are kept for arrays in PHP 7 is to move them out of the zval itself. So with something like MySQLiStatement::bind_param and MySLQiStatement::fetch, for example, does this cause a side effect of breaking the reference when you pass an array of references through call_user_func_array?
I thought I understood what this was doing, but now I'm questioning that understanding.
 
@Sherif yes and no.
Side-effects happen, but not because of that, but rc=1 (rc => refcount) elimination
 
@bwoebi Ahh, you mean because now the reference is to the bucket itself, right?
 
i.e. $b = 1; $a = [&$b]; unset($b); $a[0] is now not a reference anymore
 
Right... that actually clears it up in my head a lot.
 
@bwoebi Added a little black magic to it: github.com/amphp/amp/blob/master/lib/CallableFromMethod.php
 
11:31 PM
it internally still is a reference, but upon accessing by-ref, the reference is unref'd
 
@bwoebi Note this actually still works in PHP 5. I just happened to test it in PHP 7 and realized it doesn't work the same way.
 
        if (!isset(self::$__reflectionMethods[$method])) {
            if (self::$__reflectionClass === null) {
                self::$__reflectionClass = new \ReflectionClass(self::class);
            }
            self::$__reflectionMethods[$method] = self::$__reflectionClass->getMethod($method);
        }
 
Probably because the reference is still maintained by the zval, which contains the same array. But move the array out of the zval and bind_result does weird things php-lxr.adamharvey.name/source/xref/PHP-7.0/ext/mysqlnd/…
I'm thinking this is the culprit Z_REFCOUNTED(stmt->result_bind[i].zv) no?
 
@bwoebi Would have to be the other way around.
 
@Trowski yes, fixed
@Sherif yeah, in PHP 5 it worked weirdly and much more inconsistently than now
 
11:34 PM
@bwoebi Yep, that's even better.
 
Damn, PHP 7 makes me question my entire understanding of PHP sometimes.
 
@Sherif not sure what you mean
@Sherif for your reading pleasure: 3v4l.org/iOC9I
 
No, no, that's not what I'm talking about here though. That's normal by reference semantics.
 
@Sherif are you sure?
 
bind_result maintains a reference, but when you're passing that reference as a reference to an array value through something like call_user_func_array you're adding a new level of indirection, which I'm thinking is allocating a new ht causing the ref information to be lost in the middle.
 
11:42 PM
@bwoebi if the codegolf SE site allows for speed challenges you might try there.. what you've got is already on par with simply unserializing for me
 
@PaulCrovella did you try serialize/unserialize?
 
yes, I serialized what your method returns, cached then timed unserialize
 
I did not know that unserialize() is so slow
the output of the serialize() is around 2 MB AFAIK?
 
picked up maybe a ms or two, but whatever it was was w/i the margin of variance
2.42MB, yeah
 
hehe… I've today saved a 20 ms from the old result… interesting that it's on par with unserialize() though…
 
11:49 PM
I knew unserialize wasn't particularly fast, but I still expected better
 
@Sherif no, you can't have refs to refs
I've been looking but can't see a reason why this should fail
@Sherif anyway, the TRY_ADDREF inside mysqlnd bind_result should increment its refcount…
 
@bwoebi But that's kind of my point. Isn't all the ref/refcount and gc moved out of the array in PHP 7? Making what bind_result does there ineffective?
Or am I just missing something obvious and this is all just a PEBKAC?
 
@Sherif but each individual reference on each element of the array holds its own refcount?
 
You're asking me or telling me?
 
telling.
 
11:57 PM
But bind_result explicitly doesn't touch the refcount.
 
the question is whether that's the part you do not understand
 
Ahh, I meant doesn't touch is_ref
sorry
 
yeah, refs remain refs
 
But the array semantics are by value in call_user_func_array
How does the reference remain in tact?
 
@Sherif they aren't?
 

« first day (2144 days earlier)      last day (2801 days later) »