2017.08.17
来源:互联网 发布:js 字符串对象转数组 编辑:程序博客网 时间:2024/06/06 12:27
解决Idea出现cannot resolve symbol
Idea cannot resolve symbol 代码边红色 现象的2中解决方法:
1.File-->Invalidated cache
如果不行,可能是maven的问题,执行第2种:
2.reimport maven,重新把maven import到Idea中。
修改贫困生mr程序.
1.把有关useragent的都注释了.
System.out.println( context.getConfiguration().get(Config.UA_URL));String UAUrl = context.getConfiguration().get(Config.UA_URL);String json = JsonParseUtil.loadJson(UAUrl);JSONObject obj = null;try { obj = new JSONObject(json); int userAgentTag = obj.getInt("UserAgent"); System.out.println("<--->"+userAgentTag); if (userAgentTag == 1){ gameAppSum = new IntWritable(1); } if (userAgentTag == 3 ) { learnAppSum = new IntWritable(1); } if (userAgentTag == 4){ consumptionAPPState = new IntWritable(1); } if (userAgentTag == 5){ orderMealAPPState = new IntWritable(1); } if (userAgentTag == 13){ videoAppSum = new IntWritable(1); }} catch (JSONException e) { e.printStackTrace();}
我准备把这个url放在mr程序中的otherargs中.
1.
otherArgs[7] = "http://192.168.20.60:8080/user-agent-service/UserAgentTag?word=";
conf.set(Config.UA_URL,otherArgs[7]);有set就用get来获取public static final String UA_URL = "http://192.168.20.60:8080/user-agent-service/UserAgentTag?word=";
String UAUrl = context.getConfiguration().get(Config.UA_URL);
http://192.168.20.60:8080/user-agent-service/UserAgentTag?word=
正则表达式
1.find()方法是部分匹配,是查找输入串中与模式匹配的子串,如果该匹配的串有组还可以使用group()函数。
matches()是全部匹配,是将整个输入串与模式匹配,如果要验证一个输入的数据是否为数字类型或其他类型,一般要用matches()。
2.Pattern pattern= Pattern.compile(".*?,(.*)");
Matcher matcher = pattern.matcher(result);
if (matcher.find()) {
return matcher.group(1);
}
- //拿到map集合中的key的Set集合
- Set<String> keySet = map.keySet();
Map map = new Hashmap();//创建一个mapmap.put("key","value");//给map赋值String vlaues = map.get("key");//获取map中键值为“key”的值system.out.println(vlaues );//输出结果以上代码的运行结果:value;
html中是+号的意思,通过 GET方式传值的时候,+号会被浏览器处理为空。。需要转换为%2b
\\D*
匹配非数字字符的字符串* 表示匹配前面的子表达式零次或多次(大于等于0次)。例如,zo*能匹配“z”,“zo”以及“zoo”。*等价于{0,}。
阅读全文
0 0
- 2017.08.17
- 2017.08.17
- 工作日记2017.08.17
- 2017.08.17总结
- 2017.08.17工作日记
- 嵌入式每日学习心得2017.08.17
- 菜鸟学Java学习笔记小结 2017.08.17
- 2017.08.17【NOIP提高组】模拟赛B组总结
- 2017.08.03
- 2017.08.03
- 2017.08.05
- 2017.08.05
- 【2017.08.06】
- 2017.08.06
- 【2017.08.07】
- 2017.08.08
- 2017.08.09
- 2017.08.10
- 缺少Microsoft Communications Control 控件
- Java回调机制
- WordPress 后台出现No input file specified解决方案
- Ubuntu下安装MySQL及简单操作
- java根据名称下载文件
- 2017.08.17
- HDU 6129 Just do it(多校7, 组合数 规律)
- Nginx+tomcat 搭建负载均衡集群
- jupyter notebook 的使用方法(持续更新)
- NL-mean和BM3D去噪算法
- gulp压缩js/less(css)
- java数据类型
- 命令者模式(使用较少)
- c++ list, vector, map, set 区别与用法比较