Installing the Oracle JDK ========================= 1. sudo add-apt-repository ppa:webupd8team/java 2. sudo apt-get update 3. sudo apt-get install oracle-java8-installer 4. sudo update-alternatives --config java 5. sudo vi /etc/environment JAVA_HOME="/usr/lib/jvm/java-8-oracle" 6. source /etc/environment Installing Apache Tomcat 8 ========================== 1. sudo apt-get install tomcat8 tomcat8-docs tomcat8-admin tomcat8-examples 2. dpkg -L tomcat8 3. sudo vi /etc/tomcat8/server.xml change port 8080 to 8081 since jenkins is using 8080 4. sudo /etc/init.d/tomcat8 restart 5. Check: http://localhost:8081 6. sudo vi /opt/tomcat/conf/tomcat-users.xml 7. sudo /etc/init.d/tomcat8 restart Re-installing Tomcat 8 ====================== 1. Getting errors Errors were encountered while processing: tomcat8 E: Sub-process /usr/bin/dpkg returned an error code (1) 2. sudo dpkg -P libtomcat8-java tomcat8-common tomcat8-docs tomcat8 tomcat8-examples tomcat8-admin 3. sudo apt-get purge libtomcat8-java tomcat8 tomcat8-admin tomcat8-common tomcat8-docs tomcat8-examples tomcat8-user 4. sudo reboot
Thursday, October 20, 2016
Install Oracle JDK 8 and Apache Tomcat 8
Install Oracle JDK 8 and Apache Tomcat 8
Installing the Oracle JDK
=========================
1. sudo add-apt-repository ppa:webupd8team/java
2. sudo apt-get update
3. sudo apt-get install oracle-java8-installer
4. sudo update-alternatives --config java
5. sudo vi /etc/environment
JAVA_HOME="/usr/lib/jvm/java-8-oracle"
6. source /etc/environment
Installing Apache Tomcat 8
==========================
1. sudo apt-get install tomcat8 tomcat8-docs tomcat8-admin tomcat8-examples
2. dpkg -L tomcat8
3. sudo vi /etc/tomcat8/server.xml
change port 8080 to 8081 since jenkins is using 8080
4. sudo /etc/init.d/tomcat8 restart
5. Check: http://localhost:8081
6. sudo vi /opt/tomcat/conf/tomcat-users.xml
7. sudo /etc/init.d/tomcat8 restart
Re-installing Tomcat 8
======================
1. Getting errors
Errors were encountered while processing:
tomcat8
E: Sub-process /usr/bin/dpkg returned an error code (1)
2. sudo dpkg -P libtomcat8-java tomcat8-common tomcat8-docs tomcat8 tomcat8-examples tomcat8-admin
3. sudo apt-get purge libtomcat8-java tomcat8 tomcat8-admin tomcat8-common tomcat8-docs tomcat8-examples tomcat8-user
4. sudo reboot
=========================
1. sudo add-apt-repository ppa:webupd8team/java
2. sudo apt-get update
3. sudo apt-get install oracle-java8-installer
4. sudo update-alternatives --config java
5. sudo vi /etc/environment
JAVA_HOME="/usr/lib/jvm/java-8-oracle"
6. source /etc/environment
Installing Apache Tomcat 8
==========================
1. sudo apt-get install tomcat8 tomcat8-docs tomcat8-admin tomcat8-examples
2. dpkg -L tomcat8
3. sudo vi /etc/tomcat8/server.xml
change port 8080 to 8081 since jenkins is using 8080
4. sudo /etc/init.d/tomcat8 restart
5. Check: http://localhost:8081
6. sudo vi /opt/tomcat/conf/tomcat-users.xml
7. sudo /etc/init.d/tomcat8 restart
Re-installing Tomcat 8
======================
1. Getting errors
Errors were encountered while processing:
tomcat8
E: Sub-process /usr/bin/dpkg returned an error code (1)
2. sudo dpkg -P libtomcat8-java tomcat8-common tomcat8-docs tomcat8 tomcat8-examples tomcat8-admin
3. sudo apt-get purge libtomcat8-java tomcat8 tomcat8-admin tomcat8-common tomcat8-docs tomcat8-examples tomcat8-user
4. sudo reboot
Install Oracle JDK 8 and Apache Tomcat 8
Installing the Oracle JDK
=========================
1. sudo add-apt-repository ppa:webupd8team/java
2. sudo apt-get update
3. sudo apt-get install oracle-java8-installer
4. sudo update-alternatives --config java
5. sudo vi /etc/environment
JAVA_HOME="/usr/lib/jvm/java-8-oracle"
6. source /etc/environment
Installing Apache Tomcat 8
==========================
1. sudo apt-get install tomcat8 tomcat8-docs tomcat8-admin tomcat8-examples
2. dpkg -L tomcat8
3. sudo vi /etc/tomcat8/server.xml
change port 8080 to 8081 since jenkins is using 8080
4. sudo /etc/init.d/tomcat8 restart
5. Check: http://localhost:8081
6. sudo vi /opt/tomcat/conf/tomcat-users.xml
7. sudo /etc/init.d/tomcat8 restart
Re-installing Tomcat 8
======================
1. Getting errors
Errors were encountered while processing:
tomcat8
E: Sub-process /usr/bin/dpkg returned an error code (1)
2. sudo dpkg -P libtomcat8-java tomcat8-common tomcat8-docs tomcat8 tomcat8-examples tomcat8-admin
3. sudo apt-get purge libtomcat8-java tomcat8 tomcat8-admin tomcat8-common tomcat8-docs tomcat8-examples tomcat8-user
4. sudo reboot
=========================
1. sudo add-apt-repository ppa:webupd8team/java
2. sudo apt-get update
3. sudo apt-get install oracle-java8-installer
4. sudo update-alternatives --config java
5. sudo vi /etc/environment
JAVA_HOME="/usr/lib/jvm/java-8-oracle"
6. source /etc/environment
Installing Apache Tomcat 8
==========================
1. sudo apt-get install tomcat8 tomcat8-docs tomcat8-admin tomcat8-examples
2. dpkg -L tomcat8
3. sudo vi /etc/tomcat8/server.xml
change port 8080 to 8081 since jenkins is using 8080
4. sudo /etc/init.d/tomcat8 restart
5. Check: http://localhost:8081
6. sudo vi /opt/tomcat/conf/tomcat-users.xml
7. sudo /etc/init.d/tomcat8 restart
Re-installing Tomcat 8
======================
1. Getting errors
Errors were encountered while processing:
tomcat8
E: Sub-process /usr/bin/dpkg returned an error code (1)
2. sudo dpkg -P libtomcat8-java tomcat8-common tomcat8-docs tomcat8 tomcat8-examples tomcat8-admin
3. sudo apt-get purge libtomcat8-java tomcat8 tomcat8-admin tomcat8-common tomcat8-docs tomcat8-examples tomcat8-user
4. sudo reboot
Installing monit in Ubuntu (IP: 10.20.30.40)
1. Repair missing LSB tags on tomcat and vncserver and other daemon as well
$ sudo vi tomcat
$ sudo vi vncserver
add this after shebang
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct script
# placed in /etc/init.d.
### END INIT INFO
2. Install monit
$ sudo apt-get install monit
3. Edit /etc/monit/monitrc
$ sudo vi /etc/monit/monitrc
3.1. Uncomment this section:
set httpd port 2812 and
use address 10.20.30.40 # only accept connection from localhost
allow 0.0.0.0/0.0.0.0 # allow localhost to connect to the server and
allow admin:monit # require user 'admin' with password 'monit'
allow @users readonly # allow users of group 'users' to connect readonly
3.2. Append at the end of the config
# monitor sshd
check process sshd with pidfile /var/run/sshd.pid
#
# monitor jenkins
check process jenkins with pidfile /var/run/jenkins/jenkins.pid
#
# monitor apache2
check process apache2 with pidfile /var/run/apache2/apache2.pid
4. Install upstart
$ sudo apt-get install upstart-sysv
5. Reload monit
$ sudo reload monit
OR
$ sudo service monit restart
6. Open browser and check
http://10.20.30.40:2812/
Thursday, January 29, 2015
Adding a non-root users to access SSH in WD My Book Live
Regular (non-root) user's SSH password
URL: http://community.wd.com/t5/My-Book-Live/what-s-my-normal-non-root-user-s-SSH-password/td-p/566360
Not Not simple, but not too complicated as well. Be careful. Something wrong and you might get locked out.
If I remember all my steps, this is what I did. Make sure you save backups copies for the files before you edit them.
- Enable ssh:
http:///UI/ssh
- Create shares, users, set passwords and permissions via dashboard
- Allow Users to SSH:
edit file /etc/ssh/sshd_config
Change "AllowUsers" line by adding user names such as:
AllowUsers root user1 user2
- Optional: Set users home dir: edit file /etc/passwd
The following will set home dir to "Public"
Change from "/shares:/bin/sh" to "/shares/Public:/bin/sh"
- Restart ssh deamon or reboot:
/etc/init.d/ssh restart
Test ssh for your users within the home network. If all works, then proceed to:
- Set your router to forward port TCP 22
- Set DDNS on your router
===========
Using Cygwin
malex@laptop /home/malex/manuals
$ pwd
/home/malex/manuals
malex@laptop /home/malex/manuals
$ ./rsyncEbookPush.sh
===========
Using Cygwin
malex@laptop /home/malex/manuals
$ pwd
/home/malex/manuals
malex@laptop /home/malex/manuals
$ ./rsyncEbookPush.sh
#!/bin/bash
rUser="malex@192.168.10.250"
rsync --remove-source-files -avzhe "ssh -q" --exclude "rsyncEbook*.sh" --progress /home/malex/manuals/ "$rUser":/shares/Public/Manuals
rUser="malex@192.168.10.250"
rsync --remove-source-files -avzhe "ssh -q" --exclude "rsyncEbook*.sh" --progress /home/malex/manuals/ "$rUser":/shares/Public/Manuals
$ ./rsyncEbookPull.sh
#!/bin/bash
rUser="malex@192.168.10.250"
rsync -avzhe "ssh -q" --exclude "rsyncEbook*.sh" --progress "$rUser":/shares/Public/Manuals/ /home/malex/manuals
Saturday, January 11, 2014
How to calculate 95th percentile of values with grouping variable in Excel
Sample data:
A B C D
1 Watershed WQ 2 50500101 62.37066150500101 {formula here}3 50500101 65.505046 4 50500101 58.741477 5 50500105 71.220034 6 50500105 57.917249
Excel formula in D2 :
{=PERCENTILE(IF($A2:$A6=C2, $B$2:$B$6), 0.95)}
Also, be sure to enter the formula as an array formula.
Do so by pressing Ctrl+Shift+Enter when entering the formula.
http://stackoverflow.com/questions/5473537/how-to-calculate-95th-percentile-of-values-with-grouping-variable-in-r-or-excel
Wednesday, October 2, 2013
Reshape data in R
hsb2 <- br="" faq="" header="T," hsb2.csv="" http:="" r="" read.table="" sep="," stat="" www.ats.ucla.edu="">hsb2[1:10,]
l <- br="" hsb2="" reshape=""> varying = c("read", "write", "math", "science", "socst"),
v.names = "score",
timevar = "subj",
times = c("read", "write", "math", "science", "socst"),
new.row.names = 1:1000,
direction = "long")
l[1:10,]
->->
l.sort <- br="" id="" l="" order=""> ->
l.sort[1:10,]
l.sort
w <- br="" l.sort="" reshape=""> timevar = "subj",
idvar = c("id", "female", "race", "ses", "schtyp", "prog"),
direction = "wide")
->
w
w[1:10,]
Saturday, September 7, 2013
Restoring iPod when you forgot your passcode
1. Connect your iPod to the computer where you normally sync your iPod.
2. Make a backup of the iPod (you will use this later when your restore the contents of the iPod)
3. Restore to factory setting, see: http://support.apple.com/kb/ht1808
2. Make a backup of the iPod (you will use this later when your restore the contents of the iPod)
3. Restore to factory setting, see: http://support.apple.com/kb/ht1808
Friday, June 28, 2013
Calculate Normal Distribution Using R
#:************************************************************************
#: Author: Alex Madriaga
#: Date: 06/06/2013
#: Time: 11:11:11
#: File: dnorm.r
#: Status: Working using the data in C:/workspace/ecdf/d176m.csv
#: Version: 0.98
#: Description: Latest version of the normal distribution for R scripting
#: Revision history:
#:
#:************************************************************************
# load the csv file, ignoring the header
mainDir <- "C:/workspace/ecdf"
setwd(mainDir)
mainDir <- getwd()
rawCSVFile <- "d176m.csv"
rsm <- read.csv(rawCSVFile,header=TRUE)
# check structure and convert vector values to numeric
str(rsm)
rsm$HEAP <- as.numeric(rsm$HEAP)
# calculate the mean and standard deviation
mean <- mean(rsm$HEAP)
sd <- sd(rsm$HEAP)
#plotting the density function of a normal distribution
heap <- rsm$HEAP
# plot the data
plot(heap, dnorm(heap, mean, sd), type="l")
Bash Script using Flags and Options
#!/bin/bash
#:########################################################################
#: The option-string
#:
#: The option-string tells getopts which options to expect and which of them
#: must have an argument. The syntax is very simple . every option character
#: is simply named as is, this example-string would tell getopts to look
#: for -e, -d and -m:
#:
#: getopts fAx VARNAME
#:
#: When you want getopts to expect an argument for an option, just place
#: a : (colon) after the proper option flag. If you want -e to expect an
#: argument (i.e. to become -e ENVIRONMENT ) just do:
#:
#: getopts ed:m VARNAME
#:
#:########################################################################
function checkParam()
{
# if no paramter was supplied, show usage
text="Usage: $0 -e ENVIRONMENT -d DATE_FILENAME.TXT -m METRIC_FILENAME.TXT"
[ $# -eq 0 ] && { echo "$text"; exit 1; }
# parse the flags and options
while getopts "e:d:m:" opt; do
case $opt in
e)
echo "-$opt $OPTARG $OPTIND $OPTERR was triggered!" >&2
env=$OPTARG
;;
d)
echo "-$opt $OPTARG $OPTIND $OPTERR was triggered!" >&2
fdate=$OPTARG
;;
m)
echo "-$opt $OPTARG $OPTIND $OPTERR was triggered!" >&2
fmetric=$OPTARG
;;
*)
echo "Invalid option: -$opt $OPTARG $OPTIND $OPTERR" >&2
;;
esac
done
# show the flags and options that were parsed
echo "Environment: [$env]"
echo "Date filename: [$fdate]"
echo "Metric filename: [$fmetric]"
# Check the given files exist #
[ ! -f "$fdate" ] && { echo "Error: $fdate file not found."; exit 2; }
[ ! -f "$fmetric" ] && { echo "Error: $fmetric file not found."; exit 2; }
# Check the given files are not empty #
[ ! -s "$fdate" ] && { echo "Error: $fdate file is empty."; exit 2; }
[ ! -s "$fmetric" ] && { echo "Error: $fmetric file is empty."; exit 2; }
}
#: ## [ MAIN ] ###
checkParam $@
Sunday, June 23, 2013
Enable SSH on WD MyBook
Link
To login use /UI/login, example: http://192.168.1.150/UI/login Open Mybook UI go to Import / Export Current Configuration (under Utilities) Export the current configuration, open the file, update: ssh_enable="disabled", to ssh_enable="enabled", import the configuration file After reboot SSH is enabled. Default is root / welc0me as per other WD devices. Change root password right away. If you want to enable SFTP, modify /etc/ssh/sshd_config and add the user who needs to access through SFTP. For example: “AllowUsers root malex” enables the user “malex” to connect to the device by both ssh and sftp. Twonky is available at port 9000, example: http://192.168.1.150:9000 FTP when enabled is available using the user you created.
Subscribe to:
Posts (Atom)
