Filezilla ~ backup Site Manager settings

進入目錄全部複製起來

開資料夾打網址

%APPDATA%\FileZilla

reference
http://forum.filezilla-project.org/viewtopic.php?f=2&t=20341

PHP ~ set php.ini

ini_set('max_execution_time', '100');

http://php.net/manual/en/function.ini-set.php

Visual C++ ~ error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.

這問題是發生在用OpenCV的時候

裡面有段code使用fopen

但vs覺得他不安全就不給編譯= =

解決方法就是改Preprocessor Definitions

Project -> Properties(Alt+F7) -> Configuration Properties -> C/C++ -> Preprocessor ->
Preprocessor Definitions.

新增

USE_STANDARD_FILE_FUNCTIONS
_CRT_SECURE_NO_WARNINGS

就可以了


reference
http://darmawan-salihun.blogspot.tw/2011/07/crtsecurenowarnings-error-message-in.html

Visual c++ ~ OpenCV

架設OpenCV環境至Visaul Studio C++專案

參考~
http://jepsonsblog.blogspot.tw/2012/07/installation-guide-opencv-24-with.html

download Autoblog wallpaper javascript

會寫這支javascript是因為平常看autoblog的gallery

例如網址

http://www.autoblog.com/photos/2012-pagani-huayra-first-drive/#photo-5378629/

我都會邊看圖邊按下載桌布

DOWNLOAD WALLPAPER

這顆按鈕

可是這樣慢慢點慢慢看很費時間

後來我autoblog待看,下載的車就越積越多

0rz...............


我就想說乾脆叫程式下載就好

省時省力

而且抓下來的圖直接點了就可以看, 還是桌布size的圖片


就研究了一下他的gallery這支網頁的原始碼跟javascript

發現可以透過javascript一直跑回圈下載圖片

就自己寫了一隻js

之後進入網頁後開console貼上這段js給他run, 就可以開始下載了

超省時省力XD


var i = 0;
var totalItems = $('.thumbnails li').length;
var sleepSecond = 3500;
function xxx() {
if (i < totalItems) {
$('.thumbnails li:eq(' + i + ')').mousedown();
$('#gallery_wallpaper a').click();
i++;
setTimeout("xxx()", sleepSecond);
} else {
alert('over.')
}
}
xxx();



大致上就是每抓一次圖等待3.5秒在抓一次

抓取所有項目圖片項目的長度, 在一個一個觸發點下去項目的事件切換圖片後

在去處發點下載桌布的按鈕的程式

C++ ~ cin to array and output use vector, for_each

#include <iostream>
#include <vector>
#include <algorithm>


int inputNumber = 1 ;
vector<int> inputArray;
while(inputNumber != 0)
{
cin>>inputNumber;
inputArray.push_back(inputNumber);
}
for_each (inputArray.begin(), inputArray.end(), myfunction);



reference
http://www.cplusplus.com/reference/algorithm/for_each/

http://stackoverflow.com/questions/3807163/stdcin-in-an-array

C++ ~ stringstream sample

void saveToTxt(stringstream& ss){
FILE *p = NULL;
char *file = "I:\\Hello.txt";

const std::string tmp = ss.str();
const char* cstr = tmp.c_str();

size_t len = 0;
p = fopen(file, "w");
if (p== NULL) {
cout <<"Error in opening a file.."< }

len = strlen(cstr);
fwrite(cstr, len, 1, p);
fclose(p);
cout<<"\nWritten Successfuly in the file.\n";

}



stringstream ss;
ss << "caaaaaaaaaaaaaa\n";
saveToTxt(ss);

C++ ~ stringstream write to file

stringstream ss;
ss << "ggggggggggg\n";

const std::string tmp = ss.str();
const char* cstr = tmp.c_str();

FILE *p = NULL;
char *file = "I:\\Hello.txt";

size_t len = 0;
p = fopen(file, "w");
if (p== NULL) {
cout <<"Error in opening a file..";
}

len = strlen(cstr);
fwrite(cstr, len, 1, p);
fclose(p);
cout<<"\nWritten Successfuly in the file.\n";