Friday, July 23, 2010

Twitter like notification bar in jquery

Just designed a twitter like notification bar in jquery... See it in action demo here...

Just add the following jquery,

            var $alertdiv $('<div id = "alertmsg"/>');
            $alertdiv.text("Welcome to twitter");


      font20px/40px arialsans-serif;

Thursday, July 22, 2010

Simple Jquery Dropdown menu...

I ve designed a simple jquery dropdown Menu without using any jquery menu plugins....

<html xmlns="">
<head runat="server">
    <script type="text/javascript" src=""></script>
    <style type="text/css">
        ul, li{margin:0; padding:0; list-style:none;}
    /* Targeting both first and second level menus */
#Programming li { float: left; position: relative;font-family:Arial,Helvetica,sans-serif; }
#Programming li a { background: #f3fded; border: 3px solid #333f31; color: #333; display: block; margin: 0 5px 0 0; padding: 5px 8px;text-decoration:none; font-size:110%;font-weight:bold;}
#Programming li a:hover { background: #333f31;color:#fff; text-decoration: none; font-size:110%;font-weight:bold;}

/* Targeting the first level menu */
#Programming { display: block; height: 35px; padding: 10px 0; width: 700px; z-index: 100; position: absolute;}
#Programming > li > a { font-size:110%;font-weight:bold; }

/* Targeting the second level menu */
#Programming li ul { background: #f3fded; border: 3px solid #333f31; color: #333; display: none; margin: -3px 0 0 0; width: 105px; position: absolute; }
#Programming li ul li { width: 100% }
#Programming li ul li a { background: none; border: none; line-height: 30px; margin: 0; padding: 0 0 0 5px; text-decoration:none;  font-size:110%; font-weight:bold;}
#Programming li ul li a:hover { background: #333f31;color:#fff;font-size:110%;font-weight:bold;}

/* A class of current will be added via jQuery */
#Programming li.current > a { background: #333f31;color:#fff; font-size:110%;font-weight:bold;}

/* CSS fallback */
#Programming li:hover > ul.child { display: block; }

    <form id="form1" runat="server">
    <div id="ProgMenu" style="padding-left: 45px;">
                            <ul id="Programming">
                                <li><a href="#">.net</a>
                                    <ul class="child">
                                        <li><a href="#"></a></li>
                                        <li><a href="#">WPF</a></li>
                                        <li><a href="#">Winforms</a></li>
                                        <li><a href="#">Silverlight</a></li>
                                <li><a href="#">java</a>
                                    <ul class="child">
                                        <li><a href="#">Struts</a></li>
                                        <li><a href="#">Spring</a></li>
                                        <li><a href="#">Hibernate</a></li>

                        <script type="text/javascript">
                            $(document).ready(function() {

                                $("#Programming ul.child").removeClass("child");

                                $("#Programming li").has("ul").hover(function() {
                                }, function() {
                                    $(this).removeClass("current").children("ul").stop(true, true).css("display", "none");


Monday, July 19, 2010 with ASP.NET implementation...

Just now finished my sample scheduled task with in my web application.....

Here's a complete example how to do this using First of all, you have to create a class which implements the IJobinterface defined by This class is called by the scheduler at tne configured time and should therefore contain your send mail functionality:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.IO;
    using Quartz;
    /// <summary>
    /// Summary description for SendMailJob
    /// </summary>
    public class SendMailJob : IJob
        public void Execute(JobExecutionContext context)
        private static void WriteToFile()
            StreamWriter SW;
            SW = File.CreateText("C:\\Documents and Settings\\chendur\\Desktop\\samp.txt");
            SW.WriteLine("God is greatest of them all");
            SW.WriteLine("This is second line");
        public static DateTime getIndianStandardTime()
            TimeZoneInfo IND_ZONE = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
            return TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, IND_ZONE);
Next you have to initialize the scheduler to invoke your job once a day at 06:00. This can be done in Application_Start of global.asax:
<%@ Application Language="C#" %>
<%@ Import Namespace="Quartz"%>
<%@ Import Namespace="Quartz.Impl" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e) 
        ISchedulerFactory schedFact = new StdSchedulerFactory();
        // get a scheduler
        IScheduler sched = schedFact.GetScheduler();
        // construct job info
        JobDetail jobDetail = new JobDetail("mySendMailJob", typeof(SendMailJob));
        // fire every day at 06:00
        //Trigger trigger = TriggerUtils.MakeDailyTrigger(06, 00);
        SimpleTrigger trigger2 = new SimpleTrigger("myTrigger",
        //Trigger trigger = TriggerUtils.MakeHourlyTrigger();
        //// start on the next even hour
        //trigger.StartTimeUtc = TriggerUtils.GetEvenHourDate(DateTime.UtcNow);  
        //trigger.Name = "mySendMailTrigger";
        // schedule the job for execution
        sched.ScheduleJob(jobDetail, trigger2);

That's it. Your job should be executed every day at 06:00. For testing, you can create a trigger which fires every minute (for example). Have a look at the method of TriggerUtils.

Friday, July 16, 2010

Get Indian Standard Time(IST) in c#

When you are hosting you application to a production server outside india, its often we need indian time so i ve created a c# method which returns indian standard time from your server wherever it is located in india...

public DateTime getIndianStandardTime()
 TimeZoneInfo IND_ZONE=TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
 return TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, IND_ZONE);}

Thursday, July 15, 2010

Grant Mysql Database access...

Today morning i was just looking around for a mysql query which grants me access to another database....

GRANT ALL PRIVILEGES ON dbname.* TO 'dbname'@'urpartnerip'    IDENTIFIED BY 'dbname' WITH GRANT OPTION;
GRANT SELECT ON mysql.proc TO 'dbname'@'urpartnerip' IDENTIFIED BY 'dbname'