Friday, September 9, 2011

Fancy box and mvc's action result


I faced issue with mvc. The images
I'm using are stored in a database. They are served from the server
using ASP.NET MVC 3. Therefore, my image links look like this:
<a href="/Photo/Image/4" rel="gallery"><img src="/Photo/Image/4"
alt="foo" /></a>

The fancybox script uses regex to determine if the link is an image.
Well, it fails on this, and winds up showing you the raw data in the
image file. I figured out what to do by reading the javascript. All I
needed to do was add 'type': 'image' to my options. My script looks
like this:
$(".gallery a").fancybox({
'zoomSpeedIn': 300,
'hideOnContentClick': true,
'zoomSpeedOut': 300,
'overlayOpacity': .8,
'type': 'image'

JQuery Fancy box

Wednesday, September 7, 2011

Check no of open connection in SQL server

--> To allow users to view current activity on the database:

--> To give you the total number of connections per database on a database server:

SELECT DB_NAME(dbid) as 'Database Name',
COUNT(dbid) as 'Total Connections'
FROM master.dbo.sysprocesses WITH (nolock)
WHERE dbid > 0

--> To get the dbid from database name
SELECT DB_ID('MyDBName') as [Database ID]

--> To give you the process Ids of existing connections in the database (not necessarily open but existing):
FROM master.dbo.sysprocesses WITH (nolock)
WHERE dbid = (SELECT DB_ID('MyDBName') as [Database ID])

--> To give you information about the actual process id (replace 1018 with the spid):
dbcc inputbuffer (1018)

--> To kill a process
kill 1018