Ubuntu14.04里面有两个python版本。
默认的是python2.7
如果要使用python3.4 可以用python3这个命令就好了。
Ubuntu14.04里面有两个python版本。
默认的是python2.7
如果要使用python3.4 可以用python3这个命令就好了。
让PHP函数json_encode不转义中文
echo json_encode($ret, JSON_UNESCAPED_UNICODE);
PHP7 编译配置参数
ubuntu14.04上需要安装的库
apt-get -y install libxml2-dev libjpeg-dev libpng-dev libfreetype6-dev libmcrypt-dev libcurl4-openssl-dev make gcc
说明:configure 是用来生成makefle的
配合apache的编译参数
./configure --prefix=/www/php --with-apxs2=/www/httpd/bin/apxs --enable-cli --enable-shared --with-libxml-dir --with-gd --with-openssl --enable-mbstring --with-mcrypt --with-mysqli --enable-opcache --enable-mysqlnd --enable-zip --with-zlib-dir --with-pdo-mysql --with-jpeg-dir --with-freetype-dir --with-curl --with-pdo-sqlite --with-sqlite3 --disable-fileinfo
配合nginx使用的编译参数
先要安装Pgsql的开发包 apt-get install postgresql-server-dev-9.5
-dev的包一般是用来提供依赖关系的。
./configure --prefix=/usr/local/php5 --with-gd --with-curl --enable-fpm --enable-cgi --with-openssl --enable-mbstring --with-mcrypt --with-pdo-mysql --enable-zip --with-mysqli --enable-opcache --enable-mysqlnd --with-libxml-dir --with-jpeg-dir --with-freetype-dir --with-pdo-sqlite --with-sqlite3 --disable-fileinfo --enable-cli --enable-shared
要使用PG的话就加上下面两个参数
--with-pdo-pgsql --with-pgsql=/usr/lib/postgresql
注意:–with-pgsql=/usr/lib/postgresql的路径只在ubuntu14.04 64位上测试通过
make && make install
最后把php加入环境变量
sudo echo "PATH=$PATH:/www/php/bin">> /etc/profile
echo "PATH=$PATH:/usr/local/php5/bin">> /etc/profile
最后把php.ini 拷贝到/www/php/lib下面
cp php.ini-development /usr/local/php5/lib/php.ini
VC 递归调用GetWindow查找控件
HWND g_TargetMainWnd = NULL ;
BOOL WINAPI EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
if (:: GetWindowLong(hWnd , GWL_STYLE ) & WS_VISIBLE )
{
char szWindowText[128] = { 0 };
if (:: GetWindowText(hWnd , szWindowText, 128) != 0)
{
if (strstr(szWindowText, "职业技能实训平台" ) != NULL )
{
g_TargetMainWnd = hWnd;
return FALSE;
}
}
}
return TRUE;
}
void CAnswerGetDlg ::Work(HWND hSubWnd )
{
if ( hSubWnd != NULL)
{
while ( hSubWnd != NULL)
{
char szWindowText[128] = { 0 };
:: GetWindowText(hSubWnd , szWindowText, 128);
if (strstr(szWindowText, "[A]"))
{
RECT rc;
BOOL bret = ::GetWindowRect( hSubWnd, &rc);
SetDlgItemText(IDC_EDIT1 , szWindowText + 3);
char szCoordinate[16] = { 0 };
sprintf(szCoordinate, "%d %d", rc.left, rc.top);
SetDlgItemText(IDC_EDIT5 , szCoordinate);
}
if (strstr(szWindowText, "[B]"))
{
RECT rc;
::GetWindowRect( hSubWnd, &rc);
SetDlgItemText(IDC_EDIT2 , szWindowText + 3);
char szCoordinate[16] = { 0 };
sprintf(szCoordinate, "%d %d", rc.left, rc.top);
SetDlgItemText(IDC_EDIT6 , szCoordinate);
}
if (strstr(szWindowText, "[C]"))
{
RECT rc;
::GetWindowRect( hSubWnd, &rc);
SetDlgItemText(IDC_EDIT3 , szWindowText + 3);
char szCoordinate[16] = { 0 };
sprintf(szCoordinate, "%d %d", rc.left, rc.top);
SetDlgItemText(IDC_EDIT7 , szCoordinate);
}
if (strstr(szWindowText, "[D]"))
{
RECT rc;
::GetWindowRect( hSubWnd, &rc);
SetDlgItemText(IDC_EDIT4 , szWindowText + 3);
char szCoordinate[16] = { 0 };
sprintf(szCoordinate, "%d %d", rc.left, rc.top);
SetDlgItemText(IDC_EDIT8 , szCoordinate);
}
HWND hSubWnd2 = ::GetWindow( hSubWnd, GW_CHILD);
if(hSubWnd2 != NULL)
{
Work(hSubWnd2);
}
hSubWnd = ::GetWindow( hSubWnd, GW_HWNDNEXT);
}
}
}
void CAnswerGetDlg ::OnBnClickedOk()
{
for ( int i = 0; i < 8; i++)
{
SetDlgItemText(1000 + i, "" );
}
::EnumWindows(( WNDENUMPROC)EnumWindowsProc, NULL );
if (g_TargetMainWnd != NULL)
{
HWND hSubWnd = ::GetWindow(g_TargetMainWnd, GW_CHILD);
Work(hSubWnd);
}
}
WinForm中richTextBox1换行
richTextBox1.Text += "【" + DateTime .Now.ToLongTimeString() + "】" + log;
this.richTextBox1.AppendText( Environment.NewLine);
Linux查找并删除命令
find / -name "apache2" -print -exec rm -fr {} \;
ubuntu或centos No package ‘glib-2.0’ found解决办法
CentOS:
在root 下运行 yum install libgnomeui-devel
ubuntu :
sudo apt-get install libperl-dev
sudo apt-get install libgtk2.0-dev
VC 检测文件是否存在
bool IsExistFile(LPCSTR pszFileName )
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFile(pszFileName , &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
return false;
else
{
FindClose(hFind);
return true;
}
return false;
}
VC库函数获取当前EXE所在的路径
TCHAR cfgPath[ MAX_PATH];
GetModuleFileName(NULL , cfgPath, MAX_PATH);
PathAppend(cfgPath, "..\\config.ini" );
wireshark只抓HTTP包 http and tcp.port == 80