Sunday, November 19, 2017

scp command - SCP to Securely Transfer Files/Folders in Linux





Some time you may wonder In Unix, how do I securely transfer files between two Linux computers? So generally we use scp command to   Securely Transfer Files/Folders in Linux (e.g. Ubuntu, Cent OS, Fedora, Linux mint ..). scp stands for "secure copy."



scp syntax



scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]

    [-l limit] [-o ssh_option] [-P port] [-S program]

    [[user@]host1:]file1 ... [[user@]host2:]file2



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Sunday, November 12, 2017

Scala Tutorial 10 - Match expressions





Find more such tutorials on -  http://www.codebind.com

In Scala match expressions are used to select between a list of alternatives same as multiple if-statements or select statement, if you are familiar with java.



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Tuesday, October 31, 2017

Scala Tutorial 9 - Scala For Loop



Find code here : http://www.codebind.com/scala/scala-while-and-do-while-loops/

So what is a loop ?

loops allow us to execute a statement or a block of statements multiple times. Like conditional statements, they are controlled by boolean expressions.



The for comprehension



Scala’s for is much more powerful than Java’s for

Consequently, it is used much more often than the other kinds of loops

Prints the numbers 1 through 10

Prints the numbers 1 through 9

Prints all the values in myArray

Prints all the values in myArray

Prints all the even numbers in myArray

-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Monday, October 9, 2017

Scala Tutorial 6 - Scala String Interpolation





In Scala it’s common to inject variables in strings like this with the different types of string interpolation:



Scala supports basically three kinds of String Interpolation:

s String Interpolator -  Prepending s to any string literal allows the usage of variables directly in the string



f String Interpolator - Prepending f to any string literal allows the creation of simple formatted strings. It is  similar to C languages style printf . When using the f interpolator, all variable references should be followed by a printf style format string, like %d, %s, %f etc.



raw String Interpolator - The raw interpolator is similar to the s interpolator except that it performs “No escaping of literals within the string”



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT


Wednesday, September 20, 2017

Scala Tutorial 4 - Data Types and Variables



Strong typing is very important in functional programming

Most scripting like Ruby, Python, etc. are dynamically typed, which is supposed to be one of their advantages.

Static typing makes programming much safer.

But sometimes types declarations become a burden.

Scala’s type inferencing mechanism minimizes the number of type declarations required.

It’s not uncommon for user code to have no explicit types.



Data Types Byte : 8 bit signed value. Range from -128 to 127

Short : 16 bit signed value. Range -32768 to 32767 Int : 32 bit signed value. Range -2147483648 to 2147483647

Long : 64 bit signed value. -9223372036854775808 to 9223372036854775807

Float : 32 bit IEEE 754 single-precision float

Double : 64 bit IEEE 754 double-precision float Char : 16 bit signed Unicode character. Range from U+0000 to U+FFFF

String : A sequence of Chars

Boolean : Either the literal true or the literal false Unit: Corresponds to no value : void

Null: null or empty reference

Nothing : The subtype of every other type; includes no values Any: The supertype of any type; any object is of type

Any : Java's Object class

AnyRef: The supertype of any reference type





-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Saturday, September 16, 2017

Scala Tutorial 3 - How to Install and Setup SBT on Windows 10





SBT (Scala Build Tool, formerly Simple Build Tool) is an open source build tool for Scala and Java projects, similar to Java's Maven and Ant. In this video I am going to show you How to Install and Setup SBT on Windows 10. Also i am going to show you How to execute sbt on Windows to open the interactive shell?



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Scala Tutorial 2 - Introduction to SBT (Scala Build Tool)



SBT (Scala Build Tool, formerly Simple Build Tool) is an open source build tool for Scala and Java projects, similar to Java's Maven and Ant. SBT is a modern build tool. While it is written in Scala and provides many Scala conveniences, it is a general purpose build tool. sbt is the de facto build tool in the Scala.
Why SBT :
- Native support for compiling Scala code.
- Uses Apache Ivy for dependency management
- Only-update-on-request model
- Full Scala language support for creating tasks
- Support for mixed Java/Scala projects
- Launch REPL (Read–Eval–Print Loop) in project context.

-------------------------Follow-------------------
My Website -
http://www.codebind.com
My Blog -
https://goo.gl/Nd2pFn
My Facebook Page -
https://goo.gl/eLp2cQ
Google+ -
https://goo.gl/lvC5FX
Twitter -
https://twitter.com/ProgrammingKnow
Pinterest -
https://goo.gl/kCInUp
Text Case Converter -
https://goo.gl/pVpcwL
Epoch Timestamp Converter -
https://goo.gl/Zedjo5
Decimal - Binary - Hexadecimal Converter -
https://goo.gl/rkX3JE
8-bit Checksum Calculator -
https://goo.gl/inxvIT

Saturday, September 9, 2017

Scala Tutorial 1 - Introduction to Scala





- “Scala is an acronym for Scalable Language ”
- Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way.
- Scala is written by Martin Odersky at EPFL.
- Scala is Statically Typed
- Scala Runs on JVM, full inter-op with Java.
- Scala is Object Oriented
- Scala is Functional
- Scala has Dynamic Features
- Scala is Scala blends object-oriented and functional programming in a statically typed language.

Tuesday, September 5, 2017

Redis Tutorial for Beginners 11 - Redis Publish Subscribe





SUBSCRIBE, UNSUBSCRIBE and PUBLISH implement the Publish/Subscribe messaging paradigm where senders (publishers) are not programmed to send their messages to specific receivers (subscribers).
PSUBSCRIBE pattern [pattern ...]
Listen for messages published to channels matching the given patterns
PUBSUB subcommand [argument [argument ...]]
Inspect the state of the Pub/Sub subsystem
PUBLISH channel message
Post a message to a channel
PUNSUBSCRIBE [pattern [pattern ...]]
Stop listening for messages posted to channels matching the given patterns
SUBSCRIBE channel [channel ...]
Listen for messages published to the given channels
UNSUBSCRIBE [channel [channel ...]]
Stop listening for messages posted to the given channels

-------------------------Follow-------------------
My Website -
http://www.codebind.com
My Blog -
https://goo.gl/Nd2pFn
My Facebook Page -
https://goo.gl/eLp2cQ
Google+ -
https://goo.gl/lvC5FX
Twitter -
https://twitter.com/ProgrammingKnow
Pinterest -
https://goo.gl/kCInUp
Text Case Converter -
https://goo.gl/pVpcwL
Epoch Timestamp Converter -
https://goo.gl/Zedjo5
Decimal - Binary - Hexadecimal Converter -
https://goo.gl/rkX3JE
8-bit Checksum Calculator -
https://goo.gl/inxvIT

Saturday, September 2, 2017

What Is JSON ?



“JSON” stands for “JavaScript Object Notation”
Despite the name, JSON is a (mostly) language-independent way of specifying objects as name-value pairs. Json Commonly used in Web as a vehicle to describe data being sent between systems. JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange.


-------------------------Follow-------------------
My Website -
http://www.codebind.com
My Blog -
https://goo.gl/Nd2pFn
My Facebook Page -
https://goo.gl/eLp2cQ
Google+ -
https://goo.gl/lvC5FX
Twitter -
https://twitter.com/ProgrammingKnow
Pinterest -
https://goo.gl/kCInUp
Text Case Converter -
https://goo.gl/pVpcwL
Epoch Timestamp Converter -
https://goo.gl/Zedjo5
Decimal - Binary - Hexadecimal Converter -
https://goo.gl/rkX3JE
8-bit Checksum Calculator -
https://goo.gl/inxvIT

Thursday, August 31, 2017

How to Install Eclipse Oxygen on Ubuntu 16.04





In this video I am going to show you How to Install The Latest Eclipse in Ubuntu 16.04.

Download Website
https://www.eclipse.org

Java Install command
sudo apt-get install openjdk-8-jdk

What’s Eclipse?
- Eclipse is An IDE is an Integrated Development Environment
- It is a free software / open source platform-independent software framework for delivering what the project calls "rich-client applications". Eclipse is also a community of users, constantly extending the covered application areas.
- Eclipse was originally developed by IBM as the successor of its VisualAge family of tools.
- Eclipse is now managed by the Eclipse Foundation, an independent not-for-profit consortium of software industry vendors.

-------------------------Follow-------------------
My Website -
http://www.codebind.com
My Blog -
https://goo.gl/Nd2pFn
My Facebook Page -
https://goo.gl/eLp2cQ
Google+ -
https://goo.gl/lvC5FX
Twitter -
https://twitter.com/ProgrammingKnow
Pinterest -
https://goo.gl/kCInUp
Text Case Converter -
https://goo.gl/pVpcwL
Epoch Timestamp Converter -
https://goo.gl/Zedjo5
Decimal - Binary - Hexadecimal Converter -
https://goo.gl/rkX3JE
8-bit Checksum Calculator -
https://goo.gl/inxvIT

Tuesday, August 8, 2017

How To Install MySQL on Mac OS X











In this post we will learn how to How To Install MySQL on Mac OS X. The same procedure can be used for installing MySQL on Mac OS X.

How to add MySQL to $PATH variable:
cd to your home folder
$ open -t .bash_profile
Try adding the following line to your .bash_profile file.
export PATH=${PATH}:/usr/local/mysql/bin/

Setting the MySQL root user password on OS X
$ mysql -u root -p
mysql$ ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'; 

-------------------------Follow-------------------
My Website - http://www.codebind.com
My Blog - https://goo.gl/Nd2pFn
My Facebook Page - https://goo.gl/eLp2cQ
Google+ - https://goo.gl/lvC5FX
Twitter - https://twitter.com/ProgrammingKnow
Pinterest - https://goo.gl/kCInUp
Text Case Converter - https://goo.gl/pVpcwL
Epoch Timestamp Converter - https://goo.gl/Zedjo5
Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE
8-bit Checksum Calculator - https://goo.gl/inxvIT

Sunday, July 30, 2017

How to Install Apache Tomcat on Mac OS X







Tomcat is a Servlet container (Web server that interacts with Servlets) developed under the Jakarta Project of Apache Software Foundation.

Tomcat implements the Servlet and the Java Server Pages (JSP) specifications of Sun Microsystems

Tomcat is an open-source, non commercial project

Licensed under the Apache Software License

Tomcat is written in Java (OS independent)



Download and unzip the tar.gz:

http://tomcat.apache.org/download-70.cgi



install:



sudo mkdir /usr/local

sudo mv ~/Downloads/apache-tomcat-7.0.*  /usr/local

sudo ln -s /usr/local/apache-tomcat-7.0.*  /Library/Tomcat

sudo chown -R your-OSX-username  /Library/Tomcat

sudo chmod +x /Library/Tomcat/apache-tomcat-7.0.*/bin/*.sh



start:

/Library/Tomcat/bin/startup.sh



stop:

/Library/Tomcat/bin/shutdown.sh





------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Wednesday, July 26, 2017

Shell Scripting Tutorial





For more detailed Tutorial visit - https://goo.gl/bbvi0C



A shell script is a computer program designed to be run by the Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. A shell usually interprets a single line of input, but we can also create a file containing a number of lines of commands to be interpreted. This file is a program known as a shell script. The program can also contain control structures (if-then, loops). Shell scripts allow a sequence of commands to be executed automatically . Shell Scripting tutorial is designed to help beginners and professionals.



00:00:00 1 - Introduction

00:10:00 2 - using Variables and Comments

00:20:11 3 - Read User Input

00:31:37 4 - Pass Arguments to a Bash-Script

00:40:08 5 - If Statement ( If then , If then else, If elif else)

00:53:20 6 - File test operators

01:03:45 7 - How to append output to the end of text file

01:14:26 8 - Logical 'AND' Operator

01:21:01 9 - Logical 'OR' Operator

01:26:35 10 - Perform arithmetic operations

01:33:51 11 - Floating point math operations in bash | bc Command

01:46:06 12 - The case statement

01:53:53 13 - The case statement Example

02:02:26 14 - Array variables

02:12:51 15 - WHILE Loops

02:19:07 16 - using sleep and open terminal with WHILE Loops

02:23:59 17 - Read a file content in Bash

02:31:15 18 - UNTIL loop

02:35:38 19 - FOR loop

02:44:08 20 - use FOR loop to execute commands

02:50:44 21 - Select loop

02:57:41 22 - Break and continue

03:04:11 23 - Functions

03:13:48 24 - Local variables

03:22:09 25 - Function Example

03:34:16 26 - Readonly command

03:41:34 27 - Signals and Traps

04:03:08 28 - How to debug a bash script



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Saturday, July 22, 2017

Redis Tutorial for Beginners 6 - more commands (SETEX, SETNX, INCR, DECR...





SETEX key seconds value

Sets the value with the expiry of a key



SETNX key value

Sets the value of a key, only if the key does not exist



SETRANGE key offset value

Overwrites the part of a string at the key starting at the specified offset



STRLEN key

Gets the length of the value stored in a key



MSET key value [key value ...]

Sets multiple keys to multiple values



MSETNX key value [key value ...]

Sets multiple keys to multiple values, only if none of the keys exist



PSETEX key milliseconds value

Sets the value and expiration in milliseconds of a key



INCR key

Increments the integer value of a key by one



INCRBY key increment

Increments the integer value of a key by the given amount



INCRBYFLOAT key increment

Increments the float value of a key by the given amount



DECR key

Decrements the integer value of a key by one



DECRBY key decrement

Decrements the integer value of a key by the given number



APPEND key value

Appends a value to a key



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Redis Tutorial for Beginners 5 - Redis strings commands





1 SET key value

This command sets the value at the specified key.



2 GET key

Gets the value of a key.



3      DEL key

This command deletes the key, if it exists.



4 FLUSHALL

Delete all the keys of all the existing databases, not just the currently selected one.



5 KEYS pattern

Returns all keys matching pattern.



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Tuesday, July 18, 2017

Redis Tutorial for Beginners 3 - How To Install Redis On Ubuntu Linux





There are two ways to install Redis under Ubuntu Linux



1. usind apt-get install

----------------------------------------------------

$ sudo apt-get install redis-server



2 with followind commands:

-------------------------------------------------------------

$ sudo apt-get update

$ sudo apt-get install build-essential tcl

$ mkdir redis && cd redis

$ wget http://download.redis.io/releases/redis-4.0.0.tar.gz

$ tar xzf redis-4.0.0.tar.gz

$ cd redis-4.0.0

$ make

$ make test

$ sudo make install



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Sunday, July 16, 2017

Redis Tutorial for Beginners 1 - How To Install Redis On Windows





There are two ways to install Redis under Windows



1. Download the latest Redis .msi file from

https://github.com/MSOpenTech/redis/releases

and install it.



2. You can choose either from these sources



https://github.com/MSOpenTech/redis/releases or

https://github.com/rgl/redis/downloads

Personally I prepared the first option

- Download Redis-x64-2.8.2104.zip

- Extract the zip to prepared directory

- run redis-server.exe

- then run redis-cli.exe



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Redis Tutorial for Beginners 1 - Introduction







Redis is an open source, BSD licensed, advanced in-memory key-value store where keys can contain data structures such as strings,

 hashes, lists, sets, and sorted sets. Redis Can be used as Database, a Caching layer or a Message broker.

Following in the footsteps of other NoSQL databases,  such as Cassandra, CouchDB, and MongoDB, Redis allows the user to store vast amounts of data without the limits of a relational database.

 

 History - In Early 2009 - Salvatore Sanfilippo, an Italian developer,

 started the Redis project.At that time. He was working on a real-time web analytics solution and found that MySQL could not provide

 the necessary performance. June 2009 - Redis was deployed

 in production for the LLOOGG real-time web analytics website

 March 2010 - VMWare hired Sanfilippo to work  full-time on Redis (remains BSD licensed) Subsequently,  VMWare hired Pieter Noordhuis, a major Redis contributor, to assist on the project.



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Tuesday, June 13, 2017

How To Install MySQL on Windows 10



In this post we will learn how to How To Install MySQL on Ubuntu 16.04 LTS. The same procedure can be used for installing MySQL  on Ubuntu 14.04 LTS.

But first lets see What is MySQL . MySQL is a very popular, open source database. Officially pronounced “my Ess Que Ell” (not my sequel). Handles very large databases;  very fast performance.

Why are we using MySQL? Free (much cheaper than Oracle!)

Each student can install MySQL locally. Easy to use Shell for creating tables, querying tables, etc.Easy to use with Java JDBC. While installing MySQL, it will promt you to create a root password .  At this stage please select a safe and secure password . Make sure you remember the password, to use it later.MySQL tutorial for beginners and professionals with examples on CRUD, insert statement, select statement, update statement, delete statement, use database, keys, joins etc.



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Sunday, May 21, 2017

Shell Scripting Tutorial for Beginners 23 - Functions





Functions :

Functions make scripts easier to maintain. Basically it breaks up the program into smaller pieces. A function performs an action defined by you, and it can return a value if you wish.



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Sunday, May 14, 2017

Shell Scripting Tutorial for Beginners 21 - Select loop





SELECT COMMAND Constructs simple menu from word list. It Allows user to enter a number instead of a word. So User enters sequence number corresponding to the word.

--------------------------------------------

Syntax:

select WORD in LIST    

do          

RESPECTIVE-COMMANDS

done

--------------------------------------------

Loops until end of input, i.e. ^d  (or ^c)



-------------------------Follow-------------------

My Website - http://www.codebind.com

My Blog - https://goo.gl/Nd2pFn

My Facebook Page - https://goo.gl/eLp2cQ

Google+ - https://goo.gl/lvC5FX

Twitter - https://twitter.com/ProgrammingKnow

Pinterest - https://goo.gl/kCInUp

Text Case Converter - https://goo.gl/pVpcwL

Epoch Timestamp Converter - https://goo.gl/Zedjo5

Decimal - Binary - Hexadecimal Converter - https://goo.gl/rkX3JE

8-bit Checksum Calculator - https://goo.gl/inxvIT

Tuesday, May 9, 2017

Java Tutorial | Learn Java programming





Java is a widely used robust technology. According to Estimates , 3 billion devices run java.



This Java Tutorial course is aimed at complete beginners to the subject. For those who have no programming experience or those who have limited knowledge of Java. We get you up and running and will give you the skills you need to master the Java programming language.



00:00:01 1 - Introduction and Installing the java (JDK) Step by Step Tutorial

00:13:03 2 - Installing Eclipse IDE and Setting up Eclipse

00:28:01 3 - Creating First Java Project in Eclipse IDE

00:47:34 4 - Variables and Types in Java

00:57:26 5 - Getting User Input using Java

01:09:31 6 - Math and Arithmetic Operators in Java

01:18:13 7 - Increment Operator and Assignment Operator

01:25:18 8 - IF ... ELSE Statements and Relational Operators

01:33:48 9 - Logical Operators in Java

01:41:11 10 - switch Statement in Java

01:50:44 11 - The while Statements (while Loops)

01:57:22 12 - The do-while Statements (do-while Loops)

02:03:15 13 - Arrays in Java

02:11:49 14 - The for Statement in Java (for loops)

02:20:20 15 - Java String

02:29:08 16 - Introduction to Methods

02:37:07 17 - Parameter passing and Returning a Value from a Method

02:49:41 18 - Classes and Objects in Java

03:05:02 19 - Class Constructor in Java

03:15:18 20 - Method Overloading in Java

03:20:40 21 - 'static' keyword in Java

03:28:15 22 - 'static' keyword Example in Java

03:34:58 23 - Public, Private, Protected and this (Java Access Modifiers)

03:47:14 24 - The final keyword in Java

03:57:42 25 - Inheritance in Java

04:07:51 26 - Polymorphism in Java

04:16:21 27 - Method Overriding in Java

04:22:35 28 - Abstract Methods and Classes

04:31:47 29 - Java Interfaces

04:39:06 30 - Recursion in java

04:45:54 31 - Arraylist in Java

04:56:42 32 - LinkedList in Java

05:04:36 33 - Difference between LinkedList vs ArrayList in Java

05:16:53 34 - ListIterator in Java

05:24:28 35 - HashSet in Java

05:32:39 36 - Catching and Handling Exceptions in Java using Try Catch Blocks

05:42:58 37 - Java Finally block (try-catch-finally Exception Handling in Java )

05:53:01 38 - Create a File and Write in it Using PrintWriter and File class

06:01:34 39 - How to Read file using Java

06:09:43 40 - Using Date & Time + formatting Date using SimpleDateFormat

Sunday, April 9, 2017

Shell Scripting Tutorial for Beginners 20 - FOR loop to execute commands



#!/bin/bash
# for loops

echo "all the files in directory--------"
for item in *
do  
   if [ -f $item ]
   then 
     echo $item
   fi
done

echo
echo "all the directory in directory--------"
for item in *
do  
   if [ -d $item ]
   then 
     echo $item
   fi
done
echo
echo "execute list of commands--------"
for command in ls pwd date
do  
     echo "command name -> $command"
     $command
done

Shell Scripting Tutorial for Beginners 18 - FOR loop



Basic Syntax:



for VARIABLE in 1 2 3 4 5 .. N
do
 command1
 command2
 commandN
done
#OR-----------------------------------------------

for VARIABLE in file1 file2 file3
do
 command1 on $VARIABLE
 command2
 commandN
done
#OR-----------------------------------------------

for OUTPUT in $(Linux-Or-Unix-Command-Here)
do
 command1 on $OUTPUT
 command2 on $OUTPUT
 commandN
done
#OR-----------------------------------------------
for (( EXP1; EXP2; EXP3 ))
do
 command1
 command2
 command3
done




Example:



#!/bin/bash
# for loops
#Example 1 ------------------------
for i in 1 2 3 4 5
do
   echo $i
done

#Example 2 ------------------------
for i in {0..10}
do
   echo $i
done

#Example 3 ------------------------
for i in {0..10..2}
do
   echo $i
done

#Example 4 ------------------------
echo ${BASH_VERSION}
for (( i=0; i<5; i++ ))
do
   echo $i
done

Saturday, April 1, 2017

Shell Scripting Tutorial for Beginners 18 - UNTIL loop



#!/bin/bash
# until loops
n=1

# first way
echo "----until loops------first way-------------------"
until [ $n -gt 10 ]
do
    echo "$n"
    (( n++ ))
done


# second way
n=1
echo "----until loops------second way-------------------"
until (( $n > 10 ))  
do
    echo "$n"
    (( ++n ))
done

# third way
n=1
echo "----until loops------third way-------------------"
until [ $n -gt 10 ]
do
    echo "$n"
    n=$(( n+1 ))
done
output


test@test:~/Desktop$ ./hello.sh 
----until loops------first way-------------------
1
2
3
4
5
6
7
8
9
10
----until loops------second way-------------------
1
2
3
4
5
6
7
8
9
10
----until loops------third way-------------------
1
2
3
4
5
6
7
8
9
10
test@test:~/Desktop$ 

Shell Scripting Tutorial for Beginners 16 - using sleep and open termina...



#!/bin/bash
# while loops
n=1

while [ $n -le 3 ]
do
    echo "$n"
    (( n++ ))
    gnome-terminal &
done

Shell Scripting Tutorial for Beginners 15 - WHILE Loops


#!/bin/bash
# while loops
n=1

# first way
echo "----while loops------first way-------------------"
while [ $n -le 10 ]
do
    echo "$n"
    (( n++ ))
done


# second way
n=1
echo "----while loops------second way-------------------"
while (( $n <= 10 ))  
do
    echo "$n"
    (( ++n ))
done

# third way
n=1
echo "----while loops------third way-------------------"
while [ $n -le 10 ]
do
    echo "$n"
    n=$(( n+1 ))
done
output:
test@test:~/Desktop$ ./hello.sh 
----while loops------first way-------------------
1
2
3
4
5
6
7
8
9
10
----while loops------second way-------------------
1
2
3
4
5
6
7
8
9
10
----while loops------third way-------------------
1
2
3
4
5
6
7
8
9
10
test@test:~/Desktop$ 

Saturday, March 25, 2017

Shell Scripting Tutorial for Beginners 14 - Array variables

#! /bin/bash

os=('ubuntu' 'windows' 'kali')
os[6]='mac'

unset os[2]
echo "${os[@]}"
echo "${os[0]}"
echo "${!os[@]}"
echo "${#os[@]}"

string=dasfdsafsadfasdf
echo "${string[@]}"
echo "${string[0]}"
echo "${string[1]}"
echo "${#string[@]}"

Wednesday, March 22, 2017

Shell Scripting Tutorial for Beginners 13 - The case statement Example



#! /bin/bash

echo -e "Enter some character : \c"
read value


case $value in
    [a-z] )
        echo "User entered $value a to z" ;;
    [A-Z] )
        echo "User entered $value A to Z" ;;
    [0-9] )
        echo "User entered $value 0 to 9" ;;
    ? )
        echo "User entered $value special character" ;;
    * )
        echo "Unknown input" ;;
esac
Output:


test@test$ ./hello.sh 
Enter some character : f
User entered f a to z
test@test$ ./hello.sh 
Enter some character : K
User entered K a to z
test@test$ LANG=C
test@test$ ./hello.sh 
Enter some character : K
User entered K A to Z
test@test$ ./hello.sh 
Enter some character : 9
User entered 9 0 to 9
test@test$ ./hello.sh 
Enter some character : 5
User entered 5 0 to 9
test@test$ ./hello.sh 
Enter some character : &
User entered & special character
test@test$ ./hello.sh 
Enter some character : sdsdsdsd
Unknown input
test@test$ 

Tuesday, March 21, 2017

Shell Scripting Tutorial for Beginners 12 - The case statement

#! /bin/bash

vehicle=$1

case $vehicle in
    "car" )
        echo "Rent of $vehicle is 100 dollar" ;;
    "van" )
        echo "Rent of $vehicle is 80 dollar" ;;
    "bicycle" )
        echo "Rent of $vehicle is 5 dollar" ;;
    "truck" )
        echo "Rent of $vehicle is 150 dollar" ;;
    * )
        echo "Unknown vehicle" ;;
esac

Saturday, March 18, 2017

Shell Scripting Tutorial for Beginners 11 - Floating point math operatio...



#! /bin/bash

num1=20.5
num2=5

echo "$num1+$num2" | bc
echo "$num1-$num2" | bc
echo "20.5*5" | bc
echo "scale=20;20.5/5" | bc
echo "20.5%5" | bc

num=4

echo "scale=2;sqrt($num)" | bc -l
echo "scale=2;3^3" | bc -l

Thursday, March 16, 2017

Shell Scripting Tutorial for Beginners 10 - Perform arithmetic operations

#! /bin/bash

num1=20
num2=5

echo $(( num1 + num2 ))
echo $(( num1 - num2 ))
echo $(( num1 * num2 ))
echo $(( num1 / num2 ))
echo $(( num1 % num2 ))


echo $(expr $num1 + $num2 )
echo $(expr  $num1 - $num2 )
echo $(expr  $num1 \* $num2 )
echo $(expr  $num1 / $num2 )
echo $(expr  $num1 % $num2 )

Wednesday, March 15, 2017

Shell Scripting Tutorial for Beginners 8 - Logical 'OR' Operator



#! /bin/bash

age=60

# for using OR operator use ||
if [ "$age" -gt 18] || ["$age" -lt 30 ]
then
  echo "valid age"
  else
  echo "age not valid"
fi

#  The -o option provide
# an alternative compound condition test.
if [ "$age" -gt 18 -o "$age" -lt 30 ]
then
  echo "valid age"
  else
  echo "age not valid"
fi

# if [[ $condition1 || $condition2 ]]    # Also works.
if [[ "$age" -gt 18 || "$age" -lt 30 ]]
then
  echo "valid age"
  else
  echo "age not valid"
fi

Monday, March 13, 2017

Shell Scripting Tutorial for Beginners 8 - Logical 'AND' Operator

#! /bin/bash

age=60

# for using And operator use &&
if [ "$age" -gt 18] && ["$age" -lt 30 ]
then
  echo "valid age"
  else
  echo "age not valid"
fi

#  The -a option provide
# an alternative compound condition test.
if [ "$age" -gt 18 -a "$age" -lt 30 ]
then
  echo "valid age"
  else
  echo "age not valid"
fi

# if [[ $condition1 && $condition2 ]]    # Also works.
if [[ "$age" -gt 18 && "$age" -lt 30 ]]
then
  echo "valid age"
  else
  echo "age not valid"
fi

Saturday, March 11, 2017

Shell Scripting Tutorial for Beginners 7 - How to append output to the e...



#! /bin/bash

echo -e "Enter the name of the file : \c"
read file_name

if [ -f $file_name ]
then
      if [ -w $file_name ]
      then
         echo "Type some text data. To quit press ctrl+d."
         cat >>  $file_name
      else
          echo "The file do not have write permissions"
      fi
 else   
  echo "$file_name not exists"
fi

Shell Scripting Tutorial for Beginners 6 - File test operators



#! /bin/bash

echo -e "Enter the name of the file : \c"
read file_name

if [ -s $file_name ]
then
  echo "$file_name not empty"
 else   
  echo "$file_name empty"
fi

Monday, March 6, 2017

Shell Scripting Tutorial for Beginners 5 - If Statement ( If then , If t...





Bash Shell

Conditional Statements 
  • Conditionals let us decide whether to perform an action or not, this decision is taken by evaluating an expression. The most basic form is:


      if [ expression ];

      then

            statements

      elif [ expression ];

      then

            statements

      else

            statements

      fi

  • the elif (else if) and else sections are optional
  • Put spaces after [ and before ], and around the operators and operands. 
Bash Shell

Expressions 
  • An expression can be: String comparisonNumeric comparisonFile operators and Logical operators and it is represented by [expression]:
  • String Comparisons: 


=  compare if two strings are equal

!=  compare if two strings are not equal

-n  evaluate if string length is greater than zero

-z  evaluate if string length is equal to zero

  • Examples:


[ s1 = s2 ]  (true if s1 same as s2, else false)

[ s1 != s2 ]  (true if s1 not same as s2, else false)

[ s1 ]   (true if s1 is not empty, else false)

[ -n s1 ]   (true if s1 has a length greater then 0, else false)

[ -z s2 ]   (true if s2 has a length of 0, otherwise false)

Bash Shell

Expressions 
  • Number Comparisons:


-eq compare if two numbers are equal

-ge         compare if one number is greater than or equal to a number

-le  compare if one number is less than or equal to a number

-ne  compare if two numbers are not equal

-gt  compare if one number is greater than another number

-lt  compare if one number is less than another number

  • Examples:


[ n1 -eq n2 ]  (true if n1 same as n2, else false)

[ n1 -ge n2 ]  (true if n1greater then or equal to n2, else false)

[ n1 -le n2 ]  (true if n1 less then or equal to n2, else false)

[ n1 -ne n2 ]  (true if n1 is not same as n2, else false)

[ n1 -gt n2 ]  (true if n1 greater then n2, else false)

[ n1 -lt n2 ]  (true if n1 less then n2, else false)

Bash Shell

Examples 
cat user.sh

 #!/bin/bash

      echo -n “Enter your login name: "

      read name

      if [ “$name” = “$USER” ];

      then

            echo “Hello, $name. How are you today ?”

      else

            echo “You are not $USER, so who are you ?”

      fi

cat number.sh

#!/bin/bash

      echo -n “Enter a number 1 < x < 10: "

      read num

      if [ “$num” -lt 10 ]; then

            if [ “$num” -gt 1 ]; then

                  echo “$num*$num=$(($num*$num))”

            else

                  echo “Wrong insertion !”

            fi

      else

            echo “Wrong insertion !”

      fi





#! /bin/bash

word=a

if  [[ $word == "b" ]]
then
  echo "condition b is true"
elif [[ $word == "a" ]]
then 
  echo "condition a is true" 
else
  echo "condition is false"    
fi