« first day (674 days earlier)      last day (4274 days later) » 

12:00 AM
exactly. As is intended in MVC. Modularity.
 
You are creating two instances of each component. You only code each one once. With 2 templates, you need to code the data fetching/template population code twice
 
do you even understand how classical MVC differs from MVC-inspired patterns for web ?!?
 
or as many times as you're using the template
 
lol thanks @ asshole that -1
 
12:02 AM
what you are suggesting is to execute whole triad with different parameters for each user
 
Yes. Exactly!
 
initializing EACH of the structures again and again
 
Because it makes it entirely modular
without the need for repeated code.
Place any view in any other view
reusable components
 
after scrolling up, my only response is "um."
 
really ? with out repeating code ? and where do the 10 triads come from ? magic fairy dust ?
where do the 10 different request to controller come from ?
 
12:04 AM
No, of course you need a entry point, but this is a single line in the view, which creates another view (and possibly model, and possibly controller).
 
how is that better then "single line" which reuses same template to populate with different data from existing model ?
i actually fail to imagine how any of this can be done in a "single line"
 
What if you want to put the same form on two different pages? If you can't place a view inside a view it's impossible without repeated code.
 
@tereško $godObject->run($request)->violateTheLawOfDemeter()->getResponse()->outputTo('php://stdout');
 
form is just a template
 
A populated form isn't
 
12:08 AM
It's populated with data from the model
 
populated form is a template where someone added data
 
Therefore, how is it different than any other template; populated with data from a model?
 
A simple factory: $module->create('Foo/Bar');
using the same router that's used for URL routes
 
Okay. another question.
:-)
 
so view created instance of $module ? how is it not violating SRP ?
or was it injected in the constructor ?
 
12:10 AM
@daviesgeek ask away
 
View gets passed the factory in its constructor using DIC if it needs it.
 
I have a nested array and I want to search it with something like array_search. However, it returns "Wrong datatype"
Array
(
    [0] => Array
        (
            [User ID] => 19
            [Application ID] => 30
            [Read] => 1
        )

    [1] => Array
        (
            [User ID] => 19
            [Application ID] => 1
            [Read] => 1
        )

    [2] => Array
        (
            [User ID] => 19
            [Application ID] => 1000
            [Read] => 1
        )

)
 
What are you searching for?
 
^^ That is the array ^^
@Lusitanian I'm searching for the Application ID.
So, something as such:
$key = array_search($app['id'], $data['unreadCount']);
 
@Lusitanian because the Model has a state. That being "Which user is currently being viewed/edited"
 
12:11 AM
@TomB , and then the view creates another triad ?!
 
The factory does
 
> A view requests from the model the information that it needs to generate an output representation.
this is what view is responsible for
 
Indeed, and part of that may be a nested view
 
which makes it "not-MVC"
last time i checked "instantiate another MVC triad" had nothing to do with "request information from model"
 
Hardly, MVC isn't that strict. Nowhere in the definition of MVC does it say that views can't include other views. Hell, in most MVC implementations there's a window layout which includes another view. On the web you generally have a layout which is... a view. Which includes other views
 
12:14 AM
@Lusitanian I need to get the key of the search result
 
"Views are designed to be nested. Most windows in fact involve at least two views, one nested inside the othe"
 
notice how it says "views" not "MVC triads" , and why do you keep pointing back to the pattern which cannot be implemented in PHP or web in general ?
 
@daviesgeek you need to use foreach for that
array_search doesn't support nested arrays
 
@meze How would I do that?
Like this?
17
Q: How to search by key=>value in a multidimensional array in PHP

danIs there any fast way to get all subarrays where a key value pair was found in a multidimensional array? I can't say how deep the array will be. Simple example array: $arr = array(0 => array(id=>1,name=>"cat 1"), 1 => array(id=>2,name=>"cat 2"), 2 =&g...

 
@daviesgeek foreach ($data['unreadCount'] as $unreadCountKey => $unreadCount) { if ($unreadCount['Application ID'] == $app['id']) { $key = $unreadCountKey; break; } }
 
12:18 AM
@tereško it can easily be implemented on the web. There's nothing stopping it other than people's comfort zone being in the page controller mentality as described here: blog.astrumfutura.com/2008/12/…
 
@meze Thanks! I will try that.
 
and if you read that link, it does mention each view in the nested triad having its own controller
 
@daviesgeek sorry had to run a minute but i believe you just got an answer (:
 
@TomB , do you know why Smalltalk definition says to nest views ? because there are no such thing as templates for smalltalk
 
@Lusitanian Yes I did (i'm testing it now) But thank you for your help.
@meze Invalid argument foreach()
It doesn't like $data['unreadCount']
 
12:20 AM
what is in var_dump($data['unreadCount'])?
 
@meze Haha! I gave you the wrong var
:-) the var is $data['readCount']
Okay...I echoed $key and it doesn't return anything...
 
already checked what is in $app['id']?
btw is that array comes from PDO?
 
@meze PDO?
 
ok nevermind
 
@meze Yes. It is a number
 
12:24 AM
@daviesgeek then it's not in the array
 
@meze What do you mean by that? It won't be found in the array?
 
@tereško that's pure conjecture and irrelevant anyway because a view is a view.
 
@daviesgeek what is that number?
 
It's been fun chatting but it's getting late and I have work in the morning
 
@meze It is within another foreach loop, so it depends.
 
12:25 AM
true
 
@TomB a view isn't a view if a user can't interact with it. Templates are just strings. And it won't make them views if you put strings in SomeView class
 
Anyway, I'm off to bed, it was fun ahem discussing :P
 
html too is just a string ... your point ?
 
@meze, Users interract with the view by clicking links on the web page. Provided the view is re-created in the same state on subsequent requests, it's no different at all to a view in a desktop application
 
my point is there's no view
@TomB they click in their browsers
@daviesgeek no
 
12:28 AM
 
@meze :-) Just realized that. The rest of the loop executes just fine.
 
Indeed, in windows applications you click a button, the mouse action is interpreted by the operating system, triggers an event in the windows API and the windows API calls a function in the application. It's no different having a web browser in place of the windows API
 
@TomB it's different. And that's why it's cool to change view's controller in runtime - a user won't even notice it - the behavior will change
 
@meze Any ideas?
 
And that brings me back to my initial point about giving views access to their controller :P
Anyway, I really must get some sleep
 
12:31 AM
@TomB night
 
night
 
@meze Why isn't it in the array?
 
@daviesgeek i don't know
@daviesgeek var_dump every step
and see if it's really in the array
 
Odd. It isn't finding it.
 
@tereško so are you against storing files in the database's blob-column?
 
12:36 AM
in general , yes
 
@daviesgeek foreach ($data['unreadCount'] as $unreadCountKey => $unreadCount) { var_dump($unreadCount['Application ID'] . ' == ' . $app['id'] . "\n"); if ($unreadCount['Application ID'] == $app['id']) { $key = $unreadCountKey; break; } }
 
but there are some situations where it might be beneficial , for example, when you utilize ROLLBACK in your queries ( with small files )
 
sigh /me is stupid. Of course it isn't finding it!! I don't have a matching id in the array!
 
yes just wanted to say that SQL Antipatterns book recommends it for such situations
 
it is for very specific situations , and should not be done "because i can"
 
12:38 AM
but i disagree with his solution
you can simply never remove a file and run a cron job that will clean up your files
 
here is a hint: distributed file system is not a simple as you might imagine
 
Okay, now it is finding it. However, it is finding 12 in an array that only has 9
Any ideas on why that would be?
 
@tereško what?
for amazon s3 it's just one request
@daviesgeek if you have another loop above, then before foreach do $key = null;
 
@meze Okay...
Still finding 12 in 9
 
@daviesgeek then var_dump() that array and check application id
or use debugger
the distributed file system isn't problem. the problem is disk fragmentation for small files.
 
12:54 AM
@meze The array is still the same as above. It is returning 0 as the key
Weird...
 
@Lusitanian - a page can be both populated with json and contain the string 't-shirt'. This is what's happening. Let's not be childish with the downvotes please. — pguardiario 1 min ago
this person is such an idiot
@tereško does what he's saying make any sense to you?
and/or anyone else in here
 
@meze Oh dear. When I add an array with "43" for the Application ID, it returns 0 for all the applications
 
@daviesgeek i can't say what is wrong without code and data
just var_dump every step of the loop
 
1:11 AM
@Lusitanian , i have no opinion
 
heh, i just don't even get what he's trying to say
 
i exhausted my reserves of "opinion" about an hour actually more like two hours ago
 
understandable.
@tereško I'm done with answering questions on S/O for a h-while, everytime I do someone with Dunning–Kruger comes along and annoys the crap out of me unless the question-asker has it him/herself
 
@Lusitanian he was trying to say that the error page could contain t-shirt string
your answer won't help either
 
I know, mine turned out to be wrong
Should probably delete it.
That's not what he was saying though, he said that the entire body is somehow magically replaced with a mythical AJAX request
I think...
 
1:24 AM
meh, his #blahblah won't be parsed
i'd keep your answer
 
Nah, I left it as a comment too - it's redundant
The <center> cannot hold its too late.
 
but you were right in your first comment.
move it to an answer
didn't notice it . and i'll remove my comment
 
@meze done
 
upvoted ;)
 
heh, that one was actually a complete shot in the dark: i thought maybe it was some wacky custom wrapper that didn't know how to parse a fragment and was garbling it to hell
@Lusitanian - You're right, I'm actually thinking of the contents of the inspect panel which is where confusion from these things generally comes from. Downvote is inappropriate though. — pguardiario 2 mins ago
okay now lolwut. he admits to being wrong but says i shouldn't have downvoted
 
2:05 AM
@NikiC I wish Stas would be quiet on the mailing list.
He seems to be against every proposal and can never provide any good reasons.
 
@meze Yeah...I did. I'll do it again, and see :-)
 
@daviesgeek hey i actually have time to help you now
if you're still having issues (:
 
2:50 AM
@Lusitanian I do.
3 hours ago, by meze
@daviesgeek foreach ($data['unreadCount'] as $unreadCountKey => $unreadCount) { if ($unreadCount['Application ID'] == $app['id']) { $key = $unreadCountKey; break; } }
I used that.
3 hours ago, by daviesgeek
Array
(
    [0] => Array
        (
            [User ID] => 19
            [Application ID] => 30
            [Read] => 1
        )

    [1] => Array
        (
            [User ID] => 19
            [Application ID] => 1
            [Read] => 1
        )

    [2] => Array
        (
            [User ID] => 19
            [Application ID] => 1000
            [Read] => 1
        )

)
That's the array I'm running it through
And my problem is that when $app['id'] = 12, it returns 0
And also when there is an array with an Application ID of 40, it returns 0 for all the $app['id'] s
 
I don't understand how an HTML element is not output if it is between two PHP code blocks?
 
@daviesgeek so what exactly are you trying to do
you want to find a sub-array which has an Application ID of 12?
 
Can someone enlighten me on this? A good example would be <?php if (something) { ?> <p>I am hidden if something is false</p> <?php } ?>
 
@W3Geek what about it?
 
How does it work? I don't understand it?
I thought the PHP engine wasn't running if it is outside a codeblock?
 
3:00 AM
@W3Geek there are curly brackets though...
 
Even without the curly braces it works...<?php if ($expression == true): ?>
This will show if the expression is true.
<?php else: ?>
Otherwise this will show.
<?php endif; ?>
 
obviously. learn some common sense please.
PHP is a server side language. It is compiled BEFORE information is sent to the client. Therefore it can control what it wants sent the client. If something is blocked out by PHP like in the situation above, then it won't be sent to the client.
 
What do you mean, learn some common sense. You said there are curly braces though... I just said that it works without them also. All of the output from this code would be sent to the client, <?php echo $something ?> <p>Hello</p> <?php echo $something ?>.
 
@W3Geek do you know the difference between client and server?
 
3:07 AM
Yes, the sever is a computer that is responding to requests while the client is a computer sending those requests, what HTML and CSS render on. @Lusitanian, Please. Nile, you sound like a troll. If you don't want to help someone don't help them.
 
@W3Geek I'll make this a bit clearer than he's making it
 
@W3Geek so if the server says DONT SENT THIS TO THE CLIENT, guess what happens?
 
@Nile stop, you're getting a bit inflammatory
Not that I don't but, heh, not worth it (:
 
@Lusitanian it's so aggravating...
such a basic concept.
 
@W3Geek Basically, the PHP engine works by interpreting any file it reads. When it gets to conditional statements, like if(true) { // blah }, obviously the condition body is only executed when "true" evaluates" to "true"
So what happens when there's a break in between code blocks is this
 
3:09 AM
@Lusitanian Yes.
 
@Nile Whoopy do dah for you. Its not that easy for me to understand. Everyone learns differently.
 
It's basically a giant "echo" block, as though you were executing echo '<html><blah>'; but it doesn't need to be escaped, etc.
Therefore, the conditional that it's wrapped in still applies even though it's not in <?php tags
The same goes for loops
<?php for($i =0; $i < 10; ++$i) { ?> hello <?php } ?> will output hello ten times
 
@W3Geek if that doesn't make sense to you, read up on client-server interactions
 
@Nile the thing is it's not really about client-server interactions
it's just the way the php engine works
some scripting languages might totally ignore what's outside of code in preprocessing tags
so it really is a valid question
maybe i'm just taking the summer o' love too seriously, anyway @daviesgeek i'll make you a codepad (:
 
@Lusitanian Yes I see. So it basically acts like an giant echo block between the conditional block. I've seen this, <?php if (something) echo "<html>" ?> and I know exactly what that does. Just <?php if (something) ?> If something equals true, display this <?php endif; ?> was confusing me.
 
3:14 AM
okay, well there you go
it's still parsed by php
 
I thought for sure PHP ignored what was outside its codeblocks.
 
@W3Geek it does
> Everything outside of a pair of opening and closing tags is ignored by the PHP parser which allows PHP files to have mixed content.
this page should explain it in-depth: php.net/manual/en/language.basic-syntax.phpmode.php
 
@Nile not exactly though
that's misleading
 
> PHP skips them according to the condition since the PHP interpreter will jump over blocks contained within a condition what is not met.
 
Example #1 Advanced escaping using conditions is the section to read there @W3Geek
@daviesgeek what that function allows you to do is arbitrarily query an array like that given an array query
so you can search by one or more fields in the array
 
3:20 AM
Thank you @Nile. It is misleading though. Conditionals control whether an HTML element is displayed or hidden.
 
i gave you some examples, if you need help understanding let me know
 
@W3Geek no they don't.
 
> PHP will skip the blocks where the condition is not met
 
" PHP skips them according to the condition since the PHP interpreter will jump over blocks contained within a condition what is not met. "
which means yes, in essence, conditions do control whether or not html outputted within code blocks is displayed/hidden
 
3:21 AM
yes, it skips everything in the block. not specifically html elements. you could add more php between the blocks and it would be skipped also
 
yes, but he's narrowing it down to a subset, you're just being semantic :P
 
okay, then nevermind. d:
 
hehe
 
@daviesgeek is it still not working?
 
I am very subsetting, if that is a word. :P
 
3:22 AM
(i was out eating and such
)
heh
there's a reason i phrased it as i did
 
I'm sure
I enjoy doing that from time to time though
 
cause you pervs would find a way :)
 
of course!
 
@W3Geek here:
> Subsetting is a concept used in research communities (for example, earth sciences) to describe the process of retrieving just the parts of large files which are of interest for a specific purpose. This occurs usually in a client—server setting, where the extraction of the parts of interest occurs on the server before the data is sent to the client over a network. The main purpose of subsetting is to save bandwidth on the network and storage space on the client computer.
(wikipedia)
 
3:24 AM
@Lusitanian haha
 
lol xD I didn't even know it was a word. @Nile Is it just conditions that control this in PHP?
 
@W3Geek Lol, I'm kidding, It's not actually a word. What do you mean is it just conditions? You can do the same thing in functions and methods also.
 
@Nile haha now I feel stupid. Hmm that is cool. So you could make a function or method that renders a whole document?
 
@W3Geek yes, although probably not recommended.
 
3:27 AM
@Nile, isn't that supposed to be subnetting (in your fake definition) by the way?
I can see your point.
 
it's not a fake definition, it was obtained by searching "define subsetting" on google, but it's not an actual word was my point
 
@cHao btw did you have fish taco for dinner
okay now i'm really done.
 
and no @W3Geek
> A subnetwork, or subnet, is a logically visible subdivision of an IP network.[1] The practice of dividing a network into two or more networks is called subnetting.
(subnetting as defined by wikipedia)
 
@Lusitanian nachos and chicken strips, actually. quit pervin :)
 
i'm done
sounds like my kind of meal lol
 
3:29 AM
Yes, thats what subnetting is! Geez I feel really dumb now... >.>
 
@W3Geek sorry I meant subnetting, editted
 
lol its ok @Nile.
 
@cHao i just read a giant ass answer of yours on DI
 
really? which one?
 
I've gotten to the point where if I see another question relating to singletons
I'm just going to write "Don't look for things. It applies to development and life."
4
A: Is a singleton appropriate for this design?

cHaoAs for whether a capital-S "Singleton" is appropriate...ask yourself this... Is a second instance certain to cause the death of my program? (I do mean "certain" and "death". Not just "likely"...and not just some confusion about which instance is the "official" one. If the program will cra...

 
3:31 AM
lol
 
lol, i started out porting GNU units to PHP then realized writing a wrapper would be way simpler
$unitConverter = new UnitConverter();
echo $unitConverter->convert('2 gigabytes', 'megabytes');
woo
fun part:
$unitConverter = new UnitConverter();
echo $unitConverter->convert('2 gigabytes', 'fluid ounces');
 
lol
nannite memory!
 
good this actually works well, unit-test + github for it.....................tomorrow.........or maybe the next day
throw new Exception\ConformabilityException('HOW AM I SUPPOSED TO CONVERT GIGABYTES INTO OUNCES GODDMAINFOIVWJEVIWVE!!!!!!!!!!!!!!!');
 
3:49 AM
lol
 
meh. i will be surprised if one other person ever uses this
 
why's the path so long? and why's it in a src directory anyway? php doesn't have "source"; the source is the program
 
because i'm using as part of a larger project that conforms to PSR-0, and idk because i see that all the time for php libraries
which doesn't really make all that much sense i suppose
cargo-cultism
 
really doesn't...lol
 
I put my source into src and my tests into test. Wow. Amazing idea.
 
3:59 AM
src should potentially be called lib, but i dunno
@PeeHaa changed my oauth "lib" dir to "src"
 
@Lusitanian Thank you. I will take a look at it later tonight, or tomorrow. I appreciate your help
 
@daviesgeek of course, ping if you need anything, i idle here often
 
Sam
hi folks.......
is it better to inject a class with another class or an interface? Most of the examples I see use Interfaces, especially since the problem they are trying to highlight has multiple solutions (e.g. db access, filesystem, web service,etc); however, if the problem has a single solution (e.g. a single db access), does it still make sense to use an Interface?
 
@Sam If you are asking about database stuff specifically, then yes.
You should ALWAYS abstract that away.
 
Sam
4:15 AM
@LeviMorrison why? because the underlying db can be changed anytime?
 
High level details should not know about low-level details.
@Sam Well, that's one reason.
Another is testing.
You can mock database tests, but that's not nearly as simple as mocking an interface.
 
Sam
well, I haven't done any unit testing yet (still relatively new at OO)
I mean....I understand Interface and what it does.....but the problem is trying to figure out when it's needed to be used and when it's an overkill
 
rule of thumb: never overkill
 
Sam
@Lusitanian rule of thumb: never overkill, when you know you are overkilling. :-D
 
Well, there is a point of overkill.
But since you are new you should try using them all over.
Eventually you will see when they shine and when they suck.
 
4:23 AM
night everyone -- may you dreams be exception-less
 
Sam
that actually makes sense........guess I start refactoring my DIs to use interfaces
@LeviMorrison thanks
 
user895378
@LeviMorrison Spl\HashingMediator is working swimmingly for http client event notifications
 
@rdlowrey Did you pull the most recent updates?
 
user895378
@LeviMorrison no -- I see callable type checking is now implemented :) pulling ...
 
@rdlowrey Also, do you agree with the approach taken here?
 
user895378
4:32 AM
@LeviMorrison I don't know if it's really necessary -- I mean, do you really need to protect people from the performance impact of the hash() call that results from trying to remove things that aren't callable in the first place?
 
user895378
I don't feel strongly about it, but I would vote 60-40 to remove the is_callable check there.
 
I don't want hash to bork on NULL or FALSE, the two most common places it would fail.
 
user895378
In that case, I would probably just do if (!$callable) return
 
user895378
with braces and indentation, of course :)
 
Noted. I'll think about it some more.
 
user895378
4:37 AM
Well -- I don't know -- does the hash function break on a resource parameter?
 
I'm fairly certain.
It's not intended to work as a generic hashing algorithm.
 
user895378
It may be easiest just to leave the is_callable check now that you mention it. It guarantees you'll never pass a bad parameter. And a resource would pass a simple boolean check.
 
user895378
I wasn't thinking in those terms, but I'd say keep it with that type of error-prevention in mind.
 
I find it funny that hash is the most complex part of the whole class.
 
user895378
that is funny :)
 
4:39 AM
It goes to show how useful a tiny bit of code can be.
@rdlowrey Changes pushed?
 
user895378
@LeviMorrison I hadn't yet, but if you'll give me just a few minutes to clean some stuff up I will so I can get your thoughts on a couple of things if you don't mind.
 
user895378
@LeviMorrison lol awesome
 
4:55 AM
I need to upload some large video files onto my site, has anyone ever used swfuploader ? I'm thinking of implementing it for my users, don't know how good it is, and how safe it is.
 
user895378
@LeviMorrison I'm going to go ahead and push in just a moment, but be aware that massive test failures will result if you run phpunit on the changes -- I did away with the mutable/immutable delineation today, but havent merged the tests to reflect that yet.
 
Okay.
 

« first day (674 days earlier)      last day (4274 days later) »