realm export objects to JSON - realm

Are realm database files platform independent ? For example, if I copy a realm database file from an iOS device to an Android device, will it work ? I am not able to find this from the docs. I cannot use realm platform for file synchronisation though.
Also, in case the file is not cross-platform, if I want to export the data and import it into JSON, what will be the code for the export ? I can find the import code as mentioned in https://realm.io/docs/swift/latest/#json But I cannot find any way to export the contents of a realm database to JSON (Kotlin/Java and Swift are the languages that I care, if it matters).

I have got an answer from the realm forums. The .realm file can be moved across platforms and it is expected to work. Also, there is no native way to export a realm database to JSON as of now (January 2018) as JSON cannot handle cycles, while realm can.
Forum discussion url: https://forums.realm.io/t/realm-export-import-and-cross-platform-nature-of-the-realm-file/

Related

Electron with realm. <Encryption not enabled>

i made an app with Electron, react, realm.
my OS is windows 10(x64)
and now i meet a problem when i try to use 'encryptionKey ' option.
var realm = new Realm({schema: [CarSchema, PersonSchema], encryptionKey: new Int8Array(64)});
as you can see, i followed Docs.
and my electron app say "Error: Encryption not enabled at Object."
i try to find the reason for 2 days...but still i can't understand.
i use latest electron(ver.1.6.2) and realm(ver.1.2.0)
and i used 'electron-rebuild' to use realm db in Electron.
so, when i check node_modules
node_modules
------|--relam
------------|-- compiled
------------------|-- electron-v1.6_win32_x64_ <--- this is newly added after i use
electron-rebuild.
------------------|-- node-v48_win32_x64
if i don't use encryptionKey option, my app is working well with no problems to use relam DB.
please give me an answer how to fix it.
Encryption and Sync aren't supported on Windows.
This isn't mentioned in the Realm React Native docs, but it's in the Realm Xamarin Docs under Limitations: https://realm.io/docs/xamarin/latest/#limitations-on-windows-desktop-or-uwp

Where is the sqlite data stored when using Ionic SqlStorage?

I'm just curious about the default key-value usage.
import {Storage, SqlStorage } from 'ionic-angular';
let storage = new Storage(SqlStorage);
storage.set(key, value);
storage.get(key).then((value) => { ... });
Where can I find the sqlite file(s)?
I assume I will be able to read/write outside of the app; is that true? Honestly I'm only interested for debugging reasons, so it would be okay if I can only have read access, and only after the app is closed. And I particularly interested on my desktop during development (as opposed to on a device). Do I have to use the backup file option and specify my own path for the database in order to do that?
the documentation states it is stored to WebSQL unless you have installed the SQLite Plugin
First few lines of the documentation...
http://ionicframework.com/docs/v2/api/platform/storage/SqlStorage/
The default database file name within the app storage folder will be '__ionicstorage' per the source here:
https://github.com/driftyco/ionic/blob/f477aa2391922a399acde23bf50ff095b12a287d/src/storage/sql.ts

why realm.io is needs in additional frameworks?

I create app with Realm database (RealmSwift)
When i try build app, there are a lot of errors , experimentally i found several libraries i should link to project for success compilation.
But i don't want to get it for final app version (size of app will very big), what to do ?
These frameworks for example:
CoreVideo.framework
CoreMedia.framework
AudioToolbox.framework
CommLibiOS.a
MediaLibiOS.a
My app doesn't use any video/audo/media features of Realm , i don't know why i need to link it.
If I try to delete for example AudioToolbox.framework from linked list , i have a lot of errors like this:
Undefined symbols for architecture x86_64:
"_AudioComponentFindNext", referenced from:
-[MPAudioUnitEngine voiceAudioUnit] in MediaLibiOS.a(MPAudioUnitEngine.o)
Why Realm needs these libraries?
p.s. sorry for my English
Realm doesn't require linking any of the libraries you've referenced. These must be referenced in your own Xcode project's configuration.
Realm Swift requires the following libraries to be linked: Realm, Foundation & libc++. Following the installation instructions in Realm's documentation should get all this set up properly: https://realm.io/docs/swift/latest/#installation
I suggest you look at some of the Realm example Xcode projects to compare and identify what you may be doing differently. https://github.com/realm/realm-cocoa/tree/master/examples

Database backup Azure Resource Manager

Is there a way in Azure Resource manager to take a copy of an existing database? Currently I know there is a database import option, which points to a bacpac file in Blob Storage and creates a new database from that file, but the process to create the file is a manual one at this point. With that, what is the current process to create bacpacs and put them in Blob storage in an automated way through ARM?
There is a way to specify the createMode of your database in the ARM template. This is very undocumented stuff but I found this in the REST api documentation and then just tried in the ARM template.
You can specify the properties "createMode" and "sourceDatabaseId".
I am not using this functionality because the sourceDatabaseId needs to be in the same subscription which was not the case with me. So i export the bacpac manually and then use an ARM template to import the bacpac (which also is undocumented but I commented the ARM template used here: https://azure.microsoft.com/en-us/documentation/articles/sql-database-import/)

Firebase client on ReactNative

When using Firebase on ReactNative, it will show such error message:
can't find variable process
However, if I require firebase/lib/firebase-web.js manually, it will show:
can't find variable document
How can I resolve this?
I just went through the same issue while trying to use sockets.io in my react native app so hopefully I can help.
The reason that you cannot use firebase's node module is because there hasn't been a polyfill created yet for websockets support (which firebase is dependent on) in react native.
If you take a look at issue #619 in react native's repo you'll find the current discussion on creating a websockets api polyfill.
The way that we solved it is by using Jason's modified version of the sockets library and creating our own repo around just that file. Then we added the line below to our package.json dependencies.
"react-sockets": "crewapp/react-native-sockets-io"
The reason that Jason's version of the sockets.io client file works is because react-native is added as a user agent. You can find the code that makes this change at the top of the file:
window.navigator = {
userAgent: "react-native"
}
Once you've gone through these steps you should be able to require sockets.io / firebase as normal.
Just figuring it our. Pavan's answer is helpful, but it is not quite true when using with Firebase.
For firebase, please follow the steps:
Download the firebase-debug.js from wsExample. Or you can just install wsExample by npm and require the firebase-debug.js inside it.
Use badfortrains's forked React-Native:
"react-native": "git://github.com/badfortrains/react-native#WebSocket"
New the Firebase like this:
var firebase = require("../../firebase-debug.js");
var rootRef = new Firebase(Const.FB_ROOT);
Things should just work now!
I had issues with socket.io on React Native too, solution was to get notifications about new data and if data is big enough - get it by simple RESTfull request. in my case data was small enough to be sent all within notifications API.
I was using GCM service to send notification to phone from nodejs server. BTW, it uses less battery then socket connection and works great :)

Resources