« first day (1208 days earlier)      last day (3966 days later) » 

@Ocramius I know I just read it and exploded at my desk
4
(devomer)
@DaveRandom Dude, that's disgusting!!
@Ocramius What's that, a thing for cleaning up sick?
11:07
@Jimbo I'm looking at a tutorial which has a snippet like this:
$conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
// stuff
$conn = NULL;
It's 2014 already. Why don't we have a singleton implementation? All the frameworks has their own, it's time we standardize it.
4
@andho yes please!
and it explains that it's a good idea to close the database connection to free up memory on the server
singleton all the things! Stop the memory waste!
@Jimbo IDK, don't be so quick to dismiss persistent connections, they do have uses in very high traffic envs IMO
11:09
@Ocramius I think you are missing the point. the developer of php is supposed to write good code. the user is expected to write complicated useless code. You should implement a singleton pattern not for u but for your users. cause they are gonna read some oop book and expect it.
@BillyMathews in a normal application which will run a request in less than 1s, closing your connection won't get you much
lol
@Ocramius I'm intrigued by this idea of implementing design patterns in the core. I think we also need a formal Big Ball Of Mud implementation in the core, for far too long people have been using this pattern without a formal standard.
@mAsT3RpEE exactly. Our main user base is newbs, so that is naturally one of the most needed features
11:11
@DaveRandom we haz that, it's called PHP-SRC
SpaghettiStrap
well, at least the last time I read it
@Ocramius Can I explain? will you listen?
@mAsT3RpEE go on: if you are serious, then I'm intrigued
okay consider 2 languages: C and PHP. u were around or at least know of the history right? why were the 2 languages so popular?
11:13
@mAsT3RpEE The user needs to go buy a better book.
@mAsT3RpEE C is popular because it solves low-level problems better than others, PHP is popular because it solves high level problems quickly and allowing you any crap
look @ C. it was a joke language. The author initially created A. after some success and funding he added B. the perfect language. it had basically everything that anyone would want. the perfect language off the time but it failed. eventually beaten he decided to focus on unix. so he created a language specifically for programming operating systems. he called it C. u know the rest.
still not following
why would a singleton impl. be a good idea?
did B (the perfect language) have Singletons :O
PHP's popular because it allows bad programmers to write bad code and get away with it. it caters to their need. 90% of php programmers dont know whats happening in the CPU when they write their code. PHP was simple and easy to use. It provided a way for bad programmers to write good code. I hate it when developers put bad programming down and say "getthout!". that's your job. they just learnt php. they wont write good code for years.
@andho B had everything. including support for AI. you probaly wouldnt need singletons.
11:20
it provided for bad programmers to write working software (with bad code)
what about javascript?
why do you think it beat other languages like ASP. dont be like Kodac / IBM and forget what made you great or Digital Cameras / Microsoft / DELL will come and replace you.
@mAsT3RpEE even so, it doesn't mean PHP should encourage it's users to write bad code.
that's a bad use of bold text
how to parse the data from below url using json and php
https://www.googleapis.com/youtube/v3/search?part=snippet&q=hello&key=AIzaSyDkLnMw5fYWY15IbEM8BftsnsOsxudgXO0&maxResults=25&alt=json
@lalith458 did you check the value of file_get_contents?
51 mins ago, by lalith458
i try the below code
$json = file_get_contents('https://www.googleapis.com/youtube/v3/search?part=snippet&q=hai&key=AIzaSyDkLnMw5fYWY15IbEM8BftsnsOsxudgXO0&maxResults=25');
$data = json_decode($json,true);
var_dump($data);

But i am getting NULL result
yes, i check, i am getting "False"
11:28
@lalith458 so you cannot get the contents of that url. You're trying to solve the wrong problem
/away
k. can u tell me how to retrieve the values
@mAsT3RpEE no, you don't need them. PHP already gives you the "freedom" to write crap code: that doesn't mean it must enforce you to write crap code
@lalith458 Some hosts disable url_open so you cant use file_get_contents or fopen. Have you tried recieving the json with CURL?
@mAsT3RpEE no, i din't use CURL, can u tell me how to approach through CURL
There's a difference between allowing bad code and accepting it.
It wouldn't hurt for PHP to be a little more strict IMO
But shit code can be written in any language
11:41
@andho @mAsT3RpEE "lalith"'s question is here:
1
Q: Parsing json data using php from youtube data api v3

lalith458I am using Youtube data api v3 to retrieve data for search query using the below url https://www.googleapis.com/youtube/v3/search?part=snippet&q=text&key=apikey&maxResults=25. I am getting json response, while i am using json decode to parse the json data, i am getting empty result, can any one ...

@lalith458 Have you tried putting ini_set('allow_url_fopen', true); at the top of your script?
I thought it was illegal to ask questions here and on stackexchange?
@lalith458 answered on stack exchange. try that and if it doesnt work ill modify it
12:02
:D
@Jimbo I found it pretty boring
@Jimbo no fair. when i get it im gona assasinate u.
@Leigh Really, nothing new then?
it always bothers me when people spell assassinate incorrectly :x
Leigh likes his ass'es
12:05
@Jimbo didn't hold my interest I'm afraid, not enough to want to pay for it monthly anyway.
@Leigh for you, i'll use spellchecker.
@Leigh The big deal I think is that it'll be on consoles too
I much prefer coming home after a day of work and jumping on the couch with a controller instead of on the PC
I have a nice chair
yesterday I played Dungeon Keeper :)
@mAsT3RpEE "bad programmers" keep me in a job.
@Leigh hallelujah
@Jimbo wut wut
user895378
12:16
@RouvenWeßling Hello :)
user895378
Do you usually idle here and I wasn't aware of it? Or are you just passing through?
user895378
Also, morning all
@rdlowrey Howdy
Morning @rdlowrey
user895378
Trying to get perfect forward secrecy working for encrypted stream servers today ... it's one of the last things I need in 5.6
12:24
Hi guys, I need your help! I am sending emails using PHP mail and I'm finding most of them are going into spam/junk. Any ideas?
@RyanGittings Use a mail lib, not just php's mail
Or.. something like this may help...
$header .= "Reply-To: Some One <[email protected]>\r\n";
$header .= "Return-Path: Some One <[email protected]>\r\n";
$header .= "From: Some One <[email protected]>\r\n";
$header .= "Organization: My Organization\r\n";
$header .= "Content-Type: text/plain\r\n";
Can you recommend one?
@RyanGittings Personally never used it, but I've seen it all over the place used by other libs and symfony / fuelphp frameworks - Swiftmailer
@RyanGittings Honestly, there's quite a few things that you need to do for this. There is no "fix", even with a library doing it for you. I recommend you Google for tips/advice on keeping your email out of the spam folder.
I have had a quick Google, and spoke to a few guys from the hosting company.
12:28
Hi I wrote regular expression to match the following
email[at]domain[dot]com
email(at)domain(dot)com
email{at}domain{dot}com
regexp => /[\w\d-._]+\s?(@|[[\{(](at|@)[]\})]\s?)\w+\s?(.|[[\{(](dot|.)[]\})]\s?)[‌​a-z]{2,3}$/
writing a mail collector, uh?
Now I need to help to exclude specific part
:14516295
/^(([^<>()[]\\.,;:\s@\"]+(\.[^<>()[]\\.,;:\s@\"]+)*)|(\".+\"))@(([[0-9]{1,3}\.[‌​0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
730
Q: Validate email address in JavaScript?

pix0rHow can an email address be validated in JavaScript?

Ignore "javascript", the regex can be used in PHP
@Ocramius: from my pages it's a tool
In my html I have the <div id="comments"></div>
I want to exclude the above regexp from that
I need to scrap from other
12:35
@DaveRandom Let's be ashamed for rep-whoring together: stackoverflow.com/questions/11243447/… :p
@PeeHaa My stupidity?
@Jimbo Nope not at all. My stupidity :D
@PeeHaa Ah okay lol
@Leri :'(
I totally didn't read the question, but started yelling at you instead ;) @Jimbo
12:36
@PeeHaa Which question was it again?
nvm ;)
@Jimbo The one after which @PeeHaa called the chastity of your sainted mother into question, and threatened to remove the epidermis of a beloved pet.
@Leri Rep whoring? REP WHORING?!?!??! REP WHORING!
He does that a lot. Crazy Dutch.
@DaveRandom lulz well played :)
@PeeHaa LOL
Good morning!
Howdy
what's the good word?
morning, @ircmaxell
12:48
No good word yet. Woke up and for some reason checked PHP internals mailing list...first thing I see? Request for Singleton implementation in core
^ ((:
@Ocramius ur girlfriend?
that made my day
@mAsT3RpEE I'd count that offensive
@mAsT3RpEE on period
yup :-)
12:49
Y do women think men are chocolate atm machines?
Can you subscribe yourself to certain tags on this website so you get an email when a question is posted related to a tag?
@David there is an XMPP bot that will do that
@David if you'll subscribe on questions, you'll find your email exploded till day's end
@AlmaDo woof, having that kind of misery delivered straight to you? You'd have to be a masochist
@cspray huh? ..
12:52
No it's ok I am not going to be subscribing to anything. I was just wondering because this one user seems to be the first to comment/answer on every post related to a certain tag and I was thinking there is no way he is just sitting at the computer 24/7 refreshing the page
@cspray singleton-in-core suggestion made me like you :p So that's why it was funny for me that it was in internals mail
@AlmaDo No, I meant having Stack Overflow questions coming straight to your inbox. That sounds horrible
And yes, Singleton in core was an epic
@cspray so do I. I mean that if you'll subscribe even only on - you'll cry till day's end (because your email will be swarmed). Add there or whatever, and..
oops
I don't think we need such ability here
do if statements have scope in PHP?
no
and I can't imagine what that means
12:56
php only has function-level scoping
@DaveRandom I thought it was @Listuanian's mother's chastity that was being called into question
if ( $cond ){
    $bool = true;
} else {
    $bool = false;
}
function check(){
    var_dump ($bool);
}
check();
// getting false no matter what
^ it's one scope
try if(1) - you'll see
@BillyMathews perhaps $cond is false...
Let me edit that actually...
does the function not have access to the variable above it's scope? and how can I get them?
12:59
^ pass it as argument
or define it as global variable..
hm
I may be calling this function a lot so I think the global variable approach may be better?
From my experience global variables are hardly ever better
or change check to an anonymous function and pass it to the function using use
there are bad words in PHP which shouldn't be ever used and goto or global or eval are among them
@BillyMathews Use one variable $GLOBALS and put everything inside.
Seriously, globals are hard to maintain and bad practice.
13:06
btw what will happen if do goto inside eval to some label above?
it's a very specific way to do suicide, I know
@andho like this?
function check() use ($bool){
   var_dump($bool);
}
@AlmaDo wont work. you can only goto to labels in the eval string.
@mAsT3RpEE well, from manual php.net/goto :
@BillyMathews that won't work
$check = function() use ($bool){
   var_dump($bool);
};
but then again, that won't be available everywhere
@andho global $check all the times :p
13:10
What's the deal with anonymous functions? I just read this and I understand the syntax but don't really understand how it differs from any other function?
@BillyMathews you can assign it to a variable. It also has the use clause which is not available to other functions.
1. you can inject variables into the function using use.
2. they cannot be serialized (causes errors).
3. they are converted into an object (Closure).
php 5.4+ (function() use ($bool){
var_dump($bool);
});
@mAsT3RpEE 1. you're not "injecting" variables. You're using them from current context. 2. Yes. 3. They are instances of Closure, not "converted" to it
13:16
morning guys!
hello, @reikyoushin
So, an anonymous function is a closure object
@AlmaDo hi! wazzup?
@reikyoushin got ability to protect questions from anonymous :p
@mAsT3RpEE 5.3+
13:19
@mAsT3RpEE you still don't have a handle on the function
@ircmaxell I thought (new Object) was only available in 5.4+??? so theoretrically (function(){}) should not work.
@AlmaDo 1) would you call that lexicating the scope
@andho tru i havent looked @ the implementation. Im still on 5.2 :(
it is
@mAsT3RpEE i mean how are you gonna call it after that?
13:21
but anonymous functions have been around since 5.3
ummm. i think the point of putting it in parenthesis should automatically call it? isnt that the point. create a temporary function and execute it?
maybe im confusing php with javascript.
it doesn't auto-call it
even in JS
When can we hear about the new offices @ircmaxell? :)
then i know absolutely nothing about anonymous functions. ive never had to. someone direct me:

1. whats their use.
2. how are they implemented in js engine / php
3. what am i supposed to use them for really?
when I see them
13:27
@mAsT3RpEE (function() {})() is correct syntax for that but in javascript. :)
Would be interesting to know whats myths are true or not.
@mAsT3RpEE it's used when you need a function, but only for a very specific instance.
typically self-executing functions are used to simulate block or lexical scoping
im a c programmer. this is really scratching my head. its like a boy meeting a girl for the first time.
@ircmaxell thanks. that makes sense.
Apparently you can do pilates @ircmaxell
13:34
Current situation: Melting butter (and slightly toasting my bread) using the fan exhaust on the left-hand side of my laptop.
so according to google, anonymous functions are like lambda for php and javascript? do the function performance wise in the same way?
the other function is for passing to functions that expect a function as a parameter?
that's it right?
@AlmaDo 15k? nice!
yep.. noticed that just now
@Danack Finally it's a tie on your opcache question :)
@AlmaDo actually yes. if i knew php had a labda i would have used it earlier. i stopped web developement to enter into os programming and ai / cryptography. i left when php 5.2 just came out. so im very rusty.
13:43
I need help using assert() and value() in Silex
@mAsT3RpEE what does lambdas provide in terms of performance?
it works fine except the default value is never assigned
belliates - the pilates belly dance mash-up. Rocks.
Bye the way, did everyone see and enjoy markmail.org/message/ib7jufrr3byea6n6? #lolwut
@DaveRandom Indeed we did. Quite amusing.
13:49
Wow these people must be one of the worst blacklists uceprotect.net/en/rblcheck.php
I18n, one of the best abbreviations I have heard of :P
And the most intuitive. ^
What's the best way to get n:n data in one query for a mapper? If I just join the tables I get duplicate data obviously... why can't I just get an object back like mongodb does... :(
@Patrick you'll just have to join
@Patrick Because mongodb is graph database.
14:00
@Leri graph?
why don't mysql give a more advanced interface with stream.
A graph database is a database that uses graph structures with nodes, edges, and properties to represent and store data. By definition, a graph database is any storage system that provides index-free adjacency. This means that every element contains a direct pointer to its adjacent element and no index lookups are necessary. General graph databases that can store any graph are distinct from specialized graph databases such as triplestores and network databases. Structure Graph databases are based on graph theory. Graph databases employ nodes, properties, and edges. Nodes represent e...
@andho so just join and handle it with php?
@Patrick yup. If it's any help, Hibernate does it that way too
@Fabien l10n is also pretty awesome :)
@Patrick Grouping?
14:03
@Patrick That's hard to say. Depends on your query; I don't think it is "obvious" that a JOIN results in duplicate data.
anyone here with experience on PCI-DSS stuff?
@Leri he needs data from both tables.
@reikyoushin I've taken a look at it enough to know I'd rather have some already compliant vendor handling it for me ;)
@Leri i didn't know mongo has this kind of feature (graph db)
@cspray but getting a compliant vendor doesn't mean your compliant too right?
@andho I might be wrong. Researching now. I was sure, mongodb was graph database, however, it's not in the list in the wikipedia article.
@reikyoushin Pretty much. If you want to become compliant that's something totally different
i mean, is 'this' vendor just upselling me or do i really need a dedicated server part of the system for that?
@PeeHaa heh. We should do it with everything.
Yeah @F4n!
14:07
@andho Well, you can use mongodb as graph-database. Could not find official source confirming that fact.
@cspray actually AWS EC2 says they are compliant, but Rackspace says you need a hybrid cloud for that because you cannot put those 'sensitive' data on a multi-client hardware (public cloud included)
of course if i'd choose, i dont want to handle those stuff and will just get a 3rd party to handle it, but just in case.. i just want to be prepared
@reikyoushin That is getting deeper into PCI compliance than I went. I'd hate to tell you the wrong thing with such a serious matter
@cspray yeah, same reason i am researching far more into this subject. phew!
@reikyoushin Yea, PCI compliance is pretty complex and a lot goes into it. I wouldn't really recommend anybody implement their own system for PCI compliance; just too many vendors already out there that are compliant. In my opinion
@cspray my problem is two vendors are contradicting each other. hmm.. oh well. might as well ask them. ;)
14:12
@PeeHaa So yeh, the Exchange protocol spec documents are 83+MB of PDF of (what I'm certain will turn out to be) uninterrupted horror. Luckily (I think) we're only talking about a very small subset of this, but we shall see
@reikyoushin Yea, good luck with that :D
@DaveRandom Yeah rain on my parade like that. Thanks man :P
@Leri i don't think it has the features.
@Leri i don't think it has the features.
@cspray who do you think is more reliable then, AWS or Rackspace? RS says if i am not compliant, i might be fined tons if i was caught violating PCI-DSS. its scary. lol. hehe.
@reikyoushin Well, Rackspace is right that if you aren't compliant you can get fined tons. pcicomplianceguide.org/pcifaqs.php#11
14:15
@andho any idea about how to deal with limit?
Technically the bank you have a merchant account with will be fined
But you can bet your ass they're gonna pass that on down to you
@PeeHaa I'm going to pick through it and see if I can at least work out which of the 60 or so documents we're actually interested in, these things always looks scarier than they are.
Not to mention they might wind up charging higher transaction fees or just terminate your merchant account altogether
@Patrick oh? I never implemented eager joins. I guess you would need to go with subqueries.
Except CIFS/SMB. That's even scarier and more incomprehensible than it looks.
14:19
:D
@Patrick and also once again, hibernate doesn't have a limit clause in HQL. God speed on moving past ORMs :)
@PeeHaa lol
aaargh stupid flappy bird. haha
@andho hibernate is basically what I need, but it has to be php... doctrine seems like the best option but it's not great with legacy dbs...
right now we have one guy each working on a doctrine solution, a custom written solution and manual sql in the mappers/repositories. I am doing an example with the last one but the limit/many to many is ruining it :)
is there a book that covers the php source for php 5.4 +?
14:32
@Patrick my advice is don't depend entirely on a Mapper. Let your Repositories handle this with the best tool. If you have a huge map of data to retrieve, do it with SQL if that would help. But then again the problem here is with sql hehe
@Leri wut?
Anyone any idea why this is still downloading the whole file instead of 1 - 3 bytes
    $opts = array(
        'http'=>array(
            'method' => 'GET',
            'header' => "HTTP/1.1 206 Partial Content\r\n
                         ContentLength: $bytesToRead\r\n
                         Accept-Ranges: bytes\r\n
                         Content-Range: bytes=1-3"
        )
    );

    $ctx = stream_context_create($opts);
    $data = file_get_contents($fileUrl, false, $ctx);
@Ocramius Non-sense. ;)
user895378
@Jimbo I would be shocked if that worked how you expected because of your malformed headers
@Leri alright :)
user895378
14:41
'header' => "HTTP/1.1 206 Partial Content\r\n" .
                   "ContentLength: $bytesToRead\r\n" .
                   "Accept-Ranges: bytes\r\n" .
                   "Content-Range: bytes=1-3"
user895378
@Jimbo ^^
user895378
And if the content length you're returning exceeds 3 bytes in size you're doing something wrong.
user895378
Oh, wait.
user895378
Are you making a request or sending a response?
user895378
Because you're putting headers in like you're returning a response
14:43
@rdlowrey 1 - 3 are just arbitrary numbers. I'm making a request to get some data,
file_get_contents() ...
user895378
Then wtf are you doing in those headers? :)
hello all, I want to add a lot of html lines in a php variable. I'm using the `<<<EOT
html...... EOT; but I'm getting syntax error. any syggestions?
user895378
Because that's a set of response headers you're sending in your request
@Christos EOT; should the first thing on a new line, no spaces no nothing before that.
user895378
Range: bytes=0-2
user895378
14:45
^^ The only header you need to send in your request
^ interesting
user895378
The server may or may not support range requests, however.
@andho thx! so simple!
user895378
You need to consult the resulting response headers to see if there is a Content-Range header. If not, the server sent you the whole thing.
user895378
14:47
But, you should be using artax anyway.
user895378
would be a hell of a lot simpler.
OMFG I almost just changed all passwords in a huge fucking live legacy database :|
Almost does not count, so you are safe. ^
Yeah I know it was just one of those omg omg omg omg omg pfeeeew situations
I am creating more and more clutter in my project. Time to go home and get a sleep.
Later
14:52
@rdlowrey Okay okay, I'm trying to download a file like Mega.co.nz. The file (torrent download) will be on my server. Basically, the JS is going to AJAX off a request for some data, it'll be returned, put into a blob, stored in HTML5 local storage (so I can provide download speed / eta in-browser), then at the end moved from local storage to an actual download.
The PHP is going to grab bytes (say, 100KB) per AJAX request and pass it off to the JS
Here's an example mega.co.nz download. Note: I haven't opened the file, it's just a trailer apparrently, but you can see how the download works Using AJAX for the moment, websockets once I've gotten the basics working
@rdlowrey lol, basics first before lib :P
user895378
@Jimbo I don't support your basic php needs. I support my lib. Good luck ;)
Dick! :P
@AustinBurk Dude, that's just stupid...
@rdlowrey Okay fine. Show me how easy it is to do in Artax.
@Jimbo How long did you watch it?
@AustinBurk About 5 seconds before I flagged then checked source url
1 message moved to /bin/gif
14:58
@PeeHaa Ty, in retrospect I should've checked source url first, but still, yay that was annoying!
user895378
$client = new Artax\Client;
$request = (new Artax\Request)->setUri('http://someuri.com/somefile')->setHeader('Range', 'bytes=0-2');
$response = $client->request($request);
switch ($response->getStatus()) {
    case 206:
        // partial response! woo!
        break;
    case 200:
        // they sent us the full body :(
        break;
    default:
        // something went wrong :(
}

// Do stuff with the result
$body = $response->getBody();
user895378
@Jimbo ^

« first day (1208 days earlier)      last day (3966 days later) »