working with scala examples 1

commandline session

$ 4.2.29 15 515---> scala
Welcome to Scala version 2.9.2 (OpenJDK 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.

scala> 4*2-7
res0: Int = 1

scala> res0+1
res1: Int = 2

scala> 2*0.4
res2: Double = 0.8

scala> "hello"
res3: java.lang.String = hello

scala> "hello"+res3
res4: java.lang.String = hellohello

scala> "hello"+res2
res5: java.lang.String = hello0.8

scala> "hello res2"
res6: java.lang.String = hello res2

scala>

GNU readline + bind + functions + keybinding

commandline session

$ 4.2.29 57 557---> bind -P

abort can be found on "C-g", "C-xC-g", "eC-g".
accept-line can be found on "C-j", "C-m".
alias-expand-line is not bound to any keys
arrow-key-prefix is not bound to any keys
backward-byte is not bound to any keys
backward-char can be found on "C-b", "eOD", "e[D".
backward-delete-char can be found on "C-h", "C-?".
backward-kill-line can be found on "C-xC-?".
backward-kill-word can be found on "eC-h", "eC-?".
backward-word can be found on "ee[D", "e[1;5D", "e[5D", "eb".
beginning-of-history can be found on "e<".
beginning-of-line can be found on "C-a", "eOH", "e[1~", "e[H".
call-last-kbd-macro can be found on "C-xe".
capitalize-word can be found on "ec".
.
.
.
.
.
.
.
.
.
yank-last-arg can be found on "e.", "e_".
yank-nth-arg can be found on "eC-y".
yank-pop can be found on "ey".

apache2 commandline 1

commandline session

$ 4.2.29 34 534---> sudo /usr/sbin/apache2 -D module
[sudo] password for jeffrin:
apache2: bad user name ${APACHE_RUN_USER}
$ 4.2.29 35 535---> sudo /usr/sbin/apache2 -D loadmodule
apache2: bad user name ${APACHE_RUN_USER}
$ 4.2.29 36 536---> sudo /usr/sbin/apache2 -l
Compiled in modules:
  core.c
  mod_log_config.c
  mod_logio.c
  mod_version.c
  prefork.c
  http_core.c
  mod_so.c
$ 4.2.29 37 537--->

xargs and find to selected copy

commandline session

$ 4.2.29 8 508---> find  . -name "*gimp*"  -print0   | xargs -0 -I {}  cp  {} ../6raphics/
$ 4.2.29 9 509---> find  . -name "*gimp*"  -print0   | xargs -0 -I {}  cp  {} ../6raphics/
$ 4.2.29 10 510---> find  . -name "*blender*"  -print0   | xargs -0 -I {}  cp  {} ../6raphics/
$ 4.2.29 11 511---> find  . -name "*inkscape*"  -print0   | xargs -0 -I {}  cp  {} ../6raphics/
$ 4.2.29 12 512---> find  . -name "*Grap*"  -print0   | xargs -0 -I {}  cp  {} ../6raphics/
$ 4.2.29 13 513---> find  . -name "*grap*"  -print0   | xargs -0 -I {}  cp  {} ../6raphics/
$ 4.2.29 14 514--->

R – reading tabular data files

commandline session

> dfrm  print(dfrm
dfrm
> print(dfrm)
    V1      V2
1 Name Jeffrin
2  Age      35
3  Sex    Male
> dfrm  print(dfrm)
            V1
1 Name-Jeffrin
2       Age-35
3     Sex-Male
> dfrm  print(dfrm)
            V1
1 Name-Jeffrin
2       Age-35
3     Sex-Male
> class(dfrm$V1)
[1] "factor"
> class(dfrm$V1)
[1] "factor"
> class(dfrm$V2)
[1] "NULL"
> class(dfrm$V3)
[1] "NULL"
>

$ 4.2.20 6 506---> cat first.txt
Name-Jeffrin
Age-35
Sex-Male
$ 4.2.20 7 507--->

R – package installation

Get The Hang

> install.packages(c("Rpad"))
Installing package(s) into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL 'http://ftp.iitm.ac.in/cran/src/contrib/Rpad_1.3.0.tar.gz'
Content type 'application/x-gzip' length 1745840 bytes (1.7 Mb)
opened URL
==================================================
downloaded 1.7 Mb

* installing *source* package ‘Rpad’ ...
** package ‘Rpad’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded

* DONE (Rpad)

The downloaded source packages are in
	‘/tmp/Rtmp75RiAi/downloaded_packages’
>

R – reading tabular files

commandline session

> test  print(test)
    V1      V2
1 Name Jeffrin
2  Age      35
3  Sex    Male
> version
               _
platform       x86_64-pc-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          2
minor          15.1
year           2012
month          06
day            22
svn rev        59600
language       R
version.string R version 2.15.1 (2012-06-22)
nickname       Roasted Marshmallows
>
Save workspace image? [y/n/c]: y
$ 4.2.20 2 502---> cat first.txt
Name Jeffrin
Age  35
Sex  Male
$ 4.2.20 3 503--->

R – loading libraries and data related

Get The Hang

> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’
> library(ggplot2)
Loading required package: reshape
Loading required package: plyr

Attaching package: ‘reshape’

The following object(s) are masked from ‘package:plyr’:

    rename, round_any

Loading required package: grid
Loading required package: proto
>