Explore

Loading

Wednesday, March 7, 2012

Which should I use, BSD or Linux?

What does this all mean in practice? Who should use BSD, who should use Linux?
This is a very difficult question to answer. Here are some guidelines:
  • “If it ain't broke, don't fix it”: If you already use an open source operating system, and you are happy with it, there is probably no good reason to change.
  • BSD systems, in particular FreeBSD, can have notably higher performance than Linux. But this is not across the board. In many cases, there is little or no difference in performance. In some cases, Linux may perform better than FreeBSD.
  • In general, BSD systems have a better reputation for reliability, mainly as a result of the more mature code base.
  • BSD projects have a better reputation for the quality and completeness of their documentation. The various documentation projects aim to provide actively updated documentation, in many languages, and covering all aspects of the system.
  • The BSD license may be more attractive than the GPL.
  • BSD can execute most Linux binaries, while Linux can not execute BSD binaries. Many BSD implementations can also execute binaries from other UNIX like systems. As a result, BSD may present an easier migration route from other systems than Linux would.

What is BSD?

BSD stands for “Berkeley Software Distribution”. It is the name of distributions of source code from the University of California, Berkeley, which were originally extensions to AT&T's Research UNIX operating system. Several open source operating system projects are based on a release of this source code known as 4.4BSD-Lite. In addition, they comprise a number of packages from other Open Source projects, including notably the GNU project. The overall operating system comprises:


  • The BSD kernel, which handles process scheduling, memory management, symmetric multi-processing (SMP), device drivers, etc.
    Unlike the Linux kernel, there are several different BSD kernels with differing capabilities.
  • The C library, the base API for the system.
    The BSD C library is based on code from Berkeley, not the GNU project.
  • Utilities such as shells, file utilities, compilers and linkers.
    Some of the utilities are derived from the GNU project, others are not.
  • The X Window system, which handles graphical display.
    The X Window system used in most versions of BSD is maintained by the X.Org project. FreeBSD allows the user to choose from a variety of desktop environments, such as Gnome, KDE, or Xfce; and lightweight window managers like Openbox, Fluxbox, or Awesome.
  • Many other programs and utilities.


    CREDITS:http://www.freebsd.org/doc/en/articles/explaining-bsd/

Monday, March 5, 2012

Sample android application:Quick Navigator

package com.android.qa;


import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;


public class QuickAccessActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        navigate();
    }
    public void navigate(){
        Button google=(Button)findViewById(R.id.google);
        Button facebook=(Button)findViewById(R.id.facebook);
        Button youtube=(Button)findViewById(R.id.youtube);
        Button twitter=(Button)findViewById(R.id.twitter);
        Button myspace=(Button)findViewById(R.id.myspace);
        Button linkedin=(Button)findViewById(R.id.linkedin);
        Button flicker=(Button)findViewById(R.id.flicker);
        google.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String url="http://www.google.com";
Intent i=new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

}
});
        facebook.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String url="http://www.facebook.com";
Intent i=new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
        youtube.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String url="http://www.youtube.com";
Intent i=new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
        twitter.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String url="http://www.twitter.com";
Intent i=new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

}
});
        linkedin.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String url="http://www.linkedin.com";
Intent i=new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
        myspace.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String url="http://www.myspace.com";
Intent i=new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
        flicker.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String url="http://www.myspace.com";
Intent i=new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
    }
}

//XML code(Layout)
----------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >


    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />


    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.52" >




        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:text="@string/google" />




        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/button1"
            android:layout_marginTop="18dp"
            android:text="@string/facebook" />




        <Button
            android:id="@+id/button3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/button2"
            android:layout_marginTop="26dp"
            android:text="@string/twitter" />




        <Button
            android:id="@+id/button4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:text="@string/orkut" />




        <Button
            android:id="@+id/button5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/button4"
            android:layout_marginTop="24dp"
            android:text="@string/linkedin" />



        <Button
            android:id="@+id/button6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/button5"
            android:layout_marginTop="32dp"
            android:text="Button" />


    </RelativeLayout>


</LinearLayout>

Sunday, February 19, 2012

How to get started with android?

How to get started with android?

Step 1
  • First of all we need a IDE. 
  • I suggest you  to use Eclipse.because it is an industrial standard open source IDE.
  • Install Eclipse.

Step 2

  • Go to developer.android.com and download ADT plug in for Eclipse..
  • You will get a link.Copy the link and  follow the  steps  
  • Help->Install New Software->Work path.
  • Paste the link.

Step 3

  • Check all the options Click next.
  •  Now the ADT plugin is installed in your Eclipse.
  • Next is to download the SDK.
  • Go to developer.android.com, Download the SDK.
Step 4
  •   Go to Window(Eclipse menu)->Preference->Select Android from the left side.->Browse the android location->Means please select the SDK location that you downloaded(Don't forget to extract).
Step 5

  • You need an active internet connection for this.
  • Goto window->select  SDK Manager->Download the latest OS version and API,Because it will include new striking features.

Step 6

  • Now the environment is ready
  • You can start developing applications.
  • Don't forget to install the JDK.


What is android?

Android is a software stack for mobile devices that includes an operating system, middleware and key applications.
Android SDK provides tools for developing android applications using Java programming language. 


Features of android OS



  •        Application framework enabling reuse and replacement of components
  •          Dalvik virtual machine optimized for mobile devices 
  •          Integrated browser based on the open source WebKit engine
  •          Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL  ES 1.0 specification (hardware acceleration optional)
  •          SQLite for structured data storage
  •          Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)
  •          GSM Telephony (hardware dependent)
  •          Bluetooth, EDGE, 3G, and WiFi (hardware dependent)
  •          Camera, GPS, compass, and accelerometer (hardware dependent)
  •          Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE

Android architecture 
 

Thursday, February 16, 2012

Unix Commands


.
6.3. Automating Tasks
Create a Makefile pico Makefile
A makefile consists of macro definitions and targets.
Test Makefile make -n [target]
Run make make [target]
6.4. Managing Disk Usage
Check Quota quota -v
Seeing Disk Usage df
du -s
6.5. Combining and Compressing Files
Create a tarfile tar cf file.tar file1 file2 … fileN
tar combines files but does not compress
Create a zipfile zip filename
Unzip a file unzip filename
7. Printing
7.1 Formatting Output for Printing
Paginate with Page Headers pr filename
in n columns pr -n filename
Format for Laser Printer tex document
7.2 The Printer Queue
Print a File lp [-dpr] filename
lpcae filename
Check Quota lpquot
List Queue lpq
Stop Job lprm
8. Miscellaneous
8.1 Miscellaneous Commands
List Commands for Subject man -k subject
Display Current Date and Time date
Log off exit
Electronic Mail pine
Display Documentation man command
8.2 Control Keys
Abort Program CTRL-C
Backspace (Delete Last Character) CTRL-H
Pause Display on Screen CTRL-S
Resume Display after CTRL-S CTRL-Q
Send Job to Background CTRL-Z followed by bg

Unix Commands


Modifiers
Print Command Line :p
Substitute Command Line :[g]s/l/r/
3.2 Aliases
alias Command alias name 'definition'
definition can contain escaped history substitution event
and
word designators as placeholders for command-line arguments.
3.3. Variable Substitution
Creating a Variable set var
Assigning a Value set var = value
Expressing a Value $var
Displaying a Value echo $var
value is a single word, an expression in quotes, or an
expression that results in a single word after variable,
filename and command substitution takes place.
Assigning a List set var = (list)
list is a space-separated list of words, or an expression that
results in a space-separated list.
Selecting the n'th Item $var[n]
Selecting all Items $var
Selecting a Range $var[x-y]
Item Count $#var
3.4 foreach Lists
Start foreach Loop foreach var (list)
foreach prompts for commands to repeat for each item in
list (with >), until you type end. Within the loop, $var
stands for the current item in list.
3.5. Command Substitution
Replace Command with its Output on Command Line ``
3.6 Job Control
Run Command in the Background &
Stop Foreground Job CTRL-Z
List of Background Jobs jobs
Bring Job Forward %[n]
Resume Job in Background %[n] &
4. Processes
Listing ps [-[ef]]
Terminating kill [-9] PID
Timing time command
time is a number up to 4 digits. script is the name of a file
containing the command line(s) to perform.
5. Users
Seeing Who is Logged In who
w
Seeing Your User Name whoami