Tuesday, November 29, 2011

Marathon training begins today


      Marathon Training Schedule
Week
Mon
Tue
Wed
Thur
Fri
Sat
Sun
1
Rest
3 m run
Nov 29
5 m pace
Nov 30
3 m run
Dec 1
Rest
8
Dec 3
Cross
Dec 4
2
Rest
3 m run
Dec 6
5 m run
Dec 7
3 m run
Dec 8
Rest
9
Dec 10
Cross
Dec 11
3
Rest
3 m run
Dec 13
5 m pace
Dec 14
3 m run
Dec 15
Rest
6
Dec 17
Cross
Dec 18
4
Rest
3 m run
Dec 20
6 m pace
Dec 21
3 m run
Dec 22
Rest
11
Dec 24
Cross
Dec 25
5
Rest
3 m run
Dec 27
6 m run
Dec 28
3 m run
Dec 29
Rest
12
Dec 31
Cross
Jan 1
6
Rest
3 m run
Jan 3
6 m pace
Jan 4
3 m run
Jan 5
Rest
9
Jan 7
Cross
Jan 8
7
Rest
4 m run
Jan 10
7 m pace
Jan 11
4 m run
Jan 12
Rest
14
Jan 13
Cross
Jan 14
8
Rest
4 m run
Jan 17
7 m run
Jan 18
4 m run
Jan 19
Rest
15
Jan 21
Cross
Jan 22
9
Rest
4 m run
Jan 24
7 m pace
Jan 25
4 m run
Jan 26
Rest
Rest
Half Mar
Jan 31
10
Rest
4 m run
Jan 31
8 m pace
Feb 1
4 m run
Feb 2
Rest
17
Feb 4
Cross
Feb 5
11
Rest
5 m run
Feb 7
8 m run
Feb 8
5 m run
Feb 9
Rest
18
Feb 11
Cross
Feb 12
12
Rest
5 m run
Feb 14
8 m pace
Feb 15
5 m run
Feb 16
Rest
13
Feb 18
Cross
Feb 19
13
Rest
5 m run
Feb 21
5 m pace
Feb 22
5 m run
Feb 23
Rest
19
Feb 25
Cross
Feb 26
14
Rest
5 m run
Feb 28
8 m run
Feb 29
5 m run
March 1
Rest
12
March 3
Cross
March 4
15
Rest
5 m run
March 6
5 m pace
March 7
5 m run
March 8
Rest
20
March 10
Cross
March 11
16
Rest
5 m run
March 13
4 m pace
March 14
5 m run
March 15
Rest
12
March 17
Cross
March 18
17
Rest
4 m run
March 20
3 m run
March 21
4 m run
March 22
Rest
8
March 23
Cross
March 24
18
Rest
3 m run
March 27
2 m run
March 29
Rest
Rest
2 m run
March 30
Marathon



Monday, October 24, 2011

Naan


Ingredients:
  • 2 cups of All Purpose flour (Plain flour or maida)
  • 1 teaspoon active dry yeast
  • 1 teaspoon salt
  • 1 teaspoon sugar
  • Pinch of baking soda
  • 2 tablespoons of oil
  • 2 1/2 tablespoons yogurt (curd or dahi)
  • 3/4 cup lukewarm water
Also needed:
  • 1 teaspoon of clear butter or ghee to butter the Naan
  • 1/4 cup All Purpose flour for rolling
Method:
  1. Dissolve active dry yeast in lukewarm water and let it sit for 10 minutes or until the mixture becomes frothy.
  2. Add sugar, salt and baking soda to the flour and mix well.
  3. Add the oil and yogurt mix, this will become crumbly dough.
  4. Add the water/yeast mixture and make into soft dough.Note: after dough rise will become little softer.
  5. Knead until the dough is smooth. Cover the dough and keep in a warm place for 3-4 hours. The dough should almost be double in volume.
  6.  Heat the oven to 500 degrees with pizza stone for at least thirty minutes so stone is hot. Using a pizza stone will help to give naan close to same kind of heat as clay tandoor.
  7. Next turn the oven to high broil.
  8. Knead the dough for about two to three minutes and divide the dough into six equal parts.
  9. Take each piece of dough, one at a time, and roll into 8-inch oval shape. Dust lightly with dry flour to help with the rolling.
  10. Before putting the Naan in oven, lightly wet your hands and take the rolled Naan, and flipp them between your palms and place onto your baking/pizza stone into the oven.
  11. You can place about 2 Naan on the baking/pizza stone at a time. The Naan will take about 2 to 3 minutes to cook, depending upon your oven. After the Naan is baked(Naan should be golden brown color on top).
  12. Take naan out of the oven and brush lightly with clear butter or ghee.
  13. wait 2 to 3 minutes before baking the next batch of naan. It gives oven the chance to get heated again to max.
  14. Serve Naan with Daal, Chola, Palak Paneer or any vegetable. Enjoy!

Friday, October 21, 2011

JavaScript: Alert.Show(”message”) from ASP.NET code-behind


In highly interactive websites and intranet sites, you probably want to let the users know what’s going on when they delete, save, export etc. on the site. Those kinds of status messages are widely used and are often implemented by a JavaScript alert box on the web page. ASP.NET doesn’t natively support JavaScript functions from the code-behind files. You manually have to print out a script tag and add the alert() call to it.
As easy as it may be, the extensive use of the alert() status message though out a website calls for a unified and simple implementation in order to avoid duplicate code – a centralized method.
In Windows Forms it is very easy to pop up a status message by calling MessageBox.Show(“message”). It is that kind of object model we want in ASP.NET for printing out JavaScript alerts. We want Alert.Show(“message”) in ASP.NET.
Such a thing doesn’t exist so we have to create it our selves.
I’ve written a static class called Alert with one public method called Show. The implementation is as simple as can be. Just put the .cs file in the App_Code folder on your website and you instantly have access to the method from all pages and user controls.


using System.Web;
using System.Text;
using System.Web.UI;

///



/// A JavaScript alert
///

public static class Alert
{

///

/// Shows a client-side JavaScript alert in the browser.
///

/// The message to appear in the alert.
public static void Show(string message)
{
   // Cleans the message to allow single quotation marks
   string cleanMessage = message.Replace("'""\\'");
   string script = "";

   // Gets the executing web page
   Page page = HttpContext.Current.CurrentHandler as Page;

   // Checks if the handler is a Page and that the script isn't allready on the Page
   if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alert"))
   {
      page.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", script);
   }
}  
}

Demonstration


That class of only 30 lines of code enables us to add a JavaScript alert to any page at any time. Here is an example of a Button.Click event handler that uses the method for displaying status messages.
void btnSave_Click(object sender, EventArgs e)
{
   try
   {
      SaveSomething();
      Alert.Show("You document has been saved");
   }
   catch (ReadOnlyException)
   {
      Alert.Show("You do not have write permission to this file");
   }
}

If something was saved without problems, this JavaScript alert box will apear to the user of the website

Friday, August 5, 2011

funny

सावधान !!!!!
अगर   आप  बस  ट्रेन  प्लेन  या  कहीं  से  भी  आ  जा  रहे  हो  और  किसी  महिला /लड़की  के  हाथ  में फूल ,धागा ,चैन  या  चमकती  हुए  कोई  भी  वस्तु  देखें  तो  तुरंत  वहां  से  भाग  जाये .यह  वस्तु  राखी  हो  सकती  है . आपकी  ज़रा  सी  लापरवाही  आपको  भाई   बना  सकती  है .
पुरुष  हित   में  जारी  .....

Javacript image banner random rotator


Phew..enough conditions there ?

So, I needed this javascript image rotator which would pick files from a folder and show them randomely rotating through the images ...

Meh.. here is what I googled and searched and figured out 

First put a placeholder on the page...

 <div id="imageDiv">
                        <script language="javascript" type="text/javascript">
                            document.write('<center><img src="' + adBanner1 + '" id="adBanner5" width="620" height="250" border="0" alt="Some Alt Text">');
                            document.write('</center>');
                        </script>
                        <noscript>
                            <img src="/Images/rotate/1.jpg" id="adBanner5" border="0" width="620" height="250"
                                alt="Some ALt Text" /></noscript>
                        </div>



Now, getting a random number ...after all the first image should be random no ??

    <script language="JavaScript" type="text/javascript">
<!--
        rnd.today = new Date();
        rnd.seed = rnd.today.getTime();
        function rnd() {
            rnd.seed = (rnd.seed * 9301 + 49297) % 233280;
            return rnd.seed / (233280.0);
        };

        function rand(number) {
            var result = Math.ceil(rnd() * number);
            if (!result) result++;
            return result
        };
</script>

Now that we have a random number, lets populate the image 

<script language="javascript" type="text/javascript">
//the total number of images to rotate
                  var ad_cnt1 = 20;
        var ad1 = rand(ad_cnt1);
        var link1;
        var adBanner1;
        var width1
        var height1
        var i = 0;
        for (i = 0; i <= ad_cnt1; i++) {
            if (ad1 == i) {
                adBanner1 = "/images/rotate/" + i + ".jpg";
            }
        }                                   </script>



Now... using the rotator to rotate through the images
var currentAd5 = 1;
        function cycle5() {
            if (currentAd5 == ad_cnt1) {
                currentAd5 = 1;
            }
            var banner5 = document.getElementById('adBanner5');
            banner5.src = "/images/rotate/" + currentAd5 + ".jpg";
            currentAd5++;
        }
        window.setInterval("cycle5()", 5000);

Hmm so my final code would look like such:

In the head of the page I put this Javascript :

  <script language="JavaScript" type="text/javascript">
<!--
        function clearText(field) {

            if (field.defaultValue == field.value) field.value = '';

        }

        function restoreText(field) {

            if (field.value == '') field.value = field.defaultValue;

        }

        rnd.today = new Date();
        rnd.seed = rnd.today.getTime();
        function rnd() {
            rnd.seed = (rnd.seed * 9301 + 49297) % 233280;
            return rnd.seed / (233280.0);
        };

        function rand(number) {
            var result = Math.ceil(rnd() * number);
            if (!result) result++;
            return result
        };
        var ad_cnt1 = 20;
        var ad1 = rand(ad_cnt1);
        var link1;
        var adBanner1;
        var width1
        var height1
        var i = 0;
        for (i = 0; i <= ad_cnt1; i++) {
            if (ad1 == i) {
                adBanner1 = "/images/rotate/" + i + ".jpg";
            }
        }
        var currentAd5 = 1;
        function cycle5() {
            if (currentAd5 == ad_cnt1) {
                currentAd5 = 1;
            }
            var banner5 = document.getElementById('adBanner5');
            banner5.src = "/images/rotate/" + currentAd5 + ".jpg";
            currentAd5++;
        }
        window.setInterval("cycle5()", 5000);
-->
    </script>

And where I need to rotate the images I put this div 

  <div id="imageDiv">
                        <script language="javascript" type="text/javascript">
                            document.write('<center><img src="' + adBanner1 + '" id="adBanner5" width="620" height="250" border="0" alt="Some Alt Text">');
                            document.write('</center>');
                        </script>
                        <noscript>
                            <img src="/Images/rotate/1.jpg" id="adBanner5" border="0" width="620" height="250"
                                alt="Some Alt Text" /></noscript>
                        </div>



By the way "window.setInterval("cycle5()", 5000);" does the rotation at 5 sec interval... you can change it to suit your needs

And you are welcome



Friday, June 17, 2011

rang bikharenge toh fariyaad karegi khushboo
kisi phool ko chutki se machchal kar dekho

raat ko shamma ki maanind pighal kar dekho
zindagi kya hai kisi taap mai dhal kar dekho

Tuesday, May 24, 2011

just a thought

जिस दिन मंदिर की घंटी से स्वर मिल गया अज़ान का
उस दिन रूप बदल जायेगा अपने हिंदुस्तान का

Monday, May 16, 2011

Setting gridview edititemtemplate dropdownlist selectedvalue

This is a very quick way of setting the selectedvalue of dropdownlist in gridview edittemplate...

Just add the following to your dropdownlist

SelectedValue='<%# Bind("acceptance") %>' AppendDataBoundItems="true"


The entire column would look something like this




<asp:TemplateField HeaderText="Acceptance">

                <ItemTemplate>

                    <asp:Label ID="Acceptance" runat="Server" Text='<%# calcAcceptance((int) Eval("acceptance")) %>'  />

                </ItemTemplate>

                <EditItemTemplate>

                <asp:DropDownList ID="ddlAcceptance" runat="server"  SelectedValue='<%# Bind("acceptance") %>' AppendDataBoundItems="true">

                    <asp:ListItem Value="0">Acceptable</asp:ListItem> 

                    <asp:ListItem Value="1">Required</asp:ListItem> 

                </asp:DropDownList>

                </EditItemTemplate>

            </asp:TemplateField>




Wednesday, May 11, 2011

Posting Html code to blogger/blogspot

http://www.simplebits.com/cgi-bin/simplecode.pl

This is a simple but superb utility which lets you customize your html for posting to blogger !!!

Seal of approval from me...

I can be definitely not be the only person who thinks of a seal nodding approvingly every time they say seal of approval... am I ??

Placeholder dynamic controls

So, I had to build on what I started yesterday.

Now I have a spiffy code sample for all the times when I want to add dynamic controls to placeholders..

The sample below adds 5 rows to a table with all kinds of funky controls each having its own properties set separately....

Here it goes ....drumroll !!!!!!

Front End


 <table class="sofT" style="width: 100%">
        <tr>
            <td class="SubClass">
                Course #
            </td>
            <td class="SubClass">
                Course Title
            </td>
            <td class="SubClass">
                Hours
            </td>
            <td class="SubClass">
                Grade
            </td>
            <td class="SubClass">
                Grade Pt.
            </td>
        </tr>
 <tr>
            <td>
                <asp:Label ID="lblCrNo5" runat="server"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="tbCrNo5" runat="server" Width="300"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="tbHrs5" runat="server" Width="30" Text="0.00"></asp:TextBox>
            </td>
            <td>
                <asp:DropDownList ID="ddlHrs5" runat="server">
                </asp:DropDownList>
            </td>
            <td>
                <asp:TextBox ID="tbGPA5" runat="server" Width="30" Text="0.00" Enabled="false"></asp:TextBox>
            </td>
        </tr>
        <asp:PlaceHolder ID="plCols" runat="server"></asp:PlaceHolder>
    </table>
 <asp:Label ID="lblCounter" runat="server" Visible="false"></asp:Label>
  <hr />
          <asp:Button ID="btnAdd" runat="server" CssClass="btn" Text="Add More Classes"
                    onclick="btnAdd_Click" />



And in the backend 



  protected void Page_Load(object sender, EventArgs e)
    {
        if (Cache["tt"] != null)
        {
            Panel tt = Cache["tt"] as Panel;
            plCols.Controls.Add(tt);


        }
}


 protected void btnAdd_Click(object sender, EventArgs e)


    {
            Panel tt = new Panel();
     
        int courseCounter = Convert.ToInt32(lblCounter.Text);


//this is a fix needed else 5 gets repeated twice.... 
        if (courseCounter == 5)
            courseCounter = 6;


        int numlabels = courseCounter + 5;


//this is getting the data for dropdownlist 
        DataTable ddlTable = createDdlTable();


        for (; courseCounter < numlabels; courseCounter++)
        {


            DropDownList ddl = new DropDownList();


            // Set the label's Text and ID properties.
            ddl.DataSource = ddlTable;
            ddl.DataTextField =  "hrsToShow";
            ddl.DataValueField = "hrsToShow";
            ddl.ID = "ddlHrs" + courseCounter;
            ddl.DataBind();
           
            Label lbl = new Label();
            lbl.ID = "lblCrNo"+courseCounter;
            lbl.Text = courseCounter.ToString();


            TextBox tb = new TextBox();
            tb.ID="tbCrNo"+courseCounter;
            tb.Width= 300;


            TextBox tb1 = new TextBox();
            tb1.ID="tbHrs"+courseCounter;
            tb1.Width= 30;
            tb1.Text = "0.00";


            TextBox tb2 = new TextBox();
            tb2.ID="tbGPA"+courseCounter;
            tb2.Width= 30;
            tb2.Text = "0.00";
            tb2.Enabled=false;


      //I know all this can be single Add... divided it for clarity !!
            tt.Controls.Add(new LiteralControl(""));
            tt.Controls.Add(lbl);
            tt.Controls.Add(new LiteralControl(""));
            tt.Controls.Add(tb);
            tt.Controls.Add(new LiteralControl(""));
            tt.Controls.Add(tb1);
            tt.Controls.Add(new LiteralControl(""));
            tt.Controls.Add(ddl);
            tt.Controls.Add(new LiteralControl(""));
            tt.Controls.Add(tb2);
            tt.Controls.Add(new LiteralControl(""));
            plCols.Controls.Add(tt);
            Cache["tt"] = tt;
        }


        ddlTable.Dispose();
        lblCounter.Text = numlabels.ToString();
    }



And as Disney says ...THATS ALL,  FOLKS !!


Hope to add the processing of dynamic controls thus added to tomorrow's post