ACQUIRING KNOWLEDGE WITH EXAMPLES


commandline session

$ 4.2.29 11 511---> ping -c5 google.com &
[1] 4376
$ 4.2.29 12 512---> PING google.com (173.194.38.1100) 56(84) bytes of data.
64 bytes from sin04s02-in-f5.1e100.net (173.194.38.1100): icmp_req=1 ttl=54 time=75.8 ms
64 bytes from sin04s02-in-f5.1e100.net (173.194.38.1100): icmp_req=2 ttl=54 time=75.3 ms
64 bytes from sin04s02-in-f5.1e100.net (173.194.38.1100): icmp_req=3 ttl=54 time=75.4 ms
64 bytes from sin04s02-in-f5.1e100.net (173.194.38.1100): icmp_req=4 ttl=54 time=75.0 ms
64 bytes from sin04s02-in-f5.1e100.net (173.194.38.1100): icmp_req=5 ttl=54 time=76.1 ms

--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 75.095/75.573/76.101/0.405 ms

[1]+  Done                    ping -c5 google.com
$ 4.2.29 12 512--->

commandline session

$ 4.2.29 2 502---> ./a.out
found in: htop-0.9
found in: .
$ 4.2.29 3 503---> size a.out
$ 4.2.29 3 503---> size a.out
   text	   data	    bss	    dec	    hex	filename
   2401	    608	     16	   3025	    bd1	a.out
$ 4.2.29 4 504---> man size
$ 4.2.29 5 505---> size --format=SysV a.out
a.out  :
section              size      addr
.interp                28   4194816
.note.ABI-tag          32   4194844
.note.gnu.build-id     36   4194876
.hash                  80   4194912
.gnu.hash              28   4194992
.dynsym               360   4195024
.dynstr               143   4195384
.gnu.version           30   4195528
.gnu.version_r         32   4195560
.rela.dyn              24   4195592
.rela.plt             312   4195616
.init                  24   4195928
.plt                  224   4195952
.text                 776   4196176
.fini                  14   4196952
.rodata                50   4196968
.eh_frame_hdr          44   4197020
.eh_frame             164   4197064
.ctors                 16   6294384
.dtors                 16   6294400
.jcr                    8   6294416
.dynamic              416   6294424
.got                    8   6294840
.got.plt              128   6294848
.data                  16   6294976
.bss                   16   6294992
.comment               57         0
Total                3082


$ 4.2.29 6 506--->

Get The Hang

$ 4.2.29 2 502---> 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> va a, b = 10
:1: error: ';' expected but ',' found.
       va a, b = 10
           ^

scala> val a, b = 10
a: Int = 10
b: Int = 10

scala> a*b
res0: Int = 100

scala> val a, b :String = hello
:7: error: not found: value hello
       val a, b :String = hello
                          ^

scala> var a, b :String = hello
:7: error: not found: value hello
       var a, b :String = hello
                          ^

scala> var a, b :String = "hello"
a: String = hello
b: String = hello

scala> echo a
:8: error: not found: value echo
              echo a
              ^

scala>  a
res2: String = hello

scala>

Get The Hang

$ 4.2.29 1 501---> 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> val stat = data + ticks
:7: error: not found: value data
       val stat = data + ticks
                  ^

scala> val stat = data
:7: error: not found: value data
       val stat = data
                  ^

scala> val stat =  1
stat: Int = 1

scala> val plot  =  3
plot: Int = 3

scala> val out  = data + plot
:8: error: not found: value data
       val out  = data + plot
                  ^

scala> val out  = stat + plot
out: Int = 4

scala>

Get The Hang

$ 4.2.29 2 502---> 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> 6/3
res0: Int = 2

scala> res0.
%              &              *              +              -              /              >
>=             >>             >>>            ^              asInstanceOf   isInstanceOf   toByte
toChar         toDouble       toFloat        toInt          toLong         toShort        toString
unary_+        unary_-        unary_~        |

scala> res0.*
                           def *(x: Byte): Int        def *(x: Char): Int        def *(x: Double): Double
def *(x: Float): Float     def *(x: Int): Int         def *(x: Long): Long       def *(x: Short): Int

scala> res0.*
:9: error: ambiguous reference to overloaded definition,
both method * in class Int of type (x: Char)Int
and  method * in class Int of type (x: Short)Int
match expected type ?
              res0.*
                   ^

scala> res0.to
toByte     toChar     toDouble   toFloat    toInt      toLong     toShort    toString

scala> res0.to
toByte     toChar     toDouble   toFloat    toInt      toLong     toShort    toString

scala> res0.toS
toShort    toString

scala> res0.toString
res2: java.lang.String = 2

scala> res2*2
res3: String = 22

scala>

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>

Copyright © 2009,  2010,  2011,  2012,  2013, 2014     BeautifulWork Project    e-mail:  ahiliation@yahoo.co.in
BeautifulWork Project comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.