Error Uncaught out off memory when I use persisten object to save data on Blackberry? - blackberry-eclipse-plugin

I use Persisten Object to save data but when I run my application on Simulator, have an error dialog
Uncaught out off memory
and run on real device, it take very long time to load and run.
What did I do wrong? Please help me

The BlackBerry® Persistent Store APIs are designed to provide a flexible and robust data storage interface. With the BlackBerry Persistent Store APIs, you can save entire Java® objects to memory without having to serialize the data first. When you start the application, you can retrieve the Java object from memory and process the information. No size limit exists on a persistent store; however, the limit for an individual object within the store is 64 KB.
The BlackBerry Persistent Store APIs do not provide a relational database model. You must create an effective object model and manage the relationships between objects, as necessary, using indices and hash tables.
sample example of storing persistent data
best practice for persistent storage

Related

How can I store the state of Node.js REST API?

I build an API, which will send data to another API when has been collect 10 hashes. The client sends 1 hash per hour.
For example:
The client POST hash to API
API need to store it somewhere until the hashes number becomes to 10
When the number of hashes becomes 10 need to send data to another API and start from 0 again
My question related to the 2nd point. I can store the hashes in the array, the problem is that the data will be lost when the server will be shut down suddenly.
This is the only data which I need to store in API, so I don't want to use DBS.
By the way, it's my first time of developing API, so will be glad to your help.
Thanks in advance.
Sorry but your only options of storing data are either memory or disk.
If you store data in variables, you're using memory. It is fast and instant but it's not durable as you already said.
If you store data in database, you're using disk storage. It is slower but it is durable.
If you need durability, then database is your only option. Or maybe if you don't want to store the data in your machine, you could use cloud database such as firebase database.
Maybe your problem will be solved with Redis.
I had one feature where I needed to use some user's pieces of information on the server side in runtime and it could not be persisted at the database.
So, I used this.
In simple words, the redis will save the information in your cache and you can retrieve when you need.
There's no disk use and are more stable than a hand made memory control.
I hope this helps you.

Whats the best way to persist state in a node module?

I'm writing an auth module that contains several functions so my server can authenticate with an oAuth2 system using client_credentials. In the module I want to cache / save the credentials since they don't expire for some time (I'll refresh as needed).
Whats the best way to store the credentials?
Should I just create a var at the top of my node module? Should I create a class and instantiate it (const auth = new MyClass()) where my makes subsequent API calls (with the Bearer token)?
Creating a var variable means to store data in RAM, which is not a comprehensive approach.
I suggest you look at Redis, which was developed mostly for your purposes.
Redis is used as a database and for cache, since it’s super fast because the data is stored “in-memory” contrary to other databases in which the data is usually stored “on-disk.”
Moreover, there some thoughts about the fact that Node.js is less efficient at storing data than Redis. This article will clear more about my point.
So, in general, I guess using Redis will bring you more advantages in storing credentials.

Why use SQL/NoSQL DBs over writing your own server side store?

Why use a DB like Redis over writing your own server side key: value JSON - for example?
For objectivity, let's measure value by the following metrics:
Flexibility
Speed
Reliability
Thinking they’re pretty case by case as is. I could structure data, through objects, sets, etc to read/write/query with more flexibility. I’m trying to learn why the feature set of these services are rich enough to warrant plugging them in per operation type i.e. user sessions, shopping cart, recommendations, product catalog, user activity logs, etc. I know, at least, some leverage memory; so, the possibility of them being more performant is nice. But, I have no concrete data yet.
Why not build your own JSON server? For the same reason, you don't write your own operating system. It is always better to use the components which are time tested (even better if they are free).
However, there are other servers to store JSON docs in the market like CouchDB, MongoDB etc. Redis doesn't have native support for JSON, it will store JSON as serialized string.
If you need really fast read/write on complete JSON strings use Redis (fast memory based data structure cache), if you need to query parts of JSON use others JSON stores like Mongo DB etc.
You would need to be more specific about your use-case but even so they would probably close it like this one https://softwareengineering.stackexchange.com/questions/273127/best-strategy-for-storing-static-data-json-file-vs-db-mongo-vs-redis

How to manage >2MB object sizes in node.js

I'm new to node.js - what object size limits do I need to worry about? I have a User object that reaches up to 10MB (stays server side) for user data processing. Are there any special issues I need to manage?
What about breaking it down in setters and getters and use promises to fulfil the requires when needed. I am sure you are not using all the properties at once.

How to Cache Sharepoint Managed Client Object Model based objects?

I need to Cache certain objects which are based on SharePoint Managed Client Object Model like ClientContext, GroupCollection, User , List etc. Initially I tried using Appfabric cache but it gives some issues like "cannot be serialized" . Here my question is "Is it possible to serialize SharePoint Managed Client Object Model based Objects?" .
Next I tried with .NET ObjectCache which actually caches the SP's Managed Client Objects but problem over here is I need a distributed / unified caching technique. As per my knowledge we cant make ObjectCache distributed over multiple hosting servers. Can anyone suggest me a solution or show me light to proceed. Thanks in advance.
SharePoint Client Object Model will not support Object Cache w.r.t the Client objects. That is the limitation in Client Object Model.
You cannot serialize the context or the result of a query. Also a ListItem cannot be serialized. Nonetheless: At least when thinking about query-results the most important information you usually want to know is the content of the fields returned.
So, ListItem.FieldValues is a simple Dictionary<string,object> which can be easily serialized.
You could use this Dictionary in combination with the Listitem's ID to create your own caching mechanism.

Resources