« first day (2021 days earlier)      last day (2918 days later) » 

Ekn
1:08 AM
\o
 
Wes
1:47 AM
mornin
me with this new coffee i bought youtube.com/watch?v=LgzbKe6_DN4
 
Ekn
2:09 AM
heh :)
I'm trying to come up with a circular logo idea
 
Ekn
2:21 AM
but all the sketches end up boring... meh
 
Wes
let's see?
 
Ekn
nah, nothing really worth showing :( I basically tried a few combinations using two empty circles
nothing creative at all
 
Wes
what the logo is for?
 
Ekn
erm.. the brand name is CoProductivity
 
Wes
which is? :B
 
Ekn
2:30 AM
some sorta productive environment :p
 
Wes
i searched the word on google. is .com you? if yes, the logo isn't bad, it just needs to be updated a bit
 
Ekn
yeah, I really don't like that one
 
Wes
for instance, you could have 3 peeps rather than 4 so you don't get both axis symmetry
and i'd remove the lines of long/lat
 
Ekn
that logo was done by a really good friend who passed away and we kept it for a long time
but now that things are turning into a different way... the whole brand thingy is under huge changes
so... I'm trying to come up with something proper and more sane for me :p
it's a bit ironic that you said make it 3 rather than 4 given the above context :)
 
Wes
:( yeah, sad
i would keep it though, it definitely works
just must be simpler
less details
 
Ekn
2:55 AM
alright yeah... I'll give it a go again
 
function foo() use ($bar) { ... } If $bar was overwritten by something else prior and I was expecting it to be of type 'Baz` but instead get type Meh. How would I know unless I checked the type of $bar within the function? Is there no way to typehint like ... use (Baz $bar) .... Would that even make sense?
 
0
Q: How can I pass an argument to a script as GET method?

stackI have this folder-structure: \out \MakeAvatar.php \root \include \Calculator.php \img \avatar What's MakeAvatar.php? That's a script which gets a parameter (like id) and makes a avatar based on that parameter. Now I need to pass a argument ($id) from Calculator.php...

 
@crypticツ why would you change $bar? If you want to guard against accidentally overwriting it, you can do the old closure style scope protection in JS.
If you really want to change $bar later at any stage then maybe something like this:

function fooFx(Bar $bar) { return function() use ($bar) { ... }; }
$foo = fooFx($bar);
 
 
2 hours later…
4:51 AM
morning's
 
Wes
5:04 AM
\o
 
posted on April 28, 2016

New Cyanide and Happiness Comic

3
 
5:22 AM
!!rebecca
 
@AnmolRaghuvanshiVersion2.0 Happy Prebeccaday!
 
5:44 AM
@Leigh saw it earlier, it's a great deal :D
 
Wes
/me randomly adds +1 / -1 hoping that off by one errors would magically disappear #programming101
it worked tho
 
'nin
 
prestashop anyone?
 
Wes
hey joe
 
5:56 AM
yo peepz
 
Ekn
mornin
 
nin
 
'nin
 
how can avoid decrease of product quantity when the order status is still “Process”? prestashop
 
Experimental portability header for PHP5/7 extension agnosticism. All APIs subject to change, just a random idea... https://github.com/sgolemon/zeval
 
6:15 AM
>>>EXPERIMENTAL<<<
Just playing around with some ideas...
 
yes, but still…
 
Tired as hell of putting #ifdef ZEND_ENGINE_3 everywhere.
I'm not hugely fan of the zeval typedef, but like... that change in levels of indirection isn't a minor thing.
 
@Sara btw, did you get my email a few weeks back?
 
Refresh my memory a little?
 
on feb 24, when you announced you'd leave fb.
instana
 
6:19 AM
Oh... evidently I did. (Sorry, missed it in the pileup)
 
np, just wanted to make sure you actually got it :)
 
Whereabouts are you guys?
 
@Sara it's kinda not enough
 
Oh, sorry, you said. Reading is hard.
 
falls down on the first hashtable lookup
 
6:22 AM
@JoeWatkins I know. It's not done yet :p
 
you plan to wrap all of zend api then ?
 
@JoeWatkins It's just some quick initial thoughts, there's plenty more work needing to be done yet.
@JoeWatkins As little as I can get away with.
 
I think it's a great idea. Obviously, since I RT'ed, faved and posted it here
 
Basically just the 80% APIs, leave the rest to extensions to do their own ifdefs for
The idea is to make the extension be less than 50% #ifdef blocks :p
 
ha
I just branched everything and done new versions for 7 ...
 
6:24 AM
For complex stuff (like xdebug) I tottally would do that. But for like... a simple client wrapper, it's overkill
 
derick went the ifdef way with xdebug, some others have too ... it's quite messy, but probably the correct thing todo ... yolo
you're going to abstract away the difference in objects ?
 
Every extension is it's own thing
@JoeWatkins Part of the difference, yes. Obviously not all of it.
 
yeah, thinking out loud ... with zval, ht and objects it may be useful ...
 
Kinda depends on how complex it winds up being.
 
it's mostly just the layout that needs normalizing, I'm not sure how that will work ...
 
6:27 AM
Yep
I have a few ideas, just nothing I wanted to stay up to do.
I figure I'll hack on it a little more on Friday
 
oh, you said friday
!!rebecca
 
@Gordon Happy Prebeccaday!
 
\o/
 
@Sara cool, will check it out again
 
@Gordon Lemme look at that email tomorrow when I'm not falling asleep. Will get back to you soon.
 
6:35 AM
@Sara cool. thanks :)
 
Okay.... seriously.... passing out. g'night
 
o/
 
#if PHP5
#define ZEND_BEGIN_OBJECT(n)	typedef struct _##n {
#define ZEND_END_OBJECT(n)			zend_object std; \
								} n;
#define ZEND_FETCH_OBJET(z, t)  (t*) zend_object_store_fetch_object(z TSRMLS_CC)
#else
#define ZEND_BEGIN_OBJECT(n) 	typedef struct _##n { \
									zend_object std;
#define ZEND_END_OBJECT(n)		} n;
#define ZEND_FETCH_OBJECT(z, t)	((t*) ((char*) Z_OBJ_P(z) - XtOffsetOf(t, std)))
#endif
maybe something like that, with a ZEND_COPY_OBJECT_HANLDERS or something to deal with offset ...
 
6:51 AM
morning
 
'nin
 
Wes
@JoeWatkins question. it's possible to detect at runtime within a given function whether the return of said function call gets used (ie in an expression, assignment, etc)?
 
internally there is
the frame has opline->result_type == IS_UNUSED in 7.1 and opline->result_type & EXT_TYPE_UNUSED in 7.0
 
Wes
would like to have something like
function bar(): Foo{
    if(func_return_is_used()){
        return new Foo();
    }else{
        return;
    }
}
imagine Foo being something not necessarily used but heavy to create
 
7:04 AM
it's doable, I'm not sure about it though ...
 
Anonymous
> if(func_return_is_used()) ??
 
the name is wrong ...
a file can return a value ...
 
Wes
function splice($start, $limit, $replacement): array{
    if(func_return_is_used()){
        return $collectedRemovedSequence;
    }else{
        return; // avoid collecting the removed array entirely
    }
}
 
/s/$collectedRemovedSequence/$collectedRemovedSequence()/
 
@Wes does this check whether the return is used by the callee? I dont get it.
 
Wes
7:07 AM
@Gordon yes, that
 
do you want me to do it, or you want to do it ?
 
@Wes ok, how about having a dedicated method for both cases then? that would avoid putting environmental info into the method
 
Wes
is it worth it? i'm asking if it can be useful to have in php, for everyone
 
I'm never sure about that ...
 
splice_with_return(), splice()
 
7:09 AM
you still need to know if the return value is used though, right ?
or you want the caller to choose the right function ?
 
@JoeWatkins you decide from the caller instead of from the callee
 
requiring the caller to invoke the right function seems like it will create quite horrible apis ...
 
@JoeWatkins why? imo, its the other way round. the callee shouldnt need to know what the caller does with the result
 
Wes
@Gordon that could end bad very easily, with dozen of duplicated methods :P
 
what the caller does is different to if the caller does anything ...
 
7:11 AM
Moin
 
if you return a value and it's not used, it is immediately destroyed ... I can see this being a huge waste that in some applications it makes sense to avoid ...
but it's also awkward, because relying on internal implementation details that might go away is shaky ground ... I can't really see why this would go away, but that it could is scary ...
 
@JoeWatkins yes, it might be waste, but imo it's better to have a separate function then instead of branching the behavior inside the function.
 
@Gordon it depends what your priorities are ...
 
Wes
@Gordon yes, i'd agree with that but think about it how easily this can go bad with tons of duplicated method, or with stupid signatures eg splice(1,100000, $replacement, $returnNullInsteadOfTheRemovedSequence)
 
7:14 AM
imo it's like doing function splice($foo, $bar, $withReturn = false). and that's a code smell because boolean flag changing behavior
 
if you are writing something that must be fast, or else it's useless ... then it doesn't matter so much what the code looks like, because it needs to be fast ...
 
if will be even faster without checking whether the return val is used, right?
just use the right method
 
not if it's a function call, probably that kills it ...
could use a magic constant like __FUNCTION__ ...
now it just seems hacky ...
 
Wes
i'd go with func_return_value_is_used() :B no automagic stuff
 
adds some polymorphism (or what would you call that..) to functions with void returns
 
7:17 AM
in some cases the cost of a function call is still less than the cost of creating the object, afterall that's one func call for ctor and many many allocations ...
afk, school run
 
Wes
lata
 
mogrn
 
imo splice: void is not the same as splice: array and having two methods with different behavior is not hacky at all and doesnt require to introduce some functions that reaches outside the callee
 
@PeeHaa '
 
Can anyone help me with this question? stackoverflow.com/questions/36907803/…
 
Wes
7:20 AM
anything that is intensive to create could technically use that @Gordon but with a dedicated method you would end up with dozens of pretty much identical methods
 
@Wes imo it's not duplication at all. its more a matter how you compose your methods.
 
Wes
i would rather do $noReturn
also splice() and spliceNoReturn() can't be implemented with one decorating the other, not without a private splice(, $noReturn) so it's 3
 
perfectly fine imo
 
Wes
to me it's literally the opposite, if i'd ever forced to do that i'd quit my job :D super horrible
 
you can also do splice($foo, $bar, function($x) { expensive collector code here });
and if you dont need to collect, you pass an empty closure
 
Wes
7:24 AM
with the closure called for each element removed?
 
if that's what your splice with return needs to do
 
Wes
what is $x?
 
a placeholder. I dont know what your collectedRemovedSequence means
 
@JoeWatkins openssl replaces the TCP stream handlers. Which is fucking madness, but that is what it does.
 
Wes
like array_splice @Gordon the removed subsequence
 
7:28 AM
@Wes then $x would be the removed element(s)
 
Wes
calling the closure for each removed element would mean that the array being modified would be accessible when in an invalid state eg when reindexing is still going, and that's not a thing i want :P
 
@JoeWatkins It is, but it's now optional to the caller. If the caller does not provide a callback it's zero cost, and a callback need only be provided if the caller wishes to set socket options on the accepted peer. Having thought about this further, the callback should return specifically socket options to set on the peer rather than a context, there is already a mechanism for assigning ctx options to the peer and none of them are applied at accept() time.
 
@Wes I dont understand what you mean, but if the closure thing wont work for you, you can still use two methods. like i said: imo, that's all better than introducing a function that checks things outside the callee's scope.
 
Hi all
 
Wes
it would be an useful hack to have. an hack, but useful... will ask bob, niki etc if it's worth it
 
7:37 AM
having that function essentially means that the responsibility what to return is on the callee when it really should be on the caller. also, a method should return one thing. and not two based on some conditions outside it's scope. it's a very horrible suggestion.
 
Anonymous
Mornin
 
'
 
!!version
 
Anonymous
@Saitama ' to you too
 
Anonymous
7:41 AM
Small request, can we make Jeeves into an AI Bot please? Thanks.
 
@JayIsTooCommon you can write a plugin for that
 
Wes
@Gordon you could say about the same thing about generators
 
@Wes what makes you think that?
 
Wes
it's the same kind of optimization
 
@PeeHaa a) can you pull latest master and b) is there any way to do that automagically?
 
7:45 AM
!!deploy
!!restart
 
set up a hook?
 
Wes
dave, kelunik, peehaa, @bwoebi, @NikiC chat.stackoverflow.com/transcript/message/30213126#30213126 opinions about this?
 
@Wes how about $removedElements = collect([], splice($args) { yield $removed; })
 
Wes
> calling the closure for each removed element would mean that the array being modified would be accessible while in an invalid state eg when reindexing is still going
it's not possible...
 
sorry, i dont get that argument
 
7:50 AM
@Wes Really bad idea.
 
Wes
"really bad" is... really bad. doesn't php do this internally? avoid returning stuff when the return is not used?
 
@Gordon What language is that? It's not valid PHP.
@Wes Don't know, but userland shouldn't know about it. It may be an internal optimization, but userland shouldn't know and care.
What's the use case?
 
Wes
47 mins ago, by Wes
function splice($start, $limit, $replacement): array{
    if(func_return_is_used()){
        return $collectedRemovedSequence;
    }else{
        return; // avoid collecting the removed array entirely
    }
}
and any intensive operation whose result not necessarily is used
 
@kelunik pseudo code
 
@Gordon I guess generators won't help here.
 
7:55 AM
m etc...
 
@Wes Issue is that a function shouldn't know anything about it's calling context.
 
Wes
@Gordon you can't yield during such operation, because unless you consume the iterator the splice won't happen
 
I think it's best to have two functions in that case.
 
How does composer deal with symlink name conflicts in vendor/bin without using a directory namespace, if any package can create whatever named symlink they want?
 
Wes
@kelunik would be an hack, but useful... would avoid having duplicated methods or $noReturn param
 
7:59 AM
@Wes The thing is: You do not only not return, you must not collect the elements as well.
 
Wes
indeed
 
0
Q: slider that changes according to image size

Waqas_aamerI have some different dimensions slider images. some are small, some are large . I want this that there is a slider that changes according to machine.If we are using desktop then we can give it minimum slides to 4. If we are using tablet then it loads 2 slides. If we are using on mobile then it l...

 
@Wes You add a lot of complexity for often very little gain, because you add many conditionals to always check if the return is used.
 
Wes
how you write code is subjective, but if the operation is actually intensive, the added complexity could pay off
 
@Wes the methods are not duplicated, they are doing different things
 
8:03 AM
@kelunik I assume it's not running with sufficient OS permissions for it to be this simple, would need a git hook I imagine
 
fuck
was it allowed to typehint array in php 5.3?
 
@Wes I going to go with "no"
!!docs hint
 
@DaveRandom I bet it's running under a user that has write permissions for the directory. @PeeHaa?
 
lol useless page
@tereško 5.1
 
Wes
8:05 AM
@tereško array was typehintable since php 5.0.0
 
@DaveRandom already found it, tnx
@Wes nope
 
Wes
i thought it was 5.0 meh
 
!!docs type declaration
 
[ PDOException ] Represents an error raised by PDO. You should not throw a PDOException from your own code. See Exceptions for more information about Exceptions in PHP.
 
oO
 
8:06 AM
@Jeeves go home, you are drunk
 
"hint" is a special case, could add one for "type declaration" but would rely on no typos
"type" goes somewhere else (more basic docs about data types)
 
!!docs type
 
!!docs declaration
 
[ DOMException ] DOM operations raise exceptions under particular circumstances, i.e., when an operation is impossible to perform for logical reasons.
 
8:08 AM
o.O
 
@Wes and it's very obvious that they are doing different things by the boolean flag argument. Cf. informit.com/articles/article.aspx?p=1392524
 
(will also match things without the trailing "s")
 
@Wes if you can write up the full splice function, I will try to rewrite it so it doesnt need a flag argument
 
Wes
@Gordon i agree, but it's not humanly acceptable for code maintainability and api usability to have these pretty much duplicated methods. the function would be an exception for those rare cases where the operation is actually intensive (even if the result is going to be immediately garbage collected) and not doing it would actually yield better results. php has many hacks already, i don't think such a function would be the worst of evils... sorry for double ping
 
Morning.
 
8:15 AM
@Wes Eh ... just design a proper API instead.
 
@Wes I dont understand why you think having one function with two independent branches and variable return types could be better than having two separate methods.
 
Anonymous
@Oldskool o/
 
@Oldskool '
 
Wes
@NikiC you guys are so mean sometimes... gawd. ok ok, i'll shut up now. NOT sorry for the double ping
 
:-P
 
8:16 AM
:P
 
ftr I agree with them, and I suspect that if you go and !!coffee then you will as well @Wes
 
Wes
i like small interfaces, i would never have a "pretty much the same" method... even after a coffee
 
@DaveRandom Does it? I think it just appends s when trying? So shouldn't it be decl instead of decls?
 
@kelunik Yes, it appends the s when trying, so decl will be converted to decls and match, not the other way around. However I did fuck up declaration and am just fixing it
done
 
@Wes :)
@Wes It sometimes help to imagine a feature in the hands of a Laravel developer
6
Who would not do this as a small performance tweak, but use totally different behavior for return / no return
 
Wes
8:25 AM
@NikiC that's the problem. imagine it in the hands of a proper developer, instead. or are you improving php for Laravel users? i don't think so...
 
@Wes a "proper" developer would write two methods ;)
 
@Wes Doing the right thing should be easy, doing the wrong thing should be hard. Something like that makes it easy to do the wrong thing.
 
morning guys
 
@Wes I think I mentioned, I'm always wrong :)
 
@JoeWatkins Even when you're saying that you're always wrong?
 
8:29 AM
any mods here?
 
yes, always :D
 
ok cool
 
@taco I am retired
 
:d
 
@JoeWatkins LogicException
 
8:30 AM
@Gordon I just have an SO chatroom question. Maybe you can help?
 
!!> LogicException;
 
[ 5.5.0 - 5.6.20, 7.0.0 - 7.0.6 ] Parse error: syntax error, unexpected end of file in /in/RKdPC on line 1 <br/><i>Process exited with code <b title="Generic Error">255</b>.</i>
[ 5.5.0 - 5.6.20, hhvm-3.9.1 - 7.0.6 ] Notice: Use of undefined constant LogicException - assumed 'LogicException' in /in/c1NrV on line 1
 
@taco I don't know. You'd have to ask the question first.
 
[ hhvm-3.9.1 - 3.12.0 ] Fatal error: syntax error, unexpected $end in /in/RKdPC on line 1 <br/><i>Process exited with code <b title="Generic Error">255</b>.</i>
 
as an internals dev, I have an internal mechanism for turning logic exceptions into candy .... yummy inconsistency ...
 
8:31 AM
My Docker room got frozen. I went on Vacation for 10 days and it froze after 14
Unfortunately not many people idle there, so if I am not there to field Docker questions, it is mostly dead
 
@taco then it's probably not a good room to maintain
 
not many == nobody
:(
Docker blog just said they are going to be supporting users on SO though
so I feel like it has a place
First sentence says "We receive many requests from the Docker community for help identifying experts who can answer questions on different forums like Stack Overflow," .... so I feel like we may have more people wander in
:D
 
@taco well, it it doesnt have activity, it will get frozen for inactivity. Regardless of what some blog says
 
no doubt
 
flag the Feeds message for moderator attention. State your case and then wait to see if it gets reopened.
 
8:35 AM
ok thanks for the help!
 
for moderator attention. not a regular flag.
 
oh ok
 
lol I Just declined that flag....
 
o/
 
:<
 
8:37 AM
@taco use the flag for moderators
 
Why isn't my static calling working?
`<?php
class Person {
static public function say() {
return "Here are my thoughts!";
}
}
class Blogger extends Person {
const cats = 50;
}

echo Blogger::cats;
Blogger::say();
?>`
 
@HamZa thanks done
 
possibly, too many cats ...
 
@taco welcome. Are you into Docker? I've been playing with it lately...
 
@HamZa yep!
 
8:39 AM
Shouldn't it work?
 
@JamesSnowy maybe because you are not echo'ing it?
 
Blogger:say() doesn't show though.
Do you need to echo a static call?
 
Anonymous
because you are not echoing it.
 
@JamesSnowy You're just returning the string, not doing anything with it.
echo Blogger::say();
 
@HamZa feel free to idle in the Docker room. I answer any questions I can :d
 
8:40 AM
Should work just fine.
 
So I need to echo it, right.
 
Anonymous
yes.
 
@JamesSnowy what makes you think you wouldn't need to echo it?
 
Thought you didn't lol.
 
aww, I had come up with a whole thing about reducing the number of cats in your app ... there was going to be a meow constant and everything ...
 
8:40 AM
@JamesSnowy Well yes, if that is what you want to do. You're just returning the string, but in itself a string is not echoed by default. You might want to pass it to another function as input or whatever, so you need to tell PHP what you want to do with that return value.
 
Thanks everyone.
 
except me, I wasn't helpful, at all ...
 
This course confuses my really bad..
 
s/my/me
 
Anonymous
You will be permanently and severely confused in life, if you keep learning PHP (as your first language)
 
Anonymous
8:42 AM
Source: I'm confused.
 
hey
is there a way to get a different .gitignore for each branch?
 
@tereško by commiting it?
 
lol ^
 
@JoeWatkins I think that's rather a bad idea. Just be explicit (via parameter) in whether something shall be returned or not. \cc @Wes
 
basically, I need to prevent merge of .gitignore files, when merging branches
 
8:44 AM
I did say I wasn't sure about it
 
25
A: Git: ignore some files during a merge (keep some files restricted to one branch)

DavidI found a good answer here: stackoverflow Q332528 It uses ideas taken from here: Pro-Git merge strategies Here is a copy of it: Let's say you want to exclude the file config.php On branch A: Create a file named '.gitattributes' in the same dir, with this line: config.php merg...

 
http://git.php.net/?p=php-src.git;a=commitdiff;h=6499162ff0d8aa6e862d3e3cdd2288b87636b8a1

What's the point of that patch!?
 
@DaveRandom thanks
 
I don't know, I don't like the look of it, what is fake_scope all about ?
 
that might help
 
8:47 AM
wtf
you think he might have checked with ext devs before making that kind of change
 
@tereško I have done this before and I remember it being super-hard to wrap my head around it and I have now forgotten it, but I do also remember that the suggestion does make sense and you can just blindly follow it if you don't have time to understand it
 
are you going to email internals about that @bwoebi ?
 
@JoeWatkins About what?
about that patch?
 
yes
 
I'm more likely to mail him privately
 
8:51 AM
why ?
I think if you or I committed something like that, without any discussion, and without justification, we would be called out in public ...
 
@JoeWatkins ..because it would make more sense than creating a public shitstorm when there might be a reasonable direct answer?
@JoeWatkins probably. But at least some people would likely contact you privately first
 
hello guys! can anyone tell me how I can encode this printf("%s%s\n",$row[0],$row[1]); in json?
 
@user3295583 look at json_encode()
 
$json = json_encode($row)
 
I tried something like // Store first result set
if ($result=mysqli_store_result($con))
{
$r = array();
while($row = mysqli_fetch_array($result))
{
array_push($r,
array('total_wt'=>$row[0],
'pymt_amount'=>$row[0],$row[1],
'mode_of_pymt'=>$row[0],$row[1]));
}

echo json_encode(array("result"=>$r));

}
but it did not give me expected output
These are the 2 queries I am trying to run SELECT SUM(total_wt) FROM `billing_all` WHERE date ="15-Apr-2016";
SELECT pymt_amount, mode_of_pymt FROM `payment_details` WHERE DATE LIKE "2016-04-15%";
 
8:56 AM
what output did you get and what were you expecting?
 
The 1st returns a single value while the other returns 2 values.So if I do this if ($result=mysqli_store_result($con)) {
// Fetch one and one row
while ($row=mysqli_fetch_row($result))
{
printf("%s%s\n",$row[0],$row[1]);
}
// Free result set
mysqli_free_result($result);
}
}
I get the expected result but I want it in an json encoded format
 
@DaveRandom well, I passed it up the food-chain
 
@tereško I'm sure a compromise that pleases nobody can be reached, then
 
@Jimbo '
 
8:58 AM
@user3295583 Your arrays look off. Either your indedation is strange or you're not getting how assigning array values work. Like this: 'pymt_amount'=>$row[0],$row[1],, this would assign $row[0] to pymt_amount, and then $row[1] will become a numeric-indexed value in your array. Looks strange/unintended.
 
@DaveRandom :D
 

« first day (2021 days earlier)      last day (2918 days later) »