« first day (527 days earlier)      last day (4421 days later) » 

3:10 PM
Guys I need a reference question with not correct installed php. PHP shows code instead of page load type of question
Anybody?
 
why ?
because i can from top of my head make something up
 
-1
Q: jquery ajax call returns php file contents

tvgemertI have a jQuery ajax function which queries a php file (carousel.php) and does some stuff with the result. This all works fine on our development server, but on our live server the script seems to fail and returns the content of the PHP file (the raw code). So the PHP isn't even executed. What co...

 
@PeeHaa is your entire page being shown as PHP code? or just certain parts?
 
that's the post that me and paul argued on :P
 
3:15 PM
If it's the entire page then your web server isn't executing it as PHP
 
is using include() safe for loading up the sql connection code , its a pain writing a new PDO everytime for every page
 
does it make sense to save both an encrypted and unencrypted password in a database?
 
no
 
@tereško hmmm looks like it, but I know I've seen better ones. Lemme check a bit better
 
3:18 PM
@user705339 i guess not , only save the encrypted one , and when the user gives his/her password , encrypt that too and compare hashes
 
@JonathanCairns Not mine post :)
 
Very no.
 
@PeeHaa , might be in "related"
 
that's what I thought.....but they want to be able to see their original password too
 
@tereško actually it was linked :) ty
 
3:19 PM
@user705339 , if you want to add "recover password" functionality , you should give user ability to reset it
what do you mean by "see" ?
who wants ?
 
@tereško view the password, so that they don't use the same word twice when resetting the password
who? the client
 
same word ?
 
@user705339 its not safe to show the actual password to the user, incase they want to change password reset by asking old password new password
 
is using include() to load those sql connection lines safe?
 
3:21 PM
alright....thanks
 
@user705339 , do you want to prevent users with expired password to use same ones again and again ?
as they we usually do ..
 
What the user wants is often not what's in the user's best interest ;)
 
@anonymouslyanonymous what do you mean ?
 
$conn = new PDO("mysql:host=hostname;dbname=databasename"),"user","pass");
want to include this and some more lines also
include("db.php");
 
why are people still using the ancient way of structuring php code ?
 
3:25 PM
then whats the better way?
 
@tereško including is the ancient way?
 
not including itself
@anonymouslyanonymous , you create a single bootstrap.php or init.php or run.php or .. hell .. you can use just index.php , and in that file you read all the different configuration source , set up autoloader and then kick off the application
instead of adding another include 'common.php.inc' line
 
oh .. and also , stop using parentheses with include and require
 
@tereško thanks
 
3:31 PM
@tereško parenthesis is not required? I assume it's a function
 
@anonymouslyanonymous You really want to avoid having any files you include actually do anything. It just leads to confusion and a big mess. Included files should only ever be libraries of code. The file that's doing the including is where the actual work should be done.
 
yeah , the act of including something should not have side-effects
 
user895378
Awesome. Just had my second monitor die in as many months. Down to two. PHP chat now lives in a 1024x768 land of sadness until I buy another.
 
@rdlowrey you need to framework how to code without a monitor
 
user895378
@CarrieKendall Nice :)
 
user895378
3:43 PM
Doesn't CakePHP have a plugin for that? Auto-type?
 
:P
no, i am afraid you'll have to use symfony
 
CodeIgniter must have some kind of plugin that can eval() your monitor.
 
user895378
@GordonM Its autoloader class is so enormous there might be instructions in the docblocks for how to fix a broken monitor inverter board.
 
@CarrieKendall I can code without a monitor. No framework necessary. I just use C-x M-c M-Butterfly
 
user895378
3:50 PM
lol
 
Will PHP ever get a comprehensive library like Perl's CPAN?
this really makes me drool: metacpan.org
 
4:07 PM
 
hello..anyone knows how to get httpresponse body in php??
 
@NidhiBarot can you explain better?
 
ya...actually i want to fetch response body of requested site like www.yahoo.com and than i want to parse the response
@user705339 ya...actually i want to fetch response body of requested site like www.yahoo.com and than i want to parse the response
 
have you tried using Curl?
 
4:22 PM
yup ..i have also tried usin pear ..<?php
require_once "HTTP/Request.php";

$req =& new HTTP_Request("http://www.yahoo.com/");
if (!PEAR::isError($req->sendRequest())) {
echo $req->getResponseBody();
}
?>
but it gives me blank page
 
@NidhiBarot I don't know much about PEAR, so I'll focus on Curl. When you used Curl, what did you receive back?
 
blank page...
 
can you post the Curl statement you used?
 
sry but i have deleted that
 
oh ok...in that case, post the PEAR code as a question on SO, and people should be able to help you
 
4:27 PM
ok...thanks
 
user895378
nevermind :)
 
user895378
@NidhiBarot $source = file_get_contents("http://www.yahoo.com/");
 
being forced to listen to top-hits radio makes me die a little inside :[
 
@rdlowrey it redirects my browser to yahoo.com
 
user895378
@NidhiBarot Uh, no it doesn't. It echoes the source of yahoo.com into your browser.
 
user895378
4:31 PM
You can't "redirect" anything with an echo statement.
 
@rdlowrey nops...it redirects..
 
user895378
Just post a question on the main site.
 
user895378
With code.
 
ok...
 
4:43 PM
trying to do a scrape i have a problem with moving to the next page does anyone have a link that they find that may assist me
 
how have I never heard of filter_var()??
does it work well? validating email addresses and urls?
 
yes , it does work well
 
are there any filters I should avoid? php.net/manual/en/filter.filters.validate.php
or are they all pretty good?
(accurate / performant)
 
Hello folks. Anyone in here know Selenium?
 
$curlOptions = array(
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_FOLLOWLOCATION => TRUE,
CURLOPT_VERBOSE => TRUE,
CURLOPT_STDERR => $verbose = fopen('php://temp', 'rw+'),
CURLOPT_FILETIME => TRUE,
);

$url = "http://stackoverflow.com/questions/tagged/java";
$handle = curl_init($url);
curl_setopt_array($handle, $curlOptions);
$content = curl_exec($handle);
echo "Verbose information:\n", !rewind($verbose), stream_get_contents($verbose), "\n";
curl_close($handle);
echo $content;
this is the curl code i used but it still gives me blank page
 
user895378
4:50 PM
You do know stack overflow has an api and scraping the actual html pages is unnecessary, right?
 
user895378
And this isn't the main site.
 
@thepriebe , yes , but most of us dont do functional tests
 
Mm. Ok. Basically my boss told me to "write a menu system for 48 portals using Selenium to automate it." My first thought was, Selenium only tests, it doesn't write code...
 
hello..anyone knows how to get httpresponse body in php??
 
sounds like a problem for SO code generator!!!
 
user1385191
 
user895378
@NidhiBarot Dude, ask on the main site. There are several ways to get it. file_get_contents which works as per the example I already gave you. You just don't understand it. You could also use cURL. Or you could use the HTTP extension. If you have a specific problem try asking a question on the main site. Please don't ask over and over again in chat.
 
user895378
$source = file_get_contents('http://www.yahoo.com');
echo $source;
 
@thepriebe , you might thing of getting different boss
this is why management should not try to do developer's work
 
5:15 PM
Haha. Thanks for the advice.
 
@NidhiBarot jsfiddle.net/LdYFb/1 that simple code should work....just follow the example
 
Lix
Hi all... I'm looking for some advice regarding performance and latency in a socket server written in PHP.

Not sure what your customs are here (* attempts secret handshake *)...
 
@CarrieKendall oh ok...thx very much
 
user895378
@Lix It just depends ... if anyone is around who can/wants to answer they will. So just ask away :)
 
Lix
5:21 PM
@rdl - I'm a frequent on meta chat... first time here - everyone has their own way of doing things :P
 
@rdlowrey It looks like you got some new stuff committed, anything else before I pull?
 
user895378
@LeviMorrison Not that I know of ... shouldn't be any major changes just small bug fixes here or there.
 
@rdlowrey Good. Hitherto I work!
 
user895378
@LeviMorrison woot!
 
@ircmaxell What a great find!
 
5:26 PM
@LeviMorrison uuuuh hitherto
 
lol
 
@NikiC I actually used it incorrectly.
 
@LeviMorrison :D
 
I just wanted to use hitherto.
 
user895378
Thither and yon I travail in code
 
5:28 PM
why does my email validation regex crash php on windows? that's unfair :(
 
@rdlowrey So . . . are the examples up-to-date
 
user895378
@LeviMorrison Well there's only one in there right now ... it just demonstrates specifying listeners for the three built-in system events: error, exception and shutdown
 
So, is the bootstrap in Core now?
 
user895378
Yes ... right now there's just a closure specified in-line in the bootstrap to handle the autoloading, but that's something that will be broken out into its own class and distributed with each component
 
Sigh. Unit test writing just isn't fun. :(
 
5:34 PM
Leerrrroooy Jeeeennnnnkkinns!!!
 
user895378
@LeviMorrison But I wasn't sure how to handle the autoloader because I wasn't sure if there should be a separate copy in each component?
 
@rdlowrey I like 1 autoloader.
 
user895378
@LeviMorrison Yeah. Is there a way to softlink to the same Autoload class file in the master repo from each different component?
 
user895378
So we don't have a bunch of versions of the same file floating around?
 
user895378
I mean, it's all of 4 lines of code.
 
5:37 PM
I'm not sure why the autoloader can't just figure it out?
Why does each class have to register itself with the autoloader?
Didn't we decide on dir conventions?
 
user895378
Oh it can. I was just thinking in terms of the individual components working on their own.
 
Requiring an autoloader is pretty common now . . .
 
having not seen this used makes me ask; is it a good idea to use filter_var() to validate/sanitize my form?
 
user895378
filter_var is the preferred method IMHO
 
@rlemon Validate yes, definitely.
 
5:40 PM
I did hit one issue with filter_var and email addresses, but it's pretty much an edge case and probably safely ignored.
 
Most people only sanitize on output, so usually filter_var isn't used.
 
$username = filter_var($_POST['username'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
$password = md5($_POST['password']);
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
like this is correct?
 
@GordonM If it is the edge case test@test, then it is NOT a bug.
 
@LeviMorrison No it isn't.
github.com/gordiansolutions/reefknot/issues/1 is the one I've run up against.
 
user895378
@rlemon This line:
 
user895378
5:42 PM
> $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
 
user895378
$email will be a boolean value ... that's what the VALIDATE constant does
 
Like I said, pretty much an edge case. Assuming that Wikipedia is correct in claiming that those are valid email addresses.
 
ahh - probably would have been the first thing I noticed if I had ran the code. :P
 
user895378
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
    $email = $_POST['email'];
} else {
    throw new ...
}
 
@GordonM It depends which RFC it claims to be a valid email address for.
@rdlowrey Should I have the Http/ConfigLoader be a dependency of the Http/Router, or just pass in good ol' arrays and such? I'm not sure exactly HOW loosely coupled we are aiming for.
 
user895378
5:48 PM
@LeviMorrison I generally make things like that dependencies
 
@rdlowrey Thine English is unintelligible.
 
user895378
Old English day ... it messes with my regular English
 
lol
I'll just go ahead and have it take a generic Traversable structure.
 
user895378
@LeviMorrison That's what I was trying to say
 
class Router {

    public function registerAll(Traversable $routes) {

    }

    public function register(Route $route) {

    }

};
Something like so.
 
user895378
5:51 PM
Yes. I prefer that.
 
user895378
Unless you want to not typehint and let it take a StdClass too :)
 
user895378
Stupid non-Traversable StdClass
 
Well, StdClass doesn't make as much sense in this instance.
 
user895378
@LeviMorrison Because you're already generating a Traversable "Config" type object from the config loader I assume?
 
user895378
that holds the routes?
 
5:53 PM
Hi every body ! ^^
 
@rdlowrey Well, because we aren't using the key at all. This structure is just a list of Route objects. In our listeners we used the key for the name of the event to listen to.
 
Someone know how to block all IP adresses but one with htaccess ?
 
user895378
@LeviMorrison Oh right, I'm still thinking in terms of my old remedial method with key-value pairs
 
Basically using the examples from en.wikipedia.org/wiki/Email_address#Valid_email_addresses as my test cases. Plus various valid ones that have failed to validate that I've run into in the past.
 
WTF
8
Q: Different background color for mutliple filetypes in vim

pukIs it possible to have different background colors in vim (ie. one light, one dark) when dealing with files with multiple filetypes (ie. :set ft=html.php)? In PHP code with HTML embedded, it can be difficult to see one single PHP statement amongst dozens of HTML lines, see below. I'll settle for ...

why wouldn't this be a subject for SuperUser ?
 
5:57 PM
@LeviMorrison I just added test@test to my test suite as a valid email address. It failed. Isn't FILTER_VALIDATE_EMAIL aware of that one?
 
@tereško It is
 
Hallo folks
 
well .. someone declined the flag
"no evidence to support it"
 
Still, close it
 
5:59 PM
Does anyone know of any reasons (perhaps technical) for the absence of __getStatic($name)?
On that note, __issetStatic(), etc.?
 
I think it was forgotten
 
@ircmaxell Seriously? Just merely an oversight?
 
@GordonM I was reading some mailing list on it and someone decided to invalidate it, but it should be allowed.
 
or someone noticed "hey we already have $_GLOBALS"
 
well, not sure why it was forgotten, but go ahead and propose it
 
6:01 PM
@ircmaxell static magic. urgh
 
no argument
 
@LeviMorrison Yes it should. You might want to be validating email addresses on your LAN, for one.
 
@NikiC & @ircmaxell Yea, understandably the (legitimate) use cases are very narrow, but even still
 
As well, are there any successful/viable community efforts to consolidate core functions/classes to namespaces?
I figured this would be something worth doing on the PHP dev's side, considering they're already implementing backward-incompatible changes like traits in 5.4; aliasing even, the existing core functions/classes into namespaces would be sensible, no?
 
6:05 PM
@Bracketworks I've asked around, and the community doesn't seem too keen on it at this point.
 
@LeviMorrison @GordonM the email validation isn't really perfect ;) Talked with bjori about that on saturday.
 
@LeviMorrison Darn.
 
@NikiC Yeah, I noticed. :) What did bjori have to say about it?
 
@LeviMorrison I considered doing it myself, but then I realized halfway through array_* that all I'm doing is doubling up the call stack, and it would have to be done in the source.
 
@Bracketworks I'd love is PHP 5.5 or whatever moved global constants and stuff like that to a \php namespace.
If PHP, not is PHP
 
6:09 PM
@GordonM Most of the discussion was about him not believing me that it's trivial to write an RFC compliant regular expression, but the consensus in the end was that one would need multiple different filters to validate emails based on the exact needs. E.g. hi is also a valid address as per RFC 5322 and depending on your application you might want to accept it. For other applications on the other hand you probably want to restrict to addr-spec type mails (local-part@domain).
@GordonM -1
 
@GordonM Absolutely; I was "aliasing" array functions such as array_push to Php\Collections\push()
Ah blarg.
http://stackoverflow.com/questions/2892652/initiatives-to-namespace-php-core-and-libraries
 
hi guys my chat thing is not working too well sometimes i have to reboot my router
 
@rdlowrey I guess we shouldn't make people use objects for route destinations, should we?
I mean, why isn't a function a valid destination?
 
user895378
@LeviMorrison That's something I wrestled with before ...
 
user895378
Like whether or not to allow closure "controller" destinations
 
6:21 PM
Meh, I'll worry about it later.
Need to work more :)
@rdlowrey Well, what if an object needs constructor params?
Maybe we should ditch the 'helpful' language and just use PHP code.
 
user895378
Well, you could use the dependency container from the core like the mediator does, but that would tie the two packages together.
 
user895378
@LeviMorrison I'll have a better reference point once you can say, "here in this code" and I can look at what you're saying specifically
 
@rdlowrey /users Controller/User <-- what if Controller/User needs an instance of Pdo?
 
user895378
@LeviMorrison that's what I was saying about the core DIC provider ... you could use it to automatically provision Controller\User class in the same way the mediator does:
 
user895378
$controller = $dic->make('Controller\User');
 
user895378
6:33 PM
but that links the routing functionality to the core
 
user895378
You'd have to specify the constructor parameter definitions for the Controller\User class beforehand so that if it's needed it can be lazy-loaded
 
@rdlowrey I have to go to work. I'll talk soon.
 
user895378
@LeviMorrison np, later
 
Hm
Has anybody here read a book called "You want to do WHAT with PHP?"
 
@GordonM Nope.
 
6:46 PM
Looks interesting. Doesn't seem to have a Kindle edition though, sadly.
 
Perhaps; I've never found "gimmicky" books to be of any particular value myself; I loathe the "Head First" series
 
does anyone have any idea why 3 monitors, with the same model, VGA-connection, same-size, working on Windows, would only display as one monitor on Linux (Ubuntu)?
 
Not sure if calling it gimmocky just off the book title is entirely fair. :)
 
@GordonM Absolutely; I've judged a book by it's cover; I'll look into it.
 
evening
 
6:56 PM
afternoon
 
@rdlowrey I can talk now, but no coding. I am going to take this opportunity to properly use a word I previously misused.
Hitherto I have worked, but no longer.
 
@GordonM I've seen the book description. It seems interesting but very specific.
 
would (!(isset($array[$token]) && \is_array($array[$token]))) evaluate the entire expression, before negating it? This may sound silly, but because I've grouped the logical operands and negated them, would the interpreter evaluate both before negation, or would isset() returning false end evaluation of the two operands?
 
Hey all
How would one get the title and gist of a webpage witrh just a URL like facebook and other sites do?
 
hiho
 
7:07 PM
@Bracketworks Why are you namespacing function calls?
 
@edorian Hey there
 
Hmmm
 
Does anyone here have suggestions of books about OOP? I was looking at this PDF ccs.neu.edu/research/demeter/papers/law-of-demeter/… and wondering if there's a better resource to learn more about those theories.
 
@ircmaxell Shouldn't I? I set NetBeans to always use absolute, consequently it prepends the \ to all globally namespaced functions and classes
 
7:08 PM
@ircmaxell Whats up
 
but fb uses more.. they parse oembed and opengraph protocols also ogp.me oembed.com
 
@Keyne that was my thought too. Still, would be interested to see what the actual book is like, cos a lot of the PHP books I've seen over the years just haven't been all that good really.
 
@Bracketworks It's not necessary to namespace functions.
 
@Krish How?
 
@GordonM Let us know if you buy it
 
7:10 PM
@Krish bah, simplehtmldom so crappy and useless and obsolete. Should be banned.
3
 
@Keyne & @ircmaxell I know that I don't have to, however I thought it was merely good convention
 
@hakre : got any alternative ??
 
@Bracketworks It's the first time I see it, not sure about it being a good convention.
 
@Bracketworks Not namespacing them can have benefits at times. For example, unit testing stuff that relies on random numbers. You can replace mt_rand with something that always returns a predictable result for unit testing. If you use \mt_rand then you can't.
Its big benefit is that it allows you to reuse what were originally PHP built in function names. But you ought not to be doing that anyway unless you want the developer who goes to work on your project after you've left the company to come after you with a rusty corkscrew :)
 
Well, conventions aside, negating a set of logical operands, the interpreter will stop evaluation after the first false and negate it, ignoring all others given it's an and comparison?
 
7:15 PM
@Krish The dom extension
 
Hi guys, how many of you use getcomposer.org on daily basis ?
 
@Bracketworks I'm fairly sure short-circuit evaluation will come into play. If the left hand expression evaluates as false, then the whole expression will evaluate as false no matter the outcome of the right hand expression, so PHP will just skip it and return true (because the result of the expression is being negated).
 
user895378
@Krish If by on a daily basis you mean "never heard of it until now," then all the time.
 
The right hand expression will only be evaluated if the left hand expression evaluates to true.
 
@Neal There you go: quora.com/Facebook-1/…
@Krish PHP with it's libxml based extensions like DOMDocument (what @edorian said)
 
7:18 PM
@GordonM Yea, just confirmed it; silly me -- Also regarding conventions; I initially kept correcting NetBeans, removing the prepended "\", but now I've become accustomed to it, and find its absence irritating :P
 
user895378
People shouldn't be allowed to prefix their library names with "Simple" ... it leads to the uninitiated using poor or incapacitated libraries in droves because they think they will be easier to learn than a real alternative.
 
@hakre ahhhh haa
 
@hakre @edorian : thanks, I will try to use it .
 
@rdlowrey smtp and soap are nice examples :)
 
user895378
Case in point. And it's even worse when the libs aren't even simple at all!
 
user895378
7:22 PM
There's nothing simple about SOAP. It's very convoluted.
 
user895378
But we already knew that.
 
user895378
@edorian Back when I first started unit testing in PHP I wasted months with "SimpleTest" just because of the name before realizing PHPUnit was infinitely superior :)
 
To quote myself here: " (Did you know that if you rearrange the letters of “Simple” you can get “Broken” if you also swap out 5 of them.)" ( from : edorian.posterous.com/book-review-php-masters )
 
user895378
@edorian lol
 
nice
 
7:27 PM
evening everybody
drinks on me since it's my birthday :)
 
that's not how it works :P
you have bad friends
 
@CarrieKendall :-P
 
happy birthday :]
 
tyvm @CarrieKendall :)
 
user895378
@PeeHaa Happy bday ... I guess I'm obligated to act on any requests for the remainder of the day.
 
7:30 PM
@rdlowrey ty and I was just going to say exactly that :P
 
user895378
@edorian Nice:
 
user895378
> and if you explain DI to me like that in an interview that is the point where I will ask one or two clarifying questions and then ask you to leave!
 
@rdlowrey I'd personally say something similar about SimpleXml and DomDocument . . .
 
user895378
@LeviMorrison Yup
 
user895378
Though at least SimplXML isn't harmful ... just limited. But still, the time figuring out SimpleXML is better spent getting familiar with DOM
 
7:34 PM
@edorian minor typo: "It is one of the few PHP book" should be "It is one of the few PHP bookS"
 
@PeeHaa Thanks
 
yw :)
 
can SimpleXML parse crappy html also ?
 
@edorian while you're at it. Change the "I" to uppercase in: "is what i find prohibits" :)
 
Yes libxml can fix broken stuff quite well
a lot better than the horrid regexes of simplehtmldom at least
 
7:39 PM
Hey @Gordon @edorian
 
Hiho
 
@NikiC No hey @PeeHaa :'(
;-)
 
31 mins ago, by Keyne
Does anyone here have suggestions of books about OOP? I was looking at this PDF http://www.ccs.neu.edu/research/demeter/papers/law-of-demeter/oopsla88-law-of-demeter.pdf and wondering if there's a better resource to learn more about those theories.
 
In computer programming, SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Robert C. Martin in the early 2000s which stands for five basic principles of object-oriented programming and design. The principles when applied together intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time. Overview {| class="wikitable" style="width: auto; font-size: 95%; table-layout: fixed; line-height:1.25; margin-left: auto; margin-right: auto;" |- ! ...
go from there
 
BTW SOA is one of the worst terms I have seen for a Dutchman. In dutch it means STD :P
 
7:41 PM
@PeeHaa Hey @PeeHaa :P
 
@NikiC ow hellow @NikiC. didn't see you. Hiya! :)
 
But I, saidly, don't know of "the one oop book"
 
@PeeHaa :D
 
Refactoring by fowler and the GOF book are really solid
 
7:42 PM
@edorian Thank you. I know SOLID. I was looking for one that covers theories like the Demeter Law
I mean, I know about the book. But read just fragments.
 
1. type programming books in google 2. marvel at 3rd suggestion 3. have children just so you have a reason to buy book.
 
@edorian "I’ve spent way to much time on that chapter to I’ll keep that one short" shoudl be: "I’ve spent way to much time on that chapter So I’ll keep that one short'
@edorian "and while I wished where wasn’t" -> "and while I wished There wasn’t"
@edorian "standard is more important then which"-> "standard is more important thAn which"
@edorian that's the end of the copy editing :)
 
@CarrieKendall I'm not looking for just "programming books"
 
:)
 
7:57 PM
@Krish Thank you for the list
 
So, what's new @edorian?
 
@Keyne i was merely pointing out the amazingness of google suggestions. if that was directed at you i would have mentioned you. you should try it though
 
Just because a book is about programming, doesn't make it good
 

« first day (527 days earlier)      last day (4421 days later) »