Saturday, September 28, 2013

PROGRESS BAR IMPLEMENTATION USING "AJAX" IN AN ASP.NET APPLICATION

Hey All , Ever noticed a PROGRESS BAR getting displayed while you are browsing through an application on the internet ?? You must have noticed that at many places when ever you click on a control that brings up the data from the Server side it displays a Progress Icon which informs the user that the fetch/update action is taking place and the application is running so that the user doesn't feels that the application has got hanged up on the user's click on the web control.

So, ASP.NET users , here's all you need to know to implement this functionality in your ASP.NET application. The entire code is given below. Just include this and you'll be good to go.

Finally to start off the implementation, there is an AJAX ASP.NET Control that provides status information about partial-page updates called UpdateProgress. It's very useful to "control" the user patience but permits that the user continue interacting with other controls in the application, and rare behaviors can result if the user clicks other button or does other Postback action.

// UpdateProgress Implementation Example
<asp:UpdateProgress ID="UpdateProg1" DisplayAfter="0" runat="server">
  <ProgressTemplate>
    <div style="position: relative; top: 30%; text-align: center;">
     <img src="loading.gif" style="vertical-align:middle" alt="Processing"/>
      Processing ...
    </div>
  </ProgressTemplate>
</asp:UpdateProgress>

Unfortunately there doesn't exists an ASP.NET AJAX control that "blocks" the application while a Postback request is made to the server, but fortunately we can make a powerful combination using this control in conjunction with an AJAX Control Toolkit's called ModalPopup Extender, that allows a page to display content to the user in a "modal" manner which prevents the user from interacting with the rest of the page.

//Modal Popup Extender Implementation Example
<ajaxToolkit:ModalPopupExtender ID="ModalProgress"
runat="server" TargetControlID="panelUpdateProgress"
BackgroundCssClass="modalBackground" PopupControlID="panelUpdateProgress" />

Now, this is the interesting part, take the power of each one of this controls to create a composite functionality that shows a progress indicator to the user in a modal window way, blocking the user interaction with the application while it's processing a previous Postback request. The next code example shows how to do this:

// Include this page directives to reference ASP.net AJAX controls
// from AJAX and the Toolkit
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI"
TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="ajaxToolkit" %>

// Include ScriptManager tag manages client script for Microsoft
// ASP.NET AJAX pages
<asp:ScriptManager ID="ScriptManager1" runat="server" />

// Include UpdateProgress Control inside a Panel Control
// and then the ModalPopupExtender Control
<asp:Panel ID="panelUpdateProgress" runat="server"
CssClass="updateProgress">
    <asp:UpdateProgress ID="UpdateProg1" DisplayAfter="0" runat="server">
      <ProgressTemplate>
        <div style="position: relative; top: 30%; text-align: center;">
          <img src="loading.gif" style="vertical-align: middle"
          alt="Processing" />
          Processing ...
        </div>
      </ProgressTemplate>
    </asp:UpdateProgress>
  </asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="ModalProgress" runat="server"
TargetControlID="panelUpdateProgress" BackgroundCssClass="modalBackground"
PopupControlID="panelUpdateProgress" />

It's necessary to add a pair of javasctript functions that are executed at the initial and final AJAX requests.

//JavaScript code included at jsUpdateProgress.js file
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endReq);  
function beginReq(sender, args){
    // shows the Popup
    $find(ModalProgress).show();      
}

function endReq(sender, args) {
    //  shows the Popup
    $find(ModalProgress).hide();
}

You can view that the javascript functions references a variable called ModalProgress, this variable must be created in the ASP.net page's code. The next code shows how to do it:

<script type="text/javascript" language="javascript">
      var ModalProgress ='<%= ModalProgress.ClientID %>';      
</script>

<script type="text/javascript" src="jsUpdateProgress.js"></script>

Finally we add a little CSS code to show a gray contour in the modal window, and a cute format to the image and text.

.modalBackground
{
    background-color: Gray;
    filter: alpha(opacity=50);
    opacity: 0.50;
}

.updateProgress
{
    border-width: 1px;
    border-style: solid;
    background-color: #FFFFFF;
    position: absolute;
    width: 180px;
    height: 65px;
}

THIS IS IT. GO ON CODERS...IMPLEMENT IT !!!

Monday, September 23, 2013

Java Code Snippet Output

Here's the Solution to the snippet :

       *
     ***
   *****
 *******


Viewing Hidden/Small FB Profile Pics Clearly

Ever stuck up in a situation where you were visiting Someone's profile and were not able to open up his/her ( MOSTLY 'HER' WOULD BE THE CASE :P) Display Picture just because the concerned person is either not your friend so you are not allowed to open up the picture OR the person has deleted the photo from inside the album to prevent people from opening and downloading it....

If you nodded to the above question and you want to have a look at the SO VERY EASY SOLUTION to the issue just follow the following steps :


STEPS :

1. Open the facebook profile of person whose profile picture is locked or is set to private.

2. Right click on the profile picture and click on Copy Image Url as shown in image below.



3. Open that image in new tab by right clicking and selecting Paste (CTRL + V)

4. Now change the value of image size highlighted below which might be s160x160

to s720x720 (If its not clear try (s320x320)

5. The image will be enlarged in size.

Sunday, September 22, 2013

HIDING FILES TRICK 2 - LEARN TO HIDE FILES BEHIND IMAGES


How To Hide File Behind Image ?

1. Select an image to be used for hiding file behind the image.
2. Now select a file to hide behind the image and make it in .RAR format. With the help of the WinRAR.
3. And most important is that paste both the files on desktop. You may do this anywhere instead of desktop if you have some basic understanding of command line.
4. Now open cmd by going to Start > Accessories > Command Prompt and type following commands in it.

          cd desktop

 5. CD stands for change directory by typing above command you change your directory to desktop. After that type command given below. 

Copy /b imagename.jpg + filename.rar finalimage.jpg

Replace imagename.jpg with the name of image you want your file to be hidden behind. Don't forget to add image format (Eg: .jpg,.png,.gif)
Replace filename with name of your file you want to hide. It must be in .rar format.
Finally Replace finalimage.jpg with whatever name you want your final image with hidden files should be
This is the image where your file will be hidden.

6. Now when you will try to open this newly created image it will open as normal image, but to open you hidden file you need follow steps given below.

How To Access Hidden File ?

To access your hidden file you need to open the newly created image in winrar. Just follow simple steps given below to do that.

    1. Open winrar
    2. Now locate your image and open it or simply drag your image in winrar.
    3. Extract the file and done.
    4. Your hidden files would be right there in front of you. !!! 

Password Protect Any Folder Without Any Software

Hey All , I am sure each one of Us is at some point or the other must have used some sort of HIDING softwares to hide things on our machine...SO lets find out today a TRICK to HIDE any thing that too PASSWORD PROTECT it WITHOUT the need of any kind of EXTERNAL SOFTWARE...

STEPS TO BE FOLLOWED :

1. Open Notepad and Copy code given into it.
cls
@ECHO OFF
title tarun
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST MyFolder goto MDMyFolder
:CONFIRM
echo Are you sure to lock this folder? (Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren MyFolder "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock Your Secure Folder
set/p "pass=>"
if NOT %pass%== taaskk goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" MyFolder
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDMyFolder
md MyFolder
echo MyFolder created successfully
goto End
:End

2. Save the notepad file as lock.bat (.bat is must)
3. Now double click on lock.bat and a new folder will be created    with name MyFolder
4. Copy all your data you want to protect in that New folder
5. Now double click on lock.bat and when command promp appears Type Y and press enter.
6. Now MyFolder will be hidden from you view (ensure that DO NOT SHOW HIDDEN FILE SETTINGS IS ACTIVATED ON YOU MACHINE), to access that folder double click on lock.bat
7. It will ask for password enter your password and done. (Default password is: taaskk)
To change the password replace taaskk with  new password in the above code

How To Further Secure ?

You might be thinking that anyone can access the password by opening that lock.bat file in Notepad or any other text editor. To make it more secure hide lock.bat in some secure location after following the above tutorial To access the secured file double click on lock.bat. I would suggest copying lock.bat file into Pendrive and copying it into your computer whenever you required to access to your protected files.

Saturday, September 21, 2013

IP Addressing

Introduction



This document gives you basic information needed in order to configure your router for routing IP, such as how addresses are broken down and how subnetting works. You learn how to assign each interface on the router an IP address with a unique subnet. There are many examples to help tie everything together.

Prerequisites

Requirements

Cisco recommends that you have knowledge of these topics:

Basic understanding of binary and decimal numbers.

Components Used

This document is not restricted to specific software and hardware versions.

Additional Information

If definitions are helpful to you, use these vocabulary terms to get you started:

Address—The unique number ID assigned to one host or interface in a network.

Subnet—A portion of a network sharing a particular subnet address.

Subnet mask—A 32-bit combination used to describe which portion of an address refers to the subnet and which part refers to the host.

Interface—A network connection.

If you have already received your legitimate address(es) from the Internet Network Information Center (InterNIC), you are ready to begin. If you do not plan to connect to the Internet, Cisco strongly suggests that you use reserved addresses from RFC 1918 leavingcisco.com.

Conventions

Refer to Cisco Technical Tips Conventions for more information on document conventions.

Understanding IP Addresses

An IP address is an address used in order to uniquely identify a device on an IP network. The address is made up of 32 binary bits, which can be divisible into a network portion and host portion with the help of a subnet mask. The 32 binary bits are broken into four octets (1 octet = 8 bits). Each octet is converted to decimal and separated by a period (dot). For this reason, an IP address is said to be expressed in dotted decimal format (for example, 172.16.81.100). The value in each octet ranges from 0 to 255 decimal, or 00000000 - 11111111 binary.

Here is how binary octets convert to decimal: The right most bit, or least significant bit, of an octet holds a value of 20. The bit just to the left of that holds a value of 21. This continues until the left-most bit, or most significant bit, which holds a value of 27. So if all binary bits are a one, the decimal equivalent would be 255 as shown here:

    1  1  1  1 1 1 1 1
  128 64 32 16 8 4 2 1 (128+64+32+16+8+4+2+1=255)
Here is a sample octet conversion when not all of the bits are set to 1.

  0  1 0 0 0 0 0 1
  0 64 0 0 0 0 0 1 (0+64+0+0+0+0+0+1=65)
And this is sample shows an IP address represented in both binary and decimal.

        10.       1.      23.      19 (decimal)
  00001010.00000001.00010111.00010011 (binary)
These octets are broken down to provide an addressing scheme that can accommodate large and small networks. There are five different classes of networks, A to E. This document focuses on addressing classes A to C, since classes D and E are reserved and discussion of them is beyond the scope of this document.

Note: Also note that the terms "Class A, Class B" and so on are used in this document to help facilitate the understanding of IP addressing and subnetting. These terms are rarely used in the industry anymore because of the introduction of classless interdomain routing (CIDR).

Given an IP address, its class can be determined from the three high-order bits. Figure 1 shows the significance in the three high order bits and the range of addresses that fall into each class. For informational purposes, Class D and Class E addresses are also shown.

AJAX IMPLEMENTATION in a ASP.NET APPLICATION

Anyone intereseted on having a hear on AJAX implementation in your ASP.NET application..
Lets take a word on this concept which melts of so smoothly into your application that its working would really impress you.

Ever seen a site such as a one which displays live Cricket scores or the one related to Stock Market where equity prices get update on a live feed without you refreshing the entire page. You would have seen only the portion related to the Cricket scores or the Stock prices gets updated. The rest of the page remains as it is. This concept is called as the PARTIAL RENDERING of the page.

So for this Partial Rendering to take place in any of your pages in your ASP.NET application , you need to implement AJAX on the source code for that page in your application. Wondering how to do that ?? Below is your answer...

Implement AJAX using Update Panel 



If you are an ASP.NET developer then you probably are aware of the AJAX Extension tab in Visual Studio (2008 or higher generally) Toolbox and the tab has a few very useful tools to implement AJAX in a web application. We will be implementing AJAX using UpdatePanel and ScriptManager . Both tools are available in the same tab of the Toolbox.

UpdatePanel

Let's learn a few lines about Update Panel. It's nothing but a region that will be updated in asynchronous operations (region which undergoes partial rendering/updation). And this is the beauty of AJAX. The contents of the UpdatePanel will be updated and the outside content will remain the same.

ScriptManager

This is the hero of AJAX implementation in ASP.NET. Before writing any code related to ajax you need to put a ScriptManager tag in the aspx page.

Let's see one example in action.

The following will print the time within an Update Panel:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    //Script manager tag is here
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
   
    // Code outside of Update panel
    Time at Load Time <%= DateTime.Now.ToLongTimeString() %>.
   
    // code inside Update panel
    <asp:UpdatePanel ID="UpdatePanel1"
         runat="server" UpdateMode="Conditional">
    <ContentTemplate>
    Latest Time by refresh <%= DateTime.Now.ToLongTimeString() %>.
    <br /><asp:Button Text="Refresh Time" ID="Button1"
        runat="server"/>
    </ContentTemplate>
    </asp:UpdatePanel> 

    </div>
   
    </form>
</body>
</html>
Here is the output window:




If you try this example in your Development environment and run it then you can find the second date display is updated after each press of the button, because it's within the update panel. But the first label is (First Time display) as it is. OK, you are saying , "this is a very simple example and it's not at all useful in project development". Then I will show you something more useful than this. Let's make a little database operation by AJAX technique.

Fetch Data from Database using AJAX


Here I would like to show how to fetch data from a database and display it within a Grid using AJAX. The basic concept or implementation is the same. I will keep a few controls within the Update Panel and that's all.

Here is my aspx page:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>           
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
   
   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:DropDownList ID="DDLAjax" runat="server" Height="16px" Width="117px">
            </asp:DropDownList>
            <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Show"
                Width="95px" />
            <br />
            <asp:GridView ID="GridView1" runat="server">
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>

If you observe the content of my aspx page then you will discover that I have kept one drop down list, one button and one GridView within the UpdatePanel. And our hero (read ScriptManager) is just in the previous line of update panel. Now it's time to observe C# code for the same aspx page.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
namespace YahooProject
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.DDLAjax.Items.Add("first");
                this.DDLAjax.Items.Add("second");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();
     con.ConnectionString = "Data Source=SERVERNAME;Initial atalog=DATABALENAME;Integrated Security=True";
            con.Open();
            SqlCommand cmd = null;

            if (this.DDLAjax.SelectedItem.Text == "first")
            {
                cmd = new SqlCommand("select * from first",con);
            }
            if (this.DDLAjax.SelectedItem.Text == "second")
            {
                cmd = new SqlCommand("select * from second", con);
            }
            this.GridView1.DataSource = cmd.ExecuteReader();
            this.GridView1.DataBind();
        }
    }
}

Hey; no rocket science here. The user will choose the table name by selecting it from the drop down list and after clicking the button the data from the relevant table will be fetched and bound with the Grid View. And we need to keep in mind only the component within the update panel (here GridView basically) will be updated. 


OK, I hope you got the basic idea of UpdatePanel to implement AJAX. May be you try this out and in case of any further or advanced issues on the concept you can get back to us . Taaskk will be there to sort out the issue.

SOME VERY USEFUL TYPING TRICKS

Typing Tricks

  • Delete an entire word Instead of deleting a single letter, pressing CTRL + BKSP will delete the entire word behind the cursor. This makes deleting text quicker if you screw up a whole word.
  • Move Cursor to beginning of the next or previous word Moving the cursor around manually while typing is a great way to make your work take longer than it needs to. To speed of the process, move the cursor around with keyboard shortcuts. To move it to the beginning of the previous word, use CTRL + Left Arrow. To move it to the beginning of the next word, use CTRL + Right Arrow. In OS X you can accomplish the same using the Option key.
  • Making sub and superscript text If you need to make sub or superscript text (think exponents for superscript), press CTRL + = for subscript and CTRL + SHIFT + = for superscript.
  • Paste plain text of what was copied When you copy text from any source, programs will usually copy any formatting that comes with it. To paste this as plain text, press CTRL + Shift + V instead of the standard CTRL + V, and the system will paste unformatted text.
  • Note that many programs follow this parameter (Chrome, Firefox, etc.) but not all, particularly Microsoft programs like Word or Outlook. For those there's a few alternatives that go beyond copying and pasting in Notepad: 1) CTRL + ALT + V will show a 'paste special' dialog box. 2) CTRL + Spacebar will remove formatting in already pasted text. 3) Download Puretext and choose a hotkey to always paste plain text with it.

FOLDER COLORIZER

Feeling sick of the same old Yellow colour coming up for the folders you create on your machine. Want to segregate your folders based on your needs by using various colour.

Try the FOLDER COLORIZER.
DOWNLOAD the software through 
http://download.cnet.com/Folder-Colorizer/3000-2072_4-75609440.html

After installation, just right click on the folder you want to colorize and select colorize! THAT's IT .... AND U R DONE !!!

If its a new folder that you colourising, then that would happen on the first go but if its a folder that contains data then whille selecting the colour on the first go it would create an image file for your folder. So just repeat the process again and the awesomeness of the coloured folder would be right in front of you.

TRY IT OUT !!!

WINDOWS 7 GOD MODE

WINDOWS 7 GOD MODE :

Windows 7 is predominantly the best OS ever in the history of Microsoft. But, do you know that it has a GodMode within it ?
There is a hidden “GodMode” feature that lets a user access all of the operating system’s control panel features from within a single folder.
To enter “GodMode,” one need to create a new folder and then rename the folder to the following:
GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
Just try it..:)

To try out some more of Microsoft’s inbuilt godmode dev tools-

Append each of these after “FolderName.”


{00C6D95F-329C-409a-81D7-C46C66EA7F33}{0142e4d0-fb7a-11dc-ba4a-000ffe7ab428}{025A5937-A6BE-4686-A844-36FE4BEC8B6D}{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}{1206F5F1-0569-412C-8FEC-3204630DFB70}{15eae92e-f17a-4431-9f28-805e482dafd4}{17cd9488-1228-4b2f-88ce-4298e93e0966}{1D2680C9-0E2A-469d-B787-065558BC7D43}{1FA9085F-25A2-489B-85D4-86326EEDCD87}{208D2C60-3AEA-1069-A2D7-08002B30309D}{20D04FE0-3AEA-1069-A2D8-08002B30309D}Example- Invincible.
{17cd9488-1228-4b2f-88ce-4298e93e0966}}


Now Go and “GOD MODE YOURSELF”.


Friday, September 20, 2013

Configuring IP Addresses on Router Interfaces

first of all you need to have GNS3  or cisco packet tracer software on your pc (with a good configuration)

BEFORE STARTING NETWORKING One must know how to Give IP ADDRESSES ON THE INTERFACES.

Now open the GNS 3 or Cisco packet tracer and arrange the three (or as many u want) routers indicated as circular shape device in the following manner.Now connect all of them with a "Serial link" cable.
You have now arranged the devices.now its time to do some real work with commands.

Now enter the console of the router by double clicking on the router you wanted to configure.For example if u want to enter on router 1,just double click on it and the console window will be opened.
now  just enter the follwing commands/codes on the respective routers.
and dats it, you have successfully configured the ip address.

refer to the snapshots for codes*.



Thursday, September 19, 2013

JavaScript Interactive Message PopUps

 The 3 "commands" involved in creating alert, confirm, and prompt boxes are:


window.alert()

window.confirm()

window.prompt()


Lets look at them in detail. 


  • The first one is:

window.alert()


This command pops up a message box displaying whatever you put in it. For example:


<body>

<script type="text/javascript">

window.alert("My name is George. Welcome!")

</script>

</body>


  • The second one is:

window.confirm()


Confirm is used to confirm a user about certain action, and decide between two choices depending on what the user chooses.


var x=window.confirm("Are you sure you are ok?")

<script type="text/javascript">

if (x)

window.alert("Good!")

else

window.alert("Too bad")

</script>



There are several concepts that are new here, and I'll go over them. First of all, "var x=" is a variable declaration; it declares a variable ("x" in this case) that will store the result of the confirm box. All variables are created this way. x will get the result, namely, "true" or "false". Then we use a "if else" statement to give the script the ability to choose between two paths, depending on this result. If the result is true (the user clicked "ok"), "good" is alerted. If the result is false (the user clicked "cancel"), "Too bad" is alerted instead. (For all those interested, variable x is called a Boolean variable, since it can only contain either a value of "true" or "false").


  • The third one is:

window.prompt()


Prompt is used to allow a user to enter something, and do something with that info:


var y=window.prompt("Enter your name")

<script type="text/javascript">

window.alert(y)

</script>



The concept here is very similar. Store whatever the user typed in the prompt box using y. Then display it.