<img src="http://img.youtube.com/vi/YRKq2VilwbI/0.jpg"/>

<img src="http://img.youtube.com/vi/YRKq2VilwbI/1.jpg"/>

<img src="http://img.youtube.com/vi/YRKq2VilwbI/2.jpg"/>

<img src="http://img.youtube.com/vi/YRKq2VilwbI/3.jpg"/>





function getDistance(lat1, lng1, lat2, lng2) {
function radians(deg) {return deg * Math.PI / 180;}
return 6378.14 * Math.acos(Math.cos(radians(lat1))
* Math.cos(radians(lat2))
* Math.cos(radians(lng2) - radians(lng1))
+ Math.sin(radians(lat1)) * Math.sin(radians(lat2)));
}
Dim l As Variant
l = AddressToLatLng("東京都新宿区西新宿2−8−1")
MsgBox "lat:" & l(0) & vbCrLf & "lng:" & l(1)
MsgBox LatLngToAddress(l(0), l(1))
'住所から緯度・経度に変換
'戻り値は配列で、(0)が緯度、(1)が経度。
Function AddressToLatLng(ByVal address As String) As Variant
Dim sc As Object
Dim jsn As Object
Dim result As Object
Dim http As Object
Dim url As String
Set sc = CreateObject("ScriptControl")
sc.Language = "JScript"
sc.AddCode "function getLatLng(s) { return eval('(' + s + ')');}"
url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=" & sc.CodeObject.encodeURI(address)
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", url, False
http.Send
Set jsn = sc.CodeObject.getLatLng(http.ResponseText)
If jsn.status = "OK" Then
For Each result In jsn.results
AddressToLatLng = Array(result.geometry.location.lat, result.geometry.location.lng)
Exit For
Next
Else
'エラー
AddressToLatLng = Array(999, 999)
End If
Set jsn = Nothing
Set sc = Nothing
End Function
'緯度・経度から住所に変換
Function LatLngToAddress(ByVal lat As Double, ByVal lng As Double) As String
Dim sc As Object
Dim jsn As Object
Dim result As Object
Dim http As Object
Dim url As String
Dim text As String
Set sc = CreateObject("ScriptControl")
sc.Language = "JScript"
sc.AddCode "function getAddress(s) { return eval('(' + s + ')');}"
url = "http://maps.google.com/maps/api/geocode/json?sensor=false&language=ja&latlng=" & lat & "," & lng
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", url, False
http.Send
'ReplaceはShift_JISに無いハイフンが返されるためこれを全角ハイフンに変換
Set jsn = sc.CodeObject.getAddress(Replace(http.ResponseText, ChrW(&H2212), "−"))
If jsn.status = "OK" Then
For Each result In jsn.results
'「日本, 住所」の形で格納されてるので住所部分のみを取得
LatLngToAddress = Split(result.formatted_address, ", ", 2)(1)
Exit For
Next
Else
'エラー
LatLngToAddress = ""
End If
Set jsn = Nothing
Set sc = Nothing
End Function
Dim re As Object
Dim rslt() As Object
Dim url As Object
Set re = CreateObject("VBScript.RegExp")
re.Pattern = "https?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?"
re.IgnoreCase = True
re.Global = True
Set rslt = re.Execute("google:http://www.google.co.jp/,yahoo:http://www.yahoo.co.jp/")
For Each url In rslt
MsgBox url
Next
'rsltはコレクションなのでrslt(0)という記述もOK
Dim sc As Object
Set sc = CreateObject("ScriptControl")
sc.Language = "JScript"
sc.AddCode "function extractDate(dt) { dt.match(/(\d{4})\/(\d{2})\/(\d{2})/); return RegExp.$1 + RegExp.$2 + RegExp.$3; }"
MsgBox sc.CodeObject.extractDate("今日の日付は2011/03/18です。")
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Docs');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$user = "ユーザーID";
$pass = "パスワード";
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$docs = new Zend_Gdata_Docs($client);
$feed = $docs->getDocumentListFeed();
foreach($feed->entries as $folder){
//最終更新日とドキュメント名を出力
print date("Y/m/d H:i:s", strtotime($folder->updated->text))." - ".$folder->title->text."<br>";
}
function Database1AfterConnect($sender, $params)
{
$this->Database1->execute("SET NAMES utf8");
}
| 日 | 月 | 火 | 水 | 木 | 金 | 土 |
|---|---|---|---|---|---|---|
| 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 |