« first day (1269 days earlier)      last day (3679 days later) » 

7:02 PM
So far I have if (!is_integer($position) && !(is_string($position) && ))
 
@JoeWatkins well, you'd have copy-ctor called, which should increment the refcount
and that sounds dirty as crap
 
Is there an implementation of zend_parse_parameters written in userland code yet?
 
@LeviMorrison nope
but actually that could be useful
 
At least the bits that check certain types should have equivalents in user-land, methinks.
 
@LeviMorrison if (!(is_int($position) || is_numeric($position) || is_bool($position) || is_null($position))) {
@LeviMorrison most of it shouldn't be hard...
 
7:07 PM
yes it would, but what if the creating thread decrements it before the new thread, then you're in a situation where the new thread is calling the final dtor ... so yeah hacky, but necessary to support it at all ...
 
I'll just rewrite zend_convert_to_long.
 
@JoeWatkins yet another example of how PHP sucks...
 
...we really haven't exported strtol to PHP land?
Seriously?
 
cast it to long ...
 
That only works for when you want 1 number.
But, probably good enough.
 
@ircmaxell Yeah, that's what I want ^^
 
@ircmaxell if (($position+0.0) === $position) :)
 
Also, I question the comment on line 148
 
@CSᵠ that's not how it's implemented in the core
 
whats better for login with sessions do a logged_in session or put the user content in different sessions and on each page that requires logged in do a check with the user content if it still equals...
 
7:15 PM
that's a way to check...
 
@LeviMorrison since isspace is flaged as inline, unless the compiler won't inline it...
@CSᵠ no, becuase "1" will faill that test
 
@ircmaxell 3v4l.org/1vQfh === helps avoid that mistake
 
and we have a sum + a check, instead of 4 function calls and a check, but of course, you code is easier to read to some extent, while mine isn't as intuitive maybe
 
7:21 PM
@CSᵠ it's not a mistake. You want "1" to pass as an integer, at least for this discussion
 
i'm sorry, i thought you wanted to check for floats...
@ircmaxell @LeviMorrison so why get true for floats and also for 1 ?
|| i got it wrong...
 
Anyone knows the exact difference(s) about Include - Include_Once - Require - Require_Once?
 
@MikeM. a few do, but you can read the manual for each php.net/include
 
Because I am totally not sure about it even through the output is kinda the same
 
require halts execution if it can't find the file, include 'just' warns
_once is kinda self-explanatory
 
7:26 PM
So what would you suggest require or include...
even though it has the same kind of output I am using require now all the time
 
of course... it depends
use english, if it's mandatory, require
if you might accept to run without, include
 
so like a config file would be require...
because without the config file it won't work...
 
there you go
 
Always use require, never use anything else.
 
but where can you think a scene the file isn;t needed
if the file isn't needed you won't import it is it?
 
7:30 PM
@NikiC Perfect as a general guideline.
 
There might be an exception for atomic existence check of cache files, but that is likely better solved another way.
 
let's say you include some files, that may or may not be generated/exist
 
@PeeHaa What the actual fuck was all that?
 
but... not good for anything production worthy
 
@DanLugg trolling troll
 
7:31 PM
@CSᵠ because that's how internals works. If you pass a float to a function expecting an int, it will be parsed as an int
 
ye but if it's not good for anything production worthy why would you state it atall to be included...
 
@MikeM. there might be some genuine use, but generally not reccomended
you can, but you shouldn't :)#
 
Mhm well I will stick with require xD
 
@ircmaxell that's awesome, that's php :)
 
also my settings of a news letter script I made/making is running over config.php instead of a database
because a database connection on free hosts will slow the page alot down would it be a good idea to keep it over a file called config.php
 
7:35 PM
@MikeM. maybe use a NoSQL solution...
 
NoSQL? like I did now with running the settings over the config.php file
 
yup, but better
 
like?
 
@MikeM. a config.php file is fine, move along and make something cool rather than sweating the details. :)
 
this is what I mean: ssmailsubscription.tk (don't mind the design I suck in it)
the demo account is working... but can't do things in it behave removing an email from the emails list
it's also the first project I released in php
 
7:44 PM
@ircmaxell do you know whether your employer has a dedicated easter egg policy and if so can you link me to it?
 
@Gordon I do not know.
 
@ircmaxell Ah sorry, I left those words and ran home to have dinner. My twitter is @FabienO but I haven't really got in to tweeting.
 
:-)
 
@rdlowrey I see it .. will fix it ... probably not tonight ... had a play, need to think ...
 
user895378
8:00 PM
@JoeWatkins It's cool ... so you think it's actually a bug? I just chalked it up to "any shared resource weirdness is unavoidable"
 
this is avoidable, bug, definitely, I see it happening ... flawed, I got no solution off the top of my head ...
(I see how to fix it ... I think actually we can do a better job of this in general, it's crap)
I didn't really think anyone would be mad enough to use resources when I introduced this kind of support, I can better this, for sure ...
 
wtf, javascript room
 
user895378
@JoeWatkins hehehe, it's cool. I know it's bananas that I'm doing hardcore server stuff with PHP :)
 
user895378
Just keep me posted.
 
many bananas ... indeed I will ...
 
Yes, why hello PHPers
How would I merge four images into one such that the resulting image would have 4 squares (2 rows and 2 columns) using GD functions?
 
user895378
@chx101 That's a pretty broad question. What did you try that didn't work?
 
Step 0 should be picking a wrapper library to protect you from the horribleness of the GD interface.
I mean seriously, measuring coordinates from the bottom left!?
 
@Charles I had Imagick in mind but it's not on my dev machine.
 
@chx101 Imagick == ImageMagick != GD :)
Different toolset entirely.
 
8:21 PM
You can't use Imagick without imagemagick? :)
 
Fuck me, lol. I guess I'm just being lazy

http://www.php.net/manual/en/function.imagecopymerge.php
 
@webarto Actually, I have no idea. I know there's a wrapper around the cli, and I know that there are two freaking PECL extensions for it, but I don't remember which one is which.
 
> PHP >= 5.1.3 and ImageMagick >= 6.2.4 is required.
imagemagick FTW
Who wants to suffer with GD?
Sure, if you need portability, maybe, but...
 
Anything that goes beyond adding text to an image is annoying to deal with..
 
Hey every one (=
 
user895378
8:26 PM
@danieldorn hello. Now would probably be a good time to tell you that your smiley is facing the wrong way :)
 
@3ventic Hell, adding text to an image is annoying to deal with. I have three layers of library code that I deal with in order to make it less of a horror story. Stupid label printers...
 
lol sorry i sometimes type them that way =)
 
user895378
I'm kidding, of course ... don't flip your weird smiley face around just for me ;)
 
Ok,

addImage($img_dst, $img_src, $quadrant) // quadrant [1, 2, 3, 4]
 
So... you only want someone to give you codes? :)
 
8:30 PM
$img_src will be scaled down to $img_dst.width * .50
@webarto No, I'm find out stuff by writing stuff down.
see y'all
 
It's a pretty simple matrix, 2x2, can't figure out what's the issue?
Create image, copy image, move, copy image ... voila.
 
Hey all, is there a way to send two api calls (REST) at the same time and not have to wait for one response before the other? It would save on loading time if both requests were sent out at same time
 
chx101 i really recommend you go to javascript for what you are wanting to do, php is a back end scripting language, what you are trying to do is more front end, though it is posible to do with php its not practical.
 
@chx101 use round() floor() or ceil()
you can't have floating pixels :)
 
@danieldorn WHAT? :D
 
8:34 PM
@Darius JS/pThreads/exec()
lol wow
 
@webarto ?
 
So on page load run the requests instead while loading page?
Via Ajax
 
@danieldorn Not sure how is he going to merge 4 images with JS (in background)?
 
Anyone, with good apache and nginx configuration knowledge here?
 
@heron superuser.com serverfault.com
 
8:36 PM
This is not a job board, ask a question.
 
user3448187
I built a class which creates an OAuth token for multiple scopes. (Instead of requesting a new token with each scope). Each scope has it's own class. What would be the best way to insert that token into each class? Is this a good time for a Dependency Injection?
 
@webarto you can use javascript to merge the four images into one canvas and then convert the canvas into a image.
 
8:54 PM
anyone good with nginx and htaccess please heelp stackoverflow.com/questions/22922768/…
 
@danieldorn I know, but it's not the tool for the job, unless you don't need to save the image on server.
@Charles tag it next time :P
 
@webarto Oh, I forgot.
 
"Use while(true), as it gives the most semantic meaning. You need to parse for (;;) as it's not something you see often." Personally, I parse (;;) as a crying face, because why are you writing infinite loops? That makes me sad. — mikeTheLiar 6 mins ago
 
9:16 PM
@ircmaxell What's wrong with "infinite loops"?
6
A: What is the difference between while(true) and for(;;) in PHP?

Shankar DamodaranBoth are loops and whatever logic written inside it will run infinitely. EDIT (for comment): Hmm that is weird , a while checks condition each and everytime , whereas a for does not. Amazed by the results though.. Your Example. <?php $i = 0; $start = microtime(true); for (;;) { $i++; ...

OMG, what an "annoying repwhore". @PeeHaa :)
 
lol
 
9:36 PM
How can I specify both a string, and a format with date() (i.e. date("Y-m-d H:i:s", "updated at 3:29:48 PM EDT on 4/7/2014")?
 
9:49 PM
@hichris123 Can you rephrase, it doesn't make much sense?
 
@user3448187 Why aren't you just requesting a new token?
What happens when you need multiple scopes?
@webarto ...
 
@webarto I knew how but wasn't sure which functions to use. It's already done. All I need to do now is mess around with colors and the like
 
@ircmaxell How did you get the "opcodes" ? Did you write it in C and check the assemled code ?
or you just "know" it ?
 
@HamZa a little bit of both
function foo() {
    $args = ZPP\zend_parse_parameters("O+", func_get_args(), [
        "Iterator",
        &$objects
    ]);
    var_dump($objects);
}

foo(new ArrayIterator([1, 2]), new ArrayIterator([2, 3]));
 
10:05 PM
 
@webarto awesome
 
@JoeWatkins ^ :)
 
slight refactor
 
share? :)
 
function bar() {
    ZPP\zend_parse_parameters("+", [
        &$args
    ]);
    var_dump($args);
}

bar(1, 2.2, "3");
#array [
#    int: 1
#    float: 2.2
#    string: "3"
#]

function foo() {
    ZPP\zend_parse_parameters("bO+l", [
        &$bool,
        "Iterator",
        &$objects,
        &$int
    ]);
    var_dump($bool, $objects, $int);
}

foo(1, new ArrayIterator([1, 2]), new ArrayIterator([2, 3]), 2);
#boolean: true
#array: [
#    obj: ArrayIterator(1)
#    obj: ArrayIterator(2)
#]
#int: 2
 
user3448187
10:16 PM
@PeeHaa The token is app identity, I believe it would be better just to have one auth token for it. I thought the point of the scopes argument accepting an array is for you just to have one auth token. But I'm not that knowledgeable in this matter. developers.google.com/appengine/docs/php/refdocs AppIdentityService
 
Oh, and notice Foo takes between 3 and infinite args, where the first will be a boolean, the last is an int, and the rest must be an object instance that implements Iterator :-)
 
@user3448187 Ow we are talking about the app key?
 
user3448187
@PeeHaa AppIdentityService, it gets an access token which identifies your app to other Google APIs
 
It's dirty, but here you go: gist.github.com/ircmaxell/10067861
 
@user3448187 The accesstoken is not just for identifying the app
 
user3448187
10:19 PM
@PeeHaa enlighten me!
 
The accesstoken identifies an authorization of your app by the user
 
user3448187
@PeeHaa so I should request a new one for each API class I'm using? One for my spreadsheet class and another for contacts?
 
user3448187
@PeeHaa or should I bundle them all in one accesstoken
 
user3448187
@PeeHaa if I bundle them, then I will have to inject the token into each class or use late static binding? that's my question
 
Preferably you should get a single access token
Otherwise it means you have to ask the user permission to access resources again
 
user3448187
10:21 PM
@peehaa so would you say this is dependency injection or late static binding opportunity
 
@ircmaxell Thank you very much, Sir. Amazing.
 
Wait. Are we talking about an oauth provider or consumer here?
 
user3448187
@peehaa this is app identity, it authorizes access to the app's stuff, NOT the users
 
user3448187
@peehee the app itself has a drive
 
user3448187
@peehaa lol I wrote peehee my bad
 
10:23 PM
@peehee
 
:)
 
OK, got another question. How would I achieve these color filter effects using GD? [Imgur](http://i.imgur.com/PTABnO9.png)

I tried using a program called pixie to pick colors from the images and tried to recreate using imagefilter() function but it looks nothing like these.
 
user3448187
even after reading a bunch of answers, I still don't know when to use late static binding over dependency injections
 
user3448187
I think this is a good case for di
 
I think what you need is some token container
Which indeed you can inject into the stuff that needs it
 
10:24 PM
@chx101 Hardly, not sure. Better off with IM.
 
user3448187
@peehaa it's in a class right now
 
user3448187
@peehaa is that what you mean?
 
Yes but you only need a single access token
 
user3448187
@peehaa true, but i have other methods in that class that make like the header string and stuff
 
@webarto a few more tweaks left, then testing the crap out of it
 
10:26 PM
@ircmaxell Awesome, why don't you put it in repository? (as in not gist)
 
user3448187
@peehaa my deal is that the access token isn't encapsulated, when it's injected, whereas if I used late static binding it would be
 
@user3448187 Are you sure your class isn't doing too much?
 
user3448187
@peehaa most likely it is
 
I would fix that first :)
 
user3448187
@peehaa HM
 
10:27 PM
@webarto IM is not a choice bra!. The server I got that image from uses GD but don't know how. (closed source/proprietary )
 
user3448187
@peehaa I get it, it's a huge class I'm injecting, and I should be looking to just pass the token and handle the token's functionality aspects in other class
 
In object-oriented programming, the single responsibility principle states that every class should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility. The term was introduced by Robert C. Martin in an article by the same name as part of his Principles of Object Oriented Design, made popular by his book Agile Software Development, Principles, Patterns, and Practices. Martin described it as being based on the principle of cohesion, as described by Tom DeMarco in his book...
 
<textarea> is by far ugliest HTML element used.
 
user3448187
@peehaa i see, it has a different meaning
 
user3448187
@peehaa one class is for getting the token
 
user3448187
10:30 PM
@peehaa the other is for managing it
 
@webarto will later
 
user3448187
@peehaa if I understood that correctly XD
 
Basically if you have a huge class the chances are it is doing waaaay too much
 
user3448187
@peehaa hm the class has set_access_token, get_access_token, build_access_token_header_string
 
user3448187
actually it doesn't have get_Access_token anymore
 
user3448187
10:32 PM
but it would be best to have the access token itself injected alone, without the other methocs?
 
user3448187
@peehaa so late static binding is out of the question? that answers my question
 
case 'i':
    if ($nullable && is_null($arg)) {
        $results[$result_num] = null;
        break;
    } elseif (gettype($arg) == IS_ARRAY) {
        $results[$result_num] = new \ArrayIterator($arg);
    } elseif (gettype($arg) == IS_OBJECT) {
        if ($arg instanceof \Iterator) {
            $results[$result_num] = $arg
        } elseif ($arg instanceof \IteratorAggregate) {
            $results[$result_num] = new \IteratorIterator($arg);
        } else {
            return 'iterable';
        }
@webarto ^^ what do you think of that?
I also added support for ArrayAccess via H...
 
too much else… add a few more break; in your code and avoid else. Then put the return at the end of that case.
// easier to read...

case 'i':
    if ($nullable && is_null($arg)) {
        $results[$result_num] = null;
        break;
    }
    if (gettype($arg) == IS_ARRAY) {
        $results[$result_num] = new \ArrayIterator($arg);
        break;
    }
    if (gettype($arg) == IS_OBJECT) {
        if ($arg instanceof \Iterator) {
            $results[$result_num] = $arg;
            break;
        }
        if ($arg instanceof \IteratorAggregate) {
            $results[$result_num] = new \IteratorIterator($arg);
 
@webarto <marquee> would like to say hello
 
11:09 PM
@bwoebi: fair. Twas an initial stab at it. Needs a lot of things
 
@ircmaxell It just disturbed me immediately when looking at the code… ;-)
 
11:42 PM
Anyone knows why the chat is trippin on an iphone ?
 
user895378
@bwoebi E_CYCLOMATIC_COMPLEXITY
 
@rdlowrey erm???
 
user895378
@ircmaxell hurts my heart.
 
I don't blame you :-)
 
user895378
11:47 PM
@bwoebi A baby angel sheds a tear each time you nest control structures.
 
@rdlowrey are these tears life prolonging?
 
user895378
hehehe
 
but why on the earth do we need zpp in PHP :x
 
Because some don't know how to C :P
 
user895378
Bro do you even C Zend?
 
user895378
11:52 PM
Dang. My markdown struck-through "C" just looks like the euro currency symbol.
 
€ :D
 
€ vs. C … one strikethrough vs. two…
 
Captain Obvious Bob :P
How was London @bwoebi?
Current music.
 
@webarto The beds were too hard.
 
I'm used to concrete, so can't really complain there :D
 
11:55 PM
Well. I'm not.
 
You should have get wasted, wouldn't feel a thing.
 

« first day (1269 days earlier)      last day (3679 days later) »