Create internal DB in a UWP - c#

Is it possible to create a "internal" database to use with a UWP?
So when i publish the app it comes with the db, because there is no need for me to use a db on lets say Azure.
In the app i show movies and the user can store a movie to favorites. So I only need to store the index number from that movie to use next time a user navigate to the favorites.
Or maybe there is a better way, like a text file?
I cant find any information regarding this and a tip would be much appreciated! :D

It seems like you have solved your case by using a text file instead of a db.
For the sake of detail :
If the text file doesn't meet your criteria further on you should probably use Sqlite. There's a preview version currently in development.
For more details :
https://stackoverflow.com/a/30001048/4487530

Related

How to get a JSON file (or something similar) with lightning data from http://en.blitzortung.org?

I am currently working on my school project - Android app that informs you about strong lightning strikes near your house in real time.
There are some websites like blitzortung.org or lightningmaps.org (or other), any ideas how can I get nice output file from one of these sites, so that I can obtain geographical data, determine whether it is near your house or not, and send a push notification for user? Displaying the strikes on the map are not needed.
I am using an Android Studio, Visual Studio 2015 as well as MS SQL database.
Thanks
You can get complete source code for this from following URL
https://github.com/wuan/bo-android
It's using data from lightningmaps.org
You can give a try to Open Weather or check this answer.
For Push you can use FCM. Just google "How to implement GCM in android?" you will whole lot of help.
According to blitzortung forum:
Please remember that Blitzortung data may not be used for commercial
purposes. General operator data access info: login to your main
Blitzortung Org account, and click the 'compendium' link under
'project area'. If you haven't already, you might also see
http://www.lightningmaps.org/doc/intro

Read content of text file and use it to change text of a TextBlock

I have a Page (MainPage.xml) which has a TextBlock with "User" written on it.
I also have a file called Username.txt stored in the Isolated Storage.
How would I make the TextBlock change 'User' to the name supplied in the Username.txt (Preferably at run time/without having to press a button)
In my project I have 2 Pages, a settings view and the main view. The user gives inputs his name in the settings page, which then stores it in a .txt file for the main page to use.
The finished product is supposed to list a user's name, and some other info (eg. phone number, email and more).
Please keep in mind that I just recently started learning, so please bear with me if I don't fully understand something straight away :)
Thanks in advance
For storing settings in isolated storage I wouldn't use a file. Microsoft has already made something nice for us developers: the class IsolatedStorageSettings. It is basically a dictionary that writes to isolated storage. Storing a username is almost as simple as:
IsolatedStorageSettings.ApplicationSettings.Add("username", "johndoe");
And then to retrieve the username:
var username = (string)IsolatedStorageSettings.ApplicationSettings["username"];
There is are really nice example of storing settings on Windows Phone here. The example uses just one page but you'll definitely get some insights that will free you from your headaches.

Create and store database locally with asp.net

I have a small website with couple different forms inserting data to sql. But the users have problem with it. The problem is that they seem to be going through them too fast that its not recording everything.
So i am trying to see if there was a way to store all the data locally and have it insert to sql at the end when they are done filling out forms. Is this possible?
For example:
I have a form that have 5 fields but 2 are auto populated and 1 entered manually and 2 are being inserted using bar code scanner. The bar code scanner is the last value required before being inserted, so i was hoping there was a way to insert that into locally store access database (not seen by anyone) and when they press "Finish" all that data from access will be inserted into sql.
Hope i painted the picture clear enough.
Let me know any and all possibilities.
EDIT: Here is the aspx and .cs, hope this helps. Yes i realize that i have validation for the bar code, but not sure why its slow. And i may have stuff cluttered. So please bear with me.
Sounds like you need to put that data in application session or cache and then flush the data to db.
Here are some other choices though:
Flat files (simply serialize your objects, use protobuf)
Use Embeded Db: SqlLite, VistaDb, Sql Server Compact...
Store data in the browser via localstorage (dom storage, this is html 5 feature)

Windows Store App Saving State Information

I'm just starting to work with windows 8 development (using c#), and am working on porting one of my applications to a windows store app. Essentially my application takes a user input string, calculates an appropriate output, and responds to the user. So I'm using a list view to track the "conversation." I display the user's input as a list view element and then display the output as the next element (using text blocks with formatting like color...).
What I would like to do is make this "conversation" persist once the app is terminated but am not sure the best way to do this. My first thought was to serialize the list view object on suspension then deserialize it on load, but the listview isn't serializable...So my next thought was to write out each input and output string to a file and try to rebuild the listview from these strings when I load the application, but I am having some issues with this as well.
So I'm curious as to what the best way to go about this is. I would like the application to start back up with the previous conversation already displayed with the same formatting and what not. Does anyone have any ideas?
I wouldn't persist the ListView anyway, you only need to persist the data in it. Are you using a MVVM type model, where your conversation is perhaps captured as an ObservableCollection and then bound to the ListView? If not, you should :)
Then you'd just need to serialize the ObservableCollection (see one option for that here). Where you persist it kind of depends on you:
LocalFolder would use a file based approach and be available on the local device
RoamingFolder would also use a file based approach but sync using the cloud across multiple devices that the user owns (and has the app installed)
Cloud storage (like Windows Azure or Windows Azure Mobile Services) would provide essentially boundless storage for you, but requires managing a cloud account and paying for it (though free tiers may be sufficient)
An in-memory database like SQLite is yet another option and would give you relational semantics should that be interesting to you.
To get started, I'd say use LocalFolder and persist your collection to a file, then when you rehydrate it, simple data binding should automatically handle the display. At some point, you may need to make a decision about how much to store. You want your application to be responsive for the user ('fast and fluid'), so to that end you may need to bring in data as it's requested versus all at once (perhaps a version 2 feature!)

A lot of data in WP 7 App, how?

I would like to have a lot of data (quotes of famous people, arround 100 k quotes). And I want that users are able to search, sort on category and sort on authors.
Got a big big xml file at the moment, but what is smart to do? How can i get all the quotes in the app? maybe a sql lite database? or just loop the xml when app starts?
Any tips are most welcome!
Kevin
UPDATE: Thanks for all the replies and tips, I really appreciate it and I am looking forward to program my App, did make a runkeeper-like app yesterday, now starting the quotes app.
I would recommend storing this data on a webserver somewhere and using some SOAP interface of something like this, to access it. I wouldn't be positively surprised when a downloaded application all of a sudden decides to download a big file of quotes.
I would recommend a SQL CE database (.sdf file)
Great overview here: http://windowsphonegeek.com/tips/Windows-Phone-Mango-Local-Database%28SQL-CE%29-Introduction
And here: http://msdn.microsoft.com/en-us/library/hh202860%28v=VS.92%29.aspx
There's no SQLite on WP7. There's SQL Server Compact though. Read up on the latter, and also on LINQ. WP7.5 only.
Alternatively, store data on the Web server, and use a service to pull it on demand. In that case, read up on services and SOAP.
With the fact that you are looking at a 500mb file I think you have a couple of options.
1) Put all of this data in a database on a webserver, then have your phone application use whatever method you like to contact the database to get specific data that is needed. Obviously your UI would have to be optimised to allow a user to sort by the type of quote and / or the person to whom the quote is attributed.
2) If you want this to be done without the use of the webserver you could have a stripped down basic database of quotes in the application itself, to extend this connect to the database and download more data.
This method may be best as it lets you use the database data to say populate a website if you wanted to (make a bit of money from ad revenue / promote your app) and also it means if your users dont have an internet connection they can still get some use from your app.
Without more knowledge of the platform I couldnt say what would happen if you try load a 500mb application but I doubt it would be good, though having such a large file locally is a bad idea for a mobile device. I can see this going two ways.
1) Im out and see your application, I set it downloading, pay it no attention and then later check to find it has downloaded 500mb over my mobile phone data package. This could mean a big bill.
2) I start to download your application, it hasnt finished downloading after 10mins, I delete it and dont bother trying again.
You can do something like let the user to enter three character minimum before search from webservice ans user the service result to bind the data.
Check the following links
How to connect to a Webservice from a Windows Mobile Device 6.0
http://msdn.microsoft.com/en-us/library/aa446547.aspx
Let me know if this helps.

Categories