comments

A simple question about facebook comments plugin

半城伤御伤魂 提交于 2019-12-06 05:45:28
问题 I'm struggling with a very simple problem. The facebook documentation, as always, didn't give me enough explanation. I attached a facebook comments plugin to my site. And using a callback of "comment.create" event, I can get information of a just-create comment. FB.Event.subscribe('comment.create', function(response) { alert(JSON.stringify(response)); }); The json reponse looks like: {"href":"http://siteaddress.com/page.htm", "commentID":"111122223333" } What I like to do now is to retrieve

How to remove single line comments in php (eg “// remove this comment”)?

孤街醉人 提交于 2019-12-06 05:43:39
问题 I want to remove all single line comments (eg //comments ) from my code using regular expression. By now I'm using: preg_replace('/\/\/(.*)/','',$html); but it also removes strings like http://example.com . 回答1: You cannot do this reliably. There is no guarantee that // at any position in a file indicates a comment in PHP context. It might very well be contained in a string for example. It's only possible to approach this with a few concessions. For example if it is sufficient if it catches /

Multiple lines comments in Scheme (RnRS)

独自空忆成欢 提交于 2019-12-06 05:31:45
问题 I created this solution: ; use like this: ; (/* content ... */ <default-return>) ; or ; (/* content ... */) => #f (define-syntax /* (syntax-rules (*/) ((/* body ... */) #f) ((/* body ... */ r) r))) But is it really the best or easiest way? 回答1: You can't do it this way -- it won't work for a number of contexts. Here are some examples that won't work: (+ (/* foo */) 1 2) (define (foo a (/* b */) c) ...) (/* foo; bar */) (/*x*/) (let ((x (/* 1 */) 2)) ...) (let ((/* (x 1) */) (x 2)) ...) (car '

How can I get CSS comments with jQuery?

混江龙づ霸主 提交于 2019-12-06 05:20:48
问题 I am wondering how I can read CSS comments out of a linked stylesheet. I have this sample CSS loaded via: <link rel="stylesheet" type="text/css" media="all" href="test.css" /> #test1{ border:1px solid #000; } #test2{ border:1px solid #000; } #test3{/* sample comment text I'm trying to read */} I'm testing this in FF3. The following javascript reads the rules but doesn't read the comments in #test3 . window.onload = function(){ s=document.styleSheets; for(i=0;i < s[0].cssRules.length;i++){

How to reliably use `rem` within a command line without ignoring adjacent commands?

倖福魔咒の 提交于 2019-12-06 04:40:29
问题 I am trying to use the rem command to place a remark in a command line that contains several commands. Here are some examples to illustrate what I mean: echo Hello & rem.Comment & echo world! (echo Hello & rem.Comment) & echo world! This works perfectly fine, both echo commands in each line are executed as I expect. The . seems to modify the behaviour of the rem command so that it does not treat the remaining line as comment: Hello world! If I placed a SPACE (or any other delimiter TAB , , ,

Removing hash comments that are not inside quotes

被刻印的时光 ゝ 提交于 2019-12-06 04:38:52
问题 I am using python to go through a file and remove any comments. A comment is defined as a hash and anything to the right of it as long as the hash isn't inside double quotes . I currently have a solution, but it seems sub-optimal: filelines = [] r = re.compile('(".*?")') for line in f: m = r.split(line) nline = '' for token in m: if token.find('#') != -1 and token[0] != '"': nline += token[:token.find('#')] break else: nline += token filelines.append(nline) Is there a way to find the first

C Comment in Emacs - Linux Kernel Style

北慕城南 提交于 2019-12-06 04:38:47
问题 I'm using (setq-default comment-style 'multi-line) and my region comments, when doing M-; , are: /* void main() * { * int i; * int b; * printf("format string"); * } */ But I want them to look like this: /* * void main() * { * int i; * int b; * printf("format string"); * } */ What do I have to change? 回答1: Try with: (setq comment-style 'extra-line) 回答2: Complementing the anler answer and answering my own question. To use the Linux Kernel commenting Style [1] in emacs, just set this variable in

Extract text in HTML comment using XPath and regex

你离开我真会死。 提交于 2019-12-06 04:24:30
问题 I'm trying to parse HTML files using an XML/HTML parser which contain hidden commented text for translation, namely X and Y below. <!-- Title: “ X ” Tags: “ Y ” --> Which XPath would best match X and Y? The //comment() function matches the whole node but I need to match the two occurences of text between “ and ” quotes. I guess one would need a combination of XPath and regular expressions to do that but I'm not sure how to tackle that. 回答1: I assume that the quotes in the comment are the same

HTML Comment Behavior

旧巷老猫 提交于 2019-12-06 04:18:37
So, I noticed while messing around in a Magento WYSIWYG editor (of all things) that <!> renders as <!----> in the resultant HTML. It also seems that enclosing any string in <! > renders a normal <!-- [string] --> comment. I only tested this in Chrome, but this behavior seems a little odd to me. I have looked at the W3C spec on comments , as well as this little document on the MDN. Neither gave me an answer I could really wrap my head around, though; what is the significance of the comment open delimiter ("--") , and if it is left out, how does <!> seem to always result in a proper comment? Is

Using social plugins for pre-existing Facebook posts

半腔热情 提交于 2019-12-06 04:12:33
If there a way to use the Facebook Feed, Comments, and Like social plugins for existing Facebook posts? We're looking for a way to have pages on our site supplementing existing Facebook posts made on our FB page. The goal is to keep all sharing, comments, and likes centralized around single post, rather than the usual model where each person shares a distinct post on their feed. Example post from McDonalds: http://www.facebook.com/photo.php?fbid=10151001277817014&set=a.10150319191897014.332821.50245567013&type=1 Ideally, we'd like to pull in the functionality of the above post (commenting,