Creating large pdf file with Adobe Air - actionscript-3

I'm trying to create a pdf file using alivepdf lib with about 4000 pages and each page contains an image added by the alivepdf method addImage(). the problem is that the data takes a lot of memory because alivepdf creates the whole file in the memory before saving it to desk. so i am asking if there is a away i can open the file with each entry and add page then close it and free memory before adding the next page.
thanks

I suggest you first use your app make many much smaller PDFs (for example each one is 400 pages, then next 400 as a new PDF, so on until all 4000 pages are done in 10 PDFs).
When those are ready, use an external tool like PDFtk to process those files you saved to disk. It works from command prompt but you can tell AIR to run it as a NativeProcess. It accepts instructions to combine those saved files and output them as a new big one.
Don't worry about memory, nothing is loaded into Flash. Flash itself can start the process but the merging will happen outside your app. Just wait for a big file to magically appear.

Related

VSCode -- Preview (i.e. head) a CSV file as the default open option?

I was working with a large CSV file (> 1 GB), I wanted to preview what the columns were and what the data looked like by exploring the top ~100-1000 rows of the data alongside the headers.
When I open the file, my computer hangs for quite awhile due to the size of the file. However, I noticed there is a preview large file: head (I believe through the RainbowCSV extension?) in the context menu that loads much faster and provides the functionality I would want in the strong majority of cases (previewing large files for structure rather than opening them entirely).
Is there anyway to set this context menu option for previewing a large file as the default behavior when clicking on a .csv file in the File Explorer? I would prefer this so I do not accidentally make my computer hang when clicking on a file.
Bonus points if anyone can point me to an extension that let's you paginate CSV files by default.

PhpStorm virtual file splitting

I can't find a more appropriate. I'm using PhpStorm to create web content (php, html, css, js..) and I'm facing the problem of long files (not even so long few hundred lines enough to be lost) where it gets hard to find things and remove unnecessary content.
I was wondering if there is a functionality, plugin or external file manager where it creates different files from one file on disk.
For example: when we have a .css file, for sure it's content is dealing with different features/parts of the html but they are all on the same html page. So it's a bad idea to create different .css file for each part, but it would be nice to have different virtual files for each part/feature where we can code and debug separately our code; but they are saved to same file.
Lets say:
common_header.css: deals with headers
common_menu.css: deals with menu (some menu we have on our page)
common_footer.css: deals with what ever to the end of page
... and so on
So now while coding we see different files (best as a subtree of the original file) some thing like that on file manager:
....other file // the dot here should be + since subtree hidden
common.css // the dot here should be - since subtree is shown
common_header.css
common_menu.css
common_footer.css
...
....other file
But when on disk they are all on the same file common.css that is loaded to our browser as one too.
If your target is to reduce the number of files being loaded from your server, after the application has been deployed, you might merge and compress your files as shown here.
In case you don't want to waste computing time to compress the files on each call, you could adjust your build process to generate them once during build (something like minify).

How to export assets from an .SWF container?

Given is an online swf on Hubworld's site, which loads two configuration XMLs into an .swf file, then displays a game. A copy of the Flash with the two configuration files can be found here. (http://db.tt/zYT9Owg5). If unzipped into a folder, it loads the two XML files and displays everything correctly. The problem is, how to take it apart?
I tried decompiling the file, but it only shows up as a (mostly) empty file with a single symbol and a few misc tags inside it, despite the file itself containing several hundreds of vectors. (http://i.imgur.com/si6gq.png). I severly doubt that any sort of encryption or obfuscation is present, since it's a children's game and I took apart many others without a problem. How could I retrieve the said files from the container?
The swf contains another swf embedded as a ByteArray. I'm not sure why, but this is probably an obfuscation technique.
You can view the actual assets by running the swf in SWFWire Debugger. This application will dump the swf that is loaded from the ByteArray into the same folder as fashion.swf. You can then load this in your decompiler, or SWFWire Inspector if you just want to view the assets.

Saving several images (and metadata for each) in a single file using Adobe Air

Is it possible, via Adobe Air, to save multiple types of data in a single file? For example, an application would allow the user to load in external images, position them on stage and label them. This data would be then be stored in a ByteArray (I guess) using BitmapData for the images and probably XML for the metadata.
I would then like to write this to a single file, with a bespoke file extension that could be associated with said Air app.
I've asked this on various forums and never received a single reply.
You can add everything to a byte array and write it to file - but defining boundaries and extracting individual entities back from the file would take some effort. How about writing them to normal files, zipping them to a single file and deleting the originals? This way you can still have a single file and deal with the individual items more easily.
This article describes some ActionScript zip libraries. I've used nochump in the past and it was easy - this page has some sample code
If you want some individuality for your files, you can rename the zipped file to whatever extension you want - that's what Firefox extensions do, they have .xpi extension, but they're plain zip files renamed.

AIR/AS3: Upload portion of a File without creating a new new File chunk

I'm currently building an AIR file uploader designed to handle multiple and very large files. I've played around with different methods of breaking up file into chunks(100mb) and progressively uploading each so that I can guard agains a failed upload/disconnection etc.
I have managed to break up the file in smaller files which I then write to a scratch area on the disc however I'm finding that the actual process of writing the file is quite slow and chews up a lot of processing power. My UI basically grinds to a halt when its writing. not to mention that I'm effectively doubling the local disc space of every file.
The other method I used was to read into the original file in 100mb chunks and store that data in a byteArray which I can then upload as a POST data using the URLLoader class. Problem is that this way I cant keep track of the upload progress because the ProgressEvent.PROGRESS does not work properly for POST requests.
What I would like to know is if it's possible to read into the file in my 100mb chunks and upload that data without having to create a new file but still using the FileReference.upload() method in order to listen to all the available events that method gives me. Ie. create a File() that is made up of bytes 0 - 100mb of the original file, then call upload() on that new File.
I can post my code for both methods if that helps.
Cheers, much appreciated
I had such problem, but we were solve it in another way, we decided to write an socket connector, which will connect to server (e.g. FTP/HTTP) and write down to socket this ByteArray, and we did it also in chunks around the same size, and the biggest file we had to upload was BlueRay movie around ~150GB.
So I hope you got some interesting ideas from my message, If you'd like it, I could share some piece of code for you.