« first day (1871 days earlier)      last day (3077 days later) » 

6:05 PM
Can anybody please tell me why the page gets cached... even if I set Cache-control:max-age=0
 
wow wow wow, wiki.php.net/rfc/group_use_declarations, didn't knew this was coming!
 
it's hard to tell... it might depend on so many things! even though you seem to be sure, and that evidence seem to wupport it, there might be something else at cause. It could be related to a framework would you happen to use one. It could be your routing, if you do so php side.. pretty wide topic @whatever
afaik, a faulty .htaccess could also overwrite your php code cache setting
 
Abe
@whatever try Cache-Control: no-cache ?
 
What should/shouldn't be iterable in (regarding built-in, native types and such) PHP? Iterators of course, and arrays; strings as $offset => $byte; anything else?
I think the general agreement that objects as $publicKey => $publicValue is not good.
 
@FélixGagnon-Grenier yes I am doubting the htaccess I think.. I recently changed the one..
 
6:19 PM
@DanLugg The strings part could be controversial.
 
@LeviMorrison Fuck unicode codepoints.
 
But yeah, iterating over object properties was a stupid idea.
 
Look, its not controversial anymore.
 
@abe I am trying to set it but that max-age one is not getting replaced
 
@LeviMorrison I'm just trying to kludge a get_iterator(mixed $iterable) : Iterator function into some legacy.
Well, legacy running mostly successfully on 5.6 now.
So yea, I'll exclude objects properties.
 
6:21 PM
@FélixGagnon-Grenier I added these to htaccess recently
<Directory "/">
Options -Indexes
</Directory>
 
if you just rename your htaccess, does the caching issue still happen?
 
@LeviMorrison Anything else?
 
(keep in mind that any htacces file in a directly called php script will be applied, overwriting one another, I think)
 
Well… I'd name it getIterator to match IteratorAggregate.
Similar to how count($obj) correlates to $obj->count().
 
@LeviMorrison Conventions; methods are camelCase global functions are snake_case
Any other "iterable" types though?
 
6:25 PM
Not that I can think of.
 
Okie doke, awesome thanks :-)
 
Abe
dom stuff is iterable and iirc only implements traversable
you mean that?
 
@Abe brings up something that's bothered me for quite some time; why do we even have Traversable?
@Abe I may need to include that, yes; or rather move my type check up to Traversable for that.
 
You can turn any Traversable into an Iterator via IteratorIterator, so I doubly don't know.
 
Abe
@DanLugg to resolve the iterator magically
 
6:28 PM
@Abe Is that in response to my question?
See, that's... stupid.
 
@FélixGagnon-Grenier No I did not reanme it
 
Abe
either getIterator or Iterator, but not array
yeah, definitely annoying @DanLugg
 
what I meant was, please rename your htaccess to htaccess_bk and see if your issue still happen @whatever
 
okay
 
I honestly believe there should only be Iterator, and that IteratorAggregate shouldn't magically work through Travesable.
IteratorAggregate could surely still exist, but it wouldn't function as a magical hook into foreach via Traversable
foreach ($implementsIteratorAggregate->getIterator() as $k => $v) { }
^^ Write it out; you're not gaining anything except muddiness IMO.
 
Abe
6:30 PM
@LeviMorrison got something to talk you about, when you have some free time...
 
@DanLugg Well, if it was that way from the beginning, sure.
I think that's too big of a BC break for little gain.
And then people are going to make some new abstraction to accept Iterator or IteratorAggregate.
 
What about transitioning away: Enumerable
 
Abe
@DanLugg an object doesn't necessarily have 1 iteration only. so iteratoraggregate is not a good idea imho
 
@FélixGagnon-Grenier yes buddy that seems to have worked...
 
Abe
i mean, it is fine having a getIterator method, but not resolved automatically
 
6:33 PM
^^ Exactly.
@LeviMorrison True.
 
but I need those directives.. I need to protect the directories structures
what should I do now
 
One other matter of , setters accepting collections of things; there's a bunch of setFooArray or addBarArray methods floating around, and they're typed to accept arrays. They typically just foreach calls to setFoo or addBar to maintain type enforcement against the collection.
What would be a better suffix for "iterable" parameters? Not just arrays.
Pluralization works, obviously, but if there were a suffix to be applied to maintain singular conjugation of the type name, that'd be better.
 
Abe
would use addBarCollection @DanLugg
 
well it would appear that the way you protect your directory also messes with caching @whatever. Can't you just put those directories out of public scope? (eg at the same level as public_html)
 
@Abe Okay ^^ and I want to do that, the only issue is there is a Collection type in the library.
I don't want there to be ambiguity confusion.
 
Abe
6:37 PM
what about All?
addBarAll ?
 
Mmmmmmaybe.
 
@DanLugg Don't make these methods.
 
then I would have write too manything @FélixGagnon-Grenier
 
@LeviMorrison Well, we're down the rabbit hole, but why?
 
function for_each($input, callable $f) {
    foreach ($input as $value) {
        $f($value);
    }
}
 
6:38 PM
long story short: with a public index.php file calling the local hidden files
assuming those are php files that is
 
You can use that for all of those methods…
 
Abe
or, just use foreach()
 
Well, depending on the call site the function may be preferable, but yeah.
 
public function addFoo(Foo $foo) {
    $this->fooCollection[] = $foo;
}

public function addFooCollection($fooCollection) {
    foreach ($fooCollection as $foo) $this->addFoo($foo);
}
So don't bother with the latter? Seriously? @LeviMorrison
 
This means lots of work @FélixGagnon-Grenier
 
6:40 PM
what are you actually trying to protect @whatever ?
images? html pages? scripts?
 
the directories.. when I don't apply those then all the directories are browsable @FélixGagnon-Grenier
 
@DanLugg Correct – just lift the addFoo call.
 
That's putting strain on the call site programmer.
Idiots gonna idiot.
Also, I have cases of with*
 
that in itself is not a problem.
it's the point of public folders
 
Well, if they gonna idiot then whatever :shrug:
 
6:42 PM
why not.. my php script is browsable then .. is that good?
 
Whoops
 
@FélixGagnon-Grenier
 
put an index.html in the folders you wish to not be browsable
directly calling php scripts will still work
 
I nerfed that example, but yea.
@LeviMorrison Can you elaborate on the advantage of lifting the iterated-setter?
Idiots notwithstanding.
 
(also, that a script be present in a public folder doesn't mean it can be textually read by someone out of your network. This actually takes a server failure)
 
6:43 PM
?
 
hmmm..
 
do u know how to decode with php and string created by js api filereader in my server ?
 
The only thing I can think of is a narrower API, and that'd be understandable, but if it's only one method per mutable property, then your API would only widen excessively if you had too many mutable properties anyway.
 
i watch youtubve and google a lot but i couldnt reach
Ok dan
 
last time I asked some guys here to check my website and they told me that my directories are browsabel and I should take the site down asap
@FélixGagnon-Grenier
 
6:45 PM
@what
 
@Abe Feel free to weigh in ^^ too
 
why u dont respond when i ask for help
 
@Phoenix ??
 
the proper way of doing this would be to put your scripts out of the public scope, that's for sure. but if you can't afford the refactoring time, the quick and dirty way is to manually add index.html files in the directories so they can't be browsed. Again, if there is no server failure your scripts won't be readable by people
@Phoenix because you are being rude. Nobody has any obligation to help you
 
it's called "the entitlement problem"
 
6:48 PM
AKA Do Re ME ME ME
 
sry @FélixGagnon-Grenier
why down vote
 
Abe
@DanLugg i have some interated methods. i find some things useful to have iterated in methods, like $collection->containsAllOf() containsNoneOf() containsAnyOf() retainAll() etc but i prefer doing things like multiple adds or removes by using foreach
 
@Abe So yea, just move the responsibility to the call site...
Hmm.
 
Abe
though, i could easily change my mind on having them
 
6:55 PM
Thanks @FélixGagnon-Grenier ... This problem would not be traceable without your help.. great buddy
Many Many Thanks
 
Abe
because i suppose having an addAll method could allow me to implement it in a way that is specifically optimized for the data structure
 
glad you could solve it @whatever
 
Abe
for example empty() is basically foreach($collection as $key => $x) $collection->remove($key) but you don't do that... you just want empty()
for the same reason i could have removeAll or addAll
 
:) @FélixGagnon-Grenier
 
@Abe That's my thinking, and generally, I try to keep deviations low across APIs. Collection mutators are identical across the board, and they're included across the board currently.
But, I'd like to know of disadvantages.
 
6:59 PM
@FélixGagnon-Grenier can we talk a bit more about this issue in private chat??
 
Abe
i don't know about disadvantages...
 
@DanLugg Well, a single reusable function like for_each can do all of those setters. Less code to write is less code to have bugs and to maintain.
 
sorry, I can't right now.
 
okay..
 
@LeviMorrison So, given Foo::addBar(Bar $bar) and $foo = new Foo; you'd use for_each($bars, [$foo, 'addBar']) at the callsite.
 
7:00 PM
It's not a huge deal.
@DanLugg Or something like it, yeah.
 
Hmm.
 
But this does illustrate one reason why I want to unify symbol tables.
 
That being?
 
for_each($bars, $foo::addBar);
for_each($bars, [$foo, 'addBar']);
for_each($bars, callable($foo, 'addBar'));
 
Ah yes.
Either way though.
 
7:02 PM
I think it's pretty clear which one is the best if all are possible.
Honestly, PHP is fragmented because of the division too
 
^^ Yep.
 
We need to repeat work for constants, functions, etc because of this.
One big point is autoloading.
 
Honestly, fully unified symbol tables would be awesome; all definable types, functions, classes, constants, etc.
 
I know it would be a large BC break but I think it is the kind that is best for PHP's future.
 
Because we wouldn't need Foo:class anymore; merely Foo
 
7:04 PM
@DanLugg We'd have to remove bare strings too but yeah :D
 
As well, function foo() { } could be referenced by simply foo.
@LeviMorrison Yep.
 
It's a much better future.
 
map($collection, foo)
 
I don't know how to convince Internals of such a large BC break, though.
Would be easier if it was at a conference.
 
Another thing, extension methods with only public visibility of the type to which they're hooked.
 
Abe
7:05 PM
@DanLugg you can do like i did:
class A{}
const A = A::CLASS;
not joking.
 
^^ Yea, but that's kludgery.
 
Abe
also helps not having the same name used for multiple different things
 
register_method(Foo::class, 'doStuff', function (Foo $this) {
    // do stuff
});
(new Foo())->doStuff(); // works
 
Abe
@DanLugg planning to generate them automagically
 
Because register_method(Iterator::class, 'map', function (Iterator $this) : Iterator {});
map, filter, apply, etc.
@Abe True, that'd work.
 
7:08 PM
It breaks some magic methods too.
 
@LeviMorrison How?
 
Essentially __call and __get() would need to be unified.
 
Oh yea.
That'd be fine.
We'd only need __get
 
Abe
@LeviMorrison would be good to start educating php developers about things like, never use static, never use the same symbol for different things, etc. why don't we start a site?
never use references............
 
Stupid code kata. "Strip all 9s that are inbetween 7s"
 
7:10 PM
class Foo {
    public function __get($name) {
        if (method_exists($this, $name)) {
            return $this->$name;
        }
        return function () use ($name) {
            throw new Exception("$name doesn't exist");
        };
    }
}
 
> Expected: 7799997, instead got: 777
 
(new Foo())->bar();
Without needing to ((new Foo()->bar))()
 
Abe
((new Foo)->bar)()
:P
 
Whoops.
lol
Right?
 
> never use references............
what?
 
Abe
7:11 PM
&$references @FélixGagnon-Grenier
 
yeah I got that hum... reference :p
 
Abe
variable references, not object references
 
I love references.
 
That's what I understood, variable references. I disagree
I like them too
useful when working with arrays, for instance
 
I find them useful for "matcher" functions.
 
Abe
7:12 PM
@DanLugg you have a reserved place in hell then
 
function match($input, &$output) : bool
 
Abe
what's matcher functions?
what does that function do?
 
Things that "match" things.
preg_match for example
 
ie no need to copy a huge array just to know if it's the same
 
Abe
aaaaah @DanLugg but that's bad.
 
7:14 PM
Disagree.
Though, anonymous classes kill off array-oriented-programming, and make it cleaner
 
Abe
you should have
regex($input)->match() : true
regex($input)->matches() : []
or something...
 
^^ Yea.
Agreed, but for the current purpose, I'm okay with the implementation.
 
foreach ($hugeArray as &$array) {
    $array['key'] = 'foo';
}
 
Doesn't COW save you anyway? ^^
 
Abe
every time you use a reference a very specific kitten dies
10
 
7:16 PM
@LeviMorrison I really hope you have over 9000 lives.
 
though my example would be better done using array_walk
I'll think of a valid one
some day
 
Abe
levi hates references a lot :P
 
foreach ($keys as $key) {
    if (isset($array[$key]) && is_array($array[$key])) {
        $array = &$array[$key];
        continue;
    }
    // ... dragons
}
 
Abe
the only references i have are:
$foo = function() use(&$foo){ .... recursive anon funcs ...... };
 
If an anonymous function becomes recursive, I define it.
 
7:19 PM
Facebook\Entities\AccessToken Object ( [accessToken:protected] => CAATnCDc2XnUBAHqk5t3eA3M2Lc7WqRsZBaW5aGzECH2LFpuGAoKNDW0bZBzAJsKBCpfayO9BZCtdHZA‌​pme0UkXcAvNsWXXJBHcI42th1UPvDXst878VjzrFc4m03rL1CboP9S9KGVtjf38A6V48hgeovc3HwJqAU‌​kg81nxr4ZD [machineId:protected] => [expiresAt:protected] => DateTime Object ( [date] => 2016-01-28 21:50:30.000000 [timezone_type] => 3 [timezone] => UTC ) )
How do I extract only accessToken ?
 
Abe
@DanLugg yeah
should do the same
continue 1; === continue; right?
i never remember...
 
Abe
thanks :P
would have
foo:
continue foo; as in js
 
public function __get($name) {
    if (method_exists($this, $name) || property_exists($this, $name)) {
        return $this->$name;
    }
    return null; // this is PHP so yeah
}
 
@Abe just use goto, because that's what that is
 
Abe
7:26 PM
@ircmaxell eheh
 
as a matter of fact, I never write 1 after continue, or break. only 2 when it should break more than one layer. should I?
 
@LeviMorrison s/return null/throw new Exception()/
 
Abe
good point
 
Accessing an undefined variable isn't an exception, so this shouldn't be either.
 
@FélixGagnon-Grenier No you should not
 
7:27 PM
However… it's defined by you so you can throw if you would rather!
 
Mogoring roomsters o/
 
lotsa mojo to you too
 
@Abe use the Zeta combinator
 
Abe
@ircmaxell ?
 
function Z($step) {
    $cmb = function($next) use ($step) {
        // the following lambda makes it a Z combinator instead of Y. But w/out lazy eval, it has to be here
        return $step(function() use ($next) {
            return call_user_func_array($next($next), func_get_args());
        });

        // A lazy lang can do a true Y combinator, which would look something like this instead
        // return function() use ($next) {
            // return $step(call_user_func_array($next($next), func_get_args()));
 
7:30 PM
what am I even reading here
 
$fibo = Z(function($fn) {
    return function($n) use ($fn) {
        if ($n > 2) {
            return $fn($n - 1) + $fn($n - 2);
        }
        return 1;
    };
});
 
Like… I really hope we can get a significant number of people with voting power together at a conference or convention some time.
 
Abe
oooooooh @ircmaxell that's cool
functional confuses me...
 
If we decide to do the BC breaks then great! If not then we know that's not the future of PHP.
 
function Z(callable $step) {
    $cmb = function(callable $next) use ($step) {
        return $step(function() use ($next) {
            return $next($next)(...func_get_args());
        });
    };
    return $cmb($cmb);
}
 
7:32 PM
And that's not a bad thing, necessarily.
 
^ fixed for PHP7
 
Abe
yes, got it, it's great!
 
Stability at this point in PHP's lifecycle is welcome for a lot of people, I imagine.
 
function Z(callable $step) {
    // 7.1 hopefully
    $cmb = (callable $next) => $step(() => $next($next)(...func_get_args()));
    return $cmb($cmb);
}
 
Abe
> functional confuses me :P
 
7:38 PM
s/me/all of us/
 
I know this photo isn't related to PHP, but actually I like to know this photo what feeling gives to a programmer?
 
Abe
makes me think "thunder song"
 
someone hangs on 4chan too much
 
@Abe :D tnx
@FélixGagnon-Grenier what is "4chan" ?
 
7:42 PM
['POST','/contracts/prices',['Controllers\Contracts','computePrices']],
how would computePrice actually pass it's result to the function that would set it in a response object?
I'm thinking of having a response wrapper, which I would pass to my controllers constructors
(because right now, I'm having to duplicate code in many methods directly called by the routing process)
nvm @Shafizadeh, please do not actually google it.
 
Well, I see it as a kid hugging a tiddy bear.. :D @Shafizadeh
 
@FélixGagnon-Grenier :-)
 
seriously. it's a shadowy place of the internet
 
@whatever I didn't tell what you see? I told what feeling?
@FélixGagnon-Grenier ok :-)
 
I think the camera is good quality.. and I should have one like this too..@Shafizadeh :D
 
7:47 PM
good :-)
 
Actully in todays world when you open your facebook acount you see literally hundreds of pictures each day.. so when you see such picture you don't think too much..
 
ircmaxell discussing contributions to OSS, and room 11 gets a mention - blog.grovo.com/drives-worlds-valuable-volunteers
7
 
AS a kid back in 90's it would stir my imaginations for days.. I have one still in my diary preserved that was the picture of bunch of students sharing smile .. I would see that image and I would feel good .. but no more
@Shafizadeh
 
nice :-)
 
8:26 PM
@MarkBaker yup :-)
 
@ircmaxell func_get_args() :(
 
@NikiC shoot, good point, forgot about that
function Z(callable $step) {
    $cmb = function(callable $next) use ($step) {
        return $step(function(...$args) use ($next) {
            return $next($next)(...$args);
        });
    };
    return $cmb($cmb);
}
 
You know what'd be nice IMO? If calling a constructor returned the instance of the type it constructs.
$c = ['Foo', '__construct']; $foo = $c();
 
meaning if it acted like a factory?
 
Essentially, yes.
An implicit return. Though, I hate implicit...
public static function new(self $this, $params...) {
   // set up
   return $this;
}
 
8:38 PM
that's interesting
I could potentially get behind that
 
What problems do you think would/could crop up with this sort of functionality?
 
I don't really think much...
 
... lol
 
Abe
@DanLugg y u want to do bad things with the constructor :D
 
@Abe I don't, but object construction doesn't to me seem like anything but a normal method with implicit return of an instance of the class in which it's defined.
 
Abe
8:47 PM
it doesn't actually construct the object, it initializes it, therefore no return. imho
 
8:58 PM
Fair enough; a static initializer would be just fine.
Implicit $this, implicit return, neither, both; whatever.
public static function new(self $this) : self {
    // initialize
    return $this;
}

public static function new() : self {
    // inialize
}
 
Abe
why you need that?
 
Is new valid as a function/method name?
 
Abe
@MarkBaker it is now in php 7
 
No, but class isn't valid as a constant name.
^^ That too.
 
....
misread it...
 
9:00 PM
@Danack Yes, but they don't return the instance. Nevermind.
Short point: constructors (or technically initializes) should be factory methods. The object context of $this can either be a parameter, or an implicitly available variable. The return can also be implicit to keep with constructors as current.
However, they probably must be static for my position, as you would need to invoke the callable without an instance context to bind.
 
isn't that like violation of SRP?
 
So, [Foo:class, '__construct'] where public static function __construct
@iroegbu I don't think so.
If it were, constructors at current are a violation.
 
constructors don't return, do they?
o yes they do... in a way
 
no
 
Abe
@DanLugg are you trying to have multiple constructors?
 
9:04 PM
well, the return value is thrown away
 
@iroegbu Technically no, however the operator that invokes them yields an instance.
 
"return $this" feels awkward though
 
@Abe Nope, just to be able to invoke constructors as factory methods as callables without having to manually declare public static function create() with an identical signature proxying to __construct
@iroegbu I'd say to reason against return $this mutating the object reference would be sufficient, but you'd still need a return for the method to work correctly.
 
Abe
@DanLugg wait... writing something
some would call that a builder but it actually is a dto
which is also a weaker representation of your A
 
Abe
9:32 PM
@DanLugg A's constructors will always be conforming to AFactory, while AValue's will have constructors specific to your input data pastebin.com/ViJiTK1A
 
9:46 PM
i need an idea on something to cURL for a proof in a speech
 
The hard life of IT Dev Support: "Everything is broken, why did we hire you?" "Everything is fixed, why did we hire you?"
 
it's paradoxical
 
Abe
10:47 PM
@DanLugg was reading again and i understood you this time :B basically you want construct to be static...
@DanLugg this 3v4l.org/cP189
 

« first day (1871 days earlier)      last day (3077 days later) »