Hla Hla Htay's Notes

Just another WordPress.com weblog

How to use Sqlite in B4A September 4, 2016

Filed under: Japan,Language,Myanmar — hhh123 @ 3:16 pm
Tags: , , ,

I am learning how to write Android programs in B4A at Skylight. I want to know to how to use Sqlite in B4A (Basic For Android). As I am interested in dictionary project, I take a small dictionary project which use Sqlite database. The program will accept either Romaji (English) or Myanmar(Myamar3/Zawgyi).

Screenshot_2016-09-04-21-10-35

Screenshot_2016-09-04-21-11-27

Screenshot_2016-09-04-21-11-49

 

 

 

 

 

 

 

 

 

 

 

 

 

A Sqlite database is made from MS Excel. DB Browser for Sqlite can be downloaded here. MS Excel *.xls
is saved as *.odf*.ods in OpenOffice.The data sheet is saved as text csv in OpenOffice. Choose UTF-8 while the file is saved.

CSVinUnicode1

Open DB Browser for Sqlite. Click New Database -> Choose a location to store . Open this CSV in DB Browser for Sqlite. File–> Import–> Table from CSV file. You can rename your database and table.

sqlite-import

        Before you are using your SQL statement in program, you can check your desired result in DB Browser.

sqlite-query

Choose SQL in Library Manager.

Add your sqlite file through File Manager.

Declare in Process_Globals.

       Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.
               Dim sql1 As SQL
               Dim cursor1 As Cursor
 
End Sub

Open your db in Activity_Create.

        If File.Exists(File.DirInternal,"jpdictionary1.sqlite") = False Then
		File.Copy(File.DirAssets,"jpdictionary1.sqlite",File.DirInternal,"jpdictionary1.sqlite")
	End If
	
	If sql1.IsInitialized = False Then
		sql1.Initialize(File.DirInternal, "jpdictionary1.sqlite", False)
	End If

Write query statement as below and put the passed data into Editext.

         Dim cursor1 As Cursor
    cursor1 = sql1.ExecQuery("SELECT Romaji, HiraganaKatakana, Kanji, Myanmar, Myanmar3 FROM dictionarytable WHERE " 
& choice1 & "='"  & edtSearch.text.trim & "'")

	
    For i = 0 To cursor1.RowCount - 1
                cursor1.Position = i
		edtRomaji.Text=edtSearch.text
		
		edtHiragana.Text=cursor1.GetString("HiraganaKatakana") 
		edtKanji.Text=cursor1.GetString("Kanji")
		
		If choice1="Romaji" Then
		
		edtMyanmar.Text=cursor1.GetString("Myanmar3")	
		
                else If choice1="Myanmar3" Then

		 lblMyanmar.Text="Romaji"	
		 edtMyanmar.Text=cursor1.GetString("Romaji")
		End If 
    Next
	
    cursor1.Close

Credit:

Download:JP dic sample project

Advertisements
 

Preparation for using Ubuntu April 7, 2013

Filed under: Myanmar,Software — hhh123 @ 5:54 am
Tags: , , , , , ,

My choice for Ubuntu is
1. open source and free of charge
2. easy to install new updates
3. similar to window system
4. my project member countries also use it

1. Download iso at http://mirror.eftel.com/ubuntu-dvd/
* I installed Ubuntu 12.04 last week. Everything goes fine but I am not able to shut down the system and
It restarts again. To shut down the system, I have to press power button for a minute.
So, I switched to use Ubuntu 10.04. However, I noticed that whenever I installed a new software, I needed to upgrade the dependency softwares. As Internet in Myanmar is terrible… Now June 2013, I switched again to Ubuntu 12.04. There, as I mentioned before, the “UNABLE TO SHUTDOWN” problem still exits.

I found the solution with a simple command : sudo shutdown -h now

2. Burn ISO
Power2go (window software)–> Select a Burning Task–> Disc Utilities –> Burn Disc Image

Nero (Nero Burning Rom 8) –> Burning Rom
1. Choose DVD –> DVD-ROM (ISO)
2. Go to Multisession Tab –> No Multisession
3. Open –> Choose ISO location

3. Use internet through mobile
1. Settings–> Wireless and networks–> Tick Use packet data
2. Settings–> Wireless and networks–> Tethering and portable hotspot–> USB tethering
I am not able to use Tethering and portable hotspot–> Mobile AP with Ubuntu Lucid (12.04)

3. Use internet through wire
1.System –> Preferences –> Manual Proxy Configuration –> Use the Same Proxy for all protocols
2. Then Auto Enthernet icon will be active at the panel
3. Setting at Browser : Firefox –> Edit–>Preferences–>Advanced–> Network–> Setting–> Choose any of Proxy

4. Installing Myanmar fonts
References :
http://www.mysteryzillion.org/discussion/11164/how-can-i-install-myanmar-font-in-ubuntu-11-10/p1
https://code.google.com/p/zawgyi-keyboard/
https://code.google.com/p/zawgyi-keyboard/downloads/detail?name=how-to-install-myanmar-font-on-ubuntu910.pdf

5. Update the software
System–> Administration–> Update Manager

6. Installing Necessary Softwares
1. python tinker library : sudo apt-get install python-tk

2. GCC: sudo apt-get install gcc build-essential (Ref :http://fontignie.blogspot.com/2006/04/install-gcc-on-ubuntu.html)
3. XAMPP : http://ubuntuforums.org/showthread.php?t=223410

4. CRF++ :http://crfpp.googlecode.com/svn/trunk/doc/index.html
http://crfpp.googlecode.com/files/CRF%2B%2B-0.58.tar.gz

how to compile
==============
./configure –prefix=/your_project_directory/
make
sudo make install

how to run
===========
xxxxx@xxxxx-laptop:~/DataNWork/CRF++-0.58$ ./crf_learn

Ref:http://www.ubuntugeek.com/how-to-install-source-files-in-ubuntu.html
http://www.cs.washington.edu/education/courses/cse454/10au/crf.html

 

Solve misery with updating internet browsers September 10, 2012


Today, I have solved the misery with updating browsers. 🙂 😀
This problem stuck me over half a year. Believe it or not. I try to forget and start installing new versions of browsers thinking that
whether new version will help me .

After I have updated Window Vista , Internet explorer 8 (may be) stopped working.
Then I was nervous and update the Mozilla Firefox. Mozilla Firefox is also stopped working.
I thought the problem lies update with Window vista. And I don’t want to roll back my update too.
I have downloaded and installed many browsers. (latest version of Opera, Netscape, Internet Explorer (many versions), Mozilla Firefox , Google Chrome).. None of them works.
Fortunately, I reinstalled the old Firefox (Firefox Setup 3.5.5.exe) and it works.

It recently said can not support some features and to upgrade it. 😦
Not only that, I can not use Skype or Kies (Samsung Mobile software). It seems the problem concerns any software that use the proxy address.

I have read many web pages about how to solve that problem.
Some pages say your internet security software blocks and preventing to work it.
My internet security software is Norton Symantec and it is 1 month trial version come along with my notebook.
And I don’t have credit card and I can not update it.

Today, I uninstall all Norton Symantec and then all browsers work.:D:D:D
I know it may be vulnerable to invite viruses. What to do?

Ref: http://answers.microsoft.com/en-us/ie/forum/ie8-windows_other/internet-explorer-8-stopped-working-after-an/77f25b7e-1b1c-4755-b63a-e4ea8ec5e833
http://answers.microsoft.com/en-us/ie/forum/ie8-windows_other/internet-explorer-8-stopped-working-after-update/97f62fe2-300b-48c1-b091-07e3dcacf570
http://en.kioskea.net/forum/affich-71955-ie-8-cannot-access-any-internet-web-pagesNor

 

Preparing environment for PHP April 5, 2012


Installation Requirement
1.astah-uml-6_5-jre-setup.exe (For drawing Usecase, it is trail version.)
2.phpeditor_setup_en.exe (For writing php script)
3.xampp-win32-1.7.4-VC6-installer.exe (Server For running php script)
===============
See DocumentRoot in C:\xampp\apache\conf\httpd.conf.
DocumentRoot “C:/xampp/htdocs”
To run your php document from browser, files must be stored under DocumentRoot.
===============
Run C:\xampp\xampp-control.exe
Check Apache, MySql should be in “Running” status
From web browser, call http://localhost/yourfile.php

===============
Checking Mysql is running properly
Go to C:\xampp\mysql\bin

c:\xampp\mysql\bin>mysql -u root -p
password:(BLANK) press enter
mysql>show databases;

mysql>create database DATABASENAME; //creating new database)
mysql>use DATABASENAME; (will use this database)

mysql>source linkdb.sql; //insert the data to linkdb)
=====================
Copy linkdb.sql to c:\xampp\mysql\bin;
=====================
localhost means c:\xampp\htdocs

mysql>desc tablename; //description of the table.

$sql = ‘select * from link where link_id=:id’;
varname ‘id’ is used here to cope wih the sql injection and to increase the security,
==================
intype-0.3.1.734.exe //Advanced text editor

 

To appear Unicode font in Cosole, Eclipse September 9, 2011

Filed under: Software,University — hhh123 @ 4:46 am
Tags: , , , , ,

Some of my student stuck with not seeing unicode on Eclipse console. So I tried to solve once. Then I forgot. So keep notes of this. 🙂

1. Project–> Open Run Dialog–> At VM Argument of Argument Tab , write -Dfile.encoding=UTF-8

2. then At Common Tab, Change Console Encoding’s other to UTF8.

Reference : http://paranoid-engineering.blogspot.com/2008/05/getting-unicode-output-in-eclipse.html