iOS粒子效果實現(xiàn)工具代碼UIEffectDesigner_第1頁
iOS粒子效果實現(xiàn)工具代碼UIEffectDesigner_第2頁
iOS粒子效果實現(xiàn)工具代碼UIEffectDesigner_第3頁
iOS粒子效果實現(xiàn)工具代碼UIEffectDesigner_第4頁
iOS粒子效果實現(xiàn)工具代碼UIEffectDesigner_第5頁
已閱讀5頁,還剩35頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、iOS仿apple-pay效果,卡片堆疊效果,關(guān)于NSCoding 自定義類無法歸檔將個別文字變成* ,iOS粒子效果實現(xiàn)工具代碼 UIEffectDesigner 下載地址 查看日志 iOS私有方法 和私有變量 主要是示意大家如何使用2530芯片的AD功能*/ TxData2 = 2; TxData3 = 0; TxData4 = LightLevel / 10 + 0; TxData5 = LightLevel % 10 + 0; /*以上兩句,是吧讀取到的數(shù)值轉(zhuǎn)換成字符,供串口函數(shù)使用*/ TxData6 = 1; UartSendString(TxData, 8);/想串口助手送出數(shù)據(jù)

2、,波特率是 DelayMS(1000);/延時函數(shù),如果沒此函數(shù),讀取時間太短,向串口送數(shù)據(jù)太快了 void readTempHumidity() memset(temp, 0, 2); memset(humidity, 0, 2); DHT11(); /獲取溫濕度 /將溫濕度的轉(zhuǎn)換成字符串 temp0=wendu_shi+0x30; temp1=wendu_ge+0x30; humidity0=shidu_shi+0x30; humidity1=shidu_ge+0x30; TxData2 = 3; TxData3 = temp0; TxData4 = temp1; TxData5 = hu

3、midity0; TxData6 = humidity1; UartSendString(TxData,8);void readMan() int i; TxData2 = 6; for(i=3;i5;i+) TxDatai = 0; if(MAN = 1) /有人(只要不是冷血動物)在外活動 TxData5 = 1; if(MAN = 0) /無人或者(包括冷血動物)保持禁止 TxData5 = 0;代碼 Google Go代碼 package mainimport ( io/ioutil net/http net/ fmt encoding/json) /-/ 黃金數(shù)據(jù)調(diào)用示例代碼 聚合數(shù)

4、據(jù)/ 在線接口文檔:/- const APPKEY = * /您申請的APPKEY func main() /1.上海黃金交易所 Request1() /2.上海期貨交易所 Request2() /3.銀行賬戶黃金 Request3() /1.上海黃金交易所func Request1() /請求地址 juhe :=/finance/gold/shgold /初始化參數(shù) param:=.Values /配置請求參數(shù),方法內(nèi)部已處理encode問題,中文參數(shù)可以直接傳參 param.Set(key,APPKEY) /APP Key param.Set(v,) /JSON格式版本(0或1)默認為0

5、/發(fā)送請求 data,err:=Get(juhe,param) if err!=nil fmt.Errorf(請求失敗,錯誤信息:rn%v,err) else var netReturn mapstringinterface json.Unmarshal(data,&netReturn) if netReturnerror_code.(float64)=0 fmt.Printf(接口返回result字段是:rn%v,netReturnresult) /2.上海期貨交易所func Request2() /請求地址 juhe :=/finance/gold/shfuture /初始化參數(shù) para

6、m:=.Values /配置請求參數(shù),方法內(nèi)部已處理encode問題,中文參數(shù)可以直接傳參 param.Set(key,APPKEY) /APP Key param.Set(v,) /JSON格式版本(0或1)默認為0 /發(fā)送請求 data,err:=Get(juhe,param) if err!=nil fmt.Errorf(請求失敗,錯誤信息:rn%v,err) else var netReturn mapstringinterface json.Unmarshal(data,&netReturn) if netReturnerror_code.(float64)=0 fmt.Printf

7、(接口返回result字段是:rn%v,netReturnresult) /3.銀行賬戶黃金func Request3() /請求地址 juhe :=/finance/gold/bankgold /初始化參數(shù) param:=.Values /配置請求參數(shù),方法內(nèi)部已處理encode問題,中文參數(shù)可以直接傳參 param.Set(key,APPKEY) /APP Key /發(fā)送請求 data,err:=Get(juhe,param) if err!=nil fmt.Errorf(請求失敗,錯誤信息:rn%v,err) else var netReturn mapstringinterface j

8、son.Unmarshal(data,&netReturn) if netReturnerror_code.(float64)=0 fmt.Printf(接口返回result字段是:rn%v,netReturnresult) / get 網(wǎng)絡(luò)請求func Get(api string,params .Values)(rsbyte ,err error) var *. ,err=.Parse(api) if err!=nil fmt.Printf(解析錯誤:rn%v,err) return nil,err /如果參數(shù)中有中文參數(shù),這個方法會進行Encode .RawQuery=params.En

9、code() resp,err:=http.Get(.String() if err!=nil fmt.Println(err:,err) return nil,err defer resp.Body.Close() return ioutil.ReadAll(resp.Body) / post 網(wǎng)絡(luò)請求 ,params 是.Values類型func Post(api string, params .Values)(rsbyte,err error) resp,err:=http.PostForm(api, params) if err!=nil return nil ,err defer r

10、esp.Body.Close() return ioutil.ReadAll(resp.Body)代碼描述:基于GO的黃金數(shù)據(jù)接口調(diào)用代碼實例關(guān)聯(lián)數(shù)據(jù):黃金數(shù)據(jù)代碼 C#代碼 using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.IO;using Xfrog.Net;using System.Diagnostics;using System.Web; /-/ 黃金數(shù)據(jù)調(diào)用示例代碼 聚合數(shù)據(jù)/ 在線接口文檔:/ 代碼中JsonO

11、bject類下載地址:/- namespace ConsoleAPI class Program static void Main(string args) string appkey = *; /配置您申請的appkey /1.上海黃金交易所 string 1 = /finance/gold/shgold; var parameters1 = new Dictionary(); parameters1.Add(key, appkey);/你申請的key parameters1.Add(v , ); /JSON格式版本(0或1)默認為0 string result1 = sendPost(1,

12、 parameters1, get); JsonObject newObj1 = new JsonObject(result1); String errorCode1 = newObj1error_code.Value; if (errorCode1 = 0) Debug.WriteLine(成功); Debug.WriteLine(newObj1); else /Debug.WriteLine(失敗); Debug.WriteLine(newObj1error_code.Value+:+newObj1reason.Value); /2.上海期貨交易所 string 2 = /finance/

13、gold/shfuture; var parameters2 = new Dictionary(); parameters2.Add(key, appkey);/你申請的key parameters2.Add(v , ); /JSON格式版本(0或1)默認為0 string result2 = sendPost(2, parameters2, get); JsonObject newObj2 = new JsonObject(result2); String errorCode2 = newObj2error_code.Value; if (errorCode2 = 0) Debug.Writ

14、eLine(成功); Debug.WriteLine(newObj2); else /Debug.WriteLine(失敗); Debug.WriteLine(newObj2error_code.Value+:+newObj2reason.Value); /3.銀行賬戶黃金 string 3 = /finance/gold/bankgold; var parameters3 = new Dictionary(); parameters3.Add(key, appkey);/你申請的key string result3 = sendPost(3, parameters3, get); JsonO

15、bject newObj3 = new JsonObject(result3); String errorCode3 = newObj3error_code.Value; if (errorCode3 = 0) Debug.WriteLine(成功); Debug.WriteLine(newObj3); else /Debug.WriteLine(失敗); Debug.WriteLine(newObj3error_code.Value+:+newObj3reason.Value); / / Http (GET/POST) / / 請求 / 請求參數(shù) / 請求方法 / 響應(yīng)內(nèi)容 static s

16、tring sendPost(string , IDictionary parameters, string method) if (method.ToLower() = post) HttpWebRequest req = null; HttpWebResponse rsp = null; System.IO.Stream reqStream = null; try req = (HttpWebRequest)WebRequest.Create(); req.Method = method; req.KeepAlive = false; req.ProtocolVersion = HttpV

17、ersion.Version10; req.Timeout = 5000; req.ContentType = application/x-www-form-encoded;charset=utf-8; byte postData = Encoding.UTF8.GetBytes(BuildQuery(parameters, utf8); reqStream = req.GetRequestStream(); reqStream.Write(postData, 0, postData.Length); rsp = (HttpWebResponse)req.GetResponse(); Enco

18、ding encoding = Encoding.GetEncoding(rsp.CharacterSet); return GetResponseAsString(rsp, encoding); catch (Exception ex) return ex.Message; finally if (reqStream != null) reqStream.Close(); if (rsp != null) rsp.Close(); else /創(chuàng)建請求 HttpWebRequest request = ( HttpWebRequest)WebRequest.Create(

19、 + ? + BuildQuery(parameters, utf8); /GET請求 request.Method = GET; request.ReadWriteTimeout = 5000; request.ContentType = text/html;charset=UTF-8; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream myResponseStream = response.GetResponseStream(); StreamReader myStreamReader = n

20、ew 68 StreamReader(myResponseStream, Encoding.GetEncoding(utf-8); /返回內(nèi)容 string retString = myStreamReader.ReadToEnd(); return retString; / / 組裝普通文本請求參數(shù)。 / / Key-Value形式請求參數(shù)字典 / 編碼后的請求數(shù)據(jù) static string BuildQuery(IDictionary parameters, string encode) StringBuilder postData = new StringBuild

21、er(); bool hasParam = false; IEnumeratorKeyValuePair dem = parameters.GetEnumerator(); while (dem.MoveNext() string name = dem.Current.Key; string value = dem.Current.Value;string name = dem.Current.KeyKeyValuePairstring, stringStringBuilder postData = new StringBuilder(); / 忽略參數(shù)名或參數(shù)值為空的參數(shù) if (!stri

22、ng.IsNullOrEmpty(name)/& ! string.IsNullOrEmpty(value)StringBuilder postData = new StringBuilder(); if (hasParam)StringBuilder postData = new StringBuilder(); postData.Append(&); postData.Append(name); postData.Append(=); if (encode = gb2312) postData.Append(HttpUtility.Encode(value,

23、 Encoding.GetEncoding(gb2312); else if (encode = utf8) postData.Append(HttpUtility.Encode(value, Encoding.UTF8); else postData.Append(value); hasParam = true; return postData.ToString(); / / 把響應(yīng)流轉(zhuǎn)換為文本。 / / 響應(yīng)流對象 / 編碼方式 / 響應(yīng)文本 static string GetResponseAsString(HttpWebResponse rsp, Encoding encoding)

24、System.IO.Stream stream = null; StreamReader reader = null; try / 以字符流的方式讀取HTTP響應(yīng) stream = rsp.GetResponseStream(); reader = new StreamReader(stream, encoding); return reader.ReadToEnd(); finally / 釋放資源 if (reader != null) reader.Close(); if (stream != null) stream.Close(); if (rsp != null) rsp.Clos

25、e(); 代碼 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);/設(shè)置超時時間 c_setopt($ch,COPT_CONNECTTIMEOUT,5); /將c_exec()獲取的信息以文件流的形式返回,而不是直接輸出。 c_setopt($ch,COPT_RETURNTRANSFER,1); /

26、增加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,$body); if(count($header)0) c_setopt($ch,COPT_HTTPHEADER,$header); /設(shè)置上傳文件相關(guān) c_setopt($ch,COP

27、T_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,1); break; case POST: c_setopt($ch,COPT_POST,1); break; case PUT: c_setopt($ch,COPT_C

28、USTOMREQUEST,PUT); break; case DELETE: c_setopt($ch,COPT_CUSTOMREQUEST,DELETE); break; /上傳文件相關(guān)設(shè)置 c_setopt($ch,COPT_ENCODING,gzip); c_setopt($ch,COPT_USERAGENT,SSTS Browser/1.0); c_setopt($ch,COPT_USERAGENT,Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0);/ 模擬用戶使用的瀏覽器 if(c_errno($ch) r

29、eturn c_error($ch); $content = c_exec($ch); c_close($ch);/關(guān)閉c資源,并且釋放系統(tǒng)資源 $result = json_decode($content,true); if(!empty($result) return $result; else return $content; 代碼 C/C+代碼 /*編譯指令$ /opt/sybase/OCS-16_0/bin/cpre64 -m teststu.cp$ cc -m64 -g -DSYB_LP64 -I. -I/opt/sybase/OCS-16_0/include teststu.c

30、/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 /*建立通訊區(qū)域*/EXEC SQL INCLUDE SQLCA;/* * These tokens must be declared in a declare section* because they are used in declar

31、e 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_handler();void warning_handler(); intmain(int argc, cha

32、r *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 WHENEVER SQLWARNING CALL warning_handler(); EXE

33、C SQL WHENEVER NOT FOUND CONTINUE;/*連接到 SQL SERVER 服務(wù)器*/ /* * 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, MYMOTIFVOSTRO); EXEC SQL CONNECT :username IDENTIFIE

34、D BY :password using :server; EXEC SQL USE testdb; EXEC SQL DECLARE c1 CURSOR FOR SELECT 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 ( 1 ); EXEC SQL CLOSE c1; return(

35、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* %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

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論