Monthly Archive for November, 2004

XP Command List

I just had to put down this link for future reference.

Funny proposals

 
1. (Walk up behind girl and point fingers shaped like gun into her back)
 You’re under arrest! ; (For what?) For stealing my heart

2. Hi, my name is Chance, Do I have one?
 
3. are your legs tired? ( girl: Why?) because you have been running
 through my mind all day!
 
4. I lost my phone number, can I borrow yours?
 
5. Can you give me directions to your heart? I’ve seemed to have lost myself in your eyes..
 
6. (Take a look at the tag on the girls shirt, jacket, etc.); She would  say ; What are doing & respond, Oh, just checking to see if you were  made in Heaven.
 
7. (Pick up a flower and walk over to girl.)I was just showing this flower how beautiful you are.
 
8. Is it hot in here or is it just you?
 
9. Walk up to a gal and say: Are you from Greece? She answers ‘No’. Oh, I  thought all the gods were from Greece…
 
10. I could be born in your eye, run down your cheek, and & die on your  lips.
 
11. Did you know they changed the alphabets order ? They put U and I  together.
 
12. Are you lost? ’cause it’s so strange to see an angel so far from heaven.
 
13. Do you believe in love at first sight, or do I have to walk by you again?
 
14. What’s that in your eye? Oh…it’s a sparkle.
 
15. Do you have a map? I just got lost in your eyes.
 
16. You can forget about going to heaven because it’s a sin to look that  good.
 
17. If I had eleven roses and you, I’d have a dozen.
 
18. Boy: Is ur father a terrorist?
Gal: NO !!!!!! Why ?????????????
Boy: Coz U R a Bomb !!!

FileIOPermission

To check for file permission you still have to try to openWrite it .
just check this out you still have to open and test it cause demand
only checks for CAS.. and well the code does have access to the
concept of the directory and the file .. but its NTFS that inhibits
this access.

using System;
using System.IO;

public class FileTest
{
public static void Main()
{

  string fileName = @"c:\Security\text.txt";
  System.Console.Write("test");

    try
    {

      Console.WriteLine("File exists: " +
      System.IO.File.Exists(fileName).ToString());
      FileStream fs;

      System.Security.Permissions.FileIOPermission f = new
      System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.AllAccess,
      fileName);
      f.Demand(); //Somehow i feel that this should have been enough.. 
      Console.WriteLine("Demand checked");
      if ((fs = System.IO.File.OpenRead(fileName)) != null)
      {

        fs.Close();
        Console.WriteLine("File Closed");
      }
    }
    catch (System.IO.IOException ex)
    {
    // Console.WriteLine(ex.StackTrace); 
    Console.WriteLine("Message " + ex.Message);
    }
    catch (Exception ex)
    {
    Console.WriteLine(ex.StackTrace);
   }
  }
} 

Tab pages DHTML IE

<%@ Page CodeBehind="test.aspx.cs" Language="c#" AutoEventWireup="false" Inherits="SLK.RTS.Web.test" %>

<HTML>

            <HEAD>

                        <script language="javascript">

                                    function TabClick( nTab )


                                   {          nTab = parseInt(nTab);

                                                var oTab;

                                                var prevTab = nTab-1;

                                                var nextTab = nTab+1;

                                                event.cancelBubble = true;

                                                el = event.srcElement;

                                                for (var i = 0; i < TabPage.length; i++)

                                                {                     
                                                                oTab = Tab[i];

                                                            oTab.className = "clsTab";

                                                            oTab.style.borderLeftStyle = "";

                                                            oTab.style.borderRightStyle = "";

                                                            TabPage[i].style.display = "none";

                                                }

                                                TabPage[nTab].style.display = "block";

                                                Tab[nTab].className = "TabSelected";

                                                oTab = Tab[nextTab];

                                                if (oTab) oTab.style.borderLeftStyle = "none";

                                                            oTab = Tab[prevTab];

                                                if (oTab) oTab.style.borderRightStyle = "none";

                                                            event.returnValue = false;

                                                document.getElementById('hdnTabSelected').value = nTab;

                                    }

                                                           

                                    function BodyOnLoad()

                                    {

                                                if(document.getElementById('hdnTabSelected').value!=null)

                                                            TabClick(document.getElementById('hdnTabSelected').value);                                                                  

                                    }

                                    </script>

       <LINK rel="stylesheet" type="text/css" href="http://localhost/RTS/Includes/Style.css">

       </HEAD>

        <body onload='BodyOnLoad();'>

            <form runat="server">

                <TABLE id="Table1" cellSpacing="0" cellPadding="0" width="300" border="0">

                    <TR>

                        <td>

                           <input type="hidden" id="hdnTabSelected" value="0" runat="server">

                          </td>

                          <TD id="Tab" onclick="TabClick('0');">A</TD>

                           <TD id="Tab" onclick="TabClick('1');">B</TD>

                           <TD id="Tab" onclick="TabClick('2');">C</TD>

                      </TR>

                  </TABLE>

                   <table id="TabPage" class="TabPage">

                      <TR>

                          <td>Page1

                                           <asp:Button id="Button1" runat="server" Text="Button"/>&nbsp;

                                            <asp:DropDownList id="DropDownList1" runat="server"/>
                            </
td>

                        </tr>

                     </table>

                     <table id="TabPage" class="TabPage">

                              <tr>

                                <td>

                                    Page2

                                </td>

                            </tr>

                        </table>

                        <table id="TabPage" class="TabPage">

                                      <tr>

                                      <td>Page3

                                  </td>

                              </tr>

                        </table>

                        </form>

            </body>

</HTML>

Maintain Header while scrolling- DHTML IE


Position of parent is located using the findPos methods for X and Y

 

<%@ Page language="c#" Codebehind="GridHeaderTest.aspx.cs" AutoEventWireup="false" Inherits="UI.Home.GridHeaderTest" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<HTML>

            <HEAD>

                        <title>GridHeaderTest</title>

                        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">

                        <meta name="CODE_LANGUAGE" Content="C#">

                        <meta name="vs_defaultClientScript" content="JavaScript">

                        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

                        <LINK href="../../includes/Style.css" type="text/css" rel="stylesheet">

                        <script language="javascript">

                        //Method takes in the source layer

                        //The table whose header is to be duplicated ..

                        // and the destination layer where the header is to be inserted. as dom objecst

                        //script is for IE

                        function DrawHeader(srcLayer,srcTable,destLayer)

                        {

                           var newTable = destLayer.id + 'Table';

                           var ctr=0;

                          

                           //destLayer.style['LEFT'] = srcTable.offsetLeft;

                          

                           headerRow = srcTable.rows[0];

                          

                          

                           destLayer.innerHTML = '<table id='+ newTable +'>' + headerRow.outerHTML + '</table>';

                          

                           var oTable = destLayer.document.getElementById(newTable);

                           //oTable.border = srcTable.border;

                           oTable.border = 0;

                           oTable.width = srcTable.offsetWidth;

                           oTable.rows[0].style['height'] = headerRow.offsetHeight ;

                          

                           for(ctr=0;ctr<headerRow.cells.length;ctr++)

                           {

                              oTable.rows[0].cells[ctr].style['width'] = headerRow.cells[ctr].offsetWidth – 4;

                           }

                          

                           //Position the layer reduce the top by 2 pixels to allign the table above.

                           destLayer.style['position']='absolute';

                           destLayer.style['top'] = findPosY(srcLayer) -2//-srcTable.border;

                           destLayer.style['left'] = findPosX(srcLayer);                    

                           destLayer.style['width'] = srcLayer.offsetWidth;

                          

                        }

                       

                       

                                    function findPosX(obj)

                                    {

                                                var curleft = 0;

                                                if (obj.offsetParent)

                                                {

                                                            while (obj.offsetParent)

                                                            {

                                                                        curleft += obj.offsetLeft

                                                                        obj = obj.offsetParent;

                                                            }

                                                }

                                                else if (obj.x)

                                                            curleft += obj.x;

                                                return curleft;

                                    }

                                    function findPosY(obj)

                                    {

                                                var curtop = 0;

                                                if (obj.offsetParent)

                                                {

                                                            while (obj.offsetParent)

                                                            {

                                                                        curtop += obj.offsetTop

                                                                        obj = obj.offsetParent;

                                                            }

                                                }

                                                else if (obj.y)

                                                            curtop += obj.y;

                                                return curtop;

                        }

                       

                        //Method to call on body load to redraw the headers

                        function BodyOnLoad()

                        {

                                    if(document.all)

                                    {

                                                DrawHeader(document.getElementById('divGrid'),document.getElementById('Table1'),document.getElementById('divHeader'));

                                    }

                        }

                        </script>

            </HEAD>

            <body MS_POSITIONING="GridLayout" onload='BodyOnLoad();'>

                        <form id="Form1" method="post" runat="server">

                                    <div id="divHeader" style="Z-INDEX:3;LEFT:200px;POSITION:absolute;TOP:64px;display:block">

                                    </div>

                                    <div id="divGrid" style="Z-INDEX:2;OVERFLOW-Y: auto; LEFT: 100px; WIDTH: 300px; POSITION: relative; TOP: 100px; HEIGHT: 100px">

                                                <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="300" border="0">

                                                            <TR class="GridHeader">

                                                                        <TD>No</TD>

                                                                        <TD>Col1</TD>

                                                                        <TD>Col2</TD>

                                                            </TR>

                                                            <TR>

                                                                        <TD>asdfasdfasdf</TD>

                                                                        <TD>asdfasdfasdf</TD>

                                                                        <TD>asdfasdf</TD>

                                                            </TR>

                                                            <TR>

                                                                        <TD>asdfasdf</TD>

                                                                        <TD>asdfasd</TD>

                                                                        <TD>asdfasdfasasdfasdfasdfasdf</TD>

                                                            </TR>

                                                            <TR>

                                                                        <TD>asdfasdf</TD>

                                                                        <TD>asdfasd</TD>

                                                                        <TD>asdfasdfasasdfasdfasdfasdf</TD>

                                                            </TR>

                                                            <TR>

                                                                        <TD>asdfasdf</TD>

                                                                        <TD>asdfasd</TD>

                                                                        <TD>asdfasdfasasdfasdfasdfasdf</TD>

                                                            </TR>

                                                            <TR>

                                                                        <TD>asdfasdf</TD>

                                                                        <TD>asdfasd</TD>

                                                                        <TD>asdfasdfasasdfasdfasdfasdf</TD>

                                                            </TR>

                                                            <TR>

                                                                        <TD>asdfasdf</TD>

                                                                        <TD>asdfasd</TD>

                                                                        <TD>asdfasdfasasdfasdfasdfasdf</TD>

                                                            </TR>

                                                </TABLE>

                                    </div>

                        </form>

            </body>

</HTML>