全部 文章 问答 分享 共找到26个相关内容

[文章] C语言入门练习题(1~5期)
hljs-left:::7.拆分位数:::hljs-left:::8.花费计算:::hljs-left:::9.字母大小写互换:::hljs-left:::10.计算器:::hljs-left:::今天的练习就这些啦其实网上有很多的题目可以练习的
[问答] 大佬的摸鱼君项目有教 刷新 token 吗?
我现在练习的项目,使用后端 springCloud 、nacos、gateway、springsecurity、jwt 、redis 来做认证授权,前端是 vue 、nuxt.

[文章] Xpath介绍和使用
简单的使用一个简单的HTML网页<html><head><title>简单bai网页制作练习du</title></head><body

[文章] 阳光沙滩博客系统-SpringJap的增删改查练习
以Label为例子Label的DaopublicinterfaceLabelDaoextendsJpaRepository<Label,String>,JpaSpecificationExecutor<Label>{@ModifyingintdeleteOneById(Stringid);@Modifying@Query(value="DELETEFROM`tb_labels`WHEREid=?",nativeQuery=true)intcustomDeleteLabelById(Stringid);/***根据ID查找一个标签**@paramid*@return*/LabelfindOneById(Stringid);LabelfindOneByName(Stringname);}添加@PostMapping("/label")publicResponseResultaddLabel(@RequestBodyLabellabel){//判断数据是否有效//补全数据label.setId(idWorker.nextId()+"");label.setCreateTime(newDate());label.setUpdateTime(newDate());//保存数据labelDao.save(label);returnResponseResult.SUCCESS("测试标签添加成功");}删除@DeleteMapping("/label/{labelId}")publicResponseResultdeleteLabel(@PathVariable("labelId")StringlabelId){intdeleteResult=labelDao.customDeleteLabelById(labelId);log.info("deleteResult==>"+deleteResult);if(deleteResult>0){returnResponseResult.SUCCESS("删除标签成功");}else{returnResponseResult.FAILED("标签不存在");}}修改/更新@PutMapping("/label/{labelId}")publicResponseResultupdateLabel(@PathVariable("labelId")StringlabelId,@RequestBodyLabellabel){LabeldbLabel=labelDao.findOneById(labelId);if(dbLabel==null){returnResponseResult.FAILED("标签不存在");}dbLabel.setCount(label.getCount());dbLabel.setName(label.getName());dbLabel.setUpdateTime(newDate());labelDao.save(dbLabel);returnResponseResult.SUCCESS("修改成功");}查询@GetMapping("/label/{labelId}")publicResponseResultgetLabelById(@PathVariable("labelId")StringlabelId){LabeldbLabel=labelDao.findOneById(labelId);if(dbLabel==null){returnResponseResult.FAILED("标签不存在");}returnResponseResult.SUCCESS("获取标签成功").setData(dbLabel);}分业查询@GetMapping("/label/list/{page}/{size}")publicResponseResultlistLabels(@PathVariable("page")intpage,@PathVariable("size")intsize){if(page<1){page=1;}if(size<=0){size=Constants.DEFAULT_SIZE;}Sortsort=newSort(Sort.Direction.DESC,"createTime");Pageablepageable=PageRequest.of(page-1,size,sort);Page<Label>result=labelDao.findAll(pageable);returnResponseResult.SUCCESS("获取成功").setData(result);}条件查询@GetMapping("/label/search")publicResponseResultdoLabelSearch(@RequestParam("keyword")Stringkeyword,@RequestParam("count")intcount){List<Label>all=labelDao.findAll(newSpecification<Label>(){@OverridepublicPredicatetoPredicate(Root<Label>root,CriteriaQuery<?>criteriaQuery,CriteriaBuildercb){PredicatenamePre=cb.like(root.get("name").as(String.class),"%"+keyword+"%");PredicatecountPre=cb.equal(root.get("count").as(Integer.class),count);Predicateand=cb.and(namePre,countPre);returnand;}});if(all.size()==0){returnResponseResult.FAILED("结果为空");}returnResponseResult.SUCCESS("查找成功").setData(all);}
[问答] 模拟支付宝练习,回调函数为NULL
使用AIDL进程间通信下面打//*******的那一行thirdPayAction.requestPay(pay.getText().toString(),100,result);rerresult上几行new的对象以判断不为null;publicclassMainActivityextendsAppCompatActivity{privatestaticfinalStringTAG="MainActivity";privateTextViewqbNum;privateButtonpay;privatebooleanisBindService;privateThirdPayActionthirdPayAction;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);initView();doBindService();}/***绑定支付服务*/privatevoiddoBindService(){Intentintent=newIntent();intent.setAction(Constant.ACTION_THREEPAY);intent.setPackage("com.example.alipay");intent.addCategory(Intent.CATEGORY_DEFAULT);isBindService=bindService(intent,serviceConnection,BIND_AUTO_CREATE);}publicServiceConnectionserviceConnection=newServiceConnection(){@OverridepublicvoidonServiceConnected(ComponentNamename,IBinderservice){Log.d(TAG,"onServiceConnected....");thirdPayAction=ThirdPayAction.Stub.asInterface(service);}@OverridepublicvoidonServiceDisconnected(ComponentNamename){Log.d(TAG,"onServiceDisconnected....");thirdPayAction=null;}};/***初始化资源*/privatevoidinitView(){qbNum=findViewById(R.id.qNum);pay=findViewById(R.id.pay);pay.setOnClickListener(newView.OnClickListener(){@OverridepublicvoidonClick(Viewv){Resultresult=newResult();if(result==null){Log.d(TAG,"call==null");}try{if(thirdPayAction!=null){thirdPayAction.requestPay(pay.getText().toString(),100,result);///**********}}catch(RemoteExceptione){e.printStackTrace();}}});}publicclassResultimplementsThirdPayResult{@OverridepublicvoidpaySuccess()throwsRemoteException{Log.d(TAG,"充值成功...");qbNum.setText("100Q币");Toast.makeText(MainActivity.this,"充值成功",Toast.LENGTH_SHORT).show();}@OverridepublicvoidpayError(interrorCode,Stringmsg)throwsRemoteException{Log.d(TAG,"充值失败...");}@OverridepublicIBinderasBinder(){returnnull;}}/***解除服务绑定,释放资源*/@OverrideprotectedvoidonDestroy(){super.onDestroy();if(isBindService&&serviceConnection!=null){unbindService(serviceConnection);serviceConnection=null;isBindService=false;}}}模拟支付宝的app:requestPay(StringorderInfo,floatmoney,ThirdPayResultcall)前面参数都传递过来了,只有ThirdPayResultcall它传递的是null为什么呢?为什么呢?publicclassThirdPayImplextendsThirdPayAction.Stub{@OverridepublicvoidrequestPay(StringorderInfo,floatmoney,ThirdPayResultcall)throwsRemoteException{//第三方支付请求,然后打开一个支付界面。mcallback=call;if(call==null){Log.d(TAG,"传递的回调函数是空");}Intentintent=newIntent();intent.setClass(PayService.this,PayActivity.class);intent.putExtra(Constant.KEY_BILL_INFO,orderInfo);intent.putExtra(Constant.KEY_PAY_MONEY,money);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);startActivity(intent);}publicvoidpaySuccess(){try{if(mcallback!=null){mcallback.paySuccess();Log.d(TAG,"支付成功");}Log.d(TAG,"mcallback==null");}catch(RemoteExceptione){e.printStackTrace();}}publicvoidpayError(interrorCode,Stringmsg){try{if(mcallback!=null){mcallback.payError(errorCode,msg);Log.d(TAG,"错误代码"+errorCode+"错误信息"+msg);}}catch(RemoteExceptione){e.printStackTrace();}}}这是模拟的支付宝服务端privateThirdPayResultmcallback;@OverridepublicvoidrequestPay(StringorderInfo,floatmoney,ThirdPayResultcall)throwsRemoteException{//第三方支付请求,然后打开一个支付界面。mcallback=call;if(call==null){Log.d(TAG,"传递的回调函数是空");//这里log显示了}Log.d(TAG,orderInfo+"11"+money);Intentintent=newIntent();intent.setClass(PayService.this,PayActivity.class);intent.putExtra(Constant.KEY_BILL_INFO,orderInfo);intent.putExtra(Constant.KEY_PAY_MONEY,money);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);startActivity(intent);}这是客户端Result实现接口,传递的不是空,但模拟支付宝服务端接收的时候时空对象pay.setOnClickListener(newView.OnClickListener(){@OverridepublicvoidonClick(Viewv){Resultresult=newResult();if(result==null){Log.d(TAG,"call==null");}try{if(thirdPayAction!=null){thirdPayAction.requestPay(pay.getText().toString(),100,result);}}catch(RemoteExceptione){e.printStackTrace();}}});publicclassResultimplementsThirdPayResult{@OverridepublicvoidpaySuccess()throwsRemoteException{Log.d(TAG,"充值成功...");qbNum.setText("100Q币");Toast.makeText(MainActivity.this,"充值成功",Toast.LENGTH_SHORT).show();}@OverridepublicvoidpayError(interrorCode,Stringmsg)throwsRemoteException{Log.d(TAG,"充值失败...");}@OverridepublicIBinderasBinder(){returnnull;}}客户端传递
2020-04-23 17:09
·
AIDL通信

[文章] 【领券联盟】笔记:视频41-动态计算size去请求图片
into(cover);轮播图里的图片可以正常显示布局一半的大小,显示的是540x540的图片,但轮播图的宽度是1080,原始图片的大小是800x800,图片变模糊了,这里可以显示图片的原始大小当然,练习还是要练的
2020-04-01 19:58
·
课堂笔记

[文章] C语言入门(5)
+n下期我在网上搜一些题目并整理出来供小伙伴们练习玩玩;在家期间请小伙伴们尽量不要外出,无聊时间可以敲敲代码练练手;以上就是本期内容,谢谢;

[文章] Python 网络爬虫练手
怎么不搞一个小项目练习一下手呢?所以写一个小的demo练习一下手。这个demo很多不足的地方,后文在表述。http://www.rrdyw.cc/movie/这是真是看电影的好地方。
[问答] 我在练习post提交文本内容,使用的是摸鱼评论的API,不知道为什么,点击按钮后没有反应
package com.example.androidnetwork; import android.os.Bundle; import android.util.Log; import android.view.View; import androidx.appcompat.app.AppCompatActivity; import com.example.androidnetwork.entity.CommentItem; import com.google.gson.Gson; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; public class PostTestActivity extends AppCompatActivity implements View.OnClickListener { private static final String TAG = "ning"; private InputStream inputStream; private OutputStream outputStream; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_post_test); findViewById(R.id.btn_post).setOnClickListener(this); } @Override public void onClick(View v) { new Thread(() -> { inputStream = null; outputStream = null; if (R.id.btn_post == v.getId()) { try { URL url = new URL("https://api.sunofbeaches.com/ct/moyu/comment"); HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setRequestMethod("POST"); //设置链接超时时间 httpURLConnection.setConnectTimeout(10000); httpURLConnection.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"); httpURLConnection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); httpURLConnection.setRequestProperty("Accept", "application/json,text/plain, */*"); CommentItem commentItem = new CommentItem("1688", "夜色难免微凉,前行必有曙光"); Gson gson = new Gson(); String json = gson.toJson(commentItem); byte[] bytes = json.getBytes("UTF-8"); httpURLConnection.setRequestProperty("Content-Length", String.valueOf(bytes.length)); //连接 httpURLConnection.connect(); outputStream = httpURLConnection.getOutputStream(); outputStream.write(bytes); outputStream.flush(); //拿结果 int responseCode = httpURLConnection.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { inputStream = httpURLConnection.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); Log.d(TAG, "result--->" + bufferedReader.readLine()); } } catch (Exception e) { throw new RuntimeException(e); } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { throw new RuntimeException(e); } } if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } }); } }
2023-08-10 10:35
·
Android网络编程
[问答] Okhttp3 post上传文件的时候携带文件的参数的问题
Okhttp3post上传文件的时候携带文件的参数怎么做啊下面是接口文档和练习的demo求教!
2020-02-16 17:41
·
okhttp
[问答] 找人教我部署分布式单体项目上线(悬赏200元)
我写的手机账号注册,好像要网站上线后才能换发送消息模板内容;我不是学生了,以前跟着其它教程练习过部署简单项目上线,所以我也没有新人优惠了;服务器购买的时间长一些会有折扣,但我不知道会不会有其它问题出现,

[文章] UIKit快速入门之UIButton(4)
作为入门练习,可以先了解一下,深入的会在实战环节进行介绍:首先创建一个新文件,选择xcode菜单,File->New->File,选择:CocoaTouchClass类型:MyButton.swift

[文章] [老司机]驾考避坑指南
其他事项教练时常给我灌输学驾照就跟上学一样,要好好听教练的,平时勤快一点帮教练多干点活,也确实给他划线(没错我们驾校练习需要划线)扫地,擦车之类的。后来我才意识到不对劲。

[文章] C语言入门(3)
语句使用以及注意的相关事项这节内容可能比较多,大家可以在空余时间消化练习.之前的小编没排序,现在排个序:C语言入门(1)-----最简框架C语言入门(2)-----框架解析目录1.变量的命名规则2.变量的输入输出

[文章] Android 原生Email APP 代码解析(1)
Android原生EmailAPP代码解析(1)练习Markdown的使用,总结一下以前的学习的内容,感谢老师提供的平台最近听到一个段子就是说欧洲人在线上购买商品的时候还是用Email与商家沟通,中国的商家加入了

[文章] Hadoop集群操作
只需要多加练习就好。

[文章] 奥巴马精彩演讲:我们为什么要上学?
butyoumightnotknowthatuntilyoujoinstudentgovernmentorthedebateteam.或许你能写出优美的文字——甚至有一天能让那些文字出现在书籍和报刊上——但假如不在英语课上经常练习写作

[文章] [异性朋友]从小到大与异性的那些故事
不过有件事我印象比较深刻,当时我练习倒车入库,然后L一直在拍我,搞得我很紧张,这也是第一次对这个女生有印象。再之后我们都挂了好几次科目三,就一起考了好几次科三。

[文章] ElasticSearch安装以及相关操作
操作BulkResponseresp=client.bulk(request,RequestOptions.DEFAULT);//3.输出结果System.out.println(resp);}五.ES练习索引
2021-01-21 21:31
·
ElasticSearch
- 1