The name given to the process of encoding data such that it uses lesser number of bits as compared to the original representation.
6
votes
2answers
95 views
Reverse engineering Darkstone game archives
Reverse engineering old games is something I do every now and then. This time, I took a shot at this old RPG called Darkstone.
The bulk of the game's data is stored in archive files with the ...
3
votes
2answers
46 views
LZW encoder and decoder
Recently, I reviewed this question about an LZW decoder. In order to properly review that question, I needed to write my own encoder and decoder to be able to test their program. Someone thought it ...
7
votes
2answers
90 views
LZW decompressor in C (II)
Here is an update to my previous thread which you can find here. Again, I'd very much appreciate any advice or comments about the structure/logic of the program, style of the code, or reusability of ...
11
votes
1answer
435 views
LZW decompressor in C
Here is a simple decompressor in C. I'd very much appreciate any advice or comments about the structure/logic of the program, style of the code, or reusability of the features. I'm a real novice and ...
2
votes
1answer
16 views
Bash Compress Managed Directory Ignoring .git, bower_components, node_modules, etc
Fairly easy way to compress a wordpress plugin (or similar) as a zip file without including all the dependencies used to create and manage the development, but which don't belong in the final product.
...
2
votes
1answer
64 views
Teamwork challenge for Timus Online Judge
Question is here:
Input
The first line contains an integer \$N\$, which is the quantity of numbers written down by Vasya (\$1 \le N \le 1000\$). The second line contains these numbers ...
4
votes
2answers
110 views
Transforming an array in Ruby
I watched a presentation by Dave Thomas on Elixir where he gave an example problem that he solved using functional programming. He mentioned using Ruby to solve the same problem, but did not show an ...
6
votes
1answer
786 views
Simple LZW compression algorithm
It's a simple version of LZW compression algorithm with 12 bit codes. I want to know what's good and what's bad about this code. Be as picky as you like.
...
2
votes
1answer
98 views
Huffman code generator in Haskell
This is problem 50 in https://wiki.haskell.org/99_questions/46_to_50. The website has more elegant Haskell solutions, but I wanted to get feedback on how the code I wrote on my own below could be ...
3
votes
1answer
63 views
Program for compacting other given code
I've just finished a small function that will reduce the size of code as much as possible without breaking anything. Obviously it makes everything a bit unreadable so it's not really for cleaning the ...
2
votes
1answer
45 views
2
votes
2answers
93 views
Using reduce twice in a row for Run Length Encoding
First of all, I'm new to Lisp (I currently use CLISP and SBCL). There probably are huge mistakes in this code so any guidelines are welcome :)
I'm very confused about how to do this. It's just about ...
3
votes
1answer
417 views
HTML Compressor with regex
I would like to compress a Magento HTML page using some regex, and this is what I have written:
...
3
votes
2answers
149 views
Process zip files
I have zip bundle, for example, abcd.zip, contains more zips like 1.zip, 2.zip etc. Inside of each child zip there is a .jpg file like 1.jpg, 2.jpg etc. There are so many other files but I need only ...
3
votes
3answers
205 views
Compress an ASCII string
Given an ASCII string create a 'compressed' version of it. For example, aabccccddddddde would output a2bc4d7e whereas abc would output abc.
This is how I've implemented it. Is there a smarter way ...
3
votes
1answer
149 views
Compressing a stream asynchronously, and returning a byte[]
Assuming I have to leave the contract intact (take byte[] and return byte[]), what's the correct way to structure this ...
0
votes
1answer
93 views
Converting Ocean to RunLengthEncoding object
For the problem statement shown below:
Part II(b):
Your run-length encodings will only be useful if other classes
have the ability to read them after you create them. Therefore, implement the
...
2
votes
1answer
228 views
Counting the lines of a compressed file
This is a Python script for counting the lines of a compressed file:
...
1
vote
2answers
120 views
Backing up an entire website with PHP
I'm attempting to backup lots of website using this php code. The script basically goes through the whole public_html directory and adds all the folders and files recursively and zips them.
Here's ...
2
votes
2answers
425 views
String compression using repeated character counts
Implement a method to perform basic string compression using the counts of
repeated characters. For example, the string aabcccccaaa would become
...
8
votes
1answer
157 views
Saving bytes instead of objects to write smaller files
This question is about reducing the size of files saved to disk in an infinite world 2D mining game.
I finally added code to my game to save and load distant chunks instead of keeping all of them ...
2
votes
2answers
926 views
Evaluation of a solution for Run-length encoding algorithm
I wrote an answer for the following question and wondering if there is any better approach to it.
Using the Java language, have the function RunLength(str) take ...
8
votes
3answers
4k views
Basic string compression counting repeated characters
My task was to implement a method which performs basic string compression by counting sequences of repeating characters. Given "aaabbbccc" it should return ...
6
votes
3answers
2k views
String compression implementation in C#
I wrote a method that reduces a string like aabcccccaaa to a2b1c5a3
My implementation:
...
8
votes
2answers
165 views
Lossy packing 32 bit integer to 16 bit
I am working on the lossy 16 bit representation for 32 bit integers that catches all 32 bit range with precision depending on absolute value.
My idea is to store integer ...
3
votes
1answer
1k views
Run length encoding of vectors in MATLAB: looped version and vectorized version
A project I'm working on requires something akin to run length encoding on a vector in matlab. The data is in the form of a numeric vector, and the output is in the form of two vectors, ...
7
votes
4answers
181 views
Simple compression algorithm
An implementation of a simple compression algorithm that's featured in a programming practice book.
My goals:
Robust: All error conditions must be handled properly. The specification indicated in ...
3
votes
1answer
39 views
Bit compressing in JavaScript
I have an bit array var data = []; ... and I have the following function:
jsPerf
...
5
votes
2answers
332 views
Processing compressed .csv files
I have some .csv files compressed in .bz2 format. I need to take a subset of the records (and data) and switch to .gz.
I am not happy with the performance. Is there a more efficient way to do it?
...
5
votes
3answers
303 views
C++ demo code for interaction with C
I want to show how to interact with C from C++ and chose a simple and small library to demonstrate. zlib's gzopen, gzwrite and ...
0
votes
2answers
147 views
Increase efficiency of basic string compressor
I was wondering what I can do to increase the performance of this program. The algorithm is pretty slow right now but I was wondering what I can do to increase the efficiency of this program. I used ...
2
votes
1answer
167 views
Comparing run-length decoding algorithms
I'm working on Ocaml.org 99 problems, and I solved the run-length decode one.
Here is the solution given by the site:
...
8
votes
3answers
17k views
3
votes
1answer
159 views
htaccess for URL remapping, caching, and compression
I have been collecting snippets from all over the place and then put them all together creating the following .htaccess file.
I really don't understand if what I have done below is good/should work ...
0
votes
2answers
2k views
Run-length encoding using C
Recently I was asked in an interview to convert the string say "aabbbccccddddd" to "a2b3c4d5". i.e we have to avoid repeating same character and just adding the repeat count. Here 'a' is repeated ...
2
votes
2answers
3k views
Run Length Encoding
Given an input string, write a function that returns the Run Length
Encoded string for the input string.
For example, if the input string is “wwwwaaadexxxxxx”, then the
function should ...
2
votes
1answer
2k views
JPEG compression and DCT algorithm verification
Here is the code I am using to apply DCT on 8x8 blocks, which I'm not sure is correct. I have tried to follow Wikipedia's discrete cosine transformation (DCT) formula as closely as possible. Please ...
2
votes
2answers
123 views
Run-length decoder
This replaces numbers with the character that appears next to them ('number' times). Is there a a more elegant or shorter way to do this?
...
1
vote
1answer
143 views
How is this method for compressing (zipping) files?
I'm writing a Java Helper Library. I want to include a method to zip files together, and this is what I've come up with.
I'm using the java.util.zip.* library (ZipOutputStream and ZipEntry ...
4
votes
1answer
4k views
Reading a .gz file
I am using Python 2.6.5 and am trying to find the fastest way to print out the contents of a .gz file. It's my understanding that prior to v2.5, zcat was much faster than gzip (see here)....I guess ...
2
votes
1answer
357 views
GZip archiver for log files
It compiles, works well, solves my problem of zipping old or big log files and removes them from a hard drive. However, following this answer, I would like to know what was wrong with the code.
...
5
votes
2answers
1k views
Slow web-scraping geolocator
How do I make my Python program faster?
I have 3 suspects right now for it being so slow:
Maybe my computer is just slow
Maybe my Internet is too slow (sometimes my program has to download the html ...
6
votes
1answer
911 views
Optimizing Huffman Decoding
I've been working on implementing a fast Huffman decoder for video decoding. With some help from you, I have been able to produce a decent implementation. However I am still not satisfied with the ...
11
votes
3answers
2k views
Huffman decoding for video
I've been trying to implement a fast Huffman decoder in order to encode/decode video. However, I'm barely able to decode a 1080p50 video using my decoder. On the other hand, there are lots of codecs ...
2
votes
1answer
699 views
Huffman encoding successive-merge function
From SICP:
Exercise 2.69. The following
procedure takes as its argument a list
of symbol-frequency pairs (where no
symbol appears in more than one pair)
and generates a Huffman encoding ...