logs archiveIRC Archive / Freenode / #php / 2015 / July / 22 / 1
diegoviola
Happy_the_Exceed: do you have any idea?
runinsquares
diegoviola, did he give you clients2.php template?
diegoviola
yes
runinsquares
are you allowed to add methods?
or use this template only?
and "fill in the gaps"
no_gravity
strlen("ö") and mb_strlen("ö") both give wrong results. is there an easier way to fix this then to always write mb_strlen("ö","utf-8")?
diegoviola
runinsquares: that's right
runinsquares
diegoviola, which is right?
diegoviola
runinsquares: I have to add each method for setName(), getName(), setCpf(), getCpf(), and so on
runinsquares: same with validFoo(), validBar()
but I have no idea what I should do with them
Alphos
no_gravity they're not wrong results, you're just making a wrong assumption
         

diegoviola
he is giving vague requests
no_gravity
looks like the encoding can be set globally with mb_internal_encoding('utf-8')
diegoviola
does it make sense to you guys?
runinsquares
diegoviola, does he want you to set each value outside of the class using the object?
diegoviola, or is he expecting it contained within the class via __construct
diegoviola
runinsquares: I think so, but he still wants me to use that array
runinsquares: from clients.php
runinsquares
$object = new Foo; $foo->setName('something');
diegoviola
runinsquares: he only said it has to be a property or whatever
runinsquares
this is what i'm expecting he wants
i'm confused how Producer and Consumer are supposed to relate
diegoviola
I'm confused too
it's really annoying when a programmer forces his way of solving a problem into someone else
runinsquares
is he wanting Consumer to be created inside Producer?
this looks like he's trying to brute force you to learn some basic OOP stuff
you know the difference between protected/public/private?
diegoviola
yes
runinsquares
ok and you know stuff like A extends B?
diegoviola
yes
runinsquares: he doesn't want me to create a consumer from Producer
runinsquares
ask him what exactly is he expecting with the given template
diegoviola
he said I need a protected $clients in Producer
runinsquares: he doesn't want to tell me
runinsquares: he's giving vague sh*t for instructions
SJr
How awful or hard is it to generate cache file on a webserver on the fly?
diegoviola
runinsquares: I know OO, I used ruby for 8 years, what I don't know is how to read his fu*king mind
runinsquares
how the hell are you supposed to give him an answer when he won't tell you what to do or give an outline
SJr
Presumably I write to some temp file on the same file system, then a I use an atomic move to move the file in place?
runinsquares
there are many ways to go about this task so an outline would be good
         

laszlof
diegoviola: http://3v4l.org/cNZm9
probably something like this
is what he wants.
thats pretty standard OO models
thebuccaneersden
SJr : Sounds pretty sensible.
runinsquares
laszlof, how do you think this guy wants Producer and Consumer to relate?
laszlof
you can do some magic with __call and automate some of it
runinsquares: i dont know, i missed that part of the conversation :)
merkazu
embracing the copy/paste here :)
runinsquares
laszlof, there was no conversation, just the template
merkazu
just using a glue then changing the template and data references accordingly
laszlof
Producer/Consumer doesnt make sense to me
diegoviola
laszlof: I don't think that's what he wants, look at clients.php and clients2.php
runinsquares
give link again diegoviola
diegoviola
runinsquares: https://gist.github.com/anonymous/fa2f9c7d8b42f90d5728
runinsquares: clients2.php is a working example
laszlof
All select() is doing is validation
diegoviola
runinsquares: he just wants me to convert that to OO
laszlof
in clients.php
maybe Producer = controller, and consumer = model?
diegoviola
I think so
thebuccaneersden
https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem ???
In computing, the producerconsumer problem[1][2] (also known as the bounded-buffer problem) is a classic example of a multi-process synchronization problem. The problem describes two processes, the producer and the consumer, who share a common, fixed-size buffer used as a queue. The producer's job is to generate a piece of data, put it into the buffer and start again. At the same time, the consumer is consuming the data
(i.e., removing it from the buffer) one piece at a time. The problem is to make sure that the producer won't try to add data into the buffer if it's full and that the consumer won't try to remove data from an empty buffer.
laszlof
well, good luck with that
diegoviola
so any ideas?
thebuccaneersden
I dont know why anyone would want that in php, since php isnt asynchronous or threaded (at least not inherently good at it)
i wonder if hes referring more to an observer pattern
__adrian
diegoviola, you want to turn that into a Client object? is that correct?
diegoviola
__adrian: yes
laszlof
it looked like a standard model class to me
__adrian
yeah, just a model
maybe add a factory/accessor for it
laszlof
Im just not sure what the hell producer/consumer has anything to do with it
__adrian
oh... i just got here, i wasn't sure that was part of this question
diegoviola
it doesn't have to be called that
consumer/producer
__adrian
well.. is that what you want?
laszlof
i dont even know what its in reference to
im assuming model/controller
__adrian
"doesn't have to be called that" is meaningless. "that" means something specific. is that specific thing what you want?
diegoviola
right
laszlof
the controller would probably have a validate() function that iterates through the items and calls the specific model validate() methods
diegoviola
laszlof: right
laszlof
i believe its called "select()" in your thing
diegoviola
laszlof: he wants me to have a validName, validCpf, validFoo, validBar
laszlof
diegoviola: yes, in the model
runinsquares
is there a reason he's set them all public? or does he expect you to change them?
laszlof
in the controller, you would instanciate the model class, set all your values. then have a validate() function that goes through and validates all the specific elements
diegoviola
laszlof: that makes more sense
laszlof
runinsquares: you would want set/get functions to be public.
the controller isnt going to inherit the model
runinsquares
validName is public too, i'm wondering if he wants the logic outside of the class
$foo = new Consumer; if($foo->ValidName($bar)) $foo->setName($bar);
laszlof
i dont have time to mess with it right now. but if I'm around later I'll give you a hand
diegoviola
ty
he probably thinks I'm a noob and I have trouble with logic, what I'm having trouble with is with vague logic
runinsquares
i can imagine him sat there with a smug smile on his face tbh lol
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 next »