Python :: Uncompress Zlib String In Using ByteArrays
Dec 2, 2009
I have a web application developed in Adobe Flex 3 and Python 2.5 (deployed on Google App Engine). A RESTful web service has been created in Python and its results are currently in an XML format which is being read by Flex using the HttpService object.Now the main objective is to compress the XML so that there is as less a time between the HttpService send() method and result events. I looked up Python docs and managed to use zlib.compress() to compress the XML result.Then I set the HttpService result type from "xml" to "text" and tried using ByteArrays to uncompress the string back to XML. Here's where I failed. I am doing something like this:[code]Its throwing an exception at byteArray.uncompress() and says unable to uncompress the byteArray. Also when I trace the length of the byteArray it gets 0.[code]
View 1 Replies
Similar Posts:
Oct 9, 2009
I can't seem to get a stream that Flex 3 want's to decompress.
I've tried:
System.IO.Compression.GZipStream
System.IO.Compression.DeflateStream
ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream
zlib.ZOutputStream
None of these seem to make ByteArray.uncompress happy, i.e. I get
Error #2058: There was an error decompressing the data.
Also the whole Deflate vs zlib has me going around in circles. It seems that according to the wikipedia article, zlib is an implementation of DEFLATE. But according to Actionscript they are two different things?
Microsoft also seems to indicate the Gzip at least uses the Deflate algorithm, as in their docs they refer that GZipOutputStream uses the same compression algorithm as DeflateStream. So I'm assuming that it's just a header difference, which would indicate that's "no good" as far as 'ByteArray.uncompress' as the "DEFLATE" algorithm is only supported in AIR applications.
Sample "server" code, using SharpZipLib in this case (not working):
public virtual bool ProcessRequest(string path, HttpListenerContext context)
{
var buffer = File.ReadAllBytes(path);
// Specifying to strip header/footer from data as that seems to be what the
[code]....
View 2 Replies
Jul 14, 2011
I experience strange behavior of sockets in Python (3.2). Client connects to my application using Flash. Most of the time there is nothing unusual but sometimes python crashes in a way that should not have taken place - enter into infinite loops. Below I attach to the loop code and error message in the log. Python hang on bytesRecived = sock.recv(64) and receive b'' witch is visible in log.
code:
try:
buff = ''
[code].........
View 1 Replies
Feb 22, 2010
I am using python and webapp framework in app engine for backend and flex 4 for front end.I would like to pass a string form backend to front end, so i write the following code in the main.py:
[Code]...
View 3 Replies
Feb 14, 2011
I have created a flex application in the Python Gae sdk and I got the error 2048, so I put a crossdomain.xml under the static folder.
The crossdomain.xml is following:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy> [code].....
However, I still got the error 2048. Therefore, I would like to know is anything I need to configure or miss in my case and how to fix the error.
View 2 Replies
Jun 15, 2011
Does Adobe Flash expose any Automation or hosting interfaces through COM or a DLL in %systemroot%system32? I'm working with Python and wxWidgets to host a flash application to monitor lunar phases.
View 1 Replies
Aug 7, 2010
i develop one project on python and upload on google app can i use swf file to import in python web application?
View 1 Replies
Jul 27, 2010
i need a simple python lib that check the uploaded files to my webserver are flash media (FLV), by reading the flv header (metadata) and not the mimetype extension.
View 1 Replies
Apr 12, 2011
If swf file is embedded in html it is easy to call ActionScript methods via ExternalInterface using JavaScript. Now I want to use the swf file outside of a browser and still be able to access its methods, but now I want to use Python to call ActionScript. Is it possible? There is so little information about it in the Internet. Probably I can use AMF (pyAmf) for this, can I?
View 2 Replies
Sep 21, 2009
I'm trying to find out if there is a way I could embed a Python back-end into an AIR application? I'm looking to employ an approach similar to the one outlined here to implement the business logic for my application, but additionally, I would like to provide the user with a single binary which they can load. I don't want the user to have to fire up a seperate server process to make this work.
View 3 Replies
Sep 6, 2011
Is there a way to uncompress ziped data without inflate()?
View 1 Replies
Jun 4, 2008
Does the uncompress method of ByteArray only supports level 3 compressed streams? Because I have a valid zlib compressed file but compressed in level 2, and Flash always throws me the 2058 error message.
I've also tried using the DefaultCompressionAlgorithm class for AIR with its two compression methods, but with no success.
Doing some quick tests with python using the same file gets uncompressed with no problems.
View 3 Replies
Nov 7, 2011
I'm doing a flashlight in pixel bender and works great. I pass, as parameters, the center of the flashlight.Now, I want to have more than one flashlights (n value).I don't think so I can use Arrays in Pixel Bender, so I thought about ByteArrays but I don't know how to use it in Pixel Bender.
View 2 Replies
Jul 26, 2010
I am trying to load swf as byteArrays. I am able to load the swf, however I am unable to access movieclip properties. I have the code below.. How do I get access to movieclip properties?[code]...
View 6 Replies
Dec 19, 2011
I have an xml snippet that contains an object hierarchy:
doc = """
<RootObj val1="ValueOne" stat1="Stat1" stat2="Stat2">
<internalarray type="array">
<InternalObject val1="12" val2="12" />
<InternalObject val1="13" val2="13" />
[Code]...
View 1 Replies
Dec 22, 2010
I'm trying to combine two ByteArrays to send it out as post data using URLRequest.. Whenever I try to simply add them up, the request becomes get instead of POST and the data for some reason doesn't get included.
View 2 Replies
Apr 6, 2011
I have an Air application with remote service in codeigniter. I'm trying to save a bytearray that I received from the Air app but when I save the data I get empty files with the correct filename.So there must be something wrong with my bytearray or the way I save the data. Does anyone have an idea what I'm doing wrong? I've debugged the Arraycollection I sent and the bytearray is definitely in there.This is where I make my arraycollection to send to my codeigniter amf
ActionScript Code:
var ldr:Loader = Loader(event.target.loader);
var b:Bitmap = Bitmap(ldr.content);[code]....
View 0 Replies
Jun 21, 2010
I would like to be able to move images into and out of Flex by converting back and forth between ByteArrays. I've been having some trouble with this, so I designed a simple test program, and even that I can't get to work. Here's the code I'm trying right now:
[Code]...
So far the process follows top to bottom: Click button 3, image displays, everything is going well. Click button 4, and I get "Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type." after the line "loader.loadBytes(myByeArray);" in the function button4_clickHandler. As far as I can tell I'm using everything as intended.
View 1 Replies
Oct 14, 2011
does anyone know if there is any possibility to do simple elementwise math on bytearrays without having to program it explicitely, e.g. a built-in function for multiplying all elements of a bytearray (of type float) by a constant or adding the elements of two bytearrays (with specified datatype)?
View 1 Replies
Dec 21, 2010
I work on a Flex application that creates compressed files and uploads them on a server. The files are created with ByteArray.compress method, which is zlib compression. I can decompress them using Python API on the server but I prefer to keep the files compressed there. I want to be able to download and decompress the files later, however WinZip and WinRar fail to decompress them. When I google for zlib utility, I only find zlib dll library. I need a simple application for Windows (and/or Linux)
View 1 Replies
Jul 26, 2011
Is there anyway to get the client's ip address when running PyAMF via the WSGI gateway interface (Apache)?
View 1 Replies
Jan 3, 2012
in a local as3 application i need to capture a video at 25 frames per second and send the bytearray to a local python script.when i try to encode the bytearray to png inside as3 it is much to slow.so i decided to just write the raw bytearray i got from :[code]this is pretty performant and does not drop frames so far.however, i need to convert these raw bytes to png on the python side.
View 1 Replies
Aug 25, 2010
Is there a way to imprt a python program into flash, so that you would get what you would see in python, but in .swf file (I'd like to make a text-only game for Kongregate)
View 1 Replies
Jan 9, 2010
Is there any such effort been made?
Some more info:
it's client application (gui intensive)
By porting I was thinking of cross-compiling.
View 2 Replies
Mar 6, 2010
i have this function in a view that shows the xml in the browser, but what i want is to save the xml content in a file, to use in a Flash gallery.
def build_xml_menu(request):
rubros = Rubro.objects.all()
familias = Familia.objects.all()
[Code].....
View 1 Replies
May 22, 2010
I have a swf file (a flash game). I want to run some script to open it in full-screen mode. I'm not attached to any browser, but I do run Linux, so a bash, or generic answer is what I'm looking for. I'm also open to building a lite browser application if need-be.
View 2 Replies
Jun 3, 2010
How can I send a .png file using python cgi to a flex application?
View 1 Replies
Jul 9, 2010
I am trying to create an automated program in Python that deals with Flash. Right now I am using Python Mechanize, which is great for filling forms, but when it comes to flash I don't know what to do. Does anyone know how I can interact with flash forms (set and get variables, click buttons, etc.) via Python mechanize or some other python library?
View 1 Replies
Jan 29, 2011
I am calling Python script from flex using HTTP service. How can I send back some values from python to flex app?
View 3 Replies
Mar 6, 2011
I'm trying to generate an embeded flash widget on a page with Python using a dynamic parameter. Here's the code I currently have.[code]...
The {{query}} parameter is passed through as a URL parameter. I'm not very technical, but I think the query value needs to be encoded for the flash to work. How do I encode the flash parameter?
View 1 Replies