for Inkscape scripting, what is the difference between "object-set-attribute" and "object-set-property"? - vector-graphics

$ inkscape --action-list
...
object-set-attribute: Set or update an attribute on selected objects. Usage: object-set-attribute:attribute name, attribute value;
object-set-property : Set or update a property on selected objects. Usage: object-set-property:property name, property value;
...
What is the difference between an "attribute" and a "property", if any? If they are the same thing, shouldn't that be clarified somewhere?
Can either of these be used to specify text in Inkscape, which seems to be neither an attribute nor a property, but rather the inner content of an XML element?
If not, how would you script text replacement in Inkscape? You could use "sed" or some XML tool to edit the file directly, but it seems like there should be some Inkscape-specific way to do it. If there isn't, isn't that a problem?

Related

How to set dicomfile encoding

fo-dicom 4.0.6.
netcore5
I create dicom files based on existing one. Only adding few tags in cyrillic
As I understand when I open dicomfile, tag SpecificCharacterSet is used to define tag's value encoding.
Bu as I understand I can change this behavior with custom IOManager.
F.ex. if I want force encoding 1251 I can define class
public class AnsiIOManager : IOManager
{
/// <inheritdoc />
protected override Encoding BaseEncodingImpl => Encoding.GetEncoding("windows-1251");
...
}
And to assign this by IOManager.SetImplementation(new AnsiIOManager());
Am I right?
Sometimes I need to create files in different encoding at the same time in multithreading. And can I change this IOManager encoding dinamically instead of change static type value?
Changing the default encoding in IOManager is not the right way to do that. Because you add some value to a a DicomDataset and therefore also need to update the SpeicificCharacterSet in that file. The IOManager only influences the default encoding used when parsing values.
All this encoding this have been improved dramatically in version 5.0.0. So I recommend, to use fo-dicom 5.0.0. Then you can do the following:
load the DicomDataset
call dataset.AddOrUpdate(DicomTag.SpeicificCharacterSet, DicomEncoding.GetCharset( Encoding.GetEncoding("windows-1251") )), so telling the dataset, now to use the encoding you desire
add Tags with string values

Sterling Map Editor : Conditional Null Value

I have a XML to XML map on IBM Sterling B2B Integrator map.
I am trying to set an empty tag on a conditional variable as follows:
empty($my_var[counter][1].#my_var);
The result is that on output the empty tag does not show up.
Expected result:
<my_var/>
Is there any way to achieve this?
The XML element should be declared as mandatory in the map.
The PCDATA property should not have Mandatory checked if it is not required, but the element level should be mandatory.
Note also this known problem:
http://www-01.ibm.com/support/docview.wss?uid=swg21701246

Variables containing "." character in Handlebars?

I am using Handlebars templates. If I want to insert a variable in an hbs file, I add it as {{var_name}}.
The issue is, I have a large object with its keys taking formats similar to:
{
"stats.name":"John",
"stats.performance.day":123,
"stats.performance.month":4567,
"company":"My LLC"
}
If I try to add these to the Handlebars file as {{company}}, {{stats.name}}, {{stats.performance.day}}, {{stats.performance.month}} then only the {{company}} will be displayed. All other values come out blank, I assume because "." is a special character in Handlebars.
My question is, is there a way to override this, or do I actually need to iterate through this object and change every "." to a "_" or something before passing it to Handlebars to make it work?
I would recommend renaming your properties. Dot Notation is one of the two ways to access object properties in JavaScript. Typical code would look like: obj.prop. If your object's keys are not valid identifiers, then you must use Bracket Notation: obj['my-prop']. Since a dot is a property accessor, it is very unusual to see one in a property name. If I were to come across code written as obj['stats.performance.date'], I would assume it was a mistake and that obj.stats.performance.date was intended.
With that said, Handlebars does support referencing properties that are not valid identifiers. This is called "segment-literal-notation", and it is as simple as wrapping square brackets around your identifier:
{{[stats.performance.day]}}
The documentation also states that:
JavaScript-style strings, " and ', may also be used vs. [ pairs.
So the following alternatives are valid:
{{"stats.performance.day"}}
{{'stats.performance.day'}}

How do I change the inner text instead of attributes in config transformations?

I've been using config transformations a lot, but I'm struggling with one bit: the changing of "inner text" as opposed to attributes.
As an example, I've got the following in a config file (Sitecore's webforms for marketers if anyone's interested):
<param desc="connection string">Database=sitecore_webforms;Data Source=CHANGEME;user id=CHANGEME;password=CHANGEME;Connect Timeout=30</param>
and I want to change it to the proper connection string. Usually that would be part of an attribute which I can do fine but in this case it's not.
Is this possible using either the "vanilla" transformations or Sayed Ibrahim Hashimi's SlowCheetah?
You need to use the Replace transform. In your case, something like
<param desc="connection string" xdt:Transform="Replace">new connection string here</param>
You'll need to also add the right xdt:Locator attribute, to select the element.

Do *.zcml files get parsed i18n wise?

I have named utilities and would like to mark names for later i18n usage. Is this the right way?
<utility
name="Home"
i18n:attributes="name"
provides=".interfaces..."
factory=".shortcut...." />
The utility's name is not a translatable message id, but an internal technical id. You cannot use it for translation purposes.
If you look at zope.component.zcml you can see the interface for the directive containing:
class IUtilityDirective(IBasicComponentInformation):
"""Register a utility."""
name = zope.schema.TextLine(
title=_("Name"),
description=_("Name of the registration. This is used by"
" application code when locating a utility."),
required=False)
If you look at for example http://wiki.zope.org/zope3/zcml.html it will tell you that an attribute needs to be of type MessageID to be translatable in ZCML.
If you have a ZCML directive with an attribute of type MessageID, all you need to do is to define an i18n:domain for the ZCML file. The ZCML machinery knows what attributes are translatable itself based on them being of the right type. So you don't need any extra markup to note any attributes like you need in TAL.
All that said, if you work inside Plone and use i18ndude to extract messages, it won't extract any messages from ZCML files - simply because there's not a single message being defined in ZCML, that's also actually shown anywhere in the Plone UI.
If you have utilities and want to give them translatable names, give them a title attribute, like:
from zope.i18nmessageid import MessageFactory
_ = MessageFactory('mydomain')
class MyShortCut(object):
title = _('My shortcut')
and use the title attribute in the UI.
You do not want to do that. The name attribute is meant for application use, not end-users, and needs to be stable.
If you translate it, then you'll have to translate all named look-ups through-out your code too!
Titles and descriptions can be translated, using the i18n_domain="domain" marker on the <configure> element.

Resources