realm

Realm date-query

帅比萌擦擦* 提交于 2019-12-05 22:45:01
问题 In my RealmSwift (0.92.3) under Xcode6.3, how would I // the Realm Object Definition import RealmSwift class NameEntry: Object { dynamic var player = "" dynamic var gameCompleted = false dynamic var nrOfFinishedGames = 0 dynamic var date = NSDate() } The current tableView finds the number of objects (i.e. currently all objects) like follows: func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { if let cnt = RLM_array?.objects(NameEntry).count { return Int(cnt) }

第六章 Realm及相关对象——《跟我学Shiro》

孤街浪徒 提交于 2019-12-05 22:36:15
转发地址: https://www.iteye.com/blog/jinnianshilongnian-2022468 目录贴: 跟我学Shiro目录贴 6.1 Realm 【2.5 Realm】及【3.5 Authorizer】部分都已经详细介绍过Realm了,接下来再来看一下一般真实环境下的Realm如何实现。 1 、定义实体及关系 即用户-角色之间是多对多关系,角色-权限之间是多对多关系;且用户和权限之间通过角色建立关系;在系统中验证时通过权限验证,角色只是权限集合,即所谓的显示角色;其实权限应该对应到资源(如菜单、URL、页面按钮、Java方法等)中,即应该将权限字符串存储到资源实体中,但是目前为了简单化,直接提取一个权限表,【综合示例】部分会使用完整的表结构。 用户实体包括:编号(id)、用户名(username)、密码(password)、盐(salt)、是否锁定(locked);是否锁定用于封禁用户使用,其实最好使用Enum字段存储,可以实现更复杂的用户状态实现。 角色实体包括:、编号(id)、角色标识符(role)、描述(description)、是否可用(available);其中角色标识符用于在程序中进行隐式角色判断的,描述用于以后再前台界面显示的、是否可用表示角色当前是否激活。 权限实体包括:编号(id)、权限标识符(permission)、描述

Problems running Realm: Could not find io.realm:realm-gradle-plugin:0.88.0-SNAPSHOT

故事扮演 提交于 2019-12-05 22:31:18
I am trying to run the example projects from the Realm git repository using Android Studio. I find that when I open any of the example projects I get the following error: Error:Could not find io.realm:realm-gradle-plugin:0.88.0-SNAPSHOT. Searched in the following locations: file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/maven-metadata.xml file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/realm-gradle-plugin-0.88.0-SNAPSHOT.pom file:/Applications/Android Studio.app

Apache Shiro 使用手册(二)

 ̄綄美尐妖づ 提交于 2019-12-05 22:10:30
认证就是验证用户身份的过程。在认证过程中,用户需要提交实体信息(Principals)和凭据信息(Credentials)以检验用户是否合法。最常见的“实体/凭证”组合便是“用户名/密码”组合。 一、Shiro认证过程 1、收集实体/凭据信息 //Example using most common scenario of username/password pair: UsernamePasswordToken token = new UsernamePasswordToken(username, password); //”Remember Me” built-in: token.setRememberMe(true); //Example using most common scenario of username/password pair: UsernamePasswordToken token = new UsernamePasswordToken(username, password); //”Remember Me” built-in: token.setRememberMe(true); UsernamePasswordToken支持最常见的用户名/密码的认证机制。同时,由于它实现了RememberMeAuthenticationToken接口,我们可以通过令牌设置

Realm + NSTableView + NSArrayController

故事扮演 提交于 2019-12-05 21:58:07
i have some Problems with my macOS Application and hope you can help me. Im pretty new on macOS so please be nice ;) A part of the app consists of a simple NSTableView which content is binded to an NSArrayController. The NSArrayController is feeded from a realm database. As you can see there is a checkbox for each row, which should set the bool value in the realm object. The bindings are ok, so if I mark/unmark the checkbox it seems to try writing on the realm object. But since realm needs a active write transaction, which will not be triggered, it crashes. My Question is: How can I write on

Sharing Realm instance between React Native and Android

淺唱寂寞╮ 提交于 2019-12-05 21:39:20
I'm working on a React Native project that uses Realm for React Native. It works without problems but now, I am faced with a problem of writing Android Service that would use the same Realm instance. Is it possible and how would I do that? I think you can communicate from Java to React Native through Native Modules and do your Realm-related code in Javascript as you normally would. Otherwise, Realm for Android's multi-process support for non-encrypted Realms will arrive in Realm-Java 2.0.0 (and that part is actually in with the snapshot), which will most definitely support this use-case; when

How to apply encryption on existing realm database

五迷三道 提交于 2019-12-05 21:38:15
问题 I have an iOS app that use a non-encrypted realm database. Now I would like to apply encryption on that database. Can I just set an encryption key using: Realm.setEncryptionKey(key, forPath: Realm.defaultPath) and then realm will encrypt the existing database? Or do I need to create a new realm database file with encryption and then move the data in the existing database to the new encrypted database? 回答1: You'll have to create an encrypted copy of the unencrypted Realm file, which you can do

Adding RealmSwift as a subproject: Missing required modules: 'Realm.Private', 'Realm'

南楼画角 提交于 2019-12-05 20:44:46
So I wanted to link to RealmSwift in my own framework and these are the steps I took: Add RealmSwift as a subproject Link the framework: Add the dependency Import RealmSwift into the Swift file: And I got the error: Missing required modules: 'Realm.Private', 'Realm' . How can I solve this issue? Thanks! jpsim You'll need to add /path/to/RealmSwift.framework/Frameworks to the “Framework Search Paths” section in Build Settings where /path/to/RealmSwift.framework is the location of the framework. This is because RealmSwift.framework depends on Realm.framework (where the Realm and Realm.Private

Using Realm and LiveData. Converting LiveData<RealmResults<CustomModelObject>> to LiveData<List<CustomModelObject>>

浪子不回头ぞ 提交于 2019-12-05 20:41:57
I am trying out Realm along with Android architecture components including LiveData. I have been following Google's Guide to Application Architecture: https://developer.android.com/topic/libraries/architecture/guide.html ...substituting Room with Realm. I have everything working using: LiveData<RealmResults<CustomModelObject>> from my repository layer right through ViewModel to View. I am thinking it might be nicer to only have more generic types coming back from repository so LiveData<List<CustomModelObject>> rather than LiveData<RealmResults<CustomModelObject>> . Here is a code snippet of

How to close realm opened by Realm.getDefaultInstance?

柔情痞子 提交于 2019-12-05 20:05:44
问题 I am using realm to store and retrieve data. Usually when we open a realm to store some data we do like: Realm realm = Realm.getDefaultInstance(); realm.beginTransaction(); // Copy the object to Realm realm.copyToRealm(myObject); realm.commitTransaction(); realm.close(); in the above case I am closing the realm. But when I am retrieving some data like: RealmResults<MyClass> results = Realm.getDefaultInstance().where(MyClass.class).findAll(); How do I close this realm? Does it need to be