Shahadat Hossain Khan Razon
Office Address: South Goran, Dhaka
Website: https://www.shahadathossain.com/
 

COVID 19 Update

FoundRecoveredDeath
Bangladesh1552563114115727439
India3369758130974748447373
Nepal79236766165111103
Bhutan259900

the fact of real shit

Suppress Zend Session Manager Warning @production
At production level session_regenerate_id warning is annoying. So I suppress ZF2 (2.4.13) session manager session_regenerate_id warning by changing Zend/Session/SessionManager.php file’s regenerateId method by putting “@” in front of session_regenerate_id function.
Changing ZF2 core 2.4.13 \Zend\Stdlib\Hydrator\AbstractHydrator::hasStrategy
class: Zend\Stdlib\Hydrator\AbstractHydratorfunction: hasStrategyphp version: 7.4 public function hasStrategy($name){if(is_array($this->strategies))return array_key_exists($name, $this->strategies)|| array_key_exists(‘*’, $this->strategies);if(is_object($this->strategies)) return property_exists($this->strategies, $name);return false;} new change / new code Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in /media/shkr-home-wifi/works/workspace/vendor/ZF2/library/ Zend\Stdlib\Hydrator\AbstractHydrator on line 87 reason of change public function hasStrategy($name){return array_key_exists($name, $this->strategies)|| array_key_exists(‘*’, $this->strategies);} previous code
Changing ZF2 Core 2.4.13 /Zend/I18n/Translator/Loader/Gettext::load
class: Zend\I18n/Translator/Loader/Gettextfunction: loadphp version: 7.4 Last portion change ……. if ($textDomain->offsetExists(”)) {$rawHeaders = explode(“\n”, trim($textDomain->offsetGet(”)));foreach ($rawHeaders as $rawHeader) {list($header, $content) = explode(‘:’, $rawHeader, 2);if (trim(strtolower($header)) === ‘plural-forms’) {$textDomain->setPluralRule(PluralRule::fromString($content));}}$textDomain->offsetUnset(”);} ………….. end of change ……………….. Reason to change: Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in …/Zend/I18n/Translator/Loader/Gettext.php on line 142 ///////// […]
Copy large amount of file to remote server using nohup tar and ssh
This command will copy large amount of file to remote server by compressing and decompressing on the fly. It saves time and bandwidth. It will execute in background, so you can detach current login session. nohup sh -c “tar -c /any/directory/at/source/server/ | gzip -2 | ssh server-alias ‘cat | tar xz -C /target/directory/of/target/server/'” > /dev/null […]
add new hard disk into ubuntu more than 2TB size
lsblk will list available device parted /dev/sdd considered device “sdd” from lsblk output (parted) mklabel gpt(parted) mkpart primary ext3 0 100%(parted) print(parted) quit mkfs.ext3 /dev/sdd1 this command will format this hard disk into ext3 file system as we instruct by parted command mkdir /home/data mounting point directory creating mount -t ext3 /dev/sdd1 /home/data mounting formatted […]
recursive change group and file mode in linux and detach active login session
change group nohup sh -c “find /any/path/that/need/to/change/* -group mygroup -exec chgrp www-data {} \;” > /dev/null 2>&1 & traditional way nohup sh -c “chgrp -R www-data /any/path/that/need/to/change” > /dev/null 2>&1 & change mode nohup sh -c “find /any/path/that/need/to/change/* -perm u=rw,g=r,o=r -execdir chmod g+w {} \;” > /dev/null 2>&1 & traditional way nohup sh -c “chmod […]
Changing ZF2 Core 2.4.13 Zend\View\Helper\HeadLink::createDataStylesheet
class: Zend\View\Helper\HeadLinkfunction: createDataStylesheetphp version: 7.3 public function createDataStylesheet(array $args) { $rel = ‘stylesheet’; $type = ‘text/css’; $media = ‘screen’; $conditionalStylesheet = false; $href = array_shift($args); if ($this->isDuplicateStylesheet($href)) { return false; } if (0 < count($args)) { $media = array_shift($args); if (is_array($media)) { $media = implode(',', $media); } else { $media = (string) $media; } } […]
Install php 7.2 ssh2 in ubuntu 16x
recently i need to install ssh2 connection through my php code to connect remote server by sftp for file transfer. i’m using php 7.2 and face a “sigment fault” issue for normal installation. i solved this issue by install required demon. hope it may help someone who face same issue. first you need to install/upgrade […]
changing zf2 core 2.4.13 Zend/Stdlib/ArrayObject.php
class : Zend\Stdlib\ArrayObject function: unserialize($data) php version: 7.3 previous (original) code /** * Unserialize an ArrayObject * * @param string $data * @return void */ public function unserialize($data) { $ar = unserialize($data); $this->protectedProperties = array_keys(get_object_vars($this)); $this->setFlags($ar[‘flag’]); $this->exchangeArray($ar[‘storage’]); $this->setIteratorClass($ar[‘iteratorClass’]); foreach ($ar as $k => $v) { switch ($k) { case ‘flag’: $this->setFlags($v); break; case ‘storage’: $this->exchangeArray($v); break; case […]
kill mysql process which is ideal for N seconds
step 1: login mysql through putty step 2: execute – SELECT GROUP_CONCAT(‘KILL ‘,id,’; ‘ SEPARATOR ‘ ‘) FROM information_schema.processlist WHERE time > 500 AND user<>’system user’; step 3: you will get a string as output. copy that string and paste into mysql command prompt and press enter… nJoy