PHP-常用代码片段

STM32 Modbus-RTU从零到实战:手把手教你用HAL库实现工业通信(附完整代码) 本文详细介绍了如何使用STM32 HAL库从零开始实现Modbus-RTU从机通信。内容涵盖RS485硬件设计、CubeMX串口与定时器配置、基于空闲中断的高效数据接收、协议栈状态机设计、CRC16校验实现以及常用功能码处理。文章提供了完整的代码框架和调试方法,帮助开发者快速构建稳定的工业通信节点。 阅读详情
这是一些使用频率比较高的函数...... 

1.产生随机字符串函数

function random($length) {
 
$hash = @#@#;
 $chars = @#ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz@#;
 $max = strlen($chars) - 1;
 
mt_srand((double)microtime() * 1000000);
 
for($i = 0; $i < $length; $i++) {
  
$hash .= $chars[mt_rand(0, $max)];
 }
 
return $hash;
}


2.截取一定长度的字符串

注:该函数对GB2312使用有效

function wordscut($string, $length ,$sss=0) {
 
if(strlen($string) > $length) {
               
if($sss){
                      
$length=$length - 3;
                      
$addstr=@# ...@#;
                }
  
for($i = 0; $i < $length; $i++) {
   
if(ord($string[$i]) > 127) {
    
$wordscut .= $string[$i].$string[$i + 1];
    
$i++;
   } 
else {
    
$wordscut .= $string[$i];
   }
  }
  
return $wordscut.$addstr;

 }
 
return $string;
}


3.取得客户端IP地址

function GetIP(){
             
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
                   
$ip = getenv("HTTP_CLIENT_IP");
             
else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
                   
$ip = getenv("HTTP_X_FORWARDED_FOR");
             
else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
                   
$ip = getenv("REMOTE_ADDR");
             
else if (isset($_SERVER[@#REMOTE_ADDR@#]) && $_SERVER[@#REMOTE_ADDR@#] && strcasecmp($_SERVER

[@
#REMOTE_ADDR@#], "unknown"))
                   $ip = $_SERVER[@#REMOTE_ADDR@#];
             else
                  
$ip = "unknown";
             
return($ip);
}

4.创建相应的文件夹

function createdir($dir=@#@#)
{
        
if (!is_dir($dir))
        {
            
$temp = explode(@#/@#,$dir);
            $cur_dir = @#@#;
            for($i=0;$i<count($temp);$i++)
            {
                
$cur_dir .= $temp[$i].@#/@#;
                if (!is_dir($cur_dir))
                {
                @
mkdir($cur_dir,0777);
                }
            }
        }
}

5.判断邮箱地址

function checkEmail($inAddress)
{
 
return (ereg("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+",$inAddress));

}

6.跳转

function gotourl($message=@#@#,$url=@#@#,$title=@#@#)
{
 
    
$html  ="<html><head>";
    
if(!empty($url))
     
$html .="<meta http-equiv=@#refresh@# content="3;url=@#".$url."@#">";
    
$html .="<link href=@#../templates/style.css@# type=text/css rel=stylesheet>";
    
$html .="</head><body><br><br><br><br>";
    
$html .="<table cellspacing=@#0@# cellpadding=@#0@# border=@#1@# width=@#450@# align=@#center@#>";
 
$html .="<tr><td bgcolor=@##ffffff@#>";
 
$html .="<table border=@#1@# cellspacing=@#1@# cellpadding=@#4@# width=@#100%@#>";
 
$html .="<tr class=@#m_title@#>";
 
$html .="<td>".$title."</td></tr>";
 
$html .="<tr class=@#line_1@#><td align=@#center@# height=@#60@#>";
 
$html .="<br>".$message."<br><br>";
    
if (!empty($url))
     
$html .="系统将在3秒后返回<br>如果您的浏览器不能自动返回,请点击[<a href=".$url." target=_self>这里</a>]进入";
    
else
     
$html .="[<a href=@##@# onclick=@#history.go(-1)@#>返回</a>]";
    
$html .="</td></tr></table></td></tr></table>";
 
$html .="</body></html>";
 
echo $html;
 
exit;
}

7.分页(两个函数配合使用)

function getpage($sql,$page_size=20)
 {
      
global $page,$totalpage,$sums;  //out param
      $page = $_GET["page"];
      
//$eachpage = $page_size;
      $pagesql = strstr($sql," from ");
      
$pagesql = "select count(*) as ids ".$pagesql;
      
$result = mysql_query($pagesql);
      
if($rs = mysql_fetch_array($result)) $sums = $rs[0];
      
$totalpage = ceil($sums/$page_size);
      
if((!$page)||($page<1)) $page=1;
    
$startpos = ($page-1)*$page_size;
    
$sql .=" limit $startpos,$page_size ";
    
return $sql;
 }

function showbar($string="")
{     
    
global $page,$totalpage;
 
$out="共<font color=@#red@#><b>".$totalpage."</b></font>页  ";
    
$linkNum =4;
    
$start = ($page-round($linkNum/2))>0 ? ($page-round($linkNum/2)) : "1";
    
$end   = ($page+round($linkNum/2))<$totalpage ? ($page+round($linkNum/2)) : $totalpage;
    
$prestart=$start-1;
    
$nextend=$end+1;
    
if($page<>1) 
 
$out .= "<a href=@#?page=1&&".$string."@#title=第一页>第一页</a> ";
    
if($start>1)
 
$out.="<a href=@#?page=".$prestart."@# title=上一页>..<<</a> ";
 
for($t=$start;$t<=$end;$t++)
    {
     
$out .= ($page==$t) ? "<font color=@#red@#><b>[".$t."]</b></font> " : "<a href=@#?page=$t&&".$string."@#>$t</a> ";
    }
 
if($end<$totalpage)
 
$out.="<a href=@#?page=".$nextend."&&".$string."@# title=下一页>>>..</a>";
    
if($page<>$totalpage)
   
$out .= " <a href=@#?page=".$totalpage."&&".$string."@# title=最后页>最后页</a>";
   
return $out;
}


8.获取新插入数据的ID
mysql_insert_id();
?>




9.怎么获得某个月的最后一天
<?
    
$lastday = mktime (0,0,0,9,0,2006);
    
echo strftime ("2006年8月最后一天是: %d", $lastday);
    
echo "<BR>";
    
$lastday = mktime (0,0,0,10,0,2006);
    
echo strftime ("2006年9月最后一天是: %d", $lastday);
    
echo "<BR>";  
?>



10.算当前礼拜的日期函数(从xx日到xx日为当前礼拜)
<?php
    
function weekdate($today)
    {    
        
$today_form = date("Y-m-d", strtotime("today"));
        
switch ($today)
        {
            
case "Sunday":
            
$monday = date("Y-m-d", strtotime("today")-518400);
            
$sunday = $today_form ;
            
break;
            
case "Monday":
            
$monday = $today_form ;
            
$sunday = date("Y-m-d", strtotime("today")+518400);
            
break;
            
case "Tuesday":
            
$monday = date("Y-m-d", strtotime("today")-86400);
            
$sunday = date("Y-m-d", strtotime("today")+432000);
            
break;
            
case "Wednesday":
            
$monday = date("Y-m-d", strtotime("today")-172800);
            
$sunday = date("Y-m-d", strtotime("today")+345600);
            
break;
            
case "Thursday":
            
$monday = date("Y-m-d", strtotime("today")-259200);
            
$sunday = date("Y-m-d", strtotime("today")+259200);
            
break;
            
case "Friday":
            
$monday = date("Y-m-d", strtotime("today")-345600);
            
$sunday = date("Y-m-d", strtotime("today")+172800);
            
break;
            
case "Saturday":
            
$monday = date("Y-m-d", strtotime("today")-432000);
            
$sunday = date("Y-m-d", strtotime("today")+86400);
            
break;
        }
        
return compact('monday','sunday');
    }
    
    
$a = date ("l", time());
    
extract(weekdate($a));
    
echo $monday."----------".$sunday;
?>

/*第二种方法*/
<?php
    
$monday = date("Y-m-d",mktime(0,0,0,date('m'),date('d')-date('w')+1,date('Y')));
    
$sunday = date("Y-m-d",mktime(0,0,0,date('m'),date('d')+7-date('w'),date('Y')));
    
echo $monday."----------".$sunday;
?> 
 
别再到处找DEM了!手把手教你免费下载90米、30米、12.5米全球高程数据(附国内网盘链接) 本文详细介绍了如何免费获取全球90米(SRTM3)、30米(ASTER GDEM)和12.5米(ALOS)高精度DEM数据,并提供了国内网盘链接以绕过国际平台访问障碍。通过对比不同数据源的特点和适用场景,帮助用户根据项目需求选择最合适的DEM数据,同时分享了数据处理和质量提升的实用技巧,实现从数据获取到应用的无缝衔接。 阅读详情

相关推荐

半导体AMHS天车振动控制:从0.5G到超低振动的技术演进与工程实战

在先进晶圆厂中,自动化物料搬运系统(AMHS)的天车如同空中出租车,承担着晶圆盒(FOUP)在洁净室各工艺区间的转运任务。然而,当天车加减速、过弯或抓取时产生的机械振动通过轨道梁和建筑结构传递至光刻机等敏感设备,便可能直接威胁套刻精度与良率。传统被动减振方案依靠橡胶垫和弹簧,在0.5G指标时代曾行之有效,但在EUV光刻和先进制程面前已力不从心。主动振动控制技术通过传感器、控制器与作动器构成的闭环系统,在轨道吊点和机械手端实时输出反向力抵消振动,配合磁悬浮走行、轻量化结构及调度系统的路径优化,将振动从0.5G

weixin_29188043的博客 345

Android之动画主菜单

目前,用户对安卓应用程序的UI设计要求越来越高,因此,掌握一些新颖的设计很有必要,比如菜单,传统的菜单已经不能满足用户的需求。其中圆盘旋转菜单的实现就比较好,该菜单共分里外三层导航菜单.可以依次从外向里关闭三层菜单,也可以反向打开,并且伴有圆盘旋转的动画效果,首先,看下效果: 源码下载:http://download.youkuaiyun.com/detail/weidi1989/4588807 以下...

way 145

INCA软件操作指南:手把手教你生成和解析DCM标定数据文件

本文详细介绍了INCA软件在汽车ECU开发中生成和解析DCM标定数据文件的全流程。从A2L文件导入到DCM文件生成,再到HEX文件导出,手把手教你掌握标定数据处理的实用技巧,包括参数标定、曲线标定和常见问题排查,帮助工程师提升工作效率。

weixin_29271053的博客 1057

安卓游戏开发——团队作业第一周

团队展示 队员学号 20172305谭鑫(组长) 20172307黄宇塘 20172311赵晓海 20172314方艺雯 20172323王禹涵 队名 糖皮123【糖(黄宇塘)皮(赵晓海)1(一文)2(二许)3(三金哥)】 拟作的团队项目描述 基于安卓开发的一款跑酷类小游戏 跑酷是时下风靡全球的时尚极限运动,以日常生活的环境为运动场所。通过我们的技术运用将跑酷场景融入到手机上,成为一款指尖上的“...

weixin_30609331的博客 275

永磁同步电机FOC控制实战:如何用线性死区补偿解决低速抖动问题(附Matlab仿真代码)

本文详细介绍了永磁同步电机FOC控制中线性死区补偿技术的工程实现方法,有效解决低速抖动问题。通过Matlab/Simulink仿真验证,该方案可将转矩脉动降低70%以上,显著提升系统稳定性。文章包含完整的数学模型构建、Simulink实现步骤及参数整定技巧,为工程师提供实用解决方案。

weixin_30872499的博客 154

微生物16S数据上传NCBI的SRA库

本篇内容仅包括:俺自己的实验收集了淡水、淡水沉积物、海水、海草附着微生物样品,测序所得的Fastq格式数据,在文章投稿发表时被要求数据需上传NCBI的SRA库,得到一个PRJNA2347899这样子的IDs。仅解决了这个上传过程!

Xf_Niu的博客 7435

Cocos2d-x 3.0final-《微信飞机大战》实现 -----沈大海

本文介绍一款纵版射击游戏的实现,开发环境: win7 vs2012 cocos2d-x3.0final android adt android ndk r9 首先看下最后的效果: (图1,微信飞机大战运行效果) 源码下载地址:http://download.youkuaiyun.com/detail/sdhjob/7513863 一、游戏资源准备

bright_mmmmmmmmmmmm的专栏 781

Transformers 实战修炼与源码剖析专栏大纲

本专栏以 Hugging Face Transformers 为主线,围绕“能用、会调、敢上线、懂源码”四个目标展开。内容不把理论堆成公式墙,而是用真实或拟真的业务场景驱动:客服分类、合同抽取、知识库问答、模型微调、推理服务、监控告警、源码扩展等。采用“业务痛点 → 三人剧本对话 → 代码实战 → 总结思考”的四段式结构,让读者在动手完成一个个小项目的过程中,逐步理解 Tokenizer、Model、Pipeline、Trainer、Generation、PEFT、Accelerate、Serving等概念

davidwang456的专栏 923

产品经理从专能到全能——界面布局规范

界面布局及字体规范界面布局规范1.iOS篇iPhone的app界面一般由四个元素组成,分别是:状态栏(status bar)、导航栏(navigation)、主菜单栏(submenu)、内容区域(content)。状态栏(status bar):就是我们经常说的信号、运营商、电量等显示手机状态的区域;导航栏(navigation):显示当前界面的名称,包含相应的功能或者页面间的跳转按钮;主菜单栏(s

ZLJ925的博客 1022

大语言模型与ROS集成的自然语言机器人控制:开源框架与应用实例

近年来,大语言模型(LLM)与机器人操作系统(ROS)的集成逐步成熟,使得自然语言驱动的机器人控制成为可能。用户输入“捡起绿色方块”或“把微波炉里的饭热好端过来”这类日常语句,机器人能够自动拆解步骤、规划动作并执行。本文梳理2026年前后发布的三个代表性开源框架——ROS-LLM、ROSClaw以及LLM+Nav2基准测试系统,介绍其技术路径与工程落地情况。

Studying…… 634

ArcGIS实验教程——实验二十五:大型商场选址经典案例

本实验基于ArcGIS平台进行商场选址分析,综合考虑道路、居民点、停车场和已有商场四个影响因素。通过缓冲区分析建立各要素的影响范围(道路50米、居民点100米、停车场100米、已有商场500米),采用叠加分析中的相交和擦除运算确定最优选址区域。实验建立了区位评价体系,通过属性赋值(1/-1)和联合运算生成综合评价结果,并实现分级可视化显示。注意事项包括距离参数设置对结果的影响以及正确选择空间分析工具。该流程为商业选址提供了科学的GIS解决方案。

智慧空间实验室 1万+

Android游戏开发之绘制游戏主菜单与进度条加载进度(十三)

雨松MOMO带你走进游戏开发的世界之主菜单与进度条雨松MOMO原创文章如转载,请注明:转载至我的独立域名博客雨松MOMO程序研究院,原文地址:http://www.xuanyusong.com/archives/271本例中出现的资源图片全部源于互联网,本文仅供个人学习。 由于Android开发 横竖屏的切换会给游戏开发造成非常麻烦的事情 所以在游戏的制作当中会强制手机屏幕横屏或者竖...

weixin_30713953的博客 61

ARMv8/ARMv9的TLB深度学习

千万不要人云亦云。一个TLB entry里有很多很多东西的,有100多个比特位呢,并不是仅仅只有VA/PA/nG/VMID/ASID等。.👉👉👉 个人博客笔记导读目录(全部) 👈👈👈。

baron-周贺贺-代码改变世界ctw 1570

推荐:优雅的圆形菜单库 —— Circle Menu for Android

推荐:优雅的圆形菜单库 —— Circle Menu for Android circle-menu-android :octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animat...

gitblog_00012的博客 595

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Android系统:Launcher知识点总结

一:如何定制Launcher主菜单中应用程序图标的显示顺序? 请修改res/xml/default_toppackage.xml文件: <toppackages xmlns:launcher=" http://schemas.android.com/apk/res/com.android.launcher2bird13gb"> <app launcher:topPackageName="c

LYJ的IT生活 2354

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

Android4 游戏开发入门指南(一)

欢迎来到实用 Android 4 游戏开发。这本书带你一步一步了解两种不同手机游戏的演变;从概念到代码。你将学习如何从一个根本的想法构思一个游戏,并完成编码引擎的复杂任务,将你的想法变成一个可玩的游戏。我决定写这本书来教授为 Android 4 平台创建你自己的 2D 和 3D 游戏所需的技能。Android 4 将基于 Android 的手机和平板电脑的操作系统统一在一个通用的 SDK 下。这意味着你开发的游戏可以在最新的平板电脑和手机上玩,也可以在最好的硬件上玩。

龙哥盟 1777

Android 自定义主菜单

本文介绍一个超简单的自定义主菜单,效果如下: 原理:其实就是对原生的Dialog的一个简单的封装。并加上显示和隐藏的动画效果。再给控件加上回调事件。 TestDialog.java public class TestDialog implements OnClickListener { private Context mContext; private Dialog mD

顾明伟 4083
上一篇: C++-必知必会_模板局部特化(条款47)
下一篇: C++-必知必会_类模板成员特化(条款48)
MasterFT
博客等级 码龄20年 48粉丝 59原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值