^   ^

광고 수익의 일부는 블로거에게 제공됩니다


MAC Address 가져오기 VB.NET

 

1
2
3
4
5
6
7
8
9
10
11
12
Private Function GetMacAddress()
       Dim mc As System.Management.ManagementClass
       Dim mo As System.Management.ManagementObject
       mc = New System.Management.ManagementClass("Win32_NetworkAdapterConfiguration")
       Dim moc As System.Management.ManagementObjectCollection = mc.GetInstances()
       For Each mo In moc
           If mo.Item("IPEnabled") = True Then
               Return mo.Item("MacAddress").ToString()
           End If
       Next
       Return String.Empty
   End Function

하단
Posted by 네이션
,
^   ^

광고 수익의 일부는 블로거에게 제공됩니다


how to weather xml in classic asp / how to weather api in classic asp / how to weather in asp / how to weather api in javascript / how to 비동기 날씨가져오기 in classic asp / how to weather ap in jquery

 

어디 넣어야할지 몰라서 우선 개발을  classic ASP 로 했으니 ㅎㅎ 여기 넣어야겠다

 

사용 설명 : 날씨의 지역을 선택하면 하단의 3일간의 날씨가 비동기로 변경된다.

 

※ 아래 소스는 PC버전을 이용하셔야 보입니다.

 

 

날짜를 선택한다.   ▶▶ 선택시 ▶▶      해당 지역의 날짜(3일간)을 표현한다.

 

1. 보여줄 페이지 (weather.asp)

 참고 : jquery1.10을 사용했습니다.

javascript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function callPage() {
   var weatherKey = $( "#search_area").val();
   var url = './weather_rss.asp';
   var divWeather = $(".left_weatherWrap");
   var tdiv  = "";
   $.ajax({
       type: "POST",
       url: url,
       data:{weatherKey:weatherKey},
       success: function(response){
       $(".weather_txt").remove();
       for (var i in response.weatherData)
       {
           tdiv =  "<div class='weather_txt'><img src='"+response.weatherData[i].imgWeather+"'  alt='"+response.weatherData[i].wfKor+"' /><div class='weather_tw'><span class='txt01'>" + response.weatherData[i].time +"</span><span class='txt02'><span class='txt'>"+ response.weatherData[i].wfKor +"</span><strong>" + response.weatherData[i].temp + " C</strong>("+response.weatherData[i].tmx +"/"+response.weatherData[i].tmn +")</span></div></div>";
 
           divWeather.append(tdiv)
       }
       },
       dataType: "json"
   });
}

HTML

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!--//날씨정보 시작-->
<div class="left_weatherWrap">
    <h4>날씨정보</h4>
    <select  name="sido" id="search_area" class="region" onchange="callPage();">
        <option value="4200000000" <%If strKey = "4200000000" Then%>selected="selected" <%End if%>>강원</option>
        <option value="4100000000" <%If strKey = "4100000000" Then%>selected="selected" <%End if%>>경기</option>
        <option value="4800000000" <%If strKey = "4800000000" Then%>selected="selected" <%End if%>>경남</option>
        <option value="4700000000" <%If strKey = "4700000000" Then%>selected="selected" <%End if%>>경북</option>
        <option value="2900000000" <%If strKey = "2900000000" Then%>selected="selected" <%End if%>>광주</option>
        <option value="2700000000" <%If strKey = "2700000000" Then%>selected="selected" <%End if%>>대구</option>
        <option value="3000000000" <%If strKey = "3000000000" Then%>selected="selected" <%End if%>>대전</option>
        <option value="2600000000" <%If strKey = "2600000000" Then%>selected="selected" <%End if%>>부산</option>
        <option value="1100000000" <%If strKey = "1100000000" Then%>selected="selected" <%End if%>>서울</option>
        <option value="3600000000" <%If strKey = "3600000000" Then%>selected="selected" <%End if%>>세종</option>                     
        <option value="3100000000" <%If strKey = "3100000000" Then%>selected="selected" <%End if%>>울산</option
        <option value="2800000000" <%If strKey = "2800000000" Then%>selected="selected" <%End if%>>인천</option>
        <option value="4600000000" <%If strKey = "4600000000" Then%>selected="selected" <%End if%>>전남</option
        <option value="4500000000" <%If strKey = "4500000000" Then%>selected="selected" <%End if%>>전북</option>
        <option value="5000000000" <%If strKey = "5000000000" Then%>selected="selected" <%End if%>>제주</option>
        <option value="4400000000" <%If strKey = "4400000000" Then%>selected="selected" <%End if%>>충남</option>
        <option value="4300000000" <%If strKey = "4300000000" Then%>selected="selected" <%End if%>>충북</option>
    </select>
    <div ID="WeatherDiv">
    </div>
</div>
<!--//날씨정보-->

 

how to weather xml in classic asp / how to weather api in classic asp / how to weather in asp / how to weather api in javascript / how to 비동기 날씨가져오기 in classic asp / how to weather ap in jquery

2. 비동기 데이터 호출 페이지 (weather_rss.asp)

참고: aspJSON1파일(ASP문 JSON 변환)은 다운로드 받으세요.  출처 : http://www.aspjson.com/

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!--#include virtual="/include/aspJSON1.13.asp" -->
Set oJSON = New aspJSON
 
strKey = request("weatherKey")
 
'strKey = request("sido")
If strKey = "" Then
    strKey = "1100000000"
End If
 
'RSS사이트의 주소입니다.
 
'RSS주소에서 text를추출합니다. 아래 Function참고하세요.
RSSData = GetXmlHttp(RSSUrl)
 
'DOM을 생성합니다.
Set xmlDoc = Server.CreateObject("MSXML2.DOMDOCUMENT.4.0")
    xmlDoc.async = false
    xmlDoc.loadXml RSSData  '위에서 받은 text를 로드합니다.
 
    '전체뉴스중 랜덤으로 추출하기 위해서 item노드의 갯수를 구한다.
    newsLength = xmlDoc.selectNodes("//data").length
    Set SelectNodes = xmlDoc.SelectNodes("//data")
 
'전체 뉴스의 리스트
Dim strTemp
Dim strWeather
 
 
' oJSON.data("weatherData") = strKey
Set oJSON.data("weatherData") = oJSON.Collection()
 
 
For x = 0 To newsLength-1
    If  SelectNodes(x).selectSingleNode("day").Text > 0 then
        If SelectNodes(x).selectSingleNode("hour").Text = 12 Then
        Set newitem = oJSON.AddToCollection(oJSON.data("weatherData"))
        newitem.add "hour", SelectNodes(x).selectSingleNode("hour").Text
        newitem.add "day", SelectNodes(x).selectSingleNode("day").Text
        newitem.add "temp", fn_Weather_Cal(SelectNodes(x).selectSingleNode("temp").Text)
        newitem.add "tmx", fn_Weather_Cal(SelectNodes(x).selectSingleNode("tmx").Text)
        newitem.add "tmn", fn_Weather_Cal(SelectNodes(x).selectSingleNode("tmn").Text)
        newitem.add "sky", SelectNodes(x).selectSingleNode("sky").Text
        newitem.add "pty", SelectNodes(x).selectSingleNode("pty").Text
        newitem.add "wfKor", SelectNodes(x).selectSingleNode("wfKor").Text
        newitem.add "wfEn", SelectNodes(x).selectSingleNode("wfEn").Text
        newitem.add "pop", SelectNodes(x).selectSingleNode("pop").Text
        newitem.add "time", FormatDateTime(DateAdd("d",SelectNodes(x).selectSingleNode("day").text,now()),1) & " " &SelectNodes(x).selectSingleNode("hour").Text & "시"
        newitem.add "imgWeather", fn_Weather_img(SelectNodes(x).selectSingleNode("wfKor").text, SelectNodes(x).selectSingleNode("wfEn").text)
 
'       CreateNewsLink(SelectNodes(x))
        End if
    Else
        If strTemp = "chk" Then
         
        Else       
        Set newitem = oJSON.AddToCollection(oJSON.data("weatherData"))
        newitem.add "hour", SelectNodes(x).selectSingleNode("hour").Text
        newitem.add "day", SelectNodes(x).selectSingleNode("day").Text
        newitem.add "temp", fn_Weather_Cal(SelectNodes(x).selectSingleNode("temp").Text)
        newitem.add "tmx", fn_Weather_Cal(SelectNodes(x).selectSingleNode("tmx").Text)
        newitem.add "tmn", fn_Weather_Cal(SelectNodes(x).selectSingleNode("tmn").Text)
        newitem.add "sky", SelectNodes(x).selectSingleNode("sky").Text
        newitem.add "pty", SelectNodes(x).selectSingleNode("pty").Text
        newitem.add "wfKor", SelectNodes(x).selectSingleNode("wfKor").Text
        newitem.add "wfEn", SelectNodes(x).selectSingleNode("wfEn").Text
        newitem.add "pop", SelectNodes(x).selectSingleNode("pop").Text
        newitem.add "time", FormatDateTime(DateAdd("d",SelectNodes(x).selectSingleNode("day").text,now()),1) & " " &SelectNodes(x).selectSingleNode("hour").Text & "시"
        newitem.add "imgWeather", fn_Weather_img(SelectNodes(x).selectSingleNode("wfKor").text, SelectNodes(x).selectSingleNode("wfEn").text)
'           CreateNewsLink(SelectNodes(x))
            strTemp = "chk"
        End if
 
    End If
Next
 
    '객체를 소멸시킨다
    Set SelectNodes = Nothing
'DOM을 소멸시킨다.
Set xmlDoc = Nothing
 
'XMLHTTP로 원격지 서버의 정보를 긁어오기
Function GetXmlHttp(XMLURL)
    Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
        xmlHttp.Open "POST", XMLURL, False
        xmlHttp.Send
        GetXmlHttp = xmlHttp.responseText
    Set xmlHttp = Nothing
End Function
 
 
Function fn_Weather_Cal(strTemp)
    Dim strCal
 
    strCal = "-"
     
    select case strTemp
        case "-999.0"
            strCal = "-"
        Case Else
            strCal = strTemp
    End Select
     
    fn_Weather_Cal = strCal
End Function
 
Function fn_Weather_img(strKor, strEn)
    select case strEn
        case "Clear"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB01.png"
        case "Partly Cloudy"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB02.png"
        case "Mostly Cloudy"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB03.png"
        case "Cloudy"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB04.png"
        case "Rain"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB08.png"
        case "Snow"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB11.png"
        case "Snow/Rain"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB12.png"
        case "Rain/Snow"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB13.png"
        case "구름많고 비"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB20.png"
        case "구름많고 눈"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB21.png"
        case "구름많고 눈/비"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB22.png"
        case "구름많고 비/눈"
            fn_Weather_img = "http://www.kma.go.kr/images/icon/NW/NB23.png"
        case ""
            fn_Weather_img = "NoImage"
        case else
            fn_Weather_img = "NoImage"
    end select
End Function 
 
 
'Return the object
Response.ContentType = "application/json"
Response.Write oJSON.JSONoutput()

'IT관련 > 웹(Web)' 카테고리의 다른 글

ASP - 날씨 비동기 호출  (1) 2015.04.16
ASP - 음력 양력 변환 프로그램  (0) 2015.04.16
zeroPlus[숫자 앞에 0자리 채우기]  (0) 2015.01.26
달력 소스 ASP  (0) 2015.01.21
음-양력 변환 프로그램  (0) 2015.01.21
하단
Posted by 네이션
,
^   ^

광고 수익의 일부는 블로거에게 제공됩니다


워낙 쉬운 코드라 ... 올리기도 참 민망하지만

요즘 머리가 점점... 기억을 잃어 버려 ㅋㅋ 이렇게 적어놓아본다.

ASP 달력소스

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<%
    Dim str, d(7), cnt, end_date, st_date, t_date
 
    str = Date()
 
    d(0) = "일"
    d(1) = "월"
    d(2) = "화"
    d(3) = "수"
    d(4) = "목"
    d(5) = "금"
    d(6) = "토"
 
    '이번달 1일의 요일
    st_date = Weekday(DateSerial(Year(str), Month(str), 1))-1
 
    '이번달 마지막일
    end_date = Day(DateSerial(Year(str), Month(str)+1, 1-1))
 
    Response.write "<h2>" & Year(str) & "년 " & Month(str) & "월 </h2><br />"
%>
<table border="1">
    <tr>
<%
 
    For i=0 To 6 Step 1
        Response.write "<td>"&d(i)&"</td>"
 
    Next
 
    Response.write "</tr>"
 
    For i=0 To st_date-1
        Response.write "<td></td>"
 
    Next
 
    For i=1 To end_date
        t_date = Weekday(DateSerial(Year(str), Month(str), i))-1
        Response.write "<td>" & i & "</td>"
 
        If(t_date = 6) Then
            Response.write "</tr><tr>"
        End if
 
    Next
 
    Response.write "</tr>"
%>
</table>

'IT관련 > 웹(Web)' 카테고리의 다른 글

ASP - 날씨 비동기 호출  (1) 2015.04.16
ASP - 음력 양력 변환 프로그램  (0) 2015.04.16
zeroPlus[숫자 앞에 0자리 채우기]  (0) 2015.01.26
날씨 비동기 호출  (0) 2015.01.21
음-양력 변환 프로그램  (0) 2015.01.21
하단
Posted by 네이션
,
^   ^

광고 수익의 일부는 블로거에게 제공됩니다


Syntax Highlighter


이름을 몰라서 한참을 찾았었는데 구글링의 힘으로 찾아서 설치/적용 방법을 알게되었다. 차근 차근 따라해보자.


1. Syntax Highlighter Download


http://alexgorbatchev.com/SyntaxHighlighter/download


다운로드는 의외로 간단하다. Syntax Highlighter 공식 홈페이지에서 다운로드 받을 수 있다. 위 링크를 클릭하면 큼지막 하게 Click Here to Download. 라고 씌여있다.

이 제작자분께서 강력하게 Donate를 원하는 것 같으니 죽어가는 개발자를 위해 Paypal로 돈을 보내줄수도 있겠다.


 

2. 파일 업로드


압축 폴더를 풀면 다음과 같은 폴더들이 나온다.



이 중 우리가 업로드 할건 scripts 폴더와 styles 폴더이다. 내용은 아래 그림과 같다.

필요한 것만 올려도 상관 없으나 용량이 부족하지 않은이상 큰 문제가 없으니 모두 업로드하자.



Tistory 관리 >> HTML/CSS 편집 >> 파일 업로드 >> 추가 버튼을 차례로 눌러서 모두 업로드



그럼 업로드가 완료된다.



3. HTML 수정하기


여러분이 제일 귀찮아하는도 귀찮은 HTML 손보기는 의외로 간단하다

Tistory 관리 >> HTML/CSS 편집에 다시 들어가 CTRL + F 로 </head>를 찾는다.

찾고나서 </head> 바로 위에 다음 태그를 삽입해준다.(복붙)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script type="text/javascript" src="./images/shCore.js"></script>
<script type="text/javascript" src="./images/shLegacy.js"></script>
<script type="text/javascript" src="./images/shBrushBash.js"></script>
<script type="text/javascript" src="./images/shBrushCpp.js"></script>
<script type="text/javascript" src="./images/shBrushCSharp.js"></script>
<script type="text/javascript" src="./images/shBrushCss.js"></script>
<script type="text/javascript" src="./images/shBrushDelphi.js"></script>
<script type="text/javascript" src="./images/shBrushDiff.js"></script>
<script type="text/javascript" src="./images/shBrushGroovy.js"></script>
<script type="text/javascript" src="./images/shBrushJava.js"></script>
<script type="text/javascript" src="./images/shBrushJScript.js"></script>
<script type="text/javascript" src="./images/shBrushPhp.js"></script>
<script type="text/javascript" src="./images/shBrushPlain.js"></script>
<script type="text/javascript" src="./images/shBrushPython.js"></script>
<script type="text/javascript" src="./images/shBrushRuby.js"></script>
<script type="text/javascript" src="./images/shBrushScala.js"></script>
<script type="text/javascript" src="./images/shBrushSql.js"></script>
<script type="text/javascript" src="./images/shBrushVb.js"></script>
<script type="text/javascript" src="./images/shBrushXml.js"></script>
<link type="text/css" rel="stylesheet" href="./images/shCore.css">
<link type="text/css" rel="stylesheet" href="./images/shThemeDefault.css">
<script type="text/javascript">
SyntaxHighlighter.all();
</script>


아직 끝난게 아니다. 범용성을 늘리기 위해 우리는 textarea 태그를 이용할 것이므로 추가 수정이 필요하다.

다시 CTRL + F로 <body>를 찾아주자.

찾았다면 <body>를 다음과 같이 덮어씌운다(바꾼다).


<body Onload="dp.SyntaxHighlighter.HighlightAll('code');">

그렇다면 HTML 수정이 완료된다. 이제 사용법만 알면 된다. 참 쉽죠?



4. Syntax Highlighter 적용법


원래 Syntax Highlighter 적용법에는 크게 두가지가 있다. <pre> 태그 이용법과 <textarea> 태그 이용법, 하지만 <pre>태그를 이용하게 되면 html태그 코드를 사용할 때 많이 많이 불편하게 되므로 <textarea>태그를 이용하자.


간단하다. 글 작성할 때 코드를 쓰게된다면 먼저, HTML에티터 타입으로 변경한다.


그리고 나서 다음과 같이 입력해준다.

1
2
3
<textarea name="code" class="brush:원하는 언어;">
에디터 모드에서 이 사이에 코드를 작성하면 된다.
</textarea>



5. 예시 및 다양한 변형


만약 c++ 코드를 입력하고 싶다면? 다음과 같이 입력하면 된다. col이나 width는 중요하지 않다.


1
2
3
4
5
6
7
8
9
<textarea name="code" class="brush:cpp;">
#include <iostream>
using namespace std;
void main(){
cout << "참 쉽죠?";
}
</textarea>


사용할 언어 목록은 다음과 같다.


Brush name

Brush aliases

File name

ActionScript3

as3, actionscript3

shBrushAS3.js

Bash/shell

bash, shell

shBrushBash.js

ColdFusion

cf, coldfusion

shBrushColdFusion.js

C#

c-sharp, csharp

shBrushCSharp.js

C++

cpp, c

shBrushCpp.js

CSS

css

shBrushCss.js

Delphi

delphi, pas, pascal

shBrushDelphi.js

Diff

diff, patch

shBrushDiff.js

Erlang

erl, erlang

shBrushErlang.js

Groovy

groovy

shBrushGroovy.js

JavaScript

js, jscript, javascript

shBrushJScript.js

Java

java

shBrushJava.js

JavaFX

jfx, javafx

shBrushJavaFX.js

Perl

perl, pl

shBrushPerl.js

PHP

php

shBrushPhp.js

Plain Text

plain, text

shBrushPlain.js

PowerShell

ps, powershell

shBrushPowerShell.js

Python

py, python

shBrushPython.js

Ruby

rails, ror, ruby

shBrushRuby.js

Scala

scala

shBrushScala.js

SQL

sql

shBrushSql.js

Visual Basic

vb, vbnet

shBrushVb.js

XML

xml, xhtml, xslt, html, xhtml

shBrushXml.js

 


나머지 자세한 사항은 홈페이지에 가면 나와있다.

출처 : http://jb-story.tistory.com/13

 

하단
Posted by 네이션
,