React createElement – Warning: Unknown prop `childItems` on

The following command creates an element in React.

    const el = React.createElement(
                 < an html tag or react component >, 
                 < attributes or props or {} >, 
                 < children elements or text >

When you pass a non html standard attributes in the second parameter to create html tag like div or p tag then a warning is raised of unknown prop. Simply remove the non standard attribute from the second parameter or pass empty object {}.

Ubuntu 17.10 expo and genymotion errors and solutions


Switched to a LAN URL because the tunnel appears to be down. Only devices in the same network can access the app. You can restart the project to try reconnecting.


Due to some bug you must start xde (expo development environment) before genymotion. Also i needed to run xde from root user login. (not su or sudo ).
UPDATE: The following problem of adb version fixed this problem too.



Couldn’t start project on Android: could not install *smartsocket* listener: Address already in use
ADB server didn’t ACK
* failed to start daemon *
error: cannot connect to daemon


the adb version on your system is different from the adb version on the android sdk platform-tools

1. check sys adb version

# adb version
Android Debug Bridge version 1.0.39

2. check sdk adb version

# cd /root/Android/Sdk/platform-tools
# ./adb version
Android Debug Bridge version 1.0.32

3. copy
# rm /usr/bin/adb
# sudo cp /root/Android/Sdk/platform-tools/adb /usr/bin/adb


Error: EACCES: permission denied, open ‘/tmp/haste-map-react-native-packager-1-8963e41d25a58e25717f5939e5144fc2

Solution: sudo rm /tmp/haste-map-react-native-packager-1-8963e41d25a58e25717f5939e5144fc2

The development server returned response error code: 500

For me this error was resolved running yarn in the project folder. The cause may have been due to the fact that I’d switched branches and some of the packages were not installed.

Reset windows 8 password from Ubuntu – Metadata kept in Windows cache, refused to mount

It was an interesting task to reset windows 8 password on a machine running Ubuntu . When I tried to (re)mount the disk I got the following problem and after googling for a while I found that there was no viable solution but to reinstall windows. However I successfully reset the password by using the following techniques.

I removed hard disk from the windows computer and attached it to my laptop running Ubuntu 17.10. By default Ubuntu mounts new hard disk as read only (or if any error) and therefore I have to remount the disk as read-write but I got the following error during mounting.

Metadata kept in Windows cache, refused to mount. ..

Windows machine had errors or hibernated files and therefore did not allow to mount as read-write. I used the following commands (alternatively, please unmount all partitions if mounted auto by Linux) a couple of times to fix this.

   sudo mount -t ntfs-3g -o remove_hiberfile /dev/sda5  ~/win8/
   sudo ntfsfix /dev/sda5

After this I installed the command line tool by:

  sudo apt install chntpw

Now first list the Windows users and then make password blank by:

   cd ~/win8/Windows/System32/config/
   sudo chntpw -l SAM
   sudo chntpw -u Administratör SAM

The funny part starts now. The administrator user was written with Swedish character ‘ö’ i.e Administratör and it was’nt recognized as in the last command above.

A work around is to use RID which is displayed when listing Windows users ( command : sudo chntpw -l SAM ).

   sudo chntpw -u 0x01f5 SAM

From the menu shown after the above command choose the one with blanking password, press q and (yes) for saving changes.

virtualbox ubuntu boot menu delay and reset password

To increase boot menu delay, first get a list of vms by typing the following in a terminal.

 VBoxManage list vms

You can change the delay by typing:

VBoxManage modifyvm "You virtual machine name from above command" --bioslogodisplaytime 10000

Now start/restart the Ubuntu machine and hold down the left SHIFT key from keyboard unless you get the boot menu. Select ‘root …’ from menu.
We need need to remount the disk in read-write mode:

mount -rw -o remount /

Change the password of the required user, lets say user1:

passwd user1

The state object

The state object contains the main data object of the application. Anything that changes in the state object will re-render the component.

The related method to set a specific key in the state is setState. The set state could be called after componentDidMount is called.


    constructor(props) {
      this.state = { products: [...] };

    componentDidMount() {

Chain pattern

require "vendor/autoload.php";

use Chain\HomeStatus;
use Chain\Lock;
use Chain\Lights;
use Chain\Alarm;

$lock = new Lock();
$lights = new Lights();
$alarm = new Alarm();


$homeStatus = new HomeStatus();
echo PHP_EOL;

Strategy pattern

namespace Stra;

use Stra\Logger;
use Stra\DatabaseLogger;
use Stra\FileLogger;

class Strategy
    public function log($msg, Logger $logger = null)
        if(is_null($logger)) {
            $logger = new DatabaseLogger();


Test Drive

require 'vendor/autoload.php';

use Stra\Strategy;
use Stra\FileLogger;
use Stra\DatabaseLogger;

$app = new Strategy();
$app->log('Some action happened.', new FileLogger());

Factory pattern


namespace Patterns;

 * Design pattern - Factory
 * @author: Hazrat Ali
 * @mail:
 * Date: 2016-07-30
class ShapeFactory
    private static $types = ['Rectangle', 'Square'];

    public static function create($type)
        if( ! in_array($type, self::$types)) {
            die('Invalid type ' . $type . ', valid types are ' . implode(',', self::$types) . EOL);

        if($type == 'Rectangle') {
            return new Rectangle(50, 15);

        if($type == 'Square') {
            return new Square(20);


Git repo

namespace Patterns;

 * Design pattern - Singleton extended
 * The extended version contains an array of instances
 * @author: Hazrat Ali
 * @mail:
 * Date: 2016-07-30
class SingletonX
    private static $instances = [];
    private $dir = 'tr';
    private $language;
    private $translations;

    public function __construct($language)
        $this->language = $language;

        echo 'Object initiated with language ' , $language . EOL;

    public static function getInstance($language)
        if( ! isset(self::$instances[$language])) {
            self::$instances[$language] = new self($language);

        return self::$instances[$language];

    public function translate($text)
        return isset($this->translations[$text]) ? $this->translations[$text] : false;

    private function readTranslationFile($fileName)
        $filePath = $this->getPathAbs($fileName);

        if(file_exists($filePath)) {
            $contents = file_get_contents($filePath);
        } else {
            $svContents = json_encode([
            $frContents = json_encode([
                'language'=>'la langue',

            if($this->language == 'sv') {
                file_put_contents($filePath, $svContents);
                $contents = $svContents;

            if($this->language == 'fr') {
                file_put_contents($filePath, $frContents);
                $contents = $frContents;

        $this->translations = json_decode($contents, JSON_FORCE_OBJECT);

    private function getPathAbs($fileName)
        $path = sprintf("%s/%s/%s/%s", dirname(__FILE__), $this->dir, $this->language, $fileName);

        if( ! file_exists(dirname($path))) {
            mkdir(dirname($path), 0777, true);

        return $path;