« first day (2008 days earlier)      last day (2940 days later) » 

3:01 PM
@user2314870 For a real-time chat app I wouldn't loop queries that way. Instead I'd do an AJAX request every 5 seconds or so to see if anything new is available (just by counting unread messages) and only start querying for those if there is anything to query.
 
@Oldskool that means once a user A will send message to user B, then user B receive msg after 5 second ??
 
I thought the extra operations conditional and comparison will make it use up more mem and time
 
@user2314870 In the worst case, yes. If that's too long you can obviously use a lower threshold, but it'll have a bigger impact on the performance of your webserver.
 
@Oldskool this is working 5n right now, only issue i need to find a way which stop this query in loop, instead there should be condition which should set if query needs to called
 
@user2314870 Alternatively SSE's from HTML5 might be useful: html5rocks.com/en/tutorials/eventsource/basics
Although I have no actual experience with those yet, so I'm not sure if they suit this scenario the best.
 
3:06 PM
Does anyone have an explanation ^^^^^
 
ThW
@Oldskool I would use WebSockets and Non-Blocking-I/O.
 
@Oldskool @user2314870 As oldskool said SSE's will optimize the performance. I have used them. You can try to implement them if the browsers supports it or do the long poll with ajax.
 
@ErvinLlojku this code is of long poll only with ajax
 
@Oldskool @user2314870 P.s: maybe you can optimize queries more by adding a condition to get only the messages after the last one fetched.
 
@Oldskool you are probably going to break your server if the number of users grow beyond your expectation
 
3:09 PM
@iroegbu Obviously. If this is going to be a large-scale application I would defeinitely do additional research.
 
@ErvinLlojku what if I set the cookie on both machine and update the value and based on that I fire the query
 
ThW
@iroegbu long polling has the same problem (depending on the server) if you hold open a request for each client on an apache httpd you might run out of resources really fast.
 
Is Long Poll with PHP worth when there are more user, because I think php is weak in concurrent process
 
@user2314870 yes you can do that or just localStorage instead of cookie. P.s: consider security if you do so.
 
ThW
@user2314870 PHP is not the problem but the webserver, here are other approaches like AMPHP or ReactPHP.
 
3:14 PM
Thanks Guys, will find some way here and update you on the very same thread
 
@user2314870 have a nice day .
 
@user2314870 If you want to use WebSockets, amphp.org/docs/aerys might be an option for you. But I'd suggest that you start with the basics of non-blocking I/O and Generators with Amp first, if you want to use it. Same for any similar project.
 
anyone have an idea why few ops is using up more mem and time? here vs here
 
Hello
 
@Andrea I already pointed it out on list but:
> This is something that particularly concerns me about union types, in that
> they reduce type safety.
This is incorrect.
 
3:21 PM
It is, it could be put better
 
I am confident it could be formally proven that it is wrong.
 
@Andrea I'm with Levi here; at least the way you put it looks wrong to me.
 
Going from an unknown and unrestricted number of types to N types will not reduce type safety.
 
Sure.
 
Also, just because you have a union of types doesn't mean you are restricted to the intersection of their interfaces for operations that can be called.
You can discriminate them and then call all operations for the appropriate type.
 
3:23 PM
Sure
 
The union type declaration is an indicator that you need to discriminate.
For instance returning User | Null is basically telling the calling code that they need to check the result.
 
I'd argue that if you need to discriminate, you may want a separate function. And if you don't need to discriminate, you shouldn't need a union type.
Not always, but.
 
the point is the not always.
 
Exactly.
 
There are enough legitimate instances … in general, before considering the union, you should consider separating the functions… but there are enough cases where a separate function doesn't help anything.
 
3:26 PM
I just feel it's a feature with too much scope for abuse, really
 
@Andrea In that case, we really should stop coding.
 
ThW
Separate functions might clutter the API if the only difference is the type.
 
In case of User | Null there may be times you can do a null object pattern. For instance, if the user you are looking up is the user associated with current session then you can maybe provide a GuestUser.
But this is actually more rare than User | Null in my experience.
 
It has some usefulness in some situations, but I feel like most of the time where people would use a union type, they probably should restructure things
 
@LeviMorrison It depends on the circumstances what you do.
@Andrea you could say the same of traits and inheritance
 
3:28 PM
(it's probably just as true)
 
they have potential to be (and actually also are) abused much…
 
@bwoebi if PHP had been designed today it might not have inheritance
 
@Andrea it depends on the designer.
 
@bwoebi Which is why modern languages no longer support inheritance ;)
 
If I were to design it alone I'd go a Go-like approach I guess.
 
3:29 PM
the other concern for me is that a lot of the usefulness of union types is as a workaround for problems which we could solve more cleanly
 
@Andrea yeah ... I think the number 1 use case for union types is really array|Traversable
 
I mean, great, it solves problems like int|float, array|Traversable and so on, but shouldn't we solve those properly first?
 
exactly
 
@Andrea totally agree on these special cases, but it's not like union types have these as only purpose.
 
@Andrea Very much my feelings as well.
 
3:31 PM
@bwoebi sure, but I think it's worth considering that union types look less useful if we fix these
 
They are just glaringly obvious ones.
 
Union types actually solve these problems in a way, but they still have a purpose apart from these. … as Levi says.
 
Sure
 
There is still basically Optional<T> that has to be solved in any language.
Do I have the thing or not?
Somehow that has to be done.
 
I agree with you there
 
3:32 PM
@Andrea there are cases like … foreign library returns an instance of something and you have an interface with exactly the same methods in your repo… you may switch MyInterface | ForeignClass
 
@Andrea you mean int|float|GMP?
 
@bwoebi Sounds like a good example of a bad usage
 
(but yeah, you can say, we should allow protocols)
 
@PaulCrovella potentially we might have some sort of Number interface they'd all implement
One thing that concerns me is that, because it allows you to work around missing superclasses and such, it makes doing the wrong thing less painful
 
@NikiC The point is that you can't runtime monkey-patch your interface to it.
 
3:33 PM
Also, intersection types are valuable and they solve their problem more elegantly than any other solution I've seen.
 
@LeviMorrison intersection types are quite a separate topic though.
 
Seems odd that you guys seem opposed to union types but not intersection types.
 
I have a possible problem with intersection types too, but it's a completely unrelated one to union types
 
@Andrea Well what is it? I still need to write the RFC.
 
@LeviMorrison well, for one thing, intersection types don't involve primitive types
@LeviMorrison so, one concern of mine is that if you're asking for two interfaces, they may not coöperate like you expect
 
3:35 PM
@Andrea bool & array is perfectly fine if you don't want anything to ever pass.
^_^
 
@LeviMorrison hehe
 
Okay, so what if for symmetry we only permit unions on non-primitives and just "fix" things Array | Traversable?
 
a potential example, say you ask for an ArrayAccess&Countable. an object might implement both, but the count might be completely unrelated to the accessable items
 
@Andrea My current favorite example where I miss union types: github.com/amphp/aerys/blob/master/lib/Host.php#L91-L99
 
Thoughts on having hash_hmac() throw an error when the key evals as empty for better security?
 
3:37 PM
@LeviMorrison only on non-primitives is interesting, but if you do that, then the question is now just: why aren't you using an interface?
 
@Andrea well, you always can shoot in your own foot.
 
avoids any weak typing etc. issues
 
@Andrea Finite number of possibilities.
Inheritance is always unretricted.
Also, technically enums are just a special case of union types as well ^_^
 
@bwoebi ah, one of those magic things where it accepts a bunch of possible types
 
@Andrea because the classes actually may implement multiple interfaces
 
3:39 PM
@LeviMorrison true! it's not an ad-hoc union though, at least
 
(and it's definitely a bad UX to force the dev to $host->useCallable($class)->useMiddleware($class)->useBootstrap($class) instead of $host->use($class))
 
oh actually come to think of it
Haskell has intersection types of a kind for its interface-like thing
 
What is my life. Changing directories in my terminal when a colleague leaves for the day. He says "See ya" and I respond with "cd"
4
 
and it works pretty well there, so I guess I shouldn't worry about it
 
@Andrea I certainly don't want to Provide 4! (24) different interfaces just to have all combinations of interface groups solved
 
3:42 PM
@SammyK Big +1. Same if the hash function is not available.
 
If we had Go-like interfaces that wouldn't be a problem … but no, it's PHP.
 
@LeviMorrison okay, I think I have no objections to intersection types, actually
 
@kelunik :)
 
I'm trying to think of an example, but Haskell does something like it sometimes
in a type signature, you can require that you give a function some type a which has implementations of certain typeclasses, and you can require that a single type implements multiple typeclasses
for example, you might require it to implement Eq (can be compared with == and /=) and Ord (can be compared with < and >)
!!admin list
 
Ronni Skansing, Félix Gagnon-Grenier, kelunik, bwoebi, Florian Margaine, Joe Watkins, tereško, DaveRandom, Danack, Levi Morrison, NikiC, Jimbo, Gordon
 
3:46 PM
one day
 
!!admin add 736162
 
User added to the admin list.
 
@Andrea today
 
!!admin help
>.<
 
@LeviMorrison I don't think we have help commands yet. :D
!!version
 
@Andrea that's quite the point of intersecting Countable and Traversable
 
!!tweet did you know @notajf is the best twitter user, it's true
 
^ That's all you have as docs.
 
@bwoebi yeah
 
3:49 PM
!!admin remove 736162
 
Morbecca!
 
User removed from the admin list.
 
@Andrea s/notajf/sapphicorb/ :-D
 
I guess there's a concern something might implement those two differently, but that's a worry anyway
@bwoebi I have many Twitter aliases. Currently only @notajf is under my “real” name
 
@Andrea Good that you don't know how it works. :P
 
@Andrea I'm sorry Dave, I'm afraid I can't do that
2
 
D:
 
@Andrea i know… too many. But two main protected accounts?
 
@bwoebi @notajf isn't protected
 
@Andrea I know … I mean, you have yet another protected account with only few followers but many tweets?
don't remember the @name though
(which I don't follow)
 
3:52 PM
yes, I do. that's for me to know and you not to find out.
 
@Andrea I found out once, don't remember how though … not important anyway ^^
I believe I saw it on some screenshot of yours ^^
 
@Andrea what's the reason for all these twitter accounts?
 
@FlorianMargaine privacy, one-off jokes, etc.
 
Like all interesting people, @Andrea is living a double life
 
3:59 PM
@NikiC hah
to a very limited extent, probably. less so than I used to be.
@NikiC unfortunately I can't joke about you not existing any more, ever since you hired that actor to play you at conferences
 
@Andrea Do you have any fake passports? :P
 
@NikiC would I tell you if I did? ;)
 
@Andrea :P
 
@Andrea actually, that actor is imitating him quite good… Knows enough about internals to be worthy.
 
@bwoebi you didn't notice the earbud?
 
4:07 PM
@Andrea I'm afraid, there was none … except if it was hidden well inside
@Andrea but heh, you can still argue the cyborg theory … :-)
 
@LeviMorrison "rebuttles" hah
I found that word funny
 
Rebuttal*
I spelled it wrong ^_^
 
@NikiC there's no difference between tmp_var and var except that the former may not be a reference, right?
 
@bwoebi ostensibly yes. practically they're not quite that interchangeable
 
@NikiC uh?
 
4:18 PM
@bwoebi not all opcodes accept tmp_vars
most notably send_var_no_ref
You can't just switch something that currently returns var to return tmp_var, it will change behavior
 
@NikiC var_no_ref isn't equivalent to send_val? (except that it unwraps refs?)
 
@bwoebi nope, not at all
send_var_no_ref is magic and the name is totally meaningless
it like, literally has absolutely nothing to do with sending variables not by reference
 
Looked it just up… I see … stupid name
 
it should be something like send_var_like
or send_varish :D
 
lxr.php.net/xref/PHP_MASTER/Zend/zend_vm_def.h#4275 … that check looks weird too … shouldn't that be if (Z_ISREF_P(varptr)) { /* do nothing */ } else if (!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) && Z_TYPE_P(varptr) == IS_OBJECT) { ...
stupid boolean conditions spanning multiple lines…
@NikiC I still don't get that code … always retain references and wrap objects into a reference if not ZEND_ARG_SEND_FUNCTION, scalars and arrays are copied?!?
with a notice if the parameter cannot be sent by ref
 
4:48 PM
@NikiC Can't figure out the purpose of that make_ref there…
 
Ekn
5:17 PM
evenings
 
o/
 
<?php
interface Mine {
	public function method(int $thing) : int;
}

$cb = function(int $thing) : int implements Mine {
	return 10;
};

var_dump($cb);

function test(Mine $thing) {
	var_dump($thing);
}

test($cb);

$cb->method(10);
?>
evening ...
 
I'm le'tired
 
Wes
evenings
 
@JoeWatkins eek?
 
5:24 PM
@NikiC orly, I love it :(
why eek, what's terrible ?
 
Wes
@JoeWatkins i don't get what it does
 
the closure implements the interface ...
 
Wes
ah, and why not __invoke ?
 
seems the wrong way around to me ...
 
Wes
the problem with that is that Mine could have other methods, this is why @marcio discarded that idea
in other words, what if Mine has another public function whatever() ?
 
5:27 PM
@JoeWatkins
$cb = new class() implements Mine {
    __invoke(int $thing): int {
        return 10;
    }
};
 
you can't implement more than one method
but that has to be true whatever
 
Wes
indeed so how do you solve it? an error? "closure can't implement Mine because it has more than one method" or something?
 
regardless of if the class is concrete or anonymous, it can only implement one invoke for one interface
how is that any better ?
 
ok .. I give up
can someone give me a good usecase for anonymous classes?
 
Ekn
working class hero is something to be
 
5:29 PM
@tereško I've used it to implement one-off event handlers.
 
@tereško they're handy for stubs in unit tests
 
@tereško throw away objects, where the implementation is never public, and really only used in one file ...
@Wes yeah, just throw if there is more than one method in the interface ...
 
@PaulCrovella, you get a cookie
rest of you .. well .. no cookies
 
Wes
@joe

interface MyCallable {
	public function __invoke(int $thing);
	public function whatever();
}

$cb = function(int $thing) implements MyCallable {
	return 10;
};

$cb->whatever(); // what happens here?
 
error
 
5:31 PM
I was considering writing a new testing library based around anonymous classes instead of doing all the hacky things the current testing libs have to do.
 
Wes
@Trowski please do
 
@tereško I use them to extend abstract value classes that are not supposed to be user instantiatable
since we have no package visibility
 
Wes
anyway guys you prefer i submit bugs to bugs.php.net as well even if i've posted them at internals people's attention in here?
 
@Leigh yeah, I asked for "good usecases"
 
oh I'll look at that inheritance thing, you should always put them on bugs too though
 
Wes
5:35 PM
okay, but seriously no hurry :P
 
@Wes yes
 
Wes
okay, doing it
@Leigh example?
 
5:51 PM
abstract class Stuff { .. bunch of stuff .. } and $stuff = new class extends Stuff then $stuff->moreStuff...
 
Wes
why would you do that? a more concrete example?
 
Why? Because I felt like it :)
 
Wes
sounds like worrying too much about visibility :P
 
oh actually, I used one the other day to implement a monolog handler and couldn't be bothered to make a new file and stuff for a concrete definition
 
What does it take to connect PHP 5.6 to SQL Server on Linux?
 
5:56 PM
@DavidDale Badly designed infrastructure ... ba dum tshh
 
Haha... but I still need to do it.
 
@DavidDale I think there's something like 3 different drivers, all of them not working well ...
 
When I had to do it I think I just used a linux ODBC driver
 
like mssql, sqlsrv, dblib and odbc
I think odbc is the most stable one
 
morng
 
5:59 PM
@PeeHaa mng
 
Wes
mhnhgfnjgfng
 
Okay. I need some pointers on how to get an ODBC driver installed- from what I could tell from the research I had done, ODBC sounded like the right one. One thing of note is that this would need to work with Laravel.
 
!!rebecca
 
6:09 PM
!!rebecca
 
oh it works :-)
 
that'll be enough @Jeeves, thanks
 
Ekn
bah it's been raining non-stop for like 15hours
 
you mean literally raining water or metaphorically raining rebecca vids? :p
 
Ekn
6:15 PM
nothing metaphorical, all day fukkin rained
s/rained/ruined
 
same, totally sucks ...
 
Is there any way to work with MongoDB using framework CodeIgniter?
 
Night, guys!
 
6:34 PM
@manetsus yes - you use PHP
anyway, silly shit aside
I have DB seam for my unit test and was writing a test for a mapper .. but there is an aspect to it, which I'm conflicted about
the interface is just $mapper->fetch($entity), and that's the method the test would be focused on, but should verify WHAT gets done to the entity there?
.. and, if I would try to verify the interaction with the entity (which is a mock), should I test for "what gets done to it in the fetch()" or "what changed after fetch()"
so .. ideas, suggestions, snide comments?
 
does anyone know if passing a nonce to a third party to use when calculating a merkle root, which they then sign with their Ed25519 key, is an adequate challenge-response authentication?
the idea is that you would calculate the merkle root of the same data structure with your shared key then verify that both hashes match after their signature is verified
I couldn't find any published attacks on such a scheme yet
(the merkle tree differentiates between leaf and branch nodes, so one class of attacks is mitigated)
 
well ... there are no known attacks on Ed25519
can you find an attack, which involves a 512 bit RSA keys?
 
@ScottArciszewski I'm probably missing something, but if you only need one nonce per key-exchange, you could use the shared key as the nonce?
 
6:50 PM
I mean, I could do that easily: {"nonce": respondHere, "hash": hashGoesHere}signatureHere
 
s/512/128
 
@tereško Why would you ever want to use a 128 bit RSA key...
 
using nonce as a BLAKE2b key requires the notary to recalculate the merkle root for each query, which could be annoying
@Leigh I think it was a "ignore the Ed25519 part" example :)
 
factorisation of a 128 bit prime is well within the bounds of capable..
 
yes, my point was that "no known attacks" result depends on there not being a way to attack Ed25519
 
6:52 PM
I'm not concerned about the Ed25519 part ;)
but I'm reasonably confident that this will be fine
I'll just do what Leigh suggested then :)
 
Nothing wrong with regular re-keying either
 
so ... that unit testing thing .. ideas?
 
like, per query
 
A lot of people still don't seem to get that union types is not empowering multiple types to exist - it's simply adding formal support for it. It's always been there. It's always been used. Our own standard library uses it extensively. The key is that instead of documentation you get actual signatures.
 
sure, but it encourages multiple types
 
6:58 PM
I actually needed something uhh 2 days ago, where I wanted to typehint a base class and an interface in unison
 
I for one welcome our union/intersect overlords
but only if we can alias them too
sort of like a typedef I guess
that way I can say array | ArrayAccess | Traversable in a bunch of places but give it a common type hint (even if only on a per-file basis)
 
@LeviMorrison It may be understood to lend legitimacy to those usages
 
7:28 PM
Hi, does anybody here uses amphp/aerys in production (except @Jeeves)?
My question is about vhosts in aerys: how to use them and whether it is possible to add/remove vhost dynamically and is it by-design. From sources it looks like it is technically possible, but the question is more about is it by-design so?
 
/cc @bwoebi
 
Thanks, I see that there are dev.kelunik.com with a-la SO chat there with some activity in rooms/1 there, aren't that by change a new place where amphp core stay nowadays?
 
@Andrea Only in the sense that you can now sanely rely on it outside of documentation.
 
7:46 PM
!!xkcd supported_features
 
I hear many of you finally have smooth Flash support, but me and my Intel card are still waiting on a kernel patch somewhere in the pipeline before we can watch Jon Stewart smoothly.
3
 
I just discovered this one ^_^
 
8:01 PM
:p
 
8:20 PM
Hahaha, epic.
 
Wes
iirc chrome (not chromium) had decent flash video support tho :B
chromium doesn't even have flash... right?
 
@Wes Not sure, but could be.
I'm not too big of a Flash fan anyway.
It was fun in the 90s, but it's rarely useful anymore.
(IMHO)
 
Is this sentence correct? I believe SO should append a new option into flag window: "OP is unseen and he don't answer the comments"
 
Wes
yeah i kept it disabled in the past 6 months or something. web worked fine anyway
 
@Shafizadeh Doesn't sound right. You mean to OP abandoned the question? (aka went AWOL?)
 
8:24 PM
yes
 
Then I'd rather state it like "OP has abandoned the question and is not answering comments".
 
You are right
 
Wes
undecided if i should go to sleep and wake up at 4 am for the formula 1 practice, or i should stay awake 6 more hours
 
Well, I don't know about that ;-) I'm no native English speaker myself, but I think it's grammtically more correct.
 
@Oldskool thx
 
8:26 PM
@Wes LOL ... F1 is fun, so if you can sleep now, I'd go for it :D
Then you'll at least be watching it while awake instead of half-asleep :p
 
Wes
unless i have like 30 beers, i won't sleep soon
that's the problem
 
LOL
Go buy some beers then ;-)
 
Wes
buy? i can't run out of beers, i have something like 200 liters of beer in the storage
:B
#totallynotanalcoholic
still a novice though, but i'm learning from the best (ahem @PeeHaa cough cough)
12 hours ago, by Gordon
@FlorianMargaine he spends all his money on beer afaik
yesterday, by Florian Margaine
@PeeHaa beer at 11am?
yesterday, by Florian Margaine
@PeeHaa beer at 5pm?!
yesterday, by PeeHaa
#time for beer
notice the timestamps
 
Excuse me, but I think you'll find that I am the one who has been to rehab, and therefore I am the best at being an alcoholic, albeit retired
 
:P
 
8:32 PM
You softcore little kids don't even have drug problems. pfft.
 
Wes
haha
 
Ekn
:p
 
Wes
> Support group for those afflicted with PHP.
i see a connection here
 
@DaveRandom unless you've done heroin, I'll that that as null. pfft.
 
8:37 PM
No I never liked opiates, I went in for things that adjust your thinking rather than flat out prevent it
 
#lucyintheskywithdiamonds
 
Ekn
/me tends to stay away from psychoactives. actually I don't even take painkillers for about ~3 years now
but I do smoke and then spend all the time doing some learning or whatever until I'm bored to sleep :p
(I learn theoretical things much faster like that...tbh)
 
true that, and not only theoritical. Complex violin technique become a lot less difficult to learn, when in the right state of mind
 
Ekn
8:52 PM
right, that's kinda how got used to strings
playing piano or midi is what I'm used to... keys :p
 

« first day (2008 days earlier)      last day (2940 days later) »