- 2009/10/23 볼륨일련번호 (VolumeID) 변경하기 (1)
- 2009/10/19 바탕 화면 보기 생성. (1)
- 2009/10/19 Windows 7 빠른 실행 (Quick Launch)
- 2009/10/18 Windows 7 XPMode (1)
- 2009/10/15 CodeIgniter paging plug-in
- 2009/09/24 ietoy ie 8 지원 (1)
- 2009/09/23 SeLinux httpd use nfs files
- 2009/09/23 XenServer XenCenter
- 2009/09/22 SeLinux 관련 펌
- 2009/09/22 CentOS 서비스 목록 참조
LazyDreamy » Search » Results » Articles
Computer와 관련된 글 42개
LazyDreamy » Computer/Programming
C CRC16, CRC32, CRC-CCITT
드림 | 2010/03/08 22:48
LazyDreamy » Computer/Programming
.NET Socket Programming (for data arriving event)
드림 | 2010/03/07 23:09
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Text' State object for receiving data from remote device.
Public Class StateObject
' Client socket.
Public workSocket As Socket = Nothing
' Size of receive buffer.
Public Const BufferSize As Integer = 256
' Receive buffer.
Public buffer(BufferSize) As Byte
' Received data string.
Public sb As New StringBuilder
End Class 'StateObjectPublic Class AsynchronousClient
' The port number for the remote device.
Private Const port As Integer = 11000' ManualResetEvent instances signal completion.
Private Shared connectDone As New ManualResetEvent(False)
Private Shared sendDone As New ManualResetEvent(False)
Private Shared receiveDone As New ManualResetEvent(False)' The response from the remote device.
Private Shared response As String = String.EmptyPublic Shared Sub Main()
' Establish the remote endpoint for the socket.
' For this example use local machine.
Dim ipHostInfo As IPHostEntry = Dns.Resolve(Dns.GetHostName())
Dim ipAddress As IPAddress = ipHostInfo.AddressList(0)
Dim remoteEP As New IPEndPoint(ipAddress, port)' Create a TCP/IP socket.
Dim client As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)' Connect to the remote endpoint.
client.BeginConnect(remoteEP, New AsyncCallback(AddressOf ConnectCallback), client)' Wait for connect.
connectDone.WaitOne()' Send test data to the remote device.
Send(client, "This is a test<EOF>")
sendDone.WaitOne()' Receive the response from the remote device.
Receive(client)
receiveDone.WaitOne()' Write the response to the console.
Console.WriteLine("Response received : {0}", response)' Release the socket.
client.Shutdown(SocketShutdown.Both)
client.Close()
End Sub 'MainPrivate Shared Sub ConnectCallback(ByVal ar As IAsyncResult)
' Retrieve the socket from the state object.
Dim client As Socket = CType(ar.AsyncState, Socket)' Complete the connection.
client.EndConnect(ar)Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint.ToString())
' Signal that the connection has been made.
connectDone.Set()
End Sub 'ConnectCallbackPrivate Shared Sub Receive(ByVal client As Socket)
' Create the state object.
Dim state As New StateObject
state.workSocket = client' Begin receiving the data from the remote device.
client.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, New AsyncCallback(AddressOf ReceiveCallback), state)
End Sub 'ReceivePrivate Shared Sub ReceiveCallback(ByVal ar As IAsyncResult)
' Retrieve the state object and the client socket
' from the asynchronous state object.
Dim state As StateObject = CType(ar.AsyncState, StateObject)
Dim client As Socket = state.workSocket' Read data from the remote device.
Dim bytesRead As Integer = client.EndReceive(ar)If bytesRead > 0 Then
' There might be more data, so store the data received so far.
state.sb.Append(Encoding.ASCII.GetString(state.buffer, 0, bytesRead))' Get the rest of the data.
client.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, New AsyncCallback(AddressOf ReceiveCallback), state)
Else
' All the data has arrived; put it in response.
If state.sb.Length > 1 Then
response = state.sb.ToString()
End If
' Signal that all bytes have been received.
receiveDone.Set()
End If
End Sub 'ReceiveCallbackPrivate Shared Sub Send(ByVal client As Socket, ByVal data As String)
' Convert the string data to byte data using ASCII encoding.
Dim byteData As Byte() = Encoding.ASCII.GetBytes(data)' Begin sending the data to the remote device.
client.BeginSend(byteData, 0, byteData.Length, 0, New AsyncCallback(AddressOf SendCallback), client)
End Sub 'SendPrivate Shared Sub SendCallback(ByVal ar As IAsyncResult)
' Retrieve the socket from the state object.
Dim client As Socket = CType(ar.AsyncState, Socket)' Complete sending the data to the remote device.
Dim bytesSent As Integer = client.EndSend(ar)
Console.WriteLine("Sent {0} bytes to server.", bytesSent)' Signal that all bytes have been sent.
sendDone.Set()
End Sub 'SendCallback
End Class 'AsynchronousClient
출처 : http://msdn.microsoft.com/en-us/library/bew39x2a.aspx
winsock 을 강제로 사용하지 않고, .net 내장 함수를 사용하려고 찾다 보니 소켓 이벤트 형태를 지원한다.
LazyDreamy » Computer/Programming
Windows 7 mscomm32.ocx , mswinsck.ocx 사용하기
드림 | 2010/02/27 10:09
뭐..;; 하다보면 아직 구버전으로 개발된 것들이 있어서 테스트 하기위해 돌려보면 ocx 파일 로딩 에러가 납니다.
windows 7 에서는 해당 파일을 구해서 windows\sysWOW64 에 넣고 등록하면 정상적으로 동작합니다.
간단히 정리하면
1. ocx 파일을 windows\sysWOW64 에 복사
2. regsvr32 windows\sysWOW64\ocx파일명
그외에 필요하면 dll 파일은 system32 에 두면 됩니다.
추가 -
sysWOW64 가 어떤 부분을 지원하는 것인가 찾아보니까
64비트 운영체제의 경우 system32 에 64비트 라이브러리가 들어가고 32비트 라이브러리는 sysWOW64 에 위치한다고합니다.
아마 운영체제가 32비트 일 경우 ocx 파일의 위치와 로딩은 system32 에서 하는 것이 맞다고 생각됩니다.
해당 부분은 windows7 64비트를 기준으로 작성되었습니다.
참고 url : http://www.sevenforums.com/drivers/47248-mscomm32.html
LazyDreamy » Computer/Programming
php pear mail with gmail smtp
드림 | 2010/02/24 15:34
<?php
require_once('Mail.php');
require_once('Mail/mime.php');$to = 'who@mail.com';
$htmlBody = '<b>mail test with tag~</b>';
$headers = array(
'To' => '"who" <'.$to.'>',
'From' => '"me" <username@gmail.com>',
'Subject' => 'email subject',
);$mime = new Mail_mime();
$mime->setHTMLBody($htmlBody);
$mime->_build_params = array(
'head_encoding' => 'base64',
'text_encoding' => 'base64',
'html_encoding' => 'base64',
'7bit_wrap' => 998,
'html_charset' => 'UTF-8',
'text_charset' => 'UTF-8',
'head_charset' => 'UTF-8'
);$body = $mime->get();
$headers = $mime->headers($headers);$params['host'] = 'ssl://smtp.googlemail.com';
$params['port'] = '465';
$params['auth'] = true;
$params['username'] = 'username';
$params['password'] = 'password';
$params['debug'] = true;$mail_object =& Mail::factory('smtp', $params);
$mail_object->send($to, $headers, $body);
?>
엑스페리아 음악 감상 삽질
드림 | 2010/02/07 16:21
# Made by Estrella
# For MS-SMS# 현재 문자음 상태 저장
sms_vol=RegRead("HKLM", "Software\BTBApps\MMSC\Conf\Alarm", "Bell")
ms_vol=RegRead("HKCU", "ControlPanel\Notifications\{A877D65B-239C-47a7-9304-0D347F580408}", "Options")
phone_vol=RegRead("HKCU", "ControlPanel\Sounds\RingTone0", "Script")changed=RegRead("HKCU", "ControlPanel\VolumeOld", changed)
SetSound="My Documents\SetSound.exe"
#무한 반복
While(1)#이어폰 삽입시 진동 활성화
If(RegRead("HKLM", "System\State\Hardware", "Headset") EQ 1)if(changed=1)
#
else
# 문자수신음 진동으로 변경
RegWriteDWord("HKLM", "Software\BTBApps\MMSC\Conf\Alarm", "Bell", "4")
RegWriteDWord("HKCU", "ControlPanel\Notifications\{A877D65B-239C-47a7-9304-0D347F580408}", "Options", "14")
RegWriteString("HKCU", "ControlPanel\Sounds\RingTone0", "Script", "av3w3r")# 진동일 경우
old_mode=RegRead("HKCU", "ControlPanel\Notifications\ShellOverrides", "Mode")
if(old_mode=1)
RegWriteDWord("HKCU", "ControlPanel\VolumeOld", "old_mode", old_mode)
else
RegWriteDWord("HKCU", "ControlPanel\VolumeOld", "old_mode", 0)
endif
SetVolume(18)changed=1
RegWriteDWord("HKCU", "ControlPanel\VolumeOld", "changed", changed)
endif#이어폰 제거시 진동 비활성화
elseif(changed=1)
# 문자수신음 본래 값 복원
RegWriteDWord("HKLM", "Software\BTBApps\MMSC\Conf\Alarm", "Bell", sms_vol)
RegWriteDWord("HKCU", "ControlPanel\Notifications\{A877D65B-239C-47a7-9304-0D347F580408}", "Options", ms_vol)
RegWriteString("HKCU", "ControlPanel\Sounds\RingTone0", "Script", phone_vol)old_mode=RegRead("HKCU", "ControlPanel\VolumeOld", "old_mode")
if(old_mode=1)
SetVolume(153)
Run(SetSound,"-setvibrate")
else
SetVolume(153)
Run(SetSound,"-setringeron")
endifchanged=0
RegWriteDWord("HKCU", "ControlPanel\VolumeOld", "changed", changed)
else
#
endifendif
#2초마다 레지스트리값 갱신
sleep(2000)
EndWhile
* MortScript 4.2 필요
네이버 스마트폰 카페 Estrella 님이 올려둔 스크립트를 기반으로 수정.
WM (Windows Mobile) 의 고질적인 문제가 진동 설정 시 이어폰을 꼽아도 해당 이어폰으로 소리를 들을 수 없다는 점이다. 일단 두가지 모드를 기준으로 수정했고, 진동모드인지 벨소리모드인지를 확인해서 동작한다.
기능
- 이어폰을 꼽게되면 벨소리 / 문자 소리가 전부 진동으로 설정된다.
- 진동 모드일 경우에도 이어폰을 꼽게되면 진동 + 음악감상이 가능한 상태로 세팅된다.
- 이어폰을 뽑게되면 기존 모드로 돌아간다. 단.. 이전 볼륨을 가져오려고 했으나, 소스가 좀 꼬여서 일단 중단하고 강제 설정으로 수정했다.
참고 및 문제점
엑스페리아의 볼륨은 0 ~ 16843009 * 255 까지 설정 가능하다. (각 모델별로 레지스트리에 써지는 값이 틀리다.
모트스크립트의 SetVolume 은 동작이 좀 묘연하다. WM 에는 크게 2개의 볼륨 (벨소리 / 시스템) 이 있는데 두개를 나눠서 조절 할수가 없다.
단순히 레지스트리 저장만 가지고는 동작에 영향이 바로 오지 않았다. (sdk 를 봐야 할 듯)
벨소리 / 진동처리를 명확히하기위해 외부 프로그램 (SetSound.exe) 를 사용했다.
볼륨일련번호 (VolumeID) 변경하기
드림 | 2009/10/23 10:45
volumeid 라는 툴을 사용하여 변경한다.
우선 원래 볼륨 확인
C:\VolumeId>vol d:
D 드라이브의 볼륨: data
볼륨 일련 번호: 889D-128B
원하는 볼륨 변경
C:\VolumeId>Volumeid.exe d: 889F-129C
VolumeID V2.01 - Set disk volume id
Copyright (C) 1997-1999 Mark Russinovich
Sysinternals - www.sysinternals.comVolume ID for drive d: updated to 889f-129c
다시 확인
C:\VolumeId>vol d:
D 드라이브의 볼륨: data
볼륨 일련 번호: 889D-128B
FAT 는 바로 적용된다고 하는데, NTFS 는 리붓 후에 적용된다 리붓 후 재확인.
C:\Users\dev>vol d:
D 드라이브의 볼륨: data
볼륨 일련 번호: 889F-129C
툴 다운로드 : http://technet.microsoft.com/ko-kr/sysinternals/bb545046(en-us).aspx
바탕 화면 보기 생성.
드림 | 2009/10/19 21:01
뭐 요건 꼭 Windows 7 용은 아니다. 다만 같은 방법이 Windows 7 에도 적용된다.
종종 빠른 실행에서 바탕화면 보기가 삭제되거나 하는데 이런 경우, 해당 파일을 가져와서 복사해도 된다. (xp, vista, 7 동일) 뭐 그럴 수 없다면 메모장이나 텍스트 에디터를 사용해 간단하게 만들 수 있다.
[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop
내용을 기입하고 바탕화면보기.scf 로 저장하면 된다.
* Windows 7 에는 테스트 바 끝에 살짝 튀어나온 부분에서 바탕 화면 보기, 바탕 화면 미리보기가 가능하다.
Windows 7 빠른 실행 (Quick Launch)
드림 | 2009/10/19 20:58
Windows 7 부터 Vista 까지 지원하던 빠른 실행이 슬며시 빠졌다. (나름 잘 쓰던 기능;)
테스크 바에 넣어서 그룹으로 사용하는 것도 좋지만, 탐색기와 익스를 여러개 열어야 되는 상황에선 불편한 점이 있었다.

새 도구 모음 –> 적절한 위치에 폴더 하나를 생성해서 연결
해당 폴더의 내용이 빠른 실행으로 나온다. 텍스트 표시 해제, 제목 표시 해제, 보기 –> 작은 아이콘
margin 을 제외하고는 기존의 빠른 연결(quick launch) 와 유사하다.
Windows 7 XPMode
드림 | 2009/10/18 21:00
Windows 7 에서는 결국 마지막 호환성을 위해 XP 를 포용했습니다. ( - -);
VirtualBOX 등에서 제공하는 기능인데, VPC 를 띄우고 해당 어플리케이션을 심리스모드로 돌리는 것 까지 지원합니다.
1. VPC 설치
2. XPMODE 설치
3. XPMODE 안에서 ko_rail_qfe_for_windows_xp_sp3_x86_439642 패치 설치
순서로 설치하면 설치 완료.
심리스 모드 설정은 간단하다 XPMODE 안에 들어가서
시작 버튼에서 오른쪽 클릭 (열기 – All User)
해당 폴더 안에 연동을 원하는 프로그램 바로가기 저장.
아이콘 확인 및 해당 아이콘을 사용하여 심리스 모드로 실행.






CRC.C


VB6KO.dll















