« first day (1795 days earlier)      last day (3379 days later) » 

00:58
wooo, Travis CI reports a pass for #1513 :)
01:28
@kelunik Not really sure why this has so many stars – can you explain why you'd find all of that useful?
my guess is people like it for a/b testing, but their blog post talking about the impetus behind it as "merging feature branches is hard, so we wanted to develop everything on master" is somewhat concerning
I think it's more that switching branches is hard. e.g. if you have some new feature that requires a DB change, then switching back and forth between it being enabled and not is hard. What you can do instead is just switch once, but only enable the feature for a few users.
new ExpressionCondition('user["active"] and product["price"] / 100 >= 0.2', $language);
wow.
01:54
@kelunik cool! thanks for your pinging ^^
now we just have to wait for the underlying dependencies to be released :sadpanda:
 
1 hour later…
03:00
can i execute header('Location:'.$return_url); in a timer?
say i want to execute it after 5 second the page is open. can it be done like that?
@MohdFadli No.
then how in certain webs they use timer to redirect the page?
@MohdFadli They use Javascript.
Let me make sure I understand your question...
YOu want a page to be loaded, possibly showing some message, such as "The page has moved. You are being redirected to example.com/foo."
Then, you want the a different page loaded automatically, without the user doing anything else. Yes?
im making paypal integration in my project
aa
@Ghedipunk yes, can it be done like that?
good morning
03:05
@Orangepill morning
@Ghedipunk automatically loaded with 5 second interval
@MohdFadli No. It is not possible with server-side scripting because HTTP does not work that way. You must use client side scripts, which means using Javascript.
@Ghedipunk then going stick to header('Location:'.$return_url); T_T
You can do a refresh header and specify a location ...
header("Refresh:7; url=".$return_url, true, 303);
or alternatively with a meta redirect header
@Orangepill Sure, if you don't want to be standards compliant... (I blame Netscape for this one, though...)
<meta http-equiv="refresh" content="7;url=<?= $return_url ?>">
ohh didn't know that wasn't a standard header
could always do the javascript redirect will the fallback link
03:16
Usability section on Wikipedia on the meta refresh page:
> Usability
> Use of meta refresh is discouraged by the World Wide Web Consortium (W3C), since unexpected refresh can disorient users.[1] Meta refresh also impairs the web browser's "back" button in some browsers.
Goes on to list a valid use case: Refreshing the page when Javascript is unavailable.
Best use case I can find for it: <noscript><meta http-equiv="refresh" content="0; url=news-nojs.php"></noscript>
which would be just a disorienting... I'm sure the meta redirect since it's an http-equiv is only supported on those browser that support the response header
Oh, before I forget...
@MohdFadli Also use the 301, 302, 303, or 307 HTTP status codes.
Hi, mornin'
I'm trying to set up session expiration after 24hrs. I'm setting a session var called keep_alive when they click remember me - then I have this code before I session_start:

if (isset($_SESSION['keep_alive'])){
$timestamp = time();
$plus_one_day = strtotime('+1 day', $timestamp);
$session_expiration = $plus_one_day;
session_set_cookie_params($session_expiration);
}
What else do I need to care/do?
@Orangepill works great
@MohdFadli as Ghedipunk said it's not guaranteed to always work just on most browsers
03:31
Mornings
morning
@Orangepill nvm that, its just my final year project, its not up and running site
okay... just wanted to make sure you knew the facts before you made the decision
03:51
Hey guys, how do you usually implement state changing routes in your REST API's? Do you always drive this through the data i.e. create routes like PUT /orders/1/state and put new state into body. Or do you implement it in non-rest way instead, like this PUT /orders/1/send?
I'm too RESTless for all that... :P
I would just do PUT /orders/1 ... the put indicates that you are changing the state
isn't that the accepted convention ... the url should indicate the resource and the method the interaction type
04:19
PUT means you're doing a complete replacement of resource at the target uri, i.e. if you GET the same uri afterward you'll receive exactly what you just PUT
DELETE is reserved for cybermen after a failed Upgrade header.
for doing partial changes you can either expose individual properties (e.g. /order/1/prop) or use PATCH
nothing wrong with making an API that isn't RESTful and using that, just don't then call it a "REST API"
Greetings Guys
Greetings
Why cant i update php 5.4 to 5.6 on CentOS 7 on VM.
i tried, but seems it crashed and not workign properly and tried to revert it back.. but vain.
04:32
are you getting any messages?
no messages at all.. i checked error log with ngninx.
and what happens if you try to run php from the command line?
havent tried that..
i will try that.
morning
The main reason I don't care about DELETE: it's rarely useful. Once something is created you usually want to keep it around but mark it as inactive or expired or whatnot.
04:47
moin
morning Joe
05:00
morning joe
Morning
need some advice about php oop and classes instances, for example, i'm doing a sample app that manages countries and towns. So, in db, I have a structure that makes a town belong to one country only. There is then a "country" field in my town table
I have a php town class, and a town manager class (that makes the link between my app and my db)
There, should I keep the $country var as an integer (like my primary key in db) or should I keep it as an object instance into the country class instance?
@bwoebi ping
user924016
05:56
mornings
@Julo0sS Depends on the use-case. For example your town manager (which probably actually is a TownAppDbLink) for example pretty much needs the integer ID for country because that value gets persisted.
@hakre well lets give it a concrete example, town has : id, name, zip and country. Country has id, name. Town "country fk" retains the country id.
The manager is used only to get / delete / update data in database, it's a seperate class that holds the "db-related" functions...
(townManager or countryManager have the same actions but on different tables)
Sounds a bit like the "Table Module"
Now, in my php town class I have vars that suit the db template, town_id, town_country as integers and town_zip and town_name as "text"
should I have something like :
town_id - integer / town_name - text / town_country - Country (from country class) / town_zip - text
instead...
Or like a "Data Mapper". The book comes with examples so if you need decision points I can recommend it. The primary key is also called identity.
You most likely want to go with the Data Mapper pattern perhaps.
As you want to break free from the individual tables.
06:16
with php could I get json response with name?
@hakre Data mapper seems interesting
morning
Morning Epodax
06:43
good tuesday
moin
morning patrick
good Morning Gordon have a great day
morning
07:05
posted on September 15, 2015 by nlecointre

/* by mistaken */

@Orangepill with command line, i couldnt get anything.. so, deleted the VM and created a new VM and voila its working good.
I love the feeds
meurning!
g' morning
07:20
morning
hello! which way of getting and setting variable do you prefer and why? i'm a little bit confused, because there's too much comments on all that and nobody from php developers confirmed what would be the best way. thanks for help in advance! :)
07:37
<?php

/* set a variable */
$a = "Hello";

/* setting a variable value to another */
$b = $a;

/* output or get the value */
echo $a;
echo $b;
@user1257255 use google
@Rafee i forgot to mention i think variables representing class properties :/
<?php

class Hello {

public $a;

public function set_variable($p) {
$this->a = $p;
}

public function get_variable($p) {
return $this->a;
}

}
@user1257255 use google and php documentation on oops
Abe
Abe
morning o/
@Rafee why use a setter with no other functionality if you have a public property? :D
07:59
o/
@PeeHaa hello man
A question on the workings of transtions: programmers.stackexchange.com/questions/297286/…
Hello everyone
08:07
@NeelIon yo \o
@PeeHaa \o
@gskema Not an answer, but learn to use prepared statements
@PeeHee <:3_)~~
@PeeHaa
@PeeHaa As in 'it safer' or 'they are the reason return ID work'?
@MarcelBurkhard so that he can understands what its doing..
08:13
@PeeHaa It's Doctrine DBAL method, the query IS prepared under the hood.
@gskema Yeah it is prepared, but it is prepared in the loop
For every iteration
@gskema As in it is faster
@PeeHaa so basically just the db->execute(params) should be in the loop?
Yes
You only need to prepare once. Inside the loop you just bind the parameters
@PeeHaa damn, the code is spaghetti-like enough as it is :D now I'll have to make the query myself :S
08:24
@gskema Why are you using a dbal in the first place? Are you supporting different database engines?
@PeeHaa Using one instance for mssql connection, another for mysql. The class is a lightweight wrapped so why not?
warpper
@Rafee I don't consider this a valid answer to my question sorry..
@gskema Well if you indeed use different db systems it's somewhat valid otherwise it's just extra complexity
@PeeHaa I guess I could trim it down to PDO... But the mssql db was a b***h to set up
@MarcelBurkhard okay, then how do should i explain. no worries.
let me learn too.
08:30
@gskema Yeah as said if you indeed use different db systems you probably want that dbal
Good morning
@PeeHaa But i'm not interchanging them, the mssql one is passed to one service class, the mysql one is used in multiple classes. So technically I could drop the dbal.
Who knows what can be the reason for phpunit to fail on reading phpunit.xml with Array to string conversion? I tried first phpunit 4.2 then updated to 4.8, same thing. xml is so far: pastebin.com/0jH0pfLw
@PeeHaa Also, it's possible to use PDO with mssql, so technically you're right, I could drop dbal altogether
0
Q: Array to string conversion exception when using PHPUnit HTML Coverage

Robin KantersI'm having an issue that seems to be related to the --coverage-html functionality in PHPUnit (I'm using version 4.8.0, though I've encountered it with other versions, too). When I leave it enabled, all tests fail with Array to string conversion in the console. I've been debugging a bit and it se...

08:42
Thanks for mentioning it here, just started wondering why it fails on Travis but works locally...
anybody here knows how to use phpunit?
@germikee Yes most of us
can you tell me or teach me how to use phpunit's setUp?
@germikee you put everything in there that needs to be initialized before each separate test
that's it. and don't forget to put parent::setup()
@Gordon oh. so i just create a new php file then and place all initializations there and call it?
08:49
@Rafee there is no correct answer as it makes no sense to have a setter for a public variable with no other logic... you could just do $hello->$a = "something"; in that case (which is ugly imo)
@Rafee so change your variable to private or protected
@PaulCrovella indeed, the xml was there for ages and I just re-run the build
so looks like it's 3-rd party issue :\
@germikee It'splaced inside the test case
@AlmaDo Y U NO USE THE SCHEMA FILE?
@germikee all the initializations you need to test the subject under test in isolation.
most of the time you just put in the code that initializes the subject under test along with any mocked dependencies
@Gordon but it isnt it the same as to applying the initializations without using the setUp?
ah cant now.. Marcel
08:52
@germikee Yes
@germikee yes, but why would you want put the code to initializes in every test method? thats code duplication
@Gordon would making the initialized variables global not good also?
@germikee Terrible
oh...
@germikee ssshh. you said global
08:53
@germikee Global is bad. Global in tests are horrible
You want to test in isolation
the whole idea of setup is to provide a clean state.
@germikee if you haven't done so already, read phpunit.de/manual/current/en/fixtures.html
well... i havent at all. sorry
for each test, you pull up and tear down the environment. if you make it global, you risk side effects from one test to affect other tests
no wonder... my other tests are acting weird. i see.
now im dumb
08:55
@Gordon Did you ever decide what to do with your hardware? :)
@germikee not dumb. on the way to enlightement.
@Gordon thanks :)
@Epodax yes and no
Sep 11 at 14:54, by Gordon
@tereško what do you think about ASUS Radeon R9 390 DC2, Asus M5A97 EVO R2.0, ARCTIC Freezer XTREME Rev. 2 and AMD FX 8320 Octa-Core. that will be about 700 euros total for the upgrade
@PeeHaa on the word "isolation" what do you mean by that?
that would be my upgrade. but I think IF I do an upgrade, I'll buy the Radeon first to see how far it gets me
08:58
@germikee Not being influenced by outside/external factors
oh okay...
i thought it's some phpunit term. hehe thanks @PeeHaa
@Gordon Not a bad idea :)
@germikee :-)
@Gordon love your upgrade.. I just F***** loving it...
GMAES GAMES GAMES GAMES hahaa.
Get GRAPHIC CARD TOOOOOO
:D
09:13
@Epodax but I guess my wife is right when she says I wont have time to play anyway
so I am not sure I'll do the upgrade
Abe
Abe
my #programming workflow: (#devs #developers #apps #developer #dev) http://t.co/GF4fHk3AJy
so I'll probably end up saving the money for when the kid is going to kindergarten or something. then I can play F4 in maximum details … in about 5 years :P
Dude, think of future.. you kids will play..
@Gordon There's always time to play :D
@Abe more hashtags
Abe
Abe
09:25
#spam
Morning
I have this question that I've been pondering about lately. What is the best way to split the instantiation of DB Entities in Factories. For example I have a data mapper that uses a factory to instantiate the model entity for the address book table in the DB, the model entity for the contact people. These are two things which most of the time are necessary to be used together, so is it a good idea to put their factory instantiation in a single file
@JoeWatkins pong
thanks, phpdbg and apcu crash, not sure which one it is ...
(7)
@JoeWatkins simple repro script?
also, code coverage with phpdbg+phpunit is a fucking brilliant feature ... I missed that /cc @SebastianBergmann and who else done it ?
09:40
@Epodax you are single without children, right? ;)
@bwoebi urm urm ... I can't remember what I was doing
@JoeWatkins Me (phpdbg), and Staab Markus (phpunit impl) mainly
sorry, I'll get back to you with that, it'll come up again ...
brilliant, well done @bwoebi :)
@Gordon Yup
@JoeWatkins I always wanted to add callgrind compatible output, but I just didn't understand how that thing works…
09:42
But it's about commitment!
I saw a thing about it but hadn't used it till today ... didn't realize it was so complete either ...
@bwoebi Do you think you can fix the implicit return / } issue before 7.0.0?
maybe we can do that in the future, I've worked on generated callgrind before ...
great anyway, more of that please :)
I'll come back around to phpdbg soon, I'm an extension and a half away from done ...
I'd like to think about better testing for extensions ....
I'd like them to be testable with phpunit, I'd like code coverage for internals ...
could we do that ?
code coverage for internals? I don't think phpdbg would be suited for that.
haven't looked at how it works, I will later on ...
not even just really limited to ZEND_FUNCTION|METHOD's ?
am I being stupid ?
09:49
@Epodax we talk again once you are married with children :D
@JoeWatkins I wonder how we will fetch the file/line info etc. …
Where do you get that information from?
well we don't have code coverage now, what about we just implement a test case from phpdbg for extensions
not sure what you mean?
well you can't make assertions about internals, the refcount of things, addresses and implementation detail, which is the sort of thing you are indirectly testing with phpts, leak output is good, but also would be good to be actually able to test internal details, you know what I mean ?
@JoeWatkins not sure how you'd test these though.
09:54
well if phpdbg registered a class that extends from a test case, we can just implement them, it's pretty straight forward isnt it ?? assertRefcountEquals/GreaterThan/LessThan/AndSoOn() assertAddressesEquals/GreaterThan/LessThan/AndSoOn() assertOtherThingsThatAreUsefulAndSoOn() ?
@JoeWatkins ZEND_ASSERT(GC_REFCOUNT(...) = ...) ? etc.?
but this only works in one mode, and not the mode everyone actually deploys, plus there are already a bunch of those and I remember the detail of about two of them, they are not really useful ...
I might in 5 years remember them ... but phpts are awkward because you can only indirectly test stuff, it seems pretty reasonable for phpdbg to expose the internals to something and since phpunit is already a mature framework for that, why not it ...
@JoeWatkins not useful? I've encountered them already a few times and they've usually saved me a lot of time which I'd have needed to localize what'd gone wrong at all…
maybe I've only encountered really cryptic ones ...
a message is nice though, right ?
don't disagree.
there eventually should be a + !"Some explanation" in the assert msgs
10:01
it's better than before, but most people don't run debug php, I've actually had a lecture from someone that had been programming a long time because no one had ever asked them to build a debug php before, they went apeshit ...
and it doesn't change the fact that phpts are awkward, they have to be because we don't like to expose implementation detail, but that is what debuggers are for ...
@JoeWatkins That's like going apeshit because of not having any idea that phpunit exists…
that's true, but I think less likely to occur ...
@JoeWatkins also… When you assert a refcount, if you'd do it in PHP, it'll have many side-effects (Separation, refcount increment, reference dereference etc.)
and less reasonable anyway, it's not surprising if you are a php dev that you don't know how to build install and debug c programs anyway ...
hmm ... not if, you didn't use variables directly, but their name, or scope and name ...
sure. But I honestly think that using a PHP debugger is the wrong tool for that. Use a C debugger/test suite runner if you want that.
10:05
or you only accepted by reference and the implementation prepared/adjusted for that ...
but the one we have it shit ...
@JoeWatkins I said C level.
like manually calling zif_my_func with a suited execute data and look what we get back.
oh I've never really got on with any of them, for a little while anthony was playing with one and I was too, but they are awkward ...
I can't remember the name of it now, might have been gperf ...
@JoeWatkins sure… but ultimately integration tests are much easier, because it tests all at once with a bit of code.
that's the issue of all unit tests…
10:29
everytime i start a webserver it happens like this.
@Rafee its probably spawning php child processes listening to requests?
what? i am just installed fresh copy of php
and test info.php with echo phpinfo()
nothing else.
Morndom
Anonymous
Does anyone know how long it takes whois servers to reflect a change made to an owner of a domain name?
10:44
That's rather a "how long is a piece of string?" question
morning
evening
"twice the length of half of it"
@Rafee who told you to run webserver on windows?
his boss
10:55
where do people get those images you see on github readmes ?
like the travis one (I know where that one comes from)
Anonymous
@JoeWatkins you mean badges?
@JoeWatkins travis provides its badge
Anonymous
yeah
Anonymous
... searching for a link
11:00
got the travis one, I've seen others, but can't find example
Anonymous
Anonymous
Others come from packagist also
@AlmaDo It's fixed again.
@JoeWatkins I use ones from scrutinizer-ci.com
for coverage and code quality
@JoeWatkins shields.io
11:10
that's probably the ones I've seen @tereško
@tereško no one.. I am just running on my own..
Is something wrong?
@Rafee for private development environment you should be running the webserver in a VM (something like VirtualBox or VMware)
helps with the mess and is much easier to keep up to date
Hey, I got CentOS on VM.
but onmy local, windows.
I installed nginx,php,mysql on VM..
so, i want the same environment except OS
@tereško
why?
so, that. i can move the development to production easily
11:17
what is the point in having nginx on windows if you already have it on the VM?
I didnt get it.
both are different?
@Rafee It wont be the "same", nginx is fundamentally different on Windows
ya know, forget it, I have run out of the patience for dealing with stupid
okay.
so, you mean.. nginx on windows(local) will be diffrerent on centos(VM)
I mean, it does the same job, has the same functions, but it will perform very differently
11:18
okay.
@JoeWatkins What about paging à la --- Press <return> to continue, <q> to quit --- … might be helpful when your ev command has accidental recursion...
Hey Leigh :)
It'd require using the output buffer for ev, but could be worth it…
Looking forward to you joining us on the 23rd :)
hi
What should be the ans of Name a few tactics you use to build a clean website that isn't bogged down with unnecessary code?
11:27
refactoring
@Fabor hey, me too :) reminds me, I need to give Ben a call
Cool, he's available whenever.
We've potentially found our new office too. It's about 3 minutes walk from the current office towards ocean village.
Will be good to have a bigger space for us all.
Daniel goes to Anthony and Leigh comes to me. The amalgamation has begun!
does that mean you'll be coming to phph with us then @Leigh ?
not that we go that often ... mostly my fault ...
11:37
Nah, I don't exactly prompt you to go either
17 mins ago, by bwoebi
@JoeWatkins What about paging à la --- Press <return> to continue, <q> to quit --- … might be helpful when your ev command has accidental recursion...
@JoeWatkins ... ^ ?
yeah I'm not sure, I guess doable
not really sure how
@JoeWatkins Probably :) One of the other interviews I had down there turned out to be with one of the phph organisers. (Colin and/or Richard?)
cool :)
not good at names, I think richard sounds right ...
And what's that, Daniel gone to google?
11:49
why logo running so fast?
any ideas?
is it me or are ES7 decorators misnamed and are just AOP
@Leigh Nope, both are at Grovo.
@kelunik Oh right, been out of the loop, missed Anthony leaving Google... (his github still says he's there :P)
12:01
posted on September 15, 2015 by nlecointre

/* by dijam */

@Leigh watch out … I will announce some news shortly, too
You're building the "new facebook"... with Laravel?
not much of a challenge
how can I fix its syntax error?
$A>=$B  ? $A++; $B--;  :  $A--; $B++;
who needs facebook anyways
the only strength I see is the fact that people can talk to each other (the chat) and the wall is like broadcasting info
12:05
@Sajad You understand what a semi-colon means right? (in terms of syntax)
@Sajad by making it into an if/else which will make it more readable as a side effect
We need facebook to share fake emotional-blackmail pictures for likes to satisfy some unquenchable need for validation.
Naturally
@Fabor oh yeah, but I thought that was clear from the start, and I didn't wanted to hate publicly
@Gordon condition ? true:false; it is exactly a if/else. but I don't know how can I do two assignment in the each side ?
@Leigh it means end of code
It means end of statement. So you have

```
$A>=$B ? $A++; // Syntax error
$B--;
: $A--; // Syntax error
$B++;
```
urgh, forgot about SO's markdown, you get the idea
12:09
ctrl+k
@Sajad no, its not. a ternary is x = cond ? expr1 : expr2; thats not the same as an if/else, but you are using it like an if/else. so just change it to if ($A>=$B) {$A++; $B--} else {$A--; $B--}
@Leigh ah! so should I use something instead of semi-colon in my condition ?
In PHP, why isn't there a function that you can call on an array
for example
@Gordon ok, tnx
$routes = [];
$routes->push($newRoute);
12:10
@Sajad no, you have too many already
@Gordon I see
just use an if/else
@Sajad You can do it as a ternary, but it's going to be less readable. Take Gordon's advice
$A>=$B ? $A++ | $B-- : $A-- | $B++; For example.
@Leigh oh really ?! I had never used this sign | so far. anyway thanks, I will check it
@Leigh also readable is not important for this part on my website. because this part of my website does not need to develop.
It's a bitwise OR operator.
Normally you'd assign the result to something. $c = $a | $b;
You could replace it with any bitwise or arithmetic operator really. i.e. $A>=$B ? $A++ + $B-- : $A-- + $B++;. But still, take Gordon's advice, just do an if/else
12:21
@Leigh intresting :-), but as both you and Gordon said, I did it using if/else
$C = (($A >= $B) * 2) - 1;
$A += $C;
$B -= $C;
Just in case you want to make it even less readable
@DaveRandom OMG! your brain is laudable!
@DaveRandom you... you stop "helping"
(btw, in case it's not obvious, don't do that)
It is branchless though, not completely useless 100% of the time
@DaveRandom I don't want do that, but It was an interesting solution
@PaulCrovella why he stop helping ?
12:24
something something branching faster than stalls these days something.
user3883753
hi
@Sino hey!
@Danack Depends whether you are writing something that would cause/be affected by branch predication failures I think. But yeh, the assignment (and associated managed heap alloc) likely would kill that benefit, rendering it absolutely pointless rather than just almost completely pointless
There may be some cases where it would gain you something in a compiled language
Trying to out-ridiculous Dave... error message changed from Parse error: syntax error, unexpected '++' (T_INC) in /in/mueI5 on line 8 in 5.x to Fatal error: Cannot use temporary expression in write context in /in/mueI5 on line 8 in 7.x ... hmmmm
pretty unhelpful, that second one
@DaveRandom still I enjoy when I see this solution. it shows your are a creative man! good for you.
12:29
to be honest the last time I even looked at CPU internals was several years ago, and it could have changed back again. But what I took away from looking at it was basically CPUs are now magic.gif and trying to understand what will be 'faster' is more a matter of guess work, rather than logic.
12:43
The part about CPUs being magic.gif sounds accurate :)
@DaveRandom if it were in C, I'd agree…
but >= like it's implemented in PHP is branching internally.
If you try being too clever with branchless code in C, the compiler will probably optimize it into a branch anyway :P
@NikiC I know. Hence always check the asm first ^^
And then the CPU fixes the crappy code the compiler generated when it turns in into micro-code.
.. Or a 10MB version - i.imgur.com/gBKH3cj.gif

« first day (1795 days earlier)      last day (3379 days later) »