Move the cursor from the two (vertical) split window in Vim.
By holding the the Ctrl, press w two times do the magic.
Ctrl-w w or type :wincmd w to move the cursor between the two windows/buffers.
Eureka!
References:
https://stackoverflow.com/questions/6071266/how-to-flip-windows-in-vim
Tuesday, September 5, 2017
Monday, September 4, 2017
Change File Permission in Linux
I have encountered this issue when I tried to edit the file postgresql.conf and pg_hba.conf. Both are with read-only permission. So I was digging on the internet and finally found a solution.
chmod 066
The syntax:
$chmod 066 filename
$chmod 066 postgresql.conf
Eureka!
References:
http://www.filepermissions.com/directory-permission/066
chmod 066
The syntax:
$chmod 066 filename
$chmod 066 postgresql.conf
Eureka!
References:
http://www.filepermissions.com/directory-permission/066
Monday, August 28, 2017
Tuesday, July 11, 2017
MongoDB installation
This is my first post as using the mongodb. First, I just downloaded the installer file from mongodb site. There are some points to remember if you install mongodb for the first time.
create c:\mongodb folder
- this is to be used for the custom installation
create \data\db folder
- put under the mongodb folder, use for database data file
create \logs
- for the mongodb log file
open powershell by run by administrator access and execute below command
>.\mongod.exe --directoryperdb --dbpath c:\mongodb\data\db --logpath c:\mongodb\logs\mongo.log --logappend --rest --install
start the mongodb service
>net start MongoDB
> show dbs
admin 0.000GB
local 0.000GB
> use mycustomers
switched to db mycustomers
> db
mycustomers
> show dbs
admin 0.000GB
local 0.000GB
> db
mycustomers
> db.createUser({
... user:"brad",
... pwd:"1234",
... roles: ["readWrite", "dbAdmin"]
... });
Successfully added user: { "user" : "brad", "roles" : [ "readWrite", "dbAdmin" ] }
> db.createCollection('customers');
{ "ok" : 1 }
> show collections
customers
> db.customers.insert({first_name:"John", last_game:"Doe"});
WriteResult({ "nInserted" : 1 })
> db.customers.find();
{ "_id" : ObjectId("5965cba0a07b84a6ed70301a"), "first_name" : "John", "last_game" : "Doe" }
create c:\mongodb folder
- this is to be used for the custom installation
create \data\db folder
- put under the mongodb folder, use for database data file
create \logs
- for the mongodb log file
open powershell by run by administrator access and execute below command
>.\mongod.exe --directoryperdb --dbpath c:\mongodb\data\db --logpath c:\mongodb\logs\mongo.log --logappend --rest --install
start the mongodb service
>net start MongoDB
> show dbs
admin 0.000GB
local 0.000GB
> use mycustomers
switched to db mycustomers
> db
mycustomers
> show dbs
admin 0.000GB
local 0.000GB
> db
mycustomers
> db.createUser({
... user:"brad",
... pwd:"1234",
... roles: ["readWrite", "dbAdmin"]
... });
Successfully added user: { "user" : "brad", "roles" : [ "readWrite", "dbAdmin" ] }
> db.createCollection('customers');
{ "ok" : 1 }
> show collections
customers
> db.customers.insert({first_name:"John", last_game:"Doe"});
WriteResult({ "nInserted" : 1 })
> db.customers.find();
{ "_id" : ObjectId("5965cba0a07b84a6ed70301a"), "first_name" : "John", "last_game" : "Doe" }
Tuesday, April 18, 2017
Obsessed with Docker
To remove stop containers
docker ps --filter "status=exited" | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm
docker ps --filter "status=exited" | awk '{print $1}' | xargs --no-run-if-empty docker rm
copy file from container to host
$docker cp <container-id>:/usr/lib/python2.7/dist-packages/openerp/addons addons
odoo 10
$docker cp <container-id>:/usr/lib/python2.7/dist-packages/odoo/addons addons
odoo11
/usr/lib/python3/dist-packages/odoo/addons
docker ps --filter "status=exited" | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm
docker ps --filter "status=exited" | awk '{print $1}' | xargs --no-run-if-empty docker rm
copy file from container to host
$docker cp <container-id>:/usr/lib/python2.7/dist-packages/openerp/addons addons
odoo 10
$docker cp <container-id>:/usr/lib/python2.7/dist-packages/odoo/addons addons
odoo11
/usr/lib/python3/dist-packages/odoo/addons
How to remove <none> images after building
docker rmi $(docker images -f "dangling=true" -q)
docker ps -a | cut -c-12 | xargs docker rm
To remove all containers we can use the following command:
docker rm -f $(docker ps -aq)
docker rm is command to remove container.
-f flag (for rm) is to stop container if it’s running (force deletion).
-q flag (for ps) is to print only container IDs.
-p is a ports mapping HOST PORT:CONTAINER PORT.
-v is a volume mounting HOST DIRECTORY:CONTAINER DIRECTORY.
To remove all dangling Docker images:
sudo docker rmi $(sudo docker images -f "dangling=true" -q)
If run as root omit "sudo"
docker rmi $(docker images -f "dangling=true" -q)
Remove non-running Docker containers
docker ps -a | cut -c-12 | xargs docker rmTo remove all containers we can use the following command:
docker rm -f $(docker ps -aq)
docker rm is command to remove container.
-f flag (for rm) is to stop container if it’s running (force deletion).
-q flag (for ps) is to print only container IDs.
-p is a ports mapping HOST PORT:CONTAINER PORT.
-v is a volume mounting HOST DIRECTORY:CONTAINER DIRECTORY.
To remove all dangling Docker images:
sudo docker rmi $(sudo docker images -f "dangling=true" -q)
If run as root omit "sudo"
docker rmi $(docker images -f "dangling=true" -q)
Sunday, April 9, 2017
Running my development environment in a Docker
This time, I want to achieve to run my dev env in a docker rather from the vmware with odoo inside. I started working last Friday on this issue. Seems that I can't run odoo with our code base because one of the requirement is to install Pika library which is not included with odoo 9 image.
I don't have any choice but to create my own image base from odoo 9 official image. But errors keep popping up one after another.
The latest error that I encounter is below:
standard_init_linux.go:178: exec user process caused "no such file or directory"
I found this link and let's see if it can solve this problem. :)
https://forums.docker.com/t/getting-panic-spanic-standard-init-linux-go-178-exec-user-process-caused-no-such-file-or-directory-red-while-running-the-docker-image/27318/4
Here we go again, execute the command.
docker build -t eg_postgresql .
Still the same error :( but anyway, at the bottom of the article there is a command called dos2unix which convert your windows code to unix format. hope it helps. cross finger....
I'm invisible.... the trick is that you don't need to change the #!/bin/bash into #!/bin/sh , just run dos2unix inside docker and the rest will do trick.
just ls and you will see the file entrypoint.sh, its because we edit this under windows environment we must convert this file to unix format.
That's it... simple. hahaha. well I've done productive today.
So the day's has past and I'm busy at work. Now I'm going to build the docker file.
so far so good...
first we run our postgresql database...
docker run -d -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin --name postgres9.3 -p 5432:5432 --restart=always postgres:9.3
and then run the odoo container...
docker run -it -p 8069:8069 --name odoo9 --link postgres9.3:db -t vbodoo
here, I add "-it" to show the log in terminal as I run my odoo back in ubuntu virtual machine. I can ctrl+c to shutdown the odoo server from there.
The only problem is that when I try to run the odoo again. I couldn't run the above command as it will going to have another instance container. I just want to run again the same container.
To do that, the answer is very simple... I spend a lot time figuring it out :(
docker start -i <container-id>
That's it! just a simple command.
The Final One!
After some testing, I finally got it. The last issue that I have facing which took me so much time is that I would like my host volume will be on drive D: because first its a different partition and has a lot of space memory.
1. Open Oracle VM VirtualBox
2. Look for the default docker-machine
3. Click Settings and add drive D: in the shared folders.
look closely on the d_drive which is the same name in the shared folders. Eureka!
I don't have any choice but to create my own image base from odoo 9 official image. But errors keep popping up one after another.
The latest error that I encounter is below:
standard_init_linux.go:178: exec user process caused "no such file or directory"
I found this link and let's see if it can solve this problem. :)
https://forums.docker.com/t/getting-panic-spanic-standard-init-linux-go-178-exec-user-process-caused-no-such-file-or-directory-red-while-running-the-docker-image/27318/4
Here we go again, execute the command.
docker build -t eg_postgresql .
Still the same error :( but anyway, at the bottom of the article there is a command called dos2unix which convert your windows code to unix format. hope it helps. cross finger....
I'm invisible.... the trick is that you don't need to change the #!/bin/bash into #!/bin/sh , just run dos2unix inside docker and the rest will do trick.
just ls and you will see the file entrypoint.sh, its because we edit this under windows environment we must convert this file to unix format.
That's it... simple. hahaha. well I've done productive today.
So the day's has past and I'm busy at work. Now I'm going to build the docker file.
so far so good...
first we run our postgresql database...
docker run -d -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin --name postgres9.3 -p 5432:5432 --restart=always postgres:9.3
and then run the odoo container...
docker run -it -p 8069:8069 --name odoo9 --link postgres9.3:db -t vbodoo
here, I add "-it" to show the log in terminal as I run my odoo back in ubuntu virtual machine. I can ctrl+c to shutdown the odoo server from there.
The only problem is that when I try to run the odoo again. I couldn't run the above command as it will going to have another instance container. I just want to run again the same container.
To do that, the answer is very simple... I spend a lot time figuring it out :(
docker start -i <container-id>
That's it! just a simple command.
The Final One!
After some testing, I finally got it. The last issue that I have facing which took me so much time is that I would like my host volume will be on drive D: because first its a different partition and has a lot of space memory.
1. Open Oracle VM VirtualBox
2. Look for the default docker-machine
3. Click Settings and add drive D: in the shared folders.
That's it, in the docker terminal just add the new volume path like below
docker run -it -p 8069:8069 -v /d_drive/Lynard/development/svn/repo2:/mnt/extra-addons --link postgres9.3:db --name dev_odoo -t ls/odoo9
look closely on the d_drive which is the same name in the shared folders. Eureka!
Sunday, April 2, 2017
Installing latest postgresql (9.6) and odoo (10)
I always trying to make things complicated like I have already installed postgres 9.3 and odoo 9 and its working fine but I like to install a newest version for both. This time the latest postgres (9.6 at this time of writing as well) as well as odoo (10).
First pull the postgres image. By not declaring which version, it will automatically pull the latest version which is 9.6.
docker pull postgres
(1st attempt)
Then run and and create the container.
docker run --name postgres9.6 -e POSTGRES_PASSWORD=password -p 5433:5432 postgres
I'm not sure why the logs is showing, let's do it again with different command. But before I forgot, my other objective is to test whether we can run two postgres container in different port like 5433 and 5432.
(2nd attempt)
So I stop and delete the running container and run again with below command. I added the POSTGRES_USER=admin, just to standardize all. .. and voila. its runs
docker run --name postgres9.6 -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin -p 5433:5432 -d postgres
Final command:
docker run -d -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin --name postgres -p 5433:5432 --restart=always postgres
Since the latest postgres is compatible with latest pgadmin as well which is version 4. so I decided to run in docker too by pulling an image from https://hub.docker.com/r/fenglc/pgadmin4/.
docker pull fenglc/pgadmin4
Lastly, run the pgadmin4 container and link to postgres
docker run --name pgadmin4 --link postgres9.6:postgres -p 5050:5050 -d fenglc/pgadmin4
EUREKA!
I'm still not finish yet, I'm too excited that I successfully run the postgres. Well, I actually I need to run the latest odoo as state in my subject but I need a break, I'm having lunch now at my desk. will continue for a while. Ciao!
Ok, let's go back to business.
First, get the latest odoo image.
docker pull odoo
Run the image and link to postgres
docker run -p 8070:8069 --name odoo10 --link postgres9.6:db -t odoo
Whoah! That wasn't so hard. This time I changed the port to 8070 by changing the parameter -p 8070:8069 to have different port for my odoo10
I'm invinsible...
Updated: 16-May-2017
I just read this new article https://blog.codeship.com/ensuring-containers-are-always-running-with-dockers-restart-policy/ it quite good as he explains clearly.
I have made changes with below command:
docker run -d -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin -p 5433:5432 --name db --restart=always postgres
after running the postgresql, run the odoo.
docker run -p 8070:8069 --name odoo10 --link db:db -it odoo
First pull the postgres image. By not declaring which version, it will automatically pull the latest version which is 9.6.
docker pull postgres
(1st attempt)
Then run and and create the container.
docker run --name postgres9.6 -e POSTGRES_PASSWORD=password -p 5433:5432 postgres
I'm not sure why the logs is showing, let's do it again with different command. But before I forgot, my other objective is to test whether we can run two postgres container in different port like 5433 and 5432.
(2nd attempt)
So I stop and delete the running container and run again with below command. I added the POSTGRES_USER=admin, just to standardize all. .. and voila. its runs
docker run --name postgres9.6 -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin -p 5433:5432 -d postgres
Final command:
docker run -d -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin --name postgres -p 5433:5432 --restart=always postgres
Since the latest postgres is compatible with latest pgadmin as well which is version 4. so I decided to run in docker too by pulling an image from https://hub.docker.com/r/fenglc/pgadmin4/.
docker pull fenglc/pgadmin4
Lastly, run the pgadmin4 container and link to postgres
docker run --name pgadmin4 --link postgres9.6:postgres -p 5050:5050 -d fenglc/pgadmin4
EUREKA!
I'm still not finish yet, I'm too excited that I successfully run the postgres. Well, I actually I need to run the latest odoo as state in my subject but I need a break, I'm having lunch now at my desk. will continue for a while. Ciao!
Ok, let's go back to business.
First, get the latest odoo image.
docker pull odoo
Run the image and link to postgres
docker run -p 8070:8069 --name odoo10 --link postgres9.6:db -t odoo
Whoah! That wasn't so hard. This time I changed the port to 8070 by changing the parameter -p 8070:8069 to have different port for my odoo10
I'm invinsible...
Updated: 16-May-2017
I just read this new article https://blog.codeship.com/ensuring-containers-are-always-running-with-dockers-restart-policy/ it quite good as he explains clearly.
I have made changes with below command:
docker run -d -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin -p 5433:5432 --name db --restart=always postgres
after running the postgresql, run the odoo.
docker run -p 8070:8069 --name odoo10 --link db:db -it odoo
Subscribe to:
Posts (Atom)
free online comma separating tool
https://delim.co/#
-
In my current company, I'm using Visual Paradigm for my documentation task. If you go there site, you can either download community and ...
-
I spend many days to figure it out my problem in Vagrant. After I posted my question in stackoverflow, nobody is helping me instead they dow...
-
I used KeePass long time ago and until now I'm still using it. It's a great tool to save your password encrypted. At my home, I sa...









