본문 바로가기

전체 글165

[vb6.0/vba] 쿠팡 상품 크롤링 Sub 검색() '/****************** 기존코드 Dim s As Shape For Each s In ActiveSheet.Shapes Debug.Print s.Name If s.Name = "이미지" Then s.Delete Next Range("5:10000").ClearContents '/****************** 0 Then sNodeName = sNodeNameIndex lNodeIndex = 1 Else sXPathArray = Split(sNodeNameIndex, "[") sNodeName = sXPathArray(0) lNodeIndex = CLng(Left(sXPathArray(1), Len(sXPathArray(1)) - 1)) End If sRestOfXPath .. 2023. 3. 11.
[vb6.0/vba] 파일명에서 사용할 수 없는 텍스트(파일명) 치환함수 Function changeFileName(txt) s = txt s = Replace(s, "\", "_") s = Replace(s, "/", "_") s = Replace(s, ":", "_") s = Replace(s, "*", "_") s = Replace(s, "?", "_") s = Replace(s, """", "_") s = Replace(s, "", "_") s = Replace(s, "|", "_") changeFileName = s End Function 2023. 3. 11.
[vb6.0/vba] WinHttp를 이용한 파일 다운로드 downloadFile 함수 Function downloadFile(URL, localPath) As String On Error GoTo goErr Set winhttp = CreateObject("WinHttp.WinHttpRequest.5.1") winhttp.Open "GET", URL, False winhttp.Send Set objStream = CreateObject("ADODB.Stream") objStream.Open objStream.Type = 1 objStream.Write winhttp.responseBody objStream.SaveToFile localPath, 2 objStream.Close Exit Function goErr: downloadFile = Err.Description End Function 2023. 3. 11.
[vb6.0/vba] htmlfile(MSHTML.HTMLDocument) 를 이용한 스크립트를 통한 encode / decode Function encode(str) Set htmlfile = CreateObject("htmlfile") htmlfile.parentWindow.execScript "function encode(s) {return encodeURIComponent(s)}", "jscript" encode = htmlfile.parentWindow.encode(str) End Function Function decode(str) Set htmlfile = CreateObject("htmlfile") htmlfile.parentWindow.execScript "function decode(s) {return decodeURIComponent(s)}", "jscript" decode = htmlfile.parentWind.. 2023. 3. 11.
[vb.net] csv 내보내기(Export data to CSV file in VB.NET) AddHandler ts.Click, Sub(so As ToolStripMenuItem, ea As EventArgs) Dim tem As String = "급여일,사원번호,이름,부서,직책,기본급,식대,자가운전,성과급,지급액계,국민연금,건강보험,고용보험,장기요양보험,소득세,지방소득세,공제액계,차인지급액2023-03-31,202301011,홍길동,인사팀,과장,1500000,100000,0,0,1600000,100000,110000,12000,4500,3200,2500,232200,1367800" Dim fileName As String = Path.Combine(APP_USER_DATA_PATH, "salary_example.csv") My.Computer.FileSystem.WriteAllText(fil.. 2023. 2. 25.
[MySQL] A테이블에 있고, B테이블에 없는 데이터 조회 및 삭제 A테이블에 있고, B테이블에 없는 데이터 조회 SELECT A.str_id FROM chat A LEFT OUTER JOIN meeting B ON A.str_id=B.multi_key WHERE B.multi_key IS NULL; 임시테이블을 이용한 A테이블에 있고, B테이블에 없는 데이터 삭제 DELETE FROM chat WHERE str_id IN (SELECT * FROM (SELECT A.str_id FROM chat A LEFT OUTER JOIN meeting B ON A.str_id=B.multi_key WHERE B.multi_key IS NULL) AS temp_table); 2023. 2. 21.
[vb6.0/vba] 로또 6/45 번호 회차별 당첨번호 크롤링 Sub 로또645_회차별_추첨결과() Dim URL As String, IE As Object, T As String Application.ScreenUpdating = 0 Set IE = CreateObject("WinHttp.WinHttpRequest.5.1") URL = "https://dhlottery.co.kr/gameResult.do?" URL = URL & "method=allWinExel&nowPage=" URL = URL & "&drwNoStart=1&drwNoEnd=65535" With IE .Open "GET", URL .setRequestHeader "Host", "dhlottery.co.kr" .send: .waitForResponse: DoEvents T = .responseTe.. 2023. 2. 16.
[PHP] $_SERVER를 이용하여 현재 페이지의 URL 정보를 가져오는 방법 $_SERVER를 이용하여 현재 페이지의 URL 정보를 가져올 수 있다. $_SERVER[ "HTTP_HOST" ] : 도메인 $_SERVER[ "REQUEST_URI" ] : 도메인 다음 부분 $_SERVER[ "QUERY_STRING" ] : GET 방식으로 넘어온 값 $_SERVER[ "PHP_SELF" ] : 도메인 다음 부분에서 GET 방식으로 넘어온 값 제외 basename( $_SERVER[ "PHP_SELF" ] ) : 파일 이름 예를 들어 URL이 http://program1472.com/php/php.php?a=123&b=456라고 할 때, 결과는 다음과 같다. $_SERVER[ "HTTP_HOST" ] : program1472.com $_SERVER[ "REQUEST_URI" ] : .. 2022. 12. 2.
[vb.net] 다형성(가상함수) Module Module1 Sub Main() Dim objParent As ParentClass = New ChildClass objParent.GeneralFunc() objParent.OverridAbleFunc() Console.WriteLine("") Dim winarray(3) As Control winarray(0) = New Control(1, 2) winarray(1) = New Label(3, 4, "aaa") winarray(2) = New Button(1, 2) For Each c As Control In winarray If c Is Nothing Then Continue For c.DrawControl() Next Console.ReadLine() End Sub Public Cl.. 2022. 11. 30.
[vb.net] 델리 게이트(Delegate) 선언 방법과 간단한 예제 *델리 게이트(Delegate)- 대리자 로써 C 언어나 C++ 언어를 공부한 사람이라면 쉽게 접할 수 있는 함수 포인터와 비슷한 기능을 합니다. 또한 콜백 함수 기능 역할도 수행*델리 게이트 선언 방법과 간단한 예제 Public Class Form1 Delegate Function DelegateFunctionA(ByVal a As Integer, ByVal b As Integer) As Integer Delegate Function DelegateFunctionB(ByVal a As Integer) As String Delegate Sub DelegateSubA(ByVal a As Integer, ByVal b As Integer) Private Sub Button1_Click(ByVal sender.. 2022. 11. 30.
[VB.NET] 다른 응용 프로그램 실행(Run) 및 종료(Kill) 'example : 1 Dim SDP As System.Diagnostics.Process '// 응용프로그램 실행 SDP = System.Diagnostics.Process.Start(Path.Combine(Application.StartupPath, "tem.exe")) '// 프로세스 종료 SDP.Kill() 'example : 2 '// API 선언 Public Declare Function ShellExecuteA Lib "shell32.dll" ( ByVal hWnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal.. 2022. 11. 4.
[vb.net] 10진수에서 n진수 변환 2진수에서 38진수 까지 변환할 수 있는 함수입니다.39진수 이상은 사실 억지입니다. ㅎㅎ Public Function Division(ByVal number As Long, ByVal convert As Integer, Optional solution As String = "") As String Dim remainder As Integer = number Mod convert solution = ConvertToSymbol(remainder) & solution number = number / convert If number > convert Then solution = Division(number, convert, solution) Else solution = ConvertToSymbol(numbe.. 2022. 10. 28.
[vb.net] ArgumentException 클래스 / 오류(Error)를 리턴 Example: Imports System Public Class Example Private Shared Sub Main() ' Define some integers for a division operation. Dim values = {10, 7} For Each value In values Try Console.WriteLine("{0} divided by 2 is {1}", value, DivideByTwo(value)) Catch e As ArgumentException Console.WriteLine("{0}: {1}", e.GetType().Name, e.Message) End Try Console.WriteLine() Next End Sub Private Shared Function Div.. 2022. 10. 15.
[vb.net] 동적 DLL 폼 (Control) 불러오기 및 클래스 (Class) 함수 불러오기 예제 Imports System.IO Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim SRA As System.Reflection.Assembly Dim FATabStrip As Object = Nothing Dim FATabStripItem As Object = Nothing Dim Class1 As Object = Nothing Dim mt As System.Reflection.MethodInfo = Nothing SRA = System.Reflection.Assembly.LoadFile(Path.Combine(Application.StartupPath, "TabStrip.dl.. 2022. 10. 13.
[vb.net] IWebDriver chrome.exe 지정 및 user data, profile 경로 지정하기 CHROME_PATH 경로에 chrome.exe가 존재하면 chrome 경로를 설정하고 그 하위 폴더에 user_data_dir을 지정합니다.CHROME_PATH 경로에 chrome.exe가 존재하지 않으면 CHROME_PATH 가 "--user-data-dir"이 됩니다 Dim profile_path As String = nhnID Dim user_data_path As String = "" If File.Exists(Path.Combine(CHROME_PATH, "chrome.exe")) Then chromeOptions.BinaryLocation = Path.Combine(CHROME_PATH, "chrome.exe") user_data_path = CHROME_PATH & "\user_data_p.. 2022. 10. 9.
[vb.net] 마우스 드레그로 컨트롤 사이즈 변경 / 영역 사이즈 변경 Private Sub Panel_x_MouseDown(sender As Object, e As MouseEventArgs) Handles Panel9.MouseDown, Panel8.MouseDown, Panel7.MouseDown If sender Is Panel9 Then Windows.Forms.Cursor.Current = Cursors.HSplit Else Windows.Forms.Cursor.Current = Cursors.VSplit End If DirectCast(sender, Panel).Tag = {1, e.X, e.Y} End Sub Private Sub Panel_x_MouseUp(sender As Object, e As MouseEventArgs) Handles Panel9.Mou.. 2022. 10. 9.
[vb.net] Create Animated Gif Option Strict Off Imports System Imports System.Collections.Generic Imports System.Diagnostics Imports System.Text Imports System.IO Imports System.Collections Imports System.Collections.Specialized Imports System.Drawing Imports System.Drawing.Imaging Imports System.Drawing.Drawing2D Imports System.Drawing.Image Imports System.Threading Imports System.Runtime.Serialization Imports System.Window.. 2022. 10. 5.
[C#] DataGridView 홀수/짝수열 배경색 다르게 지정 for (int i = 1; i 2022. 9. 30.
[vb.net, C#] Selenium Webdriver에서 iFrame을 처리하는 방법: switchTo() WebDriver driver = new FirefoxDriver(); driver.get("http://demo.guru99.com/test/guru99home/"); driver.manage().window().maximize(); driver.switchTo().frame("a077aa5e"); 웹 요소로 프레임으로 전환: 웹 요소를 사용하여 iframe으로 전환할 수도 있습니다. driver.switchTo().frame(WebElement); 상위 프레임으로 돌아가려면 switchTo().parentFrame()을 사용하거나 기본(또는 대부분의 상위) 프레임으로 돌아가려면 switchTo().defaultContent()를 사용할 수 있습니다. driver.switchTo().parentFram.. 2022. 9. 24.
[vba] Export Excel to Access Sub program1472() Dim acc As Object Set acc = CreateObject("Access.Application") acc.OpenCurrentDatabase ThisWorkbook.Path & "\DB.accdb" acc.DoCmd.TransferSpreadsheet _ TransferType:=0, _ SpreadSheetType:=acSpreadsheetTypeExcel12Xml, _ TableName:="program1472", _ Filename:=Application.ActiveWorkbook.FullName, _ HasFieldNames:=True, _ Range:="tem$A1:B10" acc.CloseCurrentDatabase acc.Quit Set acc .. 2022. 9. 19.
[vb.net] MakeTransparent 이미지 지정한 컬러 투명하게 만들기 img.MakeTransparent(Color.White) 2022. 9. 19.