compression

PHP - compress static css file with GZIP

爱⌒轻易说出口 提交于 2019-12-06 07:12:30
问题 so I have a css file, style.css. in the same directory I have the images/ folder. How can I make a script that compresses style.css, but from another folder? Right now I have this: <?php if(isset($_GET['css'])) $file = array('url' => htmlspecialchars($_GET['css']), 'type' => 'text/css'); if(isset($_GET['js'])) $file = array('url' => htmlspecialchars($_GET['js']), 'type' => 'application/javascript'); if(!isset($file)) exit(); header('Content-type: '.$file['type']); header('Cache-Control: max

How can I effectively encode/decode a compressed position description?

对着背影说爱祢 提交于 2019-12-06 06:16:14
问题 I am writing a tablebase for a Japanese chess variant. To index the table base, I encode each chess position as an integer. In one of the encoding steps, I encode where the pieces are on the board. Since the actual method is a bit complicated, let me explain the problem in a simplified manner. The Encoding In the endgame tablebase, I have (let's say) six distinct chess pieces that I want to distribute over a board with 9 squares. I can naïvely represent their positions by a six-tuple ( a , b

How to use Snappy in Hadoop in Container format

独自空忆成欢 提交于 2019-12-06 05:59:17
问题 I have to use Snappy to compress the map o/p and the map-reduce o/p as well. Further, this should be splittable. As I studied online, to make Snappy write splittable o/p, we have to use it in a Container like format. Can you please suggest how to go about it? I tried finding some examples online, but could not fine one. I am using Hadoop v0.20.203. Thanks. Piyush 回答1: for output conf.setOutputFormat(SequenceFileOutputFormat.class); SequenceFileOutputFormat.setOutputCompressionType(conf,

Compressing image taken from device or chosen from library, iOS

你。 提交于 2019-12-06 05:19:10
问题 In my app, user is allowed to take a photo from a device or upload it from the library to set it as his profile pic. Now when user is done, I need to upload that image to server. Usually the image taken from device is of size 5-6MB. I need it to compress to 25KB before uploading to server. So I am using following method to that - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker dismissModalViewControllerAnimated:YES];

what is the difference between compressing image and resizing image ? android

走远了吗. 提交于 2019-12-06 04:47:49
in my android app , i want to upload image to the server. the problem that the server will not accept images with size larger than 2M. but the user can choose an image larger than 2M. so I want to build a code that will make the image smaller than 2M. I have tow approaches : tow resize the image dimensions. as below : public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) { // First decode with inJustDecodeBounds=true to check dimensions final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;

Online CSS compress which doesn't remove IE hacks

ぃ、小莉子 提交于 2019-12-06 04:47:12
Are there are CSS compressors online which do not remove any of the CSS browser hacks. E.g: Using: cleancss.com it makes no difference which options I set it will always remove the *display for IE display inline-block hack. a { border-radius:5px display: inline-block; *display: inline; zoom: 1; text-shadow: 0 2px 3px rgba(0,0,0,0.4); -moz-border-radius:5px;-webkit-border-radius:5px; } Pranav 웃 CSS Compressor and Clean CSS usually work for me, although I prefer to use a different stylesheet for all previous versions of internet explorer. It is usually better to keep previous browser supporting

Running hadoop with compressed files as input. Data Input read by hadoop not in sequence. Number format exception

徘徊边缘 提交于 2019-12-06 04:20:13
I giving a tar.bz2 file ,.gz and tar.gz files as input after changing the properties in mapred-site.xml. None of the above seem to have worked. What I assumed to happen here is the records read as input by hadoop go out of sequence ie. one column of input is string and the other is an integer but while reading it from the compressed file because of some out of sequence data, at some point hadoop reads the string part as an integer and generates an illegal format exception. I'm just a noob. I want to know whether there is a problem in the configuration or my code. The properties in core-site

Noise reduction and compression in streaming audio

不羁的心 提交于 2019-12-06 04:14:54
问题 hope you can help. I am recording audio from a microphone and streaming it live across a network. The quality of the samples is 11025hz, 8 bit, mono. Although there is a small delay (1 second), it works great. What I need help with is I am trying to now implement noise reduction and compression, to make the audio quieter and use less bandwidth. The audio samples are stored in a C# array of bytes[], which I am sending/receiving using Socket. Could anyone suggest how, in C#, to implement

Huffman trees for non-binary alphabets?

巧了我就是萌 提交于 2019-12-06 04:10:35
问题 Is there an easy generalization of Huffman coding trees for situations where the resulting alphabet is not binary? For instance, if I wanted to compress some text by writing it out in ternary, I could still build up a prefix-free coding system for each character I as writing out. Would the straightforward generalization of the Huffman construction (using a k-ary tree rather than a binary tree) still work correctly and efficiently? Or does this construction lead to a highly inefficient coding

Unzipping a multi-part zip file volumes using Java

℡╲_俬逩灬. 提交于 2019-12-06 04:06:13
问题 I need to unzip a set of files that are a zip archive. This isn't a set of zip files, this is one big zip file that has been broken up into multiple zip files based on a size requirement. For example if you have a 2.5MB zip file and your mail system only supports 1MB files, you can ask Zip to create 3 files of at most 1MB. So it creates a.zip.001, a.zip.002, a.zip.003 ... different libraries name them differently but essentially they all work the same way. How do you unzip this in java? It