« first day (260 days earlier)      last day (4670 days later) » 

9:12 AM
Good morning folks
 
9:31 AM
morning
 
 
1 hour later…
10:37 AM
morning :)
@nikic sure, it is :-P
BTW: anyone heard about programming language without parameters? :)
 
Brainfuck?
 
OO one
 
what do you mean by "without parameters" then?
 
methods can't have params
 
Sorry off topic, but I can't find any other plays to ask...
Is there any class rooms here on stack like akubuntu.com has?
http://chat.stackexchange.com/rooms/663/ask-ubuntu-classroom
 
10:45 AM
superuser.com -> chat?
 
Suppose I have a PostController, PostModel and PostView. PostView has renderPostNotFoundPage() method. The question is, should the PostController use PostModel::doesPostExist($postID) method to decide whether or not to call PostView::renderPostNotFoundPage()? If I do that, will that be asking, rather then telling? Is the design wrong?
 
@KamilTomšík not what I thought but it might work, I'll leave now. Sorry again.
 
@rickchristie right question is - what is your model? because PostModel is not :)
 
@KamilTomšík - why is PostModel not a model? Is the design wrong?
 
@rickchristie PostModel is model only in case of rendering that post... but you're not there, yet - until getting Post, your model is Application
or Blog
BlogController gets request, calls Blog->readPost(id), which then gets another MVC triad for that post - or shows error.
this is HMVC, but in right sense, not in which it is usually presented.
 
10:52 AM
@KamilTomšík - the call is to render a post, say /post/$id - the router routes the request to PostController since it's the URI that are supposed to show a post, I don't understand why it should be BlogController - can you tell me why?
 
this is subjective - a lot of people is okay with idea of PostController handling all post actions, but PostController should really operate only on one given post, and because you don't have that post yet, you can operate only on blog, that's why you should have BlogController
 
well, the BlogController issue aside, would calling PostModel::doesPostExist($postID) violate tell, don't ask?
 
@rickchristie there wouldn't be any PostModel::doesPostExists - it's not responsibility of Post, only Blog knows if that posts exists
and yes, it would be - MVC is anti-tell-dont-ask
 
@KamilTomšík - I think I understand your point now.
Why is MVC anti-tell-dont-ask?
 
@rickchristie because controller is getting data from model and passes them to view, instead of just telling model to render itself.
 
11:00 AM
@rick
oops sorry typo :P
 
@KamilTomšík - how about this: controller tells the model to grab the post contents, but wraps the call in try .. catch. The model throws PostNotFoundException, which is caught by the controller, and the controller tells the view to render 404 instead.
 
:) what about passing on_error callback?
 
@KamilTomšík - passing callback? As in: $postContent = $model->getPost($postID, array($this, 'postNotFound')) ?
 
anyway, MVC just makes it harder - you want $blog->readPost($id); and blog should just do it. and if post does not exist, it should also be able to show error page.
something in that sense, but I really dislike returns...
 
Got it. I'll still doing it MVC (it's a sample application), but many thanks for the input :)
 
11:08 AM
np
 
11:20 AM
Well, here is a question: if I inquire about the state of the object A, but doesn't use that information to change the state of object A, does that break the 'tell, don't ask' principle? According to the definition here, it seems it doesn't:
> The problem is that, as the caller, you should not be making decisions based on the state of the called object that result in you then changing the state of the object. The logic you are implementing is probably the called object’s responsibility, not yours. For you to make decisions outside the object violates its encapsulation.
 
Hello @ManjotSingh
 
@rickchristie yeah, you're right, tell dont ask is vague, and allows getters for "just" rendering, etc. that's why I like to use term "east-oriented" which is much more exact - no returns at all...
 
Added to my reading list (although I'm not sure I'll understand) - anyway gtg, dinner
 
11:53 AM
@Gordon I've found some great slides by A. Hollub, if you're interested (oo, tda, east oriented) - it's summary of his book. bit.ly/fGjmu1 - should be familiar to what I was saying around here...
@rickchristie have a look on that too
@ChristianSciberras have a look on that too - there's part about base classes
 
 
3 hours later…
3:24 PM
Hopefully someone here is also fit with SQL, I need help on my Blog-system: stackoverflow.com/questions/6562178/…
 
 
2 hours later…
5:33 PM
hi all, on my local machine, i have two php.ini files: php.ini.default php.ini.default-5.2-previous. running phpinfo() just tells me that the php.ini is located in etc but doesn't mention which php.ini is in use. any other way to find out?
 
thanks
 
6:02 PM
http://stackoverflow.com/questions/6564314/php-variables-issue

What is the best method? Tokens or sprintf?
 
Tokens (for me)
 
 
2 hours later…
7:42 PM
@AdamStrudwick what about tokens with sprintf?
 
 
2 hours later…
9:45 PM
@nikic why did you offer a bounty on my old and solved question and deleted your own answer to it? Oo
 
@Gordon?
Well, I thought it a bit over the weekend, and came up with this:
I'm very anxious to know (@Gordon|@teresko|@KamilTomšík)'s feedback over it.
 
lets see ... there is duplication between labels and form controls
 
@Gordon Just want to transfer some rep to Artefacto :)
 
the Row construction is somewhat strange , especially since Forms are lists of inputs , and not tablular in nature
 
@teresko - OH, @KamilTomšík mentioned that. The part for switching names to readable text. I'll see to make a fix to it
I'm not sure what gives you the impression about tabs?
 
9:59 PM
and you should pass an instance of validator , not just a class name
 
That would be columns, not rows
Aha, I thought I'd be a bit clever on that one.
 
@ChristianSciberras , tablular as in "table"
 
Instead of having loads of duplicate validators, I'd have an array of ClassName=>ValidatorInstance
Singleton, if you like
 
.. singleton always is the wrong solution
 
Since the validator is like a utility class, you give it input and it gives you output. No storage, no delayed execution.
 
10:01 PM
you can pass SAME instance of validator to all elements
 
I didn't understand that, sorry.
 
and actually , validator should validate fields , instead of being used by fields to validate themselves ... the object graph is f*cked there
 
The other option here is new ValidatorNotEmpty() in place of a string.
Oh?
The validation isn't done by the field.
It's called by the form.
 
validation is EXECUTE from inside of the field classes
 
Although the field knows its own validator, it doesn't have to use it
 
10:03 PM
huh ?!?
then that structure is even worse then i thought
 
@Gordon Awarded that bounty now. Forgot to do that earlier ^^
 
@teresko and the solution...?
 
separate the field definition and validation rules
besides , each field can have more then one validation rule
 
That's not technically possible.
Though I'd love to see a solution to that
ok, let's leave that apart. Let's see if I understand what you're saying.
if it isn't $field->validator, the only option would be for each type of validator to have list of fields, no?
 
for example , email field will be mandatory , email'ish and previously unregistered
nickname field will be mandatory and unregistered
 
10:08 PM
Well, my "dirty fix" there would have been to have 3 validators in that case (email_like, unused_emai, unused_email+email_like).
 
@ChristianSciberras use Zend_Form :)
 
But of course, that implies a lot of duplicate code
 
.. oh , and some forms require you to repeat your email address twice
 
@nikic fair enough :)
 
.. just like pasword field
 
10:09 PM
Which, is very bad (said from personal experience, the hard way ;)
 
nite
 
Cheers @Gordon
And throw that darn zend_form down the bin :P
 
bottom of the line : there are a lot of duplicated code (both on API side and internally) , the object graph is backwards and you are using global state ( in the form of singleton ) causing additional "magic" side-effects
 
@teresko - so for that to work, in both cases, there should/would be a validator which ensures multiple fields have the same value; interaction between fields.
Yeah, validator has to be ctor'ed not class name
I may have to pass validator arguments, such as to match with a certain field or multiple validators.
 
@ChristianSciberras , which should tell you that rules should not be registered on fields ...
 
10:13 PM
@teresko - You can see the object graph there. Can you show a small example on how to separate validator from field?
 
instead you should create Rules ( with fields and options ) and pass them to validator
.. and i repeat once more : "label is just a property of field from the php point of view"
 
With regards to label, that just can't work with my scenario.
There are many cases why label should be changed, replaced, or a different one used
so in this case, label is only a "Text" block but which can "bind" to an item.
It cannot be a property of field since not all field types can have a label (eg: wyswyg editor etc).
 
well , if label is not set , then there is no label
fails to see the issue
ehh ,, forget it , you will understand it in some of next iterations
 
@teresko - Just one thing. I'm trying to forget HTML's inconsistencies here.
 
you must be kidding
 
10:23 PM
If I had to be honest, I'm trying to replicate (somewhat) of the great D&D/RAD in Delphi.
No, why?
 
because web is as far from desktop applications as you can get
 
Of course, I'm not generating exact width/height/x/y in this system
Sure, but there are similar things.
 
haven't you evolved even past WYSIWYG editors ?
 
For the record, I've never used wyswygs unless forced to be some retarded backend.
But that's past the point.
If you had to look at a delphi form file, you'll note that it's cleaner than CSS, let alone compare it to HTML or PHP.
 
then you are trying to recreat wrong paradigm
@ChristianSciberras , I used delphi since v3 up till version 6
 
10:28 PM
Good to hear :)
oh
You ought to try D7
It's a classic. The best in the whole series.
But anyway.
Keep in mind that this form system is just for structure. The designer still has to move the stuff around.
Plus, we're not talking about designing whole pages (a la wyswyg style) just some pieces of code, forms.
Sure the web is radically different form the desktop, but forms follow the same kind of thought; controls and containers.
 
i suspect that my understanding of Forms is a bit different , especially since i use HMVC for my application structure , and then form is just another MVC triad
 
Well, I do admit Delphi left some brain damage when it comes to the concept of RAD.
 
cheers
 
Hi @KamilTomšík!
 
hi Kamil
 
10:33 PM
Either case, that's why label is a module by itself. I just thought, well someone might want to have multiple labels pointing at the same field. Or labels which move focus to a different position on the page (instead of the item on its right).
 
@teresko there is nothing wrong on wysiwyg itself - it's just poorly implemented - in case of www...
 
@KamilTomšík , look at Christian's code and damage his ego a bit more : pastebin.com/M2yPgY5N
 
But my initial thought of a label containing a field was seriously flawed.
 
@ChristianSciberras looking, and - I don't like it, sorry
 
@teresko - :)
@KamilTomšík Loads of new's, huh? :P
 
10:35 PM
@ChristianSciberras : scroll up the the "bottom line" comment , and try to fix all three of issues for next iteration
 
@ChristianSciberras it's just weird, kfRow? wtf is that?
 
A form row?
Could have been "Container"
or "Div"
 
form has to have rows?
 
i assumed i is a sign of his poor skills in html
 
what about search form?
 
10:36 PM
The naming is a bit screwed because it's just a model.
No, you can omit kfRow
 
form might have <fieldset>'s , but that's about it
 
sorry, but it's screwed because you can't find proper name - because it's actually useless
 
Or you can have everything in on single row (though it would be stupid).
 
search form is example of one "row"
what about hiddens? each one in its own "row"?
 
@KamilTomšík as I said, you can omit rows
 
10:38 PM
yeah, that would be better
 
No
It's a physical div container
 
now - what is this? array('name'=>'row0'),
 
arguments passed through ctor
 
@ChristianSciberras then you are mixing presentation with logic
 
it's like setting a property.
 
10:39 PM
Are all of use using fancy form creation and validation libs? Nobody writing forms by hand anymore?
 
Last time, I used ctor arguments, but it looks bad
So it's an array.
@nikic still do, sadly.
 
@ChristianSciberras Why "sadly"?
 
@teresko there's no logic here, neither presentation, strictly. It's just structure.
@nikic It's a pain in the ass copying crap all over all day.
 
I don't know - even DSL would look better:
new Form( "name[notempty], surname[notempty], email[notempty, email]" );
 
I prefer brainstorming and designing cool stuff than writing plain form html.
@KamilTomšík - It's not design to look better.
It's designed to have a working form after a single run of the file.
0 parsing. (except PHP ;)
 
10:41 PM
Where have all the people gone that still know to write good HTML and SQL? All switching to Form libs and ORMs :(
 
@ChristianSciberras ever heard about caching? because you can parse that string only once...
 
@nikic If you people that use orms and form libs don't know straight html means they don't do a good enough job.
@KamilTomšík not when you're injecting values on the fly.
 
@ChristianSciberras parsing? sure you can - binding is another process
 
Well, that is still wasted time.
 
@ChristianSciberras , you can look a this small crap : pastie.org/2160258
 
10:45 PM
I've been reviewing DSL for markdown, but it just can't work with what I'm doing.
 
its a quite old code i wrote some time ago
 
ok, whatever - just tell me: can it do inline editing? can you theme it? can you separate those labels and hints outside of code? because it just takes space, it's not important for understanding that form.
 
nothing to be proved of , but maybe it might give you some good ideas
 
@teresko - Ideally, I could tone down all the redundant crap like "name=>label2" etc
I like how you did the validation part
@KamilTomšík - Inline editing, don't know what you mean by that. Themeable, sure can. Separate labels/hints, why shouldn't I? The whole hierarchy works better with @Gordon's suggestion of a parent property.
Now I don't even have to worry about finding the form - I just go to the topmost parent.
@teresko what if you wanted "city" and "state" to show up one after each other? (horizontally)? I suppose it would have been a "Css issue" right?
 
Validator class contains list of methods ( not that good idea in hindsight , but works ) , and the second argument for Form::add_field sets the rules for field , where is_{$rule} is a name for validation function
@ChristianSciberras the order in which you ad fields does not matter
 
10:52 PM
I could easily:

$cls='kfValidator'.$rule;
$obj=new $cls();
@teresko Wait, what?
 
@ChristianSciberras tereskos lib only does form handling, not form rendering ;)
 
@nikic I see.
 
that's not even a "lib"
 
s/lib/ten-line-form-handler [or how many lines is it?] :)
 
something under 200 lines
 
10:54 PM
uh, that's much
 
validations are tricky, and even the best possible form layer can't satisfy all needs. so writing form layer with perfect validation is like finding golden hammer - it's probably impossible. but there's a twist, if you're interested.
 
could you paste?
 
Well, mine's already over 600. heh.
 
@nikic , i use double-spacing
 
@KamilTomšík Never heard of PHP's built in function magicValidateForm(), did you?
 
10:55 PM
@KamilTomšík You know, I'm notorious of proving people wrong. Occasionally.
 
@teresko Could you paste it? Would like to look at your code ;)
 
@nikic Sounds like PHP7-only to me. XD
 
i better not
it's way too old
 
Is that self-shame I'm smelling? ;P
 
sure
 
10:58 PM
@ChristianSciberras You know, I honestly wouldn't be surprised if we had builtin functions for creating blogs in PHP 7 ;) PHP likes adding functions :D
 
the API is sound , the backend is very limited
it was intended as a tiny example
 
@nikic A blog that actually works? Nah, not until PHP 8 nightlies. :D
 
@teresko just show it - I promise, I won't laugh
 
@teresko - I get the point. The beauty of simplicity.
 
That little "All your pastes are belong to us." statement under Pastie is really effective
Made me immediately read their T&Cs
 
11:02 PM
Well, mine's stuck on "Be nice. :-) Use Pastie for good, not evil. "
I think they're using browser sniffin' ;)
 
using chrome?
 
Hey, didn't see you come in :P yeah, chrome.
 
me too...was using safari for a while but i wound up growing on chrome's developer tools
 
But it's an evil, evil workstation, controlled by an evil sorcerer with evil intentions. :P
 
yea, maybe. but i like their 'webkit inspector' over safari :P
 
11:04 PM
Hmm, just realized our n/s initials match.
 
/me is proud user of Firefox
 
@nikic was, until 4 came out.
 
@ChristianSciberras What got you? The interface change or some stability problem?
 
@nikic I like the UI (though it is an opera clone), but it proved to be too unstable.
 
11:06 PM
and please , do not use this code as example
 
@ChristianSciberras Intersting. I never had any stability issues with Firefox (not even on Nightlies)
 
download dialog didn't show downloads
but the progress bar showed up in taskbar button
firebug faulted a lot and wouldn't show/highlight changes
then there was this weird page load bug. it drove me crazy.
 
hmm ... actually that code i pasted is not finished .. the API does not match classes
as i said : "unfinished"
 
@teresko Are you still using that CS nowadays? Cuz it's neither ZF nor PEAR (which is bad). Additionally you are using parenthesis when using include - this is pure evil.
 
basically, on certain pages it would get stuck downloading the page, as if the network suddenly became too slow. But it stayed that way no matter the amount of refreshes.
only reseting the browser fixed it
 
11:10 PM
CS ?
 
@ChristianSciberras Strange, never had such problems
@teresko Coding style
 
its edited , because in pastie the spacing that i use looks strange
 
for me chrome is just super fast. it seems to render pages quicker. I theorize some of that is due to the V8 js engine behind chrome
 
i use similar style to Zend's
 
@nikic what's wrong with parenthesis in include?
 
11:11 PM
and what did you mean with "parenthesis in include" ?
 
@ChristianSciberras include - just like require or echo - is NOT a function. The parenthesis are not part of the construct. If you use include('file.php') you can as well write include((((('file.php'))))) - it's just as pointless
 
@teresko He doesn't like that ^
 
oh .. well , it looks better
 
I agree, but it' cleaner CS :)
I just don't like the keyword crap from perl
 
@ChristianSciberras Every popular CS agrees with what I just said - don't use parenthesis, never, with language constructs that don't need them.
 
11:13 PM
They should have made them into "special functions"
I disagree, since the only difference is a space instead of a parenthesis.
 
@nikic concur
 
At most it would be a user preference. But if the long run it doesn't matter, why bother?
But excessive parenthesis, on the other hand, is a different thing.
Anyhow, time to get some sleep. Long day tomorrow. Cheers, guys!
 
good night chistian
going to sleep too now
 
@ChristianSciberras btw: do you know that we all hate forms? not implementation, but actual usage - filling them? :) just wanted to point it out - no form is good form.
and if you really need forms - why restrict them? why validate anyway? it's just annoying - somebody wants some information, and provides you textfield - so you write something and boom - he's not happy, he wants something else...
but it's not your fault - it's developer's fault - because he don't know what he wants! he only knows what he don't want...
 

« first day (260 days earlier)      last day (4670 days later) »