王筝的博客
ruby学习

 

 

(1)项目导入,

点击intelliJ IDEA的Open按钮,

 

找到项目目录下pom的文件,然后点击ok (先admin, 在biz-admin, 再加dal)

 

由于之前导入过这个项目,所以现在要先删除再导入

导入后编译器的右侧就会出现Maven Projects的侧边栏按钮,点击此按钮会侧滑出相关目录,

点击上方的加号➕,继续添加其他项目

 

将其他关联项目的pom.xml文件选中,点击ok。 用同样的方式再继续导入

 

在Maven Projects面板里开启“Skip tests”Mode, 在平时开发编译过程中会节省很多时间

 

(2)按照dal biz_admin admin的依赖顺序,在Maven面板里依次双击intall,由于这是第一次运行,不需要先Clean

 

 

 

 

 

(3) Edit Configuration

 

添加一个configuration,选择Tomcat,点击Local

 

 

补充Ali-Tomcat 的安装步骤如下(使用 JDK 1.7及以上版本):
https://help.aliyun.com/document_detail/44158.html?spm=a1z2e.8101737.webpage.dtitle5.zCmGri
1.点击链接地址,下载 Ali-Tomcat,保存后解压至相应的目录(如:d:\work\tomcat)。
http://edas-public.oss-cn-hangzhou.aliyuncs.com/install_package/tomcat/taobao-tomcat-7.0.59.tgz?spm=5176.doc44158.2.2.jl2pnx&file=taobao-tomcat-7.0.59.tgz
2.点击链接地址,下载 Pandora 容器,保存后将内容解压至上述保存的 Ali-Tomcat 的 deploy 目录(d:\work\tomcat\deploy)下。
http://edas-public.oss-cn-hangzhou.aliyuncs.com/install_package/pandora/unauth/taobao-hsf.tgz?spm=5176.doc44158.2.3.jl2pnx&file=taobao-hsf.tgz

最后出来的目录结构如下所示:

d:\work\tomcat >  tree -L 2 deploy/
                 deploy/
                         └── taobao-hsf.sar
                                 ├── META-INF
                                 ├── lib
                                 ├── log.properties
                                 ├── plugins
                                 ├── sharedlib
                                 └── version.properties
补充JDK7下载地址
http://download.csdn.net/download/sxsj333/8331551

 

接着tomcat路径

 

配置JDK7

 

(4)配置Project Structure

 

 

 

 

 

 

顺便给Tomcat改个名字

 

 

 

 

 

 

 

 

 

大功告成,点击编译按钮来编译吧

 

遇到字符串编码的报错

解决方法

 

 

点击下拉框选择 utf8

 

然后再重新编译就好啦

 

之后我把启动端口换了一下,clean 后build就ok了

 

(0)之所以有第0步,是因为第一次倒入失败,所以从删除上次倒入的数据开始~

开始删除数据。

启动Intelli J,点击右键删除上次的导入的项目

 

把配置拷贝到.m2文件夹下,并且删除上次下载的一些依赖包

$ cd ~/.m2
$ cp ~/Downloads/settings.xml .
$ cd repository/
$ rm -rf *

 

回到程序所在的目录,删除上次导入生成的 后缀名为.iml的文件

rm -rf play-service.iml

 

停掉刚才的java进程

$ ps -ef |grep java

 

 

(1)打开intelli J,点击iimport project,选择相应的工程文件目录。

 

(2)import project from external model, 之后一路next下去,别忘了到填写project name的时候修改一下名字

 

(3)配置启动选项:RUN -> Edit Configuration, 点击加号,添加application

(4)点击主面板上的运行按钮开始运行,可以在网页看到效果localhost:8080

 

 

(1)Download IntelliJ IDEA

https://www.jetbrains.com/idea/download/

 

(2)找了个激活码

http://www.oschina.net/code/snippet_2303434_57174

 

43B4A73YYJ-eyJsaWNlbnNlSWQiOiI0M0I0QTczWVlKIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiIiwiYXNzaWduZWVFbWFpbCI6IiIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25seSIsImNoZWNrQ29uY3VycmVudFVzZSI6ZmFsc2UsInByb2R1Y3RzIjpbeyJjb2RlIjoiSUkiLCJwYWlkVXBUbyI6IjIwMTctMDItMjUifSx7ImNvZGUiOiJBQyIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNSJ9LHsiY29kZSI6IkRQTiIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNSJ9LHsiY29kZSI6IlBTIiwicGFpZFVwVG8iOiIyMDE3LTAyLTI1In0seyJjb2RlIjoiRE0iLCJwYWlkVXBUbyI6IjIwMTctMDItMjUifSx7ImNvZGUiOiJDTCIsInBhaWRVcFRvIjoiMjAxNy0wMi0yN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ZQLUwwa/cG++2+wNWP+HtBhVxMRNTdVhSm38AknZlD+PTAsWGu9GyLmhti2EnVwGybSD2Dxmhxk3IPCkhKAK+pl0eWYGZWG3tJ9mZ7SowcXLWDFAk0lRJnKGFMTggrWjV8GYpw5bq23VmIqqDLgkNzuoog==

 

 

(3)select project SDK, 选择JDK

 

(4)java select  directory is not a valid home for jdk

因为还没装jdk,下载地址为

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

我选择的是mac版本的

(5) 下载tomcat, 我下载的是后缀名为tar.gz的这个

http://tomcat.apache.org/download-80.cgi#8.5.5

 

(6)把tomcat移动到/Library里并修改权限、启动

 

$ cd /Library/
$ sudo mv ~/Downloads/apache-tomcat-8.5.5 .
$ sudo mv apache-tomcat-8.5.5/   Tomcat/
$ sudo chmod 755 /Library/Tomcat/bin/*.sh
$ cd Tomcat/
$ cd bin
$  ./startup.sh 

查看日志

$ cd ../logs/
$ tail -500 catalina.out

这时候可以查看下localhost:8080看下效果

 

 

import java.io.*;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
class test  
{
    public static void main (String[] args) throws java.lang.Exception
    {
        int[] B = {6,7,8,9,1,2,3,4,5};
        int[][] c = {{1,   3,  5,  7},{10, 11, 16, 20}, {23, 30, 34, 50}};

        System.out.println(search_mini(B));
        System.out.println(search(B,1));
        System.out.println(Arrays.toString(search_2d_matrix(c,30)));
    }
    
    public static int[] search_2d_matrix(int[][] matrix, int target){
        int row = matrix.length, column = matrix[0].length;
        int begin = 0, end = row * column ;
        int[] result = {-1, -1};
        
        while (begin + 1 < end) {
            int mid = (begin +  end) / 2;
            int number = matrix[mid / column][mid % column];
            if (number == target) {
                result[0] = mid / column;
                result[1] = mid % column;
                return result;
            } else if (number < target) {
                begin = mid;
            } else {
                end = mid;
            }
        }
        return result;
    }
    
    
    public static int search_mini(int[] A){
        int begin = 0, end = A.length - 1; 
        while (begin < end && A[begin] >= A[end]) {
            int mid = (begin + end) / 2;  
            if (A[mid] > A[end]) { 
                begin = mid + 1;  
            } else if (A[mid] < A[begin]) {  
                end = mid;  
            } else {   // A[begin] == A[mid] == A[end] 
             begin = begin + 1;
            } 
        }
         return A[begin];  
    }
    
    public static int search(int[] A, int target){
        int begin = 0;
        int end = A.length ;
        while(begin < end){
            int p = (end + begin) / 2;
            if(A[p] == target) return p;
            else if(A[p] > A[begin]  ){
                if(target >= A[begin] && target < A[p]){
                    end = p;
                }
                else begin = p + 1;
            }
            else{
                if(target > A[p] && target <= A[end - 1] ){
                    begin = p + 1;
                }
                else end = p;
            }
            
        }
        return -1;
    }
}