realm

shiro自定义Realm(数据源)

 ̄綄美尐妖づ 提交于 2019-12-05 10:54:10
2.1一样先导包 <!--使用shiro需要先导包--> <dependencies> <!--shiro的核心包--> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-core</artifactId> <version>1.4.0</version> </dependency> <!--日志包--> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.2</version> </dependency> <!--测试包--> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.9</version> </dependency> </dependencies> 2.2准备自定义Realm 写一个Realm,继承 AuthorizingRealm 提供了两个方法,一个是授权 doGetAuthorizationInfo ,一个是身份认证 doGetAuthenticationInfo (准备个MyRealm.java文件,填写如下内容 )

realm in Xamarin, System.EntryPointNotfoundException when trying to use realm

二次信任 提交于 2019-12-05 10:38:29
I have installed realm in a Xamarin app and when I try to use an object (count, write, etc) it gives me a System.EntryPointNotFoundException . Below code: _realm = Realm.GetInstance(); _realm.Write(() => { var myConfig = _realm.CreateObject<Config>(); myConfig.Email = ""; myConfig.User = ""; }); System.EntryPointNotFoundException: shared_realm_begin_transaction at at (wrapper managed-to-native) Realms.NativeSharedRealm:begin_transaction (Realms.SharedRealmHandle) at Realms.Transaction..ctor (Realms.SharedRealmHandle sharedRealmHandle) [0x0000d] in :0 at Realms.Realm.BeginWrite () [0x00000] in

Writing and reading between threads with Android Realm

半城伤御伤魂 提交于 2019-12-05 10:33:40
I'm performing some investigation of Realm threading and encountered issue. In this simple example I have 2 Thread objects, one for writing and second one for reading. The reader Thread gets count of written objects always as 0, but inside writer scope the size() for items in DB is correct. When I relaunch app, the reader gets the first count ok before any insertions. Thread writer = new Thread() { @Override public void run() { while (mRunning) { try { Realm r = Realm.getInstance(context, "test_db"); r.beginTransaction(); TestData data = r.createObject(TestData.class); r.commitTransaction();

centos6.3 svn服务器配置自动同步web

China☆狼群 提交于 2019-12-05 10:21:29
1.创建项目 mkdir -p /home/web svnadmin create /home/web 2.更改配置 cd /home/web/conf vi passwd 找到[users] 添加以下内容 testuser=123456 vi authz 最下面添加以下内容 [/] testuser=rw vi svnserve.conf 找到下面几个去掉前面的#,并把第一个改成 none ,第5个改成你的svn目录 anon-access = none auth-access = write password-db = passwd authz-db = authz realm = /home/web 3.启动svn服务 svnserve -d -r /home/web 4.客户端svn://你的ip 5.自动同步 cd /home/web/hooks vi post-commit #!/bin/sh export LANG=zh_CN.UTF-8 svn co svn://你的ip /home/web 保存退出 6.赋予post-commit执行权限 chmod +x post-commit 7.执行svn 回到根目录 svn co svn://你的ip /home/web 接下来会要求你输入root密码,svn 账户名,svn 密码,最后问你是否保存,选择保存 8

Create a realm object during a Realm Migration

跟風遠走 提交于 2019-12-05 09:56:52
Are you able to create a realm Object during a migration? I am wanting to extract part of an existing realm object and create a new object with that data, but the migration always hangs up. Here is my migration code private class var migrationBlock: MigrationBlock { return { migration, oldSchemaVersion in if oldSchemaVersion < 1 { print("Shema Version 0") migration.enumerate(Transaction.className(), { (oldObject, newObject) -> Void in let oldDate = oldObject!["date"] as! NSDate let newTransactionDate = TransactionDate() newTransactionDate.date = oldDate try! Realm.getRealm().write { Realm

Optional Int in Realm

六眼飞鱼酱① 提交于 2019-12-05 09:47:26
问题 I am trying to use an Optional Int in Realm and am getting an old error I think. Code dynamic var reps: Int? = nil Error 'Property cannot be marked dynamic because its type cannot be represented in Objective-C' I am using Realm 0.96.1 with XCode 7.1 I understand in the Realm documentation it says the Int isn't supported as an Optional but https://twitter.com/realm/status/656621989583548416. That is from the Realm twitter so thats why I am confused. Are Optional Int supported or still no? 回答1:

How to sort using Realm?

扶醉桌前 提交于 2019-12-05 09:40:08
问题 I don't know how to sort using Realm. My current code is. data = realm.objects(WorkoutSet) data = data!.sorted("date") I want to sort date an Int from high numbers to low numbers. The docs need more information and the GitHub link throws a 404 message. 回答1: You can add an ascending parameter to the sorted method: data = data!.sorted("date", ascending: false) This sorts your WorkoutSet using the date field in descending order. Update With Swift 3 and the latest RealmSwift version this has now

Gson deserialization for Realm list of primitives

十年热恋 提交于 2019-12-05 09:17:28
I am using realm with gson. I have a modal which has a list of int type field. Realm does not support currently list of primitives. To solve this there is a solution. I created my RealmInt class. import io.realm.RealmObject; public class RealmInt extends RealmObject { private int val; public int getVal() { return val; } public void setVal(int val) { this.val = val; } } I have a big modal object something like that.. public class Product extends RealmObject { @PrimaryKey private int productID; private int priority; private boolean isFavourite; ..... ..... ..... private RealmList<Document>

How to fake Realm Results for tests

冷暖自知 提交于 2019-12-05 08:47:49
I have written a test to validate if a function is called : func test_getTaskLists_doNotCreateOrUpdateTaskListToStorageWhenSynchedLocally() { ... let (datasource, restAPI, fakeTaskListStorage) = ... datasource.getTaskLists() { (taskLists, error) -> Void in ... XCTAssertEqual(1, fakeTaskListStorage.readAllInvocationCount) ... } ... } The function is mocked to bypass super implementation and the issue is that the function returns a Results which I can't figure out to build/mock in order to return a valid object so the compiler stops complaining...I know I could just call super.readAll() but here

Why is it recommended practice to store images on disk rather than in a Realm

蓝咒 提交于 2019-12-05 08:13:23
I am using Realm as the database solution for my app. I need persistent storage ability for my images so I can load them when offline. I also need a cache so I can load the images from there rather than fetching them from the API each time a cell draws them. My first thought was that a Realm database could serve both of these functions just fine if I were to store the images in Realm as NSData. But I have found two answers on SE ( here and here ) that recommend not doing this if you have many images of a largish size that will change often. Instead they recommend saving the images to disk, and