2010년 11월 16일 화요일
2010년 11월 15일 월요일
2010년 11월 14일 일요일
가전제품 소비전력
http://kin.naver.com/qna/detail.nhn?d1id=11&dirId=1118&docId=115642296&qb=6rCA7KCE7KCc7ZKIIOyGjOu5hOyghOugpQ==&enc=utf8§ion=kin&rank=1&search_sort=0&spq=0
냉장고 -- 250~500W(항상 동작하는 것은 아닙니다.)
다리미 -- 600~1000W정도
컴퓨터 (본체) 120~150W(게임용이나 그래픽용은 200~250W)
러닝머신-- 이것이 보기보다 소비전력이 높습니다. 1500W~2000W
컴퓨터(모니터) -- 19~22인치 기준으로 40~50W
식기 세척기 -- 500~600W
형광등 -- 종류에 따라 다름 20~40W
전자렌인지 -- 800~1200W
에어컨 -- 1000~2500W(이것도 설정온도,주변온도에 따라 항상 동작하는 것은 아닙니다.)
스탠드 -- 백열전구(60~100W) 형광등(20~40W)
세탁기 -- 400~600W(드럼형, 온풍인경우는 1000W이상)
오븐 -- 1000~2000W
김치 냉장고 -- 200~400W(이역시 항상 동작하는 것은 아닙니다.)
냉동고 ---어떤 것인지..
드라이기 -- 800~1200W
전화기 -- 5~10W 이하
냉장고 -- 250~500W(항상 동작하는 것은 아닙니다.)
다리미 -- 600~1000W정도
컴퓨터 (본체) 120~150W(게임용이나 그래픽용은 200~250W)
러닝머신-- 이것이 보기보다 소비전력이 높습니다. 1500W~2000W
컴퓨터(모니터) -- 19~22인치 기준으로 40~50W
식기 세척기 -- 500~600W
형광등 -- 종류에 따라 다름 20~40W
전자렌인지 -- 800~1200W
에어컨 -- 1000~2500W(이것도 설정온도,주변온도에 따라 항상 동작하는 것은 아닙니다.)
스탠드 -- 백열전구(60~100W) 형광등(20~40W)
세탁기 -- 400~600W(드럼형, 온풍인경우는 1000W이상)
오븐 -- 1000~2000W
김치 냉장고 -- 200~400W(이역시 항상 동작하는 것은 아닙니다.)
냉동고 ---어떤 것인지..
드라이기 -- 800~1200W
전화기 -- 5~10W 이하
2010년 11월 13일 토요일
A CListBox with automatic HSCROLL maintenance
http://www.flounder.com/hscroll.htm
Horizontal scrolling is poorly understood and even more poorly documented. In order for horizontal scrolling to work, you have to call the SetHorizontalExtent method and set the total width of the horizontal space being used by the entries in the ListBox. If the horizontal extent is larger than the client area of the listbox, the horizontal scrollbar will appear, providing you have selected the horizontal scroll style. You need both to be set to get the effect.
Unfortunately, this is hard to do in the parent window. It involves having to do the computation at every site where you add a string. This is not well object-oriented. So what I've done is create a new class derived from CListBox that incorporates this functionality automatically.
The way I do this is maintain a value which is the maximum width set thus far. Whenever a new string is added, I update the width. When strings are deleted I update the width. I do this by overriding the ResetContent, InsertItem, AddItem, and DeleteString methods.
Note that this works only for non-owner-drawn list boxes. For owner-drawn, it is somewhat easier because you can maintain it in the DrawItem handler.
You can download the sample code, but here's some excerpts. The sample code includes a complete project which demonstrates the scrolling.
Note that to include this class in your project, you need to include the source file in your project, then delete the .clw file and re-invoke the ClassWizard to get it to see the new class (Microsoft used to allow the importation of classes directly, but this feature seems to have been deleted in the latest versions of Visual Studio). You can then create control variables using the CHListBox class directly in ClassWizard. If you don't do the rebuild of the .clw file, you will have to hand-edit your header file. If you don't know how to do this, check out my essay on Avoiding GetDlgItem.
A CListBox with automatic HSCROLL maintenance
Overview
A question that seems to come up about once a week in the newsgroup goes something like "I checked the horizontal scroll style in my ListBox, and I don't see any scrollbar. What can I do?"Horizontal scrolling is poorly understood and even more poorly documented. In order for horizontal scrolling to work, you have to call the SetHorizontalExtent method and set the total width of the horizontal space being used by the entries in the ListBox. If the horizontal extent is larger than the client area of the listbox, the horizontal scrollbar will appear, providing you have selected the horizontal scroll style. You need both to be set to get the effect.
Unfortunately, this is hard to do in the parent window. It involves having to do the computation at every site where you add a string. This is not well object-oriented. So what I've done is create a new class derived from CListBox that incorporates this functionality automatically.
The way I do this is maintain a value which is the maximum width set thus far. Whenever a new string is added, I update the width. When strings are deleted I update the width. I do this by overriding the ResetContent, InsertItem, AddItem, and DeleteString methods.
Note that this works only for non-owner-drawn list boxes. For owner-drawn, it is somewhat easier because you can maintain it in the DrawItem handler.
You can download the sample code, but here's some excerpts. The sample code includes a complete project which demonstrates the scrolling.
Note that to include this class in your project, you need to include the source file in your project, then delete the .clw file and re-invoke the ClassWizard to get it to see the new class (Microsoft used to allow the importation of classes directly, but this feature seems to have been deleted in the latest versions of Visual Studio). You can then create control variables using the CHListBox class directly in ClassWizard. If you don't do the rebuild of the .clw file, you will have to hand-edit your header file. If you don't know how to do this, check out my essay on Avoiding GetDlgItem.
SaveListBoxData(CListBox& lbLog)
void CDeleteThisDlg::SaveListBoxData(CListBox& lbLog)
{
CFileDialog dlg(FALSE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"log 파일 (*.log)|*.log||", this);
if(dlg.DoModal() == IDCANCEL)
return;
int nCount = lbLog.GetCount();
if(nCount <=0)
return;
//파일 생성...
CString strFileName = dlg.GetPathName();
if(dlg.GetFileExt() == "")
strFileName += ".log";
CStdioFile file;
CFileException ex;
TRY {
file.Open( strFileName, CFile::modeCreate | CFile::modeWrite | CFile::typeText);
}
CATCH(CFileException, ex) {
TCHAR szError[1024];
ex->GetErrorMessage(szError, 1024);
AfxMessageBox(szError);
return;
}
END_CATCH
CString strTemp;
for(int i=0; i<nCount; ++i) {
lbLog.GetText(i, strTemp);
strTemp += "\n";
file.WriteString(strTemp);
}
file.Close();
}
{
CFileDialog dlg(FALSE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"log 파일 (*.log)|*.log||", this);
if(dlg.DoModal() == IDCANCEL)
return;
int nCount = lbLog.GetCount();
if(nCount <=0)
return;
//파일 생성...
CString strFileName = dlg.GetPathName();
if(dlg.GetFileExt() == "")
strFileName += ".log";
CStdioFile file;
CFileException ex;
TRY {
file.Open( strFileName, CFile::modeCreate | CFile::modeWrite | CFile::typeText);
}
CATCH(CFileException, ex) {
TCHAR szError[1024];
ex->GetErrorMessage(szError, 1024);
AfxMessageBox(szError);
return;
}
END_CATCH
CString strTemp;
for(int i=0; i<nCount; ++i) {
lbLog.GetText(i, strTemp);
strTemp += "\n";
file.WriteString(strTemp);
}
file.Close();
}
A Logging Listbox Control
http://www.codeproject.com/KB/combobox/logcontrol.aspx
A Logging Listbox Control
One of the most common questions I hear from programmers who have moved from console-type applications to the GUI world is "How do I useprintf to do debug output?" In my first Windows app, a decade ago, I asked myself the same question, and came up with this answer. What I'm showing in this essay and the accompanying code download is the result of a decade of maturing the world's greatest (at least IMNSHO) printf-equivalent. I refer to this in my accompanying essay on the Graphical Developer Environment, but this is the full-blown control with all the features I seem to need.
피드 구독하기:
글 (Atom)