Fit image to div without stretching — June 11, 2019
php 7.3 fpm enable error logs — June 6, 2019

php 7.3 fpm enable error logs

open this file

/etc/php/7.3/fpm/pool.d/www.conf

set the location of error log file

php_admin_value[error_log] = /var/log/php-errors.log
php_admin_flag[log_errors] = on

hopefully You will see these variables on the bottom of file. Now create the file and give it proper permissions.

touch /var/log/fpm-php.www.log
sudo chmod 644 /var/log/fpm-php.www.log
sudo chgrp www-data /var/log/fpm-php.www.log
sudo chown www-data /var/log/fpm-php.www.log

Dont forget to restart the fpm.

sudo service php7.3-fpm restart

For more information read this post.

Salesforce Aura get value in controller on keyup — June 2, 2019

Salesforce Aura get value in controller on keyup

I had the same issue. This was what I trying
In Component

<aura:component >
    <ui:inputText aura:id="enter-search" keyup="{!c.searchKeyChange}" placeholder="Search"/>
</aura:component>

    

and in client side controller

({
	searchKeyChange : function(component, event, helper) {
        console.log(component.find("enter-search").get("v.value"));
	}
})

Everything looked right but value of “get(“v.value”)” was always empty. The solution is simple. Just need to add updateOn=”keyup” in component. So the component will look like this

    
<aura:component >
    <ui:inputText aura:id="enter-search" keyup="{!c.searchKeyChange}" placeholder="Search" updateOn="keyup"/>
</aura:component>

For better explanation read the post here. It saved my day.

Css align div center with top 50% and left 50% — April 25, 2019

Css align div center with top 50% and left 50%

Sometimes we want to place element at center of page but element has some width than it is difficult to put it in center. one option is to adjust the value of left and set it to a value less than 50%. but is will create issues in different resolutions. Css provides solution to this problem

position: absolute;top: 50%; left: 50%;transform:translate(-50%, -50%);

transform:translate(-50%, -50%) will do the magic.

Update custom field plan.io (Redmine Api) — April 11, 2019

Update custom field plan.io (Redmine Api)

plan.io uses the Redmine API

// For Composer users (this file is generated by Composer)
require_once 'vendor/autoload.php';

$client = new Redmine\Client('http://redmine.example.com', 'API_ACCESS_KEY');
//-- OR --
$client = new Redmine\Client('http://redmine.example.com', 'username', 'password');

$params = [
    'custom_fields' => [
        [
            'name' => 'Test CheckBox',
            'id' => 11,
            'value' => [
                'QA UK',
                'QA US'
            ]
        ]
    ]
];
$res = $this->client->issue->update($issue_id, $params);

Upgrade JIRA server ubuntu and Confluence — March 16, 2019

Upgrade JIRA server ubuntu and Confluence

For JIRA upgrade
1.Backup database

2.stop jira
sudo service jira stop

3.create backup of jira directory
cd /opt/atlassian
cp -rp jira jira790backup

4.download latest jira software bin file
wget https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-8.0.2-x64.bin

5.make file executable
chmod +x atlassian-jira-software-8.0.2-x64.bin

6.run the installer, select options carefully
sudo ./atlassian-jira-software-8.0.2-x64.bin

7.always use collate utf8_bin for db and tables

User latest file name instead of {atlassian-jira-software-8.0.2-x64.bin}

This video saved my day.

jQuery ajax called multiple times (Maximum call stack size exceeded) — March 8, 2019

jQuery ajax called multiple times (Maximum call stack size exceeded)

There can be multiple reasons for this. In my case this was because of the data which I was trying to send to server. And in data I forgot to add single quotes around the string and I had javascript function of same name. So the function got called again and again.

function field_update_notification(element_name) {
	$.ajax({
        type: "POST",
        async: true,
        url: "test.php",
        data: {
            action: field_update_notification,
            element_name: element_name
        },
        dataType: "json",
        error: function(h, f, g) {},
        success: function(e) {
        },
		complete: function (event, request, settings) {
		}
    });
}

I forgot to add single quotes around field_update_notification. So instead of sending a string to server the jQuery called the function again and again.