« first day (1404 days earlier)      last day (3535 days later) » 

8:00 AM
I was just thinking that this whole thing could be averted if the PDO constructor did not attempt to connect immediately.
 
Point being really, that logic is sound, right? No point in heap allocating a thing that will be treated as a stack variable for the sake of saving a line or two? The mechanisms used there are public API, it's not like zval_copy_ctor or Z_REFCOUNT_P are going to disappear as "implementation details" any time soon?
 
Yeah, stack > heap, where ">" is the better-than operator.
 
:-P
 
@Ja͢ck I have been WTFing over that for a long time just never thought too long about it, cause I just catch that shit in production
 
@PeeHaa So the question is really, what do you do with the exception?
 
8:03 AM
@Ja͢ck Gotta catch them all...
 
@PeeHaa Yes, and then what?
 
Display a nice error page
 
And don't log the exception?
 
Sure
 
@Ja͢ck Don't log the trace in that context though
 
8:04 AM
Custom log message
 
It's only in the trace where it's an issue
 
Don't just log($e)
 
Right .. the reason I email the whole trace to myself is so that I have the best chance at figuring out why something went wrong in production.
I don't log it, though.
 
mail is also some form of log ;)
a crappy one, but it is :P
 
Yeah, I agree.
But it being away from the server makes it a better solution.
IMO
 
8:06 AM
It's possible that something could be done with arginfo to mark args as "don't show in trace" but that sounds like a long way to go just to counter stupidity
 
I hate the sound of an exploding mailbox when the shit hits the fan
:)
 
Not least because you know you're going to have to spend some of your hard earned money on a new fan
 
@DaveRandom Right, that's what I mentioned here.
 
Yes, this ^
 
@PeeHaa That's a risk I'm willing to take :)
Also, I have a shit resistant fan.
 
8:09 AM
:D
 
People bitch about how PHP does too much hand-holding at the cost of perf, and then the same people bitch about how it doesn't do enough hand holding when they do something stupid.
 
Here's an interesting point though ... what if by default php doesn't show the arg list in stack traces?
or rather, set the maximum length of arguments to 0.
 
That would make sense in php.ini-production
 
It would just show __construct( , , , )
Yeah, along those lines.
 
Although that said, if people are using that file then display_errors wouldn't be on in production either...
 
8:11 AM
@Ja͢ck What did mysql_* errors do? I think only remove the passord?
 
Gotta go, bbiab
 
yes three pings and I should feel bad
@DaveRandom ciao
 
Yes you should :P @PeeHaa @PeeHaa @PeeHaa
 
:)
 
not sure what mysql_ did .. trying to forget.
 
8:12 AM
Good mornings! @PeeHaa @PeeHaa @PeeHaa et al.
 
:) morning mr cowburn
 
23
Q: Should passwords be revealed in error message?

IMBI am having pet-peeve with PHP's PDO class. As you can see on the Warning note: it reveals database password by default if an exception was not caught (when display errors is on which is a probable situation in a production server for novice webmasters). Here's my argument with a PHP Dev Me: ...

There's that related post.
 
@Ja͢ck
> mysql_connect(): Access denied for user 'username'@'hostname' (using passwor d: NO)
Or using password: Yes
No password there. Makes sense
 
lolwut
go home SO you're drunk
 
8:22 AM
@PeeHaa Yeah, the difference is of course that exceptions have a stack trace that's shown by default.
 
guys how to see clearly what request file_get_contents is sending? var_dump only returns `resource(2, stream-context)`.
 
@AwalGarg WHat are you var_dumping?
 
$context = stream_context_create($opts);
	echo "<pre>"; var_dump($context); echo "</pre>";
@PeeHaa ^ (edited now)
 
The should not result in a resource
 
(and this is being done on a local server, if that matters)
 
8:24 AM
file_get_contents returns a string
 
sorry, that. I have edited it.
 
Why the hell are you var_dumping the context? You just created it. You should know what is in it
 
ahh, that makes sense. var_dump for $file returns boolean false
 
true?
It doesn't return that AFAIK
It's false|string AFAIK
 
it returns boolean false
@PeeHaa but I have written false.
 
8:29 AM
var_dump($http_response_header);
 
ok, lemme do that.
 
Sorry I thought you said true
 
array (size=11)
  0 => string 'HTTP/1.1 400 Bad Request' (length=24)
  1 => string 'Date: Wed, 20 Aug 2014 08:30:29 GMT' (length=35)
  2 => string 'Server: nginx' (length=13)
  3 => string 'Content-Type: application/json' (length=30)
  4 => string 'Access-Control-Allow-Origin: *' (length=30)
  5 => string 'Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS' (length=61)
  6 => string 'Access-Control-Allow-Headers: Authorization, Content-Type, Accept, X-Mashape-Authorization' (length=90)
@PeeHaa ^this
 
You screwed up the request :)
 
it is returning error 400. but the exact same request is working on client side (via direct xhr)
 
8:32 AM
IIRC 'http' => array('ignore_errors' => true), ignores errors and returns the json string instead of false
^ in your context
 
@PeeHaa yea, that is why I was asking how to see what request is php making.
 
hello,

i need to create a 100% random string.
Is this any good?



function randomFloat($min = 0, $max = 1) {
return $min + mt_rand() / mt_getrandmax() * ($max - $min);
}
$today_date_4 = date("Y-m-d H:i:s");
$bytes_1_cookie = openssl_random_pseudo_bytes(8);
$hex_1_cookie = bin2hex($bytes_1_cookie);
$random_numbers_cookie = substr(sha1(rand()), 0, 8);
$bytes_2_cookie = openssl_random_pseudo_bytes(8);
$hex_2_cookie = bin2hex($bytes_2_cookie);
$nr_vogel = randomFloat(5, 20);
$fullkonfirmimikodi_cookie = $hex_1_cookie . $random_numbers_cookie . $hex_2_cookie . $today_date_4 . $nr_vogel;
 
@PeeHaa ok, lemme try that out :)
 
@zeeks 100% random is impossible
There is just no such thing
 
99.99%
 
8:33 AM
posted on August 20, 2014 by kbironneau

/* by DoubleD */

 
@zeeks What is your budget?
 
mine?
 
yes
 
why do you ask
 
Because you are asking for the highest possible random thingy generators
Those things are expensive as hell
 
8:35 AM
aha, i do not have a huge budget :p what about my code, is it good ?
 
Idunno, looking at your code makes my eyes bleed
 
@PeeHaa hmm, that seems to help. but I am still interested in seeing what is the actual request being made. is it possible?
 
lol
 
@PeeHaa they also give you cancer.
 
@AwalGarg What in specific do you want to see? You built the request, so you should know what it looks like?
 
8:37 AM
@zeeks If anything, you shouldn't combine openssl_random_pseudo_bytes() with anything weaker than that.
 
Also @zeeks httpbin.org is useful
 
@PeeHaa the request is dynamically built via user input sent through xhr. but I guess it has something to do with my way of sending the image file to imgur.
 
@zeeks use this instead github.com/ircmaxell/RandomLib
 
Can't you just send a base64 encoded string to imgur?
 
@PeeHaa just planning that :D. Thanks for your help :)
 
8:42 AM
@Ja͢ck why is that?
@PeeHaa ok, i will check that
@Patrick ok, thanks
 
Because [strong entropy] + [weak entropy] < [strong entropy].
 
ehe ok, thanks :)
 
BTW what is it you are doing @zeeks?
 
It seems that he's creating a "remember me" cookie value.
 
Ah so you are trying to create a token? @zeeks
 
8:50 AM
i am not creating a remember me cookie, but I am using that string for a cookie
 
What are you using it for?
 
I wish PHP came with an inbuilt "safe" token making function :D
 
There was some talk about a random data generator api.
 
well, I am making a website where people can post without creating an account, and I would like to block some of them. I do not want to use ip since in many countries people have dynamic ip and not static ones. and I thought of using cookies
maybe I am wrong
idk
 
Useless at best
 
8:53 AM
@zeeks Any protection you might put can be overridden.
 
@zeeks it's a lot easier to delete cookies than to change the ip
 
Useless at best, harmful to your legit users at worse.
@Patrick Tor?
 
lol, then how should i do it, any idea
 
@zeeks Require accounts and suspend manually
Or manually approve any message before it being displayed on the site
 
8:55 AM
Moderation makes me sad.
 
SAD I SAID
 
@SecondRikudo lolwut
 
@SecondRikudo well, it is that kind of website where it is not required to register for an account...
 
@SecondRikudo hehe, I thought it would never reach public beta. :D
 
8:57 AM
@zeeks Then it is the kind of website where moderation is hard.
 
@SecondRikudo We're going to need a Beta beta soon.
 
@SecondRikudo just saying it's easier. Both are rather easy to do :)
 
@Jack @Fabien I just found that http://collabedit.com/
This is what I ve meant yesterday
 
Interesting :)
Hmm, people seem to disagree about this statement: Logging is a whole lot better in terms of disclosure. That said, if you don't wish to have credentials in the log file, don't log the stack trace, just the error message; alternatively, email the stack trace (encrypted).
 
Hey guys, I was wondering if I could have people's opinion, if I'm a PHP developer in my new role, though my background is in ASP.net, does that make me more valuable knowing both languages?
 
9:03 AM
no
Knowing how to program is much more valuable than knowing language x
 
@Ja͢ck I've been thinking about that one too. How difficult is it to have $pdo = new PDO; $pdo->connect(...);?
 
I'd like peoples opinions on something. When learning objective-c I saw people saying: "It's perfectly acceptable to try and call something on a null pointer, you just get null back". Same in PHP - some people say that you can set something to zero if something is wrong, and you'll just see you get a zero there sometime. Like when casting to an int, and you accidentally get a string, but convert it to a 1 or 0.
 
@SecondRikudo It would be easy .. of course, with massive BC hehe
 
I always force the right type and validation, I don't just haplessly convert to an int and hope that it's not 1 or 0.... anyone else found this opinion if I'm explaining it well?
 
9:05 AM
@Jimbo do you mean: null pointer segfaults are alright, or "we have a kinda-Maybe type"?
 
@Jimbo the reason you can do that with objective c is because you don't call something; message sending semantics allow for some more interesting behaviour ;-)
hehe Maybe monad baby!
 
Obj-C was just an example. It's just that some people are okay with not checking something is actually what you want in an object and just converting it to the right type and being done with it
 
w.r.t. php, I manually cast too.
 
Like yesterday, you're setting a value in an object to an int
 
9:06 AM
however, php being php, it still doesn't prevent errors.
 
You at least check it's an integer right, and not a string or something?
 
In the setter... \InvalidArgumentException
 
@Ja͢ck Allow both options then
 
I casted a string which I thought was an integer, but turns out it was "$0", not "0". So I got 0. I expected 0, so it was alright. Few days later, turns out it was wrong. PHP couldn't tell me shit.
 
9:07 AM
Make all fields optional, and don't connect if nulls are passed.
 
Does anyone have a preferred PHP Redis library?
 
Then separate the connection part to a public connect() method.
 
@SecondRikudo I'll see if I can make something sensible out of this.
 
@Ja͢ck Something like this (if PDO was written in PHP):
 
9:08 AM
I just got offered a full time position :) So I am back in employment! :D
 
@PeeHaa flagged as spam
@Fabien yay! what kind of position?
 
@FlorianMargaine Yeah just noticed. Also think it is spam
 
@Jimbo caring about variable types and values is important, obviously :)
 
class PDO {
    public function __construct($dsn = null, $username = null, $password = null) {
        //if any of the above are nulls {
            //Just set the variables to the properties
        //}
        else {
            $this->connect($dsn, $username, $password);
        }
    }
    public function connect($dsn, $username $password) { ... }
}
 
9:10 AM
@SecondRikudo That won't fix anything.
 
@FlorianMargaine Pirate hunter. I'm back with my old company but working directly for them, not freelancing. AudioLock
 
Yay, let's do logic in the constructor! :-)
 
Ah right. It's the same idiot I had a "conversation" with earlier...
@PeeHaa No, this code insert the global ip (which eg. the whatismyip.com site writes) — Szabó Tamás Aug 15 at 15:36
 
@Jimbo Yeah, that's sadly the state of PDO now =/
 
@Ja͢ck Why not?
 
9:11 AM
Quick everybody STAPH YOUR DOWNLOADS. THE SNITCH IS BACK!!!!!!
 
The connect method clears the private members
 
@SecondRikudo It would still show credentials in the stack trace.
->connect( ..., ..., password)
 
Okay
How do you stop it then?
 
If anyone needs to use css sprites, bookmark spritepad. I found it useful.
 
That's what I'm trying to figure out in a BC way :)
 
9:13 AM
$pdo = new PDO($dsn, $user, $pass);
$pdo->connect();
like this?
 
Yeah, but then without breaking BC
 
Not sure why that link retarded
 
@Ja͢ck One way is to have the query, exec and prepare methods lazily connect if it hasn't been done yet.
But that's magic and I don't like it.
 
Yeah, you will want to know whether the connection was successful before any queries take place :)
Tough one, I'll ponder about this for a while.
 
@Jimbo tnx
 
9:14 AM
How do you rate PDO?
 
@Ja͢ck That's actually easy, throw a PDOException
@TomášAresakMalčánek 42
 
Im thinking about to lear and use it
learn it*
 
@SecondRikudo throw it from where?
 
@Ja͢ck From the connect() method which the others would call.
 
Yeah of course.
 
9:15 AM
As in
public function query($sql) {
    if (!$this->connection) {
        $this->connect(); //Throws PDOExceptions
    }
    //normal query code which might also throw PDOExceptions
}
 
I would personally not like that.
 
Why not?
 
I've seen that before
 
Idiots. Idiots everywhere
 
9:18 AM
@SecondRikudo I feel it would complicate matters when trying to debug.
I like to hear bad news as early as possible.
 
@Ja͢ck Why? are you telling me you have a single try/catch block for each statement you write?
try {
    //All PDO relevant code here
}
catch (PDOException $e) {
   //Handle whichever exception that was thrown.
}
 
@SecondRikudo I typically have no try/catch blocks at all.
 
It doesn't matter which part of the //All PDO relevant code here throws the exception...
@Ja͢ck You use global exception handlers?
 
Of course I do.
Though, the term 'use' may be misleading.
They are in place.
For instance, I like the fact that when I pass an instance of PDO I can already assert that the credentials were correct and the only errors that could occur are because I made a booboo in my query.
Okay, the connection could break in the meantime; that's another thing.
 
@Ja͢ck That's a good point
 
9:23 AM
Alternatively, we could disable the stack trace from Exception::__toString()
By default that is.
 
@Fabien sounds cool
 
@FlorianMargaine It's very cool work. A lot of learning and freedom :)
I have worked here before but doing 3rd party work. Now I am working directly for them.
 
@Ocramius just trying to melt in with Austrians :P
@Fabien Screw freedom, give me $ :D
 
@webarto lol. You know I wonder if you rob banks as a side job -_-
 
Jesus christ. The morning are getting worse and worse
moar crap
 
9:36 AM
I just poured lemon juice in me coffee instead of tea... I didn't know senility starts to manifest immediately.
 
Good morning...
 
Morning
 
morninG
@Fabien Hmm, I could use md5 cracking skillz to rob most of the banks here.
 
has any of you made a website from scratch in javascript, java and c++ only ?
 
9:47 AM
No one, ever.
 
@zeeks Yes.
 
what are the advantages and is it easier or harder than php?
i am asking for your opinion. i have read lots of articles but i want more opinions
 
@zeeks PHP is more beginner friendly.
But for serious applications, where scaling and performance really matter, most will move away from PHP and use Java, Python or most recently, NodeJS
 
lol
did you really use performance and python in the same sentence?
 
:)
 
9:51 AM
also, your sentence is just wrong anyway
whitehouse.org is in php :P
 
lol
Invalid URL

The requested URL "/", is invalid.
Reference #9.cf1e8443.1408528306.1644196
 
yeap whitehouse runs on php alright :P
 
@SecondRikudo so, all the users in this chat that use PHP are beginners?
 
@SecondRikudo Node.js makes scaling difficult
Node.js is good for some applications, but not for all of them. The same is true of other web stacks.
 
9:53 AM
@AndreaFaulds s/for other web stacks/for tools in gerenal
 
@AndreaFaulds honestly? It's not true. Sure, there are technical merits to each stack, but in the end everything can work.
 
@zeeks No
 
it's all related to the team rather than the technical stack at the end
 
@AndreaFaulds Yes, same as PHP.
And yet people more often than not force their solutions on PHP where a better solution is readily available.
 
9:54 AM
@zeeks Subjective question is subjective
 
@zeeks there are a lot of serious applications where scaling and performance are not an issue
 
PHP is easy to learn, cheap to hire, and quick to develop.
 
@FlorianMargaine I disagree. Certain technologies are better suited to different use cases.
 
@AndreaFaulds ...
> Sure, there are technical merits to each stack, but in the end everything can work.
 
I use PHP because 1) I know it fairly well 2) it works decently for want I do with it 3) the community
 
9:55 AM
But is slow to run, and, more often than not, expensive and slow to maintain.
 
PHP's design makes it very easy to scale and it's not that slow.
 
@AndreaFaulds Not really... and it is slower than most other solutions out there.
 
@AndreaFaulds what do you mean?
which part of PHP's design makes it easy to scale?
 
Single script execution per request model, no shared state.
 
9:57 AM
I'm sorry, I may not understand, but how is that related to scaling?
 
i have heard that the new version of php will be 2 times quicker. it that true?
 
IIS is killing me... we get weird get parameters in our php code. After long search, we found an old asp rewrite rule that rewrites get parameters but then somehow skips asp and goes to the php stuff... w t f
 
@FlorianMargaine Easier to reason about, compared to say, node.js.
 
@AndreaFaulds how is that related to scaling?
 
You should be able to "just add more servers" and have things work
 
9:58 AM
hm no, not really. You still need load balancers to distribute between these servers. Just the same as with any other tech stack.
 
Though I guess it depends how the web app is structured, really
 
you still need shared sessions, just as with any other stack, etc
I don't see how PHP's design makes it easier to scale, sorry
 
@FlorianMargaine For starters, you don't need to worry about memory leaks as PHP doesn't have any shared state
It's also just generally easier to code for
 
@AndreaFaulds Unless you're running an event loop
 
according to your opinions, which language is never going to die ?
 
10:02 AM
@Jimbo Ah, but that's not the model PHP is made for. You can do event loops in PHP, it's just not ideal
@zeeks C
 
@zeeks Every language will die at some point, but on the flip side, technically they won't as long as the internet exists with the knowledge on there... but then when the world blows up. That's when.
 
@AndreaFaulds Unless you are running a php server thingy
 
^
 
Hi
 
hello @Hbirjand
 
10:06 AM
I have posted a question here,at the very begging,I have received down votes,then I have edited my question,and it does matters,the question has been on hold,now I have received 3 re open votes I need two more,and it does matter to me,and it's relevant to be here, could anybody help me please,here is the link stackoverflow.com/questions/25349238/…
 
@Hbirjand What the question is lacking is: I have tried X, but that didn't work because of Y. I searched google and found this, but that didn't work because of that. My code currently looks like this {insert code here}
 
@PeeHaa, Sorry I didn't realize your message
OK,you mean,I most provide a code?
 
Or at least share your thoughts. The title show you don't want to dick around in core. Maybe there is some way to override the pagination template (I don't do joomla). Have you researched that path? What did you find? Why doesn't it work for you?
 
I have installed a plugin and it's not working
thanks for the tip
I have another question
here is a duplicate or triplicate :) question and i have provided a complete answer that took one hour of me,stackoverflow.com/questions/4560608/need-css-only-for-chrome/…
and because I have posted on three different pages,the moderator has been deleted my answer
and I have got a huge down point,could you please help me with that?
 
Yeah don't duplicate stuff. Either vote to close as duplicate or flag
 
10:20 AM
So can i get my answer undeleted
I think stackoverflow.com/users/237838/andrew-barber is kind of ... toward me,he has deleted my other answer too. stackoverflow.com/questions/25355050/…
 
You can flag it and explain the situation and ask the mods to undelete one (if the duplication was really the problem)
 
I have flagged it,
 
@Hbirjand I highly doubt @AndrewBarber (or any other mod) has something against your personally
 
Ok,but he has deleted many of my answers at the same time,
and I don't think stackoverflow.com/questions/25355050/… has any problem
 
I'm not a mod and neither can I see the reason for deletion. If you think it all was in error I suggest posting on meta
 
10:24 AM
Actually,this deletion makes me to abandon my journey in stackoverflow, and how can I post a question on meta?
 
and what should I post there,is that gonna making my situation worth
 
Idunno. You are asking us questions in here which is pretty much useless. There is nothing we can do for you nor do we have any way of knowing the specifics so posting on meta is at least more useful than posting in here
 
Thanks @PeeHaa,but your answers was very useful to me,and I apologize,if my questions was useless.
 
@Hbirjand putting the same answer multiple times is not acceptable
the system will automatically notify us when this happens and we will delete the duplicate content
 
10:30 AM
@Hbirjand No worries :)
There your own personal mod ;)
 
@Gordon, but the questions was duplicate too,
 
@Hbirjand thats not a reason to answer them
thats a reason to closevote them
which you cannot do yet, but you can flag them as such
 
@Gordon,Thanks.But Actually I've been kind of depressed,but I will try to do better in the future.
 
@Hbirjand I usually leave the original duplicated answer around. If you want I can undelete one of them. Just pick one question.
 
Ok,thanks ,the one with more votes here:stackoverflow.com/questions/2447511/…
Thanks,it has been undeleted
and do you have any advise for stackoverflow.com/questions/25349238/…
Thanks A Lot @Gordon
 
10:39 AM
@Hbirjand you're welcome
 
Thanks A Lot @Grodon and @PeeHaa
I am leaving
Thanks for tolerating to chat with me
 
Is this gay music collection of words and music notes played through electronic instruments?
 
10:58 AM
do not forget j. bieber and gay direction
 
Oh wow this chat's in music snobbery mode now, great =/
 

« first day (1404 days earlier)      last day (3535 days later) »