This is basically an extension of the question here.
I am working on an old MFC application where it seems the resource.h file has been manually edited and has gone messy. I see that there are conflicting IDs in there.
I just want to confirm if we can have two resources with the same ID of different type.
For example, I have something like
IDD_1 101
IDS_2 101
or
IDR_1 102
IDS_2 102
Basically, there are resources defined with the same ID, but of different types.
A comment to the original question says that Resources of the same type don't share identifiers. If that is true, is it also valid for the IDR_xxxxIDs?
I am asking because I am using the Resource ID Organiser which seems to think that all IDs must be unique.
Although it's not recommended it should work OK with different types. The API FindResource uses the ID and Type to identify the resource. The problems you're more likely to hit revolve around the way MFC uses the resource id to refer to another resource, e.g. the help text for a toolbar button. Those sort of bugs can be very time consuming so you might just want to bite the bullet now and re-number so your resource ids are unique.
I am asking because I am using the Resource ID Organiser which seems to think that all IDs must be unique.
I thought I would just add that there is an option in Resource ID Organiser that allows for conflicts between symbol types:
It is not documented in the help topic.
It depends on how the code uses the control. For example if the control is a button with a duplicate ID then there is no problem to use it. On the other hand, if the control is an entry of a menu then when the user click the related event finds the first available ID. I would think it is better to rearrange duplicate IDs.
Sounds like you need a resource renumbering tool. Here's a free & open source one:
https://sourceforge.net/projects/resrenum/
From the help file:
"ResRenum renumbers resource IDs in Visual Studio C++ projects. It's a console app, and it's intended to be integrated into the IDE as an external tool. It's compatible with any version of Visual Studio from MFC 6.0 onwards. ... The resources are sorted in alphabetical order within each resource type. The resource types are sorted in compliance with Windows rules."
Note that this method only works if your resource IDs adhere to the Microsoft conventions, e.g. dialog IDs should start with IDD_ and so forth, see TN020 ID Naming and Numbering Conventions:
https://msdn.microsoft.com/en-us/library/t2zechd4.aspx
Related
I am new to Sitecore and have a basic question around this. When I create a Sitecore item a Unique ID is created for this item. Is it ok if I use this item ID in the code to hold a reference to it? Does this change from deployment to deployment?
If you actually "deploy" your items -using a package or serialization (tool)-, the ID will stay the same and you can keep a reference to it in your code.
It is a good coding practice however not to spread hard-coded guids (as that is what the ID actually is wrapping) around all over your code. So either bundle them somewhere in a piece of code that can easily be deployed without side-effects or put them in a configuration file (but again, bundle them and don't mix with other stuff).
If for some reason the item would be gone some day and you need to re-create it (meaning: the id is changed) or you just need it to point to a new one, you will be grateful that you did keep it somewhere separated ;)
This is Sitecore behaviour to have Sitecore ID like a GUID. It is a very good aproach. The ID of an item can be also use in your C# code
The ID class in Sitecore is used to identify all types of item in Sitecore i.e. content items, templates, media items etc. It is a wrapper around .NET's own System.Guid struct and has a property called Guid which returns a System.Guid. Internally Sitecore stores IDs in it's SQL Server database using the uniqueidentifier type.
For exemple a template is also an item and it has a unique ID. If it wasn't the same ID between environments you need to modify your code between environments.
Sitecore ItemID always remain unique. So If you publish the content from your CM server to CD server, Item ID will not change. You can use ItemID as this ensure even if you change the name, you still reference to right Sitecore Content Item.
It is recommended to use some kind of class and put the item id there and reference from there so that in future, if you ever need to change then you change it in one place.
Using directly GUID or any number value for that matter are kind of magic values and is always prone to bugs.
A quick answer is yes, an ID does not change during deployments, so you can hold a reference in your code.
Sitecore Item Id will not change from deployment to deployment, You can use this ID in your code like:
Creating a class holding IDs
Or maybe a configuration file
I have a pretty normal MFC SDI application.
I recently started using things from the new MFC feature pack (eg CMFCToolbar), and after all these changes, I am seeing some unexplained behavior in keyboard shortcuts.
It seems some resource IDs have function key shortcuts (like F6), but I cannot find out how this works, or how to disable it.
For example, if I mouseover ID_ABC in a toolbar, I see a tooltip like:
ABC (F2)
Do ABC action
I don't see VK_F2 anywhere in the accelerator table, or anywhere at all for that matter. I also cannot find (F2) anywhere at all in the solution. This all seems very weird to me. Pressing F2 does indeed do ABC.
If I delete the entire accelerator table, that seems to "fix" the problem, but then of course I have no accelerators. As soon as I add any accelerator back, the problem re-appears.
Usually, when I run into these things, I seem to be on my own, and the cause of the problem is usually "far away", sort of like landing in some random function after a bad memory access, and saying, "why am I here"??
But if anyone knows anything about this, thanks!
Just look into the accelerator table in the resource file of your application. Yes, many standard commands do have accelerator keys assigned (eg Ctlr+S is mapped to the File Save command). You can delete the commands you do not want (individually, not the whole accelerator table). The application "remembering" the old accelerator table assignments (or not working with the new ones) may be due to saving these in the registry. Go there and delete the "Workspace" tree for your application, and then test anew.
Menu item labels must contain the shortcut as well, separated by a tab (eg File &Open\tCtlr+O). Status bar hints and tooltips are created by a string resource, with the same ID as the menu or toolbar item. You can create/edit these in the Menu Editor or the String Table Editor. The two items are separated by a newline character.
I intend to use Camunda for my product. While all camunda abilities match with my needs, i have a concern about camunda modeler controlled usage. Following are my needs in modeller
Is it possible to create custom domain specific tasks which i can simply drag-drop during modeling. It should be possible to define custom properties needed by this custom state
Can I somehow control/prevent use of custom java code/scripts by person modeling process. I want to restrict use of only my custom tasks, so that we don't end up with lot of scattered code across processes.
Can experts share views to achieve these targets?
Recently Camunda Modeler (I am using release 1.4.0, published on October 2016) has been extended to allow json template installation, which can meets all of your needs (if I understand them correctly), or at least the most of them.
You may find documentation for templates build here. The documentation is in progress, but what is already published I think it is quite clear. Briefly you have to
list all the elements you want to customise (user tasks, general tasks, service tasks, listeners, links and so on)
find out the json representation (explained in the short documentation) of each element
insert all the jsoned elements in a file (for example: myElements.json)
put the file in a specific modeler folder (see below)
close and restart the modeler
For example if you have installed the modeler in C:\Tools\camunda-modeler\, the folder to publish the file into will be C:\Tools\camunda-modeler\resources\element-templates (note that resources will be already present, but element-templates will not; it will have to be created).
If all will be right the modeler will start without any error and you will find a new dropdown list selector on the right panel (as stated in the documentation) for all the elements for which a template has been defined. Generally you have to classify each templates as either a user task, or a service task, or generic task and so on, so that when you want to use it you have to start from the generic element. For example, if you prepare in the json file 2 templates of kind of user task, say userTask1 and userTask2, if you want to insert in your new process userTask1 you have to
pick up an empty userTask
and choose from the element template selector on the right the voice userTask1, so that the empty user task becomes quickly the userTask1 (with all my custom properties with my default values)
that's it
To sum up, you may build templates with custom id and name (editable), with custom properties (editable or not, or even hidden), with eventual input/output parameters. So you may have default values properties and also tasks with simplified selections or without any selections at all.
You may find good starting examples to build your own templates at this GIT repository.
Hope that is enough to understand.
I have craeted a Visual C++ project using studio 2010 wizard in which I have added things like FileView, ClassView, PropertiesWindow, OutputWindow etc, with the help of wizard. Now I am interested in changing the default captions/names of one of these items let's say FileView. The FileView has a resource string "IDS_FILE_VIEW" associated with it with value "File View" which is displayed as a caption of the FileView window. If I change the value of above mentioned string in the resources it does not change that caption and still shows "File View" as a caption. Could anyone suggest me that how can I customize captions and other features of such common windows created through studio wizards?
Thanks a lot.
You don't say, but I assume from the "IDS" that you are using the MFC libraries.
In MFC, the resource strings like IDS_FILE_VIEW are defined and used by the designer but it is quite possible to override them. Changing the IDS_FILE_VIEW resource's value will indeed change what is displayed when that resource is used, but you may have (inadvertently) prevented that resource being used where you expect.
I would check through your project files to see where this and related names appear and verify that there are no inconsistencies.
HtH
Ruth
Im looking to build a topic map to catagorize content.
For example the Topic 'Art' may have sub categories of 'Art History', 'Painting', 'Sculpture' etc etc.
I've crawled a few online resources, but I've hit a problem related to how I wish to use the hierarchy.
I've got a lot of content that I wish to index by topic. So to give the above example, if a user searches for 'Art' then they will not only get anything that mentions 'Art', but also anything that mentions 'Painting', even if it doesnt mention 'Art'. Fair enough.
But if, in another part of my heirarchy, I have 'House Maintenance', for example, then that might also have a subtopic of 'Painting'.
But then if a user searches for 'Art', my engine will say 'well, Painting is a sub category of 'Art', so I'll include this peice of content thats all about the best colour to paint your bathroom walls....
Has anyone come across this problem before? I've tried googling, but without knowing the exact terminology its hard to make headway....
EDIT: More succinctly, 'Painting' is a subtopic of 'Art', but if something is about 'Painting' then it doesnt neecssarily follow that its about 'Art', since 'Art' is not the only parent of 'Painting'.
In "topic maps", as it is understood in the related standard you can set different "scopes" to a topic. So "painting" may be part of two scopes, with different meanings.
A topic map:
http://www.ontopia.net/page.jsp?id=vizigator
Scope:
http://www.ontopia.net/topicmaps/materials/tao.html#stp-scope
If the Topic Map you are creating is built on Topic Maps technology, then subjectIdentifiers can be used to distinguish between two Topics with the same name (both named "Painting") that actually represent two different Subjects (Painting as an Art form, and Painting in the sense of home renovation).
If someone queries about Art and you drill down to Painting, then you can return only those entries related to 'Painting as an Art form' because those Painting entries are no longer thrown together on one heap.
Turning up late to this party (you've probably already built it or moved on or found an answer) but thought I'd throw in my 2 cents having worked on a high end Topic Map based CMS.
What you are missing out in your description is how topics are linked together. Topic are linked together via Associations that in themselves have Type's and Roles. So yes painting would be a child of art and of house maintenance but they would be linked differently.
Defining your type and role is up to you really, there is no hard and fast rules its really just down to your own leanings. So
Topic: Art
Association: Source=Art, Reference=Painitng, Type=Culture, Role=Practice
Topic: House Maintenance
Association: Soruce=House Maintenance, Reference=Painting, Type=DIY, Role=Activity
I suck at categorisation but hopefully you can see what I'm getting at. You'd filter your searches based on the type and role. So if someone searched for art you'd return painting and if you wanted to dig deeper and return co-related topics you are talking about returning Culture associated topics and not DIY associated topics.
Topic Maps if done right are extremely flexible, you've also got scope and language baked in too if you do it right. You should be able to link the same topics together in a 100 different ways and see the data differently depending on your starting point.
Information Architecture for the World Wide Web would give you a good start on organizing information... it's a good read, but might not be so technically detailed.
Since you want to process House/Painting and Art/Painting differently, then it seems like you'll need two distinct entries for Painting (one for each meaning). Which one you associate a given 'lump of text' with could be based on context clues from the text itself, if your text processor is powerful enough.
For example, whenever you have a conflict like this, look in the text - do you see other words there? Like 'sink', 'wall', 'hard wood', or 'windows'? Or do you see other terms like 'Monet', 'impressionism', 'canvas', and 'gallery'? That'll allow you to automate the decision, and should be fairly accurate. The only snag is that this presumes you have a fairly healthy dictionary of 'related terms' lying around somewhere.
On the user-end, when Painting is selected, you'd simply have to either merge all the results together, or present the user an option to select which parent topic they want to be viewing results from.
I don't know of a specific name for that, but I don't think it should really be a problem, either. All it calls for is that Art/Painting and House Maintenance/Painting are understood as separate entities. Someone searching for "art" gets subcategories of Art, so gets Art/Painting. Someone searching for "house maintenance" gets subcategories of House Maintenance, so gets House Maintenance/Painting. Someone searching for "painting" gets Art/Painting and House Maintenance/Painting, which is appropriate.