« first day (1746 days earlier)      last day (3196 days later) » 

1:00 PM
Iirc beberlei has a partial implementation
 
user895378
If you're going to do it for functions and classes it would seem sensible to allow it for constants as well
 
The main problem being that as of now we do not store the current namespace at runtime
 
@rdlowrey \xE2\x80\x8B is your friend...
So long as you don't mind code sniffers going crazy...
 
scope visibility definition { }
...
file private function foo() { }
namespace private function foo() { }
 
Oi Dan, coming to PHPNW?
 
1:09 PM
how to save the datatable state in php
 
@Fabor Nay :-(
 
Unacceptable.
 
Unacceptable.
 
Unacceptable.
 
Unacceptable.
 
1:14 PM
Unacceptable.
 
SQUIRREL.
 
C-C-C-COMBO BREAKER
 
Unacceptable.
 
Unacceptable flags are Unacceptable
 
Unacceptable.
 
1:17 PM
 
Ffs, are we ever going to have the great combo of 2015 that I can bookmark?
 
@Jimbo You doing tutorial day?
 
@Fabor Nah, I don't need that stuff ;-)
 

Room 11 threw an HTTP 406

8 mins ago, 7 minutes total – 11 messages, 9 users, 0 stars

Bookmarked just now by Dan Lugg

 
@Fabor Joking aside, are you?
 
1:26 PM
Negative. Trying to figure out what time to come up.
 
Recommend aiming for Fri mid-afternoon. Last year @PeeHaa and I had a drinking session for most of the afternoon, joined by @Danack and @JoeWatkins
 
Yeah, thinking about 4pm works with flights
 
@Fabor I'm thinking about your mother
 
We'll probably try and reign it in a bit more this year though, was pretty brutally hung over on the Sat last year
@PeeHaa That goes without saying
@Fabor leaving or arriving?
 
How mellow the evening goes is often dictated after the first 3-5 pints.
 
1:32 PM
heh
 
@DaveRandom Arriving
 
I was thinking I might do the hackathon and try and actually do some programming this year
Or at least touch a computer
 
Won't that interrupt the drinking?
 
doesn't have to
 
Doesn't need to, nothing in rules about relocating the hackathon to the bar
 
1:33 PM
£95 return flights. Not bad. Arrives at 4 and leaves at 4
Those times seem okay? Arrive Friday, leave Monday.
Or does anyone know what time we finish on Sunday?
 
About 2-ish usually
 
@DaveRandom weakling
 
So could fly back then. Saves hotel costs
 
@PeeHaa Yeh well I was planning that last year as well so...
@Fabor Yeh I think most people do
There are trams to the airport now as well
 
Would a 5pm flight be okay on the Sunday then?
 
1:36 PM
Although it takes like an hour or something from town
 
It's either 5 or 8:30
 
@Fabor I'd go with 8:30 if I were you, allows for unexpected delays and/or extra drinking time
 
Okay, arrive Friday at 4. Leave Sunday at 8
 
Check the trains out though, Piccadilly station is only about 10 mins walk from conf venue
If you're booking this far in advance can prob get some good deals
Pretty sure that's two years in a row that pic has been used now
 
who's that evil guy on the background, left ?
 
1:42 PM
@DaveRandom That is true
 
Trains are still like £100+ direct
Flights are only an hour and £140 return
inc baggage
 
inc beer
 
@Fabor Yeh, fuck that "Earth" guy, no-one likes him anyway :-P
 
I noticed when I was booking flights across UK that trains are unreasonably expensive
 
lol. I do my part. Plane is flying whether I am on it or not :P. BTW any non-rip off accommodation suggestions?
 
1:47 PM
Like, they are quite often even more expensive than flights
 
morning
 
morning pill
 
Flights booked then.
 
@Fabor Well you can crash at mine for free if you want, but that does mean a ~45min public transport journey to get from conf to house. If not I suggest trying the conf venue first (is also a hotel, v. convenient when pissed) and then the Britannia - I know someone who works there and may be able to get staff discount rates, just asking him now. Last year there was a utd match on that meant he couldn't get much discount though.
 
I'll do the same as you, try for a hotel until last minute :P If I am lucky maybe my company will cover it.
 
1:51 PM
btw @Fabor did you ask Joe if he's planning to come? He drove up last year...
 
Hmm, sounds risky.
@JoeWatkins Ping. Coming to NW?
 
@Fabor Well he got here. And back home again.
 
What's the chance of lightning striking the same place twice though? :P
 
^ higher than your may think (:
 
@Fabor Very high if you are tall
 
1:53 PM
That "e" is just sitting there taunting me
 
even triple is possible if the potential delta was high
 
What e? -_-
 
I might run for community mod next year, just so I can fix typos in other people's messages
 
Seriously though, it something else special happening that date in Oct? Hotels are trying to get me to take out a mortgage to pay for a few nights accommodation.
 
Yeah it's the bloody nobbing sports nobs
 
1:56 PM
It's the time for footballists
City and utd usually try and avoid home games scheduled on the same day but they were both playing last year
 
hi, a simple question. can you initialize variables outside the constructor_
 
lol "Ramsbottom".
 
@LucasP yes
At declaration time
 
btw, when I will be able to do
 
to be more specific, i have an abstract class with 10 variables, each child will be called with only few of those 10. but i want all classes to have the 10 variables initialized on something, without having to initialize them at every constructor
 
1:59 PM
int $x = 0;
string $y = '';
 
44 secs ago, by PeeHaa
At declaration time
 
?
 
And overwrite them
 
The shit part about football times means there's going to be loads of football louts around the hotels too. :(. Can we just reschedule the conference?
 
@Fabor no we can't. They must reschedule football
 
2:01 PM
hmm it only works if i set them to public..weird
 
@LucasP Pastie / gist please
 
@Fabor You could take some time out to go visit Penistone as well if you like, it's not far away
 
abstract class ALFA {
fuck didnt mean to send
 
Maybe on another real visit to Manchester
 
abstract class A {
public $a = '';
private $b = ''; //remains constant

method B() {


}
 
2:04 PM
you declared it private => not visible in childs
discover protected
 
oh thats what i am missing
thank you
 
next
 
lol
 
posted on July 28, 2015 by kbironneau

/* by patoch */

 
Travel lodge is £127. Maybe that's reasonable for two-nights?
 
2:07 PM
Yeh it's not terrible, but it's Travelodge so it will be terrible
Which one?
(as in, where is the Travelodge, there are quite a few around Manc)
 
@Fabor Lets be honest what do you actually need?
 
Blackjack and hookers
 
Bed and shower.
 
You could just spend the night in the casino instead
 
And not to be surrounded by idiot football fans
 
2:09 PM
Blackjack in bed, hookers in shower.
 
not bad
 
@Fabor afaik there are not yet any conferences that are held on another planet, so you might have to forgo that requirement
 
heh
 
@DaveRandom Even then, Martians United are pretty brawly.
I think they're pissed about the thin air.
 
Right, it's the Tory party conference that weekend, that's why the prices are so high
 
2:11 PM
Those wankers
Ugh, can't deal with those costs right now. Ostrich mode engaged.
 
Ahoy hoy
 
Ahey hey
 
BTW @LucasP are you sure you need that base class to begin with?
 
injection > inheritance
//flame here
 
@PeeHaa he's probably doing that "real OOP" that I have heard so much about on reddit
 
2:14 PM
City are at home to Newcastle as well on the Sat so it's going to be pretty brutal. @Fabor I just asked my mate who works for Britannia and his best rate with staff discount is >£200
 
:P
ROOP ?
 
We really need callable(type, ...) param types :-(
 
/cc @all who are needing a hotel in Manch that weekend
 
£200 to sleep in Manchester?!
 
I am gonna drag my not-traveling-anywhere ass back to reading that ES6 book
 
2:17 PM
@salathe with whom?
 
How much are the tickets for NW? I can't see it now because they sell them with promo codes only right now
 
Man, it's insane.
 
Oh and apparently OneDireAction are playing in the Manc that weekend as well
 
Shouldn't that lower the prices?
 
@DanLugg then write the RFC
 
2:18 PM
lol
> Country House in Didsbury is only £131.50
or the Airport in Northenden £117.50
 
@DanLugg yeah, write an RFC, I have implementation already
 
Per night?
 
Mental
 
I think 2 nights
The latter is not too far from tram
Not sure where the Didsbury one actually is
@Jimbo if you say "Didsbury" I will hurt you
 
@DaveRandom Didsbury
now everyone but @Jimbo do the same
 
2:22 PM
@DaveRandom Didsbury
 
16 secs ago, by salathe
@DaveRandom Didsbury
 
1 min ago, by Fabor
16 secs ago, by salathe
@DaveRandom Didsbury
 
I'm submitting for call for papers, if they accept I think I get a hotel room phew
"Dependency Injection - The Danack right way"
 
@nikita2206 How do you handle parameter variance? Given C implements I, and I callable(I) is function (C $c) { } a valid arg?
 
@DanLugg yes
Wait no
It's the other way around
 
2:27 PM
Surely not?
 
If you have type hint on argument callable(C), then you can pass there function (I $i) {}
 
You can't hint for a concrete type and then accept an interface?
That makes no sense...
 
@Jimbo Great, then you can give me your hotel room :P
 
@DaveRandom that breaks LSP
 
No, he's right, that makes sense.
Contravariance.
 
2:28 PM
@Fabor Just need some support before hand, as in.. a few beers (but not much this time)
 
I'm sure it could be arranged.
 
Oh yeh I get it
Ugh, v. confusing
 
@DaveRandom you know what's confusing? callable(callable(something)) kind of variance
That breaks your brain
 
I think you were right with "head", I just mashed mine against the keyboard.
 
@nikita2206 @Ocramius will find something better
 
2:30 PM
@DaveRandom I'm not sure proxy pattern can help in this situation but we'll see
 
callable(callable(T)) : callable(U)
@nikita2206 lol
get_class($ocramius) // Ocramius__proxy_c4ca4238a0b923820dcc509a6f75849b
 
@ziGi Have or know of a PHP implementation of your event dispatcher? Or want to make one?
 
What we need now is generics... $f = new Foo<callable(callable(T) : callable(V)) : callable(U)>(function (callable(T) $t) : callable(V) { return function(V $v) { return $v->bar; }; });
Fuck you readability
 
@DaveRandom \o/
 
We actually need generics though
 
2:35 PM
Variadic generics.
 
...
 
@DaveRandom Sir, that is bullshit
 
Closure<T...>
 
@AlmaDo It may be, I didn't sanity check it very hard
 
@DaveRandom For a moment there I thought I was in the Java room.
 
2:35 PM
By the sake of all the gods, we don't need this callable(X)
 
@AlmaDo Yes. We do. Or variadic generics.
 
think before you do something and don't hope PHP will discover yout shit for you
):
 
@AlmaDo How do you check whether a function satisfies a signature? Or do you not bother?
 
@DanLugg not in that level
 
@DaveRandom btw. that really is bullshit.
 
2:37 PM
it's not a semantic level any longer. it's business-logic level
 
@bwoebi yeah he forgot about callable(U)
 
so yes, I check. But no, not with language hacks
 
@AlmaDo I don't think that falls at the business logic level :-/
 
I may only guess how slow it will be to traverse some recursive stuff there
 
@AlmaDo callable() is simply an anonymous single-method interface. How does that have anything to do with business logic?
 
2:39 PM
-9
Q: What is the best way to get military time from a date?

Jay BowmanI'm using javascript and I need to get military time from a date object.

'SIR, ' + (new Date()) + ', SIR!'Cerbrus 4 mins ago
:D
 
@AlmaDo why not
 
@nikita2206 I mean… it's bullshit to explicitly add the type to new Foo
 
@NikiC callable? Yes it doesn't. callable(X, Y, Z) - does
 
@bwoebi you mean you'd rather see PHP infer this type?
 
Read more than the first word of what I said...
 
2:40 PM
Should be rather $f = new Foo(function (callable(T) $t) : callable(V) { return function($v) { return $v->bar; }; }); with type inferral.
@nikita2206 yeah.
 
that'd be nice yeah
Not sure about overhead though
I guess it could be done even in compile time sometimes
 
Type inference in PHP?
 
Generic variables inference
 
It theorectially could be always done at CT. The problem is just that this might need strong analysis…
 
@bwoebi I don't think so, not in PHP
 
2:43 PM
@nikita2206 oh, why not?
 
@bwoebi something like function ($a) { new ClassWithGenericVars($a); } is already impossible
And I didn't even try globals yet
 
@nikita2206 sure. then you need to trace where they're called.
 
Could someone explain this: SQL Error near: ''username' = 'Bjorn' WHERE id = '1'' on an Update query getting this as PDOException. But it just makes no sense to me. Can't see anything wrong
 
@icecub you have an error in your SQL query
 
@bwoebi ...and if they're called with $a being of different type in different places you have to give it up
 
2:45 PM
@icecub ` != '
 
@NikiC if that's for me, I didn't get it.
 
@nikita2206 no, why?
 
@icecub So your query
Are you JOINing shit?
 
11 mins ago, by DaveRandom
@AlmaDo It may be, I didn't sanity check it very hard
 
SETting shit?
 
2:47 PM
eh..
 
@PeeHaa no it's a very simple query like UPDATE users SET username = :user WHERE id = :id
 
`username` = 'Bjorn'
 
Is username a reserved word in stupidsql?
 
@DanLugg can you please give me an example when there is no way but use typehinted callables?
 
2:47 PM
@PeeHaa could be
 
@bwoebi because at different calls to this function generic variables will have different values - that means you can't just 'compile them in'?
 
@nikita2206 It makes it harder, yes. but it doesn't prevent compile time type analysis.
 
No it isn't. Name isn't even reserved if I remember correctly
 
@RonaldUlyssesSwanson Docs say no
 
@AlmaDo Well, you can always use callables with unhinted params, but it's a matter of safety.
 
2:48 PM
@PeeHaa Stupidsql == MySql if so no but user is
 
@nikita2206 yeah, actually, I don't think that should be built in.
 
@PeeHaa solution is simple, always escape names using backticks
 
Yeah stupidsql is mysql ;)
 
@DanLugg no, I mean, semantic-level case when it's justified (i.e. those params and related stuff are not derived from your logic)
 
@RonaldUlyssesSwanson I hate you
 
2:49 PM
I was unable to invent one, but may be I'm missing something
 
@nikita2206 IMHO the way to go is an external typechecker which can do that and in PHP itself we use only primitive non-generic types
 
@PeeHaa you don't like `names` ? :D
 
ha MD fail!
 
@bwoebi You mean ... Hack? :D
 
2:50 PM
class A { }
class B { }

function foo(callable $c) {
    $c(new A()); // boom
}

foo(function(B $b) {

});
It blows up in the wrong place IMO
 
But no I hate it when people escape things when it is not needed
 
If one could callable(A) then it'd blow up at invocation of foo not the callback.
 
@PeeHaa my mate Murphy says that USERNAME will eventually become a reserved word and fuck up all your queries (and so will every other word known by human)
 
Well you could try to escape the field @icecub, but that is stabbing in the dark at best
 
@RonaldUlyssesSwanson I'm on postgres so I am Murphy proof
famous last words
 
@DanLugg in that case it might be replaced with a class that has specific method
well, might be not always
 
@AlmaDo Which is precisely why we need param hints for callable
 
@DanLugg eh.. ? I mean - you define the contract with the class / better interface
 
2:56 PM
/me Wonders how much of the PHP runtime in the future will be used for type checking
 
jit will save the case.. or?
 
@PeeHaa No I've already found the issue. I was doing this: UPDATE users SET :column = :data WHERE id = :id. Because of the Prepared Statement, it was wrapping quotes around :column and it didn't like that.
 
@icecub PEBKAC :-)
@icecub Prepered statements don't add quotes btw
 
@PeeHaa they do if data is a string. are you drinking at your workplace again? :D
 
Peppered statements
 
3:00 PM
I know but for some reason it does. When using the var directly just to test it, it works perfectly fine. When preparing it, it complains about the quotes around it. Probebly indeed because of string
 
@RonaldUlyssesSwanson ?
I think I am misunderstanding something here
 
Anyway. Work day is over so I'm gonna call it a day. Thanks guys :)
 
And yes I am drinking atm
np @icecub
 
if you specify param "lol" to be a string FROM :lol WHERE apostrophes are added automatically: FROM 'sometable' WHERE
which is wrong since table/field names must be escaped with the backtick, not the apos
 
I still don't get it :(
@RonaldUlyssesSwanson $stmt = $con->prepare('UPDATE users SET column = :data WHERE id = :id'); $stmt->execute(['string', 1]);
Where are quotes added ^ here ?
 
3:03 PM
i don't remember pdo :P @PeeHaa he was parametrizing the table name (UPDATE :users SET)
 
That is not even possible ;)
 
exactly :P and that is it
 
Ooooooh lol
Dayum I am slow
Sorry :P
 
it's my english :P
 
;-)
 
3:10 PM
hi
i am new to php
 
@PeeHaa whitelist the valid tables and you are pretty safe in just interpolating the the table name into the prepare statement itself (or you could use $pdo->quoteIdentifier) but I think whitelisting valid values would be the way to go
 
how can i show a message on screen????
 
@HassanAlthaf echo
 
@Orangepill You are missing context (again) :P
;-)
 
@Orangepill I am trolling.
 
3:12 PM
@HassanAlthaf You just did
 
@HassanAlthaf How do I round a number down with jQuery?
 
I dn't use jQuery. :D
 
@PeeHaa guess I'm the slow one :)
 
I use PHP.
 
3:12 PM
3
Q: jQuery round function

SergioHow can I round the number using jQuery? If the number is 3168 I want to print it as 32. Or if the number is 5233 the result should be 52. How can I do that? Should I use the Math.round function?

 
$number = 9.5;
$numberArray = explode('.', $number);
 
@Orangepill slowbrofist
 
$number = $numberArray[0];
 
@MadaraUchiha border-bottom-left-radius and border-bottom-right-radius?
 
ya know
whats the best language on earth?
 
3:14 PM
U h'wat...
 
01001010101001110101010010101010010101001010101010100101010101010101010101010101‌​001010101010110001010101010101010010100010010101010101001010101010100101010
cuz taats the only computer language that exists in reality :D
 
@NikiC I mean like no explicit generics at all… in php code
 
@bwoebi I think you wanted generics?
 
@kelunik yeah, but ideally that's all implicit
 
@bwoebi It doesn't work implicitly, at least I can't imagine how...
 
3:20 PM
success is tat
*that
 
@bwoebi You mean no explicit generics at all or only in signatures?
 
Are they seriously proposing changing the JsonSerializable Interface or am I misreading this
 
@NikiC Ideally the former, but I think the latter will be what's doable.
 
@bwoebi From past experience, I think by now we know that no explicit generics at all is a bad idea
 
NikiC
You studying in Berlin yh?
 
3:23 PM
types are run-time assertions in PHP. And the task of the typechecker should be to re-establish all the times from beginning on and verify all the types of all potential callables etc. which ever are passed in and called. So that the typecheker internally establishes the types and checks matches its internal set of possibilities against what's accepted in code.
 
@Orangepill don't worry, they would never pass
 
So, typechecker internally should establish and use generics to have the minimal possible set.
 
@bwoebi How about things like Promise<X>?
 
@kelunik that's why I think we need some generics.
 
13 mins ago, by bwoebi
@NikiC I mean like no explicit generics at all… in php code
So how can those statements match?
 
3:31 PM
@ircmaxell didn't think it would but dumber things have happened
 
how change the login shape when user is logged ? I have two shape: log in (when user is not log in), sign out (when user is logged). now How do I know which one to show?
According to session ?
 
I would assume Generics would act more like a compile-time copy and paste of a type and not add further type checking burden to the runtime.
 
I will -1 if we do type deletion on generics
 
@ircmaxell Same, generics should not allow a type to be ignored.
 
15 mins ago, by bwoebi
@NikiC Ideally the former, but I think the latter will be what's doable.
 
3:40 PM
@bwoebi Yeah, but how should it work implicitly? If you collect a minimal set of valid values, that doesn't mean it's the correct type.
 
?
 
How should generics work if not declared (explicitly)?
 
a typechecker checks if the types still match when the generics are "unpacked"
 
Morning, room 11.
 
mornin @Levi
 
3:45 PM
Ok, have constant operations and constant assignment optimizations implemented
what else should I implement?
ah, an important one: constant conditional jumps
 
@Orangepill Maybe a JsonUnserializable would pass, but I quite sure the changes to JsonSerializable wouldn't. By adding something new it breaks all code that implements the interface.
 
I know... violates the open/close principle
 
@LeviMorrison Plus that proposal offers nothing over ClassName::fromJson($json).
 
Hi, Please help how to convert a string to associative array For ex:- $str = Status=0,JOB_ins37_14380743615938,ins37_14380743615939,ins37_14380743615940
Expecting
 
@LeviMorrison I don't think JsonUnserializable makes sense.
 
3:50 PM
[Status] => =0
[key1] => JOB_ins37_14380743615938
[key2] => ins37_14380743615939
[key3] => ins37_14380743615940
 
@kelunik I didn't say it did :)
 
@Trowski Agree with that... JsonUnserializable wouldn't really be overly helpful ...
 
mexican wave! whoever wants generics in php!
user image
4
 
@Orangepill JsonUnserializable would have to make too many assumptions to be flexible or really useful. User land is a better place to implement such functionality.
 
@Trowski yeah... not enough type information in json for you to build any thing useful around a generic unserialize
 
3:56 PM
anyone ready to help ???????????
 
@Prakash ready as in helmet, fireproof suit and flamethrower ????????
 
@Trowski, i also tried explode
$strr = "Status=0,JOB_ins37_14380743615938,ins37_14380743615939,ins37_14380743615940";
$strr_array = explode(",", $strr);
print_r($strr_array);
 

« first day (1746 days earlier)      last day (3196 days later) »