SQL Server: List active queries

Here is a SQL query that will list the active queries running in the current MS SQL Server instance.

,   right(convert(varchar, 
            dateadd(ms, datediff(ms, P.last_batch, getdate()), '1900-01-01'), 
            121), 12) as 'batch_duration'
,   P.program_name
,   P.hostname
,   P.loginame
from master.dbo.sysprocesses P
where P.spid > 50
and      P.status not in ('background', 'sleeping')
and      P.cmd not in ('AWAITING COMMAND'
                    ,'MIRROR HANDLER'
                    ,'LAZY WRITER'
                    ,'CHECKPOINT SLEEP'
                    ,'RA MANAGER')
order by batch_duration desc

JMeter : How to set a Cookie using Beanshell

Here is a Beanshell script that will add a cookie to the cookies sent in every HTTP request.

import org.apache.jmeter.protocol.http.control.Cookie;

// Retrieve the cookie value from a JMeter variable called "myCookieValue"
String cookieValue = vars.get("myCookieValue");

// Create a new Cookie and add it to the cookie manager
Cookie cookie = new Cookie("cookieName", cookieValue , "localhost", "/", false, -1);

log.info("Cookie added: "+cookie);

NB: Please remind to add a ´HTTP Cookie Manager´ to your thread group.