|
I'd use the Levensthtein distance[^] to count the number of different characters between the correct and given answer.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
seems to me you need to:
- split both texts into words (split on spaces and puctuation);
- match the words (resync when a word is missing in one of the texts);
- count the differences (each pair of matching words that are not identical count as one mistake).
Why match words: the sucker under test may connect two words, split a word in two,
just forget one, etc.
remaining problems:
- punctuation: do you check those chars too? can you hear the difference between
say a semi-colon and a period?
- capitals: are the rules strict in your language? is it the same for the first letter
following a semi-colon and a period?
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi everyone,
I have created two applications which both do similar jobs but i want to merge them together into one. I can't extract the forms from one and put them into the other because one of them was created in visual basic. I have tried to get the exe fle from the vb project into the c# project and have succeded in putting it into the resources folder. Problem is running it. HOW????
Please help.
thanks,
Ashley Staggs
|
|
|
|
|
Are you trying to make the two applications behave like a single application? You can't simply "combine" two applications like that...
Are you simply wanting to reuse some of the functionality from the VB application? If so, what you really want to do is figure out what bits of functionality you want from the VB project and convert those pieces into user controls. You can then reference the VB user controls in you C# project.
|
|
|
|
|
Basically i want the c# app to load the exe file from the resources folder
|
|
|
|
|
You can get the C# application to "start" the VB application, but the VB application will still be a separate application. It will still have its own UI and it will run in its own process -- just as it would if the user started it manually.
Are you really simply trying to start the other application programatically? Or are you trying to get the two applications to behave as a single app?
|
|
|
|
|
A single app. The vb app has been created in the 2008 edition whereas the c# is 2005
|
|
|
|
|
You can't add an executable as a resource and simply have another application "run" it as though it was part of the "host" application. What you want is a library (dll) not an executable. This means you will need to figure out what parts of the VB application you would like to re-use and re-create those pieces as classes or user-controls in a dynamic link library. Once you have those components in a library, you can add a reference to that assembly and start using the components.
|
|
|
|
|
if you have two .NET apps you can turn one (or both) of them into a DLL, and make
the remaining one (or a new one) the master controlling the other (or both).
The one (or two) that demotes to a DLL looses its static main function (C#) or the
VB equivalent, so it basically becomes a class library; to call it, instantiate
its main form and show it (as the static main does in a regular C# Windows app).
You must do it with a single version of .NET (hence the same Visual Studio);
having a non-Express edition probably makes it much easier, since now you can load
all relevant projects in a single IDE.
With VS2008VB Express + VS2008CS Express, you should also be able to do it, have one
create the DLL, then add that to the references of the other.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
how do i change the vb project into a dll and then in th c# app how do i get it to start.
|
|
|
|
|
Ashley Staggs wrote: how do i change the vb project into a dll
when you create a new project you are given a choice between many possibilities, one
of them is a "class library" or something like that. So create one of those, copy/paste
almost all your code in there, and just leave an almost empty program in your original exe
project.
Ashley Staggs wrote: how do i get it to start.
if the dll basically holds a Form derivative, you instantiate and show it.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I dont know how to control ports of serial of my computer with programming.
I want to know the code of it and exactly how to tell the computer that i want it to turn on the outputs of the ports.
I am very thankful if you give me the code in c# and tell me how to wark with it.
|
|
|
|
|
Hi,
you want the SerialPort class (available since .NET 2.0)
open the port, then write data to operate the TxD line, and/or use the appropriate
properties (such as DtrEnable) to control the control lines.
Warning: turn off hardware handshaking if you want to be in charge of some of those lines!
Advice: read all the MSDN pages on SerialPort, AND search CodeProject for SerialPort articles
and read some of those as well.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
Can anyone tell me how the normal parameter in C# are passed? is it by Ref? or just value?
Cuz i'm getting a bit problem with my code. I have this code that calculates statistics and for that i need to sort() my array. but this method also (somehow) is being applied to the array that i passed into the function...
for i.e.
<br />
private int iAnswer(ArrayList arData)<br />
{<br />
arData.Sort();<br />
}<br />
<br />
text1.Text = iAnswer(arNum).ToString();<br />
So what i'm trying to say is that when i do arData.Sort() it also sorts arNum somehow??!!
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
|
|
|
|
|
C# parameters are passed by value. But there are some sutle things here. C# has reference-base objects and value-based objects. For the reference-based object, you can think it as an object holding an address. So, when you pass them to a function, only the address will be copied. For your code, the last line passed arNum to iAnswer. iAnswer copy the address holded by arNum to it's own parameter, arData. When you sort arData, the real object that is pointed by arData and arNum will be changed.
|
|
|
|
|
|
Bert delaVega wrote: The ArrayList is a object, so it's allocated to the heap (a reference type). So in your case it is by ref.
That is not correct. It's a reference that is passed as a parameter, but it's not passed by reference. The reference itself is copied and sent as a parameter, it's not a reference to the reference that is sent as a parameter.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
if you are familiar with older languages such as C, it is very similar:
1. simple things (int, double) get copied (pass by value);
2. for complex things (strings, class instances) a pointer is passed (so there is no object
copied, it is the same object you get). Whether you call this by value or by ref however
is a bit confusing (you can optionally add a ref keyword to increase the level of indirection
by one)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thank you all for your reply. It really helped me to understand this concept.
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
|
|
|
|
|
I m new in C# please give me code for datageid conectivity with database.
Thanx in advance
help as a alias.
Be happy and make others happy.Cheer up...........
|
|
|
|
|
Use google for this also in codeproject you can get multiple articels
Keyword to search DataGrid+databind
Sarvesh Upadhyay
Senior Software Engineer
Birlasoft India Ltd.
Microsoft Certified Professional Developer in Dotnet 2.0 Enterprise Application
|
|
|
|
|
thanx
help as a alias.
Be happy and make others happy.Cheer up...........
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
class TextFile
{
public static void Main(string[] args)
{
string inFile;
string yazi;
Console.WriteLine("Dosya Ismini Giriniz");
Console.WriteLine("Örnek: d:\\filename.LOG");
inFile = Convert.ToString(Console.ReadLine());
StreamReader dosyaOku = File.OpenText(inFile);
yazi = dosyaOku.ReadLine();
string onEk = " Frequencies -- ";
int i = 1;
while (yazi != null)
{
if (yazi.StartsWith(onEk))
{
string gecici = yazi.Replace(onEk, "");
string[] parcalar = gecici.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
Console.WriteLine(string.Format("{0}\n{1}\n{2}", parcalar[0], parcalar[1], parcalar[2]));
i++;
}
yazi = dosyaOku.ReadLine();
}
Console.ReadLine();
dosyaOku.Close();
StreamWriter sw = new StreamWriter(@"C:\filename.LOG");
sw.WriteLine(string.Format("{0}\n{1}\n{2}", parcalar[0], parcalar[1], parcalar[2]));
sw.Flush();
sw.Close();
}
}
ERROR:(37,53): error CS0103: The name 'parcalar' does not exist in the current context
I want to write to text file after file is readed(modicificated) that is , I want to write output data but I cant be able to
|
|
|
|
|
It means that you've declared parcalar in the wrong place. Move the declaration to before the while and it will be visible. So, you get
string[] pacalar = null; However, you do know that you are only going to write one line to the file don't you?
|
|
|
|
|
"However, you do know that you are only going to write one line to the file don't you? "
mr.pete as your told it is writed one line to the file but i want to as a column by reading all line. please help me.
sample:
1456
4596
122.2
145.4
|
|
|
|