JuliaBox - Console Copy Paste - Clipboard - Not working - console

Machine: Windows7, browser: Firefox (lastest/recent).
I'm using Julia browser console (JuliaBox) to learn Julia. It works!
I not able to do the following though.
If I select some text in the console and right click > Copy it, the data is not getting copied to the global/system clipboard buffer.
I can open a new file within the console (vi new.txt) and there if I paste the data, it works!!
But if I want to copy the same selected/copied data outside of JuliaBox console, it doesn't work (i.e. if I try to paste it to Notepad++ or in outlook email, word doc etc).
Am I missing anything?
ALSO -- If I copy anything from notepadd++ / word doc or any data from an opened app or browser window, then I CAN'T paste it to JuliaBox console!! even if I try Control+C / Right Click Copy to copy the data.

copy-paste data from JuliaBox console:
use Ctrl+c/Ctrl+v on Windows/Linux or Cmd+c/Cmd+v on Mac.
copy-paste data into JuliaBox console:
a workaround is to use the term.js widget Paste from browser in the right-click menu.
this seems to be a bug, the issue says it will be fixed in the future.

Related

iPyWidgets FileUpload not working as I expect it

Im currently trying to load a file in my jupyter notebook, to read it's content.
My Code:
file = widgets.FileUpload(
description= 'Title',
accept='.csv',
multiple=False,
)
box = widgets.HBox([file])
display(box)
# New Cell
print(str(file))
I run the first cell, after that i use the FileUploader to Upload a .csv File before running the second cell.
I expect the output to be a dict containing the files Context like "content" etc.
A Screenshot of a simpler version:
Does anyone know that i'm doing wrong?
I also tried every other idea that came to my mind.
Unfortunately, at the moment file upload widget only retrieves file value if you are using classic Jupyter lab through your browser, and IDEs such as Pycharm and VScode do not support the feature.
Open the notebook on classic Jupyter lab and try to upload the file there, and you will see your code works perfectly.
Try accessing file.value instead.
More info here: https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html#file-upload

Enconding .rmd file mac

Yesterday I was doing an RMD file with a Mac and everything went well, but today, when I reopened the file it looks like this:
D??Pˆ#A????DE????UOØÊË?? Z†é¡Áç€????Z[??¯íñ»•??`#??A??xE??eE??ç#????
f=T??ž Ë^??‚??l[iótó:ò??§FÌ????w72??øø‡ˆDA????U??#?? N??¯??J‡??E????NO´Á??€í??Ç_žË??S|V1™??;¯??îR‘”xe^gP??‹#K??????tO9¢??ì|£æ8??????i;v??7Z??§¬ç˜??/‰RM’ÂmŽlwi3vÇ7œ¡ÊAç????ZE????êJøÀ‡??E??D??AQ??Œ^aD????A[??ô…b›N?????óò†^ƒ®«??Èq??%Z§??Ë®????r#,æ????D??}Q¾ Tçœ??BQ??Œ,^Ž®t??;~??Z†hƒrá/??‡¨EŒ??]Iì«ÁÈ????SO‘Êyç??{~]ë??KôüÍ????nd#Xèñü•??amGo??akG{??jW}—(Ÿ˜
,??Ø&ï¿&ïbN??qô$…òš??6€¦??áY??ͬ??˜,(˜r-,”f}U?? Ë??_å??(Z–??$€ò??§^Ì®????3rÇ/œˆ#E????N??Aô??Í??^€??KQÈŒ??]QìŠÊ[ç¯??î^}??+Dž??\Wƒ??«#üƒ??µoÀa??E??9D????q['ò????‰®N??¤}î*|??
:????B[??ô,…š~5????Y…T›œ
Does someone know how to revert the encoding?
Though I am a Windows user, I have an easy way to make a corrupted file readable: you can reopen the file with whatever encoding you want. First of all, open the file as usual. Then, if you see the file garbled, click File and Reopen with Encoding... button, as shown in the following picture.
Choose Encoding will appear next, so you can choose one.

How to delete part of R studio console?

I don't want to erase the entire console, but just a few lines (as I have to submit my Rcode as an assignment and if I make an error, I want to be able to edit/clean up my coding). Thanks!
use R editor from File option.
type script in the R editor and run each line by selecting it and pressing Ctrl+R.
if you have typed it in console directly then you can still copy your typed script form the console and paste it in the editor

Saving .R script File Using Script

I am using R Studio and I want to save my script (i.e., the upper left panel). However, the only ways that I can find to do it are by either clicking the blue floppy disk icon to save or using the drop down menu File > Save > name.R
Is there any way besides using these shortcuts to save the script to a .R file or is the shortcut the only way?
Thanks.
You can use rstudioapi::documentSave() to save the currently open script file to disk.
From the source documentation, one can see that it can be used in conjunction with the id returned with getActiveDocumentContext()$id to make sure the document saved is the one running the script.
For your intended use, try:
rstudioapi::documentSave(rstudioapi::getActiveDocumentContext()$id)
For future reference, here is the reference manual of rstudioapi:
https://cran.rstudio.com/web/packages/rstudioapi/rstudioapi.pdf
I'm not yet allowed to comment, but this refers to the comment above that this does not work with .rmd files:
rstudioapi::documentSave(rstudioapi::getActiveDocumentContext()$id)
I tried and in Rstudio Version 1.2.5042 it does seem to work.
Every new tab in R(created by ctrl+shift+n) can be independently saved by using ctrl+s in the respective tab. If you intend to rename the file though, you may do it as you would rename any file in windows(goto the file location and single click on the filename). Hope my answer was of some help!

How to load a notebook without the outputs?

I mistakenly printed to much to the output during a single cell's execution and now the browser tab completely freezes every time that notebook is opened. I tried restarting ipython and it didn't help (I am guessing that each time it is loaded, also all the chunk of text is loaded with it).
Is there a way to load a notebook with outputs suspended or clear?
One hack if you're desperate: open the .ipynb file, which is a text file. Scroll down to the lengthy cell output and delete it. Of course, you need to be careful that the result is still a valid .ipynb file.
nbstripout is a simple tool that removes all output from a notebook (without needing to open the notebook in your browser).
your code will be saved in the form of JSON. open it with json viewer and carefully delete the unwanted output cell and save it back.

Resources