Pages

Wednesday 24 August 2016

Android App Development For Beginners - Running application through hardware Device.

Hello everyone,

As we discussed already We can run our Developed Application either through Emulator provided by Android studio or through a Hardware Device(your own Android Device).

If you are not go through the previous tutorials for setting up environment and to develop and run your first android Application. Please go to the below links to read those tutorials

Environmental Set Up
Developing Hello World Application and running through Emulator.

How to Run your Android App through Hardware Device.

1. Enable USB Debugging  in your Android Device.

Go to settings--> Find Developer Options --> find USB Debugging and select that if not selected.

If you are not able to see any option like Developer Options. Just Click on About Device Then Click on Build Number 7 times. Then a message will appear saying Developer option is enable. Now you can developer Options under settings, then select USB Debugging.

2.Connect you Device through USB to your Laptop/Desktop.

3. Install the Drivers if the Drivers are not already present. For drivers you can go to your mobile company website to download USB Drivers for your Device.

4. Click on Run in the header of Android Studio , select Run App then Select your Mobile which will appear in the List.

This will install the apk file in your Mobile. Your Application is ready to test in your Device itself. By this way you can test offline as well.

Please let me know if you are facing any issues.

We will see about Different Layouts in Android in coming Tutorials, then we will look at actual Development.

Thanks.

Monday 22 August 2016

How to Covert Comma separated String into a Array or into a List in java!!

Converting Comma separated String into an Array:


String string = "hello,world,this,is,a,string";
String[] stringArray = string.split(",");  //the separator can be any character


Convert Comma separated String into a List:

String string = "hello,world,this,is,a,string";
String[] stringArray = string.split(",");  //the separator can be any character
List<String> list = Arrays.asList(stringArray);


Can be re written in one line

String string = "hello,world,this,is,a,string";
List<String> list = Arrays.asList(string.split(","));



Android App Development for Beginners - Developing First Android Application

Hello Everyone,

In this tutorial we will see how to create our very first Android Application and how to run that App.

As we have already seen how to do environment setup in your system to start developing your Android Application. If you are not followed that Tutorial , please click the Link below to know about Environment set up for Android Application.

Environmental Setup


Once your JDK is downloaded and Android Studio is installed we are good to start our first Application. So, lets get started.

1. Open Android Studio .Give your Application name and leave the domain and location to the default values. Please find the screenshot below:




2. Select Target Devices as Phone and Tablet. Un select the other options as of now

Please select the Minimum SDK on which your app should run. Better to select Jelly bean as still many android devices running on that version as on 22nd August 2016. Please find the screenshot below




3. Add an Activity to your mobile:

The next page asks for creating an activity. In this page you will see different layouts which you can select. Depending on the Activity you selected the activity_main.xml(Main file for designing) will be designed. So, as of now just select a Blank activity and click next.





4. Customize Activity : Leave the fields to here default values and click Finish.

Once the Android Studio Click on project on the left side to open the project and the 2 important files you need to know as of now is
1.MainActivity.java under java folder and
2. activity_main.xml under res--> layout folder .

Just click on activity_main.xml and and click on Design on the bottom tabs and you will be able to see a mobile showing Hello World.




Now Click on Text tab just beside text tab and Change the Hello World to some text which you like "Hey this is my my android page". Just click design back and you should be able to the new message on the mobile now.

Running Android Application:
1. On the Header of Android studio click on run and run app and create a emulator where you can run the app.

Note: As I said there may be some processors having issue in creating virtual device along with android studio that case you cannot run on Emulator. In that cases you have your hardware device to run the App.

We will see how to do that in next tutorial.We will learn developing new designs for your Android Application in coming tutorials. Stay tuned. Please comment below for any questions on running your first app.

Thank you.


Sunday 21 August 2016

How to Start Android App Development for Beginners - Environment Set up

Hello Everyone,

Looking to develop your own android app? Android is the leading operating system now a days and there are so many many developers out there doing different kinds of apps. Developing Android Apps is not just fun but also rewarding. So, lets get started.

Before moving on to Developing App one thing we should keep in mind you should be aware of at least basic Java Programming, because the coding which we will use for Android is Java.

Before Developing any Application we need to have following set ready in our system to Develop any Android App.

1.Download JDK 1.7

Go to the Oracle Website and download the latest version of Java Development Kit at least Java 1.7.

Make sure you have downloaded the correct version 32 bit or 64 bit depending on what Windows System you are using

Set up your environmental properties.


2. Download Android Studio

Please download the android studio here - Android Studio


Once you have downloaded the Android Studio it will automatically download the SDK for you. Once the download is done , go ahead and install the Android studio in your system. It requires atleast 2 GB of RAM but recommended is 4GB RAM.

Once it is installed you will run the app in a virtual machine which will installed during android studio installation process itself. If you face any issues or error while installing Virtual Machine during Android Studio installation you can ignore that Error. We will see how we can test that app in subsequent tutorials.

Basically, that's it the Environmental set up for Android Studio. Lets see how to develop our first app in coming tutorials. Stay tuned !!

Monday 15 August 2016

OOPS Concepts in Java

In this tutorial we will learn about the OOPS(Object Oriented Programming System)  Concepts.

Before moving into Object Oriented Programming Concepts we will understand the basic topics like Class and Object.


Object :

Object is a  Entity which has state and Behavior is a object.

Object has three characteristics
1. State
2. Behavior
3, Identity - JVM maintains one unique id internally for each Object.

   Example - Fan, Bike, Chair etc..

    Object can be both physical and logical.

Class:

 Class is a logical Entity , it is a collection of objects.

Real time example for Object and class  -

For Example take mobiles like  Samsung, IPHONE . They are the real world entities . They have state and the have behaviors like calling , sending message,playing games etc..

But these all mobiles will come under one Section that is Mobile(Class) . So, Mobile(Generic) is a collection of Different Mobile Brands.


What is difference between object-oriented programming language and object-based programming language?

Object based programming language follows all the features of OOPs except Inheritance. JavaScript and Vb-script are examples of object based programming languages.


Objected Oriented Concepts:

Encapsulation


Definition 
Encapsulation in java is a process of wrapping code and data together into a single unit, for example capsule i.e. mixed of several medicines. Its actually hiding the implementation details

The Java Bean class is the example of fully encapsulated class.

Encapsulation will give the ability to change your code without breaking anyone else code.

How to achieve encapsulation,
1. Keep instance variables protected (Private as Modifier)
2.  Make Methods public. So that developers can call the methods but cant access variables directly
3. For the methods use java bean naming convention like set<someProperty> and get<some
Property>


Please find the below diagram for clear understanding of Encapsulation





You can see in the above picture you can only access methods but cant access the variables directly.

So, what are you trying to achieve here by restricting the access?

In case in future if you want to change the method get Balance methods on some condition you can add your logic there and can return the value to the user.Say we can check the user requesting valid or not depending on that we will send the request back.

So, Encapsulation is Writing your code by hiding the implementation details in such a way that no can break your code in future.


Inheritance


Inheritance is everywhere in Java.Its safe to say almost.

Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object.

By using Inheritance we can use the existing classes and can use there methods and variables in the child classes without actually creating object for it. There are two reasons to use Inheritance
1. Code Reuse
2. To use Polymorphism.

Understanding Inheritance:

Let's say there is a Buffalo Class which has behaviors (methods) like eating Grass, walking, sleeping and also properties like color.

Now there are other two classes WhiteBuffalo and BlackBuffalo. Even they have to eat grass(as all buffaloes have to eat grass :) ) , they have to walk on four legs and sleep. Only difference will be there property COLOR. So, instead of re writing the whole code again in the WhiteBuffalo and BlackBuffalo classes we will re use the code which is written in Buffalo.

We can achieve Interface using extends keyword.

Please look at the below classes code for moments and look at the explanation below :

public class Buffalo{
//some code here
public void eatGrass(){
System.out.println("Buffalo eating Grass"):
}
}

public class BlackBuffalo extends Buffalo{
//some code
eatGrass(); //calling eat grass method in parent class instaed of re wirting the code
}

Here BlackBuffalo Class just extends the Class Buffalo and it is just calling the method eatGrass() in its parent Class instead of writing it again.

There are two types of Inheritance. They are
1. IS-A Relationship (Composition)
2.HAS-A Relationship (Aggregation)



 


Please take a moment by looking at the below code and then description below the code for explanation.

Class Car{
//code for class car
}

Class Maruthi extends Car{
private Engine Engine;
//some code here
}

Class Engine{
//Some code for Engine Class
}

So, after seeing the above classes its very clear that
1. Maruthi  extends Car means Maruthi IS-A Car.
2. Maruthi having a property which refers to other Class Engine. Maruthi HAS-A Engine

Here Engine is not extending the Maruthi but inheritance exists.

Note: We will go for Aggregation(HAS-A) when there no are no parent-child relationship.

Polymorphism


Definition:

Polymorphism in java is a concept by which we can perform a single action by different ways. Polymorphism is derived from 2 greek words: poly and morphs. The word "poly" means many and "morphs" means forms. So polymorphism means many forms.

Example: "+" is used for adding for adding two numbers but the same "+" is used for two string it will do concatination.

1+1 =2;
"Java"+"code"="Javacode";

Coming to java we will use polymorphism on objects.

Remember any Object that can pass one or more IS-A test can be considered polymorphic.

So,its easy to say all objects are polymorhic in Java. Because by default all objects extends Object Class. Any object by default is of its own type and also of Object type.

Example:

Please look at the following code then we will discuss about the code and how the ob ject is polymorphic in detail later:

Interface Vehicle{
//Code for vehicle
}

Class Car {
//code for car
}

Class Maruthi extends Car implements Vehicle{
//code for Maruthi
}

Now if we see the Maruthi Class the followiung points holds tru for that
1. Maruthi IS-A car (Inheritance as it uses extends)
2. Maruthi is also of type Vehicle (Class can extend only call so we made vehicle Interface)
3. Maruthi is of its own type
4. Maruthi is also an Object(By Default all classes extends Object Class)


So, Maruthi is Poymormic and the following declarations are legal look closely

Create a object for Maruthi Maruthi maruthi = new Maruthi();

Object o = maruthi;
Vehicle v = maruthi;
Car car = maruthi;


Overriding:

Anytime when the class extends its super class you have the ability to override the method in your child class(unless the method is marked final). Benifit of overriding is to define the behavior that specific to a particular subclass type.


Example for Overriding:
  public class Animal {
public void eat() {
System.out.println("Generic Animal Eating Generically");
}
}

class Horse extends Animal {
public void eat() {
System.out.println("Horse eating hay, oats, "+ "and horse treats");
}}

If we see in above example, Class Horse can re use the code of eat method of Animal as it extends the class Animal, but we override the method to provide our own implementation to the class Horse for eat method.

Overriding a method is optional but if the super class is of abstract type and having abstract methods then there is no choice you much override the methods. All abstract methods in abstract class must be overridden by the 1st concrete sub class .More details in Abstraction module.

Abstraction

Hiding internal details and showing functionality is known as abstraction. For example: phone call, we don't know the internal processing.
In java, we use abstract class and interface to achieve abstraction.

Abstract Class:
        A Abstract Class should not be instantiated (should not create object), Its sole purpose should be extended.

So, why we want a Class when cant make objects of it?
 Imaging you have Class Car that has all generic properties like price,color and abstract methods like goSpeed(). Abstract method means its just a method without any implementation.

Example for Abstract method:
public abstract void goSpeed();

If you observe the above abstract method it has no implementation and it ends with semicolon.

So, now any new car comes .. we will create a car class like audi and it will extend the Car Class.
So, As we discussed earlier all the abstract methods in abstract class must be implemented by first concrete subclass of the abstract class. So, abstract class will have abstarct methods it means all the methods should be implemented by the subclass of the abstract class.

What if there are multiple Abstract classes we have to extend , but Class can extend only one?

As we know class can extend only one class, if we extend that class we are blocked we cant extend any other classes, this is the reason why we go for Interfaces.

Interface:

Interface in Java is completely abstract . By default all the methods in Interface will be abstract. A Class can implement any number of Interfaces.






Friday 12 August 2016

Python Basics for absolute Beginners

1. What is Python Programming

It is a widely used high-level, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and allows programmers to express concepts in fewer lines of code when comparing other languages such as C++ or Java.

2. How to Use it

Download latest version of Python bundle from https://www.python.org/. Installation steps are pretty simple, you need to follow the steps while installation with the default settings.

Type “python”  on your terminal, to verify your python installation. This will print Python version along with your machine details.

Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Now, you can start your python coding

3. Python Syntax 

To start any block, use : instead of { and indented with same number of space to indicate code for the same block. You will see, when we go through function declaration.

4. Say Hello to Python

To print anything on terminal you need to type “print” and space and your message. Example: 
print “Hello Python”

>>> print "Hello Python”   
Hello Python
>>> 

print became function in Python version 3.x. So, you need to use 

>>> print(“Hello Python”)   
Hello Python
>>>


5. Data Types in Python

  1. String
  2. Number
  3. List
  4. Tuple
  5. Dictionary


6. Variable Declaration and Naming Conventions

A valid variable declaration would be lowercase with underscore(_) between the words and shouldn’t start with number.Example :

my_var = 4  <— valid
8my_var = 5  <— invalid

6.1. How to declare String (Immutable)

name =“AppTech Solution”
str_with_quote=“AppTech Solution’s Tutorial”
str_multi_line=“”” AppTech Solution
Welcomes You”””

6.2. How to declare Number (Immutable)

my_var = 4

6.3. How to declare List (Mutable)

It holds sequences and values are enclosed with square bracket [].

>>> a=[3,5,"Ram"]
>>> print a
[3, 5, 'Ram']
>>> 

6.4. How to declare Tuple (Immutable)

Similar to List, but values are enclosed with small bracket ().

>>> a=("alpha",34,"beta")
>>> print a
('alpha', 34, 'beta')
>>> 

6.5. How to declare Dictionary (Mutable)

Are similar to hash-map and values are enclosed with curly bracket {}.

>>> laptop={}
>>> laptop["hp"]=30000
>>> laptop["dell"]=20000
>>> laptop["acer"]=25000
>>> print laptop["dell"]
20000
>>> print laptop
{'acer': 25000, 'hp': 30000, 'dell': 20000}
>>> 


7. Functions

Function name should not start with numbers and use underscore(_) between the words. Basic syntax is

def function_name(arg):
    body with indentation
    more code here
    some more line
    return    

Example:

def addition(num):
    return num+2

my_num= addition(5)


8. Loops and Condition Controls

The syntax of a while loop in Python programming language is 

while expression :
      statement(s)

Example:

>>> a=5
>>> while(a>1): 
...    print a
...    a-=1
... 
5
4
3
2
>>>

The syntax of a for loop in Python programming language is 

for iter in sequence :
          statement(s)

Example:

>>> for letter in 'Python':     # First Example
...    print 'Current Letter :', letter
... 
Current Letter : P
Current Letter : y
Current Letter : t
Current Letter : h
Current Letter : o
Current Letter : n

Datical - Solution for Automated Database Deployment

The processes and tools available to application developers have advanced exponentially in recent years. And yet the process of implementing and deploying database change has lagged far behind. There is a gap between Data Base code delivery and Code Deployment process. 

There has been a lot of improvement in Application Development life cycle results in faster delivery, easier Deployment with a quality source code. But still there is one part of software development still not changed is Data Base Deployment . Any front end changes we are making are getting deployed faster because of newer tools and process but from the past so many year the process for Data Base deployment remains the same,which is not a good thing creating confusion in developers especially working in Agile methodology.


Challenges faced by development Team :


As there is no proper methodology or process for data base development in many organisations. Lets take a example 2 developers are working on same data base object which will go in 2 different releases in 2 consecutive months.  So, its difficult to maintain and co-ordinate for the 2 developers. Even the the developer who is going for release next month finished his work has to do re work because the same object is modified by 1st developer. 

Datical is the solution for this kind of issues. Datical is a Tool which will make your Data Base Deployment process automated and easier to manage the changes.

How the Database Deployment used to happen before Datical ?

When some Data Base code change is happened in Development region we have to make sure the same code is moved to Testing Environment. If there are any defects identified by tester you have to make enough changes to the Data Base objects and push the code. So, its very difficult to manage all the changes and push the code to Production without missing anything. So what are the disadvantages of using this process.

Disadvantages of using this old process:

1. There is lot of manual work involved for both the developers and DBA Team.
2. This is time consuming process.
3. This process is Risky  as there is lot of chance we may miss some code which should     move to production.
4. Not good for Agile Development having frequent Data Base changes.
5. Reverting the changes is challenge in case of any deployment issues.

How the Database Deployment will happen after using Datical ?

So, now Devops comes to Data Base for both Developers and DBA. It provides End-To-End Automation in your Release Process by Integrating with Jenkins. It will help you to create packages managed by labels. Each separate release will managed by release labels.
So its very easy to maintain changes.  

Advantages of using this Datical:

1. End-To-End Automation.
2. Manual work got reduced.
3. Release process becomes very easy.
5. Easily can revert back the deployment process for any deployment issues.

For more details on Datical. Please visit - Datical