comments

Doctests that contain string literals

吃可爱长大的小学妹 提交于 2019-12-03 21:29:24
I have a unit test that I'd like to write for a function that takes XML as a string. It's a doctest and I'd like the XML in-line with the tests. Since the XML is multi-line, I tried a string literal within the doctest, but no success. Here's simplified test code: def test(): """ >>> config = \"\"\"\ <?xml version="1.0"?> <test> <data>d1</data> <data>d2</data> </test>\"\"\" """ if __name__ == "__main__": import doctest doctest.testmod(name='test') The error I get is File "<doctest test.test[0]>", line 1 config = """ <?xml version="1.0"?> ^ SyntaxError: EOF while scanning triple-quoted string I

If comments are safe, then why doesn't `x = 0; x+/*cmt*/+;` or `var f/*cmt*/oo = 'foo';` work?

拥有回忆 提交于 2019-12-03 20:10:37
This thread inspired the question. Here are the code samples again. I'm looking for an answer that tells exactly what is going on. Both x = 0; x+/*cmt*/+; and var f/*cmt*/oo = 'foo'; produce syntax errors, which renders the answers in this question wrong. From ECMAScript reference : Comments behave like white space and are discarded except that, if a MultiLineComment contains a line terminator character, then the entire comment is considered to be a LineTerminator for purposes of parsing by the syntactic grammar. You're interrupting a word instead of a sentence. ++ and foo are words. People

Django Comments and Rating Systems

送分小仙女□ 提交于 2019-12-03 18:54:21
I am looking for a blogging and comments system that can smoothly integrate with my Django sites. I've found there is a lot on the Net and got lost a bit, and I don't have much experience on this. Hope you guys can give me some suggestions. Here are the things that I would like to have: Tag Clouds Articles Archive (by months/by years) Articles Rating (e.g. with Stars or customize icons) Comments to the particular Topic/Articles Sub-Comments of a particular comments (i.e. following up comments) Blogs/Articles Searching Able to relate other articles that is relevant (i.e. follow up Articles)

CSS Nested Comments

筅森魡賤 提交于 2019-12-03 18:38:18
问题 Is there any way to nest comments in CSS? For example, when I try to comment out the following two statements, the outer comment ends when it encounters the */ in the nested comment, leaving the rest of the first statement and second statement uncommented. /* #container { width: 90%; /* nested comment here */ margin: 0 auto; } #container .class { width: 25%; } */ I run into this problem often when I want to try out a different styling technique that involves multiple statements. I'm familiar

Can't comment selection

旧巷老猫 提交于 2019-12-03 18:20:20
问题 Sometimes, it seems I can't comment my code with the usual shortcut ( command + / ) under Xcode 8 Beta 4. The option is disabled in the menu (screenshot below). Do you have any idea why? Am I the only one having this issue? EDIT: It seems to work again after restarting Xcode... Still looking from where it comes. It's a bit annoying... EDIT2: It still occurs on Xcode 8.1. Maybe because I have 2 versions of Xcode installed (normal and beta)? Can't fix it anymore with a simple restart! EDIT3:

“from __future__ imports must occur at the beginning of the file”: what defines the beginning of the file?

↘锁芯ラ 提交于 2019-12-03 17:43:33
问题 The Python script ''' a ''' from __future__ import print_function works well (i.e., does nothing), but ''' a ''' ''' b ''' from __future__ import print_function causes: File "C:\test.py", line 8 from __future__ import print_function SyntaxError: from __future__ imports must occur at the beginning of the file Why? https://docs.python.org/2/reference/simple_stmts.html#future says that: A future statement must appear near the top of the module. The only lines that can appear before a future

How to make a line as a comment in SED

我只是一个虾纸丫 提交于 2019-12-03 17:19:12
Excuse me if it is a repeat. I have crontab entries which look like: * * * * * sleep 15;/etc/opt/wer.sh 1 * * * * /opt/sfm/qwe/as.sh How to insert a # on the line which contains a call to "as.sh" using sed ? How to uncomment it back? You can use: sed '/\/as.sh/s/^/#/' which will replace the start-line zero-width marker with a comment character for all lines containing /as.sh , as shown in the following example: pax> echo ' * * * * * sleep 15;/etc/opt/wer.sh 1 * * * * /opt/sfm/qwe/as.sh ' | sed '/\/as.sh/s/^/#/' * * * * * sleep 15;/etc/opt/wer.sh #1 * * * * /opt/sfm/qwe/as.sh But you need to

How do I disable or hide the unwanted Disqus ads on my website?

℡╲_俬逩灬. 提交于 2019-12-03 17:08:01
Imagine that one day, suddenly, random ads started appearing on your website... Recently Disqus started forcing unwanted ads inside of the Disqus comments , displaying those nasty ads on your website(s) without your knowing. It seems that they only target the sites with "big enough" daily traffic or use some other arbitrary criteria, so the ads do not appear on all the websites, but only on relatively busy ones. This way Disqus "forces" you to upgrade to the paid subscription plan - for the paid users these ads become optional (i.e. you can disable them in your Disqus admin panel). What to do

Possible to have Visual Studio TODO comments in aspx/ascx files appear in task list?

感情迁移 提交于 2019-12-03 16:52:23
问题 We develop asp.net webforms using visual studio 2008. For multilingual support, we translate all our text. However, when designing, we usually just enter the english text and come back to translation later (it interrupts flow of work otherwise). I've added a "ToTranslate" tag in the options. Adding //ToTranslate: something in C# code correctly adds the entry to the Task List. I haven't however figured out how to do the same for aspx and ascx files (where most of our user text lives).

How can I perform a diff that ignores all comments?

别等时光非礼了梦想. 提交于 2019-12-03 15:44:42
问题 I have a large codebase that was forked from the original project and I'm trying to track down all the differences from the original. A lot of the file edits consist of commented out debugging code and other miscellaneous comments. The GUI diff/merge tool called Meld under Ubuntu can ignore comments, but only single line comments. Is there any other convenient way of finding only the non-comment diffs, either using a GUI tool or linux command line tools? In case it makes a difference, the