|
I would think not. With the greater distance means a longer time waiting for the socket to receive data, and with greater latency means more waiting, means less repetitions in the loop I would think.
|
|
|
|
|
I have not seen the code, obviously, but if a greater distance causes it, then I'd wonder if a smaller packet size makes the code run more often for the same file size. Stabbing in the dark, here....
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
KarlWF wrote: I would think
Sure, but you would also think your program runs fine, except it does not.
There is a flaw somewhere, it could as well be in the things you think to be true.
Be alert for all kinds of things, gather facts, hence use logging as Christian suggested.
|
|
|
|
|
Hello
I have a problem.
if we have internet connection(gateway connection,not dial-up) for example by a adsl modem connecting to pc by usb, how can we disconnect and connect that connection in C#, i know how to test it's connected or it's disconected.
thank's alot.
pejman
|
|
|
|
|
Hello all,
I have a very simple program. All it does is browse for a file, calculate the sha1 hash and display it in a textbox. I have added an option in Windows context menu with the intention of right clicking on a file, choose an option like 'Get Sha1 Hash' and have the program calculate it. How do I do this? Based on what I've read, it seems that I would need the path for the file I right-clicked and probably pass that in as a parameter.
So I know two things: I know how to add something to the Windows Context Menu. I also know how to pass command-line parameters in the program. Currently all that is happening is the program starting normally when I right click on a file.
I hope I have expressed the problem clearly enough for anyone to understand.
Any help would be appreciated.
|
|
|
|
|
Does this[^] help ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
this one is in C#[^]
|
|
|
|
|
XD Oops.
The issue I had: Open and Save File Dialogs caused the program to exit.
Solution (in my case): Remove compatibility settings in Properties > Compatibilities.
modified on Monday, May 5, 2008 3:59 AM
|
|
|
|
|
Grass Cutting Sword,
Do you ever tell your program to exit/close for some reason? Do you use try{} catch{} for exceptions?
You'll need to provide more info, code etc, since we cant guess what it is from the above info.
Regards,
Gareth.
|
|
|
|
|
I didn't tell the program to close at all.
I used try/catch and it didn't show anything.
private void openToolStripMenuItem_Click(object sender, EventArgs e)<br />
{<br />
try<br />
{<br />
dlgO.ShowDialog();<br />
}<br />
catch(Exception z)<br />
{<br />
MessageBox.Show(z.ToString());<br />
}<br />
}
dlgO is the OpenFileDialog created using the Forms Designer.
|
|
|
|
|
Grass Cutting Sword,
When is "dlgO" created?
Regards,
Gareth.
|
|
|
|
|
Resolved.
It was a compatibility setting applied by windows. Windows 2000 + Dialogs = no fun.
Thanks for your help Gareth
modified on Sunday, May 4, 2008 4:45 PM
|
|
|
|
|
Please don't delete the question when it's resolved. Now noone else can benefit from the replies that you got.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I've been mucking around with embedding scripting languages in my (Windows/Desktop) applications with some success. I've looked at Script.Net which I thought was very impressive, and also IronPython and C# Script which have more, but to my mind have slightly too much for a light-weight scripting engine.
I got to wondering, however, about Java/ECMA Script as an ideal embedded language as it's possibly the most used scripting language in the world. Does anyone know of an implementation that can be embedded in .Net (not asp.net, which is what Google thinks I'm on about!) apps?
|
|
|
|
|
I successfully implemented a WSH (Windows Scripting Host) both in C++ and now in C#.
We do use VBScript as the scripting language for the templates in our Desktop CMS "zeta producer [^]". I published the interfaces here [^].
If I do understand correctly, it is simply a matter of switching the language to switch from VBScript to JavaScript (or other installed implementations like e.g. PerlScript).
|
|
|
|
|
Cool. I shall investigate
|
|
|
|
|
Hello,
As a result of my 1-st level of calculations, I'll get a 5 dimensional table of elements (each element is a structure with 4 integers inside). Those elements will be used for next level calculations (they had to be precalculated to save time for recalculating the sam values in each iteration). Length of each table dimension will be 52 ( so I'll have: myArray = new myElement[52,52,52,52,52]; )and I'll need to access the elements of it as quickly as possible by referring to table indexes for each dimension (as I have written, this will be input for next calculation and optimization is necassary)
The problem is that the table is too large:(52^5) * 2 bytes(sizeof int) * 4(ints in the structure) = 2.83274078 gigabytes, so I cannot keep it in RAM (I have only 1 gig).
I was thinking about putting the results from 1-level calculations directly to 3Gig binary file (this would save me recalculationg the array each time the programs starts), but I am not sure if seeking the proper element + harddrive delay will be quick enough solution.
Just to get the idea, I need to perform a simulation of about 1 000 000 000 000 iterations, where I'll use the values from the table (which contains a result of all combinations of cards - one card can be used 5 times)
Any ideas how can I handle this problem?
Many thanx for the help!
|
|
|
|
|
Hi,
Create a stored procedure and do the calculation at the database side. Then use a datareader in C# code.
IF even imposible, do batch calculation. Say for an example, if your table has a auto increment primary key, execute queries in batch mode.
First Query WHERE id <20000
second query WHERE id >20000 AND id < 40000
Hope this helps,
Regards,
Charith
Charith Jayasundara
|
|
|
|
|
Hi!
Thanks for the respond - I was thinking also about this solution.
The only question that appears is if direct access to the file wouldn't be quicker solution, because I'll be getting one element from the array at the time, and it will not be possible to predict which element will be needed in next iteration.
basically this will look like:
for(i=0;i<verybignumber;i++)>
{
element mElement= getVal(a,b,c,d,e); //values a-e are the indexes and we may assume that they are completly random
doOtherCalc(mElement);
}
Do you know more or less how much slower will it be to get the data from DB than from the file directly? I'll be using DBServer on the same workstation where the application runs - there will be no network connections.
Thanks again for the help!
|
|
|
|
|
Hello Forum,
I am creating a GridView with one column “Item Description”, the column is a “DataGridViewButtonColumn” the idea is the user can click to select an item, how can I get the item id?
When you see the code below you will realize that the issue is how to cast an anonymous type, Please help…
Thanks you
lnqDataDataContext dc = new lnqDataDataContext();
var query = (from p in dc.Products
select new
{
Id = p.ID,
Description = string.Concat(p.Price.ToString(), " - ", p.Description)
});
grdItemsGrid.DataSource = query;
DataGridViewButtonColumn items = new DataGridViewButtonColumn();
items.DataPropertyName = "Description";
items.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
grdItemsGrid.Columns.Add(items);
grdItemsGrid.CellContentClick += (o, e) =>
{
};
|
|
|
|
|
You can't cast an anonymous type, as you can't specify which type to cast to.
Create a class that you can use:
public class Product {
public int Id { get; private set; }
public string Description { get; private set; }
public Product(int id, int description) {
Id = id;
Description = description;
}
}
Now you can use that to create your list:
var query = from p in dc.Products
select new Product(p.ID, p.Price.ToString() + " - " + p.Description);
The data items are Product objects, so now you can cast them.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
|
Interresting. That means that the compiler reuses anonymous types within the same assembly if they have the same set of members. I wonder if the language is defined to work that way, or if the code is exploiting an undefined behaviour...
A bit of a kludge, anyway, as you have to create another instance of the type to be able to cast to the type.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yes its an ugly hack no doubt about it.
The strange thing about it is that:
var a = new { foo = 123 , bar = 678}
and
var b = new { foo = 777 , bar = 123}
Gives the same type.
But:
var b = new { bar = 123, foo=777}
Gives a new type, even tho the type have exactly the same members.
(the compiled class will have different constructors, ctor params are specified in the same order as the properties)
And if I recall correctly then this is a language feature because some MS guy wrote about the above as a bug, and then Eric Meijer(or some other linq guy, dont remember 100%) told him that that was the intended behaviour according to the c# specs.
|
|
|
|