相关文章推荐
慷慨大方的泡面  ·  Talk | ...·  1 年前    · 
宽容的苦咖啡  ·  apk - Android - do I ...·  1 年前    · 
礼貌的哑铃  ·  【Answers - Microsoft ...·  1 年前    · 

indicates new messages since 31-Dec-99 18:00
CSV isn't meant as a database, just as XML or Excell-files. That something is possible, doesn't mean that it's a good idea.
XML and CSV are slow if you treat them as a database, since the layout isn't optimized for that kind of access. Your best bet would be to use database, and export the pieces you need to CSV. If you're looking for something free and simple, consider SQLCE.
That being said, it is possible to read/write CSV data as if it were a database. You'll only need a connectionstring [ ^ ] Smile | :)
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
-- Martin Golding

Sign In · View Thread CSV can be a useful format for importing/exporting data, but although it's possible to do so, I wouldn't recommend using it as a DB.
Generic BackgroundWorker - My latest article!
BTW, in software, hope and pray is not a viable strategy. ( Luc Pattyn )
Why are you using VB6? Do you hate yourself? ( Christian Graus )

Sign In · View Thread Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Sign In · View Thread I am working on a device application using Visual Studio 2005 (C#). in the application i need an option to stream vdos within the application. i tried the web browser component by giving embed code as its document text to embed an flv player. no error is shown.. but i guess compact framework is not supporting ActiveX... it just displays a blank browser.. when i tried the same embed code on an HTML page... it is working........is there any way i can do this on a device application? Frown | :(
This code was posted by me...

Sign In · View Thread In what order is the Socket.BeginReceive/EndReceive functions called?
For instance, I call BeginReceive twice, once to get the message length and the second time to get the message itself. Now the scenario is like that, for every message I send, I start waiting for its completion (actually acknowledgment of the message sent, also I wait for the action's completion after receiving the acknowledgment), so I call BeginReceive with each BeginSend, but in each BeginReceive's callback, I check if I'm receiving the length or the message. If I'm receiving the message and have received it completely, then I call another BeginReceive to receive the completion of the action. Now this is where things get out of sync. Because one of my receive callback is receiving bytes which it interprets as the length of them message when in fact it is the message itself.
Now how do I resolve it?
Here is the code, basically it is too big, sorry for that
writeDataBuffer = System.Text.Encoding.ASCII.GetBytes(message); writeDataBuffer = WrapMessage(writeDataBuffer); messageSendSize = writeDataBuffer.Length; clientSocket.BeginSend(writeDataBuffer, bytesSent, messageSendSize, SocketFlags.None, new AsyncCallback(SendComplete), clientSocket); catch (SocketException socketException) MessageBox.Show(socketException.Message); public void WaitForData() if (! messageLengthReceived) clientSocket.BeginReceive(receiveDataBuffer, bytesReceived, MESSAGE_LENGTH_SIZE - bytesReceived, SocketFlags.None, new AsyncCallback(RecieveComplete), clientSocket); public void Send( string message) bytesSent = 0 ; writeDataBuffer = System.Text.Encoding.ASCII.GetBytes(message); writeDataBuffer = WrapMessage(writeDataBuffer); messageSendSize = writeDataBuffer.Length; clientSocket.BeginSend(writeDataBuffer, bytesSent, messageSendSize, SocketFlags.None, new AsyncCallback(SendComplete), clientSocket); catch (SocketException socketException) MessageBox.Show(socketException.Message); public void WaitForData() if (! messageLengthReceived) clientSocket.BeginReceive(receiveDataBuffer, bytesReceived, MESSAGE_LENGTH_SIZE - bytesReceived, SocketFlags.None, new AsyncCallback(RecieveComplete), clientSocket); clientSocket.BeginReceive(receiveDataBuffer, bytesReceived, messageLength - bytesReceived, SocketFlags.None, new AsyncCallback(RecieveComplete), clientSocket); catch (SocketException socketException) MessageBox.Show(socketException.Message); public void RecieveComplete(IAsyncResult result) Socket socket = result.AsyncState as Socket; bytesReceived = socket.EndReceive(result); if (! messageLengthReceived) if (bytesReceived != MESSAGE_LENGTH_SIZE) WaitForData(); return ; // unwrap message length int length = BitConverter.ToInt32(receiveDataBuffer, 0 ); length = IPAddress.NetworkToHostOrder(length); messageLength = length; messageLengthReceived = true ; bytesReceived = 0 ; // now wait for getting the message itself WaitForData(); if (bytesReceived != messageLength) WaitForData(); string message = Encoding.ASCII.GetString(receiveDataBuffer); MessageBox.Show(message); bytesReceived = 0 ; messageLengthReceived = false ; // clear buffer receiveDataBuffer = new byte[AsyncClient.BUFFER_SIZE]; WaitForData(); catch (SocketException socketException) MessageBox.Show(socketException.Message); public void SendComplete(IAsyncResult result) Socket socket = result.AsyncState as Socket; bytesSent = socket.EndSend(result); if (bytesSent != messageSendSize) messageSendSize -= bytesSent; socket.BeginSend(writeDataBuffer, bytesSent, messageSendSize, SocketFlags.None, new AsyncCallback(SendComplete), clientSocket); return ; // wait for data messageLengthReceived = false ; bytesReceived = 0 ; WaitForData(); catch (SocketException socketException) MessageBox.Show(socketException.Message);
Top Web Hosting Providers [ ^ ]
Do, or do not. There is no 'try'.

Sign In · View Thread According to the documentation, each BeginXxx needs a corresponding EndXxx, and typically that can be handled by the callback method.
I can't tell you what exactly is wrong in your code, however it is my impression your code is too complex and not sufficiently safe. I would code this more defensively, and avoid all the global variables your class seems to hold (receiveDataBuffer, bytesReceived, messageLengthReceived).
These are things I would do differently:
I would create a little class holding clientSocket, the receive data buffer, an index into it;
then create two instances (one for length, one for data) of it for each length+data communication, and pass them as the last parameter to the BeginReceive calls (and retrieve it from the EndReceive calls).
I would completely split the WaitForData() method into a WaitForLength method and a WaitForData method.
And I would completely split the RecieveComplete() method into a ReceivedLength method and a ReceivedData method.
(2) makes messageLengthReceived redundant.
(1) avoids the risk of receiveDataBuffer and bytesReceived to contain data belonging to another ongoing communication.
I am not saying the problem will be solved by doing this, I do claim the code would be more robust and easier to read, and either the problem is gone, or you'll have a better chance of locating the problem.
FWIW: I'm puzzled by AsyncClient.BUFFER_SIZE, it appears only once in the code shown; is it the size required to hold the length part only?
Hope this helps.
Luc Pattyn
Badger | [badger,badger,badger,badger...] Jig | [Dance] Badger | [badger,badger,badger,badger...] Have a look at my entry for the lean-and-mean competition ; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you. Jig | [Dance] Badger | [badger,badger,badger,badger...] Jig | [Dance]

Sign In · View Thread I need to convert the doc file into an image file.
I do not want to use the print functionality (Microsoft.office.interop) as the print out remains opened on the desktop
I should say how can I close the print out of the file so that client do not come to know about that?
Thanks & Regards,
Sheetal Rawat
Sign In · View Thread
Member 4600715 wrote:
I need to convert the doc file into an image file.

I don't think there's anything built in to do that, not even in the interop stuff. Your best bet. I'd think, is in taking a screenshot. Or printing to PDF.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

Sign In · View Thread I have a declaration of method like this
public ViewMethod([CreateClass] IInterfaceController controller)
this._controller = controller;
What does [CreateClass] mean/do here?
Ravie Busie
Coding is my birth-right and bugs are part of feature my code has!

Sign In · View Thread I would imagine if you don't already have a class Controller that implements IInterfaceController then that's what you need to create.
[edit] See Nick's answer below. [/edit]
Dave
BTW, in software, hope and pray is not a viable strategy. ( Luc Pattyn )
Visual Basic is not used by normal people so we're not covering it here. ( Uncyclopedia )
Why are you using VB6? Do you hate yourself? ( Christian Graus )

modified on Monday, September 7, 2009 6:23 AM

Sign In · View Thread It looks like you're using a Dependency Injection framework such as Unity. Am I right? If so, the documentation should tell you.
Kevin

Sign In · View Thread
the defination for createnew is
public sealed class CreateNewAttribute : ParameterAttribute
public CreateNewAttribute();
public override IParameter CreateParameter(Type annotatedMemberType);
what does it mean? i m not getting
Ravie Busie
Coding is my birth-right and bugs are part of feature my code has!

Sign In · View Thread Take some time to actually learn, don't just copy and paste.

only two letters away from being an asset

Sign In · View Thread It's a custom attribute - you'll have to look for the class CreateClassAttribute in your source.
----------------------------------
Be excellent to each other Smile | :)

Sign In · View Thread Thumbs Up | :thumbsup: I never considered that as I've never used (or needed to) an attribute on a parameter, I didn't even know you could! Something new learned today Big Grin | :-D
Dave
BTW, in software, hope and pray is not a viable strategy. ( Luc Pattyn )
Visual Basic is not used by normal people so we're not covering it here. ( Uncyclopedia )
Why are you using VB6? Do you hate yourself? ( Christian Graus )

Sign In · View Thread Hi All
I am adding app.config file in application folder of setup project for creating installer.
after installing application when we run it ..if gives following error
The Key ConnectionString does not exist in the app setting configuration section
but when I run application in Dotnet.it runs fine but when run after installing then there is above error occurs
here is app.config file
<configuration> <appSettings> <add key= " ConnectionString" value = " data source=localhost\sqlexpress;initial catalog=SFM;integrated security=SSPI;persist security info=False;packet size=4096" /> </ appSettings > </ configuration >
Thankz in Advance
Regards
Kashif

modified on Monday, September 7, 2009 6:05 AM

Sign In · View Thread The Key <big>ConnectionString </ big > does not exist in the app setting configuration section
as in
<add key= " <big>Main.ConnectionString</big> " value = " ...
the key is "Main.ConnectionString"
Hope this give you the answer you need!
Sign In · View Thread First of all thankz for your reply
Sorry keefb
it is my written mistake in question .......In project I am using same key .........now I corrected my question ...please check it again ......In app.config the key is ConnectionString .........and I also use ConnectionString (Same variable) in Code file ............Now please check it and can you tell me where is problem ....
why error occurs that I mentioned in first post
Sign In · View Thread