Adding text to html element using JavaScript


<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="utf-8" />
<title>Chapter 1, Example 3</title>
</head>
<body>
<code id="results"></code>
<script>
document.getElementById("results").innerHTML = "Hello World!";
</script>
</body>
</html>

Key source : Beginning JavaScript, 5th Edition (wrox)

settings with color and alert messages using Javascript


<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="utf-8" />
<title>Chapter 1, Example 2</title>
</head>
<body bgcolor="white">
<p>Paragraph 1</p>
<script>
// script block 1
alert("First Script Block");
</script>
<p>Paragraph 2</p>
<script>
// script block 2
document.bgColor = "red";
alert("Second Script Block");
</script>
<p>Paragraph 3</p>
</body>
</html>

 

Key source : Beginning JavaScript, 5th Edition (wrox)

setting up background color using JavaScript


<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="utf-8" />
<title>Chapter 1, Example 1</title>
</head>
<body bgcolor="white">
<p>Paragraph 1</p>
<script>
document.bgColor = "blue";
</script>
</body>
</html>

Key source : Beginning JavaScript, 5th Edition (wrox)

setting up background color for a page using css











background-color:#c00

hostid – print the numeric identifier for the current host

$hostid 
007f0101
$

 
https://en.wikipedia.org/wiki/Namespace
http://www.computerhope.com/unix/hostid.htm

May be some programs need a numeric value to identify
the host and that may be the cause of having numeric
identifier apart from the name given in the hostname.

debug method development with “ls” command

$gdb /bin/ls
GNU gdb (Debian 7.11.1-2) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /bin/ls...Reading symbols from /usr/lib/debug/.build-id/d8/8582ece1631fd6d00210f2b98e1675dff8a222.debug...done.
done.
(gdb) break 1250
Breakpoint 1 at 0x39e7: file src/ls.c, line 1250.
(gdb) source src/ls.c
src/ls.c: No such file or directory.
(gdb) source ls.c
ls.c:1: Error in sourced command file:
Undefined command: "".  Try "help".
(gdb) r
Starting program: /bin/ls 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main (argc=1, argv=0x7fffffffe228) at src/ls.c:1285
warning: Source file is more recent than executable.
1285	  set_program_name (argv[0]);
(gdb) next
1249	{
(gdb) next
1285	  set_program_name (argv[0]);
(gdb) l
1280	#if ! SA_NOCLDSTOP
1281	  bool caught_sig[nsigs];
1282	#endif
1283	
1284	  initialize_main (&argc, &argv);
1285	  set_program_name (argv[0]);
1286	  setlocale (LC_ALL, "");
1287	  bindtextdomain (PACKAGE, LOCALEDIR);
1288	  textdomain (PACKAGE);
1289	
(gdb) next
1286	  setlocale (LC_ALL, "");
(gdb) next
1287	  bindtextdomain (PACKAGE, LOCALEDIR);
(gdb) next
1288	  textdomain (PACKAGE);
(gdb) print PACKAGE
No symbol "PACKAGE" in current context.
(gdb) next
1291	  atexit (close_stdout);
(gdb) print PACKAGE
No symbol "PACKAGE" in current context.
(gdb) next
1290	  initialize_exit_failure (LS_FAILURE);
(gdb) next
1291	  atexit (close_stdout);
(gdb) next
1300	  current_time.tv_sec = TYPE_MINIMUM (time_t);
(gdb) c
Continuing.
[		  df.o		      id.c		 nproc		 seq.c			       tee.c
arch		  dir		      id.o		 nproc.c	 seq.o			       tee.o
base32		  dircolors	      install.c		 nproc.o	 set-fields.c		       test
base64		  dircolors.c	      ioblksize.h	 numfmt		 set-fields.h		       test.c
base64.c	  dircolors.h	      join		 numfmt.c	 set-fields.o		       test.o
basename	  dircolors.hin       join.c		 numfmt.o	 sha1sum		       timeout
basename.c	  dircolors.o	      join.o		 od		 sha224sum		       timeout.c
basename.o	  dirname	      kill		 od.c		 sha256sum		       timeout.o
cat		  dirname.c	      kill.c		 od.o		 sha384sum		       touch
cat.c		  dirname.o	      kill.o		 operand2sig.c	 sha512sum		       touch.c
cat.o		  du		      lbracket.c	 operand2sig.h	 shred			       touch.o
chcon		  du.c		      lbracket.o	 operand2sig.o	 shred.c		       tr
chcon.c		  du.o		      libstdbuf.c	 paste		 shred.o		       tr.c
chcon.o		  echo		      libstdbuf.so	 paste.c	 shuf			       tr.o
chgrp		  echo.c	      libver.a		 paste.o	 shuf.c			       true
chgrp.c		  echo.o	      link		 pathchk	 shuf.o			       true.c
chgrp.o		  env		      link.c		 pathchk.c	 single-binary.mk	       true.o
chmod		  env.c		      link.o		 pathchk.o	 sleep			       truncate
chmod.c		  env.o		      ln		 pinky		 sleep.c		       truncate.c
chmod.o		  expand	      ln.c		 pinky.c	 sleep.o		       truncate.o
chown		  expand.c	      ln.o		 pinky.o	 sort			       tsort
chown.c		  expand.o	      local.mk		 pr		 sort.c			       tsort.c
chown-core.c	  expr		      logname		 pr.c		 sort.o			       tsort.o
chown-core.h	  expr.c	      logname.c		 primes.h	 split			       tty
chown-core.o	  expr.o	      logname.o		 printenv	 split.c		       tty.c
chown.o		  extent-scan.c       longlong.h	 printenv.c	 split.o		       tty.o
chroot		  extent-scan.h       ls		 printenv.o	 src_base32-base64.o	       uname
chroot.c	  extent-scan.o       ls.c		 printf		 src_base64-base64.o	       uname-arch.c
chroot.o	  extract-magic       ls-dir.c		 printf.c	 src_ginstall-copy.o	       uname-arch.o
cksum		  factor	      ls-dir.o		 printf.o	 src_ginstall-cp-hash.o        uname.c
cksum.c		  factor.c	      ls.h		 pr.o		 src_ginstall-extent-scan.o    uname.h
cksum.o		  factor.o	      ls-ls.c		 prog-fprintf.c  src_ginstall-install.o        uname.o
comm		  false		      ls-ls.o		 prog-fprintf.h  src_ginstall-prog-fprintf.o   uname-uname.c
comm.c		  false.c	      ls.o		 prog-fprintf.o  src_ginstall-selinux.o        uname-uname.o
comm.o		  false.o	      ls-vdir.c		 ptx		 src_libstdbuf_so-libstdbuf.o  unexpand
copy.c		  fiemap.h	      ls-vdir.o		 ptx.c		 src_md5sum-md5sum.o	       unexpand.c
copy.h		  find-mount-point.c  make-prime-list	 ptx.o		 src_sha1sum-md5sum.o	       unexpand.o
copy.o		  find-mount-point.h  make-prime-list.c  pwd		 src_sha224sum-md5sum.o        uniq
coreutils-arch.c  find-mount-point.o  make-prime-list.o  pwd.c		 src_sha256sum-md5sum.o        uniq.c
coreutils.c	  fmt		      md5sum		 pwd.o		 src_sha384sum-md5sum.o        uniq.o
coreutils-dir.c   fmt.c		      md5sum.c		 readlink	 src_sha512sum-md5sum.o        unlink
coreutils.h	  fmt.o		      mkdir		 readlink.c	 stat			       unlink.c
coreutils-vdir.c  fold		      mkdir.c		 readlink.o	 stat.c			       unlink.o
cp		  fold.c	      mkdir.o		 realpath	 stat.o			       uptime
cp.c		  fold.o	      mkfifo		 realpath.c	 stdbuf			       uptime.c
cp-hash.c	  fs.h		      mkfifo.c		 realpath.o	 stdbuf.c		       uptime.o
cp-hash.h	  fs-is-local.h       mkfifo.o		 relpath.c	 stdbuf.o		       users
cp-hash.o	  getlimits	      mknod		 relpath.h	 stty			       users.c
cp.o		  getlimits.c	      mknod.c		 relpath.o	 stty.c			       users.o
csplit		  getlimits.o	      mknod.o		 remove.c	 stty.o			       vdir
csplit.c	  ginstall	      mktemp		 remove.h	 sum			       version.c
csplit.o	  group-list.c	      mktemp.c		 remove.o	 sum.c			       version.h
cu-progs.mk	  group-list.h	      mktemp.o		 rm		 sum.o			       version.o
cut		  group-list.o	      mv		 rm.c		 sync			       wc
cut.c		  groups	      mv.c		 rmdir		 sync.c			       wc.c
cut.o		  groups.c	      mv.o		 rmdir.c	 sync.o			       wc.o
date		  groups.o	      nice		 rmdir.o	 system.h		       who
date.c		  head		      nice.c		 rm.o		 tac			       whoami
date.o		  head.c	      nice.o		 runcon		 tac.c			       whoami.c
dcgen		  head.o	      nl		 runcon.c	 tac.o			       whoami.o
dd		  hostid	      nl.c		 runcon.o	 tac-pipe.c		       who.c
dd.c		  hostid.c	      nl.o		 selinux.c	 tail			       who.o
dd.o		  hostid.o	      nohup		 selinux.h	 tail.c			       yes
df		  hostname.c	      nohup.c		 selinux.o	 tail.o			       yes.c
df.c		  id		      nohup.o		 seq		 tee			       yes.o
[Inferior 1 (process 13843) exited normally]
(gdb) 

compressing and uncompressing a file with the help of xargs

$ls stderr.txt 
stderr.txt
$ls stderr.txt | xargs ls
stderr.txt
$ls stderr.txt | xargs cat
/home/jeffrin/quark/kernel/run_kernel.sh: line 10: ./main.native: No such file or directory
$ls stderr.txt | xargs gzip
$ls stderr.txt 
ls: cannot access 'stderr.txt': No such file or directory
$ls stderr.txt.gz | xargs gunzip 
$ls stderr.txt 
stderr.txt
$