override

Flink入门 - CoGroup和Join

拟墨画扇 提交于 2019-12-05 03:49:31
/* *CoGroup */ final StreamExecutionEnvironment streamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment(); DataStream<Tuple2<String, String>> dataStream1 = streamExecutionEnvironment.socketTextStream("127.0.0.1", 9000) .map(new MapFunction<String, Tuple2<String, String>>() { @Override public Tuple2<String, String> map(String s) throws Exception { List<String> strs = Arrays.asList(s.split(" ")); return new Tuple2<>(strs.get(0), strs.get(1)); } }); DataStream<Tuple2<String, String>> dataStream2 = streamExecutionEnvironment.socketTextStream("127.0.0.1", 9001) .map(new

Springboot 注册拦截器

依然范特西╮ 提交于 2019-12-04 00:15:31
拦截器 创建myInterceptor类 import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; public class MyInterceptor1 implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { System.out.println("MyInterceptor >>> preHandle"); return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView

Android在Service中弹出对话框二

旧街凉风 提交于 2019-12-03 22:35:00
上一篇我也写了一篇弹窗的,但是经过测试,Android8.0之后用不了,所以改一下 Myservice.class package com.nf.service; import android.app.AlertDialog; import android.app.AliasActivity; import android.app.Dialog; import android.app.Service; import android.content.DialogInterface; import android.content.Intent; import android.os.Binder; import android.os.Build; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.util.Log; import android.view.WindowManager; import android.widget.Toast; import java.sql.Time; import java.util.Objects; import java.util.Timer; import java.util.TimerTask; public

Flutter-SearchDelegate搜索框

六月ゝ 毕业季﹏ 提交于 2019-12-03 20:13:20
搜索欄 import 'package:flutter/material.dart'; typedef SearchItemCall = void Function(String item); class SearchBarDelegate extends SearchDelegate<String> { @override List<Widget> buildActions(BuildContext context) { //右侧显示内容 这里放清除按钮 return [ IconButton( icon: Icon(Icons.clear), onPressed: () { query = ""; showSuggestions(context); }, ), ]; } @override Widget buildLeading(BuildContext context) { //左侧显示内容 这里放了返回按钮 return IconButton( icon: AnimatedIcon( icon: AnimatedIcons.menu_arrow, progress: transitionAnimation), onPressed: () { if (query.isEmpty) { close(context, null); } else { query = "";

spark记录(20)自定义累加器Accumulator

戏子无情 提交于 2019-12-03 15:12:04
自定义累加器 /** * 自定义累加器需要继承AccumulatorV2<IN,OUT>类 * 并且要指定要累加的类型 */ public class MyAccumulator extends AccumulatorV2<MyKey,MyKey> implements Serializable { private MyKey info = new MyKey(0, 0); public MyKey getInfo() { return info; } public void setInfo(MyKey info) { this.info = info; } //判断是否是初始状态,直接与原始状态的值比较 @Override public boolean isZero() { return info.getPersonAgeSum()==0 && info.getPersonNum()==0; } //复制一个新的累加器 @Override public AccumulatorV2<MyKey, MyKey> copy() { MyAccumulator myAccumulator = new MyAccumulator(); myAccumulator.info = this.info; return myAccumulator; } /

Android 上下文菜单 ActionMode

三世轮回 提交于 2019-12-03 11:03:43
public class MainActivity extends Activity { private Button button; private ActionMode actionMode; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); button.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { // TODO Auto-generated method stub if (actionMode != null) { return false; } else { actionMode = startActionMode(actionCallback); v.setSelected(true); return true; } } }); } private ActionMode.Callback

Spring Boot 定义过滤器、监听器、拦截器

眉间皱痕 提交于 2019-12-03 03:14:08
一、自定义过滤器 创建一个过滤器,实现javax.servlet.Filter接口,并重写其中的init、doFilter、destory方法。 [java] view plain copy package com.example.filter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; /** * 实现javax.servlet.Filter,覆盖其三个方法 * @author Administrator * */ @WebFilter(filterName="customFilter",urlPatterns="/*") public class CustomFilter implements Filter{ @Override public void

Spring Security with OAuth2 and JWT: Encoded password does not look like BCrypt

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to implement a spring AuthorizationServer with JWT. I was able to produce JWT tokens and login until I added BCrypt to the mix. Now, when I am trying to login, I get "Bad credentials" from the API. OAuth2Configuration.java @Configuration @EnableAuthorizationServer public class OAuth2Configuration extends AuthorizationServerConfigurerAdapter { private DataSource dataSource; private AuthenticationManager authenticationManager; private BCryptPasswordEncoder passwordEncoder; public OAuth2Configuration(AuthenticationManager

Flutter 创建透明的路由页面

江枫思渺然 提交于 2019-12-03 02:07:49
原文 import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: HomePage(), ); } } class HomePage extends StatefulWidget { @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Text('home page'), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.dialer_sip), onPressed: () { Navigator.of(context).push(SimpleRoute( name:

Spring boot oauth: unsupported grant type

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: please help me... unsupported grant type makes me crazy.. my spring boot settings look like this. @Configuration @EnableAuthorizationServer public class AuthServerConfig extends AuthorizationServerConfigurerAdapter{ @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { // TODO Auto-generated method stub super.configure(endpoints); } @Override public void configure(AuthorizationServerSecurityConfigurer security) throws Exception { // TODO Auto-generated method stub security /*.tokenKeyAccess(