Friday, 20 March 2015
Android Page refresh in 20Seconds
Android Page refresh in 20 seconds
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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginLeft="23dp"
android:text="Button" />
</RelativeLayout>
---------------------------------------------------------------------------------
MainActivity-
package com.example.pagerefresh;
import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity {
Handler handler;
Button b;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b=(Button)findViewById(R.id.button1);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "test", Toast.LENGTH_SHORT).show();
}
});
Toast.makeText(getApplicationContext(), "page refreshed", Toast.LENGTH_SHORT).show();
handler= new Handler();
handler.postDelayed(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "hello1", Toast.LENGTH_SHORT).show();
Intent i=new Intent(MainActivity.this,MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
handler.removeCallbacksAndMessages(null);
handler.postDelayed(this, 4000);
}
}, 5000*4);//for 20sec
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
handler.removeCallbacksAndMessages(null);
super.onDestroy();
}
@Override
public void onStop() {
// TODO Auto-generated method stub
handler.removeCallbacksAndMessages(null);
super.onStop();
}
}
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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginLeft="23dp"
android:text="Button" />
</RelativeLayout>
---------------------------------------------------------------------------------
MainActivity-
package com.example.pagerefresh;
import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity {
Handler handler;
Button b;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b=(Button)findViewById(R.id.button1);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "test", Toast.LENGTH_SHORT).show();
}
});
Toast.makeText(getApplicationContext(), "page refreshed", Toast.LENGTH_SHORT).show();
handler= new Handler();
handler.postDelayed(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "hello1", Toast.LENGTH_SHORT).show();
Intent i=new Intent(MainActivity.this,MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
handler.removeCallbacksAndMessages(null);
handler.postDelayed(this, 4000);
}
}, 5000*4);//for 20sec
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
handler.removeCallbacksAndMessages(null);
super.onDestroy();
}
@Override
public void onStop() {
// TODO Auto-generated method stub
handler.removeCallbacksAndMessages(null);
super.onStop();
}
}
Thursday, 19 March 2015
Built-In Functions Of PostgreSQL
PostgreSQL built-in functions, also called as Aggregate functions,
are used for performing processing on string or numeric data. Following is the
list of all general purpose PostgreSQL built-in functions:
|
Functions
|
Description
|
|
COUNT
|
·
COUNT
aggregate function is used to count the number of rows in a database table.
|
|
MAX
|
MAX
aggregate function allows us to select the highest (maximum) value for a
certain column.
|
|
MIN
|
MIN
aggregate function allows us to select the lowest (minimum) value for a
certain column.
|
|
AVG
|
·
AVG
aggregate function selects the average value for certain table column.
|
|
SUM
|
·
SUM
aggregate function allows selecting the total for a numeric column.
|
|
ARRAY
|
ARRAY
aggregate function puts input values, including nulls, concatenated into an
array.
|
|
Numeric
|
Complete
list of PostgreSQL functions required to manipulate numbers in SQL.
|
|
String
|
·
Complete
list of PostgreSQL functions required to manipulate strings in PostgreSQL.
|
Oracle and PostgreSQL Query Difference
10 Major Oracle and PostgreSQL Query Difference
|
Oracle
|
PostgreSQL
|
|
select *
from tablename;
|
select *
from tablename;
|
|
desc
tablename
|
-----(select
itself desc coming)
|
|
nvl(sum,0)
|
coalesce(sum,0)
|
|
decode(a,1,aa,bb)
|
(case when
a=1 then aa else bb end)
|
|
oracle
supports ‘’ or null (both are same)
|
In
postgresql ‘’ and null both are
different
|
|
rownum
|
limit
|
|
rowed
|
ctid
|
|
Date shows
dd/mmm/yyyy
|
yyyy/mmm/dd
|
|
Auto cast
from String to Date
|
cast(d as
date)
|
|
String to
integer to_number(a)
|
cast ( a as
numeric)
|
Subscribe to:
Posts (Atom)