jupyter - how to comment out cells? - ipython

Is it possible to comment out whole cells in jupyter?
I need it for this case:
I have a lot of cells, and I want to run all of them, except for a few of them. I like it that my code is organized in different cells, but I don't want to go to each cell and comment out its lines. I prefer to somehow choose the cells I want to comment out, then comment them out in one go (so I could later easily uncomment them)
Thanks

Mark the content of the cell and press Ctrl+ /. It will comment out all lines in that cell. Repeat the same steps to uncomment the lines of your cell.

I think the easiest thing will be to change the cell type to 'Markdown' with M when you don't want to run it and change back to 'Code' with Y when you do. In a short test I did, I did not lose my formatting when switching back and forth.
I don't think you can select multiple cells at once.

If you switch the cell to 'raw NBConvert' the code retains its formatting, while all text remains in a single font (important if you have any commented sections), so it remains readable. 'Markdown' will interpret the commented sections as headers and change the size and colour accordingly, making the cell rather messy.
On a side note I use this to interrupt the process if I want to stop it - it seems much more effective than 'Kernel --> Interrupt'.

You can switch the cell from 'Code to 'Raw NBConvert'

Related

How to move selected code segment to the left in VS Code?

The question is, how do I move the selected block of code by one or several tabs, but not to the right (which is done by selecting a code and pressing Tab key), but to the left? Without selection each line one by one and deleting whitespace?
Moving parts of code from one place to another with differences in indent levels is a bit hard without knowing the shortcut.
What I mean (Imgur)
Thanks!
For what you want,
Shift+Tab
should do the trick. However, I would like to recommend this extension which I find easier to use when formatting blocks of text: Indent One space
Note however this extension only indents selections by exactly one space, forward or backwards.

Watch App - Replace ... when text is too long

I have a problem with the size of my text.
When my text is too long in a WKInterfaceLabel, no problem, I just add line or I pass line at 0 to increase automatically the number of lines.
But with WKInterfacePicker, impossible to increase the number of line and I have "..." at the end of my text.
Do you have solutions to display all my text or, at least, to delete this "..." and replace it by some letters more from my text. I work with Swift.
For the second solution, I prefer have "My text" than "My te..."
Sadly, this is not possible. Apple doesn't provide any sort of way on managing that.
A possible, but rather complicated solution would be making a costume picker with labels with multiple lines and using the newly implemented WKCrownSequencer as well as the WKCrownDelegate in watchOS 3 to detect the state of the digital crown. The default picker animations might be impossible or very difficult to reproduce, but it might fix your problem.
try this set in size width = size to fit width content

Eclipse-RCP: Hide lines of text permanently, keep correct line numbers

I have text files which contain code inside an Editor. The user can run an analysis on a certain part of his code, which will result in a set of lines which should be hidden. Next I want to present the user with only the remaining lines, but with correct linenumbers, as from the original document. Possible solutions I thought of:
Open a new Editor which does not contain the hidden lines, but *somehow* still has correct line numbers
Hide the lines in the original editor, and offer a button for the user to 'unhide'. Probably a similar solution required as in 1.
I don't really know how to go about this. Folds would be a weird solution, because they can be unfolded individually, and seem to be more semantically tied to things like methods or classes. Also, simply creating a new document without the hidden lines results in wrong linenumbers.
Use a ProjectionViewer and reflection to invoke the private method ProjectionViewer.collapse(int offset int length). This method is only used internally to hide a certain portion of the text, by manipulating the ProjectionDocument (see http://eclipse.org/articles/Article-Folding-in-Eclipse-Text-Editors/folding.html).
After this, folding text in the editor using the annotations(the little +/- icons) WILL break everything, so this solution and regular folding are mutually exclusive.

How to set cell-color according to cell-value on ooo-calc?

I can change the style of a cell using conditional formatting. But there I would be limited to a maximum of 3 cases it can handle.
What I want to do is to get the value of a cell, convert it in a certain way and set the result as the cells background-color.
The simplest example would be cells with values between 0 and 10, resulting in gray-steps between white and black.
Is this possible? Are there ways to set the background-color of a cell automatically?
Thx!
This has been implemented in libreoffice 3.6 (see the release notes)
Format one cell how you want (not one you want to conditionally format).
Press F11 to get the Styles dialogue box
Use the button one from the top right, which is "New Style From Selection"
Type the name you want, e.g. BlackBack
Then do the conditional formatting of the relevant cells, choosing BlackBack
Source: http://www.oooforum.org/forum/viewtopic.phtml?t=61294
Note that you can find "Conditional Formatting" under the Format menu in OOo Calc.
As Joey said: "As far as I can see conditional formatting in OOo cannot do that. Excel has no problems there, though."
It's simply not possible... :-/

how to use paragraph text in uitableviewcell in cocoa-touch

I've been using uiLabels to put text in the cells of tableviews. I want to now use paragraph text that carriage returns to the next line instead of going out of the boundaries of the table cell. Would I do this by manipulating a uiLabel or would I use a different control all together like a text view.
Also is there any project examples out there that implement this?
Thanks,
Joe
Simplest way is to use a UILabel and set the number of lines in IB to > 1 then set the line break to "Word Wrap."
Another way is to use a UITextView, load the data and set it to 'disabled' so it can't be edited.
Finally, you can always go the UIWebView route and load it with formatted HTML, complete with line breaks, etc. Pretty heavy, but most flexible.
The simplest approach is to use a UILabel, probably. The only alternative would be to make a custom UIView subclass that draws the text directly, but that will give you marginal benefit.