Mechanics of csh and source command in CentOS7 - centos7

I am trying to do this on CentOS-7. So why will this not work when I use the command 'source filename' where filename is the following file under another name:
!/usr/bin/csh
## setting aliases for IC tool installation path
## setenv CDSHOME /path/to/cadence/installs/ICADVM181
##The following line is from the InstallScape instructions
##setenv CDSHOME /home/administrator/cadence/installs/IC618/
##If you are using the C shell, use the following command:
##setenv PATH $PATH:installation_path/vacpp/bg/12.1/bin/
##setenv CDSHOME $PATH:home/administrator/cadence/installs/IC618/
setenv CDSHOME "/home/administrator/cadence/installs/IC618/"
## Below setting is for license server, serverA and serverB are hostnames of the license server machines, and 5280 and 5281 are ports
#setenv CDS_LIC_FILE 5280#serverA:5281#serverB
## setting path in your environment
set path = ($CDSHOME/tools/bin $CDSHOME/tools/dfII/bin $path)
If I go to terminal, engage 'csh', then use 'source filename', I can then use the 'which virtuoso' to make sure that the path can be found to virtuoso. This works.
I know some basic things about Linux, bash, and csh from reading and various videos. I don't see what I'm missing here. Everything I read says you should be able to engage csh, bash, or sh with a shebang line at the beginning of a file.
My long term goal is have this string of commands load upon logging into a number of workstations or activated by double clicking a desktop icon.
This is for the Cadence software package, so I will have to do something similar depending upon what is installed. I'm not ready to worry about the licensing server issue, but that's next after being able to run 'virtuoso' executable.

Related

How can I debug a C program installed using guix?

I installed flatpak using guix, but it segfaulted on startup. I wanted to debug it, but guix installs a wrapper script for flatpak, so I get this error when trying to run it under gdb:
"/home/user/.guix-profile/bin/flatpak": not in executable format: file format not recognized
and I tried to edit the wrapper script to call gdb, but this wrapper script is not even editable by root, because it is owned by root and has read-only permissions.
Simply copy the script to your current working directory:
cp /home/user/.guix-profile/bin/flatpak .
Mark it as writable:
chmod +w flatpak
Edit the script with your favourite text editor, to replace the string exec -a with exec gdb --args.
And finally, run it with any arguments you provided before, when it misbehaved:
./flatpak remote-add flathub https://flathub.org/repo/flathub.flatpakrepo
In this particular case, this wasn't immediately super-useful, because a debug symbol output hasn't been built for this package. But at least I could get a backtrace out of gdb.

'sc' is not recognized as an internal or external command

I am trying to create a svnserver using cmd after i changed svnserve.conf by uncommenting the following lines in the file,
anon-access = read
auth-access = write
command execute in cmd is,
sc create svnserver binpath= "C:\Program Files\TortoiseSVN\bin\svnserve.exe --service -r c:\Goods\Repo" DisplayName= "Subversion" depend= tcpip start= auto
but i am getting error
'sc' is not recognized as an internal or external command
I am not sure what i am doing wrong. I have installed tortoise SVN Client and Visual SVN Server.
Can someone please let me know what i am missing here.
you will need to add the path to sc.exe ("c:\windows\system32\") in your Path environment variable. Do this by hitting windows key + Pause|Break then selecting advanced system settings - environment variables is at the bottom. Just add an extra entry after the last - separated by semi-colons. If this isn't possible, simply give the command the full path of sc.exe e.g.
"c:\windows\system32\sc.exe" create svnserver....

Launch a program at login without permissions (fedora 20)

I'm currently developing an application with QT 4.8 with a "Launch on login" option. My main problem currently is that I can't seem to find a proper way to make the program launch itself after login on Linux (Fedora 20 in my case).
My program should be able to run in the background without stopping fedora to launch.
I would also like to avoid having to ask for any sort of admin privilege since my application doesn't require any (except maybe for this option).
Finally found out about "home/.config/autostart/.desktop".
I'll have to create autostart if it's not created but from there I can chose to make or delete the file depending on what my user decided to do.
The .desktop file have to follow a particular syntax (which is not a problem for me)
[Desktop Entry]
Type=Application
Exec=</path/to/binary or command to execute>
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=<Name_to_be_displayed>
Comment=<optional comment>
In my case, I can just remove the "comment" line since just the name of the application should be enough for the user to recognize it.
You can Either keep your executable in side /etc/rc.d/rs or inside /etc/init.d folder, so that it can automatically start once device is up.
Hope this Helps.
Each user has a .bashrc file located in their home directory, you could append a command to run your application to the end of that.
That will run when only that user logs in (I think either with graphical or terminal session)
To run for all users, look at creating a systemd service if you dare, or append a line to the end of /etc/rc.local. You'll need to be root for that though.
EDIT: Don't forget to put an ampersand at the end of the command to run in background.

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

How to create a Linux desktop icon cross desktop (KDE, GNOME) with xdg-desktop-icon?

I'd like to use the xdg-desktop-icon tool because it can be scripted and works cross desktop (at least on Linux with Gnome and KDE). At least it is supposed to do so according to freedesktop.org. 1
Made a minimal file: test.desktop
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=test
Icon=test
Name=test
Used xdg-desktop-icon...
xdg-desktop-icon install --novendor test.desktop
Exit code is 0. (Success.) But... I do not see any new icons on my desktop. Also not after reboot. This failed on Ubuntu Precise 12.04 with KDE and on Debian Wheezy with KDE.
How to use the xdg-desktop-icon tool correctly?
The problem on KDE has something to do with the desktop settings. Folder view, Newspaper view and so on.
xdg-desktop-icon relies on xdg-user-dir to determine the user desktop directory. You can check either against that command and the settings of your file manager (or program handling the desktop).
Assuming by default it would be /home/user/Desktop, then you have to check the file name there. If the file is there, then xdg-desktop-icon is working as expected.
You have to consider that the icon (test in your case) has to be installed separately using xdg-icon-resource. That is, if you are not using a stock icon or custom icon already installed or you are not using an absolute path for the icon.
Do not forget that xdg-desktop-icon only copies the .desktop file in a specific directory. No more no less.
If I am working on ~/myapp directory, I would check by doing:
$ xdg-user-dir
/home/user/Desktop
$ ls `xdg-user-dir`/test.desktop
ls: cannot access /home/user/Desktop/test.desktop: No such file or directory
$ xdg-desktop-icon install --novendor test.desktop
$ ls `xdg-user-dir`/test.desktop
/home/user/Desktop/test.desktop
Eventually, you can run with any xdg- script with:
$ XDG_DEBUG_LEVEL=1 xdg-desktop-icon ...
Which will give you an extra line telling you where the desktop file was installed. At this point, if the icon has not been installed, it might appear an ugly default icon.