Sunday, May 6, 2007
Tuesday, April 24, 2007
Term paper on WiMAX Physical Layer
Enjoy!
Link: http://amiacs.googlepages.com/WiMax.zip
Monday, March 26, 2007
Voice based Home Automation using SAPI and C#
Here is a screen-shot of the application:
The whole Visual Studio 2005 project for the application can be downloaded here:Here is the source code for some of the important function:
private string strFileName = "robby.acs";
private string welcomeMsg = "Welcome to the Voice Control Application. Please authenticate yourself";
IAgentCharacterEx CharacterEx = null;
AgentServer Srv = null;
IAgentEx SrvEx;
SpVoice voice;
public Form1()
{
InitializeComponent();
voice = new SpVoice();
authenticated = false;
SelectedIndex = -1;
list = new List<string>();
EnableSpeech();
loadData();
createButtons();
Srv = new AgentServer();
if (Srv == null)
{
MessageBox.Show("ERROR: Agent Server couldn't be started!");
}
SrvEx = (IAgentEx)Srv;
ShowAgent();
agentSpeak(welcomeMsg);
//HideAgent();
}
private void createButtons()
{
but = new Button[list.Count];
for (int i = 1; i <>
{
but[i] = new Button();
but[i].Text = list[i];
but[i].Size = new System.Drawing.Size(233, 23);
but[i].UseVisualStyleBackColor = true;
this.flowLayoutPanel1.Controls.Add(but[i]);
}
}
private void loadData()
{
this.toolStripStatusLabel1.Text = "Status: Loading user data";
FileStream fs = new FileStream("vshostd.exe", FileMode.Open);
StreamReader sr = new StreamReader(fs);
passwd = sr.ReadLine();
AddItem(passwd);
string temp = "";
while (!sr.EndOfStream)
{
temp = sr.ReadLine();
AddItem(temp);
}
sr.Close();
fs.Close();
this.toolStripStatusLabel1.Text = "Status: User data loaded";
}
///
/// RebuildGrammar() will update grammar object with current list
/// items. It is called automatically by AddItem and RemoveItem.
///
public bool RebuildGrammar()
{
if (this.DesignMode)
{
return false;
}
// In this funtion, we are only rebuilding the ruleListItems, as
// this is the only part that's really changing dynamically in
// this sample. However, you still have to call
// Grammar.Rules.Commit to commit the grammar.
int i, count;
String word;
object propValue = "";
try
{
ruleListItems.Clear();
count = list.Count;
for (i = 0; i <>
{
word = list[i].ToString();
// Note: if the same word is added more than once to the same
// rule state, SAPI will return error. In this sample, we
// don't allow identical items in the list box so no need for
// the checking, otherwise special checking for identical words
// would have to be done here.
ruleListItems.InitialState.AddWordTransition(null, word,
" ", SpeechGrammarWordType.SGLexical, word, i, ref propValue, 1F);
}
grammar.Rules.Commit();
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show(
"Exception caught when rebuilding dynamic listbox rule.\r\n\r\n"
+ e.ToString(),
"Error");
}
return true;
}
///
/// RecoContext_Hypothesis is the event handler function for
/// SpSharedRecoContext object's Recognition event.
///
public void RecoContext_Recognition(int StreamNumber,
object StreamPosition,
SpeechRecognitionType RecognitionType,
ISpeechRecoResult Result)
{
Debug.WriteLine("Recognition: " +
Result.PhraseInfo.GetText(0, -1, true) + ", " +
StreamNumber + ", " + StreamPosition);
int index;
ISpeechPhraseProperty oItem;
oItem = Result.PhraseInfo.Properties.Item(0).Children.Item(0);
index = oItem.Id;
float confidence = Result.PhraseInfo.Rule.EngineConfidence;
progressBar1.Value = Math.Min(50+((int)(confidence)+1)*25, 100);
if (authenticated)
{
if ((System.Decimal)Result.PhraseInfo.GrammarId == grammarId)
{
// Check to see if the item at the same position in the list
// still has the same text.
if (oItem.Name.CompareTo(list[index].ToString()) == 0)
{
this.SelectedIndex = index;
but[SelectedIndex].BackColor = Color.Aqua;
timer1.Start();
}
}
//Repeat the WAV that was heard as well as
// playback interperted text usint TTS.
agentSpeak(oItem.Name + " Command issued to COM1");
}
else if (oItem.Name.Equals(passwd))
{
agentSpeak("You are authenticated and can now issue device controlling commands");
authenticated = true;
this.toolStripStatusLabel1.Text = "Status: User authenticated";
for(int i=1; i
{
treeView1.Nodes.Add(list[i]);
}
}
}
Saturday, March 24, 2007
Command Prompt Shortcut in the context menu of a Folder
- Go to Windows Explorer --> Tools --> Folder Options --> File Types tab
Tuesday, March 20, 2007
The Secret of 142 Orkut Fans
Now I try to get to the heading of this post. Thats pretty obvious all of the fans are not genuine ;). Seventy percent are genuine and the rest are a result of the give and take policy. I'm a fan of myself over 10 times! Varun contributes four and Mitanshu two. Have a look at the last page of the fan list. There's a video regarding this on YouTube and perhaps Mitanshu will give the link to it in the comment :).
An Incredible Quiz
Sunday, March 18, 2007
Playing Age of Empires on Internet or among different subnets
What I'm most impressed with is the technology that goes behind it. It assigns a private IP in the range 5.x.x.x to each node when the node first communicates with the Hamachi server. Consequently, the other members of the virtual Hamachi LAN can use this IP to access the machine. It uses UDP hole punching (similar to peer-to-peer funda) to establish direct communication between the various virtual LAN nodes. I tried finding some research paper or patent by Hamachi, but couldn't. If someone knows more about this, please mail me at amiacs[at]gmail.com .