Reading/Appending Server-Side CSV Files in MVC/Razor [closed] - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
So, I'm a newbie using MVC and Razor - I do have some C# experience, however.
That being said, I need to make a simple web-app and the project specifications require server-side data to be stored in CSV. Everything I've researched online involves uploading a CSV file to the server, or letting the user download one. This is not what I want.
This is what I need help with:
1) Appending a new line to an existing server-side CSV file between user page directs/requests.
User submits page --> server appends data to server-side CSV --> User gets redirected to new page
2) Iterating through a static CSV file and presenting the data in a table.
User requests page --> Server iterates through CSV and dumps line data into a table --> User gets page with table full of data
Any ideas where to start with this?

Decide where you want to store the file, here is one of the paths:
string csvPath = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "App_data") + "\info.csv";
In the controller action use regular File IO APIs (http://msdn.microsoft.com/en-us/library/system.io.file(v=vs.110).aspx) to manipulate the file
While this may answer your specific question, this wouldn't scale when you have many front ends, multiple users trying out your site,... Suggest going with a backend DB to store such info. You would need to use locks solve the latter if you are not going to use DB.

Related

How do I embed meta data in a non-standard file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I need to write code that receives firmware update files from various sources (nothing is a given, not even the file extensions) and passes them up to the cloud so that our software can download them to individual machines.
As part of the process, the front end needs to give the users a richer experience, so I need to include information such as the version number, last time there was an approved update to the file, and some other info about who is responsible for the update.
I've been directed to pass the data in as "meta-data" so that we don't have to include two files and at this point that doesn't seem like a very viable option. I've been researching meta data all day. TagLib is only for media files. I can use Microsoft API Code Pack to read some attributes but it won't let me write anything.
The shell32 option looks like the only other possibility but I can't figure out how to write to it. I'm using C# code in VS 2019, currently .NET framework 4.6.1 but we are about to upgrade to 4.8, I think.
Is there a practical way to write a string value as meta-data into a file without knowing anything more about the file than what I could discover with c#?
If you don't want to provide additional files or locations with the meta information you can create a new single file which contains your meta data and the actual firmware update. Think of it as a ZIP file where you have the firmware update file and some other file with the meta information. This way you will have only one file you can send around, but it has all the information you will need at any later point.
You cannot change the firmware update file in any way, specially if you don't know how the file format is. It would most likely break the firmware update.

How to quickly load approximately 1 million rows of data in a form? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
We have a little c# winforms application that is connected to a sql server database.
We are using the RadGridView (tabbed) control to display data from approximately 10 different views that are stored in sql server.
We have a thread running for each view (Tab) grabbing the data and populating each radgridview tab.
Our problem is this is taking way too long to load.
How do we speed up the data retrieval?
Here's what the control looks like:
You cannot load 1,000,000 rows quickly, because that's a lot of data to get from the RDBMS's disk through the network into the memory of your application. However, it does not mean that your application is bound to be slow: as long as you give end-users a perception that the data is there as soon as they are ready to see it, they would consider your application very fast.
The users would think that you loaded the data quickly if you load the data for the top few thousand rows on the initial page first, then load the remaining data for the initial page, and only then start loading the data for other tabs.
As you go tab-by-tab in the background, load only the top hundred rows in each tab, so that when end-users click the tab, they see that the data is there. Your code should load the rest of the data only when the user opens the tab: chances are, they never will open some of the tabs, helping your application save both on the processing and on the data transfer.

Maintenance Program with a txt file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to write an employee maintenance program (in C#) that can add, change and delete from a text file. I have the HTML all put into an .aspx file but I have NO clue on how to set it up to read from a text file and populate the input fields with the employee to maintain.
If I could get some insight on how to read a text file and populate the input fields(form fields) that would be great. Even a link that explains it since I haven't been able to find one. The text file will have to have a record ID as the first field so I know which one to grab for editing(to display) or deleting.
There's a toolkit of functions to manipulate files in the system.io.file class. That's a reasonable start for the project.
You might also consider using a database instead of a text file. They're designed to handle storage and retrieval of data that changes a lot. A text file is doing it the hard way.

getting specific pdf page number in asp.net C# [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am having a user manual for my asp.net application which I will be using as a help option for the user. I am providing help using some keywords. When users clicks or selects the keyword that he wants help with I want to open that page number of the user manuals PDF file where the keyword is there. E.G. if i search User master , then user manual should get open, directly taking me to the page where user master information is there.
Can this be done in asp.net.? C#.? Any suggestions?
If you know which page the keyword is on simply;
Add "#page=4" to the end of the link.
If you don't know the page number and you want to find the page number at run time you'll need to index the pdf document and search the document.
You can map keywords to page numbers if you know the keywords ahead of time.
Google for C# PDF searching APIs.
dtSearch is good but it's not free.

Implementing a application HTML help system [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
We want to implement a application help and documentation system. It should be based on HTML, because there are a lot of existing files and it gives us the most flexibility. Currently we use CHM files. We want to enable internal people (not developers) to edit the contents.
We thought of a stand-alone application that supports TOC, indexing (tags), search, etc. We also thought of using a local web server.
Until now our application uses pure C#, it would be good to keep this.
We are totally clean of web/asp knowledge, so the question is:
Where is a good place to start?
You can use documentation apps like SandCastle
Which use your XML documentation in your code to generate a help file.
Finally we ended up implementing a local HTTP server:
Internal people creates HTML content within our internal network
Our own build-tool creates the TOC and a search index and packs all content to a zipped file
The zipped file is packed into the application installation
When the end-user call help from within our application, the local http server is started
The HTTP server uses the HttpListener class
With this, it is possible to have some HTTP queries for special tasks like starting tools of our application by clicking a link without interception of the browser

Categories

Resources