Wednesday, April 25, 2012

PL/SQL PROGRAMS

PL/SQL PROGRAMS


http://www.scribd.com/doc/15991409/TotalPLSQL-Programs




Hide Files and Folders Through Command Prompt

You can now easily hide your files or folders through Command Prompt. It will be impossible for others to find the file or folder unless they know the filename or folder name. You can secure your documents easily by this method. Make sure you remember the file or folder name! 


How To Hide Files And Folders? 
We are now going to hide a folder using Command Prompt from Windows


Suppose if you want to hide a folder named Gopi in your E drive. 
Then open the Command Prompt. [Goto Run and type cmd] 




Type attrib +s +h E:\Gopi 


Where , E:\ : Drive name 


Gopi : Folder name 




And If you want to make that folder appear, 




Type, attrib -s -h E:\Gopi








Monday, April 9, 2012

Creating A Simple Web Browser

In this tutorial I will show how to create a simple web browser application in C# using WinForms. I should mention, that in this project is used the WebBrowser control, which is a part of Internet Explorer. In this tutorial I also will use some XML, so you need at least a basic understanding of what it is.

Special Tutorial Requirements:
    * C# IDE (Visual Studio 2008 used in this tutorial)
    * .NET Framework 2.0

So, here we go.

1. Create a C# Windows Forms application:

Posted Image

2. Add a WebBrowser component to your form:

Posted Image

3. Change the WebBrowser control's Dock property to None:

Posted Image

4. Set the WebBrowser control's Anchor property to Top, Bottom, Left, Right (in this case the control will be resized with the form). As you see on the picture, it is set just to Top, Bottom, Right. This is because my form is resized only to the right, but you can change this property to other values as well.

Resized to 49% (was 1024 x 768) - Click image to enlargePosted Image


5. Add a ToolStrip control to your form: 

Resized to 49% (was 1024 x 768) - Click image to enlargePosted Image


6. Add some buttons to the ToolStrip control (we'll need 5 buttons).

Resized to 49% (was 1024 x 768) - Click image to enlargePosted Image


7. Set the DisplayStyle property of every added button to Text (you can change the style to one you like most).

8. Set the Text property of the buttons to the following: 
  • <
  • FORWARD>>
  • REFRESH
  • STOP
  • HOME

9. Add a ListBox control to your form:

Posted Image

10. Anchor the ListBox control to Top, Right, Bottom:

Resized to 49% (was 1024 x 768) - Click image to enlargePosted Image


11. Add a text field to the ToolStrip and a button with the Text property set to GO:

Posted Image

12. Change the Width property of the text field to 300 (so the URL can be fully viewable): 

Resized to 49% (was 1024 x 768) - Click image to enlargePosted Image


13. Add 2 buttons at the top of the ListBox (Add and Remove):

Resized to 49% (was 1024 x 768) - Click image to enlargePosted Image


So, the form looks like this:

Posted Image


Now, let's pass to the code:


1. Declare the System.Xml namespace:

1using System.Xml;


2. Declare the variable Home as string. It will keep the home page from the XML.

1public string Home;


3. Code for the Form1_Load event:

01// Creates a closing event for the form.
02this.Closing += new CancelEventHandler(Form1_Closing);
03 
04listBox1.MouseDoubleClick += newMouseEventHandler(listBox1_MouseDoubleClick);
05            XmlDocument loadDoc = new XmlDocument();
06            loadDoc.Load(Application.StartupPath + "\\load.xml");
07            Home = loadDoc.SelectSingleNode("/browser/home").Attributes["url"].InnerText;
08            webBrowser1.Navigate(Home);
09 
10            foreach(XmlNode favNode inloadDoc.SelectNodes("/browser/favorites/item"))
11                listBox1.Items.Add(favNode.Attributes["url"].InnerText);


The XML document is in the following format:

01
02 
04 
05
06'www.ymail.com' />
07'www.dreamincode.net' />
08
09 
10


The file name is load.xml and the file is located in the same folder, as the executable. You can change the file path to the one you want. The ListBox is populated with favorites from the XML.

4. Code for the "<

1private void toolStripButton1_Click(object sender, EventArgs e)
2        {
3            webBrowser1.GoBack();
4 
5        }


5. Code for the "FORWARD>>" button:

1private void toolStripButton2_Click(object sender, EventArgs e)
2        {
3            webBrowser1.GoForward();
4        }


6. Code for the "REFRESH" button:

1private void toolStripButton3_Click(object sender, EventArgs e)
2        {
3            webBrowser1.Refresh();
4        }


7. Code for the "STOP" button:

1private void toolStripButton4_Click(object sender, EventArgs e)
2       {
3           webBrowser1.Stop();
4       }


8. Code for the "HOME" button:


1private void toolStripButton5_Click(object sender, EventArgs e)
2        {
3            webBrowser1.Navigate(Home);
4        }


Remember I declared the Home variable as string? Now the browser will navigate to that URL if the "HOME" button is pressed.

9. The code for the listBox1_MouseDoubleClick (this event handler was declared in the Form1_Load event):

1private void listBox1_MouseDoubleClick(object sender, EventArgs e)
2        {
3            if (listBox1.SelectedItem != null)
4                webBrowser1.Navigate(listBox1.SelectedItem.ToString());
5        }


10. The code for the "Add" button:

1private void button1_Click(object sender, EventArgs e)
2        {
3            listBox1.Items.Add(webBrowser1.Url.OriginalString);
4        }


11. The code for the "Remove" button:

1private void button2_Click(object sender, EventArgs e)
2        {
3            // Removes the selected favorites entry.
4            listBox1.Items.Remove(listBox1.SelectedItem);
5        }


12. Now we need to program the Closing event of our form:

01private void Form1_Closing(object sender, CancelEventArgs e)
02        {
03XmlTextWriter writer = new XmlTextWriter(Application.StartupPath +"\\load.xml"null);
04 
05            writer.WriteStartElement("browser");
06            writer.WriteStartElement("home");
07            writer.WriteAttributeString("url","http://www.dreamincode.net");
08            writer.WriteEndElement();
09            writer.WriteStartElement("favorites");
10            for (int i=0; i < listBox1.Items.Count; i++ )
11            {
12                writer.WriteStartElement("item");
13                writer.WriteAttributeString("url", listBox1.Items[i].ToString());
14                writer.WriteEndElement();
15            }
16            writer.WriteEndElement();
17            writer.WriteEndElement();
18            writer.Close();
19}


This one writes the stored favorites to the above mentioned load.xml using XmlTextWriter. If you look closer at the format of the file, you will see that this code writes the home page for our browser and every item in the favorites list (which is being parsed item-by-item).

Congratulations!
You've just created your own IE-based web browser!

Of course this tutorial shows only the basics of creating such kind of applications, but it gives an essential understanding on how the WebBrowser control works.

Search This Blog