Multi-line commenting

Okay, so we've been having a little side argument at work for a few weeks now.
The premise is, is it best practice to use multi-line C-style comments in Java code any more?
The arguments tend to vary from saying that the following is ugly:
// This is a multiline comment.
// Isn't it pretty?
//To the above being better than the following:
* This is a multiline comment.
* Isn't it pretty?
*/The latter argument tends to be based around the fact that multi-line comments "cancel each other out" for want of a better description. (I.e. you cant have nested C-style comments because the first close will close both) e.g.
*int x = 200;
*int y = 300;
* *A comment
*int a = 1;
//Oh no- the above can't work!
String s = "abc";I'm interested to know what the forums think of this.

meacod wrote:
masijade. wrote:
You do realise though, that those leading *'s on each line in those C style comments are not necessary, right? ;-)Oh, of course. I just did that to illustrate the point a bit more clearly.Okay, I thought you did, but I have known a few people who didn't. ;-)
I suppose another item that enters into this is whether you believe in commenting out code or not. I'm firmly of the belief that you should never commit whole swathes of commented-out code; it either exists and will work, or doesn't work and should therefore be taken out. Others of course feel differently...True, but sometimes you're just trying things and may change it back, in which case it's easier to just comment out one portion. Not that that should be more than temporary, of course. ;-)

Similar Messages

  • How to enter a multi-line comment in the Info editor?

    When entering comments for a song (in Command-I Info), is there an easy way to break the comment into multiple lines?
    I realize that I can copy-and-paste from a text editor, but (a) it's cumbersome (b) the line breaks don't show in the Comments column, so it's pretty ugly.
    Any suggestions?

    hi,
    hope it helps.
    create a fieldcatalogue.
    and give output length as 100 characters for the field in which u have multiline data.
    plz reward if useful.
    regards,
    srishti

  • JavaScript editor single line comment bug

    Where a singe line comment (//) include Turkish specific character (ğüşıöçĞÜŞİöç) editor shows unexpected token "UNEXPECTED_CHARACTER" error.
    But multi line comment (/**/) work correct.

    Hi,
    This has been fixed and will be available when the next build of JDeveloper 11g is placed on OTN.
    Thanks
    Ashwin

  • How to add multi-line text in comments field of song tags in iTunes 12?

    Recently upgraded to iTunes 12 and can no longer enter multi-line text in the comments field of a song tag.  Used to use option+return (alt+enter) to go to a new line (carriage return).  Can it still be done?  Any help in this regard would be appreciated.

    See my other post for the solution to this problem.

  • How to create a multi-line table/column comment

    Can someone tell me how to create a multi-line table or column comment?
    Apparently, the concatenate operator (||) does not work with the COMMENT statement.
    I've searched the Oracle manuals and couldn't find an answer.
    COMMENT ON TABLE sometbl IS 'i would like to break up this comment into several lines in order to improve readability'; Effectively, this is what I'd like to do (but it doesn't work):
    COMMENT ON TABLE sometbl IS
      'i would like to break up ' || CHAR(10) ||
      'this comment into several lines ' || CHAR(10) ||
      'in order to improve readability' || CHAR(10); Oracle version is 10.2.0.4

    Why not just
    SQL> create table t (a int)
    Createtable successfully completed.
    SQL> comment on table t is 'i would like to break up 
    this comment into several lines 
    in order to improve readability'
    Commenton successfully completed.
    SQL> select * from user_tab_comments where table_name = 'T'
    TABLE_NAME           TABLE_TYPE  COMMENTS                               
    T                    TABLE       i would like to break up               
                                     this comment into several lines        
                                     in order to improve readability        
    1 row selected.?

  • Comments & multi-line text not showing up on summary report

    My multi-line answers and comments are not showing up on my summary report

    Hi;
    The summary report does not show the text based answers.  This isn't something FormsCentral supports.
    If this is an important feature for you, we do have a "Feature Request" form where you can vote on popular existing ideas or add a new one of your own:
    https://adobeformscentral.com/?f=XnF-KJVCovcEVQz9tZHYPQ
    Thanks,
    Josh

  • Multi line custom field badly saved to database

    Hello community,
    we're fighting currently against a strange issue.
    All projects has some multi line custom fields to fill every week for project status.
    During this exercise, some of the comments seems not well saved to database.
    While coming back to the PDP, we are seeing a strange behavior :
    Starting from that, I tried to look in the database and the saved html format is badly formatted, you can see a </div> in the middle and a missing one at the end of the sentence:
    <div>Révision et approbation de l&#39;ODS de Facilité.</div> <div>&#160;</div></div> <div>Compléter&#160;le questionnaire à soumettre aux experts.</div>
    <div>&#160;</div> <div>Présentation et choix des experts.
    As of now, we did not find any reason why this is happening.
    While opening back the PDP in edition and saving back ,the problem is solved.
    This is annoying because we are treating the html code as xml for reporting as seen here (http://aboutmsproject.com/converting-rtf-to-text-in-sql-revisited/
    ) and this is crashing because of badly formatted html code
    any advices?
    regards
    Jérome

    Hi Jerome,
    I've seen this issue occur when text is pasted into the field from other applications, like Outlook and Word. I've not yet been able to determine how to get it to stop. The error then causes the invalid XML issue you are seeing. A former co-worker had successfully
    integrated the use of jQuery into PDPs. I'm wondering if they have a HTML clean function.
    Thanks for finding my post useful!
    Treb Gatte, Project MVP, Tumble Road LLC |
    @tgatte | http://AboutMSProject.com

  • FormsCentral PDF Form- How to View Multi-line Fields

    I have a FormsCentral PDF form, which allows users to fill out the form and save as a PDF. However, after receiving the completed forms, I am unable to see all the text in the multi-line field boxes without opening them and scrolling down. Since I will be sharing several of these competed forms with a review panel, please let me know:
    1) How to display the entire content of the multi-line field boxes rather than having the reader scroll down, then
    2)  How to save the completed forms so that its read-only when I send it to the review panel

    I can point you to some online information.  I really don't know the steps myself.
    This blog talks about how to do it in LiveCycle Designer: http://blogs.uoregon.edu/developments/2010/12/29/pdf-making-text-fields-grow-to-accommodat e-text/comment-page-1/
    You could also consider asking the user in this post for their idea on how to do it without making a dynamic form (LiveCycle): http://forums.adobe.com/message/4841774
    Is there a reason you don't use FormsCentral to collect the responses?  You could sign up for a 1-month subscription unless you have security or other reasons not to collect with FormsCentral, and then you'd be able to collect your responses and download each one as a PDF form individually and that form would be locked and have expanded text fields.  You could stop automatic renewal and you would still have access to the form and responses in your Free level account (but could not collect more than 50 responses, if you already have greater than 50 those would remain).
    Thanks,
    Josh

  • REGEXP_INSTR on a multi line string

    Hello ,
    I am trying to search through a string that is stored with multi line and trying to find the first occurrence of a character.
    For example : The string is -
    "This is a sample
    text to test
    from [first string] to [second string] "
    When i try to search for the first occurrence of "[" and "]" regular instr function is returning the complete string
    This is the query i used:
    The above string is stored in a varchar2 column named - comments
    select substr(comments,instr(comments,'['),instr(comments,']')) from my_table
    This above query returns : [first string] to [second string]
    i assume instr returns the first occurence of a letter in the given string. i was looking for [first string] but it returns me both. Can this be replaced with regexp_instr function?.
    Any help on this would be much appreciated.
    Thanks

    user619203 wrote:
    Hello ,
    I am trying to search through a string that is stored with multi line and trying to find the first occurrence of a character.
    For example : The string is -
    "This is a sample
    text to test
    from [first string] to [second string] "
    When i try to search for the first occurrence of "[" and "]" regular instr function is returning the complete string
    This is the query i used:
    The above string is stored in a varchar2 column named - comments
    select substr(comments,instr(comments,'['),instr(comments,']')) from my_table
    This above query returns : [first string] to [second string]
    i assume instr returns the first occurence of a letter in the given string. i was looking for [first string] but it returns me both. Can this be replaced with regexp_instr function?.
    Any help on this would be much appreciated.
    Thankslike this?
    SQL> ed
    Wrote file afiedt.buf
      1  with tmp as
      2  (
      3  select 'This is a sample
      4  text to test
      5  from [first string] to [second string]' txt from dual)
      6  select substr(txt, instr(txt, '['), instr(txt, ']') - instr(txt, '[') + 1)
      7* from   tmp
    SQL> /
    SUBSTR(TXT,INS
    [first string]Also questions of these types are better asked in {forum:id=75} forum.

  • REGEXP:  In-line comments

    I am building a formatter for MU* game coding (MUSHes, if you are familiar). In short, the program takes this:
    &TEST me=$test:     
      [setq(0,#2)];
    ## Test Comment
      @switch/first
        [ifelse(1,1,0)]  ## Inline test comment.
      =
      0,
    ##          Another Comment with more spaces
          @pemit %#=%ch%crERROR:%cn Uhoh!
      1,
          @pemit %#=%ch%cgGAME:%cn Good!
        }parses through it, and produces a single line:
    &TEST me=$test:[setq(0,#2)];@switch/first [ifelse(1,1,0)]=0,{@pemit
    %#=%ch%crERROR:%cn Uhoh!},1,{@pemit %#=%ch%cgGAME:%cn Good!}NOTE: The first step is pulling all of the comments (This is where I am having trouble), I will work on removing newlines and spaces, et al, after I overcome this hurdle.
    The problem I am running into is that the '## COMMENT' regexp I am trying to build is not working. I am currently using \#\#[(\s+)(\S+)]+$, but this is ending up with everything after the [setq()] function being axed. All I want to do (at this first point) is remove everything from '##' to the end of that input line.
    In my readings, I am finding that the way Java parses MULTI-LINE strings is very different from other languages, such as Perl. Java wants to match the /entire/ string, which I do not want.
    How do I flag the pattern object to say 'Hey, only apply/match this pattern in /each line/ of this multi-line string.' ?

    It looks like you're trying to use square brackets for grouping, which is wrong. Square brackets define a character class, within which most characters lose any special meanings they normally have, but class shorthands like \s and \S still work. So you've created a character class that matches parentheses, plus signs, any whitespace character, and anything that's not a whitespace character. In other words, it matches everything.
    The regex you need is actually very simple:  Pattern commentPattern = Pattern.compile("##.*");I should also mention that the '$' anchor normally doesn't match line ends; you have to compile the Pattern with the MULTILINE flag set to make it do that. It wouldn't make a difference with your regex, though, since the [\s\S]+ will always gobble up the rest of the input anyway.

  • Permanently save line spacing in a multi-line text field

    Me: Adobe Acrobat 8 Pro, Windows Vista
    (I think the people who will be using the form have Reader 7 on Windows)
    I work in a doctors' clinic, and we use phone message sheets to document conversations between the patients/us/nurses/doctors, and I scanned the form and made it into a fillable PDF for our secretaries to fill out more quickly. The "message" area has pre-printed lines on it, and the multi-line text field I placed there needs to match up to the lines. I used the Rich Text Formatting options to set it to "Exactly 24 Points," but I can't get it to KEEP the formatting permanently. The only way I could get it to save the formatting in that field was to put a space in it and then save it, and then give that to the 2 phone secretaries. It works perfectly the first time, but instead of just closing/re-opening the file to start a new message, one of the secretaries highlights everything in the "message" field and deletes it... which deletes the line spacing formatting. I've told her
    b numerous
    times to leave that starting space in the field, but she "forgets" so all of her messages look messed up. So is there a way to force that line spacing
    b PERMANENTLY
    ???? Here's a shrunken screenshot of the field -- I wish I could just erase the lines altogether so the spacing wouldn't matter, but the secretaries type/print the message out, then the nurses/docs write on the page with pen so the lines have to stay. http://img187.imageshack.us/my.php?image=notepreviewph8.jpg
    Thanks!

    You can set the font size of the text. Then play with the underlines in the original document to match the needs of the font that is used. Print to a new PDF and then use replace pages to put the new page into the form without changing the form fields. I was able to do this with a word processing document by adding underlining in the document with 12 pt and setting the font to 12 pt in the text field. You can play with the font, the border of the field, and the underlining in the original document to get the desired result. Is this optimal, probably not. However it does the job.

  • Multi Line Text Custom Field

    Multi line text custom field is not coming in ms project Professional

    Pradeep,
    You cannot access Multiline text fields from Project Professional and in Project Server Views. These fields are for use in Project Details pages and with workflow for demand management in Project Server. Please refer to the article shared in earlier post.
    I would recommend you to create a Excel/SSRS report if you would like to show data available in this fields to end users.
    Hope this helps.
    ===================================================
    Thank you,
    Kiran K.
    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful

  • Address Book: Importing Multi-Line Fields

    A common and often unavoidable import format for Mac Address Book is Comma Separated Value files (.csv). Address Book cannot import CSV files that have multi-line fields, such as might be included in Notes, because it cannot tolerate embedded newline characters (a.k.a., carriage returns, line breaks). (See http://docs.info.apple.com/article.html?path=AddressBook/4.0/en/ad808.html. The CSV spec (http://en.wikipedia.org/wiki/Comma-separated_values) addresses this need by requiring that fields which contain newlines be enclosed in quotes, but Address Book doesn't adhere to this part of the standard.)
    Here's a way to import CSV files and have multi-line fields preserved:
    Using an editor, replace +every embedded+ newline character in the CSV file with "\n". Take care to not alter the newline characters that end each record. Import the resulting file into Address Book using the CSV option. Selecting the 'Last Import' group, export those specific records using the vCard option. Then delete those records. Then import the vCards previously exported. Presto!
    Apparently, although Address Book is blind to "\n" when importing CSV files, and exporting vCard fields, it interprets this character sequence as newline when importing vCards.

    Hi Adam,
    Thanks, but the problem is not importing to AddressBook, it is exporting.  I did discover from another that I can export very easily to a Numbers spreedsheet.  It is exceptionally simple.  But it will not export custom fields.  Someone said that is because of a vcard standard.  My custom fields are just "name" fields that I have labeled differently.  But Numbers does not support the name (it only takes the name of the card).
    Christine

  • Need a JavaScript to enable/view Multi-line option for Text fields.

    Hello All,
    I need a JavaScript to enable/view Multi-line option for all the Text fields in PDF Form.
    Assume that I have a PDF form of Fields from F1 to F100 and it contains 25 Checkboxes, 25 Combo Box and 50 Text Fields. Now i need a javascript for which i need to enable Multiline for only Text Fields. So Is there any JS for which i can enable the Multiline option for only Text fields and not for ComboBox or Checkbox.

    Hi timo,
    Thanks for your help. iam trying to use the iteraor approch to do this. but i don't know how to fetch the data entered in the form that was built by the iterator. can you please tell me .
    thanks

  • How to Remove the /Div in a Multi-line Field when reporting in Excel, getting

    I am uisng Excel Services to extract data from PS2013.  And the Multi-line text fields include the </Div> syntax.  I have looked at a lot of the links regarding how to do this.  I have even borrowed code that was on someones blog. 
    When I try and use it I get the following message and cannot not seem to resolve it after reading varous links regarding this issue. 
    Any ideas?  As a work around I have created an Excel Macro to remove it, however would like to solve it in the query
    Error Message
    The data types
    Nvarchar and Ntext are incompatible in the add operator
    Here is the syntax
    declare @Headxml nvarchar(350)
    declare @Footxml nvarchar(50)
    set @Headxml = N'<?xml version="1.0"?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"
    [<!ENTITY  nbsp "&#xA0;"><!ENTITY quot "&#x22;">]><html><body>'
    set @Footxml = N'</body></html>'
    SELECT   ProjectOwner.ProjectUID as [ProjectUID],
    ProjectOwner.ProjectName as [Project Name],
    ProjectOwner.[Project Number] as [ECP#],
    TaskRelated.TaskName as [Task Name],
    MSP_WssRiskToTaskLinks_UserView.RiskID as [Risk ID],
    MSP_WssRiskToTaskLinks_UserView.Title as [Risk Title],
    MSP_WssRiskToTaskLinks_UserView.Status as [Status],   
    MSP_WssRiskToTaskLinks_UserView.AssignedToResource as [Assigned To],
    MSP_WssRiskToTaskLinks_UserView.Owner as [PM], 
    MSP_WssRiskToTaskLinks_UserView.DueDate as [Due Date],  
    MSP_WssRiskToTaskLinks_UserView.Probability as [Probability],
    MSP_WssRiskToTaskLinks_UserView.Impact as [Impact], 
    MSP_WssRiskToTaskLinks_UserView.Exposure as [Exposure],
    MSP_WssRiskToTaskLinks_UserView.Cost as [Cost],
    MSP_WssRiskToTaskLinks_UserView.CostExposure as [Cost Exposure],  
    MSP_WssRiskToTaskLinks_UserView.Category as [Category],
    ISNULL(LTRIM((CONVERT(xml,(@Headxml+MSP_WssRiskToTaskLinks_UserView.[Description]+@Footxml),3)
            .value(N'(/)','nvarchar(4000)'))),'') AS [YourMulti-lineCustomFieldNewName],
    MSP_WssRiskToTaskLinks_UserView.MitigationPlan as [Mitigation Plan],  
    MSP_WssRiskToTaskLinks_UserView.ContingencyPlan as [Contingency Plan],
    MSP_WssRiskToTaskLinks_UserView.TriggerTask as [Trigger Task],
    MSP_WssRiskToTaskLinks_UserView.TriggerDescription as [Trigger Description],
    MSP_WssRiskToTaskLinks_UserView.CreatedDate as [Created Date],
    MSP_WssRiskToTaskLinks_UserView.CreateByResource as [Create By],
    MSP_WssRiskToTaskLinks_UserView.ModifiedByResource as [Modified By],
    MSP_WssRiskToTaskLinks_UserView.ModifiedDate as [Modified],
    TaskRelated.TaskUID as [TaskUID],
    TaskRelated.TaskName as [Task Name],
    TaskRelated.TaskStartDate as [Task Start],
    TaskRelated.TaskFinishDate as [Task Finish] FROM dbo.MSP_WssRiskToTaskLinks_UserView
    LEFT OUTER JOIN dbo.MSP_EpmProject_UserView AS ProjectOwner ON ProjectOwner.ProjectUID = MSP_WssRiskToTaskLinks_UserView.ProjectUID
    LEFT OUTER JOIN dbo.MSP_EpmProject_UserView AS ProjectRelated ON ProjectRelated.ProjectUID = MSP_WssRiskToTaskLinks_UserView.RelatedProjectUID
    LEFT OUTER JOIN dbo.MSP_EpmTask_UserView AS TaskRelated ON TaskRelated.ProjectUID = MSP_WssRiskToTaskLinks_UserView.RelatedProjectUID 
    AND TaskRelated.TaskUID = MSP_WssRiskToTaskLinks_UserView.RelatedTaskUID LEFT JOIN dbo.MSP_WssRelationshipType ON
    MSP_WssRiskToTaskLinks_UserView.RelationshipTypeID = MSP_WssRelationshipType.RelationshipTypeID                
    ORDER BY ProjectOwner.ProjectName ASC,  MSP_WssRiskToTaskLinks_UserView.RiskID
    Andrew Payze

    Hi Andrew,
    We normally create a function to do this. Some examples can be found here:
    http://blog.sqlauthority.com/2007/06/16/sql-server-udf-user-defined-function-to-strip-html-parse-html-no-regular-expression/
    http://lazycoders.blogspot.co.uk/2007/06/stripping-html-from-text-in-sql-server.html
    http://stackoverflow.com/questions/457701/best-way-to-strip-html-tags-from-a-string-in-sql-server
    Paul
    Paul Mather | Twitter |
    http://pwmather.wordpress.com | CPS

Maybe you are looking for