We provide complete mobile and web apps development solutions

Monday, August 27, 2012

Thread LifeCycle

Life Cycle of Thread :

thread's life cycle consists of five states:


New Thread : When an instance of a thread class is created, a thread enters the new thread state.        Thread newThread = new Thread(this);
                     You have to invoke the  Start( ) to start the thread.  ie, newThread.Start( );

Runnable : when the Start( ) of the thread is invoked the thread enters into the Runnable State.



sleep(long t);    where t= no: of milliseconds for which the thread is inactive.
The sleep( ) is a static method because it operates on the current thread.

Dead : A thread can either die natuarally or be killed.
A thread dies a natural death when the loop in the Run( ) is complete.
Assigning null to the thread Object kills the thread.
If the loop in the Run( ) has a hundred iterations , the life of the thread is a hundred iterators of the loop.

IsAlive( ) : it is used to determine wheather a thread has been started or stopped. If isAlive( ) returns true the thread is still running otherwise running completed.

Thread Priorities : are used by the thread scheduler to decide when each thread should ne allowed to run.To set a thread priority, use te setpriority( ), which is a member of a thread.
     final void setpriority(int level)     - here level specifies the new priority seting for the calling thread.

   The value level must be with in the range :-
 MIN_PRIORITY  is  1
 NORM_PRIORITY is  5
 MAX_PRIORITY  is  10

Tuesday, August 21, 2012

GPS – Android


 LocationManager class provides the access to  know the location of the mobile. It will provide the current geo location to the user.
Here no need to instantiate the class directly, instead you can use Context.getSystemService(Context.LOCATION_SERVICE)

Android provides the   android.location package which provides the API to determince the current geo position.

LocationProvider is a super class of different location providers, which  will provide the current geo location.

We can get the location by using three methods,

Network  -  uses mobile network,wifi
Gps      -  uses mobile gps to find the location via satellites.
Passive  - allows to participate for getting location on other components to save the power.

To use the gps service in our android mobile, we need to declare permission in manifest file:


ACCESS_FINE_LOCATION
<uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION”/>

If your getting location by gprs we  need to declare
ACCESS_COARSE_LOCATION
android.provider.Settings class provides to change the gps settings

LocationManager service = (LocationManager)getSystemService(LOCATION_SERVICE);
boolean enable = service.isProviderEnabled(LocationManager.GPS_PROVIDER);

We can check the gps enabled  by using if, else conditions
if (!enable)
 enable the gps by going to mobilesettings.

If we use  intents, we can directly goes to gps settings
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
Some constant methods:
public static final String GPS_PROVIDER
name of the gps provider. This will provide the location updates using satellites.
public static final String KEY_PROVIDER_ENABLED
it will hold the Boolean value when a provider enabled/disabled event is broadcast using a Pending Intent.
public static final String PROVIDERS_CHANGED_ACTION
Broadcast intent action when the configured location providers change.


Some public methods:
public GpsStatus getGpsStatus(GpsStatus status)
it will gives the information about current gps status.

Public LocationProvider getProvider (String name)
It gives the information associated with location provider of the given name
public Boolean isProviderEnabled(String provider)
Returns the current enabled/disabled status of the given provider.



public class MainActivity extends Activity implements LocationListener {

    TextView txtInfo;

    LocationManager lom;

    StringBuilder sb;

    int noOfFixes = 0;


    /** Called when the activity is first created. */

    @Override

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

       

      //TextView to display gps data

        textdata = (TextView) findViewById(R.id.textView1);

       

        /* the location manager is the most vital part it allows access

         * to location and GPS status services */

        lom = (LocationManager) getSystemService(LOCATION_SERVICE);

    }

   

    @Override

    protected void onResume() {

      

       //  request updates every 1000ms or 10m

        

        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 100f, this);

        super.onResume();

    }

   

    @Override

    protected void onPause() {

        /* GPS, as it turns out, consumes battery like crazy */

        lm.removeUpdates(this);

        super.onPause();

    }


    public void onLocationChanged(Location location) {

        Log.v(tag, "Location Changed");


        sb = new StringBuilder(512);

       

        noOfFixes++;


        /* display the data in the TextView */


        sb.append("No. of Fixes: ");

        sb.append(noOfFixes);

        sb.append('\n');

        sb.append('\n');


        sb.append("Londitude: ");

        sb.append(location.getLongitude());

        sb.append('\n');


        sb.append("Latitude: ");

        sb.append(location.getLatitude());

        sb.append('\n');


        sb.append("Altitiude: ");

        sb.append(location.getAltitude());

        sb.append('\n');


        sb.append("Accuracy: ");

        sb.append(location.getAccuracy());

        sb.append('\n');


        sb.append("Timestamp: ");

        sb.append(location.getTime());

        sb.append('\n');


        txtInfo.setText(sb.toString());

    }


    public void onProviderDisabled(String provider) {

        /*when the GPS is disabled in settings */

        Log.v(tag, "Disabled");


     //open gps settings

        Intent intent = new Intent(

                android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);

        startActivity(intent);

    }


    public void onProviderEnabled(String provider) {

        Log.v(tag, "Enabled");

        Toast.makeText(this, "GPS Enabled", Toast.LENGTH_SHORT).show();


    }


    public void onStatusChanged(String provider, int status, Bundle extras) {

        /*  GPS status change */

        switch (status) {

        case LocationProvider.OUT_OF_SERVICE:

            Log.v(tag, "Status Changed: Not in service");

            Toast.makeText(this, "Status Changed: Not in Service",

                    Toast.LENGTH_SHORT).show();

            break;

        case LocationProvider.TEMPORARILY_UNAVAILABLE:

            Log.v(tag, "Status Changed: Temporarily Unavailable");

            Toast.makeText(this, "Status Changed: Temporarily Unavailable",

                    Toast.LENGTH_SHORT).show();

            break;

        case LocationProvider.AVAILABLE:

            Log.v(tag, "Status Changed: Available");

            Toast.makeText(this, "Status Changed: Available",

                    Toast.LENGTH_SHORT).show();

            break;

        }

    }


    @Override

    protected void onStop() {

        /*saving the state is not important for this  app */

        finish();

        super.onStop();

    }

}




activity_main.xml


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent" >


    <TextView

        android:id="@+id/textView1"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_alignParentLeft="true"

        android:layout_marginLeft="68dp"

        android:textSize="40sp"

         />


</RelativeLayout>


we need to declare gps permission in manifest.xml


<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.example.gps"

    android:versionCode="1"

    android:versionName="1.0" >


    <uses-sdk

        android:minSdkVersion="8"

        android:targetSdkVersion="15" />


    <application

        android:icon="@drawable/ic_launcher"

        android:label="@string/app_name"

        android:theme="@style/AppTheme" >

        <activity

            android:name=".MainActivity"

            android:label="@string/title_activity_main" >

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />


                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

        </activity>

       

    </application>

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

</manifest>


Introduction To Object Oriented Programming

Java is a programming language for developing enterprise applications.
This language is evolved from Oak. It was developed by Sun Microsystems.
 Object-oriented programming  is a programming  uses "objects" and their interactions to design applications and computer programs.

Any OOP must support the following features.
1.Abstraction
2.Encapsulation
3.Inheritance 
4.Polymorphism   

Before going through all these, first learn
 What is  a class?
What is an Object?
Class
class is the blue print from which an individual objects.
or simply we can say
A class is a collection of related data and related methods.

Object
Instance of the class is known as Object.

i.e when we create an object memory will be assigned.
for example an engineer will give a plan to construct a building. With that plan, a constructor will build multiple buildings.

here plan is the class and its not existed really.

building is an object and it exists really.
Lets see the OOPS features:

Abstraction:  Showing the essential and hiding the non-Essential is known as Abstraction.

 

Encapsulation: The Wrapping up of data and functions into a single unit is known as Encapsulation.

     Encapsulation is the term given to the process of hiding the implementation details of the object. Once an object is encapsulated, its implementation details are not immediately accessible any more. Instead they are packaged and are only indirectly accessed via the interface of the object.

 

Inheritance: is the Process by which the Obj of one class acquires the properties of Obj’s another Class.

 A reference variable of a Super Class  can be assign to any Sub class derived from the Super class.

         Inheritance is the method of creating the new class based on already existing class , the new class derived is called Sub class which has all the features of existing class and its own, i.e sub class.

Advantages: Reusability of code , accessibility of variables and methods of the Base class by the Derived class.

 

Polymorphism: The ability to take more that one form, it supports Method Overloading &  Method Overriding.


Friday, August 3, 2012

Mphasis Hiring Freshers in Hyderabad

Experience: 0 to 1 yrs

Shift: 24/7

Role: L1 - Infrastructure Support Engineer

Exp:  0-6 months

Jobdescription:
1) Bachelors degree in any technical stream with minimum of 60% on aggregate/ BSc Computers / BCA
2) Good Communication Skills
3) Knowledge on Operating Systems.
4) Knowledge on MS Office Suite
5) Willing to work in 24*7 shifts

Responsibility:
1) Patching and Remediation on Wintel, Unix (Solaris, AIX and Linux)
2) Performing Prechecks
3) Performing Post Checks
Company Profile
MphasiS Limited
http://www.mphasis.com
Grow and Win with MphasiS MphasiS consistently delivers Applications services, Infrastructure services, and Business Process Outsourcing (BPO) services globally through a combination of technology knowhow, domain and process expertise. We are over 40,000 professionals servicing clients across Banking & Capital Markets, Insurance, Manufacturing, Communications, Media & Entertainment, Healthcare & Life Sciences, Transportation & Logistics, Retail & Consumer Packaged goods, Energy & Utilities, and to Governments around the world. Our Differentiators * A company driven by ethics and strong values * Transparent working environment, flat, non-hierarchical structure and open door policy that promotes free flow of ideas, opinions, information and expertise * Provides a plethora of equal growth opportunities to all Mphasians * Fair recognition for performance and hard work * Conducive work place with easy accessibility for those with special needs * Building a better tomorrow by grooming our current leaders for the next level of leadership * Attract and retain individuals exhibiting talent in every possible perspective

 

 

Deloitte hiring freshers

Business Technology Analyst

Location:

  • Hyderabad, Andhra Pradesh

  • Delhi, Delhi

  • Bengaluru, Karnataka

  • Mumbai (Bombay), Maharashtra

Firm Service: Consulting

Reference Code: S14HCBTAST-MIT Mani

Type of Position: Full-time

 Apply here

http://careers.deloitte.com/jobs/eng-us/details/j/S14HCBTAST-MIT%20Mani/business-technology-analyst&src=JB-1112

Wednesday, August 1, 2012

NexWave, Logica,Lanxess,ENERCON Freshers openings 2011, 2012 B.Tech, B.E

NexWave Talent Management Solutions Private Limited hiring Freshers -2012

 Job Description

  • Any Engineering / MCA  Graduate with Good Programming Knowledge

  • 2012 Pass Outs are Only Preferred

  • Minimum 70% marks in X and XII/Minimum 65% in Graduation    

Selection Process & Program Cycle

Group Discussion 

Assessment Test 

 Self Sponsored Program 

Final Client Assessment  &  Deployment at Client's Location as Software Engineers

Apply here:

http://www.nexwave.in/register.html

 

Logica Pvt Ltd

Support -Fresher 2011/2012

Job Description

Analysts will perform:

v  Almost zero touch installations of Operating system (OS)

v  Deployments and upgrades to OS

v  Package Images of software (as per client’s requirement)

v  Software auditing and license management

v  IT Asset management services

v  Patch management


v  Desktop Security solutions


Looking for 2011/ 2012 Fresher - BSc, BCA, BA, BCom, BBM, 3 years Diploma after 10th or 12th Std with 60% aggregate throughout  Academics (X, XII, Graduation, Diploma). Contract position.

 send resumes to:


careersin@logica.com

 Lanxess India Pvt. Ltd 

Trainee - Java- Only Mumbai Candidates With 2012 Passout

Recruiter Name:

Ms. Neethi Srinivasan

Contact Company:

Lanxess India Pvt Ltd

send resumes to:

neethi.srinivas@lanxess.com

 

ENERCON hiring Icwa Fresher - 6 Opening(s)

 Experience 0 - 2 Years 

Industry Type Oil and Gas, Energy, Power, Infrastructure

Location Bengaluru/Bangalore, Hyderabad / Secunderabad, Pune, Tirunelveli, Vadodara/Baroda, Jaisalmer  


apply here:

http://jobsearch.naukri.com/job-listings-Icwa-Fresher-Enercon-I-Ltd-Bengaluru-Bangalore-Hyderabad-Secunderabad-Pune-Tirunelveli-Vadodara-Baroda-Jaisalmer-0-to-2-310712000897?xz=1_0_2&xo=&xp=43&xid=134381926143313400&qp=&id=7437011371b37004475c49f59cde8780d2876a3f3a72ccd426d62b7ee22c459c|X|Y|X|E&f=-310712000897

 

 

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts