3.18号面试。金融公司 → 系统架构(有一个牛人带)  具体地址等会放上来http://ourcoders.com/thread/show/7449/

面试题:

  1. quartz  建议看看这位老师的http://www.cnblogs.com/kay/archive/2007/11/02/947372.html
  2. 根据web请求参数返回特定值 ,/hello?p1=p1&p2=p2  返回hello  ,/hello?x=x&man=you  返回you are X man。根据以上设计xml文件。(场景:微信开发调试的时候用于返回特定的值等等—对方解释)
    <?xml version="1.0" encoding="UTF-8"?>
    <elements>
        <nodes>
            <pramas>
                <prama name="p1">1</prama>
                <prama name="p2">2</prama>
               </pramas>
            <result>helloworld</result>
        </nodes>
        <nodes>
            <pramas>
                <prama name="a">a</prama>
                <prama name="b">b</prama>
               </pramas>
            <result>hello</result>
        </nodes>
    </elements>

    根据特定的参数和值返回特定的值。以上个人见解。

 

3.22 掌握科技 → 只和技术领导谈了谈。技术问了一个问题。一个大数整数数组*个位数。返回一个数组。

[1,3,4,6,7,8,9,2,3,0,8,7]*8 相当于134678923087*8返回一个数组

class BigNum {

    public static int[] sub(int[] item,int s){
        if(!(s > 0 && s < 10)){
            return new int[0];
        }
        
        int tens = 0;
        
        int[] rs = new int[item.length+1];
        
        for (int i = 0; i < item.length; i++) {
            int c = item[i] * s;
            int last = c%10;
            
            rs[item.length - i] = (last + tens) % 10 ;

            if((last + tens) >= 10){
                tens = (c-last)/10 + 1;
            } else {
                tens = (c-last)/10;
            }
        }
        rs[0] = tens;
        return rs;
    }
    
    public static int[][] twoSub(int[] item,int s){
        if(!(s > 0 && s < 10)){
            return new int[0][0];
        }
        
        int[][] rs = new int[item.length][2];
        
        for (int i = 0; i < item.length; i++) {
            int c = item[i] * s;
            int last = c%10;
            int first = (c-last)/10 ;
            
            rs[i][0] = first;
            rs[i][1] = last;

        }
        return rs;
    }
    
    
    public static void main(String[] args) {
        int[] b = new int[10];
        for (int i = 0; i < b.length; i++) {
            b[i] = 8;
        }
        
        int[] a =  sub(b,8);
        
        for (int i = 0; i < a.length; i++) {
            System.err.print(a[i]);
        }
        
        int[][] c  = twoSub(b, 8);
        
        for (int i = 0; i < c.length; i++) {
            int[] j = c[i];
            for (int j2 = 0; j2 < j.length; j2++) {
                System.err.print(j[j2]);
            }
            System.err.println();
        }
        
        
        
    }
    
}

返回结果如下:
7111111110464 64 64 64 64 64 64 64 64 64

个人觉得用二维数组较好。

 

 

3.28号 车风网面试  面试官主要问了一些java 相关基础知识,hashmap,treemap.io,spring 事务管理。cookie 跨域处理。

我重点说一个题目:下图展示既是我想说的。

搬运一个最佳答案吧。和我想的差不多。就是事务在发送exception时必须进行干预处理。

for example

class A{

    @Transactional
    public Result doStuff(){
        Result res = null;
        try {
          // do stuff 
        } catch (Exception e) {

        }
        return res ;
    }
}

If there is an exception in the method doStuff the transaction isn't rolled back.

To rollback the exception programmatically, we can do something like below.

declarative approach

@Transactional(rollbackFor={MyException1.class, MyException2.class, ....})
public Result doStuff(){
   ...
}

programmatic rollback you need to call it from TransactionAspectSupport.

public Result doStuff(){
  try {
    // business logic...
  } catch (Exception ex) {
    // trigger rollback programmatically
    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  }
}


You are strongly encouraged to use the `declarative approach` to `rollback` if at all possible.
`Programmatic rollback` is available should only be used if you absolutely need it.

谷歌翻译:强烈建议您使用`声明approach`为`rollback`如果在所有可能的。`编程回滚`是,如果你确实需要它可用时才能使用。

我翻译:建议使用声明式事务管理。不建议使用程序回滚。

 

面试还在进行中。。。。且行且努力

talk  is  cheap,show me code。

Interview  ing  。。。。

顺带一句话,google,stackoverflow,github促进了coder交流学习。google大法好。

posted on 2016-03-30 21:01  shininguang  阅读(157)  评论(0编辑  收藏  举报