« first day (1495 days earlier)      last day (3443 days later) » 

8:00 PM
@tereško the accepted answer is priceless
 
(/me throws his book on the bed).. enough C for today...
How are you people doing? Anyone making any fun php projects?
 
@tereško I am trying to wrap my head around the domain models and data mappers
and I am still wondering, we were discussing with you this morning that you can have partially populated object right
 
"domain models" ?
 
sorry, domain objects
I've been reading PoEEA and got confused
with this one
 
Fowler adds "model" to everything
 
8:03 PM
Anyway, what I have in mind is the following, if you have a scenario where you have article(s) and each article can have multiple editors
since I guess you would have separate entities for articles and editors of that articles
how do you avoid the fact that you have to make one request to get the article and one to get the editors if you want to populate both
since I guess you would have different mappers for both as well
 
do you need to populate both ?
 
yes
 
why ?
 
in a single request I want to get the article information and the editors
to output it to the front end
 
single request to where ?
database ?
why ?
 
8:05 PM
it goes for any 1 to many relationship
yeah database
 
so, what information exactly do you need from an article ?
aside from it's ID ?
 
the text, the title
date of creation
etc.
 
then you are retrieving two DISTINCT things
 
i'm sending ajax Content-type : 'application/x-www-form-urlencoded' form values.. how do i retrieve this string in the backend php script?
 
so @tereško what you are saying is that I have to make two separate requests?
 
8:07 PM
@ziGi why would you want to retrieve both article's content AND information about all of the associated authors with as SINGLE SQL query ?
 
well isn't it faster to make a single request with a join rather than two requests?
 
@AndreaFaulds Well rarely is good enough for me.
ping @PeeHaa
 
there should be a method to parse that string.. or do i have to write a function for that?
 
pong @fabien
 
@Fabor You should've responded directly to my message, I had to Ctrl+F to find "rarely"
 
8:09 PM
@ziGi no, it's not, because you are sending across the wire a lot of duplicated information .. in this case the duplicated information can be like a megabyte of text in each "author" row
that it just stupid
also, keep in mind that in normal systems the DB and webserver are not physically on the same box
instead you should be mapping two separate things: Article and EditorCollection
 
@tereško maybe you misunderstood me. I select a single article (which might have a lot of text) and then just join the names of all associated editors. Which means tops a few KB of editor names
 
@JoeSaad did you send it from the clientside so the data is a string like key=value&key2=value2 etc.
 
heh
 
please dont
 
@RonniSkansing correct
@RonniSkansing thank you again for helping me debug the first problem..
 
8:12 PM
could you put the code in pastie? No problem, php and angular can be a burden when smashed together..
 
Ok I see, so basically what I have to do is a single request and in the Service which glues the DOs and DMs together. So what happens in the service is that I create an Article mapper and inject it into Article DO. I also create Authors Mapper and inject it into Authors Collection DO and then basically call retrieve on both by giving them the incoming article id?
 
@RonniSkansing
http://pastie.org/9730787
 
@ziGi something like that, yes
 
Just one final thing.
 
so basically the string comes as you said.. key=value&key2=value2
 
8:17 PM
Since the authors collection is meaningless more or less without an article shouldn't it be kept in the same DO as the Article DO, instead of making a separate one, or is that in violation with SRP?
 
@JoeSaad I am not familiar with the $.param thingy.. is it jQuery? Have you tested with just a string
 
@salathe I would have been more exact if I had said for every vote there are some people who vote no - without providing feedback as to why they're voting no. Even if people just said, "the ideas dumb and I'll never vote for anything like it" that would be better than the current situation where people vote no, and it's not always clear if there is a way for the RFC to be improved to their satisfaction.
 
no! it's angularJS
@RonniSkansing i got this from here scotch.io/tutorials/javascript/…
 
@ziGi It's not so much an SRP violation of a question of who owns the related data.
 
@RonniSkansing however, in he's retrieving in php, he knows the names of the keys.. in my case i don't know the keys
 
8:20 PM
Well the related data should be owned by the Article DO since it is an extension of the description of the article (John and Marry edited it) so in that sense the collection without the article information is a bit useless and I don't see any other case in which it could be used in such form
 
@JoeSaad says in the link you gave me it is jQuery, and I can not find that method in angular. Anyways, replace the data value with a encoded string like you mentioned "key=value&key2=value2"
 
Authors are an entity. Articles are an entity. The relationship between Article and Author is a property of neither of those. It's a completely separate thing. Exactly how whatever data layer you're using decides to represent this relationship is what you should do. Some will want another entity entirely to represent the editorship.
 
look at the last screens.. he was comparing jquery to angularjs
my question is in php, how can i actually read this incoming string
 
@Charles you are right, well aren't then Domain Objects compilations of Entity information that express details about different scenarios more or less?
let's say I have ArticleDomainObject that has single instance of ArticleEntity and a collection of AuthorEntity?
 
@JoeSaad it should be in $_POST, and the article clearly says it is jQuery not Angular (The above code is for a PHP server and jQuery is needed for the $.param function. )
 
8:23 PM
@Danack I'm probably one of those people. :(
 
then I inject this ArticleDomainObject with the mappers for both Entities and voila it knows how to obtain the needed information
 
the $_POST[] works when you know what you are retrieving @RonniSkansing
 
@ziGi That would probably be a valid approach, yes..
 
in my case, i don't know what are the keys, i want to get the keys themselves and store them in an array in php
in the article, he knows the keys, and that's why he's using the $_POST, is there a way i can use $_POST when i don't know the keys but just have that long string?
 
man nginx is awesome!!!!
 
8:25 PM
@Charles yes, and then you can state that this DO can be used in cases which require exactly this composition of information.
 
I had never found the apache configuration interesting
 
@JoeSaad I am not sure in which case you would not know what you are retrieving. But if that is the case, it should still be in $_POST, you could do a foreach($_POST as $key => $value)
 
I am luving the nginx configuration :D :D
 
@ziGi Right, just be sure to not get yourself bogged down by creating a new domain object for every composition of entities.
 
However, this would produce 2 queries, so the question is, should it be considered a problem or it's completely valid to do it like this?
 
8:26 PM
(credits to PeeHaa)
 
@Charles sure, that would be moronic since I would get clogged with a lot of DO's that are really specific and I want to reuse
 
@RonniSkansing ok cool, i'm trying this now
 
@ziGi I recently struggled with this exact same conceptual conflict and decided that as long as my queries are hitting indexes every time, I don't need to care about my query count.
 
@Charles good point, as some people say, don't optimize prematurely
 
@JoeWatkins do you know if either extension_loaded('apc') && ini_get("apc.enabled") or extension_loaded('apc') && @apc_cache_info("user") is the better way of testing whether apc/apcu is available for caching data?
er, cc @DaveRandom as I probably need to fix something.
 
8:31 PM
@tereško this is serious good stuff. Makes me think about everything in a totally different way. wow
@AwalGarg o/
You needed me @Fapbor?
 
@PeeHaa the docs here say rate is limited according to bytes per second... is it possible to limit them by number of requests in a period of time? I think a rough limit can be imposed by an exstimate of the max Size Per Request, but is that the only way?
 
@AwalGarg You looking for this?
 
@AwalGarg You will have a more enjoyable life once you learn how to google stuff effectively e..g. "nginx rate limit number requests"
 
@tereško stackoverflow.com/questions/5863870/… in this example here you give the mapper the DO, isn't it counter intuitive to do this, isn't it better to inject the mapper to the DO and then when you request the information, the DO would just use the given mapper to fetch it's needed information? That way you could swap out the mapper easily in the DO constructor
 
Looks like I'm an RFC grouch: of votes with a yes/no choice, I have more no than yes. :(
 
8:38 PM
@salathe \o/ tbh that's probably good - there's been quite a few dumb RFCs.
 
@PeeHaa is it possible without a module? (installing that module anyways ;p)
@Danack I am still learning google ;p Thanks, would take care :)
 
@AwalGarg wiki.nginx.org/Modules It's a built in module.
 
@PeeHee is way more positive than me, ~70% yes/no votes :D
 
The Safe Casting Functions RFC has been put to a vote. @TheodoreBrown
2
 
oh I thought modules have to be installed... bad me
 
8:40 PM
@salathe I love you either way :)
 
@TheodoreBrown By the way, I modified the RFC to accept + signs. Otherwise, nothing's changed.
 
Oh dear, I'm on equal grouchiness as Zeev and Derick!
 
@AndreaFaulds Awesome!
 
@salathe lol
 
hmm, lets see what happens when we break the rate limit!
 
8:41 PM
@AndreaFaulds I should be able to update my implementation tonight to match
 
@salathe I've tried to be hesitant in voting on things.
@TheodoreBrown Awesome. By the way, are you declaring CastException conditionally?
 
38% of people who have voted (on a yes/no vote) have never voted no, ever.
 
@salathe Interesting.
 
@AndreaFaulds Yes
 
@TheodoreBrown Alright.
 
8:43 PM
@AndreaFaulds You're more positive than @PeeHee, ~80% of yours are yays
 
@TheodoreBrown Oh yeah, by the way, CastException should extend RuntimeException, not Exception.
 
It would be interesting to think about what would happen if people were required to vote in every RFC.
Probably bad things.
 
@Danack Bad things if they couldn't abstain.
 
@Fabor the JS room had a blog for a few months that went well.
 
@AndreaFaulds I'll change that.
 
8:45 PM
If you have to vote Yes or No, a lot of things would be voted through without proper scrutiny, and a lot of things rejected... without proper scrutiny.
@TheodoreBrown Also, presumably, you'll merge that branch into master at some point ^^
 
@AndreaFaulds Yep
 
88% of voters have more positive votes than negative ones. :)
 
@salathe I've also written a lot of RFCs ;)
Then again, I've voted against some of my own RFCs.
 
The most prolific voter (Stas) has only voted in 75% of those yes/no votes.
Most have voted in far, far fewer!
If voting were a requirement, I think we'd never finish a vote :P
 
@AndreaFaulds Another difference in my current implementation is that it provides more information when a value can't be cast. Is this something you might change?
 
8:50 PM
so... all those guys who write the php that I among many use, you all hangout here?
 
@TheodoreBrown It's not something I intend to change, no. I suppose I could change it... but I don't really want to.
 
as in, the original php-src developer team, you guys are in that team?
 
@AwalGarg Some of the people that have contributed to internals hang out here, but not all of them, and not all of us have contributed.
 
oh my! I really some some of the names in the github contributors list!
THANKYOU SO MUCH GUYS!
 
We're glad to help :p
 
8:53 PM
that must be a superb thing to do!
 
It... has its ups and downs.
 
I wish I was enough knowledgeable to contribute...
@AndreaFaulds what downs?
 
@AwalGarg Toiling in obscurity, for one ;)
 
@AwalGarg Heated discussions...
 
@AwalGarg Well, you have to deal with PHP for a start...
 
8:55 PM
:P
 
@AndreaFaulds So if I read the RFC right, instead of doing (int)$var you'd do to_int($var)?
 
but still, it is an awesome thing to contribute to such a big open-source project. Thanks for all the hard work you guys put in for the language!
9
 
@Machavity Yes. The advantage is (int)"N/A" will give you 0 while to_int would throw an exception for nonsensical input like that.
 
That's actually handy
 
8:59 PM
I think I'm the only one here with their name in phpinfo()*smug grin*
 
Guys, any recommendations to autoload files in a good way. I have seen people do it per namespace, for example use Foo\Bar; then the file Bar.php is expected to be in folder Foo
 
@salathe I was thinking I should try to get into there... I could have THE BEST TITLE
"Random contributor who removed Logo GUIDs: Andrea Faulds"
 
@ziGi Check out spl_autoload_register. Then make a function that does the include for you
 
@PeeHaa I mailed you.
 
oh no, @JoeWatkins and @bwoebi are there too, sorry chaps!
 
9:01 PM
You got mail!
 
@ziGi There are a bunch of conventions. PSR-4 is popular.
 
@Machavity yeah, I have seen that some people create an Autoloader object in their indexes and use that but I don't like it
 
@ziGi Also, there's a system where there's no specific structure, and instead you have a program scan your codebase and build up an index.
 
@AndreaFaulds I'll check it, thank you
@AndreaFaulds but isn't that kind of slow?
 
@ziGi The main advantage of PSR-4 is it's a widely-supported standard, so Composer works well with it and can auto-generate an autoloader for you
@ziGi The index is done ahead-of-time (i.e. not when your app runs), I think, so I don't think it's that slow. Might take more memory though.
 
9:03 PM
ok, that's fine
 
So if my signup on the php wiki was simply never responded to, and the account now seems to not exist, is that total rejection then? So much for contributing.
 
@Fabor \o/
 
Still setup stuff but basics are there.
Theme is meh...
 
I would also contribute to the php-src once I am capable enough.
 
@AwalGarg Then you will never do it probably :P
 
9:06 PM
I will :P
I guess once I am 20-21, I would be able to...
 
I'm so busy with other things that I can't afford the time to spend on php-src
 
spl_autoload_register is only for a single file right? I mean if you include a file that has registered a function into another file, what happens?
 
@Fabor WTF it signed me up using some old gmail account I think
 
Lol. If you have a different email I'll send it there
 
@AwalGarg I guess I had the same idea, but looks like no. I'm trying not to let that make me feel angry.
Failing.
 
9:08 PM
@Fabor Neh mail was ok, my own screwup
 
Not that I have the skills to contribute :P
 
@ziGi ?
@ziGi Here's how autoloading works
 
Where there is will, there is way skill.
 
@ziGi In the event of a collision you'll get a E_FATAL, just like if you tried to name two functions the same
 
1. You include a file that calls spl_autoload_register, which registers an autoloader function
 
9:11 PM
Well of you need a resend just say @peehaa
 
user image
13
 
2. If you try to use a class or function that doesn't exist, before erroring it'll call that autoloader function. That function will then try to find that class/function.
 
@AwalGarg Are you studying?
 
@ircmaxell If the shoe fits!
 
@HamZa yeah... not the degree education, but yeah, studying.
 
9:12 PM
@AndreaFaulds yes, I got confused that every file needs an autoloader function defined to tell it how to load files, instead of having a single one
so why is spl_autoload_register better than using __autoload
 
@ziGi Ideally you'll only have one function that does it all
 
oh, that is good then
I got confused, excuse me
 
ThW
@ziGi allows multiple autoloaders
 
ah, I see
 
9:14 PM
@ircmaxell Does the idea of optional strict typing on a per-file basis (à la use strict) sound good to you? i.e. PHP would have type hints that are non-strict and implicitly cast by default, but you could choose, per-file, to strictly check your types when calling functions.
 
@PeeHaa haha it's even funnier when you understand french
 
@ziGi You don't actually need to include the autoloader in every file. But there's no harm in doing so.
 
@AndreaFaulds no, it doesn't
 
Assuming you use require_once which won't repeat includes.
 
@PeeHaa "for example, I will show you the 'function' I have saved registered this morning" hahaha
 
9:16 PM
@AndreaFaulds well if I have it included in my index php file since it is a single point of entry, should it be ok?
 
@HamZa They alwasy told me french was good for something when I was still in school :P
 
@ziGi Yeah sure.
 
Ok, cheers!
 
guys, y u no star my announcement that the Safe Casting RFC has had voting start
15
 
@AndreaFaulds ...really?
I have a draft to require all RFCs to to be 2/3 vote
:/
 
9:22 PM
@LeviMorrison I'm not delaying this 3 weeks so you can pass a 2/3 vote RFC first :p
 
That's really selfish of you.
 
Is it?
 
hello guys
where are you all from?
 
I go out for lunch and you've already sent it off.
 
9:22 PM
haha Earth
 
i plan on taking a class next semester using php
how do you guys like it?
 
we like it
 
what is it used for exactly?
 
@PaulLesny It's horrible
 
That is why we are in this room
 
9:23 PM
Am I going to have this discussion on literally every 50%+1 vote I make? :/
 
lol
 
:-)
 
Also, your RFC still doesn't say why filter_var doesn't do @AndreaFaulds
 
@PaulLesny programming
 
programming is frustrating
 
9:23 PM
@AndreaFaulds yes, which is why you should just do 2/3 vote
 
@PaulLesny It's actually not that bad, once you get past the gag reflex :p
 
hahahah
 
@LeviMorrison Well, unless 1/3 say I should do a 2/3 vote, why should I?
 
@AndreaFaulds string(4) “10.0” fail <- -1
 
im taking it next semster
and sql
have you guys taken that?
 
9:24 PM
@ircmaxell E_WTF_IS_UP_WITH_YO_QUOTES :P
 
@PaulLesny SQL is pretty awesome
 
@PeeHaa copy-pasta from the RFC
no
 
Carry on :)
 
lol awk...
 
1 message moved to bin
 
9:25 PM
@PaulLesny you seem like a nice guy, but that is not how things work
 
lmao aww okay
 
@ircmaxell That's a tricky one. It's not accepted by filter_var, but more importantly, why should we allow 16.0 but not 16.01?
 
it was worth a shot!
 
@PaulLesny Imma downvote one of your questions.
 
@PaulLesny wth you need 60rep for your course?
 
9:26 PM
@AndreaFaulds I don't give a shit what's accepted by a crappy API
 
its part of my grade, get 50 reps on stackoverflow
 
@PaulLesny wow, awesome :D
 
Ouch. First No vote for the little RFC that could
 
60**
 
@AndreaFaulds the fact that 10.0 is accepted means that "10.0" should also be accepted. end of story.
 
9:26 PM
@PaulLesny seriously?
 
@ircmaxell But 10.0 isn't accepted, the canonical representation of that float is 10
 
So today a classmate was amazed by my 10K rep...
 
@AndreaFaulds I don't know about you, but I write 10.0 in my code...
 
@AndreaFaulds wrong, it's 10.0, because that's the only way to initalize it as a float instead of as an integer
holy crap, I'm closing in on 80k
 
haha yes @hamza! cool class and cool teacher! its mobile apps
 
9:28 PM
@LeviMorrison (string) 10.0 !== "10.0"
 
@TheodoreBrown I got rid of that principle, though.
 
yes zigi
damn 1 star please, from a fellow programmer!
 
@PaulLesny getting rep is easy. You might even go suggest some edits to gain +2 per accepted edit
 
ThW
@AndreaFaulds of course :->
 
@PaulLesny Stop spamming and starring bullshit
 
9:29 PM
@ircmaxell You have a point. Hmm...
 
please
 
@TheodoreBrown I don't care about string representations.
 
lol =]
 
If I'm converting a float as in 10.0 to an integer, then why does the string representation matter?
That's exactly one reason the ext/filter extension sucks. It always casts things to strings first.
 
Hey Lesny. Don't ask for rep. You might lose some.
 
9:30 PM
:o
adios!
 
@LeviMorrison How would you get that string representation?
 
gracias amigos
 
@TheodoreBrown By using Python, actually.
 
@PaulLesny you have a nice girlfriend :D
 
that's why we should use strong typing
@ziGi hahahaha wth dude!
 
9:31 PM
@TheodoreBrown If I'm converting float(10.0) to int I should not be considering what the string representation of float(10.0) is.
That's exactly how the ext/filter gets so off track, as I have already mentioned several times.
 
@HamZa well the guy has his public FB on his profile description
 
1 message moved to bin
 
@PeeHaa yeah, you can basically feel the everything leaking into your chakra
 
@LeviMorrison It works to convert the float 10.0 to an int. Things get really messy as soon as strings that aren't exact ints are accepted, though.
 
@tereško :-D
 
9:37 PM
Any comments on: pastebin.com/99J0ftK9
 
@ziGi yes
use composer's autoloader
 
haha true
I just wanted to make my own
just to test
 
@AndreaFaulds, you might want to extend the voting a few days; the US has a national holiday on Thursday the 27th, and lots of people tend to take the Weds-Sun off.
 
@TheodoreBrown nobody is saying "123abc" should be accepted
 
Hmm
The only problem with accepting "10.0", to me, is intent.
If you've put that, you probably expect it to be interpreted as a float.
 
9:41 PM
A float which can be safely converted to an integer, yes?
 
@ircmaxell Right. But if "10.0" is accepted, should "10.0e+7" also be accepted?
 
@TheodoreBrown if it can be precisely represented by an integer, then yes
 
@ircmaxell Hmm, that's what I thought at first too but we rejected it for some reason after discussing with @NikiC.
 
@TheodoreBrown The problem with that value is it's not necessarily full-precision... integers tend to be full-precision. I'm not sure why I care, though.
 
@AndreaFaulds Your open issues section is not reflected in the voting block:
> While I'd prefer to return NULL on error, it would also be possible to return FALSE. As this seems to be relatively controversial, it will be put to a vote.
I'm not saying you should put that to vote; it's just a discrepancy I noticed.
 
9:45 PM
@LeviMorrison Oops, yes, I forgot to remove that :/
Fixed.
Not sure how I missed that, weird.
@ircmaxell An option there is to_int(to_float())
The main issue with that is the precision difference beyond 2^53
I've wondered about making to_number or something.
 
@Charles sorry for bothering you but I was wondering, when you have Entities, do you make the fields private and use accessors and mutators or you expose them directly through public. What are the benefits of using functions?
 
@AndreaFaulds no
@AndreaFaulds if you can exactly represent, then great. If not, then error
 
Can someone actually explain what is the difference between Entities and Domain Objects
 
Also, well, allowing exponents might lead to bugs.
PHP lets ints overflow to less precise (by 10 bits!) floats
Which is one of the more likely reasons your integers have e7.0 in them
 
Allowing scientific floating point notation for an integer parsing function? Wtf?
 
9:53 PM
That is probably PHP's fault.
I mean, they shouldn't have stored ISBNs as numbers anyway
But still.
 
Guys, please be at least a little bit practical. Sticking too much to PHP's "strings and number must behave exactly the same" is what got us into this crap in the first place. Don't try to uphold it where it makes absolutely zero sense.
 
@NikiC it started as "10.0" should parse as an integer
 
So, what'll happen is
 
since 10.0 does
I don't care about scientific notation
I really don't
 
@ircmaxell yes, and that's the point where you're putting bad PHP principles over practicality.
 
9:55 PM
but when talking sane type conversion, if 10.0 is a valid int, and "10.0" is a valid float representing 10.0, then it should be a valid int
 
9.78031E+12 becomes 9780310000000 and you've lost most of the digits of your ISBN, and nobody complained! Oh dear.
 
@NikiC disagree
 
@ircmaxell 10.0 is a float in source code, yes.
 
If you do accept "10.0" then you MUST accept scientific as well, by the very same argument
 
@NikiC Why is accepting "10.0" for an int bad, exactly?
 
9:56 PM
0x10 is also an int, that's not accepted (as a string)
 
Which is the reason why the argument is bad
 
010 is an octal int, that's not accepted (as a string)
0b10101010110 is an int, that's not accepted (as a string)
 
@NikiC Exactly.
 
@ircmaxell Not a slippery slope argument.
We're saying your reasoning applies to other things.
So why 10.0 specifically?
This isn't <unspecified bad things might happen for nonsensical reasons>, this is <that principle would also include this and that and these>
 
9:58 PM
you're making a data conversion function
not a input validation function
yes, they may be cross-used
but they are different tasks
with different requirements
you want to make filter_var behave that way, great
this is not filter_*
this are safe casts
 
These are data conversion functions with validation.
 
with data-loss validation
 

« first day (1495 days earlier)      last day (3443 days later) »