« first day (1662 days earlier)      last day (3286 days later) » 

12:01 PM
Nope.
Buttons
 
@bwoebi the fact that a man may sound like a woman, does not mean he's a woman
 
@PeeHaa You mean… you need like visual buttons? Do you look on your mouse to find the buttons? oO
 
Nope. It's not about seeing. It's about feeling
 
@PeeHaa Well, then I have no idea what your issue is…
 
I don't expect you to. Apple people gonna apple. Don't even try to argue with it. Not worth it :P
 
12:05 PM
You sound like I'd like apple just because of apple ^^
 
In totally unrelated news. Considering my website sucks more than a random funeral site I am going to overhaul it
@bwoebi Nope. But apple people tend to think they need to defend things.
You are happy with you magic mouse. Good for you, but I am not ;)
 
@PeeHaa When I'd tell you that your computer/whatever is shit… wouldn't you also comment on it? :-)
 
@bwoebi that's always a reasonable possibility
 
Nope. As a matter of fact the machine I am currently on is shit
 
lol ^^
 
12:08 PM
It has become this bad that when I flip (laptop) the screen I get all kinds of rainbowwy lines all over the place
 
for the record, i'm an apple person, and i use logitech mice because i don't like any of the mice and touchpads apple makes, so don't throw us all under the same bus
 
Goddamnit. I have been trying to find a suitable bootstrap theme for my site for 30 minutes now. And I just cannot find anything I like :(
All themes I find are made by people who think images are more important then content and/or think some deep text is more important than meaning
Goddamn hipsters
3
 
@PeeHaa just open the site in links to see how poor is modern web-design
 
@PeeHaa just pick something ascetic and mod it
 
I don't even know what that means :P Haven't you seen my current site???
 
12:17 PM
Fuck you too, @Outlook http://t.co/rlUaSBryq4
seriously, why do people even use M$ stuff?
 
hi all, anyone here has already written his own websocket server with php?
 
Meh I just might use components from this bootswatch.com/simplex and hope it doesn't turn out to be a turd too much once I am done with it
@Julo0sS Yes
 
@Ocramius why would you use it at all?
 
@bwoebi forced by one client
 
12:18 PM
@Ocramius password length limits probably just are so that people won't forget their passwords^^
 
meh
correcthorsestaplebattery
 
@PeeHaa can you (if you have time) explain me where to begin? I look through many tuts about it, but looks like it's still not clear enough to me... Most popular articles talk about nodejs, is it really "the thing" to work on ws?
 
@Julo0sS I am about to go out for food, but this should give you an idea github.com/PeeHaa/WebSocketDemo
 
@Ocramius You mean properkoaladance
 
WAT
 
12:20 PM
@Machavity yep, thought about it but i'd like to make my own CODE first to help me understand the logic, then i'll maybe use such things
@PeeHaa I'll have a look now, thx
 
as long as hunter2 works...
 
@Julo0sS I am hoping like crazy that that's a typo
 
@Machavity s/make/give ? hides
 
@Machavity lol
 
@Ocramius my bank has 20char limit, I wanted to complain already
 
12:33 PM
@PeeHaa This is already too "complex/complete" example for me, need a really simple thing to begin with
 
@Julo0sS Imo the best / easiest thing you could do is read the WS rfc. It's actually pretty readable
brb
 
@FlorianMargaine wat?
 
@Danack @
 
@FlorianMargaine Gosh! *will never speak to @PeeHee again*
 
12:39 PM
@FlorianMargaine So? I use them frequently for the file IO operations.
 
@Danack you like to have your warnings supressed?
 
particularly @mkdir($someDir);
Yes, when they're fucking retarded warnings, that don't provide any useful information.
 
like which warnings? @Danack
 
@Danack until the day it's a useful information
 
mkdir gives an error when the directory already exists.....I don't care. I just want the directory to exist now.
 
12:41 PM
it also gives errors when it can't create the directory
 
but that would suppress errors as well ^
 
can't see how I can check if I have permissions to create the folder, that said
is_writable, I guess
 
@FlorianMargaine I still don't care whether the call to create a directory succeeded or not; the thing I care about is whether I can create a file in that directory.
 
I do hafta say I use it with fsockopen. I mean, if it fails I'm going to test the return anyways to see it failed. i don't need my logs clogged with useless errors
 
"i don't need my logs clogged with useless errors" - I don't log errors directly. Any unknown error gets converted to an exception.
 
12:45 PM
@Danack Sorry, shoulda specified this is in a cron job. Goes to a different log. Otherwise you're right
 
@FlorianMargaine well, most of php file-operations suck
when something fails, they just throw a warning
 
then make sure they won't fail at first
 
@FlorianMargaine Please tell me more how you can check IO operations are safe to use ahead of time and not have race conditions!
 
@FlorianMargaine maybe is_writable() is not even atomic
if(is_writable($dir)){
// someone else deletes the dir
fwrite(...);
// ... failure
}
 
12:49 PM
@Danack because you change the permissions of your folders all the time? really?
 
Some general advice @FlorianMargaine, when you see something that you think is horribly wrong being done by someone who is not obviously dumb, you will have a more production conversation if you say "Hmm, I thought this is bad, how come you're using it?" rather than calling people dumb.
5
 
@Danack not with @PeeHaa
but that's generally what I do, yes
 
@Danack sound advice
 
I don't modify directories, stuff in the background can. A basic analysis of the problem blog.rodneyrehm.de/archives/…
7 mins ago, by Danack
@FlorianMargaine I still don't care whether the call to create a directory succeeded or not; the thing I care about is whether I can create a file in that directory.
That's the point at which I check for success/fail - everything else is not just an error condition.
 
@Danack be cool kids. he didn't call @PeeHaa dumb
 
12:53 PM
15 mins ago, by Florian Margaine
Don't be a pedant, m'kay?
 
well he was clearly joking
 
@tereško "You're using CodeIgnitor!? You idiot!!!"
 
@Jimbo the answer usually is: it was not my choice
 
in fact it could have been a fun way to ask for clarifications
 
@Danack Cheer up, you have a lovely beard + a smile added = awesomeness
 
12:54 PM
Actually, people usually get scared when I start smiling....
 
Yeah, I took that as facetious. The ALL CAPS thing was kinda a giveaway
 
@Worf I think you should receive a fatal in this case, using @ could lead to a fail somewhere further in the code (things could get even worse)
 
@Danack i agree with everything you said, but are there better options than the @ operator? afaik it's very slow? maybe wrapping in a try{}catch(){//donothing}?
 
@Worf It's slow compared to general code. It's insignificant compared to the IO operation.
 
ok. TIL @ operator is not that evil
 
12:57 PM
Exceptions are more expensive anyway, but the mkdir function failing isn't an exception....it's the normal thing when the directory already exists.
 
@FlorianMargaine @PeeHaa why fclose() at all? PHP automatically dtors without warning when last reference to it is lost…
 
@bwoebi explicit > implicit
but I guess that's subjective.
 
@FlorianMargaine well, then don't complain about the @.
 
@bwoebi ?
 
hi, anybody knows using twitter cards
 
MGE
1:05 PM
Hello
 
@FlorianMargaine Tbh I also use @ in places like file_get_contents(), where if something happens I throw a custom exception in my library instead. This is possibly me using them for flow control, but it helps me maintain a more consistent API - it either returns what you want, or you get an exception. None of this "returns your object, false, null, -1 or 999"
 
MGE
Someone knows how to escape string before json_encode? because I have problems in js with json string with single quotes (')
 
totes shameless >.<
 
@MGE Why do you think you need to escape strings? Your actual problem may not be what you think it is.
 
MGE
@Danack ??
 
1:08 PM
591
Q: What is the XY problem?

GnomeWhat is the XY problem? When asking questions, how do I recognize when I'm falling into it? How do I avoid it? Return to FAQ index

 
@Jimbo I guess. I still think @ is bad and your abstraction should throw an exception correctly, but I also guess that php doesn't give the right tools, i.e. directory locking for example
 
Stupid composer error argh! [Symfony\Component\Process\Exception\RuntimeException]
The process has been signaled with signal "5".
 
doesn't flock work with dirs as well?
 
@Worf no
 
MGE
@Danack unexpected identifier
 
1:09 PM
...locking isn't the right tool either...
 
@Danack to avoid race detection?
 
@MGE How did you generate that.
 
MGE
from an array using json_encode
 
@FlorianMargaine Most of the time, the way to avoid race conditions problems, is to avoid making races conditions be a problem, not to start adding locking everywhere.
 
@Danack a function such as ensure-directories-exist should be available, and you shouldn't have to care about its implementation, but the implementation should still use locking... how do you want to do otherwise?
 
1:11 PM
20 mins ago, by Danack
7 mins ago, by Danack
@FlorianMargaine I still don't care whether the call to create a directory succeeded or not; the thing I care about is whether I can create a file in that directory.
 
@Danack did you look at the function?
 
No. i don't care about that function. The only thing I can about is whether I can successfully create a file in that directory.
 
Has someone ever got that error I got while updating composer?
Looks like I can't do anything anymore -_-'
 
@MGE Taking the JSON from there and pasting it into jsonlint.com gives no error.
The problem must lie elsewhere?
"The only thing I can about is whether I can successfully create a file in that directory." - The test for this is the atomic operation of creating a file in that directory.......i.e. no locking required.
 
MGE
1:14 PM
when I try to put this json into var = 'JSON STRING';
 
What Florian said then.....the json encoding is fine. But you're trying to embed single quotes inside single quotes...
 
MGE
thats I asked before
 
i.e. it needs escaping after the json encoding...
Not before.
 
@MGE why put it into a string?
 
MGE
what is better to escape before or after?
 
1:17 PM
....it is best to understand what the problem is and to do the appropriate thing...
 
MGE
the problem is that in the php array, there are single quotes
and passing this info into json, when I need to place it in a var
it crash
I understand completely the problem, the question is what is the best way in order to solve
 
I usually do that:
<code id="data"><?php echo json_encode($foo); ?></code>
<script>
var data = JSON.parse(document.getElementById('data').textContent);
</script>
well, "usually"
the advantage of this is that it doesn't prevent CSP headers
 
@MGE No you don't, here is a simple example of what you're missing.
var amagad = '["Hello my name is D'souza"]';
the single quote between the D and the s, breaks the string...
8 mins ago, by Florian Margaine
@MGE http://php.net/addslashes
 
@Danack actually not the best idea, it will escape the double quotes too :/
 
addcslashes then ?
 
1:25 PM
that's cause French people have to have quotes in their names
 
@Danack or put it in a <code style="display: none;"> element
6 mins ago, by Florian Margaine
the advantage of this is that it doesn't prevent CSP headers
 
MGE
var data = JSON.parse(document.getElementById('data').textContent);
$.each(data,function(index, value){
console.log('My array has at position ' + index);
});
unexpected token t
wtf
 
pastebin?
 
don't use addslashes
 
1:33 PM
hello guys
 
I have a Doubt from long time , What is the use of htmlentities in php
Can anyone explain me with eral time example ,where it will be used exactly
 
i have php website on my localpc
can i make it accessible through internet ?
i need to host it on my pc using wamp server
 
Why not just take a cheap hosting provider? Nowadays hosting costs almost nothing anymore.
 
OVH for 2.50 a month
it's perfect
 
If you point a domain name to your outgoing IP address then yes
but there are numerical drawbacks by doing that
 
1:35 PM
i know , u r right , but i need it just for test
 
OVH for example 2.5$ :P
 
@epodax , my domain is already pointed to my pc ip address
 
It needs to be your public IP
 
btw : pastie.org/10156351 has anyone suggestions how I can solve this :P
 
And you also need to allow access through what ever firewall / security you have.
 
1:37 PM
@epodax
yes i add it through A record DNS
so when i ping my domain name, it shows my pc ip address (public )
 
@Bassem So, what's the issue?
 
MGE
I added addslashes and it returns unexpected token
when I try var data = JSON.parse(document.getElementById('data').textContent);
 
Totally stuck today on Composer -_-' bummer
 
@epodax , i use wamp
there is configuration i should do in httpd.conf i think
 
1:43 PM
@Bassem Have you tried entering the domain in your browser?
 
Hello can anyone help me in verifying google's reCaptcha?
 
@MGE can you show the code with json_encode?
 
yes @epodax , sure
nothing displayed
 
did u know about wamp server
 
1:45 PM
Seriously, whoever closed those as dups is irresponsible.
Those are definitely not dupes lol
 
do I need to store the salt of password_hash in my database ?
 
No
 
Even if they are the one I posted is from 2009 and the dupe from 2012
It should close the other way
 
@LeviMorrison how are these not duplicates?
 
Even if you think they are dupes it should close the other way
 
1:46 PM
@Bassem No, not directly to wamp, but I guess you'd need it to respond to port 80,
 
@LeviMorrison (not speaking about that, but they're definitely duplicates)
 
2009 trumps 2012 by a long shot
 
/me Takes baseball bat and smashes Macbook...
 
Well, I suppose they are fuzzy equal
 
Lol, and we were just talking about how awesome they are this morning... >.>
 
1:48 PM
But the latter one talks asp.net and ajax – it's more specific
Honestly I think these could be merged.
 
@LeviMorrison dupes do not work chronologically
It's perfectly acceptable to close an older question as a duplicate of a newer question which is more popular and has better answers
 
@db experts here, might-be-interesting question: dba.stackexchange.com/questions/100663/…
 
Now in this case there's no clear winner
 
How can I edit files from composer? :)
 
But generally I think it's okay
 
1:51 PM
@NikiC Except they aren't necessarily better and it isn't necessarily more popular
I think these ones can be fully merged, personally.
 
Like, it's better to close a "header already sent" question as a dupe of the reference question on the topic, even if it was submitted before the reference
 
Sure – that's not what this is though
 
@LeviMorrison Actually I totally agree with you that both questions should just be deleted :P
 
@Duikboot send a pull request?
 
1:53 PM
@PeeHaa reaching page 23... it's readable... but not that easy... many many details... I feel like becoming more intelligent, yeah, but i don't feel like this doc will really help me...^^
 
That is the error that occured.
 
at least I don't think those Qs are SO material
 
Can only mods merge questions?
 
@LeviMorrison yup
 
@Gordon is a mod, right?
 
1:55 PM
@LeviMorrison yup
 
@Gordon I think this and this are candidates for merging.
Also, I would personally consider merging the latter into the former. The latter has a lot more dialog that in my opinion doesn't actually add anything. Don't care too much though.
 
@Patrick Made an issue of it :) github.com/composer/composer/issues/3997
 
@LeviMorrison done
 
@Gordon Thanks, mate.
 
user895378
morning
 
2:02 PM
Good morning
 
Good afternoon @ircmaxell !
 
Good morning UGT
 
Good morning
 
"Resistance is futile. Your ass will be laminated."
Good morning *
 
posted on May 05, 2015 by kbironneau

/* by Domas */

 
MGE
2:06 PM
after using addslashes
unexpected identifier
 
why are you using addslashes?
 
because we told him to use it in another context
 
........
 
Morning.
Adding Auryn to mah project :p
 
MGE
@FlorianMargaine said to add addslashes
the problem is, that when I don't use addslashes
it crashes sometimes, when ' appears inside the json string values
for example:
982","title":"What's up, people! (2nd openi
 
2:10 PM
what crashes?
 
MGE
this what ' s string breaks var = ' string value '
 
ah, the plot thickens, you're trying to assign a JS string to a json blob (as a string)?
 
MGE
yes
i got it from php var
 
yeah, don't use addslashes
 
MGE
i need to place the string into the var
 
2:11 PM
there's better encoding mechanisms
 
@MGE are you just jamming an array from PHP into a value? Using json_encode?
 
@Duikboot If you're going to open an issue, you should also get the latest version of Composer from it's github repo and try that.
 
Also... looks like music data, whatchya workin on? :)
 
@MGE do you need to support UTF-8?
 
For music, oh yes.
Even if he thinks he doesn't now, Bjork will ruin all plans.
 
MGE
2:14 PM
Im getting this info values from array
the problem is that I think that in production server with the same configuration, is taking the information properly
when can I check the charset config?
 
@MGE So can you just do: <script>var data = <?=json_encode($thePhpArray);?></script> -- before that, make sure all values put into $thePhpArray are UTF-8.
 
MGE
im doing this @ChrisBaker
 
If your data is coming from a database, you'd have to make sure the encoding is utf-8 at the db
 
MGE
the problem is how to check if the values are utf8
yes, in the db the info is encoded as utf8
 
Hmm, I struggled with UTF-8 problems on a music database myself, I wound up hitting it with a hammer: github.com/neitanod/forceutf8
Also be sure you have <meta charset="utf-8"> on your output page
 
MGE
2:21 PM
<meta charset="utf-8" />
placed
also the db charset
 
With the disclaimer that my understanding of charsets is fair to poor, I used that forceUTF8 lib and recursively hit every value in the array before outputting it.
Because I had all that going on too, and still had problems... the page was utf8, the db was too, yet my json output was not parsing.
 
MGE
I don't want to use any new lib
I think it can make properly without more plugins
 
there you go
 
Well, all I can do is tell you what I've done when dealing with the exact same problem, take from it what you will :)
 
function escapeForJs($string) {
    $len = mb_strlen($string, 'utf8');
    $array = [];
    for ($i = 0; $i < $len; $i++) {
        $array[] = mb_substr($string, $i, 1, 'utf8');
    }
    return implode("", array_map(function($char) {
        if (ctype_alnum($char)) {
            return $char;
        }
        $bytelen = mb_strlen($char, '8bit');

        if ($bytelen === 1) {
            return '\\x' . str_pad(dechex(ord($char)), 2, '0', STR_PAD_LEFT);
        }
        $result = '\\u';
        for ($i = 0; $i < $bytelen; $i++) {
 
2:25 PM
The only thing I have left to figure out is how to enter compilation albums in a way that doesn't suck.
 
that's basically a port of ESAPI's encodeForJs function: code.google.com/p/owasp-esapi-java/source/browse/trunk/src/main/…
 
MGE
    $array[] = mb_substr($string, $i, 1, 'utf8');
unexpected token
 
huh?
 
MGE
Uncaught SyntaxError: Unexpected token ]
 
that's a PHP function
 
MGE
2:27 PM
lol
 
lol
 
MGE
my brain is under fire
 
@PeeHaa gtg.. this rfc is really abstract and mysterious to me... some information are really useful, to make sure u instantiate objects correctly with the right values/data types, but most pages are hard to read... back tomorrow if u there ;) cya!
 
I was wondering, why are programmers inclined to help other programmers?
 
@ziGi i only get that when feeling when I'm in the Java room
 
2:32 PM
the PHP people help a lot
 
MGE
@ircmaxell
{"id":"201725","0":"201725","title":"Skinnyman","1":"Skinnyman","sanitize":"skin‌​nyman\\x2dstatic\\x2dx","2":"skinnyman\\x2dstatic\\x2dx","bandpic":"0","3":"0","bitra‌​te":"192","4":"192","duration":"220\\x2e31","5":"220\\x2e31","duration_string":"3\\x‌​3a40","6":"3\\x3a40","description":"\\x2e\\x2e\\x2e\\x2e\\x2e\\x2e\\x2e\\x2e\\x28\\x29\\x2d\\x‌​3f\\x26iexcl\\x3b\\x26iquest\\x3b","7":"\\x2e\\x2e\\x2e\\x2e\\x2e\\x2e\\x2e\\x2e\\x28\\x29\\x2d\\‌​x3f\\x26iexcl\\x3b\\x26iquest\\x3b","user
LOL
 
@ziGi Because we can't stand when things don't work…
 
MGE
Uncaught SyntaxError: Unexpected token x
 
@bwoebi but you care when other people's things don't work as well then?
 
@ziGi yup
 
2:33 PM
@ziGi mh? yea
 
@ziGi it's called OCD
 
:D
 
@MGE actually, forget that, drop the quotes and just run it through json_encode again, to get a string representation
 
@ziGi Personally, I think that the more people who are adept at creating and publishing their own media directly lessens the control by centralized, moneyed media outlets. Toward the end goal of democratized access to media, I like to help people with programming because that's what I know how to do. If I knew how to animate or produce video, I would help with that too.
 
@ChrisBaker that sounds reasonable, so you are a hater of the monetized media outlets sort of, that's why you help?
 
MGE
2:38 PM
@ircmaxell I tried, I passed the array values in escapeForJs
then I try json_encode, and it returns {"id":"201725","0":"201725","title":"Skinnyman","1":"Skinnyman","sanitize":"skin‌​‌​nyman\\x2dstatic\\x2dx","2":"skinnyman\\x2dstatic\\x2dx","bandpic":"0","3":"0","bit‌​ra‌​te":"192","4":"192","duration":"220\\x2e31","5":"220\\x2e31","duration_string":‌​"3\\x‌​3a40","6":"3\\x3a40","description":"\\x2e\\x2..
console error Uncaught SyntaxError: Unexpected token x
 
no, json_encode without escapeForJS
 
@ziGi Yes. I think every piece of media we consume, even trivial stuff like Android games, shapes our social expectations and the way we interact. If that marketplace of ideas is dominated by only that which gets past the gatekeepers -- large media companies with strictly capitalist interests, then culture moves toward something in the image they desire (consumption) rather than an organic expression of who we are as people.
I mean... I also help because I am wasting time at work while a problem brews in my head, and internet points, but mostly that.
 
That is really deep actually.
 
user895378
@Ocramius yes, this.
 
2:42 PM
but @ChrisBaker the thing is most of the published games/etc are made by people. The videos you watch too, so I don't see why is it a big problem
 
ThW
@ircmaxell Like this? eval.in/private/81d6af1d04f2a0
 
@FlorianMargaine :)
Have you done a git blame? :)
 
@PeeHaa your repo, your responsibility
 
Also I don't really care whether that line errors
 
2:46 PM
 
Or how it errors
I just treat it as @unlink('/i/dont/care')
Also morning again room
 
@ziGi Youtube was a great democratizing force in visual media, no doubt about that, but a majority of media consumers are still getting most of their media from television/netflix. There are likewise democratizing platforms for gaming, apps included, but the most popular games remain platform-based, or those produced by mainstream companies. I wouldn't say it is a "huge problem" -- income inequality is a huge problem. Media isn't a huge problem, just one I have the tools to help with.
I'm going to be teaching a basic CSS/HTML class in a couple of weeks, unleashing a new wave of cat-themed blogs on the world, and I couldn't be happier about it :)
(even though I think cats make terrible pets)
 
Anyone else try win95.ajf.me and keep getting "Emulation aborted due to nested emulation timeout."?
 
^ yes, just had that same error
 
PHP >= 5.5 : Foo\Bar\Qux::class
PHP <= 5.2 : @Foo_Bar_Qux
^^ lol, oh 5.2
 
2:57 PM
@Jimbo yes
 
Okay, so I was getting that in safari, but not chrome
 
> Noteworthy in my opinion is that if you prepare a statement but do not bind a value to the markers it will insert null by default. e.g.
<?php
/** @var PDO $db */
$prep = $db->prepare('INSERT INTO item(title, link) VALUES(:title, :link)');
$prep->execute();
?>
Will attempt to insert null, null into the item table. http://php.net/manual/en/pdo.prepare.php#114251
 

« first day (1662 days earlier)      last day (3286 days later) »