ampersand

Perl calling subroutine with leading '&' [duplicate]

好久不见. 提交于 2019-12-11 08:53:20
问题 This question already has answers here : When should I use the & to call a Perl subroutine? (4 answers) Closed 5 years ago . Every now and then I see Perl scripts where subroutines are called with a leading '&'. Is this legacy, or does it give any benefit? As calling the subroutine without the ampersand sign works as well. sub mysub { print "mysub\n"; } mysub; &mysub; Thx/Hermann 回答1: Calling with & is generally a code smell that somebody doesn't know what they're doing and are in a Perl4

.htaccess Removing ampersand from URL?

佐手、 提交于 2019-12-11 08:39:18
问题 I have been banging my head against a wall for a long time trying to figure out how to get rid of the last part of some of the URL's on my site. For example, I would like to rewrite this:- http://www.mysite.com/335-protective-wrapping&page=prod to this http://www.mysite.com/335-protective-wrapping There are about 2000 URL's with &page=prod at the end of them which I need to remove. Here's some more example URL's http://www.mysite.com/335-protective-wrapping&page=prod http://www.mysite.com/455

Ampersands in Wordpress titles break my share to social media links

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 17:29:33
问题 I was hoping to get some help with a bit of a coding problem that has been driving me crazy. I'd preferably like to write "&" instead of "and" in my wordpress post titles. But writing out ampersands breaks our post share links for twitter, facebook, and google-plus. Facebook is able to actually display the link (it takes the ampersand out of the title, though), but twitter full out fails, and google-plus as well. This is the code for the share links: <ul> <li class="video-twitter"><a target="

php file_get_contents($url) & turns into &

懵懂的女人 提交于 2019-12-10 03:50:19
问题 I am trying to make a request to the coinbase api like this $url = "https://api.gdax.com/products/BTC-USD/candles?start=".date($format,$starting_date)."&end=".date($format,$ending_date)."&granularity=".$granularity; and then I pass that in file_get_contents($url) but it gives me an error file_get_contents( https://api.gdax.com/products/BTC-USD/candles?start=2015-05-07&end=2015-05-08&granularity=900 ): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request. The problem of course

PHP DOMDocument->loadXML with XML containing ampersand/less/greater?

僤鯓⒐⒋嵵緔 提交于 2019-12-08 14:19:30
I'm trying to parse an XML string containing characters & < and > in the TEXTDATA. Normally, those characters should be htmlencoded, but in my case they aren't so I get the following messages: Warning: DOMDocument::loadXML() [function.loadXML]: error parsing attribute name in Entity ... Warning: DOMDocument::loadXML() [function.loadXML]: Couldn't find end of Start Tag ... I can use the str_replace to encode all the &, but if I do that with < or > I'm doing it for valid XML tags too. Does anyone know a workaround for this problem?? Thank you! If you have a < inside text in an XML... it's not a

PHP DOMDocument->loadXML with XML containing ampersand/less/greater?

試著忘記壹切 提交于 2019-12-08 07:14:43
问题 I'm trying to parse an XML string containing characters & < and > in the TEXTDATA. Normally, those characters should be htmlencoded, but in my case they aren't so I get the following messages: Warning: DOMDocument::loadXML() [function.loadXML]: error parsing attribute name in Entity ... Warning: DOMDocument::loadXML() [function.loadXML]: Couldn't find end of Start Tag ... I can use the str_replace to encode all the &, but if I do that with < or > I'm doing it for valid XML tags too. Does

Use ampersand in CAST in SQL

两盒软妹~` 提交于 2019-12-07 17:52:09
问题 The following code snippet on SQL server 2005 fails on the ampersand '&': select cast('<name>Spolsky & Atwood</name>' as xml) Does anyone know a workaround? Longer explanation, I need to update some data in an XML column, and I'm using a search & replace type hack by casting the XML value to a varchar, doing the replace and updating the XML column with this cast. 回答1: select cast('<name>Spolsky & Atwood</name>' as xml) A literal ampersand inside an XML tag is not allowed by the XML standard,

How can I make my xml safe for parsing (when it has & character in it)?

一曲冷凌霜 提交于 2019-12-07 08:44:18
问题 I've been given an xml string which I need to put through a parser. Its currently complaining because of an illegal xml character. Very simplified example: <someXml>this & that</someXml> I know that the solution is to replace & with & , but I'm not generating the XML and therefore have no control over the values. A simple string replace is not the right way to to this since the '&' has special meaning in XML and a global replace of '&' with '&' would ruin the special meaning which was

Ampersands (&) in xlink:href attributes of SVG images?

我是研究僧i 提交于 2019-12-07 01:26:35
问题 I'm building an SVG document which contains various image tags. The xlink:href (source URL) attributes for the images contain query strings with ampersands. If I escape them as %26 or the ascii encoding ? they're not valid query strings and the server won't deliver the image. I can't escape them with CDATA because they're attributes (not nodes). I've tried creating an xlink:href node within the image tag but that get's ignored by the SVG parser. I want to use pure SVG (not SVG within HTML) so

jQuery Autocomplete and Special Characters in WordPress

我与影子孤独终老i 提交于 2019-12-06 13:17:36
Hopefully im not missing an already existing answer to this question. Im working with a wordpress theme that uses jquery ui autocomplete to provide category selections in a front end form. Code is below. Problem is that if a category name has an &, it cant display the character and instead shows & in the autocomplete box. Can i make it show the character properly? ` jQuery(function(){ /* Auto Complete */ var availableTags = [ <?php $terms_array = array(); $terms = get_terms( 'majors', 'hide_empty=0' ); if ($terms) foreach ($terms as $term) { $terms_array[] = '"'.$term->name.'"'; } echo implode