« first day (1252 days earlier)      last day (3701 days later) » 

5:00 PM
@LeviMorrison You are missing a big section on signature validation ;)
wrt interfaces and inheritance
 
Ah, yes.
 
Doesn't "same as type-hints for parameters" cover this?
 
@ComFreek No, because return and parameter typehints have different variance (as in covariance / contravariance)
 
Informally yes, formally no.
@NikiC I think formally the terms are covariance and contravariance?
 
@LeviMorrison I think I just said that ^^
 
5:04 PM
Oh, didn't see the edit.
^^
 
ah, unsynchronized edits ^^
 
Also, you really think we should use different variance for it?
(I haven't reviewed this subject recently, need to go read up on it)
Think we should use invariant argument type and covariant return type?
 
@LeviMorrison I think our argument typehints are contravariant. Return typehint should be covariant
 
We allow function foo(Animal) to be overridden with function foo(Cat)?
I can't recall off the top of my head.
 
@LeviMorrison No, we allow the reverse. I think
 
5:13 PM
REPL time, I guess ^^
 
// not allowed
interface Animal {}

class Cat implements Animal {}

class Shelter {
    function adopt(Animal $a) {}
}

class CatShelter extends Shelter {
    function adopt(Cat $a) {}
}
 
@LeviMorrison Shelter is allowed, CatShelter is not.
 
@LeviMorrison You're doing it the other way around again ^^
 
5:22 PM
I was demonstrating what wasn't allowed.
lol
 
That would be covariance and a blatant violation of LSP
 
Beeeeeeeerrrrr o'clocckkk!! :D
 
Hello, salathe.
 
5:41 PM
Ugh, before I propose this RFC I need to fix the formatting of some of that stuff.
 
@LeviMorrison | array | callable
 
Oh right (was looking at older version)
 
I would also recommend mentioning the error type that is thrown on mismatch
 
What error would you recommend? E_STRICT like parameter mismatch?
 
And explaining why it's needed ;)
@LeviMorrison huh? isn't it E_RECOVERABLE_ERROR?
oh, I meant the case where you return an incorrect value from a typehinted functino ;)
 
5:48 PM
I'm not an expert on the PHP error levels.
You think E_RECOVERABLE_ERROR would be good?
 
wait, you mean to say that you don't know the exact meaning of the 15 different error types?! [we should add another type, so we have a power of two...]
 
REAL programmers are always clueless about error messages because they never get them
#Sarcasm
 
@LeviMorrison I don't think it's good, but I it's consistent with how arguments are handled
 
good morning. I'm learning composer, and hoping to bounce some questions off people. is composer used only for php packages? or do you use it for Javascript and CSS libraries as well?
 
@Hamster So programmers who write compilers only specify error messages for all those dumb programmers out there? :P
 
5:51 PM
@NikiC What error level do you think would be good, consistency aside?
 
@LeviMorrison Exception :D
 
That's the only good error level that exists ^^
 
@AndrewBrown I mostly use Bower and/or NPM for JS/CSS
 
can/should you use composer for JS/CSS packages? or does bower provide some additional features?
 
5:54 PM
I don't think Composer was specifically made for CSS/JS packages (see also here). But I'm not a Composer expert so I may be wrong
I also use Grunt to copy and bundle the files from the Bower / NPM directories.
 
hm.. i obviously don't have a strong understanding yet, but it seems silly to use composer and bower if they're both just managing dependencies
 
You're right. I hope that we will eventually get a unified package system for the whole web development area...
 
it's basically just downloading files, right? it doesn't do anything to them other than dl into your vendor directory?
 
It keeps track of the version numbers
You can update all package via a simple command, that's it. You don't have to keep track yourself and download every updated file (if you even notice an update!)
 
agreed. but in the end, it's just downloading the appropriate files into your directory. so who cares if it's a CSS/JS/PHP/whatever
from a cursory glance, it looks like bower.json and composer.json files are very similar as well. perhaps interchangeable?
 
6:04 PM
Nobody cares, you're right. However, the package maintainers have to set up their projects for each dependency management tool.
 
ok. so it's just going to become a question of competing standards (like everything)
 
I don't know if they are fully interchangeable, you can have a look at Composer's spec and Bower's spec.
Exactly.
 
so does composer act recursively? for example, if i have composer.json require a certain library, and then within that library it finds another composer.json file that requires another library
 
Oh, I don't know.
A quick Google search revealed: getcomposer.org/doc/faqs/…
 
oops. should've looked myself. appreciate it
 
6:15 PM
 
does composer work in any way with CDNs? or are they two solutions to similar problems? i guess this would have more to do with JS/CSS libraries since you wouldn't (?) CDN a php library
 
@AndrewBrown Why would you need a CDN if your package manager downloads the dependencies anyway?
You only embed a CDN in an HTML document or the like. Or do you mean automatic embedding of CDN URIs in HTML documents?
(I must leave now... 40 minutes until the shops will close)
 
thanks for the help. really appreciate it!
 
@webarto beer push origin master (:
 
:D
Erdinger is the bestest beer
 
6:22 PM
^ read as "best test" Oo
so best beer to test? :D
 
good morning all. I was wondering why using file_get_content to run POST transactions is not more commonly used instead of cURL.
 
@bdb.jack Setting up a POST via PHP streams is annoying. curl is slightly less annoying. Therefore, curl wins. You know what's less annoying though? Just using someone else's HTTP library so you don't need to deal with either of those horror shows.
 
do you have any suggestions for libraries to use?
 
I've used one from PEAR, I've used one from Zend Framework...
Guzzle is apparently the new hotness, but it's trying to do things more complex than standard HTTP requests.
 
i'm looking at it now... very nice.
that's actually perfect for what i need... except that it requires a min. of 5.4
as much as i hate to admit it, the people I work with have PHP versions all the way down to 5.2
and they don't know how to update / upgrade it
 
6:45 PM
@bdb.jack Artax by Lusitanians mom boyfriend @rdlowrey.
 
user895378
hehe
 
user895378
If you wanna see how guzzle stacks up to artax performance-wise: github.com/Danack/AsyncRequestTest (hint: it's a pretty big difference).
 
user895378
I created artax because guzzle didn't meet my needs.
 
user895378
Beyond that, there's only one HTTP client in the entire universe of PHP that's capable of working in a non-blocking environment.
 
> as soon as they, which is it's
PULL REQUEST
 
user895378
6:48 PM
Granted, there are quite a few changes I plan to make before it can finally be declared v1.0.
 
I look forward to drink a pint of beer in the name of v1.0. when the moment comes.
 
7:00 PM
@webarto very nice.
 
@webarto Will you drink 1.1 pints of beer when 1.1 is released?
 
Actually, I'll drink (in) Liter(s) in any case :P
 
user895378
That moment when PHP ruins your perfectly-aligned constant names because you can't use keywords ...
 
user895378
const NEW = 1; // F U
const TXT = 2;
const BIN = 3;
const END = 4;
 
7:16 PM
@rdlowrey You could always just add a unified prefix such as A_
 
user895378
@bwoebi what was the reasoning again for why your RFC on this matter didn't pass?
 
@rdlowrey the code to do it was rather... not clean
 
user895378
Ah, so it was implementation issues and not a philosophical thing.
 
anyone here ? have some doubts with using DOM, specially simplehtmldom
I want to grab the data in the <p> tag here http://puu.sh/7E5ti.png

For that I need to use this right
foreach($html->find('#mw-content-text') as $element)
print_r($element->p). '<br>';
 
7:36 PM
I hate compiling some times
 
user895378
:) Insert XKCD link here: _____________
 
anyone has any clues on that dom thing ?
 
HAH
 
no, I'm in dependency hell
I am compiling 2 versions of "php" side by side
one builds fine
 
user895378
oh fun.
 
7:38 PM
the other complains about a missing libxml2 parser.h
 
@vongolashu What does data mean?
 
the text inside that <p> tag
 
foreach($html->find('#mw-content-text p') as $e) print_r($e->plaintext);
 
CRAP... WTF
 
can I blow you a kiss ?
:D that solved it
how will it look if you want to search that only within a div tag
like div tag with id=mw-content and the <p> tag within it
 
user895378
7:47 PM
@ircmaxell I had an error message like that a few weeks ago. What OS are you using?
 
Goobuntu
 
user895378
IIRC I ended up manually building libxml and passing the relevant directory to the PHP configure switch.
 
But it builds fine on 5.4.23, just fails on this branch
WTF
 
user895378
weird
 
user895378
♫♫ It's Friday, Friday! Gonna optimize away extra function calls in hot code paths with goto on Friday! ♫♫
 
7:54 PM
Wiki.php.net Feedback: Left or Right? i.stack.imgur.com/Cw9hL.png
 
user895378
Don't have much of a preference. Would maybe lean towards A if forced.
 
@LeviMorrison make the colors or sizes different, and Right. Otherwise, left
yay! got it
freaking PHP...
--with-libxml-dir=/usr <-- no include/libxml2, that's assumed. And there's no check at all in github.com/GoogleCloudPlatform/appengine-php/blob/master/…
 
hey people
 
@LeviMorrison Left, because it has different header sizes
 
crap, that gets it to compile, but now it won't link... WTF
 
8:07 PM
suppose you have a array returned and you want its first object/array to be assigned to variable
how do you do it ?
 
@vongolashu Assuming zero-based and 5.3 compatibility required, list($value) = func();
 
My code is $hero_intro = $data[0]->find('p');
However to access the data in $hero_intro I need to use $hero_intro[0] since all data is stored in its 1st sub-array
so is there any way to assign the first sub-arrbay itself in my first call rather then doing [0] in my other calls ?
 
ARG, it's not linking...
PHP/AppEngine-5.4.19/php-src/ext/xmlwriter/php_xmlwriter.c:656: undefined reference to xmlFreeURI'`
 
@NikiC so in my case it will be like what ? since I have a array
 
guys, anyone tried using opcache on 5.6 recently?
 
8:11 PM
no
 
I'm getting a segfault on startup
 
$data[0]->find('p'); returns me a array whose first aka [0] element I directly want to assign to my variable, any clues ? :(
 
@LeviMorrison Left, looks cleaner.
@vongolashu What php version?
 
I thought I broke something, but I get the same on a clean build :/
 
5.3~+
 
8:12 PM
If php 5.4 then you would: $firstP = $data[0]->find('p')[0];
 
btw @webarto your solution earlier helped :) Thanks to that I am finally able to get my data but since its returned in array I need its first element now
nah tried that
error shows up saying invalid [
 
@vongolashu list($value) = as I already said...
 
Niki can you post full code for my requirement ? what you said is kind of confusing for me
 
That should work on 5.4, right?
 
@vongolashu that means that your php version < 5.4
 
8:14 PM
I dont know you meant it as $data[0]->find('p'); = $hero or what
 
@vongolashu list($firstP) = $data[0]->find('p');
 
@bdb.jack thats what I said -_- 5.3
 
:15420609 A packet was dropped on the way to your browser ;)
 
worked :O
what does it do btw ?
creates a single entry list or what
 
*magic*
 
8:15 PM
>_>
I just need to create all my other data holder variables in that list format, right ?
 
If you look at the crystal ball everything will be crystal clear.
 
it's nice having a big machine: make -j16
 
@vongolashu the only way to get past that would be something like this: $var = $data[0]->find('p); $result = $var[0]
 
@vongolashu No, it depends, you're probably doing something wrong to start with...
 
typing list once is better than adding 2nd line :3
My code became this

//All Hero data in DOM object
$data = $html->find('div#mw-content-text');

list($firstP) = $data[0]->find('p');
echo $firstP->plaintext;
 
8:19 PM
@ircmaxell That's a nice number
 
Thanks @webarto and @NikiC that solved the problem, seems I will stick to list as its a cool way to manage the variables at once rather tencreating them line by line for same array with sub arrays
 
now, if only I could get the freaking thing to link against libxml...
 
With that much -j the configure probably becomes real slow in comparison
 
You suck @vongolashu :) ... echo $html->find('div#mw-content-text p', 0)->plaintext;
 
it is really slow, by comparison
 
8:20 PM
@webarto actually the reason I removed p was
 
@ircmaxell Yeah, I get to do that on our clusters ^^ It's really nice.
 
I need more data from the content which is not in P but other tags
so now I can just find those tags directly in that dom object I created by rmeoving P from your object xD
 
@vongolashu Right, then it would be $data[0]->find('p', 0)->plaintext...
 
yeap
works magic :D
hey btw, what library or class you recommend for not-so-advanced devs who wish to create a API
I used slim API framework, it was a bit confusing but I got it to work like I wanted, though the code isnt too clean and it doesnt feels a "good" API

Kind of a chinese iphone version
 
That's a vague question, and anyone that recommends something would be bullshitting.
 
8:24 PM
LDFLAGS="-lxml2 -lmcrypt" make fixed it... SIGH
 
anyone think this has a nice theme?
 
@Jenny the blue font in the footer is an eye killer
 
@Ryan rest is fine?
 
@Jenny the yellow fonts on the lesson pages are bothering my eyes also; but i've been staring at this screen for 8 hours now, so that doesn't help.
@Jenny the second one seems like a lot less busy on the eyes; i'd prefer it over the first
 
8:28 PM
@Ryan I did not put yellow.. green might be
 
@Jenny perhaps a shade of orange found on this page: javalearnsimply.weebly.com/lesson-1.html
 
@Ryan ok then you can learn my language there without eye pain over first one
 
make test needs a -j parameter
 
@Ryan ah I have to adjest the color what color might be goood?
 
@Jenny perhaps green?
 
8:32 PM
@Ryan thank you Ryan
 
@Jenny you are welcome
 
@webarto thr ?
 
@ircmaxell You are sighing awfully lot today.
 
what kind of DOM tree would look for this TD tag ?
 
@vongolashu What does that mean?
 
8:43 PM
I tried to reach that TD like this
$hero_basehp = $data[0]->find('table tr table td'); //Get Hero name,team,statgains
print_r($hero_bashp);

But it shows blank (no dom object)
oh god
never mind, my print missed a "e"
 
What's the best/most solid way to put a licence on a piece of software written in PHP? Putting some sort of phone home code in the application code obviously is not going to work because people would just take it out
 
9:07 PM
@David A determined human will always be able to remove it somehow.
 
Yeah
Goddammit
 
The only thing you can try is to make it too annoying to crack.
 
I see zend offer this zend guard software, $600.....
 
Put several checksum checks in unrelated files and blow up everything if things don't match.
 
@webarto I was compiling PHP... what did you expect?
 
9:08 PM
@David It's crap, I broke in trivially in less than an hour.
 
And there is no guarantee if someone messes around with it enough they won't get it back to plain text
 
Same with IonCube.
 
@ircmaxell I vaguely remember I did that once, had to get drunk to forget. Good luck :)
 
Charging 600 is a bit steep if it is trivial to decode
 
@David These protections are great against casual viewing.
And that's what they'll tell you as well
 
9:09 PM
screw you Symfony
 
There are services out there that will do it for you quite easily for very little payment (I managed without paying as well)
 
@ircmaxell hhvm something?
 
@NikiC appengine something
 
@ircmaxell ah okay
right, you're with g not f ^^
 
9:14 PM
It's G and F :P
Dec 17 '13 at 15:20, by webarto
FUCK YOU SYMFONY
Related.
@SecondRikudo Anything for ioncube, newer versions?
 
@webarto Define "newer"?
I haven't tried in a while
 
If I remember correctly that's 4+...
 
@webarto I remember 6
There's already an 8 XD
 
O_o
 
@webarto decry.pt
Depending on necessity you can use their service
 
9:20 PM
> Decryption Possible: License File Required
I reckon if I have a license I would opt them.
Thanks, I "protected" some code with it, just checking if it's possible to decrypt it online for free.
 
@NikiC :-)
ARG, open_basedir
 
@ircmaxell strpose, doge likes :D
 
I need to merge a patch I have been rallying against
 
arrgh, why the heck did we ever put opcache into the distribution :(
 
@NikiC I voted against it ;-)
 
9:24 PM
it's so much not fun trying to make opcache compatible with some change
it's like this every time
you think that you can do some quick change, but then you spend countless hours trying to fix all the places where code relies on implementation details :/
 
because of bullshit designed code
 
@NikiC What are you working on that is giving you issues?
 
9:47 PM
Any advice on how could I convert:
Class::call( 'Currency',
    'add',
    $this->getAmount(),
    $amount )
To:
Currency::add($this->getAppliedAmount(), $amount);
 
__callStatic
 
I'm sorry, yes, but I meant, the actual code (line/block).
"$matches[1]::$matches[1]($matches[3])";
We all know this is going to break.
Not limited to given example, moving huge codebase. Thanks.
 
list ($class, $method, $arg) = $matches;
$class::$method($arg);
 
10:03 PM
@ircmaxell I think he's talking about refactoring code
 
:-)
like, as in a script?
 
Yup :)
> /(([^()]|(?R))*)/
Kill me now.
->new dejan$ du -sh
648M    .
Many, many, scripts.
 
holy crap
 
@LeviMorrison Basically just shoving 8 bytes (for zvals, otherwise 32 bytes) off the bucket structure. Looked like an easy saving, without many changes (actually more removal than addition). And then I enabled opcache ^^
@webarto How huge are we talking about? How many of those calls are there?
 
10:11 PM
Give me a moment, please, thanks.
There are 872 classes, pretty much all of them called with this "proxy" class. Point is to get rid of that and just use e.g. (new Class)->method(args).
It's 10 years old code in means of architecture, been updated many times but this thing left unchanged.
 
@webarto So what you need is Class::call('ClassName', 'methodName', $args) to (new ClassName)->methodName($args)?
 
Yes, Nikita, only thing is that it's not formatted like that, but chaotic.
 
@NikiC ask Dmitry, he'll do it for you…
 
So add a few \s* in there?
@bwoebi too late
 
@NikiC remember it for the next time…
 
10:23 PM
$code = str_replace(["\n"], ' ', $code);
$code = preg_replace('#\s+#s', ' ', $code);

preg_match('#Class::call\(([^,]+),([^,]+),(.*?)\)$#', $code, $matches);

$new = "(new $matches[1])->$matches[1]($matches[3])";
@NikiC so you think I should improve regex foo and do it like that? :)
 
@webarto It looks so awful, I'm really missing the /e modifier.
 
I'm just looking for confirmation so I can blame it on someone :P
 
@webarto That code looks ... really weird, but basically yes
 
Thanks guys.
By the time I finish this, new rewrite will be due, hah.
 
@webarto well, no use @rdlowrey strategy: rewrite everything as long as it isn't perfect, so that you never finish as humans aren't perfect.
 
10:29 PM
Haha, on that account my former boss used to say deployed > perfect.
 
(I'm just referring to Aerys not being in alpha yet… since 2 years…)
 
Yeah, but at least he wrote something like Artax, etc. I have zero legacy in past two years.
##############################
Domain: uvps3.stackoverflow.so
Server: uvps3.stackoverflow.so
Plan: UVPS3 (Amsterdam)
Action: Kernel Update
Date: Wednesday, March 26, 2014
##############################
@JoeWatkins @crypticツ etc.
 
11:12 PM
something must be wrong
because according to my profiling (which could 100% be falable), I'm showing this line as being the single biggest offender in performance: if (isset($this->classMap[$class])) {
theoretically, it could be a hash collision, but the chances of that are trivially small
/me runs away
 
@ircmaxell um, is that the only line of code in the whole project, maybe?
 
11:34 PM
@ircmaxell o.O
@bwoebi Hasn't been 2 years for Aerys, I don't think.
Artax, yes.
@NikiC Nice idea. Any amount of memory or CPU saving at no cost is a win.
 
@webarto yes?
 
Kernel update on 26th, regarding cv-pls.com @crypticツ.
 
@webarto you broke shit again? =oO
 
Nah, maintenance something something.
 
As long as it's nothing like the 96GB error log mess =oP
 
11:45 PM
LOL
 
Hey guys, I'm a bit confused about php methods.. tl;dr: Can they be defined/changed on an instance of a class?
$class = new Class();
$class->method = function(){
    return 'foo';
};
 
...kinda
 
Not like that? :P
 
That snippet would actually work.
But doing $class->method() won't.
You have to call it differently.
 
call_user_func();?
 
11:48 PM
Yeah.
 
sweet :)
 
You also lose all the inheritance type stuff.
 
new instances of classes won't get that method
^is that what you mean?
 
Yes, that would be true.
 
Yeah that's what I wanted
And I can use that to override a method that's set in the class definition, right?
 
11:50 PM
No, you can't do that.
 
so if $class->method(); was already set and you tried to do $class->method = function(){}; it would throw an error?
I don't mean would it inherit, I just mean can I change an already defined method as well as add new ones?
 
Technically these aren't methods.
They are functions attached to an object as a property.
So you can override other properties, yes.
 
Ah, ok. you can't override a method?
 
Correct.
You also won't have $this available to you.
 
I'm thinking: I want to set a default function
I could do that in the constructor
pass an anonymous function
That way the call_user_func() is consistent
 

« first day (1252 days earlier)      last day (3701 days later) »