[英]What is the best way to store text data in a file/files so it can be used in various platforms?
I'm developing a knowledge base java application, where I can store and retrieve annotations with its title, date when the note was created (SQL datetime), content, tags about the annotation, etc. 我正在开发一个知识库Java应用程序,可以在其中存储和检索带有标题,注释创建日期(SQL日期时间),内容,有关注释的标签等的注释。
It can be done easily with a database (I'm using SQL Server 2014), but the main problem is that the server is running on my own PC and it has to be always on and running the SQL Server. 使用数据库可以轻松完成此操作(我正在使用SQL Server 2014),但是主要问题是服务器正在我自己的PC上运行,并且必须始终在运行SQL Server。 Also, I would like to extend the application by storing and retrieving this kind of data on mobile apps for Android and iOS.
另外,我想通过在Android和iOS移动应用程序上存储和检索此类数据来扩展应用程序。
Is there any other way to store that type of data in some files so it can be uploaded to some cloud storage like Dropbox ? 还有其他方法可以将这种类型的数据存储在某些文件中,以便将其上传到Dropbox等云存储吗? After storing it on Dropbox, all I would have to do is sync the app with dropbox, get the files and read/write stuff.
将其存储在Dropbox之后,我要做的就是将应用程序与Dropbox同步,获取文件并进行读/写操作。
UPDATE: Thanks for all the answers they helped me a lot. 更新:感谢您提供的所有答案,他们对我有很大帮助。 The best solution for me is to replace SQL Server with SQlite, as Gabe Sechan commented.
正如Gabe Sechan所说,对我来说最好的解决方案是用SQlite替换SQL Server。 Now I can make changes on the database without the need of a server running 24/7 and I can use the same database on Android and iOS apps.
现在,无需运行24/7的服务器就可以对数据库进行更改,并且可以在Android和iOS应用程序上使用相同的数据库。
You can use just a basic ajax call to pull content from a Dropbox "public" URL. 您可以仅使用基本的ajax调用从Dropbox的“公共” URL中提取内容。
function(contenturl,intoselector,callback){
if (contentwindow.currenttopic!==contentID){
jQuery.ajax({
type:'GET',
url:'//www.corsproxy.com/'+contenturl,
dataType:'text',
async:true,
success:function(data){
intoselector.html(data);
if (jQuery.type(callback)==="function")
callback();
}
});
}
Notice that this example pulls through corsproxy so that you don't receive any XSS errors, so the url you pass needs to not contain a protocol itself. 请注意,此示例通过了corsproxy,因此您不会收到任何XSS错误,因此您传递的url本身不必包含协议。
If you want to pull a JSON or XML string that is stored in the file, then you might need to play around with the dataType and contenttype options in the ajax call. 如果要提取存储在文件中的JSON或XML字符串,则可能需要在ajax调用中使用dataType和contenttype选项。
This can also be done using Google spreadsheets: 也可以使用Google电子表格来完成此操作:
Reading: 读:
Writing: 写作:
Of all the cloud services, when it comes to Android, Dropbox's Sync API is one of the easiest to implement. 在所有云服务中,就Android而言,Dropbox的Sync API是最容易实现的之一。 Do you need specific code examples on how to sync with Dropbox?
您是否需要有关如何与Dropbox同步的特定代码示例?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.