Flex unzip/uncompress huge files - apache-flex

I am having an AIR applicaiton which is supposed to uncompress the file of huge size (>1GB)
I tried commonly discussed utilities i.e. FZip nochump and few more
I face the same problem with all of them,
They tyr to unzip the entire file in the memory (using ByteArray.defalte method)
This works well with the files of small size howevre they just hang the applicaiton if the size of the file is big (>1GB)
Any suggestions?

Is there not a way you could use file spanning similar to the RAR formats. I think 7-Zip's 7Z supports it also. Depending on how to the decompression library is implemented, file spanning could reduce the memory usage theoretically.
Try looking into using the LZMA SDK a la 7-Zip:
http://www.7-zip.org/sdk.html
Maybe there's Flex bindings.

I agree with sammy, Air it's not the best solution for a task like that, IMHO it's better to include in your distribution a native utility to expand your files (remember that you need an utility for each platform that you want to support) then use the new Air2 API to invoke them. Doing this way the expansion of the archive is done in a separate process without freezing your app.
Maybe you can boundle just one utility if you are sure that every platform has a common runtime (ex. java).

Related

How to convert mbtiles to .osm.pbf

I'm writing a Qt application that is supposed to show a geo-map of a specific geographical region in one of its views on top of which I need to be able to draw various other graphical elements.
The requirements are that all the map-tiles must be pre-downloaded for off-line use as during the use of the application there will be no internet connection.
After lengthy search for a suitable library that I could link into my Qt project that would support my needs (off-line tile loading, rendering and painting the map in Qt framework, non-QML only C++ integration) I thought libOsmScout would do the job.
However, I have managed to download .mbtiles files for my region from OpenMapTiles just to realise that libOsmScout cannot natively work with .mbtiles.
The library can only work (indirectly after "import") with .osm.pbf files.
(http://libosmscout.sourceforge.net/tutorials/importing/)
I've searched extensively the web but all the results were pointing to conversion procedures in the opposite direction, i.e. into the .mbtiles.
So my question is: is it possible to convert .mbtiles files to .osm.pbf format so I can then import it into libOsmScout compatible internal set of files?
If it is possible, what the process?
Any help or guidance would be much appreciated.
Thanks.
Easiest way is to use ogr2ogr to convert to pbf format.
ogr2ogr -f MVT output_dir_name input.mbtiles -dsco MAXZOOM=2
This will create a directory structure with each zoom level having a directory and pbf file named according to the tile position.
Or
using this tool called MBUtil.
There are some steps which you can follow from the github repo.
After that, you can then use the following command to convert to directory structure with each tile in pbf format.
mb-util input.mbtiles output_dir_name image_format=pbf
where tiles is the directory name you want

Writing a custom Qt Location GeoServices plugin to use geo-referenced image file as map source

I'm currently working on a Qt Quick application that will provide a map viewer for a smallish area (1 square KM or so), the map details for which will be provided in a single geo-referenced image file (GeoTIFF, geo-referenced PDF, ESRI Shape file etc.), along with display of current location, operator identified points of interest etc. It's primarily responsibility is the display of custom maps (as opposed to generic maps retrieved from public map image service providers (OSM, MabBox, ESRI etc)), and it will often be used in areas with limited connectivity
An extensive web search has identified others who have made similar enquiries in the past (here, Qt forums etc), and the general suggestions for solutions are as follows:
ArcGIS Runtime with Qt SDK Doesn't work for me as down the track I'm intending to target an embedded linux device using an ARM processor, and ArcGIS doesn't make source available for cross-compilation for arbitrary targets. They've recently produced an Android release, but nothing for ARM linux in general)
QGIS developer libraries GPL licence not compatible with my commercial development
Use the Qt Location Map component with a local tile server or offline tile collection (some plugins have recently introduced support for this) Seems a bit of a hack, as noted I'm primarily using custom maps, as opposed to offline copies of public map server images, and my images won't be big enough to really warrant tiling otherwise
It would be feasible to develop a Qt Quick component from scratch to do this, but given that the existing Qt Location Map component provides a well defined pre-existing front end interface for everything my map would need to do and has an extendable plugin based architecture, writing a custom Qt Location GeoServices plugin seems the most sensible and elegant way forward.
I've started examining the source code of the existing plugins, but can't shake the feeling that in a world containing 8 billion people, with "nothing new under the sun", this would have been done already if it was a good idea....
Would anyone with more familiarity with the Qt Location module care to comment?
Since geo-referenced images can be arbitrarily large, it is the standard to convert them into a tile pyramid, to be able to efficiently display them on any hardware (at the cost of doubling the size, at worst, depending on how many layers you want).
Even if you would write your own geoservice plugin, you most likely will end up (directly or by using 3rd party code) tiling your geotiff.
This said, QtLocation does allow you to use custom tilesets ( http://doc.qt.io/qt-5/location-plugin-osm.html, look for osm.mapping.custom.host) served in most ways (http, https, file, qrc, etc.).
So go ahead, fire up QGis, install the QTiler plugin, and convert your images.
If you need to serve these pictures over the net directly to the clients (thus needing to do the conversion on the client), you can either see what QTiler does, or build up your gdal pipeline (gdal_translate, gdalwarp and gdal2tiles), and ship the relevant gdal bits with your application.
If you need multiple images at the same time, you can either use multiple Plugin elements with different plugin parameters, or you can fork the osm plugin and support multiple custom hosts.
Based upon Paul's response, and a couple of similar responses to the same enquiry on Qt forums and mailing lists, plus my own investigation, I'd conclude the following:
Generating a custom Qt Location GeoServices plugin to directly provide map imagery from a geo-referenced image file would not be a great idea as the implementation would be less than straightforward, and in practice any non-trivial map image would likely be large enough that an initial tiling step, followed by use of one of the standard tiled mapping plugins referencing a local tile set would be more appropriate anyway.

CSS-precompiler LESS and/or SASS

Is there a way to avoid working with the command-line installing and using LESS??
There are several offers for GUIs for the compiling-phase, but I did not find a way for the Installation-Phase.
I have been working in the IT-business for so many decades (more in the mainframe and midrange area and as a project-manager and programmer in the application development) and could by now avoid to go as far down to the command-line-world.
I did develop quite fine Websites using HTML5 and CSS3 and doint this I felt a desire for all that, what LESS and/or SASS are offering and the Syntax and logics dont look difficult to handle. But I fail in the first step of just installing it.
The LESS-Website offers command-lines to key in. But I am not sure, if this will be all I have to key in, but only the significant line to be embedded in a sequence of other commands very familiar to all those working at this Level.
How do I e.g. define the place to store the Installation and to refer to in the href in the link-Statement of my html-file .... ??
Thanks
Gerhard (from Vienna/Austria, living in Trier, Germany)
Less is a CSS pre-processor. if you are include less.js in you html page
You can use less directly in to your html page.
Other ways you can use less compiler
Kola this is an open source application it will help you to compile less to css
Your Topics are clear to me. I even downloaded Koala already and I have no Problem in including less.js in my html. And I have read Bass Jobsens book about the Syntax, which does not seem to raise great Problems to me.
But before working with it, I will have to download LESS -what I have done from the Less-Website to the Folder of my choice. My Problem is the next necessary step: To install this downloaded program. There is no install.exe or something like that. The book as well as the info in the less-Website tell me to key some crpytic commands into the command-line.

How to reduce the building time for a Qt program

I have a Qt project which will take around 15 mins to build the program. Each time when I make a small modification I have to wait for long time.
Is there a method to reduce this build time? Or is there a way to "make only the file which I had modified" and then execute the program?
Well check whether your are rebuilding in all your program runs. And also whether you are cleaning your project before running it. Because if you do so, it have to regenerate all those moc files and output[.o] files needed for execution.
But normally upon a small change, the build doesn't take too much time. I have been developing a project by qt creator, it doesn't take too much time while building upon a small modification. But if there is clean/rebuild step while every execution, it will definitely take whole build time. And again even if you manually build your project via terminal without the help of IDE, it won't take that much time provided you don't remove the moc files and .o files manually before building after small modifcation.
If you are using qrc in your app and there are many files in it, it takes too much time to generate qrc.cpp and qrc.obj files. So try to minimize the number of files in qrc system and also try to minimize the sizes of each file.
As far as I know, usage of precompiled headers may help, but effect of that may varay according to you program structure.
The general C++ ways to reduce compile time apply. Don't #include what you don't need. Use class declarations instead of #include'ing the definitions if possible. etc.
It depends where you do that small modification: if you modify something in a header that is included pretty much in every file in your project...
Additionally to above responses, if you work with linux, check out ccache (https://ccache.samba.org/)

Looping OGG files with Adobe Alchemy

I'm trying to use Adobe's OggVorbis library. But I can't seem to get the Sound object to loop.
I even tried looping the _sound object inside the AudioDecoder.as in the "com.automatastudios.audio.audiodecoder" package.
Do you really have to reload the file and stream it over and over?
If you're streaming, then yes you'll have to jump back the beginning of the stream. A stream, by definition, is a constant link to the server and does minimal loading of files locally.
But, if you're not really streaming, you should have no problem loading up a file and caching it locally then playing it over and over.
Since you mention Alchemy, there may be other unknown issues if you're trying to use a converted C library, as opposed to native ActionScript.
[Note; I didn't know the OggVorbis library for Flex before now].

Resources