Indent settings for atom-beautify with uncrustify for C/C++? - atom-editor

Where can the indent settings (tab width) be set for uncrustify run by the Atom package atom-beautify (on Windows)?
While the package settings offer to specify a path for an uncrustify config file (separately for C and C++), I can't figure out where the default settings come from.

The package directory is
Windows: C:\Users\<user>\.atom\packages\atom-beautify\src\beautifiers\uncrustify
Uncrustify is run via index.coffee, resulting in arguments like:
C:\uncrustify\uncrustify.exe
-c
C:\Users\<user>\AppData\Local\Temp\.....cfg
-f
C:\Users\<user>\AppData\Local\Temp\input...
-o
C:\Users\<user>\AppData\Local\Temp\output...
-l
CPP
If no path is configured in settings, it generates a temporary config via cfg.coffee. It may just look like
indent_with_tabs = 0
output_tab_size = 2
input_tab_size = 2
This may not be enough for uncrustify to modify the source as intended. I am not sure from where these settings originate (Atom Editor Settings?). So I just modified default.cfg in the package directory (reduce tab width to 4, spaces for tabs -- not sure which parameter did it), added that to the settings, et voila...

go to Atom's top menu bar -> Packages -> Atom Beautify -> Settings and open the C section as in the picture below:
there you must fill the Config Path with yours, mine, because I work on Ubuntu, was:
/home/ungalcrys/.atom/packages/atom-beautify/src/beautifiers/uncrustify/default.cfg
on Windows it migt be:
C:\Users\ungalcrys\.atom\packages\atom-beautify\src\beautifiers\uncrustify\default.cfg
default.cfg file already exists and you may have to comment one or two lines depending on the version of uncrustify.

Related

vi can't set paste(turn off auto indent while paste) in BusyBox

vi version is BusyBox v1.20.2 (2014-08-27 12:48:18 PDT) multi-call binary, which run on esxi machine.
Can't paste text without auto indent by these methods:
:set paste in vi editor
configure set noautoindent in .vimrc which located in $HOME directory.
How could I achieve that?
BusyBox's vi is tiny and doesn't know what paste is.
It also isn't VIM, so won't read .vimrc, but will read $HOME/.exrc if it exists and is only owned and writable by the user. You should be able to put set noautoindent there in a more recent version.
You also have the option of placing commands in the EXINIT environment variable, or passing them as an additional parameter with -c "some_command" (both of which should be implemented in the version you're using, and both of which allow multiple commands separated by \n).
I'll note that all of the above depends on vi having been built with the SETOPTS, SET and COLON features enabled (though -c should work without COLON), which should be the default.
The set of options supported by a current version appears to be:
autoindent
expandtab
flash
ignorecase
showmatch
tabstop

How to set default folder in JupyterLab file browser?

I was wondering if there is a way to set a default folder every time I open JupyterLab. Is there any command I can run through Anaconda PowerShell Prompt? Or a JSON property I can modify in settings tab? Thanks in advance!
If you want to open specific file in directory a, say a/notebook.ipynb but then navigate the file browser to directory b, relative to the root directory, you can use file-browser-path query in the navigation URL (documented here):
http(s)://<server:port>/<lab-location>/lab/tree/a/notebook.ipynb?file-browser-path=/b
You can use this method from command line thanks to LabApp.default_url traitlet:
jupyter-lab --LabApp.default_url='/lab/tree/a/notebook.ipynb?file-browser-path=/b'
You can skip the opening specific file part:
jupyter-lab --LabApp.default_url='/lab?file-browser-path=/b'
If you want to change the root directory, please see this answer which explains how to do so with ServerApp.root_dir traitlet (in older versions of Notebook<7.0 and JupyterLab<3.0 used to be named NotebookApp.notebook_dir). Again, you can use it from command line, and even specify an absolute path:
jupyter-lab --ServerApp.root_dir='/home/user/project/'
# or on Windows say:
# jupyter-lab --ServerApp.root_dir='C/users/user/project/'
You can combine the two approaches, e.g.:
jupyter-lab --ServerApp.root_dir='/home/user/project/' --LabApp.default_url='/lab?file-browser-path=/project_subdirectory'
If you want to persist the changes (for either default URL or root dir), see the previously linked answer which details how to persist configuration.
Follow the answer . Just edit the alias alias my_jupn='source /home/$USER/anaconda3/bin/activate && conda activate MyPy38 && jupyter-notebook --notebook-dir=/home/$USER/Documents/Jupyter_Notebook'
and for JupyterLab alias my_jupl='source /home/$USER/anaconda3/bin/activate && conda activate MyPy38 && jupyter-lab --notebook-dir=/home/$USER/Documents/Jupyter_Notebook'
N.B. Here MyPy38 is your active environment name. and if any error occurs then change $USER to your UserName. Lastly, /home/$USER/Documents/Jupyter_Notebook will be change according to your choice.
According to the jupyter.org:
I configured like this.
Terminal command active your envirnment by conda activate Your_env_name and then jupyter lab --generate-config. jupyter_lab_config.py should be created in dir /home/$USER/.jupyter directory.
Find
# c.LabApp.app_settings_dir = '' and uncomment.
Then give your directory like this.
c.LabApp.app_settings_dir = '/home/$USER/Documents/Jupyter_Notebook'
Similar for jupyter notebook. jupyter notebook --generate-config and then nu-comment and edit like c.NotebookApp.notebook_dir = '/home/UserName/Documents/Jupyter_Notebook'
**NB: /home/$USER/Documents/Jupyter_Notebook is my changed default dir. Change it according to your need. **
The command
jupyter notebook --generate-config
will create a config file.
The path to this file is displayed in your terminal or PowerShell.
Set the desired folder path as the string c.ServerApp.root_dir in this file and make sure you uncomment the line after you set the string.
Windows users will have to use double backslash in paths, e.g.:
c.ServerApp.root_dir = 'C:\\YOUR\\PATH'

Where to config chromium options in atom editor

Due to an high dpi screen, I have to start atom with the following command to avoid blurred fonts:
atom --force-device-scale-factor=1 .
I can add the option to my desktop starters and I can define an alias for the shell. Out of curiosity, I'd like to add this configuration to the atom editor. As a result of some searching, I found the following solution for electron:
app.commandLine.appendSwitch "js-flags", "--harmony_proxies"
It should be in some sort of init script. But where would I add a line like this in the atom editor?
You could add it to
Setting -> Open Config Folder -> config.cson

How to set up your path so you can call 'julia' via the Terminal?

This is more of a n00b Unix question regarding how to set up paths correctly. It is also not a question that is specific to julia, but rather how to set up paths correctly in general (I suspect).
At the moment, the only way I can start julia via the Terminal is by using the command:
$ exec '/Applications/Julia-0.4.0.app/Contents/Resources/julia/bin/julia'
rather than $ julia
How can I set this up correctly?
Change to your home directory and find the file .bash_profile (note the . at the start: this is a hidden file. You can do ls -a to see if it is there, or just try to open it with an editor.)
Create the .bash_profile file if it doesn't already exist (e.g. using your favourite text editor).
Add the following line somewhere:
alias julia="/Applications/Julia-0.4.1.app/Contents/Resources/julia/bin/julia"
Open a new terminal window and enjoy!
(Note that 0.4.1 is the current latest stable version, which is what I have used here.)

Any idea about fixing this 'eclipse cdt -l error'

I am trying to link my AVR cross target application to my AVR cross target library.
The library is named Lib328P and the application is named LibTest. I have built the library and verified that the .a exists in the filesystem.
I am trying to link the library by Right clicking on the project>Clicking on C/C++ Build> Settings > AVR C++ Linker> Libraries adding Lib328P to the -l category and "${workspace_loc:/Lib328P}"
to the -L category
Here is the output to the console.
**** Build of configuration Debug for project LibTest ****
make all
Building target: LibTest.elf
Invoking: AVR C++ Linker
avr-g++ -Wl,-Map,LibTest.map,--cref -L"C:\Users\kempsa\indigo_workspace\Lib328P" -mmcu=atmega328p -o "LibTest.elf" ./something.o -lLib328P
c:/arduino-0023/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: cannot find -lLib328P
make: *** [LibTest.elf] Error 1
**** Build Finished ****
I have looked at the other posts and they suggest removing the lib and .a suffix. I am already doing that. Any help would be appreciated.
Thank you!
Sam
In your case, the linker is expecting to find the file:
C:\Users\kempsa\indigo_workspace\Lib328P\libLib328P.a
Are you sure it is present at that location? Or is it in a subfolder, possibly Release or
Debug?
This is the process that works for me:
When adding a library to be linked with your program, you make two entries. The entries are found on the project properties page by navigating to:
C/C++ Build > Settings
On the right pane, be sure to select whatever Configuration you are building at the top drop down box. (Occasionaly I make changes to the wrong configuration and wonder why those changes do not seem to occur.)
On "Tool Settings" tab is a navigation tree. On that tree, select
AVR C++ Linker > Libraries
On the right pane are two list boxes: Libraries and Libraries Path. These are where you add the two entries.
1.. In the top box, click the plus or + icon. Here you enter just the library base name. This is the library name without the "lib" and without the ".a"
For example, I have one "LibCore328v101".
That will cause the linker to look for a file "libLibCore328v101.a"
2.. In the bottom box, click the plus or + icon. Here you add the path to find that library file.
2a. You can simply type the path to the folder that contains the .a file.
2b. You can click the Workspace... button and navigate to the folder that contains your library. If you keep your libraries and programs in the same workspace this is a better method to specify a path. I use this, in in my example this text is created
"${workspace_loc:/LibCore328v101/Release}"
This is essentially a relative path to the library. This means you can create an entire duplicate of your workspace and all the library includes will still be correct.
When you see the linker output in the console window, you should see both options. In my example these are:
-lLibCore328v101 (lower case ell)
-L"F:\arduino-src\tt-wb-trunk-hg\LibCore328\Release" (upper case ell)
You can see that the Eclipse plugin has converted the relative path to the current absolute path. The linker will internally add the "lib" and ".a" to the library name.
You can repeat this process adding as many libraries and paths as needed.
For your multi-target programs, you create a different configuration for every build target. So instead of Debug and Release, you have "DebugNano" "DebugTiny", etc. For each configuration, change the path to the library.

Resources