|
I run into a little problem I'm not too sure how to get around.
Let's say I have this grammar xml:
<GRAMMAR LANGID="409">
<DEFINE>
<ID NAME="RID_A" VAL="0"></ID>
<ID NAME="RID_B" VAL="1"></ID>
<ID NAME="RID_C" VAL="2"></ID>
<ID NAME="RID_D" VAL="3"></ID>
<ID NAME="RID_E" VAL="8"></ID>
</DEFINE>
<RULE NAME="A" ID="RID_A" TOPLEVEL="ACTIVE">
<P>something</P>
</RULE>
<RULE NAME="B" ID="RID_B" TOPLEVEL="ACTIVE">
<P>go</P>
<P>
<RULEREF REFID="RID_C" />
</P>
</RULE>
<RULE NAME="C" ID="RID_C">
<L PROPID="RID_C">
<P VAL="RID_D">left</P>
<P VAL="RID_E">right</P>
</L>
</RULE>
</GRAMMAR>
So basically, there are 3 commands, "something", "go left", "go right".
Whenever something gets recognized this gets called:
public void RecoContext_Recognition(int StreamNumber, object StreamPosition, SpeechRecognitionType RecognitionType, ISpeechRecoResult e)
Inside of it I'm using a switch switch (e.PhraseInfo.Rule.Name) . For the rules similar to the "something" command, a simple case "A": is all I need.
My issue comes now. For the "go left" or "go right", the case "B": catches them. However, I have no idea how to determine the 'right' or 'left' part of it.
Ideally, this is what I'm looking for.
[ create ] -> one | two | three -> monkeys | elephants | puppies.
Obviously not those examples, but something that follows that path. Can I accomplish that with the sample XML I provided and the switch in the function? Or do I need a different approach?
|
|
|
|
|
is there any body who knows how to implement hand gesture recognition using haarlike features.
I am using AForge.net for image processing.
thanks
|
|
|
|
|
I have Table_A and Table B. Now I want to update all Table_B, column_2 ids with the matching ids in Table_A only. The relationship between
Table_A and Table_B is 1..n.
Could somebody help me to write this query.
Thanks
|
|
|
|
|
1. This is a c# forum. You know, for C# questions
2. If you have posted this on the SQL forum, don't cross post
2. You already know about 1 http://www.codeproject.com/Messages/3284690/question-related-to-homework.aspx[^]
3. Read the FAQs.
4. This is easy to google. I suggest you do that.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
I tried running this query. Is this the right sql query? It seems like it did its job. But, how could i make sure the records have been update properly and i didn't miss any ID in Table_B.
Table_B has thousands of rows. I don't want to go row by row in Table_B to match with Table_A.
I know there must be a better way than doing my way.
update Table_B
set Table_B.Column_2 = Table_A.coulumn_1
from Table_B inner join Table_A on Table_A.Column_1 = Table_B.Column_2
|
|
|
|
|
Still the wrong forum. Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
What part of Keiths response did you actually read? You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Evidently, he only read the signature (which, by the way, needs some spicing up)..45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Your query does nothing, in a very expensive fashion, with a typo in your post.
You have joined on Table_A.Column_1 = Table_B.Column_2 and so they already match and the set clause just overwrites the pre-existing value with the same value.
Best to move this to the SQL forum as has been said, however, if the aim is that you have already updated table_A and now want to update the matching records in Table_B this ain't gonna work.
Step 1. Update Table_A, retaining the original IDs in a separate column.
Step 2. Update Table_B, joining on the original IDs and setting the values to the new IDs from Table_A
|
|
|
|
|
|
Hello Everybody,
Form1 has a dataGridView, Form2 is opened for editing specific record after double-clicking on Form1 dataGridView (while Form1 is still open). After editing, Form2 closed and data successfully saved to underlying DataSet.
Question: how to update dataGridView on Form1 that is still opened, after Form2 is closed?
Thanks in advance for any help.
|
|
|
|
|
subscribe to FormClosed event of Form2 in Form1 and in the handler, reassign the DataGridView 's DataSource .Dave
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Similar to DaveyM69 but I would create an event specifically for the update. FormClose is ok but it doesn't allow you differentiate between by a cancel action or a save action. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I agree - I normally use the Form's Dialogresult property for thisDave
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
It seems subscription for events makes sense. Thanks to both of you!
|
|
|
|
|
I'm trying to make a 8086 microprocessor simulator in c# which will simulate the code written by the user on hypotetical microprocessor and give the same ideal result as real microprocessor. just like other compilers the architecture of my compiler is the same until Microsoft Intermediate language (MSIL). Specifically in my code generator phase of the compiler I face one problem which may actually be conceptual problem. It is the fact that MSIL uses the stack based archiceture which is confusing me because i'm expecting it to be register based, which i thought it would be easy for implementation. I think that this stack based execuition is not suitable for making such kind of compiler or is there any other way of implementing my needs in .NET please help.
thank you!
|
|
|
|
|
You seem a little confused: why are you producing a compiler to msil for a 8086 microprocessor simulator?
I would expect a µprocessor simulator to take a binary file full of (in this case 8086) machine instructions, and execute them. Not to produce any output file.You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Let me explain in a more detail way.
I'm creating my own language and compiler for.NET framework for the purpose of simulating microprocessor specifally 8086.
so what my user going to do is to write a code in my new language grammer and compile the result by my compiler to see what a real processor will resposed for that code. just like emu8086 software if u see it.
to this end I have to go through all the steps of compiler construction. that's why I got through MSIL and then to registers which actually uses machine language.
my problem is i can't get machine code through MSIL which uses stack based execuition but i need register based execuition for getting these machine code.
or if u have any other options please suggest me?
thank you!
|
|
|
|
|
Djtech01 wrote: my problem is i can't get machine code through MSIL
The reason you can't get machine code through MSIL is that MSIL is the machine code for a virtual processor: the MSIL is interpreted at run time, not converted in any way to instructions that are directly machine executable. For that reason, it is stack based - because the languages it will support are stack based.
If you want to simulate what a real processor would do with an instruction, then you need to generate that instruction, and then execute that on the simulator - effectively interpreting the 8086 instruction set at run time.
Why are you re-inventing the wheel and developing your own language and compiler, when there are various 8086 compilers out there, and also meta-compilers where you feed them the language description and they give you the compiler?You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
OriginalGriff wrote: the MSIL is interpreted at run time, not converted in any way to instructions that are directly machine executable
Uhhh, not exactly true. MSIL is converted to the processors native machine code upon execution. Remember the Just-In-Time compiler? That's what it does. MSIL is not interpreted at runtime. It's compiled down to native code for the processor it's running on. If you take the exact same MSIL code and execute it on two different processors, say a AMD Athlon 2600 and an Intel Core 2 Duo, you'll get different native code images.
But, since he's simulating an 8086, he can't use the .NET compilers, nor NGEN, to generate his native code since the JIT does not work with such an old processor.
|
|
|
|
|
My bad! You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Your simulator should be interpreting and simulating 8086 instructions, not MSIL. Your compiler should not generate MSIL for such a product, unless the microprocessor also runs the .NET Framework (which I doubt). txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Are you 'compiling' x86 machine code to MSIL? (why?)
If so, what's the problem? The registers should probably not go on the stack, but in local variable slots - that's not really a problem though
edit: Oh I see now, I misunderstood your intentionsmodified on Monday, March 15, 2010 10:54 AM
|
|
|
|
|
Hi,
now I'm getting the picture of what it is you are trying to do.
I've created lots of microprocessor simulators over the years, using all kinds of languages, from Fortran4 to C#. And I have ran hundreds of millions of simulated instructions on them! I assume you are looking for logic simulation at the user level (i.e. executing the programming model correctly in user mode, but not getting accurate timing as to number of cycles per instruction, and probably not modeling all the protection levels); and I assume you want maximum performance.
You seem set out to generate some IL code to accomplish that. Well, I haven't done so (at least not for simulation), and I am not inclined to do it any time soon. It is perfectly feasible, but I don't believe it leads to best performance.
Functions/methods in most, if not all, languages have one dominant characteristic: they use a stack model, however the stack before and after the execution is in the same state. The same is true in IL; a method may push a few items, it is bound to pop exactly the same number of items before it can return. IL validators will even check for that. So there should really not be any problem in creating an IL method that simulates one (or a series of) microprocessor instruction(s). The only thing is, I don't want to call a method for every instruction simulated.
My latest simulators (assuming a simple RISC processor for a minute) contain one huge switch statement, with lots of cases, one for each instruction type. On a CISC, that might be 256 cases, one per byte value. And each case holds one or a few lines simulating the instruction. Beware, the most code often is required for getting all the flags right (zero, negative, carry, etc). And the other design decision that needs careful analysis is how and where to keep the procoessor state; you can organize it very OO-like, but then you will pay the price for each access. Keeping one array of registers often is a fair approach.
|
|
|
|
|
Semi-hijacking here Luc...
I've often thought about writing a version of C# that can be used for higher level programming of PICs - the actual code entered by the user would be compiled down to either .asm/.s and use the free PIC compiler(s) or directly to .hex.
There are various versions of Basic( say no more) around for the PIC, and then either C (their versions are a nightmare IMO) or assembly. I use assembly but a nice C# type language would be very nice to have!
I did make a tentative start on this a few months ago but shelved it as I found myself writing a lot of inline code or one to one methods that weren't very reusable so I figured I needed a rethink. Maybe I had the right aproach? I keep meaning to take a look at F# as it seems like it may be better suited - any opinion?Dave
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|