I having some trouble trying to figure out how to implement a Rails 3 multi-page form with file uploads, where each step is handled by the update/edit actions in the controller.
Ryan Bates provided his wonderful screencast for how to to do multi-step forms using sessions, as well as a brief description on how to accomplish something similar by saving to the database on the initial step and then perform updates on each successive step. I have also read his gist giving a more detailed explanation of some different options on how to create a multi-step form (I am leaning toward option 1).
But I am still quite a bit lost when it comes to the actual implementation of a multi-step form. My goal is to use carrierwave for the file uploads (images), and perhaps workflow by geekq for the state machine to help with with validations at each step.
Just to be clear, I am currently trying to create an entry in the database on the initial step of the wizard, and have each successive page update the model.
Any ideas?
An example or a point in the right direction would be greatly appreciated.
Thanks!
Note: I have read another post where they mention something about a key/value data-store, but that unfortunately is a bit over my head...
Key-Value store or SQL for that matter are very loosely tied to your actual problem. Those are just a different approaches on how your data are actually stored in the backend. Using one way or another doesn't really make a difference in your case.
As for the actual question I think its too general for SO. Multistep forms tend to be very different one from another. There is no "one good way" of doing those.
The reason you are not getting any answers on this is probably because there is no real question asked. What you should do is to try to do actual implementation and post more specific questions when hitting the wall somewhere.
In the end - I believe the multistep forms are not really the best idea when it comes to usability. Of course there are valid reasons to use them in some cases, but you should really think twice if there is a way to avoid those in your case.
One of the problems I had while ago with forms and uploads was the validation (It isn't related to Multi/Single step specifically). Normally when validation fails user would have to re-upload the file. Fortunately in your case this not much of an issue, since Carrierwave handles that automatically.
Related
I'm pretty new to Entity Framework, and I might be having a hard time "asking the right question" on google. So i'll try here.
First some facts:
I'm working on a project based on the Entity Framework 6.x.
I'm using the Model First approach.
The database is an SQL Server.
My challenge:
Every time my Unit Tests run, I'm dropping creating and seeding a test database using the DropCreateDatabaseAlways<TContext> implementation. The Data Source is an (localdb)\v11.0 instance.
I've gotten to a point where I would like to map an entity to a database view. I can find plenty of material on how easy it is to do the mapping, but what I'm looking for is a way for the view to be applied to my test database upon database creation/initialization?
I'm trying to keep a pure Model First approach. Can anyone help with information on how the views (and Stored Procedures) can be created, when creating the database?
not sure this can be done.
I recently open an issue on codeplex for similar stuff but related to Code First.
The answer was: "edit generated code by hand".
In your case this should be done by inspiring yourself of this post about model first seed data. Instead of seeding, you should send DDL creating view through SQL(...) method as suggested in the answer of cited issue.
BTW: if you think, as I, that such a support should be a good idea, feel free to upvote code first support for view, and/or to create a model first support for view.
Creating a user heavy application and am a bit lost on what to do as far as the editing and saving data to a user goes. Can anyone push me in the right direction? Thanks.
One of the beautiful things about CoreData is that, once you create your data model, you are largely relieved from the details of how to write, edit and save the data itself. Of course, if you want to you can take control of those details.
I'd suggest you look at the tutorials here: http://www.techotopia.com/index.php/An_iOS_6_iPhone_Core_Data_Tutorial
That will definitely set you on the right course. I think you'll find it's actually very easy!
I'm interested in displaying 1-5 model instances using forms on a page using a grid similar to something one would find in a desktop database application. I understand I would need to use multiple forms or formsets but an additional requirement is that I'd prefer it to be in more of a grid format with each model's fields being display in columns with common field labels on the y-axis.
I should have the ability to edit multiple columns (so in effect, model instances) at the same time and then commit either the single column (model instance) or commit all. I'd also like to be able to highlight the changed cells that have changed to give visual feedback to the user that there are pending changes.
Sorry for the rather long list of requirements and I'm aware this probably requires a few different technologies/techniques to achieve. I'm throwing this out there because I'm asking this kind community for guidance on what components/technologies I should look at. If luck would have it, there would be some jQuery component that can handle this for me almost out of the box. If not, some guidance on achieving the editing of multiple model instances would be of help.
I will also need to build in versioning in case the data displayed on the view page is stale and to prevent overwriting a newer commit. I'd probably achieve the latter using a versioning field in the table that will perform the check and handle it accordingly.
Also, Flask and Django are both options for the engine and WTForms look to be promising at least at first look.
Thanks
There is no such ready to use solution in Django. Just create your custom form that handles as many instances as you want and do anything that you want, or extend formset.
I'm making a patient database program using Visual C#. It will have forms and will consist of 3 tabs with information about the patient. It will also have add, save, previous, next buttons and a search function. The most important thing is each record will have like 60 items/columns/attributes per record and the records could reach to 50k-100k or more.
Now my question is, which is better for my program? Should I use SQlite or Serialization/Deserialization?
Thanks
The "database" word in the question strongly suggests that just serialization/deserialization isn't enough. Of course if you can fit all of your data into memory and you're happy to perform all the querying yourself, it could work - but you'll need to consider the cost of potentially reading everything into memory on startup, and possibly writing everything out whenever you change anything.
A database does sound like a better fit to me, to be honest. Whether SQLite is the most appropriate database for you or not is a different question though.
Having said all of this, for the C# in Depth website I keep all the information about comments / errata in a simple XML file, which is loaded lazily and saved every time I make a change. It works well, it's easy to manage, and the file is human readable in source control when I want it. However, I have vastly fewer records than you, and they're much simpler too. I don't have any search requirements - I just need to list everything and fetch by ID. My guess is that your needs are rather more complex, hence my recommendation to use a database.
I'm currently looking for the best way to save data in my iPhone application; data that will persist between opening and closing of the application. I've looked into archiving using a NSKeyedArchiver and I have been successful in making it work. However, I've noticed that if I try to save multiple objects, they keep getting overwritten every time I save. (Essentially, the user will be able to create a list of things he/she wants, save the list, create a few more lists, save them all, then be able to go back and select any of those lists to load at a future date.)
I've heard about SQLite, Core Data, or using .plists to store multiple arrays of data that will persist over time. Could someone point me in the best direction to save my data? Thanks!
Core Data is very powerful and easy to use once you get over the initial learning curve. here's a good tutorial to get you started - clicky
As an easy and powerful alternative to CoreData, look into ActiveRecord for Objective-C. https://github.com/aptiva/activerecord
I'd go with NSKeyedArchiver. Sounds like the problem is you're not organizing your graph properly.
You technically have a list of lists, but you're only saving the inner-nested list.
You should be added the list to a "super" list, and then archiving the super-list.
CoreData / SQL seems a bit much from what you described.
Also you can try this framework. It's very simple and easy to use.
It's based on ActiveRecord pattern and allow to use migrations, relationships, validations, and more.
It use sqlite3 only, without CoreData, but you don't need to use raw sql or create tables manually.
Just describe your iActiveRecord and enjoy.
You want to check out this tutorial by Ray Wenderlich on Getting started with CoreData. Its short and goes over the basics of CoreData.
Essentially you only want to look at plists if you have a small amount of data to store. A simple list of settings or preferences. Anything larger than that and it breaks down specifically around performance. There is a great video on iTunesU where the developers at LinkedIn describe their performance metrics between plists and CoreData.
Archiving works, but is going to be a lot of work to store and retrieve your data, as well as put the performance challenge on your back. So I wouldn't go there. I would use CoreData. Its extremely simple to get started with and if you understand the objects in this stack overflow question then you know everything you need to get going.