Category: tricks



ASP.NET 4 includes a feature called SQL cache invalidation. Before ASP.NET 2.0, cachingthe results that came from SQL Server and updating the cache based on a time interval was possible — for example, every 15 seconds or so.

This meant that the end user might see stale data if the result set changedsometime during that 15-second period.In some cases, this time interval result set is unacceptable. In an ideal situation, the result set stored in thecache is destroyed if any underlying change occurs in the source from which the result set is retrieved — inthis case, SQL Server.

With ASP.NET 4, you can make this happen with the use of SQL cache invalidation.This means that when the result set from SQL Server changes, the output cache is triggered to change, andthe end user always sees the latest result set. The data presented is never stale.


Advertisements

ASP.NET COUNTDOWN TIMER . .


Paste the following code in header  . .

<div id=”timelabel”></div>

<script type=”text/javascript”>

var leave = <%=seconds %>;
CounterTimer();

var interv=setInterval(CounterTimer,1000);
function CounterTimer()

{

var day = Math.floor(leave / ( 60 * 60 * 24))

var hour = Math.floor(leave / 3600) – (day * 24)

var minute = Math.floor(leave / 60) – (day * 24 *60) – (hour * 60)

var second = Math.floor(leave) – (day * 24 *60*60) – (hour * 60 * 60) – (minute*60)
hour=hour<10 ? “0″ + hour : hour;

minute=minute<10 ? “0″ + minute : minute;

second=second<10 ? “0″ + second : second;
var remain=day + ” days   “+hour + “:”+minute+”:”+second;

leave=leave-1;
document.getElementById(“timelabel”).innerText=remain;
}

</script>

</body>

</html>

————————

Code Behind . . .

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.IO;
namespace tests{
public partial class _Default : System.Web.UI.Page

{

public double seconds;

protected void Page_Load(object sender, EventArgs e)

{

seconds = (GetEndTime() – GetStartTime()).TotalSeconds;

}

private DateTime GetStartTime()

{            return DateTime.Now;        }

private DateTime GetEndTime()        {            return new DateTime(2011, 8, 23, 8, 10, 0);        }

}

}

Thank you . .

DateTime Formats . . (.NET)


DateTime.Now; 3/14/2011 12:45:24 AM
DateTime.Now.ToString(); 3/14/2011 12:45:24 AM
DateTime.Now.ToShortTimeString() 12:45 AM
DateTime.Now.ToShortDateString() 3/14/2011
DateTime.Now.ToLongTimeString() 12:45:24 AM
DateTime.Now.ToLongDateString() Monday, March 14, 2011

DateTime.Now.ToString(“d”) 3/14/2011
DateTime.Now.ToString(“D”) Monday, March 14, 2011
DateTime.Now.ToString(“f”) Monday, March 14, 2011 12:45 AM
DateTime.Now.ToString(“F”) Monday, March 14, 2011 12:45:24 AM
DateTime.Now.ToString(“g”) 3/14/2011 12:45 AM
DateTime.Now.ToString(“G”) 3/14/2011 12:45:24 AM
DateTime.Now.ToString(“m”) March 14
DateTime.Now.ToString(“r”) Mon, 14 Mar 2011 00:45:24 GMT
DateTime.Now.ToString(“s”) 2011-03-14T00:45:24
DateTime.Now.ToString(“t”) 12:45 AM
DateTime.Now.ToString(“T”) 12:45:24 AM
DateTime.Now.ToString(“u”) 2011-03-14 00:45:24Z
DateTime.Now.ToString(“U”) Monday, March 14, 2011 5:45:24 AM
DateTime.Now.ToString(“y”) March, 2011
DateTime.Now.ToString(“dddd, MMMM dd yyyy”) Monday, March 14 2011
DateTime.Now.ToString(“ddd, MMM d “‘”yy”) Mon, Mar 14 ’11
DateTime.Now.ToString(“dddd, MMMM dd”) Monday, March 14
DateTime.Now.ToString(“M/yy”) 3/11
DateTime.Now.ToString(“dd-MM-yy”) 14-03-11

Thank you . .


You might have seen floating content of web sites which is always visible on the page even if you scroll it. This is easy achieve thing by using just CSS. However there is also JavaScript alternative for this but the CSS one is smoother and faster as this doesn’t includes any run time calculation. The below step by step process will guide to how to add a always visible div on web page.

<style type=”text/css”>

<!–.visibleDiv

{    position: fixed;}

//–>

</style>
<style type=”text/css”>

<!–/*For top left*/

.visibleDiv

{    top: 10px;    left: 10px;}
/*For top right*/

.visibleDiv{    top: 10px;    right: 10px;}
/*For bottom left*/

.visibleDiv{    left: 10px;    bottom: 10px;}
/*For bottom right*/

.visibleDiv

{    bottom: 10px;

right: 10px;

}

//–>

</style>

 

Thank you . .


1. The only things that you can pass between web sites are string values.

2. The other web site has to give you the names of the values that they will accept.

3. This passes values to PayPal.
1. Add each hidden variable needed as follows:

<input type=”hidden” id=”OrderID” runat=”server”>
2. The button that will submit values to the external site:

<input type=”button” onclick=”javascript: submitToPayPal(‘http://www.paypal.com/cgi-bin/webscr’);” value=”Submit to PayPal” >
3. Add the necessary JavaScript to the page:

<script type=”text/javascript”><!–function submitToPayPal(formAction){ var formElementsArray = document.getElementsByTagName(‘FORM’);   if ( formElementsArray != null )  {   var formElement = formElementsArray[0];
document.getElementById(‘__EVENTTARGET’).value = ‘ ‘;  document.getElementById(‘__EVENTARGUMENT’).value = ‘ ‘;  document.getElementById(‘__VIEWSTATE’).name = ‘NOVIEWSTATE’;
formElement.action = formAction;  formElement.submit();  }}// –>

 

</script>

Warm regards. .

Sameer

 


Rule number one : don’t screw around with the browser of your enduser. Say that you were able to filter out the print menu item. What about the keyboard combination ctrl + P? You could override that again with some javascript but that only leaves the enduser clueless as you’re overriding standard functionality and that’s a big nono.

Besides that, you’re using javascript. That can be turned off by an enduser and then your clipboard erasing script also doesn’t work anymore. Poof and there goes your protection level.

try it . .

Thank you


for firefox try as below:

 

    • 1

      Make sure the new media player is installed on your computer. Popular media players include Real Player, QuickTime, Windows Media Player and WinAmp.

    • 2

      Open Mozilla Firefox and click “Tools” and then “Options” on the main menu.

    • 3

      Click the “Applications” tab. Scroll down on the list of file types until you find all of your media file types, including playlists, audio and videos.

    • 4

      Select the “Action” column box next to each of your media file types. You will see a drop-down box.

    • 5

      Change your default media player for each file type by clicking “Use other.” Choose “Always Ask” from the list if you want the browser to ask you every time which media player you want to use, or choose “Save File” if you want to automatically save the file to your computer instead of opening it.

    • 6

      Press “OK” to close the dialog box. Close and restart your browser to activate the new settings. Click on a song or video file in your browser to make sure it recognizes your choice from Step 4 and opens the file in your new default media player.

Thank you . .

Put Windows on a Diet


Save drive space by helping XP to drop some bloat.
Windows XP is full of helpful applications, but some of them take too much control or have other downsides. MSN Explorer, the Outlook Express e-mail client, and even the Internet Explorer browser may all be mere baggage to you. All of these can be removed, saving you as much as 20MB of drive space in the process.

To remove them, navigate to the Control Panel by first clicking Start. Then open Add or Remove Programs and click on Add/Remove Windows Components on the left-hand side of the window. You can uncheck options that you do not use, such as Outlook Express, MSN Explorer, and, of course, Messenger.

After unchecking items to your heart’s content, click Next and let Windows configure its components; your system should be a few megabytes lighter. Note that some changes will require a restart, and removing things such as Networking can leave you with a crippled computer.
If you want to control more components in XP, try the utility in Add or Remove Programs that comes with Microsoft’s Service Pack 1. Click Start, then All Programs, then near the top of the column click on Set Program Access and Defaults. From here you can set your default browser, music player, and messenger, among other things.


The “Show Desktop icon” in XP missing, a lot of people seem to be confronted with this phenomenon.

Sometimes people loose this icon. It can accidentally be deleted or you may loose it for some other reason, but the bottom line is : only few people know how to restore it.

That’s because it is not an ordinary shortcut.

To recreate it :

Click Start->Run
In the “open” box, type “notepad” (without the quotes)
Click ok
Copy the following lines in your new notepad window :
[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop

Click “File” in the notepad menu and select “Save As”
Save the file to your desktop as Show Desktop.scf
Drag the new icon from your desktop to your Quick Launch toobar and select “Move here”
If you can’t move the new Desktop icon to your Quick Launch toolbar for whatever reason, you can also try the following technique :

Right-click the new show desktop icon on your desktop and select copy
Open Windows Explorer and navigate to
C:\Documents and Settings\\Application Data\Microsoft\Internet Explorer\Quick Launch (replacing with the username for which you want to restore the show desktop icon)
In the right pane of the explorer window, right-click an empty spot and select “paste”
Maybe you don’t see the Application Data folder in your Explorer. To see it, you must enable visibility for hidden folders :

In Windows Explorer, click the menu “Tools” and select “Folder Options…”
Click the “View” tab
Under “Advanced Settings”, select “Show hidden files and folders”
Click ok

Speaking Computer Without Software


This is the tutorial that teaches you to make your own software that speaks

first of all open the notepad then type the following things there

Dim message, sapi
message=InputBox(“What do you want me to say?”,”mytechnext.blogspot.com”)
Set sapi=CreateObject(“sapi.spvoice”)
sapi.Speak message

Now save the file in .vbs extension. it will work..

If You Like this Post Please write a comment..

%d bloggers like this: