Introduction
Ubuntu is a distribution (or distros in short) of "GNU-Linux", just like RedHat, Fedora, SUSE, and Debian. In other words, it is a packaging of "Linux Kernel + GNU System Programs/Utilities".
Ubuntu is open-source and free ("free" as in "free speech", not as in "free beer"). Ubuntu is sponsored by Mark Shuttleworth, a south African entrepreneur who made his fortune in IT, via a company called Canonical Inc. The term "ubuntu" means "humanity towards others" in southern African language.
Ubuntu runs the GNOME desktop manager. It includes the OpenOffice suite, Firefox Web browser, Mozilla Thunderbird, Pidgin IM client, and a collection of tools and games. It uses Advanced Packaging Tool (APT) - Debian's high-level package management system - for managing the software on the system.
The first Ubuntu version was released in October 2004. Since then, there are two releases per year, in April (YY-04) and October (YY-10), e.g., 14.04, 14.10. Some version are marked as LTS (Long Term Support), which will be supported over the next 5 years, e.g., 14.04 LTS.
Ubuntu has many flavors: Ubuntu Desktop, Ubuntu Server, Ubuntu Cloud, Ubuntu Netbook, Ubuntu Core, Kubuntu, EdUbuntu, Xubuntu, and others.
Installing Ubuntu Desktop for Programmers/Developers
Ubuntu "Desktop" vs. Ubuntu "Server"
Ubuntu has many flavors, notably Ubuntu Desktop and Ubuntu Server. Ubuntu Desktop and Ubuntu Server are almost identical, except that the Server does not come with the Windowing system, i.e., no GUI applications. For development, install the Desktop first; and then install the server packages (such as LAMP). For production, use the Server without the Windowing system.
Installing Ubuntu alongside other Operating System
There are various ways to install Ubuntu alongside other Operating Systems (such as Windows, Mac OS), such as:
- Via a virtualization software such as VirtualBox or VMWare.
- Dual-boot or multi-boot, with each OS running in its own disk partition.
- For Windows, via so-called "Wubi" which installs Ubuntu in a Windows' file, instead of disk partition (available for some Ubuntu versions only).
Installing Ubuntu via VirtualBox or VMWare
[TODO]
Dual-Boot Windows and Ubuntu
The installation procedure changes over the Ubuntu releases. Follow the instructions in the Ubuntu download site, and google if you encounter problems.
- Download Ubuntu Desktop from http://www.ubuntu.com/download. Select "Ubuntu Desktop" ⇒ Download.
- Read "How to burn a DVD" or "How to create a bootable USB stick". Create a DVD or USB Stick.
- Read "Installation instructions for Ubuntu for desktop" @ http://www.ubuntu.com/download/desktop/install-ubuntu-desktop.
- Change your computer's boot setting to boot from Live-CD, typically by pressing F2 or F12 or other function key, immediately after power up.
- You could try out Ubuntu from Live-CD without installing; or install Ubuntu.
- Choose Install Ubuntu. Follow the "Installation Instruction". The installer could detect the presence of the Windows OS, and "install Ubuntu alongside with Windows 7".
- Allocate sufficient disk space for Ubuntu (20-80 GB). Ubuntu will be installed in two partitions: a "root" partition and a "swap" partition. The default swap partition's size is your RAM size (4-16 GB). Give 20-50 GB for the root partition, depending on your usage.
- Follow the instruction on the screen to complete the installation.
Install Ubuntu Desktop with "Wubi (Windows Installer)"
NOTES: This is probably out-dated. Wubi could not install the latest version of Ubuntu!
To run Ubuntu together with Windows, you could install Ubuntu via "Wubi" (or Windows Installer), instead of using dual-boot. Ubuntu will be installed in a single file instead of a partition; and it will be much easier to uninstall. You need to have about 20 GB of free space. The installation takes about an hour.
"Wubi", however, is available for certain versions for Ubuntu under some operating platforms only. Check "Wubi Guide" @ https://wiki.ubuntu.com/WubiGuide.
- Goto http://www.ubuntu.com/download/desktop ⇒ Choose "Download Windows Installer" (only if "Wubi" is available).
- Read "Installing Ubuntu with the Windows installer".
- Run the downloaded installer ⇒ Set a "username". Choose a short, lowercase name without spaces, such as "peter" - it will be used as your login ID and your home directory name ⇒ Set a "password" ⇒ Install.
Ubuntu, by default, disables the superuserroot
for security. This user can issuesudo
command to perform system administration.
In a Wubi install, your Windows' C drive is mounted under /host
. Other drives (e.g. D drive) are mounted under /media/username/User
. In "Files Manager", you can view the Windows' C drive by selecting "Computer" under "Devices"; and other drives by selecting "User".
Post Installation - Updating Software
Run the software update:
// Update (Re-synchronize) your software list (or Package Index Files). // This does not run any actual update. sudo apt-get update // Run actual upgrade sudo apt-get upgrade
Errors that I have encountered
Error: Ubuntu installation does not detect Windows 7
Reference: http://askubuntu.com/questions/287352/ubuntu-13-04-amd64-installation-does-not-detect-windows-7
This error could be caused by a MBR (Master Boot Record) with corrupt GPT, that can be fixed by gdisk.
- Boot up the machine using Live-CD and choose "Try Ubuntu with install".
- Install gdisk (I have problems on 12.04 LTS, but fine with 13.04):
$ sudo apt-get update $ sudo apt-get install gdisk
- Back up the current MBR:
$ sudo dd if=/dev/sda of=sda.mbr bs=512 count=1
- Run gdisk to clear the GPT signatures (BE EXTREMELY CAREFUL!!!):
$ sudo gdisk /dev/sda Switch to expert mode: x To zap GPT, enter: z Choose "MBR". Make sure not to blank out the MBR.
- Re-boot with Live-CD, and you shall see the option to install alongside Windows 7.
Error: Dual-boot menu does not show up during boot
Reference: http://askubuntu.com/questions/78544/ubuntu-missing-from-boot-menu-after-setting-up-dual-boot
Need to repair the Grub, using boot-repair.
- Boot up the machine using Live-CD and choose "Try Ubuntu with install".
- Install boot-repair:
$ sudo add-apt-repository ppa:yannubuntu/boot-repair $ sudo apt-get update $ sudo apt-get install -y boot-repair
- Run boot-repair:
$ gksu boot-repair Select "Recommended repair" and follow the screen instructions.
Error: Time resets to UTC after boot
In "/etc/default/rcS
":
# assume that the BIOS clock is set to UTC time (recommended) UTC=no
Error: GUI console hangs (after upgrade)
Reinstall Unity desktop:
- At login menu ⇒ Press Ctrl-Alt-F2 to get a command-line console.
- Reinstall Unity desktop:
$ sudo su $ apt-get update $ apt-get install --reinstall ubuntu-desktop $ apt-get install unity // reinstall nvidia (if applicable) $ apt-get remove --purge nvidia* bumblebee* $ apt-get install nvidia-prime $ shutdown -r now // -r for restart
Getting Started with Ubuntu
Read the Documentation available at https://help.ubuntu.com.
"Unity" Desktop
Ubuntu uses the "Unity" desktop, which is designed "to minimize distractions, give you more room to work, and help you get things done". I highlight some of the key features of Unity desktop here:
- Launcher: On the left of the screen for you to launch commonly-used applications (similar to Windows' taskbar and Mac's dock). Apps that aren't currently running have translucent icon squares. When you start an app, the icon square pulses. When an app is running, the icon square becomes opaque. Small white triangles to the left of the icon square indicates the number of windows opened. Two triangles means that two windows opened. Three triangles means three or more windows. A small white triangle to the right of the icon square indicates the current app.
- Dash: The top icon in the launcher (painted with the Ubuntu logo) for finding programs and files. It can also be started using the "super" key (or "Windows" key). The Dash is designed to make it easier to find, open, and use apps, files, music, and more. The various lenses (applications, files, etc.) at the bottom allow you to focus the search on a particular resource.
- Panel: The bar on top of the screen is called the panel. When you move the mouse pointer over it, it shows the App Menus for the current application on its left. The panel also houses the Status Indicators on its right.
- Status Indicators: comprising mail, battery, bluetooth, network, sound, clock, and system menus.
- Overlay scrollbars: The scroll bars appear as thin orange strips at the right and bottom edge of the window to conserve space. You can move the mouse pointer over it to reveal the "Thumb Slider". You can click the top half of the thumb slider to scroll one page up; or click the bottom half to scroll one page down. You can drag the thumb slider to position the page.
- HUD (Heads Up Display): HUD is a search-based alternative to traditional menus. It can be activated via the "alt" key. Instead of clicking and selecting from the menus, you can type the search phrase (such as "replace") to locate the menu item.
- Workspaces: Ubuntu provides four workspace, by default. You can group your applications in different workspaces; and use the "Workspace Switcher" to switch between workspaces.
Using Terminal - MUST READ Before You Start Programming
Programmers use "Terminal" to issue commands, instead of the graphical user interface - which is meant for common users.
You MUST have knowledge on the File system and using the Terminal. Read "Programmer's Survival Guide for Macs and Ubuntu".
Applications and Utilities
LibreOffice: The default Ubuntu's productivity suite, which is a variant of OpenOffice (currently owned by Apache). It includes:
- Writer: word processor, similar to Microsoft Word.
- Calc: spreadsheet, similar to Microsoft Excel.
- Writer: word processor, similar to Microsoft Word.
- Impresss: Presentation program, similar to Microsoft Powerpoint.
- Math: Math formula editor.
- Base: Database application, similar to Microsoft Access.
- Draw: Graphics application for creating images.
- Dia: Technical diagram drawing editor, similar to Microsoft Visio.
- Planner: Project management application, similar to Microsoft Project.
GEdit Text Editor: The GNU gedit
is the default text editor in Ubuntu. [TODO] more.
Screenshot: Press PrintScreen key to capture the entire screen; alt+PrintScreen key to capture the current window. The images are captured in PNG. Alternatively, use the dash to search for "Screenshot". You can set the area of screenshot.
PDF Documents: Evince is the default PDF reader (you can also install the Acrobat Reader). To edit PDF document, you can install an extension called PDF Import to LibreOffice, or use programs such as PDF Editor (pdfedit
).
PDF Printer: You can install CUPS PDF printer via:
$ sudo apt-get install cups-pdf
The default "printing location" is at ~/PDF. You can configure the printer setting via "System Setting" ⇒ Printers.
Command-line Interface (CLI) Consoles
You can press Ctrl-Alt-F1 to Ctrl-Alt-F6 to activate one of the 6 virtual command-line consoles (provided by getty/agetty programs). Press Ctrl-Alt-F7 to return to the GUI console.
These command-line console is handy if your GUI console is having problem.
APT for Managing Software
Reference: https://help.ubuntu.com/community/AptGet/Howto
Ubuntu adopts Debian's Advanced Packaging Tool (APT) for software package management of ".deb
" package. Other Linux distros, such as Red Hat, uses RPM Package Manager.
APT can properly handle the dependencies. It automatically finds and downloads all the dependencies of the packages to be installed. It can also resume installation after an interruption.
Upgrading Installed Software of Your System
To perform software upgrade for your system:
- Check the Ubuntu repositories for updates to your installed software:
$ sudo apt-get update
Theupdate
option resynchronizes your package index files from their source. The list of available sources are fetched from/etc/apt/sources.list
and/etc/apt/sources.list.d/
. This command does not actually install any new versions of the software. - Upgrade your software by entering:
$ sudo apt-get upgrade // Do not upgrade version // or $ sudo apt-get dist-upgrade // Make version upgrade, if any
These commands install new versions of software.
The "dist-upgrade
" option ensure that any dependencies that are needed will be installed, even if major changes are needed - it was designed to upgrade from one version of Linux to a new version. On the other hand, the "upgrade
" option will not make major change, but install security and simple package upgrade. "apt-get upgrade
" never removes or adds new package, but patches up existing packages (under the same version number). On the other hand, "apt-get dist-upgrade
" may add/remove packages.
Useupgrade
for your production system!
Installing New Software
When you type a command, such as "mysql
" or "g++
", which is not installed in the system, Ubuntu is smart enough to suggest packages that contain such command.
To install new software, use "apt-get install <package-name>
". For example, to install MySQL Server:
$ sudo apt-get install mysql-server
It lists all the dependencies. It also lists the recommended packages, and suggested packages (less important than recommended packages). It will install the dependencies automatically. But you need to explicitly install the recommended and suggested packages.
Removing Software
You can use "apt-get remove
" or "apt-get purge
" to remove installed software. Beware that all the packages that rely on this package will also be removed, as they are no longer valid. For example,
$ sudo apt-get remove <package-name> $ sudo apt-get remove --purge <package-name> // Also purge the configuration files in "/etc" $ sudo apt-get purge <package-name> // Same as above
Configuration
APT's configuration is stored in /etc/apt
.
/etc/apt/sources.list
and/etc/apt/sources.list.d/
: locations of software repositories to fetch packages. You can also configure via the GUI "Software Sources"./etc/apt/apt.conf
: APT configuration file.
APT stores temporary files in /var/cache/apt
and /var/lib/apt
. You can use command "apt-get clean
" to clean the cached DEB files.
Check the Version/Status of the Installed Packages
There are several ways to list information of installed packages:
- use
dpkg
(Debian Package Manager) command with option:-l, --list <package-name-pattern>
: List packages matching given pattern-s, --status <package-name>
: Report status of specified package-L, --listfiles <package-name>
: List files installed to your system from package-name-S, --search <filename-search-pattern>
: Search for a filename from installed packages
// List installed software $ dpkg --list // List ALL install packages $ dpkg --list mysql-server // List package mysql-server $ dpkg --list mysql* // List packages beginning with mysql* $ dpkg --status mysql-server // Show status of package mysql-server $ dpkg --filenames mysql-server // List files installed for package mysql-server
apt-cache policy <package-name>
:$ apt-cache policy mysql-server // Show package mysql-server $ apt-cache policy mysql-server* // Show packages beginning with mysql-server
The
apt-cache
queries the APT cache, and lists installed as well as the available packages.apt-cache show <package-name>
:$ apt-cache show mysql-server $ apt-cache show mysql-server // Similar to
apt-cache policy
, but show more informationapt-cache search <key>
:$ apt-cache search mysql --names-only // Show all available package names containing mysql
How to Install JDK 8 on Ubuntu
There are several JDK implementations available for Linux, such as Oracle JDK, OpenJDK, Sun JDK, IBM JDK and GNU Java Compiler. We shall choose the Oracle JDK 8. Ubuntu chooses OpenJDK as its default JDK, which is not 100% compatible with Oracle JDK.
Step 0: Check if JDK has already been Installed
Open a Terminal and issue this command:
$ javac -version
If a JDK version number (e.g., "javac 1.x.x_xx
") appears, JDK has already been installed. You can skip the installation and goto step 2.
To remove OpenJDK, issue command:
$ sudo apt-get purge openjdk-\*
Step 1: Download and Install JDK
- Goto JDK (Java SE) download site @ http://www.oracle.com/technetwork/java/javase/downloads/index.html. Select "Java SE 8u{xx}" ⇒ JDK ⇒ Download ⇒ "Accept License Agreement" ⇒ Select Linux x86 (for 32-bit system) or Linux x64 (for 64-bit system) "
tar.gz
" package, e.g., "jdk-8u{xx}-linux-i586.tar.gz
". (To check your OS version, goto "Settings" ⇒ "Details"; or issue command "file /sbin/init
".) The tarball will be stored in folder "~/Downloads
", by default. - We shall install JDK under "
/usr/local/java
" (or Ubuntu's default JDK directory/usr/lib/jvm
). First, create a directory "java
" under "/usr/local
". Open a Terminal and issue these commands:$ cd /usr/local $ sudo mkdir java
Extract the downloaded package (Check your downloaded filename!)$ cd /usr/local/java $ sudo tar xzvf ~/Downloads/jdk-8u{xx}-linux-x64.tar.gz // x: extract, z: for unzipping gz, v: verbose, f: filename
JDK shall be extracted in a folder "/usr/local/java/jdk1.8.0_{xx}
", where{xx}
is the upgrade number. - Inform the Ubuntu to use this JDK/JRE:
// Setup the location of java, javac and javaws $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_{xx}/jre/bin/java" 1 // --install symlink name path priority $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_{xx}/bin/javac" 1 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_{xx}/jre/bin/javaws" 1 // Use this Oracle JDK/JRE as the default $ sudo update-alternatives --set java /usr/local/java/jdk1.8.0_{xx}/jre/bin/java // --set name path $ sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_{xx}/bin/javac $ sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_{xx}/jre/bin/javaws
The above steps set up symlinksjava
,javac
,javaws
at/usr/bin
(which is in the PATH), that link to/etc/alternatives
and then to JDK bin directory.
The "alternatives" system aims to resolve the situation where several programs fulfilling the same function (e.g., different version of JDKs). It sets up symlinks thru/etc/alternatives
to refer to the actual programs to be used.
$ cd /usr/bin $ ls -ld java* lrwxrwxrwx 1 root root 22 Mar 31 20:41 java -> /etc/alternatives/java lrwxrwxrwx 1 root root 23 Mar 31 20:42 javac -> /etc/alternatives/javac lrwxrwxrwx 1 root root 24 Mar 31 20:42 javaws -> /etc/alternatives/javaws $ cd /etc/alternatives $ ls -ld java* lrwxrwxrwx 1 root root 40 Aug 29 18:18 java -> /usr/local/java/jdk1.8.0_20/jre/bin/java lrwxrwxrwx 1 root root 37 Aug 29 18:18 javac -> /usr/local/java/jdk1.8.0_20/bin/javac lrwxrwxrwx 1 root root 42 Aug 29 18:19 javaws -> /usr/local/java/jdk1.8.0_20/jre/bin/javaws
- To verify the JDK installation, issue these commands:
// Show the Java Compiler (javac) version $ javac -version javac 1.8.0_20 // Show the Java Runtime (java) version $ java -version java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode) // Show the location of javac and java $ which javac /usr/bin/javac $ which java /usr/bin/java
- To use Java under Firefox, you need to enable the so-called "Java Plugin for web browser".
$ cd /usr/lib/mozilla/plugins // if this directory does not exist, create it $ sudo mkdir -p /usr/lib/mozilla/plugins
Then, create a symbolic link to your Mozilla plugins folder, (check your JDK folder)$ cd /usr/lib/mozilla/plugins $ sudo ln -s /usr/local/java/jdk1.8.0_{xx}/jre/lib/amd64/libnpjp2.so
To verify the installation, restart your Firefox and issue URL "about:plugins
".Check for Java plugins with the correct version.
Starting from JDK 1.8u??, to run unsigned applets, you need to set security level to "high" add the sites to the "Exception List" (under the Java Control Panel ⇒ Security). To start the Java Control Panel:$ cd /usr/local/java/jdk1.8.0_{xx}/jre/bin $ ./ControlPanel // OR ./jcontrol
You need to restart Firefox after modifying the Exception List. - [Don't Do this step - taken care by "alternative" in Step 3. Keep here to show you how to set PATH.] Add JDK's binary directory ("
bin
") to the "PATH" by editing "/etc/profile
":$ cd /etc $ gksudo gedit profile // OR "sudo nano profile" to use the console-based nano editor
Add these lines at the end of the file "/etc/profile
", replace "{xx}
" with the actual number:export JAVA_HOME=/usr/local/java/jdk1.8.0_{xx} export PATH=$JAVA_HOME/bin:$PATH
Rerun the configuration file by:$ source /etc/profile // Check the new settings for JAVA_HOME and PATH $ echo $JAVA_HOME /usr/local/java/jdk1.8.0_{xx} $ echo $PATH .....:/usr/local/java/jdk1.8.0_{xx}/bin
Step 2: Compile and Run a Hello-world Java Program
- Open "Folder" and create a new directory called "
myProject
" under your home directory to keep all your works. - Open "Text Editor" (gedit). Enter the following source code and save as "
Hello.java
" under the "~/myProject
" directory created earlier.public class Hello { // To save as "Hello.java" under "~/myProject" public static void main(String[] args) { System.out.println("Hello, world from Ubuntu!"); } }
- To compile the Hello-world Java program, launch a Terminal and issue these commands:
// Change directory to where the source code resides $ cd ~/myProject // List the contents of current directory. Check for "Hello.java" $ ls ...... Hello.java .... // Compile "Hello.java" into "Hello.class" $ javac Hello.java // Check for "Hello.class" $ ls ...... Hello.class ....
- Run the Hello-world Java program:
// Run "Hello.class" $ java Hello Hello, world from Ubuntu!
How to Install Eclipse 4.4 (Luna) on Ubuntu
Eclipse comes with many flavors (See "Eclipse Packages" @ https://www.eclipse.org/downloads/compare.php?release=luna):
- To use Eclipse for Java programming, choose "Eclipse IDE for Java Developers" or "Eclipse IDE for Java EE Developers". You need to first install JDK. Read "How to install JDK on Ubuntu".
- To use Eclipse for PHP programming, choose "Eclipse IDE for PHP Developers".
- To use Eclipse for C/C++ programming, choose "Eclipse IDE for C/C++ Developers".
- Nonetheless, you can install any package, and then add more features.
To install Eclipse (e.g, for Java Programming):
- Download Eclipse from http://www.eclipse.org/downloads/. Choose "Linux" 32-bit or 64-bit ⇒ "Eclipse IDE for Java Developers" (or "Eclipse Standard|Classic") for Java SE program development; or "Eclipse IDE for Java EE Developers" for developing webapps. You will receive a TAR file (e.g., "
eclipse-jee-luna-R-linux-gtk-x86_64.tar.gz
") in the "~/Downloads
" folder. - Install:
// Unzip the tarball into /usr/local $ cd /usr/local $ sudo tar xzvf ~/Downloads/eclipse-jee-luna-R-linux-gtk-x86_64.tar.gz // Extract the downloaded package // x: extract, z: for unzipping gz, v: verbose, f: filename // You can also unzip in "File Explorer" by double-clicking the tarball. // Change ownership $ cd /usr/local $ sudo chown -R your-username:your-groupname eclipse // Change ownership to your chosen username and groupname // -R recursive // Set up a symlink $ cd /usr/bin $ sudo ln -s /usr/local/eclipse/eclipse // Make a symlink in /usr/bin, which is in the PATH. $ ls -ld eclipse lrwxrwxrwx 1 root root 26 Aug 30 11:53 eclipse -> /usr/local/eclipse/eclipse $ which eclipse /usr/bin/eclipse $ whereis eclipse eclipse: /usr/bin/eclipse /usr/bin/X11/eclipse /usr/local/eclipse
To run Eclipse, open the "/usr/local/eclipse
" folder and click on the "Eclipse" icon; or start a "Terminal", enter "eclipse".
Pin Eclipse on Launcher
To pin Eclipse on the launcher, create a /usr/share/applications/eclipse.desktop file with the following contents:
[Desktop Entry] Name=Eclipse Type=Application Exec=eclipse Terminal=false Icon=/usr/local/eclipse/icon.xpm Comment=Integrated Development Environment NoDisplay=false Categories=Development;IDE; Name[en]=Eclipse
Start Eclipse, right-click on the Eclipse icon on launcher ⇒ lock to launcher.
Tips and Tricks on using Eclipse
Read "Eclipse How-To".
How to Install NetBeans on Ubuntu
To use NetBeans for Java programming, you need to first install JDK. Read "How to install JDK on Ubuntu".
To install NetBeans:
- Download NetBeans from http://netbeans.org/downloads/. Choose platform "Linux (x86/x64)" ⇒ "Java SE". You shall receive a
sh
file (e.g., "netbeans-7.x-ml-javase-linux.sh
") in "~/Downloads
". - Set the downloaded
sh
file to executable and run thesh
file. Open a Terminal:$ cd ~/Downloads $ chmod a+x netbeans-7.x-ml-javase-linux.sh // Set to executable for all (a+x) $ ./netbeans-7.x-ml-javase-linux.sh // Run
Follow the instructions to install NetBeans.
To start NetBeans, run the script "netbeans
" in the NetBeans' bin
directory:
$ cd netbeans-bin-directory $ ./netbeans
How to Install and Setup LAMP (Linux-Apache-MySQl-PHP) Server on Ubuntu
Install LAMP Server
First, install the "tasksel
" utility, which simplifies the installation of LAMP packages:
$ sudo apt-get install tasksel
You can view the manual page of tasksel via "man tasksel
".
Then, run the "lamp-server
" installation task:
$ sudo tasksel install lamp-server
To check the packages installed:
$ tasksel --task-packages lamp-server apache2 ...... mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5 ...... php5-common php5-mysql php5-cli
Setup MySQL 5
Read "How to Install and Configure MySQL 5 on Ubuntu" (Skip Step 1: Installation).
Setup Apache 2
Read "How to Install and Configure Apache 2" (Skip Step 1: Installation).
Setup PHP 5
PHP supports Apache interface and Command-line interface (CLI). PHP executable is available in "/usr/bin/php
" (link to "/usr/bin/php5
" via alternatives as shown below):
$ which php
/usr/bin/php
$ ls -ld /usr/bin/php
lrwxrwxrwx 1 root root 21 Sep 24 2013 php -> /etc/alternatives/php
$ ls -ld /etc/alternatives/php
lrwxrwxrwx 1 root root 13 Sep 24 2013 /etc/alternatives/php -> /usr/bin/php5
$ whereis php5
php5: /usr/bin/php5 /etc/php5 /usr/lib/php5 /usr/include/php5 /usr/share/php5 /usr/share/man/man1/php5.1.gz
$ man php5 // Read manual
You could try out the Command-Line (CLI) PHP via:
// Say hello $ php -r 'echo "Hello, world!\n";' Hello, world! // Run phpinfo() $ php -r 'phpinfo();' ......
The PHP configuration files are "/etc/php5/apache2/php.ini
" for the Apache interface; and "/etc/php5/cli/php.ini
" for standalone command-line interface.
Write a PHP script called "test.php
" (place under Apache's base at "var/www
" or "var/www/html
") to run phpinfo()
under Apache, as below.
<?php phpinfo(); ?>
Run the script via http://localhost/test.php. The output shows that the loaded configuration files are "/etc/php5/apache2/php.ini
" and "/etc/php5/apache2/conf.d/*.ini
". The "conf.d
" contains links to "/etc/php5/mods-available
".
The Apache loads the PHP module via "/etc/apache2/apache2.conf
" ⇒ "/etc/apache2/mods-enabled/php5.conf|php5.load
" ⇒ "/etc/apache2/mods-available/php5.conf|php5.load
".
Install PhpMyAdmin
"PhpMyAdmin" is a PHP app running under Apache, which provides an GUI for managing MySQL. Run apt-get
to install phpmyadmin
:
$ sudo apt-get install phpmyadmin $ whereis phpmyadmin phpmyadmin: /etc/phpmyadmin /usr/share/phpmyadmin
You can access PhpMyAdmin via http://localhost/phpmyadmin
.
PHP's configuration file for Apache is "/etc/phpmyadmin/apache.conf
", which is included into Apache's main config file "/etc/apache2/apache2.conf
" thru "/etc/apache2/conf-enabled/phpmyadmin.conf
". In the configuration, an alias "/phpmyadmin
" is defined which is mapped to phpMyAdmin's web pages at "/usr/share/phpmyadmin
".
Install "xdebug extension for PHP" for Eclipse PDT
The mother site for xdebug extension for PHP is http://xdebug.org.
- Install xdebug extension for PHP
$ sudo apt-get install php5-xdebug
- Check the location of "
xdebug.so
" module, which is kept under "/usr/lib/php5/20121212
", where the number depends on the PHP version. - The installation creates a configuration file "
/etc/php5/mods-available/xdebug.ini
" with the following line (otherwise, create one):zend_extension=xdebug.so
NOTE: in the previous version, you need to specify the full-path filename, e.g., "
Include the following lines into "zend_extension=/usr/lib/php5/20121212/xdebug.so
".xdebug.ini
" to enable remote debugging from Eclipse PDT:xdebug.remote_enable = On xdebug.remote_port = 9000 xdebug.remote_host = <IP_ADDRESS>
Recall that Apache loads PHP configuration files "
/etc/php5/apache2/php.ini
" and "/etc/php5/apache2/conf.d/*.ini
". To enable the above xdebug configuration file, create the following symlink in "/etc/php5/apache2/conf.d
":$ cd /etc/php5/apache2/conf.d $ sudo ln -s ../../mods-available/xdebug.ini 20-xdebug.ini $ ls -l lrwxrwxrwx 1 root root 31 Sep 11 19:42 20-xdebug.ini -> ../../mods-available/xdebug.ini
- Check PHP configuration file "
/etc/php5/apache2/php.ini
" for the following settings:; Turn on the error display for development system, ; but not for production system. display_errors = On ; Format error in HTML html_errors = On
- Restart the Apache2:
$ sudo service apache2 restart
- Check the
phpinfo()
output to verify xdebug has been started. Create a PHP script called "test.php
" with the following lines, and save under the Apache's base directory "/var/www
" (or "/var/www/html
"):<?php phpinfo(); ?>
Issuehttp://localhost/test.php
, and search for xdebug (as shown below) to confirm that xdebug is activated.NOTE: If the above steps does not work, add the lines directly into
/etc/php5/apache2/php.ini
. - Configure Eclipse PDT to work with "xdebug extension for PHP" for remote debugging of PHP programs: Read "Eclipse PDT" (debugging section).
Install Firebug plugin for Firefox for debugging client-side HTML/CSS/JavaScript
Start Firefox, select menu "Tools" ⇒ Add-ons ⇒ Search for "Firebug" ⇒ Install.
[TODO] Debugging JavaScript
Install Zend Debugger for PHP
You can use either xdebug or Zend Debugger, but not both?!
NOTE: I have problems setting up Zend Debugger. I suggest you use xDebug (descried in the previous section).
- Download the Zend PHP debugger from http://www.zend.com/en/products/studio/downloads.
- Extract the tarball.
- Check your PHP version via "php --version".
- Copy the "
ZendDebugger.so
" module from the corresponding PHP version folder into/usr/lib/php5
. At the time of writing, PHP 5.4 is not supported!!! - Edit the php configuration file
/etc/php5/apache2/php.ini
to append the below:; The section name is optional, but it's always a good idea to add it, ; especially if you are not using a separate file [Zend] ; This directive needs the full path to the Zend Debugger binary zend_extension =/usr/lib/php5/ZendDebugger.so ; This directive allows Zend Debugger to start a debug session with: zend_debugger.allow_hosts=<IP_ADDRESS>/32 ; This directive allows Zend Debugger to expose itself ; upon request (this is used in some service functionality). ; The possible options are: ; never – do not expose (default) ; always – expose to whoever wants to know ; allowed_hosts – expose only if the request comes from an IP listed above zend_debugger.expose_remotely=always
- Restart the Apache2 via
$ sudo service apache2 restart
- Check the Apache's error log via
$ tail /var/log/apache2/error.log
If error "Failed loading/usr/lib/php5/ZendDebugger.so
:libssl.so.0.9.8
: cannot open shared object file: No such file or directory" occurs, you need to installlibssl
.$ sudo apt-cache search libssl0.9.8 libssl0.9.8 - SSL shared libraries libssl0.9.8-dbg - Symbol tables for libssl and libcrypto $ sudo apt-get install libssl0.9.8
Restart apache2 and check the Apache's error log. - Check the
phpinfo()
output to verify Zend Debugger has been started.
How to Install and Configure MySQL 5 on Ubuntu
Step 1: Install MySQL
Open a new Terminal and issue this command:
$ sudo apt-get install mysql-server
The installer will prompt for the password for the MySQL root
user. Set a password for root
, and remember this password.
Step 2: Verify the MySQL Installation
// Show packages relating to mysql $ dpkg --get-selections | grep mysql mysql-client-5.5 install mysql-client-core-5.5 install mysql-common install mysql-server install mysql-server-5.5 install mysql-server-core-5.5 install php5-mysql install ...... $ dpkg -l | grep mysql ...... // Show where a package is installed $ dpkg -L mysql-server $ dpkg -L mysql-common $ dpkg -L mysql-client-5.5 | less ....... // Check the location of "mysqld" (MySQL server deamon) $ which mysqld /usr/sbin/mysqld $ whereis mysqld mysqld: /usr/sbin/mysqld /usr/share/man/man8/mysqld.8.gz $ man mysqld // Read the manual // Check the location of "mysql" (MySQL command-line client) $ which mysql /usr/bin/mysql $ whereis mysql mysql: /usr/bin/mysql /etc/mysql /usr/lib/mysql /usr/bin/X11/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz $ man mysql // Read the manual
As seen from the above output, the MySQL server daemon "mysqld
" is installed at "/usr/sbin
" (system software binaries). The MySQL command-line client "mysql
" and utilities such as "mysqladmin
" and "mysqldump
" are located at "/usr/bin
" (application software binaries).
Step 3: Configure MySQL Server
The MySQL main configuration file is "/etc/mysql/my.cnf
". Additional configuration files are be placed under /etc/mysql/conf.d
directory. The configuration files are combined in this order (if available): "/etc/my.cnf
", "/etc/mysql/my.cnf
" ("SYSCONFDIR/mf.cnf
"), "$MYSQL_HOME/my.cnf
", "[DataDir]/my.cnf
", "~/.my.cnf
".
From "/etc/mysql/my.cnf
", the MySQL server (mysqld
):
- runs on the default port number of 3306.
- A special user called "
mysql
" is created to run the MySQL server. - The data directory (
datadir
) is located at/var/lib/mysql
(owned by user:groupmysql:mysql
). - The error log is located at
/var/log/mysql/error.log
.
Step 4: Start/Shutdown MySQL Server (mysqld)
MySQL is run as a service called "mysql
" (configured at "/etc/init.d/mysql
"), which is started automatically after boot. To start/stop/restart mysql, you could:
$ sudo service mysql start
$ sudo service mysql stop
$ sudo service mysql restart
// OR (same as above)
$ sudo /etc/init.d/mysql restart
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql start
MySQL server will be started automatically after the installation. You CANNOT start another instance! To check the mysqld
process:
$ ps aux | grep mysqld mysql 1113 0.0 0.3<PHONE_NUMBER>4 ? Ssl 18:33 0:08 /usr/sbin/mysqld
Step 5: Start/Stop MySQL Command-line Client (mysql)
To start a MySQL client:
$ mysql -u root -p
// Enter the password for the root user you have set in Step 1
To quit the MySQL client, type "exit
" or "quit
" on the "mysql>
" prompt.
Step 6: Remove the anonymous users:
// Login to MySQL Server using root user $ mysql -u root -p Enter Password: mysql> select user, host, password from mysql.user; // Look for users without name, or without password mysql> drop user ''@'localhost'; mysql> drop user ''@'ubuntu'; ...... mysql> select user, host, password from mysql.user; ......
Step 7: (For Java Programmers) Install MySQL JDBC Driver
- Download the latest JDBC driver from http://www.mysql.com/downloads ⇒ MySQL Connectors ⇒ Connector/J ⇒ Compressed TAR archive (e.g.,
mysql-connector-java-{5.x.xx}.tar.gz
, where{5.x.xx}
is the latest release number). - Double-click on the downloaded TAR file (at ~/Downloads) to expand into folder "
mysql-connector-java-{5.x.xx}
". - Open the expanded folder. Copy the JAR file "
mysql-connector-java-{5.x.xx}-bin.jar
" to JDK's extension directory at "/usr/local/java/jdk1.8.0_{xx}/jre/lib/ext
".$ cd /usr/local/java/jdk1.8.0_{xx}/jre/lib/ext $ sudo cp ~/Downloads/mysql-connector-java-{5.x.xx}/mysql-connector-java-{5.x.xx}-bin.jar .
How to Install and Configure Apache 2 on Ubuntu
Step 1: Install Apache
Open a new Terminal and issue this command:
$ sudo apt-get install apache2
Step 2: Verify Apache Installation
Show all package relating to apache $ dpkg --get-selections | grep apache apache2 install apache2-bin install apache2-data install apache2-mpm-prefork install apache2-utils install apache2.2-common deinstall libapache2-mod-php5 install $ dpkg -l | grep apache List the locations of a package $ dpkg -L apache2 | less ....... $ which apache2 /usr/sbin/apache2 $ whereis apache2 apache2: /usr/sbin/apache2 /etc/apache2 /usr/lib/apache2 /usr/share/apache2 /usr/share/man/man8/apache2.8.gz $ man apache2
As shown in the above output, the Apache server program "apache2
" (called "httpd
" in the previous version) is installed in /usr/sbin
(system software binaries).
Step 3: Configure Apache
The Apache's main configuration files is "/etc/apache2/apache2.conf
", which includes:
/etc/apache2/ports.conf
: defines the listening ports (defaults of 80 for HTTP and 443 for HTTPS)./etc/apache2/envvars
: defines the environment variables used by Apache, such as:APACHE_RUN_USER
:www-data
APACHE_RUN_GROUP
:www-data
APACHE_RUN_DIR
:/var/run/apache2
APACHE_LOG_DIR
:/var/log/apache2
www-data
is used to run the apache server (defined in/etc/apache2/envvars
). Userwww-data
should have "r
" permission to all the files in the public www directory and "rx
" permission to all the directories leading to the public www directory and the sub-directories./etc/apache2/sites-enabled/*.conf
: for manage application web sites.
The default "000-default.conf
" (called "default.conf
" in the earlier releases) defines a virtual host:- listening at port 80 (enabled in "
port.conf
"). DocumentRoot
at "/var/www/html
" ("/var/www
" in the previous version?!).
/etc/apache2/sites-available
" and use helper utilitya2ensite
to make a symlink to the "/etc/apache2/sites-enabled
". Similarly, use helper utilitya2dissite
to remove a site from/etc/apache2/sites-enabled
".- listening at port 80 (enabled in "
/etc/apache2/mods-enabled/*.load|*.conf
: for manage modules. Use helper utilitiesa2enmod/a2dismod
to enable or disable a module by symlinking to "/etc/apache2/mods-available
"./etc/apache2/conf-enabled/*.conf
: for additional configuration (such asphpMyAdmin
). Use helper utilitiesa2enconf/a2disconf
to enable or disable a configuration by symlinking to "/etc/apache2/conf-available
".
Step 4: Start/Shutdown Apache Server
Apache is installed as a service called "apache2
" (configured at "/etc/init.d/apache2
"). The Apache server will be started automatically after the installation.
You can restart/stop/start Apache via:
$ sudo service apache2 restart
$ sudo service apache2 stop
$ sudo service apache2 start
$ sudo service apache2 reload
// Reload the configuration file without shutdown and restarting
NOTE: The "service xxx reload
" reloads the configuration file, without shutting down the service. On the other hand, "service xxx restart
" shutdown and restart the service. Not all services support reload
.
To check the apache process:
$ ps aux | grep apache root 3950 0.0 0.0<PHONE_NUMBER>0 ? Ss 19:48 0:00 /usr/sbin/apache2 -k start www-data 3954 0.0 0.0<PHONE_NUMBER> ? S 19:48 0:00 /usr/sbin/apache2 -k start www-data 3955 0.0 0.0<PHONE_NUMBER> ? S 19:48 0:00 /usr/sbin/apache2 -k start ......
The apache parent process is started by root
; the child processes are run by www-data
.
Step 4: Accessing the Apache 2 Server
Start a web browser (such as Firefox) and issue URL http://localhost
.
Take note that the default configuration "000-default.conf
" defines a virtual host listening at port 80 with DocumentRoot
at "/var/www/html
" ("/var/www
" in the previous version?!).
How to Setup HTTPS on Apache 2 (Ubuntu)
Step 1: Enable the SSL module:
$ sudo a2enmod ssl
This command create symlinks for ssl.conf
and ssl.load
from "/etc/apache2/mods-available
" to "/etc/apache2/mods-enabled
".
Step 2: Create a self-signed Certificate for the apache server. Read "/usr/share/doc/apache2.2-common/README.Debian.gz
".
$ sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/ssl/private/apache-ssl.crt
// In the common name, enter the server's DNS name or IP address. E.g,
// Common Name (e.g. server FQDN or YOUR name) []:<IP_ADDRESS>
The make-ssl-cert
utility generates a certificate "apache-ssl.crt
" (in "/etc/ssl/private
"). The key is contained in the certificate.
[Alternative, you can use OpenSSL to generate a certificate and a private key file. See "Create a Self-Signed Certificate"].
The SSL key file should only be readable by root, the certificate file may be globally readable. These files are read by the Apache parent process which runs as root. Therefore it is not necessary to make the files readable by the user www-data
.
Step 3: Create HTTPS config file:
$ cd /etc/apache2/sites-available // Duplicate from default-ssl $ cp default-ssl my-ssl // Edit configuration (using nano editor - there is no graphical editor in Ubuntu server) $ sudo nano my-ssl
// Set the root directory your webapp DocumentRoot ...... // Define the permissions of the root directory <Directory ...... > ...... </Directory> // Check to ensure that SSL is on SSLEngine on // Set the certificate (no key file needed if you use make-ssl-cert) SSLCertificateFile /etc/ssl/private/apache-ssl.crt # SSLCertificateKeyFile /etc/ssl/private/apache.key
If you are not using the default HTTPS port of 443, you need to add the port number to "/etc/apache2/ports.conf"
.
Step 4: Activate the HTTPS site.
// Run helper utility a2ensite to enable the site by symlinking to "/etc/apache2/sites-enabled" $ sudo a2ensite // choose 'my-ssl' // Reload the configuration file (without restarting) $ sudo service apache2 reload // or $ sudo service apache2 restart
Step 5: You can access the site via https://localhost
, if the default port number 443 is used.
NOTES:
- To resolve the warning "[warn] RSA server certificate CommonName (CN) `...' does NOT match server name!?" Add a
ServerName
right below the ServerAdmin under<VirtualHost>
, in the config file:ServerName your-hostname-or-IPaddr
- Switching between HTTPS and HTTP is not really needed, as HTTPS's overhead is not very high (other than the initial hand-shake). Otherwise, you need to pass session from HTTPS (login) to HTTP.
How to Install Tomcat 7/8 on Ubuntu
Install via APT
Search for tomcat packages:
// Search for package containing the term "tomcat" $ apt-cache search tomcat // tomcat7 and tomcat6 available // Show the description of tomcat7 $ apt-cache show tomcat7 | less // Check the suggest packages
Install tomcat packages:
$ sudo apt-get install tomcat7
// Optional: Install some suggested packages
$ sudo apt-get install tomcat7-docs tomcat7-admin tomcat7-examples tomcat7-user
Define environment variable JAVA_HOME (?!)
To start/stop tomcat:
$ sudo service tomcat7 start $ sudo service tomcat7 stop $ sudo service tomcat7 restart
You can access tomcat via http://localhost:8080
.
Install Manually
Step 1: Download
Goto http://tomcat.apache.org ⇒ Download ⇒ Tomcat 8.0 ⇒ 8.0.{xx}
(where {xx}
denotes the latest release) ⇒ Binary distribution ⇒ Core ⇒ Download the "tar.gz
" package (e.g., "apache-tomcat-8.0.{xx}.tar.gz
").
Step 2: Install
Assume that it is to be installed under "/usr/local/tomcat
".
$ cd /usr/local/tomcat
$ sudo tar xzvf /PATH/TO/apache-tomcat-8.0.{xx}.tar.gz
// unzip into /usr/local/tomcat/apache-tomcat-8.0.{xx}
For security reasons, you should NOT run tomcat using root
user. We shall create a non-login user called tomcat
(in group tomcat
) to run the server.
// Create a user called "tomcat" in group "tomcat" $ sudo useradd -s /sbin/nologin -d /opt/tomcat/temp tomcat // -s <login-shell>: specify the login shell // -d <home-dir> // Change ownership to user "tomcat" and group "tomcat" $ cd /usr/local/tomcat $ sudo chown -R tomcat:tomcat apache-tomcat-8.0.{xx} // -R: recursively for the sub-directories $ sudo chmod -R 750 apache-tomcat-8.0.{xx} // -R: recursively for the sub-directories
[TODO] Test the permissions; change to adduser from useradd.
Step 3: Set Environment Variable JAVA_HOME
Check if the environment variable JAVA_HOME
, containing the JDK installed directory, has been set. To verify:
$ echo $JAVA_HOME [JDK installed directory]
If JAVA_HOME
is not set, you can edit "/etc/profile
":
$ sudo nano /etc/profile
Include the following line at the end of the file. I shall assume that JDK is installed in /usr/local/java/jdk1.8.0_{xx}
. But you need to verify the location of your JDK installed directory!!!
export JAVA_HOME=/usr/local/java/jdk1.8.0_{xx}
Rerun the script:
$ source /etc/profile
// To verify:
$ echo $JAVA_HOME
[/usr/local/java/jdk1.8.0_{xx}]
Step 4: Configure Tomcat Server
You can start tomcat using the default configuration files provided. Read "Configure Tomcat Server" for the configuration options.
Step 4: Start/Stop Tomcat Server Manually
To start the Tomcat server, open a new "Terminal" and issue:
$ cd /usr/local/tomcat/apache-tomcat-8.0.{xx}/bin // All the following commands can be used to start tomcat $ ./startup.sh $ ./catalina.sh run $ ./catalina.sh start // use "sudo" if permissions denied
If you will get an error "permission denied" on running the script, you need to set the script to be executable, via command "chmod uga+x *.sh
".
Check for the Tomcat server's TCP port number from the console messages. The default is 8080.
To verify if the Tomcat server is started, start a browser and issue URL http://localhost:8080
, suppose that Tomcat is running on the default TCP port number of 8080.
Also try URL http://localhost:8080/examples
which shows the Servlet/JSP examples.
To shutdown the Tomcat server, you can simply press control-c on the tomcat console, or issue command:
$ cd /usr/local/tomcat/apache-tomcat-8.0.{xx}/bin
// All the following commands can be used to shutdown tomcat
$ ./shutdown.sh
$ ./catalina.sh stop
Step 5: Running Tomcat as a service
Create an initialization script called "tomcat8
" under directory "/etc/init.d
", with the following contents. Check your tomcat installed directory in CATALINA_HOME
.
$ sudo nano /etc/init.d/tomcat8
#!/bin/bash export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-8.0.12 PATH=/sbin:/bin:/usr/sbin:/usr/bin start() { sh $CATALINA_HOME/bin/startup.sh } stop() { sh $CATALINA_HOME/bin/shutdown.sh } case $1 in start|stop) $1;; restart) stop; start;; *) echo "Run as $0 <start|stop|restart>"; exit 1;; esac
Set the permissions (executable):
$ sudo chmod 755 /etc/init.d/tomcat8
To start/stop the tomcat8 service:
// To start $ sudo service tomcat8 start $ sudo /etc/init.d/tomcat8 start // same as above // To stop $ sudo service tomcat8 stop $ sudo /etc/init.d/tomcat8 stop // same as above
To start tomcat8 service automatically after boot:
$ sudo update-rc.d tomcat8 defaults
Step 6: Servlet API
To write Java servlets, you need to COPY the Servlet API JAR file ("servlet-api.jar
") from "~/myProject/tomcat/lib
" to the JDK's extension directory at "/usr/local/java/jdk1.8.0_{xx}/jre/lib/ext
". You may need the superuser right.
[TODO] Does not work on latest JDK/Tomcat. Need to include servlet-api.jar
in classpath to compile.
How to Install Postfix as a Send-Only Mail Server
Reference: Postfix @ https://help.ubuntu.com/community/Postfix.
Postfix is an MTA (Mail Transfer Agent), an application used to send and receive email.
To install postfix mail server:
$ sudo apt-get install postfix
To configure postfix, run:
$ sudo dpkg-reconfigure postfix
Read "postfix" @ https://help.ubuntu.com/community/Postfix for the configuration options.
The utility "sendmail
" is installed in /usr/sbin/sendmail
.
To send an email:
$ sendmail -v<EMAIL_ADDRESS>Subject: test This is a test message Ctrl-D
The -v option requests for a mail delivery report, which is optional.
You should also install the "mailutils
", for the "mail
" utility.
$ sudo apt-get install mailutils
Try sending an email to a user at the localhost, via "sendmail local-username
", you can then read the email by logging-in as the local-username
, and run:
$ mail .......
The postfix configuration is kept in /etc/postfix/main.cf
. Run "/etc/init.d/postfix reload
" to reload the configuration.
Disable Incoming Mail
You can use the inet_interfaces directive in /etc/postfix/main.cf
to control what address Postfix listens on for incoming connections. If you set it to the following it will only listen on the loopback interface, which means that connections can only originate from that machine.
inet_interfaces = loopback-only
C/C++ Programming on Ubuntu
C Programming
To install the GNU C-compiler "gcc":
$ sudo apt-get install gcc
Write the following hello-world program and save as "Hello.c"
in a directory of your choice:
#include <stdio.h> int main() { printf("Hello, world!\n"); }
$ cd your-directory // Compile the program $ gcc Hello.c // To run the program $ ./a.out Hello, world!
C++ Programming
To install the GNU C++ compiler "g++":
$ sudo apt-get install g++
Write the following hello-world program and save as "Hello.cpp"
in a directory of your choice:
#include <iostream> using namespace std; int main() { cout << "Hello, world!" << endl; }
$ cd your-directory // Compile the program $ g++ Hello.cpp // To run the program $ ./a.out Hello, world!
C/C++ IDE
You could use Eclipse or NetBeans as C/C++ IDE. Read the "Eclipse How-To" or "NetBean How-To".
How to Install SSH Server
SSH (Secure Shell) is the secured version of the legacy telnet, which transmits everything including password in clear text.
Setting up an SSH Server - OpenSSH
Install openssh-server
package. The SSH server daemon is called sshd
. The SSH Server runs on TCP port 22, by default. The configuration file is kept in /etc/ssh/sshd_config
.
The OpenSSH package comprises a suite of tools:
sshd
server,ssh
client,sftp
(secure ftp), which replacesftp
(file transfer protocol),scp
(secure copy), which replacesrcp
(remote copy).
The ftp
(file transfer protocol), like telnet, is unsecured. sftp
puts the ftp
over the secured ssh
connection. The legacy rcp
(remote copy) was primarily used to copy a single file between machines. The scp
replaces rcp
by channeling the data over the secured ssh
connection. sftp
operates on many files; while scp
works on a single file.
Ubuntu's Tips and Tweaks
Terminal
- Copy/Paste Shortcut Keys:
The default shortcut keys for copy/paste in Terminal are Shift-Ctrl-C and Shift-Ctrl-V. You can also use the mouse pointer to select texts, and click the "middle" mouse button (if you have one) to paste the highlighted texts. Ctrl-C, by default, is configured for interrupt signal (or break).
To use Ctrl-C/Ctrl-V as copy/paste, I reconfigure Ctrl-J (or Ctrl-Shift-C) as the interrupt signal by placing this line in the "
~/.profile
":stty intr ^J
Then, we can configure Ctrl-C/Ctrl-V as copy/paste via Terminal's menu "Edit" ⇒ Keyboard Shortcuts. - Shortcut to launch Terminal: To configure a shortcut key to launch a Terminal, goto System ⇒ Preferences ⇒ Keyboard Shortcuts ⇒ Under Desktop category, choose "Run a Terminal" ⇒ Press the key you want to set as shortcut (e.g., ctrl-t).
"Nautilus" File Manager
- Show directory path in File Manager: Press Ctrl-l to show path, ESC to show icons.
- How to show files in list view insteand of icon view: Edit ⇒ Preference ⇒ choose "Views" tab ⇒ Default View ⇒ View new folders using ⇒ choose "List view". You can also choose the columns to be displayed under "List Columns" tab.
- View dot (hidden) files: Select "File" menu ⇒ Preferences ⇒ View ⇒ Show hidden files.
- Bookmark Folders (in the sidebar): Select the desired folder, click the "options" icon ⇒ Bookmark this location. The bookmarked folder will be shown in the sidebar.
- How to remove pre-set bookmarks from the sidebar such as Videos: Edit
~/.config/user-dirs.dirs
. For example, to remove "Videos", change the lineXDG_VIDEOS_DIR=""
toXDG_VIDEOS_DIR="$HOME"
; and run:$ xdg-user-dirs-gtk-update
gedit
- Enable spell check: under "tool" menu ⇒ edit ⇒ preferences.
Accessing Remote Server
You can login to a remote server via command-line SSH, and transfer files via SCP. You can also use GUI client such as FileZilla.
SSH (Secured Shell)
A terminal-based command-line client for logging in to the remote server.
$ ssh <username>@<server-name>
// OR
$ ssh <server-name> -l <username>
SCP (Secure Copy)
A terminal-based command-line client for copying files between local machine and remote server.
$ scp <source> <dest>
// <source>/<dest> format: <username>@<server-name>:<path-name>
Mount Folders of Remote Server on Nautilus File Manager
Select "Files" menu ⇒ Connect to Server ⇒ enter "sftp://server-name/path
".
FileZilla FTP/SFTP GUI Client
To install:
$ sudo apt-get install filezilla $ which filezilla /usr/bin/filezilla
To launch FileZilla, type FileZilla
from Dash. In host, use sftp://server-name
; in port, use 22 for SSH.
(For Windows) WinSCP and Putty
WinSCP is a GUI SCP for Windows. Putty is a GUI SSH client.
Ububtu Applications
Epub Reader - Calibre
To install:
$ sudo apt-get install calibre
You can launch Calibre from the dash.
Media Player - VLC
To install:
$ sudo apt-get install vlc browser-plugin-vlc
You can launch VLC player from the dash.
Wallpaper Slide Show - Wallch
To install:
$ sudo apt-get install wallch
User and Computer Administration
- Remove Guest Session: To remove the guest session in the login menu, we need to re-configure LightDM display manager's login screen settings, by editing "
/etc/lightdm/lightdm.conf
":$ gksu gedit /etc/lightdm/lightdm.conf
In the[SeatDefaults]
section, add this line:allow-guest=false
Restart your machine or restart LightDM:$ sudo restart lightdm
- How to hide an user from the login Screen: One way is to set the UID to a number less than 1000 (UID less than 1000 are system users; 1000 and above for regular users).
$ sudo usermod -u <uid> <username>
- How to Change the Display Name: The display name is kept in
/etc/passwd
. You can avoid editing/etc/passwd
directly by using utilitychfn
:$ less /etc/passwd ...... // Change user information $ sudo chfn <username> $ less /etc/passwd ......
Note: You can check the integrity of/etc/passwd
via utilitypwck
. - How to change a username:
$ sudo usermod -l <new-username> <old-username>
This does not affect the file ownerships, as they are based on UID instead of username.
You also need to move the home folder as follows:$ sudo usermod -d /home/<new-user-dir> -m <new-username>
- How to change the hostname: Your hostname is defined in two files:
/etc/hostname
and/etc/hosts
.$ sudo gedit /etc/hostname $ sudo gedit /etc/hosts
- How to choose hostnames: Either functional names (which represents, in some encoded form, the purpose of the machine) or mnemonic names (which are drawn from some pre-existing human naming scheme and contained no implicit meaning about the machine's purpose, e.g., fruits, flowers, rivers, elements, stars, drinks, etc.). Human users seem to prefer mnemonic names over functional names.
- How to mount a drive automatically at startup: Instead of manually editing
/etc/fstab
, Dash "Disks" ⇒ Select the drive or partition ⇒ click icon "More Actions" ⇒ Edit Mount Options ⇒ set "Automatic Mount Options" to off ⇒ Set "Mount Options" to "Mount at startup" ⇒ set the "mount point" (e.g., /mnt/<drive-name>).
Check/etc/fstab
for the modifications. - Show Disk Usage:
df
(Disk File system)command: report file system and disk space usage. Try "df
" and "df -h
"du
(Disk Usage for EACH file) command: estimate file space usage.
- How to read Ubuntu files from Windows: Ubuntu uses Ext2 (or Ext3/Ext4) file system. To read Ubuntu files from Windows, install software such as "Paragon ExtFS for Windows" (Free for personal use) or "Ext2Read".
- sudo cd: "
sudo cd dirname
" does not work, becausecd
is a shell built-in, not a binary. You could issue "sudo su
" to switch toroot
, followed by "cd dirname
". - Shutdown from command-line: You can shutdown the machine from Terminal, or one of the 6 command-line console (activated via Ctrl-Alt-F1 to Ctrl-Alt-F6) using:
// Shutdown $ sudo shutdown now // Restart $ sudo shutdown -r now // -r to restart $ sudo reboot
Or, via Webmin ⇒ System ⇒ Bootup and Shutdown ⇒ Button "Reboot System", or "Shutdown System". - How to set the Grub dual-boot to wait for enter key
$ sudo nano /etc/default/grub # Set to -1 to wait for enter key GRUB_TIMEOUT=-1
- Multiple Display: The display configurations are saved in
~/.config/monitor.xml
. You can remove it to re-configure. - Show the user login history:
$ last // from /var/log/wtmp $ last -f /var/log/wtmp.1 // from older file $ last -num // number of lines
Or, via Webmin ⇒ Users and Groups ⇒ Button "Display Logins by". - Show date/time: via command "
date
".
REFERENCES & RESOURCES
- Ubuntu Mother site @ http://www.ubuntu.com.
- Matthew Helmke, "Ubuntu Unleashed 2012 edition", 2012, Sams.
- Matthew Helmke & Amber Graner, "The official Ubuntu book", 7th ed, 2012, Canonical Inc. (For beginners.)


Projected 2013 State and Local Tax Collections by Type of Tax and Taxpayer Category. Projected 2013 data from the 2011 Minnesota Tax Incidence Study. PTR = Property Tax Refund. 1 Includes taconite/iron ore occupation tax. 2 Includes Health Impact Fee. 3 Includes resorts and railroads. 4 Farm includes timber.
All icons courtesy The Noun Project (collection: Minnesota symbol by The Noun Project) and the Open Knowledge Foundation's Bubbletree library.


nebraska hunting land for sale - Extensions
Nebraska, Hunting Land land, lots, ranches and farms for sale A search on landandfarm.com for Nebraska and Hunting Land that resulted in 6 listings for farms, ranches, lots, land and other related property. http://www.landandfarm.com/search/Nebraska-Hunting-Land-for-sale/
You can develop your own extensions
using the how set up dba florida.
Syntax-Highlighting Addons
Land Mark Management & Realty Nebraska Land Senator Chris Langemeier Farm Management Appraisal . Nebraska Land For Sale River Land for sale Rogers Nebraska Hunting Land For . http://www.landmarkmgtrealty.com/
Hunting Land for Sale in Cass County NE Hunting Land for Sale in Cass County NE. Farm, Ranch and Recreational Real Estate land for sale in Nebraska, Iowa, Kansas and Missouri. Land Pros Realty is . http://landpros.com/hunting-land-for-sale-in-cass-county-ne.html in one installer (526 kb).
A simple JavaScript Formatter (47kb)Hunting Land for Sale in Knox County NE Hunting Land for Sale in Knox County NE. Farm, Ranch and Recreational Real Estate land for sale in Nebraska, Iowa, Kansas and Missouri. Land Pros Realty is . http://landpros.com/hunting-land-for-sale-in-knox-county-ne.html
Lucky Creek Ranch Virtual Fly-Over - Nebraska Hunting Land For ... Jan 29, 2010 . Amazing Keya Paha County Nebraska Hunting Land For Sale. Call Mike Lashley for more information<PHONE_NUMBER> or email . https://www.youtube.com/watch?v=jYULgw-hGMw CertMaker for iOS and Android
Kansas Hunting Land for Sale Kansas Hunting Land for Sale. Farm, Ranch and Recreational Real Estate land for sale in Nebraska, Iowa, Kansas and Missouri. Land Pros Realty is the leader . http://landpros.com/kansas-hunting-land-for-sale.html
Windows 8 AppContainer Loopback Utility
Hunting Land for Sale in Butler County NE Hunting Land for Sale in Butler County NE. Farm, Ranch and Recreational Real Estate land for sale in Nebraska, Iowa, Kansas and Missouri. Land Pros Realty . http://landpros.com/hunting-land-for-sale-in-butler-county-ne.html Download
Now (60kb) or
natasha bedinfield incompatible mp3
Traffic Differ
Nebraska Land For Sale | Hunting Land Searching for hunting land for sale in Nebraska can be overwhelming due to the diverse habitat the state offers. Find the right piece of Nebraska hunting land . http://www.whitetailproperties.com/hunting-land/nebraska Download now (47kb).
SAZ Clipboard
For Sale Nebraska Farms, Ranches, and Recreational Lot - Lashley ... For sale farms, ranches, and recreational land in Nebraska is easy with Lashley Land. We specialize in buying and selling agricultural real estate. http://www.lashleyland.com/
Gallery
The Gallery extension (50kb) Hunting Land For Sale - Mason and Morse Ranch Company Colorado hunting property for sale, hunting land, elk bird upland pheasant geese . farms land for sale Colorado, Oregon, Wyoming, Texas, Kansas, Nebraska, . http://www.ranchland.com/type/hunting-property
Nebraska Hunting Land for Sale and Land for Lease in Nebraska Known as the ìTree Planters Stateî, Nebraska has hunting land for sale and land for lease all across the 77000 square miles of area inside its boarders. http://www.huntingtripsrus.com/land-sale-lease/nebraska-land.html
AnyWHERE (sample)
The AnyWHERE extension (40kb) Land for Sale, Farms for Sale, Ranches for Sale, Acreage for Sale at ... Cabela's Trophy Properties is the largest exclusive network of recreational property experts specializing in land for sale, hunting land, fishing properties, land . http://www.cabelastrophyproperties.com/
RulesTab (sample)
Hunting Land For Sale Whitetail Properties hunting land for sale listings are the most current and diverse . Find your special piece of hunting land to turn your Dreams into Reality today! . In the State of Nebraska DBA Whitetail Trophy Properties Real Estate LLC. http://www.whitetailproperties.com/hunting-land
Privacy Scanner
The Privacy Scanner
(41kb) 3155 Acres Brown County Nebraska Hunting Land and Cattle ... Hunting Land for Sale . 3155, Sold, Nebraska, Brown . The land can hold up to 550 pair of cattle for grazing and up to 2,000 head for back grounding. Fencing . http://www.waterfowlproperties.com/hunting-land/nebraska/brown/3155-acre-brown-county-nebraska-hunting-and-cattle-ranch-with-home
Content-Blocking (sample)
The Content Blocker
sample (11kb) Valley, Douglas County, Nebraska Land for sale ... - Land Watch Listings 1 - 15 of 140 . Valley, Douglas County, Nebraska: Browse Thousands of Acres of Land for Sale in Valley, Douglas County, Nebraska. http://www.landwatch.com/Nebraska_land_for_sale/Valley
Image-Flipper (sample)
The Image
Flipper sample (6kb) Burt County WRP Nebraska Hunting Land for Sale Waterfowl Hunting Property for Sale in Nebraska, Pheasant Hunting Property for sale in Nebraska, Nebraska Hunting Land for Sale, Nebraska Farms for Sale, . http://www.landpros.com/viewlisting.php?listingid=450
3rd-Party Extensions
Nebraska Waterfowl Hunting Land For Sale | The Mapping ... Nebraska Waterfowl Hunting Land For Sale. May 10, 2010 Leave a comment. Prime Nebraska Waterfowl Hunting Property along the North Platte River in . http://themappingnetwork.wordpress.com/2010/05/10/nebraska-waterfowl-hunting-land-for-sale/
Nebraska - Hunting Country Real Estate Nebraska Farms - Ranches - Land and Real Estate For Sale Rural Property For Sale - CRP and/or Hunting Land For Sale - Hunting Lodges. Mitch Barney . http://www.huntingcountry.net/nebraska.htm
neXpert Performance Report Generator
Indiana Land for sale, Indiana Acreage for Sale, Indiana Lots for ... Listings 1 - 15 of 30671 . Indiana: Browse Thousands of Acres of Land for Sale in Indiana. . Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York . Health and Fitness, Hiking, Horseback Riding, Hunting, Nightlife, ORV/ATV . http://www.landwatch.com/Indiana_land_for_sale
StresStimulus
Nebraska Land for sale, Nebraska Acreage for Sale, Nebraska Lots ... Listings 1 - 15 of 28 . The #1 online destination for land and rural retreats . Hunting LandNebraskaHolt CountyPasture Unit With Plenty Of Water Rare . http://www.landwatch.com/Nebraska_land_for_sale/500_Acres
Watcher - Passive Security Auditor
Nebraska Hunting Leases by County Visit BaseCampLeasing.com for a prime quality land lease! . With a Nebraska hunting lease you have the first right to renew every year, so passing on the . http://www.basecampleasing.com/land/hunting-leases-nebraska.htm
Whitetail Properties: Hunting Land | Recreational Land Hunting land for sale in Illinois, Iowa, Missouri, Kansas, Ohio, Michigan, Kentucky , Nebraska, Wisconsin and other recreational property for sale throughout the . http://www.whitetailproperties.com/
Ammonite - Security Scanner
Keya Paha County, Nebraska Land For Sale | Hunting Land This tract is located in the #1 Boone & Crocket county in Nebraska. It was burned in 2012 by a wild fire and is ready for you to make it your own great hunting . http://www.whitetailproperties.com/hunting-land/nebraska/keya_paha
home
x5s - Automated XSS Security Testing AssistantNebraska Recreational & Waterfront Property For Sale ... Nebraska Waterfront Property and Recreational Property for sale - recreational property, hunting land, lakefront homes, resort property, fishing property, horse . http://www.sportsmansdream.net/nebraska_recreational_property.htm
- Detecting where safe encodings were not applied to emitted
user-inputs
- Detecting where Unicode character transformations might bypass
security filters
- Detecting where non-shortest UTF-8 encodings might bypass security
filters
why use a spider splice
intruder21
Oklahoma Land For Sale | Hunting Land Oklahoma hunting land is in high demand and we have many listings of . Sale · Nebraska Hunting Land For Sale · North Carolina Hunting Land For Sale · Ohio . http://www.whitetailproperties.com/hunting-land/oklahoma
technologies in the 1960
HTML Inspector
Sold Farms, Ranches, Nebraska Hunting Land by Chris Bober Chris Bober gets the job done! Check out his sold Nebraska hunting land, farms, ranches, recreational, lakeside and other rural properties. http://www.chrisbober.com/sell-land/sold-listings/
Wisconsin Land For Sale | Hunting Land If you are looking to purchase Wisconsin hunting land, a great state to hang your tag . of Wisconsin Land Specialists a call and take a look at the properties for sale. . In the State of Nebraska DBA Whitetail Trophy Properties Real Estate LLC. http://www.whitetailproperties.com/hunting-land/wisconsin
WCF Binary-Encoded Message Inspector
Dawson County, Nebraska Land for sale, Dawson County ... Listings 1 - 9 of 9 . LandWatch.com has thousands of rural properties in Dawson County, Nebraska, including hunting & fishing properties, cabins, Land for sale . http://www.landwatch.com/Nebraska_land_for_sale/Dawson_County
Chad Sowald's Request-To-Code
Lancaster, Nebraska land, lots, ranches and farms for sale A search on landandfarm.com for Nebraska and Lancaster that resulted in 102 listings for farms, ranches, lots . Lancaster County Land for Sale - 102 Properties . http://www.landandfarm.com/search/NE/Lancaster-County-land-for-sale/
Eyal's Extensions
- nebraska hunting land for sale has written two extensions:
Thomas Deml's Export WCAT Script extension
Nebraska Land for Sale 6 days ago . Category Archives: Nebraska Land for Sale . in Nebraska | Tagged Brown County, deer hunting, Inc., Land for sale in Nebraska Sandhills, . http://www.lashleyland.com/category/nebraska-land-for-sale/
Per-Response Latency Extension
Nebraska land, lots, ranches and farms for sale A search on landandfarm.com for Nebraska that resulted in 636 listings for farms, . Landandfarm.com is the premier site for finding land all over the world. . Commercial Land for Sale · Hunting Land for Sale · Industrial Land for Sale · Office . http://www.landandfarm.com/search/Nebraska-land-for-sale/
WPAD Server
Knox County, Nebraska Land for sale, Knox County, Nebraska ... Listings 1 - 15 of 17 . These small farms do not last long so call today for your chance to own some Nebraska Hunting Land. Property DetailsLocated SW of. http://www.landwatch.com/Nebraska_land_for_sale/Knox_County
XML Request InspectorMissouri River WRP Hunting Land for Sale in Burt County NE Whitetail Deer Hunting property for sale in Nebraska, Whitetail Deer Hunting Land for Sale in Nebraska, Waterfowl Hunting Property for Sale in Nebraska, . http://www.landpros.com/viewlisting.php?listingid=451 XML DataSet InspectorKansas Land For Sale | Hunting Land Iowa hunting land and recreational buyers can find the most diverse land options . and beyond on Whitetail Properties' current listings of Iowa hunting land for sale. . In the State of Nebraska DBA Whitetail Trophy Properties Real Estate LLC. http://www.whitetailproperties.com/hunting-land/kansas
©2013 Telerik
|


Publicly readable
By making the {{ message }} publicly readable, it would be accessible by
all registered and non-registered users.
Readable by authenticated users
By making the {{ message }} readable by authenticated users, it would be
accessible by all registered users.


CPMjs
This manual is under construction. It currently contains some basic instructions on how to get started, but stay tuned for the most recent version! In the meantime, see the examples (with provided code) and the full method documentation to get an idea of what you can do with CPMjs.
Why CPMjs?
CPMjs implements Cellular Potts Models in JavaScript. Yep, you read it correctly: JavaScript.
This somewhat unorthodox choice allowed us to harness some key strengths of web programming to provide the following features:
- Build models in the form of interactive and explorable web
applications that:
- you can easily share with other users without any fuss: your audience needs no special software except a common web browser;
- are just as fast as simulations in traditional modelling frameworks!
- Unlocking CPM models for new users:
- biologists can access & modify CPMjs models created by others (collaborators, in publications) - without needing to program anything themselves;
- a large existing community of web programmers will be able to contribute to the framework.
Build, share, explore
Simulation models have traditionally been used by a small group of computational biologists with the programming skills required to build them. While the results from such models are shared with other biologists in the scientific literature, the models themselves are typically not accessible for the target audience.
We think this should change.
In the age of open science, let's make computational biology a little more transparent. While sharing scripts and making code "open-source" is nice, it still won't make simulation models accessible for a broad audience of biologists.
We built CPMjs to make simulation models accessible to anyone in three steps:
- You build your model in the form of an explorable web application;
- You share this page online either on a private website (before publication), or as supplementary material to your paper;
- You let users explore your model by allowing them to change parameters with something as simple as a mouse click.
We believe this approach comes with some nice benefits:
- Reviewers can get a feel of how your model behaves. This will help them assess the robustness and validity of results presented in a paper - speeding up the peer review process and improving the quality of the scientific literature.
- Readers can access a simulation as supplementary material to your paper, without needing any special software. This will help them understand your models in more detail, and build on their conclusions with novel ideas.
- Collaborators with experimental expertise can be involved in the modelling process earlier on, which will foster more close collaborations and improve the exchange of ideas.
- Students can be exposed to simulation modelling early on in their program, promoting the use of computational models by a larger audience.
But what about speed?
Because simulation models tend to be computationally expensive, modelling frameworks have traditionally been written in languages with a reputation to be fast - such as C++ and Java. A modelling framework implemented in a scripting language may therefore come as a surprise. But improvements in the JavaScript engines powering common web browsers mean that performance is no longer an issue: CPMjs lets you build simulations as web applications without loss of speed.
Getting started
Set up CPMjs in 3 easy steps
Step 1: download the repository.
Via the Github website
Visit the Github repository and click on the green "clone or download" button, then select "Download ZIP":
Save the zipped folder somewhere on your computer and unzip.
Via the command line
Alternatively, in the console, go to the folder where you want to save CPMjs, and clone the repository:
cd folder/to/save-into/
git clone https://github.com/jtextor/cpmjs.git
Step 2: install node dependencies.
Most users will run CPMjs in browser simulations only and will not need to extend the software with custom modules. If that's you, you can skip this step. But if you plan to use CPMjs from the command line using node, or if you plan to write your own modules (such as hamiltonian terms), you will need to install some node dependencies.
To do this, go to the cpmjs/
folder from the command line and install the
required packages automatically using npm
:
cd folder/containing/cpmjs
npm install
If you do not have nodejs
and its package manager npm
, see
this page to install them first.
Step 3: link the build in your code.
You can now use CPMjs! See this tutorial to build your first
simulation, or start from one of the simulations in the cpmjs/examples/
folder. In these examples, you will see that the package can be loaded as
follows:

for html, and
let CPM = require("path/to/cpmjs/build/cpm-cjs.js")
for node scripts.
When you include these lines in your own scripts, just make sure they contain
the correct path from your simulation file to the cpmjs/build/
folder.
Additional notes
If you wish to build simulations in a different directory than the cpmjs
folder, it may be convenient to create a symbolic link to the build
folder
there:
cd path/to/my/simulations
ln -s path/to/cpmjs/build build
You can then access the code using:

or
let CPM = require("path/to/my/simulations/build/cpm-cjs.js")
Finally, if you want to run CPMjs simulations with nodejs from this folder,
you will need to create a link to the installed node_modules
from step 2:
cd path/to/my/simulations
ln -s path/to/cpmjs/node_modules node_modules
Your First Simulation
This tutorial will show you how to build a simple simulation in the web browser or in a nodejs script. Choose either Set up a simulation in the web browser or Set up a simulation in nodejs to get the required template code, and then see Writing your simulation to start using CPMjs in the environment of your choice.
The simulation we will build is a simple CPM cell:
Set up a simulation in the web browser
One way to use CPMjs is to build a simulation in HTML, to open directly in your favourite web browser (as long as that favourite web browser is not Internet Explorer). The advantage of this method is that it allows you to visualize the simulation immediately, and that you can easily explore the effect of changing parameters in this manner. However, if you wish to run a simulation and store output to your computer, a simulation using nodejs may be more appropriate – see Set up a simulation in nodejs for details.
An HTML template page
Unfortunately, writing an HTML page requires quite some boilerplate code. You can mostly just copy-paste this for every simulation you build, but let's go through it step by step so you know which parts you may have to adapt. If you are familiar with HTML, you may want to just copy the template code and continue building your simulation.

<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>PageTitle</title>

Your Page Title

Description of your page.

We will now go through this step by step.
Step 1 : Create a basic HTML page
A very simple html page looks like this:
<!DOCTYPE html>

The
tag shows where the page starts, and
shows where it ends.
The page consists of a header, which starts at
and ends at
,
and a body, starting at
and ending at
. (In general,
anything you place in your HTML file starts with <something>
and ends with
</something>
).
Copy the above code into a file called MyFirstSimulation.html
, which you can
save in the cpmjs/examples/html/
folder for now. If you wish to save the file
elsewhere, please read these instructions
first.
Step 2 : Configure the header
The header of the HTML page is the place that contains some meta-information about that page, and will also contain the simulation code.
First, we will expand the header code above:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>PageTitle</title>

The additional code in the first line just includes some document settings into the header that you will rarely need to change. The only thing you may want to change is the second line, where you set the title that will be displayed in the open tab in your web browser when you open the page.
Step 3 : Add JavaScript
We will now add some JavaScript code to the header part of the page:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>PageTitle</title>

The first script just loads the CPMjs package for HTML, which is stored in
cpmjs/build/cpm.js
. Please ensure that the path supplied here is the correct
path from the folder where you stored MyFirstSimulation.html
to the file
cpmjs/build/cpm.js
. If you have stored your simulation in cpmjs/examples/html
,
you can use the path ../../build/cpm.js
The second script is where your actual simulation code will go later in Writing your simulation. For now, we'll leave it empty.
Step 4: Write the body
Finally, we make some changes to the body of the page:

Your Page Title

Description of your page.

In the first line, we tell the HTML page to run the JavaScript function
intitialize()
, which we will define later in
Writing your simulation (between the

tags of the page header we just set up).
The rest of the code just adds a title and a description to the web page. The simulation will then be placed below (as in the example shown at the top of this page).
Step 5 (optional): Add CSS
The code we have now added is sufficient to make the page work once we have added a simulation, but to make it look better we may want to add some CSS styling code to the header of the page. The header now becomes:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>PageTitle</title>

To see the final result, have a look again at the complete template. You can now proceed with adding your simulation to this file.
Set up a simulation in nodejs
Another way to use CPMjs – besides using HTML – is to use nodejs from the console. This method of running CPMjs allows you to print statistics to the console and store them in external files, as well as to save images of the simulation to create a movie later. To set up a more interactive version of your simulation with a live animation, an HTML version may be more appropriate – see Set up a simulation in the web browser
In contrast to a browser simulation, a node simulation requires almost no boilerplate code.
To set up your first node simulation, just create a file MyFirstSimulation.js
in the folder cpmjs/examples/node/
(or see these instructions to create it
elsewhere). Then add the following line of code to the (still empty) script to
source the package:
/* Source the CPM module (cpm-cjs version because this is a node script).*/
let CPM = require("../../build/cpm-cjs.js")
Make sure that the path supplied to require()
is the correct path from the
location of MyFirstSimulation.js
to cpmjs/build/cpm-cjs.js
.
You can now proceed with adding your simulation.
Writing your simulation
We are now ready to add some simulation code. The following code goes either
in between the
tags of your HTML page, or at the bottom of
your node script.
Step 1: Create a simulation object
The easiest way to build a simulation in CPMjs is to use the Simulation class. This class provides some default methods for running the simulation and producing outputs, so we won't have to worry about this yet.
To construct an object of class simulation, type:
let sim = new CPM.Simulation( config )
The config
contains configuration options; we will take care of this in the
next step.
If you are writing an HTML page, you have to define an initialize()
function -
as this is the function that will be run when the page is loaded (see
this section):
let sim
function initialize(){
sim = new CPM.Simulation( config )
}
Step 2 : Configure the CPM & Simulation
The code above will not work yet because we still need to supply the config
object. A configuration object for a simulation should look like this:
let config = {
ndim : 2,
field_size : [50,50],
conf : {
},
simsettings : {
}
}
(Note: this piece of code should go above the code from the previous step,
as the config
object is needed to construct the simulation object.)
Here, ndim
is the number of dimensions of the grid, field_size
is the
number of pixels in each dimension (in this case: 50 x 50 pixels), conf
is
the configuration object parsed to the
CPM class, and simsettings
contains configuration options used directly by the simulation class.
First, we configure the CPM by setting values in the conf
object:
conf : {
T : 20, // CPM temperature
// Adhesion parameters:
J: [[0,20], [20,100]] ,
// VolumeConstraint parameters
LAMBDA_V : [0,50], // VolumeConstraint importance per cellkind
V : [0,500] // Target volume of each cellkind
}
The T
parameter is the CPM temperature, which determines how strongly the
model "listens" to the energy constraints given in the CPM. We then add
an adhesion and
volume constraint
by supplying their parameters. In this case, we will have only one type of cell
and the background, so parameters are arrays of length 2 (or a 2 by 2 matrix
for the adhesion parameters).
Finally, we need to supply some settings for the simulation class itself in
simsettings
:
simsettings : {
NRCELLS : [1],
RUNTIME : 500,
CANVASCOLOR : "eaecef",
zoom : 4
}
This ensures that one cell is seeded on the grid before the simulation, the simulation runs for 500 MCS (in node; in the browser it will just keep running), the background of the grid is colored gray, and the grid is drawn at 4x zoom.
The full config
object becomes:
let config = {
// Grid settings
ndim : 2,
field_size : [100,100],
// CPM parameters and configuration
conf : {
T : 20, // CPM temperature
// Adhesion parameters:
J: [[0,20], [20,100]] ,
// VolumeConstraint parameters
LAMBDA_V : [0,50], // VolumeConstraint importance per cellkind
V : [0,500] // Target volume of each cellkind
},
// Simulation setup and configuration
simsettings : {
// Cells on the grid
NRCELLS : [1], // Number of cells to seed for all
// non-background cellkinds.
RUNTIME : 500, // Only used in node
CANVASCOLOR : "eaecef",
zoom : 4 // zoom in on canvas with this factor.
}
}
Step 3 : Tell the simulation to run
We are now almost ready; the only thing still missing is a command in the script that tells the simulation to start running. This works slightly differently in the browser- and nodejs versions.
In nodejs
In nodejs, getting the simulation to run is easy: just call the run()
method
of the simulation class after creating the simulation object. We get:
let config = {
...
}
let sim = new CPM.Simulation( config )
sim.run()
You are now ready to run your simulation. From your console, run the script with node:
node path/to/MyFirstSimulation.js
In HTML
In HTML, we create a function that runs a single step, and then make sure that
this function is called from the initialize()
function:
let config = {
...
}
let sim
function initialize(){
sim = new CPM.Simulation( config )
}
function step(){
sim.step()
requestAnimationFrame( step )
}
To see your simulation, open your file MyFirstSimulation.html in the web browser (any except Internet Explorer; but we recommend Chrome because it is fast).


This Privacy Policy details how your private information is used by the following Google Chrome Browser extensions
When you authorise the extension for use with Trello, I collect your email address and register it at http://paulferrett.com for one or more of the following reasons:
I will never send spam, junk, or irrelevant email to you, and I will never give your email out to anyone else, unless required by law -- which I very much doubt will ever happen.
Third party services used by the extension:
This privacy policy is subject to change without notice and was last updated on 15 April 2015. If you have any questions feel free to contact me directly at<EMAIL_ADDRESS>This was not written by a lawyer, and is intended to honestly outline what I do with your data. I promise I will never intentionally do bad things with your data. Please don't sue me.


tbl_uvregression.Rd
The tbl_uvregression
function arguments are similar to the tbl_regression
arguments. Review the
tbl_uvregression vignette
for detailed examples.
tbl_uvregression(data, method, y, method.args = NULL, formula = "{y} ~ {x}", exponentiate = FALSE, label = NULL, hide_n = FALSE, show_yesno = NULL, conf.level = NULL, estimate_fun = NULL, pvalue_fun = NULL)
| data | Data frame to be used in univariate regression modeling. Data frame includes the outcome variable(s) and the independent variables. |
|---|---|
| method | Regression method (e.g. lm, glm, survival::coxph, and more). |
| y | Model outcome (e.g. |
| method.args | List of additional arguments passed on to the regression
function defined by |
| formula | String of the model formula.
Uses glue::glue syntax. Default is |
| exponentiate | Logical indicating whether to exponentiate the
coefficient estimates. Default is |
| label | List of formulas specifying variables labels,
e.g. |
| hide_n | Hide N column. Default is |
| show_yesno | By default yes/no categorical variables are printed on a single row, when the 'No' category is the reference group. To print both levels in the output table, include the variable name in the show_yesno vector, e.g. `show_yesno = c("var1", "var2")`` |
| conf.level | Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval. |
| estimate_fun | Function to round and format coefficient estimates. Default is style_sigfig when the coefficients are not transformed, and style_ratio when the coefficients have been exponentiated. |
| pvalue_fun | Function to round and format p-values.
Default is style_pvalue.
The function must have a numeric vector input (the numeric, exact p-value),
and return a string that is the rounded/formatted p-value (e.g.
|
A tbl_uvregression
object
If you like to consistently use a different function to format p-values or
estimates, you can set options in the script or in the user- or
project-level startup file, '.Rprofile'. The default confidence level can
also be set. Please note the default option for the estimate is the same
as it is for tbl_regression()
.
The N reported in the tbl_uvregression()
output is the number of observations
in the data frame model.frame(x)
. Depending on the model input, this N
may represent different quantities. In most cases, it is the number of people or
units in your model. Here are some common exceptions.
Survival regression models including time dependent covariates.
Random- or mixed-effects regression models with clustered data.
GEE regression models with clustered data.
This list is not exhaustive, and care should be taken for each number reported.
Example 1
Example 2
See tbl_regression vignette for detailed examples
Other tbl_uvregression tools: add_global_p.tbl_uvregression
,
add_nevent.tbl_uvregression
,
add_q.tbl_uvregression
,
bold_italicize_labels_levels
,
bold_p.tbl_stack
,
bold_p.tbl_uvregression
,
inline_text.tbl_uvregression
,
modify_header
,
sort_p.tbl_uvregression
,
tbl_merge
, tbl_stack
tbl_uv_ex1 <- tbl_uvregression( trial %>% dplyr::select(response, age, grade), method = glm, y = response, method.args = list(family = binomial), exponentiate = TRUE ) # rounding pvalues to 2 decimal places library(survival) tbl_uv_ex2 <- tbl_uvregression( trial %>% dplyr::select(ttdeath, death, age, grade, response), method = coxph, y = Surv(ttdeath, death), label = list("grade" ~ "Grade"), exponentiate = TRUE, pvalue_fun = function(x) style_pvalue(x, digits = 2) )


SVG plots stays smooth when you zoom
To inspect Python code using sourcemaps:
Click F12, then look under 'content'


Time/space. What is an (artist-run) space.
Killu Sukmit: One day all factories will become art galleries and then creative cities. There are artists who want to create new spaces, be curators, activists, musicians, writers, workers, drivers, technicians, translators, editors, documentaries, cleaners, parents – consequently, art has hope. When another creative city building is rising, you will think - was once there a factory where the gallery then acted, but now there is a creative city and real estate development. And also beautiful financial support.
There are very few Renaissance activists in Estonia. After a while, people burn out. We've been looking for people with whom we could work more collectively but in Estonia we didn’t find these people.
Killu Sukmit: I think we didn’t look for them enough. In the beginning we had more volunteers to help sort out the stuff. But i guess we didn’t know how to really collaborate with them. Is it at all possible in a non commercial platform to establish equal partnership, I wonder...
Who gets to access and use the space?
KS: Instead of a classical art gallery, we wanted to make space that uses the form of political-social creative activism. This space, in turn, could be divided into two: an art space and a free shop. Ironically, holding one room made it possible to hold another. Thus, the concept of the free shop allowed us to get a bearable lease with the tenant and therefore carry out an art program. And the support from Cultural Endowment of Estonia for the arts program in turn made it possible to create social space. The audience for our space was both a millionaire and a homeless person.
MH: And those in between. Initially we were hoping to get new / different audiences to the exhibitions and events we organized thanks to the free shop. This turned out more difficult.
Community
KS: We both live in a Flower Village district, near to Kraam. But we didn’t know that before we started to work together in the autumn of 2015, when the refugee crisis brought us together. We got to know each other at work. Later we became friends.
We started to provide warm clothes for the refugees and left the bags at the Art Museum's security desk, where the contact person collected them. At that time, I was still working in the editorial office of Estonian daily newspaper Eesti Päevaleht. It often happened that after working full time at a newspaper factory, I then went on to work at the Polymer cultural factory, where there was a room full of clothes. The magic of chaos. Few months later, this room became the Kraam artist-run space. From 2008 to 2014, Polymer Art Container Gallery was operating in this room. In the 1970s, this room housed a work canteen for Polymer toy-factory workers.
With the founding of Kraam in 2015, we also started to organize a feminist cultural festival Ladyfest 2016. For that we started to visit Vao Refugee Center every week to do art workshops. We went there for 6 months. Later we wanted to integrate these people to participate in Kraam’s event, for example “Coffee without Borders” event or “Political dress” group-exhibition. Our initial idea to create a community space for refugees worked only partially.
MH: It turned out more difficult to invite refugees to our space, than to organize workshops in the remote refugee center. One reason was the fact that as soon as they started living in the capital, their free time diminished, most of them started working full time or even more. The other reason, I guess, was cultural and religious differences. I guess some of our potential audience felt uncomfortable, since we often failed to establish comfortable room temperature and the old factory passageways were not very clean and sometimes smelled of cannabis...
Failure
KS: Kraam has always received an operating grant from the Cultural Endowment of Estonia (Cultural Endowment of Estonia is being one of the main, if not the only source of art funding in Estonia): Initially € 5,000 and then € 8,000 per year. So, we have been privileged. But how to cover this amount of rent, utilities, our salaries, how to pay artists? At the last group exhibition in December 2019 - "Soft Narratives", we could pay the artists and the curator a €30 fee. For such amounts it feels embarrassing. Is this the artist-run space we wanted? Or is there a difference if I participate at the Art Museum of Estonia (KUMU) in a big group exhibition, where the exhibition would open for half a year and my fee divided by one day would be 0.3 cents.
MH: Such initiatives usually can’t function for long. We lasted quite long indeed. Sooner or later capitalism swallows you, unless you win a lottery or inheritance. I also felt that running an art space shifts you more into the curator/organizer role and less into the role of an artist.  We failed in so many things, but all in all we won, we did it. And who knows, maybe we will do it again one day.
How can we invent new, better ways of collaborating, curating, thinking and doing?
KS: To bring together different people, to see the difference
of ways of thinking.
MH: More compromises and division of tasks, up to a certain
limit of course.
Lines / borders
KS: Before one of the “Coffee without Borders'' events, an Estonian art critic wrote to us to pick up all the fraudsters from the city and make them victims and give them coffee! I considered these kinds of reactions part of Kraam's educational program, and I also learned with it. We later added to the events that racist, sexist, homophobic or other shameful behavior is not welcome.
Lines / borders
KS: Sorting clothes, footwear for several hours in a row in the free shop, in an ice cold factory was a political act. Sometimes we had volunteers. But there wasn’t much room for the theory. I read books less and less. And I missed the work with content or (I dare to say) weirdness. Somehow it reminded me of the work of a coal miner.
MH: And still we were so privileged to be able to run a non-profit art space / free shop. Art is still a privilege that in a world context few can afford. I recently re-read Irving Stone's “Lust for life”, where he wrote how Van Gogh tried to help coal miners in Borinage and almost died doing it, since he wasn't able to endure such conditions.
Encounter / dis-encounter
KS: The most surprising encounter was that the free shop in
Kraam was broken into three times. Which is a kind of paranoia in
society. A hope that poverty can enrich.
MH: During the two free shop tours around Estonian small villages, we encountered several active free shops, which was a positive surprise. Yet we also saw that the real need was outside the capital.
The past, the present and the future
KS:
At this very moment, I write this text during my 13th day of quarantine.
I'm working on my “Queen Lear” embroidery creation. As one of my friends
said - for most of the people this is a crisis, but for most of the
artists this is everyday practice. If you think that artists do not have
a pay day or a health insurance fund. All they ever had was an
indefinite crisis. We ain't got no money, honey, but we got crisis.
MH: During the last three years, besides co-running Kraam and doing some documentary films I gave birth to two sons, who need more and more of my attention. One just started crying…
* Kraam in Estonian language means stuff
** This text has been written partly using speech given by Killu Sukmit and Minna Hint at the award ceremony of the Cultural Endowment of the Estonian (31th of January, 2020); and also, a not published interview made by film director and artist Sandra Jõgeva in January, 2020.


Search Terms
Login/Logout
Test
Welcome To The Library!
email error
email error
Submit
Books
Movies
Music


{% extends "base.html" %}
{% load md %}
{% block content %}
{% markdown %}
Here are some of my favorite things I've written:
- [Autocomplete as an interface](http://www.benkuhn.net/autocomplete) argues that autocompletion (in the style of e.g. Google search suggestions) is my favorite user interface tool for.
- [Readability, hackability, and abstraction](http://www.benkuhn.net/rha) describes a particularly annoying circle that I often go in while programming.
- [Probability, uncertainty, and markets](http://www.benkuhn.net/prob) discusses a common failure mode of people trying to reason probabilistically, and why the concept of Knightian uncertainty might be more reasonable for a good Bayesian than it sounds.
- [The St. Petersburg "paradox"](http://www.benkuhn.net/petersburg)--if I offer to flip a coin until it comes up heads, doubling the amount that I pay you each time, should you be willing to pay me infinity dollars to play?
- [Why squared error?](http://www.benkuhn.net/squared) explains why the squared error is so ubiquitous in statistics, and why we might or might not expect it to stay that way.
If you like these and want more, you should [follow updates](/follow/) via email or RSS. In the mean time, there's the [archive](/blog/1/) (and category-specific archives for [tech](/tag/tech/1/), [altruism](/tag/effective-altruism/1/), and [misc](/tag/misc/1/)). I also put some less polished writing on [another site](http://scraps.benkuhn.net/).
{% endmarkdown %}
{% endblock %}


Test text 1
This site uses cookies to enhance your user experience.
back
Moon Bitcoin
Moon Dogecoin
Moon Litecoin
Bonus Bitcoin
Bit Fun
Moon Dash
Moon Cash


pcf.particle.gcp.compute_engine package¶
Submodules¶
pcf.particle.gcp.compute_engine.vm_instance module¶
-
class
pcf.particle.gcp.compute_engine.vm_instance.
VMInstance
(particle_definition)¶ Bases:
pcf.core.gcp_resource.GCPResource
This is the implementation of Google’s compute service.
-
UNIQUE_KEYS
= ['gcp_resource.name']¶
-
_set_unique_keys
()¶ Logic that sets keys from state definition that are used to uniquely identify the storage bucket
-
_start
()¶ Creates the instance
Returns: response of gcp instances().insert()
-
_stop
()¶ Stops the instance
-
_terminate
()¶ Deletes the instance
Returns: response of gcp instances().delete()
-
_update
()¶ Not Implemented
-
equivalent_states
= {}¶
-
flavor
= 'compute'¶
-
get_status
()¶ Determines if the instance exists
Returns: status (dict)
-
is_state_definition_equivalent
()¶ Determines if desired_state_definition and current_state_definition are equivalent
Returns: bool
-
state_lookup
= {'PROVISIONING': <State.pending: 4>, 'RUNNING': <State.running: 1>, 'STAGING': <State.pending: 4>, 'STOPPED': <State.stopped: 2>, 'STOPPING': <State.pending: 4>, 'SUSPENDED': <State.terminated: 3>, 'SUSPENDING': <State.pending: 4>, 'TERMINATED': <State.terminated: 3>}¶
-
sync_state
()¶ Calls get status and then sets the current state.
-


#include <db_cxx.h>
This manual page describes the specific details of the DbMpool class.
The DbMpool and DbMpoolFile classes are the library interface intended to provide general-purpose, page-oriented, shared memory buffer management of underlying files. While designed to work with the other Db classes, this class is also useful for more general purposes. The shared memory buffer pools (DbMpool's) are referred to in this document as simply pools.
Pools may be shared between processes. Pools are usually filled by pages from one or more files (DbMpoolFile's). Pages in the pool are replaced in LRU (least-recently-used) order, with each new page replacing the page that has been unused the longest. Pages retrieved from the pool using DbMpoolFile::get are pinned in the pool, by default, until they are returned to the pool's control using the DbMpoolFile::put method.