资源描述
信号报告switchcase语句的应用.docx
《信号报告switchcase语句的应用.docx》由会员分享,可在线阅读,更多相关《信号报告switchcase语句的应用.docx(42页珍藏版)》请在冰豆网上搜索。
信号报告switchcase语句的应用
ASP代码样例-S05GK接口发送短信,atoi的实现,考虑异常输入和溢出判断。
bootstrap绿色大气后台模板下载,BP网络进行手写数字识别,BruteForce算法的简单实现
byte数组转化成16进制字符串,C语言HTTP协议的简单实现,C语言linuxsocket网络编程常用函数
[文件]form.php ~ 912B (154)
php
$form_description=$_POST['form_description'];
$form_data_name=$_FILES['form_data']['name'];
$form_data_size=$_FILES['form_data']['size'];
$form_data_type=$_FILES['form_data']['type'];
$form_data=$_FILES['form_data']['tmp_name'];
//echo"winson";
//ßB½Óµ½ÙYÁÏŽì
//C语言打造与PHP方便的字符串处理函数
$connect=MYSQL_CONNECT("localhost","root","admin")ordie("UnabletoconnecttoMySQLserver");
mysql_select_db("blogsystem")ordie("Unabletoselectdatabase");
$data=addslashes(fread(fopen($form_data,"r"),filesize($form_data)));
//echo"mysqlPicture=".$data;
//C语言获取当前执行文件所在的目录
//C语言获取当前执行文件所在的目录
$result=MYSQL_QUERY("INSERTINTOccs_image(description,bin_data,filename,filesize,filetype)VALUES('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");
$id=mysql_insert_id();
print"
ThisfilehasthefollowingDatabaseID:
id=$id'>$id";
//C语言实现双向链表(支持双向迭代)
//C语言实现线程池,支持动态拓展和销毁
MYSQL_CLOSE();
?
>
[文件]get_data.php ~ 874B (137)
php
if(isset($_GET['id'])){
$id=$_GET['id'];
$connect=MYSQL_CONNECT("localhost","root","admin")ordie("UnabletoconnecttoMySQLserver");
mysql_select_db("blogsystem")ordie("Unabletoselectdatabase");
$query="selectbin_data,filetypefromccs_imagewhereid=$id";
$result=@MYSQL_QUERY($query);
$out=mysql_fetch_array($result);
$data=$out["bin_data"];
$type=$out["filetype"];
Header("Content-type:
$type");
echo$data;
}
if(isset($_GET["pic_id"]))
{
$pic_id=$_GET['pic_id'];
$connect=MYSQL_CONNECT("localhost","root","admin")ordie("UnabletoconnecttoMySQLserver");
mysql_select_db("blogsystem")ordie("Unabletoselectdatabase");
$query="select*fromccs_imagewhereid=$pic_id";
$result=@MYSQL_QUERY($query);
$out=mysql_fetch_array($result);
echo$out["id"];
}
?
>
[文件]new_file.php ~ 1KB (138)
php
$connect=MYSQL_CONNECT("localhost","root","admin")ordie("UnabletoconnecttoMySQLserver");
mysql_select_db("blogsystem")ordie("Unabletoselectdatabase");
$sql="select*fromccs_image";
$result=mysql_query($sql)ordie(mysql_error());
while($out=@mysql_fetch_array($result))
{
echo"height:
100px;width:
100px;'src='get_data.php?
id=".$out['id']."'onmouseover='see_big(".$out['id'].")'/>
";
}
?
>
$(document).ready(function(){
});
functionsee_big(id)
{
varpic_id=id;
$.ajax({
type:
"GET",
data:
"pic_id="+pic_id,
:
"get_data.php",
dataType:
'text',
success:
function(data)
{
$("#big_picimg").attr("src","get_data.php?
id="+data);
}
})
}
500px;width:
600px;position:
absolute;margin-left:
200px;margin-top:
-550px;">
FileDescription:
Filetoupload/storeindatabase:
[代码][Java]代码
packagecom.ejintai.test;
importjava.io.FileInputStream;
importjava.io.FileOutputStream;
importjava.io.IOException;
importjava.nio.channels.FileChannel;
publicclassFileCopy
{
publicstaticvoidmain(String[]args)throwsIOException{
Stringsourcefile="E:
\\参考资料\\设计模式.pdf";
Stringtargetfile="E:
\\参考资料\\设计模式1.pdf";
copyfile(sourcefile,targetfile);
}
/**
*
*方法用途:
文件拷贝
*方法名:
copyfile
*返回值:
void
*
*参数:
@paramsourcefile源文件
*参数:
@paramtargetfile目标文件
*参数:
@throwsIOException
*/
privatestaticvoidcopyfile(Stringsourcefile,Stringtargetfile)throwsIOException{
FileChannelsourcefc=newFileInputStream(sourcefile).getChannel();
FileChanneltargetfc=newFileOutputStream(targetfile).getChannel();
sourcefc.transferTo(0,sourcefc.size(),targetfc);
//上面没有进行文件是否存在的判断和异常的处理
}
}
[代码]pythonsqlite3的常规使用
#Filename:
DBcon.py
importsqlite3
importtime
conn=sqlite3.connect(r'D:
\Exercise\Python\DB\example.db')
c=conn.cursor()
c.execute("Createtableifnotexistsstocks(datetext,transtext,symboltext,qtyreal,pricereal)")
flag=raw_input("Doyouwannacleanthetable?
(y/n):
")
ifflag=='y':
c.execute("deletefromstocks")
c.execute("Insertintostocksvalues('"+time.strftime('%Y-%m-%d%H:
%m:
%S')+"','Buy','Rhatd',1000,23.14)")
connmit()
c.execute('select*fromstocks')
res=c.fetchall()
count=0
printres
print'-'*60
forlineinres:
forfinline:
count=count+1
printcount,f,
print
print'-'*60
print'-'*60
print'Thereare%drecords!
'%count
c.close()
conn.close()
[代码][Shell/批处理]代码
MACADDR="52:
54:
$(ddif=/dev/urandomcount=12>/dev/null|md5sum|sed's/^\(..\)\(..\)\(..\)\(..\).*$/\1:
\2:
\3:
\4/')";echo$MACADDR
[文件]PathUtil.java ~ 3KB (10)
packagesmoke;
importjava.util.LinkedList;
importjava.util.List;
importjava.util.Stack;
publicclassPathUtil{
publicstaticListfind(int[][]matrix){
intWIDTH=matrix.length;
intHEIGHT=matrix[0].length;
int[][]used=newint[WIDTH][HEIGHT];
TreeNoderoot=newTreeNode();
root.setFather(null);
root.setX(0);
root.setY(0);
TreeNodetail=buildTree(root,matrix,used);
if(tail!
=null)
{
Stackstack=newStack();
TreeNodecurrent=tail;
for(;;)
{
if(current==null){
break;
}
Pospos=newPos();
pos.x=current.getX();
pos.y=current.getY();
stack.push(pos);
current=current.getFather();
}
Listlist=newLinkedList();
while(stack.size()>0)
{
list.add(stack.pop());
}
returnlist;
}
returnnull;
}
privatestaticTreeNodebuildTree(TreeNodecurrent,int[][]matrix,int[][]used)
{
intWIDTH=matrix.length;
intHEIGHT=matrix[0].length;
intx=current.getX();
inty=current.getY();
if(x+1{
if(matrix[x+1][y+1]==0&&matrix[x+1][y]==0&&matrix[x][y+1]==0&&used[x+1][y+1]==0)
{
TreeNodenode=newTreeNode();
node.setFather(current);
node.setX(x+1);
node.setY(y+1);
current.getChildren().add(node);
used[x+1][y+1]=1;
if(x+1==WIDTH-1&&y+1==HEIGHT-1)
{
returnnode;
}
}
}
if(x+1{
if(matrix[x+1][y]==0&&used[x+1][y]==0)
{
TreeNodenode=newTreeNode();
node.setFather(current);
node.setX(x+1);
node.setY(y);
current.getChildren().add(node);
used[x+1][y]=1;
if(x+1==WIDTH-1&&y==HEIGHT-1)
{
returnnode;
}
}
}
if(y+1{
if(matrix[x][y+1]==0&&used[x][y+1]==0)
{
TreeNodenode=newTreeNode();
node.setFather(current);
node.setX(x);
node.setY(y+1);
current.getChildren().add(node);
used[x][y+1]=1;
if(x==WIDTH-1&&y+1==HEIGHT-1)
{
returnnode;
}
}
}
if(y-1>=0)
{
if(matrix[x][y-1]==0&&used[x][y-1]==0)
{
TreeNodenode=newTreeNode();
node.setFather(current);
node.setX(x);
node.setY(y-1);
current.getChildren().add(node);
used[x][y-1]=1;
}
}
if(x-1>=0)
{
if(matrix[x-1][y]==0&&used[x-1][y]==0)
{
TreeNodenode=newTreeNode();
node.setFather(current);
node.setX(x-1);
node.setY(y);
current.getChildren().add(node);
used[x-1][y]=1;
}
}
if(x-1>=0&&y-1>=0)
{
if(matrix[x-11][y-11]==0&&matrix[x-1][y]==0&&matrix[x][y-1]==0&&used[x-1][y-1]==0)
{
TreeNodenode=newTreeNode();
node.setFather(current);
node.setX(x-1);
node.setY(y-1);
current.getChildren().add(node);
used[x-1][y-1]=1;
}
}
Listlist=current.getChildren();
if(list.size()<=0)
{
returnnull;
}
for(TreeNodenode:
list)
{
TreeNodetail=buildTree(node,matrix,used);
if(tail!
=null)
{
returntail;
}
}
returnnull;
}
}
[文件]Pos.java ~ 73B (8)
packagesmoke;
publicclassPos{
publicintx;
publicinty;
}
[文件]TreeNode.java ~ 626B (8)
packagesmoke;
importjava.util.ArrayList;
importjava.util.List;
publicclassTreeNode{
privateTreeNodefather;
privateListchildren;
privateintx;
privateinty;
publicTreeNode()
{
children=newArrayList();
}
publicvoidsetFather(TreeNodefather){
this.father=father;
}
publicTreeNodegetFather(){
returnfather;
}
publicListgetChildren(){
returnchildren;
}
publicvoidsetX(intx){
this.x=x;
}
publicintgetX(){
returnx;
}
publicvoidsetY(inty){
this.y=y;
}
publicintgetY(){
returny;
}
}
[代码][PHP]代码
classUser{
staticfunctiongetInstance()
{
if(self:
:
$instance==NULL){//Ifinstanceisnotcreatedyet,willcreateit.
self:
:
$instance=newUser();
}
returnself:
:
$instance;
}
privatefunction__construct()
//Constructormethodasprivatesobymistakedevelopernotcrate
//secondobjectoftheUserclasswiththeuseofnewoperator
{
}
privatefunction__clone()
//Clonemethodasprivatesobymistakedevelopernotcrate
//secondobjectoftheUserclasswiththeuseofclone.
{
}
functionLog($str)
{
echo$str;
}
staticprivate$instance=NULL;
}
User:
:
getInstance()->Log("WelcomeUser");
[代码][JavaScript]代码
(function(){
vari=null;
functionk(){
returnFunction.prototype.call.apply(Array.prototype.slice,arguments)
}
functionl(a,b){
varc=k(arguments,2);
returnfunction(){
returnb.apply(a,c)
}
}
functionm(a,b){
varc=newn(b);
for(c.f=[a];c.f.length;){
vare=c,
d=c.f.shift();
e.g(d);
for(d=d.firstChild;d;d=d.nextSibling)d.nodeType==1&&e.f.push(d)
}
}
functionn(a){
this.g=a
}
functiono(a){
a.style.display=""
}
functio