Monday, June 20, 2011

Find a string in all Stored Procedures

Find a string in all Stored Procedures:

SELECT OBJECT_NAME(id)
FROM syscomments
WHERE [text] LIKE '%foobar%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)

Wednesday, March 23, 2011

Send mail from asp.net

1. Create a MailHelper class.

public class MailHelper
    {
        public static void SendMailMessage(string from, string to, string bcc, string cc, string subject, string body)
        {
            MailMessage mMailMessage = new MailMessage();
            mMailMessage.From = new MailAddress(from);
            mMailMessage.To.Add(new MailAddress(to));

            if (!(string.IsNullOrEmpty(bcc)))
            {
                mMailMessage.Bcc.Add(new MailAddress(bcc));
            }

            if (string.IsNullOrEmpty(cc))
            {
                mMailMessage.CC.Add(new MailAddress(cc));
            }

            mMailMessage.Subject = subject;
            mMailMessage.Body = body;
            mMailMessage.IsBodyHtml = true;
            mMailMessage.Priority = MailPriority.Normal;

            // Instantiate a new instance of SmtpClient
            SmtpClient ss = new SmtpClient();
            //ss.EnableSsl = true;
            ss.Timeout = 10000;
            ss.DeliveryMethod = SmtpDeliveryMethod.Network;

            mMailMessage.BodyEncoding = UTF8Encoding.UTF8;
            mMailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
            ss.Send(mMailMessage);
        }

2. Add the following smtp configuration in Web.config file.


 
 

Wednesday, March 16, 2011

My system is damn slow, what to do?

This post is an initiative for tips to improve the speed of system running Windows 7, so that we dont waste the system resources:

1. RacTask : Microsoft Reliability Analysis task to process system reliability data.
If you want to speed up your task rather than this analysis, diable this task in TaskScheduler.
Task Scheduler > Task Scheduler Library > Microsoft > Windows > RAC > RacTask > right click > disable

2.

Tuesday, February 1, 2011

Session state can only be used when enableSessionState is set to true

asp.net issue:
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that system.Web.SessionStateModule or a custom session statemodule is included in the \\ section in the application configuration.

One possible solution - Set the startup page in your website.

Sunday, January 30, 2011

Some Googling tricks

1. Go to www.google.com
Type "intitle:indes of" abc

abc can be replaced by anthing like: hack pdf OR abobe OR akon mp3

Now, browse the links in search result page and download if you find something interesting.


2. Go to www.google.com
Type inurl:"viewerframe?mode=refresh"


3. Go to www.google.com
Type intext:"UAA(MSB)" Lexmark-ext.pdf


4. Type elgoog

5. inurl:/view/index.shtml


spy the database sp changes

SELECT name, create_date, modify_date
FROM sys.objects

WHERE type = 'P'

order by modify_date desc

Tuesday, January 18, 2011

Find out, why the net is so slow?

  • Type cmd in your Windows Run box.
  • Type "netstat -b 5 > activity.txt" and press enter.
  • After say 2 minutes, press Ctrl+C.
  • Type "activity.txt" on the command line to open the log file in notepad