« first day (4202 days earlier)      last day (971 days later) » 

00:50
C question, thought I'd ask here since it makes sense.

I have some functions which return pointers and I would like to keep track of them, for this I wanted to use an array of pointers, however an array has a fixed size, so I guess I'd have to malloc and realloc ? Any reading material pointers would be helpful thanks
My main goal is to be able to free anything which has been created by my custom functions at the end of main()
01:36
depends how efficient you need to be for adding / removing them. If you're needing to free them all at the end of main chances are you're not managing them right in the first place
 
2 hours later…
Wes
Wes
03:49
"duck typing"
TypeError: can only concatenate list (not "tuple") to list
honestly python is weird as hell
 
2 hours later…
06:01
@Tiffany that statement is commented out, its was from another code to fetch single result
 
4 hours later…
10:17
Morning o/
 
2 hours later…
12:08
I've been cooking up my thoughts on an RFC for a few months and I think I'm ready to punt. I asked Dharman about whether I need karma and he pointed me to externals.io/message/113434#113440. I've been reading all of howto pages that lead to howto pages that lead to howto pages. I am planning to fire my work into the mailing list for discussion this week. Can anyone offer guidance about karma?
^ yes, I read that a few times and links in it that lead to more links.
I need to use a personal email account? How does one get one of those @php.net accounts. Is it necessary/beneficial?
You get one once you have commit access.
That page gives the process you want to follow - the links are to pages you need (eg. wiki registration) or for more detail.
You don't need (and won't get) an @php.net email account.
Righto
12:15
Code can be submitted as a Git(Hub) pull request
I don't foresee myself submitting any code to core. I'm not a good enough programmer for that at this point.
 
1 hour later…
13:35
To write an RFC, all that's needed is wiki karma which is separate from a PHP account.
To receive wiki karma, email internals asking for karma, it should be granted by someone, and then you can compose and submit an RFC
DGF
DGF
14:00
Posted this yesterday: https://chat.stackoverflow.com/transcript/message/54378063#54378063 and https://chat.stackoverflow.com/transcript/message/54378425#54378425.

Can anyone just please give me a hint if it's me doing something wrong or if it's a bug in PHP? At least the 2) (filter function) is weird returning one value that is not supposed
cmb
cmb
14:13
@DGF it seems that you're looking for array_walk_recursive() (although using array_walk*() may not be a good idea)
DGF
DGF
14:43
@cmb Thanks, wasn't aware of that function. Weird using different name convenction for apparently the same thing (array_map, array_walk_recursive).
I don't really need to use it tho, I'm just trying to understand how would I build something like that / why does it fail.

And the 2) isn't that a bug in PHP?
It's kind of depressing when the top voted comment on a docs page is actually kind of stupid.
cmb
cmb
@DGF array_walk() modifies the given array; array_map() returns a new array; this is very different. And no, there is no bug in PHP; see 3v4l.org/0RO6q for a working example (again, it's very different to modify in-place vs. returning).
@Crell I wouldn't call it depressing, but rather PHP. ;)
DGF
DGF
@Crell Some comment that I miss in the docs? Or not for me?
@DGF Nothing related to you. I'm just grumbling aloud.
Is it possible to configure PhpStorm to auto detect phpunit/composer path ? i have to set it in all projects
DGF
DGF
14:57
@cmb Hmmm... I actually tried to add all those & in the same place as you, the difference is that I didn't do `$v = $callback($v)` I just did `$callback($v)`. I thought the callback would automatically change the value of $v :C Thanks

But when I mentioned bug in PHP I as actually talking about the 2) example I gave yesterday (the filter one): https://3v4l.org/U6bu1. It's returning one value that doesn't start with '_'
Yeah... thinking about that, why wouldn't the value of $v change with the callback without using `$v =`? Since I'm (you) already passing $v as reference O.o

What is my brain not understanding
What's the best practice for testing a controller. Are you supposed to write integration tests or unit tests?
If a controller has any code in it worth unit testing, it needs to be refactored. :-) Integration tests are more appropriate.
Thanks
DGF
DGF
No, nevermind, you don't need to use ` $v = `: 3v4l.org/JvYNs. So, I most likely didn't add one of those & in some place
DGF
DGF
15:24
Am I not right in the 2) example or am I doing something stupid also? I even added more chars: 3v4l.org/fXtPj
@Crell I just purchased your thinking functional book.
@SalOrozco Yay! I hope you enjoy it. :-)
DGF
DGF
15:40
I think it was me doing something stupid, there is a point in where $flag returns an array and not bool, now it works: 3v4l.org/goMXE
Ofc, because of the recursive filter... it is returning an array. Facepalm
HI Any One:
Am I close? (Im so lost)


if ( ! function_exists( 'add_extra_item_to_nav_menu' ) ){

function add_extra_item_to_nav_menu( $items, $args ) {
$linkTexts = [
'administrator' => 'SHOP NOW ADMIN',
'boac' => 'SHOP boac',
'ROLEXYZ' => 'SHOP NOW XYZ'
];

$linkPaths = [
'boac' => ['link_text' => 'SHOB NOW boac', 'link_path' => '<http://google.com>']
];


if (($args->menu - 5) && (is_user_logged_in)) {
$linkIndex = null;
if (current_user_can('administrator')) $linkIndex = 'administrator';
else if (current_user_can('boac')) $linkIndex = 'boac';
Please use a pastebin for something that long.
pastebin ?
DGF
DGF
@MikeLoucas Something like 3v4l.org, where you place code and share to others
cmb
cmb
15:57
but please don't use 3v4l.org for code which can't run anyway :)
there is pastebin.com and gist.github.com for that
Well thats new, lol Like this?
Without any indentation it's hard to tell what you're trying to do. Please format it first. Also, your if-else statements need {} on them, even for single-line bodies. The function-exists check is also unnecessary.
 
2 hours later…
17:56
Good evening, folks. I was just wondering if there's any plan to add \Url class in php? If no would you like to see it?
@Leri For that to happen I think you'd need to answer: What advantage would there be to it being in core, compared to using packages like league/uri?
@AllenJB PHP already offers functional way to work with urls at the core (unless I am missing something and these functions got deprecated). From my old days with PHP almost every project had its own implementation of url. So, basically, the idea is to make programming API uniform and not scattered all over the place.
I'm not saying it wouldn't happen, but the general philosophy I see on internals is "let the community do what it can, and only add stuff to core when it has a really good reason to be there". This keeps the complexity of PHP core low and allows the community to better evolve such packages much faster (since they're not tied to PHP's release schedule).
18:17
Thanks, that makes sense. In 2014 I wanted to make a RFC for the same but caught up with a lot of work. Wanted to get back to it just for fun. Here's the initial idea if anyone is interested: github.com/leri/php-src/commit/…
 
4 hours later…
22:27
@Crell I need to call upon your functional programming knowledge if I may. What would be the formal term / design pattern for a function that accepts another function/closure to call part way through after performing actions around it, a function equivalent of a template pattern?
22:55
I'm writing recursive generators (i.e. with yield from) and … it's somehow not easy to wrap my mind around that. … but I started with a manually managed stack, which was much worse and didn't work out :-D
23:09
I suppose if I want to impement a "remember me" option I must set a cookie on the user's computer...am I correct?
23:22
Yes
23:51
o/

« first day (4202 days earlier)      last day (971 days later) »