473,545 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Client Side Data Compression (JavaScript)

Need to transfer large data (Appox 5MB in the form of XML & HTML) from
Internet Explorer to Web sphere application server. Want to know if
there is anyway I can compress data (JavaScript or otherwise) before
sending it to the server as it takes a long time to do this operation.

I am currently using xmlhttp. Sample code below.
xmlhttp = new ActiveXObject(" Msxml2.XMLHTTP" );
xmlhttp.open("P OST",'http://xyz.com',true);
var vSendXML = vMainXMLDOM.xml ;//The size of vSendXML is appox 5 MB
xmlhttp.send(vS endXML);

Note: From the server to client I am using GZIP for compression and it
is working pretty good.

Feb 2 '06 #1
8 11709

vn*******@gmail .com wrote:
Need to transfer large data (Appox 5MB in the form of XML & HTML) from
Internet Explorer to Web sphere application server. Want to know if
there is anyway I can compress data (JavaScript or otherwise) before
sending it to the server as it takes a long time to do this operation.

I am currently using xmlhttp. Sample code below.
xmlhttp = new ActiveXObject(" Msxml2.XMLHTTP" );
xmlhttp.open("P OST",'http://xyz.com',true);
var vSendXML = vMainXMLDOM.xml ;//The size of vSendXML is appox 5 MB
xmlhttp.send(vS endXML);

Note: From the server to client I am using GZIP for compression and it
is working pretty good.


If it is only you who sends data to the server, and not someone else
who is viewing one of your pages, you likely have a few options. Since
I am on broadband, I would not find sending a 5MB uncompressed file to
the server any problem, unless I had to do it dozens of times a day, so
broadband likely is the most simple option, although it might be
difficult to justify the cost if this is the only reason broadband
might be useful to you.

There are many programs available to compress data on your computer,
and some, such as Windows XP have an ordinary .zip program built in.
You can zip just about any combination of files, directories, images,
music etc. At my server, I can go to the control panel and unzip any
files that I have sent it such as zip, gzip, tar, etc. However it
sounds as if you might want the unzip function to be done automatically
at the server so the files can be used for something there. If so, this
likely would require a bit of server side code, perhaps php.

Feb 2 '06 #2

vn*******@gmail .com wrote:
Need to transfer large data (Appox 5MB in the form of XML & HTML) from
Internet Explorer to Web sphere application server. Want to know if
there is anyway I can compress data (JavaScript or otherwise) before
sending it to the server as it takes a long time to do this operation.

I am currently using xmlhttp. Sample code below.
xmlhttp = new ActiveXObject(" Msxml2.XMLHTTP" );
xmlhttp.open("P OST",'http://xyz.com',true);
var vSendXML = vMainXMLDOM.xml ;//The size of vSendXML is appox 5 MB
xmlhttp.send(vS endXML);

Note: From the server to client I am using GZIP for compression and it
is working pretty good.


I am only an amateur at this, and the following is a bit of a guess:-

OPTION 1

1. Use a zip ActiveXObject to compress the file.

2. Set the dataType for a blank XML node to "bin.base64 " and insert
the binary of the zip using nodeTypedValue.

You will lose some of the benefits of zip compression through base 64
encoding.

OPTION 2

If you can get the binary into Javascript somehow (perhaps using
ADODB.Stream if not disabled), I think you can also send pure binary as
an argument to the send method:-

<URL:http://www.devguru.com/Technologies/xmldom/quickref/httpRequest_sen d.html>

Extract: "This method takes one parameter: the requestBody to use.
Acceptable input types are BSTR, SAFEARRAY of UI1 (unsigned bytes),
IDispatch to an XMLDOM object, and IStream."

Regards

Julian

Feb 2 '06 #3
vn*******@gmail .com wrote:
Need to transfer large data (Appox 5MB in the form of XML & HTML) from
Internet Explorer to Web sphere application server. Want to know if
there is anyway I can compress data (JavaScript or otherwise) before
sending it to the server as it takes a long time to do this operation.

I am currently using xmlhttp. [...]
Note: From the server to client I am using GZIP for compression and it
is working pretty good.


Why, you can use a gzip implementation in JS/ECMAScript and compress the
data before you send it. The question is only whether this is fast enough.
PointedEars
Feb 2 '06 #4
1. Compression works by identifing repetition, indexing it and
referencing it so only the most atomic identifiers are repeated.
2. XML is full of repetition.
3. XML may also contain data that does nothing that you can strip.

No doubt somebody has already written something for this but personally
I'd:
1. Write a function that striped all the unecessary whitespace from the
XML with the exception of <!CDATA[ ]]> areas
2. Write a function that stores each unique tagname in an array.
3. Write a function that stores each unique attribute in an array.
4. Write a function that stores each unique tag content in an array.
(Keep the arrays separate)
5. Subtitute each tagname, attribute and tag content for the relevent
array index (greatly reducing the size of the XML) You could use just
letters as the array indices if you want to keep the XML valid.
6. Send over the contents of all the arrays, which arrays are which,
and the XML.
7. Use server side code to decompress by replacing the indices with
values stored in the arrays.

Feb 2 '06 #5
Thanks Julian Turner, Due have any code samples for either Option 1 or
2 or some related web site that you can suggest.

Feb 2 '06 #6
Thanks Thomas,
"Why, you can use a gzip implementation in JS/ECMAScript and compress
the
data before you send it. The question is only whether this is fast
enough. "

Can you please help me with more information on "JS/ECMAScript"

Feb 2 '06 #7
svaaps wrote:
Thanks Thomas,
"Why, you can use a gzip implementation in JS/ECMAScript and compress
the data before you send it. The question is only whether this is fast
enough. "

Can you please help me with more information on "JS/ECMAScript"


This is an abbreviation for the languages discussed in this newsgroup:
ECMAScript implementations like (Netscape) JavaScript and (Microsoft)
JScript.

Please learn to post, NetNews has threads to indicate the process of
discussion. Please learn to quote, USENET knows a sequence of leading
quote characters to indicate quotation level, and an attribution line
to indicate the author of the quoted material.

<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1P ost>
<URL:http://www.safalra.com/special/googlegroupsrep ly/>
PointedEars
Feb 2 '06 #8

svaaps wrote:
Thanks Julian Turner, Due have any code samples for either Option 1 or
2 or some related web site that you can suggest.


Sorry, don't have any particular code working on this, and can't really
suggest any specific web sites.

I suggest you google on combinations of terms such as "dataType"
"bin.base64 " "ADODB.Stre am" and "zip ActiveX controls" and see what
comes up.

Regards

Julian

Feb 3 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
9801
by: Don | last post by:
Does anyone know where I can find a client-side function I can reference from within an HTML/JavaScript web page? I'm currently using a core PHP function to do this, but I'd rather do it on the client-side and not have to upload the large raw image to the server. Thanks in advance for your help. Don ----== Posted via Newsfeeds.Com -...
15
4455
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do computations, the only data transfered is user mouse/kbd input. It works synchronously, but somehow, when I play in client window, both client and ...
18
7349
by: cjl | last post by:
Hey all: I know that it is silly in the age of Google to 'lose' something on the internet, but I recently checked out a project that had implemented a database with a subset of SQL in pure client-side javascript. I forgot to bookmark it, and now I can't find it. Anyone?
5
3588
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an instruction document (not data based) - same as using an xml web control. The resulting html is on the client? but what about the server side of...
6
1463
by: Danny Tuppeny | last post by:
Hi all, I'm writing a news client (mainly to test out CAB & ClickOnce!), and trying to decide on what to use for the storage of messages etc.. SQL Express seems like overkill (and is a hefty download for a < 1MB app!). Also, since there could be thousands of messages (potentially binary), I'm not sure that serializing my classes to disk...
14
6274
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2) show the error message next to the control. For example, if the text field is empty with RequiredField Validator control, it can show the value in...
8
3658
by: Mike Fellows | last post by:
Ok, im not sure if this is at all possible and if it is how i go about it is beyond me i have a piece of client side code that requires a piece of data from the server side (an ID number in this case) how can i pass the data from one side to the other, or retrieve it from the webform on the client side? i hope ive explained this...
1
2499
by: vidya | last post by:
Hi, I have a button which is a web control. I have some validation in javascript for the button in .aspx file and some in the button onclick event in code behind(C#). I need to get through both the java script validation as well as the click in code behind? How can this be done ? Can I call the code behind from the javascript function? If...
22
2865
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created using Perl on the backend, with Javascript providing limited frontend functionality. As an example, an expanding tree would be fully populated on the...
0
7459
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
7393
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
7803
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...
0
7749
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...
0
4942
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3444
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1871
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
695
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.