If you are a big fan of chess, I think this time I got very
important and a valuable app that make you more love to chess.
Wednesday, July 2, 2014
Monday, June 16, 2014
HTML redirect to mobile web page automatically
When the user or the client visit your website, if they see your web without any responsively it might be problem. Because the contents are may be not in the right places. So the right and most used way is to redirect them to separated mobile page. So here is the simplest source code to do that (in a javascript).
Thursday, January 2, 2014
PHP Simple Contact Us Form
In this post I’ll show how to design a contact us form using PHP language. And this can send the form details that the user types to any type of email.
So first thing first. You needed to design the main page that contain the fields that you want to get from the user. And here my main page is main.html,
<html>
<head>
<title>Cantact Us Form</title>
</head>
<body>
<form name='form' method='post' action="send_mail.php">
<input type="text" name="name" />
<input type="text" name="email"/>
<textarea name="msg" cols="85" rows="5" ></textarea>
<input type="submit" value="Submit" name="submit_email" />
</form>
</body>
</html>
Wednesday, January 1, 2014
SQLite Android JAVA Tutorial 04 – Update DB & Delete from DB
Update DB :
Following Java code shows how we can use UPDATE statement to update any record from our table test_table,
public class Sqlite_Tute extends Activity {SQLiteDatabase db;@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);requestWindowFeature(Window.FEATURE_NO_TITLE);setContentView(R.layout.sqlite_tute);try{db = openOrCreateDatabase("testDB", MODE_PRIVATE,null);db.execSQL("CREATE TABLE IF NOT EXISTS test_table (_id INTEGER PRIMARY KEY AUTOINCREMENT,_name TEXT,_email TEXT,_age INTEGER);");}catch(Exception e){Log.d("rockman", "DB Creation or TABLE Creation ERROR--"+e.toString());}/////////////////////////// UPDATE PARTString email = ”test123@test.com”; //new valueint age = 34; //new valuetry{ContentValues values = new ContentValues();values.put("_email", email);values.put("_age", age);db.update("test_table", values, "id=15", null);}catch(Exception e){Log.d("rockman", "UPDATE ERROR--"+e.toString());}}}
SQLite Android JAVA Tutorial 03 – Insert into DB & Select from DB
Insert into DB :
Let’s say we need to insert a raw of data now. The following Java program shows how we can insert records in our test_table created in previous post.
public class Sqlite_Tute extends Activity {SQLiteDatabase db;@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);requestWindowFeature(Window.FEATURE_NO_TITLE);setContentView(R.layout.sqlite_tute);try{db = openOrCreateDatabase("testDB", MODE_PRIVATE,null);db.execSQL("CREATE TABLE IF NOT EXISTS test_table (_id INTEGER PRIMARY KEY AUTOINCREMENT,_name TEXT,_email TEXT,_age INTEGER);");}catch(Exception e){Log.d("rockman", "DB Creation or TABLE Creation ERROR--"+e.toString());}/////////////////////////// INSERT PARTString name = ”Rockman”;String email = ”test@test.com”;int age = 24;try{ContentValues values = new ContentValues();values.put("_name", name);values.put("_email", email);values.put("_age", age);db.insert("test_table", null, values);}catch(Exception e){Log.d("rockman", "INSERT ERROR--"+e.toString());}}}
SQLite Android JAVA Tutorial 02 – Connecting to DB & Create a table
Connecting to DB :
First you need to import android.database.sqlite.SQLiteDatabase,
import android.database.sqlite.SQLiteDatabase;
Now within the main class create a variable using SQLiteDatabase class. Using that variable we are going to do create OR open a database called “testDB”. If the “testDB” is previously created then it will open. And if the “testDB” not found the it will be created and open it.
The following JAVA program shows how to do that.
public class Sqlite_Tute extends Activity {SQLiteDatabase db;@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);requestWindowFeature(Window.FEATURE_NO_TITLE);setContentView(R.layout.sqlite_tute);try{db = openOrCreateDatabase("testDB", MODE_PRIVATE,null); }catch(Exception e){Log.d("rockman", "DB Creation ERROR--"+e.toString());}}}
Subscribe to:
Posts (Atom)