PL/SQL Reflection Set Attribute Values - reflection

Here the link whose answer is the opposite to I want: Reflection in PLSQL?
I want to do the opposite operation to that Jon Heller wrote in the link above. I mean, I want to set attributes of an object dynamically not manually (because my user-defined type object has 130 attributes and in my opinion, filling out some many attributes manually is not best practice and not generic programming. Does anybody know how we can accomplish that?

Related

How to calculate or at least constraint the value of tags defined in a stereotype?

To prioritize the engineering effort around Requirements in a defined way, I came to the idea to use the information already added for the FMEA.
For this I have created a Stereotype named fmeaRelevant (will be named better later), which has several Tags.
My target now is to first calculate the averages of all of these Tags and then from these the average RPN, which is again a Tag.
For this, I have already created a ConstrainedProperty, which has the respective ConstrainedParameters and Constraints.
BindingConnectors are created between the ConstrainedParameters of the ConstraintProperty and the Tags of the Stereotype.
The Stereotype is assigned to my Requirements.
However, Open ConstraintView ... does not show me anything.
Is there anything I am missing?
P.S.: I am not sure how to provide something like a source code snippet for model content. If one makes a proposal in a comment, I will add this.
You used binding connectors between stereotype properties and constraint parameters? That should not be possible, since they are on different levels. The parameters are on the model level and the stereotype properties are on the language level.
Of course, Rhapsody sometimes allows strange things, so it might well be, that there is a way to get it running.
The RPN relates to an actual hazordous situation. Your model describes this situation and all values relating to the situation should therefore be value properties of the FMEAitem. This element would be defined in a library. By the way, this is how it's done in the new RAAML-specification, which might be a useful reference.

What is the use case of merge vs mergeFields

Can anyone actually explain, in layman's terms, what is a real-world use case for the set operation's options?
While I fully understand what set with merge does, as well as merge beeing a boolean and mergeFields being an array of fieldPaths, I cannot think of cases in which mergeFields might be of any use.
I also understand the fact that mergeFields basically acts like a mask for the object passed to the set operation, but I still cannot think of how is it so useful that it actually got implemented within the SDK.
Can someone shed some light?
After looking through the documentation, there seem to be two reasons why you might want to use one vs the other:
mergeFieldPaths/mergeFields trigger an error when passing in field values that don't currently exist on the document while merge will add in those fields if they don't exist. The error is good for safety purposes if you're concerned about typos/writing to incorrect field paths.
This one is just a guess, but the documentation indicates mergeFieldPaths/mergeFields ignores AND leaves fields untouched while merge ONLY leaves other fields untouched. It's possible there's some performance advantage to using mergeFieldPaths/mergeFields esp for documents with a ton of fields. The difference might be direct access vs still needing to look at unspecified fields to identify the matches in some way.
SetOptions Reference

MPI derived datatypes

I want to create derived datatype consists of dynamic arrays, which lengths I don't know, how can I do this? It will be great, if smb post here a simple example. Thanks.
I posted an answer to a similar question here. In short:
You'll need a HIndexed datatype.
You'll have to use the MPI_Address() function to get the proper displacements.
You'll have to make sure that the typemap remains valid (i.e. the arrays don't change size or relative position to the other data members), and if it becomes invalid, redefeine and recommit the datatype.

Why create new classes in R?

I know that you can create new classes in R, but why would you want to? I've thought of two reasons:
You can use the is. function to test whether an object belongs to a particular class (classifications of objects)
To only allow certain classes of entries into slots of an object (e.g., only a string for the surnmane and only a number for a zip code in the person class).
I haven't thought of situations where these benefits couldn't be achieved fairly easily by other means or when they'd really be useful.
I hope that this isn't too open ended and more concrete examples how one might use defining classes would be great. Thanks for any thoughts.
Its called Object-Oriented programming. Look it up, but in short:
Objects encapsulate behaviour - eg the behaviour of the 'print' method for a class is specific to that class. You can then keep the code for that method on that class separate from other code. You then only have to tell your users to "print" the thing - which is something they already do - and they get a nicely custom printed version of your thing, without having to use a special print function, like "printMyThing(thing)".
Objects inherit behaviour from their parent classes - eg the 'formula' method for the glm class falls back to the formula method for the lm class (not sure if this is true, but its just for illustration.
In short, its a Good Thing.

Drupal 7: How can I create a key/value field(or field group, if that's even possible)?

Let's say I'm creating some app documentation. In creating a content type for functions, I have a text field for name, a box for a general description, and a couple other basic things. Now I need something for storing arguments to the function. Ideally, I'd like to input these as key-value pairs, or just two related fields, which can then be repeated as many times as needed for the given function. But I can't find any way to accomplish this.
The closest I've gotten is an abandonded field multigroup module that says to wait for CCK3, which hasn't even produced an alpha yet as far as I can tell and whose project page makes no obvious mention of this multi-group functionality. I also checked the CCK issue queue and don't think I saw it in there, either.
Is there a current viable way of doing this I'm not seeing? Viable includes "you're thinking of this the wrong way and do X instead." I've considered using a "Long text and summary" field, but that smells hackish and I don't know if I'd be setting myself up for side-effects. I'm new to Drupal.
There is the http://drupal.org/project/field_collection module but it's not yet ready. Right now you would need to implement your entity alas to do this :( not easy.
Not sure how well it would work, because it currently does a bit more (eg, forces to group pairs into categories and the keys need to be predefined) but you might want to have a look at http://drupal.org/project/properties.
You could create a these key-value fields on their own: create 2 regular fields that that can be added as often as needed.
So you have a x fields for the keys and x for the values. If this is only for you or other people it might work OK but usability wise, it's very ugly.
If you need to extract the fields from the function, to display it properly in a page template, you should propably use a different approach. Write the function with its arguemnts in a CCK field and in the template extract them as needed. The arguments are always (depending on language) in () and the different arguments are seperated by , so splitting them would by pretty easy.

Resources