I am using heredoc statement for printing html, but how can we embed php code inside that html for example:   $results = $conn-&gt;query($sql);  $html = &lt;&lt;&lt;html &lt;table class="table table-bordered table-striped table-hover"&gt;     &lt;thead&gt;         &lt;tr&gt;             &lt;th&gt;ID&lt;/th&gt;             &lt;th&gt;Technician&lt;/th&gt;             &lt;th&gt;Project&lt;/th&gt;             &lt;th&gt;Region&lt;/th&gt;             &lt;th&gt;Date&lt;/th&gt;             &lt;th&gt;Type&lt;/th&gt;             &lt;th&gt;Notes&lt;/th&gt;         &lt;/tr&gt;     &lt;/thead&gt;     &lt;tbody&gt;         &lt;?php while($row = $results-&gt;fetch_assoc()):          &lt;tr&gt;             &lt;td&gt;{$row['ID']}&lt;/td&gt;             &lt;td&gt;{$row['Technician']}&lt;/td&gt;             &lt;td&gt;{$row['Project']}&lt;/td&gt;             &lt;td&gt;{$row['Region']}&lt;/td&gt;             &lt;td&gt;{$row['Date']}&lt;/td&gt;             &lt;td&gt;{$row['Type']}&lt;/td&gt;             &lt;td&gt;{$row['Notes']}&lt;/td&gt;         &lt;/tr&gt;         &lt;?php endwhile; ?&gt;     &lt;/tbody&gt; &lt;/table&gt; html;   How can we do something like that . . .
In PHP, the HEREDOC string declarations are really useful for outputting a block of html.  You can have it parse in variables just by prefixing them with $, but for more complicated syntax (like $var[2][3]), you have to put your expression inside {} braces.  In PHP 5, it is possible to actually make function calls within {} braces inside a HEREDOC string, but you have to go through a bit of work.  The function name itself has to be stored in a variable, and you have to call it like it is a dynamically-named function.  For example:  $fn = 'testfunction'; function testfunction() { return 'ok'; } $string = &lt;&lt;&lt; heredoc plain text and now a function: {$fn()} heredoc;   As you can see, this is a bit more messy than just:  $string = &lt;&lt;&lt; heredoc plain text and now a function: {testfunction()} heredoc;   There are other ways besides the first code example, such as breaking out of the HEREDOC to call the function, or reversing the issue and doing something like:  ?&gt; &lt;!-- directly output html and only breaking into php for the function --&gt; plain text and now a function: &lt;?PHP print testfunction(); ?&gt;   The latter has the disadvantage that the output is directly put into the output stream (unless I'm using output buffering), which might not be what I want.  So, the essence of my question is: is there a more elegant way to approach this?  Edit based on responses: It certainly does seem like some kind of template engine would make my life much easier, but it would require me basically invert my usual PHP style.  Not that that's a bad thing, but it explains my inertia..  I'm up for figuring out ways to make life easier though, so I'm looking into templates now.
Why does the kinetic energy of a particle moving in circular motion increase when the turn radius decreases and no torque is acting? Why does the kinetic energy of a particle moving in circular motion increase when the turn radius decreases and there is no torque acting? E.g. if a planet is rotating about its axis and it shrinks to half of its radius then according to conservation of angular momentum velocity will doubled, i.e. its kinetic energy will increase. Does this mean that without any external force the kinetic energy of any thing can be increased? Please explain! I am working on a prototype, one function of which is to detect whether an object is "in range" by a few cm. Right now I'm just using an Arduino and a cheap  that operates at 13.56 MHz:    I've successfully gotten it to detect the tag, but only at a distance of about 3-4 cm when the tag is oriented parallel to the antenna.  According to my  , the HF band allows read ranges of between 10 cm and 1 m for passive tags, depending on factors like antenna size, tag size and orientation, and transceiver power.  I realize this inexpensive reader is not up to task as-is, but I'm interested in building something that achieves read ranges of 15-20 cm.  Some criteria:   No need to read multiple tags; only whether one tag is in range or not. No need to write to the tag. Cannot use an active tag.   I'm not experienced with RFID reader construction (yet) but am interested in knowing what I should pursue.  Here are some things I've considered:   Ditch the embedded antenna on the cheap RFID reader and construct my own, larger antenna. I'd need to see if the onboard  is up to the task of providing additional power. Look for a different IC around which to build a reader from scratch. Find a ready-made solution instead of trying to build one (more cost-effective?). Use something other than RFID for simple proximity detection.   I am experienced with microcontrollers and basic electronics, and have made audio and lighting projects, but this is a first with RFID. Since I don't need to read multiple tags, which RFID is suitable for, I've considered maybe some sort of magnet and hall-effect sensor, but the range does not seem adequate. I considered using an ultrasonic proximity detector, but the application calls for detecting the tagged object while ignoring untagged ones (ultrasonic would produce false positives on untagged objects). I've considered some sort of reflective surface placed on the object, and detecting reflected light, but the object orientation is not reliable enough to maintain alignment.  So, in a nutshell, What modifications can I make to my existing reader, or what alternate technology should I pursue to achieve 15-20 cm detection of a passively tagged object?  I plan on connecting whatever proximity detector is used to a microcontroller using SPI. There were so many discussions about an Ubuntu with RR. They were so many pros and contras. At the end ubuntu wont be changed, the 6 month cycle system wont be changed. Thats fine!   But because there are so many people who would like to use an ubuntu with RR Im asking myself why isnt there an Ubuntu Derivate with RR. I couldnt found one, there are a loooot of Ubuntu Derivates but no RR. Is it just impossible? I mean Ubuntu = 6 months cycle, so the derivate have to be a 6 month cycle too? Is there no other option? Or are there already some smart guys trying to solve this problem? Thank you! How to proof the the derivative of $x^2$ is $2x$? Evaluation of Indefinite Integral resulting in Hypergeometric Function I am attempting to derive the result:  $$ \int \left(1+x^n\right)^{-1/m}dx= x\,_2F_1\left(\frac 1m,\frac 1n;1+\frac 1n;-x^n\right)$$  First, I start off with the binomial expansion of the integrand to get:  $$\int\sum_{k=0}^{\infty}\frac{(1/m)_k}{k!}\left(-x^n\right)^kdx  $$  Then, I pull out a $-1$ and interchange summation and integration:  $$\sum_k\int (-1)^k\frac{(1/m)_k}{k!}x^{nk}dx  $$  $$ \sum_k (-1)^k\frac{(1/m)_k}{k!}\frac{x^{nk+1}}{nk+1} $$  $$ x\sum_k \frac{(1/m)_k}{k!}\frac{(-x^n)^k}{nk+1}  $$  So, I'm just right there, but not sure how to express this series in the general form of a hypergeometric series with the two additional Pochhammer symbols.  I even typed this last series into Mathematica, and it returned the Hyper. Function. What am I missing, or how do I transform this last series into the desired form? Calculate the components of a unit vector that lies in the xy-plane and makes equal angles with the positive directions of the x- and y-axes It's just a doubt.  $\vec { A } = A \hat{ x }  + A\hat { y} $  $ A\hat { y} =A\hat{ x} $  $\vec { A } = A \hat { x }  + A\hat { x} $  Now finding the magnitud of the vector,  $A=\frac { 1 }{ \sqrt { 2 }  } $  So the components of the unit vector are:  $\vec { A } = \frac { 1 }{ \sqrt { 2 }  } \hat { x } +\frac { 1 }{ \sqrt { 2 } } \hat { y} $  Is my answer right? Possible to use draws from two distributions to get draw from distribution with density their product? I want to typeset a piece of code containing line breaks.  New lines should indent to a specified point in the previous line.  Here is a monospaced example to illustrate what I mean.  Notice how 'case' and 'of' line up below, as well as 'let' and 'in':  swap : forall a, b. Tuple a b -&gt; Tuple b a swap a b x = case x              of tuple a b y z. let x' = tuple b a z y                                in x'   The code I want to typeset is not monospaced, so I can't just use a verbatim environment to get what I want.  The actual LaTeX of the first line, for instance, is  \mathsf{swap} : \forall\alpha,\beta.\;\mathsf{Tuple}\;\alpha\;\beta\to\mathsf{Tuple}\;\beta\;\alpha   How can I align some text to a specific point in the previous line? What do you call a person who started something that is later followed by everyone? Examples of bijective map from $\mathbb{R}^3\rightarrow \mathbb{R}$ Could any one give an example of a bijective map from $\mathbb{R}^3\rightarrow \mathbb{R}$?  Thank you. How do I install drivers for a Canon LBP-2900 printer? I seen many times how people describe how to's about LBP-2900, and 10-12 steps from start to end of how to download, unpack, build driver, fix driver, make it work... Could be there some .deb package with ready-to-go driver for Ubuntu? This printer is very popular... Unexpected output of xargs Executing a certain action for all elements in an Enumerable CDN: How is it possible that my DNS delivers a different IP depending on the visitors location? I found  how a CDN works. But there is one thing I don't really understand. Let's assume I setup multiple DNS servers at my location and they use the nameserver domains dns1.example.com, dns2.example.com and dns3.example.com. This DNS servers are able to deliver a server IP depending on the visitors location (ping, geo database, browser language or whatever). Now I update this nameserver settings for my domain www.example.org at the registry.  Now, the very first request on www.example.org with an expired TTL tries to resolve the domain. It asks:   the local .hosts/DNS, if TTL expired: the internet providers DNS, if TTL expired: the root DNS, if TTL expired: my local dns1.example.com   But if I understand it correct, the new IP is then added to all these nameserver caches until the TTL expires again. So how is it possible to send other IPs to the visitor depending on his location?  In  theandym said the request is "forwarded", but I don't think this is how a CDN works, because "forwarding" means lengthen the transmission way resulting a longer loading time. Or does a CDN require zero TTL for the domain?  Update1 Through  I found  describing how they optimized CDN performance. It did not explain how the CDN works in general, but there were interesting explanations like the following:     Thereafter, whenever a client attempts to fetch content hosted on the   CDN, the client is redirected to the node determined to have the least   latency to its prefix. This redirection however is based on the prefix   corresponding to the IP address of the DNS nameserver that resolves   the URL of the content on the client’s behalf, which is typically   co-located with the client.   This means Google checks at first the latency of all IP prefixes and defines a DNS resolution table (?) for all available prefixes. And if a visitor has the IP 198.51.100.231 the Google server IP is used, that is set for the prefix 198.51.100.0. But again: How does Google's DNS know which IP the visitor is using? Most visitors resolve Google's domain through their internet provider and by that the resolving is done through those external DNS servers or not?  As an additional example: If I start a DNS resolution for the domain facebook.com with different online tools (hosted in different countries) it is resolved to different IPs with different domains like:   31.13.92.36 Reverse: edge-star-mini-shv-01-frt3.facebook.com 31.13.76.68 Reverse: edge-star-mini-shv-01-sea1.facebook.com 31.13.69.228 Reverse: edge-star-mini-shv-01-iad3.facebook.com 157.240.2.35 Reverse: edge-star-mini-shv-01-ort2.facebook.com   After that I thought it could depend on the DNS server location used by the visitor, but I tried my own (Deutsche Telekom, Germany), Google's (8.8.8.8) and a major one from France (Orange) and they all returned for facebook.com the IP 31.13.92.36. I get different lightning render with the same scene camera setup.  Cycles render (both experimental and supported feature set) gets weaker lightning and needs more energy.  How can I get the same lightning and reflection setup with EEVEE and Cycles? Like the subject: short sci-fi story about Earth blockaded by other human colonies.  The best humans have colonized some stellar systems. But they begin to treat humans of earth like inferiors. A war began, colonies won the war and blockaded the earth, but despite this the earth won. Who is the author? Callback animation to begin only after ALL children have finished animating Every Artinian ring is isomorphic to a direct product of Artinian local rings Does C# have anything comparable to Python's list comprehensions? how can i automatically record every terminal session?