realm

Delete Item from RecyclerView and Realm DB

陌路散爱 提交于 2020-06-12 18:06:52
问题 Image I have an EditText which adds items to this RecyclerView and to the Realm DB. That works fine. The problem is that I don't know how to remove those items from both the RecyclerView and from the Realm DB. Should this be done on the Fragment or on the adapter? And how? Thanks! There is an image on top showing a screenshot of the app. Here is the Fragment where the RecyclerView is: public class FragmentMyList extends Fragment{ private RecyclerView recyclerView; private EditText editTxt;

Delete Item from RecyclerView and Realm DB

坚强是说给别人听的谎言 提交于 2020-06-12 18:04:57
问题 Image I have an EditText which adds items to this RecyclerView and to the Realm DB. That works fine. The problem is that I don't know how to remove those items from both the RecyclerView and from the Realm DB. Should this be done on the Fragment or on the adapter? And how? Thanks! There is an image on top showing a screenshot of the app. Here is the Fragment where the RecyclerView is: public class FragmentMyList extends Fragment{ private RecyclerView recyclerView; private EditText editTxt;

Filtering Realm with nested subqueries

▼魔方 西西 提交于 2020-05-17 07:56:07
问题 My app has data that looks like this. class ShelfCollection: Object { let shelves: List<Shelf> } class Shelf: Object { let items: List<Item> } class Item: Object { var name: String let infos: List<String> } I'm trying to get all shelves in a shelf collection where any items match the query either by name or by an element in their infos list. From my understanding this predicate should be correct, but it crashes. let wildQuery = "*" + query + "*" shelfResults = shelfCollection.shelves.filter(

Unable to generate GlideApp & Glide Requests when using Realm Database in my project in Android

痞子三分冷 提交于 2020-05-15 06:08:49
问题 I was using Glide for images and it was working fine till now. But now when I integrate Realm database in my project it is giving error for generating GlideApp & GlideRequests classes. Main build.gradle buildscript { repositories { mavenCentral() google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.3.1' classpath 'io.realm:realm-gradle-plugin:5.8.0' } } allprojects { repositories { mavenCentral() google() jcenter() maven { url "https://raw.github.com/signalapp/maven

Unable to generate GlideApp & Glide Requests when using Realm Database in my project in Android

好久不见. 提交于 2020-05-15 06:08:32
问题 I was using Glide for images and it was working fine till now. But now when I integrate Realm database in my project it is giving error for generating GlideApp & GlideRequests classes. Main build.gradle buildscript { repositories { mavenCentral() google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.3.1' classpath 'io.realm:realm-gradle-plugin:5.8.0' } } allprojects { repositories { mavenCentral() google() jcenter() maven { url "https://raw.github.com/signalapp/maven

How to display Realm Results in SwiftUI List?

冷暖自知 提交于 2020-05-12 02:55:50
问题 I have been able to save data in a Realm database, but have been unable to show the results in a SwiftUI List . I know I have the data and have no problem printing the results in the console. Is there a way to convert Realm Result into a format that can be displayed on a SwiftUI List ? import SwiftUI import RealmSwift import Combine class Dog: Object { @objc dynamic var name = "" @objc dynamic var age = 0 override static func primaryKey() -> String? { return "name" } } class SaveDog { func

shiro认证授权

梦想的初衷 提交于 2020-05-08 19:08:48
一、shiro基础概念 Authentication :身份认证 / 登录,验证用户是不是拥有相应的身份; Authorization :授权,即权限验证,验证某个已认证的用户是否拥有某个权限;即判断用户是否能做事情,常见的如:验证某个用户是否拥有某个角色。或者细粒度的验证某个用户对某个资源是否具有某个权限; Session Manager :会话管理,即用户登录后就是一次会话,在没有退出之前,它的所有信息都在会话中;会话可以是普通 JavaSE 环境的,也可以是如 Web 环境的; Cryptography :加密,保护数据的安全性,如密码加密存储到数据库,而不是明文存储; Web Support :Web 支持,可以非常容易的集成到 Web 环境; Caching :缓存,比如用户登录后,其用户信息、拥有的角色 / 权限不必每次去查,这样可以提高效率; Concurrency :shiro 支持多线程应用的并发验证,即如在一个线程中开启另一个线程,能把权限自动传播过去; Testing :提供测试支持; Run As :允许一个用户假装为另一个用户(如果他们允许)的身份进行访问; Remember Me :记住我,这个是非常常见的功能,即一次登录后,下次再来的话不用登录了。 记住一点,Shiro 不会去维护用户、维护权限;这些需要我们自己去设计 / 提供

nginx介绍(六)

人走茶凉 提交于 2020-05-05 00:25:48
前言   跨域访问问题, 相信很多人都遇到过, 并且都用不同的办法去解决过. 方法有很多种, 不一一叙述了. 这里主要使用nginx反向代理来解决跨域问题. 啥是跨域   假如你是百度开发人员, 在百度页面去请求谷歌的资源, 算不算跨域?   跨域是指一个域名的网页去请求另一个域名的资源. 只要协议, 域名, 端口中, 有任何一个不同, 都是跨域. 谁限制了我们跨域   罪魁祸首, 是浏览器. 为了安全考虑. 如果一个网站可以随意的访问另一个网站的资源, 那么就有可能在客户不知情的情况下, 出现安全问题.   比如:     1. 用户访问淘宝, 进行了付钱操作, 这时cookie都生成, 存放在浏览器端.     2. 付完钱后, 小伙去看了看苍老师(虽然她要结婚了, 但是不影响嘛)     3. 这时候, 看苍老师的网站, 拿到了淘宝的cookie, 那是否可以替他买东西呢?     4. 如果浏览器不限制, 且淘宝也没有做相应的安全处理, 那么还是有可能替他消费的. 为啥要跨域   前端时间, 公司.net 项目的成员找到我们, 说想访问我们的资源, 希望我们修改配置, 支持他们跨域访问. 那不能拒绝啊, 都是为了工作嘛(主要是没有拒绝的权利嘛)   即使是同一家公司, 都会出现跨域访问的问题, 那我能不让他访问我这边的资源吗? 很明显, 做不到嘛, 那不还是要跨域!  

Nexus 3 搭建 npm 私服 (windows)

*爱你&永不变心* 提交于 2020-05-02 16:08:28
Nexus 3 搭建 npm 私服备忘 下载与安装 在官网下载 Nexus Repository Manager OSS 3.x , 解压至任意位置. 管理员运行 powershell, 切换到 nexus-3.x/bin 目录     $ nexus.exe /install 进行安装, 成功后会提示 Installed service 'nexus     $ nexus.exe /run 运行服务, 第一次要耐心等待很久 添加 npm仓库 以下输入的 Name都是根据自己需求修改 启动服务后 使用管理员账户登录 nexus3: ( http://localhost:8081 , 默认账户密码: admin/admin123) 这里创建一个 npm 组、一个 npm代理(代理到https://registry.npmjs.org/)、一个本地npm 1.创建npm代理 (我们环境使用: https://registry.npm.taobao.org ip:114.55.80.225 ) 2. 创建本地 npm 3. 创建 npm组 4. 配置 node的仓库地址 1) 首先查看 nodejs的默认仓库地址 2) 查看搭建好的 npm私服地址 3) 设置 npm私服地址: http://localhost:8081/repository/npm-group/ 4)

如何降低Realm数据库的崩溃

柔情痞子 提交于 2020-04-30 18:34:59
云栖号资讯:【 点击查看更多行业资讯 】 在这里您可以找到不同行业的第一手的上云资讯,还在等什么,快来! Realm的崩溃,猝不及防,不仅仅是Realm,任何数据库导致的奔溃总是个难题,总有那么零星几个让人没有头绪的bug。 本文提供了一个思路来解决Realm数据库崩溃问题 代码部分见重点内容,Java等其他平台也可参考。 谨记以下几点: Realm的数据写入是同步阻塞的,但是读取不会阻塞 Realm托管的对象是不可以跨线程的,即不同线程是不可以修改彼此的对象的 Realm托管的对象的任何修改必须是在realm.write{} 中完成的 Realm 采用了 零拷贝 架构。 尽量少使用写入事件少量事件,可以尝试批量写入更多数据 将写入操作载入到专门的线程中执行。 推迟初始化任何用到 Realm API 属性的类型,直到应用完成 Realm 配置。否则会崩溃。 官方明确的限制: 类名称的长度最大只能存储 57 个 UTF8 字符。 属性名称的长度最大只能支持 63 个 UTF8 字符。 Data 和 String 属性不能保存超过 16 MB 大小的数据 每个单独的 Realm 文件大小无法超过应用在 iOS 系统中所被允许使用的内存量——这个量对于每个设备而言都是不同的,并且还取决于当时内存空间的碎片化情况(关于此问题有一个相关的 Radar:rdar://17119975)