« first day (1075 days earlier)      last day (3857 days later) » 

11:00 AM
well, not 0, but haven't touched Java in literally 15 years
 
so for you it does, for me it doesn't at all :/
 
@NikiC You don't like the mocking use case? That seems pretty clear cut to me...
 
@DaveRandom If it were accompanies by some code I might like it
 
I have in mind an example for that, @NikiC - imagine that you have some base class and you're binding some handler, which extends functionality of that class. You're doing that in custom 1-2 places, so you don't want to have entire extending handler
 
But I don't see how it's applicable
 
11:01 AM
that's the place to use anon. classes
 
mocking usually tests stuff like was this method called, with which params, how many times
anon classes might cover a very very small bit of the mocking cases
@AlmaDoMundo by handler you mean?
 
There are cases where you need a class for exactly one code path. There are cases you need private classes. Both are solved by this
 
@ircmaxell private classes are solved by this?
 
Well, not "solved" but this can be used
 
@NikiC - well, it may be some callback for such things as set_error_handler or more usual - some actions handler
 
11:03 AM
@ircmaxell I'm actually not even sure it can. @JoeWatkins seemed to have issues with class redeclarations when the same code path is taken twice (if I got that right)
 
Imagine having a doubly linked list class. Where you have nodes stored as classes. Nobody outside of the DLL class needs the "node" class, so you can create a private factory method which returns a constructed anonymous class...
 
@ircmaxell ugly
 
@NikiC well, then that needs to be fixed...
@NikiC why do you say that?
 
you have a "node" class, you even give it a name, so let it have a name
allow me to typehint a LinkedListNode
etc
 
it should never be exposed outside of that class though
it's a hidden implementation detail
 
11:04 AM
If you want visibility handling, implement visibility handling, not this.
 
so it should never be type hinted against
 
@ircmaxell in your own code
 
eih, don't really agree there
 
where?
@ircmaxell somehow you managed to make me like this even less
 
Whatever
 
11:05 AM
If introducing anon classes means people will use it for visbility handling, ugh
 
right
 
What's the point of anonymous classes?
I don't get it. :/
 
@NikiC it's not up to the language to dictate what features should be used for what
it's up to the language to make things possible in a certain way, and up to the community to determine what's a good use and what's not
 
What's a legit use case for anonymous classes?
 
/me quits
 
11:07 AM
I'm genuinely interested. I have never seen them used.
 
oh wait, already did that
 
@ircmaxell You're in a bad mood
 
no, I'm really not. I'm in quite a good mood
 
So what's the issue with a bit of discussion?
 
Are they class-specific classes?
 
11:09 AM
that's what this is? this is discussion?
 
@ircmaxell It isn't?
 
/me gives up.
 
@NikiC it's Stas style discussion. Pick one point out of 10 that were given, say "I don't like that, and therefore the feature is bad".
 
gist.github.com/nikic/b8fa227ae2f7df2ec916 <= I'd much prefer the first way here. It has a meaningful name and the implementation can typehint against it.
@ircmaxell I'm not saying the feature is bad, I'm saying that using it for visibility handling is bad.
 
And I'm only saying that's one possible use-case.
 
11:14 AM
@ircmaxell yes, sure. But I don't see a problem with discussing some particular use cases
 
@Starsong You can come hang out in the "I don't know what's going on" corner with me if you like.
 
@Fabien I'm in the annoying position where I half-understand what this proposal is, and half don't. I'd rather just have no idea.
 
read the RFC. It's linked on the right side
 
If it's nested classes, I don't see how it can cause any harm.
 
@Starsong heh.
 
11:15 AM
@Starsong it's not nested classes
 
@NikiC Yeah, I just read the RFC, for some reason I'm too stupid to read the starred links. :D
I'm still not quite sure I understand where I'd use it.
 
:)
 
@NikiC it's how it's being discussed that's the problem. Stas has the habit of using disarming wording, which means that it basically ends the discussion right at that point (there's no way to counter it). You did the same here. It's not good or healthy to a discussion
 
@ircmaxell what disarming wording?
 
13 mins ago, by NikiC
If introducing anon classes means people will use it for visbility handling, ugh
there's no way to discuss or disagree with a point like that. It's a personal view, but presented in a way that masks it as fact
 
11:20 AM
@ircmaxell Honestly interested, what makes that into a fact over a personal point of view?
 
@NikiC that's awesome
 
For all you console.loggers() Console API
 
Or how shoold the presentation be changed?
@ircmaxell It would be cool to have the same for PhpStorm ^^
 
@JoeWatkins so I've read your RFC
 
Well, it's how it's presented. You could have said "The potential for abuse scares me". It distinguishes that it's your opinion, and that others may disagree. It opens for "why does it scare you" vs being an absolutist or generalist comment
 
11:23 AM
But I can't see a use-case where this is needed, can you give an example? (And probably include it in the RFC as well later)
 
@ircmaxell okay, so let's assume that I said "The potential for abuse scares me" three :D
 
Ok, in that case, what specifically scares you? Or what specifically about using anonymous classes as private classes do you think is dangerous (or bad)?
 
@ircmaxell The fact that you are giving up a meaningful name (and all that comes with it, like typehints), just for the sake of visibility handling. Visibility handling seems a rather minor concern. Just add a /** @private */ declaration or a _ before the class name or something.
 
Love the Named Parameters RFC...
This would make my life SO much easier.
No more someFunction(1, null, null, null, null, null, null, null, 2); -_-
 
This may be a stupid question, but is there a good reason why class visibility at the language level doesn't exist (as in private class Foo {})?
 
11:29 AM
@Starsong TBH, if you have a function with 9 arguments, it probably does too much.
 
@NikiC Well, it's an implementation detail. It's less about visibility than about keeping the abstraction where it needs to be. And in the cases I'm referring to, type hinting (even protected or private methods) may be going too far... DLL may be a bad example, but...
@MadaraUchiha or needs a parameter object
 
@MadaraUchiha If you've never had to use someone else's (horribly written) functions, I envy you.
 
Also, the parameters most likely to be overridden should be first.
 
github.com/turkishdelighthorse /via @tobmaster on irc
4
 
@ircmaxell You have a better example maybe? In a DLL type hints sounds quite useful still.
 
11:30 AM
@Starsong Gotcha :P My condolences.
 
@MadaraUchiha Typically I see functions where someone forgot to add a parameter or made it do more later.
 
@Gordon That is someone with way too much time on their hands...
 
Ergo the arguments at the end are like return_keys_only or something.
 
@Gordon lol, genius
 
@NikiC an internal data structure representing complex types. You may want more than an array (some validation logic), but is really just a one-off
 
11:32 AM
@MadaraUchiha Though I agree, a lot of these functions could be broken into 5 or 6...
I think the worst function I saw was in a site I had to fix, it had 26 parameters and spanned over 800 lines...
 
@Starsong I'd rewrite.
 
@MadaraUchiha I did :P
 
@NikiC but the point wasn't that it's "possible" or "not", but that it opens doors to simpler code.
 
I made that function an alias to

function oldFunction(26 fucking parameters){
    newFunctionOne(3 of params);
    ...
    newFunctionSix(4 of params);
}
So as not to break bc
 
11:33 AM
after all, isn't that what a generator is? You can, by definition, do everything a generator does with an iterator... It's just a PITA. This is the same, although it's less of a pita and more just "yet another named class to maintain"...
 
Obviously I didn't name the functions that horribly. :P
 
And I have yet to find a single good usecase for Iterators vs arrays (except for the ability to traverse items which are generated on-demand)
 
@Gordon I can easily do the same with a for and $array[$i+1].
 
@ircmaxell For the record, I'm not arguing that "you can already do it this way" is a bad reason to decline something. Otherwise we'd have stayed with assembly. I'm more arguing whether anon classes really offer a better way.
 
@NikiC that's fair
And I'll respond to that argument with castle: flickr.com/photos/ircmaxell/9930012025
 
@MadaraUchiha well, the point is to encapsule the logic to make it reusable instead of writing the logic over and over again
 
hey friends
 
Hi @Dave-88
 
11:40 AM
@MadaraUchiha also recursing over an array is far more convenient and easy with iterators than with procedural code. and let's not forget append and multipleiterators
 
i'm freshman in php :)
 
We're happy
 
and i have a question
 
Is it a question you've already asked Google? ^^
 
so i have my form input
<div style="padding-top: 6px;">
                <input id="pin1" maxlength="1" class="login_input" type="password" onpaste="return false">
                <input id="pin2" maxlength="1" class="login_input" type="password" onpaste="return false">
                <input id="pin3"  maxlength="1" class="login_input"  type="password" onpaste="return false">
                <input id="pin4"  maxlength="1" class="login_input" type="password" onpaste="return false">
            </div>
        </div>
 
11:41 AM
well, HTML has nothing to do with PHP
 
i will insert datas in my postgresql
 
So, you're using 4 input fields for a 4 digit pin...
 
from my form
 
(Why?)
 
@NikiC well, to be honest, I think I'd rather have first-class anonymous classes... $foo = class {}; which could then open meta programming doors... But this would be very useful as well
 
11:42 AM
@ircmaxell which 'meta programming' do you mean?
 
@Starsong yes for the usability
but my question is
 
allowing code to modify and generate other code...
 
but that's sad
 
huh?
 
if the user put her code in the 4 inputs
 
11:43 AM
i.e. why do that?
 
and i will to insert the pins in my arrow from the table
 
because it's extremely powerful, and can lead to some patterns and simple code that's not possible with more static systems.
 
i must define a array
or variable
 
or if it's possible, it's not easy or trivial
 
Wow, Ted Cruz is still going. I love this man.
 
11:44 AM
@Dave-88 Wait, I need to understand for a second there.
Why do you have 4 inputs again?
 
for my usability
 
@ircmaxell but they always say that such things as eval (which obviously can provide any kind of code's modification at runtime since dealing with it as with string) are evil
 
is better for the user
 
and I see why
 
@Dave-88 your inputs are missing the name tag. And if you use name="pin[]" it will create an array from what they enter.
 
11:45 AM
@Dave-88 What kind of usability do you possibly gain?
How is it better for the user having to type into 4 different fields?
 
@AlmaDoMundo eval is not meta programming. It's something else... Check out JavaScripts's prototype model. That's meta-programming
 
@Fabien yes that right
mom i put the name into the input tag
 
@Dave-88 I don't think your mother is here in this chatroom.
 
@Dave-88 onpaste='return false' won't prevent from pasting, don't rely on that. :)
 
ok, I'm off, going to get ready for my talk. Later
 
11:47 AM
SO chat is more of a code review than a help section :P
 
okay i understand it
 
@Ocramius twitter.com/mathiasverraes/status/382831390879797250 is right. you are wrong. naming is important.
 
@NikiC fixed code path thing, I think ...
 
@JoeWatkins for inheritance as well? you mentioned you had an issue there
 
@ircmaxell that's fair enough
 
11:52 AM
@Gordon never said naming is not important...
 
@NikiC yep
pushed ... I dunno how sound that is ... doesn't leak and works as i expect ...
<?php
function my_factory_function() {
    return new class extends stdClass {};
}

var_dump(my_factory_function());
var_dump(my_factory_function());

while ($i++<10) {
    var_dump(new class{});
}

while ($i-->0) {
    var_dump(new class{});
}
?>
I updated the rfc with this info ...
that was the only real problem ...
I gotta go out, we'll discuss later if youre around
 
"In the future, the app store business model will be no more." < wut?
 
@Leri if that will happen in 100 years - I don't care :p
 
@JoeWatkins Small hint about coding style: You should try to avoid leaving trailing whitespace (in blank lines for example)
 
@AlmaDoMundo I don't expect it to in 21st century. So we may not care :D
BTW, I expected more from them. I won't develop anything even just for fun.
 
12:08 PM
@Leri but may be in nearest 50 years they will invent immortality essence :p Then - sh*t - we will care :\
 
If I am routing everything through index.php and I have a function to explode the URL to help decided stuff... where would you store that function? Or name... basically helper functions. A routing class perhaps?
 
@Fabien Yes, a routing class
 
ty
 
@Fabien that's a 'classic' question
 
It allows you to expand outwards and have more and more complex routing rules
 
12:12 PM
yes, normally, you should divide your front controller and router
 
@MadaraUchiha Where would you guys put composer? In an application folder? or library or somewhere else?
 
@Fabien I personally have never used Composer
 
:(
 
You should ask @ircmaxell, I know he has
 
what is composer? oO
 
12:17 PM
Well my thinking is that if routing is application specific it should sit inside application. But my composer is in library because composer is mostly 3rd party. But I would like to use composer for autoloading. So I can either move it in to application or have a second autoloader for my application.
Or maybe my logic is wrong?
 
you could have one autoloader for 3-rd party stuff, and one usual autoloader - that's a sample. You should then store all 3-rd party libraries in one place - and, perhaps, have data structure (such as config or array) so your loader will know where to search
 
Two autoloaders seems redundant though
 
it's up to you
 
Maybe composer can allow itself to be loaded in to application and store required classes in a different location
I'll look it up.
that was I can move composer in to application and stills tore 3rd party classes outside
 
12:22 PM
Is anyone familiar with how PHP internally manages memory? If I'm passing a large array from one function to another, will a pass-by-reference reduce the load?
 
nice js-cat generator :p
 
Im trying to make a small blogpost about how to import a SQL file via SSH / Mysql.
http://pastebin.com/0hBj7yiB
Does that look ok to you guys?
 
@Duikboot why do that if you can achieve it via single command?
 
U mean mysql -p -u username database_name < file.sql ?
 
no
that's not enough for remote import
 
12:25 PM
@Duikboot Does mysql-client not let you remote login?
 
You mean I don't have to SSH first?
 
I haven't useed mysql in ages, but with postgres for instance I can just connect to any random system.
 
you can execute your commands directly in ssh
 
That's how I play schemaverse.com .
@AlmaDoMundo Yeah, the file being on another machine is why I didn't suggest that, but you could totally do that too.
 
@Incognito that's why it's not enough
 
12:26 PM
Hmm
So the way I do it is not the good way? ( I am new to do this because I had a very large SQL file and I didn't know how to import it.. and the solution I posted worked). But there is a better way then...
 
you can do it via: scp /path/to/local/dump.sql user@host:/path/to/remote/dump.sql && ssh user@host 'mysql -uUSER -pPASSWORD DATABASE < /path/to/remote/dump.sql && rm /path/to/remote/dump.sql '
that's one command
 
Oh cool
Is SCP automatically supported?
 
There's a lot of ways to do this.
 
you can omit last rm inside ssh if you want to keep remote copy of your dump
 
scp is in most places
 
12:29 PM
It's a good idea to .gz the generated SQL btw.
 
Allright.
 
@Duikboot if you have ssh, then - yes, you should have scp (at least your system will 'support' it)
@Jack - yes, true
@Jack the only thing is that remote host could not have gzip, but ..
 
When using .gz you have to extract it too?
 
@Duikboot yes
 
Yeah
 
12:30 PM
gzip > outputfile.sql.gz
something like that then?
 
just RTFM :)
 
@AlmaDoMundo I can do tutorials and read 1000x articles about this, I am just looking for the best practice.
 
gzip something.sql will create something.sql.gz.
 
@Duikboot man gzip
 
The cool kids do over-the-wire gzip of course.
 
12:32 PM
Allright.
 
@Jack The cooler kids just wire one machine's CPU directly into another's RAM.
 
Playing around with Symfony Security model ... its works :)
@Incognito Or use the butterfly :)
 
@Duikboot also make sure you have properly configured ssh-keys authotization - otherwise it will be keyboard-interactive promts..
 
@Jack What do you mean it works?
/is-symfony-(ab)user.
 
@Incognito I took an existing project and relayed the pipes to work with Symfony.
 
12:34 PM
Great thanks Alma !
 
@Jack You mean framework-inception or something else?
 
I had already implemented login system on Silex.
So the step to Security wasn't that big.
 
Silex is nifty.
Are you using the doctrine ACLs or anything like that?
 
Nah, my accounts are stored on Amazon DynamoDB :)
 
then matrix has you
oh my lord..
http://stackoverflow.com/questions/19005091/php-convert-encoded-string-into-image
my eyes..
 
12:38 PM
I don't use question flags often, but I felt compelled this time.
 
@AlmaDoMundo I'm not sure why OP decided that was a good thing to do.
 
which thing? To post raw data in question? Yes, that's sad
 
Yeah, that thing.
 
Beautiful jpeg.
 
another point - I have 3Gb sql dump which fails ..somewhere on 374573 row - so let me post all of them to question :p
 
12:40 PM
Go for it!
 
@AlmaDoMundo Can't you lint it or something?
 
@Incognito </sarcasm>
 
@AlmaDoMundo wooshing sound goes over my head
 
12:42 PM
@Jack that raw data was for
? :)
 
@AlmaDoMundo Nope, it was clearly a jpeg image :)
Stuff that starts with JFIF .
 
@NikiC I tidied up ..
 
@AlmaDoMundo I forget, what's all in that image. Brainfuck, Perl, C(?)
 
not perl
not C
 
It looks like C
 
12:50 PM
Definite Brainfuck.
 
@Jack - well, agree, may be C (skipped those # somehow)
 
Though the main() { ... } could be valid in any number of languages.
 
I think it is intentionally representing multiple languages
 
145
Q: What's the joke in the Stack Overflow 404 page code?

DexterI have journeyed thus and bruised into the lands of the error page on Stack Overflow. There, upon the hill I see a vision as such: For those reading with images off: # define v putchar # define print(x) main(){v(4+v(v(52)-4));return 0;}/* #>+++++++4+[>++++++<-]>++++.----.++++.*/ print(202*2...

 
Damn you
5 seconds too late :P
 
12:52 PM
lol, I knew the answer was on Meta, I was just trying to see if I (we) could decipher it.
 
Ruby, Python, Perl, C, Brainfuck and Befunge
Admittedly I've never heard of Befunge before
 
Noice.
It could be PHP too.
 
The print(202*2);exit(); certainly.
 
Yeah, just have to imagine the <?php.
 
Really, it could be any C-family language.
 
12:54 PM
-108 rep today :(
 
Yikes. Is someone fucking with you?
 
It better be worth it.
Started a bounty on this
 
@Jack wow.. -108? why?
 
Oh ok, just saw that.
 
hmmm i have a file in Util/AbstractTestCase.php. but when referencing to it I get
 
12:56 PM
 
WAT
No.
 
/_tests/Util/AbstractDatabaseTestCase .php
 
I use S3 for my current project. That class is 10x simpler.
 
failed opening required file
any idea's?
 
@Fabien github.com/aws/aws-sdk-php <-- that one.
 
$s3 = new S3(AWSACCESSKEY, AWSSECREKEY);
S3::putObject(S3::inputFile($path_and_filename), $bucket, $filename, S3::ACL_PUBLIC_READ);
 
Why S3::putObject()?
 

« first day (1075 days earlier)      last day (3857 days later) »