Wednesday, 25 May 2022

Why to learn java?

Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. This tutorial gives a complete understanding of Java. This reference will take you through simple and practical approaches while learning Java Programming language. Why to Learn java Programming? Java is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Software Development Domain. I will list down some of the key advantages of learning Java Programming: Object Oriented − In Java, everything is an Object. Java can be easily extended since it is based on the Object model. Platform Independent − Unlike many other programming languages including C and C++, when Java is compiled, it is not compiled into platform specific machine, rather into platform independent byte code. This byte code is distributed over the web and interpreted by the Virtual Machine (JVM) on whichever platform it is being run on. Simple − Java is designed to be easy to learn. If you understand the basic concept of OOP Java, it would be easy to master. Secure − With Java's secure feature it enables to develop virus-free, tamper-free systems. Authentication techniques are based on public-key encryption. Architecture-neutral − Java compiler generates an architecture-neutral object file format, which makes the compiled code executable on many processors, with the presence of Java runtime system. Portable − Being architecture-neutral and having no implementation dependent aspects of the specification makes Java portable. Compiler in Java is written in ANSI C with a clean portability boundary, which is a POSIX subset. Robust − Java makes an effort to eliminate error prone situations by emphasizing mainly on compile time error checking and runtime checking. Hello World using Java Programming. Just to give you a little excitement about Java programming, I'm going to give you a small conventional C Programming Hello World program, You can try it using Demo link. Live Demo public class MyFirstJavaProgram { /* This is my first java program. * This will print 'Hello World' as the output */ public static void main(String []args) { System.out.println("Hello World"); // prints Hello World } } Applications of Java Programming The latest release of the Java Standard Edition is Java SE 8. With the advancement of Java and its widespread popularity, multiple configurations were built to suit various types of platforms. For example: J2EE for Enterprise Applications, J2ME for Mobile Applications. The new J2 versions were renamed as Java SE, Java EE, and Java ME respectively. Java is guaranteed to be Write Once, Run Anywhere. Multithreaded − With Java's multithreaded feature it is possible to write programs that can perform many tasks simultaneously. This design feature allows the developers to construct interactive applications that can run smoothly. Interpreted − Java byte code is translated on the fly to native machine instructions and is not stored anywhere. The development process is more rapid and analytical since the linking is an incremental and light-weight process. High Performance − With the use of Just-In-Time compilers, Java enables high performance. Distributed − Java is designed for the distributed environment of the internet. Dynamic − Java is considered to be more dynamic than C or C++ since it is designed to adapt to an evolving environment. Java programs can carry extensive amount of run-time information that can be used to verify and resolve accesses to objects on run-time. Audience This tutorial has been prepared for the beginners to help them understand the basic to advanced concepts related to Java Programming language. Prerequisites Before you start practicing various types of examples given in this reference, we assume that you are already aware about computer programs and computer programming languages.

Tuesday, 8 December 2020

How to create a basic text editor using html and javascript.

     How to create an online Text Editor using Html & Js

It is easy to understand the basics of programming by doing simple programming projects. Here, I am going to explain how to make a basic text editor like in MS word in an easy way. I have used html and js to create this simple project.

Functions in this editor are :

  • Bold
  • underline
  • italic
  • alignments
  • undo and redo
This is the demo video of the project. And you can find the explanation video as well in  Tech Cravings .


Steps to follow:

Step 1:

Create a new folder and open it with brackets. If you don't have brackets editor, download it here. In brackets, create an html file.

Step 2:

Form the basic structure of the html  & add the script which contains access to icons package from fontawesome between the head tags.:

<!DOCTYPE html>

<html>

<head>

<title> Online Text Editor </title> 

<script src='https://kit.fontawesome.com/a076d05399.js'></script>

</head>

<body> </body>

</html>


Step 3:

Create a <div> and put all buttons inside the div. Then create an <iframe> which will be used as an editor to give input.

<!DOCTYPE html>

<html>

<head>

<title> Online Text Editor </title> 

    <script src='https://kit.fontawesome.com/a076d05399.js'></script>

</head>

    

<body onload="enableEditMode();">

    <div>

      <button onclick="execCmd('bold')"><i class="fas fa-bold"> </i></button>

        <button onclick="execCmd('underline')"><i class="fas fa-underline"> </i></button>

        <button onclick="execCmd('italic')"><i class="fas fa-italic"> </i></button>

        <button onclick="execCmd('justifyLeft')"><i class="fas fa-align-left"> </i></button>

        <button onclick="execCmd('justifyCenter')"><i class="fas fa-align-center"> </i></button>

        <button onclick="execCmd('justifyRight')"><i class="fas fa-align-right"> </i></button>

        <button onclick="execCmd('justifyFull')"><i class="fas fa-align-justify"> </i></button>

        <button onclick="execCmd('undo')"><i class="fas fa-undo"> </i></button>

        <button onclick="execCmd('redo')"><i class="fas fa-redo"> </i></button>

    </div> <br>

    

    <iframe name="richTextField" style="width: 1000px ; height: 500px"></iframe>

</body>

</html>

Step 4:

Now create the Javascript functions to let the frame editable and make the buttons work below the <iframe> tag.

<script type="text/javascript">

        function enableEditMode(){

            richTextField.document.designMode = 'on';

        }

        

        function execCmd(command){

            richTextField.document.execCommand(command, false, null);

        }

</script>


  • iframe : used to create an inline frame.
  • document.designMode : Controls the editability of the frame.
  • execCommand() : when an html document becomes editable using designMode, execCommand() is used to run commands that makes changes in the editable region.



 



Friday, 27 November 2020

How to read input from keyboard in C#


  • All statements will end with ;                                                                                                      
  • Classes and methods begin with '{ ' and end with ' } '.                                                               
  •  Statements between { and } are called blocks. blocks defines the scope of the program elements.                                                                                                                                     





Sunday, 4 October 2020

Learn OOP with C#

C# an Introduction.


It is one of the languages which evolved from C programming like C++ with object-oriented development. It has a feature named 'Garbage Collection' which makes beginners understand them easily and quickly. This allows C# to stand different from C and C++.




Some of its features are:
  • Object-Oriented
  • Comes with an extensive class library
  • Supports exception handling.
  • Multiple types of polymorphism
  • Separation of interfaces from implementations.
Mostly, C# is used to develop desktop apps and games. It has powerful development tools, multi platform support and generics makes C# a good choice.

C# is used for:
  • Rapid application development projects.
  • Projects implemented by small or large teams.
  • Internet/Web applications.
  • Projects with strict reliability requirements.
C# is case-sensitive. That means name and Name are not the same variables here.

Sample Hello World Program in C#:

//Declaration of namespace
Using System;

//Beginning of the start class
Class HelloWorld
{
    //Main program begins here
    Static void Main()
    {
       //writing to console
       console.Writeline("Hello World!");
    }
}

Output =>  Hello World!

From the above example, you can understand that a program here has consist of 4 basic parts namely,
  1. namespace declaration
  2. a class
  3. main method
  4. program statement 
Recommended IDE to use is : Visual Studio .

Saturday, 22 August 2020

OOP basic concepts

 There are 4 basic concepts in Object-Oriented Programming(OOP) :


1.Inheritance => Here, the object acquires or shows all the properties and behaviors of the parent Object. So, it will be easy to reuse code as well as it will be easy to understand the principle. For example just thing of it as a human you will be resembling the features physically and logically like your parents. That's how this works.


2.Encapsulation => This one is actually binding up codes and data together, that is binding up methods/functions with data(variables) together. Consider it like a capsule in which medicine are mixed together where we can't see anything. This is protecting the function happening in back from the site of the user. This function is simply known as Data hiding.


3.Abstraction => This is what doing that hiding thing like I mentioned earlier. So user can't find how the function is working. and this distinguishes between different objects. It classifies objects into concepts and focuses on common properties.


4.Polymorphism => Here, one functions/task is performed in different ways. For example, When we take a shape class with data of radius, length, and width; we can find the area of rectangle, circle and square with different functions.


  • In Object Oriented Programming, properties are also called as attributes, and data members. These are actually the variables we create.
  • And functions are called as methods, behaviors and member functions.
The properties are said to be private while methods are public. So the assigned value of properties/instance variables can be used in programs without showing them.

Sunday, 16 August 2020

Object-Oriented Programming

  

 What are object-oriented programming?

Object-oriented programming (OOP) refers to a type of computer programming method (software design) in which programmers define the data type of a data structure, and also the types of operations (functions) that can be applied to the data structure. Once an object is created, it can be used in the code as many times we need it.

For example, if we create a design for a house, we can use the same design to build many houses for different customers in different interior and paint. Like that here, a set of functions implemented in a created Class is used in different places to create instances/objects for different functions.OOP languages are diverse, but most popular are class-based. That means objects are instances of main classes.

The languages they are using this concept in the current period are:
  • C#
  • Java
  • C++
  • Python
  • Dart
  • Scala
  • Swift
  • Ruby, etc.
Among these C# and Java are popular for web application development these days, C++ is good for game development, Dart is emerging in mobile app development along with flutter framework, and python is used mostly in data science and in games too. Object-Oriented languages are easy to learn and implement as there we can use the same code in different places(repeated usage).

Object-Oriented concepts 

Object: The entity that has state and behavior. For example, if Student is a class. Raj is an object of it.

Class: Class is a set of objects which have common properties. It can be a blueprint for those objects and can't be physical.

The Object-Oriented design has four major concepts for the function of the system. They are:
  • Inheritance
  • Abstraction
  • Encapsulation
  • Polymorphism

Benefits of Object-Oriented Programming

  1. Improved productivity during software development 
  2. Improved software maintainability
  3. Faster development sprints
  4. Lower cost of development
  5. Higher quality software

Challenges associated with OOP:

  1. Steep learning curve
  2. Larger program size
  3. Slower program execution
  4. Its not a one-size fits all solution.

Why to learn java?

Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms...