« first day (1691 days earlier)      last day (3273 days later) » 

12:17 AM
Hey @marcio hola
How's life in Brasil
 
@ziGi are you aware that "hola" is Spanish?
 
yes, sorry if I have offended you, I just thought it's something similar
 
Brazilians speak Portuguese :P
 
yeah, not exactly
isn't it ola in brazilian, sorry portugese?
 
You may say "oi" or "olá"
 
12:22 AM
oi mate :D
 
oi ^^
 
so is it nice living in Brazil
Warm weather, nice food
 
Well, it's like a continent. You will find different weather and food depending on the region.
 
True, actually it's quite big
 
but in general it's warm, you only get below 0ºC on south
 
12:29 AM
yeah, that's what I meant
it's a bit strange I guess for people living in the North like me, that when you go to the South it gets colder :D
 
just avoid the equator line, it's hot as hell :x
 
How do you program when it's warm, I'd like to seat on the beach all day long
 
use an air conditioner?
 
hah, yeah, good point
 
taking a computer to a beach sounds much better than it is.
 
12:46 AM
Yeah, I mean going to the beach without the computer, just enjoying the weather and drinking
 
quick question room: Does it make sense to have 2 constructors. One normal, new Foo($a, $b, $c) and the other static, Foo::create($abcArray)?
 
yes
 
@marcio did you also see from the arguments the intention I have (passing in an array to construct my object, this is nice especially coming from forms)
 
as long as you don't name it just "create"
Foo::createFrom...();
 
ahh....Foo::createFromArray
 
12:48 AM
Request::createFromGlobals();
 
I'm trying to think if this will be bad for unit testing?
I haven't unit tested a static method yet
 
how so?
 
Thinking about it, I guess there's nothing different
 
@DavidGraham No, unless both are very common use cases
 
Seems like I heard that statics were a nightmare to unit test
 
12:51 AM
@DavidGraham I suggest you don't mix static with non-static constructors
 
hmmm @ziGi Should I abandon the non-static constructor and have 2 static constructors? Foo::create($a, $b, $c) and Foo::createFromArray($abcArray)?
 
just create 2 static constructors one called Foo::createFromArray($array) and one called Foo::createFromValues($a, $b, $c)
@DavidGraham I can show you a really nice article on the topic, give me a sec
 
woohooo thx!
 
it is a nightmare if you have hard dependencies like:

class foo { function bar() { Baz::doSomething(); /*...*/ } }
 
it's all about semantics
 
12:54 AM
checking out link...
 
@DavidGraham it's also worthwhile taking a look at the other articles the guy has, it's a really nice blog
 
One more thing...so constructors should be putting the object in at least the bare minimum valid state right?
To reduce parameters passed into a constructor, people do Value Objects or Builders?
I get kind of concerned that some of my entities (I'm trying lite DDD) will require more than 5 fields be set to be in a valid state.
Passing 10 params into a constructor worries people for some reason
 
@DavidGraham isn't there a way to group some of the fields in other Value Objects
for example if you have to pass city, address, number, then it's worthwhile creating a valueobject called FullAddress containing those 3 values
 
Yeah I'm thinking I can, such as firstName, middleName and lastName would move 3 into 1
 
exactly, do some aggregation
 
12:59 AM
Right
I also have some setters for the remaining properties I want to set (but are not required, so I don't pass them into constructor)
 
Besides, builders cannot be implemented properly in PHP since you need to be able to create inner static class, otherwise you have to expose the fields
 
Hence, why I wanted another constructor (static) that I could pass in an array, that constructs plus sets other properties in one go
 
"bare minimum valid state" is something too general, and five parameters should be something rare in any method or function.
 
@marcio any recommendations?
I don't have an anemic entity, I do a lot of behavioral stuff
 
@marcio there are cases where you have large aggregates, I have sometimes 5 params in the constructor
 
1:02 AM
but I also have a good bit of data operators in there
Think about a person entity....
you might require name, address, birth date, ss#, etc....
then you have some additional optional data you can set
VOs can reduce the params down, but I can still see myself going past 5
 
@DavidGraham create some aggregates
 
"aggregates"?
 
yeah
 
like entity that has child entities
?
 
@ziGi are all the 5 parameters required for initialization? If not, I'd drop the parameters and using setters.
 
1:04 AM
Yeah, the constructor needs to finish with the object in a valid state (although this is a highly debated thing)
 
@marcio yes, but you cannot do it for ValueObjects. Otherwise you have to create special setters that can be executed only once, but having setters does not guarantee you fully populated object
 
so if it takes 10 params to do that....people freak out and automatically assume you are doing to much in the class (not true though)
 
@DavidGraham no, it just means you have too much scattered data which can be grouped inside objects
besides, put only those fields that are necessary for the object to exist in the constructor
 
Another problem that arises is the mixture of $a, $b, $c and dependency injecting other optional VOs (ie. Address, Email, ...)
all in the contructor
?
 
if they are not necessary to be there when the object is initialized use setters
 
1:07 AM
@ziGi yep, I did that....otherwise constructor would have like 30 params, lol
 
haha
 
Again I stress though, this entity is not anemic. Just a lot we keep on a person's profile
 
@DavidGraham I think you just need an "attributes" parameter.
 
Is it bad to do this: new Foo($attributes) and then inside the constructor do the check for minimum required?
 
Foo::fromArray(['name' => 'David', ... ]) is obviously not a bad choice. As long as you have a very specific scenario, anything else is over thinking.
 
1:11 AM
and then there is the issue of DI....

     public function __construct($attributes = [], Address $address, Email $email)
    {
            // check to see that $attributes['something'] exists
The $address and $email are not required, but I need them to setup those properties?
 
what makes $address and $email non attributes?
 
public function __construct($attributes = [], Address $address, Email $email)
    {
            // check for required stuff...$attributes['something required']
            ...

            // Set up VOs?
            $this->setAddress = $address;
            $this->setEmail = $email;
@marcio Well, I can pass them in the attributes...but what if I don't pass them (they are optional remember). The VOs need to be initialized
for example, if I do $foo->address->getZipCode() that will throw an error because I never intialized address to the VO Address (even though it would be empty since I didn't set it in attributes array)
Now I could do something like this:

    public function __construct($attributes = [])
        {
                // check for required stuff...$attributes['something required']
                ...

                // Set up VOs?
                $this->setAddress = new Address;
                $this->setEmail = new Email;
 
why don't you import the attributes and then check if the required ones were initialized. If not, give an useful error.
 
Yup I do that....but look at code above....
I need to setup those VOs
using the new inside that constructor....that makes unit testing harder
Versus using Dependency Injection
 
Hi, I have a page on my website where the customer sees all his order details. At first I wrote PHP code on that page connecting to the database and withdrawing those values and inserting them into the page. But then I heard it was dangerous to connect to the database on a client side page, so changed it around, but now the page doesn't update on refresh. So the question is can users see PHP code on a client side page?
 
1:21 AM
@DavidGraham why are you instantiating Address and Emails instead of receiving it through the parameters? :)
 
@Quickcoins do a "right click > view page source" and you tell us :-)
 
@DavidGraham You could write $this->address = $address ?: new Address;
 
3 mins ago, by marcio
why don't you import the attributes and then check if the required ones were initialized. If not, give an useful error.
 
@marcio because they are optional, (might not be included in $attributes)
@Trowski you still have the new in that constructor....means you can't mock it for unit testing
 
So there's an expected set of keys in the $attributes array?
@DavidGraham Yes you can, you pass a mock address object....
 
1:24 AM
@Trowski yeah, we have some keys that will be required to construct the object into a valid state, the others are optional
@Trowski you used the new so I can't do that there
I could if I used Dependency injection, right?
 
@DavidGraham ok, then you are looking for nulls objects
 
@DavidGraham Seems like what you want is __construct($required1, $required2, $required3, Address $address = null, Email $email = null, array $options = null).
 
// flees
 
use bug spray @marcio
and watch out for lyme disease
 
@DavidGraham With what I proposed, $this->address = $address ?: new Address; you can give the constructor a mock Address object.
 
1:26 AM
hmm...thinking @Trowski
 
Yeah, that constructor would be rather terrible.
How many required attributes are there?
 
@DavidGraham thanks for the reply! I cannot see any PHP, but I was worried hackers would be able to do other tricks, so it is safe to connect to the database on a page my client uses?
 
public function __construct($attributes = [], Address $address = null, Email $email = null)
{
    if(!isset($attributes['name'])){
        throw Exception('name required!');
    }
    $this->setName($attributes['name']);
    ...
    ...

    $this->setAddress($address);
    $this->setEmail($email);
}
@Quickcoins it depends...(we all hate that answer, "it depends", LOL).....
 
@DavidGraham you are designing issues for yourself just to have some typehints, that's pretty bad.
 
@DavidGraham what do the $attributes represent that is so important for the object you are constructing
 
1:31 AM
@ziGi in DDD we want to make sure each entity is instantiated into a valid state
 
@DavidGraham if $address can be null and $email can be null, then just remove them from the constructor and create setters for them, this means that the object is not dependent on them
 
so there are maybe 5-10 things that are required for a Person entity to be valid
there are 30 more things that can be set after construction
 
@DavidGraham so then make a Person ValueObject that does those checks inside it's constructor and just make
public function __construct(Person $person) {
 ....
}
 
@Quickcoins you are safe in that the hackers wont get your database stuff from the page.....but there are other things the hackers could do, sql injection for example
 
this way you are sure that you are passing a valid object to the constructor
 
1:32 AM
@DavidGraham I feel like you should be separating attributes out into another object.
Yeah, what @ziGi said :)
 
Person VO and Person entity?
 
Zigi is the best :P
 
@DavidGraham Ohhhhh phew thanks for that! SQL injection is only an issue with user input right though?
 
Well it depends, but most likely it would be an entity since you need to identify people somehow, by social security or name or whatnot
 
@Quickcoins phptherightway.com/#databases_interacting Read, learn, use it.
 
1:34 AM
Help me please
0
Q: How to send the push notification only to iPhone device in following scenario?

user2839497I'm using gomoob:php-pushwoosh a PHP Library that easily work with the pushwoosh REST Web Services. I want to send push-notification only to iPhone device. Following is the sample program I've written to send a push notification. Can someone please correct my code in order to send the push noti...

 
@user2839497 Find me a girlfriend please!
 
@user2839497 Stop posting this in here every few hours...
 
@ziGi It doesn't make sense to have both an Person VO and a Person entity.....besides, I'd run into the same problem with a Person VO, i'd still need 10 params to construct it
 
@DavidGraham don't make Person VO, just Person Entity, but in the entity put validation in the constructor, so you are sure that your entity is always correct when created
 
I think you guys have helped me though, I see how you guys think about it
 
1:36 AM
this way you are also going to easily find if there are any problems not only from data coming from the front end, but also from incomplete data coming from the database
 
Yeah I do validation in that constructor (actually I call a few setters from the constructor for each of the required attributes, the setters have validation....but I make sure to not use $this before object is fully constructed)
 
although you should be careful. I did deployment in production and there was some corrupt data so my code started failing saying that it cannot reconstitute the entity because of missing data which was produced by a previous version of the application
 
@DavidGraham FAAAAAAAAAAACK didn't realise you founded coder camps
also anyone, what is foo?
 
Ultimately I wanted to get Laravel's IOC (or service container in Laravel 5) to auto-construct my entities
@Quickcoins I didn't create coder camps
 
Guys, I am still writing on my thesis and it's almost 4 in the morning here and I have to go to work tomorrow.
So bye for now, talk to you tomorrow
 
1:38 AM
@DavidGraham ahhh shame, well you still seem like a great guy
 
@Quickcoins foo is just a generic programmer word. It's meant to be a placeholder for whatever you want to demonstrate
foo just kind of means "example"
and sometimes you will see foo and bar
bar is like "example 2" or a child of foo
 
@DavidGraham Oh i see, cheers that helps, just reading that article the other guy linked
 
@Quickcoins you have Foo, Bar, Baz, these are just generic words used for example like 'Lorem ipsum dolor sit amet'
 
At your level @Quickcoins the best way to learn is actually get a book and go through it. Books are great for beginners
Save yourself the jumping around from article to article
and trial and error
 
@ziGi thanks
 
1:42 AM
@ziGi thanks for your insight and help
 
I am happy I could help, talk to you later
 
laterz
 
@DavidGraham I hear that, will read some books, but I like the diving into the deep end and learning that way, you can have a peak if you like made my first website quickcoins.co.uk/website/home.php
 
Crazy background you got there! My wife is from India
so it jumped out at me like hindu art
 
Yeeaaah its pretty POW, I thought it was hindu art but its actually Frida Kahlo from Mexico, similar styles however
Think its too POW?
 
1:51 AM
depends on what you are trying to convey. I'm from Austin, everybody tries to do hipster stuff here, so this background would totally work. For bitcoins though, it might scare folks?
To bump it up to being a bit more professional, try doing a fluid banner (a bar that goes from edge to edge of screen) and the banner only has this background
the rest of the site is white
Make the banner pretty thick though, maybe like at least 1/3 of the typical screen height
So that blue banner shown here, that would be your Frida Kahlo background instead
maybe bring down the transparency a bit on it too
 
@DavidGraham awesome, yeah trying to find the right balance between funky and legitimate looking haha. So if all my PHP is hidden, and i've protected user input against SQL injection, what do I need to be worried about security wise, am I pretty much covered?
 
Try looking into MVC
that will help you a lot
you need to separate code from your "views"
You don't want to mix php code with html
at least not to the degree that you are
 
Oohhh, why? I have a lot of PHP values in my html. Surely if it can't be seen how do you know?
 
Just to help you organize
 
Not a security issue though? How did you know I do it a lot if it can't be seen
 
2:04 AM
You need protect some of your code using html_entities as well
that would be a security issue
 
good morning
 
I don't know, I just assumed you were mixing all your code into a single file
@boyee good morning? more like night here
 
Ahhh okay, yeah I am. But how would I put a PHP dependent value into html without PHP in the html
 
well you would definitely put some variables in the "view" (view is a php file with nothing but $variables and HTML/JS)
 
2:08 AM
but don't put database calls, etc in there
 
I just read echoing in PHP is really bad for performance, what is the alternative?
 
Do all your php logic in a seperate file, load up a big array of values, pass the big array to your view file, take those values and use them throughout your html
 
@Trowski is that an MVC template
 
use extract to turn the array into variables w3schools.com/php/func_array_extract.asp
<div>My view is so so <?=$somePHPvalue;?> clean!!</div>
call the view file "somepage.view.php" or "views/somepage.php"
 
okay sounds good, so would that print the $somePHPvalue on the page even without the echo
 
2:13 AM
yeah, <?= is a shortcut for echo
and remember, don't talk about coinclub!
I'm out guys
see ya'll later
 
DOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOON
 
3:10 AM
@Danack zomg! never let monkeys touch your Ruby code!
 
3:21 AM
@Quickcoins It's just a template. It doesn't have to be used in an MVC.
 
 
2 hours later…
5:33 AM
0
Q: Why the fatal error is coming even after including proper namespaces?

PHPLoverFollowing is my program written to send push-notifications using php-pushwoosh library: <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); use Gomoob\Pushwoosh\Client\Pushwoosh; use Gomoob\Pushwoosh\Model\Request\CreateMessageRequest; use Gomoob\Pushwoo...

 
@PHPLover Are you using two accounts?
Looks like you're this profile as well.
 
6:29 AM
Good morning gents and genties
 
Good morning
 
6:45 AM
Hi
 
6:59 AM
@bwoebi I was wondering about that one as well. Imho we should use it without opcache too
Would help me for some things as well
 
c:\> php -r readfile('http://symfony.com/installer'); symfony2 I executed this command but I didn't find symphony file!!
 
MOnring
 
morning
@PeeHaa have you idea about downloading symfony2
 
@JavaFan wrong .. read the docs again
php -r "readfile('http://symfony.com/installer');" > symfony ... then, run it with php symfony
 
@Ja͢ck how to
Move the downloaded file to your projects directory and execute it as
how to run it?
 
7:18 AM
It's just a PHP script, so you run it with php command line tool
 
Good morning
#120 0x0000000000738a46 in zend_objects_store_free_object_storage (objects=objects@entry=0xf5e760)
    at /usr/src/builddir/Zend/zend_objects_API.c:97
#121 0x0000000000700753 in shutdown_executor () at /usr/src/builddir/Zend/zend_execute_API.c:290
#122 0x0000000000710215 in zend_deactivate () at /usr/src/builddir/Zend/zend.c:946
#123 0x00000000006ae15a in php_request_shutdown (dummy=dummy@entry=0x0) at /usr/src/builddir/main/main.c:1812
#124 0x0000000000471a25 in main (argc=<optimized out>, argv=<optimized out>)
thoughts ? (:
Checked this & this
 
Built from master?
 
# php -v
PHP 5.5.25-1~dotdeb+7.1 (cli) (built: May 15 2015 16:39:22)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
From sources dist..
not PHP 7 (:
As it's production system, I can not just set desired PHP version to play round
 
Probably an opcache bug. I am shocked!
 
Good point .. what happens when you disable opcache?
 
7:24 AM
@Ja͢ck D:\>php -r "readfile('http://symfony.com/installer');" > symfony2 A required privilege is not held by the client.
 
lol .. that's a Windows error
 
@PeeHaa nice catch, trying..
 
@JavaFan It seems that you don't have permissions to write into d:\symfony2
 
however firstly I should run the former command true?
 
Provided you have write permissions
 
7:28 AM
?
okay what next
 
obtain write permissions
 
after that what command to be run?
 
@PeeHaa what makes you think that it's opcache? (looks like you're correct, without it - no sigsegv)
 
because opcache does many magical things
 
ook, but let's assume it's opcache and I have to deal with it somehow. What can I do (again, I can not just disable it on live system as then response time will raise to the sky)
that's why I'm wondering why do you think it's opcache
 
7:34 AM
@AlmaDo "zend_objects_store_free_object_storage"
 
I'm not sure what the level of support is for 5.5 + opcache ... but it wouldn't hurt to raise this issue anyway.
 
@Ja͢ck should be full support.
 
i agree
 
ok, then
 
5.4 is security fixes only, 5.5 is still full-on
 
7:35 AM
looks like it is the thing, no?
 
does changing that value make a difference?
 
checking (:
 
morning
 
No, still same
 
darn
 
7:38 AM
well, what can I do to keep opcache running and have no segfaults ://
 
the most important part to get your issue more attention is a reproducible test case.
what are you running anyway? anything standard?
 
I have a 100% case
it reproduces segfault with opcache and works fine without
 
go on
open a bug on bugs.php.net and send the link :)
someone will fix it by tonight.
and you'll just apply the patch and run a custom php build until the next release
 
I can not - they will (obviously) tell me to send a code
But I can't as it's the whole f*ng production system
I mean - I have request that reproduces it 100%
 
then open a bug
and we'll try to find a workaround
 
7:47 AM
Question: may upgrade to 5.6 help?
probably I will arrange that faster than this bug will be fixed
 
no idea.
I don't think so tbh
 
@AlmaDo they'll also want you to try it on the most recent version (5.6.9)
 
if it's a bug in opcache, chances are it's not fixed in 5.6 either
@AlmaDo try it on 3v4l.org
 
eh..
@FlorianMargaine try what?
 
your crashing code
 
7:48 AM
> But I can't as it's the whole f*ng production system
And I have no idea what causes it. I just know exact request to reproduce
and know that without opcache - works fine
 
@AlmaDo ah...
shucks
 
May be opcache configuration change might help, but no idea what can influence that
 
@SergeyTelshevsky Good morning :)
 
8:04 AM
So far I did increasing of opcache.memory_consumption and opcache.interned_strings_buffer
and looks like that helped
thoughts why?
 
@AlmaDo Because opcache is a piece of shit a useful piece of software with some issues
 
Morning
 
Hey fabeur
 
@PeeHaa well, after second run it still persists
 
8:15 AM
@AlmaDo can you reproduce the whole f*ng production system locally?
 
@Ja͢ck no
 
damn
the thing is that in order to know whether upgrading to 5.6 actually works, you would need to know what causes it in the first place.
otherwise you're risking breaking other things as a direct result of a minor version upgrade
 
@Ja͢ck I can do it as it's out from LB now
 
of course, you can
 
ThW
Morning
 
8:33 AM
posted on June 03, 2015 by kbironneau

/* by Tumeconnais */

 
8:48 AM
 
@ircmaxell What do you think about this: nccgroup.trust/us/about-us/newsroom-and-events/blog/2011/… ?
 
@kelunik only with a random key generated each time
but it's also expensive, so only really useful in certain circumstances (where other constant-time comparisons are much faster and more useful in generic usages)
 
Does anyone know if there's a standard way of doing #warning "Some warning message" in C which is portable across all compiled PHP extensions are meant to support?
 
@ircmaxell Yeah, I'm currently using constant time hash_equals. It's just an article that Trello linked in their reference implementation for webhook hmacs. Thanks
 
@kelunik yeah, both are useful
 
9:40 AM
Morgen
 
Mogguh @ziGi
 
Jeez, I slept for 3 hours last night, and I don't feel tired at all, it is kind of strange. It is alse really interesting to mention that, the dawn starts at around 4:30-5:00 in the Netherlands already
 
Yeah I have noticed that during the weekend too
 
this is crazy, that it's light that late here
 
@ircmaxell are you referring to NJ?
 
9:48 AM
@ircmaxell Also deja vu.
 
In the Netherlands currently the sky starts to get lighter at around 4:30 in the morning and gets dark at around 22:45, it's real fun, I can't sleep a lot
 
@ircmaxell if you want, you can check previous discussions on the topic on the container-interop project. The idea is that project would consume a generic container (because that's actually the part that you consume, even in the case of an injector), and that projects may provide generic containers instead of having framework-specific container definition for every possible framework out there.
One thing that really rustles my jimmies atm is that for doctrine we have a dozen integration packages, whereas it could be one if we had this sort of very lightweight abstraction/contract. Yes, it is key based, but the current glue containers are key-based anyway.
 
@ziGi no
@ziGi I am in france right now
@Ocramius I question why the hell you need an integration package in the first place
 
@ircmaxell because you don't configure all those services on your own anyway. I know you don't use FWs, so you probably don't follow on that
 
@Ocramius I have used them a few times, and they have always struck me as as-much work as configuring it yourself
 

« first day (1691 days earlier)      last day (3273 days later) »