« first day (615 days earlier)      last day (4333 days later) » 

2:00 PM
and do the stuff that can generate exceptions and so on in another function. Yii also does it via setAttributes for example
 
When you close php://memory is it cleared?
 
Sem
@ircmaxell @blizz What can be needed to get a class in a stable state then? How can a class be instable in that case?
 
@NikiC Ha. beat me
 
dependencies
 
@NikiC internals2 link at the bottom is broken (extra ] on the end in the href)
 
Sem
2:04 PM
@ircmaxell doesn't that lead to optional propertys?
 
@Sem it kinda depends what you consider "data" in that object
 
@Leigh fixed
 
if you're talking about some active record pattern, it usually is a single array anyway
 
user895378
@Sem I think of constructors like a house. The House might eventually have furniture in it, but it doesn't require the furniture for construction to be complete. I can use methods to add furniture after the house is built but a person could live in the house just fine without the furniture. Plumbing or electrical wiring, on the other hand, are integral to making the house stable. Those are aspects of House that must be added during construction.
 
@Sem exactly.
 
2:07 PM
@rdlowrey nice metaphor :)
 
Could I get some design advices? http://jsfiddle.net/v9yLG/

I would like some suggestions on what to do with my platforms, site color theme is greys,blacks and reddish orange with white text.
 
@Krish I just got started fiddling with with php-src too. I got started the same way a lot of people get started with open-source stuff I guess, by being selfish :) - I found something I wanted changed, and then worked out how and where to change it.
 
user895378
@Blizz Well, it's a very popular one. I try to stay away from the tired Car and House metaphors for code, but a House is really appropriate when thinking about constructors.
 
never heard it explained that way... but it's one i'll remember if anyone ever asks me :)
 
Sem
@rdlowrey nice one, so for the user construction you would just need to give it a mysqli object for example.
 
user895378
2:09 PM
@Sem No!
 
user895378
The user doesn't care how it's stored.
 
user895378
It shouldn't know anything about the backend persistence of its data.
 
Sem
@rdlowrey What would be the Plumbing or electrical wiring then?
@rdlowrey also, how would you store your information in a db then? No update or insert function inside the user class at all?
 
Wouldn't the update and insert functions be inside the DB/backend class you are using?
 
I have the feeling this is going to turn into a pro vs contra active record discussion :)
 
user895378
2:12 PM
For your purposes a User is a simple DTO (Data Transfer Object) or Value Object. It's just a data structure. Your code will be much cleaner and more maintainable if you keep it separate from the persistence layer.
 
user895378
@Sem Read about the Data Mapper pattern.
 
Sem
Thanks for the help guys :) The help like this is a lot better than a tutorial or a lesson at my evening studies.
 
@Leigh : thanks for your insight .. now what do I want to change in PHP .. lol
 
I wish I once was part of a project where I could focus a bit more on the actual split between data and storage...
 
I would think you would want to build it like this:
$db=new DB($sqlver,$server,$user,$pass);
$insertdata=DB->insertdata($table,$columns,$data);
 
2:14 PM
unfortunately its all active record
 
user895378
@Blizz Yeah, I used to have that problem.
 
@rdlowrey what did you do about it? stopped working? :)
 
Active Record.... Sounds a bit CI-esque to me...
 
user895378
@Blizz No, I just stopped using ActiveRecord cold turkey.
 
Sem
@rdlowrey Basically that's the misunderstood "model" in failMVC? You create a seperate class for each class that needs to store things in the db?
 
2:16 PM
@rdlowrey it's cool for new projects but if you're mostly maintaining projects its not something that you can decide out of the blue
 
user895378
ActiveRecord is like the proverbial golden ring in a pig's snout.
 
user895378
It promises so much that it can't quite deliver on.
 
most project leads and so on don't really see the use of doing a makeover of that magnitude that "results in exactly the same functionality"
 
That's why I like my bosses -- They have no clue what it is I actually do -- so when I tell them we need something or need to do something -- they go with is..
 
user895378
@Sem It depends. The Model is a layer of your application that encompasses all that type of logic. "Models" aren't classes in a 1:1 ratio with database tables.
 
2:17 PM
with it*
 
@Sem but an active record usually encompasses a model
 
I got a job as a PHP dev today :D
 
congrats @davemeetsworld
 
thanks dude
 
user895378
@Blizz But thinking about an object as a model is wrong in the first place. There is no such thing as a model object.
 
2:19 PM
tubular!
 
user895378
All the ActiveRecord implementations I've seen conflate persistence with business logic. It's generally impossible to separate the two with ActiveRecord.
 
user895378
@Sem @tereško has a lot of good MVC and model-specific answers you can check out. Specifically: stackoverflow.com/questions/5863870/…
 
@rdlowrey most frameworks out there do it like that no? I can't say I have exhaustive experience in that area but I haven't really seen it done otherwise yet
 
user895378
@Blizz Yes, most frameworks do it like that. Not coincidentally, you'll also find that the general feeling in this room is that most frameworks are garbage.
 
Sem
Guess I'll need a nice book on how to structure applications flexibly. But for now I'll stick with my 1:1 class - mysqli table dream, else it would be to big differences to change in my framework.
 
2:23 PM
@Sem , and what will you do when you need to work with user-groups situation ? an N:N table relationship ?
 
Sem
@rdlowrey One more thing though, what about mysqli objects. Do you initialize them when you need one? Or do you use a singleton somewhere?
 
user895378
@Sem Hehe, it's always a journey. Incremental improvement is better than no improvement. If you wait to write code until you fully understand every possible best-practice and nuanced OOP edge-case you'll never get anything done.
 
user895378
@Sem I certainly don't use a singleton. If you have a class that requires a mysqli instance you should inject that mysqli instance into it as part of the class "plumbing/wiring"
 
@Sem here's a nice rule of thumb: if you need a singleton, your architecture is broken
 
Sem
@tereško For now it's going to be a nice drag and drop CMS that uses modules with easy properties.
 
2:25 PM
@Sem , that does no answer my question ..
 
Sem
@tereško It is possible to make other classes in modules but it's optional to use the 1:1 table structure.
 
@tereško what architecture?
 
Sem
@tereško So basically you make a new mysqli object in every data mapper you have?
 
@ircmaxell .. you have a point there
 
@Sem if you think those are the only two alternatives...
 
2:27 PM
@Sem don't feed teresko!
 
Sem
@ircmaxell , I'm just searching for answers hehe.
 
@Sem , so , how much time have you spent on learning OOP ?
hour ?
 
user895378
@Sem You definitely shouldn't instantiate mysqli objects over and over. Inject a connection you've already created, but don't open connections left and right for every mapper.
 
@Sem think, how else could you solve it
 
$connection = new MySQLi( ... );
$foo = new Foo( $connection );
$bar = new Bar( $connection );
 
Sem
2:29 PM
@tereško Be happy I'm in the 3rd chapter of clean code now :P
 
@Sem , how many connections did i initialize in that code above ?
 
Sem
@tereško That's how I do it now.
 
6 mins ago, by Sem
@rdlowrey One more thing though, what about mysqli objects. Do you initialize them when you need one? Or do you use a singleton somewhere?
 
@Sem If you only have one instance, then it doesn't need to be a singleton does it
 
@Sem by the looks of it , no , you don't do it tht way
 
2:32 PM
I searched for "dependency ejection" just because I liked the sound of it... second result was for zend framework..
 
Sem
@tereško The discussion started about overloading constructors. rdlowery talked about an object being a house which doesn't need it's furniture at the start. But does need it's electrical wiring for example. Then I said, so i only have to give the mysqli object with the constructor? He disagreed.
 
user895378
@Leigh haha
 
user895378
@Sem, I said you shouldn't inject the mysqli connection into your User object. The User shouldn't know or care how it's persisted.
 
@Leigh , what a sad joke
 
Hi phpl
 
Sem
2:33 PM
@rdlowrey Isn't that what @tereško showed in his example?
 
hi :)
 
no
 
user895378
@Sem no.
 
@Sem , an instance of User is a domain level object, which deals with business logic
 
user895378
Foo and Bar are classes that need a myqli instance. Your User class doesn't need one.
 
2:34 PM
Oh btw just ordered one of these for my desk ebay.co.uk/sch/i.html?_nkw=php+elephant
very reasonably priced :D
 
Sem
WTF, I clearly see a mysqli object given to the constructor there!
 
@Leigh what a waste of money
 
Sem
@rdlowrey which is what i said.
 
@tereško What's money for then?
 
user895378
@Sem He's demonstrating how to avoid Singletons by injecting the same instance into any classes that need it. He's not suggesting that your User object should be tightly coupled to a database.
 
2:36 PM
@Sem why are you assuming that Foo and Bar are domain level objects , which contain domain business logic ?
 
@tereško probably because the concept is new to him and you haven't said otherwise :) The whole dependency injection thing is not something that one can grasp from 5 lines of code
 
I want to store user data in a cookie so the user can be 'remembered' on the next visit. I've read that most people hash the user id and password and store it in the cookie, but how do you authenticate the cookie? The only way I can think that'll work is if you extract the cookie value, then hash EVERY user id and password and compare it to the cookie value until you find a match, but it seems unpractical. How would one normally do this?
 
Sem
I guess I used a different word there that caused misunderstanding. I'm not that good in OOP at all hehe. At least not the architecture part. Which is the most important.
 
@Stuyvenstein Where did you read that "most people store a user id and password in a cookie" ?
 
user895378
@Sem Just keep reading, learning and asking questions :)
 
2:38 PM
@Stuyvenstein you never store user data in a cookie. You assign them some kind of ID (usually a session id) and that maps in your database on a user
 
@Leigh something along the lines of : zazzle.com/cafeina_mug-168100619735610460
 
@Leigh This is where I read that: stackoverflow.com/questions/7214458/…
 
Sem
@rdlowrey I will hehe, thanks :) Happy I handling my connections correctly. At least something is ok :D
 
@Stuyvenstein No, that's not how most sites do it
 
@Blizz That's how I though it'd be practical
 
2:40 PM
@tereško "Beverages > Non-Alcoholic Drinks" isn't a waste of money, and my fluffy elephant is?
 
in php 5.3 its said you can leave out the "middle part" of a ternary operator... is it possible to remove the else from a ternary operator? <?php echo ( isset($username) ) ? $username; ?>. Or maybe another shorthand way of doing this without having to write out if( isset($username) ): echo $username; endif; ?>
 
Most sites create a new random token, and store it in a new database table. Then if not logged into the session, but has the token, it looks that token up to validate
 
@Mike what be the use of that? :)
 
@Leigh what ? how about you let the page fullly load, before releasing a brain-turd
 
idk, just seems logical in my head that you shouldnt HAVE to specify an else with a ternary
 
2:42 PM
@Stuyvenstein Don't tell me you store your user's password as plaintext
 
granted, i'm far far far from being an expert on the subject :)
@Stuyvenstein please don't tell me that either.
 
@tereško Don't worry about it, I was implying that specialised storage of non-alcoholic drinks was more of a waste of money than plush animals
 
Sem
Getting the feeling this chatbox is growing, might just be a busy hour :)
 
hmm silence, uh ow :)
 
@Arkh no I md5 it, I have not worked with authentication systems much yet
 
2:44 PM
that scares me @Blizz
 
@Stuyvenstein Use SHA1 at least
 
Sem
@Stuyvenstein whirlpool hashing FTW! I use it because it's dutch.
 
@Leigh ok cool, thanx.
chat later
 
i prefer PBKDF2 actually :)
 
@Stuyvenstein
 
2:46 PM
@Sem It's also slow
 
@Sem and because it's just as easy to break as MD5
 
user895378
@Mike if you can lose the isset you could do: echo $username ?: ''; or otherwise echo isset($username) ? $username : '';
 
@Stuyvenstein md5 == plain text
 
/waits for ircmaxell to link a relevant article on security.
 
ok, I'll paste a few
 
Sem
2:47 PM
@ircmaxel tell me, best hash out now?
 
73
A: Fundamental difference between Hashing and Encryption algorithms

ircmaxellWell, you could look it up in Wikipedia... But since you want an explanation, I'll do my best here: Hash Functions They provide a mapping between an arbitrary length input, and a (usually) fixed length (or smaller length) output. It can be anything from a simple crc32, to a full blown cryptog...

 
@Mike You mean his article on his password lib ;)
 
42
A: PHP 2-way encryption: I need to store passwords that can be retrieved

ircmaxellPersonally, I would use mcrypt like others posted. But there is much more to note... How do I encrypt and decrypt a password in PHP? See below for a strong class that takes care of everything for you: What is the safest algorithm to encrypt the passwords with? safest? any of them. The safe...

 
yes @Leigh lol
 
2:47 PM
29
A: Many hash iterations: append salt every time?

ircmaxellIn short: Yes. Go with the first example... The hash function can lose entropy if feed back to itself without adding the original data (I can't seem to find a reference now, I'll keep looking). And for the record, I am in support of hashing multiple times. A hash that takes 500 ms to genera...

 
@rdlowrey thanks, i knew of ?: shorthand but it still requires an $a and a $b :)
 
@ircmaxell: Did you ever check out coursera.org/course/crypto? It was pretty fun if you can cope with the maths
 
there you go
 
user895378
@Mike Oh yeah. There's no way to lose the last part. Besides, it would be totally unreadable anyway :)
 
2:48 PM
that's all? :P
 
@Stuyvenstein in short, if you want to stay away from the news headlines unlike LinkedIn did... follow that advice.
 
@Leigh no, not really...
@Blizz those are the the point specific ones...
 
@rdlowrey word, even with the ?: its still near unreadable.. i always have to take a second look at ternary operators and think through them.
 
Sem
@ircmaxell I'll read it, which hash is the best one to use then? I'm not scared though. I use some useragent propertys with a couple of optional salts so it's not that bad.
 
@ircmaxell You might enjoy it, quite a few hands-on breaking crypto systems programming homeworks
 
2:50 PM
They should come up with a short for isset($var) ? $var : <else> imo :)
 
@rdlowrey plus echo $username ?: '' is identical to echo $username; for the majority of values (except edgecases like 0
@Leigh I've broken real world crypto-systems ;-)
@Sem yes, it is...
 
@Sem At least use bcrypt
 
@ircmaxell I didn't say they were pretend ;) One of them is based on cracking CSS, another on a padding oracle attack with PKCS
 
Sem
@ircmaxell Hmm, if you say so. random token is a good way to go?
 
i don't consider adding a salt to an md5 hash "secure"... sure its more secure than no md5 at all.. Which is why i laughed at LinkedIn when they said that.
 
2:53 PM
certainly considering the fact that most implementations i saw with a salt actually stored the salt in the same record as well
 
lmao yaeh
 
at least use a part of the actual password as salt then or something
 
@Blizz when you use a different salt for every pass, you have to store it somewhere
 
@rdlowrey Hello there, tanned man.
 
i use a lib for password storage and hashing. but if i did it home grown i wouldn't store the salt anywhere. much less in a table in teh same database.
 
2:54 PM
Leigh not really :)
 
user895378
@LeviMorrison what up, yo.
 
if you salt with the first 5 chars of the actual password
its "double protection"
 
@Sem yes
 
lol
 
rd has is pic back i see.
 
2:55 PM
@Blizz that's just like concatenating the password with itself as a salt, a terrible pass gives a terrible salt
 
registration timestamp + firstname + first 5 of password for salt
 
user895378
@LeviMorrison I think I worked out my GET/POST anxiety. The problem was I was thinking like PHP about $_GET and $_POST and not about how HTTP really works ($_QUERY_PARAMETERS and $_ENTITY_BODY_PARAMETERS)
 
Leigh i never said it was perfect, its better than nothing... I use a PKBDF2 algorithm for my hashes
 
Sem
@ircmaxell thank you.
 
wish ion_auth supported pkbdf2
last i checked it was only bcrypt or sha
 
user895378
2:57 PM
@LeviMorrison I still can't decide: should we throw an exception if entity-body parameters are requested if the method isn't PUT, POST or OPTIONS (which optionally accepts an entity-body)?
 
user895378
I'm leaning towards an exception ...
 
Sem
I'm off, a wonderfull evening to everyone. And thanks @rdlowrey @tereško @Blizz @ircmaxell for the help guys! :)
 
user895378
@Sem good luck
 
bye @Sem
 
@Mike Add it in?
 
3:00 PM
too much work =), for its purposes bcrypt will suffice quite fine especially with 12 passes and a random length salt.
 
@rdlowrey I'm going to say no. HTTP is extendable, and we don't want to break that.
 
thank god they got smart and ported it.
 
@Mike 12 passes?
 
Good afternoon
 
random length salt?
 
3:01 PM
thats what it ships with lol
 
user895378
@LeviMorrison Fair enough.
 
do you know how bcrypt works? You can't have a random length salt
 
@ircmaxell I think he means load factor 12
 
@ircmaxell i read it wrong >_> random rounds..
 
3:02 PM
random rounds?
why would you do such a thing?
 
no idea
 
I got a question. Can you make by PURE Mysql query, a query that:

selects activities.name, activities.price from activities , and then checks if there's a row in user_activities, on user_activities.activity_id = activities.id, and if there does then it should select the user_activities.price and not the activities.price ?
 
but thats how it ships lol
 
otherwise it should use the activities.price still
 
@Mike Use Blizz' approach, take the ascii value of the first character of the persons surname, as the number of rounds!
 
3:03 PM
no it doesn't
the cost parameter is specified by the constructor
it's not random
 
one of the things i've found i dont like about this library is that when you get a users details it friggin brings over its password hash
$this->ion_auth->user(1); returns an object including the password hash
 
The hash should be good enough for that not to be a problem, but I guess that is exactly the point
 
@Mike Well that should be fine right, it's a secure hash
 
still dont like it :)
 
@Mike Even if it didn't return it, it would still exist in the code/in memory somewhere
 
3:05 PM
in my opinion password hash should only be accessed when you're verifying credentials for some reason.. otherwise leave it. Me being paranoid?
 
@Mike No, it's fine to say it should do that, I agree. But I don't see it as much of a threat
 
and what if it is assigned to a session variable :)
 
why would you assign all those things to the session?
 
NFI
 
@Mike Well that seems like a silly thing to do, since it will (probably) be written somewhere other than your users table, just another place for user details to be stolen from
 
3:08 PM
lol
 
i set the username firstname and email address in session... not the password.
 
@Mike I usually only have the userid
 
their username and firstname are dispalyed in the header of the page "welcome, user123", figured it didnt hurt anything to store username/firstname in a session var to save a query.
 
user895378
@LeviMorrison I just created a gist summarizing my thought process on how the Request interface exposes access to query and entity-body parameters. Please let me know if you have comments or suggestions.
 
@Mike I guess it's no worse than caching the query results and using them, you can encrypt session data though, might be a good idea
 
3:10 PM
@Mike yes and no, it's not the end of the world
 
area uses SSL
 
still if you're using file based sessions, it's unencrypted on disk
 
CI is configd to store it in a db
im sure someone will find other holes before going there.
 
Only if you set CI to do that... Which not everyone does... the problem with CI, is that it's CI ;)
 
@Leigh If you're using database based sessions, it's unencrypted on disk as well
 
3:12 PM
@Justin yeah i always enable that. and yes.. its CI i know, Id love to migrate to Kohana or hell even zend.
it'd be a great learning experience to pickup on the zend framework.
 
Never used Kohana or zend.. I've used CI extensively -- and on this project i'm using Symfony...
 
i think almost everyone in here has used CI lol
but i feel very few have stuck with it
i think im done answering questions for people with < 10 rep. they never accept
 
@Mike yeah I know that one... Had a guy a while ago that had a question -- thanked me for my answer.... then deleted his question...
 
@Justin lmfao
 
@ircmaxell Well, unless you encrypt it :D
It's nice to see something pro-PHP at the top or r/programming for once: reddit.com/r/programming (Though some people seem to interpret it as anti-PHP...)
 
3:20 PM
good luck
 
"new limited edition reddit stickers!"
 
just finished reading that php bug post, that is some funny shit
 
@rdlowrey You should open up an RFC.
 
Hi guys! :D
Don't you know how to use (easily decode and encode) viewstate in PHP?
 
@EventHorizon: agreed haha
 
@rdlowrey Even suggesting that PHP populate $_POST anytime the Content-type of the body is form encoded would be an improvement. The only things that might break are things that are user problems anyway, like use !empty($_POST) to determine if the request type was POST.
 
if those don't help then I must have read the original post those links came from incorrectly
 
> Escalate? Oh how I wish I had someone to escalate to.
> - Rasmus
 
user895378
@LeviMorrison yeah, that is really funny :)
 
3:40 PM
thanks :D
 
user895378
@LeviMorrison I don't know ... I feel like I should get my C skills in better working order before making RFC suggestions ...
 
That is also why we are not likely to reverse a change like this that others in your situation have now accounted for, tested and deployed in production for many months simply because it is inconvenient for you.
That made me lol
 
user895378
But I realized when I was working out how to model the request parameters that $_GET and $_POST were worse than global, they were actually misnamed.
 
@rdlowrey Yeah, they are misnamed. At least $_GET
$_GET should be $_QUERY
 
Why should it be that @NikiC
 
user895378
3:43 PM
@Event_Horizon read this: gist.github.com/2973301
 
user895378
I just posted it.
 
@NikiC $_QUERY sounds like a synonym for $_REQUEST
 
@Leigh $_REQUEST should obviously die altogether ^^
 
@Leigh Except that it has specific HTTP semantics.
 
user895378
It's amazing how much you can learn when you spend some time reading the HTTP spec :)
 
3:46 PM
@rdlowrey very true, at one point I was looking for a way to get browsers to repeat data back to the server without using cookie or etag, went through pretty much every possible header
 
@rdlowrey Yep. By the way, I was serious about that RFC
 
user895378
@LeviMorrison Well, given my personal insecurities with C I'll be happy to do so as long as you'll edit for me.
 
@rdlowrey what exactly is it you need to edit?
 
@NikiC all of them should die
 
$_QUERY and $_BODY could work. $_BODY would be populated any time the content-type is form-encoded.
 
3:48 PM
@LeviMorrison what if there are 2 content parts, both are form encoded?
 
php://input ^^
 
user895378
@Leigh We're talking about a potential RFC for correcting $_GET and $_POST to more appropriate names like $_QUERY and $_BODY
 
I wouldn't do it that way
why replace one super global with another?
 
@rdlowrey introducing 2 new ones only, or actually removing the old ones while you're at it?
 
@rdlowrey Please no
 
3:49 PM
why not create a first-class request object
 
user895378
@ircmaxell I'm much more interested in that
 
user895378
superglobals need to die
 
I agree that the names aren't perfect, but adding another set of variables which just alias the same thing won't help anyone
 
@rdlowrey I just realized that @irmaxell is correct. Why would we introduce NEW globals? We could simply add functions/objects that make parsing form-encoded data easier.
And so on.
 
user895378
yes, the hole should be fixed, not patched.
 
user895378
3:51 PM
I can't help but smile when I think of the massive amount of code that would go haywire if superglobals were removed :)
 
@rdlowrey Interesting
 
exactly
 
@rdlowrey Well you'd have to leave them in for BC, but that doesn't mean you can't introduce a new(better) method for people developing new apps to use going forward.
then give it a couple of years, stick a deprecated on them, wait another couple of years, and then think about deleting :p
 
so make them depreciated like the mysql_* commands....where everyone insists on using and asking about them on SO
 
I just had a thought
What do you think, it SO contributing to the increase of bad programmers?
 
3:54 PM
No, they already exist
 
I mean, if you're completely clueless, you can just go to SO and your problem is solved.
 
they just come here to espouse how bad they are within their questions
 
@NikiC Repwhoring new guys eager to answer terrible questions and making SO seem like a place where you shouldn't have to even try and work things out on your own before coming here
 
user895378
@NikiC When you have issues like the fiasco it's certainly possible. You can get answers that don't correct you for using really bad practices.
 
@EventHorizon Still, there might be come kind of possitive feedback loop effect ;)
 
3:55 PM
@rdlowrey <-this
 
@rdlowrey Btw, am I the only one who feels like $request->getEntityBodyParameter('foo') is a bit long?
 
user895378
@NikiC No, I was going to ask for input.
 
user895378
It's really long but I wasn't sure if I should explicitly use EntityBody over Body
 
@rdlowrey I'd say EntityBody is even more confusing (what entity?)
 
@rdlowrey I think you could drop Entity out of it.
 
user895378
3:58 PM
I only used entity-body in the first place because that's how it's referenced in the HTTP spec
 
@rdlowrey Whats your opinion on a question, where the poster is aware that something is a "bad practice" but has a genuine question about it? Should it be downvoted and the OP told off, or should it be answered, but with a clause saying that it's not really the best thing to do? - I experience the former far more than the latter, and personally I think that good questions should be answered regardless of what people think about the process being used.
 
@Leigh SO isn't the place for 'bad practice' questions. It would be closed.
 
user895378
@Leigh No, the question is fine, but I'd say answers that subsidize bad practices should get the righteous downvote for sure.
 
(.htaccess) what is the pattern to allow a-z and '-' ?
 
@Ibra038 [a-z-]
 
3:59 PM
@LeviMorrison wow, that was hard!
 
user895378
@LeviMorrison I don't have a problem with a bad practice question ... I have a problem with answers that don't rant against the bad practice.
 
@LeviMorrison "It would be closed" isn't the same as "it should be closed"
 
@le
 
Well I think it might be time to find a new job...
 
@NikiC I could have directed to an article explaining it, I decided to feed the vam . . . user.
 
4:00 PM
@LeviMorrison omg, it's that easy? lets try, THnx!
 
Just got a call from the place I cash my checks -- the last 2 have bounced... unacceptable don't ya think?
 
@LeviMorrison As an example, if someone asks something like "I know singletons are bad practice, but I want to understand how they work. I've done this and this, but I'm not getting the result I expected, can someone tell me what I did wrong". You'd go for the close vote?
 
@rdlowrey Though I think that if you are getting pedantic about the spec then the request can't have ->getBodyParameter() etc at all ^^
I mean, the body could be used for pretty much anything
The fact that a certain body is to be interpreted as urlencoded parameters is not inherent to the request
 
user895378
@NikiC Yes. I'm having a difficult time trying to come up with a succinct way to reference form encoded parameters from the HTTP message body.
 
@rdlowrey Subclass it.
FormEncodedRequest extends Request {
array getFormEncodedData();
}
 
user895378
4:03 PM
I think subclassing might be the way to go ... I've tried various ways of splitting out the parameter bits into their own class and using composition but they've all been clunky. I think that's a good signal that like @NikiC said, there's nothing about a Request that inherently needs form encoded params.
 
user895378
@LeviMorrison That also makes an argument for asking for the Request instance in your MyController::get or MyController::post method instead of the constructor because different verb methods may use different Request implementations
 
user895378
Though I guess they don't have to ...
 
user895378
If you didn't catch this when it was posted in chat yesterday, you should definitely carve out an hour of time to watch it this weekend: vimeo.com/43612849
 
is it that good?
 
@rdlowrey: Just for clarity on my part, your proposal would be to create something like a builtin class (Request?) that you could call static methods of to retrieve query/body parameters? - I'll probably have a stab at php-src over the weekend, might as well give myself a mini-project to aid my learning.
 
4:11 PM
I hate 1hr vids
 
user895378
@NikiC It's pretty similar to the "Architecture: The Lost Years" video from the RoR conference if you saw that.
 
user895378
It's really good for beginner to intermediate PHPers. If you're a SO chat regular you probably already know most of it :)
 
I'm unproductive today anyways, so might just as well watch it
 
user895378
@NikiC I love that ... being unproductive but not feeling bad about it because at least you're watching an educational video :)
 
user895378
Sometimes I wish Uncle Bob would spend less time on nerdy digressions and just get to the point, though
 
user895378
4:17 PM
Yes, I'm impressed by your knowledge of subatomic particles. Just talk about programming. I don't have all day. Thanks.
 
4:28 PM
Hey Ho!
 
It's always nice to go into a question <1min old to see someone already responding with the mysql_* rant :]
 
@orourkek quite nice
 
in fact it was @Truth, purveyor of his namesake :P
 
user895378
Am I the only person who pronounces "SQL" as "S-Q-L" and not "Sequel" ???
 
<- "S-Q-L" & "my S-Q-L"
 
4:41 PM
I alternate
 
@rdlowrey same here
 
@rdlowrey No, I do that as well, Unless I'm talking about SQL Server, in which case it's Sequel Server
 
So clearly the intellectuals of the world prefer "S-Q-L" :P
 
user895378
Okay good, I've lately been feeling a lot of "Sequel" around me.
 
because its friday! weekend ftw!
 
4:57 PM
b92.net/eng/news/… I paid 400€ for rent and I'll got is car bomb for welcome
 
Funny thing @Gordon I just saw that one on Facebook too
@webarto that car got FUCKED
 

« first day (615 days earlier)      last day (4333 days later) »