|
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.
|
|
|
|
|
I created a Setup project for an application, and I built the setup.exe and .msi files for this application. I then ran the installation on another PC and the application ran fine until I removed the .exe and .msi files from that PC. Once that occurred, the application kept looking for those files as long as I tried to start the application with the shortcut that was created at installation time on the User's Programs Menu. Since those files no longer existed on the PC, the application would not run via that shortcut.
So, I manually created a new shortcut to the executable, and the application runs fine when started via the new shortcut. What I can not figure out is what property is causing the shortcut created via the install to expect the setup.exe and .msi files for the install to still exist on the PC. This is not a published executable, but there must be some obvious property I am not setting properly. Can anyone tell me what might be causing the shortcut created on the install to continue to expect the existence of the setup.exe and .msi files?
Thank you...
|
|
|
|
|
Hi there,
i have written a port-forwarding tool for a special software i use for an online game project.
everything works fine, but the server only get the client-ip from the forwarding server, not from the user.
Everything is working with TCPclient Class.
So, is there a posibility to edit the senderip in a packet, i send?
For example:
Client-IP=88.88.88.88
Forwarder-IP=99.99.99.99
Server-IP=11.11.11.11
1.the client connects to the forwarder
2.the forwarder accept the connection if some checks have been made...
3.the forwarder connects to the server
4.the forwarder forwards all messages from the client to the server and backwards.
additional to 4: on point 4, the forwarder should modify the packet data on send, that the server sees client-ip 88.88.88.88. but at the moment, it sees 99.99.99.99.
Maybe you can help me?
Thanks for all replies.
janwe
|
|
|
|
|
You'd have to rewrite the packet in raw mode to do this. The problem is you really can't do that under Windows XP SP2 and above because of security concerns.
|
|
|
|
|
Thank you for your reply!
what about windows server 2003 enterprise?
could it work there?
if so, are there any examples availlable?
|
|
|
|
|
Jan Weltmeyer wrote: what about windows server 2003 enterprise?
Not a chance.
|
|
|
|
|
Hi,
This essentially cannot be done, since the sender address is used by the server to send the response packets back to the client. If you fake the sender address, the TCP connection won't even get past the SYN-ACK phase (as the server will attempt to reply to the forwarders SYN packets with a FIN an ACK directly to the client - which will fail in most scenarios as the client won't have a half-open connection matching it). So - getting even the first payload into the server application would fail. This is why simple "spoof attacks" can only cause damage (unless the targets have seriously broken TCP/IP stacks) using connectionless protocols (UDP, ICMP etc). They can't get to any actual data using TCP.
Note that what you "Write()" to the TcpClient socket is NOT a packet. It is a payload. It will be sent in one or more actual packets over a connection established with a two-way initial packet exchange, each of which will be acknowledged or retransmitted by the sender - the client in this case. If you *really* want a one-way only packet transfer you can use UDP (but then you have to build your own acknowledgement/retransmit mechanism). Then, you could in theory spoof the sender IP (but like another poster noted, Windows and/or the framework will most likely not let you).
TCP-based application layer gateways (ALGs - such as those found in firewalls) handle it this way:
1. They keep track of their clients and forward the response traffic to the appropriate client based on the server IP and the port numbers used (as each client get their own sender port allocated by the forwarder - which becomes the receiver port in replies).
2. Some applications (FTP, for instance) insert the IP addresses in the packet payload (protocol commands). In this case, the ALG has to rewrite the commands (replacing the client's IP address and port(s) with its own) and then use method 1 as well.
Some protocols (such as SIP and other telephony applications) have more elaborate methods of handling ALGs - the ALGs become part of the protocol and actually tell the server that they're involved (as in "hi, this is me on this IP address, but I'm actually working on behalf of this guy on this private IP address that you can't see, so please let me know if you want to talk to him and I'll handle it for you"). This increases complexity by a factor of ten and explains why VoIP is sometimes such a royal pain in the a**... Even telephony operatores sometimes can't configure it correctly...
Later,
--
Peter
modified on Wednesday, May 14, 2008 4:18 AM
|
|
|
|
|
Okay. Very nice and Detailed information.
So i think i have no real chance to workaround my problem.
I will look for any other solutions, and writing it down here if I have one...
Thank You very much,
Jan
|
|
|
|
|