'Programming'에 해당되는 글 59건
- 2009/07/07 PHP - Detects what compression file uses
- 2009/06/29 Visual C++ 6 Unleashed
- 2009/05/14 C# : Unit Class - File Size
- 2009/04/10 C# - Length unit class , 길이 관련 클래스
- 2009/03/27 ADO.NET for SQLite
- 2009/03/24 iTunes Programming - SelectedTracks
- 2009/03/18 C#, Windows Installer 를 통한 설치 프로그램 목록 얻어오기 (2)
- 2009/03/10 Different with ArrayList, List<T> – Boxing, None Boxing
- 2009/03/02 정규표현식(Regular Expression) Href URL 캡쳐(Capture)
- 2009/02/17 스크립트에서 클라이언트 프로그램 실행 시키는 방법 (3)
유명한 MySQL 관리 툴이죠. phpMyAdmin 소스를 보던 중 좋은 내용을 발췌합니다.
libraries\import.lib.php 파일에 있던 내용이고요.
코드는 아래와 같습니다.
/**
* Detects what compression filse uses
*
* @param string filename to check
* @return string MIME type of compression, none for none
* @access public
*/
function PMA_detectCompression($filepath)
{
$file = @fopen($filepath, 'rb');
if (!$file) {
return FALSE;
}
$test = fread($file, 4);
$len = strlen($test);
fclose($file);
if ($len >= 2 && $test[0] == chr(31) && $test[1] == chr(139)) {
return 'application/gzip';
}
if ($len >= 3 && substr($test, 0, 3) == 'BZh') {
return 'application/bzip2';
}
if ($len >= 4 && $test == "PK\003\004") {
return 'application/zip';
}
return 'none';
}
'Program > PHP' 카테고리의 다른 글
| PHP - Detects what compression file uses (0) | 2009/07/07 |
|---|---|
| PHP on IIS 7.0, 6.0, 5.1 with Fast CGI (0) | 2009/02/01 |
| PHP : natsort() Natural order sorting 로 숫자를 제대로 정렬 (0) | 2007/05/25 |
| PHP 성능 최적화를 위한 방향 (0) | 2007/05/22 |
간만에 정말 유용한 사이트를 찾은 것 같다.
뭐 자주 볼일은 없는 C++ 이지만,
Visual C++ 6 관련된 내용을 보게 된다면 거의 바이블이나 마찬가지인 사이트이다.
정말 내용이 방대한 -_ -;;
책을 안가지고 계시다면!!
여기를 한번 보면 좋을듯 후훗~
(아래 링크들은 Shift + Click 으로 봐주시길 ^ ^)
http://www.informit.com/library/
http://www.informit.com/library/library.aspx?b=Visual_C_PlusPlus
Visual C++ 6 Unleashed
Visual C++ 6 Unleashed provides comprehensive coverage of the core topics for Visual C++ 6 programming. This book skips the beginning level material and jumps right in to Visual C++.
Table of Contents
Copyright
About the Authors
About the Contributors
Acknowledgments
Tell Us What You Think!
Introduction
How to Use This Book
What You Need to Use This Book
What's New in Visual C++ 6.0
Contacting the Main Author
Part I: Introduction
Chapter 1. The Visual C++ 6.0 Environment
Part II: MFC Programming
Chapter 2. MFC Class Library Overview
Chapter 3. MFC Message Handling Mechanism
Chapter 4. The Document View Architecture
Chapter 5. Creating and Using Dialog Boxes
Chapter 6. Working with Device Contexts and GDI Objects
Chapter 7. Creating and Using Property Sheets
Chapter 8. Working with the File System
Chapter 9. Using Serialization with File and Archive Objects
Part III: Internet Programming with MFC
Chapter 10. MFC and the Internet Server API (ISAPI)
Chapter 11. The WinInet API
Chapter 12. MFC HTML Support
Part IV: Advanced Programming Topics
Chapter 13. Using the Standard C++ Library
Chapter 14. Error Detection and Exception Handling Techniques
Chapter 15. Debugging and Profiling Strategies
Chapter 16. Multithreading
Chapter 17. Using Scripting and Other Tools to Automate the Visual C++ IDE
Part V: Database Programming
Chapter 18. Creating Custom AppWizards
Chapter 19. Database Overview
Chapter 20. ODBC Programming
Chapter 21. MFC Database Classes
Chapter 22. Using OLE DB
Chapter 23. Programming with ADO
Part VI: MFC Support for COM and ActiveX
Chapter 24. Overview of COM and Active Technologies
Chapter 25. Active Documents
Chapter 26. Active Containers
Chapter 27. Active Servers
Chapter 28. ActiveX Controls
Part VII: Using the Active Template Library
Chapter 29. ATL Architecture
Chapter 30. Creating COM Objects Using ATL
Chapter 31. Creating ActiveX Controls Using ATL
Chapter 32. Using ATL to Create MTS and COM+ Components
Part VIII: Finishing Touches
Chapter 33. Adding Windows Help
Part IX: Appendix
'Program' 카테고리의 다른 글
| Your files are always in sync - DropBox.com (0) | 2009/10/10 |
|---|---|
| Visual C++ 6 Unleashed (0) | 2009/06/29 |
| Visual Studio에서 " " 따옴표로 묶은 문자열만 잡기 (0) | 2009/02/13 |
| Editplus의 정규표현식 사용 문자열 바꾸기 (1) | 2009/02/13 |
| Visual Studio Add-in CopySourceAsHtml (0) | 2008/04/15 |
| Windows RSS Platform (0) | 2008/04/07 |
이전에 올렸던 Length 단위에 이어 두번째 File Size 관련된 단위입니다.
귀찮았는데 막상 파일사이즈를 보여야 할 일이 있어서
간단히 Property 를 이용해서 작성해 봤네요.
C# 프로퍼티(Property)의 가장 적절한 예가 아닌가 생각됩니다. ㅋㅋㅋ
class FileSize
{
public enum UNITS { B, KB, MB, GB, TB }
double b = 0;
double kb = 0;
double mb = 0;
double gb = 0;
double tb = 0;
public double B
{
get
{
return this.b;
}
set
{
this.b = value;
this.kb = this.b / 1024;
this.mb = this.kb / 1024;
this.gb = this.mb / 1024;
this.tb = this.gb / 1024;
}
}
public double KB
{
get
{
return this.kb;
}
set
{
this.kb = value;
this.B = this.kb * 1024;
}
}
public double MB
{
get
{
return this.mb;
}
set
{
this.mb = value;
this.KB = this.mb * 1024;
}
}
public double GB
{
get
{
return this.gb;
}
set
{
this.gb = value;
this.MB = this.gb * 1024;
}
}
public double TB
{
get
{
return this.tb;
}
set
{
this.tb = value;
this.GB = this.tb * 1024;
}
}
public FileSize(double size)
{
this.B = size;
}
public override string ToString()
{
string ret = string.Empty;
if (b < 1024D)
{
ret = string.Format("{0}{1}", b, UNITS.B.ToString());
}
else if (kb < 1024D)
{
ret = string.Format("{0}{1}", kb, UNITS.KB.ToString());
}
else if (mb < 1024D)
{
ret = string.Format("{0}{1}", mb, UNITS.MB.ToString());
}
else if (gb < 1024D)
{
ret = string.Format("{0}{1}", gb, UNITS.GB.ToString());
}
else
{
ret = string.Format("{0}{1}", tb, UNITS.TB.ToString());
}
return ret;
}
}
'.NET > C#' 카테고리의 다른 글
| Windows Service Debugging (0) | 2009/10/21 |
|---|---|
| Unicode 한글 코드 표 (0) | 2009/09/27 |
| C# : Unit Class - File Size (0) | 2009/05/14 |
| Memory usage of current thread on C# windows form app. (0) | 2009/04/23 |
| C# : TextBox Auto Scrolling (2) | 2009/04/20 |
| Better string.IsNullOrEmpty() ? How to do C#.NET 3.0 (0) | 2009/04/14 |
CodeProject에 올라온 코드를 보던 중 유용한 클래스를 발견했다.
딱 보아도 한눈에 알 수 있는 길이 관련된 클래스
원본 길이 단위의 값을 넣고, 원하는 길위 단위로 값을 읽어오기만하면, 길이를 원하는 형식으로 변경할 수 있다.
꽤 유용하게 써먹을 듯?? 훗~
public class Length
{
public enum UNITS{FEET=0,KM,METER,MILES}
private double meter = 0;
private double km = 0;
private double ft = 0;
private double miles = 0;
public double Meter
{
get
{
return this.meter;
}
set
{
this.meter=value;
this.km=this.meter/1000;
this.ft=this.meter*3.2808;
this.miles=this.meter*6.2e-4;
}
}
public double Km
{
get
{
return this.km;
}
set
{
this.km=value;
this.Meter=this.km*1000;
}
}
public double Ft
{
get
{
return this.ft;
}
set
{
this.ft=value;
this.Meter=this.ft/3.2808;
}
}
public double Miles
{
get
{
return this.miles;
}
set
{
this.miles=value;
this.meter=this.miles/6.2e-4;
}
}
}
'.NET > C#' 카테고리의 다른 글
| C# : TextBox Auto Scrolling (2) | 2009/04/20 |
|---|---|
| Better string.IsNullOrEmpty() ? How to do C#.NET 3.0 (0) | 2009/04/14 |
| C# - Length unit class , 길이 관련 클래스 (0) | 2009/04/10 |
| Error Handling Guide - Rethrow to preserve stack details (0) | 2009/04/03 |
| 훈스 C# 스터디 5주차 - CLR의 동작 , 메모리 관리, Boxing, UnBoxing, Generic (0) | 2009/03/11 |
| Different with ArrayList, List<T> – Boxing, None Boxing (0) | 2009/03/10 |
SQLite는 일반적으로 PHP 등에서 먼저 채택해서 많이 알려준 Database인데요
.NET C# 에서도 소형의 Database 면서 강력한 SQLite DB를 사용하려면 어떻게 해야할지 갑자기 궁금증이 생겨서 찾아봤더니 위와 같은 주소가 있더군요.
두 링크는 각각 다른 역할 입니다.
먼저 첫번째 ADO.NET 2.0 Provider for SQLite는 .NET 환경에서 SQLite를 이용하여 개발하기 위한 Provider 고요.
ADO를 통해서 SQLite에 접속하려면 이 Provider가 있어야 가능하겠죠.
그리고 두번째 링크는 필수 항목은 아니지만 SQLite를 조금 더 편하게 사용하기 위한 Wrapper Library입니다.
ADO.NET을 이용해서 DB는 필요한데 부담스러운 경우가 많죠.
사용자 환경에 데이터가 저장되어야 하는 가계부나 일기장 이런 프로그램은 확실히 사용자 환경에 DB가 있어야 할겁니다.
기존에 Access에서 이용하던 MDB같은 좋은 애들도 있지만 MDB 보안 문제 등 문제점도 있어서 MDB를 이용하지 않고 SQLite를 이용해 보는것도 좋을 것 같네요.
뭐 아직 저도 SQLite를 이용한 개발은 안해봤지만요 -_ -;;
나중에 위 자료를 이용한 개발을 하게되면 테스트 예제를 별도로 포스팅 하도록 하고 이만 마칩니다.
'.NET > ADO.NET' 카테고리의 다른 글
| ADO.NET for SQLite (0) | 2009/03/27 |
|---|---|
| LINQ to SQL Debug Visualizer (0) | 2007/08/08 |
.NET 환경은 Visual Studio에서 interupt.iTunesLib 을 참조에 추가하면
public interface IiTunes
위와 같은 인터페이스를 찾을 수 있다.
이 인터페이스 안에서 다양한 iTunes 관련 컨트롤을 할 수 있으며,
public virtual IITTrackCollection iTunesLib.IiTunes.SelectedTracks
위와 같은 속성을 통해서 iTune에서 선택한 트랙들을 가져올 수 있다.
'.NET' 카테고리의 다른 글
| iTunes Programming - SelectedTracks (0) | 2009/03/24 |
|---|---|
| DevPia 에서 스크랩한 링크들 (0) | 2009/02/12 |
| 고품질 코드 작성 (0) | 2008/04/18 |
| MS Heros Happen here 세미나 자료 (0) | 2008/04/10 |
| VS Setup Project - 설치 배포 패키지 제작 (0) | 2007/12/21 |
| Visual Studio 2008 and .NET Framework 3.5 Training Kit (0) | 2007/12/19 |
저랑 비슷한 고민을 하신분이 있군요. ㅎㅎ
이 분은 C#으로 Windows Installer 의 설치 프로그램 목록을 얻어오는 코드를 작성하셨네요.
저는 어제 작성한
" 2009/03/17 - [OS] - MSI파일의 ProductCode 얻기 - How to find the ProductCode .MSI for uninstall "
글에서 VBS 스크립트 파일로 MSI 파일의 ProductCode를 얻어오는 방법을 찾았거든요.
MSI 파일의 ProductCode를 얻으려고 하는 이유는 일단 MSI 파일의 ProductCode는 GUID 값을 가지고 있는데요.
MsiExec.exe /x {9CAEFF6D-8A27-48F4-8340-509F6A248CAD}
위와 같은 형식으로 제어할 수 있기 때문에 ProductCode가 필요한 것이죠.
참고하세요~!
'System > OS' 카테고리의 다른 글
| AMD-V Hyper-V System Compatibility Check Utillity 1.0 (0) | 2010/02/18 |
|---|---|
| Install Windows 7 via USB Drive (0) | 2009/09/21 |
| C#, Windows Installer 를 통한 설치 프로그램 목록 얻어오기 (2) | 2009/03/18 |
| MSI파일의 ProductCode 얻기 - How to find the ProductCode .MSI for uninstall (0) | 2009/03/17 |
| ASCII Code - 아스키 코드 표 (0) | 2009/03/06 |
| 리눅스에서 VMPlayer로 윈도우 띄우기 (3) | 2008/07/21 |
-
youngjr 2009/05/15 13:08
저도 윈도우에서 설치 프로그램 목록을 얻어오는 함수를 찾고 있었는데, 여러 방법이 있는 것 같네요. 저는 제거가 목적이 아니라, 설치된 프로그램 이름과 버전 정보 등이 필요해서요. 좋은 팁 잘 보고 갑니다.
Different with ArrayList, List<T> – Boxing, None Boxing

example source project :
BoxingTest.zip |
ArrayList는 값을 object형식으로 방식해서 받게 되어 모든 타입을 담을 수 있다.
하지만 Boxing이 일어나는데 이러한 빈번한 Boxing을 막기 위해 우리는 Generic에 있는 List<type>을 이용한다.
다음은 Boxing처리되는 ArrayList와 Boxing되지 않는 Generic List<>의 비교를 보도록 한다.
Boxing 되는 예 (ArrayList.Add(object))
Boxing 되지 않는 예 (List<RGB>.Add(RGB))
실행 결과
실행 결과 대략적으로 6배 정도의 속도 차이를 보인다.
예제 소스
using System;
using System.Collections;
using System.Collections.Generic;
namespace BoxingTest
{
struct RGB
{
public int red;
public int green;
public int blue;
public RGB(int red, int green, int blue)
{
this.red = red;
this.green = green;
this.blue = blue;
}
public override string ToString()
{
return red.ToString("X") + green.ToString("X") + blue.ToString("X");
}
}
class Program
{
static ArrayList boxValue;
static List<RGB> noBoxValue;
static void Main(string[] args)
{
DateTime start;
DateTime middle;
TimeSpan end;
RGB rgb = new RGB(255, 255, 255);
#region None Boxing
Console.WriteLine("박싱되지 않는 List<RGB>.Add(RGB)");
noBoxValue = new List<RGB>();
start = DateTime.Now;
for (int i = 0; i < 10000000; i++)
noBoxValue.Add(rgb);
middle = DateTime.Now;
end = middle - start;
Console.WriteLine("시작 = {0}, 끝 = {1}, 경과시간 = {2}", start.ToString("hh:mm:ss"),
middle.ToString("hh:mm:ss"),
end.ToString());
#endregion
#region Boxing
Console.WriteLine("박싱되는 ArrayList.Add(object)");
boxValue = new ArrayList();
start = DateTime.Now;
for (int i = 0; i < 10000000; i++)
boxValue.Add(rgb);
middle = DateTime.Now;
end = middle - start;
Console.WriteLine("시작 = {0}, 끝 = {1}, 경과시간 = {2}", start.ToString("hh:mm:ss"),
middle.ToString("hh:mm:ss"),
end.ToString());
#endregion
}
}
}
'.NET > C#' 카테고리의 다른 글
| Error Handling Guide - Rethrow to preserve stack details (0) | 2009/04/03 |
|---|---|
| 훈스 C# 스터디 5주차 - CLR의 동작 , 메모리 관리, Boxing, UnBoxing, Generic (0) | 2009/03/11 |
| Different with ArrayList, List<T> – Boxing, None Boxing (0) | 2009/03/10 |
| 정규표현식(Regular Expression) Href URL 캡쳐(Capture) (0) | 2009/03/02 |
| 여러줄을 한번에 StringBuilder로 감싸는 방법~! - Editplus 정규표현식, 바꾸기 기능 (2) | 2009/02/26 |
| [Hoons C# 스터디 2009 1기] 3주차 세미나 / 발표 내용 정리 (2) | 2009/02/25 |
참고 주소
http://hoons.kr/Board.aspx?Name=QACSHAP&Mode=2&BoardIdx=20596&Key=&Value=
http://phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=32231
이 글은 먼저 훈스닷넷(hoons.kr)에 질문으로 올라온 글 덕에 작성해본 코드이고요.
정규표현식(Regular Expression)을 이용해 HTML의 링크에 해당하는 <a href="..." 형태의 URL 부분만 받아오도록 처리하는 방법을 아래 코드로 요약해봅니다.
자세한 주석의 설명은 없지만, () 괄호로 구분되는 정규표현식 테그로 치환되는 값들을 유심히 살펴보시면 됩니다.
주석에 나와 있는 숫자 설명은
붉은색으로 강조해 둔 부분에 들어갈 값을 설명한 내용이에요~
(PS. 첨부된 파일은 테스트용 전체 소스에요)
/// <summary>
/// URL을 뽑아온다
/// 0:Link
/// 1:host.domain (FQDN)
/// 2:protocol
/// 3:domain extension (.net, .co.kr, .com ...)
/// 4:port
/// </summary>
/// <param name="strHtml"></param>
/// <returns></returns>
private List<string> GetHrefs(string strHtml)
{
List<string> urlList = new List<string>();
Regex r;
Match m;
// ref. url http://phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=32231
string pattern = string.Empty;
pattern += @"((http|https|ftp|mms):\/\/[0-9a-z-]+(\.[_0-9a-z-]+)+(:[0-9]{2,4})?\/?)"; // domain+port
pattern += @"([\.~_0-9a-z-]+\/?)*"; // sub roots or sub directory
pattern += @"(\S+\.[_0-9a-z]+\??)?"; // file & extension string
pattern += @"([_0-9a-z#&=-]+)*"; // parameter
r = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled);
for (m = r.Match(strHtml); m.Success; m = m.NextMatch())
{
if (string.IsNullOrEmpty(m.Groups[0].Value))
continue;
urlList.Add(m.Groups[0].Value);
}
return urlList;
}
'.NET > C#' 카테고리의 다른 글
| 훈스 C# 스터디 5주차 - CLR의 동작 , 메모리 관리, Boxing, UnBoxing, Generic (0) | 2009/03/11 |
|---|---|
| Different with ArrayList, List<T> – Boxing, None Boxing (0) | 2009/03/10 |
| 정규표현식(Regular Expression) Href URL 캡쳐(Capture) (0) | 2009/03/02 |
| 여러줄을 한번에 StringBuilder로 감싸는 방법~! - Editplus 정규표현식, 바꾸기 기능 (2) | 2009/02/26 |
| [Hoons C# 스터디 2009 1기] 3주차 세미나 / 발표 내용 정리 (2) | 2009/02/25 |
| Use WebBrowser and shdocvw.dll for POST Data sending (0) | 2009/02/16 |
일단 이건 MS IE 전용이라는 가정이 있어야하고 -_ -;
먼저 클라이언트에 "C:\winetc\eMule\emule.exe" 파일(실행파일)이 있다고 가정한다.
보안문제가 발생할 수 있으므로, "신뢰할 수 있는 사이트"에 등록되어 있어야 사용 가능한 스크립트입니다.
작성 HTML
과연 써먹을 구석이 있긴 한걸지 -_ -;;<html>
<head><head>
<script language="javascript">
function aa()
{
var objWSH = new ActiveXObject("WScript.Shell");
var retval = objWSH.Run("C:\\winetc\\eMule\\emule.exe",1,true);
}
</script><body>
<input type="button" name="test" onclick="aa();">
</body>
</html>
그래도..
HTA application(MSDN을 찾아보시길;)을 만든다면 써먹지 않을지 생각된다;
'Web > JavaScript' 카테고리의 다른 글
| Javascript : Microsoft OS & Internet Explorer Agent Check (0) | 2009/07/20 |
|---|---|
| Javascript – 이벤트 추가 (0) | 2009/05/08 |
| 스크립트에서 클라이언트 프로그램 실행 시키는 방법 (3) | 2009/02/17 |
| [js]브라우저의 오른쪽 상단의 X표시를 누르거나 창을 닫을때 이벤트 잡기! (1) | 2009/01/05 |
| DHTML을 빠르게 하는 12가지 튜닝 (0) | 2008/07/14 |
| 다양한 HTML 소스복사 / 마우스 우클릭 방지 모음 (0) | 2008/05/23 |
-
JKwang 2009/04/23 23:31
질문있습니다만.위와같이 하면 "자동화 서버는 개체를 작성할 수 없습니다."라고 자바스크립트 에러가 나오는데 해결방안이 있는지요???
신뢰할수있는싸이트에 등록해주었고 로컬이랑 인터넷 영역에 안전하지않은 스크립팅~~~ 사용으로 해주었습니다.ㅠ_ㅠ;;-
써니루루 2009/04/24 02:51
마지막줄에 적어둔 내용대로 웹 페이지 상에서는 스크립트 권한 문제로 사용하지 못하는 경우가 많습니다.
그래서 HTA 프로그램 등에만 사용하셔야할 것 같습니다.
위 코드를 응용해서 *.hta 확장자로 windows 로컬에서만 작동하는 프로그램을 개발할 때 유용하죠.
일반적으로 CD에 들어있는 autorun에 실행될 설치 페이지나 cd 목록 페이지를 만들때 자주 사용되는 *.hta에 적용하기 좋은 내용입니다.
-
이올린에 북마크하기
이올린에 추천하기
BoxingTest.zip
Prev




