comments

Regular expression finding empty comments in code

拈花ヽ惹草 提交于 2019-12-08 06:24:35
问题 i am looking for a regular expression which only finds empty java comments like the following one: /** * */ Eclipse creates those when e.g. generating a serial version id... There is another thread about finding all comments however i didn't manage to adapt the regex to only "filter" out the empty ones. //.*|("(?:\\[^"]|\\"|.)*?")|(?s)/\*.*?\*/ Any ideas? Thanks! 回答1: Try this: \/\*\*[\s\t\r\n]*[ \*]*[\s\t\r\n]*\*/ Should match any string which starts with /**, ends with */ and contains only

How to make add replies to comments in Django?

放肆的年华 提交于 2019-12-08 05:45:36
问题 I'm making my own blog with Django and I already made a Comments system.. I want to add the replies for each comment (like a normal comment's box) and I don't know what to do this is my current models.py comments: class Comment(models.Model): post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='comments') author = models.ForeignKey(User, on_delete=models.CASCADE) text = models.TextField() created_date = models.DateField(auto_now_add=True) parent = models.ForeignKey('self',

Team Foundation Server CheckIn Comment Template

孤人 提交于 2019-12-08 04:45:06
问题 I want to be able to provide a default comment template when developers check in items into TFS. e.g. "Description: Code Reviewer: Incident #: " I know there's a policy with Power Tools that checks if any text has been entered at all, but I'd like some predefined text to be presented ready for the developer to fill in the rest. I know there's also a 'Check-in Notes' section, but I'm trying to avoid this to make the process as streamlined as possible. The comments are also the first thing a

how to skip over lines of a file if they are empty

余生长醉 提交于 2019-12-08 04:30:15
问题 Program in python 3: This is my first program involving files. I need to ignore comment lines (start with #) and blank lines, and then split the lines so they are iterable, but I keep on getting and IndexError message that says string index out of range, and the program crashes on the blank line. import os.path def main(): endofprogram = False try: #ask user to enter filenames for input file (which would #be animals.txt) and output file (any name entered by user) inputfile = input("Enter name

Most common/liked syntax for in-code documentation (comments)?

拟墨画扇 提交于 2019-12-08 04:08:57
问题 I've been coding PHP with Notepad++ for years now, but today I downloaded Eclipse IDE. One of its features is auto-completing certain "syntax-patterns", such as comments. I've seen a lot of different ways to implement comments and documentation into php-files, so now I started wondering, should I follow the syntax Eclipse suggests. Here's a snap of what I mean: What do you think? Martti Laine 回答1: it's phpdoc format, a way to auto document your code using comments. http://www.phpdoc.org/ 回答2:

trying to access Github issue comments using PyGithub library

感情迁移 提交于 2019-12-08 03:12:08
问题 I am trying to access issue comments using PyGithub library. this is the function which I implemented, def get_issue_comments_dict(self, repository): """ get issue comments outputs reponame: issue title, issue url, comments Return type: dict """ repo = self.user_obj.get_repo(repository) issues = repo.get_issues() issues_dict = {} i = 1 for issue in issues: issue_dict = {} issue_dict['url'] = issue.url issue_dict['title'] = issue.title issue_dict['comments'] = [comment for comment in issue.get

What this Delphi's define {$WARN GARBAGE ON} means?

二次信任 提交于 2019-12-08 02:53:53
问题 I am keen on finding new conditional defines and keywords in the Delphi language which are undocumented. Stuff like {$WARN GARBAGE ON} http://qc.embarcadero.com/wc/qcmain.aspx?d=77686 I report such stuff in Quality Central but the issue got closed and "Promoted to Internal Database". What does this mean? Should I expect an answer to this already year and half old question? 回答1: These two warnings are now documented. GARBAGE : Turns on or off warnings produced when the presence of non

Count the number of threads on a parent comment in ReactJS

陌路散爱 提交于 2019-12-07 20:18:32
问题 I have an array in React like this. { "comments":[ { "id":1, "comment_text":"asdasdadasds", "author":"adsfas", "post_id":1, "children":[] }, { "id":2, "comment_text":"idlsfgh", "author":"asdsda", "post_id":1, "children":[ { "id":3, "comment_text":"fdsfdsfdsf", "author":"sdfdsf", "post_id":1, "children":[ { "id":4, "comment_text":"fdsfdsfd", "author":"sdfsdfdsfsd", "post_id":1, "children":[] } ] } ] } ] } Now, I want to count the total number of replies on every parent comment. So the array

Regex to source code comments

谁都会走 提交于 2019-12-07 19:09:14
问题 Is there a regular expression to match any line comment, but avoiding the comments inside strings? I need all content in a line after // (with the // included) For example: //Comment (match!) bla bla bla bla //Comment (match!) this string "foo // foo" (don't match because it's inside "") 回答1: The following regular expression will correctly match any strings and regular expressions in the input: var strings = /("((.|\\\n)*?([^\\"]|\\\\)|)"|'((.|\\\n)*?([^\\']|\\\\)|)'|\/[^*](.*([^\\\/]|\\\\))\

Getting the height of a 'Facebook Comments' widget/social plugin

杀马特。学长 韩版系。学妹 提交于 2019-12-07 18:52:06
问题 Using Facebook Javascript SDK+XFBML, I'm implementing the fb 'comments widget', as explained here. then, using the fbml line: <fb:comments href="someurl.com" num_posts="2" width="400"></fb:comments> creates an iframe with the comments widget. The height of the iframe is of-course according to the length of the comments; I need to make changes to my page according to the height of the comments widget. I can tap into when the widget has finished loading, by using FB.Event.subscribe('xfbml