Cordova - Zip files and folders on iOS [closed] - ios

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am using Cordova to create a mobile application on iOS. I want to upload multiple files to server but instead of sending them one after another. I want to compress these files into one '.zip' file and upload it to server.
I searched for a Cordova plugin, but I found only these plugins that doesn't solve my problem:
Icenium/cordova-plugin-zip to zip and unzip files on iOS but there is no documentation or example about how using it.
jjdltc/jjdltc-cordova-plugin-zip to zip and unzip files on Android platform only.
Please, help me to find a plugin that zip files and folders on iOS, or give me an example about using the first plugin.

We have managed to unzip, modify and zip back files using the JSZip javascript API and the cordova file plugin. It should also work to create a zip from scratch. There isn't a real need to use native code for the zipping action (although it is most likely faster), only to read the files to zip and write the zip file. Hence, it is fine to use a javascript API that wasn't designed for cordova in particular.
Process
If you want to try the JSZip + file plugin method, here is a quick outline of how we worked with it :
We use the file plugin to read files as binary. If you are lucky enough to have only text files, you could read as text too, but it's less flexible that way. Note that to read the files, you will need to obtain the File object from their FileEntry which will require navigating in the file system using DirectoryEntrys. If you aren't familiar with the file plugin, take a look at its documentation to do this step.
We create a JSZip object.
Manipulate the JSZip object as you want it. You can create folders within the zip, add files, remove some, modify some content. As you see fit. Their documentation gives simple and good examples.
Generate the zip binary content using the JSZip JSZip#generate() method, specifying the type. If you want to create an actual file with it, we noticed that string and arraybuffer could be written with the file plugin's write method (after creating the file) without code to convert it on iOS, but not uint8array (and we didn't try the other generation types).
Treat the binary as you wish. It is the same as if you had read the binary of an actual zip.
PS: The file plugin has some outdated documentation on cordova.apache.org. While the examples in it can be useful, be aware that some of those are not valid anymore. For instance, resolveLocalFileSystemURI() is now resolveLocalFileSystemURL().

Related

Updating .stringsdict localization files over-the-air

I'm looking for a way to update stringsdict localization files over-the-air without having to release a new version in the appStore. So ideally I want my stringdict files on a webserver, and the iOS app should download these files from the website and update the local strings.
After doing some research, I realized that we cannot update files in the bundle it was shipped in however I found some reports saying we could store/load localizations in/from the application support folder.
source #1
source #2
source #3
Can this also be applied to stringsdict files because I'm trying but no success so far.
Basically you need to create a .bundle with your new strings and make your app download it. After that, I think it's possible to create a NSBundle object using your freshly downloaded translations and swizzle a couple of methods from the main NSBundle currently used by the system.
I've tried something similar, but found out that it's much easier to integrate an existing service such as Smartling or Lokalise. They already have an SDK that allows you to update your translation over the air.
Also I found it's much easier to manage all my translations there.

How to install and use VerySimpleXML in Delphi? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am new to Delphi and I need help in how to install VerySimpleXML. I would also greatly appreciate a tutorial on how to use it to convert html to xml, if you guys know where I can find such a tutorial.
I've downloaded the VerySimpleXML and it is a single pas file, so there's nothing to install.
To make this unit available to your project(s) you basically can:
Put the file anywhere in your disk and add the file to every project where you want to use it. To add the file to the project use ShiftF11 or via menú in Project/Add to project
Put the file anywhere in your disk and then add that folder to your Delphi library path, globally in Tools/Options/Delphi Options/Library/Library Path.
Put the file anywhere in your disk and then add that folder to your Project search path, in Project/Options/Delphi-Compiler/Search Path.
Put the file in the same folder where your project (dpr) file resides
Once the file is available to the project, you just add Xml.VerySimple to your uses clause in any unit you want to use it, for example:
Unit myUnit;
interface
//whatever
implementation
uses Xml.VerySimple;
The download comes with an example that you may study to learn how to use it.

Get apk file icon, version, name in delphi

Is there a way I can get application name, application version and application icon, for the package that is not yet installed by delphi?
*.apk files are basically zip files, so you can have a look at the single resources at least to get the app icon. The ApplicationManifest.xml is howewer compiled into some binary format, so this might be a bit harder to decode (but there are answers that show code for that task as well here: How to parse the AndroidManifest.xml file inside an .apk package).

BlackBerry - Unpack Zip File

I'm developing a BlackBerry application in which I need to unpack a zip file compressed with PKZIP. The package could have one file in it, or it could have 10; it will vary in each case. I know that the BlackBerry API has native support for GZip and Zlib, although I'm pretty sure that these methods aren't going to be helpful in my case. It doesn't look as if I can extract the individual files using these calls.
I've tried JZlib (http://www.jcraft.com/jzlib/), which compiled fine, but again it doesn't look as if the methods contained therein are going to allow me to pull the individual files.
It appears as if this is possible, as there's an application called Ziplorer (http://www.s4bb.com/software/ziplorer/) that claims to do perform this exact procedure. How they're doing it, however, escapes me.
So here I am after hours of Googling. I'm welcoming any insight into my problem with open arms.
"zip" algorithms are typically offshoots of the Lempel-Ziv-Welch algorithm. They are a fairly efficient stream compression algorithms, but because of how they function, you can't start to decompress at random points in the file, you have to start from the start.
Any product that claims to be able to decompress one file from a zip still has to decompress everything before it in the zip file in order to know how to decrypt the given file, or even, for that matter, where the file is in the archive.
If you can tolerate GPL code in your application, then this library http://jazzme.sourceforge.net/ that might work. However the project (and its parent project http://sourceforge.net/projects/jazzlib/) don't look like they're being developed.

J2ME Properties

J2ME lacks the java.util.Properties class. Although it is possible to put application settings in the JAD file this is not recommended for many properties. (Since, some platforms limits the size of JAD file.) I want to put a configuration file inside my jar file and parse it. And I do not want to go with XML because it will be overshooting for my case.
Question is, is there an already existing library for J2ME that can parse properties files or something similar such as INI file. Or would you recommend another method to solve the initial problem?
The best solution probably depends on what is going to be generating the properties files.
If you've got other non-JavaME projects using the same properties files, then stick with them, and write or find a parser. (There is a simple one from GoBible available on Google Code)
However you might find it just as easy to keep your configuration as static final String myproperty="myvalue"; in a Configuration.java file which you compile, and include in the jar instead, since you then do not need any special code to locate, open, read, and parse them.
You do then pick up a limitation on what you call them though, since you can no longer use the common dot separated namespacing idiom.

Resources