How do I get an event using fullcalendar getEventSourceById? - fullcalendar

The function as mentioned in the docs doesn't seem to be working:
Events are added with ids 1 and 2.
I execute calendar.getEventSourceById(1)
I expect to get the first event
To reproduce see here: https://codesandbox.io/s/full-calendar-demo-forked-iihhvn

As mentioned in the comments, I should have used
calendar.getEventById(1)
and not
calendar.getEventSourceById(1)

Related

Is it possible to show all options in Tokenize2?

Tokenize2 is a javacsript lib to select multiple options.
It provides a very neat UI to start writing and then get a list of options to select from. Selected options will show up as "tags" that can be removed with "x" link.
So far all is fine. But Right now you need to know what your looking for and start write at least one character to see matching alternatives.
In my scenario there are very few alternatives and they are not known to the user. I would like to show ALL options when the user clicks the input box. There is a configuration option named searchMinLength but it is already set to 0.
Is there a workaround that can be used? Maybe like triggering load and dropdown manually?
I know there are a lot of similar alternatives but I picked Tokenize2 because:
It looks clean and nice
It works in mobile browsers
I don't know if there is an "official" approach, but after some investigation I have found an acceptable workaround.
After downloading the Tokenizer2 sourceode I found the following line that triggered my attention:
if(this.input.val().length > 0){
this.trigger('tokenize:search', [this.input.val()]);
}
My interpretation is that the internal search command is not triggered unless the user input has at least one character. This line in sourcecode could easily be modified. I have filed a suggestion for this here: https://github.com/zellerda/Tokenize2/issues/26
My current workaround is to add an event listener for the select event and there trigger the internal search command. That works fine for my scenario and does not force a source code rewrite.
$("#my-dropdown").on("tokenize:select", function (e: Event, routedEvent: boolean) {
$("#my-dropdown").trigger('tokenize:search', "");
});
Tokenize2
This link worked for me GitHub
$('.tokenize-sample-demo1').on('tokenize:select', function(container){
$(this).tokenize2().trigger('tokenize:search', [$(this).tokenize2().input.val()]);
});

How do I register a MediatR post processor

I would like to try the new pipeline feature in MediatR: https://github.com/jbogard/MediatR/wiki/Behaviors
I tried the following, but it does not get executed
services.AddMediatR();
services.AddTransient(typeof(IRequestPostProcessor<,>), typeof(PostHandler<,>));
What am I missing?
You need to register the behavior associated with post-processors, like this unit test shows.
Your registration code would look like:
services.AddMediatR();
services.AddTransient(typeof(IRequestPostProcessor<,>), typeof(PostHandler<,>));
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RequestPostProcessorBehavior<,>));
That behavior will get all the post-processors you registered and execute them.
Edit
After a comment about the post-processor running twice, I had a look at the code that registers MediatR in the ASP.NET Core built-in DI container, and it turns out instances of IRequestPreProcessor<TRequest, TResponse> and IRequestPostProcessor<TRequest, TResponse> are automatically registered as you can see here. What's left to do to get them running in the pipeline is just register the associated behavior. So the necessary registration is then:
services.AddMediatR();
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RequestPostProcessorBehavior<,>));
I encountered the same issue as Larsi in the comment above. My code looked like this
services.AddScoped<IPipelineBehavior<AddMessageRequest, MessageResponse>, RequestPostProcessorBehavior<AddMessageRequest, MessageResponse>>();
but the behaviour still executed twice. My solution was to simply not register it manually, seems like the registration is handled otherwise now.
In my case services.AddMediatR(Assembly.GetExecutingAssembly()); was enough.
Would be nice if someone could expand on why this is.

updated_{$meta_type}_meta not firing, but updated_post_meta is

I'm not sure if I'm using it correctly, but I can't get the updated_{$meta_type}_meta hook to work. There is a updated_post_meta hook which runs when you save a posts meta (and possibly other times, I haven't checked). I can't find much reference to updated_{$meta_type}_meta apart from here, so I don't really understand if I am even hooking it correctly, because I didn't read it properly at first and so thought it should be used like: updated_CPT_meta, but that didn't work, so I tried a meta key instead of the CPT.
My question is, what should $meta_type be ?
Of course I found this straight after I posted
As the page at https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/meta.php#L0 states, $meta_type Type of object metadata is for (e.g., comment, post, or user).
So, you should just use it as updated_post_meta for any CPTs also.
duh.

FullCalendar - flexible time range for day\week agenda

I was trying to play with the minTime and the maxTime, I need the hours range to be from 6:00am untill 5:30am.
Unfortunately this is not possible, I've tried to use the 'minTime' and 'maxTime' and it gave me an empty calendar.
Is there any workaround that you guys know about ?
Many thanks :)
Moving to answer from the comment.
Looking at your requirement I think there is only one option, you have to change the code of the plugin. I can tell you that inside function "buildSkeleton" it creates the dom with css "fc-slot" there it format the time before it shown in UI. You have to change there probably to meet your requirement.
My workaround will be allowing event creation until next hours on the next day. I'm doing this by very little code changes, find the following code on your fullcalendar.js,
function slotSelectionMousedown(ev) {
and find where it says,
if (cell && cell.col == origCell.col && !getIsCellAllDay(cell)) {
then remove cell.col == origCell.col so it will be if (cell && !getIsCellAllDay(cell)) {,
then on your fullCalendar init call, set selectHelper to false or don't define it at all.
EDIT: add demo (select 'Futsal'), http://buking.my/Galaxy

How to call ICaptureGraphBuilder2->RenderStream twice?

I have read in msdn RenderStream that we can call RenderStream multiple time to make long filter chain. I have following filter chain:
Capture Filter -> Sample Grabber -> Transformation Filter -> Video Mixing Renderer9
I'm trying to do the same using RenderStream programmatically.
pBuid->RenderStream(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video,pCap,pSampleGrabber,pTransformFilter);
pBuid->RenderStream(NULL,NULL,pTransformFilter,NULL,pVMRender);
But, above code does not work. After executing, first RenderStream it shows console window(win32) and does nothing.
Please help me how can I render Capture->Sample Grabber->Transform Filter->Renderer.
Resolved the issue:
#CPlusSharp,
you were right it was media type issue. I set proper media tyep for AM_MEDIATYPE.
Thanks to all for help :)
You need to use Pin_Category_preview if you are using videoRenderer. Try the following:
pBuid->RenderStream(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video,pCap,pSampleGrabber,pTransformFilter);
pBuid->RenderStream(&PIN_CATEGORY_PREVIEW,&MEDIATYPE_Video,pCap,null,null); //the preview pin automatically connects to the renderer.

Resources