This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Function: ImageURLEncryption | |
* Parameters: | |
* $Url : the url or text that you want to encrypt. | |
* $Code: the magic code which masks the url. | |
*/ | |
function ImageURLEncryption($Url,$Code) | |
{ | |
$SecretCode = md5($Code); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Author: Allen ([email protected]) | |
* Date: 2012/04/18 18:30 | |
* Goal: 反轉委員表,把它轉換為 Name, Review No 1~Review No. n. | |
*/ | |
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <iterator> | |
#include <map> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConfigFile cf("config.txt"); | |
std::string foo; | |
std::string water; | |
double four; | |
foo = cf.Value("section_1","foo" ); | |
water = cf.Value("section_2","water"); | |
four = cf.Value("section_2","four" ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
class A{ | |
public: | |
T m_A; | |
void funcTest() | |
{ | |
map<T , int> mapTempTable; /* 這部分沒問題, OK! */ | |
/* 編譯器會出錯! | |
要改成 typename map<T, int>::iterator it; */ | |
map<T, int>::iterator it; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
/* | |
* @Function: | |
template<typename T,size_t M,size_t N> | |
void fnPrint2DArray(T (&arr)[M][N]) | |
* @Brief: Print the content of 2D Array. | |
* @Input: 2D array. | |
* @Output: None. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
/* | |
* @Function: | |
template<typename T,size_t N> | |
void fnChange(T (&arr)[N]) | |
* @Brief: Let each element of array increase by one. | |
* @Input: 1D array | |
* @Output: The array whose elements all increase by 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @Function: void fnPrintArray(int arr[10]) | |
* @Brief: Print the array content , and the input is by reference. | |
* @Input: int arr[10] | |
* @Output: array content. | |
*/ | |
void fnPrintArray(int (&arr)[10]) | |
{ | |
for(size_t i=0;i<10;++i) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @Function: void fnPrintArray(int arr[10]) | |
* @Brief: Print the array content. | |
* @Input: int arr[10] | |
* @Output: array content. | |
*/ | |
void fnPrintArray(int arr[10]) | |
{ | |
for(size_t i=0;i<10;++i) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 要使用 ConfigurationManager,需引入System.Configuration 這個namespace */ | |
using System.Configuration; | |
/* 程式碼區 */ | |
[HttpPost] | |
public ActionResult Upload(HttpPostedFileBase file) | |
{ | |
//檢查是否有檔案上傳,有的話存檔 | |
if (file !=null && file.ContentLength > 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
type: "POST", /* 選擇傳輸方式 */ | |
url: "/person/create", /*選擇要處理的controller/action */ | |
dataType: "json", /*選擇資料類型,以本篇文章,資料類型為json */ | |
contentType: "application/json; charset=utf-8", /* 選擇傳輸的encoding以及媒體類型 */ | |
data: jsonData, /* data欄位填入json包好的資料就行了!以這個為例,jsonData是該篇文章的一個物件 */ | |
success: function (result){ /* 成功了要做什麼動作? */ | |
console.log(result); //log to the console to see whether it worked | |
}, | |
error: function (error){ /* 失敗了要做什麼動作? */ |