How to make a read-only property in Rhapsody - properties

When I load as reference an external profile to my Rhapsody project I'm not able to modify its properties as it is a reference.
Is there any way to make some properties (not all) read-only at project level?

You can make them all read-only if you maintain your profile in a separate model and load that in the models you need.
I don't think you can protect single properties.

Related

Make Modelica class read-only in Dymola

Is there are way to make a user written class read-only in dymola? I want to avoid modifying it by error, when working on models that use it.
There are two ways I know of. The first is to make the files read only on the file system. I'm pretty sure Dymola will recognize that fact and prevent modification. I think.
There is also a way to add an annotation that is essentially a checksum or hash or something. But this is typically done by DS as a way of "signing" libraries. I don't think there is a way for ordinary users to perform this signing.
Have you check in the documentation? It might be documented there. I don't have access to a machine with Dymola on it right now to check.
Since Dymola 2017 FD01 classes can be locked.
Right-Click a class in the package browser and select Lock...
This will create the annotation
__Dymola_LockedEditing="<reason-for-locking>"
and the class and nested classes (e.g. classes in a package) are not editable anymore.

Workflow for modifying existing crud scaffolded model, views & controllers

I am in the process of learning Yii framework. I have always previously built plugins in wordpress and I have never used a PHP MVC framework before.
Assuming I have designed my database
Used Yiic shell - console to model the db and create crud classes etc.
Modified the controllers and views to my custom requirements.
Now the client requirements change and an extra field is required in the database.
I modify the database to add for example "tel2" field to the customer table.
Do I need to update the model, view and controller manually to incorporate these changes or do I save customisations then get Yiic shell to re-scaffold the model, view & controller, then re-write the customisations manually?
I am sure that I can do either, but is there an easier way / is there a way in which you all work which makes your lives easier?
This was a question on my mind also when I began Yii.
The simple answer to it is you dont have to change everything. The Gii module is a really powerful feature of Yii and after making the CRUD and the model after a DB table, and if you have your own custom functions and methods and then you decide that you need to alter a table and add a new column to it, all you need to do remake the model in gii and it shall show the the modified code in a seperate link tagged as "diff".
Gii only generates the code, it does not overwrite it.
Now all you need to do is open up the "diff" make sure that you do not overwrite the code as there would be an overwrite button as well. After you check out the "diff" code, it shall show the new columns and the new properties highlighted, now all you need to do is copy the requisite changed code into your original code.
This way, you can do as many changes as you want with everything remaining intact.
There is also another method. You can use a base class and extend all your code into another file. This way, all you need to do is change the base model and everything still remains intact.
I think this should have answered your question.
Regards,
You should look at gii as a tool that gets you started quickly. But once you created your models and maybe CRUDs you can usually forget about it. Your project code evolves and - if it's not a very simply project - you will have a lot of manual changes to the auto generated code anyway.
So every time you touch your DB you will update the related files. Often this only involves to add a new attribute rule in rules() in your model, and adding another input field to the form view.

Why Local Classes don't show up in SE38 Classes list?

I'm writing an ABAP program using OO objects. In SE38, under the class folder of my program, some of my local classes do not show up. Some do.
All my classes are stored in an 'include'. As far as I know there's no Class-Builder capability for local classes.
When I rename a class, sometimes it gets renamed in the folder listing mentioned above, sometimes it doesn't.
When I add new classes, sometimes they show up, sometimes they don't.
What am I missing? Is there a particular way to add local classes to an include with other classes and have it show up in the Classes folder? Is there a way to refresh the listings?
Syntax is is being checked, the program finds the classes, so SAP is reading everything and recognizing it just fine. It just doesn't display under the classes folder.
As much as I enjoy OO, I'm starting to get the feeling that although it's the path forward, it's also semi-masochistic. I'm trying to be the leader of our group to encourage OO over classic ABAP. Things like this though, I have to iron out and understand before I could ever convince others. :)
The list of local objects in SE80/SE38 (classes as well as data types, forms and other stuff) isn't refreshed as frequently as one would like. It's not like the Outline view that you might know from Eclipse or similar tools from other IDEs. When in doubt, you might want to right-click the program in the tree view and rebuild the object list. Or you might want to switch to global classes altogether, which gives you a much better tool support.

Fluently map assemblies/entities at run time

Simple question for I bet a not so simple answer.
Think of a project like Wordpress. The base of Wordpress is great and the developers built it to be extended with widgets or plugins etc.
Now think NHibernate, specifically with Fluent Mappings.
Put them together and you have a great and stable "base" system BUT how do you load mappings presented from external assemblies? I realize that the system would have to load the Assemblies on the fly using reflection but how do you configure nHibernate, Fluently, at first run to realize that there are extra entities to be loaded from those assemblies? How do you reference them?
I know you can;t add Mappings at run-time after the configurations is made, well you have to recreate the SessionFactory. This is why I want to load all required entities at runtime.
I also know that this can be somewhat accomplished with Dependancy Injection but I do not wish to go that route nor want the extreme baggage that comes with it.
If the plain old nHiberante config file can be modified and then referenced at runtime to reflect new Entities I can only assume there has to be a way to do it Fluently.
Also, based on answers: do you make the configuration from the base project or a DATA ACCESS assembly?
Thanks for your help.
You can pass an NHibernate Configuration object to Fluently.Configure(). That way you can update the configuration. You need to re-create the session factory when you do that, like you said.
You can scan the assemblies in the bin folder for assemblies that contain fluent mapping classes (Assembly.Load, then check
Assembly.GetExportedTypes()
.Any(x => x.IsClass
&& !x.IsAbstract
&& typeof(IMappingProvider).IsAssignabledFrom(type))
or similar) and add the assembly. When all assemblies are scanned, (re-)create the session factory.
I'm doing something similar in an extensible application framework I have written (although I've moved to from Fluent NHibernate to NHibernate mapping by code, but the principles are similar).

Eclipse: Project nature benefits, reading project & plugins settings

So far I have two short questions:
1) What precisely are the benefits of creating custom nature?
2) Is it possible to somehow programmatically read files in [project]/.setting or [workspace]/.metadata/.plugins?
I'm using Eclipse Helios (3.6).
Ad 1. I've read that you can't have two natures ofthe same set, that you can use it to associate certain perspectives/tools (ex. builder) with it but well.. anyting else I can't do easily without nature? Ex. I can easily add a builder by modifying an IProject variable.
Ad 2. I tried to find a way to read project specific settings or plugin settings but failed. No specs, different file types, inconsistent XML tags... Is it at all possible without parsing them manually?
Thanks for your help!
Paweł
Think of a nature as a flag. All project-related functionality in Eclipse is triggered by natures. Project properties pages, context menu items, etc. appear based on presence of natures. Third parties can check for presence of nature to tell if the project is of certain "type". A nature also has install/uninstall methods. This gives you a convenient place to implement all actions that need to happen on the project when your technology is enabled. Why is that convenient? Because a third party can simply add the nature without knowing what else is necessary to configure and your code takes care of the rest.
Plugins write to [project]/.setting or [workspace]/.metadata/.plugins locations in different ways. The file formats are never documented as they aren't meant to be manipulated directly. Some plugins re-use the common ProjectScope and InstanceScope classes to read/write the data. Some read/write on their own. I would start with what information you are trying to read, figure out which plugin it belongs to and then see if there is public API in that plugin for accessing that information. Reading these settings directly is almost never going to be the correct approach.