Using svg-edit and some of the variants I've found that seem like they are based on the same JS libraries, I create a basic drawing then using either source editor within svg-edit, or loading up an external Notepad-created SVG, that some attributes on <g> elements for example are tossed out.
I want to amend a typical element with let's say a class="Position" it works, and retains the attribute through edit cycles. But when I use foo="bar" that attribute seems to get discarded completely.
This is fairly inconvenient because I want to use svg-edit to create an arbitrary drawing with some unique-to-me attributes that my code can later recognize.
Is this a dumb question? Am I missing something fundamental about SVGs with arbitrary non-standard type attributes included (and for retention)?
Related
Just like TImageList contains a collection of images, is there a similar component for generic files?
I know I can embed files as resources, but I'd like the convenience of storing different groups of files in different "TFileList" components, and to be able to retrieve files by name or by their position in the list.
Extra points if such a component allowed some sort of design time preview of the file content (just like TImageList lets you see what each image looks like, at design time).
(I come from Delphi where I wrote my own component to do the above, but before I rewrite and port the property editor and all that to Lazarus, maybe there is already something that is tried and tested...)
Thanks!
You can use pre-defined lazarus TFPGList to specialize list of the type, that you want, for example - UTF8String
But, there's no T<>List as a component, only as object.
So, yes, this feature will be useful and i can implement, if have time,
also, there's a very limited RTTI, which has been updated only a few months ago, so you can access Methods and Properties now, so FP is more systemized, than delphi pascal, but also not so enterprise-developed, which limits it to implementations for common opensource and shareware project problems.
Nevertheless, it is more stable and supported, even my friends can contribute.
I'm using Adobe PDF library (C++ Interface) and have been trying to remove the watermarks on an existing PDF for a while.
To add a watermark I have used the PDDocAddWatermarkFromText method, but I would need to remove the previously existing watermarks on the file.
I accomplished the task when the Watermark is added as an Annotation, but this will not cover all the possible cases, as it seems they can be added also as background Objects. Would need to know how these background objects can be removed from the file.
Thanks for help!
Well, it may prove difficult to clearly identify Watermarks that exist as purely text for removal instead of for example existing as a Watermark annotation. That being said if you can identify a pattern to how the watermarks are formatted it may be possible to devise a solution.
Have you attempted to contact the Support department for more assistance?
Watermarks will typically be the last element of the page's content stream, Backgrounds will the first element of the content stream. So I would check if the first or last element is a PDEForm. And if it is, I would then check if the PDEFormCosObj has a PieceInfo dictionary entry. The PieceInfo dictionary may indicate if it is a WaterMark or a Background.
Otherwise, you might need to analyze the content of that PDEForm for watermark-like properties (e.g. is it a Text Element with a single textRun? Does the Form|Text|TextRun's matrix indicate any rotation?)
I am having an issue loading certain SVG files in Fabric.js without grouping its elements.
The screenshots on how the file is displayed on the canvas with and without grouping are shown. The used SVG file is part of the Fabric.js' SVG test collection used at http://fabricjs.com/test/svg_import:
With grouping:
Without grouping:
Both screenshots correspond to what it results when using the Fabric.js' kitchensink. However, I obtain the same results when writing my own program.
I have tried other files and they are shown with no problems whether the grouping is performed or not. Because of this, I suppose the distortions observed for this file on the non grouped version are due to some SVG elements (transformations or groups, perhaps?) that are not very well handled by the library's SVG parser.
Is it possible to avoid this issue under certain conditions? If so, what kind of SVG elements should be avoided to prevent files from presenting this problem?
This is a well known "missing feature" in fabric.js
https://github.com/kangax/fabric.js/issues/1520
The library is not handling very good the object with a "transformMatrix" property set.
the "transformMatrix" property comes from parsing the transform attribute of the elements and the parents elements.
Normally the objects are grouped in a pathGroup object that is capable of handling the transforMatrix and give a correct rendering with the downside effect the objects cannot be moved individually or rotated/scaled.
There is a work in progress about this feature (by me) to solve this but is not complete yet.
You can download and try my branch here:
https://github.com/asturur/fabric.js/tree/experimentalCBox
Is not perfect yet but is gonna be inserted in future fabric version to fix this issue.
I'm writing a few custom CIFilters for a program. Based on the fact that CIKernel's kernelsWithString: will take multiple kernels from the same file (and a few similar clues I can't recall right now), it seems like I could provide them all in 1 plugin. Am I barking up the wrong tree, or is this doable?
I made an admittedly flawed attempt at this, and the 2 filters do show up. However, one was flawed, and using [[CIFilter filterWithName:filterName] attributes] on it produces null for the parameter list.
I believe I've fixed it now, but [CIPlugIn loadAllPlugIns] "loads newly added image units, but image units (and the filters they contain) that are already loaded are not removed." Either my fix is being ignored, or I haven't actually fixed it. Unless somebody knows a method that unloads a filter (which the Core Image Programming Guide implies is possible), I can't be sure without rebooting.
Apparently I had a misunderstanding of how the CIPlugin system works: it is not global. That is, each program's loaded plugins are independent of other programs'. So to update a plugin, simply close all programs that are using it, and replace the plugin.
To answer the main issue, yes, it's fairly easy to put multiple filters in 1 plugin.
Each filter needs it's own XxxPlugInLoader : NSObject <CIPlugInRegistration> class and Xxx : CIFilter class. (The filters' bundleForClass appear to all load from the same bundle.)
The kernels can be in the same *.cikernel file or not, but if together avoid loading the *.cikernel for each filter (it won't hurt, but it's inefficient).
Set up 1 Description.plist and 1 Description.strings, with the info for all the filters. In the plist, each filter's CIFilterClass entry must match the CIFilter class defined above. Each filters CIAttributeDescription entry is a key into the strings file.
I'm relatively new to Expression Engine, and as I'm learning it I am seeing some stuff missing that WordPress has had for a while. A big one for me is shortcodes, since I will use these to allow CMS users to place more complex content in place with their other content.
I'm not seeing any real equivalent to this in EE, apart from a forthcoming plugin that's in private beta.
As an initial test I'm attempting to fake shortcodes by using delimited strings (e.g. #foo#) in the content field, then using a regex to pull those out and pass them to a function that can retrieve the content out of EE's database.
This brings me to a second question, which is that in looking at EE's API docs, there doesn't appear to be a simple means of retrieving the channel entries programmatically (thinking of something akin to WP's built-in get_posts function).
So my questions are:
a) Can this be done?
b) If so, is my method of approaching it reasonable? Or is there something stupidly obvious I'm missing in my approach?
To reiterate, my main objective here is to have some means of allowing people managing content to drop a code in place in their content that will be replaced with channel content.
Thanks for any advice or help you can give me.
Here's a simple example of the functionality you're looking for.
1) Start by installing Low Replace.
2) Create two Global Variables called gv_hello and gv_goodbye with the values "Hello" and "Goodbye" respectively.
3) Put this text into the body of an entry:
[say_hello]
Nice to see you.
[say_goodbye]
4) Put this into your template, wrapping the Low Replace tag around your body field.
{exp:low_replace
find="[say_hello]|[say_goodbye]"
replace="{gv_hello}|{gv_goodbye}"
multiple="yes"
}
{body}
{/exp:low_replace}
5) It should output this into your browser:
Hello
Nice to see you.
Goodbye
Obviously, this is a really simple example. You can put full blown HTML into your global variable. For example, we've used that to render a complex, interactive graphic that isn't editable but can be easily dropped into a page by any editor.
Unfortunately, due to parse order issues, EE tags won't work inside Global Variables. If you need EE tags in your short code output, you'll need to use Low Variables addon instead of Global Variables.
Continued from the comment:
Do you have examples of the kind of shortcodes you want to support/include? Because i have doubts if controlling the page-layout from a text-field or wysiwyg-field is the way to go.
If you want editors to be able to adjust layout or show/hide extra parts on the page, giving them access to some extra fields in the channel, is (imo) much more manageable and future-proof. For instance some selectfields, a relationship (or playa) field, or a matrix, to let them choose which parts to include/exclude on a page, or which entry from another channel to pull content from.
As said in the comment: i totally understand if you want to replace some #foo# tags with images or data from another field (see other answers: nsm-transplant, low_replace). But, giving an editor access to shortcodes and picking them out, is like writing a template-engine to generate ee-template code for the ee-template-engine.
Using some custom fields to let editors pick and choose parts to embed is, i think, much more manageable.
That being said, you could make a plugin to parse the shortcodes from a textareas content, and then program a lot, to fetch data from other modules you want to support. For channel entries you could build out of the channel data library by objectiveHTML. https://github.com/objectivehtml/Channel-Data
I hear you, I too miss shortcodes from WP -- though the reason they work so easily there is the ubiquity of the_content(). With the great flexibility of EE comes fewer blanket solutions.
I'd suggest looking at NSM Transplant. It should fit the bill for you.
There is also a plugin called Shortcode, which you can find here at
Devot-ee
A quote from the page:
Shortcode aims to allow for more dynamic use of content by authors and
editors, allowing for injection of reusable bits of content or even
whole pieces of functionality into any field in EE