« first day (1473 days earlier)      last day (3471 days later) » 

12:05 AM
@ircmaxell one hour… If there's a transcript I'd love to read it… but well listening is not my thing...
 
Thank you @ircmaxell for reminding me about that function_exists thing. I haven't laughed that good in too long.
 
@bwoebi it was towards the end. Maybe last 10 or 15
 
12:23 AM
@ircmaxell I tried listening 5 minutes. I can't really follow. Understanding most words, but you're all speaking English like always. That means, a bit too fast for me to grab context...
I'm already not understanding everything in normal conversations in my mother tongue… (but usually getting context) but English at normal speed…
 
12:56 AM
@JoeWatkins there still are bugs with quitting :-/
prompt> c
[Script ended normally]
shouldn't happen…
 
You were told there would be an earth shattering kaboom?
 
@DaveRandom I sympathize fully, in a non-pure tech environment, "do it right the first time" is the better strategy in my experience. Even if you don't have the time or the requirements.
 
@bwoebi bugs in the debugger? Better build phpdbgdbg
4
 
:-D
gdb/lldb are fine^^
 
user895378
1:55 AM
@Danack Marving the Martian \o/
 
user895378
Current level of debugging annoyance:
 
user895378
echo "OMG WTF\n";
 
While we've gotten by with the omission of type-checks for scalars, we should really have a resource type.
Having to is_resource is silly.
 
user895378
2:11 AM
F that. Resources need to go away entirely.
 
lol, optimism much?
 
user895378
:)
 
user895378
FWIW I'm not the only person who's expressed an interest in such a development.
 
I agree whole-heartedly, but in the interim (which is probably the foreseeable future) we could use a resource type-check.
 
user895378
Except that's totally useless.
 
user895378
2:12 AM
A resource hint could be anything.
 
No, it'd have to be a descriptor.
 
user895378
It could be a php://memory stream. It could be a mysqli resource. It could be anything.
 
Oh yea...
 
user895378
It could be a libevent event resource.
 
I forgot about those.
 
user895378
2:13 AM
I mean, it could literally be anything
 
Yea, nevermind.
Insta-conversion: fuck resources, we need a proper streams abstraction.
 
user895378
so even the is_resource() check leaves me uneasy when I do it (I still do sometimes)
 
user895378
We need streams for streams and everything else should be an object.
 
What? "Streams", or what we would touch of it, should be the OO abstraction.
 
user895378
I mean extensions should bundle up their C data into objects and not vague resources that could be anything.
 
2:15 AM
^^ Gotcha; yes, agree.
 
user895378
And if something is actually a stream of data it should be part of a better stream API that we have yet to create. That's all I mean :)
 
Yes, much agree.
 
user895378
But I don't have time to try my hand and I'm not sure if anyone else does. Lots of people want to kill resources (I think), but actually doing it is another story entirely.
 
I mean, people can harp all day about how this platform did this wrong, or that platform's abstraction is bad, but at the end of the day I far favor working with streams in .NET than PHP (and favor other platforms too, but C# is my 9-5 bread)
Yea, understandably it'd be a huge undertaking.
 
user895378
 
2:19 AM
U C WUT I DID THAR? long-ing sigh?
:-)
 
user895378
2:38 AM
Not going to explain my stupidity but suffice it to say I just found the source of a sanity-degrading bug I've been hunting and it was an epic ...
 
@rdlowrey Oh come'on, you can't tease like that; what was it? :-P
 
user895378
It was a problem in the test script I was trying to use to debug -- not the actual code.
 
I really hate when that happens.
 
user895378
Turns out there was no problem in the real code ... only the test code.
 
user895378
Stupid.
 
2:40 AM
That does suck
Today I was able to get an easy win... fixed a years long bug by hitting the backspace key 3 times.
 
2:59 AM
Dear god, are people so warped as to believe that $_PUT and $_DELETE offer anything at all?
 
user895378
@DanLugg dat comment
 
user895378
@DanLugg Yes. Yes they are.
 
user895378
I remember a time when I was just a young sparky and thought, "Hey, $_PUT/$_DELETE would totally be useful!"
 
user895378
Then I stopped being an idiot who knew nothing.
 
My cynicism may outweigh the sun, but seeing as we're going to be stuck with the HTTP "abstraction" we have forever, I think it would be beneficial, if only for semantics, that we rename $_GET to $_HTTP_QUERY and $_POST to $_HTTP_FORM -- I don't think BODY is helpful, because not all (and now, arguably more) message payloads aren't form encoded.
Does STDIN point at php://input when non-CLI? Can't remember.
I actually wouldn't mind:
$_HTTP_METHOD  => GET|POST|...
$_HTTP_URI     => Request-URI
$_HTTP_VERSION => \d+\.\d+
$_HTTP_HEADERS => [key => value]
$_HTTP_QUERY   => [key => value]
$_HTTP_FORM    => [key => value]
And, if (I can't recall which handles are opened where) $_HTTP_STREAM was an open, rewound handle to php://input
 
 
1 hour later…
4:24 AM
On this day: Remember Tommy Flowers http://blog.krakjoe.ninja/2014/10/remember-tommy-flowers.html #RememberTommyFlowers #php
/me goes back to bet for a while ...
 
posted on October 28, 2014 by Joe Watkins

Fig 1. Tommy Flowers MBETommy Flowers might well be a name you never heard before today, and yet, he should be remembered as one of the giants upon the shoulders of which we all stand as computer programmers. Modern computing was, at least in part, born of war, many technological advancements are. As a result of that, they can be shrouded in secrecy by necessity, robbing the people involved o

5
 
user895378
5:00 AM
@Danack I did a bit of hunting for the problems re: establishing new connections instead of reusing old ones. Didn't get very far ... will resume in the morning. Cheers!
 
5:10 AM
morning
 
5:42 AM
anyone there?
 
yes
 
hi! a quick question
I need to insert data into two different tables of two different databases
it should be smt like this :
$dbh1 = mysql_connect($hostname, $username, $password);
$dbh2 = mysql_connect($hostname, $username, $password, true);

mysql_select_db('database1', $dbh1);
mysql_select_db('database2', $dbh2);
I know
but my code is a lil bit more complicated and couldn't find a way
if you're available, can you help me arranging that on a fiddle etc.?
 
6:04 AM
do you think this would work?
 
6:26 AM
@EkinHazal please stop using mysql_* API. It is deprecated and has not been maintained in past 10 years.
 
@tereško but this is a quick project and should be okay I think if I can make it work... any suggestion?
 
6:42 AM
Just a quick question. the syntax '.=' is an invalid operator, right? Or does a decimal followed by an equal sign mean anything?
 
@JosephCasey $a .= $b means $a = $a . $b
@EkinHazal and how does that make any fucking difference?!
 
@tereško I see. Not sure why it was so difficult to find 'php .= operator' in google.
 
@tereško Thanks!
Haha ok
@EkinHazal Why not use mysqli?
 
@tereško easy man...
 
@JosephCasey thanks! that's a really useful info.
@JosephCasey so if I update that code as viper-7.com/JVeM0C is it better?
 
no , it is not better
because you obviously have no fucking idea how to use prepared statements
 
look, you have no idea if is it my code or not, I'm asking all these to improve it and myself, with that attitude you're just being an annoying person without any reason, then you put a video as if you're throwing a trash to someones face. enough.
 
7:03 AM
@EkinHazal watch the video
@tereško's language is colourful, but he's not wrong ;)
 
@JoeWatkins I have no problem with that, I'm spending all my fucking time on learning these. But I hate those kind of ways to give an info. That's why there is something called peer pressure.
 
don't cuss at me
chill, watch the video ...
 
7:30 AM
can I use DEFINE('_ARRAY', $array); aswell?
 
@Mi
@MikeM. it doesnt really make sense to define an array as a constant
array are mutable objects, that''s their nature
 
good morning evryone
 
morning
 
It's db info set in the config file written as $config[''][''];
yet all other files may not edit that array so I want to call that config file with an define...
 
7:33 AM
it still doesnt make sense
you might want to use a container and set these as configuration parameters
 
posted on October 28, 2014 by kbironneau

/* by OcuS */

 
good morings
 
> I'm spending all my fucking time on learning these (..)
was I the only one who found the tone of that statement funny?
@Duikboot fuck 'em and fuck their shitty framework
 
No Laravel fan-boy @tereško
 
7:56 AM
@JoeWatkins very nice post**!**
 
8:08 AM
:)
 
good morning
 
ThW
Morning
 
Always impressed about this guy blog: mathiasbynens.be
 
Good morning everyone.
 
8:23 AM
good meurning!
 
xD
 
9:04 AM
Mon to the ring
 
Tue is this ring
 
:P
 
yo
 
9:09 AM
morning
 
mornings
 
Hi Friends
 
hello
 
Hi
 
does anybody work with socketo.me ?
 
9:22 AM
I'm not your friend, buddy
 
@DaveRandom awwww
 
posted on October 28, 2014 by kbironneau

/* by MrJ */

 
he's not your buddy, guy
 
he's not your guy, pal
 
9:37 AM
i'm not your pal, friend
 
@Jimbo are you at IPC?
 
Omrning
 
crap. i mixed up the rooms. wanted to see a session about pentesting. now in a session to write faster javascript
 
@Gordon it's easy: don't use jquery
now you can go looking for the proper room
 
9:42 AM
If you have to login to scrape a site would you guys stick out PHP or use a headless webkit?
 
@tereško i feel its rude to leave now
 
@Fabien it would be simple enough with PHP
 
Depends how the login works
 
yeah, depends.
SO openid login, for example, is a bitch.
 
If it uses some complex JS mechanism to make a token or something you're better headless (i.e. Phantom)
 
9:44 AM
Fair enough. Phantom is going up as it is.
 
@Gordon make a big (fake or real) fart and then pretend you need to go to the toilet.
 
Should probably have asked that before sending it but whatever
 
hi all
 
@DaveRandom enough jibber-jabber ... github.com/krakjoe/php-src/compare/mutators write tests, someone else will do the syntax, eventually, probably ...
 
@JoeWatkins Write tests for the syntax I just suggested, you mean?
 
9:53 AM
write the tests for the syntax that is working right now, so that the implementation can be written, it doesn't really matter what the syntax is, what we want is a non-horrible implementation ...
 
Can i do this with pdo?
$db->prepare("UPDATE table SET value1 = :val1, value2 = :val2 WHERE id IN (?,?,?)");
?
 
Negative.
 
OK, no worries
@Julo0sS no, it's one or the other.
However, I do have a utility function for you somewhere
I presume you are trying to dynamically construct the IN() clause based on the number of elements in an array @Julo0sS?
 
@DaveRandom exactly
i have the 2 previous vars
 
Anyone used symfony web profiler toolbar in silex?
 
9:58 AM
i suppose that, in this way, i could put them as first elements of my array, and send it as value in execute statement...
so it would look like,
$db->prepare("UPDATE table SET value1 = ?, value2 = ?, WHERE id IN (?,?,?)");
 
@Julo0sS OK just a minute, I have a utility function I've used for it before, let me dig it out
 
$myArray = array($val1,$val2,$ph1,$ph2,$ph3);
..->execute($myArray)
@DaveRandom ok thx
@DaveRandom i go smoke a few minutes then :P
 
PDO really needs PDO::PARAM_ARRAY for binding
 
@tereško It really does
@Julo0sS 3v4l.org/KtWlv
@NikiC how difficult would it be to make splat work inside array literals to merge? (as in: $a1 = [4,5,6]; $a2 = [1,2,3,...$a1];)
 
10:18 AM
@DaveRandom I think it would be better to have more general infix op like + but for merging
 
@nikita2206 tbh I wish $arr1 + $arr2 === array_merge($arr1, $arr2) anyway, I'd certainly be up for having an operator that did that, but I'm not sure what it would be
 
+1
But you know
Bc
 
But there are some cases (see that 3v4l above, for ex) where I'd rather splat, it would be more readable IMHO
@nikita2206 Indeed, although if we can come up with a sane operator to use it would be OK
Maybe &
Bitwise operations on an array is never going to make sense
Not fantastic though
 
Though about the same yeah, & or |
 
Actually I suppose . would be OK
That's sort of what you are doing, concatenating them
 
10:23 AM
Heh, that could be break for some people
But yeah
Makes most sense
 
Why, because they are relying on two notices and a string of ArrayArray ? :-P
 
Actually no, sorry, I confused the outcome of this op, thought about array typehint
So yeah
Actually I have nothing to do
Will try if
It
 
@nikita2206 reason I would like splat inside array literal:
$v4 = $v1 + $v2 + $v3; // number? array?
$v4 = [...$v1, ...$v2, ...$v3]; // everything obviously an array
It just reads better
 
Dunno, for me it looks too specific
And you have to keep track of var types anyway
 
@nikita2206 iirc I looked at it once, and the problem (not really a problem, just didn't have time to fully investigate the impact) is that this routine would need to be moved to /Zend
I don't think that's really a problem though
Not sure about master, maybe there's something there already
 
10:29 AM
I think that's a kind of abuse ...
 
@nikita2206 true, it's purely about readability rather than enforcing that it's an array.
@JoeWatkins what is, sorry?
 
[...]
 
How so? Pretty unambiguous what it does. It's for stuff like 3v4l.org/KtWlv - I'd much rather have written array('val1' => 'Hello', 'val2' => 'World', ...$inData)
Apart from anything else, in that case it more accurately describes the operation I wanted to perform
 
@DaveRandom not difficult
 
In which case I guess you don't like the idea? :-P
 
10:36 AM
your code should describe the operation it wants to perform ... I just think splat currently makes sense everywhere it used, [...] doesn't give us enough to open the door to other quite silly uses, can't think of any ... we should keep it simple to explain ... we introduced it for a quite different thing ...
 
That's a lot of ... you wrote there ;)
 
@DaveRandom wow... any explanation pls? :)
 
trying to work ...
 
moin
 
@DaveRandom You work with Phantom much?
 
10:39 AM
Do any other languages allow it? It just seems like an obvious legitimate use to me, there are only two places where an expanded list of values make any sense, and those are fcalls and arr literals (nothing else actually takes a list, as such)
 
@DaveRandom Oh it's fine, I don't have anything against it. But don't want to do a proposal either.
 
Will you do a patch if I write a proposal?
 
@DaveRandom Yes, other languages allow it
Other languages commonly also allow the use in list() or their equivalent
 
I... don't get how that would work? list() does the opposite of splat
sort of
 
@DaveRandom It would work like variadics basically
list($a, $b, ...$rest) = [1, 2, 3, 4, 5, 6]; results in $rest = [3, 4, 5, 6]
 
10:41 AM
oic
Yeh I guess that makes sense
 
hi. i have a 12 digit number and i need to match certain patters like 4 similar continuous numbers or 4 digits in a row in increasing order. any help guys ?
should i use preg match or some other way ?
 
@Julo0sS Just loop over the values to use in the IN clause and create a string with the same number of named placeholders, each with a number appended to it. At the same time, create a new array with the same keys as the placeholders - then you just need to drop the string into place and pass the params in with the rest of them
 
@NikiC Uuuh, Improved array_slice :-)
 
I have seen people use quite a lot the following way of returning multiple results from a function: list($a, $b, $c) = someFunc(); but I usually use 'Data Transfer Object' that is just a simple object holding a few values used as a transaction: 3v4l.org/8l8gd What do you guys usually do? Isn't the list thing easier but more 'hacky'?
 
well, finally, it's just like if i put the IN params as a simple string into the query... would it work the way i asked over too? (changing the :val1 :val2 in ? and append them to the array i pass as param to the query?
 
10:50 AM
@ziGi Depends on the exact use case. In the example on my 3v4l I'd much rather use list() because I don't want to clutter the codebase with another class just for that
Also, there's really no difference between an array and a value object in that context
 
what if the second variable is not just a variable but a list of variables?
so how do you know whether something is big enough to split it in an object
or keep it as an array with multiple vals
 
anyone free ?
 
@Sajal use preg match
 
@ziGi ok thanks. can it return the no. of times the pattern was found ?
 
@ziGi There's no general rule, it's case-by-case. If you are returning a lot of distinct but related values, you probably want an object to represent them. If you are returning a lot of unrelated values, your function is probably too big.
 
10:54 AM
@Sajal I think you have to count them, I don't know
@DaveRandom let's say I want a controller to get from a Service Invoice with lines, basically it is a structure of a single array (the invoice header data) + N lines of arrays with the same structure (the invoice lines). I guess there should be a way to do it since you want the controller to get the whole data and not call twice the service to get first the invoice data and then the lines data
 
@ziGi actually i need this in a app where user will book 12 digit number. So different patterns will cost him accordingly. And in one level if the patters matches and used twice then cost is more. So by using preg match can i get the same ?
 
@ziGi $invoice->getLines() maybe?
 
@Sajal use nl1.php.net/manual/en/function.preg-match-all.php and then just do count($matches)
 
@Julo0sS yes but the order of the data then become significant. I personally would rather use names... but it's really up to you
 
@Patrick yeah, but that means that you have to keep the invoice header data and the invoice lines in an object, right? So in this case you have a Transfer Object
 
11:00 AM
@ziGi fyi if you wanted to OO that IN clause stuff up a bit and avoid the array return, I'd rather do 3v4l.org/MpCvF
 
@ziGi well not really a transfer object, this sounds more like entities
 
@ziGi yes this might work .. let me check. Thanks man.
 
@ziGi That's definitely a case for an Invoice class, with a $lines property, which is an array of InvoiceLine objects. That's not simple data, and those objects might have calculated data.
 
exactly!
 
It's hard to put into words exactly why that's objects and not arrays
 
11:02 AM
that is what I am saying
well I don't know
I usually check if the logic is more complicated and they belong together
then I put them in an object
especially if something has to be done internally within the structure
like calculations etc.
But, hey, thanks for the info :)
 
@DaveRandom That should be possible. I think you can start a proposal without a patch though, as it's pretty clear what it should do.
 
Indeed, just don't want to start a proposal if everyone is going to be like "screw that, way too hard to implement"
Will look at drafting something later
 
@NikiC in what cases would that be useful?
 
@ziGi It's a very common functional pattern, but probably not very useful in PHP. Mainly makes sense as the complement to supporting the same during array creation.
though I'd say that the first step should be to support keys in list(). Kinda weird that it can only do continuous integer indexes right now
 
Why do you have to return an array in PHP instead of passing a variable by reference to be altered inside the function?
 
11:15 AM
Because everyone hates references ;)
 
morning
 
morning @bwoebi
 
@NikiC why?
what's wrong about references
 
@ziGi that's the C way I guess...
 
@NikiC depending on the array size it has a perf impact. As when the array is manipulated it needs to be copied...
 
11:17 AM
@ziGi By-ref out params make for damn ugly APIs
 
11:40 AM
@JoeWatkins again, now hopefully resolved every issue related to file breaks and quitting.
 
I don't hate references, but I pretend to, to fit in.
Would supporting [$a => $b] = ['a' => 1] make the grammar ambiguous at this point?
 
12:02 PM
Hey guys, I have issues with a header i've added after a succesful operation
It gives me the warning in which it cannot modify the header though, I have no whitespace, I have ob_start on, buffering is on(which would mean ob_start isn't required) and at the end there's ob_end_flush
It works correctly on a different page though but not on one of the pages included in htaccess, is there a logical solution for this?
I'd paste the code but it's literally just "header("refresh:10;url=url.php");"
 
how can possibly be that CI guy says that loud and he's not trolled
 
@SergeyTelshevsky because not every developer lives in room 11 bubble
 
@tereško well, you don't have to even visit room 11 to understand downsides of that one
 
12:22 PM
641
Q: How to fix "Headers already sent" error in PHP

Moses89When running my script, I am getting several errors like this: Warning: Cannot modify header information - headers already sent by (output started at /some/file.php:12) in /some/file.php on line 23 The lines mentioned in the error messages contain header() and setcookie() calls. What could...

 
user652649
@LeviMorrison add min-width:250px; to h1.refname{} this should definitely fix any problem related to the page tools and the search field dropdown
 
@DaveRandom how about $array[...$list] = $thing; where it translates to $array[$list[0]][$list[1]][$list[3]] = $thing;
 
@tereško nooooo oO
 
why not ?
 
12:36 PM
because one shouldn't use arrays that deep usually.
Neither address them programmatically in that way
 
@tereško I'm not a fan of that, also intrigued as to what real-world use case you have for that? Seems like the sort of thing you'd hate, on the face of it?
 
tree-like things
 
hmmm
Will have to consider that further
 
access of deep tree leaves in php is a pain
 
I concede that if you do want to do something like that at the moment it's a huge pita, I can't think of a way that doesn't involve loop + references
Not sure if splat is the right way though, seems more like a case for a class in the standard lib (with methods like setLeafAt($address, $value))
 
12:41 PM
it would also address the news.php.net/php.internals/77809
 
@tereško I don't follow what the problem is there (the quote thing)
But then I have a UK keyboard so I guess I wouldn't
 
is was referring to the surrounding discussion of array paths in general
 
hi?
need help with regex
 
@Sajal what's your regex, problem, expected output?
 
required pattern is any 12 digit number with 4 same continuous digits or counting digits like 879644448576 or 879612348576
 
12:53 PM
so, and what is the regexp that you currently have ?
 
actually the input will be 12 digit nos. and need to match pattern
 
1 min ago, by tereško
so, and what is the regexp that you currently have ?
 
i don't know much of regex .. just searching for it but could not found any with my requirement
i don't have any
i need help
 
then write some, then come back
 
"or counting digits" can't be done elegantly with regex.
that said:
 
12:55 PM
you do not want "help", you want "free labor"
 
19 secs ago, by tereško
then write some, then come back
 
Any of you guys watching Tokyo Ghoul?
 
@Fabien nope...
 
@HamZa i don't want free labor just give me some hint and i will work on it further. I use this - /[0-9]{4}()/ but its wronge
 
@Fabien looks promising
 
12:59 PM
4 mins ago, by HamZa
"or counting digits" can't be done elegantly with regex.
 

« first day (1473 days earlier)      last day (3471 days later) »