I'm quite new to programming.
I'm making an UWP application, and on one of the pages I want to display a bunch of laws and regulations.
Where should I store the text/paragraphs?
I do not want to write them all in the XAML file, as this will take a lot of space and make
the XAML file hard to navigate and read.
I know it's possible to store text-strings in a resource file (.resw), but for me it seems like this is made for storing strings in different languages.
Should I store the strings in a database, SQL? I have not worked with databases before but
I'm eager to learn it if that's the way to go.
I have added a picture of what the law-paragraphs looks like (the text is in norwegian).
The paragraphs will be displayed in different frames on the page. It would be nice if I could easily add and edit text in the database.
Paragraphs
Best way to store text in UWP application
You have many ways to store the text, you could create txt file in your local folder and write the text in it, and here is document how to read and write data into file.
I checked your law-paragraphs, it's not very long string, so you could use LocalSettings to store this law-paragraphs with specific key quickly. Each setting can be up to 8K bytes in size and each composite setting can be up to 64K bytes in size. For more info please refer this document.
And we don't suggest your store this simple law-paragraphs string with SQL, it's too heavy, if you do want it, please refer Use a SQLite database in a UWP app
Related
I am new to coding and trying to understand something. I have read that a .EXE can not change itself or change embedded files inside itself. So lets say you make a game and that game has setting that the user can adjust like difficulty or level or whatever. Maybe it is an RPG game and they need to save progress. Where does that information get saved? If you save it to a text file then the user could go into the text file and adjust their level and cheat. Also you would not save a password to a text file because then anyone could open the text file and see the password.
Another problem would be that, if they moved the game to a different computer and did not also move the save file they would not have access to their saved information.
For C# applications, there are several ways to save application data; various practices are dicsussed in this question; the most usual ways are custom data files (Xml, Json, binary formats), the Windows registry, or the cofiguration settings file of the application. The problem that a user could manually edit the saved data is always present and somewhat unrelated; this is a drawback of either possibility. One solution would be to encrypt the saved data or use checksums to detect manipulation.
I have a custom sensor, connected via Bluetooth, that streams data to my UWP app.
I need to store this data locally somehow, however my problem is that it is streaming at 100Hz, so the data is arriving at the app very quickly.
I have tried to store the data into a SQLite database, as it will be easier to work with the data later. e.g. searching the data.
However the SQLite database cannot keep up with the data stream and starts to lag behind considerably overtime.
So does anyone have any advice or recommendations to the best approach for storing large amounts of data very quickly in C# UWP apps?
Many thanks for the help.
You should store data in file instead of sqlite, just append data to file each time. You can use csv or tab separated format. for improving performance save data in batches.
create two array of objects.
imported data will be added to one array.
once array is full save that array and new input will be added to other array. you should continues switch between them when one of them is full. and save them(it is like two buffer)
I would like to identify users in my Universal App each time they run it.
So I am thinking I want to have Johnny open a separate app which will save an array of his DetectedFace(s). Then I have Sally use the separate app and save an array of her DetectedFace(s).
How do I transfer these arrays to my actual program so it can differentiate between Johnny and Sally?
For text it is easy to save to a text file and then pull from that text file, but I don't think I can save a DetectedFace to a Text File?
Is this something a Database could store?
I think I will just save images with Johnny's face and then generate the DetectedFace(s) from these saved images in the actual program. Then get the DetectedFace(s) from the person in the current video stream. Then compare the two. Doesn't seem very efficient if I had 1000 users though.
I need to print a few thousand stickers with a few text fields (name, position, etc) as well as a barcode image.
Each staff member gets two unique stickers, and the sticker paper has 4 per sheet so that's 2 staff per sheet.
I already have all the code to generate the barcode as an Image, and the staff details are stored in a List of object.
If possible, I'd like to avoid using MSWord directly since my development environment is quite different from the target environment and I've had issues in the past from the disparity. (Win7-64, MSOffice2010 vs. WinXP-32, MSOffice2003).
What's the best way to accomplish this?
If I save the document as an XML format and replace the mail merge fields with unique tokens which I can replace with my actual values (and I can even replace the binary image data with base-64 encoded image bytes) then that works but it's clunky. For starters, I'd have to save the XML file and then somehow print it transparent to the user (don't want Word showing up). Also, the XML template is 1 page, but I might have several dozen to print. I can send each page to the printer individually but that's not exactly ideal.
Any other suggestions?
I would use DevXpress XtraReports as I have used it in the past in similar scenarios with great results. If you prefer other engines like Crystal or Telerik is the same, as easy as dragging some fields in the page details section and assign your object list as datasource. DevXpress has also a RichTextBox with builtin mailmerge feature. at last if you decide for word do not forget that you can automate and use it while keeping it invisible so users wont see it.
I have a few pdf files that were created from word or excel files.
I need to get the information thats in the tables.
The text in the document is not an image so I'm able to extract the text using tools such as pdfbox.
When I have the text I have no way of knowing what cells in the table it belongs to because I don't know where the table borders are.
Iv'e tried a few desktop tools such as abby or solid pdf converter and they are able to convert the files into nice word documents but this doesn't suit my needs as I want to be able to do this programatticly in C#.
Some of the tables have nested tables wich I think makes this a little bit more diffucult.
I appreciate your help
The difficulty here is caused by the fact that the text in the PDF is not contained within any table. It might look like it is, but underneath the surface, it is not.
So there are a couple of options that I can think of. But none of them are going to be quite as satisfying as you'd probably like.
There are some companies that offer SDKs for PDF to Excel/Word conversion. Investintech and Iceni are a couple of examples. But these solutions are not free.
If you know the exact layout of the PDF files that you need to extract the table data from, then you can use any SDK that lets you extract text from a PDF and also tells you the exact co-ordinates of the extracted text. Using this method you need to know in advance where the text is going to be, so that you can extract text from a specific area on the page. It obviously won't work if you need to process any random document.
It's a difficult task, but hopefully this will give you a starting point.