Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • osian/sucs-site
  • kais58/sucs-site
  • imranh/sucs-site
  • foshjedi2004/sucs-site
  • gigosaurus/sucs-site
  • matstn/sucs-site
  • ripp_/sucs-site
  • eggnog/sucs-site
  • sucssite/sucs-site
  • elbows/sucs-site
  • realitykiller/sucs-site
  • crox/sucs-site
  • vectre/sucs-site
  • welshbyte/sucs-site
  • paperclipman/sucs-site
15 results
Show changes
Showing
with 755 additions and 0 deletions
<p>Sometimes someone in Milliways will type something that your terminal emulator can&#39;t cope with. This is usually caused by your terminal emulator not being set to use the same character set as the Milliways program.</p>
<p><a href="../Logging%20in%20remotely/Configuring%20PuTTY">PuTTY</a>&#39;s default character encoding is <a href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1">ISO 8859-1</a>, also known as Latin1. This is a Western European character encoding containing characters for e.g. French and German, as well as the pound sign. Milliways, on the other hand (or more specifically your shell session), by default uses the <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> character encoding, which is an encoding of <a href="http://www.unicode.org/">Unicode</a>, the unified character set. Milliways quite frequently encounters the pound sign, and this will get screwed up if your terminal receives it as UTF-8 but interprets it as Latin1. You will also simply lose any characters in UTF-8 which can&#39;t be translated into Latin1.</p>
<p>To fix this in PuTTY, open the window menu (which has some extra entries) and select &#39;Change settings...&#39;:</p>
<img src="/pictures/mw.png" alt="PuTTY window menu" width="530" height="362" />
<p>This brings up a dialogue box similar to the one you get when you first run PuTTY (sans options that can only be changed before the connection is made). Select &#39;Translation&#39; and pick &#39;UTF-8&#39; from the combo box labelled &#39;Received data assumed to be in which character set&#39;:</p>
<img src="/pictures/mwconf.png" alt="PuTTY configuration dialogue box" width="373" height="359" />
<p>Now click &#39;Apply&#39;, and any more weird characters should be displayed correctly (assuming you have appropriate fonts installed).</p>
\ No newline at end of file
<p>
Milliways regulars include society members from both past and present, and some
who just like to use Milliways but have never been part of the society. There
is a unique sense of community, and you will often find passionate debate on
all sorts of subjects from programming to politics, plus the odd pun.
</p>
<p>
It can be a little daunting when first joining Milliways as the community is so
well established, but stick around and get to know how things work and you'll
soon find out how to get the most out of Milliways. If you find any way
that Milliways can be improved, let us know. Milliways is an open source
project developed by SUCS members since 1992 and it changes regularly!
</p>
<p>
Below are a few guidelines that every user should follow so that Milliways can
be a place where people want to hang out and tell their friends about.
</p>
<p>
<strong>You're Talking To Humans</strong>
</p>
<p>
It's important to keep in mind that there are real people behind the usernames
and that they all have their own backgrounds and experiences, and perhaps some
of them are even having a bad day. Use good judgement as to your familiarity
with other users and the power dynamic between you before choosing your words,
especially when using light hearted banter.
</p>
<strong>Asking Questions</strong>
</p>
<p>
It is tempting to ask if you can ask a question on Milliways, or if anyone is
around who knows about a certain subject, but if you have a question or
something that you require help with, the best thing to do is to ask that
question straight away. Provide as much context as you can. You may have to
wait for an answer outside of busy hours and if you do not get an answer it can
be useful to other users to report back when you've found the answer elsewhere.
If the question is likely to be answered with a quick web search, try that
first to save time. Note that students asking for coursework solutions will
likely encounter silence but asking very specific questions to help you
understand the concepts you need is highly encouraged.
</p>
<p>
<strong>Answering Questions</strong>
</p>
<p>
Particularly with newcomers, it's important to appreciate that asking a
question may be a difficult thing to do. We were all new students and new to
Milliways at one point. If you think the answer is obvious or simple, it's best
to keep that to yourself to avoid belittling the asker. Not everybody has the
same knowledge in their head.
</p>
<p>
<strong>Don't Flood the Talker</strong>
</p>
<p>
If you have anything that you wish to share on Milliways that is more than a
line or two of text then you should make use of a pastebin, such as the <a
href="http://sucs.org/Tools/PasteBin" target="_blank">SUCS PasteBin</a> and
there is also a <a href="http://sucs.org/Tools/ShortURI" title="ShortURI"
target="_blank">SUCS URI shortener</a> for posting very long links without
flooding, although many long URIs can be shortened greatly just by trimming the
ad tracking elements from them.
</p>
<p>The following is an attempt to explain some of the more unusual and esoteric phrases and acronyms that regularly get used on milliways.&nbsp;</p>
<p><strong>AIUI</strong> (As I Understand It) - This is how the person speaking understands the topic, although it might not be correct. </p>
<p><strong>AFAIK</strong> (As Far As I Know) - This is as much as the person speaking knows, it might not be everything or up to date. </p>
<p><strong>FFS</strong> (For F*cks Sake) - An expression of annoyance or frustration.</p>
<p><strong>FTW</strong> (For The Win) - Expressing that something is particularly good or useful.</p>
<p><strong>IIRC </strong>(If I Remeber/Recall Correctly) - The person speaking is relating something from memory, but it is possible they have misremembered.</p>
<p><strong>ISTR </strong>(I Seem To Remember/Recall) - The person speaking thinks they have remembered something correctly but are not completely certain.</p>
<p><strong>KUATB</strong> (Keep Up At The Back) - The thing you just mentioned is old news and has already been debated, probably several times, before you arrived.</p>
<p><strong>MROD</strong> (Magic Roundabout Of Death) - The mechanism for ejecting someone entirely from Milliways.</p>
<p><strong>s/foo/bar/</strong> - This is the regex search and replace function, as used by the "sed" and "vi" commands, in this case "foo" would be replaced by "bar".&nbsp; It is used as a method of correcting an error in a previous line, usually but not always the previous line spoken by the person using it. It is also used for humorous effect. </p>
<p><strong>MW</strong> (Milliways) - This is how people on Milliways usually refer to it.</p>
<p><strong>(N)SFW</strong> ((Not) Safe For Work) -&nbsp;When posting URIs, anything which may be considered offensive is usually tagged as "NSFW" since most people would be repremanded for viewing such sites while at work.&nbsp; Similarly, links which sound dodgy, but are infact ok, may be tagged as "SFW" to clarify that there is nothing offensive on them.</p>
<p><strong>room x</strong> - Milliways is divided into different rooms, numbered from 0 (where almost everything happens) to 65535.</p>
<p><strong>(The) room</strong> - The SUCS Room on the ground floor of the Student Union building</p>
<p><strong>ZOD</strong> (Zebedee of Death) - A slightly less drastic ejection mechanism, simply throws them out of talker rather than out of the system entirely.</p>
<p>The usernames of almost all users are frequently abbreviated for easier and faster typing. </p>
<p>Most commonly, the first few characters of the username are used, for example "rohan" is often referred to as "ro", "Zaphod" as "Z" and "Arthur" as "art". If the name obviously contains more than one part, then often the first letter of each part is used as the abbreviation - e.g. "FireFury" becomes "ff", "rollercow" is "rc" and "willwel2000" is "ww" or "ww2k".&nbsp; </p>
<p>Exceptionally there are abbreviations that do not appear to relate to the username. For example "Thryduulf" is shortened to the logical "thr" or "thry", but also by some to "cmc" - this is because Thryduulf is an awkward sod and for historical reasons as Thryduulf's username used to be "cmckenna". </p>
<p>When a comment is directed at a particular user, their username (or an abbreviation of it) followed by "&gt;" or ":" is usually placed at the start of the line. For example you might see</p>
<pre>Arthur: dom&gt; are you in the room?<br />Psycodom: art&gt; no, but rc is. <br /></pre>
<p>Meaning that Arthur is asking whether psycodom is currently in the SUCS room. Psycodom replies that he isn't, but that rollercow is. </p>
\ No newline at end of file
<p>Milliways includes its own scripting language, details of which are available from within Milliways with the .scrhelp command. To get you started, we have a range of example scripts you can install in your home directory.</p>
<p><em><strong>Note:</strong> SUCS members who first signed up after September 2008 will already have these scripts in their home directories so there is no need for them to read past this point.</em></p>
<p>These scripts can be found at <a href="../../../../files/Help/mw-script.tar.gz">http://sucs.org/files/Help/mw-script.tar.gz</a>. Type the bold parts of the following at the command line on silver to install them:</p>
<pre class="console">[dez@silver somewhere]$ <strong>cd</strong><br />[dez@silver ~]$ <strong>wget </strong>http://sucs.org/files/Help/mw-script.tar.gz<br />--18:19:51-- http://sucs.org/files/Help/mw-script.tar.gz<br /> =&gt; `mw-script.tar.gz'<br />Resolving platinum.sucs.swan.ac.uk... 137.44.10.6<br />Connecting to platinum.sucs.swan.ac.uk|137.44.10.6|:3128... connected.<br />Proxy request sent, awaiting response... 200 OK<br />Length: 15,552 (15K) [application/x-gzip]<br /><br />100%[====================================&gt;] 15,552 --.--K/s <br /><br />18:19:51 (25.05 MB/s) - `mw-script.tar.gz' saved [15552/15552]<br /><br />[dez@silver ~]$ <strong>tar zxvf mw-script.tar.gz</strong><br />.mwrc<br />mw-script/<br />mw-script/colour.mws<br />mw-script/ipc.mws<br />mw-script/mud.mws<br />mw-script/random_user.mws<br />mw-script/slap.mws<br />mw-script/system.mws<br /></pre>
<p>The <span style="font-weight: bold">.mwrc</span> file is automatically executed when you start Milliways from the shell on Silver.</p>
<p>If you are already in the Milliways talker when you make changes to your scripts, you can use the .restart command to make Milliways reload your .mwrc file and all the scripts referenced in it.</p>
\ No newline at end of file
<h2>Why do I want a version control system?</h2>
<p>Placing files you often work with under version control has several benefits:</p>
<ul>
<li><dl>
<dt>Undo changes</dt>
<dd>Sometimes when you&#39;re editing that file, you&#39;ll wish you could go back to the version that actually worked. Now you can!</dd>
</dl></li>
<li><dl>
<dt>Easily carry your work between computers</dt>
<dd>If you ever find yourself wondering which computer you left the latest version of X on, version control can help.</dd>
</dl></li>
<li><dl>
<dt>Track the changes made to a file</dt>
<dd>With Subversion you can easily get an accurate picture of what you&#39;ve changed and when.</dd>
</dl></li>
<li><dl>
<dt>Allow a group of people to collaborate effectively</dt>
<dd>Version control becomes near <em>essential</em> for any project where several people share responsibility for the same group of files.</dd>
</dl></li>
</ul>
<p><a href="http://subversion.tigris.org">Subversion</a> is a free, widely used version control system which is easy to use with your SUCS account.</p>
<h2>Creating a repository</h2>
<pre class="console">$ ssh sucs.org # Connect to the main SUCS server<br />$ svnadmin create repos<br /></pre>
<p>This creates a new empty Subversion repository named &quot;repos&quot;</p>
<p>You may now import an existing directory tree into the repository:</p>
<pre class="console">$ svn import {path of stuff to import} {path of repository}<br /></pre>
<h2>Accessing your repository</h2>
<p>Once you have set up a repository, you may access it remotely using a Subversion client. A simple but powerful command-line client exists, in addition to graphical front-ends for most platforms.</p>
<h3>Installing a Subversion client</h3>
<dl>
<dt>Linux</dt>
<dd>Subversion is included in all major linux distributions, such as Ubuntu, Fedora Core, SuSE and Mandriva. You may use your distribution&#39;s standard package management tools to install it.</dd>
<dt>Windows</dt>
<dd>The command-line client is available for Windows, but you will likely prefer to use a graphical client instead. <a href="http://tortoisesvn.tigris.org/">TortoiseSVN</a> is a Windows shell extension, providing access to version control commands through your right-click context menu.</dd>
<dt>Mac OS X</dt>
<dd>The easiest way to get SVN for Mac OS X is via <a href="http://fink.sourceforge.net/">fink</a></dd>
</dl>
<p>You can visit the <a href="http://subversion.tigris.org/project_packages.html">Subversion packages page</a> for more information.</p>
<h3>Check out a &quot;working copy&quot;</h3>
<p>In order to view and make changes to files in a Subversion repository, you must first perform a &quot;checkout&quot; operation. This downloads a copy of the files you selected from the repository to your computer, ready to be edited.</p>
<p>The following command will check out a working copy of everything in our repository:</p>
<pre class="console">$ svn checkout svn+ssh://{username}@sucs.org/home/member/{username}/repos</pre>
<h2>Basic Subversion usage</h2>
<p>Below are the commands you are likely to use often, to keep your working copy(s) synchronised with your Subversion repository:</p>
<h3>After you make changes to a file</h3>
<pre class="console">$ svn commit -m &quot;Changes made&quot;</pre>
<h3>Fetching the latest revision</h3>
<pre class="console">$ svn update</pre>
<h3>Placing a new file under version control</h3>
<pre class="console">$ svn add {file(s)}</pre>
<h3>Dealing with conflicts</h3>When you have more than one edit of one line you will have a conflict. When this happens, you have to manualy merge the two changes. You do this in your editor of choice. Once you&#39;ve patched up the file you need to tell Subversion<br /><pre class="console">$ svn resolved {file(s)}<br /></pre>
<p>For more on resolving conflicts see the <a href="http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.resolve">Subversion Book</a><br /></p><h2>Further Reading</h2>
<p>If you want to know more about using Subversion, you can take a look at the following links:</p>
<dl>
<dt><a href="http://www.onlamp.com/pub/a/onlamp/2002/10/31/subversion.html">Single-User Subversion</a></dt>
<dd>A slightly more comprehensive tutorial on using Subversion in a single-user environment.</dd>
<dt><a href="http://svnbook.red-bean.com/">Version Control with Subversion</a></dt>
<dd>A free book about using Subversion, including a large reference section.</dd>
</dl>
<h1>This page is out of date, and the instructions on it are unlikely to work. &nbsp;</h1><p>
The Computer Society offers you extra disk space, and the chance to use this
disk space directly from your campus account. This can be done using the SMB
protocol. SUCS runs a server called Samba, which is available at
<strong>sucssmb</strong>. For most users the DAV option described above is easier
now that almost all the campus machines support DAV.&nbsp;</p><h3>Getting an account</h3>
In order for you to use this service, you must have an account created by a member of <a href="../../../About/Staff">staff</a>. Once you have an account, follow the instructions below.&nbsp;<h3>Connecting</h3>
<p>To connect to the server, download
<a href="oa/mapsucs.bat">mapsucs.bat</a> and run it
from the Command Prompt (Start, Programs, Command Prompt) with your username
as a parameter:&nbsp;</p>
<table border="0" bgcolor="#0000aa">
<tbody><tr><td>
<font color="#ffff00"><strong>&gt; mapsucs <em>username</em></strong></font>
</td></tr>
</tbody></table>
<p>You will be prompted for your <em>Samba</em> password three times - once for every drive that will be mapped. The drives are mapped as follows:</p>
<table border="1">
<tbody><tr><th>
Path
</th><th>
Drive letter
</th><th>
Description
</th></tr>
<tr><td>
sucssmbhomes
</td><td>
h:
</td><td>
Your personal disk space on SUCS
</td></tr>
<tr><td>
sucssmbwinapps
</td><td>
i:
</td><td>
Windows Applications installed on SUCS
</td></tr>
<tr><td>
sucssmbftp
</td><td>
j:
</td><td>
The SUCS Anonymous FTP site
</td></tr>
</tbody></table>
<p>Once the drives have been mapped once, a record of
this is made in your personal Windows Registry settings. This means
that your drives will be automatically mapped every time you log on. If
for any reason your settings are lost, all you have to do is run the
batch file again to recreate the mappings.&nbsp;</p><h3>Changing your password</h3>
To change your password, ssh to sucs, and use the command smbpasswd.
You will be asked for your current password, then prompted for your new
one twice, to confirm that you have typed it correctly.&nbsp;<h3>Deleting files</h3>
You must be careful when deleting files on SUCS over a Samba connection.
The files will not be transferred to the Recycle Bin. You should not delete symbolic links to directories with your Samba connection as the files in the
real directory will be deleted too. It is strongly recommended that you
always use the Linux <strong>rm</strong> command to remove such files.
\ No newline at end of file
<div style="text-align: left">
<style>
a.wd {behavior: url(#default#AnchorClick);}
</style>
The Computer Society offers you extra disk space and you can use this
from anywhere on the internet via <a href="http://www.webdav.org">WebDAV</a>. This enables you to see your files on the SUCS network as if you were browsing through folders on your own computer.<br /></div><h2>Windows</h2><p>[<span style="font-weight: bold">Note:</span> These may be out of date instructions for WebDAV on Windows. An up-to-date, slap-dash pictorial walkthrough can be found <a href="http://andrewprice.me.uk/weblog/entry/a-shiny-windows-pictorial-walkthrough-for-sucs-members-who-like-pointing-and-clicking" title="Windows XP WebDAV walkthrough at Andrew Price&#39;s blog">here</a>.]</p><p>In an Internet Explorer window the following link should just <a class="wd" href="https://sucs.org/dav" target="_blank" folder="https://sucs.org/dav">Open a Web Folder</a>, if it does not then try the next suggestion.</p><p>In an Explorer window (the one with the file
icons), select <strong>Open</strong>, then enter https://sucs.org/dav/ in
the <strong>Go to</strong> box, tick <strong>Open as web folder</strong> and hit OK.
<br /></p><p>
You will be asked to accept a digital certificate (used to keep the file
transfers between your workstation and the machines encrypted), and then for
your login and password. After this you will get an explorer window showing
the files on your computer society space. </p><h2>Linux</h2><h3>Gnome</h3><p>Open a nautles window, select Open Location from the file menu, and give davs://sucs.org/dav as the location, you will be promted for your SUCS username and password.<br /></p><h3>KDE</h3><p>Anyone that uses KDE feel free to write this bit!<span style="font-weight: bold"><br /></span></p><h2 style="text-align: left">Mac OS X</h2><p>Grab Finder, In the menu navigate to &quot;Go -&gt; Connect to Server&quot; or just key in Command+K then enter https://sucs.org/dav/ as the server address, you will be promted for your SUCS username and password.</p>
\ No newline at end of file
<p>When you join a society that is a member of SUCS, you will quite likely have given them your email address so they can email you. The system SUCS provides to societies to send email to their members is called <em>mailman</em>. Here is a brief guide to using mailman&#39;s web interface to change your preferences, using the mailing list <em>jokes</em> as an example. You can apply these principles to other mailing lists that you may be (or want to be) subscribed to.</p>
<p>Note: there are two general methods for using mailing lists: the web interface and the email interface. To get help on the email interface, send an email to (for example) <a href="mailto:jokes-request@lists.sucs.org" title="jokes-request@lists.sucs.org">jokes-request@lists.sucs.org</a> with the word &#39;help&#39; in the subject or body.</p>
<h3>Subscribing to lists</h3>
<p>To subscribe to the <em>jokes</em> mailing list, go to <a href="http://lists.sucs.org/mailman/listinfo/jokes" target="_blank" title="http://lists.sucs.org/mailman/listinfo/jokes">http://lists.sucs.org/mailman/listinfo/jokes</a>. On this page is a description of the list, a form for subscribing, and (for existing members) forms for seeing the members list and changing your list options. Enter the email address you want mail from the list to be sent to. If you want, you can supply your name (so people looking at the members list know who you are), and you can pick a password. If you don&#39;t pick a password, mailman will pick one for you, and email it to you.</p>
<p><span style="color: red">WARNING</span>: Do not use an important password for the list, because it will be emailed to you periodically as a reminder, in clear text.</p>
<p>You can also subscribe by sending an email to (e.g.) <a href="mailto:jokes-subscribe@lists.sucs.org" title="jokes-subscribe@lists.sucs.org">jokes-subscribe@lists.sucs.org</a>. You will be sent back an email asking you to confirm you want to subscribe. Simply reply to the email, keeping the subject intact (though a Re: at the start is OK), or type the URL (web address) it gives you into a web browser.</p>
<h3>Changing your preferences</h3>
<p>Mailman has lots of options for things like digest mode (where you receive all the day&#39;s email in one big &#39;digest&#39; instead of as individual emails - this is particularly handy if the list sees a lot of traffic) and whether you want to receive copies of your own emails to the list. To change these preferences, enter your email address in the box at the very bottom of the list&#39;s info page (<a href="http://lists.sucs.org/mailman/listinfo/jokes" title="http://lists.sucs.org/mailman/listinfo/jokes">http://lists.sucs.org/mailman/listinfo/jokes</a> for the <em>jokes</em> list) and click on the button next to it. This sends you to a page with lots of options that you can leave alone or change as you wish.</p>
<h3>Sending messages to the list</h3>
<p>You can send a message to everyone subscribed to the list simply by sending an email from the address you subscribed with to (e.g.) <a href="mailto:jokes@lists.sucs.org" title="jokes@lists.sucs.org">jokes@lists.sucs.org</a>.</p>
<p>Note: Some mailing lists are &#39;announcement&#39; lists (usually called something like <em>jokes-announce</em>). You can still send mail to these lists, but they have to be approved by a <em>moderator</em>, a person who decides if an email is suitable for the list or not.</p>
<h3>Unsubscribing from lists</h3>
<p>To unsubscribe from a list you don&#39;t want to get mail from (or send mail to) anymore, log in to your preferences page for that list. On the following page there is a button you can click on to unsubscribe. It&#39;s easy to click on this by mistake, so the form makes you click on the checkbox below it first.</p>
<p>Alternatively, you can send mail to (e.g.) <a href="mailto:jokes-unsubscribe@lists.sucs.org" title="jokes-unsubscribe@lists.sucs.org">jokes-unsubscribe@lists.sucs.org</a>. You will be sent back an email asking you to confirm you want to unsubscribe. Simply reply to the email, keeping the subject intact (though a Re: at the start is OK), or type the URL (web address) it gives you into a web browser.</p>
<p>The Computer Society allows its members to keep their own sets of personal web pages, which can be accessed from anywhere on the Internet. Setting up your web pages is quite straightforward - this guide will show you how to do it.</p>
<h2>Setting up a directory</h2>
<p>Your web pages should be stored in a directory called <tt>public_html</tt>,
within your home directory. To create this directory, <a href="/Knowledge/Help/SUCS%20Services/Logging%20in%20remotely">SSH to silver</a>, then type the following command from the command-line prompt:</p>
<p><tt>mkdir ~/public_html</tt></p>
<p>The ~ (or &quot;tilde&quot;) character is usually obtained by pressing SHIFT and the key to the
left of the enter key on the third row of the keyboard. On a Mac keyboard, you will find this key immediately to the left of Z.</p>
<p>The above command will <strong>m</strong>a<strong>k</strong>e the <strong>dir</strong>ectory called <tt>public_html</tt>, the <tt>~/</tt> denoting that it is within your home
directory. To change to this directory, type:</p>
<p><tt>cd ~/public_html</tt></p>
<p>or just <tt>cd public_html</tt> if you are in your home directory already.</p><h2>Creating a file</h2>Web pages are written in <strong>HTML</strong> format - HTML stands for <strong>H</strong>yper<strong>T</strong>ext <strong>M</strong>arkup <strong>L</strong>anguage. To enable the computer to distinguish them from other files, each HTML filename must end with the
characters <tt>.html</tt> (note the full stop).
<p>It&#39;s wise to call your main page <tt>index.html</tt>. This is because unless a web browser is told which page within your directory to look at, it usually shows your <tt>index.html</tt> page. Also, you must have an <tt>index.html</tt> page for your website to be listed on your <a href="/Community/Members">Member page</a>.</p>
<p>You should create your file in a text editor. Many different editors are available on
our system, the most popular ones, in increasing order of friendliness, being
<tt>vi</tt>, <tt>joe</tt> and <tt>nano</tt>. Nano is probably the best editor
for beginners to use, as all the commands are listed at the bottom of the
screen at all times.</p>
<p>To edit a file called <tt>index.html</tt> in Nano, just type</p>
<p><tt>nano index.html</tt>&nbsp;</p>
<p>The convention <tt>^C</tt> at the bottom of the screen in Pico indicates that
you should hold the Control (Ctrl) key down and press the character noted.
For example, Control-X will exit Pico, and Control-O (the letter &#39;oh&#39;)
will save your current file (Nano calls this &#39;WriteOut&#39;).</p>
<h2>Writing your web page</h2>
<p>A HTML document is a text file, with special formatting, links and the like
marked by <strong>tags</strong>. The vast majority of tags come in pairs. The initial
tag, <tt>&lt;tag&gt;</tt> turns on an effect, the final tag, <tt>&lt;/tag&gt;</tt>
turns it off. With the exception of the &quot;DOCTYPE&quot;, tags should be written in lower case.</p>
<p>With that in mind, let&#39;s look at a simple example of HTML. You can
<a href="/files/Help/example.html">view this page</a> (press Back on your browser to
return here when you&#39;re done).</p>
<pre>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;<br />&lt;html&gt;<br /> &lt;head&gt;<br /> &lt;title&gt;My Homepage&lt;/title&gt;<br /> &lt;/head&gt;<br /> &lt;body&gt;<br /> &lt;h1&gt;Hello, this is my page&lt;/h1&gt;<br /> &lt;p&gt;I&#39;m a student at &lt;strong&gt;Swansea University.&lt;/strong&gt;&lt;/p&gt;<br /> &lt;p&gt;I&#39;m also a member of &lt;a href=&quot;http://www.sucs.swan.ac.uk/&quot;&gt;SUCS&lt;/a&gt;&lt;/p&gt;<br /> &lt;/body&gt;<br />&lt;/html&gt;</pre>
<p>The tag that starts <tt>&lt;!DOCTYPE</tt> tells the web browser which of the HTML standards to follow. In this case, we are using HTML 4.01. The tag <tt>&lt;html&gt;</tt> then starts the HTML
document. All HTML files are divided into two sections - a <strong>head</strong> and a <strong>body</strong>.</p>
<p>The head of the file always starts with the tag <tt>&lt;head&gt;</tt>, and finishes
with the tag <tt>&lt;/head&gt;</tt>. The head can contain general information about the file: its author, subject matter, copyright status and so on. In this case, all we&#39;ve put in the head is the title of the page (between the beginning and closing tags <tt>&lt;title&gt;</tt> and <tt>&lt;/title&gt;</tt>). The title of the page will normally be displayed at the top of the browser window, next to the browser name.</p>
<p>The body of the file now follows. The first line of the body shows an example of a <strong>heading</strong>. Heading size 1, denoted by the tags <tt>&lt;h1&gt;...&lt;/h1&gt;</tt> is the largest size of heading available in the browser. Text marked with <tt>&lt;h1&gt;</tt> will normally be written in bold type, significantly larger than normal text.</p>
<p>A normal line of text then follows, starting with a <tt>&lt;p&gt;</tt> tag, indicating that this is a paragraph. If you&#39;ve viewed the <a href="/files/Help/example.html">example file</a>, you&#39;ll have noticed that the text &quot;Swansea University&quot; appears in <strong>bold</strong>. This
is accomplished by the tags <tt>&lt;strong&gt;...&lt;/strong&gt;</tt> at the beginning and end
of the phrase. Other text effects are also available - we&#39;ll return to these.</p>
<p>This line of text finishes with the tag <tt>&lt;/p&gt;</tt>, indicating that the paragraph has finished. The browser prints a blank line between this and the next line of text. Note that the web browser will <strong>not</strong> move on to the next line of text unless it finds a specific tag telling it to do so - it ignores the position of new lines in your HTML file.</p>
<p>The next line shows the main feature of HTML: the ability to create links
between one document and another. The code for this is</p>
<p><tt>&lt;a href=&quot;location of other page&quot;&gt;...&lt;/a&gt;</tt></p>
<p>The location of the page to be linked is given in the quotes following <tt>href=</tt>. This should normally be of the format <tt>http://...</tt> that Firefox and other browsers show just below the menu bar. However, if you&#39;re linking a page on the same directory, you can just give the filename within the quotes (or a path to a subdirectory if the file is within the subdirectory).</p>
<h2>Locating your files and letting others see them</h2>
<p>Before anyone can read your page using a browser (this includes you too, generally) you <strong>must</strong> make sure that everybody is given permission to read the files in your <tt>public_html</tt> directory. To do this, type the following four commands from the command line, pressing Enter after each:</p>
<pre>cd<br />chmod a+x .<br />cd public_html<br />chmod -R a+rx .<br /></pre>
<p>(For the curious, these commands change to your home directory, give all users execute permission on your home directory, change to your <tt>public_html</tt> directory, and recursively give all users read and execute permission on all files and subdirectories within this directory).</p>
<p>Your web address will be of the form:</p>
<p><tt>http://sucs.org/~<em>username</em>/</tt></p>
<p>where <em><tt>username</tt></em> should be replaced by the username you chose for your SUCS account. This assumes that you have a file called <tt>index.html</tt> in your <tt>public_html</tt> directory: if not, you&#39;ll have to add the filename of your index page to the end of the location above.</p>
<p>So if your username is <tt>spod</tt>, and you wish to access the file called
<tt>bobbins.html</tt> in your <tt>public_html</tt> directory, you would use:</p>
<p><tt>http://sucs.org/~spod/bobbins.html</tt></p>
<h2>Summary</h2>
<p>Having followed this guide, you should now have a folder called <tt>public_html</tt> in your SUCS account home directory, in which you have created a text file called <tt>index.html</tt> containing a valid HTML document. They should have been given the correct permissions so that when visiting <tt>http://sucs.org/~<em>username</em>/</tt> you are able to see the web page you created. </p><p>If it hasn&#39;t worked, don&#39;t worry - help is at hand! Log on to <a href="/Knowledge/Help/SUCS%20Services/Using%20Milliways">Milliways</a> and ask for help. There&#39;s nearly always someone there ready to offer assistance. Alternatively, post a message on the <a href="/Community/Forum/">Forum</a>.<br /></p>
<h2>Credits&nbsp;</h2><p>Current version by <a href="http://sucs.org/~dez/">Dez</a>, based on the guide written by <a href="http://sucs.org/~rhys/">Rhys</a> which was inspired by a guide to HTML on the Merton College, Oxford website, written by
Robin Stevens.</p>
\ No newline at end of file
<p><em>This page is under construction</em></p><p>There are many photo gallery programs available that you can install in your SUCS web space. If you were feeling particularly adventurous, you could write your own, as other SUCS members have. However, in these cases, you are responsible for making sure that the program is secure and bug free and for keeping it up-to-date. Not so with a program called <a href="http://gallery.menalto.com/">Gallery</a> which is already installed on the SUCS web server. All you have to do is follow the instructions below to set it up for your website and we will keep it up-to-date.</p><ol><li>If you haven&#39;t done so already, follow the <a href="/Knowledge/Help/SUCS%20Services/Using%20your%20web%20space">Using your web space</a> walkthrough to set up your public_html directory and ensure that the permissions are set correctly.</li><li>If you don&#39;t already have one, you need to ask a member of admin to set up a Postgres database for you.</li><li><a href="https://sucs.org/Knowledge/Help/SUCS%20Services/Logging%20in%20remotely">Login to silver</a> and type the following at the prompt, pressing Enter after each line:<br /></li></ol>
\ No newline at end of file
<h1>Basics</h1>
<p>Using PHP in your SUCS webspace is as easy as creating a file with a .php extention.</p>
<p>e.g.&nbsp; Create a file called helloworld.php</p>
<pre>&lt;?php<br /> echo "Hello World&lt;br&gt;\n";<br />?&gt;<br /></pre>
<p>There is comprehensive documentation for php online at <a href="http://www.php.net/manual/en/">http://www.php.net</a></p>
<h1>Programming<br /></h1>
<p>For those that have never programmed for the web before, web (or CGI) programming is quite different from writing traditional software. An easy way to think of what happens is that every time a user loads a web page, your program gets run, it gets told any values the user gave, it prints out a response page and then exits.&nbsp; </p>
<p>Your program (your php page) exits after every request, nothing is stored, there is no kind of state or persistance, you have to do all of those things yourself.</p>
<p>Typical approaches that are used to get around these are :-</p>
<h2>Cookies</h2>
<p>When you output a page you can include with it some small pieces of text called cookies. The users web browser will store these, and hand a copy of them back to you with each subsequent page request. These are often used to remember some kind of state to identify which user it is returning, such as by storing a unique session identifier.</p>
<h2>Databases</h2>
<p>Cookies can only hold small amounts of data, and are not very permanent or trustworthy, if a user closes the browser, or switches to another machine, they are lost. For more persistant storage we typically use a database. Ask a member of SUCS admin to create one for you.</p>
<h1>Using a Database</h1>
<p>Here at SUCS we prefer to use the <a href="http://www.postgresql.org/docs/8.4/interactive/index.html">PostgreSQL</a> database system, it is a very common and powerful SQL database system, once a database has been created you can directly access the database from the commandline using the <strong>psql</strong> command.&nbsp; You can also access it from your PHP code, PHP does have functions for directly interface with postgres, but we would recommend that you use an abstraction layer such as <a href="http://adodb.sourceforge.net/">AdoDB</a>, which makes accessing it much friendlier and safer.</p>
<p>AdoDB is already installed on the SUCS servers, to use it simply include the following lines in your code :</p>
<pre>require("/usr/share/php/adodb/adodb.inc.php");<br />$DB = NewADOConnection('postgres8');<br />$DB-&gt;Connect('dbname=mydbname user=myusername');<br />$DB-&gt;SetFetchMode(ADODB_FETCH_ASSOC);</pre>
<p>&nbsp;</p>
<p>You can then make database queries like so. (see the <a href="http://phplens.com/lens/adodb/docs-adodb.htm">Adodb Manual</a> for more info)</p>
<pre>$rows = $DB-&gt;GetAll("SELECT * FROM mydata ORDER BY id");</pre>
<p>The result is an array $rows where each element of the array contains one row of the database as an associative array.</p>
<p>An example for printing all the results might be something like this:</p>
<pre>echo "&lt;ul&gt;\n";
foreach ($rows as $row)
{
echo "&lt;li&gt;${row['id']} = ${row['name']}\n";
}
echo "&lt;ul&gt;\n";
</pre>
<p>&nbsp;</p>
<h1>Using Templates</h1>
<p>Traditional PHP can be thought of as a HTML page with fragments of code within it, where the fragments of code control the printing of certain other parts of the HTML.&nbsp; This is easy when you start, but as your projects grow in complexity it can become harder deal with the mixture of code and html. One good way of dealing with this is to seperate the html generation away from the PHP code by using a templating system such as <a href="http://www.smarty.net/docs/en/">Smarty</a>. </p>
<p>You can use the smarty system by first creating the directories 'templates' and 'templates_c' in your directory, then add the following code to your PHP document, making sure that there is nothing before the &lt;?php tag.</p>
<pre>&lt;?php<br />require("/usr/share/php/smarty/libs/Smarty.class.php");<br />$smarty = new Smarty;<br /></pre>
<p>Now, to reuse the above database example, we would make out database query, and then tell smarty about the data we want it to print.</p>
<pre>$rows = $DB-&gt;GetAll("SELECT * FROM mydata ORDER BY id");<br />$smarty-&gt;assign("mydata", $rows);<br /></pre>
<p>Next we define the template, which tells smarty how to display the data. </p>
<p>We create the file <em>templates/list.html</em> and enter this:</p>
<pre>&lt;html&gt;<br />&lt;body&gt;<br />My List :-<br />&lt;ul&gt;<br />{foreach $mydata as $row}<br />&lt;li&gt; {$row.id} = {$row.name}<br />{/foreach}<br />&lt;/ul&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;<br /></pre>
<p>Now that we have both the data, and the instructions on how to display it, back in our php code we can ask it to display the result.</p>
<pre>$smarty-&gt;display("list.html");<br />?&gt;</pre>
<p>We can exit then as we have finished and dont need to output anything more.</p>
<p>If you write your templates carefully, you will quickly find that you can resuse the same templates again and again for different parts of your website, especially if you start to write reusable templates that only render certain pieces of a page, and you chain them together. eg by using {include ...} to load common headers and footers for each page.</p>
\ No newline at end of file
Firstly you need to <a href="SUCS%20Services/Logging%20in%20remotely">log in</a>.<p>Once you have logged in for the first time, your first priority should be to reset your password from the one you gave when you joined to something else. To select a password, you should consider the following guide lines: </p><ul><li>Use at least 6 different letters/numbers/symbols </li><li>Use a mixture of lower and uppercase </li><li>Use a mixture of numbers and letters and symbols </li><li>Don&#39;t use names of family members / boyfriends / girlfriends etc. </li><li>Don&#39;t use words which appear in the dictionary </li><li>Do consider using acronyms (with mixed case) to generate what would appear to be a random mix of letters, numbers and symbols to anyone who didn&#39;t know the acronym. </li></ul><p>In order to change your password, type the command <strong>passwd</strong>. You will be prompted for your old password and then you have to enter the new password twice. Once you have done this, there is no way for any of the Computer Society System Admin to find out what your password is. If you forget your password, it must be reset by the Admin to a new one. </p>
<h2>The Command Line</h2>When you login, you will be faced with a variety of messages which end up with the display of a prompt. At this point you can type in commands; pressing Enter results in the commands being executed. To start with, try out some of the commands listed below. They all return immediatly to the command line after they have executed resulting in the display of another prompt at which you can enter another command.<p>&nbsp;</p><p>Here is a list of simple commands with brief descriptions: </p><ul><li><strong>ls</strong> List files in the current directory </li><li><strong>ps</strong> List all the process you are running </li><li><strong>who</strong> List who is on the system and where they are </li><li><strong>w</strong> List who is on the system and what they are doing </li></ul><p>Most commands are very short; they are often used with command line arguments. If you type:<br /></p><pre>ls -la<br /></pre>Then you will get a <strong>l</strong>ong listing of <strong>a</strong>ll your files. The &quot;-la&quot; part of the command is referred to as it&#39;s command line arguments. You could also try:<br /><pre>ps -aux<br /></pre>As this will produce a list of all the processes (programs) being run on the computer which will be much longer than the list the command produced earlier. Don&#39;t worry if you did not understand the output produced by this program, it will be explained later. If the text scrolled off the top of your screen, then try typing:<br /><pre>ps -aux | more<br /></pre>This time you will see only a single screenful of information. Press the space bar to see the next screen, press return to see the next line; pressing <strong>b</strong> will make the text scroll back one page. When you have finished viewing the document, type <strong>q</strong> if the prompt has not been redisplayed. <p>&nbsp;</p><h2>Finally</h2>Try some other commands, such as those below: <p>&nbsp;</p><ul><li><strong>finger</strong> username - Find out about others on the system </li><li><strong>talk</strong> username - Talk to another user </li><li><strong>write</strong> username - Write to a users screen </li><li><strong>cp</strong> file1 file2 - Copy a file </li><li><strong>mv</strong> file1 file2 - Move a file </li><li><strong>mkdir</strong> name - Make a directory </li><li><strong>rmdir</strong> name - Remove a directory </li><li><strong>cd</strong> name - Change directory </li><li><strong>cat</strong> name - View a text file </li><li><strong>more</strong> file - View a text file a screen at a time</li><li><strong>chmod</strong> perms name - Change file permissions </li><li><strong>chsh</strong> - Change your login shell </li><li><strong>chfn</strong> - Change your real name and contact information on the system </li><li><div align="left"><strong>man</strong> command - View the manual page for specified command (see also the <a href="UNIX%20Commands%20and%20Concepts/The%20Online%20Manual">man</a> section)</div></li></ul>
\ No newline at end of file
<p>There are many control key combinations (where you hold down the Ctrl key and press another key) that you will find useful both when using the shell and navigating text. These are listed in the table below.</p>
<table border="1">
<tbody>
<tr>
<th>Ctrl-</th><th>Function</th>
</tr>
<tr>
<td>a</td>
<td>Home - move cursor to the beginning of the line</td>
</tr>
<tr>
<td style="vertical-align: top;">c<br /></td>
<td style="vertical-align: top;">Cancel - abort <br /></td>
</tr>
<tr>
<td style="vertical-align: top;">d<br /></td>
<td style="vertical-align: top;">End of File - used to quit some programs cleanly<br /></td>
</tr>
<tr>
<td style="vertical-align: top;">e<br /></td>
<td style="vertical-align: top;">End - move cursor to the end of the line<br /></td>
</tr>
<tr>
<td style="vertical-align: top;">h<br /></td>
<td style="vertical-align: top;">Backspace<br /></td>
</tr>
<tr>
<td style="vertical-align: top;">k<br /></td>
<td style="vertical-align: top;">Delete from cursor to the end of the line<br /></td>
</tr>
<tr>
<td style="vertical-align: top;">q<br /></td>
<td style="vertical-align: top;">Start Transmitting - unfreezes output from the terminal<br /></td>
</tr>
<tr>
<td style="vertical-align: top;">r<br /></td>
<td style="vertical-align: top;">Reverse intelligent search - find the most recent match from the command history (works in bash and Milliways)<br /></td>
</tr>
<tr>
<td style="vertical-align: top;">s<br /></td>
<td style="vertical-align: top;">Stop Transmitting - freezes output from the terminal<br /></td>
</tr>
<tr>
<td style="vertical-align: top;">w<br /></td>
<td style="vertical-align: top;">Delete word at cursor<br /></td>
</tr>
<tr>
<td style="vertical-align: top;">z<br /></td>
<td style="vertical-align: top;">Suspend - stop the current job and return to the shell<br /></td>
</tr>
<tr>
<td style="vertical-align: top;">\<br /></td>
<td style="vertical-align: top;">Quit - quit a program (for example, if Ctrl-c doesn't work)<br /></td>
</tr>
</tbody>
</table>
\ No newline at end of file
<p>As described in <a href="/wiki/email.shell">"Using shell-based mail clients"</a>, you don't have to download your SUCS email to read it - you can read it using one of the mail clients installed on silver.</p>
<p>This section presents quick guides to some of them.</p>
\ No newline at end of file
<p>Alpine, short for "Apache Licensed Program for Internet News and Email", is designed to be easy to use and by default has a reduced command set to help with this. It replaces <a href="/Knowledge/Help/UNIX%20Commands%20and%20Concepts/Mail%20Clients/pine">pine</a>, which is no longer developed.</p>
<p>Alpine will only run on silver and is started with the following command:</p>
<pre class="console">$ alpine</pre>
<h3>Changing the default colours</h3>
<p>If you have previously used pine, the first thing you will probably want to do is change the colour scheme. To do this, press S (setup), K (Kolor), go to "Normal Color" and press enter. You can then select the colour combination you prefer - perhaps a white foreground colour and black background. Once you're happy with your selection, press E (To Colors), E (Exit Setup) and confirm that you want to save the changes.</p>
\ No newline at end of file
<p><strong>Note:</strong> Pine has been obsoleted by <a href="/Knowledge/Help/UNIX%20Commands%20and%20Concepts/Mail%20Clients/alpine">Alpine</a> and consequently is no longer available on silver. You should use alpine instead.</p>
<hr />
<p>Pine, short for &quot;Program for Internet News and Email&quot;, is designed to be easy to use and by default has a reduced command set to help with this.</p>
<p>Pine will only run on silver and is started with the following command:</p>
<pre class="console">$ pine</pre>
<p>You will be presented with the following screen:</p>
<pre class="console"><span class="reverse"> PINE 4.58 MAIN MENU Folder: INBOX 1 Message </span><br /><br /><br /> ? HELP - Get help using Pine<br /><br /> C COMPOSE MESSAGE - Compose and send a message<br /><br /> I MESSAGE INDEX - View messages in current folder<br /><br /> <span class="reverse"> L FOLDER LIST - Select a folder to view </span><br /><br /> A ADDRESS BOOK - Update address book<br /><br /> S SETUP - Configure Pine Options<br /><br /> Q QUIT - Leave the Pine program<br /><br /><br /><br /><br /> Copyright 1989-2003. PINE is a trademark of the University of Washington.<br /> <span class="reverse">[Folder &quot;INBOX&quot; opened with 1 message]</span><br /><span class="reverse">?</span> Help <span class="reverse">P</span> PrevCmd <span class="reverse">R</span> RelNotes<br /><span class="reverse">O</span> OTHER CMDS <span class="reverse">&gt;</span> [ListFldrs] <span class="reverse">N</span> NextCmd <span class="reverse">K</span> KBLock</pre>
<p>To select a menu item, you can either press the key indicated (e.g. for help, it&#39;s ?; to compose a message, C) or move the highlight to the appropriate option with the up and down arrow keys, then press Enter.</p>
<p>If you just want to send an email, you can use:</p>
<pre class="console">$ pine <em>[email address]</em></pre>
<p>This will produce the following screen:</p>
<pre class="console"><span class="reverse"> PINE 4.58 COMPOSE MESSAGE Folder: (CLOSED) No Messages </span><br /><br />To : test@test.com<br /><span class="reverse">Cc :</span><br />Attchmnt:<br />Subject :<br />----- Message Text -----<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><span class="reverse">^G</span> Get Help <span class="reverse">^X</span> Send <span class="reverse">^R</span> Rich Hdr <span class="reverse">^Y</span> PrvPg/Top <span class="reverse">^K</span> Cut Line <span class="reverse">^O</span> Postpone<br /><span class="reverse">^C</span> Cancel <span class="reverse">^D</span> Del Char <span class="reverse">^J</span> Attach <span class="reverse">^V</span> NxtPg/End <span class="reverse">^U</span> UnDel Line<span class="reverse">^T</span> To AddrBk<br /></pre>
<p>You may notice that this bears a striking resemblance to pico or <a href="../Text%20Editors/nano">nano</a>. This is because pine does actually use the pico text editor to compose mail (and nano is based on pico).</p>
<p>You will see that the <strong>Cc</strong> line is highlighted as this is what you are expected to enter next. If you want to enter multiple email addresses, separate them with commas. When you have finished a field, press enter. Once you get to the point that <strong>----- Message Text -----</strong> is highlighted, you can type the message itself.</p>
<p>When you have finished, press Ctrl-X to send the message, Ctrl-O to postpone it or Ctrl-C to cancel. If you postponed the message, you can go back to it by choosing the Compose message option and saying &quot;yes&quot; when asked if you want to continue the postponed mesage.</p>
\ No newline at end of file
<p>A text editor is one of the most important tools you will use on a UNIX-based machine. For example, the settings for most programs and servers are held in text files. If you want to write your own programs, you will use a text editor to do this and writing web pages is also done in a text editor.</p>
<p>There are a number of text editors installed on the SUCS machines, some more powerful than others. It's probably best to try a few and find the one you like most.</p>
\ No newline at end of file
<p>Joe is a &quot;mode-less&quot; text editor, meaning that unlike with, for example, <a href="../../../../wiki/vi">vi</a>, you can start typing text the moment you open it. If you have ever used WordStar or one of Borland&#39;s languages, such as TurboPascal, you should find it easy to use as it uses the same control key commands.</p>
<p>To start joe, you use the command:</p>
<pre class="console">$ joe <em>[filename]</em></pre>
<p>Most commands in joe start with <em>Ctrl-K</em>. So to get the help screen, you press <em>Ctrl-K H</em>. The result is as follows:</p>
<pre class="console"><span class="reverse"> Help Screen turn off with ^KH more help with ESC . (^[.) </span><br /><span class="reverse">&nbsp;</span><u>CURSOR</u> <u>GO TO</u> <u>BLOCK</u> <u>DELETE</u> <u>MISC</u> <u>EXIT</u> <span class="reverse">&nbsp;</span><br /><span class="reverse">&nbsp;</span>^B left ^F right ^U prev. screen ^KB begin ^D char. ^KJ reformat ^KX save <span class="reverse">&nbsp;</span><br /><span class="reverse">&nbsp;</span>^P up ^N down ^V next screen ^KK end ^Y line ^T options ^C abort <span class="reverse">&nbsp;</span><br /><span class="reverse">&nbsp;</span>^Z previous word ^A beg. of line ^KM move ^W &gt;word ^R refresh ^KZ shell <span class="reverse">&nbsp;</span><br /><span class="reverse">&nbsp;</span>^X next word ^E end of line ^KC copy ^O word&lt; ^@ insert <u>FILE</u> <span class="reverse">&nbsp;</span><br /><span class="reverse">&nbsp;</span><u>SEARCH</u> ^KU top of file ^KW file ^J &gt;line <u>SPELL</u> ^KE edit <span class="reverse">&nbsp;</span><br /><span class="reverse">&nbsp;</span>^KF find text ^KV end of file ^KY delete ^_ undo ^[N word ^KR insert<span class="reverse">&nbsp;</span><br /><span class="reverse">&nbsp;</span>^L find next ^KL to line No. ^K/ filter ^^ redo ^[L file ^KD save <span class="reverse">&nbsp;</span><br /><span class="reverse"> IW Unnamed Row 1 Col 1 12:12 Ctrl-K H for help</span></pre>
<p>Note that in the help, the symbol &quot;^&quot; represents the Ctrl key.</p>
<p>A lot of the standard <a href="../Control%20Keys">control keys</a> apply, but a few of the most commonly-used joe-specific commands are listed below:</p>
<table border="1">
<tbody><tr>
<th>Key-comb</th>
<th>Command</th>
</tr>
<tr>
<td>Ctrl-K H</td>
<td>Help</td>
</tr>
<tr>
<td>Ctrl-K D</td>
<td>Save the file</td>
</tr>
<tr>
<td>Ctrl-K X</td>
<td>Save and exit</td>
</tr>
<tr>
<td>Ctrl-K F</td>
<td>Search/Replace</td>
</tr>
<tr>
<td>Ctrl-C</td>
<td>Exit without saving</td>
</tr>
</tbody></table>
<p>You launch nano with the command:</p>
<pre class="console">$ nano <em>[filename]</em></pre>
<p>When you do, you will be presented with the following screen:</p>
<pre class="console"><span class="reverse"> GNU nano 1.2.1 New Buffer </span>
<span class="reverse">[ New File ]</span>
<span class="reverse">^G</span> Get Help <span class="reverse">^O</span> WriteOut <span class="reverse">^R</span> Read File <span class="reverse">^Y</span> Prev Page <span class="reverse">^K</span> Cut Text <span class="reverse">^C</span> Cur Pos<br /><span class="reverse">^X</span> Exit <span class="reverse">^J</span> Justify <span class="reverse">^W</span> Where Is <span class="reverse">^V</span> Next Page <span class="reverse">^U</span> UnCut Txt <span class="reverse">^T</span> To Spell<br /></pre>
<p>You will notice a number of commands at the bottom of the screen. These are executed by using the key combination to the left of the command name. In this context, the symbol "^" means Ctrl. So to <strong>Get Help</strong>, you would press Ctrl-G; to <strong>Exit</strong>, you would press Ctrl-X, and so on.</p>
<p>Some of the standard <a href="https://sucs.org/Knowledge/Help/UNIX%20Commands%20and%20Concepts/Control%20Keys">control keys</a> apply here.</p>
<p>The official website for nano, which includes documentation, is <a href="http://www.nano-editor.org/">http://www.nano-editor.org/</a>.</p>
\ No newline at end of file
<p><em>Vi</em> (pronounced &quot;vee-eye&quot;) is a popular and very powerful text editor. It&#39;s fairly hard to learn, but it&#39;s well worth learning, especially since it&#39;s often the only editor available on an unfamiliar Unix system.</p>
<p>The first thing you&#39;ll notice about <em>vi</em> when you run it is that you can&#39;t enter text straight away. This is because <em>vi</em> starts in <em>command mode</em>, which uses many commands based on keys that would normally produce a character (such as letters and punctuation). This is an unusual approach but it works well as the majority of commands are single, unshifted keystrokes on the main part of the keyboard, meaning that for the vast majority of your time using <em>vi</em>, your hands stay in exactly the same place. This way you don&#39;t waste time moving your hands around the keyboard. Also, the rarity of commands using CTRL or ALT reduces the amount of stretching that the hand has to do, reducing the probability of repetitive strain injury.</p>
<h2>Modes</h2>
<p><em>Vi</em> has several modes; the most important are command mode, insert
mode, command line mode and visual mode. In any of these modes you can press <strong>ESC</strong>
to go back to command mode.</p>
<h3>Insert mode</h3>
<p>Insert mode behaves much as you&#39;d expect: pressing a key inserts the appropriate character. You can use the arrow keys to move about, but bear in mind that going back to command mode is often faster, especially if you have a long way to move.</p>
<p>There are several ways to enter insert mode from command mode. Most commonly you will press <strong>i</strong> to start typing before the cursor, or <strong>a</strong> to start typing after it. You can also press <strong>o</strong> or <strong>O</strong> to insert a blank line respectively after or before the current one and start typing in it. (Note that vi is case sensitive.)</p>
<p>To leave insert mode, just press <strong>ESC</strong>.</p>
<h3>Command mode</h3>
<p>Most of your time will be spent in command mode. Here you enter commands to enter other modes, move the cursor around, and do simple text manipulation such as deleting (cutting), yanking (copying) and pasting.</p>
<p>In general, there are two types of command: those that are modified using a count, and those that are modified using a movement. Commands taking a count can be entered without one, but commands taking a movement don&#39;t do anything until they get a movement telling them how much text to act on.</p>
<p>As an exanple, there are two ways to delete 5 lines, and to delete 10 characters to the right of the cursor.</p>
<h4>Supplying a count</h4>
<p>To delete the current line and the four lines after it, press <strong>5dd</strong>. Similarly, to delete the current character and 9 characters to the right of it, press <strong>10x</strong>.</p>
<p>The exact meaning of the count depends on the command. For example, the <strong>K</strong> command looks up the word under the cursor in the <a href="../The%20Online%20Manual">manual</a> (exactly as if you had typed <strong>man (word)</strong> in the shell). Adding a count tells the command to look the word up in that section of the manual (exactly as if you had typed <strong>man (count) (word)</strong> in the shell).</p>
<h4>Combining a command with a movement</h4>
<p>Movement of the cursor is achieved using the keys h, j, k and l - these are left, down, up and right respectively. Think of the curve in the j as being an arrow pointing downwards. These are &quot;count&quot; commands - that is, they can be repeated by typing a number before it. You can also move the cursor using the arrow keys, but they can&#39;t be combined with commands as described below like hjkl can. There are also lots of advanced movement commands that move further, e.g. to the beginning / end of the word / sentence / paragraph. These are documented in <em>vim</em>&#39;s online help system (type <strong>:h</strong> to read it).</p>
<p>To delete the current line and the 4 lines after it, press <strong>d4j</strong>. In words, this means &quot;delete lines from here until wherever the movement <strong>4j</strong> goes&quot;. Similarly, <strong>d9l</strong> deletes the current character and the 9 characters to the right of it - it says &quot;delete characters from here until wherever the movement <strong>9l</strong> goes&quot;.</p>
<h4>Command mode reference</h4>
<table border="1" cellspacing="1" cellpadding="1" style="margin-top: 1em; margin-bottom: 1em">
<thead>
<tr><td>Command</td><td>Meaining</td><td>Modifier</td></tr>
</thead>
<tbody>
<tr><td>a</td><td>Append text after cursor (enters insert mode)</td><td>Count</td></tr>
<tr><td>d</td><td>Delete (cut) text</td><td>Movement</td></tr>
<tr><td>dd</td><td>Delete line</td><td>Count</td></tr>
<tr><td>D</td><td>Delete rest of line (if given count &gt; 1, also deletes count-1 following lines)</td><td>Count</td></tr>
<tr><td>gg</td><td>Move to start of file (or countth line)</td><td>Count</td></tr>
<tr><td>G</td><td>Move to end of file (or countth line)</td><td>Count</td></tr>
<tr><td>h</td><td>Move left</td><td>Count</td></tr>
<tr><td>i</td><td>Insert text before cursor (enters insert mode)</td><td>Count</td></tr>
<tr><td>j</td><td>Move down</td><td>Count</td></tr>
<tr><td>J</td><td>Join lines (minimum count 2, if specified)</td><td>Count</td></tr>
<tr><td>k</td><td>Move up</td><td>Count</td></tr>
<tr><td>l</td><td>Move right</td><td>Count</td></tr>
<tr><td>n</td><td>Repeat last search</td><td>Count</td></tr>
<tr><td>o</td><td>Insert text in a blank line after current line (enters insert mode)</td><td>Count</td></tr>
<tr><td>O</td><td>Insert text in a blank line before current line (enters insert mode)</td><td>Count</td></tr>
<tr><td>p</td><td>Paste after cursor</td><td>Count</td></tr>
<tr><td>P</td><td>Paste before cursor</td><td>Count</td></tr>
<tr><td>u</td><td>Undo (very useful!)</td><td>Count</td></tr>
<tr><td>CTRL-r</td><td>Redo</td><td>Count</td>
</tr><tr><td>v</td><td>Enter visual mode</td><td>Movement</td></tr>
<tr><td>V</td><td>Enter linewise visual mode</td><td>Movement</td></tr>
<tr><td>x</td><td>Delete character at cursor</td><td>Count</td></tr>
<tr><td>X</td><td>Delete character before cursor</td><td>Count</td></tr>
<tr><td>y</td><td>Yank (copy)</td><td>Movement</td></tr>
<tr><td>yy</td><td>Yank line</td><td>Count</td></tr>
<tr><td>/</td><td>Search forwards from cursor</td><td>Count</td></tr>
<tr><td>?</td><td>Search backwards from cursor</td><td>Count</td></tr>
<tr><td>:</td><td>Enter command-line mode</td><td>Count or Visual</td></tr>
<tr><td>&lt;</td><td>Shift line left count times</td><td>Count</td></tr>
<tr><td>&gt;</td><td>Shift line right count times</td><td>Count</td></tr>
<tr><td>&lt;&lt;</td><td>Shift line left once</td><td>None</td></tr>
<tr><td>&gt;&gt;</td><td>Shift line right once</td><td>None</td></tr>
<tr><td>%</td><td>Match brackets / braces etc (handy if you get lost among lots of parentheses)</td><td>None</td></tr>
<tr><td>^</td><td>Move to start of line (but after whitespace)</td><td>None</td></tr>
<tr><td>0</td><td>Move to start of line</td><td>None</td></tr>
<tr><td>$</td><td>Move to end of line</td><td>None</td></tr>
</tbody>
</table>
<h3>Command line mode</h3>
<p><em>Vi</em> has a &quot;command line&quot; which is used to enter a number of &quot;Ex commands&quot; that have long names or take various textual arguments - for example, opening and saving files and setting variables. To enter an Ex command first press <strong>:</strong> (colon). There isn&#39;t much to say about this mode except to give a list of some commonly used commands.</p>
<table border="1" cellspacing="1" cellpadding="1">
<thead>
<tr><td>Command</td><td>Meaning</td></tr>
</thead>
<tbody>
<tr><td>e</td><td>Open a new file for editing - follow by filename</td></tr>
<tr><td>w</td><td>Save (write) - follow by filename to use (unless you want to save with the same filename)</td></tr>
<tr><td>q</td><td>Quit</td></tr>
<tr><td>wq</td><td>Save and quit</td></tr>
<tr><td>noh</td><td>Stop highlighting things found by the last search</td></tr>
<tr><td>syntax on</td><td>Turn syntax colouring on (<em>vim</em>-specific)</td></tr>
<tr><td>syntax off</td><td>Turn syntax colouring off (<em>vim</em>-specific)</td></tr>
<tr><td>set</td><td>Set an option</td></tr>
<tr><td>let</td><td>Set a variable</td></tr>
<tr><td>s/foo/bar/</td><td>Substitute regular expression foo with bar. Useful for changing large amounts of text at the same time or in the same way</td></tr>
<tr><td>h</td><td>Read <em>vim</em>&#39;s online help - optionally follow by a word to look up. (<em>vim</em>-specific, though probably works in some other versions)</td></tr>
</tbody>
</table>
<p>Sometimes it might be a bad idea to execute a command - for example, typing <strong>:q</strong> without saving first. In these cases <em>vi</em> might not let the command go ahead. You can override this using an exclamation mark; for example, <strong>:q!</strong> quits without saving, even if the buffer has changed since you last saved.</p>
<p>For commands that act on the current line only, the command can be preceded by % to make it act on every line instead. There are a few such range modifiers, all of which are documented in vim&#39;s online help.</p>
<h3>Visual mode</h3>
<p>This provides a convenient alternative to most movement-oriented commands rather like selection in other editors. Pressing <strong>v</strong> starts a highlight on the current character that can be expanded by moving about (with hjkl or other movement commands, but <em>not</em> the arrow keys). Similarly, pressing <strong>V</strong> selects text a line at a time, and moving up and down changes the amount of text selected.</p>
<p>For example, <strong>v9ld</strong> will delete the current character and the 9 to the right of it, but, equivalently, you can press <strong>v</strong>, then <strong>l</strong> nine times, followed by <strong>d</strong>. And <strong>V4jd</strong>, or <strong>V</strong> followed by <strong>j</strong> four times and then <strong>d</strong>, will delete the current line and the four lines after it. Between the <strong>v</strong> or <strong>V</strong> and the command, the text which the command will act on is highlighted.</p>
<p>To cancel visual mode, press <strong>ESC</strong>.</p>
<p>(Historical note: <em>vi</em> is an abbreviation for &quot;visual&quot;, but it wasn&#39;t named after this mode - rather, it was to distinguish it from line editors such as <em>ed</em> which were the only editors available when the original <em>vi</em> was created back in the early 1970s. They&#39;re not much used now because the hardcopy terminals they were designed for are long since obsolete.)</p>
<h3>Ex mode</h3>
<p>Ex mode is like command-line mode, except that you enter a sequence of Ex commands instead of directly working on the file. It&#39;s rather like <em>ed</em>. As such it is rather hard to use and not particularly useful.</p>
<h2>Some useful features in vim</h2>
<p>The following instructions refer only to vim; other clones may have similar mechanisms, but probably not the same ones.</p>
<h3>Syntax colouring</h3>
<p>Many clones of vi, including vim, provide highlighting of syntactic elements in a large number of programming and markup languages. This can greatly help in understanding the structure of code, especially if you are dyslexic.</p>
<p>To turn on syntax highlighting, type <strong>:syntax on</strong>. If you are using an appropriate filename (i.e. one that has the canonical extention for the language you are editing) vim will be able to guess which language you want. in some cases the guess is wrong - in these cases you can tell vim to highlight for a different language by typing <strong>:set syntax=(language)</strong>.</p>
<p>In particular, the filename extension .pl is, by default, associated with Perl. Unfortunately this clashes with the default extension for Prolog source files, which is also .pl. You can tell vim to interpret the file as Prolog by typing <strong>:set syntax=prolog</strong>.</p>
<p>Another thing to watch out for is that each syntax specification may support several dialects. For example, vim&#39;s Pascal highlighting supports GNU Pascal as well as Delphi. Generally you need to set a variable to change vim&#39;s behaviour in these cases:</p>
<ul>
<li>To highlight Pascal using Delphi&#39;s dialect, type <strong>:let pascal_delphi = 1</strong></li>
<li>To highlight Bourne shell scripts using the bash dialect, type <strong>:let is_bash = 1</strong></li>
</ul>
<h3>Autoindent and c-indent</h3>
<p>These are two exceptionally handy features when editing source code:</p>
<ul>
<li>Autoindent (turned on with <strong>:set ai</strong> and turned off with <strong>:set noai</strong>) automatically inserts as much whitespace at the start of a new line as there is on the current line (e.g. when you press enter or use the <strong>o</strong> or <strong>O</strong> commands). This saves you reaching for the tab key most of the time.</li>
<li>C-indent (turned on with <strong>:set cin</strong> and turned off with <strong>:set nocin</strong>) provides even more when editing C source code (and source code for languages with C-like syntax, such as Java). On top of the provisions of autoindent, it automatically inserts extra whitespace where appropriate, particularly after a {, and deletes it when appropriate, particularly when you type a }. With both options turned on, you almost never have to press the tab key, saving a lot of time.</li>
</ul>
<p><span style="color: red">Note:</span> When pasting text into vim using the middle mouse button under X, autoindent and cindent can easily mess up the formatting of the text being pasted. You should turn both options off before pasting.</p>
<h3>Folds</h3>
<p>Many of the editors supplied with integrated development environments (IDEs) allow you to collapse large sections of code, such as a class, function, or loop body. Folds achieve the same effect in vim.</p>
<p>In C-like languages, a convenient way to fold all {} blocks is to do:</p>
<pre>:syn region myFold start=&quot;{&quot; end=&quot;}&quot; transparent fold<br />:syn sync fromstart<br />:set foldmethod=syntax<br /></pre>
<p>This will automatically fold all {} blocks. To expand the fold under the cursor, press <strong>za</strong>, and the same to close it again. To manually create a fold, use the <strong>zf</strong> command with a movement or Visual mode selection.</p>
\ No newline at end of file