热门标签 | HotTags
当前位置:  开发笔记 > 前端 > 正文

jsCanvas实现的日历时钟案例分享

本文主要分享了js实现的日历时钟案例,具有一定的参考价值,下面跟着小编一起来看下吧

Html:













js:

;var calendarWithTime = function(){
 v = navigator.userAgent.toLowerCase().indexOf("android") != -1 || navigator.userAgent.toLowerCase().indexOf("iphone") != -1 || navigator.userAgent.toLowerCase().indexOf("ipad") != -1;
 // 浏览器可见区域
 appWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth);
 appHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) - 3; // chrome下,高度一样是,会出现下拉滚动条
 // 中心点
 centerPoint = {'x':appWidth*0.5,'y':appHeight*0.5};
 // 动画用
 lastFpsUpdateTime = (+new Date);
 // canvas对象
 caObj = null;
 // canvas context对象
 ctxtObj = null;
 // 现在时间
 timeNow = "";
 // 开始年份
 startY = 1988;
 init = function(){
  window.Onload=function(){this.initCanvas();}
 }();
 getDomId = function(id){return document.getElementById(id);}
 initCanvas = function(id){
  this.caObj = this.getDomId("calendarWithTime");
  this.ctxtObj = this.caObj.getContext("2d");
  // 全屏canvas
  this.caObj.style.width = (this.appWidth+'px');
  this.caObj.style.height = (this.appHeight+'px');
  this.caObj.width = this.appWidth;
  this.caObj.height = this.appHeight;
  if (v) {
   caObj.style.border = "none";
  }
  // 开始年份
  startY = Math.floor((new Date()).getFullYear() / 8) * 8;
  // test 
  // startY = Math.floor(2010 / 8) * 8;
  this.lastFpsUpdateTime = (+new Date);
  this.animate();
 }
 doDraw = function(){
  this.ctxtObj.clearRect(0, 0, this.caObj.width, this.caObj.height);
  var date = new Date();
  // test
  /*date.setDate(29);
  date.setMonth(3);
  date.setFullYear(2010);*/
  var afterGap = 8 - (date.getFullYear() - startY);
  var allYears = date.getFullYear()-this.startY+afterGap;
  var allDays = this.getCountDays(date.getFullYear(),date.getMonth());
  this.doDrawDayPanel(31,allDays);
  this.doDrawMonthPanel();
  this.doDrawYearPanel(this.startY,date.getFullYear(),afterGap);
  // 画时间针
  this.doDrawTPanel();
  this.drawYMDHMS(0,0.35,0,0.1,date.getSeconds(),0,30,'s','');
  this.drawYMDHMS(0,0.3,0,0.05,date.getMinutes(),date.getSeconds()/60,30,'m','');
  this.drawYMDHMS(0,0.25,0,0.03,date.getHours() % 12,date.getMinutes()/60,6,'h','');
  this.drawYMDHMS(0.4,0.7,0.4,0.66,date.getDate(),date.getHours()/24,Math.ceil(31*0.5),'d',date.getDate());
  this.drawYMDHMS(0.4,0.6,0.4,0.568,(date.getMonth()),date.getDate()/(allDays+1),6,'M',date.getMonth()+1);
  this.drawYMDHMS(0.4,0.55,0.4,0.52,(date.getFullYear() - this.startY),(date.getMonth()+1)/13,Math.ceil(allYears*0.5),'y',date.getFullYear());
  // 显示时间
  this.getTimeNow();
  this.ctxtObj.save();
  this.ctxtObj.beginPath();
  this.ctxtObj.fillStyle = "#369";
  this.ctxtObj.strokeStyle = "#369";
  this.ctxtObj.fOnt= "30px bold 微软雅黑";
  this.ctxtObj.textAlign="start";
  this.ctxtObj.textBaseline="top";
  this.ctxtObj.fillText(this.timeNow,0,0);
  this.ctxtObj.strokeText(this.timeNow,0,0);
  this.ctxtObj.restore();
  /*
  fillText(String text,float x,float y,[float maxwidth]):填充字符串
  strokeText(String text,float x,float y,[float maxwidth]):绘制边框
  fOnt="bold 45px 宋体"
  textAlign:设置绘制字符串的水平对齐方式,start|end|right|center
  textBaseline:垂直对齐方式:top|hanging|middle|alphabetic|bottom
  */
 }
 doChangeToFrOnt= function(i,x){
  // 转换为画面值
  return (i +Math.ceil(x/4)) % 60;
 }
 doChangeToEnd = function(i,x){
  // 转换为后台值
  return (i +Math.ceil(x/4*3)) % 60;
 }
 doDrawTPanel = function(){
  // 画时钟面板
  var minsLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.3;
  var mineLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.32;
  var maxsLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.28;
  var maxeLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.34;
  var gap = Math.PI/30;
  futOnum= 5;
  this.ctxtObj.save();
   this.ctxtObj.fillStyle = "#369";
  this.ctxtObj.strokeStyle = "#369";
  for(var i =0;i<=59;i++){
   if(i % futOnum==0){
    sLen = maxsLen;
    eLen = maxeLen;
   }else{
    sLen = minsLen;
    eLen = mineLen;
   }
   this.ctxtObj.beginPath();
   this.ctxtObj.moveTo(Math.cos(i*gap)*sLen + this.centerPoint.x ,Math.sin(i*gap)*sLen + this.centerPoint.y);
   this.ctxtObj.lineTo(Math.cos(i*gap)*eLen + this.centerPoint.x,Math.sin(i*gap)*eLen + this.centerPoint.y);
   this.ctxtObj.stroke();
   this.ctxtObj.closePath();
   /*iDiff = this.doChangeToFront(i); // i => iDiff
   //iDiff2 = this.doChangeToEnd(iDiff,60); // iDiff => i
   this.ctxtObj.fOnt= "2px bold 微软雅黑";
   this.ctxtObj.textAlign="center"
   this.ctxtObj.textBaseline="middle"
   this.ctxtObj.fillText(iDiff,Math.cos(i*gap)*eLen + this.centerPoint.x,Math.sin(i*gap)*eLen + this.centerPoint.y);
   */

  }
  this.ctxtObj.beginPath();
  this.ctxtObj.arc(this.centerPoint.x,this.centerPoint.y,Math.min( this.caObj.width, this.caObj.height)*0.5*0.01,0,360,false);
  this.ctxtObj.fill;
  this.ctxtObj.fill();
  this.ctxtObj.closePath();
  this.ctxtObj.restore();
 }
 doDrawYearPanel = function(startYear,nowYear,afterGap){
  // 画年份面板
  var sLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.53;
  var eLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.55;
  var labelLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.60;
  var allYears = nowYear-startYear+afterGap;
  var gap = Math.PI/Math.ceil(allYears*0.5);
  this.ctxtObj.save();
   this.ctxtObj.fillStyle = "#b4ffff";
  this.ctxtObj.beginPath();
  this.ctxtObj.arc(this.centerPoint.x,this.centerPoint.y,eLen+2,0,360,false);
  this.ctxtObj.closePath();
  this.ctxtObj.fill();
   this.ctxtObj.fillStyle = "white";
  this.ctxtObj.beginPath();
  this.ctxtObj.arc(this.centerPoint.x,this.centerPoint.y,sLen-2,0,360,false);
  this.ctxtObj.closePath();
  this.ctxtObj.fill();
  this.ctxtObj.restore();
   this.ctxtObj.fillStyle = "#369";
  this.ctxtObj.strokeStyle = "#369";
   for(var i =-2;i<=allYears-3;i++){
   this.ctxtObj.save();
   this.ctxtObj.beginPath();
   this.ctxtObj.moveTo(Math.cos(i*gap)*sLen + this.centerPoint.x ,Math.sin(i*gap)*sLen + this.centerPoint.y);
   this.ctxtObj.lineTo(Math.cos(i*gap)*eLen + this.centerPoint.x,Math.sin(i*gap)*eLen + this.centerPoint.y);
   this.ctxtObj.closePath();
   this.ctxtObj.stroke();
   iDiff = this.doChangeToFront(i,allYears) + startYear;
   this.ctxtObj.translate(this.centerPoint.x, this.centerPoint.y);
    this.ctxtObj.rotate(i*gap);
   this.ctxtObj.fOnt= "10px bold 微软雅黑";
   this.ctxtObj.textAlign="start";
   this.ctxtObj.textBaseline="bottom";
   this.ctxtObj.fillText(iDiff,sLen,0);
   this.ctxtObj.restore();
  }
 }
 doDrawMOnthPanel= function(){
  // 画年份面板
  var sLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.58;
  var eLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.6;
  var labelLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.70;
  var gap = Math.PI/6;
  this.ctxtObj.save();
   this.ctxtObj.fillStyle = "#fde08c";
  this.ctxtObj.beginPath();
  this.ctxtObj.arc(this.centerPoint.x,this.centerPoint.y,eLen+2,0,360,false);
  this.ctxtObj.closePath();
  this.ctxtObj.fill();
   this.ctxtObj.fillStyle = "white";
  this.ctxtObj.beginPath();
  this.ctxtObj.arc(this.centerPoint.x,this.centerPoint.y,sLen-2,0,360,false);
  this.ctxtObj.closePath();
  this.ctxtObj.fill();
  this.ctxtObj.restore();
   this.ctxtObj.fillStyle = "#369";
  this.ctxtObj.strokeStyle = "#369";
   for(var i =-2;i<=9;i++){
   this.ctxtObj.save();
   this.ctxtObj.beginPath();
   this.ctxtObj.moveTo(Math.cos(i*gap)*sLen + this.centerPoint.x ,Math.sin(i*gap)*sLen + this.centerPoint.y);
   this.ctxtObj.lineTo(Math.cos(i*gap)*eLen + this.centerPoint.x,Math.sin(i*gap)*eLen + this.centerPoint.y);
   this.ctxtObj.closePath();
   this.ctxtObj.stroke();
   iDiff = (this.doChangeToFront(i,12)) % 12+1;
   this.ctxtObj.translate(this.centerPoint.x, this.centerPoint.y);
    this.ctxtObj.rotate(i*gap);
   this.ctxtObj.fOnt= "20px bold 微软雅黑";
   this.ctxtObj.textAlign="start";
   this.ctxtObj.textBaseline="middle";
   this.ctxtObj.fillText((iDiff+'').PadLeft(2,0),eLen,0);
   this.ctxtObj.restore();
  }
 }
 doDrawDayPanel = function(dayCount,realAllDay){
  // 画年份面板
  var sLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.68;
  var eLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.7;
  var labelLen = Math.min( this.caObj.width, this.caObj.height)*0.5*0.80;
  var gap = Math.PI/Math.ceil(dayCount*0.5);
  this.ctxtObj.save();
  this.ctxtObj.fillStyle = "#e587e5";
  this.ctxtObj.beginPath();
  this.ctxtObj.arc(this.centerPoint.x,this.centerPoint.y,eLen+2,0,360,false);
  this.ctxtObj.closePath();
  this.ctxtObj.fill();
  this.ctxtObj.fillStyle = "white";
  this.ctxtObj.beginPath();
  this.ctxtObj.arc(this.centerPoint.x,this.centerPoint.y,sLen-2,0,360,false);
  this.ctxtObj.closePath();
  this.ctxtObj.fill();
  this.ctxtObj.restore();
  this.ctxtObj.fillStyle = "#369";
  this.ctxtObj.strokeStyle = "#369";
  for(var i =-2;i<=dayCount-2;i++){
   this.ctxtObj.save();
   this.ctxtObj.beginPath();
   this.ctxtObj.moveTo(Math.cos(i*gap)*sLen + this.centerPoint.x ,Math.sin(i*gap)*sLen + this.centerPoint.y);
   this.ctxtObj.lineTo(Math.cos(i*gap)*eLen + this.centerPoint.x,Math.sin(i*gap)*eLen + this.centerPoint.y);
   this.ctxtObj.closePath();
   this.ctxtObj.stroke();
   iDiff = (this.doChangeToFront(i,dayCount)) % (dayCount+1);
   if(iDiff<=realAllDay && iDiff!=0){
    this.ctxtObj.translate(this.centerPoint.x, this.centerPoint.y);
     this.ctxtObj.rotate(i*gap);
    this.ctxtObj.fOnt= "20px bold 微软雅黑";
    this.ctxtObj.textAlign="start";
    this.ctxtObj.textBaseline="middle";
    this.ctxtObj.fillText((iDiff+'').PadLeft(2,0),eLen,0);
   }
   this.ctxtObj.restore();
  }
 }
 drawYMDHMS = function(slen,elen,cslen,celen,main,sub,gapM,type,value){
  // 画日期时间针
  var date = new Date();
  var siM = main;
  var siS = sub;
  var gap = Math.PI/gapM;
  var sLen = Math.min( this.caObj.width, this.caObj.height)*0.5*slen;
  var eLen = Math.min( this.caObj.width, this.caObj.height)*0.5*elen;
  var csLen = Math.min( this.caObj.width, this.caObj.height)*0.5*cslen;
  var ceLen = Math.min( this.caObj.width, this.caObj.height)*0.5*celen;
  i = this.doChangeToEnd(siM+siS,gapM*2);
  ci = (i+gapM) % (gapM*2);
  this.ctxtObj.save();
  this.ctxtObj.beginPath();
  if(type=='y'){
   this.ctxtObj.stroke;
   this.ctxtObj.lineWidth = 6;
  }else if(type=='M'){
   this.ctxtObj.stroke;
   this.ctxtObj.lineWidth = 5;
  }else if(type=='d'){
   this.ctxtObj.stroke;
   this.ctxtObj.lineWidth = 4;
  }else if(type=='h'){
   this.ctxtObj.lineWidth = 3;
  }else if(type=='m'){
   this.ctxtObj.lineWidth = 2;
  }else if(type=='s'){
   this.ctxtObj.lineWidth = 1;
  }
  this.ctxtObj.moveTo(Math.cos(i*gap)*sLen + this.centerPoint.x ,Math.sin(i*gap)*sLen + this.centerPoint.y);
  this.ctxtObj.lineTo(Math.cos(i*gap)*eLen + this.centerPoint.x,Math.sin(i*gap)*eLen + this.centerPoint.y);
  this.ctxtObj.moveTo(Math.cos(ci*gap)*csLen + this.centerPoint.x ,Math.sin(ci*gap)*csLen + this.centerPoint.y);
  this.ctxtObj.lineTo(Math.cos(ci*gap)*ceLen + this.centerPoint.x,Math.sin(ci*gap)*ceLen + this.centerPoint.y);
  this.ctxtObj.stroke();
  this.ctxtObj.closePath();
  this.ctxtObj.restore();
  var cpi = ci*gap*360/Math.PI;
  if(type=='y'){
   this.ctxtObj.save();
    this.ctxtObj.fillStyle = "#00cece";
   this.ctxtObj.stroke;
   this.ctxtObj.lineWidth = 8;
   this.ctxtObj.beginPath();
   this.ctxtObj.arc(this.centerPoint.x,this.centerPoint.y,ceLen,ci*gap-gap*0.5,ci*gap+gap*0.5,false);
   this.ctxtObj.stroke();
   this.ctxtObj.closePath();
   this.ctxtObj.translate(this.centerPoint.x, this.centerPoint.y);
    this.ctxtObj.rotate(i*gap);
   this.ctxtObj.fOnt= "20px bold 微软雅黑";
   this.ctxtObj.textAlign="start";
   this.ctxtObj.textBaseline="middle";
   this.ctxtObj.lineWidth = 2;
   this.ctxtObj.fillText(value + '年',eLen*1.03,0);
   this.ctxtObj.strokeText(value + '年',eLen*1.03,0);
   this.ctxtObj.restore();
  }else if(type=='M'){
   this.ctxtObj.save();
   this.ctxtObj.beginPath();
    this.ctxtObj.fillStyle = "#ce9b00";
   this.ctxtObj.stroke;
   this.ctxtObj.lineWidth = 7;
   this.ctxtObj.arc(this.centerPoint.x,this.centerPoint.y,ceLen,ci*gap-gap*0.5,ci*gap+gap*0.5,false);
   this.ctxtObj.stroke();
   this.ctxtObj.closePath();
   this.ctxtObj.translate(this.centerPoint.x, this.centerPoint.y);
    this.ctxtObj.rotate(i*gap);
   this.ctxtObj.fOnt= "20px bold 微软雅黑";
   this.ctxtObj.textAlign="start";
   this.ctxtObj.textBaseline="middle";
   this.ctxtObj.lineWidth = 2;
   this.ctxtObj.fillText(value + '月',eLen*1.03,0);
   this.ctxtObj.strokeText(value + '月',eLen*1.03,0);
   this.ctxtObj.restore();
  }else if(type=='d'){
   this.ctxtObj.save();
   this.ctxtObj.beginPath();
    this.ctxtObj.fillStyle = "#bd01bd";
   this.ctxtObj.stroke;
   this.ctxtObj.lineWidth = 6;
   this.ctxtObj.arc(this.centerPoint.x,this.centerPoint.y,ceLen,ci*gap-gap*0.5,ci*gap+gap*0.5,false);
   this.ctxtObj.stroke();
   this.ctxtObj.closePath();
   this.ctxtObj.translate(this.centerPoint.x, this.centerPoint.y);
    this.ctxtObj.rotate(i*gap);
   this.ctxtObj.fOnt= "20px bold 微软雅黑";
   this.ctxtObj.textAlign="start";
   this.ctxtObj.textBaseline="middle";
   this.ctxtObj.lineWidth = 2;
   this.ctxtObj.fillText(value + '日',eLen*1.03,0);
   this.ctxtObj.strokeText(value + '日',eLen*1.03,0);
   this.ctxtObj.restore();
  }
  this.ctxtObj.restore();
 }
 animate = function(){
  var now = (+new Date);
  if (now - this.lastFpsUpdateTime > 60) {
   this.lastFpsUpdateTime = now;
   this.doDraw();
  }
  window.requestNextAnimationFrame(this.animate);
 }
 getCountDays = function (year,month) {
  var curDate = new Date();
  curDate.setFullYear(year);
  curDate.setMonth(month+1);
  curDate.setDate(0);
  return curDate.getDate();
 }
 getTimeNow = function(){
  var date = new Date();
  var seperator1 = "-";
  var seperator2 = ":";
  this.timeNow = date.getFullYear() 
    + seperator1 + (date.getMonth()+1+'').PadLeft(2,0)
    + seperator1 + (date.getDate()+'').PadLeft(2,0)
   + " " + (date.getHours()+'').PadLeft(2,0)
    + seperator2 + (date.getMinutes()+'').PadLeft(2,0)
   + seperator2 + (date.getSeconds()+'').PadLeft(2,0)
    + '.' +(date.getMilliseconds()+'').PadLeft(3,0);
 }
 // objects
}
var cwt = new calendarWithTime();
//=================================================
String.prototype.PadLeft = function(totalWidth, paddingChar)
{
 if ( paddingChar != null )
 {
 return this.PadHelper(totalWidth, paddingChar, false);
 } else {
 return this.PadHelper(totalWidth, ' ', false);
 }
}
String.prototype.PadRight = function(totalWidth, paddingChar)
{
 if ( paddingChar != null )
 {
 return this.PadHelper(totalWidth, paddingChar, true);
 } else {
 return this.PadHelper(totalWidth, ' ', true);
 }
}
String.prototype.PadHelper = function(totalWidth, paddingChar, isRightPadded)
{
 if ( this.length 

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!


推荐阅读
  • Unity3D引擎的体系结构和功能详解
    本文详细介绍了Unity3D引擎的体系结构和功能。Unity3D是一个屡获殊荣的工具,用于创建交互式3D应用程序。它由游戏引擎和编辑器组成,支持C#、Boo和JavaScript脚本编程。该引擎涵盖了声音、图形、物理和网络功能等主题。Unity编辑器具有多语言脚本编辑器和预制装配系统等特点。本文还介绍了Unity的许可证情况。Unity基本功能有限的免费,适用于PC、MAC和Web开发。其他平台或完整的功能集需要购买许可证。 ... [详细]
  • 深入理解CSS中的margin属性及其应用场景
    本文主要介绍了CSS中的margin属性及其应用场景,包括垂直外边距合并、padding的使用时机、行内替换元素与费替换元素的区别、margin的基线、盒子的物理大小、显示大小、逻辑大小等知识点。通过深入理解这些概念,读者可以更好地掌握margin的用法和原理。同时,文中提供了一些相关的文档和规范供读者参考。 ... [详细]
  • 使用正则表达式爬取36Kr网站首页新闻的操作步骤和代码示例
    本文介绍了使用正则表达式来爬取36Kr网站首页所有新闻的操作步骤和代码示例。通过访问网站、查找关键词、编写代码等步骤,可以获取到网站首页的新闻数据。代码示例使用Python编写,并使用正则表达式来提取所需的数据。详细的操作步骤和代码示例可以参考本文内容。 ... [详细]
  • macOS Big Sur全新设计大版本更新,10+个值得关注的新功能
    本文介绍了Apple发布的新一代操作系统macOS Big Sur,该系统采用全新的界面设计,包括图标、应用界面、程序坞和菜单栏等方面的变化。新系统还增加了通知中心、桌面小组件、强化的Safari浏览器以及隐私保护等多项功能。文章指出,macOS Big Sur的设计与iPadOS越来越接近,结合了去年iPadOS对鼠标的完善等功能。 ... [详细]
  • ECMA262规定typeof操作符的返回值和instanceof的使用方法
    本文介绍了ECMA262规定的typeof操作符对不同类型的变量的返回值,以及instanceof操作符的使用方法。同时还提到了在不同浏览器中对正则表达式应用typeof操作符的返回值的差异。 ... [详细]
  • 使用chrome编辑器实现网页截图功能的方法
    本文介绍了在chrome浏览器中使用编辑器实现网页截图功能的方法。通过在地址栏中输入特定命令,打开控制台并调用命令面板,用户可以方便地进行网页截图操作。 ... [详细]
  • 本文介绍了互联网思维中的三个段子,涵盖了餐饮行业、淘品牌和创业企业的案例。通过这些案例,探讨了互联网思维的九大分类和十九条法则。其中包括雕爷牛腩餐厅的成功经验,三只松鼠淘品牌的包装策略以及一家创业企业的销售额增长情况。这些案例展示了互联网思维在不同领域的应用和成功之道。 ... [详细]
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • 本文详细介绍了Linux中进程控制块PCBtask_struct结构体的结构和作用,包括进程状态、进程号、待处理信号、进程地址空间、调度标志、锁深度、基本时间片、调度策略以及内存管理信息等方面的内容。阅读本文可以更加深入地了解Linux进程管理的原理和机制。 ... [详细]
  • 1,关于死锁的理解死锁,我们可以简单的理解为是两个线程同时使用同一资源,两个线程又得不到相应的资源而造成永无相互等待的情况。 2,模拟死锁背景介绍:我们创建一个朋友 ... [详细]
  • 后台获取视图对应的字符串
    1.帮助类后台获取视图对应的字符串publicclassViewHelper{将View输出为字符串(注:不会执行对应的ac ... [详细]
  • 《数据结构》学习笔记3——串匹配算法性能评估
    本文主要讨论串匹配算法的性能评估,包括模式匹配、字符种类数量、算法复杂度等内容。通过借助C++中的头文件和库,可以实现对串的匹配操作。其中蛮力算法的复杂度为O(m*n),通过随机取出长度为m的子串作为模式P,在文本T中进行匹配,统计平均复杂度。对于成功和失败的匹配分别进行测试,分析其平均复杂度。详情请参考相关学习资源。 ... [详细]
  • 本文介绍了通过ABAP开发往外网发邮件的需求,并提供了配置和代码整理的资料。其中包括了配置SAP邮件服务器的步骤和ABAP写发送邮件代码的过程。通过RZ10配置参数和icm/server_port_1的设定,可以实现向Sap User和外部邮件发送邮件的功能。希望对需要的开发人员有帮助。摘要长度:184字。 ... [详细]
  • 动态规划算法的基本步骤及最长递增子序列问题详解
    本文详细介绍了动态规划算法的基本步骤,包括划分阶段、选择状态、决策和状态转移方程,并以最长递增子序列问题为例进行了详细解析。动态规划算法的有效性依赖于问题本身所具有的最优子结构性质和子问题重叠性质。通过将子问题的解保存在一个表中,在以后尽可能多地利用这些子问题的解,从而提高算法的效率。 ... [详细]
  • Google在I/O开发者大会详细介绍Android N系统的更新和安全性提升
    Google在2016年的I/O开发者大会上详细介绍了Android N系统的更新和安全性提升。Android N系统在安全方面支持无缝升级更新和修补漏洞,引入了基于文件的数据加密系统和移动版本的Chrome浏览器可以识别恶意网站等新的安全机制。在性能方面,Android N内置了先进的图形处理系统Vulkan,加入了JIT编译器以提高安装效率和减少应用程序的占用空间。此外,Android N还具有自动关闭长时间未使用的后台应用程序来释放系统资源的机制。 ... [详细]
author-avatar
CL_LC的小屋花_344
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有