I have a class with methods which I want to use as callbacks. How to pass them as arguments?  Class MyClass {      public function myMethod() {         $this-&gt;processSomething(this-&gt;myCallback); // How it must be called ?         $this-&gt;processSomething(self::myStaticCallback); // How it must be called ?     }      private function processSomething(callable $callback) {         // process something...         $callback();     }      private function myCallback() {         // do something...     }      private static function myStaticCallback() {         // do something...     }     }   UPD: How to do the same but from static method (when $this is not available)
How can I dynamically invoke a class method in PHP? The class method is not static. It appears that   call_user_func(...)   only works with static functions?  Thanks.
Custom post type - posts list - white screen of death i am getting a weird error - white screen in the list of posts for a specific Custom post type (just for that one)   tried deactivating all the plugins tried checking for error (debugging = true)   Still nothing the page just doesnt echos anything... (nothing in source too)  I am talking about such a url in the admin:     Here is register_post_type part i am using:    function register_submodelcpt() {     $labels = array(         'name'                  =&gt; __('Sub Models', THEME_NAME),         'singular_name'         =&gt; __('Sub Models', THEME_NAME),         'add_new'               =&gt; __('New Model', THEME_NAME),         'add_new_item'          =&gt; __('Add new Model', THEME_NAME),         'edit_item'             =&gt; __('Edit Model', THEME_NAME),         'new_item'              =&gt; __('New Model', THEME_NAME),         'all_items'             =&gt; __('All Sub Models', THEME_NAME),         'view_item'             =&gt; __('Watch Model', THEME_NAME),         'search_items'          =&gt; __('Search Models', THEME_NAME),         'not_found'             =&gt;  __('No Models found', THEME_NAME),         'not_found_in_trash'    =&gt; __('No Models found in trash', THEME_NAME),          'parent_item_colon'     =&gt; '',         'menu_name'             =&gt; __('Sub Models', THEME_NAME),      );      $args = array(         'labels'                =&gt; $labels,         'public'                =&gt; true,         'publicly_queryable'    =&gt; true,         'show_ui'               =&gt; true,          'show_in_menu'          =&gt; true,          'query_var'             =&gt; true,         'rewrite'               =&gt; array('slug' =&gt; 'submodels'),         'capability_type'       =&gt; 'post',         'has_archive'           =&gt; true,          'hierarchical'          =&gt; true,         'menu_position'         =&gt; 5,         'menu_icon'             =&gt; get_stylesheet_directory_uri().'/images/cpt/subcars.png',                     'supports'              =&gt; array('title', 'thumbnail', 'revisions', 'page-attributes')     );      register_post_type('submodelscpt',$args); } add_action('init', 'register_submodelcpt');   Did anyone encounter such an issuse? can you think of a reason this might happen?   Another weird thing when i change this:    To this:     The posts list loads correctly... how to display the actual network traffic (wireless) in a terminal?  Additionally: Is it possible to add this info to the chart of top? "In a party people shake hands with one another" In a party people shake hands with one another (not necessarily everyone with everyone else).   (a) Show that 2 people shake hands the same no. of times.   (b) Show that the number of people who shake hands an odd no. of time is even.        I find this question to be very tough and I can't find a way to even start answering this. It would be great if I could get a small hint in order for me to at least start it. How to order the Ubuntu Phone? Yes, of course, I want that Ubuntu Phone.   Where is the order now button? Let's say I fire a bus through space at (almost) the speed of light in vacuum. If I'm inside the bus (sitting on the back seat) and I run up the aisle of the bus toward the front, does that mean I'm traveling faster than the speed of light? (Relative to Earth that I just took off from.) Is there any way to know when I will receive my UK visa? Why is ridge regression called "ridge", why is it needed, and what happens when $\lambda$ goes to infinity? Which indefinite article should precede hour — a or an?        an hour     a hour      Does the usage of an vs a depend on the pronunciation — a history, a hobby, but an hour, an honor? At the beginning of  we see that Logan (a.k.a. Wolverine) and Colonel William Stryker were working together by the end of the Vietnam War.   For 5 years after the war, he lives in Canada with a girlfriend. But in  we see that Logan was part of some gang at the end of the Vietnam War.   My question is which of these are X-Men movie canon? Salesforce lightning get current users username How I would go about getting the current users username or first and last name?  I have been looking at this for the last couple of hours - I was just wondering how I would go about getting their name and then displaying it on the page.  For example the current user is 'John Smith' and in the lightning component I want to output John Smith's name like:     Welcome to our community John Smith! In the radio series, how did Zaphod get into the artificial universe? In the book The Restaurant at the End of the Universe, it's very clearly explained how Zaphod gets into the simulated universe; he's in it from the moment he enters Zarniwop's office, and a big deal is made of him leaving via the window rather than the door so that he stays in it.  In the radio series, however, this doesn't happen. At the end of Fit the Seventh, Zaphod asks "How do we get to this universe, then?" and Roosta replies "I'm afraid it looks like we don't...", pointing out that the building is splitting down the middle, preventing them reaching the office.  Later, in Fit the Twelfth, Zaphod finally meets Zarniwoop in the lounge of the slightly-delayed spaceliner and reacts with astonishment at learning he's been in the artificial universe all this time. "How did we get into it? I mean like where, when?"  Zarniwoop only replies enigmatically: "You didn't notice? Well, I'll let you work it out for yourself."  So, how did he get in? As noted, he never actually entered Zarniwoop's office. My only thought is that it happened during the "body debit" incident with the disco, but there's no particular indication that that should be the case. Is there any other possibility? Non superscript citations for figures Is it possible to reference figures like so   taken from \emph{ref. \cite{reference}}   with non superscript numbers, while leaving the rest of the references in the bulk of the document untouched? This is using BibTeX and the . Why is the last digit of $n^5$ equal to the last digit of $n$? I was wondering why the last digit of $n^5$ is that of $n$? What's the proof and logic behind the statement? I have no idea where to start. Can someone please provide a simple proof or some general ideas about how I can figure out the proof myself? Thanks. What is a good replacement for a cable end cap? I was adjusting the tension of my front derailleur cable and managed to pop off the cable end cap. The cable is now quite frayed at the end and I think it would be difficult to attach another cap.  What would work as a suitable replacement for a cap? I've read that perhaps superglue or duct tape could work? How to render world position pass Drawbacks of making public which journal a manuscript is submitted to, while it is under review? Many researchers list out their submitted manuscripts on their website. Some specify the journal name, like     Smith J, Oliver J (under review) My awesome paper. Nature.   while others don't, like     Smith J, Oliver J (under review) My awesome paper.   One reason I can think of as to why some don't mention the journal name is that they may get embarrassed in the case where the current journal rejects the paper. Then, the "circle" will know this paper gets rejected from Nature first and then ends up in an inferior journal.  Besides this, are there any other considerations preventing people from mentioning to which journal they submit a paper to?  P.S.: I am asking because my advisor is a researcher who only mentions accepted  papers on his webpage. As a student hunting jobs, I feel it is advantageous for me to mention my submitted papers on my webpage. I hesitate to do so, as I worry I may make my advisor unhappy by announcing in which journal our papers are currently under review. Why are the orbits of planets in the Solar System nearly circular? Except for Mercury, the planets in the Solar System .  Is this property special to the Solar System?  :     Most exoplanets with orbital periods of 20 days or less have near-circular orbits of very low eccentricity. That is believed to be due to tidal circularization, an effect in which the gravitational interaction between two bodies gradually reduces their orbital eccentricity. By contrast, most known exoplanets with longer orbital periods have quite eccentric orbits. (As of July 2010, 55% of such exoplanets have eccentricities greater than 0.2 while 17% have eccentricities greater than 0.5.) This is not an observational selection effect, since a planet can be detected about equally well regardless of the eccentricity of its orbit. The prevalence of elliptical orbits is a major puzzle, since current theories of planetary formation strongly suggest planets should form with circular (that is, non-eccentric) orbits.   What is special about the Solar System that orbits of planets here are nearly circular, but elsewhere they are moderately or highly eccentric? Formal basis for variable substitution in limits How do I use '&' literally in LaTeX? Real Time LaTeX? Possible Duplicate:          I'm looking for an application in which I can write pure LaTeX in one half of the screen and on the other half to see the compiled document in real time. This seems really like an obvious way to do LaTeX authoring but it doesn't look like any software is able to do it. LyX is not what I'm looking for. I want to edit the actual LaTeX and see it rendered in real time. Why isn't this already being done somewhere?