« first day (1224 days earlier)      last day (3950 days later) » 

18:00
@hek2mgl i never used chef. cant help with that. I considered it briefly as an alternative to puppet but after reading the docs I figured its the same amount of pain
omfg
php has no avg function?
I guess array_sum/count will have to do
@Gordon it is :)
@NikiC really, no avg! .. On "Who get's the billionaire" I would have bet for that (and loosed :)
@NikiC write one or make a tutorial out of it. for the internals book. its a small isolated feature. maybe good for illustrative purposes
user2518044
Can somebody help me? If I have a parameter and I want it to be an array, which method is the better:
- default value;
- type hinting;
- a condition?
Hi all
18:09
hi @JABFreeware
I have an array that can contain an element that just has white space...like " "
I need that element to be removed, leaving only elements that are not just whitespace
I tried this:
$arguments =  array_filter(array_map('trim', $arguments));
but it doesnt work
user2518044
Hi
@Gordon May I ask what are you doing with ansible? (Which components, which tasks) Are you 100% happy with it?
I'm not sure how to do this. php is not my forte
@hek2mgl I am evaluating it :)
@hek2mgl but I know people who worked with puppet before who are much happier with ansible. so its mostly hearsay. no hands on.
18:12
@Gordon Ah ok :) Would be nice to hear some results... I need to deploy PHP, Redis, Postgres server, Webshop Systems like Magento, XTC ... + Plugins and such stuff.. Nothing special.. (I thought :)
can anyone help me? :)
Btw, webshop systems, had anybody a look at Oxid? .. I tend to like the code.. nice, not so common, design
@JABFreeware What is not working?
 for($i =0; $i < count($this->arguments); $i++)
        {
             if(preg_match("^\s*$", $this->arguments[$i]) == 1)
             {
              unset($this->arguments[$i]);
             }

        }
why wont that remove whitespace elemets
@JABFreeware the array_filter() attempt worked for me
Anonymous
hi @Gordon
18:24
@Simon_eQ hello Simon, you want to be banned again?
some poeple like it
:D
Anonymous
lol, why can't I just say hi to someone I like ?
@Simon_eQ the last few times, you just wanted to be banned :D
can I be banned?
@Simon_eQ but hi. hows it going? how was/is the internship?
18:26
:P
@JABFreeware sure, if you want
nawww
im good thanks man
Anonymous
All is good, all went fine and leaned a lot. This is my first comment since I was banned, didn't bother to write anything for 2 weeks because I'm no longer hooked to this room
Anonymous
I just had one question for you @Gordon
Hey there :)
18:28
while read user ; do mod_tools ban "$user" ; done < $(so_client list users)
:)
(can be done even in parallel maybe :)
Evening
F** there is a bug in that line :) .... will leave for today.. cu guys..
See you later
@Simon_eQ what question?
Wow @Simon_eQ is back
18:38
Eveing
> how to php array? i try apache but not work. i should css and jquery?
Anonymous
@Fabien Hi Fabien. Hello :)
@Gordon I just need a feedback about something I've been working on, I need you to just tell me, if it is too stupid or slightly stupid only. But, I'll try to put it into an example so it will be easy to understand. I'll ping you then.
@DanLugg no. write a webserver in asm and the code in an own new language.
NO YOU CANNOT “PAIR“ ON THE PROJECT, THIS ISN’T COLLEGE I’M NOT PAYING YOU TO WATCH SOMEONE ELSE WORK
That Twitter feed is hilarious.
Also
IT HAS COME TO MY ATTENTION THAT SOMEONE CALLED JASON HAS BEEN ENCODING AND DECODING DATA IN OUR APP. PLEASE CHANGE YOUR PASSWORDS
^ crap
sounds like old old joke about call me back & javascript :p
18:51
lol, best one I've seen in awhile:
YOU WANT TO OPEN SOURCE SOME OF THE CODE YOU'VE BEEN WORKING ON? OK WHEN YOU CAN CROWDSOURCE YOUR SALARY LET ME KNOW AND WE CAN DO THAT HAHA
lol @Gordon you here?
@AlmaDo yeah
if yes, why they deleted my comments on this ?
so I can't comment that question is RTFM and mark it as duplicate (my cs was canceled too) just because vast majority thinks it's "hot" ? ..
@AlmaDo no, people considered the question not a dupe. all the mod did was clearing the comments after community decided
@Gordon well, last thing I remember - comment with 10 or more score. thus, I doubt it worth deletion
but - yes, that comment causes downvoting on question (instead of upvoting just because "it has high rating") ..
so is that a reason?
also why canceled my cv ?
shame that I have no screenshots or something - i.e. I can only ask now. Why horrible things are not only promoted - but also protected from justified comments about RTFM stuff.
18:58
@AlmaDo vote was cleared by community
what does that mean "by community"?
I was disappointed when it got +10 score afternoon. Now with those deletions I'm feeling really angry. It's just like a punch for nothing. Or response: "Yes! We WILL promote stupidity! Yes! You can NOT do anything with that!"
ugh my stream of this hockey game is so delayed :(
@Lusitanian Hmm, perhaps US bandwidth is governed by their score? ;-)
@DanLugg nah, i just have a slow connection at my workplace
I'll leave it as it is.. but I doubt I'll ever do anything about scoring questions or answers. Not here. It's completely useless..
19:05
@DanLugg lol
still a super close game
running out of time iaojsgdfioejrifo
this is nervewracking
> I enjoy moderator duties - shutting down voting rings, keeping spam under control, actioning flags, etc.
For the user 'slugster' running for mod
does that mean cv-ring too?
yes.
D:
(not really sure)
annd that's the game.
19:08
I'll just assume the worst and vote based on that =oP
i would assume, i dv'd.. not that it matters, he has no shot
still over a minute left on my screen lol
@TutelageSystems odd. you're even more delayed than me :O
anyway it's 1-0 F
yeah i assumed that. i can hear the room next door cheering too lol
Canada - Sweden is gonna be a fantastic game :D
19:09
cv-ring has been given the semi-approval of various SE-employees in the past, it's been discussed to death on meta, balpha even helped us build bits of the plugin, I don't think some new upstart community mod is going to affect that
yeh i'm not really worried
@TutelageSystems Now it's a super over game ;-)
In any case, I imagine he's referring to serial upvoting
Maybe he's referring to up-voting rings. ^ apparently I should read the comments immediately previous to my own.
probably
> Here's my top 5 reasons why I would make a decent mod
^^ Because a vote for FreshPrinceOfSO, is a vote for satisfactory.
huh.. hard to have no sleep 2 nights :\ so - night room.
What is best PDO or MySQLi?
19:20
@Lusitanian's mom is the best
The review queue needs an [Edit & Close] option.
@PeeHaa o
cv-pls: Docs, Backlog | Tools: Explain, phpdbg | Addons: [cv-pls], PHP Manual Linkifier | Snippets: ext/mysql | Reference: QAs
4
@LiamMartens use PDO
@LiamMartens You have to make that decision for yourself. php.net/manual/en/mysqlinfo.api.choosing.php
19:30
@DaveRandom you might want to check my JS in the canonical links page. I know it's probably crap. =oD
Anonymous
so @Gordon do I have your OK on that ?
@Simon_eQ huh, did you ask the question yet? Oo
you said, you wanted to prepare something
Anonymous
@Gordon No, but I want will make an effort to make it presentable .. that is, if you are only willing to just give it 2 minutes.
@Simon_eQ yeah sure
Anonymous
thanks ..
19:43
I smell a get-rich-quick scheme pitch ;-)
@PeeHaa what the lol?
> I'm making a tutorial site. How do I make a tutorial site?
@DanLugg Needing a tutorial for making a tutorial site =o(
user924016
lol
@crypticツ That's pretty much how I read the Q ;-)
19:51
what to the fuck
-5
Q: my desired output is not coming correct

user3338720my output is correct for i<20000 but it isnt coming for i<2000000.I want the same logic and in c codes. #include<stdio.h> void main() { unsigned long i=3,j,c=0,sum=2; while(i<2000000) { for(j=1;j<i;j++) { if(i%j==0) c++; } if(c==1) sum=sum+i; c=0; i=...

2014 Moderator Elections: Vote Now! (final voting)
5
@crypticツ no @MadaraUchiha :-(
Sadly, no.
*riots*
I have no idea who to vote third.
I voted bluefeet and Undo
20:04
How's everyone today?
Still have no idea who to vote third
I may just not cast a third vote.
There's no one I especially like/trust.
@MadaraUchiha me, too. and matt
wait you don't have to use all your votes?
nope
  public class Token {
    public static final int ADD      = 0x1021;
    public static final int SUBTRACT = 0x1022;
    public static final int MULTIPLY = 0x1033;
    public static final int DIVIDE   = 0x1034;
    public static final int POW      = 0x1045;
    public static final int NUMBER   = 0x2001;
    public static final int GROUP_OPEN  = 0x4001;
    public static final int GROUP_CLOSE = 0x4002;

    // snip

    public boolean isOperator() {
      return (token & 0x1000) == 0x1000;
    }
am I evil for that?
nvm, you have to change them all to the same position
20:09
@Gordon Matt you say?
I'll take your word for it, I have no one better to vote for.
@MadaraUchiha: What about first and second choices? :P
5 mins ago, by Madara Uchiha
I voted bluefeet and Undo
I've always liked bluefeet for mod, and I know who's Undo because he mods another site, I know he's good.
@DanLugg Then you stop breathing, apparently :D
@MadaraUchiha i based my votes on flag count and community votes
@Gordon: Still the same :P
20:17
@Gordon Flag count really doesn't mean much.
I can sit around all day long at the flag queue and get insane amount of flags.
I can even outsource it into some third-world company to do it for me, ffs
@MadaraUchiha if they have high flag count they create more work for me so if they are mods it means less work for me ;D
@ircmaxell what for exactly?
You and I both know that I (or most of us here on the PHP room) do more for moderation work than most of those with a high flag count.
@ircmaxell Yes, because you misspelled precedence ;)
helpful flags: 20144 ...... wow, no wonder they need more mods – FreshPrinceOfSO
20:19
@ircmaxell for precedence!
The first thirty times I wrote that word I had to remind myself that it's "all e's" :)
s/precedence/president/
I mean seriously, at 20k+ I expect users to moderate more and flag less.
I'm more interesting in seeing close vote and up/down vote stats than I am interested in flag count.
@MadaraUchiha still, most of our work is wading through the ever growing flag queue, its fighting windmills
@Eugene a shunting yard parser
@NikiC shhh :-P
@Eugene and the evil question is for embedding 3 things into the number (type, precidence, value)
20:21
@ircmaxell Also, I feel obliged to mention that Java is a very strongly typed language, given that you have to type out public static final int so many times...
@NikiC it's a verbose language, nobody can argue that
@ircmaxell I must confess, I'm very bad with bit operations.
@ircmaxell I think people usually use the word 'clever', but it means the same :)
Btw, talking of precedence and bitwise operations...
@LeviMorrison :-)
20:23
The precedence of bitwise operations in C is total shit
@NikiC which is why for bitwise operations I always group, no matter what language...
Whenever you use bitwise ops you must wrap everything in a deep layer of parentheses, otherwise the compiler will go out of its way to choose the most stupid interpretation possible
/me is off to a meeting, later
Was wondering who to vote as second choice. After reading this I think I'm going to vote for @Undo.
It's really disconcerting how little thought language designers seem to give to sensible operator precedence, given that it is so very important for practical use :/
20:26
> kbd's are not buttons
^^ Disagree; context
@NikiC I guess one could prefer an absence of precedence altogether; forcing one to manually denote it with parentheses ;-)
@DanLugg You better keep that most evil of thoughts to yourself...
At least then you know; everything is right-to-left.
lol
(((((((((((((((((((((((((((a))))))))))))))))))))))))))))
20:29
@DanLugg you like LISP too?
((((((((((((((((((((((((((((O)))))))))))))))))))))))))))))
Now, see, that's just crazy talk.
"a * b / c + d - e % f" == "a * (b / (c + (d - (e % f))))"
That ain't so bad ;-)
Really? I go away for half an hour and you're all drawing ASCII tits?
11 messages moved to bin
@DaveRandom You know your first instinct was to join in.
I know it's Friday and all but that's definitely hovering on the border of actually offensive
@DanLugg sshhhh
20:36
@DaveRandom haha :D
@NikiC I learned bitwise precedence in C, so maybe I'm just used to garbage in this case ^^
6
Q: How does Haskell's "boobs operator" work in plain non-functional English?

Sergey K.In this answer http://stackoverflow.com/a/11006842/1065190 an "owl operator" is mentioned: absoluteError = ((.) . (.)) abs (-) to express the absolute error function in point-free notation. Anyway, how does this notation actually work? Could you, please, explain it to a non-functional C++ pr...

Semi-on-topic definitely related.
Out of all the people who made it to this stage of the elections, the only one I voted for was bluefeet :/
@R.MartinhoFernandes @PeeHaa Turn that hip hop down kids. At least music in my day had a tune you could sing along to: youtube.com/watch?v=ocFxQjPeyiY
20:44
@Jack @rdlowrey a thought occurs after all this peer verification stuff I have been doing that the CN/SAN matching algo is currently incomplete, in that we don't account for punycode name conversions. It's valid for certs to contain either the unicode name or the punycode ACE. SAN can only contain IA5String, so those will be punycode, CN however may contain non-ASCII characters
@Danack Isn't "in your day" more like youtube.com/watch?v=uTZGlPwboP8?
:-P
@MadaraUchiha Oh no he di'nt!
Maybe I drank too much, I don't know.
But I'm in the mood right now.
For what? Dancin'? Romancin'?
@Danack or at least recite the intro: youtube.com/watch?v=isWR_yzOM2w
20:55
@salathe another classic.
I could never get along with Maiden. I don't exactly dislike it, and it's definitely I genre I have some love for, but they just don't do it for me
@Danack the soundtrack of this morning's commute included youtu.be/1p9J0sB3-bE?t=1m27s :)
21:10
@MadaraUchiha Well done. Well. Done.
Totally saw it from me.
@Danack Oh, come'on now!
user895378
@DaveRandom Hmm, I think you're right.
user895378
@DaveRandom I totally agree with you regarding the OO resource switch proposed on the list. That's a huge job. It'd be nice, but it's a huge job.
user895378
Does PHP reclaim the unique integer IDs it uses internally to reference objects?
21:21
Yes
Deallocated object store buckets go into a free list ;)
user895378
So in a really long-running process you don't have the problem of running out of integers and getting a fatal error like you do with resources then.
yep
What, really? You can run out of resource IDs?
@NikiC Is the hash retrieved via spl_object_hash derived from that ID?
user895378
@DaveRandom Yeah. I believe it'll loop back to PHP_INT_MAX * -1 and start counting up and eventually fatal if the next resource ID gets to zero.
user895378
21:24
Or maybe it only fatals if there's a collision. I forget.
That seems like a bug that should be easily squashable on the face of it
user895378
Probably easier just to write new code using objects than worry about it :)
user895378
But it is problematic for long-running servers (e.g.) because all your streams or sockets use resource IDs.
user895378
New client connection? Resource ID.
sounds like you'd run out pretty quickly on a 32bit build
21:27
In a maxed out C10k you run out in under 5 days
user895378
@NikiC yep.
And that's assuming you have nothing but 1 stream resource per connection
(at 10k/sec)
user895378
mysqli_*? Resource ID. Open a file handle? Resource ID.
user895378
It spirals out really quickly.
@rdlowrey nope, mysqli is objects
:-P
user895378
21:29
Oh, sorry, I'm living in mysql_* land in my head :)
It's easily done with mysqli because of the stupid fucking procedural API that should never have existed
user895378
In aerys a worker process will automatically respawn if a process fatals out from something like that, but it's still a suboptimal situation. IIRC in pthreads the resource IDs start over from 1 in each new thread.
That actually demonstrates quite nicely why the whole idea of just mimicking the procedural API with methods on the relevant "resource" is a bad plan. I mean just imagine how shitty the API would be if you created a generic "stream" object and stuck all the methods that can operate on that resource type on to the class
@rdlowrey That has to be how it works otherwise the Apache threaded MPM would just blow up periodically
user895378
ugh, sounds terrible.
user895378
@NikiC I was giving some thought to adding content negotiation to FastRoute and trying to come up with the best API. There are a couple of options really ...
user895378
21:34
// Something like this is simpler and could reuse the existing interface but it doesn't
// allow servers to express preferences for individual types.
$r->addRoute('GET', '/user/{name}/{id:[0-9]+}', [
    'handler0' => 'text/html',
    'handler1' => 'application/json',
    'handler2' => 'application/xml',
]);
user895378
But with something like that users can't weight their preferences for the individual available content types.
@rdlowrey btw I think I'm going to PR my branch now so I can start an internals thread about it with a footnote of "implementation needs polishing" in case someone has a good reason why it needs changing drastically
@rdlowrey Can't you base preference on the order of the elements in the array?
yay for business trips
user895378
@DaveRandom I would add tests first, but otherwise go for it. I honestly don't know enough about the underlying windows things to comment effectively. All I'll be good for is saying, "I tested it and it works on my *nix and windows builds"
user895378
@DaveRandom Yeah. The only thing that prevents is the ability to strongly prefer one type to another (like q=1.0 vs. q=0.1)
user895378
21:37
I don't know how much people really need that level of control, though.
user895378
@ircmaxell \o/
I'm reasonably certain there's no-one who knows enough about the APIs to properly actually comment, hence the reason I've been fishing for someone who does by starting the bounty on stackoverflow.com/q/7340504/889949
/me is heading to Silicon Valley in 2 weeks
user895378
@DaveRandom ah, I was hoping I could stack another bounty on top of it but SO won't let me :/
@rdlowrey Ahh right yeh that won't work. 'handler' => [0.1, 'text/html'], and if you supply a string instead of an array then assume 1.0?
user895378
21:40
@DaveRandom oh, wait. You probably don't need to add tests because those should already exist :)
user895378
@DaveRandom Yeah but that starts to get really ugly and convoluted ...
@rdlowrey I was going to say, the idea here is that the functionality is the same as what already exists, it's just normalisation
There may be some SKIPIFs that need altering?
will have to check
@rdlowrey I'll have to admit to being a total stranger to content negotiation
Do people really use that stuff?
user895378
@NikiC Only for data APIs
I can imagine that it comes in useful in that context
user895378
21:43
But it's useful to have. I'm happy to implement it (because I need it). I'm just trying to talk out the API we want.
user895378
So you don't need to know anything about HTTP to contribute to the conversation :)
@rdlowrey tbh whatever you do is going to be ugly an convoluted. Basically the only way of doing it is either an array or asking people to put the q value in the string, and the latter requires parsing expense
@rdlowrey In that case ... I'd invert key/value ;)
user895378
@NikiC sold.
You have to convey three bits of information - type, q and handler. That's only sensibly possible with a 2d vector or a string that needs parsing
user895378
21:46
Yeah. I think I'll just use the above approach to start and then if anyone ever wants super-fine-grained control we can possibly add a separate method Dispatcher::addNegotiableRoute() (or something) that takes arguments with the express purpose of doing that.
user895378
I suspect no one will ever ask for that level of control over the content negotiation anyway.
I must be honest, when I wrote that algo of mine that handled it I thought to myself "why the fuck would I ever care about type parameters in practice"
and if you stop caring about those then just an order of preference is fine
user895378
Agree.
Also the whole concept of a server preferring a certain type is a bit weird, really negotiation is there for the client's benefit
user895378
@NikiC Would you rather see an additional optional param to Dispatcher::dispatch($httpMethod, $uri, $acceptHeader = NULL) or have a separate method for routing that takes the accept header into account (e.g. Dispatcher::negotiate($httpMethod, $uri, $acceptHeader))?
21:50
@rdlowrey Don't have a preference in that direction
I'd guess that implementing it as part of dispatch is simpler
user895378
It's less for lib users to learn that way. And I really can't imagine ever adding any other input to the routing decision so I don't think an optional param there would hurt the API in the long term.
yup
user895378
The only other consideration is that I'll add a new Dispatcher::NOT_ACCEPTABLE return code with an array of available content types at index 1 in the route result array (just like the METHOD_NOT_ALLOWED approach).
@rdlowrey Accept-Language is genuinely (potentially) useful
user895378
@DaveRandom oh, I forgot about the other accept headers
user895378
21:53
In that case ...
This is where named params would be awesome
Should you return a 406 on an unsupported Accept-Language?
user895378
Yes.
user895378
But it's unlikely the user doesn't want to see whatever you have
user895378
Because: google translate.
21:54
That's my thinking. But you'd prefer to support the option to bork the request if they want Moon-speak or something.
user895378
If it's for a data API I would send the 406. If it's for human consumption I would just fallback to whatever language you do support.
It's well documented that HTTP doesn't reflect reality in really any way. It's one those things where the more you know about it the less you like it (I have found)
user895378
$dispatcher->dispatch($httpMethod, $uri, $negotiationHeaders = [
    'accept' => 'text/html;q=1,*/*;q=0.1',
    'accept-language' => 'en-us;*',
     etc.
]);
Language specific routes, really?
Accept-Language: lisp, delphi;q=0.8, haskell;q=0.3, brainfuck;q=0.1
21:57
Shouldn't that be handled at some other level?
user895378
HTTP was designed so that you wouldn't have to handle it elsewhere ...
user895378
The idea is that the resource is the universal thing. Things like language and display format are just representations of that one universal thing.
It's not like you'd use different controllers for different languages
That's a very valid point
The i18n should kick in at some other point
user895378
21:59
Hmm. That's true.
user895378
And it is a hell of a lot easier to do it in the URI:
user895378
$dispatcher->dispatch('GET', '/{lang}/some-page');

« first day (1224 days earlier)      last day (3950 days later) »