|
this means the class that the code is written in. You don't need it, actually.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi everybody,
Do anyone knows what is replacement for functions done by Port Class in Compact Framework in .Net Framework 1.1? The Port class is for serial socket communication and can be used to connect to Modem.
denpsia
-- modified at 19:31 Wednesday 21st December, 2005
|
|
|
|
|
Hey there
Any body knows an implemetation of Damerau or Editex algorithm?
Im implementing Damerau algorithm but i have problems.
If some body worked in this or have ported any algorithm, please tell me.
Thanks
Elvio Fernandez
|
|
|
|
|
|
Hi Curtis
Thanks for your time
I already implemeted Leveshtein. My problem is Im new in dynamic programming so sometimes I try to port (to code) several mathematical recursive definitions and.. I lose!!
Actually Im trying to code Editex algorithm (a mix between Levenshtein and phonetic algorithm). Interesting data about this is found in paper "Phonetic String Matching: Lessons from Information Retrieval" by Justin Zobel & Philip Dart
Do you know some url talking about dynamic programming? Some text readable for a human being!!
Thanks
Elvio Fernandez
|
|
|
|
|
Merry Christmas Eve, Elvio!
I headed over to Wikipedia and found from their discussion on Dynamic programming A Tutorial on Dynamic Programming. I read it and it seems <smile>readable for a human being</smile>. It's math-oriented (like they all seem to be, eh?), but nothing insurmountable like advanced topology.
On another note, I read the paper and it sounds like a neat thing. If I have more time this weekend, I'll give a stab at an implementation. Two terms ago I did an information retrieval class in my grad program and really enjoyed it. Based on what I learned there, I've almost completed an article for CodeProject on creating a spellchecker based on M-Trees and Levenshtein distance. I would like to follow that with a document retrieval article using M-Trees and something simple like document content tokenization minus junk words. When time allows, as always!
Hope this finds you and your loved ones well.
Sincerely,
Curtis.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
An Editex implementation. Hope this helps you find your way through dynamic programming!
#region Constructor
public YourClassNameHere()
{
editexGroups = new Hashtable( 24 );
editexGroups[ 'a' ] = new int[] { 0 };
editexGroups[ 'b' ] = new int[] { 1 };
editexGroups[ 'c' ] = new int[] { 2, 9 };
editexGroups[ 'd' ] = new int[] { 3 };
editexGroups[ 'e' ] = new int[] { 0 };
editexGroups[ 'f' ] = new int[] { 7 };
editexGroups[ 'g' ] = new int[] { 6 };
editexGroups[ 'i' ] = new int[] { 0 };
editexGroups[ 'j' ] = new int[] { 6 };
editexGroups[ 'k' ] = new int[] { 2 };
editexGroups[ 'l' ] = new int[] { 4 };
editexGroups[ 'm' ] = new int[] { 5 };
editexGroups[ 'n' ] = new int[] { 5 };
editexGroups[ 'o' ] = new int[] { 0 };
editexGroups[ 'p' ] = new int[] { 7 };
editexGroups[ 'q' ] = new int[] { 2 };
editexGroups[ 'r' ] = new int[] { 4 };
editexGroups[ 's' ] = new int[] { 8, 9 };
editexGroups[ 't' ] = new int[] { 3 };
editexGroups[ 'u' ] = new int[] { 0 };
editexGroups[ 'v' ] = new int[] { 7 };
editexGroups[ 'x' ] = new int[] { 8 };
editexGroups[ 'y' ] = new int[] { 0 };
editexGroups[ 'z' ] = new int[] { 8, 9 };
}
#endregion
#region Editex Distance
public int EditexDistance( string first, string second )
{
first = StringCleaner.NullToEmpty( first ).ToLower();
second = StringCleaner.NullToEmpty( second ).ToLower();
if( ( first == string.Empty && second == string.Empty ) || first == second )
{
return 0;
}
int[,] array = new int[ first.Length + 1, 2 ];
array[ 0, 0 ] = 0;
array[ 1, 0 ] = 1;
array[ 0, 1 ] = 1;
for( int i = 2; i < first.Length + 1; i++ )
{
array[ i, 0 ] = array[ i - 1, 0 ] + d( first[ i - 2 ], first[ i - 1 ] );
array[ i, 1 ] = array[ i - 1, 0 ] + d( first[ i - 2 ], first[ i - 1 ] );
}
int sourceColumn = 0;
int targetColumn = 1;
int left = 0;
int up = 0;
int diag = 0;
for( int i = 1; i < second.Length + 1; i++ )
{
array[ 0, targetColumn ] = ( ( i != 1 )? array[ 0, sourceColumn ] + d( second[ i - 2 ], second[ i - 1 ] ) : 1 );
for( int j = 1; j < first.Length + 1; j++ )
{
left = array[ j, sourceColumn ];
up = array[ j - 1, targetColumn ];
diag = array[ j - 1, sourceColumn ] + r( first[ j - 1 ], second[ i - 1 ] );
if( j > 1 )
{
up += d( first[ j - 2 ], first[ j - 1 ] );
}
else
{
up++;
}
if( i > 1 )
{
left += d( second[ i - 2 ], second[ i - 1 ] );
}
else
{
left++;
}
array[ j, targetColumn ] = StringComparer.Min( left, up, diag );
}
sourceColumn = Math.Abs( sourceColumn - 1 );
targetColumn = Math.Abs( targetColumn - 1 );
}
return array[ first.Length, sourceColumn ];
}
private int d( char a, char b )
{
if( a == 'h' || a == 'w' )
{
return 1;
}
else if( b == 'h' || b == 'w' )
{
return 0;
}
return r( a, b );
}
private int r( char a, char b )
{
if( a == b )
{
return 0;
}
bool inSameGroup = false;
int[] ga = ( int[] ) editexGroups[ a ];
int[] gb = ( int[] ) editexGroups[ b ];
if( ga == null || gb == null )
{
return 0;
}
for( int i = 0; i < ga.Length && !inSameGroup; i++ )
{
for( int j = 0; j < gb.Length && !inSameGroup; j++ )
{
inSameGroup = ( ga[ i ] == gb[ j ] );
}
}
return ( ( inSameGroup )? 1 : 2 );
}
private Hashtable editexGroups;
#endregion
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hey Curtis!!
Thank you very very very much for your time.
Im reading your links on dynamic programing.
Thanks for Editex code!!! Im impatient to test it!!!
Im working on a system based on trademark watching, so I have to test similarity on Trademark names.
Actually, to detect similarity I have a set of algorithm working together (Levenshtein, QGrams, CharMatching, DoubleMetaphone). To test similarity I have several set of words. The first, a Dictionary with 800,000 entries (from http://www.outpost9.com/files/WordLists.html), the second a small Database with 30,000 trademarks (if you want it just tell me).
There are some implementations in sourceforge.net ( search for this packages lucene-1.2-src.zip, phonetics.NET-20050420.zip, secondstring-20030401.tgz, simmetrics.NET-20041111.zip, JSpell)
Also, there are a library for openBSD on this issue libdistance-0.2.1.tar.gz located in http://www.monkey.org/~jose/software/libdistance/
Jose, author of libdistance-0.2.1.tar.gz is a cool guy, Im working with Damerau distance ported from libdistance-0.2.1.tar.gz
Some interesting papers:
- Finding Approximate Matches in Large Lexicons by JUSTIN ZOBEL & PHILIP DART
- Searching trademark databases for verbal similarities by C.J. Fall & C. Giraud-Carrier
- Indexing methods for approximate string matchings by Gonzalo Navarro, Ricardo Baeza-Yates, Erkki Sutinen, Jorma Tarhio
- Guided tour to approximate string matching by Gonzalo Navarro
There are more, but I think those one are most relevant. A lot of papers is found in http://citeseer.lcs.mit.edu/cs
Portal ACM site have a lot of papers but they want you pay for this papers I dont wanna pay for something that belongs to humanity
All algorithms that Im using are ported code from some library located in sourceforge.net , but nobody write something about Editex. Just looking your code I see my error was in first stage of algorithm, I have initialize the cost matrix in a wrong way.
Curtis (again) thanks for your help.
Elvio Fernandez
|
|
|
|
|
Hey, no problem. I had fun playing with Editex and showing it to my geek friends.
Thank you for the leads on the other papers, too. I really enjoy information retrieval as a hobby/research area.
If I can help you with anything else, just post! I lurk about the boards quite often....
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi:
I've been developing a program that loads a file for default settings which I have placed for now in the bin\debug folder under the project that uses it. This works fine for development, but I want to make a release kit for other users.
I have made a 'Setup wizard' project and have included the default settings file to be loaded into the Application folder.
My question is, what path do I hardcode into the default settings loading call?
I tried just using the file name in this call and the release executable goes to the Documents And Settings\userid\ folder to look for defaults file - and of course complains when it does not find it there. I'd like to avoid hardcoding the path to the application folder since at installation time the users have discretion to install to any folder of their choice.
Please give me your suggestions.
Thanks, Sam
|
|
|
|
|
|
I am trying to connect to a password protected database. I am using the "Configure Data Adapter Wizard". I can connect to the database when there is not a password set. When I set a database password I get the following error when I try to configure the adapter.
"Test connection failed because of an error in initializing provider. Not a valid password."
I have tried unchecking the "Blank Password" checkbox and entering in my password in the password box but then I get this error.
"Test connection failed because of an error in initializing provider. Cannot start your application. The workgroup information file is missing or opened exclusively by another user."
|
|
|
|
|
What type of datebase are you using? Access?
When you connect to a password protected Access database, you have to supply the user name also. The user name is Admin.
---
b { font-weight: normal; }
|
|
|
|
|
Yes I am using an Access database and I have tried to use Admin as the username but still is not working.
|
|
|
|
|
Hi.
I Need a sample code to connect to an Access DB and execute a query
such as select, insert, ...
I want to don't any work in design and all do in code, please.
Best wishes
|
|
|
|
|
Hi,
I have a datagrid and a datatable, and use the MouseMove event to bring up a tooltip. But now when I click on the cell, the MouseUp event doesn't fire. What can I do about this?
|
|
|
|
|
I just realized that it works under certain conditions. Here is what I have under MouseMove:
DataGrid.HitTestInfo hitInfo = dg.HitTest(new Point(e.X, e.Y));<br />
if (hitInfo.Row < tCat.Rows.Count && hitInfo.Row > -1)<br />
{<br />
if (hitInfo.Column == 1)<br />
{<br />
dg.CurrentCell = new DataGridCell(hitInfo.Row,hitInfo.Column);<br />
DataGridCell dc = dg.CurrentCell;<br />
string txt = dg[dc].ToString();<br />
<br />
if (txt.Length > 10)<br />
{<br />
tt.AutoPopDelay = 3000;<br />
tt.InitialDelay = 2000;<br />
tt.ReshowDelay = 3000;<br />
tt.SetToolTip(dg, txt);<br />
tt.Active = true; <br />
}<br />
else {tt.Active = false;}<br />
}<br />
else {tt.Active = false;}<br />
}
If I'm not in column one, the MouseUp works. But in column one, it doesn't, regardless of whether the tooltip is active or not.
Now I'm really confused.
Thanks,
Mel
|
|
|
|
|
I'm unclear about what your question is. Are you having problems with the MouseUp event when you are in Column 1? If so I don't see anything in your code that strikes me as bad but it's almost certainly this code. Try commenting out the code and trying again to verify this is the code at fault.
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|
|
Is it possible to write form variables to Word file variables in C#. I know this can be done in Windows Forms, but I would like to do it in a WebForm. Any help would be appreciated.
dstayton
|
|
|
|
|
What are word file variable? Do you want to write it to Microsoft Word or is it something else.
|
|
|
|
|
This is a template app.
I will have about 10 Word Files. Templates if you want to call them that. They will have embedded html controls(mainly textboxes).
The user will fill out the WebForm. When they are finished filling out the form, they will hit a create doc button which will trigger an event to open up the word file template with the variables from their form populating the corresponding variables in the Word File. They can then save the file on their desktop with evrything filled in.
So yes, in a nutshell, I want to take my form variable and write/populate it in the MS Word File. Hope that makes sense.
Thanks for your response.
dstayton
|
|
|
|
|
how can translate this html code to text
%d8%b1%d9%81%d8%ad
Palestine
|
|
|
|
|
|
This is not html encoded text, it's url encoded. Use UrlDecode as leppie suggested.
---
b { font-weight: normal; }
|
|
|
|
|
Hey,
I found this code snippet:
int numlabels = 5;<br />
int x = 8;<br />
int y = 8;<br />
int width = 80;<br />
int height = 16;<br />
int end = 2;<br />
<br />
Label[] LabelsI;<br />
<br />
this.SuspendLayout();<br />
for(int i = 0; i < numlabels; ++i )<br />
{<br />
LabelsI[i] = new Label();<br />
LabelsI[i].BackColor = System.Drawing.Color.Beige;<br />
LabelsI[i].Size = new System.Drawing.Size(width, height);<br />
LabelsI[i].Location = new System.Drawing.Point(x, y);<br />
this.Controls.Add(LabelsI[i]);<br />
<br />
x = x + (width + end);<br />
}<br />
this.ResumeLayout(true);
But when I try to use it, it comes with this error :
Use of unassigned local variable 'LabelsI'(CS0165)
Could someone please help me with this...
Thanks,
JanS
|
|
|
|
|