Recent Comments

This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

2012年9月2日 星期日

CentOS 設定使用者自動登入


 vim /etc/gdm/custom.conf

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=abc


2012年8月15日 星期三

找出重疊的元件


.cpp
//---------------------------------------------------------------------------

#include
#pragma hdrstop

#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::___TEST(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
int I;
TPoint pt;
TStringList *L = new TStringList;
GetCursorPos(&pt);
pt = this->ScreenToClient(pt);
for (I=0; I if (!Controls[I]->ClassNameIs("TPaintBox")){
continue;
}
if (!PtInRect(Controls[I]->BoundsRect , pt)){
continue;
}
L->Add(Controls[I]->Name);
}
ListBox1->Items->Text = L->Text;
delete L;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::PaintBox1Paint(TObject *Sender)
{
TPaintBox  *tPbx =((TPaintBox *)Sender);
tPbx->Canvas->Rectangle(0,0,tPbx->Width,tPbx->Height);
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
for (int I=0; I if (!Controls[I]->ClassNameIs("TPaintBox")){
continue;
}
((TPaintBox*)Controls[I])->OnMouseDown = ___TEST;
}
}
//---------------------------------------------------------------------------

====================================================
.h
//---------------------------------------------------------------------------

#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include
#include
#include
#include
#include
//---------------------------------------------------------------------------
class TForm2 : public TForm
{
__published: // IDE-managed Components
TPaintBox *PaintBox1;
TPaintBox *PaintBox2;
TPaintBox *PaintBox3;
TListBox *ListBox1;
TButton *Button1;
void __fastcall PaintBox1Paint(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);

private: // User declarations
void __fastcall ___TEST(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
public: // User declarations
__fastcall TForm2(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
//---------------------------------------------------------------------------
#endif

2012年8月6日 星期一

移動滑鼠執行事件


  SetCursorPos(30,30);
mouse_event(MOUSEEVENTF_LEFTDOWN,30,30,NULL,NULL);
mouse_event(MOUSEEVENTF_LEFTUP,30,30,NULL,NULL);
mouse_event(MOUSEEVENTF_LEFTDOWN,30,30,NULL,NULL);
mouse_event(MOUSEEVENTF_LEFTUP,30,30,NULL,NULL);

2012年7月1日 星期日

shell script 數字補0

數字1、2、3、 補0 => 01、02、03

xx=`echo $num|awk'{printf "%02d", $1}'`
echo $xx;

2012年6月28日 星期四

CentOS6用yum安裝webmin

vim /etc/yum.repos.d/webmin.repo
加入下面的內容

[Webmin]
name=Webmin Distribution Neutral 
baseurl=http://download.webmin.com/download/yum 
enabled=1

rpm --import http://www.webmin.com/jcameron-key.asc
yum install webmin
yum install gcc openssl openssl-devel

http://localhost:10000
帳號密碼為系統管理者root

2012年6月7日 星期四

the log_filename parameter must equal

當執行pgadmin III的工具->伺服器狀態時會出現the log_filename parameter must equal……
主要是設定檔的LOG FILE格式和PGADMIN III的格式不符所造成的

修改postgresql.conf
vim /var/lib/pgsql/9.1/data/postgresql.conf
修改下面log_filename的參數內容
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'

安裝adminpack


使用locate adminpack找到檔案路徑
/usr/pgsql-9.1/share/extension/adminpack--1.0.sql


執行
su -l postgres
psql -d n5_data < /usr/pgsql-9.1/share/extension/adminpack--1.0.sql


出現Use "CREATE EXTENSION adminpack" to load this file.
在9.1的安裝方式改了,改用下面的指令,直接到資料庫中執行指令產生


psql -d n5_data 
CREATE EXTENSION adminpack


最後reload設定檔
su -l postgres
 /usr/pgsql-9.1/bin/pg_ctl reload -d /var/lib/pgsql/9.1/data/

重新開始後pgadmin iii就不會出現這個錯誤,也可以用pgadmin直接看到log內容
log檔案位置:/var/lib/pgsql/9.1/data/pg_log

2012年6月4日 星期一

解壓縮資料夾下的檔案

解壓縮Z
ls *.tar.Z | xargs -n 1 gunzip -d


解開檔案
ls *.tar | xargs -n 1 tar -xvf