editor in Cygwin [closed] - cygwin

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I had just installed cygwin on my win XP machine, new to unix & learning things...
How can I know which editor had been installed with cygwin installation on my system? none of the editors out of vi, vim, nano, ted, jow etc working...tried using 'notepad' but it saves the file as .txt ....
Also another confusion which I have is, even the files which I have created without shebang line as well as without .sh extension , I am able to execute them when given permission to do so...how can a script be run when I have not added shebang line in that?

I had trouble with this and a few other things in Cygwin. Vim, Emacs, (and many other standard Unix programs) are not installed by default in Cygwin.
You need to run the setup program again (no need to uninstall first), and explicitly add what you want.
I wrote a blog post about this: http://wilsonericn.wordpress.com/2011/08/15/cygwin-setup-gotchas/

The shebang line is not needed if your $SHELL can interpret the script. i.e., if you write a bash script and invoke it through bash, you don't need the shebang line.
To know which editors are installed, run the cygwin setup.exe file again and go through the package list (under the group editors), you may pick additional editors to install too.

If you have other scripts, you should be able to launch most scripts without sheband line in this way:
bash script.sh
tcsh script.csh
python script.py
perl script.pl
etc...
By the way, if you are new to unix, I recommend you get used to an advanced text editor.
I don't want to troll, but using XEmacs or Vim could help you a lot (syntax highlighting, snippet usage for ex.). I have been using Vim for years now, and I would probably not be able to go back to a basic editor...

If you have the disk space I recommend just letting the Cygwin installer have at it and deploy everything .... I am glancing at it every now and then while watching the F1 race. I use a 750GB hybrid flash / spinning disc drive so storage isn't an issue. It is much like the old Red Hat "Kitchen Sink" option with the DVD9 format.
It would be helpful if the Cygwin installer would show the fact it intends to install only 50/2100 packages by default, or if there was a wizard with some useful premix choices (minimal, server, GUI, everything)

Related

Installed Go, but command go not found. Does work on one terminal linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I installed go on linux yesterday. It worked fine and downloaded some tools and they worked also. I left the terminal open and when I came back today go stopped working... In the left terminal go works and does everything... But when I open another terminal and type go it said "command go not found" (see screenshot).
Can anyone help me please? I don't know what I did wrong or what went wrong...
Go works on the left terminal, not right...
tl;dr
Add the export command you ran to the $HOME/.bashrc file (preferably at the end).
When you installed go you probably ran the export command to add the location of go binaries to the PATH variable. But here's the thing. The PATH variable is, effectively, reset to the previous value when you open the new terminal. To make it permanent you need to add the command to your shell's rc file.
What's an rc file?
When you open the terminal it uses a rc (short for run commands) file and runs the commands in this file. The name of the file depends on the shell you are using.
If you are using bash, the name would be .bashrc. If you are using zsh, the name would be .zshrc.
You can run echo $PATH in both the terminals and see the PATH variable in which go runs would have the location of go binaries and the other wouldn't.
So to make this permanent, add the export PATH=$PATH:{PATH_GO_BINARIES} to the rc file. And, then, whenever a new terminal is opened, the PATH variable would be updated to contain the location of go binaries.

Edit an applescript file from a linux computer [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Though applescript appears to be a scripting language like any other (wikipedia/applescript), for reasons I don't understand it seems these scripts are often saved as binaries. It seems like this isn't an issue for someone working on a Mac with a mac-based text editor that can open these scripts into a plain-text format where they can be edited and read, but for the rest of us, we just see gibberish. For instance, Github has many examples of .scpt files committed to repositories instead of/without the plain-text equivalent (a bit of Googling suggests this would be a .applescript file instead)
Question: Is there an open-source tool that can parse and serialize these binaries so that they can be viewed/edited in a standard plain text editor and saved back as .scpt?
(My context: I'd like to provide a user-friendly, os native button-click way to launch my application on a mac, rather than tell users to open a bash terminal and type stuff.)
Edit I only have access to a linux machine, I don't own a mac.
Instead of trying to create an AppleScript on a non-Mac, what you can do is simply name your shell script file with a .command suffix and make sure that it has execute POSIX permissions for the user. The user can then double-click the file in the Finder to execute your script instead of having to enter Terminal commands.
If you would like to take advantage of AppleScript commands within your shell script file to add some simple GUI functionality, you can use the osascript command.
BTW, for reference: on a Mac the application "Script Editor" (or "AppleScript Editor" on older systems) is generally used to create AppleScripts. It provides several save options - the .scpt binary and .applescript plain text files you noted as well as .scptd script bundles and .app standard, double-clickable applications.

Prolog Programming in Ubuntu

I have an interest in playing and fuxing with prolog, I have installed the swi-prolog and added the repository, just in case anyone is interested on which one commands I used:
% sudo apt-add-repository ppa:swi-prolog/stable
% sudo apt-get update
% sudo apt-get install swi-prolog
How do I actually begin to write prolog codes on my linux machine? for my regular programming I use VIM to write/edit/debug and terminal to compile. Can I use vim to write prolog? How do i compile or use the prolog interpreter(i think that is what it is called)?
Yes, you can use any text editor, incl. VIM. Once you have written a Prolog source file, say, file.pl, you can load it into SWI-Prolog like so:
swipl -s file.pl
This will compile your file and take you to an interactive shell where you can then ask queries against the definitions in your file.
If you want to use your Prolog program in batch mode, you can use:
swipl -s file.pl -t goal
where goal is the goal/query you want to evaluate. Note that in this case you won't be getting the option to ask for alternative solutions.
On Ubunutu, I started off using emacs, which at least does syntax highlighting:
http://www.swi-prolog.org/FAQ/GnuEmacs.html
(2 emacs suggestions on that page ^)
But now I use prolog in anger, I use an Eclipse plugin called PDT:
http://sewiki.iai.uni-bonn.de/research/pdt/docs/v2.1/start
Especially useful is the real-time line by line debug and trace, so you can step into, step over individual predicates, monitor variables names etc.. just like an other real IDE you would find in eclipse.
Probably only worth installing if you're going to use it a LOT, since the install is a lot of work, but it's a great IDE.
But if you like your low level editors like VIM, you will have to use the debug and trace tools built into swi-prolog, see:
http://www.swi-prolog.org/pldoc/man?section=debugger
To work out how the strange and beautiful prolog interpreter works, using a tracer of some kind is a must-have.
I personally use gprolog or swipl in the interpreted environment.
So you write facts and rules in a mydb.pl file, and open the interpreter in the same directory.
Once the prompt shows up you can query
['mydb.pl'].
for loading your database. now you can either see the warnings\errors or start querying from inside the prolog interpreter.
buddy I also use vim to edit prolog code, What I personally do is I save my prolog file with the '.pl' extension, and then on the terminal, I use prolog interactive environment to consult my file
e.g:
To initiate a prolog interactive environment just type On terminal:
prolog
Now that you have entered in SWI-prolog you can use 'consult' i.e pre-defined pseudo-predicates allow one to load Prolog code into a running Prolog interpreter:
?- consult("filename.pl")
that's it!
You can use any text editor to write your code. Just make sure to save your code with the .pl extension like fibo.pl.
After that open the terminal and go to the location where you have saved your code.
After that type prolog
After that write the name of your file without .pl extension and end it with . ['fibo']. and press return
Eg - cd /home/student/14917
prolog
['fibo'].
Here fibo.pl is my program name
I use SWI prolog with Sublime Text on mac. Works really nice. In Sublime Text you just hit cmd - B to run the code, and the output appears in a window within Sublime Text. There is a package for it here.

Whats a text editor program for linux with ftp? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Just a program i can code in like notepad++ for linux?
Thinking of installing linux and this is what i need most, if they don't have a program like notepad++ then i will not install it.
Remote editing with any editor when using some Fuse based FTP-filesystem.
CURLFFTPS
urlftpfs -o user=username:password ftp.example.com /my/mount/point
Or you could use SSH and SSHFS if possible. http://fuse.sourceforge.net/sshfs.html
For the editor I would recommend Eclipse.
Or should also checkout JetBrains' PHPStrom http://www.jetbrains.com/phpstorm/
GVim/Vim supports ftp & ssh/scp (link1 link2)
Emacs is seemed to support them also (link)
General format is: protocol:user#host#port:dir/file
You can also use Gedit as Remote File Editor via FTP and SSH (Ubuntu)
Using Gedit as Remote File Editor via FTP and SSH (Ubuntu) (link here)
Vim has integrated FTP (and other protocols!) support with its bundled netrw plugin.
To use it, you can begin to edit a file as you would any other file, except you use a URL rather than a file name. For example:
$ vim ftp://www.example.com/file.txt
You can also give it a directory name rather than a file name and it will show you a directory listing.
For more information, see its documentation.
As icktoofay suggested Vim however if you don't have experience with Vim and wish to avoid learning how to use it then I would strongly suggest Sublime text.
If we are talking text editors I would add Sublime Text as the lead. It does not have FTP support included but has a superb S/FTP easy to install and use plugin.
Sublime Text is like Notepad++ only better.
Sublime Text
Vim may be the best editor but it isn't similar to notepad++ at all.
For web development I would strongly recommend using KDE's http://kate-editor.org/
By taking advantage of KDE network stack, you'll have a (remote) filesystem browser, ftp editing, nice syntax hightlighting and symbol list for javascript, css and many other filetypes, column mode editing... It is nice clean and easy to use.
As a bonus, it is possible to run in vim emulation mode, so you can have both :)
I'm really astounded by how little attention has been given one of the best text editors

Overwriting "Print Screen" actions in linux without administrative rights [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Disclaimer:
I am a bit of a Linux noob :(
Problem:
I have an interesting problem that I could use some help with. Essentially, I want to overwrite the default actions for the "Print Screen" button in Linux. My reasons for doing so are that I have a homemade graphics card running attached to the computer and I'm trying to make a utility where I can capture what it is outputting to a separate monitor and send it back to the "host" computer. For purposes here, I only want to know: How can I execute a script upon pressing the Print Screen button? Note that I cannot install xbindkeys or any other software. Ideally I would like to be able to run a script to enable this behavior.
Current work-around:
Currently, I have a .bashrc script:
#!/bin/bash
export PATH=/home/username/bin:$PATH
In the /home/username/bin folder I have a script "gnome-screenshot" that, for now, just performs some arbitrary task (it actually does this: "cat /usr/share/icons// > /dev/dsp" -- try it! It's fun!).
I am working on school computers, so I first CTRL-ALT-F5 to open a terminal login, login, then source .bashrc. I then startx -- :1 to start a new X session. Now, if I hit the PrintScreen button, it uses my gnome-screenshot, not the default screencapture program.
Is there anyway to do this without all of the restarting X? In short, is there a way to source my .bashrc script, or otherwise modify my PATH variable, before or while I login?
Another Approach:
I also tried, briefly, to xmodmap and the keycode to execute a script, but couldn't figure out how to tie them together. I know the keycode (111) but can't figure out how to run a script on press. I believe it might be possible to make a sort of binding using this but can't figure out how.
Help!
I'd really appreciate some help or comments!
(Edit): Added Details About Distribution:
cat /etc/redhat-release tells me:
Red Hat Enterprise Linux Client release 5.8 (Tikanga)
xmodmap is not the tool you want; it cannot bind keys to programs, it binds physical keycodes to logical keysyms. XGrabKey(3) is what you're looking for.
Reading your shell dotfiles while starting the X session depends on the exact OS and desktop environment you're using (including version; there are 4 or 5 different ways you might need to use even considering only different Ubuntu versions with their stock desktops).

Resources