|
You can store the username in your application properties as a temporary measure.
|
|
|
|
|
Hello. I know there is a way to enable and disable speech recognition because you can do pretty much anything in c#. I am stuck on how to enable and disable speech recognition by using my voice. This is the scenario that I want to achieve.
When I say start listening I want my program to accept voice commands. When I say stop listening I want my program to reject all voice commands, apart from "start listening", however only listen out for the command "start listening" to enable full voice command control again.
Does anyone have any ideas on how I can go about doing this?
|
|
|
|
|
Member 11839664 wrote: Does anyone have any ideas on how I can go about doing this? You probably need to start by creating a program that uses the Speech API and recognises those two phrases. Once you have that working you can move on to the more advanced aspects.
|
|
|
|
|
I've used SAPI to do that. Now what do i do
|
|
|
|
|
What code do you currently have?
|
|
|
|
|
No idea. This is your application so only you know what it is supposed to do.
|
|
|
|
|
Set a flag in your application that denotes it's not supposed to process certain commands? Seems kind of obvious to me.
|
|
|
|
|
Hi,
I receive a string from an API like this example:
{"id":"30535","email":"myemail@yahoo.com","first_name":"John","last_name":"Smith","gender":"male","friends":{"data":[{"name":"Helen Ford","id":"68304"},{"name":"Leo Pitt","id":"4732"}]
I'd like to split and save the values into these
string personId
string email
string firstName
string lastName
string gender
and for friends values into an array that contains these values "personId" and "name" (for each set of records)
I'd really appreciate it if someone could help me.
|
|
|
|
|
|
|
hi
i have this query in access that run's excellent ! ,I called her MyQUERY
SELECT BK_LEVEL9.Aitur AS Aitur, Sum(BK_LEVEL9.M_NewQty) AS M_NewQty, Sum(BK_LEVEL9.ErrorCount) AS ErrorCount, (IIf([M_NewQty]<>0,Round(([ErrorCount]*100)/[M_NewQty],2),0)) AS ErrorProcc
FROM BK_LEVEL9
GROUP BY BK_LEVEL9.Aitur;
in my C# program i try to run her like this:
SQL = "SELECT Aitur,M_NewQty,ErrorCount,ErrorProcc from MyQUERY";
dsWorkKabat = new DataSet();
adp = new OleDbDataAdapter(SQL, Conn);
adp.Fill(dsWorkKabat, "MyQUERY");
adp.Dispose();
and i got this error:
You tried to execute a query that does not include the specified expression 'IIf(Not [M_NewQty]=0,Round([ErrorCount]*100/[M_NewQty],2),0)' as part of an aggregate function.
What could be the problem ?
thanks
|
|
|
|
|
You seem to be missing the formula from your GROUP BY clause. So try something like:
SELECT BK_LEVEL9.Aitur AS Aitur,
Sum(BK_LEVEL9.M_NewQty) AS M_NewQty,
Sum(BK_LEVEL9.ErrorCount) AS ErrorCount,
(IIf([M_NewQty]<>0,Round(([ErrorCount]*100)/[M_NewQty],2),0)) AS ErrorProcc
FROM BK_LEVEL9
GROUP BY BK_LEVEL9.Aitur,
(IIf([M_NewQty]<>0,Round(([ErrorCount]*100)/[M_NewQty],2),0));
|
|
|
|
|
GrabMemberAndProductInformation - This method is adatabase call and returns a DataTable.
SetupAccountListForMember - This method takes in a dataTable, does some calculation on each record and then adds the record to a listbox.
try
{
Task fetchMemberAccounts = Task.Factory.StartNew<DataTable>(GrabMemberAndProductInformation)
.ContinueWith(antecedent => SetupAccountListForMember(antecedent.Result),
TaskScheduler.FromCurrentSynchronizationContext());
catch (AggregateException err)
{
...log error
}
Now when an exception is thrown the exception seems to be swallowed by the CLR and does not trigger the exception handling I have in place. Can someone explain to me why the catch block is not being triggered? Any help is appreciated.
Thanks
Matt
|
|
|
|
|
You are creating a new thread. Exceptions occuring on the thread will not propagate to your catch-clause. The code on the thread ("task") needs its own exception handling.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Matt - in order to work out what errors are being thrown, you need to add an exception continuation to your task, so you would end up with the following:
Task errorTask = fetchMemberAccounts.ContinueWith(ex => { }, TaskContinuationOptions.OnlyOnFaulted);
|
|
|
|
|
If you can upgrade to .NET 4.5, async / await makes this type of code much easier to write.
try
{
DataTable data = await Task.Run(GrabMemberAndProductInformation);
SetupAccountListForMember(data);
}
catch (DbException err)
{
...
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
This worked nicely. Thanks for your help.
Matt
|
|
|
|
|
In this example, the taskscheduler.dll only displays tasks from c:\windows\task folder. Win 7, 2008 and 2012 store the tasks in the c:\windows\system32\task folder. Also, the object type has to be a "Task Scheduler Object".
How can I get this to be compatible with 2008 and 2012?
|
|
|
|
|
jwc jwc wrote: In this example,
In WHAT example?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
http://www.codeproject.com/Articles/2407/A-New-Task-Scheduler-Class-Library-for-NET?msg=5091641
|
|
|
|
|
You're supposed to post questions like this at the bottoms of the article pages. That way the author will see them and be able to respond.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
The exercise consists in creating a fully functional method/function to sort a set of squares one next to the other in increasing size order along the X axis.
The project has to be developed using C#, no other language is allowed. Try to make the method/function as professional as possible (proper comments, perfect indentation, meaningful variable names...) as it’s not a lab practical, it’s a professional development. Pay extreme attention to the details and the readability and simplicity of the code. Use auxiliary methods as required or deemed appropriate for a better structure and isolation and less coupling.
The method/function has to be developed in a file called metalcam_exercise.txt, add no other code than the required method/function in this file. The method name and parameters are as follows:
public static void OrganiseSquares(ref List<Square> pio_Squares)
Method description:
The method OrganiseSquares gets a list of squares and modifies each square position so the squares are placed one next to the other in increasing size order along the X axis.
Parameter description:
pio_Squares: The list of squares as input and output. For the output the squares should be sorted from smaller to bigger and in the right position. All the squares are in position 0,0 initially.
return: The return value will be void as the imputed Square objects will be modified to set their position according to the algorithm.
The class Square is as follows:
using System.Collections.Generic;
internal class Square
{
private double m_Lenght;
private double m_PositionX;
private double m_PositionY;
public Square(double p_Length)
{
m_Lenght = p_Length;
m_PositionX = 0;
m_PositionY = 0;
}
public void SetPosition(double p_PositionX, double p_PositionY)
{
m_PositionX = p_PositionX;
m_PositionY = p_PositionY;
}
public double GetLenght()
{
return m_Lenght;
}
public static void OrganiseSquares(ref List<Square> pio_Squares)
{
}
}
modified 14-Jul-15 11:34am.
|
|
|
|
|
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
(ref List pio_Squares)
That code came from the teacher?
There's already rectangle class.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
"Those who can, do; those who can't, teach."
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|