|
Actually, I got that wrong. The extra 8 bytes would be on the heap if your reference was not null. So, just 4 bytes on a 32bit machine. Trying to find a good reference for this stuff now.
Regards,
Rob Philpott.
|
|
|
|
|
Can't find anything on the net I'm afraid. I'm sure there's lots out there if you look around though. Also, consider reading one of Jeffrey Richters books - they are excellent on this sort of stuff.
Regards,
Rob Philpott.
|
|
|
|
|
|
Dear techies..
Nice if you could please help me with sorting an arraylist i have which contains objects of type 'card', which inturn contains 2 enums - rank and suit.
The arraylist normally contains 7 card objects. eg :
spades 3, hearts 4, spades 1, diamonds 4, spades 2, clubs 4, spades 4
The sorted arraylist should be like:
spades 1,spades 2,spades 3,spades 4,clubs 4,hearts 4,diamonds 4 - with the suits together with sorted ranks
Many thanks in advance..
|
|
|
|
|
|
You want to call .Sort on your ArrayList, the problem being though that Sort doesn't know how to compare two cards in order to do the sort.
To tell it this, you'll either need to extend 'card' to implement IComparable, or create a new seperate class which implements IComparer. Either way, you'll need to create a method which compares two cards. Compare suits first, and then if they are the same, the 'rank'.
Regards,
Rob Philpott.
|
|
|
|
|
Hi all,
I have an application (C# .Net WinForms) problem I am finding it difficult to solve, hopefully you guys will have some ideas...
This issue is that sometimes the application will freeze, by that I mean completely unresponsive - like if you perform long tasks on the UI thread. (I use BackgroundWorkers for a number of tasks when required)
Sometimes, I will get a message saying the application has stopped responding with little information I have found use of - it's an 'AppHangB1' error
The problem will occur regardless of which form is open, even a very basic one with little functionality (and no background workers)
I can recreate the issue two ways (not on all machines I tried thou) - If the system is idle an the station becomes locked, the application freezes when logging back in (not 100% of the time thou). The second method is too open internet explorer for a few seconds and then close/minimise, this causes the application to freeze (does not apply on a second machine I tested)
If any one has any ideas or pointers as to what I should be looking for then your responses will be much appreciated.
Thanks
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi musefan,
If this is not happening on all the PC's as you said; it might be due to
1) Memory problem (memory leak); check for memory hungry applications running.
2) OS update differe (Check for difference on the PC it is not happening)
3) Check for cross-loops creating infinit loop if any in your code.
4) Also might cause due to virus problem.
Regards,
Maruti
|
|
|
|
|
Hi,
Thanks for your reply. In response to your suggestions...
1) I have 3GB memory installed, at at the time of freezing no applications are using excessive amounts of memory. Total usage around 45%
2) When I said not happening on other PC, I meant when I can recreate with internet explorer open/close - This issue itself has occurred on all tested machines at some point
3) The freeze occurs on a basic form not long after start-up, when I create the freeze in debugging mode and then pause the process. The highlighted code is Application.Run in the Program.cs file. I would have thought if an infinite loop error then It would shown a line of code in the loop, - well if on the UI thread, a background thread infinite loop should not freeze the UI thread though surely
4) Due to it only freezing my application and on multiple machines, I think a virus is unlikely (Unless you include Vista as a virus )
Thanks again
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
|
How can I save DLL file to database and download DLL file from database in C#.
I want to save DLL file binary format in database.
Note: I use MS SQL Server 2008.
Thanks...
|
|
|
|
|
Keep it in a varbinary(max) column. BTW, keeping a DLL file in database seems to weird.
Best wishes,
Navaneeth
|
|
|
|
|
|
Hi All,
When I set the ReceiveTimeOut of Socket to some milliseconds then Socket throws the timeout Exception while the period expires and the problem is that then Socket is disconnected therefore i am unable to send and receive again with this socket.
I want that it waites for sometime for receiving but after elapsing the time,it should not be disconnected so that i can use it again n again..
Plz help...Its urgent.
Best Regards,
Lalit Narayan
|
|
|
|
|
From MSDN:
The ReceiveTimeout property determines the amount of time that the Read method will block until it is able to receive data. This time is measured in milliseconds. If the time-out expires before Read successfully completes, TcpClient throws a IOException. There is no time-out by default.
Read more here[^].
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
But when the socket throws exception ,socket is disconnected...this creates the problem 4 me,plz give the solution so that the socket should not be disconnected.
Best Regards,
Lalit Narayan
|
|
|
|
|
I think that is what happens when the time-out period is exceeded, the Receive method will throw a SocketException. Have you tried catching the exception, checking whether the socket is still connected (see here[^]), if not try to reconnect...
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi,
Actually i am working on Server Side,the connection requests comes from the Client Side,i can not reconnect to the Client through Socket....
The Server has TCP Listener on its own side,that waits for the Connection Request from the Client and make the Socket after Accepts the request.
Best Regards,
Lalit Narayan
|
|
|
|
|
As far as my understanding of TCP/IP clients and server(s) goes; it is the client initiates the connection. So, if the client disconnect in any way from the server, when it is the clients 'responsibility' to reconnect to the server.
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi,
The Client Side Code is written in C at Embeded Side n it takes some time to show the status "Disconnected" this creates the problem 4 me,they find the state of Socket "Connected" while it is disconnected at Server Side...
Plz do the needful.
Thanks and Regards,
Lalit Narayam
|
|
|
|
|
|
Well, I think you can't do that.
Imagine the situation:
Server starts reading.
Client starts sending. But, for some reason, the connection is VERY slow.
Server then receives the time-out (imagine it does not disconnect).
The server then asks for more data... but, the client is still sending the old-data. So, the server must now wait for what? The old data? The new data? How will it differentiate one data from the other?
I think the fact the connection is closed is on purpose. If you want, I think you may NOT use the ReceiveTimeOut. Instead, create another thread to call "abort" in the reading thread if it takes too long, so the connection will not be aborted, but I don't really know what will happen with the data in this case.
Also, depending on your requirements, it's possible to use UDP to receive the data.
|
|
|
|
|
is it a problem of my compiler?
if(((1*1*1)+(64*64*64))==(1*1*1))
printf("my name");
the printf()is printing "my name".
|
|
|
|
|
What compiler are you using? I tried with GCC and MSVC. printf is not executing in both places.
BTW, you are on a wrong forum.
Best wishes,
Navaneeth
|
|
|
|
|
this does not look like C# code (printf is a C function); if your environment is using 16-bit arithmetic, then 64*64*64 would overflow as it equals 2^18
|
|
|
|