« first day (1313 days earlier)      last day (3860 days later) » 

13:02
is there a way to make if ($var) not throw a notice if $var doesn't exist?
@SecondRikudo @
@HamZa Anything that won't make me murder a kitten?
@SecondRikudo isset?
@HamZa The idea is to do something like this:
@SecondRikudo: if(isset($var))
13:04
$var = $might["not_be_set"] ?: "some default";
why this is true: var_dump(+INF==+INF); ?
@AlmaDo Any reason why it wouldn't be?
@SecondRikudo because both are infinities
you can't compare them on equality
@AlmaDo Welcome to PHP!
@SecondRikudo, $var = isset($might["not_be_set"])?:"some default";
13:05
otherwise, that "+INF" (same for "-INF") has different sense, not math infinity
but..
var_dump(log(0)); //-INF
@Arun That will make $var either true or "some default".
so it behaves like math standard limit..
But I want it to be either $might["not_be_set"] or "some default".
@SecondRikudo I saw this trick somewhere eval.in/155049
@SecondRikudo, YEah. So what you actually need?
13:07
@HamZa Hmm
@SecondRikudo reference is the best :D
That could work but it seems cumbersome to add a helper function for it...
Well, guess I've got no real choice in this one
now you're being picky :P
$var = (isset($x = $might['not_be'set']))  ? $x : "defualt value";
?
even worse, var_dump(+INF!=+INF); //false - like they're exact values (physically, they are, INF is just a bit, which is set in float numeric - but from math sense it's crap)
13:08
Don't know if that'd work with the $x, just a guess
hey anyone suggest codeigniter latest hmvc auth module
I see tank auth update jan 2012, github.com/Abban/Tank-Auth-for-MX-HMVC
so is there any latest one to use?
@Jimbo syntax error, it seems you can't do an assignment in isset()...
@AlmaDo yup, in math: ∞ NE ∞
Well bootstrap is a lot cleaner.
@HamZa Worth a try :)
13:10
@AlmaDo Thank god that INF==INF
@gowri Wtf I don't even...
NaN!=NaN is a disaster
@CSᵠ in math you should result in +INF != +INF and +INF == +INF both false
@NikiC why?
@NikiC no, it's quite what it should be
@Jimbo: wtf ?
lol
13:11
@AlmaDo It means that NaN always needs special handling - in many places. Mostly it's just ignored because it's used rarely
lol. It's not. var_dump(NAN==NAN, NAN!=NAN); //false, true
Almost the batman theme tune.
why second is true? ... Oo
simply saying, two "NAN"'s are just non-comparable
but they are.. crap
The second one that needs special handling is 0.0 == -0.0 of course, while at the same time 0.0 and -0.0 being distinct values :(
watman
13:13
@NikiC it terms of bits -0.0 is not same as +0.0
@AlmaDo Yes, that's the problem ;)
two different values, but comparing equal. Good in some cases, nuisance in other cases
@Jimbo, sorry bad in abbr. so what people using for auth now. don't see any good module system for codeiginitor. sparks also very old
the problem is in "leaky abstractions". So we let physical structure to influence on logical result. I think math behavior would be much clearer (example, NULL for DBMS which is truly non-comparable)
hi, @ircmaxell
13:14
@gowri Honestly? Recommend another framework - CI is full of bad practice and is way behind the crowd
Choose a framework with an LTS (long-term support) release :-)
well, I know why it's so (even without looking into PHP source) - since PHP will use some standard way to compare floats, no matter what they are (inf or nan or regular values)
yep! sounds worse after choosing CI
but.. crappy
@tereško ^ This makes up for the slightly crappy dub.
I hope Attack on Titan Season 2 comes soon.
13:24
@Fabien Same, but unlikely.
My bet is that they'll wait until the manga finishes.
I'd be surprised if they don't drag it out and filler it
Consider how well received it is.
But the anime is significantly better than the manga.
Do you watch the slice of life stuff?
@Fabien Nope
I recently finished Elfen Lied
I'm surprised you hadn't watched it before tbh.
13:27
@Fabien Yeah, me too.
It was horrible though :X
lol.
I liked it. Good soundtrack
The only part where I really had a hard time viewing is when those kids beat the dog to death.
Then the difficulty immediately relieved once they turned into cubed tomatoes.
I can pretty much watch anything without being affected, until the moment when they beat/kill animals,
That's pretty much my limit
@Jimbo di container usually would be a replacement for a factory
@Danack you shouldn't. I would instead pass the request abstraction to the controller.
Disgusting image of Spielberg on hunting trip. Very disappointing. http://t.co/kW8MeNeVyG
@tereško like:
1 hour ago, by Danack
public function TestController {

	function __construct(Request $request, ServiceFactory $serviceFactory) {
		//copy the params to internal
	}

    public function indexAction() {
        $value = $request->getValue('foo');
        $service = $serviceFactory->create($value); // $value is decided right here in this controller method
    }
}
13:36
I thought manga is always better than anime :\
@Danack that sounds terrible
IKR
and service CTOR: public function __construct(AnObject $obj, $value);
@tereško constructive feedback as ever. Thanks.
well .. I am not sure how to articulate why it is terrible
@tereško Because you arbitrarily create services based on user input?
13:39
at what point you would use the Document management service instead of Authentication service, @Danack ?
Wat? For the record that's based on Jimbo's example, so I have no idea what you just asked.
do you know what "services" are?
It was a random name for an object that requires another object and a scaler value in it's constructor
@tereško Yes, though I'm not sure that Jimbos controller is actually a controller and not a service itself.
The scalar value comes from the request, but in order to keep this "service", or library separate from the application, typehinting for a Request object in it is out of the question
13:41
@Danack in this context, a "Service" is a component that is holistically responsible for a single ability or behavior of your app, it sits in the model layer.
Okay okay, forget the word service. Let's just use class. It doesn't matter right now where it is, just what is needed
Which is why it doesn't make sense that the Request object (and user input) get to choose what service is being deployed.
@SecondRikudo It's out of the question for a user to send up a variable to be used in a library?
@Jimbo Again, why would the user determine what class gets instantiated?
@Jimbo in a library, not as a library.
@SecondRikudo Not what's instantiated, what's passed into the object
13:43
I will just slowly back away to not get hit by the flying wheels of the train wreck
@Jimbo He passed it into the factory's create method, that usually indicates instantiation.
@tereško Slowly backing away won't save you!
@SecondRikudo That was actually my code... but yep
Also, listen to the video I linked above ^
@Jimbo Ergo, it doesn't make any sense to create an object directly based on user input.
The only place where that should happen is the Router, and even that is in a whitelist, and not a blacklist.
@SecondRikudo No no, this has nothing to do with instantiating a specific object depending on user input
i.e. You specify allowed routes beforehand, and match the user's input against those.
@Jimbo So the code sample doesn't do what you tell us it does.
Make a better one.
cc @Danack
13:45
@SecondRikudo Wut? Scroll up, the explanation has more to it :D
Okay. I code an object, without a framework. This object has: __construct(AnotherObject $obj, $userSuppliedValue);
@Jimbo Yeah
So the $userSuppliedValue isn't deciding what object is instantiated, it's merely a scalar value to be passed in from, for example, a POST var sent in
(after being sanitized etc)
Wow, I found good content on Reddit:
13:48
@NikiC No way!
Didn't even know such a thing was possible :D
It doesn't really matter - the fact is that the value is arbitrary and is not known at compile time.
@Jimbo Okay... The point?
It could be from the result of an API call, but I don't want the API to be anything to do with my library, so I'm not typehinting for the api object in my thing. They're just separate
So the point is, I'm trying to use Auryn DiC to typehint for the MyObject with the above constructor
Of course, the $userSuppliedValue which is retrieved from elsewhere doesn't exist on automatic object instantiation
Hence, a factory is required, but all it's doing really is passing through variables
hey peeps
13:51
@SecondRikudo You understand?
@Jimbo $injector->defineParam()
@SecondRikudo The param is not known at compile time, so not known in my bootstrap
@Jimbo When is it known?
@SecondRikudo Just an example, but when a user makes a POST request to the controller
It's a dynamic variable
13:52
Or when a request is made to an API which then retrieves this variable
heeeeeeeeeeeeeeeeeeeeeeeeeellllllllllllllllllllllppppppppppppppppppppppp
It's just separate from anything else - that's not known at compile time
12 messages moved to bin
> This user has been automatically suspended for posting inappropriate content and cannot chat for 4 hours 59 minutes.
> And if you're wondering: Yes, this feature is about as stupid as it sounds. I assume that it'll be deprecated sometime "soon".
13:53
PHP don't take no shit
why not do that :-)
@Jimbo Will the caller know it? The guy that instantiates the object?
0
Q: how to pick record from a query that has distinct and use of case in sql

GotalovePHPI have a query that i want to pick employee pin no,Employees SurName,Basic_Pay,House_Allowance and transport where the payrollcode matches code say 'P137' for our example. Select distinct Employees.PINNo, Employees.SurName + ' ' + Employees.OtherNames, tblEmploye...

@rlemon Each accepted flag adds 30 minutes, I believe.
how do I get 0 instead of null value
13:54
@SecondRikudo If it's user supplied - they won't know that it's doing any class stuff unless they look at the code, is that what you mean?
yup
For example, I might need the current logged in username (or the one making the request)
@Jimbo I mean that the controller needs to get this information from somewhere.
@SecondRikudo Yep, possibly the Request object
But I'm not wiling to typehint for Request in my object and get it out that way, because it knows nothing of my framework or any sort of request
@Jimbo Okay, but you don't want to pass a request object, because you only need something out of that request object.
13:55
@ircmaxell I think there even was some ML discussion on it already
@SecondRikudo I guess, hence a factory is a sort of mediator. That I don't like.
If I remember correctly, it ended with Yasuo joining in and ... yeah well, Yasuo joined in.
I think I went on earlier about a sort of delayed instantiation for objects with undefined scalar values
You want to pass in $userId or whatever that was passed in the POST which is relevant to that action.
13:56
wow this is the most active chatroom yet everyone is totally ignoring me.This blows!!!
@SecondRikudo As an arbitrary example, the point it a lib I've made simply takes a scalar value as a required ctor param
@Jimbo The thing is, the caller needs to know your value.
The caller can be a factory, it could be the bootstrap.
@SecondRikudo The value comes from somewhere else that my library is not going to rely on, that's all
So I guess the factory example I gave is one way
I understand the problem, that problem can only be solved by a common interface.
i.e. some sort of Params object that gets populated with what you need.
@SecondRikudo You mean you need to have some code that knows about the request object, extract the var from it and is then able to pass that param into the constructor of the object that requires it?
13:58
@Danack That's right.
> Also recommend avoiding mysqli, as its a dated procedural way to code
...
Bzzt! Wrong!
That's usually the job of the factory, where all the crap and switch/cases are abstracted away from the main code.
Factory is allowed to know what it needs to create the objects, right
@SecondRikudo That's exactly what the code I posted does?
@LeviMorrison can you help me with an sql prob plz?
13:59
@Danack That's not what implied from it.
What I understand from the code you pasted is that you create a service which is named $value.
@GotalovePHP If someone wants to help you they will. Please don't ping people randomly.
^ That's not at all the case :)
@Jimbo Well, that's what I understand, and what most people who understand OOP patterns will understand.
Although I think that's a possible one anyway
@SecondRikudo No, no, no. The factories not a servicelocator.
Can someone help me with looping through an array?
14:01
@LeviMorrison I almost want to argue it, but I don't. Mainly because MySQLi's API does suck
@Danack thanks
PDO's isn't much better
I have a directory Clients containing two other directories for torrent downloads: Transmission, Azureus or whatever the latest clients are called. Depending on a value provided by a user in their 'dashboard', let's say they provide Transmission in a form - the DiC will use this as a directory path before going through the common interfaces to get the data from the respective torrent client
Dont mean to be annoying @Danack which room would best suit my sql query if you know please
@SecondRikudo (this is for you and the above post :P) Of course it's all secure and only one of the two can be provided, maybe a dropdown etc, but it's possible. Polymorphism via a user-defined variable, client-side, with all the validation etc of course
14:03
@ircmaxell Yeah,functionally it has more capabilities than PDO; if you need or want them you need to use it anyway.
Anyway, that's not what my issue was here.
"Your recent moderator chat flag was declined" WTF
If I had a record of that I'd go meta it :P
@GotalovePHP I can't at the moment; walking out the door.
See you guys later!
@LeviMorrison kul thanks anyway
@LeviMorrison well, if they didn't abuse references, I wouldn't have a problem with them
@Jimbo Generally speaking, you don't want your controller working with strings directly.
Only the very edge of your application, the part where the actual "computation" happens, should deal with scalars.
14:06
@SecondRikudo by definition, your controller is "on the very edge of your application"...?
@ircmaxell Not really.
Well the 'meat' is the business logic
Before the controller there's the Router, and before that there's the bootstrap.
Why does this only return one row but the number of rows shows 777?
$array = $result->fetch_array(MYSQLI_ASSOC);
foreach($array as $key =>$value) {
echo $value;
}
Router is the one that deals with strings on the one end, on the other end, there's the smallest parts of the Model, and then eventually, obviously the Model selecting templates.
/me shakes head
@ircmaxell I'm open to criticism, especially from Papa Anthony (I'd say we have Uncle Gordon, so let's settle for that :D).
What do you think the workflow should be? Why would you need to deal with strings in your Controller?
@Travis you need to continually call fetch_array to get all the results, until it returns false.
@SecondRikudo In Silex you get the current user by SecurityContext::getToken()::getUser()
What if I wanted to return that user to the twig template being rendered?
@Danack while ($row = $result->fetch_array(MYSQLI_ASSOC)) {?
14:11
@Travis something like that, yes.
@Jimbo Let's ignore the blatant use of static, you'd have the view acquire the user object from the model, and then toString it into the template.
For simplicity I would:
public function indexAction(\Twig_Environment $twig, SecurityContext $sc) {
    return $twig->render('template', array('username' => $sc->getToken()->getUser()->getName());
}
With getUser() returning an instance of a doctrine Entity I guess
getName() returns a string
String in the controller
@Jimbo You should have stuck with the previous example.
@Danack I know, the silence speaks volumes..
@Danack Any thoughts on that delayed stuff yet?
"A disturbance in the force, as if a million people face-palmed at once, and then were suddenly silenced".
14:17
:D
@Jimbo Yes. I need to get my arse into gear and finish up a massive PR I have outstanding for Auryn, to split the huge and fugly provider class into the actual injector and plugins that store information about what should be instantiated where.
Doing the delegateParam stuff would be trivial once that is done.....so I ought to get that done.
@Danack Please do, I've given three talks now and they've involved the awesomeness that Auryn can provide - so hopefully it should steadily be gaining interest
I can't see any real reason not to support delegateParam() or more likely delegateScalar() - although they are close to (effectively) being global variables it sounds rather useful.
14:23
5 messages moved to bin
> because of a cyberattack that compromised a database containing encrypted passwords
Better call the cyberpolice.
Thanks, Obama!
> containing encrypted passwords
Oh already quoted
Hello All, I uploaded a cakephp application on a new server. but DNS is not defined with that server. How can I open that page on browser?
14:25
Amazing isn't it.
Excuse me, but you should connect me with mr. President. No. This can not wait. The Internet is not working!
@SecondRikudo doesn't mean they weren't hashed. You're talking about a press release from a marketing department
@ircmaxell Yeah, I know, but still :D
Out of interest - can people tell me downsides of using an autowiring dic like Auryn? I haven't seen any. The reflection issue is a non-issue as the reflections are cached. I thought that in a massive application it might cause problems but someone said it would make it easier. Are there any downsides?
$pedantic++
14:26
@tereško I actually lyk it thea.I love PHP but you guys are harsh
Sigh eBay has one of my good passwords too :(
@Jimbo If you know what you're doing, nothing much of an issue.
The problem starts when you make a SL out of it.
@Fabien Google "LastPass"
@Jimbo It causes a huge rise in dick jokes?
NTTAWWT
@SecondRikudo I know lastpass but still. Not a big fan of 1 repo for all my stuff.
@Danack WTFINTTAWWT?
@Fabien Meh, it's better than trying to remember all of the passwords yourself, and sure as hell better than using the same 3 passwords for everything.
You could always use Password Cards
Google "password card"
14:29
I used to use them
@SecondRikudo "Not That There's Anything Wrong With That" - as in, "So, I heard that Bob likes to wear womens underwear at the weekend, NTTAWWT"
Why do we not have some form of OO IO implementation?
procedural functions for streams are so annoying
@hohner Make/Find a wrapper.
Make them OO by wrapping the function calls or something? :
that's what I'm doing - I just wish there was some kind of SPL alternative to invoking procedural calls
14:33
@hohner Why are they annoying?
I can't easily retrieve state from a resource
I have to go to the docs and spend 2 minutes finding the right procedural call
Thank you for your input. We value it a lot.
Hello, I am half-way through writing a question about class design, but I'm worried it's a duplicate and was hoping I could get some advice here. Basically I'm sure this question will have been asked before, but I don't know the correct terms to search this question out.
^ jusk ask
@tereško no worries!
14:43
Q: What are you most glad for as a dev? A: That I don't have to touch wordpress.
Thanks :) I'm trying to figure out the best way of implementing meta-data in classes, e.g. class CarPart has property weight, but I want to specify that weight is a required value, has a maximum allowable value, must be a float value, will accept values to two decimal places, etc. Is there a term to describe this?
@hohner using classes does not make code OO
@ircmaxell Oh yeah, bind_param is the worst... ugh.
^ I'm victim to that.
14:44
not using classes does not make code non-OO
Procedural OOP = POOP.
7
@568ml Sounds like you want a Value Object from DDD. Class representing a value, has some validation in there
So class CarPart will have a Weight object in there. Else, just have validation in setWeight()
@LeviMorrison Apart from the obvious, 'no-one wants to touch it' do you know of any reason why someone hasn't added a bind_param replacement that doesn't use references?
in a way I agree with @ircmaxell's concept: there's no pure OOP. It's always somwehere in the middle (after all, no matter how many abstraction layers do you have - you'll have to start from somewhere, so entering point will be "procedural" part at least)
Congratulations @ircmaxell. Apple dethroned by Google as world's most valuable brand :)
14:46
@Danack Fortunately in 5.6 there's no need to worry about it for the most part; ... fixes it nicely.
@ircmaxell I know, but IMO encapsulating responsibility is. I just find arbitrary procedural calls which modify a resource a bit chaotic
@Jimbo thank you very much for your help :) I take it that something like that is generally considered 'good practice'? (i.e. are there any hidden pitfalls to look out for/plan for?)
@AlmaDo There's always a main() function.
That main function (or the bootstrapper) should be the only procedural part of your application.
Ideally.
lol @ main wtf
14:49
(:
@568ml Not really, just make sure each object has a single responsibility and use Dependency Injection
btw, there's no equality "OOP" = "good" and/or "Procedural" = "bad"
@hohner ... mysqli can be used either as a resource or as a class. What's your point?
Oh wait
You are talking IO in general, not mysqli >.<
@Jimbo ok great! Thanks so much for your help!
ok, later. home run
14:51
@LeviMorrison "Write bad code, wait for the language to evolve to make it okay code" I like that style.
lol
I've said it a lot but avoid using references, please.
@SecondRikudo whole-heartedly disagree
@ircmaxell I agree with your definition of OO, but it's also about the communication of messages (Alan Kay)
@SecondRikudo why should it be a "function" ?
14:57
Can we elaborate on this bootstrap procedural stuff?

« first day (1313 days earlier)      last day (3860 days later) »