Tuesday, October 15, 2019

SQLite Database

SQLite

SQLite is a relational database management system (RDBMS). If most RDBMSs such as MySQL, Oracle, etc. are standalone server processes, then SQLite is embedded because it is provided in the form of a library that is linked in applications.
Like other RDBMSs, data is accessed in a SQLite database by using Structured Query Language (SQL).

Android SQLite Java Classes

Cursor: a class provides access to the results of a database query. Its methods include:
  • close(): release all resources used by cursor and close it.
  • getCount(): returns the number of rows contained within the result set.
  • moveToFirst(): moves to the first row in the result set.
  • moveToLast(): moves to the last row in the result set.
  • moveToNext(): moves to the next row in the result set.
  • move(): moves by a specified offset from the current position in the result set.
  • get<type>() (such as getInt(), getDouble(), so on): returns the value of the specified <type> contained at the specified column index of the row at the current cursor position.
SQLiteDatabase provides the primary interface between the application code and underlying SQLite database. Its methods include:
  • insert(): inserts a new row into a database table.
  • delete(): deletes rows from a database table
  • query(): performs a specified database query and returns matching results via a Cursor object.
  • execSQL(): executes a single SQL Statement that does not return result data.
  • rawQuery(): executes an SQL query statement and returns matching results in the form of a Cursor object.
SQLiteOpenHelper is designed to make it easier to create and update databases. Its methods include:
  • onCreate(): called when the database is created for the first time.
  • onUpgrade(): called in the event that the application code contains a more recent database version number reference.
  • onOpen(): called when the database is opened.
  • getWritableDatabase(): opens or creates a database for reading and writing.
  • getReadableDatabase(): creates or opens a database for reading only.
  • close(): closes the database.
ContentValues allows key/value pairs to be declared consisting of table column identifiers and the values to be stored in each column. Its methods include:
  • put(): adds a value to the set.

Saturday, April 23, 2016

Learn C# - Part 2

මේ කොටසෙන් C# වලින් Decision statement ලියන විදිය සහ ඉදිරියට තියන දේවල් ගැන බලමු. Beginner level එකේ ඉඳන් ලියන නිසා හැම පොඩි දෙයක් ගැනම ලියන්න ඕන කියල හිතුන.​ Decision statement කිව්වම අපිට මතක් වෙන්නෙ if/else if/else නෙ. කලින් කොටසෙදි කිව්ව වගේ Java,C,C++ වල වගේම තමයි C# වලදිත් Decision statements ලියන්නෙ.

පහළින් තියෙන්නෙ if/else if/ else සේරම use කරල ලියපු statement එකක්. Try කරල බලන්න​.



දැන් අපි බලමු assignment හා concatenation operation combine කරල කොහොමද statement එකක් ලියන්නෙ කියල​. කලින් code එකේම අන්තිමට print කරන්න හදපු 'msg' variable එකම use කරමු.




Decision statements ලියන තවත් විදියක් ගැන අපි දැන් බලමු. මේකට conditional operator කියලත් කියනව​.


මෙතනදි statement එක true නම් msg variable එකට ගන්නෙ "car" කියන string එක. false නම් පස්සෙ තියන "house" string එක msg කියන variable එකට ගන්නව. මතක තියාගන්න ඕන දේ තමයි පලවෙනි string එකට පස්සෙ දාන්න ඕනෙ colon(:) එකක් semicolon(;) එකක් නෙමෙයි.

lines කීපයක් use කරල pint කරපු message එක, තනි line එකකින් print කරගන්න පුලුවන් ලේසි විදියක් අපි දැන් බලමු. තවත් variable තියානව නම් curly braces ඇතුලෙ 3,4,5.. විදියට numbers දාල variable names අන්තිමට දාන්න පුලුවන්.



දැන් අපි බලමු Loops වැඩ කරන විදිය ගැන​. මුලින් for loop කොහොමද use කරන්නෙ කියල බලමු.අනිත් languages වල වගේම තමයි වෙනසක් නෑ.











ඕනම programming language එකක වැදගත් අංගයක් තමයි arrays කියන්නෙ. අපි දැන් බලමු array එකක් කොහොමද declare කරන්නෙ කියල​ සහ array elements access කරන්නෙ කොහොමද කියල​.


C# වල arrays index කරන්නෙ position 0 ඉඳන්.
array එකක් declare කරන තවත් ලේසි විදියක් ගැන අපි දැන් බලමු.



C# තවත් කොටසකින් නැවත හමුවෙමු





Friday, April 22, 2016

Learn C# - Part 1

අනිත් programming languages එක්ක බලද්දි C# සිංහල tutorials තරමක් අඩුයි කියල හිතනව​.
C# කියන්නෙ type-safe language එකක්. ඒ කියන්නෙ C# access කරන්නෙ access කිරීමට permission තියන memory locations විතරයි. උදාහරණයක් විදියට type-safe code එකක් වෙනත් object එකක private fields read කරන්න​ බැහැ.type-safe code එකකට object එකක් මත operation කරන්න අවසර දෙන්නෙ නෑ එම object එකට operations අනුකුල නොවෙනව නම්. C,C++,Java වගේ languages පුරුදු අයට ලේසියෙන්ම C# ඉගෙන ගන්න පුලුවන්. අනෙක් වැදගත් කාරණය තමයි C# case sensitive language එකක්.
C# code කරන්න Visual Studio IDE එක use කරන්න පුලුවන්. මේක Microsoft එකෙන් නොමිලේ දෙන IDE එකක්.

අපි ඉතා සරල මට්ටමේ ඉඳන් C# ඉගෙන ගන්න පටන් ගමු. ඕනම language එකක වගේ Hello world program එකක් ලියල ආරම්භයක් ගමු.

අලුත් project එකක් පටන් ගන්න මේ විදියට කරන්න,
File --> New --> Project මෙතනදි එන menu එකෙන් console application තෝරගන්න​. ඉස්සරහට බලමු අනිත් options වලින් මොනාද කරන්න පුලුවන් කියල​. මේකෙදි output අපිට දැක ගන්න පුලුවන් වෙන්නේ Console එක හරහා.


'Start' button එක​ click කලාම​ අපිට console එකේ මේ වගේ output එකක් දැකගන්න පුලුවන්.

මේකෙදි WriteLine() method එකෙන් console එකට print කරනව​, ReadLine()  method එකෙන් input එකක් ලැබෙනකන් ඉන්න කියල command එකක් දෙන්නෙ.

variable declare කරන විදිය බැලුවොත් Java,C වල​ වගෙම variable name එකට කලින් data type එක දෙන්න තියෙන්නෙ.
eg: int x=2;
      char a='i';

අපි දැන් පොඩි program එකක් ලියමු runtime එකෙදි user input දෙකක් අරගෙන ඒ දෙක concatenate කරල print කරන විදියට​.
















මෙතනදි WriteLine() සහ Write() විදියට method  දෙකක් අපි use කරනව​. ඒ දෙකේ පොඩි වෙනසක් තියෙන්නෙ. WriteLine() method එකෙන් අලුත් line එකකට යනව Write() method එකෙන් ඒ line එකේම ඉන්නව​. මේ program එක run කරල input දුන්නට පස්සෙ ලැබෙන final output එක මේ විදියට දැක ගන්න පුලුවන්,








C# ඉගැනුම​ තවත් පාඩම් ඊළග post එකෙන් බලාපොරොත්තු වන්න​..


Tuesday, August 4, 2015

IDM version 6.23 Build 18

ඉන්ටනෙට් downloading වලදි කාටත් මුලින්ම මතක් වෙන software එකක්නෙ IDM කියන්නෙ.download speed එක වැඩි කරන නිසා හැමෝම මේකට කැමතියි.2015 අගෝස්තු 05 වෙද්දි ඇවිත් තියන අලුත්ම IDM version (version 6.23 Build 18) එක තමයි අද මම ඔයාලට දෙන්න හදන්නෙ.
මේකෙ Trail version එක ඕන කෙනෙක්ට download කරල භාවිත කරන්න පුලුවන් උනත් key එකක් සල්ලි දීල ගන්න ගොඩ දෙනෙක් කැමති වෙන්නෙ නෑනෙ.ඔන්න මන් ගාව තියනව හැමෝට free භවිත කරන්න පුලුවන් විදියෙ crack එක හා patch එක​.

install කරන්න ඕන පිලිවෙල මුල ඉදන් කියන්නම්.


මුලින්ම මෙතනින් ගිහින් IDM download කරගන්න​.(crack එක හා patch එකත් මෙතන තියනව​)

Patch කරනව නම් කෙරෙන්න ඕනෙ මෙහෙමයි
  1. සාමාන්‍ය විදියට Internet Download Manager install කරන්න​.
  2. දැන් system tray එකෙන් IDM exit කරන්න​.

     3.  දැන් patch file එක කරල patch කරගන්න​.
     4.  දැන් වැඩේ ඉවරයි First name එකයි Last name එකයි දීල register ක්ලික් කරන්න​



Crack කරනව නම් කෙරෙන්න ඕනෙ මෙහෙමයි
  1. සාමාන්‍ය විදියට Internet Download Manager install කරන්න​.
  2. කලින් කියපු විදියට​ system tray එකෙන් IDM exit කරන්න​.
  3. Crack Folder එකේ තියන  IDMan.exe එක  " C:\Program Files\Internet Download Manager\  එකට  Copy - Paste කරන්න.
  4. ඊලගට IDM Reg Key.reg කියන එක Doubble click කරලා IDM එක Register කරගන්න.

හරි දැන් වැඩේ ඉවරයි :) 
කිසිම අව්ලක් නැතුව, keys වලට සල්ලි වියදමකුත් නැතුව හැමෝටම use කරන්න පුලුවන්.
තවත් post එකකින් අයෙත් හමුවෙමු..




Accessing 'GodMode' hidden Windows system - GodMode මගින් සියලු windows features හැසිරවීම​

 මාගේ ප්‍රථම ලිපිය ලෙස මෙය පලකරනවා. අද මම කියන්න යන්නෙ windows මෙහෙයුම් පද්ධතිය තුල දැකිය හැකි සියලුම සැගවුණු features එකම folder එකක් තුලදී භාවිත කල හැකි ආකාරයයි.

අපි මුලින්ම බලමු මොකක්ද මේ GodMode කියන්නෙ කියල​..

මූලිකව windows system එකේ සියලුම features සහ​ customization options එකට එකතු කරල තියන interface එකක් විදියට හඳුන්වන්න පුලුවන්. උදාහරණයක් විදියට භාවිත කරන්නාට Screen resolution වෙනස් කිරීමට අවශ්‍ය නම් හෝ Folder options වෙනස් කිරීමට අවශය නම් නැතහොත් task bar එකේ notification  අවශ්‍ය ආකාරයට හැසිරවීම වැනි විවිධ අවශ්‍යතා මෙමගින් සපුරාලිය හැකිය​.
clicks කිහිපයක් මගින් operating system එකෙහි secret settings පාලනය කලහැකි පහසු ක්‍රමයක් ලෙස මෙය කෙටියෙන්ම හඳුන්වන්න පුලුවන්.
සතුටුදායක ආරන්චිය වෙන්නෙ ලගදි release වෙච්ච windows10 තුලත් මෙය ක්‍රියාත්මක වීමයි.

දැන් අපි බලමු මේක කොහොමද ක්‍රියාත්මක කරන්නෙ කියල​.අපිට පුලුවන් සරල පියවර කිහිපයකින් මෙය ක්‍රියාත්මක කරවන්න​.

  • මුලින්ම desktop එකෙහි 'new folder' එකක් සාදාගන්න​.


  • දැන් හදපු folder එක rename කරන්න මෙන්න මේ ටික දාල​ GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
  • දැන් ඔයාල හදපු folder එකේ icon එක පහල පින්තූරෙ තියෙන විදියට වෙනස් වෙලා තියෙයි.



  • දැන් හදපු folder එක open කරල බලන්න​. settings විශාල ප්‍රමාණයක් එකම folder එකක් තුල දැක ගන්න පුලුවන්. ඒ වගේම මේ folder එක ඔයලට කැමති ඕනම තැනකට move කරන්නත් පුලුවන්. task bar එකට පින් කරන්න උනත් හැකියාව තියනව​.



  • අපි හිතමු GodMode කියන නමට ඔයාල කැමති නැ කියල, ඔයලට පුලුවන් වෙන කැමති නමකින් උනත් rename කරන්න​. ඒකට මන් කලින් rename කරන්න දීපු code එකේ 'GodMode' වෙනුවට කැමති නමක් දාගන්න​. වරහන් ඇතුලෙ තියන කිසිම දෙයක් වෙනස් කරන්න එපා.

අදට කියන්න තියෙන්නෙ මෙච්චරයි. අලුත් post එකකින් ඉදිරියටත් හමුවෙමු. මේක මගෙ පලවෙනි blog post එක අඩුපාඩු තියනව නම් කියන්න :)