Dears:
I found there are two classes named "SingleSampleMediaPeriod" & "MergingMediaPeriod" which implements the interface = MediaPeriod.
But I do NOT see where they are applied?
Does there anyone know the usage case for them?
Thanks~
Related
The CSS.Pseudo types of csstypes have a bunch of CSS selectors like for ':hover' , ':active' and so on.
Is it possible to create a new type based on CSS.Pseudo, which accepts all the CSS.Pseudo types but with a '&' in front?
For example '&:hover', '&:active' and so on.
I want to be able to do something like
type CSS.Pseudo = ':hover' | ':active' ... etc.
type CssStyle= { [SOMETHINGSOMETHING CSS.Pseudo]: string}
const styles: CssStyle= {
'#:hover: someCssString, //OK
':hover: someCssString, //NOT OK
'&:hov': someCssString //NOT OK
}
I've tried a billion things on TS Playground but I feel I'm just not good enough at TS or it's just impossible.
You can't do this programmatically, at least as of TypeScript 3.5.
This has been suggested before, and the suggestion was closed as a duplicate of either a string literal key augmentation or a regular expression string literal validation suggestion, neither of which are particularly close to being incorporated into the language. If you really want to see this happen, you might want to go to one or both of those issues and give them a 👍 or possibly describe your use case if you think it's more compelling than what's already there.
Sorry this isn't the answer you probably want, but at least you can stop trying to get the compiler to do this for you. Good luck!
I am using JMS\Serializer in my project and I want to ignore one property only if the array in it is empty.
I tried something like :
#JMS\Exclude(if="count('$this->required') === 0")
or
#JMS\Exclude(if="empty('required')")
but got a syntax error.
Can anyone help me on this?
thank.
What you need was implemented recently and it is in release-1.7 so you might as well wait for it. It is called #SkipWhenEmpty
#SkipWhenEmpty This annotation can be defined on a property to
indicate that the property should not be serialized if the result will
be "empty".
This is the bug related it.
You need this one:
#JMS\Exclude(if="!object.required")
Is there a simple way to check if a content-type, or a specific object, has Versioning enabled/disabled in Plone (4.3.2)?
For context, I am making some unique conditionals around portal_actions. So instead of checking path('object/##iterate_control').checkout_allowed(), I need to first see if versioning is even enabled. Otherwise, the action in question does not display for items that have versioning disabled, because obviously it isn't checkout_allowed.
I didn't have any luck with good ole Google, and couldn't find this question anywhere here, so I hope it's not a dupe. Thanks!
I was able to get this working by creating a new script, importing getToolByName, and checking current content type against portal_repository.getVersionableContentTypes(). Then just included that script in the conditional.
I was looking for something like this that already existed, so if anyone knows of one let me know. Otherwise, I've got my own now. Thanks again!
The first thing that checkout_allowed does is check if the object in question supports versioning at all:
if not interfaces.IIterateAware.providedBy(context):
return False
(the interface being plone.app.iterate.interfaces.IIterateAware:
class IIterateAware( Interface ):
"""An object that can be used for check-in/check-out operations.
"""
The semantics Interface.providedBy(instance) are a bit unfortunate for usage in conditions or TAL scripts, because you'd need to import the interface, but there's a reversal helper:
context.portal_interface.objectImplements(context,
'plone.app.iterate.interfaces.IIterateAware')
I was checking some code , I found comClass attribute.
what is that and what is it used for?
is there any good articles about that?
Thanks
Pretty easy to find, yeah... https://www.google.com/search?rlz=1C1CHFX_enUS384US384&sourceid=chrome&ie=UTF-8&q=ComClassAttribute
First link: http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.comclassattribute.aspx
Fifth link: http://mikedimmick.blogspot.com/2005/09/what-does-vbnet-comclass-attribute-do.html
It seems to be relevant only to VB (as in, it's not relevant to C#, for example). See this:
http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.comclassattribute.aspx
Also, I thought this was a good read: http://blogs.msdn.com/b/vbteam/archive/2007/06/01/so-what-does-lt-comclass-gt-actually-do.aspx; it basically says this is how you'd make a VB.NET class visible to VB6.
Other related threads that I found:
Will VB.NET automatically generate ComClass attribute and guids?
http://mikedimmick.blogspot.com/2005/09/what-does-vbnet-comclass-attribute-do.html
I am working on an add-on component that needs to play nice with other similar add-ons. There is a 3rd party component that decided to implement the functionality a little differently than the default.
What I am trying to do is call an overload of a method that only the 3rd party component has, like this:
Select Case True
Case TypeOf provider Is 3rdParty.Provider
result = DirectCast(provider, 3rdParty.Provider).GetNames(method, True)
Case Else
result = provider.GetNames(method)
End Select
Unfortunately, the DLL that contains 3rdParty.Provider is optional, so this code will give compile errors if it is not present. How can I accomplish the same thing but make it safe to run whether the 3rdParty.Provider.dll is present or not?
You need inversion of control for this.
Check Castle Windsor or Microsoft Unity projects.
These will provide you a way to switch implementations of same base type by configuration.
http://www.castleproject.org/container/
http://unity.codeplex.com/
After some trial and error and going through several MSDN docs and forum posts, I was able to piece together the following solution:
Dim t As Type = Type.GetType("3rdParty.Provider, 3rdParty.Provider")
Select Case True
Case Object.ReferenceEquals(provider.GetType(), t)
result = Convert.ChangeType(provider, t).GetNames(method, True)
Case Else
result = provider.GetNames(method)
End Select
I tested removing the 3rd party DLL reference from my project and this works without a hitch and calls the default GetNames in that case without any exceptions or compile errors.