|
Thanks man
it works
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
You can double click on a control, like a button, and the default event, Click in this case, will be automatically created for you.
only two letters away from being an asset
|
|
|
|
|
Thank you very much
it works
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Say, I have 1000 different coordinate points which are totally scattered. Please give me some suggestions regarding how to find out the outer envelope area of those plotted points. Please provide me any link or sample project. Any suggestion on the algorithm would be helpful too.
Thanks in advance...
Faysal
|
|
|
|
|
Interesting problem. When you talk about the outer envelope - is this the smallest shape that contains all the points?
And when you say area - do you mean area (as measured in square centimetres say) or just the subset of points which define it?
Regards,
Rob Philpott.
|
|
|
|
|
|
Sorry, how is it related to the envelope area?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Because the envelope would be the shape bounded by the leaves of the tree.
|
|
|
|
|
What you want is the complex hull[^]
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
I am trying to add a database created in SQL Server Management Studio Express to a C# express application.
The data source is "Microsoft SQL Server Database File (SqlClient)"
The data provider is ".Net Framework data provider for SQL Server
I browse to the database and get a "The file is in use" error.
Visual C# 2008 Express Edition is the only application open.
What am I doing wrong?
Butch
|
|
|
|
|
Hi,
For developing a windows application that must work on a LAN, one way is common developing of it and sharing ConnectionString (i.e. ConnectionString be the IP address of Computer that SQL Server is installed on it).
Is there any other way? if yes, is it better?
Best wishes
|
|
|
|
|
Depends on what you want to do. If your application is a quick and dirty bodge and all the computers can access Sql Server direct on the LAN you can do this. You'd want to make sure you use Windows Authentication rather than SQL authentication mind for security reasons. I should stress it's not recommended on a quality basis though.
If you want to make a quality solution, you should look at abstracting the database away from the client computer by using an N-Tier architecture. http://en.wikipedia.org/wiki/Multitier_architecture[^]
Regards,
Rob Philpott.
|
|
|
|
|
Your question(s) made no sense.
|
|
|
|
|
I'm trying to set up a service with a class that make use of the FileSystemWatcher, is not working for some strange reason, basically I set up the FSW set an event handler and run the Service.
Now if I test the Class on a normal executable, once it passes through the FSW code the executable ends I had to put a while loop that will keep the executable running and that way it works perfectly, but the while loop takes too much processing when program is not doing anything, so I can't really put it on the service.
Another thing that I noticed when running the Service is that the event handler calls a method that actually calls an outside process but this process stays in memory and never gets out, I can see it in the task manager. The following code is the one I'm using for the Service:
class Watcher
{
const string DIRECTORY_TO_LISTEN = @"c:\tmp";
const string SFTP_SENDER = @"pscp.exe";
const string SFTP_SERVER = @"192.168.0.59";
const string SFTP_USER = "john";
const string SFTP_PASSWORD = "smith";
const string SFTP_LOCATION = @"/home/john/";
public bool ContinueRunning {get; set;}
public void Run()
{
try {
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = DIRECTORY_TO_LISTEN;
watcher.Created += new FileSystemEventHandler(OnFileCreated);
watcher.EnableRaisingEvents = true;
while (ContinueRunning)
{
System.Threading.Thread.Sleep(15000);
}
} catch (Exception ex) {
new Logger(ex.Message,"ezWatcher");//Logs Event viewer.
}
}
private void OnFileCreated(object source, FileSystemEventArgs e)
{
string output;
string args = String.Format("-sftp -pw {0} -batch {1} {2}@{3}:{4}{5}",
SFTP_PASSWORD,
e.FullPath,
SFTP_USER,
SFTP_SERVER,
SFTP_LOCATION,
e.Name);
Process proc = new Process();
try {
proc.EnableRaisingEvents = true;
proc.StartInfo.FileName = SFTP_SENDER;
proc.StartInfo.Arguments = args;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
output = proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
proc_Exited(proc.ExitCode,e.Name,output);
} catch (Exception ex) {
new Logger(ex.Message, "SFTPWatcher");//Logs Event viewer.
}
}
private void proc_Exited(int result, string fileName, string output)
{
try {
new Logger(result + " " + fileName + " " + output, "ezWatcher");
SqlConnection conn =
new SqlConnection("Data Source=someServer;Initial Catalog=someDB;Persist Security Info=True;User ID=someUser;Password=somePass");
string query = String.Format("INSERT INTO SFTPWatcher SELECT [filename] = '{0}', [output] = '{1}', [result] = '{2}'", fileName, output, result.ToString());
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
} catch (Exception ex) {
new Logger(ex.ToString(), "SFTPWatcher"); //Logs Event viewer.
}
}
The calling code is:
protected override void OnStart(string[] args)
{
base.OnStart(args);
Thread process;
Watcher watch = new Watcher();
watch.ContinueRunning = true;
process = new Thread(new ThreadStart(watch.Run));
process.Start();
}
So if anyone show light on this will be appreciated.
Thank you.
|
|
|
|
|
Hi ,
i am able to create static crystal reports , but i want to create reports based on user input. I have to provide UI to select between two dates and some other options .
i want to get data from databse (sql 2005) based on these query ...
can any one suggest me how can i do : this (samples or Links )
Thanks
csn.
|
|
|
|
|
That thing will depend upon the version of Crystal Report you are using. In Crystal report 11, the method is, go to "Field Explorer". you have the option "Parameter Fields". Create a new parameter with datatype date time. for eg. "Startdate" & "EndDate". Now go to menu Report --> Select Expert. It will ask you to select the field. Assuming that the field you have to use is "DateofBirth", select this field.
Now a window will open & it will ask you for selecting a option, as for date, you will select "is between", then it will ask you the two values. Select the parameter field you have created earlier & click ok its done. Now see the preview it will ask you for input parameters.
Good luck
|
|
|
|
|
Hi ,
Thnaks for you reply ..., i will try this ...
|
|
|
|
|
You need to create parameters in crystal report. Google Push and Pull method in ASP.NET with Crystal Report.
Cheers
Anoop
|
|
|
|
|
Hi,
I would like to compare 2 instances of List < Point > which meet following specification.
<br />
- both lists contain uneven count of random Points (List < Point > )<br />
- special method evaluates two points (bool MatchPoints(ref Point p1, ref Point p2); )<br />
- there is no similarity in points in those lists. They can be perfectly similar or they can have no points in commmon at all.<br />
- it is possible to do whatever processing (hashing etc...) of those lists when created, because they won't change much (if at all) after created. <br />
- result should be saying percentage of points that match from all evaluated points<br />
- there will be up to 1000 points approx in a single list. <br />
simplyfied Example:
bool MatchPoints(ref Point p1, ref Point p2)
{
return (p1.X == p2.X && p1.Y == p2.Y);
}
List<point> l1, l2;
l1 = {[0,0], [1,1], [2,2], [3,3]}
l2 = {[1,1], [3,3], [4,4]}
points that match = {[1,1] , [3,3]}
points that don't match = {[0,0], [2,2], [4,4]}
percentage matched = 2*2 / 7 = 4/7;
any ideas
thank you
zilo
|
|
|
|
|
Very good. Now what's your question? What have you tried and where have you failed?
|
|
|
|
|
My question is what would be the best algorithm in terms of speed to do that. I haven't tried anything yet, although I have some ideas. I real, the MatchPoints method evaluates distance between two points . They don't have to be exactly the same to match, they just need to be whithin a specified distance. Now what I'm trying to do is create a Region from rectangles (should be circles but I guess rectangles approach will be faster and much less expensive) where each point is the center of it's rectangle. Union all rectangles to region. So after I create the list of points, I also create Region that these points 'cover'. After that I just need to run points from one list on the other's list Region for IsVisible(Point point) constraint. I need to test it to see how it performs...
zilo
|
|
|
|
|
Do you have to use your own Point class? I think System.Windows.Point has the == operator overloaded already so matching code would be a little simpler, if you're already using it, then disregard. I ran into this problem before, and I started with the smaller of the 2 lists to use as a starting point as you're not going to have any match lists longer than the shortest list. But you're still stuck with a runtime of O(n2). ( I think that's right, but it's been a while for O notation). You could also put your two point lists into Generic Lists and if you're using .NET3.5 there is a Union<> generic extension method that can be used, but I'm unsure if that'll buy you any performance. I looked at the IL generated by the MatchPoints function, and it's 37 Bytes. If you drop the ref and do p1 == p2 the codesize drops to 13 bytes in IL.
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|
|
Hi,
thanx for answer,
I've created my own Point2D struct because accessing fields directly without Properties is much faster when considering a lot of iterations. I can overload the == operator in my Point2D struct same way as it is in Point struct if I needed... yes my lists are Generic lists (using .NET 2.0). I don't understand what's O(n2) .
zilo
|
|
|
|
|
Could you sort the lists? Maybe adding X+Y and sorting the lists on that parameter, and then doing a comparison to see if a match is possible may prune the searches down. The worst case is that all the points add to the same number and you're doing an extra comparison. But practically, you'd probably cut on average half of the possible cases. And there's definitely some tricks you can do by saving positions in the list where you know values can't match. For example, when comparing near the end of the list, you know that sorted elements in the other list's beginning aren't going to match, so skip over them using a fencepost parameter you have saved. Hope this helps.
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|
|
I was thiking of that too but I can't figure out how to sort it. Just adding x+y doesn't tell a thing about that point location. e.g you have two points [0,20] and [20,0]. They both have sum of 20 hence are far away from each other.
zilo
|
|
|
|
|