« first day (1794 days earlier)      last day (3380 days later) » 

MGE
MGE
15:01
eventid is unique
Is it ironic that Symfony's YAML library has an array to yaml converter called "Dumper"? "If an error occurs during the dump, the parser throws a DumpException exception."
@Orangepill Ok. Thanx bro. I will try to follow the methods you mentioned :)
MGE
MGE
but there can be more than a purchase with the same eventid or different
user924016
Morning v2
@MGE you probably want to add a group by clause in there
@RonniSkansing good morning
user924016
15:05
yo agentOrange =)
MGE
MGE
I used. SELECT COUNT(purchases.id) AS sales, events.id as eventid,events.name AS eventname, events.date AS eventdate, events.status AS eventstatus, SUM(codes.passes) AS passes,SUM(codes.amount) AS amount,codes.currency AS currency FROM events INNER JOIN codes ON events.id=codes.eventid INNER JOIN purchases ON events.id=purchases.eventid WHERE codes.property=5 GROUP BY events.id ORDER BY codes.id DESC
but the same problem
15:17
@androidplusios.design just so you know: use of global variables are considered an extremely bad practice
hellow guys php codeigniter, how many joins and where, we can use in query. thanks in advance
27
no more, no less
sure?
15:22
@Crysis as many as you need
@Crysis There's no limit. It's more about how long the query takes.
but if you know 42 why would you need a database?
@Crysis can you form a sentence in english, please?
same for in codeigniter also?
15:25
are you a troll?
iam a newbie :(
@PaulCrovella I always thought the counting of the joins shall be 3. I mean, 2 is right out...
Hi erveryone
Is it a bad design when i have PlayerResources extends LocationResources extends GameResources extends RealmResources extends DomainResources extends ApplicationResources ? (I can guess the answer, any suggestions?)
15:30
@chozilla My answer would only extend your problem...
@chozilla yes, it's really bad
@tereško so what do you do when you build up a complex application?
extend basically means "is type of"
player is not a type of location .. usually
i am not talking about the player i am talking about the resources the player can interact with
@chozilla "composition over inheritance"
15:32
@Machavity excepting that thou then proceed to three
@tereško yea yea try to understand the problem first before you answer with a sentence i heared a 100 times
it is not the player it is everything he can interact with.
you can only have a location in a game and a game in a realm and a realm in a domain and a domain in the application
this is not an object that repesents something this is an API that represents what he can interact with
Hello all
user924016
@chozilla so a PlayerResource is-a LocationResouce?
user924016
or does it PlayerResource has-a LocationResource?
@chozilla On a more serious note, you should use Dependency Injection instead of chaining extends like that. If the Location needs to know the Game Resources, you should pass the GameResource instance into Location
15:37
.... you guys do know what a API is do you?
user924016
lol
@chozilla Apple Polishing Intern. Duh
it is not the resources themselfs. this are DI container that depend on eac other.
oh, this just keeps getting better
If there is a common interaction you want to support for all of the resource types interfaces would probably be more appropriate then the deep inheritance tree.
15:39
@Orangepill yes my current implementation is slightly different.
an interesting study-case of dunning–kruger effect
also i don't want the player to interact with the application directly sometimes i need deep resources later on.
user924016
@chozilla please, give a small code example
@Orangepill currently i have something like this:
trait Game_ResourceApi
{
	use Realm_ResourceApi {
		getDatabase as getRealmDatabase;
	}

	/** @var  Game_Resources */
	protected $gameResources;

	public function setGameResources(Game_Resources $resources) {
		$this->gameResources = $resources;
		$this->setRealmResources($resources['RealmResources']);
		return $resources;
	}

	/** @return Game_Resources */
	public function getResources()
	{
		return $this->gameResources;
	}
/me waves
15:41
o/
how does this work again?
ctrl+k?
somewhat better.
do you actually want opinion @chozilla ?
lol .. that's a new way of making singletons
because you asked your initial question and said that you probably knew the answer, then when you got the answer, which you already knew, you rebelled against it ...
@JoeWatkins yes i very much do.
15:44
well, maybe go back to the initial responses and read without thinking you are being attacked, you asked a question and got an answer, a good one "composition over inheritance" ... you might have heard it before, but your question tells us, without doubt, you didn't understand it properly, or have chosen to ignore it ...
@JoeWatkins the problem is that 80% of the answers is just critic without any help or guidance.
@JoeWatkins keep in mind that he's not even using OOP there. What he calls "extends" is just abuse of copy-paste
you invited that criticism ..
@tereško he can read you here.
@JoeWatkins yea i would not ask if i had not refactored the code already 20 times.
it's friendly criticism ... invited, friendly criticism ... productive stuff ... which you asked for ... smile, and read it again ... if you don't understand how it applies here, then ask how it applies here ... someone will surely explain it ...
15:49
It seems to me that what you really want here is some sort of resource registry that you can pass in to everything that needs it, I would suggest you start with something along those lines. Right now it appears as though everything that implements this trait has to manage it's own copy of all of the resources.
I dunno, being a douche to the people you're asking for help isn't a great way to get explanations, and that canoe has already sailed
like @tereško sayed before. it is not OOP. well what else can i get from that information? of cause it is not OOP this are traits they are compiler-side copy and paste. also this are no OBJECTS this are functions that are only setters and getters on a DI container that can have everything inside. also there is NO global state. this works perfectly without it.
@Orangepill yes you got it :) there is a resources object and the trait is just the API to the DI-Container, all the getters and some setters that are supposed to be exposed to the Domain logic.
Anonymous
Is the zend Engine written following a particular design pattern?
18
Anonymous
@JoeWatkins ^
Design is generous, let alone pattern
15:52
@samayo How dare you to reduce the Zend Engine to a pattern?
fraid not @samayo ...
Hey Joe
alcoholism and irresponsibility are patterns
14
yo fab
Where you going with that gun in your hand?
15:53
You coming up to NW?
Anonymous
@bwoebi I meant, does it follow some sort of coding convention?
yes fab, you catching a ride ?
22 secs ago, by Paul Crovella
alcoholism and irresponsibility are patterns
@PaulCrovella overused ones imo
@samayo oh there's one of those ... lxr.php.net/xref/PHP_TRUNK/CODING_STANDARDS
not taken super seriously though ...
15:54
@Orangepill but… that's nice and readable code.
@Orangepill I think most of what I write uses the alcoholism pattern...
@Trowski Oh, that explains why Icicle is that shit (just kidding…)
BDD = Booze Driven Development
i wish i had booze
Anonymous
I thought the fact that php4 was "completely rewritten" implied there were some design patterns involved at the very least.
16:06
@Gordon do you go there again? meetup.com/phpugmunich/events/220171811
Hey guys, does PHP7 allow for overriding constructors in traits?
@samayo it uses the modularity design pattern, kinda
good morning all
people, please stop using traits
3
for fuck sake
@prograhammer why would you implement a constructor in a trait
16:17
@Orangepill Shits and giggles and/or adherence to the principle of most astonishment
Sometimes I declare abstract protected function __construct() in base classes just to make life more interesting
Glad to see the INTERCAL developers are here this morning...
@chozilla nope. am speaking at IPC that day
@Orangepill Glad you asked!
@DaveRandom if only you could throw a final in there
@kelunik I'm certainly open to changing the name if that's what contributors/users want. That being said my intent was to make it clear that this is the UA if you don't set one in the request. If you feel this intent is made clear with just OP_USER_AGENT I have no problem making that change
Generally I start out being over explicit
16:24
@Gordon ok, we drink a beer some day else.
@cspray I'm not sure either, that's why I asked. Let's wait until @rdlowrey is back to normal OSS activity.
@kelunik Sounds good to me
@Orangepill I think it's good to consider one trait (I call it the "dominant trait") to act in the place of inheritance, and therefore offer a "suggested" constructor. All other traits are subservient and are more/less copy-paste for boilerplate stuff (ie. Decorator pattern / delegation code)
This frees up the "extend" slot for a base class if needed.
@prograhammer but how helpful is "abstracting" out the construction of a specific implementation... and if you are doing much more then assigning properties in a constructor then things start to smell imo
I tend to follow the strict rule of only one trait that can be tightly coupled (act as main parent class) and perhaps an additional "base class" under some circumstances can be used. Never any multiple inheritance.
@Orangepill yeah, it's not smelly...
I don't do any more than bring in dependencies.
So the constructor just shows you what dependencies this "dominant/parent" trait needs.
It's like a note "hey I need these, use me, or copy me to add to your constructor"
16:35
@bwoebi It's certainly a contributing factor :P
personally I wouldn't do it that way if for no other reason then I wouldn't want to have to crack open another file just to see how my object is being created.... I would prefer to do the copy paste myself
@Orangepill a practical example would be I made my own Command class, but it requires you to supply a handler (if self-handling). It was originally an abstract class that you extend, but I converted it into a "dominant trait". Now I can use the "extend" for extending Laravel's base Job class, which effectively turns my command into job, giving me ability to "queue" etc. I probably could compose in the Job functionality, but I think single inheritance (plus my trait) is fine for this example.
@Orangepill But then I have to tell you in some docs what dependencies need to be brought in with the Trait.
@nikita2206 óÒ
@Orangepill so you choose, use some "docs" to tell you what you need to bring in to your constructor, or consider the trait's constructor a "documented suggestion" itself.
The Trait is going to use the dependencies regardless, so I'd like to have some "protection" that says "hey you need to bring these dependencies in or you'll get an error".
So you have to copy paste the docs between all instances that share the trait... I would just assume copy pasting the whole constructor as well... let the code be the documentation
16:42
Again, under the strict rule that only the dominant trait has a constructor (because it's acting as a parent class would, with tight coupling/etc). All other "recessive" traits should just be copy-paste help/etc.
@Orangepill Well the docs would just say "add this trait". There's no other copy paste?
In your case the docs would say "add this trait, oh and make sure you also write your constructor to bring in this dependency, and this one, and also this one".
@prograhammer stop using PHP traits as contracts, they are not meant for that.
@marcio the trait must be paired with an interface, so I'm missing your point.
@marcio Traits help meet the interface they are coupled with. No loss of "type".
I use an interface with the same class that also uses the trait.
@prograhammer if your trait requires something to work, then you're using it as a contract. But I'm totally against traits, so I'm very biased.
Sep 4 at 0:35, by marcio
user image
the funny thing is that you just said "I probably could compose in the Job functionality, but I think single inheritance (plus my trait) is fine for this example." up there ^^
@marcio all my classes have contracts. Using a trait just helps copy/paste to meet that contract. The problem is, if you use too many traits in a class you might have naming collisions and could be a smell your class is doing too much, SRP. So I have a dominant trait and any other traits I use they are just for situations where I want to decorate all the methods of some dependency easily, and then add my own additional methods (which are outside the trait).
@marcio See @Gordon 's answer here: stackoverflow.com/a/7893384/1110941
I'm just starting WordPress plugin development. What does the "__" function do?
16:57
"We could use aggregation/composition (like shown elsewhere on this page) to achieve the same resulting class, but the drawback of using aggregation/composition is that we will have to add the proxy/delegator methods manually to each and every class then that should be able to log. Traits solve this nicely by allowing me to keep the boilerplate in one place and selectively apply it where needed."
Anonymous
@Michael look it up.
@Michael something about strings if I remember, look up "double underscore" in stackoveflow
It's always used to output a string. Such as: __('You do not have sufficient permissions to access this page.')
HTML escaping?
@prograhammer Thank you.
@DaveRandom really stupid not to support android given the market shares
@Michael It's the "Here's a function to make you think you're outputting secure HTML so that you won't dig too deeply and remove the many, many, _many_ XSS holes that we've put in for you" function.
17:00
@Ghedipunk Thanks for clearing that up for me. xD
Glad to help. ;-)
Ah, it's used for translations.
@marcio I think developers need to have a firm understanding of composition and inheritance and coding to an interface before they should be allowed to use traits. I doubt anyone who is effectively using SOLID principles is going to misuse traits. PS. raptors aren't that scary, they were much smaller in real life.
Everything you know about velociraptors is a lie: todayifoundout.com/index.php/2010/07/…
Raptors were more feathery, too. Even T-Rex had feathers, though not all dinosaurs did.
@Ghedipunk yeah, basically ancient dinosaur turkey
@Ghedipunk which dinosaur is it though that more closely resembles the raptors in Jurassic Park? Something that starts with an "a" I think...
17:12
Not sure off hand... not sure where to look it up either. Most of what I know about dinosaurs came from documentaries.
@Ghedipunk @marcio actually, maybe the depiction in Jurrasic Park calling them raptors isn't too wrong. See this wiki pic of the "utahraptor": en.wikipedia.org/wiki/Utahraptor#/media/…
Calling them velociraptors is wrong though.
"Raptor" describes the shape... bird-like (specifically like a bird of prey... but not like a Klingon Bird-of-Prey class ship.)
The Austroraptor reminds me of Kevin from "Up"
@Ghedipunk You mean raptors can't cloak?
17:20
Only if they find foliage that matches their plumage...
Austroraptor, I think that's the one I was thinking
Stegosaurus lived 150 million years ago. T-Rex lived 65 million years ago. T-Rex lived closer to human times than it lived to Stegosaurus times...
@Ghedipunk you are liking a walking/talking dinosaur encyclopedia
Meh, I just collect useless trivia. That's why I like PHP so much, it's just so trivial...
^ ohhhh burn.
Hi
Can someone help me in my problem?
5 hours ago, by MRS1367
I face with Waiting for XDebug session (57%) from today
Hey guys which addon do you advice me for debuging php ? (chrome or ff) TY
Abe
Abe
17:46
xdebug
@Baldráni Xdebug with an IDE that allows Xdebug integration. Browser addon doesn't matter.
1
Q: PHP- Login system

smileI'm trying to make Login system to my project, but I don't know how can I check if the password that the user typed is correct. Login.php <?php error_reporting(E_ALL); ini_set('display_errors', 1); require_once("guest.php"); require_once("db.php"); $error = ""; global $tf_handle; $gb = new g...

@Ghedipunk Ok thank you guys I'll go check right away
@FlorianMargaine I imagine it's because they've had to make the filter thing for specific hardware, hence the reason they also don't support the iPhone 6 (while 4 and 5 are almost the same in terms of the case design)
17:48
@smile password_hash(). Stop trying to make a login system until you start using that.
i'll make it when i finish don't worry
:)
Catchable fatal error: Object of class mysqli could not be converted to string in /var/www/html/guest/guest.php on line 77
user924016
@smile you switched the params around
how ??
user924016
$check = $gb->email_exist($tf_handle,$u_email); // => ($u_email,$tf_handle)
user924016
see the function function email_exist($email,$con) takes the email first
17:50
yes
yeah :D
user924016
but you passed $tf_handle as the first arg
yes yes thanks
user924016
ah
this is the first error
user924016
no problem, now fix it to use password_hash before storing it, and password_verify to check the password
17:51
but still one more :(
user924016
what is the next one?
Switch to using password_hash() before you're finished. Rule number 1 of passwords: Never deal with the plaintext version in any way except to convert it to its hash. Immediately convert it to its hash. Always convert it to its hash. Never touch the non-hashed version of a password. This is my BIG soapbox and I will always shout from the mountain tops: If you're touching a password, IMMEDIATELY use password_hash() before ANYTHING else.
user924016
lol, cant believe you got so many answers without anyone seeing that
hahahhah :D
the next one is
when i try to login with any mail and any password it logged in !
:(
user924016
heh
user924016
17:55
on the line before if($chpassword) .. do a var_dump($chpassword); exit;
user924016
var_dump() all the stuff is a good way if you are unfamiliar with cowbow debugging
ok 1 sec
object(mysqli_result)#3 (5) { ["current_field"]=> int(0) ["field_count"]=> int(5) ["lengths"]=> NULL ["num_rows"]=> int(0) ["type"]=> int(0) }
Who here actually writes their autoloaders by hand?
user924016
Looks like $chpassword = mysqli_query .. did not return what you expected @smile
$chpassword = mysqli_query($tf_handle,"SELECT * FROM users WHERE email = '$u_email' AND password = '$u_password'");
17:57
@LeviMorrison I do; I can't stand PSR-0.
i need to SELECT * with the email and the password
can php does image processing? (I have two same photo, I want php tell me they are the same or not, is it possible ?)
user924016
@smile it does not return a bool (false or true) it return a mysqli_result object
@Ghedipunk just a note: PSR-0 is deprecated >> php-fig.org/psr/psr-4
@Ghedipunk And PSR-4?
17:58
i changed if($chpassword) to if(mysqli_num_rows($chpassword) > 0)
so you think what should i do ?
(For the record I write my own loaders most of the time)
(I hate composer vomit)
@Sajad if they are the same you can just use md5_file($image1) == md5_file($image2)
user924016
@smile no, because now you are checking for the password inside the db, and will not be able to use the password_verify function
@LeviMorrison what exactly do you hate in it?
@Orangepill I thought md5 is for password, but ok tnx, I will try it
18:00
@Sajad MD5 should never be used for passwords in this day and age.
@LeviMorrison Does PSR-4 try to force the module writers into a standard structure, rather than allow passing an autoloader that allows multiple projects to autoload without having identical file structure schemas?
@LeviMorrison yes it is not secure!
I've got a project coming up with a large enough domain model. We have to use Doctrine ORM. There is a little problem I have: Three or four of the entities do not live in the local DB, they live on a different server which has a REST endpoint. Does anyone know if you can override the Doctrine functionality for fetching and saving those specific entities so I can abstract the REST calls?
@RonniSkansing wihout password_verify how can it works
$chpassword = mysqli_query($tf_handle,"SELECT * FROM users WHERE email = '$u_email' AND password = '$u_password'");
it should be what ??
how can i type this line to do what i want ?
@Sajad it creates a hash of an input ... if the calculated hashes for two inputs are the same you can assume with a high degree of confidence that the inputs are the same.
18:01
you understand me ?
user924016
@smile why do you want to know that if you want to change it to using the password_hash and password_verify
user924016
yes I understand you
just to face many errors and fix it
@Orangepill yes it is a good way for comparing two photos, but I think It is good for two same exact photo, if they have just a bit different, it returns false, right ?
because how can it works in phpmyadmin !
and in script no ?>
that's strange for me
18:02
@sajad correct
now I need to aslo return true if they were look like (Similar) together
@sajad that is a much much harder problem
@Orangepill yes :-(
I need to a image processing
just tell me is it possible doing that using php ?
@Sajad GD library is a start... but what if one image is a cropped version of another? What if one is rotated?
@Ghedipunk em, I don't know, actually I want to compare some avator, and detect each photo is belong to which user
18:05
@RonniSkansing Strange right ?
@Sajad Possible? Yes. PHP is not the best tool for the job, though, because it is very data intensive, and there are libraries written in other languages that are already highly optimized for the work you're looking to do, with the benefits of being compiled.
@Ghedipunk all version are the same, and there is not any rotate!
user924016
@smile no
@Sajad If that's true, then a hash of the file will be good enough... But what about image scaling?
Sigh... PSR-4 autoloader examples: php-fig.org/psr/psr-4/examples
18:07
@Ghedipunk all scale are the same
Well, the class based one is pretty sigh-worthy anyway.
@LeviMorrison can you link an example of your autoloader, so that we may be inspired?
Then the hash of the image file will work. If they're not scaling, rotating, or translating the images in any way, then the bytes will be the same.
user924016
@smile did you fix it?
i changed the code to
$chpassword = mysqli_query($tf_handle,"SELECT password FROM users WHERE email = '$u_email'");
$retrievepassword = mysqli_fetch_assoc($chpassword);
if($u_password !== $retrievepassword['password'])
but same problem :/
user924016
did you var_dump($retrievepassword); ? @smile
(I'm joking about it in case you couldn't tell)
@Danack I don't have any examples of my autoloaders that I can share, but this sums up my reasons for not liking the PSR based autoloaders, and is the philosophy behind how I implement each module's preloader (the details are different): r.je/php-psr-0-pretty-shortsighted-really.html
Fixed
$chpassword = mysqli_query($tf_handle,"SELECT password FROM users WHERE email = '$u_email'");
$retrievepassword = mysqli_fetch_assoc($chpassword);
print_r($retrievepassword);
if($u_password === $retrievepassword['password'])
{
  $error = "Thanks for loggin , you will be redirected...";

}
@Ghedipunk yeah, I've read that and agree with it.....and it's the fundamental flaw in what the PSR people are doing. They aren't working towards inter-operability most of the time. Instead they're jut working towards a single common implementation.
18:13
@Ghedipunk But I don't think so, look, I have a photo on the server, and I want to put one photo front of webcam, now I want program tell me that photo are the same with what is opposite of webcam or not ...
Which is a different thing entirely.
user924016
@smile does it work now?
@RonniSkansing but can you tell me when it became boolean ... i mean why if($chpassword) doesn't work
user924016
because $chpassword was not true or false, it was a object with query result data
user924016
because it holds a value, it will be read as true
18:14
@Sajad Then you have scaling, rotation, cropping and color changes all at once. While technically PHP can do it, so can a Turing tar pit. You'll have much better results finding a library built specifically for that, especially facial recognition.
Just saw a User class with 37,298 LOC. It was in a Codeigniter project. For some reason I'm not surprised.
@Danack Yep. Focused on implementation.
Also, why on earth does an autoloader need another standard?
@RonniSkansing because it holds a value, it will be read as true ....as you said so it should works as if(true) ?
user924016
yes
18:16
PHP itself gives a really flexible autoloading standard: here's a class name - load it or don't. Whatever.
user924016
but not any value is true smile .. but any object is
Did we really need two PSR documents for this?
Did we need one?
@Ghedipunk aha
I like that the PHP-FIG group is trying to solve interoperability problems. But they're not defining interfaces, they're dictating implementation.
18:20
@RonniSkansing the query like SELECT etc it will return object ?
user924016
@smile have you read the manual? I really encourage it. There you can read about what functions/methods return, it is not the query, it is the function executing the query.
i think i understand now but i will read it Thankssssssss :)
18:36
@LeviMorrison I actually had people in my workshop (code review for security) actually ask how this worked: github.com/ircmaxell/CodeReviewSecurityRepo/blob/master/…
I guess our transition to PSR(0|4) is complete...
yay, completed Portal 2
btw, is it just me or Valve has some issue with number 3 in general
@smile learn to use prepared statements, please
^ that has a nice ending music
you mean portal 3?
portal 3, half life 3, team fortress 3
Portal's story was written into a corner. There may be a game with portal guns, but there won't be a Portal 3.
@Ekin also, I actually liked ending song for the first Portal better ... maybe because it was so unexpected
I heard like they might release Portal 3 and Half Life 3 together
...under a single title
someone on reddit said that
"as they both share the same universe"
@Ekin "Portal Life 3.14159"
haha
@tereško yep I played the first one twice just because of the song
then did the same for the 2nd, but that was because portal 2 was the only game I could run on my linux at that time :p
I played the fist portal twice too, but that was to get the developer's commentary, because I am still interested in game-dev
"Gordon Freeman will eventually need to get closer to Aperture Science, to get to Borealis" - so maybe at a point the player will receive a portal gun to trigger the Portal mechanics in Half Life 3
^ sounds pretty interesting to me
18:46
I don't think there will be HL3 game
user924016
wtf is a (binary) 'string' aka b"foo" ?
@RonniSkansing legacy for PHP6
(binary) === (string)
user924016
ah thanks man. That was confusing for a moment..
user924016
are they other strange string prefixes like the b".." ?
user924016
18:51
Is it a non bc break to remove it?
user924016
You can't remove it! There'll be no proof PHP6 ever existed!
PHP 6 ran great on Windows 9...
md5 is not a good way for storing password, so what is good ?
user924016
password_hash
18:53
@RonniSkansing tnx
@Sajad php.net/password_hash
@Ghedipunk and @ircmaxell thanks
what about php5.4?
18:56
ha that's great
twitter is down, and it makes me sad. My normal route for bitching about services being out is useless :-P
(BTW: Thank you for that great library, @ircmaxell )
indeed thanks
18:58
@Orangepill It's still supported for 12 more hours in my time zone...
@Ghedipunk no it isn't
@Ghedipunk We should really add timezone information. :P
ISO 8601.

« first day (1794 days earlier)      last day (3380 days later) »