The reply buffer is in ASCII value...but I need is HEX value.Is there any way that the reply buffer is in hex?
Code:
Public Function read_write_string(ByVal devicehandle, ByVal command, ByVal commandlenght) As String
Dim inputReportBuffer(100) As Byte
unManagedBuffer = Marshal.AllocHGlobal(inputReportBuffer.Length)
I found this function from the net. But I have a problem with the reply buffer. The reply buffer is in ASCII value...but I need is HEX value. Is there any way that the reply buffer is in hex?
I'm working on decoding a NMEA sentence that is a compressed 8-bit string. I'm having a very hard time of wrapping my head around the bit manipulation needed to convert this string. If someone could get me started with this it would be great.
I can't seem to find how to recast a char to Ascii, the VB6 way was to ASC(thechar/thestring).What is the new method? or how to perform the recast while converting to a byte so it will fit and not buffer overrun.
I am writing a console application, which reads emails from different email boxes and processes through them. Emails are received from various automated systems. The email messages are logged and/or sent forward.
The problem is that some emails are encoded in UTF-8 and transfer-encoded in quoted-printable which messes up special characters (mainly ä,ö and å). I have not found any solution to convert them in readable format.
For example "ä" in quoted-printable is "=C3=A4". Using a normal conversion methods the result is "ä" (gibberish).
I shamelessly ripped this example conversion table from here: [URL]
[Code].....
So how do I get the real codepoint from UTF-8 value? I'd rather not use any external libraries. Besides I've tried a couple already and they failed.
I have a program written in VB.NET and I have a textbox for the RFID tag (which is in ASCII format) and then convert it to a simple text format to be saved to my database. How can I convert ASCII to plain text to save to my database?
This is my code for retrieving pictures, it was working before but then i accidentally deleted the table and i created it again with the same name and same fields. and now whenever i open the form with the picture, there was a message box error. it says Buffer cannot be null. Parameter name: buffer I don't know what i did wrong.
I am using Microsoft.VisualBasic.Fileio.TextFieldParser to parse a CSV file that was created with Excel 2003. The parser is working great with the exception that it is converting extended ascii values to question marks! So if the file content was:
± 3 The TextFieldParser is returning ? 3
I have tried all of the encodings in the System.Text.Encoding package with no luck. I thought I had it with UTF7 but it was dropping other characters like replacing the + sign with a space.
I would like to pass a whitespace character by using the System.Text.Encoding.ASCII.GetBytes(" "), and System.Text.Encoding.Unicode.GetBytes(" ") , where " " is the whitespace Character required. What do I need to type (" ") to get a whitespace character passed.?
So I have an ASP.Net (vb.net) application. It has a textbox and the user is pasting text from Microsoft Word into it. So things like the long dash (charcode 150) are coming through as input. Other examples would be the smart quotes or accented characters. In my app I'm encoding them in xml and passing that to the database as an xml parameter to a sql stored procedure. It gets inserted in the database just as the user entered it.
The problem is the app that reads this data doesn't like these characters. So I need to translate them into the lower ascii (7bit I think) character set. How do I do that? How do I determine what encoding they are in so I can do something like the following. And would just requesting the ASCII equivalent translate them intelligently or do I have to write some code for that?
Also maybe it might be easier to solve this problem in the web page to begin with. When you copy the selection of characters from Word it puts several formats in the clipboard. The straight text one is the one I want. Is there a way to have the html textbox get that text when the user pastes into it? Do I have to set the encoding of the web page somehow?
To Double Buffer or not to Double Buffer this is the Question!I have a form with Protected Overrides Sub OnPaint that sets forms background to a gradient fill ,on top of that is a transparent richtext box. Ok. now here`s the problem ,If i enable forms double buffering the transparent Rtb doesn't flicker when forms resized. but the forms drop shadow does flicker! ,its a boarderless form using CS_DROPSHADOW to draw the drop shadow Now if i disable double buffering the forms drop shadow doesn`t flicker but the transparent Rtb does ,any one have a clue how to get both to work in harmony !
I have a problem that i cant solve i am trying to buffer 28 bytes from the com port into the array actual_packet_VPS1(30). It works with the counter set to 0 - 15 but doesnt work when we increase the counter size to 0 -28.
Private Sub MSComm5_OnComm(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MSComm5.OnComm Dim buffer As Object
I have a need to double buffer a flowlayoutpanel. I have the form set to doublebuffered which is half the story but their is no property in the list to make the flowlayoutpanel do this (although MSDN states that it has this property) how i can set it to true for the panel?
Im trying to do a video player but i have to play this video from the buffer, is this possible.. Let me explain you much more complicated,a got a CryptoStream and im decryting the video
While lngBytesProcessed < lngFileLength 'Read file with the input filestream. intBytesInCurrentBlock = fsInput.Read(bytBuffer, 0, 4096) 'Write output file with the cryptostream.
[code]....
This code writes my decryted or crypted video to a new file. However, i need to play the video file from the buffer(without copying to a new file), in other way it would be meaningless if i create a decryted file. in other words it would unsecure for me cuz if anyone can locate my temp directorey they can copy my decrypted video files.
Dim Fs as FileSystemObject Dim TS as TextStream Set Fs = CreateObject("Scripting.FileSystemObject") Set Ts = fs.OpenTextFile(textFilePath, ForReading, False, TristateUseDefault) While not Ts.AtEndOfStream Buffer=Ts.ReadLine ' Process the buffer Wend Ts.Close Fs.Close I tried to convert into c# but am getting ERROR like EOF expected, what I have to do?
I am using VB.net sockets to send a music file from one instance to another. It currently saves the file, but I do not want to be caught up in file-sharing, so I want to "save" it to a buffer, and when it gets to a particular percentage transferred, I want another thread to play the music file, deleting it from the buffer as it plays. I have the code to send it over the network, but I need to know how to keep it in a buffer and not save it as a file.
I've looked and looked + tryed debugging but I'm not getting anywhere fast I'm trying to import a usb radio driver and I'm 99% there. I can turn it on / off and get / set the freq.. but I'm struggling to get the rds name from it. The VB code for the function is
I have been asked to improve the memory efficiency of an application that is used for high speed data acquisition. After running the VS memory profiler several times and scanning the projects for obvious issues I came to the following conclusion: despite using a fixed size circular buffer for storing acquired sample points, the RAM usage increases relative to the polling period. For example: polling data for one signal at 2 microseconds can use 5 times more memory (private bytes) than when running at 50 microseconds ... even though the buffer size is the same.
The circular buffer is an array of SamplePoint objects. Each of these objects contains an array of Shorts (16 bit) for corresponding data per signal and one date object (8 bytes) for the time stamp. For efficiency, the circular buffer is Redimmed only once every time it begins polling and filled with empty sample points which are then "assigned".
Also, it seems that when we stop and run the application it hogs even more memory each time as though the Redim is not releasing the previous array. My questions boil down to the following: What is most memory efficient way of implementing a circular buffer containing managed objects which have arrays?Also, how and why is memory usage increasing with a fixed size array with different polling speeds? Does the garbage collector not have time? Do local variables get disposed of IMMEDIATELY when a sub or function exits?These are some of the doubts and concerns that I would like to rule out before proceeding.
basically I'm sending and receiving both images, strings and files over a client/server connection. I can easily use a protocol for string commands but I cannot distinguish between the incoming data [if data is image or whatever and then follow onward instructions].So how do I make a packet using Dim buffer as byte()?
How can I create a circular buffer on the heap in VB.NET ? This would be used for audio playback via P/Invoke to winmm.dll waveoutopen and waveoutwrite to support development of a software synth. I currently use the marshall class to build a regular array of bytes in the heap.
I've been trying to get the double buffer function working in VB.NET GDI+ for a space invaders game using the following command.[code]But because I am using a separate draw routine attached to a class it doesn't seem to work:[code]The aliens draw correctly but the images are very stuttery and double buffering doesn't seem to work.
I have connected to a host, but how do I find the correct buffer size? (The Buffer is currently set to 8k (8192)) Dim webget As New Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) webget.Connect(host, port) webget.Send(data, 0, data.Length, SocketFlags.None) Dim rData(8192) As Byte webget.Receive(rData, rData.Length, 0)
I'm currently working on a little software for my GPS and i havent touched VB in about 10 years so I'm trying to figure this out from scratch again pretty much. Anyway, I have this code to get the information from the GPS and parse it, the only problem is that It isn't getting all the code at once and then parsing, it is getting bits and pieces and only getting the RIGHT code from time to time..
Private Sub timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles timer1.Tick
I need to search a buffer for a string of characters.The buffer is essentially a binary file (it's an image) and contains lots of chr(0) characters.The string I need to locate also contains chr(0) characters. In fact it is the following string:
chr(100) & chr(0) & chr(0) & chr(163)
This is a marker in the image file for items I need to process.So I though I would do the following:
Dim sFileBuffer as String = system.io.file.readalltext("myimagefile") Dim sLookFor as String = chr(100) & chr(0) & chr(0) & chr(163) Dim iLocation as Integer = sFileBuffer.IndexOf(sLookFor)
The problem is that, although the characters in sLookFor definitely exist inside of sFileBuffer - IndexOf will always return -1 (not found).I tried the following:
Dim Marker() as Byte = {100, 0, 0 , 163} Dim sLookFor as String = System.Text.Encoding.UTF8.GetString(Marker) Dim sFileBuffer as String = system.io.file.readalltext("myimagefile", Encoding.UTF8) Dim iLocation as Integer = sFileBuffer.IndexOf(sLookFor)
But this appears to only find occurrences of Chr(100) & Chr(0) - not the full 4 character sequence I desire. It appears to see the second Chr(0) as a termination of the search string.I think the sticking point here is the null. Yes - I can string.replace(chr(0), Chr(255)) in both the sLookFor and the sFileBuffer and adjust my search accordingly - but that seems like a mess to me.Is there not a way to search a buffer of binary data? I've tried working with byte arrays - but there appears to be no way to easily search for a sequence of byte values - just individual elements in the array.
I've managed to make an application at home using a serialport emulator and connector that will read text from a file on my desktop send it to com1 and then my connector program will merge com1 with com2. In short my program works at home but when I connect it to my device it appears the data in DataReceived is a fraction of what my simulator setup at home is producing, which apparently is completely normal according to all these threads I've read here.
How can a TextBox or RichTextBox buffer size be set? I have data that goes to a TextBox continuously, but I want to set a maximum size of buffer for the TextBox. I read in one forum someone suggesting to set the TextBox MaxLength property, but the questioner replied that he had tried this, and when the MaxLength was reached no further data input was possible, and what he wanted was the situation where new data could still come in, but the oldest data was then deleted, i.e a rolling buffer, which is precisely