How To Copy From Remote File To Local Server Using PHP

PHP copy function is capable of accepting URL as the source & destination parameters. We can download any file available on the remote host through HTTP connection and copy it to local storage or another remote host.

Destination file will be overwritten if it already exist and if the destination is URL and it's not support the write operation it will fail as well.

$source = 'http://example.com/robots.txt';
$destination = 'robots.txt';

if (copy($source, $destination)) {
    echo "Successfully copy $file to local server.";
} else {
    echo "Failed to copy $file !";
}

Upgrading CoreOS With Deis Onboard

Deis have disable the auto update facility in CoreOS by default due to specific technical reason.

To update to the latest release of CoreOS we must trigger the update manually using following command.

sudo systemctl unmask update-engine.service
sudo systemctl start update-engine.service
sudo update_engine_client -update

For those who is not familiar with CoreOS, you will notice the argument unmask of systemctl first command line. This service have been marked as masked to make it impossible to start nor enabled by the system itself. It is part of CoreOS systemd feature where it introduce granular level of service management.

A completed CoreOS update required a reboot as it will change the passive update partition to become active upon boot process. The update-engine service need to be stop and mask back to prevent the automatic update process in the future.

sudo systemctl stop update-engine.service
sudo systemctl mask update-engine.service

We can verify successful update with following command.

cat /etc/lsb-release

Howto Pull Docker Image in One Line

Currently Docker CLI tool only capable of pulling or refreshing a single image at one time, it's quite a problematic if were in need to refresh a numbers of image. This problem can be solve by using some others tool in Linux shell.

docker images | awk '{print $1}' | grep -v REPOSITORY | xargs -L1 docker pull

Unification of The "Reactivator"

For last few year, i started to implemented the reactive programming into few of my projects with a different flavor like C#, ObjC, Swift and Java. From my experience in implementing the RP, its feel like filling the hole in your chest that already been there since the ancient beginning of the computer programming. There's a thousand way that you can describe on the need to go reactive and why we need to embrace it.

 

Read More

Docker Exec Is Your Boss

Version 1.3 of Docker have introduced a long awaited feature which is docker exec that allowed user to interact with the process inside the container.

docker exec my-lamp cat /var/log/messages

User not only can peek inside the container but actually can enter into container without having additional setup such as nsenter or others. By spawning a bash program and stream back terminal to client.

docker exec -it my-lamp /bin/bash

The flag -i will keep the STDIN open thus allowing Bash program to read an input from client.

Simplify boot2docker Configuration on OSX

After installing Boot2Docker using installer tools, run below post installation command.

docker run --rm -v ~/:/target nematix/boot2docker-tool && source ~/.profile

It will automatically configure docker and boot2docker to run along with the extra features.

You can use docker-enter straight from your terminal without using ssh into boot2docker host.

docker-enter web

Additional info can be access from here Github

Add Boot2Docker Port Forward on Localhost

To have you boot2docker running container service accessible on your "localhost" or host computer, following command can be use. The command line specifically modify the boot2docker virtual machine, to add the port forward configuration to the NAT interface.

VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port8000,tcp,0.0.0.0,8000,,8000"

The IP address of `0.0.0.0` is mean to listen on all IP of you host computer, you can also replace it with IP '127.0.0,0' to make sure its only available on local loop-back adapter.

The `tcp-port8000` is only a name assigned to identify the port-forward configuration and you can use others name as well such as `port8000-to-8000-tcp`

Release of node-phonenumber 0.1.2 Are Available Through NPM

Release 0.1.2 have been available by today (11 July 2014) through NPM package or you can clone from my GitHub repository.

Basically nothing was change on the base-code, the true purpose of this release is to add the Apache 2.0 License attribute to the readme file to reflect the original libphonenumber licensing attribute.

Thanks to Lion Vollnhals on making remark on this issue.