persistence

How to properly implement a custom session persister in PHP + MySQL?

泪湿孤枕 提交于 2019-12-04 02:11:54
I'm trying to implement a custom session persister in PHP + MySQL. Most of the stuff is trivial - create your DB table, make your read/write functions, call session_set_save_hander() , etc. There are even several tutorials out there that offer sample implementations for you. But somehow all these tutorials have conveniently overlooked one tiny detail about session persisters - locking . And now that's where the real fun starts! I looked at the implementation of session_mysql PECL extension of PHP. That uses MySQL's functions get_lock() and release_lock() . Seems nice, but I don't like the way

Android persistence alternative to SQLite

旧街凉风 提交于 2019-12-04 00:56:00
Is there any other alternative to SQLite in Android for persisting data in the phone? I am looking something like iOS coredata or something simpler like a key-value store. If we need to embed it with the apps, something that is relatively small in size is also great. Thank you for your assistance. If you need just a simple store for a couple key/value pairs, SharedPreferences is the way to go. If you are looking for something more powerful, that compares to Core Data, you should give greenDAO a try. Like Core Data, greenDAO a layer between your objects and the data store (Core Data on iOS

Simple, modern, robust, transparent persistence of data structures for Perl

风流意气都作罢 提交于 2019-12-04 00:27:23
I'm looking for a solution to transparently persist Perl data structures (not even objects, but object support would be a plus) without circular references. I don't care that much about the backend, but I'd prefer JSON. The number of objects would be relatively low (a few thousands of hashrefs with about 5 keys each). By "transparent" persistence I mean that I don't want to have to commit changes to the storage backend every time I update the in-memory data structure. Here's how the code would ideally look like: my $ds; ... # load the $ds data structure from 'myfile' print $ds->{foo}->{bar}; #

Oracle thin driver vs. OCI driver. Pros and Cons?

ぐ巨炮叔叔 提交于 2019-12-03 22:57:41
When you develop a Java application that talks to oracle DBs, there are 2 options right? One is oracle thin driver, and the other is OCI driver that requires its own installation (please correct if I'm misunderstanding). Now, what are the pros and cons? Obviously thin driver sounds much better in terms of installation, but is there anything that OCI can and the thin one can't? Develop environment is Tomcat6 + Spring 3.0 + JPA(Hibernate) + apache-DBCP The choice of the driver depends several factors. The nature of your calls to database (e.g. it seem like your app won't be using lots of stored

How to Represent Composite keys in Hibernate using Annotations?

放肆的年华 提交于 2019-12-03 22:48:40
So I reverse engineered some tables from my db and when I try to save my object to the db I get the following error: Initial SessionFactory creation failed.org.hibernate.AnnotationException: A Foreign key refering com.mycode.Block from com.mycode.Account has the wrong number of column. should be 2 Exception in thread "main" java.lang.ExceptionInInitializerError The Domain objects Are Block which contains a number of Account Objects: @OneToMany(fetch = FetchType.LAZY, mappedBy = "Block") public Set<EAccount> getAccounts() { return this.Accounts; } Account has a Composite key of Id and Role.

Writing Maven Dependency for javax.persistence

╄→гoц情女王★ 提交于 2019-12-03 22:28:51
Can someone help me write the dependency for javax.persistence . I have googled it but nothing worked. I bumped into this page that gives some details on how to write the dependency, but yet i am unable to write it. Can someone help me out? LeChe This is the one for javax.persistence : <dependency> <groupId>javax.persistence</groupId> <artifactId>persistence-api</artifactId> <version>1.0.2</version> <scope>provided</scope> </dependency> and this is for the whole Java EE 6 stack: <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided<

How can I access Java heap objects without a reference?

随声附和 提交于 2019-12-03 21:47:16
问题 I would like to get a reference to all objects in the Java heap, even if I don't immediately have a reference to those objects in my active thread. I don't need non-referenced objects (those "queued" for garbage collection), but would like to get anything that's still in use. The goal is to serialize and store all the objects to implement a poor-man's persistence of execution state. I realize that the rabbit hole goes deep when it comes to different types of transient state, but simply

Hibernate like layer for C++

旧城冷巷雨未停 提交于 2019-12-03 17:49:58
问题 Using a DB with C++ is a real mess and it was refreshing when I moved to Java to be able to use a unified system to abstract the whole layer away (aka Hibernate). There are a couple of C++ abstract layers for DB's out there but they are usually vendor specific and only a thin layer that wraps the real C API. Has anybody come across something more like hibernate for C++ or know of a group or open source project that is looking at this problem domain. 回答1: I don't know of any C++ library like

Best way to implement “Remember Me” check box in WinForms / WPF

核能气质少年 提交于 2019-12-03 17:18:46
I want to add a "Remember Me" check box to the login form of my WPF App. What's the best way to do this? Currently the app logs in via a websevice call that returns an authenticated token that it uses for subsequent calls. Should I simply two-way encrypt and store this token somewhere in the files system? You could also store it in Isolated Storage or create a User setting in your application's Settings. Edit: Oren's suggestion of using DPAPI to protect information is well and good, but it doesn't store anything: An important point to remember is that DPAPI merely applies cryptographic

Persistent memoization in Python

做~自己de王妃 提交于 2019-12-03 17:15:38
问题 I have an expensive function that takes and returns a small amount of data (a few integers and floats). I have already memoized this function, but I would like to make the memo persistent. There are already a couple of threads relating to this, but I'm unsure about potential issues with some of the suggested approaches, and I have some fairly specific requirements: I will definitely use the function from multiple threads and processes simultaneously (both using multiprocessing and from