« first day (663 days earlier)      last day (4285 days later) » 

7:05 AM
Salutations
 
Sem
@deceze Greetings sir.
 
hi there
 
Sem
@deceze Could you tell me why I would want to use set_exception_handler instead of a try{}catch{}?
 
@de ceze
 
Sem
@webarto :D
 
7:06 AM
What a warm welcome today... Nothing going on?
 
come on Sem, let the man have his coffee (or other vice) first :P
 
> Sets the default exception handler if an exception is not caught within a try/catch block. Execution will stop after the exception_handler is called.
 
@Sem if you want to override the default behavior of "oh an uncaught exception?! BAIL!"
 
If you intend to catch the exception and continue, set_exception_handler is not what you want.
 
if(!isset($inquiry))$inquiry = new owiInquiry;

Netbeans complains that the first use of $inquiry might have not been on an initialized variable.
 
Sem
7:08 AM
@deceze I see, pretty obvious thanks :)
 
It's only the very last resort to customize how exactly your app dies in the event of an uncaught exception.
 
ugly code I must say ol' chap
 
AFAIK that is the proper PHP way to do this, no? (I'm using a very simple custom templating system here)
 
Sem
@webarto If I knew you were around you would have been the victim :D
 
since 6AM (3h ago) :P ... but I'm no page 2 user of Stackoverflow...
 
7:10 AM
@Christian Why don't you know whether $inquiry is set?
 
Sem
@webarto Some people stay in this chatroom forever, doesn't mean they're there though .
 
It's a template file. That thing is done for two reasons:
- make netbeans think $var is of type SomeClass
- in case it has not been set, use a default instance
 
Ok, I'll ping every 15 mins...
 
Sem
@webarto sure, goddamn these chatmessages being sent on spacebar
 
creating an object in a view file
is always wrong
(ok, well not always, but....)
 
7:12 AM
@Corbin Geez, having a PHP file shouting "not an object" a couple thousand times is better?
 
you are mixing Views with Templates...
 
@Christian if you're going to default construct it, you can do that before it hits the template
@webarto templates and views are largely the same concept
 
Sem
@webarto So many nubs are. Like moi.
 
@Corbin No. Doing it elsewhere implies a web user can access this file and cause unnecessary errors. Of course, I'll be making sure the file was included correctly, but there's still the class / typehint issue.
@Corbin Then again, this is not MVC, and I won't even want to hear about switching to that BS.
 
i must be misinterpreting what this file is. this file is just meant to render data you've already set up, correct? if so, the file shouldn't be accessible by methods you don't control. (well, no file should be accessible by methods you dont control)
 
7:16 AM
@Corbin True. I'll be checking for a global constant else die out - the usual thing.
 
then you'll be controlling all paths to the file
 
If you figure out the typehint problem, I won't need this code.
 
i suppose it comes down to preference, but i wouldnt let myself not know what a variable was by the time i was echoing it
 
I do know, the IDE does not.
 
netbeans supposedly supports /* @var $example Class */ to typehint
but ive never seen it actually work :(
 
7:18 AM
@Christian what if you have text editor? Why should IDE "know"?
 
@webarto Fortunately for me, I don't. :D
 
:)
 
@Corbin no, they are not
 
@Corbin That's for properties.
/* @var Type Description */
public $myvar;
 
i've read a few places that it works for variables, but as it does not actually work, must be so
 
Sem
7:19 AM
@webarto "Views query items from the database, loop through them and display each. Views can use filters to specify exactly what to load and have a layout engine that let you control the display." Is this the correct way to look at views?
 
IMO, once you have to start catering to the IDE with your code, you should switch IDEs... :-P
 
@webarto that's not the definition i've ever heard
 
@Lusitanian lemme get back through the transcript to find it
and morning all :)
 
Sem
@PeeHaa Goede morgen
 
@deceze I can't see how any IDE would know that $var in test2.php is actually from test1.php that just included test2.php after a lengthy condition.
 
7:21 AM
@Sem , it's in the correct direction , but badly worded
 
@Sem roflcopter, are you talking about SQL views by chance?
 
oh whoops, just realized i flagged the wrong person in my response. sorry >.<
 
Sem
@webarto wp-types.com/faq/… the source
 
@Christian And somehow I end up writing code without my editor knowing that, too.
 
@webarto , you have to understand that most people thing that "model" is database abstraction
 
7:22 AM
 
@deceze Again, just like the other guy: If you're up for the challenge, put up some code where your mouth is. ;)
 
@Sem , view acquires information from model layer (the HOW creates the distinction between MVC, MVP and MVVM) and then , if necessary, it decides from which templates to create the response . The response, which view creates can also be just HTTP header, or JSON, or XML
 
@Sem like @tereško said
 
@Christian IDE vs. editor code-off? O_o
 
@Christian you are abusing IDE IMHO...
 
7:25 AM
@webarto I'm simply passing a user object to an email template and making use of typehints to know that $user has ->name, ->surname etc..
I don't know how's that is abusing the IDE if its the reason I'm using an IDE in the first place.
 
@Christian , you have broken encapsulation
 
Of course, you can always use the print_r() approach to know what's going on...
 
@Christian I understand, but why don't you check if you are really passing an object in first place... you should be using anything more complicated then loops in templates, again IMHO...
 
@webarto That was the code I posted above? O.o
 
@Christian yes, but you said it was in template? dat code
 
7:27 AM
I'm using the object as data, nothing more.
If there's something complicated, such as calculating VAT, I'd have a method elsewhere that did just that.
 
Sem
@tereško Is there supposed to be a connection between a controller and a view?
 
@Sem , depends on which MVC-inspired pattern you use
 
@Christian calculating VAT? :D $amount * 1.20 or $amount / 1.20 ? :P
 
@webarto It's 18% here. You need to have it somewhere else ;)
 
@Sem in Model2 MVC the controller only sends the messages to view , which a goal to change the state of said view. In MVP and MVVM the controller requests data from model layer and then passes to view (with additional modifications, in case of MVVM).
 
@webarto :( Mankind is doomed.
 
In classical MVC the controller will be observing view for changes ( like mouse movement or events )
 
sometimes i hate that i code PHP.
 
Sem
@tereško So in MVP and MVVM the view acquires information from the model layer indirectly?
 
@Sem yes , in MVP and MVVM the view instances are passive
 
7:35 AM
web is hackish
 
no , web development is hard , especially if you specialize in end-to-end work
 
@rdlowrey I have no idea what could be wrong. Does you stream client verify ssl connections? And if so: how?
 
of course @tereško but frameworks selling lines are, make application in half hour bla bla... that is not development...
 
@webarto , that is not aimed at developes , but at middle management
 
hah, middle management developers :)
who originally wrote mysql_* canonical answer?
 
7:39 AM
@webarto , you can be "not a professional developer" and "not in management" at the same time
 
Sem
@tereško Somehow it feels better to say that the view acquires information from the controller, and that the controller aquires information from the model layer.
 
@Sem , in that case you might want to read about Law of Demeter
also .. you are saying that "view gets information from controller which requests it from model layer" sounds better then "view requests from model layer". Why ?
 
Sem
@tereško yes
@tereško Saying the view requests from model layer indirectly feels like $this->controller->modelLayer->getInfo();, which is personal ofcourse :) Which violates the LoD
 
seems like you did not understand
in case of MVP and MVVM the controller gets information from model layer, and then passes it to the view
 
Sem
@tereško Well I do, the controller only transforms information and thus is not a source to aqcuire information from.
 
7:51 AM
in case of MVC , view requests information directly from model layer
there was question about it just moments ago :
2
Q: What are the differences between MVC, MVP and MVVM?

paxdiabloFrom what I can gather, the first two don't seem that different. Whether it's called a controller or presenter, it still seems to have the same mediation functions. MVVM seems a little different in that the controller seems to be more of a part of the framework, such as with XAML bindings. What...

 
Sem
@tereško Do you know a book that explains multiple application architectures?
 
Question, why isn't get_defined_vars() a language construct?
 
I guess paxdiablo haven't had time to set his avatar... or he really likes that pattern...
 
How does it know the right context to check?
 
@Sem , nope , i dont
 
Sem
7:57 AM
@tereško And if I say introducing instead of explaining?
 
$a = 1;

my_func(); // $a won't be available here

get_defined_vars(); // but it is here
 
@Sem , nope
 
Sem
@tereško too bad
 
there are different publications floating around
you have to read them
 
@Christian "within the scope that get_defined_vars() is called." what is unclear? you want it to be global?
 
7:59 AM
@webarto A regular function called in the same scope is not able to get variables from that scope.
@webarto I think that the functionality of get_defined_vars() is misplaced. I think it should be a language construct rather than a regular function since it seems to do something not doable in PHP.
 
@Christian you called get_defined_vars() in global scope, your function operates in its scope, so you can say that get_defined_vars() operates in its function scope - 1 ... why not look at the source?
 
@webarto Great idea....if only it was easy to find as well as readable. If anyone gave pointers, I'd gladly look.
@webarto If you wrap it up inside a function, the same behaviour happens but $a won't be global.
It's like passing a variable through different scopes, javascript, for example does this by nature. PHP not so much though. And it seems the only exception here is this function.
 
8:15 AM
If it existed, would you use a PHP which was modified to fix stuff found in stackoverflow.com/questions/249664/… and phpsadness.com ? No patches would be accepted except if it fixes any of those issues.
 
Greetings
 
@AmigableClarkKant , you are not supposed to unittest private protected methods
 
@AmigableClarkKant I find phpsadness overly dramatic. Especially this is a pretty pointless complaint.
 
@tereško, excuse me, you are not supposed to unittest private methods? Did I ever say otherwise? :-)
About phpsadness, I didn't say they ALL had to be fixed. But for a fix to go in, it would have to be in the list/spirit.
 
I have click event on class .card. If I just create element with class card, then everything works. But when I create elements with that class after retrieving from database, click event doesnt work. Created elements are with the same class. What the hell? ^^
 
8:20 AM
is HTML valid in both cases ?
did you check ?
 
@webarto codepad.viper-7.com/pQKmmw see? It's not a programming problem, it's mostly a matter of principle.
 
@tereško Yup, checked in source code. Although I am using one custom attribute inside span tag, but it must be allowed in html 5
 
@DanielsPitkevičs , are there any errors in javascript console ?
 
@tereško No errors
 
i hope you are aware that "does not work" is not a good description of problem
 
8:23 AM
haha :)
 
@DanielsPitkevičs impossible
 
and .. also , this seems like a question for javascript room
 
@tereško Well, what else could I say, when click event does not respond? I added simple alert when is clicked and no alerts received.
 
@DanielsPitkevičs paste code, could be a syntax error
 
how did you attach the event listeners ?
 
8:25 AM
@Christian I understand... sort of...
 
Ok I will paste code
 
he is obviously not using jQuery, therefore the (no)errors...
 
@webarto , wanna bet
 
@webarto Why not using jquery?
 
sarcasm is incompatible with internet
 
8:26 AM
@DanielsPitkevičs didn't come out in engrish
@tereško there is a plugin for that
 
Good old $.sarcasm()...
 
You guys are hilarious. I am going to print this and put on the wall.
 
@webarto , you lost
 
@AmigableClarkKant you laugh you lose
 
8:28 AM
@DanielsPitkevičs , go and read about event delegation
 
@DanielsPitkevičs your code is the error by itself
 
Great, great - actually I didnt ask anything about code itself, but about why click event not working.
Ok, I will read about event delegation.
 
http://stackoverflow.com/questions/11878788/if-condition-inside-while-doesnt-work-as-the-same-way-it-does-work-in-while
 
Sem
@DanielsPitkevičs Abstration instead of delegation would be nice.
 
@Sem Ok thank You
 
8:31 AM
@DanielsPitkevičs you are missing document ready ol' chap, if your JS isn't on the bottom...
 
@webarto Im not missing document ready. It is not full code
 
Good morning. Anything new in the PHP world?
 
that is very helpful of you
@Whisperity just sadness, although that is nothing new ... I might say it's usual as always...
 
@webarto Other part of code is not needed here.
 
yeah right, good luck with d3b#g1ng
 
8:33 AM
@Sem what the fuck are you talking about ?!?
 
@Whisperity morning
 
^ Being stranded and baking in the sun?
 
^ Being brainless and dying by suffocation
 
Sem
@tereško Random crap is already accepted :D
 
^ Wordpress?
@Sem NO, you have insulted this room
 
Sem
8:38 AM
@webarto Am I part of the reputation of this room? Sweet.
 
aaaaand I'm out
 
@Whisperity "These questions should really be posted in r/phphelp. Or, you may have better luck on stackoverflow."
Nooooooooooo
 
Sem
@webarto How can I make it up bro. Want some noodles?
 
W͕̫̏̂ͪ͘ ̧͍̠͖̰̟̗̗H̒̅ ̻͍̹̥̯ͦY̥ ̬̼̩ͧ?̱̻̤͖͈͕̒̃̆̔̾̀
 
8:41 AM
@deceze Oh god OP has been 303'd to Stack Overflow.
 
@Sem no noodles for me, I have moneyz for now...
 
Thank You tereško for answer to my question
 
@Whisperity I hope he gets 403 from SO
 
i'm shocked reddit was as nice as they were
 
its still early
 
8:46 AM
trying to install Win8, wish me luck
 
i installed it about two weeks ago. lasted about two hours total before i wiped it.
 
@webarto Die! DIE! Uhm, good luck. :)
 
I was going to install it, but cahnged my mind, figured the download wasn't worth it.
changed*
the Metro interface just annoys me too much
 
yeah, it's not worth it unless you want a phone OS on your desktop
 
8:47 AM
I need to decide what I throw out of the Window serverfault.com/questions/408263/…
 
haha the mario graphic is awesome
 
I fixed a similar problem to that once
 
I'm suspecting cheap DLink router and Windows 7
 
had something to do with windows of course
 
> P.S. I have tried turning it off and on again.
 
8:49 AM
let me dig up a solution
 
@deceze at least it's not OS X :)P
 
Good morning @Whisperity. Nah, not much. I proposed forking the PHP project and only fixing things which would improve PHPsadness.com and me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design but no one really took me seriously. :)
 
then you'd end up with a python 2/3 situation except for 1000 times worse
:)
 
Let's put it this way: My last OS upgrade took about half an hour over the net and cost 20$ for a full legit install-on-as-many-machines-as-you-like license. That's it. No data transfer, no good luck wishing, just continued to code on new OS...

Your turn. :P
 
8:53 AM
@Corbin except both Python 2 and 3 are both OK languages...
 
@AlexLunix Windows 7 issue (only) it is, XP is behaving good (dunno why I removed it)...
 
@Ami
whoops... still a chat noob lol
 
@deceze apt-get upgrade
 
@webarto I think it may have something to do with AcceptEx
 
@webarto I said it just worked. ;P
 
8:54 AM
@AmigableClarkKant I would probably even call them good :). But fixing the PHP oddities would be creating a completely different language. it would absolutely murder backwards compatibility which means that 0 people would migrate.
 
Something winsocky
 
though i imagine it would be adapted quite well for new projects if it was backed by a big enough organisation
people would have to trust that it would stay around...
 
@AlexLunix most definitely, for example if I write to disk (files that are going to be access by server) via network, and try to access HTTP on same machine, insta timeout...
 
@webarto A bit out of date article, but check it out mydigitallife.info/…
 
8:56 AM
Corbin, but there is a need for a language such as PHP, obviously. And nothing to fill the niche except the horror that is ... PHP.
 
Hey
is there anyway I ask an admin to unban me?
 
it is quite interesting how massively popular PHP is despite its (sometimes horrendous) flaws
 
@Madmadmax -> meta
 
i guess when it comes down to it, critics are much harsher than really necessary... lol
 
@require("config.php");
if ( !is_array(@$cfg) )
	header('Location: install.php');
 
8:57 AM
@Corbin, it's not fun to read otherwise
 
And it spits me between the eyes with a total blank page, no redirection or whatsoever...
 
@Madmadmax not for someone with such profile history stackoverflow.com/users/1317928/madmadmax
 
yeah, @AmigableClarkKant lol.... i must admit, @Whisperity, that my first response upon seeing a post defending PHP is "WTF?!?!"
:P
 
@Whisperity Dude.. @require, seriously?
8
 
@Leigh It's temporary. And it's temporarily not working.
 
8:59 AM
$cfg seems like a dangerous name to name a global...
 
@Whisperity there is nothing more permanent then temporary solutions
7
 
anyway , kill it with fire
 
especially in PHP apps...
 
What should we call the new language?
 
9:00 AM
@Corbin There is a different way planned to access configuration directives.
@AmigableClarkKant moarjquery
 
@AmigableClarkKant PHPness
 
@Whisperity that's good then :)
 
PHPNess, haha
PNP "PNP is Not PHP?"
 
PIMP Is My PHP
 
sounds too much like p = np
 
9:02 AM
if you want to design new language , then design a new language , and let php evolve on it's own
 
@tereško Nothing wrong with forking an existing language and customising it, as long as you're happy with the fact that nobody will use it.
 
some of you have missed the point that php is the only popular language which evolved instead of being designed
 
@tereško, PHP is evolving into something more inbred for each generation.
 
.. and now i know that you are here just for trolling
go back to your c++ lounge
 
hides from the impending flame war
 
9:04 AM
@AmigableClarkKant No, not at all, the discussions taking place at the moment are mostly about how it is going to evolve into a more structured language.
 
@tereško Whats bad about my history? 2 question with negative feedback total
 
@Leigh, so why do they find new things to destroy for each new feature? :)
 
@AmigableClarkKant If you redesign the structure of an already built building, sometimes you need to tear down the old parts.
 
@Leigh, or you mean, not based on track record, but rather that, yes, this time, it will be better. Promise. PHP6 will be nice.
@Whisperity, but they don't do that, they just make the chimera worse
 
@AmigableClarkKant There have been more discussions about PHP 6 recently too.
@AmigableClarkKant And what's wrong with deprecating 10 year old broken features?
 
9:11 AM
No that is awesome.
(not sarcastic)
But all the stuff in PHP Fractal of Bad Design, that's what's bad about it. And the PHP devs mess things up in the same rate or faster than they deprecate bad stuff.
 
I just found a nice book. Unfortunately it's not in English...
 
@AmigableClarkKant You know all the gripes about function naming consistency could be fixed with a small extension
If you want that for your code only
 
7 years of nagging to get "finally" in. Maybe. Instead of the devs putting it there to begin with. sheriframadan.com/2012/08/finally-keyword-in-php
 
as teresko said earlier, you're forgetting that PHP was not exactly "planned"
was more of a "imma slap some more functionality on this as quickly as i can" process for PHP1 - 3
 
@AmigableClarkKant From what I understand, finally isn't guaranteed to be executed. You can forgive non-graceful shutdowns where the state of the environment is not known, but even user-invoked shutdowns do not trigger it.
If I could vote, I'd say no until that was fixed.
 
9:17 AM
great, that'll trigger a "exit" and "really_exit" branch
"kill this and bail" means "kill this and bail" to me
 
@Corbin and "finally" means, "this is important and it has to be run to clean up" to me
 
@Corbin Guys we already have maybe_serialize() (fortunately only in WordPress).
 
right, but i think the "kill this and bail as quickly as possible" idea of exit and its alias die override that
 
@Corbin, I am not forgetting. I say it's time someone took over the wheel.
 
if you want the finally block to run, you should not kill the process imo
my retort to that is to stop abusing exit
:D
 
9:20 AM
@Corbin What if you do want the finally to run, when you kill the process.
 
then you don't user-controlled kill the process
i would rather have to a few lines of manual work than get into a world of exit and really_exit
when i kill a process, i want it dead
not staggering until it bleeds to death
 
I wonder if die/exit were to throw a catchable exception...
if you don't catch it, process dies, if you do, you can run finally
 
Eww what...
 
sounds great in theory; but that might not work so well in practice....
 
or how about, similar to current shutdown functions, calling exit from within a shutdown function triggered by exit, will prevent all subsequent shutdown functions from running.
 
9:22 AM
or... exit could actually exit
that chimera is growing again
 
or, finally could mean finally ;)
 
i think youve misunderstood finally. no offense intended
 
Btw, when you call exit/die, anything registered with register_shutdown_function is run.,
Which is basically like, a global finally.
 
The Java take: "If during execution of the code within a try block, an exception is thrown that is handled by a catch clause associated with the try block, the finally clause will be executed after the catch clause. "
 
blerh.... i just think PHP devs have a bad tendency to use exit as an "omg something completely reasonable happened and i'm too lazy to deal with it?! exit!!!!"
if PHP weren't already what it is, i would probably argue that register_shutdown_function shouldn't exist
 
9:25 AM
@Corbin I only use die in 2 places. 1) during debugging, and 2) after a header('Location: ...');
 
two very justified places :)
 
@AmigableClarkKant Same as how C# handles it too. Try runs. If exception happens and is caught, catch runs. Nontheless, finally runs thereafter.
 
can you think of a valid use of your finally-always-happening thing?
 
create a lock file, idiot code calls exit, lock file needs to be removed
 
that's not the language's responibility
i think we just have a different idea of what finally's purpose is
i see it as a (semi-)natural part of the exception paradigm.
not as a low level "this actually means finally"
 
9:29 AM
thinking
 
I was under the impression that there's a better way of doing it: foreach($a as $vn=>$vv)$$vn = $vv;
 
oh god... i just threw up
ok that might have been a bit excessive... lol
ah ok :)
a variable-variable is almost an always "an array is probably the right tool here" sign
 
Not in this case.
I'm literally passing variables as an array.
And I need to convert them into a variable on the other end.
 
hrmm, step back, look at it from a bigger picture, and maybe reconsider a lot of the design
sounds like some variable abuse to me
(also, you might be looking for extract)
 
> If we are to always finish an already started procedure, then we can use, after the try and subsequent catch constructs, the finally construct. Code put in between brackets of the finally will always be ran, despite we had an exception or not. In the case of a handled exception, finally runs after the related catch, in the case on an unhandled exception, finally runs before the software crashes with an error message.
 
9:31 AM
(though i would go as far as to call extract a horrible anti-pattern)
 
It's a template, I don't want to $v['name'] each time, I want to just $name
 
@Christian Are you trying to mimic extract?
 
@Leigh :D I knew it.
 
ah, ok, for a template taht should be fine
petty moment: (also, you might be looking for extract)
 
Yes, extract, that command thats on par with eval, and global
 
9:32 AM
@Leigh Yeah, I'll use with care, I promise.
 
@Christian Templating is about the only exception if your variables are correctly sanitised already.
 
there's not really a better way of getting vars into a template... there's either extract(), some crazy rigid planning, or some __set sadness
 
@Leigh Yes they are (sanitized).
 
@AlexLunix thank you mate, I've disabled...
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
EnableMMAP off
EnableSendfile off
... and done netsh winsock reset ... hope that it might be it :) I've installed wireless driver that might have messed up... but problem wasn't there when accessing from Linux machine (no timeout),
 
On the bright side, you now know I've never abused this side of PHP :D
 
9:36 AM
0
Q: PHP MySQL Phone Calling

Subrata BanerjeeI'm trying to do a php-mysql project that can make phone calls from the computer. The concept is - My call list is stored in a mysql database and when a tele-caller login in to their account. The call list is displayed and a call button is placed beside every calling number. When they click on th...

 
@Whisperity... wince
 
@tereško
 
yeah
 
Sem
nice one.
 
9:51 AM
Interesting date format.
 

« first day (663 days earlier)      last day (4285 days later) »