« first day (617 days earlier)      last day (4328 days later) » 

5:05 PM
 
2
Q: Proper use of MVC to display front-end in the Joomla controller

r20rockI am developing a Joomla component and I have many tasks to be performed in the components. What I am doing presently is Having a single view and the controller corresponding it. Now if a user requests some task, I simply call corresponding method in the controller. In this method itself I have w...

lol .. OP managed to have "proper MVC" and "joomla" in same sentence
 
@Gordon Dupe of which question?
 
5:09 PM
Hello?
I edited my deleted post?
 
@JeanPaul I've seen, and posted a reopen request
 
@Truth lol, he edited it out because he isnt agreeing to it. rolled back
 
I voted to reopen, it takes 5 people to reopen a closed question, so that means 4 more needs to vote on it
@Gordon XD OK
 
3 , actually
 
@tereško really? :o
I was always sure it was 5 (as closing takes 5)
 
5:12 PM
no , i mean , you need 3 more to reopen it now
 
@Truth well, i still think its borderline too localized but in dubio pro reo
 
Oh, 2 now :)
@Gordon Aight then, voted
 
I'm new to this chat, but I really can't understand all these rules.. I know that they are necessary but in some extreme case, they aren't. For example, jstree v1 is a plugin that a lot of people are using, and the code for the backend is extremely complicated for a non-PHP savvy like me
 
@JeanPaul What rules don't you understand?
 
@tereško I looked into 'Closure Tables' and even ordered the book, but I doubt that can be adapted to jstree.
 
5:14 PM
Seems as if 1 more reopen vote is missing :P
 
Yeah
So you need 5 to delete a post
and how many to reopen it?
should be 5 as well
 
@JeanPaul Close* and 5 to reopen it
 
@Truth Ok, that seems fair
 
@JeanPaul , JSTree sounds like javascript frontend .. the closure tables are for storing the tree-like structures
 
Correct
which that's the reason for me to ask the questions in PHP
 
5:15 PM
well .. no .. actually it is more like for storing directional graphs
tree is just a specialized subset of that
 
I took care of the frontend, I read a lot about the topic and while the previous versions of it were allowing you to either by DB design or scripting use either Adjacency Model or Nested Set, the front end had a lot of glitches
so I suggested my client that we needed to move to PHP 5 to make it work with the newest version and it had took me a month to master the front end and voila! The issue with the backend
 
 
@tereško I agree, but we are using JSON so we are passing the data to the backend through that process is where what should be standard gets complicated by just adding 1 record to the DB
 
php 5.0 was released like 8 years ago
 
the user_id
 
5:18 PM
most of companies are thinking about moving to 5.4 now
 
Yeah.. .well you can imagine how were things around here LOL
That's the problem when you try to talk to 'SENIOR DB architects' from USA these days
 
so .. the bottom line is that i should look at your latest question (which might not be such a good idea since i am on my 3rd beer)
 
and yesterday you had 7
before chatting with mars, am I correct?
 
it's that time of year
 
hahahaha
In Ukraine it is as well.. specially after Ukraine lost against France
Maybe in here all the problem is the DB design part, I mean on the front end is trying to do it, but then the records appear empty when copying
 
5:22 PM
@JeanPaul , naah , it's the solstice festival
 
If I use Drag and Drop, which is merely taking the folder and doing a move it works, so I'm suspicious about that
@tereško How is the weather? In here is hot as in Panama these days, which I miss terribly but don't get me wrong I prefer the snow :P
 
cold .. it was 14°C yesterday , with wind and no sun
 
40*C here
southern from you, not in India :P
 
@webarto Where's that?
40 degrees Celsious.. mm let me think: Egypt?
I suck in geography!
 
Belgrade, Serbia... nah, concrete gets hot, air temp is about 35
 
5:33 PM
@webarto Been there, done that.
That's expected for us for the entire week now :<
 
I have a friend from Serbia who recently wrote this wordpress plugin: wpcolumns.com
 
0
A: How does PHP include scope work?

TruthFrom the PHP's manual: When a file is included, the code it contains inherits the variable scope of the line on which the include occurs. Any variables available at that line in the calling file will be available within the called file, from that point forward. However, all functions an...

If anyone has anything to add to either question or answer, feel free to edit
 
@tereško If it's so cold why not vodka or cognac rather than beer?
I prefer Rum though in here is way too damn expensive
 
@Truth cheater
 
@Gordon ? :P how so?
 
5:37 PM
@Truth i disagree with self answered questions
 
@Truth You should make it CW
 
@Gordon Meh, SO sees it as positive
@NikiC I agree
 
Community Wiki
 
@Truth done :)
 
@Truth Joel sees them like that. Actually they are quite controversial
4
A: Posting and answering questions you have already found the answer to

GordonNote: This answer is also in response to http://blog.stackoverflow.com/2012/05/encyclopedia-stack-exchange and the short exchange I had with @spolsky on Twitter about it (which is too limited as a channel to discuss this topic). I disagree with answering your own questions or using StackOverfl...

 
5:38 PM
@JeanPaul Your question is reopened
@NikiC Done, can't make the question as one though
 
@Truth Yeah, you have to flag the post for that
 
@NikiC That won't pass, I won't flag it.
If you think you have a chance you're welcome to try
 
@JeanPaul looks good... I will probably start to work for www.managewp.com (they are from Belgrade too) at some point in the future... but will not work with wp directly...
 
@Truth besides, I think that is sufficiently explained in the Manual and there is plenty of Q&A about this, so we dont need that one. It didnt take you long to find a suitable dupe to stackoverflow.com/questions/11179480/… which I suspect is the reason you made the self-answered one.
 
@Gordon Yeah, but there's none with a decent full answer to the question, and there are a lot of such questions
So I wanted to create a complete catch-all to link for future questions
 
5:43 PM
Hi guys, on Joomla! when you turn on the SEF URL option, it will rewrite certian URL's. but when you access that url through your browser, it doesn't exist yet somehow the primary index.php file still intercepts it, I'm assuming it's apache that does that, how could I do something like that? anyone here did something like that before?
 
@Truth i think the ones we have are good enough and the manual pages vor variable scope and include explain that well
 
@truth: Many thanks! I'm greatly appreciated.. I'm trying with another table and cloning the dependencies and will give it a try :)
 
@Stuyvenstein all URL's that are not real files or directories (-f -d) will be redirected/routed to index.php... you'll need a so called Router/Request/Response classes to make this thing work good... every PHP framework functions like that (routes all traffic to index.php)
 
So you basically need to intercept the url's and provide a page or a 404 page if the url does not exist. @webarto You say php already has something like that?
 
@Stuyvenstein Not natively, but you can construct one.
 
5:56 PM
@Truth Generally it's better to answer an existing (or new question)
 
So how would you go about setting up such a router/request systems? Anything I could google?
 
@Truth At least it saves all the discussions ^^
 
@NikiC And then you get bombarded with "Why do you answer a duplicate?"
 
@Truth no, if it's a good answer it's okay
But to be perfectly safe one can obviously answer one of the existing questions ^^
If it is too localized just edit the Q to be more general
 
@webarto @Truth So how would you go about setting up such a router/request systems? Anything I could google?
 
6:00 PM
@Stuyvenstein It's very simple really
 
If you rewrite www.example.com/about/post/1 to www.example.com/index.php?route=/about/post/1, simply parse the route GET variable and include appropriate files.
 
@Truth Sorry but I don't quite understand. And is it only the web server that has to intercept the url?
 
@NikiC its not okay, because then you spread the quality answers over the dupes instead of collecting them on a canonical, hence picking an existing, non-dupe is always the better choice.
 
@Stuyvenstein you are not intercepting anything
 
6:11 PM
@webarto I mean finding out what the requested url is, how would I that?
 
$_SERVER['REQUEST_URI'], in your PHP file, you then parse it...
 
@Gordon right
 
@webarto That would only work on the accessed php file, I need any url on my domain to redirect to index.php parsing the original url request
 
6:37 PM
Why to people keep insisting on using stdClass in place of arrays?
 
@GordonM I actually like $this->syntax better than $this['one']
Not justification to murder code efficiency like that though
 
6:56 PM
guys can I ask a quick question?
 
@mars shoot
 
I'm trying to extend the SoapClient class in php to add curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
to the requests
where can I download the source code of the SoapClient class?
 
What SoapClient class? If it's part of some open source project then I guess from the website / github / whatever of the project
 
hi there
 
@GordonM They think it makes them more OOP
 
7:04 PM
@NikiC God save us from programmers who think they're being OOP
Look, I'm using stdClass so I must be OOP! It's just like using arrays except I can't get useful results from count() or empty() and I can't use integer indexes and I can't have any key that couldn't be used as a PHP variable name and I can't use any of PHP's array functions with it, plus it's only got about 6 times the overhead associated with it as an array does, plus I don't have any behaviour or semantics so being a stdClass doesn't tell me anything about the data. I'm so cool!
4
 
0
A: Converting named HTML entities to numeric HTML entities

hakreYou are looking for a simple translation function from named HTML entities to their numeric counterpart. This can be done by using a translation table (that is an array) and the string translation function (strtr): $translated = strtr($string, $HTML401NamedToNumeric); This works for $string b...

 
@GordonM That one definitely deserves a star.
 
7:22 PM
thanks.
Does SOAP get much real world use?
Because what I've seen of it suggests to me that the work needed to make it work is ludicrously disproportionate to what benefits you get from it.
 
user680786
Hi all. I've sent feature request to php.net , I'm asking for add Checked Exceptions to ‪PHP‬ (from Java). If you like this idea - retweet please :) twitter.com/eugeniyoz/status/216975744650326017
 
@OZ_ Meh, a developer doesn't have to catch exceptions
 
user680786
@Truth and who have to?
 
That's the beauty of it. He has the choice to catch any/some/all/none of the exceptions, and allow it to bubble up to see the debug trace that caused the exception to be thrown
If you want, there's PHPDoc that can hint IDEs about which exceptions are being thrown in a function
 
user680786
You can do it with checked exceptions too, just rethrown them.
 
user680786
7:32 PM
and comments it's just comments, I don't like to write logic in phpdocs (or any other comments)
 
@OZ_ Why add the extra code?
I have a page which throws PDOExceptions, I know I can handle those PDOExceptions but no other types of exceptions
 
user680786
@Truth to make this code more stable. to not forget catch exceptions. Ask this question Java developers :)
 
@OZ_ If you do forget, you'll notice immediately when the exception is thrown
 
user680786
@Truth I'm not asking redesign all exceptions to catched only, it will be nonsence. I'm just asking about '''adding''' new type of exceptions.
 
user680786
@Truth no, exception will be thrown not always, because it's exception.
 
7:34 PM
@OZ I don't like the idea either much, but in any case you are really only wasting your time by submitting it in the bug tracker
 
@OZ_ You aren't suggesting a new type of exception
You are suggesting a syntax change
 
Your FR requires a (deep) language change, as such it needs an RFC and discussion on internals
 
user680786
@Truth no, you don't get my idea. I'm actually asking for adding.
 
Obviously best with a proof of concept implementation, if you know C
But in any case an RFC
 
7:35 PM
@OZ_ You're asking PHP to be able to hint which exceptions are thrown
 
user680786
@NikiC well, any idea have chance :) It's not my even idea, and Java developers already know all benefits of this idea.
 
@OZ_ No, the idea doesn't have a chance
 
@OZ_ Java is much MUCH heavier with OOP than PHP
 
Not if you submit it as an FR in the bug tracker
 
7:36 PM
It has dozens if not hundreds of exception types
 
But if you start a discussion on internals, then it does have a chance ;)
 
That's the reason where it can possibly be useful
 
user680786
@NikiC aha... Will you let me know how can I do it? :)
 
Especially when Java exception terminations are often far less pleasant to the user than PHP exception terminations.
 
user680786
@Truth well, it's good to be better:)
 
7:38 PM
@OZ_ You can subscribe to the internals list via php.net/mailing-lists.php and then send a mail
 
user680786
@NikiC thanks
 
@OZ_ I never said it was better (though I truly think so), each has its own advantages and disadvantages :)
 
@OZ you might find this of interest: java.dzone.com/articles/checked-exceptions-i-love-you
 
user680786
@NikiC yes, thanks.
 
7:53 PM
> You can make your own object types and have PHP execute it as if it were part of the PHP language itself. See more on classes and objects in this manual at: php.net/manual/en/language.oop5.php
W.T.F.
 
@OZ btw, if you are going to send that mail to internals, it would be nice to make it a bit more detailed than the bug report. It should explain what exactly checked exceptions are and why they are useful :)
 
@PeeHaa Where'd you see that?
w3schools?
 
user680786
@NikiC I think php core developers knows better than me, what is checked exceptions. But now I'm reading Misko's article and I'm think about rethrowns.
 
> * * * * * * { background: rgba(255,0,0,0.1); } /* Let the carnage begin! */
Awesome XD ^
 
8:06 PM
Why do I get undefined function strptime()?
PHP version is 5.3.8
date/time support is enabled according to phpinfo()
 
@PeeHaa I'd prefer it is you used E_ALL instead of -1 in the tutorial ;)
 
Oh, nevermind. discontinued function
 
-1 is so unclear
And as of 5.4 E_ALL really is E_ALL
 
@php docs people. uhhhhmmm shouldn't we change this piece of shit? php.net/manual/en/security.database.sql-injection.php
 
@PeeHaa sure
 
8:10 PM
@NikiC How sure are you that E_ALL will stay everything when PHP 6 comes out?
 
@PeeHaa Sure enough
And in any case, it's not like you can't edit the docs after they're written ^^
 
@PeeHaa I'm pretty sure the world will end before PHP6 comes out :)
 
@NikiC :P true
 
@PeeHaa Also, what is very important for a starter tut in PHP is making github.com/PeeHaa/php-net-tutorial/blob/master/topics/… more complete
Telling people to "just install Apache and PHP and configure it" will definitely not help people get started ^^
 
@Truth Was just an example. Wouldn't surprise me if something like error_reporting(E_ALL | REALLY_ALL_THISTIME) is needed for a version 5.x ;)
 
8:12 PM
In particular I think we can make use of the built-in webserver :)
 
@NikiC Was thinking about that yep
 
I have a very strong feeling that most php devs don't know what safe_emalloc is good for: lxr.php.net/xref/PHP_TRUNK/ext/standard/base64.c#69
It makes very little sense to use it if you'll just pass in a multiplication as one argument...
Pretty much defeats all the safeness
@PeeHaa Will you change it? :)
 
@NikiC I think I will. It has been bothering me for too long now
@NikiC could you please add those 2 suggestions about the tut to the issue tracker? I tend to forget about stuff after a weekend :)
 
8:49 PM
1
A: PHP Regex - Extract Text Between These Two Tags

TruthDOM can parse HTML documents with errors. It simply throws warnings, that doesn't mean it won't be able to parse. Go with DOM anyway, it should be able to solve your issues. Simple example to prove concept: <?php $html = <<<HTML <div id="test"> Test </div> </div> ...

And NOW I'm happy with the answer :)
 
9:32 PM
@Truth borderline repwhoring imo
@Truth and its not an answer to be happy about given that you didnt even tell him how to properly suppress the errors and didnt tell him how to fetch the innerHTML which he asked for
 
This room is alive, but the C room isn't. Wow.
 
9:48 PM
@Truth and it doesnt show how to fetch an element by attribute either. im tempted to dv the answer because it basically has nothing that was asked for.
 
10:00 PM
@TC Impossible
@TC Oh, you mean C not C++?
Well, yeah, who want's to use C ^^
 
lol
 
is this code valid?
try{
$this->pdo->beginTransaction();
$query->execute();
$this->pdo->commit();}
so i can rollback if i catch a pdoexception?
 
@AnPel Why do you have a try block without a catch block?
 
@PeeHaa because we didnt answer him yet ;)
 
10:11 PM
@AnPel If you are doing just one query it doesn't make sense to use a transaction
 
@PeeHaa I do have a catch block I just didn't paste it.. it looks like:
catch(Exception $e){
$pdo->rollback();}
 
if it fails it just fails
 
but I dont know if it will work
 
@AnPel then try it
 
you need transactions only if you are doing multiple dependent queries
 
10:13 PM
It did not work.. the thing is this. Admins upload news stories, and one image per story. I want to insert the data, then create a folder named after the lastinsertid(), and put the image and thumbnails in it..
I want to rollback in case anything in the image/thumb creation fails
 
ah, now I see
so, what part of it does not work?
 
@AnPel Why are you using a try / catch around the pdo stuff than?
 
@NikiC the query does not seem to execute, even though the code never gets to the catch block
@PeeHaa because I can throw an exception at any point of the process and have the insert rolled back
if it works that is..
 
@AnPel well, probably the query is wrong then ^^ try dumping the error message in the catch block :)
 
@AnPel huh? What you got here only will catch a pdo exception and has nothing to do (as far as I can see) with a thumb creation
 
10:17 PM
@PeeHaa the full code is:
try{
$this->pdo->beginTransaction();
$query->execute();
$this->pdo->commit();
$id = $this->pdo->lastInsertId();
$destinationDirectory .= '/'.$id;
if( !mkdir($destinationDirectory) ){
throw new Exception('Could not create images folder for this story');
}
// create thumbs here...
}
catch(Exception $e){
exit('dead');
$this->pdo->rollback();
throw new Exception($e->getMessage(),1);
}
 
Finally now we are getting somewhere
 
exit(dead) part is for testing only..
 
when I echo $id I get 0..
 
@AnPel Click edit and then "fixed font" (to the right)
 
10:20 PM
the message is now too old to be edited :(
 
@AnPel Try this: $this->pdo->lastInsertId('sequenceName'); (sorry)
 
can you please clarify sequenceName?
 
@AnPel What db are you on?
 
@PeeHaa mysql
 
hmm
sequence is a postgresql thing. Been too long since I've worked in mysql
 
10:23 PM
@AnPel Just to be sure: You do have PDO exceptions enabled, right?
 
@NikiC yes.. If I mess up my password or anything I get the errors ok..
 
@AnPel Thats a connection exception, which is different
I mean, did you set ERRMODE_EXCEPTION?
 
@NikiC not that I know of. How can I check?
 
@AnPel If you don't know about it you probably didn't ^^ Add a $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); after createing the connection
 
Word
 
10:28 PM
@NikiC Nope, added it, still echo $id is 0
are transactions supported for prepared statements in the first place?
 
uhm, I don't know, but I'd assume so.
btw, are you using a storage engine that supports transactions?
E.g. the MyISAM default doesn't have transactions
You need to use InnoDB instead
 
This is beyond me right now.. I dont even know what you're talking about.. let me google some things and get back to you..
 
10:43 PM
:)
 
I'm moving this password hasher outside of hash_. Re-naming it password_*
and putting it into standard
 
why?
I don't feel like password hashing is "standard"
 
standard library, along side crypt
(outside of the hash extension, since it doesn't use anything from hash)...
 
10:58 PM
@ircmaxell crypt is in std?
 
didn't know
well, then do standard ;)
 
11:11 PM
I hate windows
about 25% of the time, while compiling in a VM, it will force the computer into sleep
 
huh?
why would it?
 
no idea
 
does not happen for me
 
lol, I wouldn't think so
 
As too localized or not a real question
I was wrong and thought it is a dulicate, OP just corrected me.
@PeeHaa ???
 
11:26 PM
there are going to be 5 functions in password.c
password_create($password, $algo = PASSWORD_DEFAULT, array $options = array())
password_verify($password, $hash)
password_register_algo($prefix, Callable $create, Callable $verify)
password_make_salt($length, $raw_output = false)
password_compare($expected, $actual)
then again, I think password_compare should go on string. And I may move it there
 
@ircmaxell What does password_make_salt do?
 
@NikiC makes a random salt of specified length (either base64 encoded, or raw)
 
@ircmaxell Do all password hashes make use of the same base64 encoding?
 
all crypt ones do...
 
hm...
 
11:29 PM
A-Za-z0-9/.
 
and why do you expose password_compare?
 
Hi Guys
javascript room is very empty
But i have a js question, is it okay if i ask it in here?
 
well, it's a constant time string comparison function. And since new algos can be registered, it'd be nice to have a C implementation of the constant time algo...
that's why I'm not sold it belongs on password_* or string...
 
@ircmaxell Yeah, but by registering the algo it'll be autotically correctly comapred in verify, right?
 
@NikiC no, because $verify would return a boolean
 
11:31 PM
oh wait
i didn't see $verify
I thought it was implicit
 
no, because the options need to be extracted from the hash
so there's no way that I can see of doing that in C and still leaving things like PHPASS's $P$ usable
libtool: link: `ext/spl/spl_array.lo' is not a valid libtool object
make: *** [sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs....
libtool: link: `ext/spl/spl_array.lo' is not a valid libtool object
make: *** [sapi/cgi/php-cgi] Error 1
 
I.e. that password_verify on a custom algo would simply be return compare($hash, $create($input, $hash);
 
no, because it builds the string
 
?
 
because of salt-generation and options (such as iterations, etc)
think of implementing scrypt
 
11:34 PM
ah, right, there is an options array now
forgot
 
$hash = password_create($pass, 'scrypt', array('N' => 5, 'r' => 1000, 's' => 10));
now, if (password_verify($pass, $hash))
how do I extract those options (programmatically) from the hash string without knowing details of how they were stored?
since $create is free to return anything as long as it has the proper prefix (${$prefix}$)
if you can think of a way, I'm all for it. But I can't...
 
hm
Drop register algo :P
 
that is an option
and a pretty good one, since I can't think of a clean solution to the problem...
 
hello, dispite my question isn't php related i think (as web developers ) you can help me.
Has anybody here worked with mysql and EntityFramework?
 
actually, I think I will. If we want to add it later, we can, but for the initial proposal, it's more work than it needs to be...
 
11:40 PM
@ircmaxell agree
 
sounds good
once I get it to compile properly, I'm going to commit it and push to my fork
(I have been committing, but wanted to wait to push until I got it to at least compile half sanely)
 
11:57 PM
@NikiC in response to the scribbliings on your SO profile page... Behold:
Jun 21 at 15:21, by Cat Plus Plus
@JimNorton C++ sucks.
Feel free to advertise that in the PHP room too :)
Jun 18 at 20:12, by DeadMG
C++ sucks donkey balls
Jun 18 at 14:34, by Radek Slupik
C++03 sucks.
Jun 12 at 21:30, by Radek Slupik
C++ sucks.
Jun 12 at 0:56, by Radek Slupik
C++ sucks. Obsolete piece of shit.
 

« first day (617 days earlier)      last day (4328 days later) »