Search For Fun

A blog for collecting diverse useful information


  • Home

  • Tags

  • Categories

  • Archives

  • Search

docker.exe error response from daemon driver failed programming external connectivity on endpoint

Posted on 2018-08-30 | In docker

description: fix docker error response from daemon: driver failed programming external connectivity on endpoint

check the port will be used in the container

1
2
3
docker ps 
# or
docker port <container_name>

check the same port used by other containers

1
docker ps

option1 stop the containers used the port

1
sudo docker stop <container_id>

if not fixed, the port could be occupied by other services

1
netstat -tulpn | grep :<port_no>

option2 stop the services

option3 start the container with another port

Java Open New Thread to Run Static Method

Posted on 2018-08-30 | In java

description: new thread to run static method in java

Code for run static method in new thread in java

1
2
3
4
5
new Thread(new Runnable() {
public void run() {
staticMethod();
}
}).start();

refresh environment variables without reboot windows 10

Posted on 2018-08-22 | In win10

description: Add a windows environment varibale without rebooting the computer

process to refresh environment variables without reboot windows

  • open cmd commend prompt window
  • input set PATH=C -> this will refresh the environment variables
  • close and restart cmd window
  • input echo %PATH% to test

Simplest web server run by python

Posted on 2018-08-15 | In python

description: use python to create a simplest server for testing website

code for python to create a web server

1
python -m http.server

Initialising an array of fixed size in python

Posted on 2018-08-14 | In python

description: python create array with length

code for creating array with fix length

1
2
3
>>> aList = [None] * 6
>>> aList
[None, None, None, None, None, None]

mount share folder to Linux in virtualbox

Posted on 2018-08-13 | In vm

description: mount share folder to Linux in virtualbox

code to mount share folder to Ubuntu in virtualbox

1
2
3
sudo mount -t vboxsf <sharefoldername> <linuxpath>
# e.g.
sudo mount -t vboxsf data ~/share/

python list subtract another list

Posted on 2018-08-09 | In python

description: the elements in a list subtract the same index elements in another list

code for list substraction in python

1
2
3
4
5
l1 = [1,2,3]
l2 = [4,8,3]
dif = list(map(lambda x: x[0]-x[1], zip(l1,l2)))
# output:
# [-3, -6, 0]

code for wrap java debugger

Posted on 2018-08-07 | In java

description:

code for wrap java debugger

1
2
3
4
5
6
7
8
9
10
11
12
public static void e(String tag, String msg){
if (LOG_LEVEL > ERROR)
Log.e(tag, msg)
}
public static void w(String tsg, String msg){
if (LOG_LEVEL > ERROR)
Log.w(tag, msg)
}
public static void i(String tsg, String msg){
if (LOG_LEVEL > ERROR)
Log.i(tag, msg)
}

python plot sine curve or wave

Posted on 2018-08-04 | In python

description: python code to plot sine wave

draw or plot sine curve code

1
2
3
4
5
6
7
8
import numpy as np
import matplotlib.pyplot as plt

x=np.arange(0,2*np.pi,0.01)
y=np.sin(x)

plt.plot(x,y)
plt.show()

python remove or delete last column of a dataframe

Posted on 2018-08-03 | In python

description: python remove last column

init data

1
2
3
4
5
6
7
8
9
10
11
12
import pandas 
data = pandas.DataFrame({
'a': [1, 2, 3],
'b': [0.1, 0.2, 0.3],
'c': ['a', 'b', 'a'],
'd': [1, 2, 3]
})
# data
# a b c d
# 0 1 0.1 a 1
# 1 2 0.2 b 2
# 2 3 0.3 a 3

drop last column

1
data[data.columns[:-1]]

output

1
2
3
4
   a    b  c
0 1 0.1 a
1 2 0.2 b
2 3 0.3 a
1…567

killfun

Personal blog for collecting useful information

64 posts
14 categories
38 tags
RSS
© 2018 killfun
Powered by Hexo v3.7.1
|
Theme — NexT.Muse v6.3.0