« first day (2383 days earlier)      last day (2570 days later) » 

12:01 PM
@JoeWatkins about 30-40 years after that
 
I'm dreading it
 
@JoeWatkins doesn't that get you back near your home again?
 
also, looks rainy and I dunno how to get boy from school
@Danack yeah, it wasn't that far actually ... and you can only get so lost on iow ...
just don't enjoy looking like a basket case, we don't allow people who don't know where they live to walk the streets ...
 
@JoeWatkins inb4 you don't pay proper attention to signage an end up in Iowa
 
Anonymous
12:20 PM
 
lgtm
Does it work?
 
Anonymous
sure
 
PR it \o/
oh already pred
even better
 
Anonymous
am I a release manager yet?
 
morning
 
12:24 PM
@JayIsTooCommon You are too good by now for that shit. I see a future as a BDFL for you
@tereško yo
 
Anonymous
agreed
 
@PeeHaa I think more MDFL
 
Anonymous
!!urban mdfl
 
whatchoo talkin bout willis
 
I can think of at least 1000 things that M would stand for
 
12:27 PM
malevolent
 
Anonymous
massively-handsome
 
Anonymous
or malevolent, sure
 
@PeeHaa Madara!
Madara Dictator for Life!
Sounds good.
 
Anonymous
that's just offensive
 
Massive Dickhead For Lunch
 
12:33 PM
Ara is a neotropical genus of macaws
Mad Ara is a neotropical genus of macaws that lost it's mind
kroaw kroaw
 
It's a coworker's 60th birthday today, she likes to gamble, so we decorated the department with casino-themed decorations. Boss covered her desk with "over the hill" and "$" confetti.
 
If she likes to gamble present her with two boxes: 1 contains a beartrap and the other money and let her put her hand into one
 
her desk is covered in confetti
like all over papers, keyboard, desk, chair, floor
 
how annoying. now she's got to clean it up
 
payback for what she did to the boss's desk
for his birthday one year
 
12:41 PM
Took a dump on it?
> Lowering The Tone as a Service
 
covered his desk with confetti
 
Your boss is unimaginative 2/10
 
and she still has to coordinate the party stuff
 
Anonymous
I'm seeing gervais tonight.. I wonder if he's fatter in person
 
...than you? Probably
 
Anonymous
12:48 PM
such a noob
 
I have a form that is submitted via ajax and the errors are outputted via json and read in the previous page. The page is register.php. If it is not a post request, register.php will be the form, but if it is, the json encoded errors are echoed in a blank page, how do I make sure that someone doesn't post from another page of their own to register.php and see the naked json?
 
You should imo first set up non JS requests and once that works add ajax magic for user convenience
I realize the reactvueangularemberquery people don't agree, but meh
 
@PeeHaa Progressive enhancement, not graceful degredation \o/
 
Oh looksy. A wild @Fabor
@Sean Aren't you too young for that? :P
You kids live by the JS and die by the JS I always thought
:-)
 
That's just my charming British looks, I'm actually 75
 
12:53 PM
hehehe
 
@PeeHaa For non js requests, it goes to the mobile site, much like how facebook sends the non js requests to its mobile registration site. But what if someone does <form action="mysite.com/register.php" method="POST">?
 
put the stuff you don't want people to see in the serverside code
at least that's my belief
 
It would expose the json
 
@CoderDudeTwodee That should have been handled from the start
That should be the very first thing you make
 
@Tiffany I will need to output the json to be read by javascript, right?
 
12:54 PM
After that add the ajax magicsauce
 
@PeeHaa I should make mobile.mysite.com/register.php first?
 
No mobile is not related
Just handle the form submit
without any JS
 
@CoderDudeTwodee So you can either add a separate endpoint for AJAX requests, or you can detect AJAX in PHP by using HTTP_X_REQUESTED_WITH (proceed at your own risk in terms of support for it)
But as said by others, your base form should support being submitted without AJAX, which will return the webpage, not JSON. Then you can build on top of that by adding AJAX support using a method above
 
@Sean Does that mean the ajax submission page should be different?
 
Write your form using pure PHP first.
(and HTML obviously)
 
12:59 PM
@Tiffany Like <form action="register.php"> and the ajax goes to something like ajaxregister.php?
 
I have very limited experience with AJAX
When I wrote a form, I used pure PHP, and the errors were handled with PHP as well
like user submitted form, if something wasn't correct, it would put them back to the form and say "fix these"
 
@CoderDudeTwodee You could let them both go to the same endpoint and capture the HTTP_X_REQUESTED_WITH header like @Sean said
 
not with that verbiage though
 
@PeeHaa Yeah but what happens if someone posts to the page that echos out json?
 
It's the same page
If the "xhr header" is missing it probably expects back html and json otherwise
 
1:03 PM
@PeeHaa But that's not very reliable right?
Or is it and I read wrong?
 
You control the JS so it's a reliable as your client side code :)
I know at least jqueeery adds it automagically
 
Segfault occurs when releasing memory – #74497
 
So the user submits the form, if it's through ajax, it checks if the `HTTP_X_REQUESTED_WITH` is what I want or not, if it is, then the page echos out naked json and it gets processed by javascript otherwise, the the js-less page works.

Did I get it right?
 
yes exactly
 
1:07 PM
Thank you!
 
No problem
 
I found this on the very first google search of "HTTP_X_REQUESTED_WITH":

http://stackoverflow.com/a/5109084/6109408
 
Wes
@PeeHaa what's the new project you started?
 
@Wes Not sure if I should fuck it up by telling it
A series of blog posts / tutorials about how to create a project with amp libraries
 
@PeeHaa what? you getting picky now about how you fuck up?
 
1:15 PM
:P
And in the first post I need to visualize how blocking vs non blocking works
So I am working on writing an async visualizer using async JS code to explain async php code
 
Who here works at Atlassian?
 
Not sure they will say it now :P
 
Wes
@PeeHaa i do indeed bring bad luck to anything is in my bad luck bringing evil radar
:B
 
@BenjaminGruenbaum you are looking to addresses to send the hate-mail to?
 
It shows the flow of async execution by jumping through code / output and maybe add a visualization of the event loop
But that thing has started to become a project in itself :(
 
1:18 PM
@tereško not hate mail, asking who works there
 
> Dear PDAPI_PRMO_PRO2_TSUSB User,
wat
 
@BenjaminGruenbaum Don't think we have people in here at atlassian
I assumed they were a java shop too
And we don't take too kindly to java people
@CoderDudeTwodee That doesn't matter
If they spoof the header they will get what they asked for. Raw JS response
You are trying to prevent innocent people from looking at an incorrectly rendered page.
 
@PeeHaa Oh well, they will be be not the regular guys and will be hacky people. They can survive ugly pages.
 
It's not security related
@CoderDudeTwodee Exactly
 
Got it.
 
1:43 PM
What do you think of the following pattern?
$object = new Object();
$object->setA(1);
$object->setB(2);
$validatedObject = $object->validate; //returns a ValidatedObject, which is immutable and has all useful member methods.
$validatedObject->doA();
$validatedObject->doB();
 
Shouldn't that be ctor dependencies instead?
 
use a Builder pattern instead
 
Wes
> US oldest tree felled after 600 years standing in New Jersey churchyard
 
And object a factory
/ builder because gordo said so
 
Wes
i'm pretty sure there are several thousands years old trees in the us..
"oldest"
 
1:46 PM
@Gordon What would be the difference?
 
Something called validate should not return something
 
Wes
that is a builder
 
Other than maybe a boolean
 
@TomasZubiri separation of creation from the actual object
 
Wes
@PeeHaa that's the factory
 
1:47 PM
@Wes And it should be called build
not validate
 
Wes
yeah
 
or create()
 
Wes
builders are overrated though
 
Yeah, changing names would be more clear then.
$objectBuilder = new ObjectBuilder();
$objectBuilder->setA(1);
$objectBuilder->setB(2);
$object = $objectBuilder->build();
$object->doA();
$object->doB();
 
Sickening scenes on the telly of 50,000 English people chasing 10 Kenyan men through the streets of London.… https://twitter.com/i/web/status/856095571827994624
2
lol!
 
Wes
1:49 PM
lol
 
or just
$object = new Object(1,2);
Is it ok to provide a constructor with 10-15 parameters without a builder?
 
1995 - At a neighborhood Italian restaurant Rasmus Lerdorf realizes that his plate of spaghetti is an excellent model for understanding the World Wide Web and that web applications should mimic their medium. On the back of his napkin he designs Programmable Hyperlinked Pasta (PHP). PHP documentation remains on that napkin to this day.

I keep re-reading this about once a year, and every year it sneaks up on me. Do I have dementia?
 
we don't have named params so I'm not sure.
 
Wes
the guy doesn't look very fit, though he could lift the sofa
 
1:52 PM
I assume that's on the way down and there are multiple people involved
 
In Perl we kinda have named params... but also we don't even have formal params. We have prototypes (not what you JS nerds are thinking of), in case you want to introduce subtle bugs into your program. Perl has a lot of wonderful features for introducing subtle bugs into your program. Like m//o
 
Wes
not sure about that, that would mean that the sofa passed through the window, but that seems unlikely that happened :B
stack objects into objects instead, e.g.
new Car(new Engine(new Transmission(new Gearbox(...))))
rather than
new car($engine, $transmission, $gearbox, $bodytype, $wheels, $all, $the, $things, $into, $the, $same, $object)
 
@Dereleased "skilled but perverted professionals..."
 
Wes
basically have more generalized objects so that you can group some of those 18
 
@DaveRandom =D
you can have all the named params you want, as long as you realize that mo-fuggin EVERYTHING is up to you!
sub foo {
  my (%named_params) = @_;
  # ...
}
 
1:57 PM
@TomasZubiri 10 to 15 params is usually an indicator for the class doing too much or for lack of encapsulation
 
sub foo(+) {
  my ($named_params) = @_;
  # this one has the subtle bugs introduced and doesn't compile on older versions!  yay!!
}
 
Wes
yes, it's what i said, or i tried to say @Gordon :B
have smaller objects
 
Yes, I see what Gordon and Wes are saying is kind of similar.
 
@Dereleased Yeh I mean you can do that in PHP as well, the only point in named params would be if they had engine-level type and name safety
otherwise you may as well just use an assoc array
 
Wes
visualization
:B
 
1:59 PM
@DaveRandom I can completely drop any (apparent) pretense in the function call, though. No array indirection, just foo(arg1 => "thing", arg2 => "things");
of course since perl is Disgusting I can equally as validly call foo(%{{ arg1 => thing => arg2 => things => }});
 
@Dereleased Right, which is worse, not better :-P
 
Is anyone arguing that it isn't (worse)?
 
YES, YOU ARE, BECAUSE I WANT AN ARGUMENT
:-P
 
Wes
for the record, phpstorm now has "named arguments"
 
@DaveRandom YOU TAKE THAT BACK PERL IS GRATE
@Wes eww
 
2:05 PM
There are two reasons for named arguments: legibility at the caller and optional parameter skipping. The former is equally well implemented with assignments at call time (which I assume is what PHP Storm does?), the latter is useless without engine-level safety.
A fucking massive block to named params right now is that reflection and docs don't match in many cases
Which betrays another problem: it's not that simple to keep those in sync
 
Wes
and the fact that sub classes can change var name @DaveRandom
 
Yes, although that's not particularly hard to solve from a technical perspective, the difficulty there will be getting a consensus on the correct behaviour
(my vote would be to require that children must retain param names, no other option makes sense in PHP imho)
I'm not really that fussed about named params in general though. The parameter skipping use case is more likely to be code smell (too many args)
 
Wes
i use defaultArgument(Foo::CLASS, "methodName", $offset) (code pastebin.com/pz7Xdbtw) for testing. would be great to have a __DEFAULT__ special constant
 
String ewww
:-P
 
Wes
lowercase string ewww
 
2:15 PM
room topic changed to PHP: Criticising @Wes's coding style for fun and sport [php]
 
Wes
you use php... if you cared about that you would be a goat farmer by now... :B
 
Anonymous
Mar 13 at 9:27, by JayIsTooCommon
@PaulCrovella I think i'd actually prefer goat farming..
 
Anonymous
still stands.
 
Wes
aha
 
I'm a ghost farmer. Cheaper. They don't eat as much.
 
Anonymous
2:17 PM
dear me..
 
room topic changed to PHP: Support group for those afflicted with PHP. Don't ask to ask, just ask. Username auto complete is *tab, not enter. Chat Guidelines : guide.room11.org [php]*
@JayIsTooCommon No no ghosts, not deer
 
Wes
@DaveRandom for the record i also write TRUE, FALSE, NULL (they are bloody constants, they must be UC) Int, Float, Array (they are all types, they must be ucfirst)
 
They are not sodding constants
 
Wes
"i own a lambo #smugface"
 
2:22 PM
That's probably not cheap
 
Anonymous
@Wes ew, what? Why are you always doing gross things
 
Wes
@rlemon @PeeHaa youtu.be/92bRBQv6WYI?t=24 do you get it?
 
hahahah
 
Wes
the flag.
 
I like how they are all italina
 
Wes
2:28 PM
:B
the one doing it properly is actually italian :B
 
@salathe could you review and merge when it looks good please github.com/php/web-php/pull/154?
 
Does this python api smell?
r = requests.get('https://api.github.com/events', stream=True)
r = requests.get(url, headers=headers)
r = requests.put('http://httpbin.org/put', data = {'key':'value'})
 
dunno without more info. What are the signatures of get() and put()?
 
@DaveRandom Obviously the way to solve this is to give PHP structs
 
2:48 PM
def get(url, params=None, **kwargs):
def put(url, data=None, **kwargs):
That's not helpful is it
 
nope :-P
I think probably some sort of explicit "request context" struct is in order there
 
def request(self, method, url,
    params=None,
    data=None,
    headers=None,
    cookies=None,
    files=None,
    auth=None,
    timeout=None,
    allow_redirects=True,
    proxies=None,
    hooks=None,
    stream=None,
    verify=None,
    cert=None,
    json=None):
 
Yes I hate that API :-P
Needs a reusable struct that can be passed as a single arg
 
@kelunik I'm not sure… 99.9% of the time it should be safe, but there is still the potential for it to be a ticking bomb.
 
Imagine if curl had that API, with its 2000000000 possible options
 
2:50 PM
Loop::run(function () {
    try {
        $deferred = new Amp\Deferred;
        yield $deferred->promise();
    } finally {
        yield new Amp\Pause(1000);
    }
});
@kelunik So I think we can say it's fine, but requires some caution. Rarely are there promises that do not resolve.
 
Should csrf tokens be generate with every form load or should they be assigned to the session once after login?
 
oh god somebody found requests
kill it with napalm after shooting it with nukes
> Requests is the perfect example how beautiful an API can be with the right level of abstraction.
I didn't make that up
 
@DaveRandom And instead of using named params you would set it with public members/setters if its a class?
 
@TomasZubiri No
Either the ctor is called with a request object or the ::request() method is called with the request object
 
I mean, how would you build the object that holds the options?
 
3:02 PM
Depends on the nature of the options
Some of those are client level defaults overridable at request level
In the case of a context struct like that though, I prefer new ctx; and a load of set statements to named params
because it separates option definition from action
 
That's the sort of API I see becoming common if PHP got named parameters.
 
Is this a tradeoff between ease of use and robustness?
 
So zend_ast arrays are like hella big all the time for all AST nodes?
 
@Trowski I predict with a high confidence level that this will remain a moot point forever
 
3:10 PM
I think you're right.
 
@SammyK i'd say more likely you're reading uninitialised memory there
Or initialised to 0, not used, you get what i mean
You can often read past the end of a buffer without it causing a fault
 
@Leigh Yeah, that's what I'm struggling with right now. Just trying to find out where it seems like the zend_ast arrays are getting set passed what I would expect from zend_ast_create
That just seems hella weird to me
 
On a train, on my phone, can't really look stuff up... I think you work out the number of children from the node type (kind?)
 
Yeah, I'm trying to add a new node that has 5 children and it's the only node that has that many. The max right now is 4 so I'm wondering if I screwed something up. Lol. I'll keep debugging it and see if I can't find out what's up. :)
 
I did this before and I can't remember why... otherwise i'd see if i had a branch pushed
You have to add a new kind that has the right bits set for 5
Or change the existing kind
 
3:22 PM
@PeeHaa why u hanging with python?
 
@Leigh OMG! You're a FUCKING GENIUS! That was it. Lol!
 
> such pythonic
> Requests is an Apache2 Licensed HTTP library, written in Python, for human beings.
amazing
 
I didn't add the "5 << ZEND_AST_NUM_CHILDREN_SHIFT" part. Just added it, let's see what happens now. :)
 
Aye.. all I can find is my slice syntax branch, that only adds a 3 child node though
 
W00t! No more segfaultiness! Thank you sir! :)
Every time I tried to access the 5th node it segfaulted and now it's all good in the hood after the bit shift to 5
 
3:31 PM
@Leigh like $array[1,3,5] to create [$array[1], $array[3], $array[5]] ?
 
No
Like python
$str [0:2]
Ok I'm about to go sub-marine, over and out
 
Later gator!
 
@DaveRandom there is another way; only allow functions to be called either with params by position, or by name. Which means that all current internal functions wouldn't be callable by name, which totally avoids the BC problem.
 
3:49 PM
re save as command – #74498
 
So I have a conundrum. My scenario is that I have a table where rows need to be prioritized. My first solution was to simply assign a numerical priority to each row and then every new row will have the priority of (rowCount +1).

That would work...the problem is that I also need to be able to shift any one of these rows to any priority and then have the list shift down. That means with my first solution I would have to run a query on forseably a LOT of rows every time I shifter the priority of a row.
 
Why are they stored as separate sets of rows, when you might have to shift a lot of them at once?
Or to put it another way - why do you need to update lots of sets of rows at once.
 
@Danack Because the first way if the rows have a numerical priority (1, 2, 3, 4, 5...) and I shift say 4 to 2 I must change the priority column in 4 rows.
 
> I would have to run a query on forseably a LOT of rows every time I shifter the priority of a row.
In that case - what do you mean by 'a lot' ?
4?
 
@Danack FORSEEABLY a lot. I'd say future-wise about 60.
 
3:59 PM
@Allenph Just load them to memory, adjust them there, save them back. Jobs a good 'un.
 
@Danack Load them all for every request?
 
@FélixGagnon-Grenier I don't mind python
 
@Allenph no, just when they need updating.
 
yeah, it might not be apparent, but I wasn't exactly dissing it
 
I am officially offended
 
4:04 PM
@Danack Updating them is not really the problem. Because, if I'm updating I should have the data already.
It's the reading them in order that's the problem.
 
Aaand back in blighty
 
@Allenph don't read them in order, just secure.php.net/manual/en/function.usort.php
 
@PeeHaa yeah, your gud at dat
 
:)
 
@Danack You think it will be faster to read the entire list no matter how many or how few I actually need every time I need to perform a CRUD operation?
 
4:07 PM
@Allenph it will almost certainly perform quicker, but more importantly it will take less of your time to do it. The probability of this being an area of your application that you actually need to optimize sounds incredibly low.
 
@Danack It's actually not. It's a pretty important piece of the core functionality to be able to prioritize these rows.
The user will likely only do it a couple times, but when they do it, they will likely send like 20 queries in rapid succesion. It's a drag-drop interface.
And it's an AJAX call from the front-end.
 
woo.
Sorting 60 items in PHP doesn't take 1/100 of a millisecond.
 
So...don't worry about it.
I'm overthinking.
 
Yeah maybe being able to prioritize them is important - optimising this function now, not so much.
 
posted on April 25, 2017 by CommitStrip

 
@DaveRandom thank you for the suggestion for adding dev server names to recaptcha. Added dev server name to accepted domain names in Google recaptcha, and it's recognizing the dev server. :D
 
Wes
@PeeHaa uuuuuuuuu
 
slowly making development code the same as production code
 
@Wes ^^^^
:P
I did JS
 
Wes
4:17 PM
noice
 
I'm actually pleased by the result
Should make it clear I think
 
The fact that I had to write a JS library for it is it even kinda worth
yo @Jimbo
Still thinking about adding the event loop, but that is a really stretch goal :)
 
4:35 PM
Doesn't phpstorm understand arrow functions @Wes?
 
Wes
you need to set the ES version in the settings
 
<3
Also I think that's the second time you had to tell me that :D
 
Wes
you have better ram than me then :B
 
:P
 
4:43 PM
@Tiffany that's kinda sad
 
Wes
@Dereleased dedotated waaamm
 
@Dereleased Wayum! What's the opposite of dissapointed. That's what I wam!
 
If you have any trouble with detotated wam you can always use google drive for that
 
Regression using host:port on mysqli constructor – #74499
 
I have seen that before
 
4:51 PM
evenin
 
jo
 
o/
!!dad
 
Dad, did you get a haircut? No I got them all cut
 
Anonymous
@tereško I can't top your post from last week on DailyMail .. but this is close
 
5:00 PM
@samayo that's giving me flashbacks of Type O Negative
:D
 
Anonymous
:)
 
@bwoebi @Trowski Maybe we should rename UvDriver to Uv0x1Driver and have Uv0x2Driver once php-uv v0.2.0 is a thing?
 
@Jimbo hm, what? what message?
@Danack It was a nice idea, some parts are nice, Paris is like the inside of an arsehole
 
5:16 PM
@JoshHallow I don't use relations in Eloquent.
It always ends up being more of a hassle than just querying the relation myself.
 
re save as command two – #74500
 
> to Open Office dot org
 
Wes
spam
why do they do that?
 
select * from alpha;
select * from beta;
select * from gama;
select * from beta;
select * from gama;
Hi, i need to count the duplicate line of each command in gz file using php,what is the best and fast way to do that because the file is huge
 
Wes
probably to check if their spam bot can guess the captcha? dunno
 
5:32 PM
weird spam is weird
Aaaand it's gone
 
poor person was very lost.. she seems to have found a bug in openoffice though :P
 
@pmmaga :D
 

« first day (2383 days earlier)      last day (2570 days later) »