473,547 Members | 2,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gz Compression on the fly

9 New Member
Hello, I've been looking and trying a lot of things but I cant find a solution to this problem. Here it is the scenario, Im building a big tar file (about 70~100 Mb) on the fly, mainly fetching information from a MySQL DB and from other raw files of my own. The output file is very redundant so I want to encode it as gz to make it lighter.
The problem is this: The only way I came to encode it is using the php function gzencode, however I have first to build the tar file (I'm building it using Output Buffering) to pass the data to the encoding function. The process of building the tar file takes time, and no output is generated durating this time, so the "Save As..." Dialog doesn't show up until the output is started (As I stated, after building and gzipping the tar file).

Does anybody knows a way to tell the client that we are going to send a file but maybe we will delay to start delivering content?

Or there is a way to gzip chunks of data inside a gzip file?

Thanks in advance, and please excuse me for my bad English.
Dec 27 '07 #1
3 1982
pbmods
5,821 Recognized Expert Expert
Heya, Zlash.

Check out flush().
Dec 31 '07 #2
zlash
9 New Member
Thanks for your reply, but is not what im needing.

I dont have problem with the output buffering, is just that for gzipping the content, I must have all the file proccesed. While Im doing it, the "Download As" dialog will not appear. This is frustrating for users, as they think that download is not working. What Im looking for is a way to tell the web browser to present the dialog, even if we are not going to send data inmediately.

My current solution, is to start the tar structure, and put on it a file with only a space, this shows the dialog to the user. Then I include the tar.gz file inside the tar.

It """""works" """ but I dont like it. Its not clean, and Im sure that there is a better way to do it. Also, I waste a couple of NULL characters that should be compressed too.

Thanks again for your reply.
Dec 31 '07 #3
pbmods
5,821 Recognized Expert Expert
Heya, Zlash.

You might want to create a download queuing system, where the User puts in his request to download the file, and then a window opens with an estimate of how long it will take to prepare the download. The window would refresh once a minute or so and present the User with a download link once the package was ready for download.
Jan 1 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
409
by: Jim Hubbard | last post by:
I went to the compression newsgroups, but all I saw was spam. So, I thought I'd post his question here to get the best info I could from other programmers. Which compression algorithm offers the fastest compression of text data? Which compression algorithm offers the best compression of text data? I need to do in memory compression of...
1
12284
by: Maurice Mertens | last post by:
Hello, I'm having troubles with saving a tiff-file with a certain compression and colordepth. This is the code I use: ---------------------------------------------------------------------- private sub MakeTiff dim imgSource as new bitmap(strTifSourceFile)
8
2464
by: Anurag | last post by:
Hi, I am told that Oracle has this "data compression" feature that allows you to store online data ina compressed format. This is different from archived data - you compress only that data which is infrequently accessed but is still available in the online database. I am interested in finding out an equivalent feature in DB2 UDB on LUW....
2
30104
by: deko | last post by:
Is it best practice to set Unicode Compression to "No" for memo fields in a table? What about text fields? According to the VB help entry: "Data in a Memo field is not compressed unless it requires 4,096 bytes or less of storage space after compression. As a result, the contents of a Memo field might be compressed in one record, but...
17
3137
by: dunric | last post by:
After writing the computing urban legend "The Helsinki Code", I spent several nights thinking up how in the world Gustav Larsson, the Finnish PDP-8 computer programmer, could have managed to receive such a miraculous message from God. Surely, for a 1-byte computer program such as "@" to compile successfully (in RTPS FORTRAN), a miracle...
1
2338
by: chris.atlee | last post by:
I'm writing a program in python that creates tar files of a certain maximum size (to fit onto CD/DVD). One of the problems I'm running into is that when using compression, it's pretty much impossible to determine if a file, once added to an archive, will cause the archive size to exceed the maximum size. I believe that to do this properly,...
3
1554
by: Benny Ng | last post by:
Dear All, Now I met some performance problems in my application. Because according to our business. The size of some web forms are larger than 1xxx MB. So it takes a long time for user opening a web page. Surely we are modifying some source code for performance improvment. But now i'm thinking should we improve the application performance...
20
2907
by: chance | last post by:
Hello, I want to add compression to a memory stream and save it in an Oracle database. This is the code I have so far: //save the Word document to a binary field, MemoryStream dataStream = new MemoryStream(); doc.Save(dataStream, SaveFormat.Doc); //now compress it GZipStream compressedZipStream = new GZipStream(dataStream,
21
5985
by: =?Utf-8?B?VkJB?= | last post by:
I compressed a file with GZipStream class and is larger than the original file.... how can this be?, the original file is 737 KB and the "compressed" file is 1.1 MB. Did i miss something or is normal with that compression class? -- VBA
3
7504
by: GiJeet | last post by:
Hello, we have an app that scans documents into TIFF format and we need to transfer them over the internet. If anyone knows of a SDK we can use that can compress TIFFs on the fly or even if it can compress them so they take up less space on the server, would be appreciated. Actually any info on handling tiff files programatically would be...
0
7510
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7437
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7463
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7797
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3473
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1050
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
748
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.