« first day (2414 days earlier)      last day (2524 days later) » 

Dan
2:37 AM
I'll just leave this 'ere
 
 
2 hours later…
4:40 AM
Mornings
Happy friday aĺl
 
5:02 AM
!!dad
 
I am terrified of elevators, I'm going to start taking steps to avoid them
 
posted on May 26, 2017

New Cyanide and Happiness Comic

4
 
5:23 AM
Hey, anyone around?
 
Hey!
Would you happen to know how to adapt .sql files in order to be imported into a postgresql database?
 
 
1 hour later…
6:39 AM
@Dereleased Thank You so much! It works :)
 
6:59 AM
Segmentation fault /Zend/zend_alloc.c: No such file or directory – #74654
 
7:20 AM
Software engineering https://t.co/ODfGTejmGU
 
7:40 AM
mornings o/
 
Wes
@Feeds that was a good one
 
Anonymous
mornin
 
"PHP

Support group for those afflicted with PHP. Don't ask to ask, just ask. Username auto complete is *tab*, not enter. Ignore @DaveRandom. Chat Guidelines : guide.room11.org" haven't noticed this hahahah
 
\o
 
Wes
i hate naming test methods
 
Anonymous
7:54 AM
!!wotd
 
backronym: an existing word turned into an acronym by creating an apt phrase whose initial letters match the word, as to help remember it or offer a theory of its origin.
 
bob
Hey I have a small problem. I have an events page and i'm trying to state when one starts and when it finishes by using an if . .. else statement. however it's showing the wrong info. pastebin.com/FGKRgFPu
 
@Wes those are the simplest ones to name
 
Wes
no, because they are so long and impossible to read. so i try to keep them short but i fail at it
 
@Wes public function test_Finding_Identities_that_are_Inheriting_from_the_Given_Role()
seems readable enough for me
 
Anonymous
7:59 AM
I'm not against long test method names, they're supposed to easily describe what's being tested
 
Wes
i should underscore them too
 
yeah, I really like using underscores in unit test methods
 
mornin all
 
Anonymous
o/
 
\o
 
8:03 AM
o/
 
Anonymous
138
Q: Compare given date with today

alexusI have following $var = "2010-01-21 00:00:00.0" I'd like to compare this date against today's date (i.e. I'd like to know if this $var is before today or equals today or not) What function would I need to use?

 
btw, @Wes, you might be interested in this one: youtube.com/watch?v=Yy9sKeCE8V0
 
@Arslan.H As I said... advice for life
moin
 
Anonymous
christoph
 
Hello guys, I have a little problem which is similar to what is asked in this thread:stackoverflow.com/questions/44172640/…
 
8:09 AM
if ($givenDate == $today) {
 
No answer has been provided yet... Will be happy to know the solution to that question
 
Wes
@tereško that is going to be awesome :D
 
there you are @JayIsTooCommon
 
Wes
yeah i already knew it
 
bob
8:10 AM
@JayIsTooCommon Thanks, but not sure that can help
 
Anonymous
@bob you haven't described your problem.
 
Anonymous
@DaveRandom thank you... nerd.
 
bob
@JayIsTooCommon It is simple shows the event has started when it hasn't or shows it has ended even though it hasn't begun.
 
Anonymous
@bob you're probably comparing dates wrong chat.stackoverflow.com/transcript/message/37304224#37304224
 
bob
yes, that's my issue. i'm doing if ($new_start_date > $date ){}
 
Anonymous
8:18 AM
the answers to the question I just gave you show you how to compare dates correctly
 
@bwoebi lol
Mornigin all
 
Anonymous
hey haa
 
jayman
 
Anonymous
i got pissed on 2 pints last night. 2 pints... I'm ashamed.
 
lol
 
8:21 AM
@bob You can also compare dates using DateTime::createFromFormat like this 3v4l.org/kW38v
 
I have been drinking the entire day yesterday. It's such great weather over here
 
I assume it's raining in the uk?
Hey Jimboob
 
Anonymous
nope, heat wave here for a change
 
Oh nice
 
8:29 AM
Probably that's because it's too soon for rain in UK
 
Morning
 
Anonymous
@brzuchal correct, it's not summer yet. Once it is, the rain will surely start.
 
I was gonna say, let's wait few hours yet for a rain :P
 
Hello guys, any answer to my question?
 
8:40 AM
@DaveRandom you have jeeves twitter api credentials for me by any chance?
oh nvm
Can just get it from prod
 
8:57 AM
moin
 
yo bobski
 
Anonymous
yo boob
 
bobislav
 
@PeeHaa I'm not a merge of myself and @Trowski …
 
Not yet
 
9:10 AM
 
Anonymous
jimeboob
 
9:25 AM
oh.
user image
4
 
https://t.co/qN3RTAH0Yb
 
bob
I'm trying to display when an event starts, is in progress or has ended, but no matter what the date is it outputs "in progress":

<?php
if( strtotime($event_start) > strtotime('now') ) {
echo '<div class="starting_today">In Progess</div>';
} elseif (strtotime($event_start) == strtotime('now') ) {
echo '<div class="starting_today">Started Today</div>';
} elseif (strtotime($event_end) > strtotime('now')) {
echo '<div class="starting_today">Event Finished</div>';
}
?>
 
Anonymous
@bob did you read through the question i sent you?
 
bob
@JayIsTooCommon yes, that lead to the changes, but still doesn't work.
 
9:32 AM
Am I the only one here to use "ask question" button on SO to upload things to imgur because their interface on main site now sucks so badly?
 
nice, can't see tagged questions … 500…
 
@bwoebi I can, you suck :D
 
getting 500 for all of SO Q&A lists actually (mainpage, tag lists etc.)
 
@brzuchal How would the closure be called? $closure($obj, $param1, $param2)?
 
19
Q: Random areas of random SE sites produce 500 errors at random times. Randomly

mornanerI am getting a 500 server error when I try to load the main page and the Questions tab. Jobs, Documentation, user profiles, etc seem to work fine, but I cannot access questions. This has been the case for around 15 minutes so far. When accessing the Questions tab the site works sometimes, but mo...

ah.
 
9:37 AM
Got told I overengineered a solution for making a join table rather than normalising :<
 
probably doesn't help that it's 5 in the morning in NY right now…
 
@kelunik I think it should be called like a normal Closure using ->call($newthis, ...$arg);
 
@AlmaDo Nope, their UI actually breaks for me, I find it difficult to upload stuff there now
 
@kelunik Something like this :
<?php
class Foo {
    public function bar() : Bar { return new Bar(); }
}
class Bar {}
function map(Closure $closure, Foo ...$foos) : array {
    $result = [];
    foreach ($foos as $foo) {
        $result[] = $closure->call($foo);
    }
    return $result;
}

map({Foo->bar}, ...[new Foo, new Foo]);
 
Anonymous
Where's Paul..
 
9:43 AM
@kelunik what do you think about that?
It could be also possible to run just: $bar = {Foo->bar}->call($foo);
It would be just like normal Closure made from class method
As I can see there is even no neet to call ->call(); method 3v4l.org/9detX
 
hi can anyone guide me where or how can i send text to user from my website when they enter their mobile number
 
So it could be just $bar = {Foo->bar}(new Foo);
 
parse int and float distort data – #74655
 
@Smple_V that's a third party service. You uses an API to send those request (kinda like you send push notification to iphones)
 
@bwoebi @Trowski is anybody taking care of renaming Pause() to Delayed() in the various examples across amphp packages? i just stumbled on that
 
9:50 AM
@StefanoTorresi ah, examples…
 
@tereško thanks for the info code.tutsplus.com/tutorials/… had this goin on where it suggested to phone#@carrier but didnt work
 
@bwoebi heh :p
 
@Smple_V well, the "SMS gateway" is what you should google for, to find where to buy that sort of service
 
@bwoebi actually it's just in parallel and redis, i can wrap the PRs up
so nvm
 
okay :-D
 
9:54 AM
php -m command gives unreadable output when run via exec() – #74656
 
o/
 
\o
 
@tereško i understand that but for verizon , tmobile, atnt they have something called sending text to phne#@carrier
thats what am looking for anyone has any idea how that works or what excatly that is ?
 
10:09 AM
@PeeHaa that's exactly what I would do :-P
 
Yea. Twas early. Brain wasn't working yet
 
@Smple_V not all carriers implement this and it can be generally flakey. You should look at a proper SMS gateway, they are generally simple things to implement. For the UK I recommend textlocal - as a general rule you'll want to use a service that is based in the same country as the destination mobile number.
 
Anonymous
@PaulCrovella yo o/ how's things?
 
@JayIsTooCommon well as it turns out breaking a toe feels exactly like stubbing it very, very hard... which coincidentally is exactly how I broke a toe
 
@DaveRandom Dude could you point me toward your criticism you wrote for my last WS talk, I can't find it
You might remember some words you used so it's easy to search for
 
10:22 AM
@Jimbo I don't remember writing anything?
in here was it?
 
Anonymous
@PaulCrovella nice, that sounds fun. Have you been busy or has an 11er pissed you off?
 
Yeah
Either that or I mentioned you and said its your fault as you looked it over, hmmm
 
I mean it would only have been about async vs parallel
 
@JayIsTooCommon busy
 
@Jimbo tbh I don't remember writing anything, I only remember going through it at nw last year
 
10:23 AM
Ah fair enough, will keep looking :)
 
@Jimbo what are you doing though? I don't mind going through it again maybe over the w/e
 
It was mainly the event loop knowledge that I needed to re-cover, as I feel it's not anything actually like signal based
 
Anonymous
!!issue SO have updated their UI - Scrapers for profile attribs need to be updated
 
@JayIsTooCommon Issue created - github.com/Room-11/Jeeves/issues/215
 
@JayIsTooCommon Can't you just use the API?
 
10:25 AM
No
 
Anonymous
2 days ago, by DaveRandom
@PeeHaa I looked into using the SE API, doesn't have twitter handles in it iirc
 
@JayIsTooCommon Just bug one of their devs. :P
 
@Jimbo what aspect of it?
I wrote a thing in chat the other day that might be useful
 
Anonymous
@kelunik :B
 
yesterday, by DaveRandom
while (haveIoToWatchOrPendingTimers()) {
    timeout = getTimeUntilNextTimer();

    if (haveIoToWatch()) {
        watchForIo(timeout);
    } else {
        sleep(timeout);
    }

    processPendingIo();
    processReadyTimers();
}
@Jimbo ^
 
Anonymous
10:27 AM
@bwoebi where are these examples?
 
@JayIsTooCommon already fixed
 
@DaveRandom Specifically this bit, I feel I need to be more correct. Rasmus is there
@DaveRandom I say it's not just a while loop though. That looks like one... :D
 
well, it is one :-P
 
It basically is
:P
It's nothing more than an infinite loop that check for things to do
 
here it is in amp
 
10:30 AM
@Jimbo It is one.
 
here it is in react
 
@Jimbo uh, it is one … your diagram shows a jump back from the last element back to the start; pretty much the definition of a loop…
 
I think he got it people :P
 
But when there is something to do, it can't just do it on it's own and block the loop
right
 
That's where the actual async comes in
 
10:33 AM
@Jimbo how do you mean?
 
@PeeHaa we're iterating infinitely to drive it home
 
It's still single threaded
(in most cases)
 
@Jimbo Everything blocks while it is actually being executed, you can't magically make a thread do 2 things at once
 
It doesn't block while waiting
 
the point of an event loop is to schedule things efficiently
 
10:34 AM
Obviously once something gets back it needs to be processed / executed
 
here is one I wrote to work on PHP 4.3.10
(don't ask)
 
lolwat
seriously Chris
wat
:P
 
does that make it better?
 
lol
:D
 
knowing that it doesn't work with 4.3.9 somehow makes it worse
 
10:36 AM
CS5100-0007D900A5C3# php -v
PHP 4.3.10 (cli) (built: Jan 20 2005 09:40:04)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
    with the ionCube PHP Loader v3.1.24, Copyright (c) 2002-2006, by ionCube Ltd., and
    with the ionCube PHP Accelerator v1.3.3r2, Copyright (c) 2001-2002, by Nick Lindridge
@PaulCrovella I actually have no idea whether it works on any other version, I've never tried it
it works extremely well on there though
 
lol it even has ioncube
 
@DaveRandom oh my gawd
 
@DaveRandom So this async thing causes it to be done in another thread?
 
no
It's all single threaded
 
it does all sort of weird shit, it's an embedded system with extremely limited capabilities and while it should in theory be possible to create a cross compiler for it I have never succeeded
 
10:38 AM
The point is it doesn't block the single thread while waiting for e.g. a http request to come back
It can do other stuff on that same single thread
 
@Patrick , thank you for your tutorial, really helped me alot
And alot of great information too
 
Anonymous
@BrightSun @Patrick
 
Argument 2 passed to Amp\Artax\Client::normalizeRequestBodyHeaders() must be of the type array, unknown given
What's unknown?
 
I dont know his full name here
 
@kelunik lolwat :P
 
10:44 AM
Okay, that's the magic :P the bit that pisses me off. Okay, and PHP under the hood is polling those streams?
 
@kelunik try running it with valgrind, maybe there's more going badly…
 
huh
As with anything weird I blame opcache LO
 
@PeeHaa OPCache isn't enabled.
var_dump($options) gives UNKNOWN:0 oO
 
2 mins ago, by bwoebi
@kelunik try running it with valgrind, maybe there's more going badly…
 
10:48 AM
@bwoebi How do I do that? :P
 
USE_ZEND_ALLOC=0 valgrind php myscript.php
 
> if you gaze long into a rabbit hole, the rabbit hole also gazes into you
 
see, all way too complicated… just do blocking synchronous and everything will be okay and reasonable
 
@Gordon You are weird
 
Anonymous
Apr 12 at 13:26, by JayIsTooCommon
@Gordon you're a bit weird.
 
Anonymous
10:55 AM
@Gordon you're getting worse apparently
 
Using coroutines it is as reasonable as it gets
 
@bwoebi There you go with a repro: 3v4l.org/HgKbi
 
@PeeHaa no, you are weird
 
Yes hence I am an expert witness :P
 
@kelunik can you please open a bug report?
 
10:58 AM
feel free to join if anyone wants to
 
@DaveRandom … why? … well.
 
@bwoebi kinda noisying up this room
 
@kelunik meh
 
signal is the new noise - this is still SO after all
 
@bwoebi Done.
 
11:04 AM
Undefined constants in array properties result in broken properties – #74657
 
@NikiC :D
 
@BrightSun :)
 
Anonymous
Yeah baby. Just signed my contract \^/
 
11:32 AM
Well done :)
 
congrats
CsrfTokenManager
^ is there a better name? (uses TokenStorage and TokenGenerator to generate and save tokens in session)
 
M to the ORNINGS
 
@Patrick TokenStorageGenerator?
 
but it's not generating a token storage ^^
 
csrfservice?
 
11:36 AM
See I'd use Manager or Handler but so many people say it's a cop out
 
@RonniSkansing I have a whole subchapter on why naming things service is bad in the book
 
(=
It sounds like a service, ala CsrfService ( storageInterface, generatorInterface)
 
many classes are services
TokenGenerator is also a service
CsrfProtector maybe
but that sounds cheesy
 
I thought the container would only touch it's dependencies
while a concrete like the generator would actually generate a string token from doing stuff (not only touching dependencies)
and oh yea, sounds nice with the book (=
 
moin
o/
 
11:40 AM
I still need to come up with a name for the book by the way if someone wants to help me brainstorm :)
if have some ideas, but they all suck in their own way
@Jimbo actually I do kinda like the idea. What about StoredTokenGenerator or StorageTokenGenerator? And then the same for ...TokenValidator
 
cool, is it a leanpub book?
 
@RonniSkansing haven't decided yet, might just self publish it
I'm not sure leanpub can format it how I want (I have some info and danger boxes in there)
Professional PHP: subtitle (something like "Clean Code, Architecture and Security)
^ yes/no?
 
dunno maybe =p
 
@Patrick Professional PHP: Building clean and secure applications?
 
@Andrea I've been thinking about array generics and variance and references
Basically, everything sucks
 
11:50 AM
@NikiC Aren't references the same issue as with typed properties? Didn't @bwoebi solve that?
 
The thing is that technically array<T> is invariant. But because it's a by-value type, we could (and for ergonomics, probably must) support passing something like array<Sub> to array<Super>, by performing a (logical) copy of the array
I'm thinking we could avoid an actual copy of the backing data array, and only create a new zend_array structure with a different type. And then only force a full separation on write
But ... references
If one of the array elements is a reference, then under PHP semantics we have an island of invariance in the array
We can cast the whole array to array<Super>, but would have one element in it that can only be assigned Sub
 
@kelunik that sounds good. Professional PHP doesn't sound too pretentious? I could then follow that up with something like Professional PHP: Domain Driven Design
 
I'm not sure what to think about that
 
@Patrick Dunno
 
PHP has two builtin ways to produce opcode dumps (w/o vld): phpdbg -p* test.php php -d opcache.opt_debug_level=0x20000 test.php
@NikiC where does opcache dump that to?
 
11:56 AM
@Gordon stderr
 
can I influence that?
 
Of course you do need a recent version of PHP
@Gordon Sure, using 2> :P
 
as in > 7.0.15?
 
@Gordon >=7.1
 
meh
that's probably why the flag isnt documented either (yet)
 
11:58 AM
@Gordon No, that's just the general quality of opcache documentation ^^
 
Anyone got any tips? I had flu / laryngitis at the end of last week and I've lost my voice slowly over the past 4 days or so. A good cough and a bit of water helps, but still not great
 
@Jimbo I am sure there is pills helping with that
@NikiC good article on the php7 vm btw. thanks.
 
Anonymous
@kelunik I wonder what type it is
 
1 hour ago, by Jeeves
Undefined constants in array properties result in broken properties – #74657
 
Anonymous
@kelunik yeah but I wonder what Z_TYPE_P actually is in that case
 
12:22 PM
@NikiC HackLang killed references for a reason,
 
12:39 PM
@Sara yeah
But, foreach by ref
 
What about it?
 
It's kinda useful
 
Nah, I know. There's always some case where it's like, "This would be so much more concise with just one little goto... i mean, reference.
 
@NikiC Meh. Even in that case I just do it myself instead of using references
So I am ready for the culling of references
DO IT
 
Anonymous
^
 
12:42 PM
We could replace foreach by ref with assignment-overloaded proxy objects :P
 
pm what hack projects do :)
 
pm?
 
pretty much
 
example?
 
all inside FB :p
collection mapping also covers that specific use case well
$dict->map($x ==> ....);
^ pretty concise
omg, can't type for shit lying down in bed
 
12:48 PM
@kelunik additionally syntax like {$foo->bar} could also benefit I think
 
Anonymous
@Sara 3v4l.org/1QrhY no excuse.
 
@brzuchal We definitely need something like that in a callable RFC.
 
Anonymous
@DaveRandom want me to update the scrapers for new UI or are you already doing it?
 
@kelunik I'll take a look on it
 
@JayIsTooCommon no go for it, that would be great (y)
 
1:05 PM
hey folks, what's the difference of intent between amphp/parallel and amphp/thread ? they look like they overlap a lot.
 
@StefanoTorresi amphp/thread will be deprecated and not updated to v2.
 
@kelunik this one wiki.php.net/rfc/callable ?
 
@brzuchal I mean we need a syntax for bound methods in your RFC.
 
@kelunik ah, I see. thanks!
 
@kelunik what does mean bounded method ?
 
1:12 PM
@brzuchal What Closure::fromCallable([$obj, "method"]) does.
You can just invoke it and it's bound to the object.
 
> Uncaught TypeError: stream_socket_client() expects parameter 6 to be resource, null given
that is really annoying @bwoebi, any chance of fixing that?
it's optional, it should accept explicit null
 
SVN post-commit hook is broken – #74659
 
1:30 PM
@bwoebi hahahaha
 
bob
Hey people what is the best way to resize images with aspect ratio on upload?
 
@NikiC yep, yep, yep. I've just assumed array, array<T> and array<OtherT> will always be incompatible.
 
@bob sounds like something you can search for
 
bob
@RonniSkansing I have and i've tried a lot of them.
 
@NikiC My preferred solution to references at the present time is to just forbid them. That sounds bad, and well, it is a little inconvenient, but consider that references to arrays (the typed properties issue) are probably more common than references in arrays.
 
1:33 PM
And what was the issue with all of them?
 
bob
@RonniSkansing not doing what I need. so i'm looking for maybe a good git
 
@NikiC My thinking is that if you forbid &$array you can't use, say, array_push. But I can't think of anything common needing &$array[0].
 
so none of them had a answer you could copy paste or was there a real issue with the code?
Did you try to fix what was wrong?
 
bob
@RonniSkansing no, I wrote the code myself. just used them as a reference.
 
@NikiC …ah, but nested arrays would become more annoying in this circumstance. :p
 
1:36 PM
So upload of file, and resize keeping aspect ratio seems to be both something alot of people have done, asked about and wrote about
 
hi ladies
 
bob
@RonniSkansing yes i tired and the resizing worked but kept on sending the images to the wrong path.
 
i'm going to ask a mysql question
 
@bob then the resizing is not the issue
 
@bob maybe you are doing it wrong?
 
bob
1:36 PM
@RonniSkansing obviously.
 
@bob change the path
 
bob
@Andrea yeah, i never thought of that. :)
 
@bob try again, and share the code that does not works as you expect
and what you have tried to fix it
 
@bob change the path harder
 
so we can help you where you are stuck.
 
bob
1:38 PM
0
A: Path to send resized images on upload php

JamesYou have some global variables that you're using inside the resize function: $directory $photo_directory_name They need to be either passed in as parameters, or declared as globals within that function: function resize($width, $height){ global $directory, $photo_directory_name; // res...

@Andrea nice :) it's changed hard that all the blood has left the function!
 
@bob it's probably placing the images in that directory because your code says to place them in that directory
 
bob
@Andrea no it doesn't.
 
oh I misread the problem, sorry
 
what is going on here
 
if (!file_exists($directory . $photo_directory_name)) {
$upload_dir = mkdir($directory . $photo_directory_name, 0777, TRUE);
}else{
$upload_dir = $directory . $photo_directory_name;
}
this looks suspect
I don't think mkdir returns a string, and shouldn't $upload_dir be the same whether you have to create the directory or not?
i.e. shouldn't it be:
$upload_dir = $directory . $photo_directory_name;
if (!file_exists($upload_dir)) {
    mkdir($upload_dir, 0777, TRUE);
}
mkdir returns a boolean
 
bob
1:42 PM
@Andrea fuck.
@Andrea the reason i had ../company_images is coz i'm going back to the directory then to company images as the handling file is within a subfolder.
 
@NikiC ArrayObject :p
no, wait…
am I even remembering what by-ref foreach does correctly
 
@Andrea ArrayObject is worse than references :P
2
 
@NikiC PHP 7.2's codebase contains a new comment from me complaining about its existence :p
 
@Andrea yeah ... object inside ArrayObject is even worse
 
@NikiC correction: PHP 7.2 contains two comments by me complaining about ArrayObject
 
1:55 PM
Can we, like, forbid that?
 
@NikiC I really want to.
@NikiC the problem that strikes me is that probably lots of code does (array)$ao
 
@Andrea so?
 
@NikiC it doesn't necessarily prevent fixing this, it just makes it trickier if you want to avoid a BC break
 
@Andrea we can still support that
 
yeah
 
1:58 PM
we just shouldn't allow passing in an object
 
also I just realised that the issue with [] I thought of doesn't exist because it's already an object
@NikiC oh. that wasn't what I was upset about
@NikiC I'm upset that the ArrayObject “property table” is the, uh, array
though that's kind of a subset of the issue you're complaining about :D
 
I thought you meant that through array object you can set integer properties on objects
 
@NikiC …oh god I forgot that was possible. Now I have two things to be upset about
 

« first day (2414 days earlier)      last day (2524 days later) »