Sunday 23 June 2019

Mongodb Data Model Design - Embedded data model & Reference data model

Mongodb Data Model Design - Embedded data model & Reference  data model

Question: What is Data Model Design?
Data modeling is first step in database design and object-oriented programming as the designers. It start from conceptual model to logical model to physical schema.


Question: What are different type of Data Model Design?
  1. Embedded Data Models
  2. Reference Data Models



Question: What is Embedded Data Model?
In Embedded Data Model, we store all releated in single document.
For example:
there is a user with name of salman and he has multiple address in different countries.
In this Embedded model, we store the address along with his details. means address and user details in single document.


Question: Give example of embedded Data Model?
One user 'Salman" have multiple address (2 address).
{
  name: 'Salman',
  ssn: '123-456-7890',
  addresses: [
    {
      street: '123 Sesame St',
      city: 'jaipur',
      cc: 'IN'
    },
    {
      street: '123 Avenue Q',
      city: 'New York',
      cc: 'USA'
    }
  ]
}



Question: Where embedded Data Model are good to used?
  1. Data that does not change regularly
  2. Document that grow by a small amount
  3. Data that you'll often need to perform ascending query to fetch
  4. Fast reading speed



Question: What is Normalized Data Models OR Reference Data Model?
In Normalized Data model, we store the user information in multiple collections.
For example,
Single user have multiple address.
Store the user details in user collections.
Store the user address in address collections.
in address collection, we set the reference to user collection.


Question: Give example of Normalized Data Models OR Reference Data Model?
One user 'Salman" have multiple address (2 address).
User collection
{
  id: 100
  name: 'Salman',
  ssn: '123-456-7890',
  
}

User's address collection
 {
      street: '123 Sesame St',
      city: 'jaipur',
      cc: 'IN',
      user_id:100
    }
 {
      street: '123 Avenue Q',
      city: 'New York',
      cc: 'USA',
     user_id:100
}



Question: Where Reference Data Model are good to used?
  1. Large sub documents
  2. When immediate consistency is necessary
  3. Document grow with a large amount
  4. Fast write speed



Saturday 22 June 2019

How to create an RSS feed from URLs

How to create an RSS feed from URLs

Question: What is full form of RSS?
Rich Site Summary
Its also known as Really Simple Syndication.


Question: What is RSS feed?
It is standard web feed formats to publish the updated information of blog OR website.


Question: What is file extension of RSS Feed?
.xml or .rss


Question: Give a Sample of RSS Feeds?
Start the XML with following code.

<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0">
    <channel>
 <title>Web Technology experts Notes</title>
  <link></link>http://web-technology-experts-notes.in
  <description>We are Web Technology Experts Team who provide you Important information on Web Development</description>
        <item><title>How to create folder with extension like .EBextensions</title> <description>Suppose you want to create folder with name ".EBextensions" Create folder with name ".EBextensions." Press enter You will see "." will disapper automatically from end of string Folder with name ".EBextensions" created successfully.</description><link></link>http://www.web-technology-experts-notes.in/2016/12/how-to-create-folder-with-extension-like-ebextensions.html<pubdate>Tue, 21 Jun 2016 15:36:00 +0000</pubdate><media:thumbnail height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWxGQGHkE2lgyXWpEN-LW9mN1MrHB2ldKSvZX-Xn2ZlAh2Zqv33Saw1_sjYdq7i0N4XPzQ6ufeh8JXw6h2ER9sFqLYyXWMUNcJU7suHXO3bgb7EwMdCaRj7yn-hMVfw5VncU7H3gkryBQ1/s72-c/How+to+create+folder+with+extension.png" width="72" xmlns:media="http://search.yahoo.com/mrss/"></media:thumbnail></item>
        <item><title>FCM push notification example</title> <description>Question: What is FCM Messages? Full form of FCM is Firebase Cloud Messaging. FCM is a cross-platform messaging solution that lets you reliably deliver messages to android and IOS devices at no cost. </description><link></link>http://www.web-technology-experts-notes.in/2016/12/fcm-push-notification-example.html<pubdate>Tue, 21 Jun 2016 20:36:00 +0000</pubdate><media:thumbnail height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJjl1lCoOWux0EG3hYYW1-rJqB-3iJsLaqIK-zOTjD_2Z_sq9v29LsVY9iC3lfu-6LZLD2TNQOahaajIsOP2y-HSQRGhUoe18L5LnJBHTU0ekF_6nVQMwSrYrkaeAJHYhFFkcds6FHEb6m/s72-c/FCM+push+notification+example.png" width="72" xmlns:media="http://search.yahoo.com/mrss/"></media:thumbnail></item>
        <item><title>What are special characters? and how to remove special characters?</title> <description>Question: What are special characters? Special characters are selected punctuation characters present on standard US keyboard. Question: Provide list of special characters?</description><link></link>http://www.web-technology-experts-notes.in/2016/12/what-are-special-characters-and-how-to-remove-special-characters.html<pubdate>Wed, 22 Jun 2016 01:36:00 +0000</pubdate><media:thumbnail height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJjl1lCoOWux0EG3hYYW1-rJqB-3iJsLaqIK-zOTjD_2Z_sq9v29LsVY9iC3lfu-6LZLD2TNQOahaajIsOP2y-HSQRGhUoe18L5LnJBHTU0ekF_6nVQMwSrYrkaeAJHYhFFkcds6FHEb6m/s72-c/FCM+push+notification+example.png" width="72" xmlns:media="http://search.yahoo.com/mrss/"></media:thumbnail></item>
        <item><title>Node JS tutorial for beginner</title> <description>Question: What is NodeJS Node.js is a platform built for fast and scalable network applications. It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.</description><link></link>http://www.example.com/url4http://www.web-technology-experts-notes.in/2016/12/node-js-tutorial-for-beginner.html<pubdate>Wed, 22 Jun 2016 06:36:00 +0000</pubdate><media:thumbnail height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7anpECNis2R4U7MyWdWUbi9ygJyKA211ydgESbcWUPGgG3acZwMO4vAKe5MxE53DkFdTOMVPVe8AH76piiHPtCo2YmgVrbI4cabzc7lX1slYKhMOHNDi1oWtvTI4B6bz6qsXQVh-sJL-f/s72-c/What+are+special+characters+and+how+to+remove+special+characters.png" width="72" xmlns:media="http://search.yahoo.com/mrss/"></media:thumbnail></item>
    </channel>
</rss>
Question: Create a script for?
Question: From where I can validate the RSS Feed URL?
https://validator.w3.org/feed/


Question: From where I can validate the RSS Feed Data?
https://validator.w3.org/feed/#validate_by_input


Question: Give a script to generate rss feeds from URL?


$urls= array(
    'http://www.web-technology-experts-notes.in/2016/12/how-to-create-folder-with-extension-like-ebextensions.html',
    'http://www.web-technology-experts-notes.in/2016/12/fcm-push-notification-example.html',
    'http://www.web-technology-experts-notes.in/2016/12/what-are-special-characters-and-how-to-remove-special-characters.html',
    'http://www.web-technology-experts-notes.in/2016/12/node-js-tutorial-for-beginner.html',
    );

$dateTime=strtotime('Tue, 21 Jun 2016 10:36:00 +0000');
$siteMapXml = '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0"><channel>';

//Uncomment the below code to enable download
/*header("Content-type: application/xml");
header("Content-Disposition: attachment; filename=rss.xml");
header("Pragma: no-cache");
header("Expires: 0");*/
$siteMapXml.=' <title>Web Technology experts Notes</title>
  <link></link>http://web-technology-experts-notes.in
  <description>We are Web Technology Experts Team who provide you Important information on Web Development</description>';
foreach($urls as $url){    
    $dateTime+=(3600*5);
    $dateString=date('D, j M Y H:i:s +0000',$dateTime);
     $siteMapXml.="<item><title>Page Title</title> <description>Page Description</description><link></link>{$url}<pubdate>{$dateString}</pubdate><media:thumbnail height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWxGQGHkE2lgyXWpEN-LW9mN1MrHB2ldKSvZX-Xn2ZlAh2Zqv33Saw1_sjYdq7i0N4XPzQ6ufeh8JXw6h2ER9sFqLYyXWMUNcJU7suHXO3bgb7EwMdCaRj7yn-hMVfw5VncU7H3gkryBQ1/s72-c/How+to+create+folder+with+extension.png" width="72" xmlns:media="http://search.yahoo.com/mrss/"></media:thumbnail></item>";   
}
echo $siteMapXml.='</channel></rss>';


Question: Give the Sample URL of RSS
Download Sample RSS