How do I comment / uncomment a block of code in PsychoPy Builder - psychopy

How do I comment / uncomment a block of code in PsychoPy Builder?
If I select a number of lines I can in/outdent it as a block using TAB and SHIFT TAB, I want to comment / uncomment the block in a similar way in the Builder interface (handy for when testing)
I've had a search but not found out how yet?
Thanks

It seems that you can comment/uncomment entire blocks of code with Ctrl-' and Ctrl-Shift-'.

Sorry, this hasn't been added as a key-binding yet to the Builder Code Component. You'll just have to surround your code with triple quotes, as Jonas suggests

Related

How to add line breaks to Redmine markdown in code highlighting?

The Redmine textile formatting guide directs us to use code highlighting like so:
<pre><code class="ruby">
Place your code here.
</code></pre>
And while line breaks are preserved within <pre> tags, once I add the <code class="python">, it removes all line breaks and places all the text on a single line. And of course, hacks like (which answered this question) or html tags don't work because it's still wrapped inside <pre>.
I've tried wrapping each individual line with <code></code> all within one <pre></pre>, but that didn't work. I've tried adding double spaces to the end of each line, and additional new lines in between but to no avail.
And while the Redmine guide above says code highlighting relies on Rouge, my version of Redmine uses CodeRay, whose website examples handle line breaks perfectly.
Thanks in advance!
Things are working ok for me. See my screenshots. Perhaps your theme is affecting that.
I'm using Abacus office 1.3.4 theme on Redmine v3.2.
Could any plugins that you have installed be causing that?

How to bookmark code snippets in intellij ide?

I have line of code which may be not optimized enough, so i want to keep track of them and later try to improve them. Is there any way to tag code and later find them easily by their tag name?
Yes, just use
//todo optimize code
your code
or
//fixme fix bug
your code
and later you can find them in the TODO tool section at the bottom of the IDE. here todo and fixme tags are keywords. You can add more customized tag in File->settings->TODO.

'fold up' sections of code - like when you close a control structure

I remember that there was a tag which made it possible to fold multiple lines.
e.g. like if you would fold down a for loop:
to
Is there a tag which makes this possible? Or is this an IDE specific tag?
Depends on the language and ide/editor.
In C# there are #region's that can be used for this. In some editors you can enable folding on all scopes (brackets). In some editors you can teach the editor to enable folding on comments with brackets in them ("//{" "//}").
In most cases this is an editor option that has to be enabled and configured.
What editor are you using? (and what language is this, JavaScript?)
For netbeans checkout the following: (You don't need to go past the first one)
http://wiki.netbeans.org/FaqCustomCodeFolds - Manual method
http://wiki.netbeans.org/SurroundWithCodeFolding - Code Template
https://ui.netbeans.org/docs/ui/code_folding/cf_uispec.html#custom - Talks about the how they work.
Example from first article:
// <editor-fold>
Your code goes here...
// </editor-fold>

IntelliJ wrapping comments in Javascript

Is it possible to wrap long comment lines in IntelliJ in javascript files? I have turned on line wrapping as shown in the settings below, but when I do a code reformat, it doesn't wrap the line.
It's not supported yet on code reformatting, added a new feature request, please vote.
I'm using IntelliJ 14 on a Mac, which has a Fill Paragraph command. Access it via the awesome universal Command-Shift-A action search feature. Works like a charm!

How to delete all NSLog's & comments from my Xcode application?

Is there anyway to delete the NSLog lines from the app by any trick/tool? I usually use NSLog's in each and every method to understand the flow of control and to know about the values of the app's variables. I also use lots of comment lines to explain the nature of methods and variables.
At some point these NSLogs and comment lines make the program hard to for me to understand. So I need to keep deleting and recreating them. Is there a way to show/hide them by any trick in Xcode?
Use the global research & replace tool (cmd-shift-f, or Edit, find, Find in Workspace)
Clic on Find, select Replace
Style => Regular expression
For the NSLogs, search
NSLog\(.*\).*$
and replace by a space.
For the comments, search
\/\/.*$
and
\/\*.*\*\/
and replace by a space.
And finish by replacing manually those ones
/* fjeizghrij
eopgfjeipgez
*/
because I don't know how to grab them safely?
EDIT :
At last, beware of this global replace because you won't be able to undo ! Copy/paste your project before, for example. You should use the preview fonctionality of the global replace too, and check each entry.
I'm not sure what the exact reason is why you want to remove the NSLog lines and comments.
if you can read the source code hard, to remove the comments, set the comments colour in the Xcode preferences to same as the background or set their font size to 1 and you won't see them when you read the code. :)
I have no idea for the NSLog, but I'm using the following way to avoid the unwanted logging in the final release.
this is a simple macro:
#ifdef DEBUG
#define DebugLog(...) NSLog(__VA_ARGS__)
#else
#define DebugLog(...) { }
#endif
I'm using the DebugLog(...) as I would use the NSLog(...) normally, and the Xcode is logging only in DEBUG mode, I don't need to remove any log when I create the release version of the app.