Advertisement

Ads

Sunday, December 30, 2018

Control Statement in PHP with Example

PHP Control Statement

What is Control Statement in PHP?

A block of code which decide the execution way of programme according to the value of the given condition.
PHP Control Statement with Example

There are some control statements that PHP supports.

1. PHP if Statement

If a given condition is true, only then if statement will execute.
Syntax:
if(condition) {
block1 of code;
}

if Statement Example: 
<?php
if ($15 > $10)
echo “15 is greater than 10”;
?>

Output:
15 is greater than 10

2. PHP if…else Statement

In PHP, if a statement is executed only when a specified condition is true. It evaluated to its Boolean values. If the condition is FALSE, it’ll ignore it.
Syntax:
if(condition) {
block1 of code
}else {
block2 of code
}

if - else Statement Example: Find a largest number between two numbers using if else statement;
<?php
$first_value = 5;
$second_value = 10;
if($first_value > $second_value) {
echo “$first_value is greater than $second_value”;
} else {
echo  “$second_value is greater than $first_value”;
}
?>
Output:
10 is greater than 5

3. PHP if….elseif….else Statement 

With this statement, you can select one of several blocks of code to be executed.
Syntax:
if (condition)
first blockto be executed if condition is true;
elseif (condition)
Second block to be executed if condition is true;
else
final block to be executed if condition is false;
if -else if else statement Example:
<?php
$d = date("D");
if($d == "Thu"){
echo "Have a nice weekend!";
} elseif($d == "Sun"){
echo "Have a nice Sunday!";
} else{
echo "Have a nice day!";
}
?>

Output:
Have a nice day!

4. PHP Switch Statement

It is like IF statements. If you want to select one of several blocks of code to be executed, use the Switch statement.
Syntax:
switch ( )
{
case1
break;
case2
break;
default:
default code
break;
}
?>

PHP Switch case Statement Example:
<?php
         $d = date("D");

         switch ($d){
            case "Mon":
               echo "Today is Monday";
               break;

            case "Tue":
               echo "Today is Tuesday";
               break;

            case "Wed":
               echo "Today is Wednesday";
               break;

            case "Thu":
               echo "Today is Thursday";
               break;

            case "Fri":
               echo "Today is Friday";
               break;

            case "Sat":
               echo "Today is Saturday";
               break;

            case "Sun":
               echo "Today is Sunday";
               break;

            default:
               echo “which day is this ?";
         }
      ?>

Output:
Today is Wednesday

Friday, December 21, 2018

Introduction to Control System Design and its Classification

What is Control System?

A control system is a group of mechanical or electronic devices that regulate alternative devices or systems using control loops. Typically, control systems are computerized.
Control systems are a central a part of the business and automation. The kinds of control loops that regulate these processes represent industrial management systems (ICS) like superior management and knowledge acquisition (SCADA) and distributed management systems (DCS).

Introduction to Control System Tutorial

Uses of Control systems are won’t enhance production, potency, and safety in several areas, including:

  • Agriculture
  • Chemical plants
  • Pulp and paper mills
  • Quality management
  • Boiler controls and powerhouse
  • Nuclear power plants
  • Environmental management
  • Water treatment plants
Control System Tutorial

There are two types of control system:

1. Open loop control system:  Its operation is incredibly easy, once a signal directs the control component to response, an output is going to be made. Samples of the open loop control systems include laundry machines, light-weight switches, gas ovens, etc.

Open Loop Control System | Thetechunknown
A washing machine is an example of an open loop system. The input and output of an open loop system area unit unrelated. An example is that the operation of a washing machine doesn't rely on the cleanness of the garments, however instead on this time. Each the structure and therefore the control method of an open loop system area unit are natural. However, the results of the output depend on whether the signal is suitable or not.

2. Closed loop control system: Sometimes, we tend to could use the output of the system to regulate the input. This can be referred to as feedback. Feedback could be a unique feature of a closed-loop system. A closed-loop system compares the output with the expected result or commands standing; then it takes appropriate management actions to regulate the input. Therefore, a closed-loop system is usually equipped with a sensing element, that is used to observe the output and compared it with the expected output.

Close loop Control System

One advantage of using the closed-loop system is that it will modify its output mechanically by feeding the signal back to the input. Once the load changes, the error signals generated by the system can adjust the output. However, closed-loop system management systems square measure typically a lot of complicated and so dearer to form.

Classification of Control System: 

Some popular Classifications of Control System are as Follow:
1. The equation of research and style, as Linear & Non-linear system.
2. the sort of the signal, as Time variable, Time-variant, Continuous information, distinct information systems, etc.
3. the kind of system parts, as Electro-Mechanical, Hydraulic, etc.,
4. the most purpose, as a Position management system.

Linear and Non-Linear systems:  A control system is linear if the principle of superposition applies to it. In actual track most of the systems area unit non-linear as a result of the saturation, friction, dead zone, etc. Most of the physical systems area unit non-linear to a certain extent.
Time varied & Time-Invariant System: whereas operative an effect system. If the parameters area unit unaffected by the time, then the system is named Time variant system. Most physical systems have parameters dynamic with time. 

Discrete information systems: If the signal isn't unendingly varied with time however it's within the type of pulses. Then the system is named distinct information system.

Continuous information systems: If the obtained at a varied a part of the systems area unit varied unendingly with time, then the system is named continuous information management systems. 

Adaptive management System:  In some control system, specific parameters area unit either not constant or vary in an unknown manner. If the parameters variations are more significant or rapid, it may be desirable to design for the capability of continuously measuring them & changing the compensation, so that the system performance criteria can always be satisfied. This is called Adaptive control system.

Optimal  Control system: optimum management system is obtained by minimizing and increasing the performance index. This index depends upon the physical network.
Single variable system: In the straightforward order there'll be one input & one output such system is named Single variable management system.
Multi-Variable system: In multivariable management system there'll be over one input & correspondingly additional output.

Monday, December 17, 2018

An Ultimate Guides to Garbage Collection in Java

What is Garbage Collection in Java?


Java garbage collection is the method by that Java programs accomplishes automatic memory management. Java programs compile to bytecode which will be run on a Java Virtual Machine. Once Java programs run on the JVM, objects are created on the heap, which is a share of memory dedicated to the program. Ultimately, some objects cannot be required. The garbage collector finds these unused objects and deletes them to liberate memory.

Java garbage collection

When there are not any references to an object, it is assumed to be now not required, Also, the memory, obtained by the purpose can be rescued. There is no specific necessity to destroy an object as Java handles the de-allocation by itself.
The technique that accomplishes this is often called Garbage Collection. Programs that don’t de-allocate memory will eventually crash once there’s no memory left within the system to assign. These programs are said to have memory escapes.

Why we perform Garbage Collection in Java?

The purpose of garbage collection is to spot and discard objects that are not any longer required by a program, so their resources are saved and reused. A Java object is a focus to garbage collection once it becomes inaccessible to the program within which it’s used.

How Java Garbage Collection Works?

Many people assume garbage collection collects and discards dead objects. But, in Java garbage collection is doing the differing! Live objects are followed and everything else chosen garbage. As you will see, this basic misunderstanding will result in several performance issues.

Let's begin with the heap that is that the space of memory used for dynamic allocation. In most configurations, the package allocates the heap in before to be managed by the JVM whereas the program is running. 

This includes several important complications:
Object creation is quicker as a result of world synchronization with the package isn’t required for every single object. An allocation claims some area of a memory array and transfers the offset pointer forward. The next assignment starts at this offset and requests the next portion of the array.
When an object is not any longer used, the garbage collector retrieves the underlying memory and recycles it for future object allocation. This implies there is no specific deletion and no memory is given back to the operating system.

All objects are allotted on the heap area managed by the JVM. Every item that the uses by the developer is treated in this manner, organized with class objects, variables, and even the code itself. If an object is being documented, the JVM considers it active. Once an object is no longer documented and therefore is not approachable by the application code, the garbage collector removes it and retrieves the unused memory.

Garbage Collection Example in Java:

public class Example1{   
   public static void main(String args[]){  
        /* Here we are purposely assigning a nullvalue to a reference*/
Example1 obj=new Example1();  
obj=null; 
        /* Here we are purposely assigning reference a to another reference b*/
Example1a = new Example1();
Example1b = new Example1();
b = a;
System.gc();  /* representing garbage collection by calling this*/
   }  
   protected void finalize() throws Throwable
   {
        System.out.println("Garbage collection is performed by JVM");
   }
}
Output:
Garbage collection is performed by JVM
Garbage collection is performed by JVM

In this example, we are representing the garbage collection by calling System.gc(). During this example, we have overridden a finalize() method. This method is invoked directly before an object is destroyed by java garbage collection method. This is often the motive you would see within the output that this technique has been invoked double.


Wednesday, October 24, 2018

Introduction to Python Programming

What is python?

Python is an object oriented programming language. It is easy to understand and a high level language. Python was developed by  Guido Van Rossum” .  
Python Programming Tutorial

Statements in Python language: like the other languages python also included if statement, while loop, for loop, do while loop, continue statement , pass statement , break statement etc.
Use of python : python is used for web development, software development, system scripting.
Creation of a variable in python: to create a variable  python doesn’t have any command.

EXAMPLE for creating a variable :
x = 5
y = "VISHANK"
print(x)
print(y)

Simple example of python program :

x = 4 # x is of type int
x = "Sally" # x is now of type str
print(x)

Operators in python : Python has some operators like the other languages. And these are as follows-
1.)    Arithmetic operators :  these  are the operators by which we can do the arithmetic operations. These operators are –
a.)    addition (+)
Example : a+b;
b.)    Subtraction :  (-)
Example : a-b;
c.)     Multiplication:  (*)
Example: a*b;
d.)    Division  (/)
Example : a/b;
e.)    Modulus : (%)
Example : a%b;
f.)     Exponentiation (**)
Example : a**b;
g.)    Floor division (//)
Example : a//b;
2.)    Assignment operator:  with the use of these operators we can assign the values.
a.)    = 
Example: x=a;
b.)    +=
Example : x=x+a;
c.)     -=  
Example : x=x-a;
d.)    *=
Example : x=x*a;
e.)    /=
Example : x=x/a;
f.)     %=
x=x%a;
g.)    //=
Example : x=x//a;
h.)    **=
Example : x=x**a;
i.)      &=
Example : x=x&a;
j.)       |=
Example : x=x|a;
k.)    ^=
Example : x=x^a;
l.)      >>=
Example : x=x>>a;
       j.)     <<=
               Example : x=x<<a;
3.)    Comparison  operator : with the help of these operator we can compare the values.
a.)     Equal (==)  example: a==b;
b.)    Not equal (!=)  example: a!=b;
c.)     Greater then (>)  example: a>b;
d.)    Less then (<)  example: a<b;
e.)    Greater then or equals to (>=)  example : a>=b;
f.)     Less then or equals to (<=)  example : a<=b;
4.)    Logical operators : are the operators which help to combine the conditional statement.
a.)    And :  it returns true if both conditions are true.
Example:  x>a and x<b;
b.)    OR : it returns true if one of the statement is true.
Example : x>a or x<b;
c.)     Not : it reverse the result.
Example : x>a not x<b;
5.)    Identity operators:  these operators are used to compare the object. If they have the same object.
a.)    Is :  it returns true if both variables have the same object.
Example : x is y;
b.)    Is not : if both variable have the same object.
Example : x is not y;
6.)    Membership operator : are the operators tests  if a sequence presented in an object.
a.)    In : Example: a in b;
b.)    Not in : a not in b;
7.)    Bitwise operators : are used to compare binary numbers.
These are as follows

               AND,OR,XOR ,NOT,Zero fill left shift, and Signed right shift.

Monday, September 10, 2018

A Beginners Guide to Blockchain Technology

What is Blockchain Technology?


Blockchain technology is one of the most promising innovations in cybersecurity. ensures that data is 100% trustworthy. Originating from the mind of an unknown creator using the pseudonymous name, Satoshi Nakamoto, blockchain was initially adopted in 2008 to enable the digital currency, Bitcoin.
Just in case you have never heard of this before, Blockchain is what powers the crypto-currencies, like the Bitcoin. While Bitcoin has been a hotly debated topic around the globe, its widespread popularity has largely been because of its involvement with money. But in case you think that Bitcoin is in itself a revolutionary technology, you are wrong on many levels. Primarily because it is not Bitcoin that translates into a ‘path-breaking technology’ but Blockchain.

In essence, Bitcoin is a very small, but an important application of the Blockchain technology. Bitcoin is not Blockchain. The blockchain is now unveiling its potential to the world, exhibiting promise in many different services and industries.

A blockchain consists of a single block that is replicated and continuously updated across many different computer servers. Because there are many copies of the block, no single party can alter its contents, rather the block must be updated with all servers agreeing on the transaction. This makes fraud nearly impossible and makes a blockchain a secure and transparent method of facilitating online transactions. The data in the blockchain is a collection of all chronological transactions, with no transaction ever forgotten. The copies of the blockchain are stored identically and sequentially on many computers, known as nodes, worldwide. The traffic between nodes is encrypted.
In an interview with the Director of IBM Blockchain Labs, Nitin Gaur gave a description of blockchain technology and its potential: “We are trying to address the problem of time and trust. ...Blockchain to me is the value of back and forth [with] an implied sense of trust ...which enables faster transfer speed.” By building a network that contains trust, blockchain eliminates the need to verify, which facilitates a faster, better and cheaper way to transfer value.

Tuesday, August 7, 2018

A Beginners Guide to Apache Ant Tutorial Step by Step

Introduction to Apache Ant Tutorial



Ant stands for "Another Neat Tool". It is a general purpose build tool. This build tool is based on java from Apache Software Foundation. Apache Ant's build files are written in XML and they take benefit of being an open standard, portable and easy to learn.

Apache Ant Tutorial

What is Apache Ant?

Ant was the first build tool, the reason to build this tool is that created for building Java applications. It is used for building and deploying Java projects but can be used for every feasible repeated task, e.g. generating documentation.

Ant is a cross-platformed and open source project which provides source code, blueprints, and documentation freely available to all the developers. And it provides the facility to users to extend the project by creating their own “antlibs”. Immediately, it became popular as a build tool between Java developers. Ant was created because of a number of problems with Unix's and it was a good replacement for the "Make" build tool of Unix. It included with most modern IDEs such as IntelliJ IDEA, Eclipse, and Net Beans.

The main difference between Ant and Make is that Ant uses the XML file to define the code build process and its dependencies, On the other hand, Make uses the Makefile format. The XML file is named build.xml by default.

Ant was designed by James Duncan Davidson (also the author of Apache Tomcat) and was released as a stand-alone product in July 2000. When he was working in Sun Microsystems for creating JSP and Servlet engine, Apache Tomcat was created before Ant. Apache ANT is a very powerful build tool it can deploy easily, integrates with the database and provide help in email & sound notifications of the building project.

Features of Apache Ant:

There are many Features of Apache Ant are as follow:
  1. Ant is the complete Java build and deployment tool and can compile Java-based applications.
  2. Ant is a platform-independent build tool and can handle platform specific properties such as file separators. The only demand for this build tool is JDK.
  3. Ant can easily create war, jar, zip, tar files and gives an interface to develop custom tasks.
  4. Ant can copy files to at different locations and can easily delete or move files from one location to another.
  5. This build tool provides a broad range of tasks that fulfills all the build requirements of the user.
  6. Ant build tool is written in Java and the source code is freely available, and it provides the facility to users to extend the project by creating their own “antlibs”.
  7. Ant is easy to learn because its scripts are written using plain XML. You can learn quickly if you already know little about XML.
  8. Ant can easily integrate with free and commercial IDEs it can be simply invoked from the command line.


Saturday, August 4, 2018

What is SERP in SEO?

What Does SERP Means?


Search Engine Results Page is the Full Form of SERP. SERP is a Page display by Search Engine.  Another way a list results display on the page by any search engine like Google, Yahoo, Bing, Yandex, Baidu etc.
What is SERP in SEO?


For example : If you are searching a query on any Search Engine so Search Engine display a results related to your query on this page that is called SERP (Search Engine Results Page).

SERP Contains three types of Results : 
  1. Paid Results : Paid Results are those results which are comes from Search Engine Marketing (SEM) like as Google Ads.                                                                                               
    Difference between Organic Results and Paid results
  2. Organic Results : Organic search is based on unpaid, natural rankings determined by search engine algorithms, and can be optimized with various SEO practices. In contrast, paid search allows you to pay to have your website displayed on the search engine results page when someone types in specific keywords or phrases. The fee you pay is based on either clicks or views of your ads.                                                       
  3. Business Listing: Get your free business listing on Google My Business to start building visibility in Google Maps and Google Search in your local community.
Google Business Listing


Saturday, July 28, 2018

SEO Tutorial for Beginners

What is SEO (Search Engine Optimization) ?

Search Engine Optimization is the Full form of SEO. Basically, SEO is one kind of Internet Marketing Strategy; it will help a website to rank higher in search engine result pages.

SEO is a process to Optimize the Website to improve the Websites SERP (Search Engine Results Page) Rankings. It's often referred to as "Organic", "Natural", or "Free" results.

seo tutorial for beginners | what is seo

SEO helps to ensure that a site is accessible to a search engine and improves the chances that the site will be found by the search engine. SEO is typically a set of "white hat" best practices that webmasters and Web content producers follow to help them achieve a better ranking in search engine results.

SEO includes On-Page & Off-Page activities to increase search ranking. 


On-Page SEO means optimization over your own Website. 
Off-Page SEO means optimization over external websites which links to your Website.


Thursday, July 19, 2018

Getting started with Android

What is Android?

Android is a Mobile Operating system. It is Most  Popular Linux-based mobile phone operating system. It  is developed by Google. It is a open Source software. Initially founded by Andy Rubin in October 2003 and later acquired by Google on August 17, 2005.

what is android?
Image Credit : Google
Android offers a unified approach to application development for mobile devices which means developers need only develop for Android, and their applications should be able to run on different devices powered by Android.


The first beta version of the Android Software Development Kit (SDK) was released by Google in 2007 where as the first commercial version, Android 1.0, was released in September 2008.


The Android OS consists of numerous Java applications and Java core libraries running under the Java-based object oriented application framework and the dalvik virtual machine in android. Dalvik is integral for the Android to run in mobile devices as these systems are constrained in terms of processor speed and memory.

The Android software itself is developed in conjunction with Google, who releases major updates to the platform every year. Manufacturers which run Android on their phones include Samsung, Huawei, Sony, Lenovo, HTC, LG and many others; it's currently operational on more than one billion devices.


Features of Android      

Features of Android
Image Credit : Google



·         Simple UI
·         Connectivity
·         Messaging
·         Media Support
·         Multi-tasting
·         Multi Language
·         Wi-Fi Support
·         Android Beam
·         Bluetooth
·         Calling
·         GSM Technology
·         Snapshot


·         Tethering

Wednesday, July 4, 2018

Introduction to SQLite

Android SQLite Database Tutorial


SQLite is a reliable and fully featured, SQL database engine. It is a light weight relational database management system in terms of setup and required resource.

It is an embedded database software that stores local/client in application software. Unlike other databases, SQLite doesn't require any configuration. Thus, it is a zero-configured database.


sqlite android database




Applications of SQLite

Some applications that uses SQLite are as follows:
  • Adobe
  • Apple
  • Bosch
  • McAfee
  • Skype


Advantages of SQLite

There are 5 advantages of SQLite are as given Below:
  • Serverless - It doesn't required server to access the database files.
  • Common table expression - SQLite supports common table expression that represents temporary named result set.
  • Portable - It's applications can be used in all operating systems.
  • Light weight - It is light weight database, so it can be used easily with various devices.
  • Public Domain - The source code of SQLite is in public domain that puts down the claim of any copyright.

Disadvantages of SQLite

  • Limited access of database – In most cases, the size of database is restricted up to 2 GB.
  • Unsupportive for Multi-user application – The performance of SQLite degrades when same database is accessed by multiple clients simultaneously.  







Saturday, June 30, 2018

Introduction to MySQL

What is MySQL?


MySQL is world's most popular open source relational database management system (RDBMS). It provides secure and effective way to manage your database applications.
What is mysql

MySQL is developed and supported by Oracle. It is an important component of web application software stack known as LAMP (Linux, Apache, MySQL, PHP/Perl/Python).


Applications of MySQL

Some applications that uses MySQL are as follows:
  • Joomla
  • YouTube
  • Google
  • facebook
  • Twitter

Advantages of MySQL

Some advantages of MySQL are as follows:
  • Open source – MySQL comes under open source license. So, it is free to use.
  • Cross-platform- It consists of simple and robust pre-defined commands.
  • Support Unicode It supports Unicode standard to express world's most languages. 
  • Cache query  It stores the cache data to serve future requests faster.


Disadvantage of MySQL

Some disadvantages of MySQL are as follows:
  • Degradation of performance- The performance of MySQL degrades when it deals with large size data.
  • Stability issue- Still, MySQL is not capable to handle certain functions such as transactions and auditing.
  • Hard to scale – It faces problem to handle lot of operations simultaneously. 

Monday, June 25, 2018

Difference between HTML and XML

What is the difference Between HTML and XML?

What is HTML?

HTML stands for Hyper Text Markup Language. HTML defines the structure of the webpage by its tags. Tags are the basic building block of webpage. HTML is used to display data on the webpage. HTML is a data presentation technology. Browser displays the page by rendering the HTML tags. 


There are different tags constitutes the webpage like “title”, “paragraph”, ”heading”, “table” etc. The author of the HTML page uses these tags to build the HTML page. Author cannot make their own tags.  The tags of HTML are not case sensitive. The HTML tags have fix set of attributes. Author cannot define their own attributes. HTML does not preserves white spaces. HTML pages are static in nature. We use different technologies like CSS, JavaScript etc. to make HTML pages dynamic.

HTML tags also contain event attributes. These event attributes give some dynamic nature to the webpage. Actually the events have some JavaScript method attached which is executed on the occurrence of that event. Some of the events are like “onload” “onerror”, “onresize” etc.


difference between html and xml

What is XML?

XML stands for eXtensibleMarkup Language. It is designed to store and transport data form one application to another.

The XML is also used to send data from one platform to another. XML author’s defines their own tags. By using the tag, data is represented. The XML representation of data can be read by different applications. This makes data Independent from the application. The tags of the XML are case sensitive



We can also define our own attribute of the XML tags. The data is represented by these attributes and tags combined. XML is not a programming language. XML represents only data which can be used by the program. The program has its presentation layer to represent this XML representation of the data.



New Internet languages like XHTML, WSDL, SMIL etc. are created using XML.

XML is also used as deployment descriptors (web.xml).XML is dynamic since it transports data to different applications.XML preserves the white spaces.



When we define XML, there are some rules to follow. The XML document should contain only one root element. The elements we defined are to be closed properly. Proper ordering should be maintained while closing the tags.The first child tag should be closed before the parent tag. The tags are case sensitive. The attributes value must be quoted. If multiple whitespace is present in tag, it is converted to single whitespace.