Sunday, February 24, 2019

Android OS: Fundamental Awareness


Thai government single policy
  
*** IMPORTANT ***
Please carefully take a look this post
     Please use any approach you preferred from provided link above. Be careful, your devices are tempered or exploited.
     I mean, undetectable backdoor, virus, malware, Trojan or else.

     You might not know they informally recording audio, video and streaming what you are doing on your devices such as another computer or mobile devices.

     Before you install or update some applications, check permission carefully.  Some applications might not need those permissions.
Don't save your real picture in your devices.


     When you use internet from Thailand all ISPs. Thai government see your chat history and it has been being logged.

Regards,
  France Admin (62.xxx.xxx.xxx)

Wednesday, February 20, 2019

Basic MongoDB(NoSQL) Part 04: Specify/Create/Drop database and Create/Drop collection

MongoDB Part 04: Specify/Create/Drop database and Create/Drop collection


>   Specify database   <
>>>   Create database   <<<
>    Drop database     <
>>>   Create collection  <<<
>    Drop collection    <

        The approaches about to specify, create and drop database are likely Oracle DBMS since it has its own built-in methods and tables, has to specify database before performing actions. 

   According to previous example the collection(a webpage) may have many documents(sets of comment) but it's an example document and its schema here:
This is a document and its schema below

mongod.exe, mongo.exe, server and client respectively
 Create database 
This example added only key 'by' from schema. Actually, it would be Rahul.
 Drop database 
Specify database then drop it.
 Create collection 
A collection will be automatically created once a document is inserted.
Be careful to check instance before performing actions!

Reference

 
You may leave comment to improve it. Thank you from THAILAND.

Basic MongoDB(NoSQL) Part 03: Data modeling and Schema

MongoDB Part 03: Data modeling and Schema


>>>   Data modeling   <<<
>    Document Schema    <







For example, it is a webpage layout or Mock-up like this
          A collection(a webpage) may have many documents(sets of comment). Therefore, document  and its schema may be like these:
This is a document and its schema below

{
   _id: POST_ID
   title: TITLE_OF_POST, 
   description: POST_DESCRIPTION,
   by: POST_BY,
   url: URL_OF_POST,
   likes: TOTAL_LIKES, 
   comments: [
      {
         user:'COMMENT_BY',
         message: TEXT,
         dateCreated: DATE_TIME,
         like: LIKES 
      },
      {
         user:'COMMENT_BY',
         message: TEXT,
         dateCreated: DATE_TIME,
         like: LIKES
      }
   ]
}



You may leave comment to improve it.
Thank you from THAILAND.

Basic MongoDB(NoSQL) Part 02:Installation on Windows and Linux

MongoDB Part 02: Installation on Windows and Linux


>>>   Installation   <<<
>     Windows     <
>         Linux        <




          1. Check current OS version and after downloading installation file then install it. Here is the page for installation file URLhttps://www.mongodb.com/download-center#community 



         2. MongoDB folder is moved from default installed path to \Database folder as depicted. This state is the state before launching mongod.exe at server-side with specific database path.
        3. To verify running port by using telnet client it will accept connection from telnet if server properly runs on waiting state.
         4. Use mongo.exe client instead telnet client for making a connection to mongod.exe server at running port. It looks like Oracle and sqlplus which is server and client respectively.




kevin@phoenix:~$ cat installation.log

# 01 command for requesting keyserver
# Below adding key commands raised error then I ignored it.
# This OS is Debian-based 
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
 
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

# 02 create a empty source file for MongoDB repository
sudo touch /etc/apt/sources.list.d/mongodb.list

# 03 insert below line in created source file
deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main

# 04 update header files of all repositories by command
sudo apt-get update

# 05 in case properly fetching repository you can install MongoDB by command
sudo apt-get install mongodb
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libboost-regex1.62.0 libgoogle-perftools4 libpcrecpp0v5 libtcmalloc-minimal4
  libunwind8 libyaml-cpp0.5v5 mongo-tools mongodb-clients mongodb-server
The following NEW packages will be installed:
  libboost-regex1.62.0 libgoogle-perftools4 libpcrecpp0v5 libtcmalloc-minimal4
  libunwind8 libyaml-cpp0.5v5 mongo-tools mongodb mongodb-clients
  mongodb-server
0 upgraded, 10 newly installed, 0 to remove and 400 not upgraded.
Need to get 11.9 MB/45.8 MB of archives.
After this operation, 196 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Get:1 http://mirror.kku.ac.th/kali kali-rolling/main amd64 mongodb-server amd64 1:3.2.11-2 [11.9 MB]
Get:2 http://mirror.kku.ac.th/kali kali-rolling/main amd64 mongodb amd64 1:3.2.11-2 [16.8 kB]
Fetched 3821 kB in 6s (628 kB/s)
Selecting previously unselected package libpcrecpp0v5:amd64.
(Reading database ... 305507 files and directories currently installed.)
Preparing to unpack .../0-libpcrecpp0v5_2%3a8.39-3_amd64.deb ...
Unpacking libpcrecpp0v5:amd64 (2:8.39-3) ...
Selecting previously unselected package libboost-regex1.62.0:amd64.
Preparing to unpack .../1-libboost-regex1.62.0_1.62.0+dfsg-4_amd64.deb ...
Unpacking libboost-regex1.62.0:amd64 (1.62.0+dfsg-4) ...
Selecting previously unselected package libtcmalloc-minimal4.
Preparing to unpack .../2-libtcmalloc-minimal4_2.5-2.2_amd64.deb ...
Unpacking libtcmalloc-minimal4 (2.5-2.2) ...
Selecting previously unselected package libunwind8.
Preparing to unpack .../3-libunwind8_1.1-4.1_amd64.deb ...
Unpacking libunwind8 (1.1-4.1) ...
Selecting previously unselected package libgoogle-perftools4.
Preparing to unpack .../4-libgoogle-perftools4_2.5-2.2_amd64.deb ...
Unpacking libgoogle-perftools4 (2.5-2.2) ...
Selecting previously unselected package libyaml-cpp0.5v5:amd64.
Preparing to unpack .../5-libyaml-cpp0.5v5_0.5.2-4_amd64.deb ...
Unpacking libyaml-cpp0.5v5:amd64 (0.5.2-4) ...
Selecting previously unselected package mongo-tools.
Preparing to unpack .../6-mongo-tools_3.2.11-1+b2_amd64.deb ...
Unpacking mongo-tools (3.2.11-1+b2) ...
Selecting previously unselected package mongodb-clients.
Preparing to unpack .../7-mongodb-clients_1%3a3.2.11-2_amd64.deb ...
Unpacking mongodb-clients (1:3.2.11-2) ...
Selecting previously unselected package mongodb-server.
Preparing to unpack .../8-mongodb-server_1%3a3.2.11-2_amd64.deb ...
Unpacking mongodb-server (1:3.2.11-2) ...
Selecting previously unselected package mongodb.
Preparing to unpack .../9-mongodb_1%3a3.2.11-2_amd64.deb ...
Unpacking mongodb (1:3.2.11-2) ...
Setting up libboost-regex1.62.0:amd64 (1.62.0+dfsg-4) ...
Setting up libtcmalloc-minimal4 (2.5-2.2) ...
Setting up libunwind8 (1.1-4.1) ...
Processing triggers for libc-bin (2.24-9) ...
Processing triggers for systemd (232-22) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up libpcrecpp0v5:amd64 (2:8.39-3) ...
Setting up libyaml-cpp0.5v5:amd64 (0.5.2-4) ...
Setting up mongo-tools (3.2.11-1+b2) ...
Setting up libgoogle-perftools4 (2.5-2.2) ...
Setting up mongodb-clients (1:3.2.11-2) ...
Setting up mongodb-server (1:3.2.11-2) ...
update-rc.d: We have no instructions for the mongodb init script.
update-rc.d: It looks like a network service, we disable it.
Setting up mongodb (1:3.2.11-2) ...
Processing triggers for libc-bin (2.24-9) ...
Processing triggers for systemd (232-22) ...

kevin@phoenix:~$


kevin@phoenix:~$ uname -a
Linux kali 4.9.0-kali3-amd64 #1 SMP Debian 4.9.18-1kali1 (2017-04-04) x86_64 GNU/Linux
 
kevin@phoenix:~$ 
kevin@phoenix:~$ sudo service mongodb start
[sudo] password for kevin:
 
kevin@phoenix:~$   
kevin@phoenix:~$ ps -ef |grep mongodb
mongodb    355     1  1 12:14 ?        00:00:00 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
kevin      374  1867  0 12:14 pts/1    00:00:00 grep mongodb
 

kevin@phoenix:~$  

kevin@phoenix:~$ mongo
MongoDB shell version: 3.2.11
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
    http://docs.mongodb.org/
Questions? Try the support group
    http://groups.google.com/group/mongodb-user
> db.test.save( { kevin: 1 } )
WriteResult({ "nInserted" : 1 })
>
> db.test.find()
{ "_id" : ObjectId("5947c09d5dba0e5c41e89b48"), "kevin" : 1 }
>
>
> exit
bye
 
kevin@phoenix:~$  
kevin@phoenix:~$ sudo service mongodb restart 
kevin@phoenix:~$ ps -ef |grep mongodb
mongodb    395     1 25 12:17 ?        00:00:00 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf
kevin      413  1867  0 12:17 pts/1    00:00:00 grep mongodb
 
kevin@phoenix:~$  
kevin@phoenix:~$ sudo service mongodb stop    
kevin@phoenix:~$ ps -ef |grep mongodb
kevin      447  1867  0 12:17 pts/1    00:00:00 grep mongodb
 
kevin@phoenix:~$
 





You may leave comment to improve it.
Thank you from THAILAND.
 

Basic MongoDB(NoSQL) Part 01: Press Room

MongoDB Part 01: Press Room


>   Inspiration   <
>     Overview     <
>   Advantages   <



Inspiration

    4 years ago(2013), I worked for my Swedish ex-CTO, Mats Engstorm, he talked about MariaDB and MongoDB. Currently, I have a good chance to learn about it and I have made a decision to learn MongoDB. Any advice is welcome if any since it's the first time for me. 



Overview 

      MongoDB is C++ based open-source document database. It's cross-platform database and its syntax is pretty much like JSON from my experience. Prerequisite is about fundamental of RDBMS. Once you completed the course you would step up to mediocre level.
       The MongoDB server is like general database. Let's say the server may consist of many databases. 

For example
             a database is gonna insert a document(record or row equivalent) to a collection named 'users' or (table equivalent)

This database has one collection and 3 documents

Example of document:
{
   _id: ObjectId(59488f161edbf45b66e5b8f3)
   title: 'MongoDB Overview', 
   description: 'MongoDB is no sql database',
   by: 'tutorials point',
   url: 'http://www.tutorialspoint.com',
   tags: ['mongodb', 'database', 'NoSQL'],
   likes: 100, 
   comments: [ 
      {
         user:'user1',
         message: 'My first comment',
dateCreated: new Date(2011,1,20,2,15),
like: 0 }, { user:'user2', message: 'My second comments', dateCreated: new Date(2011,1,25,7,45), like: 5 } ] }
     _id: this key is like id in MySQL since it may be automagically generated by the database or manually assign this value. 
       ObjectId(59488f161edbf45b66e5b8f3) : tmpi :4-3-2-3
             59488f16 = timestamp
             1edbf4       = machine id
               5b66           = process id
               e5b8f3        = incremental VALUE


Advantages

      MongoDB is better than RDBMS with these issues:
  1. Schema less
    • MongoDB is a document database in which one collection holds different documents. Number of fields, content and size of the document can differ from one document to another.
  2. Structure of a single object is clear.
  3. No complex joins.
  4. Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that's nearly as powerful as SQL.
  5. Tuning.
  6. Ease of scale-out − MongoDB is easy to scale.
  7. Conversion/mapping of application objects to database objects not needed.
  8. Uses internal memory for storing the (windowed) working set, enabling faster access of data.

       Why Use MongoDB?
  1. Document Oriented Storage − Data is stored in the form of JSON style documents.
  2. Index on any attribute
  3. Replication and high availability
  4. Auto-sharding
  5. Rich queries
  6. Fast in-place updates
  7. Professional support by MongoDB

       Where to Use MongoDB?
  1. Big Data
  2. Content Management and Delivery
  3. Mobile and Social Infrastructure
  4. User Data Management
  5. Data Hub




Reference
You may leave comment to improve it.
Thank you from THAILAND.

Android OS: Fundamental Awareness

Thai government single policy     *** IMPORTANT *** Please carefully take a look this post https://chattrawits-security.blogspo...