« first day (1585 days earlier)      last day (3360 days later) » 

12:09 AM
@Sara if you need help aside from internals I Volunteer.
 
Who in their mind thing this is "well readable code" -.- new Tuple<ulong, int, uint, bool, bool, string, bool>(UInt64.MaxValue, 12, 874902, false, true, "errord", true). Makes me think if generics and similiars are really a good idea for php.
wrapped in a #if as example for good code...
 
@Rangad The problem here looks more like insufficient type inference ;)
 
@Rangad you can make a horrible example out of any code tool...
 
That and contrived code samples
 
How can I replace blank lines in php only when there's more than 1? at the moment I'm using this pattern but it replaces all blank lines and not just 2x or more?

preg_replace("/[\r\n]+/", "\n", $content");
 
12:23 AM
@Silver89 Probably with a min/max specify like preg_replace("/[\r\n]{2,}/", "\n", $content"); which should mean at least two, and the max is unspecified.
 
Note however that \r\n, i.e. a Windows newline, will be treated as two newlines
You may want to use /\R{2,}/u instead (handles all unicode linebreaks), or /(*BSR_ANYCRLF)\R{2,}/ (handled "classic" linebreaks only)
 
@Ocramius I just added a best effort failing test case.
 
While that was an example, there is more actually used code in that style. (Wrapping an example in an #if USE_EXAMPLES is a wtf on its own). I'm not a good person to talk to on clean code, but certain things should shout at the developer, even outside IDEs. I wonder if the interpreter itself should ever give oppinionated advice on certain usage patterns (notice, strict). I guess not.
 
@Rangad everything can be used in an evil way. e.g. github.com/irestful/…
use MultipleHashMapQueueMessageRetrieverCriterias\Domain\MultipleHashMapQueueMessageRetrieverCriterias\Exceptions\CannotRequestHasAmountException;
 
@TimWolla thanks, I'll check it out when I can breathe a bit :)
 
12:34 AM
@PeeHaa Well, to be fair, it worked great on my desktop too.
 
Agreed. Maybe php should hint to a linter in its docs that atleast highlights the most agreeable rules (and nothing more). (to maybe increase general code quality in the longterm)
 
@NikiC I've tried both of those out but they seem to not leave single blank lines?
 
@Rangad scrutinizer-ci.com has semi-decent code 'quality' analysis in place. I'm really torn on it's actual value though - you end up working to please the code analysis suite, more than you do writing actual valuable code.
@Silver89 Oh - Two "\r\n\r\n" is a single blank line. You probably want 3 as the mininum if you want it to leave single lines, and the replacement should be two \n's.
 
True, but certain rules should be generally agreeable. E.g.: Don't have insanely long names; try to avoid multiple statements per line; Specialize catches; don't mix spaces + tab)
 
:-)
 
12:46 AM
@Danack Challenge accepted.
 
@Danack please tell me this repository is just a joke
 
@marcio It is a joke. Whether it was meant to be a joke when they started.....
 
It is, but I like that joke :D
 
1:02 AM
@Danack Looks like the perfect use case for the “Group Use” rfc
 
1:14 AM
Does anyone know if Laravel supports PUT/DELETE requests?
 
@TimWolla nothing will fix thing that thing.
 
Hmm. I think that explode('/', '') should return an empty array but it doesn't :(
 
@LeviMorrison why should it?
should explode('/', 'foobar') also return an empty array?
 
It should return an array with 'foobar' as its only element.
I just don't think empty segments make any sense.
 
@joshhunt Yes, it does. Laravel 4 and 5 support Route::get(), Route::post(), Route::put(), and Route::delete(). You can even force an HTML POST form to be acknowledged as a PUT or DELETE request by putting the desired method in a hidden input tag named "_method".
 
1:23 AM
@LeviMorrison well, then think about explode('/', 'a///b') :)
 
@NikiC I'm not sure why but I would expect ['a', 'b'].
Maybe my experience is based on another similar function or something?
 
@LeviMorrison ;)
 
@Kage Thank you
 
@LeviMorrison it's often an option to strip empty segments
 
@joshhunt You're welcome.
 
1:26 AM
@NikiC Perhaps that's why :)
 
dear lord, I try to be constructive but that shit has 560 repositories of pure shit github.com/irestful?page=28
 $this->nodeRepresentationBuilderMock = $this->getMock('Nodes\Domain\Nodes\Services\Representations\Builders\NodeRepresentationBuilder');
 
does unset() remove the variable or just set it to null?
what's the best way to free up memory, unset() ?
 
user895378
array_filter(explode('/', ''));
 
@KevinDuke It removes the variable.
@rdlowrey uh-oh
 
user895378
lol
 
1:29 AM
ok thanks
 
@rdlowrey array_filter(explode('/', '0/1')) have fun
 
user895378
Well you can always pass your own callback.
 
@rdlowrey Really, I'm just pointing out that '0' == false sucks ^^
 
user895378
It does suck. The "0" thing is really problematic. I'm constantly forced to be aware of it ... mostly it just makes empty() useless where I usually want to use it.
 
user895378
(annoying)
 
1:36 AM
it's handy 60% of the time, and totally not what you want the other 40%
 
user895378
Kind of like scalar type conversion :)
 
yup
which is why mixed-mode typing is cool
 
user895378
Sat down to read RFC7301 in advance of adding ALPN support for crypto streams. It took all of two minutes.
 
user895378
Was expecting something more ... voluminous.
 
heheh
 
user895378
1:44 AM
I didn't get the point of why h2 wanted to use TLSALPN before ... now I realize it saves you the hassle of sending an upgrade response back as a server. Instead of sending a 101 Switching Protocols you can just immediately initiate the connection preface after negotiating the TLS session.
 
guys, how to you read xml of about 1Gb size in php? Took XMLReader but its readOuterXml method IS SLOW
 
user895378
Mixing protocol layers and transport layers is a terrible great idea :)
 
user895378
@zerkms I'm no help here, sorry :/
 
when I say "SLOW" I mean it takes cumulatively 5m20s out of 5m40s total (for 40 calls of that method)
 
@zerkms depends on the XML, if individual documents, I've done string parsing to split it into smaller chunks, then stream it in
 
1:50 AM
The selected chunks themselves are not big
I thought that any SAX parser is as fast as your storage + small overhead for user's code
 
yeah, in theory
 
:-(
 
2:15 AM
Make to be listen now. @ircmaxell guest. Audio: http://hosting.megatron.wondernetwork.com:8000/ Chat: http://devhell.info/irc #php
 
2:41 AM
@rdlowrey This is what I did in this case ^^
 
user895378
array_*() all of the things \o/
 
3:21 AM
that was fun
 
Hi folks,
 
 
1 hour later…
4:37 AM
I am confused: 3v4l.org/Nou0t
Oh silly me.
There we go: 3v4l.org/NIbEb
We should add __CLOSURE__ or something so it's a bit easier to recurse on anonymous functions.
 
4:53 AM
@INTP
oops me
@bwoebi @bwoebi Ahh! I see you were being sarcastic.. good point. Better to change that exception or perhaps just remove it for extra speed.
@PeeHaa Thx!
 
5:56 AM
i need a wordpress developer who have good knowledge in wordpress
exp 2.5+years
for ahmedabad location
i need magneto certified developer
3+years
and core php developer 3+years
who are living in ahmedabad
interested candidate ping me
salary no bar for right candidate
 
6:30 AM
Heh.
 
[text to display](link)
 
it done strange things either way ... I dunno, is early ;)
 
good morning everyone
 
moin
 
7:20 AM
good mornings
 
indeed
> I use windows as a server and i use pthreads. extension for doing 800-1000 operation at the same time
 
7:34 AM
posted on February 17, 2015 by kbironneau

/* by Gilbow */

 
7:46 AM
morning
 
morning
 
How may I remove a directory from the requestUri in \HttpFoundation\Request? Say I have webroot/public/index.php, rewrites to index.php, so all url's like myurl.com/public/qwerty return requestUri == "/public/qwerty", how may I remove the "/public" ?
 
sup lads
 
8:10 AM
here is any one developer belongs to ahmedabad
 
wonder if he still wants that :D
@SebastianBergmann ?
 
so here's what I found regarding my issue, is there a way to do this without creating the request twice?
 
#php we're going to play a game, find a bug on http://bugs.php.net, if you can close it tag with #phpBugscapade15, older the better
 
morning guys!
 
8:27 AM
moin
 
bye @Andrea
oh nevermind, seems you stay in this room (working myself through the transcript...)
 
she said she's not going anywhere, just backing away from php to concentrate on more important things ... like studying ...
 
8:48 AM
Morning
 
mohaaa
 
o/
 
Morning
 
@Fabor
 
Rasmus is advising people on how strict mode should work
@LeviMorrison he includes something about your idea of multiple types rfc ...
 
9:05 AM
the curl_setopt example that everyone always uses is totally wrong. its a generic API with the api curl_setopt($resource, int $integer, mixed $option); strict hints would not help here in any way
 
posted on February 17, 2015 by kbironneau

/* by @ouadieboussaid */

 
.@yohgaki requests better assertion API, 14 years ago, we're just getting round to it #phpBugscapade15 https://bugs.php.net/bug.php?id=13725
remarkable ...
maybe we should take him more seriously than we do ...
 
9:32 AM
posted on February 17, 2015 by kbironneau

/* by @panduroab */

 
ThW
Morning
 
Morning
 
@JoeWatkins which RFC are you referring to?
 
well expectations now, but dbc solved zero-cost assertions too ...
 
ah
 
9:43 AM
oh hai @Jack
where you been ?
 
hiding under [[NSRock alloc] init]
 
gross
I've done many things, none of them useful ...
 
Or NSRock() if Swift's your fancy :)
 
and andrea won't do internals anymore ...
 
yeah :(
It's been like fireworks, boom, and gone.
 
9:53 AM
 
@Ja͢ck are you doing obj-C or swift now?
 
The former
We started with Swift not being around yet
 
uh, :s
 
Yeah ... it's okay, we'll gradually move :)
 
hi, pls i am trying to fix something and i am not getting it right. I am trying to get the plain text of html from wysiwyg text editor. So i am using DOMDocument and foreach getElementsByTagName. the $element->nodeValue is occuring more than one time for each element. what am i getting wrong?
 
10:00 AM
Also, that's (not) going to be fun with v0.1 and v0.3 of scalar typehints being proposed simultaneously…
 
Say what now?
@Oluwatumbi what do you mean by 'occurring more than one time' ?
Oh, you mean with nested elements?
 
@Ja͢ck I used this function:
foreach($dom->getElementsByTagName('*') as $element ){
$result.= $element->nodeValue.'<br/>';
}
 
I was already wondering why you would have this issue ... why do you traverse every element?
 
@Ja͢ck I am trying to get all text from the html seperated by <br/>
 
How about just traversing the immediate child elements of the body?
 
10:05 AM
Pls how will i do that?
 
@Oluwatumbi have a look at this example and see if it makes sense... eval.in/private/93ee0ae14b5564
 
ok. Thanks so much. i am checking now
 
In fact, just get the node value from the root node ... might be enough
@JoeWatkins so the difference between that '01 bug report and the expectations RFC in terms of configuration comes down to php.ini or compile time? :)
 
@Ja͢ck I got a better result with using getElementsByTagName('body'). It returned the text nicely but all on a single line. Please any idea how i may get it separated by line breaks?
 
What's up with this stupid "you can only counter flag on items that are flagged" message ... what happened to just ignoring it if there are no pending flags .. =/
 
10:16 AM
@Ja͢ck if there is anything like getTextNodes i will appreciated it so much. so i can handle the text my self
 
@Oluwatumbi Not off the top of my head ...
 
ok. Thanks so much @Ja͢ck
 
@Oluwatumbi get what separated by line breaks?
 
The texts of each element
 
Do they already have line breaks, or do you want to add them?
 
10:20 AM
@salathe the document already has <br /> elements. They should form the newlines in the output.
 
Oh, so not just the text nodes!
 
\o/ 1000 SO answers
 
Here is the idea. i am getting the html from a wysiwyg editor. I know that linebreaks in html can only be <br/>, <p>, or other block level elements. Now i am not using for each again because of reoccurrence so i just used $body->nodeValue; and all text was fetched on a single line
 
nl2br() maybe
you want to print with line breaks?
 
@iroegbu Yeah that sounds more like what @Oluwatumbi is wanting
 
10:29 AM
@PeeHaa gz, 33.826 rep per answer, I have only 24.08 :)
 
Thanks @Ja͢ck, @salathe, @iroegbu. But i am finding it difficult to express my problem in english. What i need is function that will fetch all the text from an HTML string seperated by <br/>
 
in JavaScript, 14 secs ago, by Caprica Six
@FlorianMargaine You (http://stackoverflow.com/users/851498/florian-margaine) have 18514 reputation, earned 0 rep today, asked 29 questions, gave 546 answers, for a q:a ratio of 29:546.
avg. rep/post: 32.19. Badges: 4g 39s 78b
 
@SergeyTelshevsky Now how did that happen cough chat.stackoverflow.com/search?q=repwhoringpeehaa&room=11 cough ;)
 
in JavaScript, 11 secs ago, by Caprica Six
@FlorianMargaine PeeHaa (http://stackoverflow.com/users/508666/peehaa) has 33826 reputation, earned 19 rep today, asked 190 questions, gave 1000 answers, for a q:a ratio of 19:100.
avg. rep/post: 28.42. Badges: 22g 101s 178b
hehe
 
@Oluwatumbi explode() ?
 
10:37 AM
@PeeHaa lol :)
 
in JavaScript, 22 secs ago, by Caprica Six
@salathe You (http://stackoverflow.com/users/113938/salathe) have 28646 reputation, earned 10 rep today, asked 4 questions, gave 641 answers, for a q:a ratio of 4:641.
avg. rep/post: 44.41. Badges: 3g 49s 81b
 
i am using DOMDocument and nodeValue @iroegbu
 
Booya!
 
@salathe How?
 
we really don't know what you want
 
10:40 AM
@salathe Tbh I deserve a lot more internet money for all those great answers of mine ;)
 
@Oluwatumbi show us what you have (the HTML inside a wysiwyg editor?) and what you want the result to be (just text, with some <br>?)
*gives @PeeHee 1 intarnet moneys*
 
although it is dynamic because users of the site can enter anything. but here is example
in the text editor:i have <div><h1>About us</h1> <img src="about.jpg" /><p>We are a good people</p><span>Thanks for reading this</span><div> and I want this to show as 'About us <br/> We are god people <br/> Thanks for reading this @salathe
 
@Oluwatumbi Loop through all nodes and unwrap the spans?
 
Hey guys,
 
in JavaScript, 11 mins ago, by Caprica Six
@GabrielTomitsuka Jon Skeet (http://stackoverflow.com/users/22656/jon-skeet) has 752306 reputation, earned 215 rep today, asked 32 questions, gave 31047 answers, for a q:a ratio of 32:31047.
avg. rep/post: 24.2. Badges: 323g 5018s 6322b
 
10:49 AM
I have a file called Configuration.php which has a namespace of Blog;
I also have a class with his namespace: namespace Blog\Template;
    public function render($template, $data = [])
    {
        global $templateParameters;

        $data = array_merge($data, [
            'menuItems' => [['href' => '/', 'text' => 'Homepage']],
        ]);

        $data = array_merge($data, $templateParameters);

        return $this->renderer->render($template, $data);
    }
I basically want to access an array defined in the Configuration.php file.
I try to do so with the global keyword.
I did the same thing in the Configuration.php
 
@HassanAlthaf Stop using global state
 
show Configuration.php and use paste bin
 
Here's Configuration.php:
<?php

namespace Blog;

global $templateParameters;

$templateParameters = [];

$templateParameters['websiteName'] = "Hassan Althaf";
Oh, @PeeHaa what alternative do you recommend?
 
your namespace does nothing
 
I use Composer
 
10:52 AM
namespace only works for classes and functions
 
So, I thought it does
 
Either pass in to the constructor or the actual method
 
Oh yeah!
Thanks @PeeHaa
 
Is there anyone familiar with php's vm on master branch (aka phpng)? I just wanted to confirm are we always emitting a INIT_*CALL opcode when calling a function now? Because I see that in 5.5 we were omitting this opcode when function could be resolved at compile time 3v4l.org/HQOd9/vld Looking at the code in zend_compile.c and just doing some debugging shows me that INITs are always emitted now, am I right here?
 
@PeeHaa Please how?
 
10:54 AM
How what?
 
how will i unwrap the spans as you said @PeeHaa
 
Get all the children of the spans, insertBefore the parent, remove the parent
 
> About us: We are god people
 
Wow. No we ain't gods.
 
@SergeyTelshevsky @HassanAlthaf Lol here. it was an error. i meant good
 
10:59 AM
Oh.
 
LIMIT ? OFFSET ? ", array($from, $to, $limit, $offset)); //mysql syntax error
LIMIT " . (int)$limit . " OFFSET " . (int)$offset , array($from, $to)); //works
I'm running mad, I don't get it - that's the tail end of a query
 
@iroegbu Are you binding as int?
 
like array($from, $to, (int)$limit, (int)$offset)
I'm sure they all ints any way... it's not user generated
 
@iroegbu That is not binding
Show me how you are binding and executing the query
 
oh! One moment
pastebin.com/CUNew943 $conn is Doctrine\DBAL\Driver\Connection
 
@Ja͢ck, Is there a >=< operator for the inverse of <=> ? — Pacerier yesterday
 
@iroegbu That is the working statement. Not really useful if you want to know why the non working statement doesnt work :P
 
@Ja͢ck >=< looks like a nice 'bug' operator
 
Yeah
 
if (false) { throw >=<; }
 
11:15 AM
array_map(>=<, $arr)
 
pastebin.com/4EmyJGp2 this fails with "SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''20' OFFSET '0'' at line 10"
 
@iroegbu It is bound as string not int
@iroegbu I just checked the source and you have to pass the third param to executeQuery
 
mysql supports offset?
 
I thought it did
not sure though
 
11:24 AM
I don't think it does
it's LIMIT <limit>, <offset>
 
@FlorianMargaine it's both syntaxes
 
my bad then
 
Yes and you should feel bad :P
 
:)
 
11:26 AM
Shame on you!
 
moin
 
drowns in shame
 
morgen @DaveRandom
@FlorianMargaine :-)
 
ooh, a wild @DaveRandom appears
 
I am very wild
 
11:26 AM
@iroegbu if you pass the correct param types it should work
 
@JoeWatkins Here's a cool use of pthreads :P
Oh you saw already
 
@PeeHaa thanks
 
Boo
SO is down
 
thought it was just me
 
11:36 AM
lol
That XOXO lol
Login is currently unavailable
The feature you're trying to use is currently unavailable.

We're doing a bit of maintenance right now and have put the site in read-only mode so that you can still access all the questions, answers, and general knowledge goodness.

We'll enable all features of the site as soon as maintenance completes.

XOXO,
The Stack Exchange Team
I don't want your kisses unless there is hot girls available to give me some. ;]
 
I prefer girls to be at room temperature
Well, whatever that means lol
Sounds a bit dark, though ...
 
Don't think I could fathom building a MC server in PHP
 
minecraft?
 
Yeah
 
@Ja͢ck 37C is pretty warm for a room
 
11:46 AM
between when I open the minecraft site and now... 8 people just bought it
 
@DaveRandom Who said anything about 37c :P
 
@PeeHaa Just because you're into cold-hearted ice maidens...
 
:D
 
that's normal in England (37c)?
 
lol
 
11:48 AM
37c is most certainly not normal. Most aircon's I've seen only go up to 28C
 
I understand
 
It's current 2C outside
And about 18C inside
 
37c can pass as room temp in some parts of Nigeria... easily
 
I had 41 in Italy once, that was as hot as I'd ever like to be
Actually my brain stops working properly after about 25
 
11:50 AM
@DaveRandom I've done 50 on a boat in turkey
 
fts
 
it's 36 where I am now... by normal standard that isn't hot at all
 
Yeh I'm not on board with that
Presumably you have aircon though?
 
Yes, I can do without it though
 
I don't know if I've ever seen 36 in the UK, thankfully it rarely gets past 30 even in high summer
I'd much rather live in Alaska than central Africa
 
11:54 AM
Server room is coldest part of the office 14C
Rain forest, where I am now... Southern Nigeria. Up North 40C is very normal
 
Server rooms are awesome for when it's hot during summer.
 
This is the nicer season for us, temperatures range between 24(deg) at night and 32 at noon.
 
Hey guys, I'm using FastRoute by NikiC on GitHub.
My issue is,
I am using this route:
 

« first day (1585 days earlier)      last day (3360 days later) »