Saving Unity GUI fields - csv

I'm new to Unity's native GUI (used to use NGUI / iGUI) and was wondering whether you can have fields or input from the native UI save to a CSV file? If that is possible, can you have multiple iterations of a build open and have OnButtonDown, an entry saved per user to the same csv file?
Literally just wanting to know whether Unity UI has that capability.
Cheers!

That wouldn't be a Unity feature or even a UI feature, but if you design your program correctly (single access to the file at one time, append instead of overwrite), then yes, you can get the functionality that you want.

Related

How to save data with JSON in a Xamarin app?

Good day dear developers, I really need your help. I want to make an app in Xamarin. In which I added some text data, and it is saved in this application. I need this information to be in the application, and I could get it without the Internet. I understand that you need to use JSON. I really want you to at least give a little hint on how I can store information using JSON in my Xamarin application. Thanks a lot!)
I tried to find information on Google, but there is a lot of superfluous and inappropriate
Depending on your data an easy way could be to use Preferences from Xamarin.Essentials which allows you to store key/value pairs: link to description
Another option would be to save files with JSON as you mentioned already. You create a class which holds your data and then serialize/deserialze the objects to files and from files. For this you can use the Newtonsoft.Json which is a nuget package that you can install.
If you have a MyData class and an data object it would look like this:
Serialize:
File.WriteAllText("fileName", JsonConvert.SerializeObject(data));
Deserialze:
var myData = JsonConvert.DeserializeObject<MyData>(File.ReadAllText("fileName"));
Different platforms has their own file system. For example, iOS limits our access to the file system, which is called Application sandbox. To save or load files, you could learn some basic info first:
for iOS, refer to File system access in Xamarin.iOS.
for Android, refer to File Storage and Access with Xamarin.Android
Xamarin forms provides several ways to use Xamarin forms local data storage. First is use File Handling just as Mario K mentioned. For Serializing JSON, you could refer to Serializing JSON.
Another is that you could use SQLite database engine which allows Xamarin.Forms applications to load and save data objects in shared code. More info, you could refer to Xamarin.Forms Local Databases.
I think you could first check these documentation and decide which method you prefer to use. If you still have questions, feel free to ask.
Hope it works for you.

AS3 Sending a Shared Object

I'm working on an application that would allow users to create a custom character sheet for role play games. I have most of the code figured out, but I want users to be able to send their character sheets between devices.
So here's the question: is there a way to save and send a shared object file, or a way to create a txt file that can easily be saved and copied?
I don't believe you can send a SharedObject from one device to another, at least without a lot of work. You could however create an XML file containing the data and save that up to a server. You could allow the user to then download character sheets from your server and the app would read the XML data before converting to a SharedObject. Can't really provide any code for this as the details are lacking.
If I understand you correctly, you could sort of do this.
You cannot literally "send and receive" a SharedObject (well, you might be able to copy your shared object data on the file system directly, but not from Flash).
What you can do is provide options to the user to save and load a file that encodes all the shared data in AMF bytes. Here's the general idea:
First you need to give the user an option to save their data. You can use ByteArray/writeObject() to write your data using the same AMF format that SharedObjectuses, and FileReference/save() to allow the user to save it to a file on their file-system.
Next, you can use FileReference/load() to load the file and ByteArray/readObject() to read all the data into AS3. Now you can simply store it in the SharedObject however you want, just like you did before.

Strategy searching and using csv values from html

i am pretty new to html and as part of project we have to create a game where the player has to select different tags and then gets rewarded according to a value which is stored in a .csv file.
I created the layout so far with diffrent buttons, now i want to know how can i search inside the csv file and return the corresponding value? I am using html and javascript so far.
There are about 6000 entries in this file. Is it wise to load them all into an array?
And how can i share variables between functions without calling them one after the other?
For example to find out how often a button was pressed i obviously could not use a var in a script since it would be lost after the script was executed so i had to create a html input text field to store the variable constantly.
Your help is appreciated :)
Regards,
Marcurion
It would be wise to use a DBMS, however if the project requirement is to use CSV you could use a server side programming language like PHP to read and write the CSV file.
I wouldnt recommend to load all entries in the array, instead you could only load what you need but this can be achieved by using a DBMS.
To share variables between functions on javascript you will need to declare them as global variables, you could google: "javascript variables scope" or "javascript global variables" and read a little more of scopes.
If you want to know how often the button was pressed you can make AJAX requests to a server side script that can handle what you need if the script needs to be submited or executed.
You could check out JQuery framework to use events, ajax and infinite other things.
My advice is for you to read a little more about javascript, a framework for javascript like JQuery and a little of server side languages like PHP, with these tools you can easily develop what you need.

ListView and Data Models - Blackberry

I'm developing for the Blackberry 10.
I'm attempting to save and load a JSON data model into a listview in my app. It loads up initially via a couple lines of C++ in the app.cpp file before switching control to the QML file. However, I don't know how to save new cells into this JSON database. I don't know how to reload the ListView after I save. Finally, I don't know the restrictions regarding what I can and cannot save in a JSON database. Can anyone offer some assistance? Should I even be using a JSON model or should it be a QML or even XML? Thanks for all your help.
Some more information about what you are doing here would be helpful in order to provide an answer. JSON is a format used to contain and represent objects in a string, it is not a database. Typically working with a ListView requires creating a ListModel that contains your data and is rendered by the ListView. When working with a ListModel you have access to a variety of functions as documented at http://harmattan-dev.nokia.com/docs/library/html/qt4/qml-listmodel.html . It is not clear from your question what you are actually doing though I would suggest posting your code to make everything clear.

How to extract data from a PDF?

My company receives data from an external company via Excel. We export this into SQL Server to run reports on the data. They are now changing to PDF format, is there a way to reliably port the data from the PDF and insert it into our SQL Server 2008 database?
Would this require writing an app or is there an automated way of doing this?
As already mentioned - you will have to write an app to do this, but ideally you would be able to get the raw data from the external company rather than having to process the PDF.
However, if you do want to extract the data from the PDF, I've used iText and found it to be very powerful, reliable and most importantly - free. It comes in Java and .Net flavours - iTextSharp is the .Net version. It allows you to programatically manipulate PDF documents and it will expose the contents of the PDF to the application that you write.
It all depends on how they've included the data within the PDF. Generally speaking, there's two possible scenarios here:
The data is just a text object within a PDF. You'll need to use a tool to extract the text from the PDF then insert it into your database.
The data is contained within form fields in a PDF. You'll need to use a tool to extract data from the form fields and insert it into your database.
Hopefully scenario #2 applies to you because this is precisely what PDF forms are designed for. Scenario #1 is really just a hack that you'd only use if you didn't have any other options. Extracting plain text from a PDF isn't as easy or accurate as you might expect.
If you're receiving a PDF form then all you need to do is match up the right fields in the PDF form with the corresponding fields in your database and then suck in the data. This process could be entirely automated if you wrote your own application.
Would this require writing an app or
is there an automated way of doing
this?
Yes, both of these options would require writing an app or buying an app. If you write your own app then you'll need to find a third-party PDF library that supports retrieving data from form fields or extracting text from a PDF.
Disclaimer: I am affiliated with the makers of ByteScout PDF Extractor SDK tool
Just wanted to share some additional real-life scenarios for text data extraction from PDF:
Scanned image with no searchable text: should be processed by OCR engine (like free Tesseract from Google)
XFA forms: it is the subset of PDF which is supported mostly by Adobe tools. But the data can be extracted as XML data with low level PDF processing tools like iTextSharp or similar tools.
ZUGFeRD PDF files which are just PDF documents with the copy of a form data attached as XML file (which can be extracted with tools like this)
Text incorrectly encoded by some PDF generators (can be restored via OCR engine with some acceptable error rate though).
Using ItextSharp, do the following
using System;
using System.Configuration;
using System.Data.SqlClient;
using System.IO;
using System.Text;
using iTextSharp.text.pdf;
protected void BtnSubmit_Click(object sender, EventArgs e)
{
String FilePath = #"GetFilePath";
StringBuilder sb = new StringBuilder();
PdfReader reader = new PdfReader(FilePath);
PdfStamper myStamp = new PdfStamper(reader, new FileStream(FilePath + "_TMP", FileMode.Create));
AcroFields form = myStamp.AcroFields;
if (form.GetField("GetFieldIdFromPDF") != null)
sb.Append(form.GetField("GetFieldIdFromPDF").ToString());
}
I think you will have to write an application for this. This question talks about extracting data from PDF. After this you can export the data to excel format so that you can preserve the existing import format.
Look for information on "Scraping" the data from the PDF. I believe Adobe has some tools that allow you to do this for simple text but I've not used them.
Honestly though, I would try to do anything you can to get this data in a raw format from your vendor.