|
|
|
I've been using the DeflateStream and the GZipStream for a while and recently I found out that both streams produced an excessive amount of data when compressing data.
Here is my question: Is there a bug in the compression algorythm?
|
|
|
|
|
ant-damage wrote: produced an excessive amount of data when compressing data
What are you compressing? The LZ77 algorithm can actually create MORE data depending on what your compressing.
ant-damage wrote: Is there a bug in the compression algorythm?
No.
Best Wishes,
-David Delaune
|
|
|
|
|
I'm compressing a binary file. it is a 678KB file, and after compressing all bytes of it with DeflateStream I've got 1MB of data. I used the zlib compression library on the same file and I'v got a smaller file with 671KB.
I searched around the web and I found out that it's possible that the DeflateStream algorythm has a bug, and generates too much data compared with the original file data.
|
|
|
|
|
ant-damage wrote: after compressing all bytes of it with DeflateStream I've got 1MB of data.
Did you mean compressing with GZipStream? Because... DeflateStream does not do compression.
ant-damage wrote: I searched around the web and I found out that it's possible that the DeflateStream algorythm has a bug, and generates too much data compared with the original file data.
The GZipStream class does not check for incompressible data. Yes it is possible to create more data.. this is the nature of the algorithm. I guess it would be better if the GZipStream class detected that it would be unable to compress the data. Classifying it as a bug is debatable.
I agree with you that the GZipStream class should be smart and detect this situation.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: DeflateStream does not do compression
Yes it does, if we are to believe the documentation[^], compared to GZipStream it leaves out the CRC and things like that.
|
|
|
|
|
I have found that the results are better when you use the biggest possible Write (so buffer first, then write it all out at once). It's slower of course, but for some reason this implementation gives really poor results on small writes.
Such a big expansion seems excessive though. It can only happen due to crappy implementation, since the Deflate spec contains an escape mechanism to store uncompressed data with only tiny overhead, but then this implementation is not known for being good in any way.
|
|
|
|
|
Hi Guys this is my first post on the forum (Despite being a long time browser), i hope you can help me.
I am attempting to create and display a modeless form within some C++ code. It works fine when the form is displayed as a modal form using ShowDialog(). However when i use Show(), the form is displayed but with black spaces where the UI controls (Label and Button) should be. You can see that there should be something there but there isn't?
I'm guessing it may be somekind of threading issue? As in the main thread is attempting to create controls on a different thread?
Has anyone come across this issue before and if so how did they get around it?
Thanks
|
|
|
|
|
Hi,
whatever language you use, you shouldn't use multiple threads accessing controls on a single form; this[^] may be useful for you.
|
|
|
|
|
Hi Luc, thanks for the quick reply...
I'm aware that i shouldn't be using multiple threads to access controls on a single form, and as it stands i'm not intentionally doing this. My question is, is the modeless form being created in a new thread automatically (hence it's ability to return immediately from the call) and if so is this the reason why the controls aren't being displayed properly?
I've spent a fair while researching this and am not having much luck, i'm primarily a C#/.Net developer ans am having a little bit of difficulty with the C++ side of things at the moment.
Regards
|
|
|
|
|
jimi77 wrote: is the modeless form being created in a new thread automatically
A form is created in the thread that executes some kind of Form form=new Form(...) statement, and that is independent of how it will be shown (modally/modelessly) later on. So you look at the code and you'll know.
jimi77 wrote: is this the reason why the controls aren't being displayed properly?
You did not show any code, you did mention threading. How can anyone but you answer that question?
|
|
|
|
|
Well i got installed visual studio 6.0 and with that i can creat a dynamic dll, i have all there librarys and include fails. So i added all the include fails and librarys to visual studio 2008 and that ____ still wont build even standard dll fail correctly gives some linking errors instead....
Note that thous librarys are from windows xp sdk and some others they should work on bouth compailer i belive...
:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(81) : warning C4346: '_It::iterator_category' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(84) : see reference to class template instantiation 'std::iterator_traits<_It>' being compiled
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(81) : error C2146: syntax error : missing ';' before identifier 'iterator_category'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(81) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(82) : warning C4346: '_It::value_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(82) : error C2146: syntax error : missing ';' before identifier 'value_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(82) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(83) : warning C4346: '_It::distance_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(83) : error C2146: syntax error : missing ';' before identifier 'distance_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(83) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(224) : warning C4348: 'std::istreambuf_iterator' : redefinition of default parameter : parameter 2
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(226) : see declaration of 'std::istreambuf_iterator'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(226) : warning C4346: '_Tr::off_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(279) : see reference to class template instantiation 'std::istreambuf_iterator<_E,_Tr>' being compiled
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(226) : error C2923: 'std::iterator' : '_Tr::off_type' is not a valid template type argument for parameter '_D'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(226) : error C2955: 'std::iterator' : use of class template requires template argument list
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(67) : see declaration of 'std::iterator'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(231) : warning C4346: '_Tr::int_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(231) : error C2146: syntax error : missing ';' before identifier 'int_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(231) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(289) : warning C4348: 'std::ostreambuf_iterator' : redefinition of default parameter : parameter 2
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\utility(291) : see declaration of 'std::ostreambuf_iterator'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(25) : warning C4346: '_A::size_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(597) : see reference to class template instantiation 'std::basic_string<_E,_Tr,_A>' being compiled
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(25) : error C2146: syntax error : missing ';' before identifier 'size_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(25) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(26) : warning C4346: '_A::difference_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(26) : error C2146: syntax error : missing ';' before identifier 'difference_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(26) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(27) : warning C4346: '_A::pointer' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(27) : error C2146: syntax error : missing ';' before identifier 'pointer'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(28) : warning C4346: '_A::const_pointer' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(28) : error C2146: syntax error : missing ';' before identifier 'const_pointer'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(28) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(29) : warning C4346: '_A::reference' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(29) : error C2146: syntax error : missing ';' before identifier 'reference'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(29) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(30) : warning C4346: '_A::const_reference' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(30) : error C2146: syntax error : missing ';' before identifier 'const_reference'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(30) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(31) : warning C4346: '_A::value_type' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(31) : error C2146: syntax error : missing ';' before identifier 'value_type'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(31) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(32) : warning C4346: '_A::pointer' : dependent name is not a type
1> prefix with 'typename' to indicate a type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(32) : error C2144: syntax error : 'std::iterator' should be preceded by ';'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(32) : error C2208: 'std::iterator' : no members defined using this type
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xstring(32) : fatal error C1903: unable to recover from previous error(s); stopping compilation
|
|
|
|
|
Hi Everyone,
I want to write a cpp test. recently i hv learnt it but i am not able to write the test cases. so if u have any idea or tips then please share it. i need ur help.
thanking u.
|
|
|
|
|
I have the same question. When I Google I see .NET unit testing, and C++ unit testing, but I don't know if any of those will work for Managed C++. Anybody have success with a particular suite? (Hopefully open source)
|
|
|
|
|
rnsk_for_u wrote: recently i hv learnt it but i am not able to write the test cases.
Learnt what? We are not mind readers here.
What are you trying to test, your own program? If so then only you can decide what needs to be tested.
|
|
|
|
|
Hi,
In the strCommand I am having 2MB of Data and when i am trying to split with the new line it was throwing error.(to loop through all the data)
But it was working for minminum (ie 50 KB of datas like 0's and 1's).
How to over come this error? Very urgent.. Below is the code...
CString strCommand; // Holds 2MB of datas like 0's and 1's...
System::String* strDataReceived = "";
strDataReceived = strCommand;
__wchar_t split __gc[] = new __wchar_t __gc[1];
split [0] = '\n';
String *strSplitCommand[] = strDataReceived->Trim()->Split (split);
Please help..
Reg,
Subbu
|
|
|
|
|
What error on what line?
That code doesn't look like it would even compile...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
IMO you should not try and split a 2MB string, what you should do is avoid you ever need nor obtain such a string in the first place. It doesn't make sense. Tackle the problem at the producer's side, not the consumer's.
|
|
|
|
|
Hi,
I need help in creating a waterfall display of my pixel data stored in a buffer. The stream of data needs to be displayed streaming down the screen as its being acquired from the camera.
I am using visual c++ (windows forms).
Can someone please help me to figure out how to achieve this display?
Thanks in advance
|
|
|
|
|
Hi all,
I m new here.
Actually i am learning cppunit testing. and i just want to know, can we write a test case for a method, without calling it?
or how to write a testcase for a void type method?
plzz reply as soon as possible.
|
|
|
|
|
Runish Kumar wrote: can we write a test case for a method, without calling it?
How can you test a method without even calling it? Do you mean mocking some method calls?
Runish Kumar wrote: or how to write a testcase for a void type method?
What is a void type method? A method takes no arguments or returns void?
Also this forum is for C++/CLI discussions. For standard C++, try the C++/MFC forum instead.
|
|
|
|
|
Hi there,
I have a huge problem with Graphics Object.
My application shows pictures in a picturebox. Now I want to draw
multiple frames (rectangles) onto the shown image (regions of interest).
The most easy and acceptable way is to create a graphics object from the image and
do the drawRectangle function on it.
If the image is scaled or zoomed the rectangle(s) will always grow and shrink in same relations! this is very important!
Problem: My bitmap is format8bppindexed with a monochrome colorPalette added by myself, so I isn't possible to create
a graphics object!
It's very important, that I can refresh the images as fast as possible (best with just changing the scan0 pointer).
Is there a possible way to get a graphics object from such an image?
Or has anyone an idea how I could come up with that rectangle drawing thing?
I would be so happy about a good answer! Thanks and have a nice day...
|
|
|
|
|
I've personally always kept regions of interest separate from the image,
just drawing the ROIs at render time instead of drawing on the actual
image data.
A couple possibilities:
1) Use double buffering. Use a graphics object created for a bitmap with the same
bit depth as the screen. Draw the image to the graphics, draw the ROIs on the
graphics, and render the bitmap to the screen.
2) Use GDI directly via platform invoke.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi everyone, I am working on a project at least a year.
I have two major problems:
1.There is no way I can find out why my computer chrashes when running the program. It runs for a while then all of a sudden coputer restart itself. I am writing in Managed C++/cli using serialport class.
2. When the serial port communication is disconnected the program freez having problem detecting that as well.
FYI: I checked usb-serial converter latest driver, computer recognize it. I can see it through divice manager.( name of the usb-serial converter is Keyspan - USA 19HS).
Thanks in advance.
|
|
|
|