14 Nis 2010

Gelecek

1.Mobile (mobile yönelik)
2.Location-Based (konum tabanlı)
3.Advertising (reklamcılık) ya da Fun (Eğlenceye yönelik)

1 Nis 2010

Window kayıtdefterinden okuma yapmak (Regedit)

Windows'ta regedit'ten (kayıt defteri) okuma, yazma yapmak isteyebilirsiniz.
Aşağıdaki kodlar vbs ile yazılmıştır.

'Regedit.vbs
Option Explicit
Dim WSHShell, RegKey, komutOne, komutTwo, komutThree
Dim objFSO, objFSOText, objFolder, objFile
Dim strDirectory,strFile
strDirectory = "C:\"
strFile = "Mntr_Sonuc.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Set objFolder = objFSO.CreateFolder(strDirectory)
Set WSHShell = CreateObject("WScript.Shell")
RegKey = "HKLM\SOFTWARE\MONITORING\"
komutOne= WSHShell.RegRead(RegKey & "status")
komutTwo= WSHShell.RegRead(RegKey & "processresult")
komutThree= WSHShell.RegRead(RegKey & "errorcode")
Set objFile = objFSO.CreateTextFile(strDirectory & strFile)
objFile.Write(komutTwo)
'WScript.echo "Status: " & komutOne & ", ProcessResult: " & komutTwo & ", ErrorCode: " & komutThree



Buradaki kod Regeditten HKEY_Local_Machine\SOFTWARE\MONITORING dizinindeki
status, processresult, errorcode ait sonuçları C:\Mntr_Sonuc.txt dosyasına yazar.
Not: Sizde bu MONITORING dizini olmayabilir.

SQL Uptime

SELECT DATEDIFF(mi,login_time, GETDATE()) AS TotalUpTimeInMinutes
FROM master..sysprocesses WHERE spid = 1


Yukarıdaki kod parçası SQL'inizin ne kadar süredir açık olduğunu söylüyor.
Mantığına gelince SQL'inizin ilk process'i sql'in kendisidir, bu spid=1 dir.