Retrieve Output parameters from stored procedure using entity framework/MVC - entity-framework

After hours upon hours of research, I can't retrieve the output parameter from the stored procedure through entity, or a helpful link about the issue. All solutions and suggested practices I have come across don't work or if they do work, they are missing enough detail so their solution can be done correctly. Any help would be appreciated, especially detailed help. Thank you.
Example of approaches that don't work:
ObjectParameter Output = new ObjectParameter("ID", typeof(Int32));
context.InsertPerson(Name, Description, Output);
this link has a solution that I have not tried because it is a bit beyond my knowledge and a bit too invasive, and doesn't really use entity framework in the end.

Related

How can I load data from PostgreSQL into Deep Learning 4J?

Could you help to understand how can I load data from PostgreSQL into Deep Learning 4J, please?
I'll appreciate if anyone have an example.
Thanks in advance
If you want to load your data from Postgres before vectorization, you can use the JdbcRecordReader. It is in the datavec-jdbc maven package.
For an example how to use it, check out the unit-test for it: https://github.com/eclipse/deeplearning4j/blob/master/datavec/datavec-jdbc/src/test/java/org/datavec/api/records/reader/impl/JDBCRecordReaderTest.java
This will give you access to your data in record form. If all your data is already numeric: great. If not, you will have to vectorize it. Explaining how to do that is probably too long for Stack Overflow. Take a look at https://www.dubs.tech/guides/quickstart-with-dl4j/ where I explain how to do it with records coming from a CSV file.
If you're confused beyond that, feel also free to ask questions on community.konduit.ai, there you can ask follow up questions better than on StackOverflow.
dl4j, as any other framework works with tensors - INDArray in case of dl4j. So in order to "load data" you'll have to convert it to tensors actually. That applies to any data source - text, images, mp3s - everything is vectorized before sending into neural network.

Form validation from complete novice

After quite a few Google searches, I have finally found my way here for this question. If this is something that could be better asked elsewhere, any direction that could be provided would be greatly appreciated.
I have made some HTML forms in the past, but I am trying to do some validation, of which, I have never done before.
What I would like to do is have a form that has two drop down lists that are sort of tied together, the first being one of two choices (say A and B) and the other being a list of the numbers 1 through 30.
What I need to do is have 30 of such "questions" and I need to validate that each number (1 through 30) are used in the form and only used once.
As stated I am a novice at any type of the programming required to make such a form from scratch. I can read some code and understand what is going on sometimes, but I don't have the knowledge to be 100% sure.
Any help, or direction to where I could get this answered is greatly appreciated.
Thank you

Core Data Structure - avoiding circular reference?

I just wanted to validate my data structure.
It seems a bit convoluted to me, maybe it can be simplified?
Questions are grouped into chapters.
For each question, only one answer per session is possible.
The purpose is to be able to compare / analyze answers to the same questions (by different users or by the same users at different times, i.e. with different sessions).
A template, being a collection of chapters & questions, should not have to be replicated, if chapters and questions are the same.
(That would be necessary if Answer did not have a relationship to Session.)
Is the relationship from Answer back to Session the right strategy?
What else would you improve to simplify the model?
Thank you!
EDIT
Follow-up clarification:
The Answer is not static (e.g. "right" answer, "solution"), but some text the user inputs. It is more like a "questionnaire" than a "quiz". The answer has quantitative attributes that can be analyzed.
As stated, one question can have only one answer within a session. Because questions can indirectly belong to more than one session (via (NSSet*) question.chapter.template.sessions), they could have more than one answers and thus need a to-many relationship.
The typical scenario: User starts a new session with a certain template and fills out the answers. Then he can look at the analysis of the results and compare those with the results of other sessions that use the same template.
EDIT 2
The snapshot of the data model including attributes
honestly, this is what I would do instead of your structure, but I don't know what the purpose of the each entity because I'm not able to find out from their simple names.
this is just an idea to resolve the loop.
you can still reach all templates and all answers from the session, not directly but it does not make your life much harder.
UPDATE:
at the first and second sight, for me, it seems the Session entity is just an extra entity only here. honestly you would not need it, if you concatenate with the Template (aka Questionnaire) entity.
you have to add a many-to-many relationship between the Template and User (you can do it, don't worry about it). using this way, from each template you can reach all answers as well, and you won't have any loop.
Despite the really helpful effort by the part of #holex - the best way still seems to be to stick with my design. The simplifications I had hoped for have not materialized.

In what scenarios would I need to use the CREATEREF, DEREF and REF keywords?

This question is about why I would use the above keywords. I've found plenty of MSDN pages that explain how. I'm looking for the why.
What query would I be trying to write that means I need them? I ask because the examples I have found appear to be achievable in other ways...
To try and figure it out myself, I created a very simple entity model using the Employee and EmployeePayHistory tables from the AdventureWorks database.
One example I saw online demonstrated something similar to the following Entity SQL:
SELECT VALUE
DEREF(CREATEREF(AdventureWorksEntities3.Employee, row(h.EmployeeID))).HireDate
FROM
AdventureWorksEntities3.EmployeePayHistory as h
This seems to pull back the HireDate without having to specify a join?
Why is this better than the SQL below (that appears to do exactly the same thing)?
SELECT VALUE
h.Employee.HireDate
FROM
AdventureWorksEntities3.EmployeePayHistory as h
Looking at the above two statements, I can't work out what extra the CREATEREF, DEREF bit is adding since I appear to be able to get at what I want without them.
I'm assuming I have just not found the scenarios that demostrate the purpose. I'm assuming there are scenarios where using these keywords is either simpler or is the only way to accomplish the required result.
What I can't find is the scenarios....
Can anyone fill in the gap? I don't need entire sets of SQL. I just need a starting point to play with i.e. a brief description of a scenario or two... I can expand on that myself.
Look at this post
One of the benefits of references is that it can be thought as a ‘lightweight’ entity in which we don’t need to spend resources in creating and maintaining the full entity state/values until it is really necessary. Once you have a ref to an entity, you can dereference it by using DEREF expression or by just invoking a property of the entity
TL;DR - REF/DEREF are similar to C++ pointers. It they are references to persisted entities (not entities which have not be saved to a data source).
Why would you use such a thing?: A reference to an entity uses less memory than having the DEFEF'ed (or expanded; or filled; or instantiated) entity. This may come in handy if you have a bunch of records that have image information and image data (4GB Files stored in the database). If you didn't use a REF, and you pulled back 10 of these entities just to get the image meta-data, then you'd quickly fill up your memory.
I know, I know. It'd be easier just to pull back the metadata in your query, but then you lose the point of what REF is good for :-D

Several relationships between two tables- is it correct or not?

These day I work with a database that have this style of relationship then I've been very confused with it. This database is in a very large web app & have worked well for 10 years then I wonder whether this design is good in someway? or in which situations I should implement it?
Welcome any idea!
There is nothing wrong in my opinion. You can have, for example, in a personal_data table a place_of_birth field and a place_of_living field both referring to a cities table. By the way you should post a more meaningful example to have a more precise answer.