How to list all xlinks in Plastic repo - list

I have Plastic SCM version 9 windows client and I want to list all xlinks inside repo (incl subdirs). I know this is impossible in graphical mode. However I was thinking I could list all dirs with subdirs to file (using command line) and then parse it with cm xlink -s.
I'm stuck at this point. I tried following dos command:
for %%x in (dirlist.txt) do cm xlink -s %%x
but it checks only dirlist.txt file. What is the correct dos command to do this?
dirlist.txt looks like this:
c:\users\xxx\plastic\some_repo\dir1\subdir1
c:\users\xxx\plastic\some_repo\dir1\subdir2
c:\users\xxx\plastic\some_repo\dir2
c:\users\xxx\plastic\some_repo\dir2\subdir1
c:\users\xxx\plastic\some_repo\dir2\subdir2
c:\users\xxx\plastic\some_repo\dir3
c:\users\xxx\plastic\some_repo\dir3\subdir1
c:\users\xxx\plastic\some_repo\dir3\subdir2
...and so on. Basically I need to check every subdir from within dirlist.txt if it's an xlink or not. If it's not then the command will return message some_dir is not an xlink. but if it encounter xlink then it will show proper message.
Or maybe there is another quicker way to do this?

Related

Open Clion from terminal

I've been trying to set a path to Clion directory in my computer in order to open this program with a command in terminal, but it didn't worked.
If you read this and asked yourself: "what?". I want to start a C++ project like I did with a normal text editor(I used to write codes with gedit).
I want something like, make a hello world:
Clion helloWorld.cpp &
And it will open a new project, named helloWorld, and then I can write down the code.
If it is impossible to do that, sorry.
In researching this question, I just discovered that there is an officially supported method for doing this is via CLion's Tools|Create Command Line Launcher... menu item.
Full details are posted here: https://www.jetbrains.com/help/clion/working-with-the-ide-features-from-command-line.html
Start CLion using the GUI interface, then start Terminal and run the following to find what process is running:
ps -ae| grep lion
Output
57257 ?? 0:20.45 /Applications/CLion.app/Contents/MacOS/clion
57434 ttys000 0:00.00 grep lion
So the command I need to use, in my case, to start CLion from the command line is:
/Applications/CLion.app/Contents/MacOS/clion
Then you need to pass the directory containing your project, so you could make a function like this:
function CLion { /Applications/CLion.app/Contents/MacOS/clion "$1"; }
Then you can just type:
Clion ~/CLionProjects/someProject
For Mac users, you need to add following row in ~/.bash_profile:
alias clion='open -na "CLion.app" --args "$#"'
Then from the terminal you can run CLion:
clion /path-to-your-project
If you use JetBrains Toolbox to manage your CLion (or other IntelliJ) apps like I do, you'll find that Toolbox installs CLion with a versioned pathname. This means every time you update CLion, the path to the clion.sh launcher script changes.
For Linux environments, you can use the following in your ~/.bash_profile to handle this:
alias clion="`find ~/.local -iname clion.sh | head -1` >/dev/null &" #Linux
or
alias clion='open -n "$(IFS=$'\n' && find "${HOME}/Library/Application Support/JetBrains/Toolbox/apps/CLion" -iname clion.app | head -1)"' #Mac OS X
If you upgrade your CLion you can restart your terminal or just run . ~/.bashrc to update the clion alias.

How to make Midnight Commander exit to its current directory

I've been using, in equal amounts, Fedora and Ubuntu for well over a decade now, and there's one minor but irritating difference I noticed from their installs of midnight commander. When you change dirs inside it using Fedora, then exit, it has done the chdir for you but in Ubuntu it keeps it at the place you started. Googling threw up a solution for older Ubuntus here: http://ptspts.blogspot.co.uk/2010/01/how-to-make-midnight-commander-exit-to.html but trying that fails on 16. When I say fails, I mean the commands are accepted without complaint but it doesn't change mc's behaviour in Ubuntu.
The other responses are fine, but I feel like they are unsatisfying, here is my solution, which I think is the simplest:
Put this line into your ~/.profile
alias mc='source /usr/lib/mc/mc-wrapper.sh'
Create an executable with the following content:
MC_USER=`id | sed 's/[^(]*(//;s/).*//'`
MC_PWD_FILE="${TMPDIR-/tmp}/mc-$MC_USER/mc.pwd.$$"
/usr/bin/mc -P "$MC_PWD_FILE" "$#"
if test -r "$MC_PWD_FILE"; then
MC_PWD="`cat "$MC_PWD_FILE"`"
if test -n "$MC_PWD" && test -d "$MC_PWD"; then
cd "$MC_PWD"
fi
unset MC_PWD
fi
rm -f "$MC_PWD_FILE"
unset MC_PWD_FILE
Then define an alias pointing to that executable:
alias mc='. ~/.config/mc/exitcwd'
Don't forget to apply the alias:
source ~/.bashrc
Simple:
mcedit ~/.profile
Add this line at the end of file:
alias mc='source /usr/lib/mc/mc-wrapper.sh'
Type this command to execute changes
source ~/.profile
Then, to save both sides of mc windows, click at the top of MC
Options -> Panel options -> Auto save panels setup
Here, in the article Use Midnight Commander like a pro, explains how to do it.
Basically, you have to create an alias for mc-wrapper.sh.
While it's not exactly an answer to your question: just use ctrl+o to drop to the shell. It doesn't really quit mc, but that has the benefit that you can just hit ctrl+o again to go back where you were in mc.
For Ubuntu put this to .bashrc:
alias mc='. /usr/lib/mc/mc-wrapper.sh'
then:
source ~/.bashrc
(or relaunch the console)
I want to add that this only works by existing with F10. If you exit by typing exit the path will not be preserved.

How can I select a drop down menu when I save a file using Applescript?

I've been trying to program an AppleScript that writes and exports an AppleScript . And so far, I've gotten as far as automating the writing of the script and getting to the "Export..." menu. I've pasted link to a screen shot of the menu that I've gotten to below.
Link to image
can someone please let me know (in the simplest way possible) a way to automate the clicking of the Application option under the drop down menu (is it called that?) named File Format using apple script. Can someone also please inform me of (if there is) a way to automate the clicking of the Run Only check box? If you are unsure what is where, the two spots (the list and the check box) is squared in red in the image.
#Darrick Herwehe's answer has the crucial pointer: use oascompile to compile AppleScript source code - no need for (cumbersome and error-prone) GUI scripting.
If you wanted to compile your AppleScript (plain-text) source file - e.g., some.applescript to:
application (bundle) some.app
with the execute-only (run-only) option (i.e., the plain-text source code is NOT included in the bundle)
you'd run
osacompile -x -o some.app some.applescript
Alternatively, you can even provide the source code as a _string:
osacompile -x -o some.app -e 'display alert "hello, world"'
If you wanted to achieve the same thing from AppleScript itself:
set src to "display alert \"hello, world\""
do shell script "osacompile -x -o ~/some.app -e " & quoted form of src
Note that the output format - an application bundle in this case - is inferred from the filename extension of the output filename passed to -o.
To invoke some.app directly from its output folder for a quick test, use:
open ./some.app
Caveat: There's at least 1 bug (around since at least 2012 and still there in OS X 10.9.2) that causes osacompile to compile incorrectly; see osacompile changing the AppleScript output so it won't run

System Call C++ with Weka

I'm writing a C++ project that will occasionally use a system call to Weka to get some machine learning information. First I'd like to ensure that the training model (training.model) is up to date. So, at the beginning of main, I call:
system("\"java weka.classifiers.trees.J48 -t ML_data.arff -d training.model\"");
That gives Error: could not find or load main class weka.classifiers.trees.J48. I know what that means, so I moved the entire Weka project folder, entitled Weka-3-6, to the directory in which my project is found. So then I tried:
system("\"java \Weka-3-6\\weka.classifiers.trees.J48 -t ML_data.arff -d training.model\"");
But that returns Error: could not find or load Weka-3-6\weka.classifiers.trees.J48.
I feel like I'm in the right neighborhood, but I can't get the slashes right, and I'd prefer not to mess with absolute paths because the folders have spaces and that makes it even messier. Any ideas? Help is greatly appreciated.
Open a terminal/cmd prompt and try to run your command in your terminal/cmd prompt. Following is an example cmd batch script for windows. Your problem is most likely java classpath settings not weka problem. If you succeed in following command, then try your command with again in c++.
SET WEKA_HOME=C:\Program Files\Weka-3-7
SET CLASSPATH=%CLASPATH%;%WEKA_HOME%\weka.jar
SET HEAP_OPTION=-Xms4096m -Xmx8192m
SET JAVA_COMMAND=java %HEAP_OPTION%
%JAVA_COMMAND% weka.core.SystemInfo

Apache Ant Build command "Access Denied"

Hey! I am trying to get ant installed and actually already did following this instructions however, I get this error:
Buildfile: build.xml does not exist!
Build failed
which it says there I might get so I just tried executing the next command it says I should(since I'm under Windows it's this one):
build -Ddist.dir=<C:\Ant> dist
anyway I get "access denied" when hitting enter and I can't figure out why. I also tried
build install
and
build install-lite
but I always get that message =/ any ideas why? or what am I doing wrong?
Edit
Without the < > I get a:
'build' is not recognized as an
internal or external command, operable
program or batch file.
Edit2
Well, my ANT_HOME is in C:\Ant and I'm trying to run the command while placing myself on that folder, isn't that correct?
Ant is already installed correctly if you're getting this:
Buildfile: build.xml does not exist!
Build failed
The "build" commands you tried next are only for building Ant from source. You don't need to do this, since Ant is already installed.
In general, the "'XXXX' is not recognized..." means XXXX is not a command/executable, or that it's not on your PATH.
You are taking the < and > symbols too literally. Take them off.
Kind of like C:\Users\<Your ID> the symbols are placeholders.
Are you in the right directory? Do you have something else called build in your path that may be superceeding the build you are trying to call. Can you create a file in that directory?
PROMPT> copy con foo.txt
asdf
asdf
sdf
CONTROL-D
Not sure if this helps but the first question that comes to mind is "do you have appropriate permissions on the file"?