"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Saturday, October 30, 2010

Text to speech in asp.net

step 1 : create new web site.
step 2 :  in the default.aspx page, copy the following code…

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 <title>Text to speach</title>
</head>
<body>
 <form id="form1" runat="server">
 <div>
 <asp:TextBox ID="txtspeach" runat="server"></asp:TextBox>
 <br />
 <asp:Button ID="btn1" runat="server" Text="Speach" onclick="btn1_Click" />
 </div>
 </form>
</body>
</html>






Step 3: Right click on the solution explore of the visual studio and add reference
in the add reference dialog box select the COM tag and add “Microsoft Speech Object library” and click to ok.
Step 4 : In the Default.aspx.cs file, copy the following code……
using System;

using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SpeechLib;
using System.Threading;

public partial class _Default : System.Web.UI.Page
{
 protected void btn1_Click(object sender, EventArgs e)
 {
 SpVoice objspeach = new SpVoice();
 objspeach.Speak(txtspeach.Text.Trim(), SpeechVoiceSpeakFlags.SVSFDefault);
 objspeach.WaitUntilDone(Timeout.Infinite);
 }
}

Step 5 : Run the code…
enter the text which u want to speech and then click to button, and listen the text…..





Have a nice day... 'N happy Coding :)

Tuesday, October 12, 2010

Some of Visual Studio’s Shortcuts

Here are some Visual Studio shortcuts that helped me increase my coding speed and also to be smart among other developers.
  • Open Smart Tag: Ctrl + .
  • Cycle Clipboard Ring: Ctrl + Shift + V
  • Go to Definition: F12
  • Go to Line: Ctrl + G
  • Vertical Block Selection: Alt + Mouse or Shift + Alt + Right Arrow
  • View Properties Window: F4 or Alt + Enter
  • Comment Selection: Ctrl + K, Ctrl + C
  • Uncomment Selection: Ctrl + K, Ctrl + U
  • Toggle Code / Design Views: F7
  • Incremental Search: Ctrl + I
  • View Object Browser: Ctrl + Alt + J
  • Delete Line: Ctrl + L or Shift + Delete
  • Add New Item to Project: Ctrl + Shift + A
  • Find All References: Shift + F12
  • The Rename Refactor: Ctrl + R, R
  • Find All References: Shift + F12
  • Format Document: Ctrl + K, Ctrl + D
  • View Task List: Ctrl + \, Ctrl + T
  • Find in Files: Ctrl + Shift + F
  • Toggle Outlining Expansion: Ctrl + M, Ctrl + M
  • Save Any Output Window: Ctrl + S
  • Build Solution: Ctrl + Shift + B
Have a nice day... 'N happy Coding :)

Enable and disable Trigger in SQL Server

Disable Triggers instead of dropping them.
================================

Business rules in table often expect your application to update the table one row at a time. Also some triggers generate error when the code in the trigger assigns to a local variable returned by selecting a column from the inserted virtual table. The assignment fails if you are updating multiple rows because the inserted table contains more than one row so the sub query returns more than a single value. Multiple updates need special handling in such scenario. Developers often wind up dropping a trigger before multi- row updates then creating them later.

But this scenario can be overcome by disabling trigger

Alter Table Mytable Disable Trigger mytrigger

You can enable Trigger using
Alter Table Mytable Enable Trigger mytrigger
Have a nice day... 'N happy Coding :)