I'm trying to parse out some data from an MRSS feed using SimpleXML then create JSON with that data.  Here's what I'm trying, it does output JSON but the formatting looks bad and given all the [{"0":" before every element, I'm sure I'm doing something wrong:   &lt;?php session_start(); $html = ""; $url = "http://feeds.nascar.com/feeds/video?command=search_videos&amp;media_delivery=http&amp;custom_fields=adtitle%2cfranchise&amp;page_size=100&amp;sort_by=PUBLISH_DATE:DESC&amp;token=217e0d96-bd4a-4451-88ec-404debfaf425&amp;any=franchise:%20Preview%20Show&amp;any=franchise:%20Weekend%20Top%205&amp;any=franchise:Up%20to%20Speed&amp;any=franchise:Press%20Pass&amp;any=franchise:Sprint%20Cup%20Practice%20Clips&amp;any=franchise:Sprint%20Cup%20Highlights&amp;any=franchise:Sprint%20Cup%20Final%20Laps&amp;any=franchise:Sprint%20Cup%20Victory%20Lane&amp;any=franchise:Sprint%20Cup%20Post%20Race%20Reactions&amp;any=franchise:All%20Access&amp;any=franchise:Nationwide%20Series%20Qualifying%20Clips&amp;any=franchise:Nationwide%20Series%20Highlights&amp;any=franchise:Nationwide%20Series%20Final%20Laps&amp;any=franchise:Nationwide%20Series%20Victory%20Lane&amp;any=franchise:Nationwide%20Series%20Post%20Race%20Reactions&amp;any=franchise:Truck%20Series%20Qualifying%20Clips&amp;any=franchise:Truck%20Series%20Highlights&amp;any=franchise:Truck%20Series%20Final%20Laps&amp;any=franchise:Truck%20Series%20Victory%20Lane&amp;any=franchise:Truck%20Series%20Post%20Race%20Reactions&amp;output=mrss"; $xml = simplexml_load_file($url); $namespaces = $xml-&gt;getNamespaces(true); // get namespaces  for($i = 0; $i &lt; 50; $i++){ // will return the 50 most recent videos    $title = $xml-&gt;channel-&gt;item[$i]-&gt;video;   $link = $xml-&gt;channel-&gt;item[$i]-&gt;link;   $title = $xml-&gt;channel-&gt;item[$i]-&gt;title;   $pubDate = $xml-&gt;channel-&gt;item[$i]-&gt;pubDate;   $description = $xml-&gt;channel-&gt;item[$i]-&gt;description;   $titleid = $xml-&gt;channel-&gt;item[$i]-&gt;children($namespaces['bc'])-&gt;titleid;   $m_attrs = $xml-&gt;channel-&gt;item[$i]-&gt;children($namespaces['media'])-&gt;content[0]-&gt;attributes(); $VideoFileURL = $m_attrs["url"];  $arr = array($title, $description, $VideoFileURL);  $json_string = json_encode($arr, 128);  echo json_encode($arr, 128); }  ?&gt;   I've tried to both   $json_string = json_encode($arr, 128)   and   $json_string = json_encode($arr, JSON_PRETTY_PRINT)   "128" seems to print out better than "JSON_PRETTY_PRINT"  Any ideas? I'm sure it's obvious, but I'm a newbie with PHP. Thanks!
Let's say I have some XML like this  &lt;channel&gt;   &lt;item&gt;     &lt;title&gt;This is title 1&lt;/title&gt;   &lt;/item&gt; &lt;/channel&gt;   The code below does what I want in that it outputs the title as a string  $xml = simplexml_load_string($xmlstring); echo $xml-&gt;channel-&gt;item-&gt;title;   Here's my problem.  The code below doesn't treat the title as a string in that context so I end up with a SimpleXML object in the array instead of a string.  $foo = array( $xml-&gt;channel-&gt;item-&gt;title );   I've been working around it like this  $foo = array( sprintf("%s",$xml-&gt;channel-&gt;item-&gt;title) );   but that seems ugly.  What's the best way to force a SimpleXML object to a string, regardless of context?
I'm in the market for a new Smartphone. Except for iPhone's, I'm new in the field and probably have some misconceptions.  My first choice was the Google Nexus S, but I was offered a great deal on the Samsung S Galaxy II (i9100). The only issue is that I read that it came with an "enhanced" version of Android. Being familiar with PC's, I know that these enhancements are almost always bloatware: I always do a clean install of Windows to get rid of it.  My question is fairly simple: is this possible to use the stock Google Android OS on the Samsung S Galaxy II (i9100)? That was the killer feature of the Nexus S for me: coming directly from Google, easily upgradable. Would that be possible and if yes, how?  Thank you for enlightening me. Calculate $\sum_{k=1}^n (-1)^{k+1} \binom{n}{k}\frac{1}{k}$ Does a multiple-entry Schengen visa allow visiting other Schengen countries later, without going via the issuing country? Intuitive explanation of the shape of the Maxwell-Boltzmann distribution At higher temperatures (for an ideal gas), the Maxwell-Boltzmann distribution is spread more widely and has a lower maximum. At lower temperatures, the spread is much more narrow and the peak is much higher. Why is this so? I was thinking that this is to maintain constant area under the curves, but the integration of the curve gives total energy—and total energy should not be constant since temperature is increasing.  So why does the distribution curve change thus? I’m looking for an explanation that’s intuitive or that involves math not surpassing first-year university level calculus. I would appreciate it if it could be explained without the Maxwell-Boltzmann distribution equation, since at this level I’m really treating this qualitatively. Creating new users using PHP not recognized by Apache 2.4 I have a server setup where new linux users are created using (PHP)  shell_exec ( '/usr/sbin/useradd ' . $username ); exec ('usermod -a -G ' . $username . ' '. $username); #add user into the usergroup exec ('usermod -a -G ' . $username . ' www-data'); #add usergroup with the www-data   And then the user script changes the owner and group of the files to this owner. The server is setup with suPHP which then allows these files to be run as the owner.  This setup worked fine with Apache 2.2 but is breaking in Apache 2.4. Everything works fine except when I try to oepn the files, it gives a 403 forbidden error. Restarting apache after the user is added fixes the issue but that is not a viable solution for me. The users are added using a web server and hence I need to be able to do this without having to reload/restart apache everytime.  I have searched for serveral hours and tried to fix the issue but haven't been able to do so! I am running ubuntu 14.04 and I am not able to downgrade to apache 2.2 as well. Create Task in loop but all tasks take the same parameter PHP: how do I copy a temp file upload to multiple places? I want to display the pages 'famous' and 'mschief'.  Using this code, WP_query() doesn't return any result:  $args = array( 'post_type' =&gt; 'page', 'pagename' =&gt; 'famous,mschief', 'posts_per_page' =&gt; 3 );   This code returns one of the 2 pages:  $args = array( 'post_type' =&gt; 'page', 'pagename=famous,mschief', );   And this code returns the 2 pages correctly:  $args = array( 'post_type' =&gt; 'page', 'pagename=famous,mschief', 'posts_per_page' =&gt; 3 );   Why does the first piece of code (the only correct one to me) doesn't work? And why the two others produce these results? How to find Oracle's installed version and release from a program? prove that if $1 \le m \le n$ then $\left(1+\frac1n\right)^m < 1+\frac mn + \left(\frac mn\right)^2$ I have answered 'No' to Siri initial prompt, but I can still see it in my process list. I've tried to kill it, but it loads again immediately. How can I unload and remove Siri from my Mac? is a wonderful freeware Windows swiss-army-knife for image viewing &amp; editing.  For me, the key features are fast viewing, simple editing (crop, contrast, brigthness, rotation, resampling), file operations (delete, copy to folder) and extended image information access (exif data) combined in the same interface. Versatile batch jobs are a very nice bonus.  But unfortunately IrfanView is for Windows only, and isn't . What would be the nearest equivalent for linux? Do Mandalorians truly never remove their helmets? In episode 3 of The Mandalorian, it is said that Mandalorians never remove their helmets for any reason. Really? Not even to sleep or bathe? Is there any canonical source for this idea? I’m going to assume that the “never” implies “Never removes their helmets in public…” right?  But in flashback scenes to the Mandalorian’s childhood, nobody is really pictured wearing Mandalorian armor let alone helmets. They simply seemed like basic humans who might just be unified by wearing maroon wardrobes all the time.  So what is the deal with this claim? What is the canonical context of the claim?      Looking for in-universe, canonical explanations; not armchair speculation and theories. If none (currently) exist, legends explanation would suffice. Regardless, please provide references and context. Hide iPhone HTML5 video play button Let $f : U \to V$ and $g : V \to W$ be linear transformations on the vector spaces $U$, $V$, and $W$. Supposedly,  $$ \dim(\ker(g \circ f)) = \dim(\ker(f)) + \dim(\ker(g) \cap \operatorname{im}(f)). $$  How might I go about proving that?    (Attempt:) The $\dim(\ker(g)\cap\operatorname{im}(f))$ term suggests to me that I should define a vector space $V' = \ker(g) + \operatorname{im}(f)$ to invoke the theorem that  $$ \dim(V') = \dim(\ker(g)) + \dim(\operatorname{im}(f)) - \dim(\ker(g) \cap \operatorname{im}(f)), $$  but I don't really see where to go from there. How to debug EntityMalformedException? I've got fatal error EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7700 of .\includes\common.inc) when trying to access user/xyz.  I tried to retrieve info about the malformed node at line 7700, where the error message is built, thinks like :  if (!isset($entity-&gt;{$info['entity keys']['bundle']}) || $entity-&gt;{$info['entity keys']['bundle']} === '') {  dpm($info);// or dpm($entity);  throw new EntityMalformedException(t('Missing bundle property on entity of type @entity_type.', array('@entity_type' =&gt; $entity_type))); }   dpm($entity) returns an unexpected user object, and $info a huge qty of things.   Could somebody put me on the right way ?  I already read whatever I could find about Missing bundle property errors, but none helped solving.  dpm($entity) returns  uid (String, 2 characters ) 70 name (String, 9 characters ) John pass (String, 55 characters ) $S$DUwPuOuDPiDL4nRTYXqc7a5uOfMKey7pyhOFUEKka1XM... mail (String, 30 characters ) john@example.com theme (String, 0 characters ) signature (String, 0 characters ) signature_format (String, 13 characters ) filtered_html created (String, 10 characters ) 1396286331 access (String, 10 characters ) 1397146661 login (String, 10 characters ) 1396513460 status (String, 1 characters ) 1 timezone (NULL) language (String, 2 characters ) fr picture (NULL) init (String, 30 characters ) john@example.com data (Array, 5 elements) roles (Array, 1 element) og_user_node (Array, 0 elements) message_subscribe_email (Array, 1 element) field_bio (Array, 0 elements) field_name_first (Array, 1 element) field_name_last (Array, 1 element) field_facebook_url (Array, 0 elements) field_linkedin_url (Array, 0 elements) field_twitter_url (Array, 0 elements) user_trusted_contacts (Array, 1 element) group_group (Array, 1 element) group_access (Array, 1 element) metatags (Array, 0 elements) rdf_mapping (Array, 3 elements) realname (String, 13 characters ) John Doe content (Array, 13 elements) entity_view_prepared (Boolean) TRUE privatemsg_disabled (Boolean) FALSE prove $\sum_{i=1}^{n}(x_i-\bar{x})^2\lt\sum_{i=1}^{n}(x_i-a)^2$ How do we prove that $$ \sum_{i=1}^{n}(x_i-\bar{x})^2\lt\sum_{i=1}^{n}(x_i-a)^2 $$  where $a$ is any value other than $\bar{x}$, the arithmetic mean.  My Attempt: $$ \sum_{i=1}^{n}(x_i^2-2x_i\bar{x}+\bar{x}^2)\lt\sum_{i=1}^{n}(x_i^2-2x_ia+a^2)\\\sum_{i=1}^{n}x_i^2-2\bar{x}\sum_{i=1}^{n}x_i+\sum_{i=1}^{n}\bar{x}^2\lt\sum_{i=1}^{n}x_i^2-2a\sum_{i=1}^{n}x_i+\sum_{i=1}^{n}a^2\\-2\bar{x}.n\bar{x}+n.\bar{x}^2\lt-2a.n\bar{x}+n.a^2\\-2\bar{x}^2+\bar{x}^2\lt-2a\bar{x}+a^2\\-\bar{x}^2\lt-2a\bar{x}+a^2 $$ But how do I proceed further or is there any better way ? Book: World covered in trees that are miles high Unable to lock the administration directory (/var/lib/dpkg/) is another process using it? I get this error when trying to use apt-get:  E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?     How can I fix this? Is there a max array length limit in C++? Is there a max length for an array in C++?  Is it a C++ limit or does it depend on my machine? Is it tweakable? Does it depend on the type the array is made of?  Can I break that limit somehow or do I have to search for a better way of storing information? And what should be the simplest way?  What I have to do is storing long long int on an array, I'm working in a Linux environment. My question is: what do I have to do if I need to store an array of N long long integers with N > 10 digits?  I need this because I'm writing some cryptographic algorithm (as for example the p-Pollard) for school, and hit this wall of integers and length of arrays representation.