|
What version of the framework is installed on your computer? Any language packs?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I want to write a type to a binary file, but the write method only seems to support strings... is there a way i can do this?
Cheers
FileStream fs = new FileStream("weapon.dat",FileMode.OpenOrCreate,FileAccess.ReadWrite);<br />
BinaryWriter bw = new BinaryWriter(fs);<br />
BinaryReader br = new BinaryReader(fs);<br />
<br />
bw.Seek(0, SeekOrigin.End);<br />
bw.Write(Weapon);<br />
|
|
|
|
|
Hi,
BinaryWriter.Write() has overloads for all kinds of native data types, including
int and string. Of course it does not know your class.
If you have a Weapon class, you could add a Write(BinaryWriter) method it,
that would perform a number of basic BinaryWriter.Write() calls so everything
that needs to be written gets written. And of course you would have to
also add a Read method; you might make that one static and have it return a
new instance of Weapon.
The next problem may consist of understanding you binary file; if it consists
of a number of records, each containing the data for one out of many possible
types, you must somehow decide which classe's Read must be invoked next.
One way of solving this is by adding a static bool Recognize(BinaryReader) method,
that does not modify the stream's position, but determines if the data corresponds
with that class.
And it typically is helpful to start each record with something unique,
often called an eyecatcher. It could be a single character ('W' for weapon),
an enum value, whatever. In doing so, you could have a general ReadFile() method
that peeks at the next eyecatcher, then calls the right Read() method, and
loops over this until the file is done.
|
|
|
|
|
Thanks for the quick reply (again ), it was very helpful ^^
|
|
|
|
|
Hi all,
I would like to be able to correctly determine whether I have connected to my Host before trying to login.
Everything I can think of trying has failed.
If I try connecting to 192.168.0.1 110 it says its connected, but has 0 bytes Available. Which is great, and works for valid and invalid addresses whilst debugging, but as soon as I remove all breakpoints it comes back with errors on the valid addresses.
I done a quick search, and found using a mixture of Poll and Available which unfortunately doesn't work either.
Basically I don't want any code to continue until I have a Connected and Communicating Socket.
Any idea's?
Regards
Gav
|
|
|
|
|
Gavin Roberts wrote: it comes back with errors
What errors?
What "comes back with errors"?
Gavin Roberts wrote: Basically I don't want any code to continue until I have a Connected and Communicating Socket.
Then check for the error and if present don't continue
|
|
|
|
|
Sorry. Basically I use Socket.Available to check if any data is available before continuing which whilst stepping through with a debugger, works fine as soon as I run the code with no breakpoints Socket.Available returns 0.
I am currently using Socket.Read to check but that is quite slow.
Cheers for the reply.
Gav
|
|
|
|
|
Gavin Roberts wrote: I am currently using Socket.Read to check but that is quite slow.
Slow?? Read will read quit fast when the TCP/IP stack has received the data from the remote socket. If it is "slow" then the network connection or remote server must be slow.
Under normal network and server conditions for a POP3 Server, you can do a blocking "Connect" and when that returns you can "Read" the "OK" message sent by the Server immediately. There should be no significant delay. If there is, then you have a network issue or the POP3 Server is slow.
|
|
|
|
|
I am using Socket.Connect to connect.
At the moment, I am having to use Socket.Receive to determine whether the connection is valid or not.
I was using Socket.Available, but this only seemed to work when I was stepping through each line using Visual Studio. As soon as I removed all breakpoints and allowed it to continue as normal, Socket.Available returned incorrect data, as if it hadn't enough time to populate.
Socket.Receive is slow for a invalid Connection, and i'd prefere to speed this up.
Thanks
Gav
|
|
|
|
|
Gavin Roberts wrote: Socket.Receive is slow for a invalid Connection, and i'd prefere to speed this up.
Socket.Receive is blocking which means that it will only return after it has received data or the connection has been closed.
To check if the connection is valid you will have to look at the socket options available to see if any of those help. Also you should be checking the return status of Socket.Connect to see if it connected properly and if you are not catching any exceptions around the Socket.Connect, then you will be missing information that may lead to the answer you are seeking.
An inference from the above is that the socket should be valid by the time the receive method is called.
Phil
|
|
|
|
|
Gavin Roberts wrote: I am using Socket.Connect to connect.
Ok but have you "read" the documentation[^]
You are expecting certain behavior based on "what" if you haven't read the documentation? Just guessing?
|
|
|
|
|
hi
Unrecognized attribute 'xmlns'
all i a getting an error while running a asp.net web application in visual studio 2005
please help mee
actually i did all
1) aspnet_regiis -i
2) going to properties of iis
actuallly i installed 2008 web edition and windows pre release once in between i stopped the installation then reinstalled later
from the time i stopped in between i not able to run web application please help me
byebye
|
|
|
|
|
|
in controlpanel goto adminstrative tool->iis->website->defaultwebsite->(rightclick and click properties)from the tab clickasp.net and change the version from 1.1 to 2.0 if it is not changed and try it again
prasanna muthuramalingam
|
|
|
|
|
dude
my problem is like this see the next part of my question
i have installed .net framework 3.5 version and i dont get that option in iis tab
|
|
|
|
|
Hi all,
Please i got a problem. I have a program that runs underneath to help for security. When i have another version of that program, i have to install that stealth program again, which sometimes leads to conflict.
Question: Is there a way i can check for the existence of that program on the system to know if installation should continue?
Probably something with System.Management or File.Exists()?
Thanx a lot.
Everything has its beauty but not everyone sees it.
|
|
|
|
|
Hi,
you can detect the existence of the EXE file with File.Exists() but if the app
is running, you will not be able to overwrite it.
you can detect the EXE being active by checking the running processes, e.g.
with Process.GetProcesses(). You could try to kill the process if it is running,
after making sure it is your program to begin with.
Of cource, a security app should protect itself against being killed and/or
overwritten. I have seen security apps that consist of more than one EXE that
keep watch on each other. As soon as one exe sees another part is missing,
it launches the app; if that occurs say every second (or based on a FileSystemWatcher
assuming it is fast enough), it becomes hard to manually kill it all.
|
|
|
|
|
Hi Luc,
is there not a way i can query the system registry to get a list of installed products? Cos the installation path of the EXE to be sought might be dynamic.
thanx
He who goes for revenge must first dig two graves.
|
|
|
|
|
I'm afraid that is a complex matter; AFAIK there is not just one way of registering
an installed product, it may reside in lots of registry branches.
Part of the solution may be to watch for all the known file associations,
they obviously must point back to the EXE that needs to be launched when a
file gets double-clicked in Windows Explorer.
|
|
|
|
|
hi friend my problem is in mdi form there are some menu and one menu option is login by clicking login the next page login page open it show in mdi form but after clicking ok button which exist in login page we want another page open but it not happened
so please tell me but to do
deepak chandra
|
|
|
|
|
Hello,
A code snipped would help us I think!
Are you call "Show" or "ShowDialog" to open the 'login' page over the menu?
If you use "ShowDialog", you can not open on other Form from that, I guess.
If you open the second Form than with Show, the Dialog Form will close.
All the best,
Martin
|
|
|
|
|
no i haven't used dialog
ok button what will i write ?by which another page open and show in mdi form
deepak chandra
|
|
|
|
|
deepaksringr wrote: hi friend my problem is in mdi form there are some menu and one menu option is login by clicking login the next page login page open it show in mdi form but after clicking ok button which exist in login page we want another page open but it not happened
so please tell me but to do
A little code snippet will be helpful.
Everything has its beauty but not everyone sees it.
|
|
|
|
|
Hi all ,
I need to update the changes made on the dataset to database ,i wrote the following code but its getting updated to database ,please help me somebody
The code like this
Da=new SqlDataAdapter("SELECT * FROM MailsInQueueTest",sqlcon);
SqlCommandBuilder builder = new SqlCommandBuilder(Da);
sqlcon.Open();
Da.Fill(MailDataset);
foreach(DataRow dr in MailDataset.Tables[0].Rows)
{
if((Convert.ToInt16(dr[0]))==1)
{
dr.Delete();
}
}
MailDataset.AcceptChanges();
builder.GetUpdateCommand ();//.GetDeleteCommand();
Da.Update(MailDataset);
Thanks In Advance
Chandra Gupta
|
|
|
|
|
I need to define a treeview with xaml that has a checkbox on each node without binding it to a data source. Can anyone help me ?
Johan Lombaard
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
|
|
|
|