NetBeans auto-generated comments, one word per line: really? - comments

When I add components or anything that automatically generates comments in NetBeans (7.1.2), the comments come out with one word per line. Like this:
/*
* If
* Nimbus
* (introduced
* in
* Java
* SE
* 6)
* is
* not
* available,
* stay
* with
* the
* default
* look
* and
* feel.
* For
* details
* see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
Really??? This is just silly. This happens no matter what the source of the auto-generated comments is. I have looked through the options and settings, but I haven't found a way to fix this (unless I'm blind as a bat, in which case I apologize in advance). If all auto-generated comments are going to look like this, I'm going to have ridiculously long source code, or have to fix it manually, or have constantly to waste time deleting these long wastes of space. Anyone know of a way to resolve this?
Thanks.

Had the same issue and finally figured it out. There's an option under Tools -> Options -> Editor -> Formatting to fix this. Set "Language" to Java and "Category" to Comments. Under the "General" section, uncheck "Wrap Text at Right Margin."
And that fixes it. I assume this is a bug of some sort, but until it gets fixed this seems to work.

There are bug reports for things similar to this, for example: http://netbeans.org/bugzilla/show_bug.cgi?format=multiple&id=203719
Let's just wait for a fix. Patience.

Related

wrap multi-line comments in vs code

VS Code seems to understand what it means to wrap multi-line comments differently from what other IDEs understand. For instance if I set Intellij to wrap multi-line comments at column 100, it breaks the line for me. But if I ask VS Code to do the same, it visually wraps the line but if I later open the same file in a simple text editor, I get one long line.
How do I get VS Code to auto break long comment lines?
Intellij:
/**
* Intellij will break this line
* at the correct location
* because I asked it to break
*/
VS Code
/**
* VS Code will wrap this line
at the correct location
but it's really one very
long line.
*/
I don't think VS Code provides native support for this.
There is an extension in the marketplace for this though: https://marketplace.visualstudio.com/items?itemName=stkb.rewrap.

Trick sonar into ignoring commented code

I was wondering if there is a way to trick sonar into neglecting commented out code while still keeping it inside. I would like to leave the snippet of code in there for modifications at a later date but would also like to increase compliance.
I have this for example
// bdgItems.setGpIncrease(zero); and this is where i get compliance issuses. on the other hand regular comments like // get data points is no cause for issue. I'd like to keep the commented code in there to pick up where I left off in the next cycle of development, but like i said, reduce the issues. Ive tried a few ways in tricking it like // [DELETE THIS] bdgItems.setGpIncrease(zero); or // bdgItems . setGpIncrease ( zero ); with spaces in between words but it still knows! I was wondering if some of you vets knew any tricks [i'm fairly new to sonar].
Thanks in advance!
It's not recommended, as Mithfindel already advised.
Simply replace dots and semi-colons with underscore.
Code sample: documentClient.deleteDatabase("dbs/" + DATABASE_ID, null);
The resulting comment without the warning would be: // documentClient_deleteDatabase("dbs/" + DATABASE_ID, null)_
This is a typical technical debt management issue.
If you "leave it there for later", then you are indeed adding technical debt into your source code, that you intend on repaying later. So SonarQube flagging this commented out code as issues is intended behavior.
You still have the option to flag those issues as false positives, but I do believe you should keep them as true issues, if only to remind yourself of coming back to fix them.

Geany4Windows text editing

I have used Geany4Windows for a long while but am still confused how it handles editing text files and I decided to ask for help now!
If I open a new file from menu I can type plain text in it and yet when I save the file it does not give a .txt extension option to save as and while I can add this to the end of the name I give to the file and save it and it saves as a .txt file with no problem. If instead, I do not do this and leave off the file extension, and then save it, it saves as a file with no extension!
There is an option to open a new template file but in my Geany4Windows there is no .txt template. I tried making my own by making a file with a {fileheader} and saving it in C:\Program Files (x86)\Geany\data\templates\files as file.txt.
This does then give me the option to open a new template text file but when I save that the text fileheader produces this:
/*
* mynewdefaulttexttemplateGeany.txt.txt
*
* Copyright 2014 Richard <Richard#RPDHPI5PAVILION>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/My first text file from new text template I just created in Geany.....
The file header shows as >> mynewdefaulttexttemplateGeany.txt.txt << with a double .txt extension.
If I could fix this file header for my default template file.txt file (so it doesn't save with the extension added twice), I would be happier working with plain text files in Geany4Windows! Anyone know how I can fix this please? Thanks.
MY EDIT
I have fixed this now and it was helped by Matthews post below (& see my comment on that).
To recap the solution:
I made a new custom file type file.txt with {fileheader}
To make this work I added the line txt=*.txt to filetype_extensions.conf
Also I created filetypes.txt.conf and added..
[settings]
extension=txt
lexer_filetype=C
[styling=C]
# multiline comments
comment_open=/*
comment_close=*/
This works now! See screenshots before & after:
after:
I do like Geany4Windows but it can be interesting trying to customise it to use new filetypes etc etc. Happy coding & editing with Geany on Windows & Linux (does it run on Mac?!). I'm pleased this is fixed now. :-)
You could create a file named like filetypes.Text.conf and inside of it put:
[settings]
extension=txt
Then add it to filetype_extensions.conf [Extensions] section like:
...
Text=*.txt;*.text; etc...
...
The manual has more details about custom filetypes.
You can create a *.txt-file by saving your file like foo.txt or baa.txt. Plain text not necessarily having txt-extension.
To explain Matthews answer more, you have been using filetype None, which does not have an extension. By creating the filetype Geany now knows about files with extension .txt
BTW you can edit filetype_extensions.conf by menu->tools->configuration files-> filetype_extensions.conf.

Magento 1.3.2.4 - Advanced search results bug on price sorting

I've got a small problem that I can't figure out how to fix.
First thing, I CAN'T update magento to a real version who's fixed it. So, I'm looking for an alternative to fix this bug, I can't find out how they fixed it in magento releases, that's why I'm asking here.
Second thing, I'm using Magento 1.3.2.4
When I do a search with the advanced search system and try to sort the restults by price, I've got the following message :
You cannot define a correlation name '_price_order_table' more than once
I already found some potential answer on Stackoverflow and some other website, like this one : Magento - using the catalog/product_list block more than once
But it's not really my case. I don't have a duplicate block in my layout xml files.
Would any of you have any idea of why I've got this error message ? It seems to be a duplicate use of a "left join" on the same table with the same alias, but how can I find where ?
Thank you so much to anyone who read this until the end and especially to the ones who will try to help me and answer me ! :-)
Anyway ... I spent too much time on this question to search the perfect solution and debug magento.
I ended in commenting /lib/Zend/db/Select.php on line 760 where the exception was thrown. The sorting works anyway, even with an exception thrown.
Sample of this file and with the line commented.
if (!empty($correlationName)) {
if (array_key_exists($correlationName, $this->_parts[self::FROM])) {
/**
* #see Zend_Db_Select_Exception
*/
#require_once 'Zend/Db/Select/Exception.php';
//throw new Zend_Db_Select_Exception("You cannot define a correlation name '$correlationName' more than once");
}
I saw the suggestion somewhere on the web when I started to search for this issue some hours ago. Anyway, it's always the same thing : when I get to ask for help, I give up on great fixes and finally accept a workaround.
Hope this may help someone someday and if anyone figure out any other solution, please share ! ;-)

Crazy Xcode garbling with code hint

I'm having an Xcode problem, where at various times during code hinting, all the letters on the page get totally garbled and mixed around . If i select another document and then return to my initial doc, it's back to normal. This is extremely irritating, plus enervating, and i'm a bit concerned for the security of my files.
Here's a screenshot of what it looks like when its all busted. the top two lines would be where the crazy times begin.
http://tinyimage.net/share-444E_4C69B955.html
Is anybody else having the problem? and/or knows how to make it stop?
It is particularly bad when i have a constants file that i import and it code hints to extern variables in there.
Yikes!
Thanks for the help!

Resources