« first day (1323 days earlier)      last day (3850 days later) » 
01:00 - 16:0016:00 - 00:00

16:02
@Jimbo np
@JoeWatkins Fair enough. The only danger I see is conflicting row versions then. That can be easily avoided by locking writing/updating operations. Am I missing something and therefore am completely wrong?
@NikiC A bit heavy :-D but nice^^
well there's is exclusion at the sql server end don't forget, the integrity of the data in the database is completely out of the hands of php whatever isn't it ...
so is down
@NikiC that looks like JavaScript :D
@BenjaminGruenbaum blasphemy!
16:09
it does a bit tho()()()
@Leri I think you just think there is danger, because threads ... you can of course work yourself into a jam in a few places in pthreads, but those problems that exist elsewhere just do not apply here, nothing is shared because shared nothing, safety is just implicit in everything you do ...
so use processes :D?
nothing is shared from the perspective of the user ... much is shared, obviously else it wouldn't work, but in the sense of zend/php, nothing can be shared because it would break everything ... so when you are working on a string you can make no mistakes, it's just as complicated as any other lanugage for pthreads to make it work, probably moreso, but for the programmer it's simple and you don't worry about sharing ...
Just to be annoying, C# does cross thread closures.
16:21
Multi threading is tricky.
If you are fine with writing functional code, then multithreading works.
But if you like having lots of side-effects, don't use multithreading.
@JoeWatkins Yeah, sure. I was not blaming pthreads for anything. Just pointing potential dangers in future/real-world. And pthread is capable to solve that problem pretty well.
we can't do that ... well ... we sorta could, but I'd have to patch some headers and, I'm not sure it's really worth it ...
Then again, there is a problem in PHP. You usually have multiple sessions of PHP contacting the database (what is the web application without databases).
You cannot simply check if value exists in the database, and if it doesn't, add it. This is prone to race conditions.
I don't like to imagine what a multithreaded codebase would look like if we allowed cross thread closures, it would be ... messy ... @BenjaminGruenbaum
@JoeWatkins right, because they're generations ahead of you, with php, that would be messy.
16:23
I'm personally against threads contacting, and if they have to contact, let them contact as less as possible. If you put locks everywhere, you get slow code.
@JoeWatkins You might be absolutely right. I ran in quite big troubles at first with threading. So I am 100 times more careful with code that uses threads/concurrency than with anything else. :)
@JoeWatkins PHP doesn't have concurrenct data structures for example, and like you said, it's shared nothing.
With C#, you can fire a thread pool that reacts to computations on a database query that's generated from code on the fly, then have it make connections itself, write data to a socket, query the database in parallel, and asynchronously, join all that data, make a remote procedure call for each, and return the result without writing the word "thread" once.
When php does that, I'll be a converted man :D
@BenjaminGruenbaum You're just playing, are not you? :)
Then again, I would argue that MySQL doesn't handle multiple connections as well. In any other database, you can easily make constraints, like UNIQUE, which usually handles the need to check, and add after that. But of course, MySQL has completely broken constraints. MySQL requires you to LOCK, or deal with race conditions.
@Leri No really, it actually can do that.
16:27
@BenjaminGruenbaum You know what I meant. E_TROLL. :)
@Leri :D not my fault your language is terrible :D
Multithreading is a tool, but PHP uses it incorrectly.
Shared nothing is obviously nonsense, because in most applications you have to store data.
not really.
You aren't going to listen for one connection, and wait until you process the connection you get. Usually, you handle multiple connections.
Shared nothing means they don't mutate data together.
16:29
@BenjaminGruenbaum PHP has not been my professional language for years. :) And it's pretty good for pure web stuff that does not go beyond request/response route. :)
most multithreading in practice is shared nothing.
@Leri sure, for database skins it works.
Good multithreading is shared nothing.
It's too easy to make mistakes when you share stuff while multithreading.
I've been playing freecell for many years, I wouldn't call myself a master of cards.
The problem is that PHP usually handles multiple connections, and there is database. It's easy to have a race condition when you involve the database (especially MySQL).
@xfix Depends how limited you are in resources, imho.
16:31
I'm for error handling on the database side, but MySQL constraints are broken for that purpose. Why people even use MySQL?
cheap, fast for short connection
PostgreSQL works quickly for me.
But this need for "fast for short connection" is another shortcoming of PHP's "shared nothing" in my opinion. In any other language, you can save the database connection between requests, because those web applications are long running applications, and not something that runs by request.
Unless there is some secret way to have long running database connection in PHP, but I haven't noticed any.
Off to home. Later.
And MySQL is not as cheap in resource usage as you claim. It uses more resources compared to other databases. Not that this really matters these days, as 1GB is minimum for the server (even if I use smaller server for IRC usage). Yes, it's on every single free hosting, but that is, I assume, by necessity (every single PHP script uses MySQL).
16:57
> Multithreading is a tool, but PHP uses it incorrectly.
citation needed, and it'll have to be really good ...
you know there's no point looking for citation, php doesn't use multi-threading, nowhere, in any code, on any operating system, does php ever instruct a processor to create multiple threads ... if threads are being used incorrectly it's because of the operating system and programmers using them ...
shared nothing does make sense at the frontend, threading doesn't, I have never, not a single time, created a thread in response to a web request in any language that supports it because that doesn't scale past the end of my face ...
and there's no magic or secrets, if you want a persistent shared connection and you're looking for a way to achieve that in an infrastructure designed to kill processes when they are finished with, and share nothing, then you are mad ... the way to have a persistent connection is separate out those parts that require said connection to a different process not restricted by the process or threading model of your server ... simples ;)
user4203923
Hi, what do you think about have a sub-domain for back end ?
user4203923
someone ?
@Tchi Don't
user4203923
so when use sub-domain ?
Different sites
> every single PHP script uses MySQL
Wut?
user4203923
17:07
but the sub-domain need to have a syntax like that : mysecondsite.mysite.fr
user4203923
in any case it'll contains the name of the principal site
@CSpray + @rdlowrey - why is the prepare method invoked via $exe($obj, $this); i.e. with a fixed second param of the injector? Why isn't it invoked with $injector->execute($exe); which avoids the hard coding of params.
@Tchi Different services, under the same domain.
If the backend relates to the main site, it shouldn't be in a subdomain.
Also 'prepare' is a rubbish name...it should be 'initMethod' or something.
user4203923
No
user4203923
17:10
I have a personal site and others sites
user4203923
and I want a back office to manage all sites / projects
user4203923
so what is the best choice ?
> Ok, I think this is very important question. I lose much more time typing than actually thinking about what code to use.
is that the biggest load of bullshit you ever read, or can you think of something that is a bigger load of bullshit ?
I can't believe people are actually giving the guy suggestions ... it's the biggest non-problem I ever read ...
Karma man
The rep of reddit.
user4203923
I have a personal site/portfolio and others sites/project and I want a back office to manage all sites / projects
user4203923
17:21
a sub-domain of my principal site is a good choice to create a back office ?
@Fabien but but .... but it's crazy ... if there is a problem, if you twist my arm and say "find a problem or I'll cut your face", I'd say well maybe the guy should think about code a little bit more, I've spent whole days thinking about a problem before typing a single character ... but I'd be doing so under duress ...
@JoeWatkins The servers start multiple PHP instances/threads.
Even if there is no thread handling in PHP, it usually is still ran multiple times at once.
@xfix they are nothing to do with PHP though are they and you made the statement that php uses threading wrong, but it can not, because it does not ...
@JoeWatkins I doubt he is at that stage of thinking yet though.
I'm aware it's not related to PHP.
But let's be honest, in most cases, the php-fpm or whatever server you are using is not configured to only run one PHP session at once.
17:28
@Fabien perhaps ... still I sad that "use VIM" is the most helpful thing, we as a community of developers, can say in response to the question ...
and also, I think 98% of the people who say they use VIM or emacs as their editor are probably lying ...
lol
I have never really used either.
@xfix you don't have to use fpm, php is powerful enough to write your own solutions to problems was my point, and if the process or threading model of the server and SAPI you are using is no conducive to your design then you need to use or design another, it's not so hard ;)
Are you suggesting writing your own server in PHP because... uhm...
@Fabien there's a strange culture around editors, like somehow you're not a serious programmer if you don't code in a terminal window and use a million impossible to remember combinations and shortcuts ... bollocks, I don't buy it ... nobody is doing that ...
@tereško Hey teresko, Is it fine to use more than one service in a controller to prevent code duplicating?
17:33
php -S exists, I know, but the PHP documentation says to not use it in the production. The web server written in PHP would be similar to php -S.
hipster coders Joe.
Except slower.
hhvm web server looks like it could be used in production, but hhvm is not official PHP.
@BenBeri yes it is fine. Actually a controller would usually be manipulating more then one service.
@xfix you should probably hang around here for a while ... forget everything you "know" and begin listening on basically any weekday ;)
@xfix are you trolling ?
17:35
@tereško Ok, but each service has a data mapper that contains a db connection. I used a DI container to always give the same db object so it won't make new connections per mapper - seems fine?
@tereško I'm giving benefit of the doubt, I can be wrong, I'm wrong quite a lot about people ...
If I would be trolling, I would create a language called Fractal, and make it completely insane.
@BenBeri each service manipulates multiple mappers and domain objects. For example a "recognition service" would deal with User and Group (or GroupCollection) instances. And at least one mapper per each domain object
hhvm sucks
6
@tereško I see, makes sense now ;P. I thought that a service only manipulates one data mapper and domain.
17:39
@AlmaDo yeah, we don't need to go into any more detail than that ...
why should we?
we shouldn't, we should pay it as much attention as we do phlangler, or whatever it was called ...
yep..
@BenBeri no. The point of a service is to contain a specific aspect of your application logic. And you application will have many aspects.
18:03
@BenBeri and yes, the mappers, which interact with the same SQL database, should share the DB connection ... of course not all mappers are mapping to a database. There are other forms of persistence too: cache, nosql, files, session, cookies, remote resources (rest, soap) and etc.
18:18
@tereško I see, didn't know you also use session/cookies in mappers
I use mappers for interacting with persistent storage
18:39
@tereško Also where do you usually validating input as to check if they are null? Controller or domains? and how are you structuring your domains? set/get method for each variable?
in domain objects, if it is related to logical inconsistencies, and mapper (via exceptions), if checking for data integrity violations (like UNIQUE for emails)
and the validation checks are done outside of setters
instead i have something like isValid() for domain objects, which checks if object as whole has a valid state
setter validation gets extremely complicated when your business rules become inter-dependent: and extremely simple example of it would be checking for matching password fields
i see
But do you have getters / setters for each variable or you just do $d->variable = 'hey'?
Anyhow thank you for your time ^^
getter/setters
Wouldn't it be ghetto if you have like 5+ variables? xD creating getter/setter for each. but yeah direct access to variable breaking the rules, atleast in java but many in php are using direct variables
18:55
the alternative is either having direct variable access causes the encapsulation to leak or magic __get()/__set() methods, which will accumulate extensive pieces of logic when you need to manipulate the values
and, if you have a lot of "moving parts" in your class, it is probably a good sign that it shouldnt all be in the same class
19:11
good mornings
19:23
hey guys :)

Im just starting now to programm php again and i never really set up a connections or something like this, just programming on already configured... How do I do it? :D (Im using phpStorm7.1 atm)
I just rent a free webserver by bplaced and created there a database. Neither do I know, how I do configure it there, because i normally use navicat or phpmyadmin
@tereško Let's say you have rewards for each user that has voted on your site, after user has voted, he selects # of rewards, after selection it gets sent to the server with an XHR request. You need to check: A) the number of rewards equals to the limit B) The rewards he selected exists C) if he can get the rewards. Where would you handle the B validation? outside of domain right?
I am not certain about your usecase, but the short answer is: kinda
you would have a RewardCollection instance, which you attempt to populate from DB
and then you check if the amount of selected rewards is equal to the available
.. well .. no .. forget that .. bad idea
Well I have a class which handles the rewards, it's a mapper. But I am unsure since you said most validations are done in the domain, but the domain has no relation with mappers. So i think i should do it in the service
> I don't know but my gut says "maybe"
19:34
@BenBeri why
@BenBeri the validation would be handles in a populated domain object or collection
why not have a RewardsProvider, if that returns invalid reward (Exception most likely) then, bam!
@DaveRandom Where do you find your peer brought entertainment from?
By which you mean "where do I get TV torrents from"?
Shhh NSA
19:35
@iroegbu you have just call it the AwsomeRavardInstentionazer .. the sarcasm would have been communicated better
I could set a variable in the domain with all of the available rewards i.e. $this->voteClaim->setRewardsCollection($this->rewards->getRewards()) and then I can validate in the domain, what do you think of that?
Danka
@BenBeri it makes no sense
no, that's like a mapper that returns reward given the picked reward
user924016
19:36
context =]
@Fabien You want an invite? It's ratio based but I have like 2TB of credits and if I invite you I can give you some
Wait, should a domain have instances of mappers?
Hmm. Ratio based, what's that mean?
@BenBeri no
@Fabien Meaning you have to seed or you will not get more torrents today
19:38
@DaveRandom I'll pass. My upload is like 30kb at best :(
Cheers though
Ask me again when(if) Fibre arrives :P
@Fabien I can give you 20GB of credits, so it would be at least a bit worthwhile.
@BenBeri since I don't know what exactly is your application about, the best practical advice I can give you is: make it work, them make it suck less
Well my app isn't big, basically it provides site links to vote on, once user votes on these sites, they send a callback that adds his vote to the db, so the system knows he voted. So once he voted on all, he can click claim which leads him to a page where he can select rewards. Lets say the reward limit is 5, so he can only select 5 rewards. Then he has to click claim again which sends an XHR request, this request should add the rewards to the db, so I need to validate the rewards he selected.
And then my java game server gathers the rewards and does w/e with it.
@dave don't you need them?
I have 2.2 TB, I think I can live without those 20GB
I'm not entirely clear on how I ended up with that much tbh, I used to submit quite a lot of torrents when I used to have usenet but even so I'm not sure how it got quite so ridiculous
19:46
Lol. Yes please then.
You use proxy or anything btw?
I don't see the point, most of what I dl is TV because I usually pay for movies and music, NSA don't really seem to give a toss about TV
Furry muff
But why is it that bad to directly checking that in the service?
I do still run peerguardian but that is probably of dubious value these days because the list are like 3 years out of date or something
@BenBeri because it seems to be something that you would describe as "business rules"
19:55
I see. How about creating a rule class and inject the needed data to it using a mapper? The purpose of that class would be validating the business rules for the claiming method. Well I dont know
20:11
wut
20:29
Cheers @DaveRandom
20:42
btw @Fabien I get the more niche UK stuff from tbz, tvt is better for international stuffz although there is still a good UK presence
Well previously I just used torrent.eu which sufficed for my needs.
Assuming this is a step up
The ratio-based sites always have better content and better speeds in my experience
I remember when I used to rapidshare everything
Back when katz was alive
@Fabien That one must have passed me by
20:56
Katz was basically the torrentz.eu of file storage websites
@SecondRikudo if you read my whole question (especially the last part) - all your answer does pretty much is agree with what my question says :P
@BenjaminGruenbaum Welcome to meta!
But yeah, I only canned through, I'll delete the answer as it adds nothing :D
@BenjaminGruenbaum "Can be easily found in documentation" and require a link to the appropriate docs?
21:02
@DaveRandom most languages don't have docs as good as php's
yay! we're good at something!
In reality that's probably true, but at the same time I have in my time answered a few rtfm answers for languages I don't know at all because I spent 30 seconds and found some decent docs
Maybe remove the "documentation" specification and loosen it to "freely available materials" or something?
That's quite open to abuse as well though, I suppose
You're usually busy on weekends fixing windows and such @DaveRandom
real windows that is
As indeed I have been doing today, but for once I don't have to get up in the morning
21:22
Slacker
@Fabien meh, I prefer kickass.to
blocked
BTW guys website idea.
A kickstarter that comes with a contractual refund if the project has enough money to pay it's investors back.
Remember the Oculus rift was kickstarted? Then sold for tons of money to AssBook? People were pissed.
If they got their investment money back they would be less pissed
Basically it's community driven investments with zero failure issues.
When you go to a bank for a loan for your idea they spank you for interest. This is basically community interest free loans.
Pay it back 'IF' you can.
If you can't, people who invested won't shouldn't mind.
foreach (explode("\t", trim($row)) as list($id, $aid, $progress)) { /* ... */ }
^ Arrrgh … You see what's wrong here?
21:39
it trimmed spaces and not the tabs ?
@bwoebi Is it that it's still too readable?
dat 2
lol
No, that's not the issue
look closer.
enhance!
21:44
The error is: Notice: Uninitialized string offset: 1 in php shell code
You see?
Oh hai guys, what's the best way of enforcing a status from within a specific set of statuses within an object? I've gone from a member array containing the statuses, to a Status interface and an individual object for each status like Paused and Stopped. These objects don't actually do anything though.
Also tried class constants for each status type, but didn't want to use reflection to iterate around them during validation checks
It took me 15 minutes to figure here that list($id, $aid, $progress) = explode("\t", trim($row); is the correct code…
^^
That's what happens when people try being too clever with their code ;)
Anyone? :P
@bwoebi I don't get it
@Jimbo So essentially what you are saying is "needz moar enum"?
21:55
@NikiC this. exactly this.
@DaveRandom What do you do at your old-new job now anyhoo?
mostly cry because of the number of times I have to write :: during the course of the day
self::cry()
@DaveRandom I'm using list() on each element of explode. On strings. And not list() on the string array explode returns…
heh
@DaveRandom Better use static::cry()
21:57
@bwoebi oh right yeh I see it now
@DaveRandom Yeah! What would you do
The fact that I didn't immediately see that only reinforces my opinion that foreach/list is a bad idea
@Jimbo Well usually what I do is constants, a private array and a setter with isset
@DaveRandom that's what I didn't see either immediately. :X But it isn't a bad idea, you just have to be clever enough to master that syntax :-D
However @cspray did something that you might be interested in if you literally hate youself
let me find it
^ that
@bwoebi If I have to stop and think, it's a bad idea
@DaveRandom How's the private array work? Just consisting of the constants?
22:02
@DaveRandom think what you want.
@Jimbo Usually I end up wanting to have something like 3v4l.org/oPvg6
If you don't want the whole string translation business then it's kind of messy
And let's be honest, that's not exactly clean and tidy...
@DaveRandom :P
True typesafe enums don't really fit in PHP. I think there's ways you could make that particular library a little more friendly but the hurdles aren't worth it for what you're getting.
I disagree. They aren't that useful in quick-and-dirty PHP mode but when you write real OOP enums are just as useful in PHP as they are everywhere else
That may be so and with an idealized language I agree with you
However with PHP I think the hurdles aren't worth it
Just write up an abstract class with constants and be done with it
That particular library you could swap over to use nikic's PHPParser, precompile the enums in a build step and then just have classes in a file like you would use like anything else.
It's the type-hinted range check I want (that's the whole point of using an enum, I guess)
22:11
But, it still feels hacky
I haven't actually used that library so I'm not even sure how it would really work out in any kind of real application
I'm pretty certain there's no possible implementation the current state of PHP that would be usable in a real world application
user895378
@Danack I completely disagree. A class method named initMethod(). That's as rubbish as a name can get? Injector::prepare exists specifically to prepare objects after instantiation. It allows people the opportunity to do hacky framework things like setter injection if they insist on avoiding clearly preferable constructor injection.
user895378
As for why the prepare method is specifically passed the injector ... I don't really see any good reason not to pass it. Convention over configuration seems more sensible in this case to me.
user895378
@Jimbo Spl is stupid.
user895378
22:15
And you have to install a PECL extension to use that.
I didn't realise that. That's crap.
Yea, my library you only need eval!
;)
I saw this:
$cls = new ReflectionClass(__CLASS__);
        foreach($cls->getConstants() as $key=>$value)
        {
            if($value == $const)
            {
                return true;
            }
        }
@rdlowrey I actually like that the preparer method is passed the injector. You may need to make things to inject into the setter.
user895378
@cspray Same. I think @Danack was suggesting that if someone wants an injector they could just typehint it and let auryn provision the argument automatically, though.
22:17
@DaveRandom So basically what you're saying is I should improve Setty to where it makes you not hate yourself and corner the niche typesafe enum market?
@rdlowrey Ah
user895378
Which is true, I guess.
user895378
I don't really care either way.
Well... my only argument against is I can't think of a reason not to pass in the injector and adding a provision step where it doesn't seem to be needed could degrade performance
class Foo {
public function bar(MyEnum $enumVal) {}
}
class MyEnum extends SplEnum {
const FOO = 1;
}
$o = new Foo;
$o->bar(new MyEnum(MyEnum::FOO)); // *really??*
have been watching "Da Vincis Demons" ... first three episodes seem quite awesome
22:19
@DaveRandom Yea, I don't like their API either
Ah I remember watching a trailer for this series. Seemed a little cheese.
yes, yes it is
but it's fun
hunting it down now
You find it on kickass?
Season 2 is. Season 1 has a torrent but the size of the videos is too big for my connection.
Or it's Indi
Actually nm. the mp4s are okay. Cheers @DaveRandom
22:32
@Fabien That's because it's a full season torrent, but you can set all but ep 1 to not dl if you only want the first ep (obviously)
It's on American netflix apparently.
Yeah, I've set it up for first one.
How does it know what I have upped?
your client reports it to the tracker, and it's hard to game it because everyone else's client reports dl to the tracker as well so if it doesn't balance it will get flagged
Finding peers still. Longer than usual.
mp4 torrent has 124 seeds, if you're having issues it may be you ISP blocking it in some way
Damn ISP fuckers.
22:37
I'm go grab a shower, bbiab
ja ne
22:50
@rdlowrey I meant that the 'thing' would be called 'initMethod' and so then you would have 'setInitMethod($classname)' when setting up the DIC, and 'getInitMethod($classname)' . Currently the function that sets the 'prepare' is called just 'prepare' which is a verb itself, rather than 'setNoun'.
@rdlowrey And yes, currently every preparer (also better than prepare) method has to be coupled to Auryn, which seems better.
/cc @cspray
@cspray The scenario I'm thinking of is: i) People currently have legacy code. ii) That code currrently requires an init method on an object after it's created iii) They would like to move to use Auryn without modifying their existing code.
If the preparer method isn't hard coded to have the injector as the second param, that is no problem. If they have to modify their code to accept the injector - that's a massive problem.
Anyone who is writing new code that uses wouldn't (shouldn't) be writing code that requires a 'prepare' method - so the main point of having the preparer setting is to support legacy code, but that's self-defeated by hard-coding the injector as the 2nd param.
I ptu too much mayo in my tuna mayo sandwich, so I had to add more tuna. Now it's got a thicker middle than bread.
I don't know why I am telling you this, no one cares.
@cspray To be explicit: "You may need to make things to inject into the setter." If you need to do that, then the injector should injected into the class to be used as a service locator. "Optional dependencies" is oxymoronic.
user924016
I care
user895378
23:25
@Danack Ah I see what you're saying. Although setInitMethod still doesn't seem right because it's any callable, not just class methods.
user895378
This is how I use it (if I ever use it):
Yeah - setPreparer is slightly better - but I think we can do better than that still.
setInitCallable?
user895378
I'm okay with that. How do you feel about ... Injector::afterInstantiation or onInstantiation ?
tbh there's lots of other things that are slightly poorly named - I tidied up by fork and am going to submit and a novel describing it tomorrow.
user895378
Well, "poor" is in the eye of the beholder, of course ;)
user895378
23:27
But if your novel provides valid justifications then that's fine.
Hmm - then the methods would be 'setOnInstantiation' and 'getOnInstantiation'.....
user895378
I see no reason to have an associated getter for that. Justification?
@rdlowrey i'll send the PR tomorrow, will be a lot clearer than me post midnight.
user895378
Cool. TBH it's been forever since I did the original auryn stuff so there may or may not be lots of things that I'd change now myself.
Pecl extension in 3....2......1
user895378
23:32
Hahah F that. The increasing C-ification of slow userland framework things makes me seethe with nerd rage.
user895378
Symfony is a particularly egregious offender: "Hey we did something idiotic and slow but it's okay because we have an elaborate caching layer to lessen the idiocy and we've implemented it in C too!"
user895378
Of course, if you want to, go for it. I just wouldn't ever see that as a bottleneck in my own work. Maybe it is for others, and if so, congratulations because your app is super optimized.
23:57
@cspray to be even more explicit, if you do $injector->share($injector) then when Auryn executes any callable that requires the injector it will get injected as the appropriate parameter, which seems much better than hard-coding it to be the 2nd parameter.
01:00 - 16:0016:00 - 00:00

« first day (1323 days earlier)      last day (3850 days later) »