« first day (1011 days earlier)      last day (4163 days later) » 

19:00
@NikiC yeah, turn arrays into "iterators"... At least for internal usage
@ircmaxell wouldn't this mean just more overhead?
@ircmaxell Actually I have quite a big chunk of code in that direction
@bwoebi less actually
ah? why?
because right now all the type-juggling has to be done on every step. Here, it could be a polymorphic decision done at the initial point...
19:02
a complicated patch though, and requires serious cleanup ^^
@NikiC I like it
@NikiC I can only imagine
the issue is - as always - interruption safety
I.e. either you copy the array or you implement some safety mechanism. I went for the latter
Where safe iterator need to be registered in the hashtable
hmmm...
adds another pointer of overhead though (in the ht struct)
could save it in cases where the IAP is not used though
anyway, everything a bit complicated
yeah, sounds like it
unless...
the entire array (from an iteration standpoint) is just a big SLL, right?
19:06
@ircmaxell yes
github.com/nikic/php-src/commit/… <= That was my initial code (the actual iterator wrapper for arrays is not in there though).
so it's safe from modification prior to the current start point (as long as it's not cutting free)
hmmm... no...
@ircmaxell The problem is if the element you are currently pointing to is removed
That's the case you need to handle
or any after
no, any after doesn't matter
just the one you're pointing to, to prevent leaving you with a dangling ptr
Well, ah, copy-on-write will take care of that
can you pre-cache the next pointer? So you're safe unless both the current and next are poppsed...
19:09
@ircmaxell hack ^^
imho this should work in the general case
yeah, definitely
PHP arrays suck
so in the end there is no way around registering the HashPosition in the hashtable, so the pointer can be updated with the bucket is removed :)
@ircmaxell Yep ^^
unless. and this is a big concept. we refactor it to be a real array (ordered and everythign), with a hash-table pointing to the array element. Insertions would be WAY more expensive, so that's out
/me is kidding, if that wasn't obvious
There have to be some serious optimizations on arrays PHP is missing.
user1596138
Been on the phone with GoDaddy for an hour now. All I need is the goddamn default php.ini file. It's taken me until now to convince them that I actually need it and now they're looking for a supervisor who has access to it.
user1596138
19:13
I could've re-written it from scratch from phpinfo() in this time...
I say that because I have a test that is pretty much all array operations and it gets destroyed when compared to JS.
@LeviMorrison that's sort-of the point. The arrays are already optimized. And that leads to a lot of pain in a lot of cases...
@LeviMorrison JS is using a compiler optimization to do it
@ircmaxell 50 mins meh
it's worth it
but assuming ICs means inline cache - then yeah, inline caches are awesome
esp polymorphic inline caches ^^
19:18
;-)
Apache or Nginx?
Some of you work with Firebird?
@NikiC: what do you think about abstracting the HT away from the rest of PHP all together...
@ircmaxell not quite sure what you mean there
Well, right now, all over core is direct references to the HT and its internals
but what if we abstracted that behind a slim and sane interface
that way, if you do array(1, 2, 3), we can internally allocate double[3] instead of a full HT (and thereby switch to a HT once you either use non-int keys, sparse keys or different values...
19:26
@ircmaxell if you want to do that kind of optimization, then you need to do it at the HT level anyway
^ my current problem
IIRC lua optimizes continuously indexed arrays (they also support only HTs)
@NikiC well, but abstract it so we could do it... So that way code would do `ht->get_index(*zval)
rather than the current H format which returns the HT itself (no polymorphism)
@ircmaxell no, absolutely against that
HT should not be a polymorphic structure
way too slow and memory expensive
19:28
too slow?
memory expensive?
carrying vtables around and stuff
it would just be a single pointer...
HT->handlers.get_index(HT, *zval)
@ircmaxell then I think I still don't get your idea
Can I ask a quick question about SQL in here? I'm just trying to figure out if you can use an AS alias to do operations with? Like SELECT ID as 'ID#' FROM tablename WHERE 'ID#'>0
@ircmaxell Or at least zval[3] instead.
19:29
it would be 1 extra pointer lookup (for the funciton pointer)
@ircmaxell and in either case, at some point you will need to transition from the "plain array" to the actual HT, so...
@NikiC right, unboxing. But only if it doesn't fit that category
@LeviMorrison sure
anyway, point being: I don't think that optimizing continuously indexed arrays requires additional abstraction.
If someone wanted to do this, then it shouldn't be much harder to do it with the current API
Well, I'm talkign about changing how iteration works. So pListNext would dissapear. So it would need to be abstracted...
because the buckets would disappear...
@NikiC as someone from Microsoft once said "99% of features, that people request for the next Excel, are already in the current Excel"
19:35
Sorry for interrupting your interesting discussion, but why is the first parameter of the callback passed to array_reduce by reference? I thought you would return and not modify the $result? Or is this reference doing anything?
@bwoebi hm... that doesn't sound right
Thanks @MadaraUchiha ^_^
@NikiC it's just what the docs are stating… that's confusing me.
@ircmaxell he's talking about the callback, not the function itself ;)
19:39
Ah ok
@ircmaxell the first parameter of the callback.
is it?
(being passed by reference)?
that's not a reference
@bwoebi not a reference
19:41
it's just getting the pointers to match up as expected
although...
eih, yeah
I don't actually know how you can see ref/noref in fci calls
I'd presume that they're always by-val
// from docs:
 function

    The callback function.
    mixed callback ( mixed &$result , mixed $item )
it depends on the called function
yeah, that's what's happening
$test = array(1);
$b = 2;
$test[] =&$b;

$el = 3;
var_dump($test);
var_dump(array_reduce($test, function(&$initial, &$value) {
    $value++;
    $initial++;
    return $initial;
}, $el));
var_dump($test);
array(2) {
  [0]=>
  int(1)
  [1]=>
  &int(2)
}
int(5)
array(2) {
  [0]=>
  int(2)
  [1]=>
  &int(3)
}
?
so, the & is just too much in the docs?
= just to confuse users :-)
 // Then the callback should be documented as:

 function

    The callback function.
    mixed callback ( mixed $result , mixed &$item )
19:51
it's reference on both
isRef was set on both... the point was that $initial was overwritten by the return...
// why is $ref at the end NULL ?!?

$test = array(1);
$b = 2;
$test[] =&$b;

$el = 3;
var_dump(array_reduce($test, function(&$initial, &$value) use (&$ref) {
    $initial++;
    $ref = &$initial;
    return $initial;
}, $el));
var_dump($ref);
@ircmaxell But $ref is a reference? Analogy: $b = 5; $a = &$b; unset($b);, then $a should still be 5?
20:00
Evening room 11
@bwoebi no, the $ref =& kills the initial reference and creates a new one. You'd need to drop the & from that liune
@ircmaxell Did I just see Lance in there?
@ircmaxell this would be assigning by value?
@bwoebi well assigning by value to a reference... You can't make a chain like that...
I got an idea
i have a question, what do you think about it: i have to make a lot of services (desktop apps, php-based app, node.js app, etc...) and they all need to be connected to the same database. should i do an api that will be able to manage every services?
or should i do an api for the non-php or non-web based apps
20:03
$test = array(1);
$b = 2;
$test[] =&$b;

$el = 3;
$initials = [];
var_dump($test);
var_dump(array_reduce($test, function&(&$initial, &$value) use (&$initials) {
    $value++;
    $initials[] = &$initial;
    $initial++;
    return $initial;
}, $el));
var_dump($test, $initials);
array(2) {
  [0]=>
  int(1)
  [1]=>
  &int(2)
}
int(5)
array(2) {
  [0]=>
  int(2)
  [1]=>
  &int(3)
}
array(2) {
  [0]=>
  &int(5)
  [1]=>
  &int(5)
}
@ircmaxell no? $b = 5; $a = &$b; $c = &$a; $b++; var_dump($a, $b, $c); unset($b); var_dump($a, $b, $c);
@PeeHaa among others
@bwoebi $a = &$b; $a = &$c; $b !== $c && $a !== $b;
@ircmaxell I'm not doing this?
it's complicated and I barely understand it without thinking about it hard
20:07
please :(
@ircmaxell ah, you're returning by-ref
@bwoebi yup ;-)
but this still doesn't clarify to me why my code doesn't work as I expect
the reference is broken
@ircmaxell yes, when a reference pointer is removed (with unset() in PHP), the variable remains the same value…?
or where's the difference here?
20:11
try removing the return by reference ;-)
@ircmaxell I know, that's what I have?
@ircmaxell That is pretty... awseom
!
@PeeHaa yeah, have you seen many HISHE?
@bwoebi no, with the array
@ircmaxell No, really not
@ircmaxell what the?!? why does it work with an array entry but not with a variable?!?
20:15
@PeeHaa the ending would have made a ton more sense if you had...
to the point of rolling on the floor funny
@ircmaxell please explain?
?
it matters how references are implemented
think about it as pointers to pointers, and draw what's going on
@ircmaxell but why does it work with the array?
draw it out
Thought the $ref should be equal to $initial in the last/second iteration? (= $initials[1])
20:21
draw it out
I don't get what you mean with I should draw it out?!
you've seen my video on references?
@ircmaxell which one?
Any here from academia ? I have query regarding a research paper on a graph based algorithm. This is my first research paper. I am quite confused. :(
@ircmaxell it didn't get clearer… even after I tried to draw it out :-/
I just can guess a bit, but this doesn't really help me.
$ php -r '$a = 1; $b = &$a; $c = 3; $b =& $c; var_dump($a, $b, $c);'
int(1)
int(3)
int(3)
that's clear
hey! something strange it's happening me with Session, I put a value on a session, but unlti I reload the page, It dosen't change... why?
Evenings
link #fail
//But this isn't clear:

php -r '$b = 1; $a = &$b; $c = 3; $b =& $c; var_dump($a, $b, $c);'
int(1)
int(3)
int(3)
draw it out
20:36
why isn't there a reference from $c over $b to $a?
$a = &$b doesn't create a reference from A to B, it creates a reference from A to B's value
but I think I think too much with pointers instead of PHP refs… what is confusing me
thank you, I have understood :-)
@hakre hehehehehehehe
this just doesn't sound like what someone might expect…
PHP: you never finish learning something new…
7
20:44
@ircmaxell: I'm getting some feedback on the mailinglist (saying: ask on glibc devs :D) and also here some more feedback: security.stackexchange.com/questions/39417/…
yeah, I saw
that's what's making PHP in the same time a sadness as it makes it fascinating.
Auto-ellipsis?
aww, I missed the references discussion :/
20:48
Wrap the action controller in a dynamic-parameter-action-controller-front-controller-homemade-mvc-edition. That normally does it. — hakre 3 mins ago
@hakre Gesundheit.
:P
Was that supposed to be a stab at me @hakre ?
^_^
I would like 42 MILLION dollars. Small bills. 8 suitcases. — Neal 4 secs ago
a stab? In german it's called Stab and it means baton/poles/post
@hakre Pffft
@hakre I thought it was a stab (English) at my library. :-P
20:52
what does that mean? Like poking someone?
MVC has nothing to do with security ? that s quite a statement, which makes me speak no more. — DarthVader 1 min ago
3
Also just had the pleasure to remind wordpress devs of a GPL violation they introduced ca. eight years ago. ^^
I was talking about this @hakre
@hakre That sounds very pleasing indeed
@hakre Again?
@hakre wasn't it you who brought up the hello dolly thing some time ago?
@PeeHaa sure. I could also slip blank automattic inc., but I keep that one for a special moment.
@PeeHaa well, not originally.
However in the end I had the opportunity to explain wordpress core devs which GPL version exactly they use and why and what that means.
anantgarg.com/2009/03/13/… @tereško it is bad, no?
yes , it is bad
20:58
I built on top of those examples for my library (although it has diverged a lot from there)
and it's bad even as a "how to make rails clone" tutorial
the code there makes small children bleed
:-\
anyone know of a site that has tutorials on best practices for unobtrusive js and php variables? typically i add data- attributes to elements, but i want to read how others handle this

JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
@user20232359723568423357842364 What does this have to do with [php]?
21:02
oh god that name
i have data in php that i echo like data-test-elm=<?php echo $var; ?>
then i use js to get the attribute data-test-...
@user20232359723568423357842364 That has nothing to do with PHP in the sense of unobtrusive JS
Totally unrelated
:-)
@user20232359723568423357842364 in general you could do something like this at the bottom of you HTML output (somewhere before </body>):
<script type="text/javascript">
    var data = data || {};
    data.variable = <?php echo json_encode($some_php_parameter); ?>;
</script>
ty tereško ... i do that now.. but i hear people saying they NEVER mix php and JS
this particular implementation might have some security issue, but it should give you the general idea
@user20232359723568423357842364 they are saying it about mixing your php and javascript logic
all your JS logic (including events) should reside in separate JS files
and those should not contain any PHP whatsoever
so, <script> on the page is still unobstrusive?
provided i do not mix js logic with php
i think you do not really understand waht "unobtrusive" means
21:07
i can use your example in my output and domready will catch it
@user20232359723568423357842364 should be perfectly fine.
you're probably right :D
guess i know where to start ;)
@user20232359723568423357842364 why would you use ondomready ?
why cannot you put your scripts just at the bottom of your HTML code ?
the generic term domready... $().ready
There is a ondomready? :P
21:09
@PeeHaa actually, I'm not sure ... I think usually it just gets faked
@user20232359723568423357842364 jquery is not part of javascript or DOM standard syntax
also
@user20232359723568423357842364 that is jQuery and not plain ol' javascript
when you put your JS right before </body> it will get executed as soon as DOM is complete
thanks tereško.. you have pointed out that i need a better understanding of unobtrusive js.. so.. bbl
@user20232359723568423357842364 idk if you have the right definition there...
actually, you just need to stop being lazy and learn native javascript
Unobtrusive JavaScript is a general approach to the use of JavaScript in web pages. Though the term is not formally defined, its basic principles are generally understood to include: * Separation of functionality (the "behavior layer") from a Web page's structure/content and presentation * Best practices to avoid the problems of traditional JavaScript programming (such as browser inconsistencies and lack of scalability) * Progressive enhancement to support user agents that may not support advanced JavaScript functionality A new paradigm JavaScript historically has had a reputation for ...
21:13
most of my work is backend... so jquery is good for front end nubs like myself
being good at JS will make you a better PHP developer
seriously
throw new TooMuchJavascriptInRoomException(11);
lol , i just got hit by serial DV
@tereško lol maybe that user about security ?
21:17
most likely
@hakre just, why don't you want to have shorter salts than the maximum? there's more entropy when you allow also for example 8 byte salts. (= more possible salts) (related to: security.stackexchange.com/questions/39417/…)
@bwoebi Well technically \NUL and $ do not work, so the 256 character alphabet is reduced to 254 characters. Right now I don't want to go lower than that.
(I as of my personal motivation. I might be wrong however)
@hakre \0 works, it just shortens your salt? it doesn't reduce anything?
@bwoebi Dreppers code used NUL terminated strings for the salt, so yes, \0 effectively terminates the string which is counter-productive.
there are more possible combinations of salts if you include \0
@hakre it isn't? it should be considered intentional?
21:23
@bwoebi well, AFAIK a specification contains an implementation as well. So does it Drepper. Reading the text does not suggest to drop NUL or $, but reading the implementations' C code, it suggests that those characters are not allowed for salt.
If you could review the C code as well, I'm not so good as you are I assume. (scroll down here if you like)
in JavaScript, 59 secs ago, by Neal
Anyone want to improve my js over here: http://codepen.io/maniator/pen/reAnu ?
^_^
Insta star
And yeah I'm glad Dutch isn't in there
@Neal you would have to pay for that
lol
21:28
@tereško :-P
@Gordon what is Rammstein?
21:31
@Gordon i think i pulled somthing in my neck
@Gordon never heart of.… Gehöre wohl zu dem winzigen einen Teilchen da, der im Deutschunterricht war :D
@bwoebi oh, that's a perfect sentence I'd say.
@bwoebi +1
with a cryptographically secure source of random bytes (8 bit octets), is it okay to take only 7 bits of each byte 7 times and then use those taken out 7 bits to form another 7 bit value before using byte #8 to go on?
@PeeHaa Blarg; people poo-talking XHTML.
21:37
@hakre Don't know how to express this (mainly Verniedlichung) in English… Auch wenn man wohl aufpassen sollte und die Verniedlichung von Teil mit dem Wort Teilchen, das eine Form von Materie beschreibt, nicht verwechseln sollte
cutification probably? In any way, because of the context of your sentence, it's clear how you used Teilchen, that said, not going into physics.
which could be sports as well, right?
@hakre sports?!
physics in the gym?
@hakre no?
probably I better check the dictionary before laying out too wide out of the window.
21:41
@Gordon , will 4 DVs in a minute be caught by maintenance script ?
@tereško Let me guess, a sane value of a limit is 10.
dunno
against the same user.
well .. yes .. against me
I mean the pair of the same user like you + mr. x. 10 times.
21:43
@hakre seems as if it was intentional to cut a string off at a NUL or $ byte. And if you remove both from your possible chars, you have instead of (sum i = 1 to 16 (254^i)) only 254^16 possibilities, what is about 0.4% less
@hakre you are drunk, go home
@tereško I suppose he's already at home
@tereško not sure. ping when it doesnt happen within 24 hours
... if i remember
21:46
@bwoebi yes I would strip bit 1 (zero based). and collect those until i've got 7 of them.
@hakre which is about 1,3*10^24 possibilities more if you include at least one of these two: NUL or $
Does anyone know a good guide for java layouts? That oracle tutorials doesn't really teach good design.
@bwoebi that looks like a circa calculation.
@kaser probably (just saying) asking in the PHP chatroom is not very straight forward?
hi! I'm writing a value on a session, but when I try to print the value It prints me the previous one unil I reload the page... any idea?

public function TestingSessions($c,$d){
ob_start();
session_start();
$_SESSION["TempZone"]=array($c,$d);
session_write_close();
return "TestSessions : ".$_SESSION["TempZone"][0] . " " . $_SESSION["TempZone"][1];
}
It returns it correctly.
no one's in tne java room. :(
@hakre but thanks for answering
21:49
@kaser try IRC chat room for java on FreeNode
@kaser are you looking for swing?
ok
@hakre Oops, it's 1,186 * 10^24
oh yeah
lol. laffing
21:49
do you know a good swing chat?
wth
get away
go away
@kaser ... that didn't come out as it sounded in your head
like @tereško suggested: there is IRC actually with good chats. Here on SO we're just a bunch of camping PHP devs that like to have it the "HTML" + "JQUERY" way ^^
okay thanks. the javascript chat guys are mean, but u guys are nice
@hakre thanks :)
nobody :'(?
@kaser you aint seen nothing yet
21:56
@kaser Uhhhm no. You have been found to be an idiot
@PeeHaa ...and off we go!
@Suavelizard ?
Where are we going?
@PeeHaa off to not nice land

« first day (1011 days earlier)      last day (4163 days later) »