Rserve arguments: --save vs --no-save vs --vanilla - rserve

I am trying to understand the difference between the Rserve arguments --save, --no-save, and --vanilla. I don't see anything describing the effects of these in the documentation or any forums. Does anyone know exactly what these do?
In OSX, I need to specify one of these to run Rserve.

Those are R arguments and documented in the R documentation as well as in --help:
$ R --help
[...]
--save Do save workspace at the end of the session
--no-save Don't save it
--no-environ Don't read the site and user environment files
--no-site-file Don't read the site-wide Rprofile
--no-init-file Don't read the user R profile
--restore Do restore previously saved objects at startup
--no-restore-data Don't restore previously saved objects
--no-restore-history Don't restore the R history file
--no-restore Don't restore anything
--vanilla Combine --no-save, --no-restore, --no-site-file,
--no-init-file and --no-environ

Related

Terminator/config Is not in .config file

Description of Problem:
I'm trying to use terminator in a bash script but I keep getting an error stating that No such file or directory: ~/.config/terminator/config. and its keeping the terminals from popping up on screen. However when I run terminator on my terminal the window pops up. So I definitely have terminator installed I just don't know where terminator/config is.
Questions and summary of issue:
How would I check if terminator/config exists on my system?
Where would I find it since it isn't in ~/.config?
Why would this be happening?
Solutions that I know don't work and extra information
Uninstalling and reinstalling. I did it before I came to this site to ask.
These are the commands I used to install it the first time:
sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator
I don't think I was at the home directory when I installed terminator if that matters.
How would I check if terminator/config exists on my system?
Either find the file using 'locate':
$ sudo apt install locate -y
$ sudo updatedb # this is to update the file database
$ locate config
Or even better, use stat:
$ stat ~/.config/terminator/config
Where would I find it since it isn't in ~/.config?
If the file does not exist, you cannot find it ofcourse.
Perhaps create the file yourself.
$ mkdir -p ~/.config/terminator/
$ touch ~/.config/terminator/config
Why would this be happening?
The systems provides an error message. Because it expects there to be file, which isn't.
Please read the documentation.
the config file is created automatically if you make same permanent changes.
start terminator
right click -> preferences
go to tab profiles -> sub tab colors
choose a different color profile e.g. "Solirized light" https://i.stack.imgur.com/QYFyp.png
close preferences and confirm the color of the terminator has
changed.
now the file "~/.config/terminator/config" has been created, containing the current user configuration.

Terminal is not working as usual mac after trying to install CakePHP

I was downloading the CakePHP framework for a project. Below the steps:
Installation
1) Install PHP 5.6 from: http://php-osx.liip.ch/
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
2) add the updated PHP version to our path. So we edit .profile file
nano ~/.profile
Add into the file
export PATH= /usr/local/php5/bin:$PATH
Then hit Control + O to write out the file
Then hit Control + X to save the file
exit
Restart the Terminal
Now the terminal doesn't work as usually. I've tried to understand the shell concept and apply different solutions, but I can't even find the .profile file again.
I obtain errors like:
enter code here-bash: ls: command not found
Anybody can explain me what's wrong and the shell concept to properly understand shell (-bash)?
The problem is this:
export PATH= /usr/local/php5/bin:$PATH
You killed your PATH variable. You need to find a way to edit .profile file, and change that line to:
export PATH=$PATH:/usr/local/php5/bin
You could try editing with the following command (using vim):
/usr/bin/vim /Users/yourname/.profile
Or (using nano):
/usr/bin/nano /Users/yourname/.profile
Or just remove .profile file completely by doing /bin/rm /Users/yourname/.profile. Of course, in any case, you need to restart your terminal once you're done.

How to add man and zip to "git bash" installation on Windows

I am using git bash on Windows - that is git for Windows via the integrated bash. Apparently it uses the MINGW/MSYS underpinning. (Update from #VonC: It now uses msys2 since msysgit is obsolete since Q4 2015.)
So there are already a lot of MSYS tools installed - from awk to zcat. However I miss the man command and zip to compress multiple files into a zip file (unzip exists!).
Where from can I install them? I do not want to install another copy of the MINGW system! Any way just to add some pre-compiled tools to the git bash installation?
Here's another, slightly different, set of instructions to install zip for git bash on windows:
Navigate to this sourceforge page
Download zip-3.0-bin.zip
In the zipped file, in the bin folder, find the file zip.exe.
Extract the file zip.exe to your mingw64 bin folder (for me: C:\Program Files\Git\mingw64\bin)
Navigate to to this sourceforge page
Download bzip2-1.0.5-bin.zip
In the zipped file, in the bin folder, find the file bzip2.dll
Extract bzip2.dll to your mingw64\bin folder (same folder as above: C:\Program Files\Git\mingw64\bin)
7-zip can be added to gitbash as follows:
Install 7-zip on windows.
add 7-zip folder (C:\Program Files\7-Zip) to PATH
On gitbash exp: export PATH=$PATH:"C:\Program Files\7-Zip" (temporary)
On Windows, adding PATH like image below (permanent)
duplicate a copy of 7z.exe to be zip.exe
reopen gitbash again. done!
This way, it works on my laptop.
If you skip step 3. you still can call zip command as 7z instead of zip
Conclusion: Gitbash is running base on windows Path, I think you can run any command that you have added to your Windows PATH.
2016: The zip command can be installed from GoW (Gnu On Windows). man is not provided (too big).
It is to note, however, that if you only want to add the zip command from GoW, still the whole GoW system has to be downloaded and installed. Then you can delete the other commands from the bin directory, however make sure to keep the needed dlls in the directory.
Update 2021: tar/zip are by default installed on Windows 10.
7-zip based solutions are available below.
git-archive, is prepared without any installation, can create zip-archive.
mkdir workrepo
cd workrepo
git init
cp -r [target_file_or_dir] .
git add .
git commit -m commit
git archive -o ../myarchive.zip #
cd ..
rm -rf workrepo
Following script may be usable:
zip.sh foo.zip target_file_or_dir
#!/usr/bin/bash
set -eu
unset workdir
onexit() {
if [ -n ${workdir-} ]; then
rm -rf "$workdir"
fi
}
trap onexit EXIT
workdir=$(mktemp --tmpdir -d gitzip.XXXXXX)
cp -r "$2" "$workdir"
pushd "$workdir"
git init
git config --local user.email "zip#example.com"
git config --local user.name "zip"
git add .
git commit -m "commit for zip"
popd
git archive --format=zip -o "$1" --remote="$workdir" HEAD
I am so glad to share my experience on this issue that I haven't known for two years since the first day I played with Groovy. My method needs to have git for Windows installed in Windows OS.
These steps are for installing 7z command-line utility, which behaves a bit differently from zip:
Download and install 7-Zip from its official website. By default, it is installed under the directory /c/Program Files/7-Zip in Windows 10 as my case.
Run git Bash under Administrator privilege and navigate to the directory /c/Program Files/Git/mingw64/bin, you can run the command ln -s "/c/Program Files/7-Zip/7z.exe" 7z.exe
I am pretty sure it could help you a lot. Trust me!
On Windows, you can use tar instead of zip.
tar -a -c -f output.zip myfile.txt
which is same as,
zip output.zip myfile.txt
no need to install any external zip tool.
I use choco as my Windows Package Manager.
I install 7zip with choco using PowerShell (you must be admin to use Choco)
PS > choco install 7zip.install
Open another gitbash Terminal and locate the 7z.exe executable
$ which 7z
/c/ProgramData/chocolatey/bin/7z
Do a straight copy of 7z.exe to zip.exe and voila
$ cp /c/ProgramData/chocolatey/bin/7z.exe /c/ProgramData/chocolatey/bin/zip.exe
You can mimic a small subset of man behavior in the shell by mapping man <command> to <command> --help | less
Unfortunately, on my machine bash aliases won't add flags to positional arguments, it will try to run the flag as a command and fail (alias man="$1 --help" doesn't work).
And a function called man() is not allowed!
Luckily a combination of bash functions and aliases can achieve this mapping. Put the code below in your ~/.bashrc (create one if it is not there). Don't forget to source ~/.bashrc.
# man command workaround: alias can't pass flags, but can't name function man
m() {
"$1" --help | less
}
alias man="m"
It doesn't get you the full man page, but if all you're looking for is basic info on a command and its flags, this might be all you need.
You can install individual GNU tools from http://gnuwin32.sourceforge.net/packages.html such as zip.
Then add "/c/Program Files (x86)/GnuWin32/bin" to PATH in your startup script like .profile, .bash_profile, .bashrc, etc.
Here are the steps you can follow.
Go to the following link
https://sourceforge.net/projects/gnuwin32/files/
Find out whatever command you are missing
Here I need zip and bzip2 for zip command. Because zip command relies on bzip2.dll to run. Otherwise you will get error “error while loading shared libraries: ?: cannot open shared object file: No such file or directory”.
Unzip the downloaded files
Here I am downloading “zip-3.0-bin.zip” for “zip.exe” and “bzip2-1.0.5-bin.zip” for “bzip2.dll” in the bin folder. /bin/.exe
Copy the command exe file into git-bash folder
Here I am copying “zip.exe” and “bzip2.dll” to \Git\usr\bin.
Reference Link
https://ranxing.wordpress.com/2016/12/13/add-zip-into-git-bash-on-windows/
ln -s /mingw64/bin/ziptool.exe /usr/bin/zip
steps to install SDKMAN on windows
Run Windows Terminal in Admin rights. open git bash inside. (Ctrl + Shift + 4)
winget install -e --id GnuWin32.Zip
mkdir ~/bin
cp /usr/bin/unzip ~/bin/zip
curl -s "https://beta.sdkman.io" | bash
source "/c/Users/ajink/.sdkman/bin/sdkman-init.sh"
sdk selfupdate force
After you can install Java like this.
sdk install java 17.0.2-open
Done ! :)
In msys2, I restored the functionality of git help <command> by installing man-db:
|prompt> pacman -Syu man-db
|prompt> git help archive
For zip functionality, I also use git archive (similar to yukihane's answer).
Here's yet another 7-Zip option that I didn't notice:
Create a script named zip:
$ vi ~/bin/zip
Reference 7z specifying the add command followed by the args:
#!/bin/bash
/c/Progra~1/7-Zip/7z.exe a "$#"
Finally make it executable
$ chmod ugo+x ~/bin/zip
This helped to make a ytt build script happy.
+ zip ytt-lambda-website.zip main ytt
7-Zip 18.01 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-01-28
Scanning the drive:
2 files, 29035805 bytes (28 MiB)
Creating archive: ytt-lambda-website.zip
Add new data to archive: 2 files, 29035805 bytes (28 MiB)
Though this question as been answered quite thoroughly in regards to man there is one alternative to zipping that has not been highlighted here yet. #Zartc brought to my attention that there is a zip compression utility built-in: ziptool. In trying to use it however I found out it is no where near a drop-in replacement and you need to specify each individual file and folder. So I dug into the docs and experimented until I had a bash-function that can do all the heavy lifting and can be used very similar to a basic zip -qrf name * compression call:
zipWithZiptool() {
# Docs: https://libzip.org/documentation/ziptool.html
targetFilePath="$1"
shift
args=() # collect all args in an array so spaces are handled correctly
while IFS=$'\n\r' read -r line; do
if [[ -d "$line" ]]; then
args+=("add_dir" "$line") # Add a single directory by name
else
# add_file <pathInZip> <pathToFile> <startIndex> <length>
args+=("add_file" "$line" "$line" 0 -1)
fi
done <<< "$(find "$#")" # call find with every arg to return a recursive list of files and dirs
ziptool $targetFilePath "${args[#]}" # quotation is important for handling file names with spaces
}
You can then for example zip the contents of the current directory by calling it like this:
zipWithZiptool "my.zip" *
If you are willing to install CygWin also, you can add the CygWin path to your GitBash path, and if zip is there, it will work. e.g. add
PATH=$PATH:/c/cygwin/bin
export PATH
to your .bashrc; NOTE: I would put it at the end of the path as shown, not the beginning.
Since CygWin has a UI-based installer, it's easy to add or remove applications like zip or man.
You can figure out the windows paths of each by saying
`cygpath -w /bin`
in each respective shell.
Regarding zip, you can use a following perl script to pack files:
#!/usr/bin/perl
use IO::Compress::Zip qw(:all);
$z = shift;
zip [ #ARGV ] => $z or die "Cannot create zip file: $ZipError\n";
If you make it executable, name it zip, and put it in your $PATH, you can run it like this:
zip archive.zip files...
however it will not work for directories. There is no need to install anything, as perl and all required modules are already there in the Git for Windows installation.
Regarding man, at least for git there is a documentation invoked like this:
git option --help
it will open in your default browser.
Here is my experience, I cant run and exe or .msi files in my laptop. so downloaded filed from https://github.com/bmatzelle/gow/wiki > go to download Now and Downloaded Source Code (Zip) and unzipped this file in a folder and updated path variable with folder name.
This worked out for me.
If you want to zip files without needing to install any additional tools on Windows, in a way that works both on git bash and on other *nix systems, you might be able to use perl.
Per Josip Medved's blog, the following script creates an .epub (which is a zip file), and includes a filter for stripping src/ from the files added to the zip:
perl -e '
use strict;
use warnings;
use autodie;
use IO::Compress::Zip qw(:all);
zip [
"src/mimetype",
<"src/META-INF/*.*">,
<"src/OEBPS/*.*">,
<"src/OEBPS/chapters/*.*">
] => "bin/book.epub",
FilterName => sub { s[^src/][] },
Zip64 => 0,
or die "Zip failed: $ZipError\n";
'
install zip
https://gnuwin32.sourceforge.net/packages/zip.htm
copy zip.exe and bzip2.dll from C:\Program Files (x86)\GnuWin32\bin to C:\Program Files\Git\mingw64\bin
reopen git-bash
Solutions for me were just to install zip on my terminal(bash):
$ sudo apt-get update
$ sudo apt-get install zip unzip

Is there a way to change the logging location of a pkg?

I'm building an installer using pkgbuild and productbuild. I'd like to be able to collect the install logs from my users in the case that anything goes wrong. It'd be nice if those logs were not mixed in with everything else they've installed.
By default it looks like all logs go to /var/logs/install.log. Is there any way to change this location for my app's installer logs?
There are two ways of installing apps in flat file format (.pkg) on MAC OS X:
GUI
Installer.app (On El Capitan it is located in /System/Library/CoreServices/Installer.app) is GUI installer method which doesn't seem to have any option to change the logs but it does have view logs option (Command+L)
Command Line
installer is command line that has -dumplog that can be used to dump logs to stdout that can be redirected to a file.
-dumplog
Detailed log information is always sent to syslog using the LOG_INSTALL facility (and will wind up in /var/log/install.log). -dumplog additionally writes this log to
standard error output.
Command
installer -dumplog -pkg InstallMe.pkg -target / > install.log 2>&1
I ended up solving this by adding the following function to the end of my postinstall script. It detects the first line of install.log that's relevant to the current installation, and copies everything from that line to the end of install.log into a separate file.
One caveat: if multiple installations are happening simultaneously, it's possible to get logs from the other installation mixed in. This solution simply captures a time-bounded snapshot of install.log, but doesn't separate the logs from multiple installations.
function export_log {
NOW=`date "+%Y-%m-%d-%H-%M-%S"`
LOG_NAME="install_log_$NOW.log"
# Interactive install logs start with a line "<AppName> x.x.x Installation Log". Silent install logs start with a line
# "Product archive /path/to/pkg/folder".
# Must include something like \d in this expression and the pkg filename, that won't match this line itself when it's printed in the log
STARTING_LINE_OF_LAST_INSTALL=`egrep '(<AppName> \d+\.\d+\.\d+ Installation Log)|(Product archive.*path/to/pkg/folder/\d+.\d+\.\d+/)' /var/log/install.log | tail -n 1`
# Copy the rest of the log from that line on, up to 10000 lines.
fgrep --after-context=10000 "$STARTING_LINE_OF_LAST_INSTALL" /var/log/install.log > "$LOGGING_DIR/$LOG_NAME"
}

Bazaar locks in Windows

I am new to Bazaar, but that's what is being use at my new job right now. I have installed the latest stable version 2.5.1 on my Windows 7 x64 machine and I can't seem to get it to work.
Every single operation I make, either with the command line tools or the GUI tools end up with the same result. An error window pops up to tell me the program could not acquire a lock.
Every time, the application I'm using will freeze for about 10 seconds, then this shows up and if I click Ignore, nothing happens. My changes are not saved and nothing is applied. If I choose to close the app, I lose all my changes. It even does that when I click the red X to close the application.
In the command line, I try to init a repository and I also get a lock error, but it's different this time. There's an error with a lock inside the repository I'm trying to create.
I just can't figure it out at all and I need help.
The version of Bazaar I'm using is 2.5.1 with the bundled Python v2.6.6 and Tortoise BZR.
I've installed bazaar in cygwin instead and have been using that for a couple of days now. But, to be able to use the GUI tools, I had to do a couple of tricks. I got them to work and here's what I did. It's a workaround if anybody else is stuck with the same issue. Basically here's what I did.
Through the Cygwin setup, install the following packages:
bzr
python3
python3-pyqt4
python-pyqt4 (I wasn't sure which one to install, so I installed both, but I think this one is not necessary.)
xinit
libqt4core (I think, but I'm not sure. Can't remember if I had to install it or if it was installed as a dependency with python3-pyqt4.)
Then download the individual Windows packages for the bazaar plugins you want to use. In my case I downloaded:
qbzr
bzrtools
bazaar explorer
I installed the plugins under c:\bazaar and the installers put them under C:\Bazaar\2.0\plugins.
In a Cygwin terminal, in my home dir, I created the directory ~/.bazaar/plugins/ and in that directory I made a sym link of every directory under C:\Bazaar\2.0\plugins.
After that, in the cygwin terminal, start up a new X-server using the startxwin command. Then export the DISPLAY variable so that your graphical tools know which X session to output to.
$ export DISPLAY=:0.0
Also, in case you get the annoying xterm when you start X, just create an empty file called .startxwinrc in your home directory.
Then, when you enter the commands bzr qlog, bzr explorer, bzr qbzr, the tools should open up through the X server and show up on your desktop. If any dependencies are missing, you will get an error message and you can install the missing package through Cygwin setup.
After that, if you want to use your favourite windows merge tool and editors with bazaar in Cygwin, they won't be able to interpret the Cygwin paths. So instead, I created a ~/bin/ folder and made a few scripts that call my favourite apps and that translate the file paths given as arguments using cygpath -w. Here's an example for p4merge:
#!/bin/bash
if [ "$#" = "2" ]; then
this=`cygpath -w $1`
other=`cygpath -w $2`
/cygdrive/c/Program\ Files/Perforce/p4merge.exe $this $other
elif [ "$#" = "4" ]; then
base=`cygpath -w $1`
this=`cygpath -w $2`
other=`cygpath -w $3`
result=`cygpath -w $4`
/cygdrive/c/Program\ Files/Perforce/p4merge.exe $base $this $other $result
else
echo "Invalid number of arguments."
echo "Usage: p4merge.sh <this> <other> or p4merge.sh <base> <this> <other> <result>"
exit 1
fi
I configured my bzr explorer to use that as a diff viewer and merge tool and it works perfectly.
Old question but I got the same error today. I solved it by simply deleting the content of the directory "C:\Users\{username}\AppData\Roaming\bazaar\2.0\lock"
Happened on a Win 7 x64 machine

Resources