Giter Site home page Giter Site logo

moli's Introduction

moli

moli's People

Contributors

mengmoli avatar

Watchers

 avatar

moli's Issues

mysql查询数据字典

USE information_schema;

SELECT
	字段,
	字段说明,
	PK,
	数据类型,
	允许为空,
	默认值
FROM
	(
		SELECT
			CONCAT('数据表:', MAX(C.TABLE_NAME)) AS '字段',
			MAX(C.TABLE_NAME) AS '表名',
			MAX(T.TABLE_COMMENT) AS '字段说明',
			'' AS 'PK',
			'' AS '数据类型',
			'' AS '允许为空',
			'' AS '默认值'
		FROM
			information_schema. COLUMNS AS C
		INNER JOIN information_schema. TABLES AS T ON C.TABLE_SCHEMA = T.TABLE_SCHEMA
		AND C.TABLE_NAME = T.TABLE_NAME
		WHERE
			C.TABLE_SCHEMA = '替换成数据库名字'
		GROUP BY
			T.TABLE_NAME
		UNION ALL
			SELECT
				MAX(C.COLUMN_NAME) AS '字段',
				MAX(C.TABLE_NAME) AS '表名',
				MAX(C.COLUMN_COMMENT) AS '字段说明',
				MAX(C.EXTRA) AS 'PK',
				MAX(C.COLUMN_TYPE) AS '数据类型',
				MAX(C.IS_NULLABLE) AS '允许为空',
				MAX(C.COLUMN_DEFAULT) AS '默认值'
			FROM
				information_schema. COLUMNS AS C
			WHERE
				C.TABLE_SCHEMA = '替换成数据库名字'
			GROUP BY
				C.TABLE_NAME ASC,
				C.ORDINAL_POSITION ASC
	UNION ALL
			SELECT
			'' AS '字段',
			MAX(C.TABLE_NAME) AS '表名',
			'' AS '字段说明',
			'' AS 'PK',
			'' AS '数据类型',
			'' AS '允许为空',
			'' AS '默认值'
		FROM
			information_schema. COLUMNS AS C
		WHERE
			C.TABLE_SCHEMA = '替换成数据库名字'
		GROUP BY
			C.TABLE_NAME
	) S
ORDER BY
	表名 ASC

表达式求值(递归算法)

题目描述:表达式求值(递归算法)
表达式:1、可以是一个项
2、也可以由多个项通过加减构成
项:1、项本身可以是一个因子
2、项也可以由若干个因子通过乘除组成
因子:1、因子本身可以是一个数字
2、因子也可以由表达式加上括号组成

tomcat远程监控

在CMD命令台下,进入到%tomcat_home%/bin目录
然后执行如下命令:
service install tomcat
即可创建一个名为tomcat的服务
下面主要讲一下如何进行远程监控:

  1. 打开被监控对象Tomcat7.0(安装版)配置面板;
  2. 找到Java选项卡;
  3. 在Java Options框的最下方增加以下内容:
    -Djava.rmi.server.hostname=127.0.0.1
    -Dcom.sun.management.jmxremote
    -Dcom.sun.management.jmxremote.port="9090"
    -Dcom.sun.management.jmxremote.authenticate="false"
    -Dcom.sun.management.jmxremote.ssl="false"

编写一个截取字符串的函数,输入为一个字符串和字节数,输出为按字节截取的字符串。 但是要保证汉字不被截半个,如“我ABC”4,应该截为“我AB”, 输入“我ABC汉DEF”,6,应该输出为“我ABC”而不是“我ABC+汉的半个”。

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * Created by Mori on 2017/6/2.
 */
public class ABC {
    public static void main(String[] args) throws Exception {
        String str = "我ABC汉字DEF";
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("请输入要截取的字节数:");
        int len = Integer.valueOf(br.readLine());
        String result = subStr(str, len);
        System.out.println(result);
    }

    public static String subStr(String str, int len) throws Exception {
        byte[] bytes = str.getBytes("gbk");
        if (len > bytes.length) {
            len = bytes.length;
        }
        int count = 0;
        for (int i = len - 1; i >= 0; i--) {
            if (bytes[i] > 0) {
                break;
            }
            count++;
        }
        if (count % 2 == 1) {
            len --;
        }
        return new String(bytes, 0, len, "gbk");
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.