Is there a way to compress a long string to a smaller one and vise versa by code?
I am working on a plugin for an existing web-based tool in JavaScript.
We are collecting data and store it in a string like this:
"2.545,3.552,8.568;2.553,9.898,6.542;..." and so on.
The problem is, that we reach an export limit of 64k characters too fast.
I wanted to ask - and excuse me if it is a dumb question - if someone knows
of an algorithm or method we could use to compress the string before we export it. I am sure that it is technically possible but it certainly exceeds my skills as a programmer.
Thanks for any tips, link or suggestion.
javascript string encryption compression
|
show 15 more comments
I am working on a plugin for an existing web-based tool in JavaScript.
We are collecting data and store it in a string like this:
"2.545,3.552,8.568;2.553,9.898,6.542;..." and so on.
The problem is, that we reach an export limit of 64k characters too fast.
I wanted to ask - and excuse me if it is a dumb question - if someone knows
of an algorithm or method we could use to compress the string before we export it. I am sure that it is technically possible but it certainly exceeds my skills as a programmer.
Thanks for any tips, link or suggestion.
javascript string encryption compression
With respect, is there a reason why the Google search results for "Compression Algorithm" did not help you?
– Luke Joshua Park
Nov 14 '18 at 23:57
1
Possible duplicate of How to compress a string?
– Markus Safar
Nov 15 '18 at 0:05
I might should have mentioned that I am an amateur programmer, not familiar with web programming in general. As I said, sorry if it is a dumb question. @MarkusSafar Thanks for the link. I actually found this when I googled the question but I wasn't sure if it is really the same one. The OP asked something about a "SVG path String" and I am unfamiliar with that term. Maybe I should ask the question somewhere more appropriate for noobs? I dont really understand how I would implement such a solution.
– HenryChinaski
Nov 15 '18 at 0:12
@HenryChinaski, SVG path String just means that the OP has a string which contains path data from the SVG format. However the problem seems to be the same as your goal is to compress data which is stored in a string. Therefore you need some kind of compression algorithm and the linked question contains a bunch of answers pointed to them. So I hope this helps you ;-)
– Markus Safar
Nov 15 '18 at 0:16
1
@AbanaClara Thanks anyway for the hint with web workers!
– HenryChinaski
Nov 15 '18 at 0:39
|
show 15 more comments
I am working on a plugin for an existing web-based tool in JavaScript.
We are collecting data and store it in a string like this:
"2.545,3.552,8.568;2.553,9.898,6.542;..." and so on.
The problem is, that we reach an export limit of 64k characters too fast.
I wanted to ask - and excuse me if it is a dumb question - if someone knows
of an algorithm or method we could use to compress the string before we export it. I am sure that it is technically possible but it certainly exceeds my skills as a programmer.
Thanks for any tips, link or suggestion.
javascript string encryption compression
I am working on a plugin for an existing web-based tool in JavaScript.
We are collecting data and store it in a string like this:
"2.545,3.552,8.568;2.553,9.898,6.542;..." and so on.
The problem is, that we reach an export limit of 64k characters too fast.
I wanted to ask - and excuse me if it is a dumb question - if someone knows
of an algorithm or method we could use to compress the string before we export it. I am sure that it is technically possible but it certainly exceeds my skills as a programmer.
Thanks for any tips, link or suggestion.
javascript string encryption compression
javascript string encryption compression
asked Nov 14 '18 at 23:53
HenryChinaskiHenryChinaski
134
134
With respect, is there a reason why the Google search results for "Compression Algorithm" did not help you?
– Luke Joshua Park
Nov 14 '18 at 23:57
1
Possible duplicate of How to compress a string?
– Markus Safar
Nov 15 '18 at 0:05
I might should have mentioned that I am an amateur programmer, not familiar with web programming in general. As I said, sorry if it is a dumb question. @MarkusSafar Thanks for the link. I actually found this when I googled the question but I wasn't sure if it is really the same one. The OP asked something about a "SVG path String" and I am unfamiliar with that term. Maybe I should ask the question somewhere more appropriate for noobs? I dont really understand how I would implement such a solution.
– HenryChinaski
Nov 15 '18 at 0:12
@HenryChinaski, SVG path String just means that the OP has a string which contains path data from the SVG format. However the problem seems to be the same as your goal is to compress data which is stored in a string. Therefore you need some kind of compression algorithm and the linked question contains a bunch of answers pointed to them. So I hope this helps you ;-)
– Markus Safar
Nov 15 '18 at 0:16
1
@AbanaClara Thanks anyway for the hint with web workers!
– HenryChinaski
Nov 15 '18 at 0:39
|
show 15 more comments
With respect, is there a reason why the Google search results for "Compression Algorithm" did not help you?
– Luke Joshua Park
Nov 14 '18 at 23:57
1
Possible duplicate of How to compress a string?
– Markus Safar
Nov 15 '18 at 0:05
I might should have mentioned that I am an amateur programmer, not familiar with web programming in general. As I said, sorry if it is a dumb question. @MarkusSafar Thanks for the link. I actually found this when I googled the question but I wasn't sure if it is really the same one. The OP asked something about a "SVG path String" and I am unfamiliar with that term. Maybe I should ask the question somewhere more appropriate for noobs? I dont really understand how I would implement such a solution.
– HenryChinaski
Nov 15 '18 at 0:12
@HenryChinaski, SVG path String just means that the OP has a string which contains path data from the SVG format. However the problem seems to be the same as your goal is to compress data which is stored in a string. Therefore you need some kind of compression algorithm and the linked question contains a bunch of answers pointed to them. So I hope this helps you ;-)
– Markus Safar
Nov 15 '18 at 0:16
1
@AbanaClara Thanks anyway for the hint with web workers!
– HenryChinaski
Nov 15 '18 at 0:39
With respect, is there a reason why the Google search results for "Compression Algorithm" did not help you?
– Luke Joshua Park
Nov 14 '18 at 23:57
With respect, is there a reason why the Google search results for "Compression Algorithm" did not help you?
– Luke Joshua Park
Nov 14 '18 at 23:57
1
1
Possible duplicate of How to compress a string?
– Markus Safar
Nov 15 '18 at 0:05
Possible duplicate of How to compress a string?
– Markus Safar
Nov 15 '18 at 0:05
I might should have mentioned that I am an amateur programmer, not familiar with web programming in general. As I said, sorry if it is a dumb question. @MarkusSafar Thanks for the link. I actually found this when I googled the question but I wasn't sure if it is really the same one. The OP asked something about a "SVG path String" and I am unfamiliar with that term. Maybe I should ask the question somewhere more appropriate for noobs? I dont really understand how I would implement such a solution.
– HenryChinaski
Nov 15 '18 at 0:12
I might should have mentioned that I am an amateur programmer, not familiar with web programming in general. As I said, sorry if it is a dumb question. @MarkusSafar Thanks for the link. I actually found this when I googled the question but I wasn't sure if it is really the same one. The OP asked something about a "SVG path String" and I am unfamiliar with that term. Maybe I should ask the question somewhere more appropriate for noobs? I dont really understand how I would implement such a solution.
– HenryChinaski
Nov 15 '18 at 0:12
@HenryChinaski, SVG path String just means that the OP has a string which contains path data from the SVG format. However the problem seems to be the same as your goal is to compress data which is stored in a string. Therefore you need some kind of compression algorithm and the linked question contains a bunch of answers pointed to them. So I hope this helps you ;-)
– Markus Safar
Nov 15 '18 at 0:16
@HenryChinaski, SVG path String just means that the OP has a string which contains path data from the SVG format. However the problem seems to be the same as your goal is to compress data which is stored in a string. Therefore you need some kind of compression algorithm and the linked question contains a bunch of answers pointed to them. So I hope this helps you ;-)
– Markus Safar
Nov 15 '18 at 0:16
1
1
@AbanaClara Thanks anyway for the hint with web workers!
– HenryChinaski
Nov 15 '18 at 0:39
@AbanaClara Thanks anyway for the hint with web workers!
– HenryChinaski
Nov 15 '18 at 0:39
|
show 15 more comments
2 Answers
2
active
oldest
votes
lz-string looks like it will work.
var string = "2.545,3.552,8.568;2.553,9.898,6.542";
alert("Size of sample is: " + string.length);
var compressed = LZString.compress(string);
alert("Size of compressed sample is: " + compressed.length);
string = LZString.decompress(compressed);
alert("Sample is: " + string);
<script src="https://cdn.jsdelivr.net/gh/pieroxy/lz-string/libs/lz-string.js"></script>
Thank you so much @Will. Really helping me out with your snippet! I am used to C# code in stand-alone applications and I have a hard time to understand trivial things in web developing.
– HenryChinaski
Nov 15 '18 at 0:38
@HenryChinaski I forgot to ask. If you have no way of modifying the server code. How are you going to decompress this string once they receive it? Your client will be handling a string not formatted in a way they expect it to be
– Abana Clara
Nov 15 '18 at 0:40
@AbanaClara they send the text file to us, we decompress it and send them the results after we worked with it.
– HenryChinaski
Nov 15 '18 at 0:42
@HenryChinaski ah great. You shouldn't have problems then. Good luck
– Abana Clara
Nov 15 '18 at 0:43
@AbanaClara Perfect! Thanks!
– HenryChinaski
Nov 15 '18 at 0:44
|
show 1 more comment
I would suggest you use a dedicated Web Worker for this. There is a pretty good explanation on Using Web Worker on the mozilla developers page.
Thank you very much for your help!
– HenryChinaski
Nov 15 '18 at 0:40
@HenryChinaski, you are very welcome. If you need any further assistance, just let me know ;-)
– Markus Safar
Nov 15 '18 at 0:41
@HenryChinaski be mindful that a web worker will not have access to the DOM, window, or any library. You need to copy paste the source code of your compression library inside the web worker script, or you could conceptually send the function string and evaluate inside the worker. Web workers accepts and sends nothing but strings. I'm not sure how multi-threading works in C# or Java but this is how it currently works for JS
– Abana Clara
Nov 15 '18 at 0:47
1
@AbanaClara Thanks for the tip. I will keep it in mind and just try a bit for a day or two. Actually, JS is my smaller problem. My problems are all the seemingly minor things you need to pay attention to when you are using databases, servers, html implementation and so on. I believe that most of it is really trivial stuff for experienced web developers but in stand-alone applications, there's just you and the code. You can test everything easily in your safe space.
– HenryChinaski
Nov 15 '18 at 0:59
2
@AbanaClara Worked perfectly! Thanks!
– HenryChinaski
Nov 15 '18 at 1:57
|
show 5 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53310514%2fis-there-a-way-to-compress-a-long-string-to-a-smaller-one-and-vise-versa-by-code%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
lz-string looks like it will work.
var string = "2.545,3.552,8.568;2.553,9.898,6.542";
alert("Size of sample is: " + string.length);
var compressed = LZString.compress(string);
alert("Size of compressed sample is: " + compressed.length);
string = LZString.decompress(compressed);
alert("Sample is: " + string);
<script src="https://cdn.jsdelivr.net/gh/pieroxy/lz-string/libs/lz-string.js"></script>
Thank you so much @Will. Really helping me out with your snippet! I am used to C# code in stand-alone applications and I have a hard time to understand trivial things in web developing.
– HenryChinaski
Nov 15 '18 at 0:38
@HenryChinaski I forgot to ask. If you have no way of modifying the server code. How are you going to decompress this string once they receive it? Your client will be handling a string not formatted in a way they expect it to be
– Abana Clara
Nov 15 '18 at 0:40
@AbanaClara they send the text file to us, we decompress it and send them the results after we worked with it.
– HenryChinaski
Nov 15 '18 at 0:42
@HenryChinaski ah great. You shouldn't have problems then. Good luck
– Abana Clara
Nov 15 '18 at 0:43
@AbanaClara Perfect! Thanks!
– HenryChinaski
Nov 15 '18 at 0:44
|
show 1 more comment
lz-string looks like it will work.
var string = "2.545,3.552,8.568;2.553,9.898,6.542";
alert("Size of sample is: " + string.length);
var compressed = LZString.compress(string);
alert("Size of compressed sample is: " + compressed.length);
string = LZString.decompress(compressed);
alert("Sample is: " + string);
<script src="https://cdn.jsdelivr.net/gh/pieroxy/lz-string/libs/lz-string.js"></script>
Thank you so much @Will. Really helping me out with your snippet! I am used to C# code in stand-alone applications and I have a hard time to understand trivial things in web developing.
– HenryChinaski
Nov 15 '18 at 0:38
@HenryChinaski I forgot to ask. If you have no way of modifying the server code. How are you going to decompress this string once they receive it? Your client will be handling a string not formatted in a way they expect it to be
– Abana Clara
Nov 15 '18 at 0:40
@AbanaClara they send the text file to us, we decompress it and send them the results after we worked with it.
– HenryChinaski
Nov 15 '18 at 0:42
@HenryChinaski ah great. You shouldn't have problems then. Good luck
– Abana Clara
Nov 15 '18 at 0:43
@AbanaClara Perfect! Thanks!
– HenryChinaski
Nov 15 '18 at 0:44
|
show 1 more comment
lz-string looks like it will work.
var string = "2.545,3.552,8.568;2.553,9.898,6.542";
alert("Size of sample is: " + string.length);
var compressed = LZString.compress(string);
alert("Size of compressed sample is: " + compressed.length);
string = LZString.decompress(compressed);
alert("Sample is: " + string);
<script src="https://cdn.jsdelivr.net/gh/pieroxy/lz-string/libs/lz-string.js"></script>
lz-string looks like it will work.
var string = "2.545,3.552,8.568;2.553,9.898,6.542";
alert("Size of sample is: " + string.length);
var compressed = LZString.compress(string);
alert("Size of compressed sample is: " + compressed.length);
string = LZString.decompress(compressed);
alert("Sample is: " + string);
<script src="https://cdn.jsdelivr.net/gh/pieroxy/lz-string/libs/lz-string.js"></script>
var string = "2.545,3.552,8.568;2.553,9.898,6.542";
alert("Size of sample is: " + string.length);
var compressed = LZString.compress(string);
alert("Size of compressed sample is: " + compressed.length);
string = LZString.decompress(compressed);
alert("Sample is: " + string);
<script src="https://cdn.jsdelivr.net/gh/pieroxy/lz-string/libs/lz-string.js"></script>
var string = "2.545,3.552,8.568;2.553,9.898,6.542";
alert("Size of sample is: " + string.length);
var compressed = LZString.compress(string);
alert("Size of compressed sample is: " + compressed.length);
string = LZString.decompress(compressed);
alert("Sample is: " + string);
<script src="https://cdn.jsdelivr.net/gh/pieroxy/lz-string/libs/lz-string.js"></script>
answered Nov 15 '18 at 0:24
WillWill
1,79411111
1,79411111
Thank you so much @Will. Really helping me out with your snippet! I am used to C# code in stand-alone applications and I have a hard time to understand trivial things in web developing.
– HenryChinaski
Nov 15 '18 at 0:38
@HenryChinaski I forgot to ask. If you have no way of modifying the server code. How are you going to decompress this string once they receive it? Your client will be handling a string not formatted in a way they expect it to be
– Abana Clara
Nov 15 '18 at 0:40
@AbanaClara they send the text file to us, we decompress it and send them the results after we worked with it.
– HenryChinaski
Nov 15 '18 at 0:42
@HenryChinaski ah great. You shouldn't have problems then. Good luck
– Abana Clara
Nov 15 '18 at 0:43
@AbanaClara Perfect! Thanks!
– HenryChinaski
Nov 15 '18 at 0:44
|
show 1 more comment
Thank you so much @Will. Really helping me out with your snippet! I am used to C# code in stand-alone applications and I have a hard time to understand trivial things in web developing.
– HenryChinaski
Nov 15 '18 at 0:38
@HenryChinaski I forgot to ask. If you have no way of modifying the server code. How are you going to decompress this string once they receive it? Your client will be handling a string not formatted in a way they expect it to be
– Abana Clara
Nov 15 '18 at 0:40
@AbanaClara they send the text file to us, we decompress it and send them the results after we worked with it.
– HenryChinaski
Nov 15 '18 at 0:42
@HenryChinaski ah great. You shouldn't have problems then. Good luck
– Abana Clara
Nov 15 '18 at 0:43
@AbanaClara Perfect! Thanks!
– HenryChinaski
Nov 15 '18 at 0:44
Thank you so much @Will. Really helping me out with your snippet! I am used to C# code in stand-alone applications and I have a hard time to understand trivial things in web developing.
– HenryChinaski
Nov 15 '18 at 0:38
Thank you so much @Will. Really helping me out with your snippet! I am used to C# code in stand-alone applications and I have a hard time to understand trivial things in web developing.
– HenryChinaski
Nov 15 '18 at 0:38
@HenryChinaski I forgot to ask. If you have no way of modifying the server code. How are you going to decompress this string once they receive it? Your client will be handling a string not formatted in a way they expect it to be
– Abana Clara
Nov 15 '18 at 0:40
@HenryChinaski I forgot to ask. If you have no way of modifying the server code. How are you going to decompress this string once they receive it? Your client will be handling a string not formatted in a way they expect it to be
– Abana Clara
Nov 15 '18 at 0:40
@AbanaClara they send the text file to us, we decompress it and send them the results after we worked with it.
– HenryChinaski
Nov 15 '18 at 0:42
@AbanaClara they send the text file to us, we decompress it and send them the results after we worked with it.
– HenryChinaski
Nov 15 '18 at 0:42
@HenryChinaski ah great. You shouldn't have problems then. Good luck
– Abana Clara
Nov 15 '18 at 0:43
@HenryChinaski ah great. You shouldn't have problems then. Good luck
– Abana Clara
Nov 15 '18 at 0:43
@AbanaClara Perfect! Thanks!
– HenryChinaski
Nov 15 '18 at 0:44
@AbanaClara Perfect! Thanks!
– HenryChinaski
Nov 15 '18 at 0:44
|
show 1 more comment
I would suggest you use a dedicated Web Worker for this. There is a pretty good explanation on Using Web Worker on the mozilla developers page.
Thank you very much for your help!
– HenryChinaski
Nov 15 '18 at 0:40
@HenryChinaski, you are very welcome. If you need any further assistance, just let me know ;-)
– Markus Safar
Nov 15 '18 at 0:41
@HenryChinaski be mindful that a web worker will not have access to the DOM, window, or any library. You need to copy paste the source code of your compression library inside the web worker script, or you could conceptually send the function string and evaluate inside the worker. Web workers accepts and sends nothing but strings. I'm not sure how multi-threading works in C# or Java but this is how it currently works for JS
– Abana Clara
Nov 15 '18 at 0:47
1
@AbanaClara Thanks for the tip. I will keep it in mind and just try a bit for a day or two. Actually, JS is my smaller problem. My problems are all the seemingly minor things you need to pay attention to when you are using databases, servers, html implementation and so on. I believe that most of it is really trivial stuff for experienced web developers but in stand-alone applications, there's just you and the code. You can test everything easily in your safe space.
– HenryChinaski
Nov 15 '18 at 0:59
2
@AbanaClara Worked perfectly! Thanks!
– HenryChinaski
Nov 15 '18 at 1:57
|
show 5 more comments
I would suggest you use a dedicated Web Worker for this. There is a pretty good explanation on Using Web Worker on the mozilla developers page.
Thank you very much for your help!
– HenryChinaski
Nov 15 '18 at 0:40
@HenryChinaski, you are very welcome. If you need any further assistance, just let me know ;-)
– Markus Safar
Nov 15 '18 at 0:41
@HenryChinaski be mindful that a web worker will not have access to the DOM, window, or any library. You need to copy paste the source code of your compression library inside the web worker script, or you could conceptually send the function string and evaluate inside the worker. Web workers accepts and sends nothing but strings. I'm not sure how multi-threading works in C# or Java but this is how it currently works for JS
– Abana Clara
Nov 15 '18 at 0:47
1
@AbanaClara Thanks for the tip. I will keep it in mind and just try a bit for a day or two. Actually, JS is my smaller problem. My problems are all the seemingly minor things you need to pay attention to when you are using databases, servers, html implementation and so on. I believe that most of it is really trivial stuff for experienced web developers but in stand-alone applications, there's just you and the code. You can test everything easily in your safe space.
– HenryChinaski
Nov 15 '18 at 0:59
2
@AbanaClara Worked perfectly! Thanks!
– HenryChinaski
Nov 15 '18 at 1:57
|
show 5 more comments
I would suggest you use a dedicated Web Worker for this. There is a pretty good explanation on Using Web Worker on the mozilla developers page.
I would suggest you use a dedicated Web Worker for this. There is a pretty good explanation on Using Web Worker on the mozilla developers page.
answered Nov 15 '18 at 0:37
Markus SafarMarkus Safar
4,71241837
4,71241837
Thank you very much for your help!
– HenryChinaski
Nov 15 '18 at 0:40
@HenryChinaski, you are very welcome. If you need any further assistance, just let me know ;-)
– Markus Safar
Nov 15 '18 at 0:41
@HenryChinaski be mindful that a web worker will not have access to the DOM, window, or any library. You need to copy paste the source code of your compression library inside the web worker script, or you could conceptually send the function string and evaluate inside the worker. Web workers accepts and sends nothing but strings. I'm not sure how multi-threading works in C# or Java but this is how it currently works for JS
– Abana Clara
Nov 15 '18 at 0:47
1
@AbanaClara Thanks for the tip. I will keep it in mind and just try a bit for a day or two. Actually, JS is my smaller problem. My problems are all the seemingly minor things you need to pay attention to when you are using databases, servers, html implementation and so on. I believe that most of it is really trivial stuff for experienced web developers but in stand-alone applications, there's just you and the code. You can test everything easily in your safe space.
– HenryChinaski
Nov 15 '18 at 0:59
2
@AbanaClara Worked perfectly! Thanks!
– HenryChinaski
Nov 15 '18 at 1:57
|
show 5 more comments
Thank you very much for your help!
– HenryChinaski
Nov 15 '18 at 0:40
@HenryChinaski, you are very welcome. If you need any further assistance, just let me know ;-)
– Markus Safar
Nov 15 '18 at 0:41
@HenryChinaski be mindful that a web worker will not have access to the DOM, window, or any library. You need to copy paste the source code of your compression library inside the web worker script, or you could conceptually send the function string and evaluate inside the worker. Web workers accepts and sends nothing but strings. I'm not sure how multi-threading works in C# or Java but this is how it currently works for JS
– Abana Clara
Nov 15 '18 at 0:47
1
@AbanaClara Thanks for the tip. I will keep it in mind and just try a bit for a day or two. Actually, JS is my smaller problem. My problems are all the seemingly minor things you need to pay attention to when you are using databases, servers, html implementation and so on. I believe that most of it is really trivial stuff for experienced web developers but in stand-alone applications, there's just you and the code. You can test everything easily in your safe space.
– HenryChinaski
Nov 15 '18 at 0:59
2
@AbanaClara Worked perfectly! Thanks!
– HenryChinaski
Nov 15 '18 at 1:57
Thank you very much for your help!
– HenryChinaski
Nov 15 '18 at 0:40
Thank you very much for your help!
– HenryChinaski
Nov 15 '18 at 0:40
@HenryChinaski, you are very welcome. If you need any further assistance, just let me know ;-)
– Markus Safar
Nov 15 '18 at 0:41
@HenryChinaski, you are very welcome. If you need any further assistance, just let me know ;-)
– Markus Safar
Nov 15 '18 at 0:41
@HenryChinaski be mindful that a web worker will not have access to the DOM, window, or any library. You need to copy paste the source code of your compression library inside the web worker script, or you could conceptually send the function string and evaluate inside the worker. Web workers accepts and sends nothing but strings. I'm not sure how multi-threading works in C# or Java but this is how it currently works for JS
– Abana Clara
Nov 15 '18 at 0:47
@HenryChinaski be mindful that a web worker will not have access to the DOM, window, or any library. You need to copy paste the source code of your compression library inside the web worker script, or you could conceptually send the function string and evaluate inside the worker. Web workers accepts and sends nothing but strings. I'm not sure how multi-threading works in C# or Java but this is how it currently works for JS
– Abana Clara
Nov 15 '18 at 0:47
1
1
@AbanaClara Thanks for the tip. I will keep it in mind and just try a bit for a day or two. Actually, JS is my smaller problem. My problems are all the seemingly minor things you need to pay attention to when you are using databases, servers, html implementation and so on. I believe that most of it is really trivial stuff for experienced web developers but in stand-alone applications, there's just you and the code. You can test everything easily in your safe space.
– HenryChinaski
Nov 15 '18 at 0:59
@AbanaClara Thanks for the tip. I will keep it in mind and just try a bit for a day or two. Actually, JS is my smaller problem. My problems are all the seemingly minor things you need to pay attention to when you are using databases, servers, html implementation and so on. I believe that most of it is really trivial stuff for experienced web developers but in stand-alone applications, there's just you and the code. You can test everything easily in your safe space.
– HenryChinaski
Nov 15 '18 at 0:59
2
2
@AbanaClara Worked perfectly! Thanks!
– HenryChinaski
Nov 15 '18 at 1:57
@AbanaClara Worked perfectly! Thanks!
– HenryChinaski
Nov 15 '18 at 1:57
|
show 5 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53310514%2fis-there-a-way-to-compress-a-long-string-to-a-smaller-one-and-vise-versa-by-code%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
With respect, is there a reason why the Google search results for "Compression Algorithm" did not help you?
– Luke Joshua Park
Nov 14 '18 at 23:57
1
Possible duplicate of How to compress a string?
– Markus Safar
Nov 15 '18 at 0:05
I might should have mentioned that I am an amateur programmer, not familiar with web programming in general. As I said, sorry if it is a dumb question. @MarkusSafar Thanks for the link. I actually found this when I googled the question but I wasn't sure if it is really the same one. The OP asked something about a "SVG path String" and I am unfamiliar with that term. Maybe I should ask the question somewhere more appropriate for noobs? I dont really understand how I would implement such a solution.
– HenryChinaski
Nov 15 '18 at 0:12
@HenryChinaski, SVG path String just means that the OP has a string which contains path data from the SVG format. However the problem seems to be the same as your goal is to compress data which is stored in a string. Therefore you need some kind of compression algorithm and the linked question contains a bunch of answers pointed to them. So I hope this helps you ;-)
– Markus Safar
Nov 15 '18 at 0:16
1
@AbanaClara Thanks anyway for the hint with web workers!
– HenryChinaski
Nov 15 '18 at 0:39