A question like this has been asked differently several times.
Yet here i am.
I am writing a standalone windows program which will get user input like three fields and have to store it in the disk.
Also i need to delete them, edit them and so on.
It should be UTF8.
Besides here is the actual need.
I have hosted this application in my server and users can download it.
I want the db automatically created when the program is executed for the first time.
What i mean is user can or should download only one file and that is the program.
The program will be one exe file and it will not have any dependencies.
meanwhile asking this question i tried sqllite for .net 2.0 and i got an installer from sourceforge and installed it.
I included in my application and it showed an error like there is a problem in that.
So, if people suggest sqlite then please give me reference of how to include in c#.net v2.0
I am new to .net so it is taking a very long time to fit things together so thought of posting this question.
any comments, suggestions, advices and references would do good.
EDIT
I have attached the error what i got
Edit after first reply
A user can save as many as set of three fields.
I mentioned three fields for an example.
They will save as many as records as they want.
It could 100 to infinity.
If that's only 3 fields to store - forget about databases and store the data in an XML file.
You can create a class that has these 3 properties, and then serialize/deserialize it on demand.
Here's a nice tutorial from Microsoft about XML serialization: http://support.microsoft.com/kb/815813
Deserialization is done in a very similar fashion.
Related
I am new to app development and I am doing a proof of concept app in Visual Studio 2017 community. The aim is to have Android and IOS versions.
The app purpose is to record five exercises results per test and give a pass / fail result based on a set of targets per exercise. The test targets will depend on the age, gender, and level of the person completing the test
For example a test target for a male 25 year old level 1 maybe
Push ups Target 22
Shuttle runs in 60 seconds Target 20
And so on
I expect to have two hundred lines of targets for all the variation of users, age, gender and levels. In particular, if i consiser sqlite (which i am using in the project already to store student info and results) I am thinking of how to seed the initial data table. If I code by a static resource file on first start I can read the data file (xml / csv /json) and seed the data table of targets and replace that file later to re-import using an app setting to signify a re-seed of the data table is required, but I am concerned I am "bloating" the App size and wondering what format is more efficient to read in
These targets will not change very often but may be review once a year and changed
In WPF I would create an a csv or Json file with this data in as a resource and read it in a plain C# class to model the targets. However on reading up there is concern about such static files "bloating" the size of the finished app and delays in creating the list of targets when in use and that there is no native csv library
I would also like to be able to import new data (targets) into the resource file
What is the most efficient way to achieve this please
If I understand your scenario correctly you need to save 5 targts for each user then Xamarin.Essentials: Preferences might be worth considering. It uses shared preferences on Android and NSUserDefaults on iOS.
If you have more information to save, then SQLite seems like a good option.
Review option to put "initial" DB file as a resource. So, you can prepare as DB structure as seed data. At first startup, app will be in need to just copy to document directory and use it (simple binary copying of the resource as is).
Later time, you will need some kind of code snippet that will merge changed data from new "initial DB file" to your local one at document directory.
I have my software been developed in .net in C# and i am modifying desktop.ini file from that software. I am successfully been able to update desktop.ini. But i have one question like what approach should i follow to keep information of desktop.ini which was there previously like should i store information in database or something like that?
And i wanted to reupdate my information of desktop.ini, i.e. information which was stored previously on uninstallation of my software.
I would really appreciate if someone could explain me what approach should we follow for this.
Thanks
Dharmen
In the specific case of ini files, the answer is to use a tool that supports the standard Windows Installer method of managing ini file content - the IniFile table and the WriteIniValues and RemoveIniValues standard actions, then you don't need to do anything. VS setup projects don't support this.
To code it yourself you'd just need to remember what sections and values you added, then remove them at uninstall time with an uninstall custom action. That's basically a development question about where to store the values so you can retrieve them to take out of the ini file at uninstall time. I don't know if that's much of an answer, but it's basically about coding a scheme to remember what you added or removed and then restoring those section values at uninstall time.
You should also have a rollback custom action to remove them in case the install runs your custom action to alter the ini file and then fails.
I'm planning to develop an application that will read a log file and display statistics.
The first question, I guess, is to know if I need a database or not?
Will it be quicker to run queries against the database ; or read the file each time a user wants to see the statistics?
If I choose the database method, I will have to read the log file and update the database on a regular basis (between 1 and 10 minutes).
Is this article still good do you think (as it's from 2005): http://www.codeproject.com/KB/aspnet/ASPNETService.aspx
Or is it better to develop a Windows service? In that case, can I add the Windows Serice in my ASP.NET project in Visual Studio, or does it need to be
You mentioned ASP.NET so I believe it is a web application. In such case I would suggest to use Data Base, this is more robust, flexible and distributed solution.
Any way consider using log4net and then you can easily switch on file/DB ouput in any time by simply adding an other one appender section into the configuration file.
If I choose the database method, I will have to read the log file and
update the database on a regular basis (between 1 and 10 minutes)
Exactly, you're going to have to do it anyway. The Database basically just becomes another bottleneck at that point. For this type of app, there's no need to do anything other than read the file when the user requests to see it, and display them the results on the fly.
No need to have a windows service either. I mean, I don't know all your details, but I'm assuming the log file is in a directory on your machine, so just access it, open it, parse it, and display it to the user when they choose to see it on the front end.
If the only data you going to work is LOG files, you don't need any database.
But I assume that your application would do parse logs files, create some statistics and STORE it somewhere, to make possible to users to get back and see statistics for some period of time. It is not cool if any time you will be "re-calculating" that statistics again (further more, you might loose original log files till that time).
Even if you could store it to some files also, I do not recommed that at all. Don't be afraid of using Database, don't be concered on application performace on such early stage. Do the most that helps you to solve the problem.. and as for me using Database will solve your problem;
I need to create a patching routine for my application,
it's really small but I need to update it daily or weekly
how does the xdelta and the others work?
i've read around about those but I didn't understand much of it
the user shouldn't be prompted at all
Ok this post got flagged on meta for the answers given, so I'm going to weigh in on this.
xdelta is a binary difference program that, rather than providing you with a full image, only gives you what has changed and where. An example of a text diff will have + and - signs before lines of text showing you that these have been added or removed in the new version.
There are two ways to update a binary image: replace it using your own program or replace it using some form of package management. For example, Linux Systems use rpm etc to push out updates to packages. In a windows environment your options are limited by what is installed if you're not on a corporate network. If you are, try WSUS and MSI packaging. That'll give you an easier life, or ClickOnce as someone has mentioned.
If you're not however, you will need to bear in mind the following:
You need to be an administrator to update anything in certain folders as others have said. I would strongly encourage you to accept this behaviour.
If the user is an administrator, you can offer to check for updates. Then, you can do one of two things. You can download a whole new version of your application and write it over the image on the hard disk (i.e. the file - remember images are loaded into memory so you can re-write your own program file). You then need to tell the user the update has succeeded and reload the program as the new image will be different.
Or, you can apply a diff if bandwidth is a concern. Probably not in your case but you will need to know from the client program the two versions to diff between so that the update server gives you the correct patch. Otherwise, the diff might not succeed.
I don't think for your purposes xdelta is going to give you much gain anyway. Just replace the entire image.
Edit if the user must not be prompted at all, just reload the app. However, I would strongly encourage informing the user you are talking on their network and ask permission to do so / enable a manual update mode, otherwise people like me will block it.
What kind of application is this ? Perhaps you could use clickonce to deploy your application. Clickonce very easily allows you to push updates to your users.
The short story is, Clickonce creates an installation that allows your users to install the application from a web server or a file share, you enable automatic updates, and whenever you place a new version of the app on the server the app will automatically(or ask the user wether to) update the app. The clickonce framework takes care of the rest - fetching the update , figure out which files have changed and need to be downloaded again and performs the update. You can also check/perform the update programatically.
That said, clickonce leaves you with little control over the actual installation procedure, and you have nowhere close to the freedom of building your own .msi.
I wouldn't go with a patching solution, since it really complicates things when you have a lot of revisions. How will the patching solution handle different versions asking to be updated? What if user A is 10 revisions behind the current revision? Or 100 revisions, etc? It would probably be best to just download the latest exe(s) and dll(s) and replace them.
That said, I think this SO question on silent updates might help you.
There is a solution for efficient patching - it works on all platforms and can run in completely silent mode, without the user noticing anything. On .NET, it provides seamless integration of the update process using a custom UserControl declaratively bound to events from your own UI.
It's called wyUpdate.
While the updating client (wyUpdate) is open source, a paid for wybuild tool is used to build and publish the patches.
Depending on the size of your application, you'd probably have it split up into several dll's, an exe, and other files.
What you could do is have the main program check for updates. If updates are available, the main program would close and the update program would take over - updating old files, creating new ones, and deleting current files as specified by the instructions sent along with a patch file (probably a compressed format such as .zip) downloaded by the updater.
If your application is small (say, a single exe) it would suffice to simply have the updater replace that one exe.
Edit:
Another way to do this would be to (upon compilation of the new exe), compare the new one to the old one, and just send the differences over to the updater. It would then make the appropriate adjustments.
You can make your function reside in a separate DLL. So you can just replace the DLL instead of patching the whole program. (Assuming Windows as the target platform for a C# program.)
Just a quick question:
I'm in the finalizing state of my current C# project, and I'd like to send a version out to people that has 90% of the features initially requested, but it'll be a version of the software that will do all they need - they need the software as soon as possible, basically.
Therefore I'm going to be using the online install option in VS2008 that will use updating to add the final few features, as well as additional things, later. What I'm wondering is the following:
The program will come packaged with a .mdf file. When I create a new version of the program however, I don't want to change all of the data that has been added to the database already. My question is how do I go about doing this?
Thanks!
How are you planning to distribute the update? An installer will have flags indicating when a file should be replaced. (Date, version etc)
One-Click installation has the ability to check for changes on program startup.