|
Member 4756709 wrote: the shortest path between two points
Is a straight line.
Couldn't resist....
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Only on a 2D/3D surface. In 4D spacetime, it's a geodesic.
Cheers,
Vikram.
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
Wasn't me that gave your the 1 vote...
Doesn't Pythagoras work in any number of dimensions? The geodesic would just be a visualization of it, right?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Pythagoras is only correct in euclidean geometry. It's not the number of dimensions that matters, it's the flatness that does. In flat space a geodesic is a strait line. In curved space a strait line isn't always the shortest path.
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop.
-- Matthew Faithfull
|
|
|
|
|
hmm....the straight line is always not possible with blockages along the path between source to the exit...i dont want the shortest path b/w two points but the shortest out of every available path....
|
|
|
|
|
Try here[^]. Lots of A* implementations are there
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Hi all. I have project compress file using C#. I'm using name space IO.Compression and i saw this code on Internet but it is compress to file bigger than source file. Can you help me, please.Thanks for your help.
<br />
public void CompressFile(string inputFileName, string outputFileName)<br />
{<br />
byte[] buffer = new byte[4096];<br />
if (File.Exists(inputFileName))<br />
{<br />
using (FileStream inputFile = File.Open(inputFileName, FileMode.Open), outputFile = File.Create(outputFileName))<br />
{<br />
<br />
using (GZipStream gzip = new GZipStream(outputFile, CompressionMode.Compress))<br />
{<br />
int n = 0;<br />
while ((n = inputFile.Read(buffer, 0, buffer.Length)) != 0)<br />
{<br />
gzip.Write(buffer, 0, n);<br />
}<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
public void UncompressFile(string inputFileName, string outputFileName)<br />
{<br />
byte[] buffer = new byte[4096];<br />
if (File.Exists(inputFileName))<br />
{<br />
using (FileStream intputFile = File.Open(inputFileName, FileMode.Open), outputFile = File.Create(outputFileName))<br />
{<br />
using (GZipStream gzip = new GZipStream(intputFile, CompressionMode.Decompress))<br />
{<br />
int n;<br />
while ((n = gzip.Read(buffer, 0, buffer.Length)) != 0)<br />
{<br />
outputFile.Write(buffer, 0, n);<br />
}<br />
}<br />
}<br />
}<br />
}<br />
Le Trung Hieu
|
|
|
|
|
What sort of data are you trying to compress? If it's something like an image file (Jpg, PNG, GIF, etc) then this data is already compressed, and a zip compression is unlikely to compress it further. The data ends up bigger since it has to add the zip header at the beginning of the output data.
|
|
|
|
|
Thanks for your reply.I was tried it with *.exe file.And one more question , how about compress,decompress multi-file in the folder?Thanks so much.
Le Trung Hieu
|
|
|
|
|
Depending on the type of file, you will get different compression results. Also, files that are already compressed usually get larger when compressed again.
Using the GZipStream class you can only compress/decompress a single file. That is the way the GZip protocol is designed. If you want to compress multiple files into a single archive you will need to use a Zip protocol.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
I have created C# Class Library (MySample.DLL)
I have set [assembly: ComVisible(true)]. I have also checked "Register for COM interop" check box under Project properties. The class library is also registered using regasm.exe and also the .TLB file is generated (tlpexp.exe)
Now i'm trying to load this library in a VC++ program at RUN TIME. VC++ program know only the dll name (MySample.DLL).
I'm using an API LoadTypeLib(MySample.DLL). But this gives an error TYPE_E_CANTLOADLIBRARY (The type library or DLL could not be loaded.)
But When i specify the tlb name instead of dll name then the call LoadTypeLib(MySample.TLB) is success.
But my VC++ program will get the .dll.
Could you pls help.
Thanks in advance
|
|
|
|
|
Hi all,
I have a error on using Impersonator class in c# .net. The error was "A required privilege is not held by the client". My system OS is windows 2000 advanced server. How to fix this error when changing my Impersonator class?
Note:The same Impersonator class is working fine another system which is in Windows 2000 advanced server.
Is there any changes in IIS?
Thanks in advance.
Regards,
Rameshkumar Thirumalaisamy
|
|
|
|
|
Have a look at this[^] post. Does it help you any?
|
|
|
|
|
Hi,
I need a help urgently, if any one can sort it out... I want to display the winforms datagrid dataset into
(1) pdf file
or
(2) on Microsoft Report Viewer control using RDLC.
I have a screen that displays two different dataset with two different datagrid. Using that screen results, I have to print or convert it into the PDF file...
......
Kind Regards,
Madhusudan Kushwaha
|
|
|
|
|
Just a little tip: if you say your problem is urgent, it will get ignored.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Hi, my friends.
I have a question with my web services. he have two functions, the intellisense in the windows application show me this function whit the parameters of each one. But it does,t work.
The error message is terrible:
System.Web.Services.Protocols.SoapException was unhandled
Message="System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: Cannot serialize the DataTable. DataTable name is not set.\n at System.Data.DataTable.WriteXmlSchema(XmlWriter writer, Boolean writeHierarchy)\n at System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter writer)\n at System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)\n at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_SearchResponse(Object[] p)\n...........and much more.
thanks.
|
|
|
|
|
What is the return type of the webmethod ??
Was it working separately as a function ??
Sathy
|
|
|
|
|
thanks Sathy.
the function in the services return a datatable, but in the application if I do:
DataTable appsearch = new DataTable();
appsearch = serv.Search(var1,var2);
fail in build with the error message:
Cannot implicity convert
type 'Client.localhost.SearchResponseSearchResult' to 'System.Data.DataTable'
what that mean? please.
|
|
|
|
|
Ok in that case - the Webmethod is returning the type SearchResponseSearchResult which will have some series of properties (you'll probably find that the datatable is one of them), if you are using VStudio you can use object explorer to examine that object otherwise you'll be able to find the webservice proxy class to see the class definition of SearchResponseSearchResult . Then you should be able to do something like :
<br />
Client.localhost.SearchResponseSearchResult objResult = serv.Search(var1, var2);<br />
DataTable appsearch;<br />
<br />
if(objResult.DataTableProperty ! = null)<br />
{<br />
appsearch = objResult.DataTableProperty;<br />
}<br />
|
|
|
|
|
thanks a lot, Torsten Mauz.
I can do what you explain here but the DataTableProperty i don't have. I think this can be because i am working with a xml web service and also this is the reason why i have
System.XML.XmlElement[] SearchResponseSearchResult.Any
I dont now where this Any come from but i think i can use this XmlElement.
what you think?
Something else, in this web services i have another function boolean, this function return boolean in the application without any problem.
|
|
|
|
|
DataTable name is not set - kind of gives the game away. The webservice has issues that need resolving, i.e. the DataTable object they are trying to return needs to have it's TableName property set before it can be serialised. If you have access to the webservice code then you'll need to fix that. Otherwise you'll have to get in touch with whoever is responsible for the service.
HTH
|
|
|
|
|
the datatable name is set
|
|
|
|
|
How do you tell if a cell in DataGridView is empty?
foreach (DataGridViewRow r in theTableDataGridView.Rows)
{
richTextBox1.Text += r.Cells[1].Value.ToString() + " " + r.Cells[2].Value.ToString() + "\n";
if (r.Cells[3].Value.ToString() == null) { return; }
else { richTextBox1.Text += r.Cells[3].Value.ToString() + "\n" ; }
}
This doesnt work... ToString().Trim() does not work... I just can not figure it out.. in the database the default value is <dbnull>.
I just can not figure it out... Thanks in advance!
|
|
|
|
|
how about r.Cells[3].Value == null || r.Cells[3].Value.ToString().Length == 0 ?
Last modified: 2mins after originally posted -- fixed a bunch of syntax and logic errors
|
|
|
|
|
Jacob Dixon wrote: How do you tell if a cell in DataGridView is empty?
foreach (DataGridViewRow r in theTableDataGridView.Rows)
{
richTextBox1.Text += r.Cells[1].Value.ToString() + " " + r.Cells[2].Value.ToString() + "\n";
if (r.Cells[3].Value.ToString() == null) { return; }
else { richTextBox1.Text += r.Cells[3].Value.ToString() + "\n" ; }
}
This doesnt work... ToString().Trim() does not work... I just can not figure it out.. in the database the default value is .
I just can not figure it out... Thanks in advance!
You need to use DBNull.Value . A couple things, while we are at it. The way you formatted your string is ugly. This is 2008, format strings the right way . Use string.Format() . Also, in an if statement, put the constant on the left hand side. So in the end, you would want your code to look like this:
foreach (DataGridViewRow r in theTableDataGridView.Rows)
{
richTextBox1.Text += string.Format("{0} {1}\n", r.Cells[1].Value.ToString(), r.Cells[2].Value.ToString());
if (DBNull.Value == r.Cells[3].Value)
return;
else
richTextBox1.Text += string.Format("{0}\n", r.Cells[3].Value.ToString());
}
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|