Password for MySQL in Azure Web App

User name and password for MySQL PHPMyAdmin located in the file:


Posted in Short notes | Tagged , , | Leave a comment

MySQL in Azure

When I tried to move old WordPress site to Azure App Service the first problem I met is to import database to new Azure MySQL.

The simplest way is to use phpMyAdmin – click on MySQL In App and then on Manage. I created new empty database. Then I hope to import, but upload file size is limited to 8M, so I zipped my my 64M file and got a file 5.5M. PHPMyAdmin should be able to unzip the file. Now when tried to import file the process was timed out after 5 min. I added new extension PHP Manager to change PHP upload limit and execution time limit – nothing help.

As next step I tried to use phpMyAdmin console to do import file with command: source C:\sql\my_import.sql; . Doesn’t work.

Then I called Microsoft support. They suggest me to use Kudu debug console.

I uploaded my .sql file to /root/data/mysql/mysql folder, switched to D:\Program Files (x86)\mysql\\bin folder and run following command:

mysql.exe  –user=UserID –paswword=Password –port=50298 MyNewDB < D:/home/data/mysql/mysql/MyOldDB.sql

Unfortunately I got an error

ERROR 1062 (23000) at line 43: Duplicate entry ‘268226’ for key ‘PRIMARY’

Microsoft engineer told me it is because of AUTO_INCREMENT parameter in my file. So I was need to export my database again from my old MySQL but in Custom settings / Object creation options AUTO-INCREMENT check box should be cleaned. Uploaded again to Azure FTP and ran again

mysql.exe  –user=UserID –paswword=Password –port=50298 MyNewDB < D:/home/data/mysql/mysql/MyOldDB.sql

This time successfully!

Posted in Short notes | Tagged , , , | Leave a comment

Opt in opted out Silverpop contacts

The script below will try to update existing contact and if it is not exist – will create a new one. The script will read list of contacts from file lead-to-restore.csv line by line and will create new output file output-YEAR-MM-DD-HH-mm-ss.csv. 

require_once ‘/lib/Engage.php’;
// Configuration section – replace with your values before running
// replace with your IBM Marketing Cloud API endpoint hostname:
$apiHost = ‘’;
// replace with your IBM Marketing Cloud API username:
$username = ‘’;
// replace with your IBM Marketing Cloud API password:
$password = ‘password’;
set_time_limit(0); // ignore php timeout
ignore_user_abort(true); // keep on going even if user pulls the plug*
while(ob_get_level())ob_end_clean(); // remove output buffers
ob_implicit_flush(true); // output stuff directly
echo ‘<!DOCTYPE html><html><head></head><body>’; // webkit hotfix
echo “<br><br>— Trying to submit customer —<br>”;
echo “Logging into the IBM Marketing Cloud API on {$apiHost} as {$username}\n”;
$engage = new Engage($apiHost);
$engage->login($username, $password);
$outfile = “output-” . date(“Y-m-d-H-i-s”) . “.csv”;
$output = fopen($outfile, “w”);
echo(“Output file opened<br>”);
$input = fopen(“lead-to-restore.csv”, “r”);
echo(“Source file opened<br>”);
if ($input) {
while (($email = fgets($input)) !== false) {
$email = str_replace(array(“\r”, “\n”), ”, $email);
file_put_contents(“lead-to-restore.csv”, str_replace($email . “\r\n”, “”, file_get_contents(“lead-to-restore.csv”)));
echo(“<br>” . $email .”<br>”);
‘<VALUE>’ . $email . ‘</VALUE>’ .
‘<VALUE>’ . $email . ‘</VALUE>’ .
$response = $engage->execute($request);
$line = “Responce: ” . $response->RESULT->SUCCESS;
echo($line . “<br>”);
catch (Exeption $e)
echo $e->getMessage() . “\n”;
include ‘spopapi.php’;
fwrite($output, $email . ” : ” . $line . “\r\n”);

In additional we need Engage.php file in /lib/ folder:

class Engage
protected $apiHost = null;
protected $username = null;
protected $password = null;
protected $sessionId = null;
protected $lastRequest = null;
protected $lastResponse = null;
protected $lastFault = null;
public function __construct($apiHost)
$this->apiHost = $apiHost;
public function execute($request)
if ($request instanceof SimpleXMLElement) {
$requestXml = $request->asXML();
} else {
$requestXml = “<?xml version=\”1.0\”?>\n<Envelope><Body>{$request}</Body></Envelope>”;
echo(“Request XML: ” . $requestXml . “<br>”);
// NOTE: Make sure that your request string uses UTF-8 encoding
$this->lastRequest = $requestXml;
$this->lastResponse = null;
$this->lastFault = null;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $this->getApiUrl());
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestXml);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(‘Content-Type: text/xml; charset=UTF-8’, ‘Content-Length: ‘ . strlen($requestXml)));
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($curl, CURLOPT_TIMEOUT, 180);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
$responseXml = @curl_exec($curl);
if ($responseXml === false) {
throw new Exception(‘CURL error: ‘ . curl_error($curl));
if ($responseXml === true || !trim($responseXml)) {
throw new Exception(‘Empty response from Engage’);
$this->lastResponse = $responseXml;
// NOTE: You may want to check that the Engage response is in valid UTF-8 encoding before parsing the XML
$response = @simplexml_load_string(‘<?xml version=”1.0″?>’ . $responseXml);
if ($response === false) {
throw new Exception(‘Invalid XML response from Engage’);
if (!isset($response->Body)) {
throw new Exception(‘Engage response contains no Body’);
$response = $response->Body;
return $response;
public function getApiUrl()
$url = “https://{$this->apiHost}/XMLAPI”;
if ($this->sessionId !== null) {
$url .= ‘;jsessionid=’ . urlencode($this->sessionId);
return $url;
public function checkResult($xml)
if (!isset($xml->RESULT)) {
throw new Exception(‘Engage XML response body does not contain RESULT’);
if (!isset($xml->RESULT->SUCCESS)) {
throw new Exception(‘Engage XML response body does not contain RESULT/SUCCESS’);
$success = strtoupper($xml->RESULT->SUCCESS);
if (in_array($success, array(‘TRUE’, ‘SUCCESS’))) {
return true;
if ($xml->Fault) {
$this->lastFault = $xml->Fault;
$code = (string)$xml->Fault->FaultCode;
$error = (string)$xml->Fault->FaultString;
throw new Exception(“Engage fault ‘{$error}'” . ($code ? “(code: {$code})” : ”));
throw new Exception(‘Unrecognized Engage API response’);
public function getLastRequest()
return $this->lastRequest;
public function getLastResponse()
return $this->lastResponse;
public function getLastFault()
return $this->lastFault;
public function login($username, $password)
echo(“<br>Trying to login with ” . $username . ” and ” . $password . “<br>”);
$this->username = $username;
$this->password = $password;
$this->sessionId = null;
$request = “<Login><USERNAME><![CDATA[{$username}]]></USERNAME><PASSWORD><![CDATA[{$password}]]></PASSWORD></Login>”;
echo(“Login request: ” . $request . “<br>”);
try {
$response = $this->execute($request);
} catch (Exception $e) {
throw new Exception(‘Login failed: ‘ . $e->getMessage());
if (!isset($response->RESULT->SESSIONID)) {
throw new Exception(‘Login response did not include SESSIONID’);
$this->sessionId = $response->RESULT->SESSIONID;
Posted in Development | Tagged , , | Leave a comment

Export all email addresses from Sent Outlook folder

Here is procedure how to export all email addresses from Sent Outlook folder to Excel ( I found the idea here ) :

  1. We need to configure Outlook to download all email from server: File – Account settings – Change – Keep offline: All

Download all mails from Exchange server

  1. Restart Outlook and wait some time to allow downloading mails from server.
  2. Click on ‘File’, ‘Import and Export’ to open the Wizard
  3. Select ‘Export to a File’ [then click Next]
  4. Select CSV file [click Next]
  5. Select Sent folder [Next]
  6. Click on Browse to select a location and then type the file name to export the information to (terminated by .xls) [Next]
  7. Click on Map Custom Fields. This will bring up a list of all the available fields that are available in that folder.
  8. Since we are only interested in Email address, click on Clear Map and then from the Left side click on From: (address) and To: (Name) and drag that to the Right listExport email custom filter
  9. Click OK
  10. Click Finish
  11. Now we have Excel file with all contacted email addresses. There are a lot of duplicates. Click on A column to select it and on theDatatab, in the Sort & Filter group, click Advanced.
  12. Select Unique recordsonly and OK.
    Excel advanced filter
  1. I need to remove local users as well. Using Find and Replace feature, in column B we find all cells contains “/o” substring.Removing local addresses 
  2. Once it finishes Ctrl/A to select all found, right click on one of the selected row on the sheet and choose “Delete row”.


Now we have Excel file with recipients addresses you contacted since you have your mail box.

Posted in Short notes | Tagged , , , , | Leave a comment

Change location of SQL database files

  2. Move .mdf and .ldf files to new directory.
  3. ALTER DATABASE DatabaseName MODIFY FILE ( NAME = DatabaseName, FILENAME = ‘C:\DBs\DatabaseName.mdf’ );
  4. ALTER DATABASE DatabaseName MODIFY FILE ( NAME = DatabaseName_Log, FILENAME = ‘C:\DBs\DatabaseName_Log.ldf’ );

Original MS Article:


Posted in Short notes | Tagged | Leave a comment

Migrate mailbox from Office 365 to Google Apps

Export from Office 365

  1. Exchange admin cemter – compliance management – in-place eDiscovery & hold:

Migration 1

  1. Click “+” to create a new search
  2. Type some name:

migrate 2

  1. With Specify mailboxes to search click on “+” and find particular user:


  1. Leave Include all content selected and click Next
  2. Do not select Place content … on hold, click Finish
  3. When Search is saved, select it and click Export to PST button
Note: We should use Internet Explorer. It will not work with Chrome

8. When eDiscovery PST Export Tool launched, select proper location to your PST file.

Import to Google Apps

  1. Download Google Apps Migration for Microsoft Outlook from here:

  1. Since organization admin doesn’t have access to users email boxes, You need to have user password.
  2. Start migration:


  1. Allow access of this tool to mail box:

migrate 45

  1. Change source to migrate to PST:

migrate 5

  1. On step 2 select what data to migrate:

migrate 6

  1. Migration started:migr7
Posted in Short notes | Tagged , , , | Leave a comment

unable to get value of the property “setVisible” in Dynamics CRM

One day our marketing changed the lead form in Dynamics CRM online. Then we start receiving following popup error:
There was an error with this field’s customized event.
Error:Unable to get property ‘setVisible’ of undefined or null reference

This is because of custom JavaScript code added to this form. The code should change the fields removed by our guy.

The solution is to disable this code.

From editor – Form properties – in Event Handlers find related Library – Open to edit and remove Enabled checkbox.


Posted in Short notes | Tagged , | Leave a comment