On the fly razor compilation - razor

cshtml files are stored in Views subfolder.
I want to store some views in database and i want to allow users to change them.
Is there a way to do that ? I need to compile on the fly but i don't know how.
Thanks

Related

How can I store an image in MySQL database using Razor Pages?

I am learning web development and working on Razor Pages. For my last assignment I was asked to make a website. In my website people can upload images and others see these images. The problem is I dont know how to store those photos. My tutor said if I save them in my sql table as binary values, that makes it very slow. I have to find another way. Can I convert image inputs to Url and store them as "text" ? Or is there any other solution?
You can save the file to the file system (wwwroot/images, for example) and the file name of the image in the database. Then construct the value for the src attribute from the saved filename:
<img src="/images/#Model.ImageFileName" alt="..." />
My tutor said if I save them in my sql table as binary values, that
makes it very slow.
I can't speak with any authority on MySQL, but you should test to see if there is actually a performance penalty, and if so, whether it's significant.
Store the Uploaded files in the File System and insert the path of the saved file in the DB.
This will help you to maintain the DB performance.
Thanks

What is the best way to routinely import a CSV or XML file into a MS access database?

I have an Access database that keeps track of many different aspects of my companies performance and I would like to add functionality to keep track of the hours the employees are working.
The hours are all kept track of on a website called timetracker. They have a few reporting options including XML and CSV files. The site has a favorite report feature to get the same data in the format that I want it every week.
What I would like to do is find the best process for getting the data from this website, into a table in my database that I can reference.
I will not be the one executing whatever process I come up with and I would really like it to be as easy as possible for whoever it is that does have to do it.
Right now I have a linked table that is an XML file in our SharePoint folder. I was thinking that maybe we could just run the report and download the file every week then just save it over the old file with the correct sheet names and it should update.
What I am wondering is if anyone can come up with an easier process for doing this that would take the least amount of time and be easiest to write down instructions for that anyone could execute.
(Would it maybe be possible to create some sort of macro to actually download the report automatically?)

displaying images and collecting rating score of each image

I have lots of images with filename as an identifiers. Each image has to be seen by users online and they can give a score/rating. How can I collect the data?
I have done it through Excel and collected the data manually. But now I am looking for an online based method as I know basic html and have access to a webserver. Please someone point me in the right direction or place for information.
For this you need to run some backend script where you will pass the value of the image clicked and doing some database function you have to store it in your database.
This is a vast subject. For example you can store data in database (MySQL for ex.) and generate html pages using server-side language (Python, Ruby, PHP, ext.). And users interact with the server through the html pages. Your images information will be stored in database and change with script on server-side.
More details can be found here:
http://searchnetworking.techtarget.com/definition/client-server

Store User data temporary on ASP.Net MVC

I'm doing an ASP.Net MVC website, but I need some help figuring out how to go about a problem I'm having. The problem is when the user is logged in (it gets the information from a MySQL database), I need it to save all the user's information and the company's info. But I need to access it from multiple Views and Models. So what is the correct way to use do something like that?
You can store that information in Global.asx so that it will be available anywhere in the project.
But the only thing is that you need to mention the properties in Global.asx before execution.

What's the best way of backing up a rails app data?

I need to make a backup system for my rails app but this has to be a little special: It doesn't have to back up all the database info and files in a single file or folder but it has to back up the database info and attachment files per user. I mean, every one of this backups should be able to regenerate all the information and files for one single user.
My questions are:
Is this possible? What's the best way to do it? And, if it's impossible or a bad idea at all, why is it?
Note: The database is a MySQL one.
Note2: I used Paperclip for the users uploads.
Im guessing you have an app that backs up data, when a user clicks on something right? I'm thinking get all the info connected to the user(depends on how you did your user model, so maybe you should have a get_all_info method) then write it out in sql format to a file, which you save as .sql. (either using File.new or Logger.new)
I would dump the entire user object and related objects into a single xml file dump. As you go through the creation of the XML grab out all the files and write the XML + all files into one directory, then compress them.
I think there are definitely use cases to have a feature like this, but be sure to have it run in a background process and only when needed in order to not bog down the web server. Take a look at http://github.com/tobi/delayed_job or http://github.com/defunkt/resque.