<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mohammed Hassan on Medium]]></title>
        <description><![CDATA[Stories by Mohammed Hassan on Medium]]></description>
        <link>https://medium.com/@melfarw?source=rss-2839bdc3f5a1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*R3CR3JNVSFqitXZkpWME8g.jpeg</url>
            <title>Stories by Mohammed Hassan on Medium</title>
            <link>https://medium.com/@melfarw?source=rss-2839bdc3f5a1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 18:58:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@melfarw/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Oracle DB instances and Listener start automatically on AWS EC2]]></title>
            <link>https://medium.com/@melfarw/oracle-db-instances-and-listener-start-automatically-on-aws-ec2-54258a70b9ff?source=rss-2839bdc3f5a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/54258a70b9ff</guid>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-database]]></category>
            <dc:creator><![CDATA[Mohammed Hassan]]></dc:creator>
            <pubDate>Thu, 03 Jan 2019 08:39:42 GMT</pubDate>
            <atom:updated>2019-01-03T08:44:45.710Z</atom:updated>
            <content:encoded><![CDATA[<p>I just wanted to share this quick write up on how to stop and start your Oracle database and listener automatically on AWS EC2 . I use this approach for 10g, 11g, and 12c and so far I haven’t had any issues.</p><p>1- login as EC2-user on ec2 that was database installed</p><p>ssh <a href="/service/mailto:ec2-user@10.0.4.77">ec2-user@1</a>.0.0.0</p><p>2- Change user as root : sudo su</p><p>- Edit the /etc/oratab file and make sure that the databases are set to stop and start when the dbshut and dbstart commands are passed with value : Y</p><p>Oracle provides the means to do this using scripts called dbshut and dbstart that are located in your $ORACLE_HOME/bin directory. The above two scripts actually read the /etc/oratab file to find out which databases to stop and start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*sXYXOqjtfSCJMGM5mqxvVQ.png" /><figcaption>Edit the /etc/oratab</figcaption></figure><p>3- Next we will need to create a script to take advantage of the dbshut and dbstart commands when you are shutting down or rebooting the server. Create a file: /etc/init.d/dbora</p><ul><li>In the file paste the following:</li></ul><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>#!/bin/sh<br># chkconfig: 345 99 10<br># description: Service to start and stop Oracle Database and Listener<br>#<br># processname: oracle<br># config: /etc/oratab<br># pidfile: /var/run/oracle.pid</p><p># Source function library.<br>. /etc/init.d/functions</p><p>RETVAL=0<br>ORA_OWNER=”oracle”<br>ORA_HOME=”/opt/oracle/product/1221_64&quot;</p><p># See how we were called.</p><p>prog=”oracle”</p><p>start() {<br>echo -n $”Starting $prog: “<br>su — $ORA_OWNER -c “$ORA_HOME/bin/dbstart $ORA_HOME”<br>su — $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start LISTENER_DXCTST”<br>RETVAL=$?<br>echo<br>[ $RETVAL -eq 0 ] &amp;&amp; touch /var/lock/subsys/dbora</p><p>return $RETVAL<br>}</p><p>stop() {<br>echo -n $”Stopping $prog: “<br>su — $ORA_OWNER -c “$ORA_HOME/bin/dbshut $ORA_HOME”<br>su — $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl stop LISTENER_DXCTST”<br>RETVAL=$?<br>echo<br>[ $RETVAL -eq 0 ] &amp;&amp; rm -r /var/lock/subsys/dbora</p><p>return $RETVAL<br>}</p><p>restart() {<br>stop<br>start<br>}</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>You need to make sure to change the script so that the ORA-OWNER and ORA_HOME match your configuration.</p><p>4- we need to active service and run the following commands to change permissions :</p><pre>[root@oracle ~]# chgrp  dba /etc/init.d/dbora<br>[root@oracle ~]# chmod 750 /etc/init.d/dbora<br>[root@oracle ~]# chkconfig --level 345 dbora on</pre><p>With that you should be able to now reboot your server and have the databases and listener(s) stop and start automatically.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54258a70b9ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tools for Big Data Analytics]]></title>
            <link>https://medium.com/@melfarw/tools-for-big-data-analytics-b66f59568d4a?source=rss-2839bdc3f5a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b66f59568d4a</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[hadoop]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Mohammed Hassan]]></dc:creator>
            <pubDate>Fri, 10 Aug 2018 13:24:14 GMT</pubDate>
            <atom:updated>2018-08-10T13:24:14.922Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0aMrBUXG8Nka7FNrf9qc8w.png" /></figure><h3>1. Hadoop</h3><p><a href="http://hadoop.apache.org/">Apache Hadoop</a> is an open-source software framework that facilitates distributed processing of very large data sets across hundreds of inexpensive servers that operate in parallel. It’s been quite a time business have been using Hadoop to sort and analyze big data. Hadoop uses simple programming models to ensure distributed processing of large data sets and making them available on local machines.</p><p><a href="http://www.sas.com/en_us/insights/big-data/hadoop.html">Click here to learn more about Hadoop</a></p><h3>2. Storm</h3><p><a href="http://storm.apache.org/">Storm</a>, another product from Apache, is a real-time big data-processing system. Storm is also open source and can be utilized by both small and big businesses. It is fault tolerant and goes well with any programming language. Storm is capable of performing data processing even if any of the connected nodes in the cluster die or messages are lost. Other tasks that Storm can perform is distributed <a href="http://searchsoa.techtarget.com/definition/Remote-Procedure-Call">RPC</a> and online machine learning. Storm is a good choice for big data analytics as it integrates with existing technologies, which makes processing of big data much easier.</p><p><a href="https://www.tutorialspoint.com/apache_storm/apache_storm_introduction.htm">Click here to learn more about Storm</a></p><h3>3. Hadoop MapReduce</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*rEnNAp6LpBZxeyHX" /><figcaption><em>Image source: gigaspaces.com</em></figcaption></figure><p><a href="https://www-01.ibm.com/software/data/infosphere/hadoop/mapreduce/">Hadoop MapReduce</a> is a programming model and software framework for writing data processing apps. Originally developed by Google, MapReduce enables quick processing of vast amounts of data in parallel on large clusters of compute nodes.</p><p>The MapReduce framework has two types of key functions. First, the map function which separates out data to be processed, and second, the reduce function which performs data analysis. As MapReduce involves two stage processing, it’s believed that a large number of varied data analysis questions can also be answered with it.</p><p><a href="http://blog.tonybain.com/tony_bain/2008/09/what-is-mapreduce.html">Click here to learn more about MapReduce</a></p><h3>4. Cassandra</h3><p><a href="http://cassandra.apache.org/">Apache Cassandra</a> is highly scalable <a href="https://en.wikipedia.org/wiki/NoSQL">NoSQL</a> database. It is capable of monitoring large sets of data spread across large clusters of commodity servers and the cloud. Cassandra was initially developed at Facebook out of a need for a database to power their Inbox Search. The big data tool is now widely used by many famous enterprises with large, active datasets, including Netflix, eBay, Twitter and Reddit.</p><p><a href="http://datascale.io/cassandra-benefits/">Click here to learn more about Cassandra</a></p><h3>5. OpenRefine</h3><p><a href="http://openrefine.org/">OpenRefine</a> (formerly GoogleRefine) is an open source powerful tool that is meant to work with messy data. The tool allows quick cleaning of huge sets of messy data. Then, it transforms the data into useable format for further analyses. Even non technical users can integrate OpenRefine into their data workflow at ease. OpenRefine also enables to create instantaneous links between datasets.</p><p><a href="https://en.wikipedia.org/wiki/OpenRefine">Click here to learn more about OpenRefine</a></p><h3>6. Rapidminer</h3><p><a href="https://rapidminer.com/">Rapidminer</a> is an open source tool that is capable of handling unstructured data, like text files, web traffic logs, and even images. The tool is basically a data science platform that relies on visual programming for operation. With Rapidminer comes functions that include manipulation, analysis, modeling, creation of models, and fast integration in business processes. Rapidminer has become <a href="http://www.kdnuggets.com/2014/06/kdnuggets-annual-software-poll-rapidminer-continues-lead.html">popular among data scientists</a> as it offers a full suite of tools to help make sense of data and convert it to valuable business insights.</p><p><a href="https://www.getapp.com/business-intelligence-analytics-software/a/rapidminer/">Click here to learn more about Rapidminer</a></p><h3>7. MongoDB</h3><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /><figcaption><em>Image courtesy: devGeeK</em></figcaption></figure><p><a href="https://www.mongodb.com/what-is-mongodb">MongoDB</a> is an open source and widely used database for high performance, high availability, and easy scalability. It is classified as a NoSQL database. MongoDB’s distributed key value store, MapReduce calculation capability and document oriented NoSQL features make it a popular database for big data processing. MongoDB is well suited for programming languages like JavaScript, Ruby and Python. MongoDB is easy to install, configure, maintain and use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b66f59568d4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an Intelligent Chatbot for Slack]]></title>
            <link>https://medium.com/@melfarw/building-an-intelligent-chatbot-for-slack-774abb669172?source=rss-2839bdc3f5a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/774abb669172</guid>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[mobile-apps]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Mohammed Hassan]]></dc:creator>
            <pubDate>Fri, 10 Aug 2018 13:04:03 GMT</pubDate>
            <atom:updated>2018-08-10T13:36:55.291Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e8v1xC0NTgoduh_ei9F7Pw.png" /></figure><h3>What is a Chatbot and why should you care?</h3><p>A chatbot provides a way for your users to give complex commands and get complex tasks done using simple language.</p><p>For example, assume you want to buy a pair of shoes from an ecommerce site that has it’s own chatbot. You can tell the bot that you are looking to buy some shoes, and it would have a conversation with you to gather more details, like “what brand/colour?”, “what’s your size?” and “what kind of shoes? Sneakers or boots?”. Instead of browsing through the website, you will have a conversation with the bot, <strong>mirroring the type of experience you would have when you go to the retail store.</strong></p><p>Another example of a use case would be Starbucks’ chatbot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GWpIM-P7ww4yxFzQ.jpg" /></figure><p>It’s easy to order coffee while conversing with the bot, and then clicking on a bunch of buttons and searching for the orders manually. For these reasons, chatbots are considered to be one of the best ways to engage with the user. Now that we know what a chatbot is, let’s get into the basics. Below is my definition of a chatbot:</p><blockquote><em>A chatbot is a service, powered by rules and sometimes artificial intelligence, that you interact with via a chat interface. The service could be any number of things, ranging from functional to fun, and it could live in any major chat product (Facebook Messenger, Slack, Telegram, Text Messages, etc.).</em></blockquote><p>In layman terms, a chatbot is a program that interacts with a user on a chat platform. It can be as dumb (fun) as you want it to be and as smart (resourceful) as you require it to be!</p><h3>Anatomy of our Chatbot</h3><p>There are various ways of creating a chatbot based on what kind of functionality we want it to have. In this tutorial, we are going to build a basic chatbot. Below is a high level design of it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/0*uWT6LTVfghrTVthp.png" /></figure><p>We will use Slack’s API to send the messages to DialogFlow (DF). DialogFlow’s NLP engine would understand the intent and semantics behind the user’s messages, and craft an appropriate reply for our chatbot to send to the user. The Slack interface and DialogFlow together make the chatbot. To put this in an analogy, the Slack interface would be the “face” of our bot, and DialogFlow would be the “brain”.</p><h3>A simple rule based Chatbot using Slack</h3><p>For this study, Slack is our platform of choice, as it is used widely across the world for organization level communications. It also has very good support for adding bots through its APIs. Before we can do anything with Slack however, we need to get a few things ready:</p><ul><li>A Slack workspace to test our bot</li><li>A Slack application for the bot</li></ul><h3>Creating a Slack Workspace</h3><p>A workspace (group) is Slack’s way of organizing teams.you are part of a workspace. A workspace’s URL address looks like this:</p><pre><a href="https://workspace-name.slack.com/">https://workspace-name.slack.com</a></pre><p>You can create your own workspace at this url:</p><pre><a href="https://slack.com/create#email">https://slack.com/create#email</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F5Fc8ewsV_Nb--6A.png" /></figure><p>Once you enter your email, Slack will send you a 6 digit code on your email id. Follow their given steps to select your name, password, team size. Then, Slack asks you to provide a name for the group:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/0*MdbqybDLD7CprBOB.png" /></figure><p>You can give it any name you like. I’ll name mine <strong>something</strong> . Once you select the URL address and create your workspace, Slack will recommend sending email invitations. You can just skip this step by clicking on <strong>“Skip for Now” </strong>and voila! You just created your own workspace on Slack. Try sending some messages!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d84T2eEFk7xRdp78.png" /></figure><h3>Creating a Slack Application</h3><p>Now that you have a workspace to experiment with, you need an application where you can attach your bot. Create the app on the below link:</p><pre><a href="https://api.slack.com/apps">https://api.slack.com/apps</a></pre><p>Click on “Create App” and give a name to the app and select your workspace:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/0*VwzHk3pVu9JtGwLg.png" /></figure><p>This will redirect you to your app dashboard. From there, you can select the <strong>“Bots”</strong> option:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/0*w4aCcpu-B12HAMco.png" /></figure><p>Click “Add a Bot User” –&gt; Give a name to your bot. In my case, I have named it “skynet”. Now that we have created a bot for our app, we need to add it to our workspace so we can chat with it! Go back to the above app dashboard and scroll down to find the “Install App to Workspace” option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/0*5h_5GgzQb-Xd8FzF.png" /></figure><p>Once you do that, Slack will ask you to “authorize” the application. Go ahead and accept the authorization. <strong>Now that we have authorized the bot, let’s create a simple rule based chatbot using python.</strong></p><h3>Using python to create a rule based bot</h3><p>Before we are able to connect any external program to our Slack bot, we need to ensure that Slack has the right authorization to access the bot. For that, Slack provides an “auth token” that we need to provide when trying to connect with it. Go back to the “app dashboard” and select the “OAuth &amp; Permissions” option:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TKLtIpV8w9-W_5IQ.png" /></figure><p>This will open the permissions settings of the app. Select the “Bot User OAuth Access Token” and save it (I have hidden them for security reasons). This token is instrumental in connecting to our bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/0*YdeZUYMoICLsOgko.png" /></figure><p>Now that you have everything set up, let’s write some python code. To make it easy to connect to the Slack API, I have written a small python program. Let’s setup the code environment.</p><p><strong><em>Note: </em></strong><em>The entire project is in </em><strong><em>python 2.7</em></strong><em>.</em></p><p>1.Install <em>slackclient</em> library.</p><pre>$pip install slackclient</pre><p>2. Clone my slack repository.</p><pre>$git clone <a href="https://github.com/mohdsanadzakirizvi/Slack-AI-ChatBot.git">https://github.com/mohdsanadzakirizvi/Slack-AI-ChatBot.git</a></pre><p>3. Set your slack auth token to the value of <strong>“Bot User OAuth Access Token” </strong>and the name of your bot in the environment variables.</p><pre>$export SLACK_TOKEN=&lt;your_bot_user_oauth_token_here&gt;<br>$export BOTNAME=&lt;your_botname_here&gt;</pre><p>For example, my BOTNAME is “skynet” so I’ll set it like this:</p><pre>$export BOTNAME=skynet</pre><p>4. Go to the <em>Slack-AI-ChatBot</em> directory.</p><pre>$cd Slack-AI-ChatBot</pre><p>5. Start the python bot.</p><pre>$python mainbot.py</pre><p>You should now get the below notification:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/0*Lqmze6_yTDdvI718.png" /></figure><p>Now that everything is set up, you can just go to your Slack workspace and start chatting with your bot. Note that it would reply only when you talk to it by using its mention @chatbotname (just like we normally do in Slack).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/0*5SAKCruL2FXw26_i.png" /></figure><p>These are some of the hard coded rules I have preset in the bot. You can change them or add your own rules. If you open the file <strong>mainbot.py</strong>, you will find the below function:</p><pre>def handle_command(slack_api, command, channel):<br>    &quot;&quot;&quot;<br>    Recieves commands directed for the bot, if they are valid perform action <br>    else resends clarification<br>    &quot;&quot;&quot;<br>    EXAMPLE_COMMAND = &#39;do&#39;<br>    if command.lower().startswith(EXAMPLE_COMMAND) or command.lower().startswith(&#39;what&#39;):<br>        slack_api.rtm_send_message(channel, &#39;Yes, code me further to do that!&#39;)<br>    elif command.lower().startswith(&#39;hi&#39;) or command.lower().startswith(&#39;hey&#39;) or command.lower().startswith(&#39;hello&#39;) or command.lower().startswith(&#39;who are you&#39;):<br>        slack_api.rtm_send_message(channel, &#39;Hey, I\&#39;m your slack bot, how may I help you?&#39;)<br>    else:<br>        print &#39;Invalid Command: Not Understood&#39;<br>    slack_api.rtm_send_message(channel, &#39;Invalid Command: Not Understood&#39;)</pre><p>This is where all the magic is happening. Go ahead and try adding your own rules and make the chatbot as customizable as you can! Also, I have added comments throughout the code in the project to make it understandable. Feel free to <a href="https://api.slack.com/bot-users">explore the code here</a> to understand how the process works.</p><p>Now that we have got a taste of building a chatbot for Slack using custom rules, let’s see how can we use the power of NLP and ML to make our bot even more intelligent!</p><p><strong><em>Note: </em></strong><em>Every time you make changes in the code, you will have to restart the program for the changes to take effect.</em></p><h3>Understanding Google’s Dialogflow (api.ai) for NLP and Machine Learning</h3><p>Before we proceed, recall the anatomy of our chatbot we discussed right at the beginning of the article. For your reference, below is that diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/0*EEYZuD68D_AyL8gr.png" /></figure><p>The first part, which included setting up Slack, has been completed. Now, it’s time to explore the DialogFlow api.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZgJdfJMxMjBTY936.png" /></figure><h3>Setting up DialogFlow</h3><p>1. Go to <a href="https://dialogflow.com/">https://dialogflow.com/ </a>and signup for free using your Google account</p><p>2. You will get access to your console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ILit1m_nYpLktZU4.png" /></figure><h4>Agents</h4><p>DialogFlow works by creating agents. Agents are best described as NLU (Natural Language Understanding) modules. These can be included in your app, product, or service. They transform natural user requests into actionable data.</p><p>This transformation occurs when a user input matches one of the intents inside your agent. Intents are the predefined or developer-defined components of agents that process a user’s request.</p><p>For example, you tell the chatbot that you are feeling cold, or you want the fan to be turned off. The agent needs to know what the intent is behind these statements. More specifically, “What does the user wants me to do?”. Once the intent is known, a corresponding action/reply can be generated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*Cji2vXOiGHBH1OGs.png" /></figure><p>Let’s start by creating our own agent. We’ll take the example of a chatbot for a pizza company.</p><p>On the top left of the window, you’ll see an option to “Create Agent”. Click on it and select a name for your agent. I have named mine as “pizzaBot”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/0*7YcJCd4LUxRHL-eL.png" /></figure><p>Now that we have the agent ready, we need to define some entities it needs to recognize and some intents it needs to understand.</p><h4>Understanding intents and entities</h4><h4>a.) Entity</h4><p>Entities are a group of objects that you need the agent to recognize. For example, if we are creating a pizzaBot, some of our entities would be objects that are usually required with a pizza:</p><ol><li>Breads</li><li>Toppings</li><li>Cheese, etc.</li></ol><p>Let’s create our entities.</p><ul><li>Click on the “Entities” button on the left and select “Create Entity”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/0*oRdTOCdVihLsHhmh.png" /></figure><ul><li>Select a bunch of toppings for your pizza.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/0*gFXdkXtvmDb7ywWo.png" /></figure><ul><li>On clicking the “Save” button, you’ll have your toppings entity.</li><li>Let’s add another entity “Cheese” for our agent:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/0*ZbAl7e2MnuCeL613.png" /></figure><p>Now that our entities are ready, we need to define some intents that will help our agent understand what to do with these entities.</p><h4>b.) Intent</h4><p>In simple words, an intent is a mapping between what the user “says”, and what operation your bot takes on that instruction. If you click on the intent tab, you’ll see that there are two intents already present.</p><ul><li>The default fallback intent when the bot doesn’t understand what the user is saying, and</li><li>the welcome intent which is triggered when the user says something along the lines of “hello” and you want the bot to respond to that with something similar.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/0*TTy8mq1sylmnJ2-v.png" /></figure><p>Let’s play around with the default intents. Type “pizza please!” in the demo field on the right and see how the agent reacts:</p><p>Since we haven’t trained our agent yet, it used the default fall back intent and responded with one of the many responses it has stored for that scenario. Let’s create an intent to cook a pizza and call it “makePizza”. Click on create intent, select a name, and save it. You will see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/0*L7hWjULbO5l9h0Vo.png" /></figure><p>The way DialogFlow works is by taking some sample user sentences to start out with. Then, it trains it’s engine to generate an algorithm that best matches these sentences to the correct intents. Let’s add some basic training phrases for our agent:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/0*XzHsQQ1NTmiYF0Ah.png" /></figure><p>The idea is to train our agent in as diverse and varied examples as possible to make it more precise. Once you have set up the training phrases, you need to define <strong>what action the agent should take if it encounters this intent.</strong> You can do that by clicking on the “Add Parameters and Action” option. Add the following actions and parameters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/0*GAK2A7S-Ij5KrUui.png" /></figure><p><strong>What do these column names mean?</strong></p><ul><li><strong>Required</strong> — Defines whether this parameter is mandatory for the action.</li><li><strong>Entity</strong> — Here we map the parameters to the entities we have predefined.</li><li><strong>Value — </strong>If we want to re-use this parameter in the response, we can simply use it’s value name and the parameter will be substituted in it’s place.</li><li><strong>Is List </strong>— If the parameter value can be a list (for instance, there can be more than one toppings in the order).</li><li><strong>Prompts — </strong>What should the agent say while prompting the user for the parameters? We customize that here.</li></ul><p>Click on “Define prompts” next to toppings and write “What toppings would you like on your pizza?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*7MhS42gkuHg49RTa.png" /></figure><p>Similarly, add one for cheese. Wow. That was a lot of work. Let’s see what we achieved. Save the intent and get back to the demo area of the agent. Try asking the agent for a pizza. Since we have trained the agent on a few sample phrases, it should be able to immediately recognize any phrase related to ordering a pizza. It should also ask you for the toppings and for the type of cheese you want? Checkout the following video to see what I’m talking about.</p><p>Notice how natural the conversation feels. Once you trigger an intent, the agent tries to extract the parameters you have marked as important from the user by having a conversation. Note that you only need to give a few examples for the training phrase; the NLP engine of DialogFlow takes care of the rest.</p><p>Also, you can add custom responses for the user in case the intent is successfully acted upon and completed. Click on the “Add Responses” button below the “Action and Parameters”, add the following response, and save it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/0*g4xPik-SqHCjF1D-.png" /></figure><p>Once your pizza is ready, you’ll be greeted by the below message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/0*gzzG006fw94OoUnY.png" /></figure><p>What happened behind the scenes? When we used $cheese and $toppings in the response field, they were automatically replaced by the values the parameters extracted from the user’s conversation. Convenient, isn’t it?</p><h3>Training the agent</h3><p>Now that everything about the agent is set up , it’s time to train it. Click on the settings icon next to your agent name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/0*5PRSCB80kNH6JX84.png" /></figure><p>In the settings window, select “ML Settings”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*dWcdB4tmkQCtOdRv.png" /></figure><p>Here are few important things to note:</p><ol><li>There are two modes to train the model:</li></ol><ul><li>Hybrid mode</li><li>ML only mode</li></ul><ol><li><strong>Hybrid mode</strong> is good when you have<strong> less training samples.</strong> If you have a large set, you should go for the ML mode</li><li><strong>ML Classification Threshold</strong> is the minimum confidence score that the model should have. Only then can it take an action on an intent, otherwise it will fall back to the “Default Intent” we discussed earlier.</li></ol><p>Click on the “Train” button and once the agent is trained, save it. Now our NLP agent is good to go. Let’s go to the next step and integrate this with our Slack app to make the chatbot complete!</p><h3>Bringing the Chatbot to life (Integrating DialogFlow and Slack)</h3><p>DialogFlow (DF) is an excellent choice when it comes to integration with most popular applications. <strong>It</strong> <strong>supports integration with Slack right out of the box</strong>. Let’s get our DF agent to work with our Slack bot!</p><h3>Setting up Slack app credentials with DialogFlow</h3><p>On the left side of the window, click on the “Integrations” button and you will see a bunch of options. Select the Slack icon and click settings beneath that. The below box will pop up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/0*buzVhTjRlUamxi5V.png" /></figure><p>On the top right hand side, toggle on the switch to “turn on” the integration with Slack.</p><p>Scroll down and you will find fields to enter your Slack app’s credentials:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/0*UE-jWltQig-UG3cr.png" /></figure><p>For that, head back to your Slack app’s console. If you don’t have it opened already, just go to the following URL and select your app:</p><pre><a href="https://api.slack.com/apps">https://api.slack.com/apps</a></pre><p>Scroll down on the page and you’ll find your app’s credentials (I have hidden them for security reasons).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/0*NcH69LAEoPF4RlVc.png" /></figure><p>Copy them to the respective fields in the DialogFlow page.</p><p><strong><em>Note: </em></strong><em>To copy the “Client Secret”, you have to first click on the “Show” option button next to it. After you have copied the credentials, click “Start” on the bottom right of the Slack box in DialogFlow.</em></p><h3>Continuing Slack Setup</h3><p>Now that you’ve set up Slack and Dialogflow, you’ll need to enable OAuth (helps in authentication), Event Requests URLs (provided by Dialogflow), and Event Subscriptions (what kind of events does our bot listen to?).</p><h4>Add OAuth URL</h4><ol><li>Copy the <strong>OAuth URL</strong> from Dialogflow’s Slack setting p.age</li><li>Go to the Slack Developer Console and click on <strong>OAuth &amp; Permissions</strong> in the left hand menu.</li><li>Click on the <strong>Add a new Redirect URL</strong> button and paste the OAuth URL.</li><li>Click <strong>Add.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/0*lARShzRSyeEdYrhS.png" /></figure><h4>Add Event Request URL</h4><ol><li>Copy the <strong>Event Request URL</strong> from Dialogflow’s Slack setting page.</li><li>Go to the Slack Developer Console and click on <strong>Event Subscriptions</strong> in the left menu.</li><li>Click on the switch to enable Events, and paste the Event Subscription URL in the <strong>Request URL</strong> field.</li></ol><p>After a few moments you should see a green “Verified” text above the Request URL field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/0*I019PRY4_qMX1Vhf.png" /></figure><h4>Enable Event Subscriptions</h4><p>Event subscription is the most crtitical thing for the chatbot. <strong>It basically tells Slack what kind of events our bot will listen to and get triggered.</strong> Events can range from someone joining a channel to a new personal message.</p><ol><li>Click on <strong>Event Subscriptions</strong> in the left menu.</li><li>Click the switch to enable the option.</li><li>Under the <strong>Subscribe to Bot Events</strong> , click on the <strong>Add Bot User Event</strong> button.<br> This will reveal a text field and a list of events. You can enter terms into this field to search for events you want your bot to respond to. Here’s a list of events that I suggest adding:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/0*SedrorvDPwgpmJN5.png" /></figure><ol><li>Once you’ve added the events, click the <strong>Save Changes</strong> button at the bottom of the screen.</li></ol><h4>Add Your Slack Bot to a Team</h4><ol><li>In the Slack Developer Console, click on <strong>Manage Distribution</strong> in the left menu.</li><li>Under the <strong>Share Your App with Your Team</strong> section, click the <strong>Add to Slack</strong> button.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*zaGDsvFTJPly86x1.png" /></figure><ol><li>On the next page, click the <strong>Authorize</strong> button to add the agent.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/0*bsWoPW8ng1yAfLG4.png" /></figure><p>Once you are done with this step, you can go back to your workspace and start conversing with your bot!</p><h3>Conversing with the chatbot</h3><p>Go to your workspace and either personal DM the bot, or mention his name like @botname and it will start responding.</p><p><strong>Did you notice?</strong></p><p>That apart from answering the normal pizza questions, the bot is also good at replying to generic messages like “hi”, “hello”, and “thank you”? This is possible because of a DialogFlow feature called “SmallTalk”.</p><h3>Configuring the Small Talk</h3><p>If you click on the “Small Talk” button on the left pane in DialogFlow, you’ll come across a set of options:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/0*gI13HWyOwhEmm1Z9.png" /></figure><p>Small Talk let’s you add how your bot should react when it receives generic comments like “Hi, Hello” or general questions like “Who are you?” and “What can you do?”. Go ahead and set it up with details specific to your project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=774abb669172" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ETL vs ELT]]></title>
            <link>https://medium.com/@melfarw/etl-vs-elt-d76ae24f6a66?source=rss-2839bdc3f5a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d76ae24f6a66</guid>
            <category><![CDATA[data-warehouse]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Mohammed Hassan]]></dc:creator>
            <pubDate>Fri, 10 Aug 2018 12:55:57 GMT</pubDate>
            <atom:updated>2018-08-10T12:55:58.225Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZscCPknCJ-W_VwwHEDnQfg.png" /></figure><p>The traditional concept of ETL is changing towards ELT — when you’re running transformations right in the data warehouse. Let’s see why it’s happening, what it means to have ETL vs ELT, and what we can expect in the future.</p><p>ETL stands for Extract, Transform, Load. It has been a traditional way to manage analytics pipelines for decades. With the advent of modern cloud-based data warehouses, such as BigQuery or Redshift, the traditional concept of ETL is changing towards ELT — when you’re running transformations right in the data warehouse. Let’s see why it’s happening, what it means to have ETL vs ELT, and what we can expect in the future.</p><h3>ETL is hard and outdated</h3><p>ETL arose to solve a problem of providing businesses with clean and ready-to-analyze data. We remove dirty and irrelevant data and transform, enrich, and reshape the rest. The example of this could be sessionization — <a href="https://statsbot.co/blog/event-analytics-define-user-sessions-sql/">the process of creating sessions out of raw pageviews and users’ events</a>.</p><p>ETL is complicated, especially the transformation part. It requires <strong>at least several months</strong> for a small-sized (less than 500 employees) company to get up and running. Once you have the initial transform jobs implemented, never-ending changes and updates will begin, because data always evolves with business.</p><p>The other problem of ETL is that during the transformation we <strong>reshape data into some specific form</strong>. This form usually lacks some data’s resolution and does not include data which is useless for that time or for that particular task. Often, “useless” data becomes “useful.” For example, if business users request daily data instead of weekly, then you will have to fix your transformation process, reshape data, and reload it. That would take a few weeks more.</p><blockquote><em>The more data you have, the longer the transformation process is.</em></blockquote><p>The transformation rules are very complex, and even if you have only a few terabytes of data, <strong>loading time can take hours</strong>. Given the time it takes to transform and load a big dataset, your end users will almost never get fresh data. “Today” will mean today last week, and “yesterday” — a week ago yesterday. Sometimes it takes several weeks or months to get a new update to rollup.</p><p>To summarize some of the cons of ETL:</p><ul><li>ETL is expensive to implement, especially for small and medium businesses.</li><li>ETL is expensive to maintain.</li><li>ETL eliminates access to raw data.</li><li>ETL is time consuming. Users have to wait for transformation to be finished.</li></ul><h3>Why have we been doing it for decades?</h3><p>A prior generation of data warehouses weren’t able to work with the size and complexity of raw data. So, we had to transform data before loading and querying it.</p><p>The latest advances in database technologies made warehouses much faster and cheaper. Storage is getting more accessible all the time, some data warehouses even separate pricing for storage and computation. For example, BigQuery <a href="https://cloud.google.com/bigquery/pricing">storage pricing</a> is quite cheap and you can just store all your raw data there.</p><p>The most important changes in recent years to data warehouses, which made the comparison of ETL vs ELT possible:</p><ul><li><strong>Optimized for analytical operations.</strong> Modern analytical warehouses tend to be columnar and optimized for aggregating and processing huge datasets.</li><li><strong>Cheap storage.</strong> No worries about what to store, you can just dump all your raw data into a warehouse.</li><li><strong>Cloud based.</strong> It scales infinitely and on-demand, so you can get the performance you need the moment you need it.</li></ul><h3>ETL vs ELT: running transformations in a data warehouse</h3><p>What exactly happens when we switch “L” and “T”? With new, fast data warehouses some of the transformation can be done at query time. But there are still a lot of cases where it would take quite a long time to perform huge calculations. So instead of doing these transformations at query time you can perform them in the warehouse, but in the background, after loading data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gfONebxg4qjZICNz.png" /></figure><p>Once raw data is loaded into a warehouse, heavy transformations can be performed. It makes sense to have <strong>both real-time and background transformations in the BI platform</strong>. Users consume and operate on the business definitions level when querying data, and BI is either performing transformation on-the-fly or querying data already transformed in the background.</p><blockquote><em>This approach gives flexibility and agility for development of a transformation layer.</em></blockquote><p>Software engineers nowadays deploy several times a day and praise continuous delivery. The same principle should be adopted for how we approach a transformation. If metric definition changes or some new data is required, one can easily make this changes in hours, not weeks or months. It is especially valuable for fast-growing startups, where changes happen daily and data teams have to be flexible and agile to keep up with product development and business needs.</p><p>As data warehouses advance more and more, I’m sure we will see how query time transformations will entirely replace background transformations. Before that happens, we can run some transformations in the background with ELT. Since they are already SQL based and run in the data warehouses, the final switch would be easy and painless.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d76ae24f6a66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrate Oracle Database to AWS]]></title>
            <link>https://medium.com/@melfarw/strategies-to-migrate-oracle-database-to-aws-b9d2abccb53a?source=rss-2839bdc3f5a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9d2abccb53a</guid>
            <category><![CDATA[data-migration]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Mohammed Hassan]]></dc:creator>
            <pubDate>Mon, 06 Aug 2018 15:26:33 GMT</pubDate>
            <atom:updated>2018-08-06T15:48:50.150Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*e--cLrtZtPqLOW2NGT2EEQ.png" /></figure><p>DB migration is one of the difficult tasks for solution architects and this document would be a starting point to migrate Oracle DB into cloud.</p><p><em>Listed out migration strategies for Oracle DB into Cloud:</em></p><p>1. One-Step migration — We can consider this for development environments or if the DB size is small and requires down time.</p><p>2. Two-Step Migration — This strategy is applicable for any size of the DB and requires minimal downtime</p><p>Step 1: The data is extracted from the source database at a point in time</p><p>Step 2: Data changed in the source database after the initial migration is propagated to destination before switch over</p><p>3. Zero-Downtime Migration — When we don’t have downtime, consider this option.</p><p>a. Hot backup (RMAN) and restored into AWS if the instance runs on EC2. We can’t use RMAN if the instance runs on RDS</p><p>b. Apply the changes at the destination using replication</p><p>i. We can use AWS DMS (Database Migration Service) or Golden gate</p><p><em>Migrating Data for Small Oracle Databases</em></p><p>If your source database is under 10G and if you have reliable high-speed internet connection you can consider below methods for data migration. Its just a guideline, you can consider the same for larger databases as well.</p><p><em>1. </em>Oracle SQL developer Database Copy: SQL developer can handle large volume of objects, it can comfortably migrate databases even if it has more number of objects. <em>Please note this method will not encrypt data during data transfer.</em></p><p>2. Oracle Materialized Views: You can use MV’s to migrate DBs runs on RDS or EC2. This gives flexibility of selective tables to migrate to cloud. This method is suitable for migrating limited number of tables. The data transfer will happen over Sql*Net. If the network security design doesn’t allow SqlNet connection then we can’t use this method</p><p>3. Oracle Sql*Loader: We can use this when DB runs on RDS or EC2. We can use SqlDeveloper to create Sql files for data migration</p><p>4. Export and Import Utilities: It’s a traditional data transfer method over dbs. We can use DataPump as most of our clients using DB version 10 and above</p><p><em>Based on my prior experience we usually go for DataPump and Hot backup (using RMAN) to migrate the databases. We migrated several databases in the past using Data pump and RMAN.</em></p><p><em>Migrating Data for Large Oracle Databases</em></p><p>This section describes three methods for migrating large databases:</p><p>1. Migration using Oracle Data Pump</p><p>2. Migrating using Oracle External Tables</p><p>3. Migrating using Oracle RMAN</p><p>Data migration using Oracle Data Pump</p><p>Oracle data pump requires data file to be available in the DB server instance to import them into the database. Since we can’t access RDS hardware directly, we need to use couple of EC2 instances (bridge instances) to transfer files from source to AW RDS instance. Please note that bridge instances only for the duration of the import; we can terminate the instances soon after the import is done. Please remember Oracle client should be available in bridge instances to proceed Data pump.</p><p>Use Tsunami UDP to move the files to an Amazon EC2 instance running the destination Oracle database in AWS.</p><p>Note: To use this method, your Amazon RDS database must be version 11.2.0.3 or later</p><p>Data migration using External Tables</p><p>It’s similar to Datadump. If your DB is small or you want to migrate only set of tables then you can consider this. But I would recommend to use sqlloader or Datadump to migrate the data than external tables as it has some limitations. Please refer Oracle documentation before proceed.</p><p>Data migration using RMAN</p><p>It’s one of the traditional method to migrate Oracle database. Please note that you can’t use this method when your DB is running on RDS. You can consider RMAN when the DB is running on EC2. You can use S3 to keep RMAN dump and restore to EC2 instance. If the DB size is more than 5TB then you can consider RMAN than other DB migration methods</p><p><em>DATA Replication using AWS DMS</em></p><p>It’s an AWS product and helps to migrate databases from on premise to AWS. It’s a low cost service. You can migrate a Tera byte data can be done as little as $3 using DMS</p><p>Advantages of using AWS DMS</p><ul><li>Zero downtime</li><li>Change data capture (CDC)</li><li>Migration only subset of data</li><li>Heterogeneous migration from different database platforms</li><li>Continuous data migration with high-availability</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9d2abccb53a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Data Services]]></title>
            <link>https://medium.com/@melfarw/aws-data-services-2cabf6b7634b?source=rss-2839bdc3f5a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cabf6b7634b</guid>
            <category><![CDATA[data-migration]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[data-management]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Mohammed Hassan]]></dc:creator>
            <pubDate>Mon, 06 Aug 2018 15:22:34 GMT</pubDate>
            <atom:updated>2018-08-06T15:34:39.579Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YzxLQaO8ty_tTJ0U-aFeLg.png" /><figcaption><strong>AWS Database Stack</strong></figcaption></figure><h3><strong>What is Amazon RDS?</strong></h3><p>Managed relational database service in the AWS cloud</p><p>Multi-engine support: Amazon Aurora, MySQL, Maria DB, <br> PostgreSQL, Oracle, SQL Server</p><p>Automated provisioning, patching, scaling, replicas, backup/restore</p><p>Easily scales to handle growth</p><p>High availability with Multi-AZ and Amazon Aurora Amazon RDS</p><h3><strong>Why use Amazon RDS?</strong></h3><p>Built-in high availability and cross-region replication <br> across multiple data centers</p><p>Even a small startup can leverage multiple data centers to design <br> highly available apps with over 99.95% availability</p><h3><strong>Which RDS engine should I use?</strong></h3><ul><li>Commercial</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*fmWLy2nffkA7leNcByAtnQ.png" /></figure><ul><li>Open Source</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JRewBeyp84jU_X_me8L1Fw.png" /></figure><ul><li>Cloud Native</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*Gv1ajYHPL5Ny0r8ZTmlBhQ.png" /></figure><h3><strong>Which instance type should I choose ?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YDooaAmbo6BCB9zj6q0Iaw.png" /></figure><h3><strong>Which storage type should I choose?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IwvjpQBi57gUBIlWdPWesw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cabf6b7634b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>