How do I use a clipping path in transloadit? - image-clipping

In the transloadit docs it mentions a parameter for the clipping path but I can't find any examples of how to actually use that.
See https://transloadit.com/docs/conversion-robots#image-manipulation-robots and look for the "clip" parameter.

If you set clip to true, then it will act as a toggle (automatically taking the first clipping). If you set it to a string it's the name for when there are multiple clippings in an image. Other operations in the step, then only apply to the selected clipping.

Related

VSCode API: Access the minimap

Is there any way to access the "minimap" that optionally appears next to the scroll bar on the right hand side of the editor?
Preferably I would like to access that panel's width in pixels.
The best I could do to get the values I want is to read the current editor configuration (also settable from the vscode settings UI/JSON).
const editorConfig = vscode.workspace.getConfiguration('editor');
const minimapOn = editorConfig.get("minimap.enabled");
const minimapWidth = editorConfig.get("minimap.maxColumn");
But this only lists the maximum width, not the current one.
Configuring the Width of the Editor's Minimap
The Minimaps with is configurable, not by pixels, but by characters.
The reason it is configurable by characters is because it gives developers a way of setting the minimap's width to the exact width that there longest lines of code are. This is beneficial, as it makes the minimap as wide as needed, without taking up any unnecessary space.
Below is the setting that changes the width of the editor's minimap.
// #file Globally Scoped "settings.json" file
{
"editor.minimap.maxColumn": 75
}
75 can be set to any amount of characters you choose.
Now the part about the API
Anytime you have a setting that does what you want, you can use the API to apply it to your extension. I don't want to continue explaining anything byond the scope of this question, so I will provide a link to the documentation that covers the method used to change a setting using the VS Code API, and a snippet showing you how to use the method to change the minimap's columns width.
Below shows the code an extension might include to change the size of the minimap.
await vscode.workspace
.getConfiguration()
.update(
'editor.minimap.maxColumn',
100,
vscode.ConfigurationTarget.Global
);
NOTE: I wrote the example above off the top of my head. I know that the semantics are all correct, but you will probably have to play with it to get it to do exactly what it is your going for.
Here are a couple links to help you understand what your doing.
"vscode.workspace.getConfiguration()" This is can be interpreted as the base of program-interface that changes settings. From this part of the API, a few methods, objects, constants, and events extend, all of which are used to set, get, and mutate configurations within VS Code.
"The Configuration target" sets the settings.json file you are targeting. Global is a good bet, I prefer "workspace" (which is not the same as "workspace folder".

How do you set the size of an array that is exposed in Blueprint from within Blueprint?

Is there a way to expose an array of undetermined size to the blueprint editor so that the level/game designer can adjust the size of the array?
In my example, I want an array of gunshot sound effects.
In my header file I have this:
UPROPERTY(EditAnywhere)
USoundBase* MuzzleSound[5];
... but I don't know how to do it without having to already know the size.
Over in BP I want some way to be able to adjust the size to add even more if desired:
Is this possible?
You can use a TArray. TArrays are the default array the editor uses within blueprints.
UPROPERTY(BlueprintReadWrite, EditAnywhere)
TArray<USoundBase*> MuzzleSound;

Alternative to simulink transparent subsystem

I need to organize a set of elements in simulink. The first method is to create a subsystem. The problem with subsystem is that the elements inside it are no longer visible. An alternative method is to create a colorized box and put it behind a set of elements as a background. It makes a lot of troubles during selection of elements.
The ideal method is to have a subsystem which is transparent but you can see the elements inside it. So you can make it large and see inside it without opening it.
What is the feasible alternative method?
Knowing that there is no support by simulink doing this, the only possibility would be to use a mask icon which shows the content. The following is a very rough prototype for the mask code:
model='s1/Subsystem';
loc=fullfile(pwd,[model,'.png']);
print(['-s' model], ['-dpng'], '-r300', loc);
image(loc);
port_label('input',1,'In1');
port_label('output',1,'Out1');
Obviously this prototype has multiple issues which must be addressed when really using the code:
Remove the hard-coded directory.
Set in- and outports automatically.
create required folder structure. (folder s1 must be created once manually)
Scale the subsystem block to make the image look good
work properly if pwd is not the directory the model is stored in
You can make use of the 'Icon Drawing Commands' of the mask parameter's tab 'Icon and Ports' :-
Take a screenshot of the logic gates you want to be visible on the subsystem (the ones with a blue background color shown in your question)
Save the picture e.g 'mylogic.png'
Write this command in the 'Icon Drawing Command' field of Icon and Ports image(imread('Pause_Icon.png'));
You're done. But yes, make sure you have the picture file in the same folder as your model or simply add the folder containing the picture on your path.
Of course, if you update the blocks inside the subsystem, you'll have to update the mask icon with the new screenshot.

Bokeh - How to use box tool without default selections?

I have built a bokeh app that allows users to select windows in data and run python code to find and label (with markers) extreme values within these limits. For ease of interaction, I use the box select tool for the range selection. My problem arises when repeating this process for subsequent cases. After markers are placed for the results, they are rendered invisible by setting alpha to zero and another case needs to be chosen. When the new select box includes previous markers, they become visible based on the selection. How do I override this default behavior? Can markers be made unselectable? or can I add code to the customJS to hide them after they are selected?
Thanks in advance for any help!
There are a few possible approaches. If you just want non-selected glyphs to "disappear" visually, you can set a policy to do that as described here:
http://docs.bokeh.org/en/latest/docs/user_guide/styling.html#selected-and-unselected-glyphs
Basically, for bokeh.plotting, pass
nonselection_fill_alpha=0.0,
nonselection_line_alpha=0.0,
as arguments to your plot.circle call or whatever. Or if you are using the low level bokeh.models interface, something like:
renderer.nonselection_glyph = Circle(fill_alpha=0.0, line_alpha=0.0)
But be aware (I think you already are) that the invisible markers are still there, and still selectable if the user happens to draw a box over them with the selection tool.
If you truly want only a subset of the data to be visible and selectable after a selection, I'd say you want to replace the data in the column data source wholesale with the subset in your selection callback.

jquery .attr('alt','logo').css('display','none') not working !

I have the three following lines and the first two line gets all the images on the document and hides all, but then when I add the third line shows all the images.
What I need its to hide only the images with the attribute alt=minimize and alt=maximize but for some reason hides all the images.
$('img').attr('alt', 'minimize').css("display","none");
$('img').attr('alt', 'maximize').css("display","none");
$('img').attr('alt', 'logo').css("display","inline");
I am using IE7, but it should be compatible with IE6 and IE8.
Any help would be very much appreciated.
Thanks.
I'm thinking you are not using the attr function correctly, might you be looking for the attribute equals selector?:
$('img[alt=minimize]').css("display","none");
What you did with your code was,
Select all images
Change their alt attribute to 'minimize'
Hide them
Select all images
Change their alt attribute to 'maximize'
Hide them
Select all images
Change their alt attribute to 'logo'
Hide them
what you do: you take every img in document and set alt to logo and then set display: inline;.
Note, that attr('alt',string) doesn't filter all images to those with alt=string, but rather sets alt attribute to string on all images.
What you want to use is this:
$('img[alt="minimize"]').css...
$('img[alt="maximize"]').css...
$('img[alt="logo"]').css...
In the call $('img').attr('alt', 'logo').css("display","inline"); the "attr" doesen't filter the set of dom elements You catch with $("img").
If you want to hide everithing but not the image with the attribute 'alt' = 'logo' I think You can:
give it an Id of logo and then calling: $("img").not("#logo").hide()
from the jquery website:
hide():
The matched elements will be hidden
immediately, with no animation. This
is roughly equivalent to calling
.css('display', 'none'), except that
the value of the display property is
saved in jQuery's data cache so that
display can later be restored to its
initial value. If an element has a
display value of inline, then is
hidden and shown, it will once again
be displayed inline.
and
attr( attributeName )
Returns: String
Description: Get the value of an
attribute for the first element in the
set of matched elements.
If instead you want to hide all the maximize and minimize images (both share the "imize" part of the attribute):
$(parentElement).find("img[#attr $= '*imize']").hide()
OP is referring to
http://dev.w3.org/csswg/css3-values/#attr
alt I think is simply a string type, not "logo" whatever that is, that is not a data type.
try that. in fact, you can look up alt in the html5 img
http://www.w3.org/TR/html5/the-img-element.html#the-img-element
http://www.w3.org/TR/html5/the-img-element.html#attr-img-alt
http://www.w3.org/TR/html5/the-img-element.html#alt
(in order of reference clicking, last one is the target)
even if this isn't the exact answer (it should be), it should be a step in the right direction.
I am actually trying myself to figure out how to reference a css property within css with attr() - it's mentioned within the top URL. if I had my druthers, I could be using css calc() along with it, but that's draft. maybe I can get it to work...