What keystroke can you use to select a specific window within a tmux session? - tmux

In tmux, you can launch the visual layout for selecting a session/window with Ctrl+b s (C-b s).
You can then switch to the last opened window in any of the available sessions by typing the number beside that session.
When you highlight a session with multiple windows, tmux shows a split with the contents of each window. It also shows numbers over those splits which I presume are for selecting those windows (see image). However, when I type one of those numbers, I am instead brought to a window from among the available sessions. What keys can you use to select a window within a session?
Note, I am aware that I can launch the choose-tree command with C-b w with all windows expanded, but for now I prefer launching the layout showing only sessions.
Tmux layout with multiple windows in a session

Related

Can I autosave a running jupyter python notebook without having it open in a browser tab?

So I have a long-running python notebook.
As long as it's open in my browser's tab, it's autosaving every 2 minutes, and life is good.
Is it possible to keep it auto-saving even if I close the browser tab?
The kernel already keeps running when I close the tab, which is great.
This is kind of like "screen", but in jupyter
EDIT: Even if I leave the tab open in my browser, I noticed that after 24 hours, the "kernel status" in the top right becomes "disconnected", even though the running cell still has output being piped to it from the server websocket connection
No, you can't (for now), and their will be no point in doing it.
The reason is, as soon as you close your tab, some critical information is lost because it is in the memory of the Javascript VM that run the page.
Any update sent by the kernel after you've closed your page are lost.For example try the following.
create a cell with sleep(10);print('Hello')
Execute the cell
Quickly close and reopen the tab.
the "Hello" will never be printed.
The mapping between the "Execution request" and the "Execution reply" have been lost, and can't be recovered.
The Jupyter team is aware of that. The fixes are not that hard, but require a lot of careful refactor and API design. There was a long in person discussion in NYC at the end of August 2017. Right now the focus is to polish JupyterLab, and once this is done it will be one of the area of focus. It will go hand in hand with real-time collaboration.
In more detail, the fix requires to "move" the notebook model from the client (your browser) to a server side (what is serverside is handwaved for now, but here is not the place to expand it), there are technical questions about that, like what to do with widgets, and when collaborating what state is shared by everyone and what state is per-client. Like if you fold some code, should this be stored ? or not ?
If you are interested in that, I would suggest getting involved with JupyterLab, there will be soon a number of low hanging fruits to contribute that should quickly fix 80% of the usecases.

What does 'In [*]' mean in Jupyter notebooks?

What does In [*] at the upper left-hand of the cell mean when running a Jupyter notebook?
I know that when the cell in Jupyter notebook has not been run, it shows as In[ ], after running the cell, it shows as In[num].
What about In [*], does it mean that this cell is running now?
This means that your kernel is busy.
If you want to interrupt/stop the execution, go to the menu Kernel and click Interrupt.If it doesn't work, click Restart.
You need to go in a new cell and press Shift + Enter to see if it worked.
When a cell is displayed as "busy" with an asterisk, it can mean one of several things:
The cell is currently executing.
An "execute" command was sent to the cell, but another cell is currently executing. The cell will execute when its turn comes.
The kernel was interrupted / restarted while the cell was executing, it is currently not executing.
it would mean that either your code timed out or ran out of memory,
Check for infinite loops or memory leaks.
When a cell is displayed with an asterisk it means it's busy.
It might mean that: 1) The cell is now executing; 2)or it will execute when it's turn arrives. 3)or it is not executing because the kernel was restarted or interrupted.
My recommendation is that you save the file and restart the kernell in preferrence without running everything, but if you are sure everything can run without problems just do it and it will be faster for you.

Increase the command window in R [duplicate]

In R, I like to use reverse search (ctrl+r) to redo infrequent but complex commands without a script. Frequently, I will do so many other commands in between that the command history discards the old command. How can I change the default length of the command history?
This is platform and console specific. From the help for ?savehistory:
There are several history mechanisms available for the different R
consoles, which work in similar but not identical ways...
...
The history mechanism is controlled by two environment variables:
R_HISTSIZE controls the number of lines that are saved (default 512),
and R_HISTFILE sets the filename used for the loading/saving of
history if requested at the beginning/end of a session (but not the
default for these functions). There is no limit on the number of lines
of history retained during a session, so setting R_HISTSIZE to a large
value has no penalty unless a large file is actually generated.
So, in theory, you can read and set R_HISTSIZE with:
Sys.getenv("R_HISTSIZE")
Sys.setenv(R_HISTSIZE = new_number)
But, in practise, this may or may not have any effect.
See also ?Sys.setenv and ?EnvVar
Take a look at the help page for history(). This is apparently set by the environment variable R_HISTSIZE so you can set it for the session with Sys.setenv(R_HISTSIZE = XXX). I'm still digging to find where you change this default behavior for all R sessions, but presumably it will be related to .Startup or your R profile.
?history
"There are several history mechanisms available for the different R
consoles, which work in similar but not identical ways. "
Furthermore there may even be two history mechanism in the same device. I have .history files saved from the console and the Mac R GUI has its own separate system. You can increase the number of GUI managed history entries in the Preferences panel.
There is an incremental history package:
http://finzi.psych.upenn.edu/R/library/track/html/track.history.html
In ESS you can set comint-input-ring-size:
(add-hook 'inferior-ess-mode-hook
'(lambda()
(setq comint-input-ring-size 9999999)))

Copying text into minicom doesn't get pasted completely

I am trying to paste a line; which is:
setenv -p STARTUP "ifconfig eth0 -auto;boot -z -elf 136.170.195.87:vmlinuz-nfs-7231b0-D183-NFS-DEBUG 'root=/dev/nfs nfsroot=136.170.195.87:/export/home/joshis1/vmlinuz-nfs-7231b0-D183/rootfs/nfs rw bmem=226M#30M ip=dhcp'"
When I try to copy the line in minicom, the line is not copied completely.
What should I do?
I have solved this by setting Character tx delay to 1ms.
Ctrl+A followed by z
select 't'
select 'f'
type '1'
and there you go!
Maybe you are running without line wrap on? I had a problem until I started invoking with "minicom -w". In the problem condition, output line content beyond screen width was lost, input line content wrapped to beginning of line.
If I'm not wrong you should exit minicom, start it again with "minicom -w".
Or even better, try using 'screen' instead of 'minicom'. I gave up minicom a long time ago in favor of screen. Once you get used to it, you'll never go back!. Chris Stratton was probably right: you're overrunning the target. There is no flow control in virtually all embedded targets. That said, I do these copy operations from screen all the time using screen to set u-boot environment variables, and never have any issues. Depends on your target, too!
Invoke screen something like this:
screen /dev/ttyUSB0 115200
Of course, the device node corresponding to your serial port will be different depending on your serial device. The example above is typical for Linux with a USB serial dongle. On my macbook, it usually comes up as something like this for the same serial dongle:
/dev/tty.usbserial
If you like vi, you'll love screen.
I do like the suggestion of this answer to use screen.
However, if you want to keep using minicom an option is to enable both Software flow control and Line wrap.
To enable Software flow control:
press Ctrl+A followed by o
go down to Serial port setup and enter it
press g to switch Software Flow Control to Yes (if not previously enabled)
press Esc and select Save setup as dfl if you want to permanently save the configuration
To enable Line wrap:
press Ctrl+A followed by o
go down to Screen and keyboard and enter it
press r to switch Line Wrap to Yes (if not previously enabled)
press Esc and select Save setup as dfl if you want to permanently save the configuration
Line wrapping can also be enabled by starting minicom with the -w option or by pressing Ctrl+A followed by w.

FlexPrintJob pause Flex code execution

when using FlexPrintJob, after calling start(), a OS system print interface will appear, and at the same time Flex code execution will be paused, and it will remain paused until user finished interaction with the OS print dialog. the problem is I do have data from server, and the connection will time out within certain period, so is there any walk around to not pause the Flex code execution while OS print dialog is popped up. Thanks.
From the doc for FlexPrintJob:
You use the FlexPrintJob class to print a dynamically rendered document that you format specifically for printing.
This makes me wonder if you couldn't (essentially) fork off a second page from the browser that contains your print job and do the printing from there. This would leave your original page still running. In my flex apps I do this via PHP (create additional pages for printing and such). Example here.
Otherwise: you should finish all the server data d/l before starting the print job to avoid this issue.
Flex is only just recently starting to add multi-threading. It's adding worker threads of a sort but this won't help what you're asking for.

Resources