D

88250 Java golang Linux 开源
关注
1 号成员,2012-11-24 16:19:56 加入
68.9k
个人主页 浏览
34.6k
帖子 + 回帖 + 评论
但行好事莫问前程
  • Hi, 88250

    2015-11-24 16:07

    本贴需要 @someone1764 的邀请。

  • Hi, 88250

    2015-11-24 16:02

    本贴需要 @someone1764 的邀请。

  • Hi, 88250

    2015-11-24 15:56

    本贴需要 @someone1764 的邀请。

  • 链滴是个什么样的社区

    2015-11-24 13:41

    @zonghua

    public Set<String> getUserNames(final String text) throws ServiceException {
        final Set<String> ret = new HashSet<String>();
    
        int idx = text.indexOf('@');
    
        if (-1 == idx) {
            return ret;
        }
    
        String copy = text.trim();
        copy = copy.replaceAll("\\n", " ");
        copy = copy.replaceAll("(?=\\pP)[^@]", " ");
        String[] uNames = StringUtils.substringsBetween(copy, "@", " ");
        String tail = StringUtils.substringAfterLast(copy, "@");
    
        if (tail.contains(" ")) {
            tail = null;
        }
    
        if (null != tail) {
            if (null == uNames) {
                uNames = new String[1];
                uNames[0] = tail;
            } else {
                uNames = Arrays.copyOf(uNames, uNames.length + 1);
                uNames[uNames.length - 1] = tail;
            }
        }
    
        if (null == uNames) {
            return ret;
        }
    
        for (int i = 0; i < uNames.length; i++) {
            final String maybeUserName = uNames[i];
    
            if (!UserRegisterValidation.invalidUserName(maybeUserName)) { // A string match the user name pattern
                if (null != getUserByName(maybeUserName)) { // Found a user
                    ret.add(maybeUserName);
    
                    copy = copy.replace("@" + maybeUserName, "");
                    idx = copy.indexOf('@');
                    if (-1 == idx) {
                        return ret;
                    }
                }
            }
        }
    
        return ret;
    }
    

    完整代码在这里

  • Hi, 88250

    2015-11-23 18:06

    本贴需要 @someone1764 的邀请。

  • 第一次来,测试一下发帖

    2015-11-23 15:07

    @weixx 那是必须的 😏

  • Hi, 88250

    2015-11-20 18:53

    本贴需要 @someone1764 的邀请。

  • 测试代码插入

    2015-11-20 11:46
    package com.dashu;
    
    import java.util.ArrayList;
    import java.util.Comparator;
    import java.util.List;
    import java.util.PriorityQueue;
    import java.util.Queue;
    import java.util.Random;
    
    public class DaShu {
    
    
        static Comparator<Integer> cmp = new Comparator<Integer>() {
          public int compare(Integer e1, Integer e2) {
            return e2 - e1;
          }
        };
        static Queue<Integer> sortQueue = new PriorityQueue<Integer>(10,cmp);
    
        public static void main(String[] args) throws Exception {
            while(true){
                Thread.sleep(1000);
                sortQueue.add(random());
                if(sortQueue.size() == 10){
                    List<Integer> list = new ArrayList<Integer>();
                    for(int i = 0;i<sortQueue.size();i++){
                        if(i == 0){
                            System.out.println("Max :"+sortQueue.poll());
                        }
                        list.add(sortQueue.poll());
                    }
                    sortQueue.addAll(list);
                    System.out.println("Min: "+list.get(list.size() - 1));
                    System.out.println("------------------------------------");
                }
            }
        }
    
        public static int random(){
            int max=10000;
            int min=1;
            Random random = new Random();
            return random.nextInt(max)%(max-min+1) + min;
        }
    }
    
  • 算法练习:求最大值和最小值

    2015-11-20 10:48

    @DASHU 500 怎么样

  • 理解 HTTPS 原理,SSL/TLS 协议

    2015-11-20 09:16

    @kuuyee 上面的示例代码已经比较完整了,改下证书的实参就可以的。

  • 链滴是个什么样的社区

    2015-11-19 15:05

    @zonghua 首页使用的是 Reddit 的帖子排序算法。

  • Hi, 88250

    2015-11-18 13:11

    本贴需要 @ddrisme 的邀请。

  • 社区缺陷报告与功能建议

    2015-11-18 11:09

    @wishao 这的确是个 bug,230 积分已经转账给你,多谢反馈!

    下次 bug 报告积分奖励为 240

  • 签到100天留念

    2015-11-17 09:32

    @mymoshou 不行,我要克制住强迫症。

  • Thanks HSBC,Goodbye HSBC

    2015-11-17 09:31

    上次你在我博客留言时你还在汇丰,不得不感叹所谓变数。加油,Eric Cen!

  • 干掉

    2015-11-17 09:27

    @61260551 “带走”听上去好像很暴力的样子

  • 干掉

    2015-11-17 09:03

    他自己离职时怎么不留一份~

  • 签到100天留念

    2015-11-17 08:57

    上周末我去 V 的老家玩,签到断了 😢

  • 边上班边悄悄开公司,有什么需要注意的 ?

    2015-11-13 16:50

    开公司后理论上也可以上班吧,应该不冲突吧(我瞎猜的,逃

  • 求解答 关于工作的问题。

    2015-11-13 15:45

    看上去你已经不喜欢这家公司了,果断走吧,不要纠结。

    PS 能再排下版么,我是处女座 😏

  • welcome to hacpai

    2015-11-13 13:54

    哦,我原以为你用的是独立模式呢,那个模式不用安装数据库、容器,一个命令就可以启动了,是 1.2.0 的最大改进。

    对了,有空多来社区看看哦: http://hacpai.com

  • welcome to hacpai

    2015-11-13 11:49

    是 [Solo] ,不是 [B3log] 啦~

    另外:

    • 你用的是独立模式还是容器模式?还有数据库是 H2 还是 MySQL?
    • 1.2.0 还没有正式发布哦,不过应该不会有什么改动了,计划下周发布
  • Hi, 88250

    2015-11-13 09:29

    本贴需要 @hellochina 的邀请。

  • NetBeans 8.1 发布!

    2015-11-12 13:41

    我是 NetBeans 的忠实用户。 Golang 用 [LiteIDE] 和 [Wide]

  • 测试一下标签

    2015-11-12 13:41

    没明白你的意思。

  • eclipse 不能用

    2015-11-12 09:05

    用 [NetBeans] 啊!

  • 测试一下标签

    2015-11-12 09:05

    没有设计删除功能,可能后续是需要考虑一下。

  • 测试一下标签

    2015-11-11 10:25

    我也删不了....

  • Hi, 88250

    2015-11-11 08:46

    本贴需要 @hellochina 的邀请。

  • Hi, 88250

    2015-11-10 15:31

    本贴需要 @gcg0036 的邀请。