随笔分类 -  代码

日常代码记录
摘要:【摘抄至:Javascript 权威指南 - 15 章 】 零、文档坐标和视口坐标 要在两种坐标系之间相互切换,必须加上或减去滚动的偏移量。 一、getBoundingClientRect(),获取元素尺寸与位置的简单方法 返回视口坐标(viewport),方法中的"Client"是一种间接指代,就 阅读全文
posted @ 2018-12-07 11:02 chenyizh
摘要:/* 分为4个区段 p x j< k < r, 待扫描 k = r, arr[k] = x */ function partition(arr, p, r){ var i = p - 1, j = p, x = arr[r]; while(j < r){ if(arr[j] <= x){ i = i + 1; swap(arr, i, j); } j = j ... 阅读全文
posted @ 2018-11-29 09:34 chenyizh
摘要:/*来源: PPT【Scalable IO in Java.pdf】*/ // Reactor:通过分派适当的处理程序来响应IO事件 class Reactor implements Runnable{ final Selector selector; final ServerSocketChann 阅读全文
posted @ 2018-04-09 10:36 chenyizh
摘要:$.validator.format = function(source, params) { if ( arguments.length === 1 ) { return function() { var args = $.makeArray(arguments); args.u... 阅读全文
posted @ 2017-12-11 17:12 chenyizh
摘要:参考文档:http://www.cnblogs.com/ligerleng/p/gmail_assist_2.html http://open.chrome.360.cn/extension_dev/overview.html 一、Chrome扩展中脚本类型: 1、injected ,即通过动态方法 阅读全文
posted @ 2017-09-28 11:43 chenyizh
摘要:【oracle查看被锁的表和解锁 https://www.cnblogs.com/XQiu/p/5212787.html】 --1SELECT * FROM V$DB_OBJECT_CACHE WHERE name='TYWDM_YZYWLB' AND LOCKS!='0';--2select wm 阅读全文
posted @ 2017-05-12 16:31 chenyizh
摘要:View scrollTo:相对于初始位置 scrollBy:相对于当前位置 1.滚动对象是View内部的内容 2.X轴 负值:向右,正值:向左 (左正右负) Y轴 负值:向下,正值:向上 3.滚动效果为跳跃式,没有平滑滚动效果 Scroller使用步骤: 1.创建Scroller实例 2.调用Sc 阅读全文
posted @ 2016-06-28 17:12 chenyizh 阅读(302) 评论(0) 推荐(0)
摘要:1、LogHelper 2、ImageCache 3、BitmapHelper 4、网络是否正常 5、从主题中获取颜色值 阅读全文
posted @ 2016-06-03 15:26 chenyizh
摘要:参考来源:慕课网 http://www.imooc.com/learn/615 1、组合方式实现自定义控件:继承LinearLayout 2、三角形绘制 3、控件滑动 scroll [Scroller源码分析 http://www.jianshu.com/p/d74f6badb164#] 4、dis 阅读全文
posted @ 2016-05-03 11:35 chenyizh
摘要:摘抄至:http://blog.csdn.net/xiaanming/article/details/17539199 1、Scroller实现View的平滑移动,scrollTo() 方法是对里面的子View进行滚动,而不是对整个布局进行滚动,所以我们用LinearLayout来套住我们的item 阅读全文
posted @ 2016-04-23 22:48 chenyizh
摘要:参考至慕课网:五子连珠 http://www.imooc.com/learn/641 1、源代码: wuziqiPanel MainActivity.java activity_main.xml 2、 自定义View 重要的几个重载方法: onMeasure、onTouchEvent、onDraw 阅读全文
posted @ 2016-04-21 18:52 chenyizh 阅读(191) 评论(0) 推荐(0)
摘要:1、教学视频:慕课网 http://www.imooc.com/note/648?sort=last 2、第三方包ZXing实现二维码扫描解析与生成功能; 3、Android Studio 项目目录:1、app 2、libzxing,app引用libzxing Module; 4、源代码: 解析二维 阅读全文
posted @ 2016-04-12 17:58 chenyizh 阅读(625) 评论(0) 推荐(0)
摘要:1、onMeasure中:match_parent与exactly数值 对应Mode = MeasureSpec.EXACTLY; wrap_content 需要处理宽与高; 2、ValueAnimator 实现动画效果 MyDashCircle package com.yizhui.dashcir 阅读全文
posted @ 2016-03-07 14:20 chenyizh
摘要://转载至 http://www.oschina.net/code/snippet_1398304_44573import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat 阅读全文
posted @ 2016-02-22 15:59 chenyizh
摘要:import android.content.Context; import android.os.Handler; import android.view.View; import android.view.inputmethod.InputMethodManager; /** * Created 阅读全文
posted @ 2016-02-17 20:21 chenyizh
摘要:<?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:key="using_categories_in_r 阅读全文
posted @ 2016-02-11 21:18 chenyizh
摘要:参考转载至 慕课网 《Android电商活动中的刮刮卡 http://www.imooc.com/view/225》 1、获取canvas 的两种途径 1)onDraw(Canvas canvas); 该回调方法由系统传参 2)new Canvan(mBitmap); mBitmap = Bitma 阅读全文
posted @ 2016-02-06 13:14 chenyizh
摘要:1、canvas.rotate(degree) 适合在圆弧上画刻度时使用 2、paint.getTextWidths(String,start,end,widths) 计算该画笔下文字宽度 3、canvas.drawTextOnPath(String,path,hOffset,vOffset,pai 阅读全文
posted @ 2016-02-04 11:17 chenyizh
摘要:1、wait()惯用法:wait()包装在一个while语句中,因为某个其他任务可能会在WaitPerson被唤醒时,会突然插足并拿走订单;2、只能在同步控制方法或同步控制块里调用wait()、notify()和notifyAll();import java.util.concurrent.*;pu... 阅读全文
posted @ 2015-12-30 16:23 chenyizh 阅读(194) 评论(0) 推荐(0)
摘要:1、代码摘自 《算法的乐趣》// chinese_num.cpp : Defines the entry point for the console application.//#include #include //using namespace std;const int CHN_NUM_CHA... 阅读全文
posted @ 2015-12-04 15:06 chenyizh