« first day (1200 days earlier)      last day (3974 days later) » 

18:00
Okay. Can't wrap my head around this one.
Why does the following code output bool(false)?
$str = 'Sat 16-03';

function customValidate($date, $format='D d-m')
{
    $d = DateTime::createFromFormat($format, $date);
    //print_r(DateTime::getLastErrors());
    return $d && $d->format($format) == $date;
}

var_dump(customValidate($str));
But if $str is Sat 15-03, it outputs bool(true). What am I missing?
user895378
@DanLugg FWIW I specifically try to avoid those abstractions. I don't like them :)
user895378
They're leaky.
user895378
Besides, your php script almost certainly should not be setting the date header itself.
user895378
That's a server responsibility (much like Transfer-Encoding and Content-Length where setting them yourself leads to unnecessary work at best and broken messages at worst)
@rdlowrey Of course. It's merely for testing/completeness.
It's purposefully leaky though; more of a "helper".
You can always drop down and edit raw headers. But the common practice of assigning a properly formatted date can be encapsulated.
user895378
But you shouldn't be setting the Date header yourself in the first place.
Or a non-negative integer.
@rdlowrey No, I shouldn't. That's where setDate is less valuable than getDate; which DateTimeInterface HeaderCollectionReader::getDate()
@Amal Murali 03/16 is not a Saturday, if you change it to Sun it will return true
Again, completeness.
user895378
18:08
There's zero benefit to calling $response->getDate() versus $response->getHeader('Date') and I'd argue you're adding to the cognitive load required to read the code.
user895378
Understanding HTTP should be enough. Don't make me learn your framework too.
We'll have to agree to disagree.
user895378
(these are just my opinions, obviously)
user895378
I hate those leaky unnecessary HTTP abstractions :)
I appreciate your position; light-weight, simple, arguably elegant. But I also appreciate a sensible interface; we have a DateTimeInterface with which one can interact. I'm just doing the up-front and providing the instance outright.
user895378
18:11
$date = new DateTime($response->getHeader('Date'));
And again, I'd argue it's an intentionally leaky abstraction; you're not hiding the implementation details of a string/string map.
@rdlowrey $date = $response->getDate(); $dateString = $response->getHeader('Date');
Sorry, ping-tastic.
user895378
But you're adding cognitive complexity. What if I am writing code in one place and I know HTTP and I don't use the abstraction. Someone else doesn't know anything about HTTP and they use it because, "hey, it's easy and fun and awesome!" ...
user895378
Now you have separate ways of doing the same thing in the codebase.
user895378
You can introduce rules about which way is "right" for your project.
user895378
But now that we have a couple of abstractions I have to remember which headers have abstractions and which don't.
user895378
18:13
Can I call $response->getContentLength()? I don't know. I have to consult the documentation first because damn I can never remember which ones do and which ones don't.
user895378
^^ That's my problem with the leaky abstraction.
user895378
But it's obviously such a non-issue it's not worth arguing about :)
lol, I was literally typing "I see it as a non-issue" ;-)
Helpers man, helpers. Not full-bore "hide-the-implementation-details" abstractions; helpers.
@rdlowrey By the way, yes, you can call getContentLength. Any other questions ;-)
user895378
No. Only tears of sadness ;)
lol, you'll see. I understand and respect your position on the matter; but I think I've gone about this in a far less obtrusive manner than you may be picturing.
18:21
If I want to store ipv6 addresses just as string (not numbers) in a mysql table, what should the column type be?
Would Varchar(100) be enough?
157
Q: Maximum length of the textual representation of an IPv6 address?

GillesI want to store the data returned by $_SERVER["REMOTE_ADDR"] in PHP into a DB field, pretty simple task, really. The problem is that I can't find any proper information about the maximum length of the textual representation of an IPv6 address, which is what a webserver provides through $_SERVER["...

Beaten to the punch.
/me gives @Charles a cookie ;p
oooh, cookies
omnomnomnom
 Author Fabien Potencier with 103 Commits (277/119 CCN: 0.000265828104414034)
 Author Bernhard Schussek with 36 Commits (897/707 CCN: 0.000341689427988925)
 Author Jordi Boggiano with 16 Commits (2/2 CCN: 0.000199690433547229)
 Author Jakub Zalas with 15 Commits (44/36 CCN: -0.000183832428895442)
 Author Pascal Borreli with 9 Commits (7/7 CCN: 1.7541210585309e-05)
 Author Tobias Schultze with 8 Commits (110/4 CCN: 8.21401974330787e-05)
 Author Joseph Bielawski with 7 Commits (27/-15 CCN: 6.25171601093826e-05)
^ every contributor in Symfony 2, in 2013
18:25
@ircmaxell Including the sub-modules?
waaaait, I only ADDED code?
Well, the numbers are different
@Danack symfony has no sub-modules...
@Charles I get incomplete addresses
2600:1000:b003:cb18:b8d5:39f9:3d0a:42f7
the first number (27/15) is the total lines addedanddeleted / net effect of additions and deletions
CCN is the overal sum of cyclomatic complexity per line of code change
18:27
@AGirlSaidMySmileIsCute: echo strlen('2600:1000:b003:cb18:b8d5:39f9:3d0a:42f7'); => 39
@AmalMurali Right, but if I put that on some ip tracer, it fails.
@AGirlSaidMySmileIsCute Yeah, but are they well-formed? If not, you should probably correct that before storing them. I'm not sure how that will change the length, if at all.
@HamZa yo bud, why doesn't this work? T-T regex101.com/r/fL8pU5
@ircmaxell yeah, I was noticing that the CCN went down
18:37
@reikyoushin 'cause you're anchoring it and the test string doesn't start with http?
@reikyoushin Also shouldn't that be (https?:\/\/[^\s]*)? With .* you're getting the text after the space, which doesn't seem to be the implied intent.
^ that
@reikyoushin simplified ~https?://\S+~i regex101.com/r/qC2zJ2
@Alez How are you doing ?
18:52
well, i was planning to get everything until the first space.. isn't that what [^\s]* was supposed to do?
@Charles @HamZa so my mistake was just the ^ amd $ right?
@reikyoushin [^\s] === \S :)
@HamZa where is that documented?
haha I don't know
but yeah i will remember that. :P
It's the same with \W === [^\w] :P
18:57
\W is the same as \S?
\w is alphanum right?
@reikyoushin yes it is (with underscore)
cool. thanks!
at least i almost got it this time. ^_^
and \W !== \S
yeah :)
19:09
@bwoebi I don't know nothing about geometry, sorry ;)
19:20
@ircmaxell Do you think that the str size / long patch is a good idea for PHP 5.6?
Sorry the grammar nazi in me can't hold it in!! Double negative!
Rather than master=6.0, that is
My wife does that all the time -_-
@Fabien I ain't not know no nothing about grammar ;)
heh
19:22
garmar?
Man it's like trying to read a bad ternary statement.
hey guys can you tell me why twitter uses twitter-text-js when the same can be done in backend
hello
Sorry guys. Probably very inappropriate place to ask, but does anyone of you know an SE site, where I could ask a question about headphones cable length?
@NikiC (!I->(!know(!!$grammar))) or something like that :P
19:39
Noo, they renamed GTFO into GOAWAY in HTTP2 :(
boourns!
GTFO FTW!
Man the Japanese really know how to prank
@Eugene You might try ham.stackexchange.com, avp.stackexchange.com, or sound.stackexchange.com, but they all seem like a long-shot, and would probably be
@DanLugg Thank you. Will look into that.
None of them seem particularly consumer-product oriented; sound.stackexchange.com is probably your best bet, but no promises ;-)
19:53
@nikic depends on how long until 6. I think it is OK for 5.6. I just don't want 6 to become the catch-all it is setup to be (and never ship)
I would rather ship a small 6, just to get past that boundary without massive rework. Help adoption and get past the stigma...
user895378
@Ocramius Oh no! Link?
user895378
Nevermind. Found it :(
Train, laterz...
user895378
GTFO was the best part of the specification
user895378
@ircmaxell later
19:56
@ircmaxell I feel like it does a pretty big break in the extension API, which is better suited to a major version jump
@DanLugg for a split second I was like wtf, why is there a site dedicated to ham...then realized it was ham radio *sighs*
> HamExchange, all ham, all day, every day. Bacon.
@DanLugg And I thought there is an exchange site just for me :P
20:15
morning
@rdlowrey see on the right
Nevermind. Saw you found it :(
@NikiC ah okay, no problem :-)
user895378
Yeah, I realized I have the draft spec bookmarked and simply needed to pull it up and ctrl+f on "GTFO" :(
You can put Github emoticons in commit descriptions! =oD
:rocket:
20:20
I'm going to go crazy with them O_O
:shipit:
@NikiC which is why I'd simply say "This is 6, we're shipping Alpha in January 2015", and let anything else require a patch to be accepted (no arbitrary features, etc, just what can reasonably be done in that timebox)
@DanLugg hambutton.com
3
@ircmaxell I also think it would make sense to just specify a timeframe and release whatever gets done in that timeframe
Well, yes, but a reasonably short timeframe. We don't need to rewrite the entire engine for 6. Could we? sure. I think smaller, more defined steps are better
Example: would love to see the reentrant parser work finish for it
but not some of the huge changes people have been saying
20:32
@ircmaxell why would we want to finish that in particular?
not many people using zts after all
@NikiC just on the top of my head, talked with Elizabeth Smith about it quite a bit at Benelux
@NikiC no, but it would clean up a lot, and remove a lot of the ZTS complexity now
@ircmaxell what's it good for?
ah
much easier way to remove zts complexity seems to be usage of tls
The unknowing masses are gonna be upset if "PHP6" doesn't fix unicode though...
Why would my $_FILES array return empty after submitting the form with a file?
20:35
@Charles I would be really sad if PHP6 attempted that
It would require me to find a new language
I have already check for the max input which is 32M or 20 photos.
@NikiC I'd be disturbed, considering the previous work and why it failed. But meh.
@Designer17 Wrong MIME type on the form?
6 attempted 2 things: 1. Unicode strings and 2. Unicode parser
the 2nd is what failed IIUC
and the 2nd is dumb. But unicode strings would be awesome
@Charles they're jpg or png and I'm trying to upload to WP
I'm out, laterz
20:40
@ircmaxell have fun
@Charles you can see my current code here: stackoverflow.com/questions/21407397/…
@Designer17 ["error"]=> array(1) { [0]=> int(4) } us2.php.net/manual/en/features.file-upload.errors.php
UPLOAD_ERR_NO_FILE -- no file was uploaded...
@ircmaxell bye
Hello.
@Designer17 Is there a post size limit on your web server....
20:46
Quick question: What does the slash before object instance creation mean?
E.g. `$stats = new \UserIpStatistics();`
@Hamster root namespace..
@reikyoushin Ah. Thanks.
@Orangepill yes, there is a size limit ... but, it's WP's default which is 32M.
Hello @all. What is the appropriate stackExchange where I can get a review for a UML 2.0 use case diagram that i made for Tic-Tac-Toe game? Thank you in advance.
@Designer17 That would be php's.... the web server can also limit how large the post body can be.
20:51
@Starlays maybe CodeReview?
@Orangepill I'm running this on localhost (which would be MAMP) and in they're php.ini file they have this set "upload_max_filesize = 32M"
@Designer17 This would be in your apache config (or .htacces) ..... try adding LimitRequestBody 0 to the .htaccess file
@Designer17 Nevermind ... if that was the case apache would give you a Entity too large error...
@Orangepill That was in bin/php/php5.5.3/conf/php.ini ... this is where "phpinfo();" said it was
@Designer17 does your server error logs shed any light on the situation.
Hi!!!
Just a quick y/n question:
Will the $_GET variables in a URL (index.php?foo=bar) be passed to any php files that I `include`?
21:01
@Orangepill No, I'm not getting anything helpful from my error log.
@reikyoushin I don't have any code, I have only one image with the diagram... it will be OK if i post there a specific question that dosen't involve code review?
@AustinBurk If by "passed to" you mean "will $_GET be available in included files", then yes.
Thanks!
@AustinBurk it's a superglobal.... it's available from anywhere.
21:01
Excellent
@Charles I tried adding it the way you said and got an error "array to string"
@Designer17 what
@Charles ["error"]=> array(1) { [0]=> int(4) }
@Designer17 What I mean is that there's an error code there. The code is 4. 4 in this context is UPLOAD_ERR_NO_FILE, meaning PHP knows there was supposed to be a file but there was none in the form.
@Starlays hmm.. well there is no such thing as a schema review so i dunno
21:10
@reikyoushin OK, thank you
@Designer17 Does it work with fewer files?
@Charles I get a syntax error "T_DOUBLE_ARROW"
@Designer17 It's not code. It's a copied and pasted snippet from your question.
@Orangepill I've tried with one to four and none of them want to work for me.
*sigh* I give up.
21:14
@Charles All that is being returned is shown here stackoverflow.com/questions/21407397/…
@ircmaxell Mmm, hammy.
user924016
Having fun?
@AustinBurk Also, it's not a great practice (read: it's a bad practice) to use $_GET here and there and everywhere.
user924016
@Charles
@Charles Sorry for the mix up ... I see what you meant now ... it's from printing $_FILES it is returning error #4! haha sorry again.
21:21
A note to those who dabble in design; I came up with a pretty awesome solution to the 3-column holy grail layout, fixed-fluid-fixed; each column is it's own container, and the source order is preserved as left-center-right.
@DanLugg show us the goods
Lemme isolate it.
user924016
@Designer17 is the browser redirecting to the upload page or is it a ajax call?
user924016
and is it from the frontend or backend?
user924016
Like you have this, choose files, then pick files, how are the picked files input into the transfered data??
user924016
21:28
Even the tutorial you linked to does not have that..
@RonniSkansing It is currently a redirect but I still have the ajax call hooked up
user924016
So which one?
it is redirecting.
It might be goofy because I just recreated the whole of it; missing clearfixes etc.
But that's the gist of it. You can fix the layout to be l-c-r, l-c, c-r, or just c.
21:31
@RonniSkansing js clicks the input when #pick-photos is clicked.
user924016
js clicks the input?
user924016
so basicly you choose some pictures, they are then shown on the page, and you then pick which of these you want to upload?
@Orangepill If you remove column-l altogether, and drop the with-l class from the column-container, it'll display correctly, with only the center and right. You can drop the right column similarly, or drop both and everything works fine.
The best thing about it is it works on IE8, 7, and ... wait for it ... 6.
@DanLugg You mean the worst thing, right?
If something works in IE 6, it must be bad by definition ;)
lol, truer words hath not been spoken
Even still, when I fired up 6 and it didn't completely bork, I was amazed; better yet, it didn't actually bork at all.
HD-DVD ^^ ? Nevermind.
user924016
21:37
=]
@RonniSkansing you can see what my js is doing here: pastebin.com/GqCVfUtL
@DanLugg I can't break it .... works like a champ...
You might be able to get away from including the wrapper div by moving the styles down to the container.... still behaves in chrome at least
Oh yea, you don't need the .wrapper, but that's just how I've vertically segmented the site I'm working on; I dunno why I included it.
Force of habit I suppose.
@Orangepill The weird thing is, it's not really anything special; just careful use of positive/negative margins.
Yeah it's easy enough to follow... even if you don't know sass :)
21:49
I'd start an argument with @teresko about it, but he appears to have gone to Jupiter.
(he's not particularly fond of CSS pre-processors, IIRC)
I like them in concept ... i just have never used them.
user895378
^^ Just posted a new Improved TLS Defaults RFC for those who are interested.
22:15
If the array of rfc passes I think it should be accompanied by a arrayof operator as well...
@rdlowrey I only skimmed, but looks very nice. Very nice indeed!
if ($products arrayof Product) {...}
that kinda thing..
@Orangepill eek
user895378
@NikiC Thanks :) Last night and today were definitely php-src days between fixing the SAN vulnerability, merging the other RFC and floating this one.
@NikiC No good?
m59
m59
22:20
$dom = new DOMDocument();
$dom->loadHtml('
  <html><head></head>
    <body>
      <div id="content"></div>
    </body>
  </html>
');
$content = $dom->getElementById('content'); //NULL !?
if (arrayof($products, Product::class)) { ... } :)
+ implement arrayof in userland ;)
not that I'd do that, of course ^^
anyway, good night
user895378
@NikiC night
Good night
Meh, I'd favor an operator over a function. Just seems cleaner.
Night @NikiC
And more inline with instanceof, which is favored over is_a() (seeing as is_a() is deprecated)
that was my thought
and you should be able to do
$var !instanceof MyClass
m59
m59
22:25
Does anyone know what I did wrong there? ^
@Orangepill I always thought that too, but I concluded that negating the expression is just fine; you don't gain much from negating the operator.
!($o instanceof C) vs $o !instanceof C
I dunno... jury's still out I guess. If !instanceof became a thing, I'd use it, but I wouldn't "woo hoo" the matter.
@m59 does it need a doctype?
m59
m59
how about that...
23:10
0
A: CSS holy grail with ordered columns

Dan LuggThis is a revised answer. Here's the original. The following is a rather simple pattern, born out of assistance from folks in chat, and just tinkering for awhile. It meets the requirements described in my question, however it does use a single non-semantic <div> (which is one less than the old a...

^^ I had asked a question about it awhile ago; alas, I have answered ;-) S'got the summary details if you were curious.
m59
m59
Hm..in php there's no way for var_dump(0 == false) to print "true"?
m59
m59
mercy heaven
I was on code viper because 3v4l was stopped working for a minute
My mistake :)

« first day (1200 days earlier)      last day (3974 days later) »