« first day (1516 days earlier)      last day (3657 days later) » 

15:00
hi everyone
@darkyen00 why is that a performance problem. Also, please don't store json in the database
@ircmaxell challenge accepted
@CarrieKendall awesome
how are you?
I am having trouble sharing a post on facebook from my website. It doesnt post.
shame that we cannot use <blink> tag for optimal effect
15:03
this is my code to share things. <li> <a
id="fb-share"
style='text-decoration:none;'
type="icon_link"
onClick="window.open(
'http://www.facebook.com/sharer.php?s=100&p[title]=YOUR_TITLE&p[summary]='
+ 'YOUR_DESCRIPTION&p[url]=YOUR_URL&p[images][0]=YOUR_IMAGE',
'sharer',
'toolbar=0,status=0,width=580,height=325');"
href="javascript: void(0)"
>
my link wont share and idkw
posted on December 10, 2014 by kbironneau

/* by NerdyWizard */

@ircmaxell i'm good, how are you? your blog post on timing attacks was a great read.
thanks :-)
I'm getting better, slowly. Still a long way to go
oh yeah, i read something about that on twitter. that sucks
were you abroad when you got sick?
hi can anyone perhaps help me?
15:08
Hour of Code ☺ #mukuru #hourofcode #sarajevo http://t.co/ddJ84Judzm
@LukeSmith Not related to php
@CarrieKendall no, home
well, at least there's that haha. i got a really bad tooth ache while in iceland
Had a visit from abandoned kids today, taking the hourofcode class with us, whole time I was thinking of their parents and their excuses for leaving 'em, can't think of a good one... there, I've said it :-)
15:17
@webarto So now you have 9 kids running around at home? :)
They wouldn't let me adopt anyways, criminal history and whatnot ;-P
And I'm not Angelina Jolie :-P
You kinda look like brad pitt though
<3 #nohomo
15:19
@PeeHaa How many drinks does it take to come to that conclusion?
$dmitry->sprinkleMagicDust("/Zend/zend_compile.*")
0
Q: Create an array from an array and keep the same order

INTENSSI've created a very simple deck of cards. I'm using 3 arrays, $deck, $cards, & $used. $deck is the cards in play, $cards is a comparison array, and $used is a discard array. When cards are used from $deck they get place in the $used array. My issue is when they are placed in the $used array they ...

someone fell asleep on his keyboard :/
Nah. He was giving his answer in HHVM
hahaha
For historical reasons...
15:37
@JoeWatkins :D
if a little boy makes my little girl cry, is it okay to kill said little boy ? what about if I just strangle him a little ?
nobody ever blamed homer simpson for that
he's a perfectly good roll model ... so we're going with strangulation ?
sounds perfectly fine
15:41
@webarto Can I have a certificate of completion? I heard @DaveRandom is a certified jock strap.
@Jimbo No no, that was addressed to me but it had your name on the certificate, remember? They mixed up the envelopes when they were sending me that Certificate Of Being Better Than @Jimbo.
maybe I should be a bit more scary, walk her to school carrying a baseball bat in a muscle shirt, and call anyone who approaches me a "biatch" ...
replace the the muscle shirt with a "The Punisher" shirt. That would be even more scary
However, if you do that your daughter will have a hard time winning the favor of the principals
muscle shirt because lots of tatoos, gives the impression I'm something I'm not really ... might aswell use it to my advantage for once ...
to scare ten year olds ...
lol
@JoeWatkins If the Simpsons have taught us anything, it's that repetitive strangulation makes a point but yields no permanent injury.
15:48
and also that if something is hard, it's not worth doing ...
@JoeWatkins I am disappointed in you.
never openly threaten people
Oh... so I was doing it wrong all the time?
be more subtle. Do it mentally, without actually saying it.
Mental torture is far more effective, and far easier to get away with
15:49
I'm messing about ... I'm not gonna set about a bunch of ten year olds ... we are talking about ten year olds ...
@Patrick Are you going to extend your tutorial some more?
@JoeWatkins Sounds like a guaranteed win. I would go for it!
One more, because Homer.
15:51
I decided I'm going to have a go at actually writing the talk by the way @ircmaxell then make an abstract from however it comes out ... I'll probably want more help at some point ...
ThW
ThW
@Jimbo I didn't mean your answer. It is complete and fine. I just don't like the order of the 3 solutions in the answer where I added my comment.
:-)
@ircmaxell After reading your blog post, I decided to not lie to people who use the framework I'm building. :)
@ircmaxell Instead of pretending to be MVC, we have Endpoints, Libraries (sort of like models, but no ORM), and Templates. :D
ELT
Trademark it!
@DaveRandom ON JOHN
++blogPostsAboutMVC && thisTimeJustTellThemToStopSayingMVC()
15:54
/me writes a platform called JOHN
ELT on JOHN -- I would campaign our office to switch to that. Like yesterday.
Trademark it, sue Elton John for infringement, $$$
@ircmaxell you can only yourself to blame for this
Right, that's my plan for this week sorted.
@ThW Ah, fair enough, I'll remove the comment. I was a little confused lol...
15:55
shhh
@ircmaxell Models. Yay!
I'm probably going to put return types to vote with invariant return types.
@DaveRandom Java Or Haskell Nipples?
I'm just really out of time and need to move on.
15:56
@DanLugg s/Nipples/Node/, then it will be web scale.
Hasknode -- that's kinda catchy.
Okay home time. See you guys!
@ircmaxell What would you name a function that converts the $obj->method($param) calling convention to $method($obj, $param)?
there's an easter egg in the speedtest.net android app ...
pull the graph down and it tells you the story of Ookla ... funny ...
@LeviMorrison huh?
16:08
I am not sure what you are confused about.
can you elaborate on how that would work, or what it would look like?
/me goes to #phph, lata chaps
Yes, when I can find time and motivation =)
Anything in particular that you would like to see?
I'll definitely add some DB persistence, but I am not sure yet if I should use entities/repositories or keep it simple like it is now with the filereader thing
@ircmaxell It's simple: you pass the context 'object' as the first parameter.
^ That could be an implementation. (Actually, that was for a slightly different but similar function; actual code incoming)
TIL: 5.4 introduced PHP_SESSION_*
16:17
Awesome, I just finished your whole tutorial.
$f = function ($class, $method) {
    return function($object, ...$params) use($class, $method) {
        assert($object instanceof $class);
        $object->$method(...$params);
    };
};
$step = $f(Vector::class, 'append');
$transducer = map(function($value) { return $value * 2; });
reduce($transducer($step), $data = [1, 2, 3], $initial = new Vector);
^ That basic idea allows you to map, reduce, filter using user-provided data structures.
You could also do this:
I dislike the assert line, but I get it
0
Q: Joomla 2.5 template parameter for logo not working

FrondorI got this parameter in my template: <config> <fields name="params"> <fieldset name="basic"> <field name="logo" type="media" preview="tooltip" directory="stories" description="description goes here" /> </fieldset> </fields> </config> and ...

$step = 'array_push';
$transducer = map(function($value) { return $value * 2; });
reduce($transducer($step), $data = [1, 2, 3], $initial = []);
It's a really powerful idea but I've found out that I commonly am converting from $obj->$method($param) to $method($obj, $param) so I figure I should provide a function for it. I just don't know what to name it.
I don't know.
ask Igor
but I like it. If it's not difficult to follow...
as I'm finding it hard to see what "map" does
16:26
Oh, that's definitely understandable ^^
I didn't tell you anything about it.
I can show you how it's derived:
array_map(callable $f, array $data) {
    $new_data = [];
    foreach ($data as $value) {
        $new_data[] = $f($value);
    }
    return $new_data;
}
^ that needs to know specific data structure information (in this case, it knows specifically how to create an array and to add values to it).
So you need to provide a function that can do that stuff instead.
function map(callable $f) {
    return function (callable $step) use ($f) {
        return function ($accumulator, $value) use ($f, $step) {
            return $step($accumulator, $f($value));
        };
    };
}
^ That only deals with adding a value.
The initial reduce parameter takes care of initialization.
If we substitute the pieces I showed above using array_push (which was actually slightly wrong in retrospect):
interesting...
function map(callable $f) {
    //return function (callable $step) use ($f) {
        return function ($accumulator, $value) use ($f) {
            return array_push($accumulator, $f($value)); // wrong because `array_push` returns the new index, not the accumulator
        };
    //};
}
reminds me of something... Something I can't talk much about unfortunately, but...
function step(callable $f) {
    return function($accumulator, $x) use ($f) {
        $f($accumulator, $x);
        return $accumulator;
    };
}
$f = step('array_push'); // pass this instead of array_push and it would work properly
Also, I think I've finally named my function that started this whole discussion:
function unbound_method_closure($class, $method) {
    assert(is_string($class));
    return function($object, ...$params) use ($class, $method) {
        assert($object instanceof $class);
        return $object->$method(...$params);
    };
}
function virtual_method_callback($class, $method)
I spent yesterday reading a tutorial of Haskell's type system
and I must say, on types alone, I think I may be in love
16:45
@ircmaxell and Haskell, sitting in a tree, k (i) = s [s <- i, n < g]
Sorry for all the code today, but how does this look?
/**
 * Takes the $class and $method and returns a closure for that method, except
 * that the closure expects the context (an object of type $class) as its first
 * parameter.
 *
 * You can think of it as converting:
 * $class->$method(...$params)
 * to:
 * $method($class, ...$params)
 * except that $method is a proper closure in the second.
 *
 * @param string|object $class
 * @param string $method
 * @return callable
 *
 */
function unbound_method_closure($class, $method) {
    assert(is_string($class) || is_object($class));
I think my example may be more confusing than helpful ^^
@ircmaxell Do you know of any PHP conferences in continental US that would be accepting papers now or soon?
2
Q: How to get the data from $_POST and $_FILES array by using jQuery and AJAX before they get destroyed due to uploading the larger file?

PHPLoverI've following HTML form and I'm submitting the same to a PHP file using jQuery/AJAX: <div class="modal-body" style="max-height: 300px; overflow-y: auto;"> <form id="request_form" method="post" enctype="multipart/form-data" action=""> <input type="hidden" name="customer_id" id="custome...

@LeviMorrison not really, the spring ones all recently closed. the next batch that I know of are in the fall...
@PHPLover , please STOP dumping question links in the chat
16:58
@tereško: ok
posted on December 10, 2014 by kbironneau

/* by nukestar */

Morning
Hi everyone. I'm trying to execute a file at the server with the exec("") or system("") command but it's not happening. The file to be executed is a simple command line file, but I can't get it to work. I tried all answers in the threads regarding to these commands. I'm using WAMP server, got the safe mode off and trying this code: pastebin.com/RuAf51Qn
^ I also tried everything that is commented, obviously
17:13
I wondered if we should make non-deterministic exceptions fatal instead of throwing them into somewhere random. With non-deterministic, I mean exceptions thrown from destructors, signal handlers etc. Apart preventing from these exceptions being randomly caught if gc is triggered by luck (or more probably not luck) in some try block, it also guarantees that only one exception is thrown at once and that e.g. an exception from a destructor cannot override a normal exception.
\cc @LeviMorrison @ircmaxell
I'm not sure.
Exceptions in destructors seem bad in general.
Could be a good idea; I don't know.
Bobs-iMac:~ bob$ php -r 'class test { public function __destruct() { throw new Exception("test"); } } function a() { $test = new test; throw new Exception("a"); } a();'

Fatal error: Uncaught exception 'Exception' with message 'a' in Command line code:1
Stack trace:
#0 Command line code(1): a()
#1 {main}

Next exception 'Exception' with message 'test' in Command line code:1
Stack trace:
#0 Command line code(1): test->__destruct()
#1 Command line code(1): a()
#2 {main}
 thrown in Command line code on line 1
And
Bobs-iMac:~ bob$ php -r 'class test { public function __destruct() { throw new Exception("test"); } } function a() { $test = new test; throw new Exception("a"); } try { a(); } catch (Exception $e) { var_dump($e->getMessage()); }'
string(4) "test"
In this case destructor exception overrides normal exception, if it's caught… wat?
morning bwoebi
@foobar hehe, morning ;-)
I'm trying to have semi-practical examples these days.
e.g.
$elePHPantParty->danceClub?->addToDanceFloor($elePHPantPool->remove());
17:33
@bwoebi I think that's a good idea...
@DanLugg You might like this:
$reducer = compose(
    filter(function($x) { return $x % 2; }),
    map(function($x) { return $x - 2; }),
    map(function($x) { return $x * 2; })
);

$step = step('array_push');
var_dump(transduce($reducer, $step, [3, 4, 5, 6, 7], []));
array(3) {
  [0] =>
  int(2)
  [1] =>
  int(6)
  [2] =>
  int(10)
}
It first filters, then maps, then maps. And it works on any iterable input and you can provide a custom data structure!
Who has Joe Watkins mobile number? tag @DaveRandom
$reducer = compose(
    filter(function($x) { return $x % 2; }),
    map(function($x) { return $x - 2; }),
    map(function($x) { return $x * 2; })
);

$step = step(unbound_method_closure(Vector::class, 'append'));
var_dump(transduce($reducer, $step, [3, 4, 5, 6, 7], new Vector));
class PHP\Collection\Vector#10 (1) {
  private $values =>
  array(3) {
    [0] =>
    int(2)
    [1] =>
    int(6)
    [2] =>
    int(10)
  }
}
No magic methods needed!
nm he text me
user924016
17:48
=]
18:07
@AndreaFaulds By the way, I'm going to not vote on unicode. I have nothing against it, I am just too busy to investigate it properly.
@LeviMorrison Fair enough. I don't need your vote anyway, it's doing pretty well ^^
@ircmaxell I have no idea if systems rely on this behavior / what BC impact it would be…
@AndreaFaulds I just wanted to say I was refraining, rather than wanting to vote against but not wanting to look like the one opposer or something ^^
@bwoebi I'd argue relying is a bug
18:13
@ircmaxell Uh, I think it was intentionally implemented this way actually. There are measures in code so that the old exception doesn't leak memory…
It's more bad behavior.
I'd allow them to be thrown
well, hang on
public function __destruct() {
    try {
        throw Exception();
    } catch (Exception $e) {}
    } // should not fatal
}
definitely yes.
It's about letting them bubbling through…
however, if the exception crosses the boundary, then yes.
but that opens an interesting question
do you then treat explicit dereferences different from implicit ones?
does unset($foo) allow the bubble, but $foo = 10 not?
no.
destructors generally shouldn't bubble through.
If we begin making exceptions, that just gets weird.
yes it does
18:17
i'd expect it to fatal only if an exception is thrown past a destructor call while another exception is already being propagted through the call stack
propagated*
@foobar That IMO has the problem, that everything goes well, until sometime the garbage collector is started in the middle of the exception handling chain.
That just hides the problem to then appear sometime unexpectedly.
well, if the destructor is called by the garbage collector and an exception is thrown, you'd have to fatal anyway as there's no place to propagate the exception to
@foobar garbage collector calls destructor on top of current stack frame…
that ain't deterministic behaviour
@foobar yes. That's why let exception fatal upon crossing dtor boundary.
18:25
why not just when an exception is already being propagated or the destructor's being called by the gc? and if called under normal circumstances, just let it pass through
and because it really is an implementation detail when the dtor exactly is called, just expose always the same behavior.
@foobar Yeah, well. That introduces then non-deterministic behavior. It may work or may not, depending if there's a circular reference somewhere or not (which might be not in the class' control).
well, i see the problem with the gc. but it would still be deterministic as it would always fail with circular references and not only sometimes
Everything works well in my own tests then until someone has the great idea to inject a circular reference into my class in his application. He's then probably going to have a hard time finding a simple reproduce case (because it's not really clear when gc will be triggered)...
So, the way I designed it, it perfectly works… until it goes into real world usage and it fatally breaks. (e.g. because gc never needed to be triggered in my small tests (gc root buffer isn't filled) and then it blows up…)
i'd usually argue that you're right and the class user shouldn't have to know about the internals of the destructor and whether it's save to have an object of a given type in a circular reference or not, but on the other hand it's a programming error to have circular references at all with no more references to it on the stack (directly or indirectly). at least i think it's a programming error. i'd expect the gc to never have something to clean up in a well written program
it's my personal opinion that a gc should never have something to clean up in a reference counting language. don't know what others think about that
No, it's not a programming error. Current example I have: a Connection class and a Statement class. Connection class fills data into Statement class as it receives the data sequentially. But Statement class might want to execute the prepared statement and then needs to notify connection class about it. So, circular reference is needed in some way.
18:37
sure, but you should break up the circular reference explicitly when you can no longer access any objects in the circular reference except from the circular reference itself
otherwise you actually leak memory
Morninig room
and the gc is just a security net, preventing you from having lost that memory forefver
morning
hmmm
forever*
@foobar that works as long as you manually close the statements when you don't need them anymore…
18:41
but that's all just my personal opinion. i don't know what philosophy you try to follow with php
@foobar all we do here is relying on something like RAII…
But maybe I just have some thinking failure…
no, you're right with that and i don't like it either...
@foobar And that IMO is why we need to not make a difference between destructor called from gc and destructor called because last reference to it just was unset.
i can think of a different approach, allowing the connection and the statement to communicate in both directions without using cyclic references, but that doesn't make your approach less valid =/
@foobar oh, really? what's that approach then?
18:58
in your example, it's not required that the connection and the statement will know forever about each other. so you can just drop the reference in the connection object to the statement object as soon as you have filled all data into the statement. that way you break the circular reference. the statement could keep the reference to the connection and can reuse it at anytime, re-establishing a circular reference. the only drawback to this solution is that you can't ask a connection for its
statements
From now on I will call you both @bwoebi and @invertedbwoebi :)
@PeeHaa oO
@foobar yep, that's the drawback of this. Also, it makes anyway problems when the Connection looses all its references except the circular ones in the middle of fetching. At that point then Statement and Connection still have references to each other, but nothing is referencing Statement/Connection anymore…
i just saw that php has weak references
you could use them to solve that problem ;)
but it's still too much you have to know as a language user
no, that definitely doesn't solve the problem. At least not as long as you want a bit of encapsulation and go over a methods API.
well, it would. but again with a drawback. this time it would be possible to destroy the connection while the statement is still alive
19:08
At the point where I need to expose all the Futures array and columns and rows and state properties I also just can inject the object itself. Too many weak references is suboptimal.
@PeeHaa You need to explain that with the @invertedbwoebi…^^
the last option i can currently imagine is to use an implementation class for the statement which holds the reference to the connection and an interface class to access an instance of the statement implementation class. when the instance of the interface class gets out of scope, it can explicitly close the statement implementation object, which in turn tells the connection to unset the reference to it and then unsets the reference to the connection
user924016
bwoebi I think he is refering to the avatars.. hehe
19:17
@RonniSkansing no, they aren't matching^^
Close enough to me
:-D
user924016
=]
if you do it that way, the cyclic reference gets broken by the destructor of the statement interface class without any drawbacks in functionality but at the cost of additional code
19:18
@foobar I must say, I've already thought about that, that's really the only alternative. But it's nothing I'd like to implement that way. A StatementContainer for a Statement is just too much.
ye, it's also the alternative i'd like to do the least, but it's the only one without reduced functionality
depending on the use case i'd prefer one of the other solutions
As much as I like to argue here… I don't want to write a damned RFC… mhm…
morning
@NikiC morning
19:29
@NikiC morning… you eventually can contribute your opinion about chat.stackoverflow.com/transcript/message/20388430#20388430 ?
@bwoebi Don't have much of an opinion on that - imho you just shouldn't throw from a destructor.
@NikiC Morning
iirc we already convert some exceptions thrown during destruct to fatals
but I'm unsure as to the exact circumstances
@NikiC Isn't that inside shutdown sequence where we have anyway no parent stack frame?
yeah, that might be it
19:33
@NikiC yeah… you usually don't throw directly from a dtor, but you might from within some helper function called inside dtor…
Hi, good day to everyone
@bwoebi which is completely fine. Just gets weird if it crosses the destructor boundary
@ircmaxell In which case you probably forgot to catch it at all.
yup
the more I think about it, the more I like what you're proposing (or talking about)
Just a tip for you guys should ever be forced into Java work:
Don't even think of using nullability annotations.
19:45
That's why just fataling is better than having it landing unnoticed in a catch handler which really isn't related to that exception coming from a random dtor.
@NikiC in 8? I haven't played around with them at all
@NikiC have you played with haskell at all?
@ircmaxell Yes. It's horrible. Maybe if they would fully annotate the standard library and make all different nullability annotations compatible, it would be workable. Right now half the time is writing code, the other half is how to trick eclipse and findbugs into understanding the code is correct.
@ircmaxell Sure. Was a while though.
@NikiC thoughts? I've been slowly digging into it, and the type system is melting my brain (in a good way)
@NikiC using eclipse is your first problem.
@ircmaxell Haskell is nice in the same way Lisp is nice. Do you get my meaning?
no, as I think there's something more subversive in that messaging
19:51
Meaning: It's nice to look into it sometime and read a Haskell book or two, but should preferably not be practically used.
@ircmaxell So you're having fun with higher-kinded types?
yes, but more than that
it's that everything is an expression
including the type declaration
and the pattern matching. holy hell.
Not everything's an expression in Haskell...
not everything, but everything with type declaration or value declaration or usage
19:55
@ircmaxell I like that kind of pattern matching starting to turn up in imperative languages as well
yeah...
I really want to give this a go
Rust has it, for example ^^ It also has rather algebraic datatypes, so works out pretty nicely.
I may go to clojure eventually, or another more "modern" language, but still...
I will revisit rust, when they stabalize the language...
@ircmaxell Probably yeah ... I'd have use IntelliJ if it were my choice
They likely also have sane type analysis
yes
netbeans is decent
but intilliJ is much better
we use that as the base for android studio
20:02
public @Nullable String getString() {
    return null;
}
// This method may return a null value, but the method (or a superclass method which it overrides) is declared to return @NonNull.
ummmm
/me head-desk
what the hell how is SO's formatting so braindead
@NikiC inline annotations. ew.
@ircmaxell Haskell is really nice
There are a lot of things Haskell has that I wish PHP had.
20:19
@ircmaxell is it just me or there have been more of the completely retarded php+mvc questions than usual ?
@tereško I don't know. It's hard to tell
@DanLugg You alive, mate?
@LeviMorrison Aye, but kinda stacked atm. I'll be around in about an hour (I hope)
Ahaha I'll be in a meeting then.
Did you see my earlier ping?
Hey, just wanted to quickly ask here - if anyone has ever worked with cakephp, when you make web requests using the HttpSocket(), are the web requests made from the users connection or from the servers?
20:31
completely horrible, but interesting
has me thinking again
I'm getting really pissed over here
20:48
Native TLS gone to vote here: wiki.php.net/rfc/native-tls#vote
someone update the starred thingie
@AndreaFaulds re zpp oflow patch
#define ZEND_DOUBLE_FITS_LONG(d) (!((d) >= ZEND_LONG_MAX || (d) < ZEND_LONG_MIN)) on x64 is used for L as well - where it previously always used exclusive ranges.
@NikiC By which you mean only > and not >=?
yes
Oh, then the existing behaviour was probably wrong then
As it'll overflow if you don't do >=
but wait
as you're clamping to ZEND_LONG_MAX afterward anyway it doesn't actually matter
so nevermind, behavior stays the same
20:53
It may change for some edge cases
honestly, I don't think I really understand the >= condition
or maybe I do
dunno :D
@NikiC Double inaccuracy
A lot of values > ZEND_LONG_MAX will become (double)ZEND_LONG_MAX (a value which, by the way, isn't the same as ZEND_LONG_MAX)
@NikiC why?
@ircmaxell java
:-)
wiki.php.net/rfc/tls <-- that's why we can't have nice things
TLS means transport-level-security. It's an open standard. You can't just re-use the acronym because you want an acronym.
20:57
thread-local storage is pretty well-established as well ^^
eih, maybe
also, reading that mcrypt thread makes my head hurt
@AndreaFaulds I find some of test changes concerning

« first day (1516 days earlier)      last day (3657 days later) »