« first day (1941 days earlier)      last day (3004 days later) » 

5:02 PM
posted on February 08, 2016 by nlecointre

/* by adi */

 
hello everyone
 
5:20 PM
Hi
 
Hey ^^
 
hi @RonniSkansing
how are you?
 
Great thanks
Hope you are okay too
 
yah i'm
but always wired, like past
 
Morning.
 
5:26 PM
if you don't mind i've question today also.
 
@LeviMorrison \0
 
in my area, it's midnight
hello everybody
 
what's the transliterated chinese name for "shadow"?
I remember that in japanese it was "kage", but what's the chinese?
 
sorry dear @LeviMorrison i didn't know tht.
 
5:30 PM
@Nirob It's okay :)
 
Morning
 
hi does any know about .htaccess settings on WAMP?
 
the .htaccess file is for Apache
 
@tereško WAMP uses Apache
 
I know ... but there is a significant chance that @ainasma doesn't know that
@Shafizadeh as for the comment you linked. That's limited to subject regarding active record based ORMs and their limitations.
 
5:44 PM
posted on February 08, 2016 by Joe Watkins

Fig 1. Man chasing Dragon.It's no secret that, I am an addict ... I'm allowed to assume that if you are reading my blog, about programming, you too are an addict. All of the time I am awake, I chase the ultimate high ... that high is ... making computers do stuff. We probably both have a problem ... I've always found "chasing the dragon" to be a beautiful metaphor for the pursuit of our a

2
 
^ @JoeWatkins yea. (hint: phpdbg)
 
oh shit 12:8, RIP list() keys
 
@bwoebi I have a branch I'm working on still ...
along with the function autoloading ... doing them both in tandem ...
 
@Andrea whut … why?
 
@Andrea huh, that's not quite expected
@Andrea Maybe should have done the [] syntax first, hm...
 
5:56 PM
wow, Dmitry and Xinchen opposed
I wonder why
 
@bwoebi Much more surprisingly, Stas is in favor
 
@NikiC Yeah, I took that as a positive indicator…
 
shouldn't we worry about where the real stas is, and what happened too him ??
2
and are we next ??
 
hehe
 
@JoeWatkins You're saying there's a serial killer out for php core devs?!
 
5:58 PM
that's the only reasonable conclusion, I think we can all agree on that ...
 
@NikiC That's crazy talk. He's saying the pod people are after PHP Core Devs
 
@bwoebi yeah, weird
 
@Andrea I'd be interested in hearing their reasoning
 
@bwoebi ditto
 
It's probably something along the lines of "this looks ugly"
 
6:01 PM
if that's the case, resist temptation to yomama them ... even though it'd be so funny, for years to come ...
 
Wes
@Andrea :(
 
maybe objection is legit, but nobody asked yet ...
(haven't been watching closely ...)
 
Wes
it should be obligatory to reason why one voted yes/no. that's not a killer feature but it's legit... i don't see why it shouldn't pass. @Andrea do you know the reasoning for those who voted no?
the only thing one could complain about is that the name "list" wont fit anymore... but that's typical php already :B
 
While I do think that people should explain their reasoning (because the reasoning behind a No could help inform potential changes that could make a later attempt succeed; or reveal a misunderstanding on part of the voter that can be corrected), it should not be required.
If you're going to vote against, though, you really ought to say something during the comments period.
 
@Wes If you're really interested in that, all you need to do is provide a wiki diff that implements this
I think everyone would like to have (optional) comments on votes
But nobody wants to bother actually implementing it ;)
 
6:17 PM
@NikiC good idea.
 
Wes
@NikiC i wouldn't touch mediawiki with a 10 foot pole :B
 
7:16 PM
@Wes it's not mediawiki…
Anyone wants to review the limits or whether we need other limitations? github.com/amphp/aerys/issues/64#issuecomment-181525974 … (\cc @ScottArciszewski maybe something for you? or are you just for crypto?)
 
@Wes no, and I might ask
 
I'm having a weird exception... [FATAL E_ERROR] Call to a member function allow_codes() on string in file Zend OPcache ... the function goes like public function sms(Number $number, $message) { $number->allow_codes(['+2665']); ... not sure how it allows string to be passed even tho there's a typehint. Cannot reproduce locally. PHP 5.6.9
 
(Added default values too to that issue)
 
@DejanMarjanovic can you add a if (!$number instanceof Number) {throw new Exception("blah blah");} in there?
And I'd try just restarting PHP just to make sure there's no caching weirdness...
 
7:33 PM
@DejanMarjanovic Looks like memory corruption. Is it issue sporadic or persistent?
 
@Danack There's a typehint and that works just like expected :) (no need for instanceof, problem is that 'string' is passed instead of Number object by opcache (not sure what sourcery is this)).
@NikiC Thanks, happened 11 times today only on a code deployed 10 days ago, I'm going to re-create on live, spend some money :)
 
7:48 PM
@NikiC it's persistent!
Error message: (ErrorException [ 1 ]: [FATAL E_ERROR] Call to a member function allow_codes() on string ~ Client.php [ 315 ]
)
there's a typehint 100%
 
@DejanMarjanovic what does var_dump say before the call?
 
Possible PEBKAC, I don't have stack trace for some reason, and the method is called from 2 places, one passes Number object and second one string (thus the error), but I'm wondering how it fails to throw typehint exception in that case? @NikiC
 
@DejanMarjanovic maybe you suppress the error?
in 5.6 that was possible
do you have a custom error handler?
 
:(
Yes, how is that possible?
I mean, the same code throws exception locally, but I have 5.6.16 and possibly different config.
I'm sorry, I'm stupid @NikiC
ErrorException [ 4096 ]: [E_RECOVERABLE_ERROR]
Obviously not a fatal and therefore can be supressed.
I have no idea :)
Thanks!
 
8:07 PM
@JoeWatkins skimmed over your blog post. Was it just my impression or are you actualy looking for someone to mentor?
 
@tereško Thanks for the link
 
@Shafizadeh it's actually an excerpt from this book: amazon.com/Patterns-Enterprise-Application-Architecture-Martin/…
but you are a bit too new to programming to read it yet
 
his own site is a really good source on the topic
 
Seems like professional ..
Actually my project is done and I don't want to write code anymore ;-) I will hire two expert programmer for my website instead
3
 
@DejanMarjanovic that's why I said to test the type manually and get the stack trace...also....ewwww. Suppressing errors is usually it's own punishment.
 
8:16 PM
riiiiiight
 
There was a exception handler within controller set in __construct @Danack :'(
 
LiamNeesons.jpg
 
8:31 PM
anyone knows a nice playlist of game soundtracks?
 
just follow links on youtube?
 
oh great thanks, yeah I've been doing that last 3hours..
last one was frozen synapse ost
 
that reminds me, have you looked at Bastion soundtrack?
 
yes :) I've played that so much and it was inevitable
this was kinda unexpected youtube.com/…
@tereško have you listened transistor ost?
 
8:53 PM
nope
I still haven't played the game (it's in my library, though)
 
some of them kinda remind me karma police(radiohead) or portishead youtube.com/watch?v=57cOmxB12XI
 
@Ekin I spent like 4 days looping this song few years ago
 
@tereško ah yes that's a great one
huh it's been a lot I haven't listened it
thank you for reminding
@tereško have you played this war of mine?
I just got that too, it was in my wishlist for a while
 
not yet, but it's on a wishlist
then again, if I am honest, that games scares me a bit
 
why?
 
9:07 PM
"it's complicated" would be the short answer
 
when I saw the trailer first I though this might be a game to make me cry
 
from what I have seen, I probably would end up feeling guilty and/or like shit
 
it's a short game though I expected damn feels
 
it also would put "an emotion" to stories of WW2 from my grandparens
4 mins ago, by tereško
then again, if I am honest, that games scares me a bit
 
I see
I never heard any stories from anyone experienced it... which would be really interesting
 
9:10 PM
for my invalid numeric strings RFC, currently the compiler sometimes evaluates stuff like "123abc"+1 at compile-time causing a notice to appear before the line is executed. Would the best approach to solve that be to just check at compile-time if a string is non-well-formed and, if so, disable compile-time eval? @NikiC @bwoebi
 
@Danack There are some mistakes in CSS that make this difficult for me to judge.
The skinny content and then wide code… ugh >.<
 
@Ekin and soon you might loose that chance forever. It has been 70+ years since then. And there are not many people who live till 90
 
Regardless of light or dark I think there are some more important questions to make first. For example, I think dark backgrounds with light text are significantly better for code that has syntax highlighting.
If you pick a dark background for the code then you need to make sure the transition to light backgrounds for text is not too jarring.
Since it is also text heavy you may want some different kinds of text blobs.
 
@Andrea yes.
At least that's how it's currently done…
 
For instance I see some things that look like notes where whole paragraphs are italicized. You may want some sort of "box" around it and alter the color and other styles.
 
9:15 PM
But I'm all in favor of emitting the notice at compile time if known at ct … @NikiC
 
@Andrea yes, that's preferable
maybe
I don't know :P
 
@NikiC I see no benefit at making compile-time detectable errors run-time only?
 
@tereško indeed... My country wasn't involved in WW2 so there were not many chances but I heard stories from WW1 times from my grandparents, about their ancestors..
 
:)
 
@Ekin I have relatives who were born during WW1 …
 
9:20 PM
:)
 
But obviously they were too young back then to remember themselves of any first-hand experiences …
But it didn't impact Luxembourg very much … we were occupied by Germany, but not much war happened in our region...
but WW2 … yea…
if your family has first-hand some stories about war… absolutely listen to them… (I mean not solider experience, but how peoples lives at home were impacted…)
 
Well, in WW1 Turkey was Ottoman so the whole empire and everything was in constant change. After WW2, they basically fought with many european countries resided in the area. So I've heard many stories from each side...
 
@Danack Q2 OST (by Sonic Mayhem) also good :)
Although Q1 was possible my first exposure to NIN, and been a fan since
 
I really don't fit in the culture/traditions of them or feel somewhat homesick but well, it's a home of many great stories and historical events.
 
everything has its unique history … :-)
 
9:31 PM
indeed
 
heh
there wasn't even such a thing as "Latvia" before WW1
 
btw now thanks to you I got the song in loop
 
... why do I feel like I should apologize ?
 
:)
I dig my hole, you build a wall, One day that wall is gonna fall, that's why
 
@bwoebi for one thing, compile time errors can happen before error handling is set up
 
9:36 PM
@Andrea yea… and? you can very easily fix that.
 
Accessing a class method is easy using 'SomeClass::Method'

How can I do this with a property?
 
god it's so hard to play cs:go and not curse
 
Damn. Thanks
 
@rtheunissen Hey. I'm busy (as pretty much always lately) but wanted to say hi.
 
Hi @LeviMorrison :)
 
10:11 PM
@LeviMorrison stop being busy and take care of your enum RFC! :-)
 
Heh we're all busy. Can't remember the last time "busy" wasn't my answer to "how's it going?"
Less so now with most of the ds stuff behind me.
 
@bwoebi I find an hour every couple weeks :)
 
A lot ahead though, but weight off my shoulders at least
 
Overall it looks pretty good. Congratulations.
 
@LeviMorrison When you say weeks you really mean months? :-D
 
10:13 PM
@bwoebi :D
 
@rtheunissen To clarify, do you implement Iterator or not?
I assumed that you don't (which is how it should be)
 
@NikiC They all have get_iterator but the "position" is handled by the iterator, not the instance
If that makes sense?
I don't explicitly implement the interface anywhere.
 
@rtheunissen Yes, then everything's fine
 
\o/
 
but you implement Traversable, right?
 
10:16 PM
According to the docs he does implement Traversable.
 
okay
 
@rtheunissen Regarding the linked list, what I meant is basically an out-of-order vector
 
@rtheunissen Do you implement Countable? I saw a count method but no extends Countable.
 
Which thus has O(1) remove/insert operations. And has good locality in case most of the elements are not out of order
 
10:18 PM
struct Node {
    struct Node * prev;
    struct Node * next;
    zval v;
};
struct Node {
    size_t prev;
    size_t next;
    zval v;
};
To clarify @NikiC you mean basically doing the above where size_t are indices into a vector?
 
Types notwithstanding, yes
 
Countable, traversable, json serializable.
@NikiC that's pretty clever. You could also iterate very quickly when order doesn't matter (internally), copying etc.
Would be interesting to benchmark a basic implementation against vector.
 
uhm, what's this Hashable interface?
 
@JoeWatkins OH elsewhere: "should have been the guy who played Chandler, he has loads of experience with top gear."
 
can't we just behave like the SplObjectStorage there?
 
10:25 PM
@bwoebi I read through all the object key RFCs, considered other language implementations etc, and decided that a Hashable interface is the nicest way to provide more control for object as keys.
They all fall back to spl_object_hash anyway so it's optional
 
I still don't like it… You should go after identity, not equality here, IMHO.
 
new User(1) and new User(1) can be the same key. SplObjectStorage doesn't support that because they're not the same instance.
@bwoebi I'm very open to suggestions / changing things around
 
equals() is IMO an abomination from Java which should be avoided … when you need a comparison, please have a static function for it which is called by the user explicitly
 
A callback passed to the constructor as referenced in the reddit discussion.
 
@LeviMorrison that's unsafe. Especially in case you pass an instance in and the called code is doing insertions and removals on it. Might destroy internal consistency…
 
10:32 PM
@bwoebi If you do these side effects then it is your fault.
That's my $0.02 anyway.
 
It might be legitimate, but not intended by callee
like you are first operating on the array (with the same structure and your custom comparison) and then passing it in to callee having another expectations … things will go wrong in possibly weird ways.
To be safe one would have to copy the whole structure contents into a new object…
@LeviMorrison That's smelling too.
I'd honestly go after identity, you always can do custom comparisons yourselves...
(or have a map which objects map to which objects regarding equality)
 
who can add me to his team? opensource project development
?
 
10:51 PM
@NikiC you mean amortized O(1) removal?
 
Sorry was making coffee
 
@LeviMorrison "different kinds of text blobs." - do you have any examples of what you mean by different kinds of blobs? fyi, I made the code block only push out where needed....and gave up and just add a 'change theme' button...
 
@bwoebi how would you cover the use case of two separate instance that are by definition "equal". Like a user with an id.
 
user5236938
So by preparing an insert with mysqli_real_escape_string does that guarantee that it can't be injected?
 
spl_object_hash is identity, right?
It's a difficult problem to solve 100%
 
11:02 PM
@Wicked yes. If all the params are bound rather than embedded in the query, it should be safe for almost all situations.
 
user5236938
Thank you @Danack it must be a false positive then. Because I can not reproduce it manually, and it's being sanitized using that.
 
@rtheunissen the best analogy is using 2 red balls.
 
I like it. Tried 'user' because it's a reasonable real word example
 
@rtheunissen It depends on what your need is? Do you want to collect objects? then go by identity only. Do you want to have an unique instance of each User object in a collection? Then just address by id instead of by the object.
 
that said, I've never had the need to compare by identity, but it's also a code smell to have 2 instances of the same thing imho.
 
11:11 PM
So instead of object -> data, you'd have id -> object, id -> data ?
 
yes. (though you only need id -> object if you want to iterate)
 
Or just don't support object keys :p
 
object keys can be useful, especially if there is no unique identifier for an object
But as Florian says, two instances of the same thing is a code smell usually.
There are some usages for SplObjectStorage, but not many … but I've really never missed an equality comparison
@rtheunissen Also, the flaw with hash() is that it might collide with a hash() of an instance of a different object.
 
Use case: database models, like a typical framework 'Model', with an id etc. By definition, two instances of the same type with the same id are the same resource. Joins, aggregations etc sometimes results in multiple instances of the same model.
 
Which means that you would be unable to use your datastructure with unrelated objects as keys
 
11:19 PM
@bwoebi I don't think that's correct
 
@rtheunissen no?
 
Has to be an instance of the same class to pass as "equals"
 
@rtheunissen ehm, I was talking about the hash, not about equals
 
But the hash just directs to the bucket?
 
Oh okay
 
11:20 PM
The hash itself isn't used to determine equality.
 
Fine, I was thinking that each object is supposed to have an unique hash signature … fine.
 
Nope, it's just for better distribution in the table.
I see where you're coming from though :)
 
that was just a minor misunderstanding on my side ^^
@rtheunissen my point is that you don't want to index into a datastructure with a clone of the original
If you need uniqueness, you can easily guarantee that at insertion time by storing which ids (or whatever) already were added to your structure
I'm still maintaining my point that it adds complexity for something easily doable in an alternative way.
 
With that logic, objects as keys are redundant?
Because you can just use the object's address as the id or whatever.
 
@rtheunissen They already are without that logic :-D
 
11:28 PM
I guess what hash/equals allows is to avoid that a->b b->c explicitness, a->c instead.
It's convenience more than anything..
 
you can also just map an id to the object's address … and then use that address in the datastructure
 
Might make more sense for Set
 
@rtheunissen I love being explicit in some circumstances and this is one of them.
 
Would it be incorrect to say that you can be explicit if you like with the current implementation?
 
@rtheunissen when do you plan on making the first tagged release? Also, will you be signing your releases?
 
11:31 PM
@crypticツ Few weeks I think, still need to clean a few things up and write proper docs.
What do you mean exactly by "signing"?
 
@rtheunissen gpg signing the release. Like how php-src does and other packages are now catching up and doing.
 
@rtheunissen the problem with current impl. is that it doesn't allow to differ between contexts… I might want to map all the objects (by identity) … or I might want to have an unique-object map of specific objects.
 
@Ocramius I love how every time I see a twitter user with a terrible programming joke name, I immediately know it's you
 
And in general it's always better to have less "magic" (either by a function defined in ctor where the datastructure is passed to a callee ... or where you need to implement some interface and then the object when passed into the datastructure may or may not overwrite an existing key depending on whether it implements that interface)
 
@NikiC A proper linked-list type can be useful in some scenarios, e.g. because it allows garbage collection. but you can trivially implement one in userland with good memory usage, so why bother doing it in C :D
 
11:34 PM
@rtheunissen I think I now finally achieved to articulate my issue properly.
 
@Andrea terrible programming mistake name :P
 
@Andrea … and terrible performance?
 
class List {
    private $head, $tail;
    public static function nil() /* : ?List */ {
        return NULL;
    }
    public static function cons($head, List $tail = NULL) /* :  ?List */ {
        return new self($head, $tail);
    }
    private function __construct($head, List $tail = NULL) {
        $this->head = $head;
        $this->tail = $tail;
    }
    public function head() {
        return $this->head;
    }
    public function tail() /* ?List */ {
        return $this->tail;
    }
}
 
@Andrea I'd be happy to benchmark that for you :p
Also it's sad that a class can't be called "List"
 
@bwoebi it's slow because list traversal is O(n), not because it's written in PHP
@rtheunissen oh yeah :(
or was it one of the names that was relaxed?
hmm]
 
11:38 PM
@Andrea class names left unchanged
 
$ php -r 'class List {}'
PHP Parse error:  syntax error, unexpected 'List' (T_LIST), expecting identifier (T_STRING) in Command line code on line 1

Parse error: syntax error, unexpected 'List' (T_LIST), expecting identifier (T_STRING) in Command line code on line 1
;_;
@bwoebi oh well
 
@Andrea a userland linked list wouldn't even come close to SplDoublyLinkedList though re: performance?
 
@rtheunissen this is the datastructure is at the core of yolisp
 
Might run a linked list benchmark for fun
 
@rtheunissen probably, but I have no idea
 
11:41 PM
that nil() method looks super useful :x
 
ditto
 
Also what do you mean by "because it allows garbage collection"
 
gonna do that nyao
@rtheunissen if you return the tail of the list, the head is garbage-collected
if the linked list is made of multiple objects, that is
 
Bah, I need to write code generating code by measuring the average time of garbage collector traversals …
 
@Andrea can I do... push N, remove N: ardent, php-ds, spl?
 
11:46 PM
@rtheunissen what?
 
Benchmark setup.
 
hmm
by remove N do you mean taking off the first element in the list, or the last?
 
Could do either.
 
the latter would be an unfair comparison if we're comparing an immutable singly-linked list with a mutable doubly-linked list
 
@crypticツ I'm not sure, will take a look at deployment options when it comes to it. PECL etc
@Andrea so taking off the first then
 
11:50 PM
@rtheunissen fair
though, in one case you're modifying a data structure (Spl's doubly-linked list) and in the other you're not doing any modification at all! (immutable singly-linked list)
 
@rtheunissen you can sign using git, so anyone pulling from the repo can verify the signature for the release. I don't think pecl.php.net supports signing. I think they only have hashes.
 
yay I can construct infinite lists in PHP :D
ooh I can probably do it in the same line if I use a reference
 
@Andrea you've made a list with the next element pointing to itself? :-P
 
no I can't do it using a reference because PHP developers suck >:(
@bwoebi yes :D
 
11:58 PM
@Andrea congrats!
 
$list = new Cons(1, NULL);
$list->tail = $list;

foreach (traverse($list) as $value) {
    echo "$value, ";
}

echo PHP_EOL;
Andreas-Air:gash ajf$ php linked-list.php
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
 
generator abuse…
:-D
@Andrea gash sounds like GNU again shell
 
@bwoebi heh
 

« first day (1941 days earlier)      last day (3004 days later) »