|
I want to know how can I open an existing license.rtf (located in my application folder) in Microsoft Word and in WordPad?
|
|
|
|
|
Just start Wordpad.exe passing the filename as an argument.
|
|
|
|
|
System.Diagnostics.ProcessStartInfo wordpadPSI =
new System.Diagnostics.ProcessStartInfo(
@"WordPad.exe");
wordpadPSI.Arguments = @"C:\Users\Dave\Documents\licence.rtf";
System.Diagnostics.Process.Start(wordpadPSI); For word, use WinWord.exe, remember the end user may not have word installed.
|
|
|
|
|
Hi,
just
Process.Start(@"whateverPathYouMayHaveChosenToHideTheFile\license.rtf");
will open the file with the default app for RTF files, same as double-clicking it in Windows Explorer.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Suppose I got the following sql :
select empno, empname, deptname,sal from emp, dept where emp.did= dept.did
I need the following:
If the column name is empno replace it by eno,
If the table name is emp then replace it by employee,
If the table is dept then replace it by department,
if the column name is did replace it by deptid.
That means after operation my the sql should be as follows:
select eno, empname, deptname, sal from employee,department where employee.deptid=department.deptid
How can I do that? Can I have any sample code for that??? Please help me.
I am stuck on this place. I can't proceed without this.
|
|
|
|
|
This is not a C# question. You should have asked in the General Database forum.
What you are looking for are called aliases
SELECT empno AS eno, emp AS employee, etc.
only two letters away from being an asset
|
|
|
|
|
I have to do it using c#. Because there is no direct interaction to database here. NO I don't want to alias the column name and table name. I have the replace/ create a new sql select statement by replacing the column names and table names with the new one (According to the condition's that I described above).
Suppose I write an sql select statement in a text box. After button click I want to do the above replacement of column name and table name in the same text box...
|
|
|
|
|
so, use some of the methods in the string class; what is holding you up?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Suppose I got emp as table but if I replace all the emp inthe sql by employee then empname is also converting to employeename which is becoming to wrong column name
|
|
|
|
|
so you must replace words, not parts of words. That requires a parser, something that chops your text (SQL or other) into words based on whitespace and/or delimiters.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
so you must replace words, not parts of words. That requires a parser, something that chops your text (SQL or other) into words based on whitespace and/or delimiters.
How can I replace the word if I can't find the words? Because see the following string:
select empno,empname,deptname,sal from emp, dept where emp.did= dept.did
see here empno,empname,deptname,sal is one word. Because there is no space here. Also there may be column alias.It will be more difficult if i use group by, order by, having clause. In that case it will be more difficult.
Ok it is easy to find different column name and table name (Using a parser). But problem is how can I just replace the old table name to new table name and old column name to new column name.
again the problem is:
Suppose I got emp as table but if I replace all the emp by employee then empname is also converting to employeename which is becoming to wrong column name
|
|
|
|
|
dokhinahaoa wrote: empno,empname,deptname,sal is one word
not in my world.
as I said: a parser, something that chops your text (SQL or other) into words based on whitespace and/or delimiters.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
I got some idea. But do you know any good parsers name where i can easily find out the column names, table names, join tables names columns in join condition, column in where clause, column in group by clause and having clause. Also I can Replace the tables and columns names accordingly using the parser.
|
|
|
|
|
dokhinahaoa wrote: do you know any good parsers name
I don't name the parsers I create; all it takes is some ten lines of code: scan the string for begin and end of identifier, then look it up in a replacement dictionary.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
OOPs sorry...
Can you share your parser code an how to use it??
I will be grateful to you...
|
|
|
|
|
dokhinahaoa wrote: see here empno,empname,deptname,sal is one word. Because there is no space here
Then seperate it by comma not space
From all of you're posts it's clear you really have no clue what you are doing. I would suggest you turn this project over to someone who does.
only two letters away from being an asset
|
|
|
|
|
dokhinahaoa wrote: That means after operation my the sql should be as follows:
select eno, empname, deptname, sal from employee,department where employee.deptid=department.deptid
dokhinahaoa wrote: I have to do it using c#.
dokhinahaoa wrote: I have the replace/ create a new sql select statement by...
These statements contradict each other. What do you actually want?
only two letters away from being an asset
|
|
|
|
|
You can think the sql as a string here. Just the format of the string is like an sql select statement. Because i m not sending the sql to the database before formatting as i mentioned. And I have to do the formatting using c#.
|
|
|
|
|
Good day
This is a relatively advanced problem...
I am writing training software for image recognition.
When the training program starts, it loads a set of a few thousand (roughly 5000) images of size 24x24 pixels (greyscale).
I decided to load all images into my own class type, using a list. In other words, if my class is called "class Image", i have a list: List.
The image data is stored as a 2D double array in the class.
On each training round I need to process all images, and I am finding this is taking very long. Is there a way to make processing faster?
This is what I have already tried without much reduction in time:
1. Using unsafe code and pointers to access each image object.
2. Parrallel processing the images (but I ended up with errors).
3. Using a "for loop" instead of "foreach" to iterate through the list (not much improvement).
I am also considering using structs instead of classes to store the images, but not sure if this would overload the stack?
Please ask if any more information needed (I didn't give more since there is too much to say).
Any help would be appreciated please
tvb
|
|
|
|
|
Do you really need all those images in memory to be processed all at once? Even with just one byte per pixel, 24 x 24 x 5000 is almost 3GBMB
modified on Sunday, October 18, 2009 9:22 AM
|
|
|
|
|
Thanks for the reply.
I think it would be 2.8Meg? 24x24x5000= 2.8+E6
Memory isn't my biggest problem, since I'm using 4G of ram.
The reason I load them all into memory is that I assumed it would be faster. Do you have any other suggestions?
tvb
|
|
|
|
|
That's what happens when I try to think on a Sunday!
|
|
|
|
|
tvbarnard wrote: The image data is stored as a 2D double array in the class.
Something like this?
List<MyImage> myImages;
class MyImage
{
Double[,] data;
} How are these created, and how does the Image get into this array? Have you tried timing the code, to see where the bottlenecks are?
I are Troll
|
|
|
|
|
Yes, that would be how it's done.
I have used a profiler, and it shows that my bottleneck is when I am processing each image array.
The code is very abstract, but I'll post it in any case.
unsafe
{
fixed (int* pPosPoints = allFeatures[f].pointsPos, pNegPoints = allFeatures[f].pointsNeg)
{
for (int iP = 0; iP < boundPosImages; iP++)
{
featureValue = 0;
fixed (double* pIntVec = posTrainingSet[iP].imageIntegralVectorDouble)
{
for (int i = 0; i < boundPointsPos; i++)
{
featureValue += *( pIntVec + *( pPosPoints + i ) );
}
for (int i = 0; i < boundPointsNeg; i++)
{
featureValue -= *( pIntVec + *( pNegPoints + i ) );
}
if (allFeatures[f].polarity)
{
if (featureValue < allFeatures[f].threshold)
allFeatures[f].weightedError += posTrainingSet[iP].weight;
}
else if (allFeatures[f].threshold < featureValue)
allFeatures[f].weightedError += posTrainingSet[iP].weight;
}
}
To explain: the "imageIntegralVectorDouble" is my image array which I have reshaped to a vector (so the vector is size 24x24= 576).
What is happening here is I am using a classifer that contains two arrays of points ("allFeatures[f].pointsPos" & "allFeatures[f].pointsNeg") that need to be either added or subtracted in that image. In other words each point is a location reference.
In this specific code, I decided to use pointers to reference the images and points (as can hopefully be seen)
What I might have left out from my original question (in order to prevent confusion) is that the system uses at least 200,000 classifiers, implying - each image has to be evaluated by all of those classifiers. Which makes the reason for trying to optimize the code fairly obvious.
Most of the processing time is spent on the first two for-loops. I suppose this is the area to try and optimize.
tvb
|
|
|
|
|
tvbarnard wrote: Most of the processing time is spent on the first two for-loops. I suppose this is the area to try and optimize.
I have no idea how you'd optimize the code within those loops. Have you tried doing them in parallel[^]?
I are Troll
|
|
|
|