版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、UIPageViewController一个页面包含多个Controller.UIPickerView的简单应用 ,UIPickerView实现省市区选择器 ,UITableViewCell 分割线的属性 cell两端置顶 缩进 颜.UITableView的全部属性、方法以及代理方法执行顺序,P./* Disable channel after done conversion */ADCCFG &= (0x80 0xFF);/* Read the result */reading = ADCH;reading |= (int16) (ADCH = 8;return (reading);从相册或
2、拍照获得头像关于自动布局Masonry学习小结文件 sun.c 547B#include ioCC2530.h#include sun.h#include config.huint16 myApp_ReadLightLevel( void )uint16 reading = 0;/* Enable channel */ADCCFG |= 0x02;/ 归档反归档类目/纪录生活点点滴滴/* writing to this register starts the extra conversion */ADCCON3 = 0x81;/* Wait for the conversion to be d
3、one */while (!(ADCCON1 & 0x80);/* Disable channel after done conversion */ADCCFG &= (0x02 0xFF);/* Read the result */reading = ADCH;reading |= (int16) (ADCH = 8;return (reading);检索网页中的邮箱 .简单的动画文件 config.h 178B#ifndef _CONFIG_H_#define _CONFIG_H_typedef signed short int16;typedef unsigned short uint1
4、6;typedef unsigned char uchar;typedef unsigned int uint;代码 Google Go代码package mainimport (io/ioutilnet/httpnet/fmtencoding/json)/-/ 黄金数据调用示例代码 聚合数据/ 在线接口文档:www/docs/29/-const APPKEY = * /您申请的APPKEYfunc main()/1.上海黄金交易所Request1()/2.上海期货交易所Request2()/3.银行账户黄金Request3()/1.上海黄金交易所func Request1()/请求地址juh
5、e :=web:8080/finance/gold/shgold/初始化参数param:=.Values/配置请求参数,方法内部已处理encode问题,中文参数可以直接传参param.Set(key,APPKEY) /APP Keyparam.Set(v,) /JSON格式版本(0或1)默认为0/发送请求data,err:=Get(juhe,param)if err!=nilfmt.Errorf(请求失败,错误信息:rn%v,err)elsevar netReturn mapstringinterfacejson.Unmarshal(data,&netReturn)if netReturner
6、ror_code.(float64)=0fmt.Printf(接口返回result字段是:rn%v,netReturnresult)/2.上海期货交易所func Request2()/请求地址juhe :=web:8080/finance/gold/shfuture/初始化参数param:=.Values/配置请求参数,方法内部已处理encode问题,中文参数可以直接传参param.Set(key,APPKEY) /APP Keyparam.Set(v,) /JSON格式版本(0或1)默认为0/发送请求data,err:=Get(juhe,param)if err!=nilfmt.Errorf
7、(请求失败,错误信息:rn%v,err)elsevar netReturn mapstringinterfacejson.Unmarshal(data,&netReturn)if netReturnerror_code.(float64)=0fmt.Printf(接口返回result字段是:rn%v,netReturnresult)/3.银行账户黄金func Request3()/请求地址juhe :=web:8080/finance/gold/bankgold/初始化参数param:=.Values/配置请求参数,方法内部已处理encode问题,中文参数可以直接传参param.Set(key
8、,APPKEY) /APP Key/发送请求data,err:=Get(juhe,param)if err!=nilfmt.Errorf(请求失败,错误信息:rn%v,err)elsevar netReturn mapstringinterfacejson.Unmarshal(data,&netReturn)if netReturnerror_code.(float64)=0fmt.Printf(接口返回result字段是:rn%v,netReturnresult)/ get 网络请求func Get(api string,params .Values)(rsbyte ,err error)v
9、ar *.,err=.Parse(api)if err!=nilfmt.Printf(解析错误:rn%v,err)return nil,err/如果参数中有中文参数,这个方法会进行Encode.RawQuery=params.Encode()resp,err:=http.Get(.String()if err!=nilfmt.Println(err:,err)return nil,errdefer resp.Body.Close()return ioutil.ReadAll(resp.Body)/ post 网络请求 ,params 是.Values类型func Post(api string
10、, params .Values)(rsbyte,err error)resp,err:=http.PostForm(api, params)if err!=nilreturn nil ,errdefer resp.Body.Close()return ioutil.ReadAll(resp.Body)代码描述:基于GO的黄金数据接口调用代码实例关联数据:黄金数据代码 C#代码using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using Syste
11、m.IO;using Xfrog.Net;using System.Diagnostics;using System.Web;/-/ 黄金数据调用示例代码 聚合数据/ 在线接口文档:www/docs/29/ 代码中JsonObject类下载地址:/download/gcm3206021155665/7458439/-namespace ConsoleAPIclass Programstatic void Main(string args)string appkey = *; /配置您申请的appkey/1.上海黄金交易所string 1 = web:8080/finance/gold/shgo
12、ld;var parameters1 = new Dictionary();parameters1.Add(key, appkey);/你申请的keyparameters1.Add(v , ); /JSON格式版本(0或1)默认为0string result1 = sendPost(1, parameters1, get);JsonObject newObj1 = new JsonObject(result1);String errorCode1 = newObj1error_code.Value;if (errorCode1 = 0)Debug.WriteLine(成功);Debug.Wri
13、teLine(newObj1);else/Debug.WriteLine(失败);Debug.WriteLine(newObj1error_code.Value+:+newObj1reason.Value);/2.上海期货交易所string 2 = web:8080/finance/gold/shfuture;var parameters2 = new Dictionary();parameters2.Add(key, appkey);/你申请的keyparameters2.Add(v , ); /JSON格式版本(0或1)默认为0string result2 = sendPost(2, pa
14、rameters2, get);JsonObject newObj2 = new JsonObject(result2);String errorCode2 = newObj2error_code.Value;if (errorCode2 = 0)Debug.WriteLine(成功);Debug.WriteLine(newObj2);else/Debug.WriteLine(失败);Debug.WriteLine(newObj2error_code.Value+:+newObj2reason.Value);/3.银行账户黄金string 3 = web:8080/finance/gold/b
15、ankgold;var parameters3 = new Dictionary();parameters3.Add(key, appkey);/你申请的keystring result3 = sendPost(3, parameters3, get);JsonObject newObj3 = new JsonObject(result3);String errorCode3 = newObj3error_code.Value;if (errorCode3 = 0)Debug.WriteLine(成功);Debug.WriteLine(newObj3);else/Debug.WriteLine
16、(失败);Debug.WriteLine(newObj3error_code.Value+:+newObj3reason.Value);/ / Http (GET/POST)/ / 请求/ 请求参数/ 请求方法/ 响应内容static string sendPost(string , IDictionary parameters, string method)if (method.ToLower() = post)HttpWebRequest req = null;HttpWebResponse rsp = null;System.IO.Stream reqStream = null;tryr
17、eq = (HttpWebRequest)WebRequest.Create();req.Method = method;req.KeepAlive = false;req.ProtocolVersion = HttpVersion.Version10;req.Timeout = 5000;req.ContentType = application/x-www-form-encoded;charset=utf-8;byte postData = Encoding.UTF8.GetBytes(BuildQuery(parameters, utf8);reqStream = req.GetRequ
18、estStream();reqStream.Write(postData, 0, postData.Length);rsp = (HttpWebResponse)req.GetResponse();Encoding encoding = Encoding.GetEncoding(rsp.CharacterSet);return GetResponseAsString(rsp, encoding);catch (Exception ex)return ex.Message;finallyif (reqStream != null) reqStream.Close();if (rsp != nul
19、l) rsp.Close();else/创建请求HttpWebRequest request = (HttpWebRequest)WebRequest.Create( + ? + BuildQuery(parameters, utf8);/GET请求request.Method = GET;request.ReadWriteTimeout = 5000;request.ContentType = text/html;charset=UTF-8;HttpWebResponse response = (HttpWebResponse)request.GetResponse();Stream myR
20、esponseStream = response.GetResponseStream();StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding(utf-8);/返回内容string retString = myStreamReader.ReadToEnd();return retString;/ / 组装普通文本请求参数。/ / Key-Value形式请求参数字典/ 编码后的请求数据static string BuildQuery(IDictionary parameters,
21、 string encode)StringBuilder postData = new StringBuilder();bool hasParam = false;IEnumeratorKeyValuePair dem = parameters.GetEnumerator();while (dem.MoveNext()string name = dem.Current.Key;string value = dem.Current.Value;/ 忽略参数名或参数值为空的参数if (!string.IsNullOrEmpty(name)/& !string.IsNullOrEmpty(value
22、)if (hasParam)postData.Append(&);postData.Append(name);postData.Append(=);if (encode = gb2312)postData.Append(HttpUtility.Encode(value, Encoding.GetEncoding(gb2312);else if (encode = utf8)postData.Append(HttpUtility.Encode(value, Encoding.UTF8);elsepostData.Append(value);hasParam = true;return postD
23、ata.ToString();/ / 把响应流转换为文本。/ / 响应流对象/ 编码方式/ 响应文本static string GetResponseAsString(HttpWebResponse rsp, Encoding encoding)System.IO.Stream stream = null;StreamReader reader = null;try/ 以字符流的方式读取HTTP响应stream = rsp.GetResponseStream();reader = new StreamReader(stream, encoding);return reader.ReadToEn
24、d();finally/ 释放资源if (reader != null) reader.Close();if (stream != null) stream.Close();if (rsp != null) rsp.Close();代码 PHP代码/* c远程传输工具*/public function post_c($,$body,$header,$type=POST)$ch = c_init();c_setopt($ch,COPT_,$);c_setopt($ch,COPT_HEADER,0);/0只要正文c_setopt($ch,COPT_TIMEOUT,5);/设置超时时间c_setop
25、t($ch,COPT_CONNECTTIMEOUT,5);/将c_exec()获取的信息以文件流的形式返回,而不是直接输出。c_setopt($ch,COPT_RETURNTRANSFER,1);/增加header头信息/ array_push($header,Accept:application/json);/ array_push($header,Content-Type:application/json);/ array_push($header,http:multipart/form-data);if(count($body)0)c_setopt($ch,COPT_POSTFIELDS
26、,$body);if(count($header)0)c_setopt($ch,COPT_HTTPHEADER,$header);/设置上传文件相关c_setopt($ch,COPT_FOLLOWLOCATION,true);c_setopt($ch,COPT_MAXREDIRS,3);/递归c_setopt($ch,COPT_SSL_VERIFYPEER,false);/ 对认证证书来源的检查c_setopt($ch,COPT_SSL_VERIFYHOST,0);/ 从证书中检查SSL加密算法switch ($type) case GET:c_setopt($ch,COPT_HTTPGET,
27、1);break;case POST:c_setopt($ch,COPT_POST,1);break;case PUT:c_setopt($ch,COPT_CUSTOMREQUEST,PUT);break;case DELETE:c_setopt($ch,COPT_CUSTOMREQUEST,DELETE);break;/上传文件相关设置c_setopt($ch,COPT_ENCODING,gzip);c_setopt($ch,COPT_USERAGENT,SSTS Browser/1.0);c_setopt($ch,COPT_USERAGENT,Mozilla/4.0 (compatible
28、; MSIE 8.0; Windows NT 6.0; Trident/4.0);/ 模拟用户使用的浏览器if(c_errno($ch)return c_error($ch);$content = c_exec($ch);c_close($ch);/关闭c资源,并且释放系统资源$result = json_decode($content,true);if(!empty($result)return $result;elsereturn $content;代码 C/C+代码/*编译指令$ /opt/sybase/OCS-16_0/bin/cpre64 -m teststu.cp$ cc -m64
29、 -g -DSYB_LP64 -I. -I/opt/sybase/OCS-16_0/include teststu.c /opt/sybase/OCS-16_0/include/sybesql.c -L/opt/sybase/OCS-16_0/lib -lsybct64 -lsybtcl64 -lsybcs64 -lsybcomn64 -lsybintl64 -lsybunic64 -rdynamic -ldl -lnsl -lm -o teststu*/#include /*建立通讯区域*/EXEC SQL INCLUDE SQLCA;/* These tokens must be decl
30、ared in a declare section* because they are used in declare sections below.*/EXEC SQL BEGIN DECLARE SECTION;#define TYPESIZE 13#define TIDSIZE 6EXEC SQL END DECLARE SECTION;#define EOLN 0/* Forward declarations of the error and message handlers and* other subroutines called from main().*/void error_
31、handler();void warning_handler();intmain(int argc, char *argv)/*声明宿主变量*/EXEC SQL BEGIN DECLARE SECTION;/* storage for login name and password. */char username30;char sname30;char password30;char server30;EXEC SQL END DECLARE SECTION;/*错误处理*/EXEC SQL WHENEVER SQLERROR CALL error_handler();EXEC SQL WH
32、ENEVER SQLWARNING CALL warning_handler();EXEC SQL WHENEVER NOT FOUND CONTINUE;/*连接到 SQL SERVER 服务器*/* Copy the user name and password defined in sybsqlex.h to* the variables declared for them in the declare section.*/strcpy(username, mymotif);strcpy(password, wxwpxh);strcpy(server, MYMOTIFVOSTRO1454
33、80);EXEC SQL CONNECT :username IDENTIFIED BY :password using :server;EXEC SQL USE testdb;EXEC SQL DECLARE c1 CURSOR FORSELECT SNAME FROM STUDENT;EXEC SQL OPEN c1;printf(name in table studentn);do EXEC SQL FETCH c1 INTO :sname;if (sqlca.sqlcode != 0) break;printf( student name = %sn, sname ); while (
34、 1 );EXEC SQL CLOSE c1;return(0);/*错误处理程序*/* void error_handler()* Displays error codes and numbers from the SQLCA and exits with* an ERREXIT status.*/voiderror_handler(void)fprintf(stderr, n* SQLCODE=(%ld), sqlca.sqlcode);if (sqlca.sqlerrm.sqlerrml)fprintf(stderr, n* ASE Error );fprintf(stderr, n*
35、%s, sqlca.sqlerrm.sqlerrmc);fprintf(stderr, nn);exit(-1);/* void warning_handler()* Displays warning messages.*/voidwarning_handler(void)if (sqlca.sqlwarn1 = W)fprintf(stderr,n* Data truncated.n);if (sqlca.sqlwarn3 = W)fprintf(stderr,n* Insufficient host variables to store results.n);return;代码 Log4j
36、配置org.slf4jslf4j-log4j12导入这个包,会引入下面两个jarorg.springframeworkspring-context-supportcommons-loggingcommons-logging-api1.1org.springframeworkspring-orm !-当spring-config.xml文件中配置需要加入此包 -org.aspectjaspectjweaverorg.springframeworkspring-webmvc文件 无缝滚动.html 1KB*margin: 0;padding: 0;#wrap ul liwidth: 380px;h
37、eight: 230px;float: left;list-style: none;#wrap ulposition: absolute;left: 0;top: 0;#wrapwidth: 1520px;height: 230px;margin: 100px 50px;position: relative;background: red;overflow: hidden;window.onload=function()var oDiv=document.getElementById(wrap);var oUl=oDiv.getElementsByTagName(ul)0;var oLi=oU
38、l.getElementsByTagName(li);oUl.innerHTML=oUl.innerHTML+oUl.innerHTML;oUl.style.width=oLi0.offsetWidth*oLi.length+px;setInterval(function()if(oUl.offsetLeft-oUl.offsetWidth/2)oUl.style.left=0oUl.style.left=oUl.offsetLeft-2+px;,30)代码 获取的参数/获取的参数function getParam(paramKey)/获取当前var = location.href;/获取要取
39、得的get参数位置var get = .indexOf(paramKey +=);if(get = -1)return false;/截取字符串var getParamStr = .slice(paramKey.length + get + 1);/判断截取后的字符串是否还有其他get参数var nextparam = getParamStr.indexOf(&);if(nextparam != -1)getParamStr = getParamStr.slice(0, nextparam);return decodeURIComponent(getParamStr);代码 添加参数/添加参数
40、function addParam(,paramKey,paramVal)var andStr = ?;var beforeparam = .indexOf(?);if(beforeparam != -1)andStr = &;return + andStr + paramKey + =+ encodeURIComponent(paramVal);代码 删除参数/删除参数function delParam(,paramKey)var Param = .substr(.indexOf(?)+1);var before = .substr(0,.indexOf(?);var next = ;var
41、 arr = new Array();if(Param!=)var ParamArr = Param.split(&);for(var i=0;i0)next = ?+arr.join(&); = before+next;return ;代码 C#代码#region 防止sql注入式攻击(可用于UI层控制)/ 判断字符串中是否有SQL攻击代码/ 传入用户提交数据/ true-安全;false-有注入攻击现有;public bool ProcessSqlStr(string inputString)string SqlStr = and|or|exec|execute|insert|select
42、|delete|update|alter|create|drop|count|*|chr|char|asc|mid|substring|master|truncate|declare|xp_cmdshell|restore|backup|net +user|net +localgroup +administrators;tryif (inputString != null) & (inputString != String.Empty)string str_Regex = b( + SqlStr + )b;Regex Regex = new Regex(str_Regex, RegexOpti
43、ons.IgnoreCase);/string s = Regex.Match(inputString).Value;if (true = Regex.IsMatch(inputString)return false;catchreturn false;return true;/ 处理用户提交的请求,校验sql注入式攻击,在页面装置时候运行/ System.Configuration.ConfigurationSettings.AppSettingsErrorPage.ToString(); 为用户自定义错误页面提示地址,/ 在Web.Config文件时里面添加一个 ErrorPage 即可/
44、public void ProcessRequest()trystring getkeys = ;string sqlErrorPage = System.Configuration.ConfigurationSettings.AppSettingsErrorPage.ToString();if (System.Web.HttpContext.Current.Request.QueryString != null)for (int i = 0; i System.Web.HttpContext.Current.Request.QueryString.Count; i+)getkeys = System.Web.HttpContext.Current.Request.QueryString.Keysi;if (!ProcessSqlStr(System.Web.HttpContext.Current.Request.QueryStringgetkeys)System.Web.HttpContext.Current.Response.Redirect(sqlErrorPage + ?errmsg= + getkeys + 有SQL攻击嫌疑!);System.Web.HttpContext.Current.Response.End();if (Sys
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 二零二五年度餐饮泔水回收与环保设施投资合同3篇
- 二零二五年矿山土地及资源使用权转让合同3篇
- 二零二五版白糖进口许可证申请代理服务合同下载2篇
- 二零二五年度驾驶员押运员安全责任及培训合同3篇
- 二零二五版企事业单位节能环保办公电脑采购合同2篇
- 二零二五版电子商务平台借款及库存商品质押合同3篇
- 二零二五年纺织原料市场调研与分析合同2篇
- 小区下水管网清理疏通承包合同(2篇)
- 二零二五版房产买卖合同含抵押权转移及贷款利率协商协议0183篇
- 2025年度农业科技推广财产赠与合同3篇
- 【译林版】六年级英语(下册)单词默写单
- 高中英语名词性从句讲解
- 计算机二级wps题库及答案
- 整套课件:工业催化
- 爆破安全管理知识培训
- 旅游地理学教案
- 煤矸石综合利用途径课件
- 企业信息公示联络员备案申请表
- 卫生部关于发布《综合医院组织编制原则试行草案》的通知((78)卫医字第1689号)
- 挑战杯生命科学获奖作品范例
- 医院岗位设置与人员编制标准
评论
0/150
提交评论