Free Information Technology Magazines and eBooks

Thursday, April 09, 2009

SQL Server: Script to List the physical location of Data and Log files of each database

As SQL administrator, part of our preventive maintenance is knowing the physical location of all databases for us to properly manage the available disk spaces needed for each database. The hassle of going through the properties of each database is too tedious and slow. But ofcourse there's always an easier way. To retrieve all physical location in less than a minute, use the following SQL scripts:


SELECT name, physical_name AS physical_location
FROM sys.master_files


Here's a sample output of the script:

Output of sql script to List the physical location

From the result you can monitor all the physical location of your databases. I hope this short tip can help anyone specially beginners. Until next time!

Tuesday, April 07, 2009

VB.NET: Using Google Maps on your application

During my college days we created a project called "Electronic Map Navigator". Its function is to locate the easiest route from Point A to Point B. Those days, creating map enabled application was still a complicated task but not anymore. Today I guess it's as easy as creating your first hello program. The task made easier by the availability of internet, Google Maps, Google Earth and Virtual Earth. On this article, I will show you how to implement google maps on your VB.NET applications (without using Maps API).

  • Add "Imports System.Text" statement on your VB.NET project
  • In your main form, add text boxes to hold street, city, state and zip
  • Add search button for user to click when searching the map. On it's click event put the following codes:


  • Try
    Dim streetaddr As String = ""
    Dim cityaddr As String = ""
    Dim stateaddr As String = ""
    Dim zipaddr As String = ""
    Dim AddrToSearch As New StringBuilder()
    AddrToSearch.Append("http://maps.google.com/maps?q=")

    ' if there is street entry
    If txtStreet.Text <> "" Then
    streetaddr = txtStreet.Text.Replace(" ", "+")
    AddrToSearch.Append(street + "," & "+")
    End If

    ' if there is city entry
    If txtCity.Text <> "" Then
    cityaddr  = txtCity.Text.Replace(" ", "+")
    AddrToSearch.Append(city + "," & "+")
    End If

    ' if there is state
    If txtState.Text <> "" Then
    stateaddr = txtState.Text.Replace(" ", "+")
    AddrToSearch.Append(state + "," & "+")
    End If

    ' if there is zip code
    If txtZipCode.Text <> "" Then
    zipaddr = txtZipCode.Text.ToString()
    AddrToSearch.Append(zip)
    End If

    ' pass the AddrToSearch value to web browser control
    wbrowser.Navigate(AddrToSearch.ToString())

    Catch ex As Exception

    MessageBox.Show(ex.Message.ToString(), "Problem encountered while retrieving google map")

    End Try

  • Aside from actual street address of the map, you can also search the map by latitude and longitude


  • Try
    Dim latitude As String = ""
    Dim longitude As String = ""
    Dim AddrToSearch As New StringBuilder()
    AddrToSearch.Append("http://maps.google.com/maps?q=")

    ' if there is latitude
    If txtLatitude.Text <> "" Then
    latitude = txtLatitude.Text
    AddrToSearch.Append(latitude & "%2C")
    End If

    ' if there is longitude
    If txtLongitude .Text <> "" Then
    longitude = txtLongitude .Text
    AddrToSearch.Append(longitude)
    End If

    ' pass the AddrToSearch value to web browser control
    wbrowser.Navigate(AddrToSearch.ToString())

    Catch ex As Exception

    MessageBox.Show(ex.Message.ToString(), "Problem encountered while retrieving google map")

    End Try



Since using this method does not require or needs any Google Maps API, you have little or no control on view map controls. These controls are already provided by Google Maps inside your web browser control.