How do I clear out a Akavache database? - akavache

I am using Akavache for a cache of local objects. I'd like to be able to delete everything in the database (so it is as if it was the first time the program was run). I've seen the Vacuum method, but that only removes old items that have expired. What is the easy way to clean everything up?

#SmartyP and #fenix2222,
I had to do the following to permanently remove the data:
BlobCache.LocalMachine.InvalidateAll();
BlobCache.LocalMachine.Vacuum();
It appears as though InvalidateAll() essentially marks everything as expired, but you still must use Vacuum() to remove the expired items.

Turns out it is right there, I just couldn't see it!
BlobCache.UserAccount.InvalidateAll();
Does the trick!

Related

OrchardCMS duplicated item with same version Number and ContentItemRecord_id

Yesterday, the person in charge of adding content to our OrchardCMS website suddenly got this error when trying to access the Content section in the Dashboard and we can't add any new content any more.
I've imported a bacpac of the database in production and started locally debugging. When trying to access the Content an exception is thrown right here:
And, if we look in the database, the Orchard_Framework_ContentItemVersionRecord table contains a duplicated item with the same version Number, both are "latest version" and they both have the same ContentItemRecord_id.
My concern now is how should we fix this without causing any side effect somewhere else, since I don't fully understand how Orchard manages relations between items, parts, and versions.
Solution proposal:
It seems natural and obvious to manually update the "is latest version" of one of the items to false and increment the version number of the latest one.
Is this solution right or will I cause a side problem?
Have you experienced this before?
Do you know if this is caused by a wrong way of defining the model or something I can do to prevent this from happening again?
Quick answer: it is probably due to double clicking the publish button... Small tip and hack: hide publish button on click...
I remember that happened to me once before, it was ugly situation and a lot of debugging had to be done to find the cause.
The only fix I could find back then was to alter/edit/fix the db data manually.
I must ask
did that error happen once or does it happen all the time?

Clearing Core Data

I am in search of an easy way to clear all data logged into core data model. Please note that I don't want this to happen every time the app is opened. I merely need an easy way to clear test data that has been recorded from a text input. Any ideas? Thank you in advance!
You can delete the installed app from the device. This gets rid of all coredata entries and other saved entries.
There is also a programmatic solution mentioned here Clearing CoreData and all that inside

How to update a field in a post-op plugin?

I have a reason to prefer my plugin to be registered on post-op but I'd need to put something in it (change a field to another value). Do I really have to register it on pre-op or can I shove my update into it despite that the operation has been carried out already?
I'd prefer to avoid firing up an update. The code logic might get a bit crowdy and confusing by that, since there'll be a lot of stuff to do upon a "real" update.
Changes made to the target entity in post-op will not end up in the database unless you run an update manually.
You could consider breaking up your plugin into two. One to change the field in pre-op and one to do whatever it is you're doing in post-op.
Plugins can share data: http://msdn.microsoft.com/en-us/library/gg328579.aspx

_deleted_conflicts in CouchDB?

Using CouchDB 1.0.1.
I have DELETEd some documents, then I PUT some other documents with the same _id as the deleted ones.
Now these new docs have the _deleted_conflicts field:
"_deleted_conflicts":["2-667c9e8e75f8ee51a4ab79ed534622dd"]
It looks like the _rev field of the deleted doc (can't be sure though).
The CouchDB wiki just says "Information about conflicts".
Is this a problem?
Why CouchDB saves this information?
Am I supposed to do something about it?
Thanks,
Giacomo
I'm not sure if this is actually going to be a problem, but it's likely this could come up during replication.
If you want to prevent it from coming up, you should look into the /db/_purge command. This command will remove references to deleted documents, and you can specify a single document ID to affect.
Deleted Conflicts should be regularly purged otherwise a very long history will slow couchdb down significantly (at least for earlier versions of couchdb I used).

SPListItem in FormsLib does not handle blank values

I have a FormsLib with a couple of xml files in there. When I pull up either InfoPath or the standard EditForm and clear out a value on the SPListItem (sync with the xml file) the old value comes back. If I add a space it works. I have tried it via the OM also and the result is the same.
So, for example, if I have a field with the value "Johan" and I pull up the form and clear out that value it still says "Johan" after the update.
Anyone else had any experience with this?
Yes. I have encountered this and the work around I came up with was to add a single space instead of clearing out the field entirely. In my experience though, it only happened if I made the changes in the EditForm. When done in InfoPath, it seemed to work.
Of course, after using " " as my empty value, I had to trim it whenever I needed to check if the field was indeed blank.
I have found an alterntive solution to this issue and I have blogged about it:
http://johanleino.wordpress.com/2009/08/24/node-demotion-does-not-work-with-blank-empty-values/

Resources