Wednesday, April 02, 2008

Usuário SA no SQL 2005 isLocked

/* Boa dica de como destravar o usuario SA */


alter login sa
with password = 'yourpwd' unlock,
check_policy = off,
check_expiration = off

Tuesday, February 13, 2007

Google Maps using ASP.NET 2.0

Para utilizar o Google Maps 2.0 usando ASP.NET voce precisa baixar o Assembly da Reimers no endereco: http://www.reimers.dk/files/folders/google_maps/entry1.aspx

Colocar a DLL no diretório /bin do seu projeto e colocar essas linhas, so lembrando que a Latitude/Longitude deste projeto esta marcada para meu endereço caso alguem queria fazer alguma doação de uma Ferrari J

Default.aspx
Registrar a Tag no comeco do arquivo

<%@
Register
TagPrefix="cc1"
Namespace="Reimers.Map"
Assembly="GoogleMap"
%>

Criar controle dentro de um FORM

<cc1:GoogleMap
id="GMapControl1"
runat="server"
/>

Default.aspx.vb

Imports System.Web.UI.WebControls
Imports MapControl

Partial Class _default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


' Lat/Lon(-21.190814, -47.82075)


Dim Lat As Double = -21.190614

Dim Lng As Double = -47.82131


Dim sInfo As String = "Algum comentario aqui"
GMapControl1.Width = 550
GMapControl1.Height = 400
GMapControl1.MapType = MapControl.GMapType.MAP
GMapControl1.DoubleClickZoomEnabled = "true"
GMapControl1.TypeControl = Reimers.Map.MapTypeControl.None
GMapControl1.ShowScaleControl = True
GMapControl1.GoogleKey = ConfigurationManager.AppSettings("googlemaps_key")
GMapControl1.Latitude = Lat
GMapControl1.Longitude = Lng
GMapControl1.MapControl = Reimers.Map.ControlType.Large
GMapControl1.Zoom = 15

' Criar PinPoint no Mapa

Dim sPinPoint As String = "<b>Ola</b><br />Somente um teste"
Dim MyPoint As Reimers.Map.GoogleLatLng = New Reimers.Map.GoogleLatLng(Lat, Lng)
Dim myMarker As Reimers.Map.GoogleMarker = New Reimers.Map.GoogleMarker("pinpoint" + "1", MyPoint)
GMapControl1.Markers.Add(myMarker)
GMapControl1.AddOverlay(myMarker)

End Sub

Protected Sub GMapControl1_MarkerClick1(ByVal Map As Reimers.Map.GoogleMap, ByVal Marker As Reimers.Map.GoogleMarker, ByRef MapCommand As
String) Handles GMapControl1.MarkerClick

Dim sPinPoint As String = "<b>Ola</b><br />Somente um teste"
sInfo = sInfo & "<br /><br />Latitude: " & Map.Latitude & "<br />Longitude: " & Map.Longitude
MapCommand = Marker.OpenInfoWindowHTML(GMapControl1, sInfo)
End Sub
End Class

Sunday, January 28, 2007

Google Earth


Sinceramente não consigo entender como tem gente estupida usando um computador! Como um ser humano que já tem o direito de votar em um presidente consegue usar o que ele chama de massa cinzenta para pensar em algo tão estupido.

Você consegue imaginar se duas pessoas solicitam para o Google Earth posicionar o satélite em 2 posições diferentes? Faz o que imbecil? Divide o satélite em 2 partes?

Agora meu caro Rodrigo, vai ser burro assim lá longe hein, você acha que o Google vai colocar um satélite à sua disposição?

Meu caro internauta, vai estudar um pouco antes de pensar em usar um computador!
Posted by Picasa

Friday, January 26, 2007

Como mostrar todas as tabelas e tamanhos e registros no SQL 2000/2005

IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'sp_show_huge_tables' AND type = 'P')
DROP PROC sp_show_huge_tables
GO


CREATE PROC sp_show_huge_tables
(
@top int = NULL,
@include_system_tables bit = 0
)
AS

/*
Exemplos como usar:

Para listar todas as tables do banco e os tamanhos:
EXEC sp_show_huge_tables

Para ver as 3 maiores tabelas do banco:
EXEC sp_show_huge_tables 3

Para listar todas tables do usuario e do sistema com seus tamanhos:
EXEC sp_show_huge_tables @include_system_tables = 1

*/

BEGIN
IF @top > 0
SET ROWCOUNT @top

SELECT [Table Name], (SELECT rows FROM sysindexes s WHERE s.indid < 2 AND s.id = OBJECT_ID(a.[Table Name])) AS [Row count], [Total space used (MB)] FROM
( SELECT QUOTENAME(USER_NAME(o.uid)) + '.' + QUOTENAME(OBJECT_NAME(i.id)) AS [Table Name], CONVERT(numeric(15,2),(((CONVERT(numeric(15,2),SUM(i.reserved)) * (SELECT low FROM master.dbo.spt_values (NOLOCK) WHERE number = 1 AND type = 'E')) / 1024.)/1024.)) AS [Total space used (MB)]

FROM sysindexes i (NOLOCK)

INNER JOIN

sysobjects o (NOLOCK) ON i.id = o.id AND ((@include_system_tables = 1 AND o.type IN ('U', 'S')) OR o.type = 'U') AND ((@include_system_tables = 1)OR (OBJECTPROPERTY(i.id, 'IsMSShipped') = 0))

WHERE indid IN (0, 1, 255)

GROUP BY QUOTENAME(USER_NAME(o.uid)) + '.' + QUOTENAME(OBJECT_NAME(i.id)) ) as a
ORDER BY [Total space used (MB)] DESC

SET ROWCOUNT 0
END

GO

GRANT EXEC ON sp_show_huge_tables TO Public