This work is considered making the dictionary on three languages: Russian, Uzbek and English on sphere ICT, using оbject-oriented programming languages Java and database SQLite. The words is offered on three languages ICT sphere and created dictionary runs on platforms Android for device smart phones and tablets. Giving dictionary is intended for students, programmer and student studied on this sphere.
Key words: Java, database SQLite, ICT, оbject-oriented programming languages.
1. Introduction
Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google. Applications («apps»), which extend the functionality of devices, are written using the Android software development kit (SDK) and, often, the Java programming language that has complete access to the Android APIs. Java may be combined with C/C++, together with a choice of non-default runtimes that allow better C++ support [1, 3].
SQLite- compactly integrated relational database. The source code for the library in the public domain. In 2005 the project was awarded Google-O'Reilly Open Source Awards. As you know in its development SQL rushed in different directions. Young people interested in Android platform, because there is among popular tab, mobile devices or fashionable gadget [2,4].
2. Russian, uzbek and english dictionary on sphere ICT SQLite database
Large manufacturers have started to push any expansion. Although all sorts of accepted standards (SQL 92), in real life all the major databases do not support full have something of their own. So, SQLite tries to live by the principle of «minimal, but the full set». It does not support the complex stuff, but largely corresponds to SQL 92. And introduces some features which are very convenient, but it is not standard [5,6]. The word «embedded» (embedded) means that SQLite does not use the client-server paradigm, the SQLite engine is there is not a separate working process interacts with the program, and provides a library with which the program is assembled and the engine becomes an integral part of the program. Thus, as the protocol used by function calls (API) library SQLite.
This approach reduces overhead costs, response time and simplifies the program. SQLite stores all database (including definitions, tables, indexes, and data) in a single standard file on the computer on which the program is executed. Ease of implementation is achieved due to the fact that prior to the execution of a transaction record the entire file that stores the database is locked; ACID-functions are achieved, including by creating a log file [5,6].
Several processes or threads can be simultaneously without any problem to read data from one database. An entry in the database can be carried out only if no other requests are currently not in service; otherwise write attempt fails, and the program returns an error code. Another scenario is the automatic repetition of attempts to write for a specified length of time. The bundle comes as a functional part of the customer in the form of an executable file sqlite3, by which demonstrates the realization of the main functions of the library. The client side runs from the command line allows access to the database file on the basis of standard functions of the operating system. Creating program and connected together database SQLite. At firstly, we try to create database under the three name:
Dictionary
Ict_temps
Sqllite _sequences
Fig.1. Interface of program SQLite database
Fig.2. Entering words of three languages to SQLite database
Secondly after connected database and entering words, as result is appears on the interface SQLite.
3. SQLiteOpenHelper and program code
Due to the architecture of the engine may use SQLite as embedded systems, as well as on a dedicated machine with a gigabyte data sets. Older versions of the SQLite were designed without any restrictions, the only condition was that the database fits in memory, in which all calculations were performed using 32-bit integers [4,7]. This created some problems. Due to the fact that the upper limits have not been determined and thus properly tested frequently detected errors by using a sufficiently SQLite extreme conditions. Therefore, new versions were introduced SQLite limits are now tested with a common set of tests [4,7]. SQLite is available on any Android-powered device does not need to be installed separately. SQLite supports the types TEXT (analogue of the String Java), INTEGER (analogue long in Java) and REAL (analogue double to Java). Other types must be converted before you save the database. SQLite itself does not check the data types, so you can write an integer in the column designed for strings, and vice versa. In the third step part of dictionary be following view:
package com.aiw.ictdictionary;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import android.widget.Toast;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.SQLException;
import java.util.ArrayList;
public class DatabaseManager {
public final String APP_TAG = "ICT_DICTIONARY";
public final String DB_NAME = "ict_dict.db";
public final String DB_FOLDER = "databases";
private static DatabaseManager instance;
private SQLiteDatabase db;
private Context context;
private DatabaseManager(Context context) {
this.context = context;
this.db = openDatabase(DB_NAME);
}
public static DatabaseManager getInstance(Context context) {
if (instance == null) {
instance = new DatabaseManager(context);
}
return instance;
}
private SQLiteDatabase openDatabase(String dbName) {
File dbFile = this.context.getDatabasePath(dbName);
String dbPath = dbFile.toString();
File dbDir = new File(dbPath.substring(0, dbPath.lastIndexOf('.')));
if ( ! dbFile.exists()) {
if ( ! dbDir.exists() ) dbDir.mkdirs();
copyDatabase(dbFile, dbName);
}
return SQLiteDatabase.openDatabase(dbPath, null, 0);
}
private void copyDatabase(File dbFile, String dbName) {
try {
InputStream istream = this.context.getAssets().open(DB_FOLDER + "/" + dbName);
OutputStream ostream = new FileOutputStream(dbFile);
byte[] buffer = new byte[100 * 1024];
int length;
Android contains an abstract class SQLiteOpenHelper, with which you can create, open and update the database. This is the basic class with which you will have to work in their projects. If you implement this helper class is hiding from you the logic on which the decision to create or update the database before opening it.
References:
- Dmitriy Volkov. Google Android eto neslojno. Sbornik urokov. Elektronnoe izdanie, 2012.
- Orlov L. V. Web-sayt bez sekretov. 2-e izd. M.: ZAO “Noviy izdatelskiy dom”, 2004. -512 p.
- Wikipedia. Internet encyclopedias. (ru.wikipedia.org/wiki/Android)
- Official web- site of Android, (android.com)
- Spravka — OS Android. (http://support.google.com/android/?hl=ru)
- Programmirovanie dlya android, java — s samix pervix shagov. (http://davidmd.ru/tag/eclipse/) API Guides for Android App. (http://developer.android.com/guide/components/index.html)
- D.Vinogradov. Start Andorid. (Sbornik urokov) — 2012. 703 p.