Thursday 12 October 2017

What is Mysql


What is Mysql?
MySQL is an open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter, and "SQL", the abbreviation for Structured Query Language.
Today, Its most widely used in Web Development.




What are Client programs?
Communicating with the server to manipulate information.The following list of client programs:
  • MySQL Query Browser and MySQL Administrator.
  • All mysql is a command-line program.


What are three layer of Mysql Architecture?
Following are 3 layer of Mysql Architecture
  1. Application Layer: It represents the interface for all type of users, The user who is interacting with databases.
    • Sophisticated User
    • Specialized User
    • Naive User
    • Database Administrators
  2. Logical Layer: Core functionality of RDBMS is represented in the logical layer.
  3. Physical Layer: It is responsible for the storage of variety of information and that are following.
    • Data Files: It store user data
    • Data dictionaryr: store metadata about the structure of the database.
    • Statistical Data: Statistical information about the data
    • Log Information: Keep the track of query information.



Question: In which language it was written?
C/C++


Question: What is current Stable Version ?
5.7.21 / 15 January 2018;


Question: How to change the collation of column, table and database?
ALTER TABLE `hotels` CHANGE `Name` `Name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;




Wednesday 11 October 2017

How to get Speech Recognition from Audio OR Video

How to get Speech Recognition from Audio OR Video

Question: What does do the voicebase.com?
Give the Audio/Video URL in API and get all Speech in Text.


Question: How to get the API Key?
You can request API access using this form: http://info.voicebase.com/request-api-key


Question: What other it can do?
  1. Machine-generated Transcript
  2. Per Word Confidence
  3. Time-stamped words
  4. Player SDK
  5. Stereo speaker ID



Question: How to get media-id in voicebase api?
    //Get Token
    $tokenKey='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUadDKFDSLJLDLJKJLKKWWUEUUEEUUEUEUUEUUEUDUUDUDDLDLDLLDLLLDLLDLDLKFMFKK2b2ljZWJhc2UuY29tIn0.8M4bmafBqdlqon-o65CMKabBjxVatDObzRklDoUysNU';

    //Get Video URL
    $videoAudioURL='http://example.com/audio/filename.mp3';

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://apis.voicebase.com/v3/media",
      CURLOPT_RETURNTRANSFER => true,
        CURLOPT_SSL_VERIFYPEER=>false,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\n{$videoAudioURL}\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
      CURLOPT_HTTPHEADER => array(
        "authorization: Bearer {$tokenKey}",
        "cache-control: no-cache",
        "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",    
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }



Output
{
  "_links": {
    "self": {
      "href": "/v3/media/70cafaf7-89bc-474f-bb02-c59f0181a51f"
    },
    "progress": {
      "href": "/v3/media/70cafaf7-89bc-474f-bb02-c59f0181a51f/progress"
    },
    "metadata": {
      "href": "/v3/media/70cafaf7-89bc-474f-bb02-c59f0181a51f/metadata"
    }
  },
  "formatVersion": "3.0.1",
  "mediaId": "70cafaf7-89bc-474f-bb02-c59f0181a51f",
  "status": "accepted",
  "dateCreated": "2017-10-11T08:46:56.343Z",
  "metadata": {
    
  },
  "mediaContentType": "video/mp4",
  "length": 222956
}



Question: How to get transcription from mediaID?
        //Get Token
        $tokenKey='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUadDKFDSLJLDLJKJLKKWWUEUUEEUUEUEUUEUUEUDUUDUDDLDLDLLDLLLDLLDLDLKFMFKK2b2ljZWJhc2UuY29tIn0.8M4bmafBqdlqon-o65CMKabBjxVatDObzRklDoUysNU';
        $mediaId='70cafaf7-89bc-474f-bb02-c59f0181a51f';

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://apis.voicebase.com/v3/media/{$mediaId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"mediaUrl\"\r\n\r\nhttp://enterprise-dev2.georama.com/test/love.mp3\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
  CURLOPT_HTTPHEADER => array(
    "authorization: Bearer {$tokenKey}",
    "cache-control: no-cache",
    "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
    "postman-token: 0effcf6c-38cd-0ebc-dc87-3d821fd5ca72"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
Output
{
  "confidence": 0.16606535003699963,
  "words": [
    {
      "p": 0,
      "c": 0.998,
      "s": 4230,
      "e": 4540,
      "w": "Hello"
    },
    {
      "p": 1,
      "c": 0.95,
      "s": 4549,
      "e": 4660,
      "w": "my"
    },
    {
      "p": 2,
      "c": 0.941,
      "s": 4670,
      "e": 4799,
      "w": "name"
    }
  ]
}