Time of Update: 2018-12-04
利用JS正則-驗證日期時間格式是否正確 1.建立一個文字框,時間為頁面載入時自動擷取的系統時間 <input id="date" name="createTime" type="text" value="" size="15" onblur="mycheck()" />2.正則驗證函式function mycheck(){ var str=$("#date").val(); var reg = /^(\d{1,4})(-|\/)(\d{1,2})\
Time of Update: 2018-12-04
#include "stdafx.h"#include <iostream>#include <string>#include <map>#include <vector>#include <typeinfo>using namespace std;template <typename Iterator, typename Type>void count_( Iterator first, Iterator last,
Time of Update: 2018-12-04
bool CopyThread::copyFileDW(const QString& orgPath, QString tarPath){// source fileHANDLE hIn = CreateFile(orgPath.toStdWString().c_str(), GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);if ( INVALID_HANDLE_VALUE
Time of Update: 2018-12-04
#include "stdafx.h"#include <iostream>#include <string>#include <conio.h>using namespace std;#define DOUBLE(x) x+xvoid Func(char a[100]){cout<<sizeof(a)<<endl;}int main(){int i = 5*DOUBLE(5); // #define 會將運算式展開為 5*5+5 =
Time of Update: 2018-12-04
#include "stdafx.h"#include <iostream>#include <string>using namespace std;class A{public:int iNum;A(){}explicit A( class B& b); // 用exlicit 顯示初始化//A( class B& b);};class B{public:int iNum;double dNum;B(){}operator A(){A a;a.iNum
Time of Update: 2018-12-04
namespace X{template <typename T> void f(T);}namespace N {using namespace X;enum E { e1 };void f(E) {cout<<"N::f(E)"<<endl;}//void f(int) //如果開啟這個函的話,範圍N裡面的函數f就和外面的產生了歧義.//{//}}void f(int){cout<<"::f(int)"<<endl;}int
Time of Update: 2018-12-04
#include "stdafx.h"#include <iostream>#include <conio.h>using namespace std;///////////////////////////////////////////////////////////////////////////////class A{public:A(){}private:int a = 0; // 非靜態常成員};int main(){}// 錯誤
Time of Update: 2018-12-04
#include "stdafx.h"#include <iostream>#include <conio.h>using namespace std;template <typename T>class C{public:C(int){cout<<"C(int)"<<endl;}};void Func(const C<double>& ) {cout<<"Func(C<double>
Time of Update: 2018-12-04
1.網銀是我爸幫我弄的,用的時候,發現驗證資訊是“女兒,努力!” 2.媽說:“想你的時候,就一個人去逛街,想像著那些漂亮衣服穿在我女兒身上是什麼樣子的,這樣我就開心了。” 3.家裡買台大電視,我想放客廳,可老媽想放他們臥室,一直爭執不下,最後還是老媽妥協了。 很多年過去了,有天老媽發簡訊:電視放我和你爸臥室其實是想讓你能來我們屋看,這樣可以多陪陪我們…… 當即釋懷,忍不住大哭。
Time of Update: 2018-12-04
1.甲去買煙,煙29元,但他沒火柴,跟店員說:“順便送一盒火柴吧。”店員沒給。 乙去買煙,煙29元,他也沒火柴,跟店員說:“便宜一毛吧。”最後,他用這一毛買一盒火柴。 這是最簡單的心理邊際效應。第一種:店主認為自己在一個商品上賺錢了,另外一個沒賺錢。賺錢感覺指數為1。第二種:店主認為兩個商品都賺錢了,賺錢指數為2。當然心理傾向第二種了。同樣,這種心理還表現在買一送一的花招上,顧客認為有一樣東西不用付錢,就賺了,其實都是心理邊際效應在作怪。
Time of Update: 2018-12-04
#include "stdafx.h"#include <iostream>using namespace std;// 錯誤的例子//template <class T> class ListItem;//template <class T> class List {//public://List<T> ();//List<T> ( const List<T>& );//List<T>&
Time of Update: 2018-12-04
原則上一個html頁面上不應該存在多個相同id的元素。 若編寫過程不可避免產生了此種情況,在利用jQuery時無法用$()擷取所以相同id的元素值,假使使用$().each()也同樣無法擷取所有相同id的值,只能擷取到第一個id匹配的元素。此時我們可以使用$('[id=xx]'),可以擷取到所有相同id的元素,而不是第一個匹配的元素值。當然,規範編寫的話,還是應注意不應該出現相同的id的元素。
Time of Update: 2018-12-04
在Qt程式中,如果要開啟指定網站或系統中的檔案夾,可以使用QDesktopServices類的openUrl方法。詳見http://qt-project.org/doc/qt-4.8/qdesktopservices.html比如要開啟Qt開發社區,如下:1 #include <QDesktopServices>2 #include <QUrl>3 4
Time of Update: 2018-12-04
OpenCV中文網站:http://www.opencv.org.cn/index.php/%E5%9C%A8Qt%E4%B8%AD%E4%BD%BF%E7%94%A8OpenCV%E5%BA%93例子:UI:標頭檔:#ifndef CAMARAGET_H#define CAMARAGET_H#include <QtGui/QWidget>#include <QImage>#include <QTimer> //
Time of Update: 2018-12-04
#include "stdafx.h"#include <iostream>#include <conio.h>using namespace std;template <typename T>void Func(T& a, T& b){cout<<"a[0] = "<<a[0]<<endl;cout<<"b[0] = "<<b[0]<<endl;}int main(){
Time of Update: 2018-12-04
#include "stdafx.h"#include <iostream>using namespace std;struct Node// 節點的定義{int data;Node* front, *next;};struct List// 雙向鏈表A{List(int a = 1)// construtcton A: data(0), head(NULL), tail(NULL){if(head == NULL) // 如果鏈表為空白 建立鏈頭{head = new
Time of Update: 2018-12-04
#include "stdafx.h"#include <iostream>#include <conio.h>using namespace std;// *************************************class A; //前置聲明class B : public A{};int main(){}// error C2504: 'A' : base class undefined 需要A的定義// **********************
Time of Update: 2018-12-04
模板://Singleton.h#ifndef SINGLETON_H#define SINGLETON_H#include <cassert>#include <boost/shared_ptr.hpp> template<typename T> class gameSingleton { protected: static int m_counts; static T* m_singleton;
Time of Update: 2018-12-04
1. 共用記憶體的方法Unix: QSharedMemory "owns" the shared memory segment. When the last thread or process that has an instance of QSharedMemory attached to a particular shared memory segment detaches from the segment by destroying its instance of
Time of Update: 2018-12-04
//Server .....// tServer.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>#include <winsock.h> #include <stdio.h>#include <string>using namespace std;#define PORT 8080