« first day (881 days earlier)      last day (4292 days later) » 

00:00
I don't know what you try to achieve, so include was just one suggestion.
Because you said multiple files are involved.
@hakre i have done included the file contating the post variable but it comes empty to other files
then probably include is not the right tool for what you need to do.
@hakre sorry i used require_once not include , i dont know if they have same work
00:17
0
A: How should we handle ext/mysql deprecation in PHP questions (older included)?

Madara UchihaAs the author of said comment, I can tell you this. We've tried very hard to make the comment as informative as possible, while keeping a nice, polite language. I've gotten very good feedback from users who used it and learned. "Wow, didn't know that, thanks!" followed by questions about moving ...

I think I'm satisfied.
 
1 hour later…
01:20
Hey guys :)
I remember a while ago reading about a function like fastcgi_finish_request for mod_php -- but I can't find it
Does anyone have an idea of what it might be?
@crypticツ that requires fpm, though... I am /sure/ that I saw something that worked with just mod_php w/o fpm
fastcgi is cgi no? mod_php is Apache
correct me if I am wrong, but those are different
Yes, that is correct. But I swear there was an extension/function inside PHP that when you were using PHP with modphp in apache, you could complete the request, causing the client to finish downloading the page, but the php script could still continue processing something.
01:38
@timgws I believe it's an fpm-only trick though I'm afraid.
trying to save a float value (microtime) in a session, and it's dropping the last two digits...
is that normal??
@Shea How many digits are there?
microtime(true) produces 1363311512.204746 but trying to get the values after the session has been saved and parsed, it's 1363311512.2047
I'm wondering if this is a serialization issue
@hakre If you really want to know, I think it was PHP 5.3.0, but I don't know that definitively.
@LeviMorrison Still couldn't get that hotplate to return within reasonable time ... aaargh
01:43
@Jack :] Let me see if I still have my old SplFixedArray code laying around.
Cool .. in the meantime I'll test a few accessing scenarios that I've left out before.
I just had microtime(true) produce 1363311793.667881 and the session file shows lt|d:1363311793.667881011962890625; which gets read as 1363311793.6678. what in the world?
@Jack Found them. Let me find someplace to stick a tarball of them.
so apparently there's a precision settings....
@Shea Ah you found it by yourself, even better :)
01:50
@Jack yeah, thanks though. :P
Dafuq is up with the toString() method of the JS RegExp object? console.log(new RegExp(/hello world/.toString())); results in //hello world// :-X
It's JavaScript, who knows?
Actually it's more the constructor that's at fault
I'm going to have to run a regex on my regex so I can use my regex
2
@DaveRandom Thou shalt not invoke the .toString() on RegExp objects.
If it wasn't 1:52am it would be Xibit time
@Jack I would really rather not, but I have to pass one via JSON, I have no choice.
01:53
@DaveRandom That's definitely a use-case I've never heard of :)
Browser extensions can be a pita
I wonder if RegExp has any other methods you could use.
I've just been investigating it, I don't think so
But because JS always uses / as a delimiter it's pretty easy to write a regex to make it work
On Chrome, /hello world/.toString() returns "/hello world/"
@DaveRandom you're creating two regexp patterns
01:57
@DaveRandom Also what @Shea said :)
/this creates it's own pattern/ without new RegExp
I am aware of that. The problem is that the constructor of RegExp doesn't treat delimiters in a string as delimiters, it treats them as literals
I have to pass a regex from one environment to another via JSON
console.log(new RegExp('hello world').toString()); this is the correct way to write that
Oh wait, I forgot what you wanted to do again lol
parts = /hello world/.toString().match(/^\/(.*?)\/([a-z]*)$/i);
console.log(new RegExp(parts[1], parts[2]));
Screw you Chrome
In fact I'm going to go sleep on it, seems like there must be a better way.
nn @all
02:02
@Jack Know of a good temporary file sharing site?
I might break down and do a gist again.
hmm, besides yousendit?
Like, email?
send me an email at my php.net address.
sure ... send to datibbaw :)
Got it
Feel free to ping me with Q's
Expect results like:
359 iterations took 141.890867 seconds.
359 iterations took 163.477213 seconds.
359 iterations took 180.195247 seconds.
@Jack I found some things that I think might speed up the runs with the fixed arrays; rerunning tests now. It takes a long time to run each test, so it'll be a few minutes :]
02:23
yay. Composer SUCKS
@ircmaxell Oh? What is it now?
I install two zend dependencies (crypt and feed). So it decides to install all of zend framework instead
so now my little app has all of symfony (I'm using silex and another symfony component) and all of zend as a dependency
. . . it installed ALL of Zend? You are sure you requested specific packages?
What's a better way to speed up a website. Compressing just about everything? Or caching?
 "require": {
    "silex/silex": "1.0.*@dev",
    "mustache/silex-provider": "v0.1.0",
    "fp/lightopenid": "dev-master",
    "zendframework/zend-crypt": "2.1.*@dev",
    "zendframework/zend-feed": "2.1.*@dev"
},
@DemCodeLines what's a better way to have more money to spend on the weekends? To get a better job making more money? Or to cut other expenses to save more money, so you can spend it where you want?
02:28
@ircmaxell did it install symfony/symfony? silex should only give you the 4 components it needs.
@igorw no, it did before I removed a component. Now it just installs the components
I know you are trying to make analogy but here is a stupid question: Which part of that analogy relates to caching?
I had added another component before.
@DemCodeLines it doesn't matter. And that's the point of the analogy
@ircmaxell which one, and which version constraint? that shouldn't happen and I'd like to investigate
the analogy is to show that when you are trying to do something, there are multiple ways that often will get you to the same point, and it depends on the particulars of the situation...
02:29
Well, I know facebook uses a lot of caching
@igorw Honestly, I don't remember now. If I remember or figure it out again I'll let you know
as for the zf2 thing, I can reproduce that so apparently it still hasn't been fixed :-/
But is there an alternative to caching?
@DemCodeLines I'm sure they also compress.
@igorw why is it doing that?
@DemCodeLines cache for scale. Not for speed
And sweet! I got oauth working on my little app
without needing to boot up a PHP session!
02:31
@ircmaxell I'm not sure, either something borked in composer's solver or in the zf2 package definitions, but it's been happening ever since zf2 was added to packagist. installing certain zf2 components triggers it, that's all I know.
@DemCodeLines Why do you need to to speed up your website, anyway? That's a better question . . .
@igorw Well, at least it only installed it once. and not multiple times
I feel it will crash sometime soon, which doesn't exactly require the need for speeding it up, but oh well. There is a lot of data being passed around between the user and the database
at any given second
@Jack False alarm; nothing change :]
@DemCodeLines then fix the code ;-)
02:33
Well, the web host kinda has a role to play on that
@ircmaxell that, plus it caches the zip so at least it's fast next time. not that that's an excuse. I've asked IRC if there's any news on the zf2 front. please prod me next time you run into weirdness with sf2 installing everything - it's possibly related but I haven't seen it happen with sf2 for a while.
server's not good enough to consistently support that large scale stuff, and I don't have enough money (LOL) to get a top notch server :D
it could help tracking down the problem.
@igorw: any cleaner way of doing this, without going too deep down dependency hell road:
$app->before(function($request) use ($app) {
            list($path) = explode('?', $request->getRequestUri(), 2);
            if (in_array($path, array('/login', '/auth', '/fake'))) {
                return;
            }
            if (!$app['openid']->isAuthenticated()) {
                return $app->redirect('/login');
            }
        }, \Silex\Application::EARLY_EVENT);
(the /fake route allows me to fake an openid response for debugging reasons)
@LeviMorrison Hehe okay ... I'm at the office now, so I will check da c0dez later :)
02:36
not sure what exactly you're looking for, but you could package this up as an event subscriber if you wanted to.
an event subscriber is an object that contains one or more event listeners
then you can configure it in the constructor
@igorw I know I could, but I felt that was a bit much overhead for not a heck of a lot gain
the one part I'm not sold on is the path matching. There's gotta be a better way than that...
btw, there is $request->getPathInfo(), did you avoid it intentionally?
@igorw that's what I was looking for ;-)
and you can make the endpoints a parameter on the container
that way you can only add /fake in a debug context
yeah, I've already removed it...
02:40
@LeviMorrison they (Facebook) would definitely also compress :)
I could also make it into a regex
150 lines of code for a fully functioning openid endpoint... Not horrible for a first go
actually, you can assign the function to a var, then only add it to the specific routes that need it
the auth filter?
yeah, like this: $app->get('/my-app', function () {})->before($openIdGuard)
then you don't need the path check at all
Well, it needs to be the default filter... So I actually need the reverse
02:43
and you have more granular control
basically, I'm making an auth-only app. If you're not logged in, all you get to is the login page
curl_init()? Never heard of it before! ... thanks Zend Studio 10 =(
if you really only have 2 unauthed endpoints then I suppose matching against a list is fine. if you ever want to make it more re-usable/granular, you should go for the per-route before though.
@igorw yeah, can see that
if you use controller collections, you can also apply it to just that collection
just something to keep in mind
02:48
yeah, refactoring to do that now
@ircmaxell playing with the silex? ;-)
it helped me refactor one of my projects ... until i realized how much static stuff i was using, then i gave up on it for a while :/
How is Silex?
oh wow, the entire controller binding system is just weird
02:55
the controller service provider thingy?
I like how you can mount applications :)
wtf... now setcookie stopped working? I'm deleting the cookie properly in the header, yet the browser isn't deleting it...
nevermind, my screwup (cookie paths)
hey guys, do you guys know any unix shell cheatsheet for log file analysis
Why does Zend Studio have entries for memcache, ldap and redis inside the Core API Language Library ... but not cURL?
it's zend
03:11
AARGH!
Did Redis sleep with Zend to get into the "core api" or sth?
@LeviMorrison this somehow feels wrong: github.com/igorw/edn/blob/master/src/parser.php#L312 is it just me or am I doing stupid things here?
also, polymorphic dispatch on functions would be nice.
I'm off, g'night!
My third SO question therefore becomes this:
0
Q: Missing cURL definitions in Core API Language Library

JackI started on a new project today, and wrote this: $ch = curl_init(); Pretty easy right? Alas, Zend Studio 10 immediately complains about this: Call to undefined function 'curl_init' This is before running any code; the editor just doesn't know about the function! The definitions that are us...

Stupid Zend!
user895378
03:29
So I haven't been at the computer all day -- yay for visiting family.
user895378
10 hours ago, by igorw
btw, IMO a static factory method is perfectly fine. the new operator might as well be considered a static method like it is in ruby. you get zero additional coupling by using a static factory method over new.
user895378
@igorw I humbly disagree with that ^ for a couple of reasons ...
user895378
The new operator shouldn't be used inside the class either. IoC is the way.
user895378
So that argument doesn't hold water unless you're only talking about calling the factory method in bootstrap/glue code outside any application objects.
user895378
Second, static is the same as a globally accessible function. So you can use it, but it's not object-oriented programming, it's class oriented programming (which may or may not be fine depending on what you're doing).
user895378
03:32
Third, if you use a static factory method inside a class, you've eliminated the ability for third-party users to change the behavior of the objects using the factory because you can't inject your own factory implementation.
user895378
Fourth, you can't mock the results of the static factory method for testing.
user895378
Fifth, you've added the potential for class-oriented abuse even if you're well-behaved. Why expose the knife edge if you don't have to?
user895378
Sixth, the "ease-of-use" argument is kind of out the window with php5.4 because of constructor dereferencing IMO ...
user895378
(new MyFactory)->make()
user895378
* Note that I'm not advocating that anywhere that isn't bootstrap/glue code ^
03:35
Hi all
Hi ircmaxell
user895378
So I dunno ... that's my take on the static factory methods. I know lots of people don't agree. To each his/her own :)
user895378
@Jack I haven't had a chance to use your library yet -- I am going to try it out but it'll probably end up being a few days before I make it to that point.
@rdlowrey No worries, code is patient :)
I am developing a PHP API for my project, do you recommend any articles/resources on how to best develop an API in php (best practices, guidelines, etc).
@igorw It's screaming for polymorphic behavior, that's why.
03:39
@rdlowrey Btw, regarding the (new MyFactory)->make() syntax ... I believe Facebook has a utility function for that ... function id($x) { return $x; } :)
So, id(new MyFactory)->make() ... tada~
user895378
hehe nice
@rdlowrey let me clarify. what I'm suggesting is that a static factory method is fine when and only when you use it as a substitute for new.
@igorw In this case it isn't really necessary anyway since we can utilize it via an add/append method.
user895378
Ah, I guess there's not really a good reason other than dogma to disagree with that then but why route through userland if the language provides the new construct for you?
By the way, ideally you'd have something like:

function apply_tag_handlers(LinkedList $node, array $tagHandlers);
function apply_tag_handlers(Vector $node, array $tagHandlers);
function apply_tag_handlers(Map $node, array $tagHandlers);
function apply_tag_handlers(Set $node, array $tagHandlers);
But we don't have that luxury in PHP and probably never will.
03:44
@rdlowrey if you're just passing parameters through to the constructor, then I totally agree. however, the case we were discussing earlier was having __construct take varargs (vargs?) and have a factory method that takes an array.
In my honest opinion the best way to handle this handlers problem is to use a Factory and subclass . . . Well, maybe.
@LeviMorrison yep, that's exactly what I meant with polymorphic dispatch. :)
user895378
Y U NO LIKE ReflectionClass::newInstanceArgs?!?!?!?
user895378
</joke>
;-)
user895378
03:46
It would be nice to have *args, **kwargs
with 5.4 you don't even have to assign it to a variable (usually with a meaningless name like $r) anymore, (new ReflectionClass('Foo'))->newInstanceArgs($data)
@igorw Also, you don't have to resort to reflection: just foreach loop and add it . . .
It's a shame you can't do call_user_function_array on a constructor.
Lot's of disappointments in PHP I guess :]
@igorw I would at least split the bits in the if statements into new functions and call those.
is php.net down?
@Connor Possibly; an email went across the mailing list a moment ago.
Just use a mirror: us.php.net
@LeviMorrison yeah, I'm refactoring it now
03:56
@LeviMorrison thats not working either
the reason I didn't do it initially is because I'm trying not to mutate state and avoid side-effects
ok thanks
FYI, they should all be working again soon.
anyone with magic awk fingers here?
04:05
@LeviMorrison refactored, it's a slight improvement I suppose.
@igorw Agreed,but more open to errors.
Specifically line 322
@andho What are you tawking about? ;-)
Previously nothing would happen in the loop if it was a collection but not one you recognized. Now it does a bad index.
hehe. i'm trying to convert a string with "something\nanotherthing" into:
"something
anotherthing"
yeah, I decided not to implement a full instanceof since it's internal API and the parser produces specific instances of ardent data structures.
04:09
@igorw In this case I would just check to see if the key exists and then do some error if it doesn't.
And depending on how often it's called, maybe tune it for performance, such as maybe using a static conditional declaration.
@andho Can't you sed it?
// something like:
static $fns = isset($fns) ? $fns : [
    'Ardent\\LinkedList' => __NAMESPACE__.'\\apply_tag_handlers_list',
    'Ardent\\Vector'     => __NAMESPACE__.'\\apply_tag_handlers_list',
    'Ardent\\HashMap'    => __NAMESPACE__.'\\apply_tag_handlers_map',
    'Ardent\\HashSet'    => __NAMESPACE__.'\\apply_tag_handlers_set',
];
By the way, that's borderline kosher for me.
i need some advice im making a admin panel and i want to make a little box in the bottom where all admins can chat to eachother, im going to be using ajax, whats the best way to tell if there is a new message, so that i can append instead of html() ??
@Connor Web sockets. That's how.
And curl definitions are back .. fuq yeah! My wishes have been heard, maybe.
04:13
@LeviMorrison yeah i really want to use them but i really not a big fan of javascript, and i cant find a simple way to use sockets
@Connor You are going to have to use JavaScript for this anyway unless you want them to reload the page every X seconds.
@LeviMorrison i know i have been using jquery ajax that is simple, i will look into sockets now though, know any simple tutorials?
and also what shall i use for websockets
Well . . . the product that I'd recommend isn't publicly available, so I can't help you there :]
@LeviMorrison yeah, good point. done. I'm not really too concerned with performance at this point. If I were, I'd probably scrap some of the ardent stuff, like vectors.
@igorw Yeah, as I mentioned earlier, there isn't much of a case to use Vector instead of array.
04:22
yup, I'm mostly using it to represent the different data structures of the edn format.
ok, off for real this time. thanks for all the input. good night!
do i need to use node.js or other to use socket.io?
@Connor Wish I was more help. I'd maybe re-evaluate the need for the chat to be in the web page. We use a jabber server at work to communicate between admins.
@LeviMorrison im just looking for a cross browser way to use websockets but i have heard bad thinks about node.js so i dont want to go there, and i dont want comments on node.js just a solution to cross browser sockets
Well, node.js is a server that can be used for web sockets. You still have to use JavaScript to talk to it.
I'd just use a jabber server and then let them use pidgin, chat or whatever IM program they use.
@LeviMorrison ok so what if i want to use pure js for cross browser sockets?
04:29
You still have to have a web-socket server. It can't be purely client side.
@LeviMorrison oh ok thanks
@igorw Let me know how else I can help out. Seems like a project that Ardent would be useful for.
ok thanks
tiobe is rating us poor in this year tiobe.com/index.php/paperinfo/tpci/PHP.html
04:39
i dont get it do i now use node instead of wamp? becuase i done the node.js homepage example and i have to go to 127.0.0.1:1337 to see any result how would i implement this into my existing site?
who cares
@tereško who are you talking to
also, it seems kinda arrogant to assign a number to the developer community's "livelyness"
TWAT
@pbvamsi I'd be more interested in new projects on github instead of TIOBE
And I know there's enough PHP development that I'm not concerned about it going away anytime soon.
04:47
@LeviMorrison i believe future is ours
posted on March 15, 2013 by Chris Shiflett

I wasn’t going to write about Ideas of March this year. I wasn’t even sure it was an idea worth spreading last year. It’s important to me, but I’m struggling to blog as often as I’d like, so I’m hardly setting a good example. Then, Google decided to shut down Google Reader. If you were subscribed to their blog, you probably read about it there. Otherwise, you probably read about it on Twitter

how to insert array element after certain key
there is no replacement for RSS yet.
array('a'=>'A','b'=>'B','c'=>'D')
I want to insert z after c
04:59
Yay, my first 3 upvotes for an answer ^^ 12 more for generalist addition =D
so do i have to learn node.js aswell as javascript to use websockets
is there any good solution for me
05:19
haiiii all
05:37
GM All
@ScoRpio haii
@Jack that's quite objective if you ask me
@Connor javascript yes, node no
06:12
@andho yes, quite :)
it helps to know how node.js doesn't works though.
06:30
<?php
echo "Hi ALL";
?>
Anybody familiar with nodejs ,expressjs and compoundjs?
hi guys
i need help for below q
-2
Q: How to Show Loading gif with Percentage

Atif Azadi have a website which upload videos from pc and also from youtube. and at loading period i want to show a gif image with percentage values which show how much download is left or complete. thanks for help

@sujithayur Ask your question at the JS room. This is the PHP room after all :)
07:05
-10 votes and hardly any constructive comments for the beginner .. bah
user1105787
Indeed, so much for beginners luck.
guy's i need some help i am parsing some json with php but i gotta parse one file from youtube which list all my playlist and i use urlencode to encode the id of the selected playlist so the url comes out mysite.com/second_parser.php?id=xyz - so my now in second parser the filepath to the json is different but i need to define the id (which changes from whats selected) into the $filepath so that the parser can parse different playlists
@DavidEugenePeterson Btw, delv should be cast first and then ask here ... not ask here because you can't cast them yourself :)
user1105787
I wrote delv, but meant to put close vote; soon after I realized it was already closed. Problem solved itself
Should I throw an exception in default case?
class Factory_DataMappers
{
    protected $_DB;
    const USER = 1;
    const TRANSACTION = 2;

    public function __construct($DB)
    {
        $this->_DB = $DB;
    }

    public function build($flag_int)
    {
        switch ($flag_int) {
            case self::USER:
                return new M_UserMapper($this->_DB);
                break;

            case self::TRANSACTION:
                return new M_TransactionMapper($this->_DB);
                break;

            default:
                throw new Exception('Bla bla, not valid flag');
user1105787
07:15
@Jack Good to know though
@an1zhegorodov I tend to do that for sanity :)
especially if the function needs to return something useful.
good mornings
9 hours ago, by hakre
omg this is cool. why didn't I ever tried that? http://3v4l.org/27XVt
5.0.0 even.
@Jack Thanks. Even PHPStorm claims that I should have return statement if I don't use default.
user1105787
http://stackoverflow.com/questions/15426689/linkedin-php-code-to-post-to-linkedin-user-wall
07:40
You can only love PHP:
$bytesToReadBlockedNoMetadataBytesToReadButStreamSelectTellsThereIsToRead = 4096;
That's probably the most informative variable name.
badger badger badger badger
mushroom mushroom!
On a slightly related note:
1
A: Good programming, should i reuse values?

JackLet's see what it would look like if you chose variables for just their value: var superman = 1, marypoppins = 0, mario = 3; function roll_dice(){ return Math.floor(Math.random() * superman * mario ); } var source = ["hello.jpg","hello2.jpg","hello3.jpg", "hello4.jp...

07:56
Morning
08:11
@Jack That sarcasm.. ;)
@TillHelgeHelwig Just a tad :)
08:32
I see my friiiiends
Morning, @Gordon.
Monerinignin y'all
10 hours ago, by Gordon
Happy Friday!
Is this going to happen every Friday? ;-)
08:40
@Jack yes. the songs not called every other friday after all
I'm tempted to flag that as inappropriate...but I guess that wouldn't do any good, would it? ;D
@Gordon I've never seen that video actually ;-)
I just know the girl has the voice of an ... angel :)
@Jack its not that bad actually. i really like the song. its fun. cheesy. but fun.
Man, reusing cURL connections and switching between methods is diabolical.
You would think that switching to POST is just CURLOPT_POST => 1 right? Nooo, first do CURLOPT_PUT => 0 ... ffs, why?
@Gordon You really have a link for everything. :D
08:49
Good Rebeccaday
1
A: using PHP variables in html tag

JackYou must echo the value ... also, don't forget to escape it: <a href="<?php echo htmlspecialchars($link); ?>">LINK</a>

Hmm ... out of curiosity
specialchars() or entities()?
specialchars
This is not the first time I'm seeing that particular comment.
There seems to be some comfort in using htmlentities($str, ENT_QUOTES, 'UTF-8') rather than just htmlspecialchars($str).
Of course, if there's a good reason for it that would be one thing.
There just isn't a good reason that I can see. entities() makes your source larger and less human readable
6
Q: Bootstrap modal appearing under background

natlinesI have used the code for my modal straight from the Bootstrap example, and have included only the bootstrap.js (and not bootstrap-modal.js). However, my modal is appearing underneath the grey fade and is non editable. Any ideas why this is?

any help...
08:59
The only rational sounding argument that I can find in favour of entities is "it makes the encoded entities character set agnostic", which is true but also not relevant, because unless you already know the character set you can't correctly encode the raw string in the first place. Although I suppose if you have mixed character set content that could work, but only to a limited degree - you would have to convert all the content so that unencoded chars were at the right code points
and you might as well just do that conversion first

« first day (881 days earlier)      last day (4292 days later) »