« first day (1523 days earlier)      last day (3416 days later) » 

12:00 AM
"use strict";

function reduce(f, input, initial) {
    var accumulator = initial;
    for (var i = 0; i < input.length; ++i) {
        accumulator = f(accumulator, input[i]);
    }
    return accumulator;
}

var g = function (a, b) {
    return a + b;
};

var output = reduce(g, [1, 2, 3], 0);
What is the content of output? Going to ask that to our interviewees.
 
@LeviMorrison 6
 
<?php

function f($number) {
    return $number % 2;
}

$sum = 0;

for ($i = 0; $i < 4; $i++) {
    if (f($i)) {
        $sum += $i;
    }
}

echo $sum;
^ What is printed?
 
Also, that can be a little more concise:
'use strict';

function reduce(f, input, accumulator) {
    for (var i = 0; i < input.length; ++i) {
        accumulator = f(accumulator, input[i]);
    }
    return accumulator;
}

var output = reduce((a, b) => a + b, [1, 2, 3], 0);
@LeviMorrison 6? Oh wait, no. 2. Exclusive ranges are evil :p
 
@AndreaFaulds ^^ You are incorrect.
 
@LeviMorrison Oh wait, I thought that was if ($number % 2 === 0), but it isn't. So it'd be 4.
 
12:06 AM
We have actually had very few people get it right for various reasons.
It's not intended to be tricky.
 
I'm so used to seeing % 2 followed by === 0 that if it's not there I seem to think it is anyway :p
 
Commonly people have summed the result of f($i) instead of $i.
 
Yep, I made that mistake too ^^
remove the function and I'd probably have gotten it right :)
 
These are intended to be basic screening questions where they talk us through the example (we don't really care about final answer; we just want them to walk us through the code).
 
So like FizzBuzz? :)
 
12:09 AM
Except NOT FizzBuzz.
 
yes, because every man and his dog can write a NoSQL Enterprise WebScale Big Data version of FizzBuzz now
 
<?php

function filter(callable $f, $input) {
    $output = [];
    foreach ($input as $value) {
        if ($f($value)) {
            $output[] = $value;
        }
    }
    return $output;
}

$f = function($value) {
    return $value % 2;
};

$output = filter($f, [1,2,3]);
^ We were doing that one too but we decided we need to include more languages so for time reasons we just use the first one.
 
Do you give bonus points to candidates who object to the horrendous naming of functions in those questions?
'f'
 
In our real codebase they are named, but we don't want to help them TOO much.
 
@Danack f is a perfect name for a function, I name all my variables v along the same lines, and my classes are all called c
 
12:13 AM
and params are p1, p2 etc?
 
For instance, Andrea would not have made the mistake she did if I had named the function odd instead.
 
Right
Hey Levi
 
With casting type hints for return types, function isOdd(int $x): bool { return $x % 2; } would work ;)
 
12:14 AM
@LeviMorrison yeah.....I'm not sure of what that indicates. It's possibly selecting for people who are used to dealing with shitty codebases with deceptively named functions.
 
@AndreaFaulds It doesn't return a bool; it returns an integer (maybe a float; do we support floating point modulus?)
(I mean in my case it doesn't return a bool; it just gets used in that context later)
 
@LeviMorrison Ah, fair enough. It's just it seemed like something that ought to explicitly convert to bool.
@LeviMorrison We don't support floating-point modulo, no. % acts very much like a bitwise op in the sense that it converts its operands to integers.
 
Now I need to do a SQL example too.
 
@LeviMorrison SELECT with a fun expression?
By fun I mean exciting, not function. :p
 
I need to do a query that does a basic join.
 
12:22 AM
Ah. I suggest including the CREATE TABLE and initial INSERTs as part of the sample
 
@LeviMorrison Let them write the haversine formula :P
 
That's worthy of paying them though ^^
 
:)
 
Make them write a recursive fizzbuzz without modulo available
Let's see...
 
hello gys
 
12:35 AM
<?php
function modulo($a, $b) {
    if ($a < $b) {
        return $a;
    } else {
        return modulo($a - $b, $b);
    }
}

function fizzbuzz($from, $to) {
    if (!($from < $to)) {
        return;
    }

    if (modulo($from, 3) === 0) {
        if (modulo($from, 5) === 0) {
            echo "FizzBuzz", PHP_EOL;
        } else {
            echo "Fizz", PHP_EOL;
        }
    } else if (modulo($from, 5) === 0) {
        echo "Buzz", PHP_EOL;
    } else {
        echo $from, PHP_EOL;
    }
2
@Jorgesys Hi!
 
hello :D
 
@LeviMorrison Thoughts? ^^
 
@AndreaFaulds ^^ Too much for what we're looking for.
But if it works, well done ^^
 
It does work :D
Though it'd be so much more elegant in Haskell
 
static constexpr uintptr_t tag_mask = 0b0011;
static constexpr uintptr_t ptr_mask = ~tag_mask & UINTPTR_MAX;

union {
        uintptr_t bits;
        void *ptr;
};
^ Basics of a tagged pointer.
 
12:43 AM
Interesting
 
@AndreaFaulds Please don't withdraw the 5.7 rfc. I think it's a topic that needs settled with a vote at some point rather than endless discussion.
 
When you need to get the pointer you do (void *)(bits & ptr_mask).
In reality I would probably use an enum to determine exact bits and safely cast to appropriate pointer types.
 
@PaulCrovella Extending 5.6's life would need a new RFC.
 
If we don't do a PHP 5.7 I'd still vote for a 5.6 extension that is just that. We support bug fixes and security for another year.
(And be very strict about which ones we allow)
 
Maybe I should make it a 50%+1 5.7/extend 5.6/do nothing vote
 
12:47 AM
Realistically a fair number of people won't adopt 7.0.
They'll wait for 7.1.
(Or at least 7.0.1)
 
Yeah.
 
@AndreaFaulds Up to you. I'm not married to any particular outcome, I would just like there to be an outcome.
 
@AndreaFaulds I think this RFC should be left as long as possible to vote on. There may emerge a very strong reason for having a 5.7. Having a vote before it is absolutely necessary to vote would make it possible for a massive fuck up to occur.
 
@Danack Fair enough.
 
Notably any RFCs which may make use of a PHP 5.7 should have some time.
(ACK PLS DON'T RUSH ME!)
 
1:17 AM
"How do you automatically generate a REST API from a database schema?" You fucking don't. That's how.
4
Really, one box of tweets is broken?
 
https -> http
It's SO chat that is broken
 
 
2 hours later…
3:03 AM
Instead of providing REST APIs, why not just provide SQL querying?
(serious)
 
3:29 AM
Not as easy to use, more difficult to support, restricts schema changes, etc.. I'm also not a fan of exposing a database to the horrors "developers" are happy to inflict on it.
I'd rather write an efficient query that provides what people need and expose the result through a rest api than just let random schmoes fumble about and hit query time limits and such.
 
 
2 hours later…
5:22 AM
@AndreaFaulds, 3v4l.org/qnhuS
 
5:44 AM
-2
Q: Unable to make connection with database from cronjob

berserkI have a cron.php file on my server which makes connection with the database and do some function. When I execute this file using browser, it runs perfectly. But when it executes from cron, it gives following error while making database connection: ERROR: SQLSTATE[28000] [1045] Access denied for...

Hi
 
morning
 
@berserk Your problem is an error when making a database connection, and when you were asked for code you completely skipped the part attempting to make the database connection...
 
@PaulCrovella Sorry, I thought it won't be necessary as the connection works when I run the cron.php manually in browser.
Let me post.
 
Hello Good morning...
I'm going to implement a method to send e-mail with iCal event, which can automatically added to the Outlook calender. Can someone help me for that.. I'm trying lot of tutorials and still no luck... FYI I've already tried examples with php mail() but there are not working.. and I tried with PHPMailer it sends mails but not sends with event.. hence it not allowed to change the header of the mail..
Please guide me to do this..
 
6:02 AM
moin
 
@PaulCrovella I posted the code.
If you got time, please check.
 
It seems that they allow static but it's quite intentional. They should not be called statically.
I think that indicates the docs are in error.
 
next person to star a random message gets a swift kick to the tits ...
 
must.. resist.. urge...
 
6:21 AM
this will be me ... coub.com/view/49gd8
 
@berserk Verify that localhost resolves the same both from cron and from a script you load via the browser. It'll be weird if it doesn't, but would explain why by all appearances you're connecting to a different db server.
@berserk also does the error message literally contain USER_NAME or does it give your actual user name
 
that db_connection doesn't make sense
also, relative paths are bad
error_reporting(1) also suspicious ...
 
6:36 AM
@JoeWatkins I'm running on the assumption that the db_connection has a bit of bad copy/paste.
 
yeah, but that's a problem in itself ... if we're only seeing bits of code then we are stabbing in the dark ...
need to post the actual code that has a problem, not code that you think is the same @berserk
 
a MCVE would certainly be preferred
 
@PaulCrovella The error is exactly same as I posted.
 
@PaulCrovella yeah ... /me saves bookmark for github issue responses ...
 
@berserk , it seems that you have no defined consts.
 
6:50 AM
@sectus Umm what?
 
@berserk turn that error reporting on with error_reporting(-1); and you should get a notice like "Use of undefined constant USER_NAME - assumed 'USER_NAME'"
 
@PaulCrovella ERROR: SQLSTATE[28000] [1045] Access denied for user 'USER_NAME'@'localhost' (using password: YES)<br />
Ok prob solved.
 
7:20 AM
morning folks
 
zan
Good morning
Do any one have any idea with Vagrant and Virtualbox
 
Morning
 
7:35 AM
 
;Mornings
 
Hey I want to run php function on href onclick
How can i do this
 
zan
use ajax
run it in other file and use response from it
 
please provide me any link or reference or any thing...
 
@APURVPATEL that's no code-on-demand service here :D what is this php function supposed to do?
 
7:43 AM
I have a function for watermark
and my requirement is to this on lightbox
 
zan
check this out it might help you stackoverflow.com/questions/15957862/…
 
this functin is working on btn
but not in link of lightbox
 
you are mixing up PHP and javascript
 
^ this
use an image without watermark for your thumbnail and another image with watermark for the lightbox
 
@APURVPATEL you have already been hinted all of this in stackoverflow.com/questions/27505305/…
 
7:47 AM
"Give me my solution downvoters" making demands like this is really not cool
 
@PaulCrovella made me laugh =]
 
hahah. For some programming is still unprofitable arts
 
Actually I know the question is not really exactly that what i m asking but there should be comment for every downvote
 
@APURVPATEL no, noone is forced to leave a comment.
 
no, there shouldn't. voting is anonymous. don't like downvotes, ask better questions.
 
7:52 AM
yeah!!
 
moinz new peepz
upgraded to fedora 21 from 20, broke kde ...
now stuck in horrible gnome ... yukky
 
The other one (you don't use) is always horrible
 
8:08 AM
I keep trying, there are things I like about it ...
the most annoying thing is, I have two screens, and no matter what they are configured the wrong way round, where the acitivities/notifications are on the right ...
 
woah. I worked for about half an hour, and something felt odd. Now I just noticed I didn't listen to music...
 
if I try switching the screens, it turns one off (leaves strange foobared image on screen) and the other has no menu's on it ...
 
Morning
> If you’ve launched a useful, sustainable, community-adopted open-source PHP project (a current concrete example is Taylor Otwell’s Laravel Community) smelling good standards, you probably nailed it – you are a pro PHPer with a decent level of PHP Cred.
 
mohaa
 
I lolled even this early
Hey mr @JoeWatkins \o/
 
8:15 AM
:)
putting php in everything is annoying ... PHPenomenon, PHPather ... nope ...
 
it bothers me that the elePHPant isn't wearing pants
 
@PaulCrovella yeah, because normally elephants wear pants ...
 
@PeeHaa lol thanks
 
@JoeWatkins well, normally they're not spelled "elephpants" either
 
8:22 AM
We tried ordering some elephpants... they didnt even reply ..
whole fresh new website now i see.. maybe time for a new attempt :)
 
user3949359
what is meant by "node" in a table in a mysql DB?
 
Didnt know mysql used the word "node" for anything..
context?
 
user3949359
@DamienOvereem this is what they tell me. It's about a comment system on a blog. So anytime you comment some content, the comment form should submit a "content node" in the table
 
who is doing that ?
 
Guessing that would just be a "row" then in mysql itself
 
8:25 AM
super annoying, stop it ...
 
user3949359
@DamienOvereem my guess is the same
 
Who is doing what ?
 
user3949359
@DamienOvereem I'm learning a CMS right now
 
user3949359
Nuts 'n' Bolts
 
user3949359
and reading the docs
 
8:28 AM
Hey @JoeWatkins did you make a new recording?
 
@DamienOvereem starring random shit ...
@RonniSkansing not yet, gonna do after school run ...
 
@nosille I doubt they're meaning "node" as something particular to the database rather than the general structure of the site. "Node" is usually a thing in a tree-like structure, and a comment node would have something like a blog entry node as its parent
 
Okay looking forward to it
 
user3949359
@PaulCrovella has to do with the database, they have a picture of a table over there
 
user3949359
I'm sure the term node is wrong here
 
8:38 AM
good meurning!
@JoeWatkins going back to school? ^^
 
ThW
Morning
 
Morning all
 
Good morning @PeeHee @ThW et al.
 
8:54 AM
Heya @salathe!
 
9:08 AM
Hi everyone
can I ask something here ?
 
@Ankit Let yourself go!
@PeeHaa o/
 
@Ankit You just did
 
Naruto-kun
:3
 
Thanks, have somebody implemented authorize.net CIM xml method ?
 
O god, not another fan? :D
 
9:10 AM
XD
its jiraiya :3
 
Oooo... tought you were dead?!
@Ankit I havn't, sorry
 
speaking from heavens
 
:) I am facing a problem related lineitems.
 
MY real name is Ankit too
 
@Naruto: Have you implemented the authorize.net cim method ?
@berserk that's good :)
 
9:14 AM
What would be better regarding this issue? Fork it and create a tag myself or use dev-master? @rdlowrey seems to be busy with other stuff which I understand but I need a fix until he has time to look at it :(
 
@berserk Dem forbidden jutsus.. :)
@Ankit I havn't = I have not
 
hehe
 
@Naruto no prob. thanks
 
@Naruto "=" !== "=="
 
aww it ain't workin: gizoogle.net/…
 
9:22 AM
still no suggestion :(
 
@Patrick Is it dev or production code?
 
@Naruto taking my kids to school ...
 
fak
I have a coworker, who takes 5 minutes to write a response in skype
 
@LeviMorrison Well, I suppose that's fair enough then :)
 
9:28 AM
@Ja͢ck Urahara :O
 
@PeeHaa production
 
@berserk Yup, but sporting a werewolf hunter hat ;p
 
@Patrick In that case I would rather keep bugging @rdlowrey.
He has been slacking long enough now :)
 
@tereško write ... backspace* ... write again ... backspace* ?
 
@Ja͢ck oh lol
 
9:30 AM
yes
it's fucking annoying
 
what is? the fact that Skype tells you when they're typing? :)
 
essentially - yes
 
@JoeWatkins yeah, was just joking..
 
but the part that annoys me is "do you really need 2 fucking minutes to decide on which 4 words to user ?!?!"
 
depends on the amount of thinking that preceded it :)
 
9:33 AM
he has been at it for 10 minutes now
 
Hey All
while inline edit in jqGrid I want to call a javascript function ruther then given a hard coded url, can anyone help
cellEdit :true,
cellurl : '/orphan/save', //This I want a javascript method or an remote call
 
then, just close the chat window until a new message comes in.
@ScoRpion the fact that this chatroom is written in JavaScript doesn't mean we answer those questions.
 
posted on December 17, 2014 by kbironneau

/* by LSSW */

 
I suppose that people here have very good knowledge in javaScript. so i am expecting some help
@Ja͢ck
 
@ScoRpion please do not copy paste your message in both rooms
 
9:36 AM
Isn't there also a JavaScript room?
=.=
 
yup it is
 

JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
 
See? Now go there and stay there :P
 
he is already there
 
What I mean is don't go anywhere else.
 
9:38 AM
ok
 
Or go anywhere else, except here. :P
 
fine no issues if u dont want to response
 
Microsoft, why WinHTTP? Why?!?!
It's at times like these that I'm happy for the humble file_get_contents() ...
 
9:53 AM
@ScoRpion expecting? We don't owe you anything to begin with
morning
 
mornings from the slowest computer on earth
 
@ScoRpion javascript? I heard it's like java but for browsers right?
 
@DaveRandom Morning mr dave
 
408
A: What's the difference between JavaScript and Java?

Shog9One is essentially a toy, designed for writing small pieces of code, and traditionally used and abused by inexperienced programmers. The other is a scripting language for web browsers.

3
 
@DaveRandom hahahahaha
 
9:57 AM
Gotta love Shog
 
@tereško tell him to use his favorite editor/IDE while composing his messages
 
-5
Q: PHP: Finding The Day For January 5?

oxygenLast month, I was invited for a job interview. It was for php developer job. They ask me following question: What is the day for January 5 in a year includes a month which has five Monday? I could not give an answer! Thanks for advance..

 

« first day (1523 days earlier)      last day (3416 days later) »