|
Just read the bytes from the BinaryReader:
byte[] byffer = r.ReadBytes(int.MaxValue);
---
b { font-weight: normal; }
|
|
|
|
|
again , thanks for the assistance. Please excuse my lack of understanding here, but I am a novice with vb.net. I still don't know how to convert this array into a data string (to send as a parameter). I would need to send the string as it appears when you open it with notepad.exe.
Thanks again.
|
|
|
|
|
That depends on how you are sending the data.
If you want to convert the data into a string, you will have to know how the string is converted when it's sent. You will have to use the same encoding to convert the data into a string, as the encoding that is used when the string is converted to bytes when sending it.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks a million! FYI, the encoding of a PKZIP file is apparently UTF8
Here's my code:
Dim ra As Array
fs = New FileStream(inputfilename, FileMode.Open, FileAccess.Read)
Dim r As New System.IO.BinaryReader(fs, Encoding.ASCII)
ra = r.ReadBytes(r.BaseStream.Length)
Dim [ASCII] As Encoding = Encoding.ASCII
Dim [UTF8] As Encoding = Encoding.UTF8
Dim asciiBytes As Byte() = Encoding.Convert([ASCII], [UTF8], ra)
Dim asciiChars(ascii.GetCharCount(asciiBytes, 0, asciiBytes.Length)) As Char
ascii.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0)
Dim asciiString As New String(asciiChars)
Return asciistring
|
|
|
|
|
pbaggett wrote: FYI, the encoding of a PKZIP file is apparently UTF8
No, it's definitely not. The PKZIP format is a binary format, not a text format, so it doesn't have any encoding. Also, the PKZIP format (1989) predates the Uncode standard (1991).
What you have done is to interpret the binary data as ASCII (which it isn't) and converted it to Unicode. The ASCII encoding only support character codes 0-127, so if you successfully decoded the file, you were just lucky to have a file where all the bytes happened to be in that range. You must have used a very small file, for this is not normal for compressed files.
The bytes that you handled as ASCII and converted to Unicode is in the asciiBytes array (so it's not at all ASCII bytes, but Unicode bytes). Then you decode the Uncode data as if it was ASCII and place it in the asciiChars array. The only reason this doesn't turn the data into total garbage, is that you were lucky again, and none of the "characters" did become a multi-byte code in Unicode.
Sorry to say it, but your code does at best virtually nothing at all. When used with most compressed files it will totally mangle the data, though.
Back to the drawing board. You still have to find out how the string that you send will be decoded.
---
b { font-weight: normal; }
|
|
|
|
|
I have now tested this code with 30 different zip files ranging in size from 1kb to 1gb and containing 1 to 100 compressed files. Each test run produced successful results for what I am attempting to accomplish - which is to convert the zip file contents into a single text string to be passed as a parameter to another process. I don't think this can be attributed to "luck".
That being said, this process is only designed to handle zip files with simple compressed ascii text files. Perhaps this is why the code does not produce total garbage.
Again, I appreciate your assistance.
|
|
|
|
|
I tested your method with one zip file, and it fails.
I examined the data in asciiBytes, and all character values above 127 turns into question marks.
Are you sure that you really use the code that you showed? Have you verified that the zip files are intact after you sent them?
I reduced the code substantially by skipping the BinaryReader and the double conversion. Closing the file might be a good idea, also. It's in C#, but I think you can see the changes:
FileStream fs = File.OpenRead(filename);<br />
byte[] ra = new byte[fs.Length];<br />
fs.Read(ra, 0, ra.Length);<br />
fs.Close();<br />
string asciiString = new string(Encoding.ASCII.GetChars(ra, 0, ra.Length));
Still doesn't work, though.
---
b { font-weight: normal; }
|
|
|
|
|
It still works for me however, none of the files I am testing would ever contain ascii char values above 127. I think my code was just dumb luck. That being said, I ended up modifying the external service to handle the files in their unzipped/uncompressed state so this is no longer necessary.
Thanks again for the help. I'm still learning vb.net so I hope my questions don't seem (too) ignorant.
|
|
|
|
|
Hi All,
I want to add a text box in my windows form at run time..
and also want to get the values of these text boxes in array.........
like i have already one text box in my vb form and
in run time if i need 5 text boxes they will add and i will put data in them
and when i press the button to save the data the data will transfer in to array or directoly into the data base one by one..
Thanks in Advance..
Muhammad Nadeem.
|
|
|
|
|
hi everyone,
does anybody suggest any database engine or a way to store my big data without taking much space on the pc and I can't use Mssql
thanks alot
|
|
|
|
|
rawanrawan wrote: big data
That depends on what you mean by "big data". Do you mean that individual elements of data are large (e.g. multi-kilobyte colums)? Or that you have a large number of rows? Or a large number of tables? Or a combination?
rawanrawan wrote: without taking much space on the pc
It sounds like you are tring to squeeze a litre in to a pint pot. If the quantity of data is large, then the amount of disk it takes up will be at least correspondingly large.
rawanrawan wrote: I can't use Mssql
Why is this option being discounted? Would you consider Oracle? If not, why not?
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
thanks alot for the fast response,
what I meant by "big data" is alot of rows in not too many tabels, I use access2000 and it keeps growing in size unless I make a "compact and repair" and I want to stop doing that
and I can't use sql cuz it takes space of the pc
-- modified at 9:09 Monday 27th February, 2006
|
|
|
|
|
rawanrawan wrote: it keeps growing in size unless I make a "compact and repair" and I want to stop doing that
I would guess all database systems will require something like that. If they do it automatically as it goes along then data access will be very slow. The reason it keeps growing is that it is an expensive (i.e. time consuming) operation to compact the database.
Some database systems, like SQL Server, allow you to schedule tasks so that it occurs automatically at a time that is suitable. e.g. if it a system used during office hours only, then you can schedule it for the middle of the night.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
The Access drivers also takes space, but you don't see that as they are installed by default with Windows.
Any competetive database solution that you choose will take space on the pc. You could for an example use the text file data driver that is also pre-installed, but you would lose very much in performance.
Compare the space that the database engine will take up against what you win by not having to "compact and repair" the database continously.
An alternative to MS SQL that might be a bit more light weight would be MySQL. Compare the system requirements.
---
b { font-weight: normal; }
|
|
|
|
|
hi
how can I see any drive on my pc while its not connected to any network by writing in the run the pc name as if its through network.
ie. \\PcName\c
thanks alot I know I am boring
|
|
|
|
|
Hi,
I am trying to send a mail message using System.Net.Mail.MailMessage. I'm having a strange problem (well, to me it is strange). I cannot receive the message if I set the body of the message to be a variable.
<br />
Dim mailMsg As New System.Net.Mail.MailMessage("me@mycompany.com", m_Recipient, m_Subject, m_Body)<br />
Dim oMailClient As New System.Net.Mail.SmtpClient("someipaddress")<br />
oMailClient.Send(mailMsg)<br />
I don't get any errors compiling or when I run the code, I just don't receive the message.
The same code works fine if I hardcode some text for the body of the message.
Any ideas what might be wrong?
Thanks very much,
dlarkin77
|
|
|
|
|
Is there an easy simple way to get the cursor to change from an arrow to that wee hand thingy when it goes over a button?
|
|
|
|
|
hi I hope I understood what you need
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.MouseIcon = LoadPicture _("c:\winnt\cursors\hnesw.cur")
End Sub
|
|
|
|
|
Set the Cursor property of the button to Cursors.Hand.
---
b { font-weight: normal; }
|
|
|
|
|
hi there,
has anyone tried the vistadb , if yes is it good?
thanks
-- modified at 5:38 Monday 27th February, 2006
|
|
|
|
|
rawanrawan wrote: has anyone tried the vistadb
Yes
rawanrawan wrote: if yes is it good?
That depends on what you want to do with it. I typically work on multi-gigabyte datawarehouse projects and it is not good for that. If, however, you want to supply a small database with your application and have a very simple install process (just add the DLL and the database file to your setup project) then it is great.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
I want to develope Chainz game at pocket pc using VB.NET.
Can you tell me the logarithm of Chainz game?
Thx before. .
-- modified at 5:15 Monday 27th February, 2006
|
|
|
|
|
The logarithm for what? Creating a game? Plaing a game? Solving a game?
---
b { font-weight: normal; }
|
|
|
|
|
I want to create Chainz game at Pocket PC. I need the algorithm for create this game.
|
|
|
|
|
How do you take a printout like invoice bills., by a single click on a default printer settings?
if you an idea of coding regarding this, then plz solve my problem. coz I am learner on these tech's.
wish me as All The BEST.
|
|
|
|