netstat

netstat 用于显示linux中各种网络相关信息。如网络链接 路由表 接口状态链接 多播成员等等。
-a (all)显示所有选项,默认不显示LISTEN相关
-t (tcp)仅显示tcp相关选项
-u (udp)仅显示udp相关选项
-n 拒绝显示别名,能显示数字的全部转化成数字。
-l 仅列出有在 Listen (监听) 的服務状态

-p 显示建立相关链接的程序名
-r 显示路由信息,路由表
-e 显示扩展信息,例如uid等
-s 按各个协议进行统计
-c 每隔一个固定时间,执行该netstat命令。

LISTEN和LISTENING的状态只有用-a或者-l才能看到

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
netstat -pntl | grep $PORT or fuser -n tcp $PORT  #to find out which process (PID) is listening on the specified TCP port
netstat -p tcp | grep $PORT
Use lsof –i :portnumber.
lsof -n -i4TCP:$PORT | grep LISTEN
netstat -at|more 列出所有tcp端口
netstat -au
只显示监听端口 netstat -l
只列出所有监听unix端口 netstat -lx
显示所有端口的统计信息 netstat -s
一秒钟输出一次tcp监听端口信息 netstat -ntplc
显示路由信息 netstat -r
显示网络接口列表 netstat -i
显示所有tcp(netstat -st)或udp(netstat -su)的统计信息
显示pid/进程名称 netstat -p -p可以与其他参数一起使用 比如 显示tcp的进程id信息
netstat -ptnl

perf

iPhone Simulator path:

Xcode 6.x
/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app.
Xcode 4.x, 5.x /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/

启动 simulator:

xcode6:
xcrun simctl install booted
xcrun simctl install booted /path/to/your.app

1
2
3
4
5
未测试
There are undocumented command line parameters for the iOS Simulator, which can be used for such purposes. The one you are looking for is: -SimulateApplication
An example command line starting up YourFavouriteApp:
/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication path_to_your_app/YourFavouriteApp.app/YourFavouriteApp
This will start up your application without any installation and works with iOS Simulator 4.2 at least. You cannot reach the home menu, though.

windows

下载安装并配置path路径, JAVA_HOME环境变量

mac os:

下载安装

ubuntu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
切换jdk
update-alternatives --config java
tar -zvfx jdk-7u72-linux-x64.tar.gz
sudo mv -rf jdk1.7.0_72/ /opt/jdk1.7.0_72
apt-get install openjdk-7-jdk
##先检查java安装情况
sudo update-alternatives --display java
sudo update-alternatives --display javac
sudo update-alternatives --remove java /opt/jdk1.6.0_43/bin/java
sudo update-alternatives --remove javac /opt/jdk1.6.0_43/bin/javac
确认这些符号链接(symlinks)是否都删除了
java -version
javac -version
### 重新配置java链接
sudo update-alternatives --install /usr/bin/java java /opt/jdk1.6.0_43/bin/java 300
sudo update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_72/bin/java 400
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-7-openjdk-amd64/bin/java 500

sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.6.0_43/bin/javac 300
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_72/bin/javac 400
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 500
# 在需要的时候进行手动切换即可
sudo update-alternatives --config java
sudo update-alternatives --config javac

java

SpringBoot的logback如何配置?

1
The default strategy assumes that if you don't have a logback.xml (or one of the other standard file names) in the classpath then you must be happy with the defaults (see LogbackLoggingSystem for details). Spring Boot tries to unify the external configuration switches for common logging sytems, so it looks in logging.config (it didn't know about logback.configurationFile). You could use that instead (i.e. logging.config=file:./src/test/resources/logback.xml), or make sure your config file is on the classpath.

如果是log4j 1.x:
java -jar -Dlog4j.configuration=[file:/full_path/log4j.properties] final.jar
log4j 2.x:
java -Dlogback.configurationFile=logback-test.xml -cp . -jar target/benchmarks.jar StringConcat

  1. Logback tries to find a file called logback.groovy in the classpath.
  2. If no such file is found, logback tries to find a file called logback-test.xml in the classpath.
  3. If no such file is found, it checks for the file logback.xml in the classpath..
  4. If neither file is found, logback configures itself automatically using the BasicConfigurator which will cause logging output to be directed to the console.
    Where should the configuration files such as logback.groovy, logback-test.xml or logback.xml be located on the classpath?

Configuration files such as logback.groovy, logback-test.xml or logback.xml can be located directly under any folder declared in the class path. For example, if the class path reads “c:/java/jdk15/lib/rt.jar;c:/mylibs/“ then the logback.xml file should be located directly under “c:/mylibs/“, that is as “c:/mylibs/logback.xml”. Placing it under a sub-folder of c:/mylibs/, say, c:/mylibs/other/, will not work.

For web-applications, configuration files can be placed directly under WEB-INF/classes/.
So you need to put logback.xml in the classpath. On one project we had a similar problem although logback.xml was in the right place. Renaming it to logback-test.xml helped.

php

https://github.com/mmoreram/RSQueueBundle.git