Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
On page load I have a function that sets my event sources like this:
var source1 = {
url: '/Feed1.aspx?param=abc',
color: '#4793E6',
textColor: 'black'
};
var source2 = {
url: '/Feed2.aspx?param=abc',
color: '#4793E6',
textColor: 'black'
};
Then I create the FullCalendar doing something like this:
$('#Calendar').fullCalendar({
eventSources: [
source1,
source2
]
});
This successfully loads both sources and renders the calendar. Then after changing a value using a drop-down on the page I want to remove source1 and source2, recreate them based on the changed value and refetch the events doing this:
$('#calendar').fullCalendar('removeEventSource', source1);
$('#calendar').fullCalendar('removeEventSource', source2);
var source1 = {
url: '/Feed1.aspx?param=defgh',
color: '#4793E6',
textColor: 'black'
};
var source2 = {
url: '/Feed2.aspx?param=defgh',
color: '#4793E6',
textColor: 'black'
};
$('#calendar').fullCalendar('addEventSource', source1);
$('#calendar').fullCalendar('addEventSource', source2);
/* According to the documentation this is NOT needed, but I tried anyway */
$('#calendar').fullCalendar('refetchEvents');
The event sources are successfully removed, but after changing the source values (using the same successful function as I do initially) and re-adding them, the fullCalendar doesn't try to fetch the events automatically which according to the documentation it's supposed to and still doesn't when I manually call refectchEvents.
No JavaScript errors are being thrown it just doesn't properly alter the sources and/or refetch the events.
What am I doing wrong?
Answer from comment
Be careful to use case sensitivity when getting elements by Id.
Don't feel bad though, it happens to all of us at one time or another!
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
So I've been building my first app and when I recently updated to Xcode 12 multiple issues have occurred...
I have noticed that there is no longer app and scene delegate files but my project is still using it. Wondering how I clean this up without copying and pasting everything into a new project.
I also am having multiple warnings saying:
"The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99."
I currently have my Deployment target to iOS 13. If I change it to 9 my URLIMAGE module comes up an error as it has a minimum of 11. When I change it to 11 I have 999+ errors...
example below:
I have no idea what to put it to!
I am also seeing along with URLImage that my firebase isn't properly working and that most of my UI has disappeared.
I am running through an instagram tutorial and my "Home" feed is now blank. My story feed file is still working fine though, not sure if it has something to do with firebase or URLImage?
I have played around with the view and added in a rectangle underneath my story scrollview and it has appeared so I suspect it has something to do with firebase.
Current code:
import SwiftUI
import URLImage
import Firebase
struct HomeView: View {
#ObservedObject var homeViewModel = HomeViewModel()
var body: some View {
NavigationView {
ScrollView(.vertical, showsIndicators: false) {
Story()
Rectangle().frame(width: 200, height: 200).foregroundColor(.red)
if !homeViewModel.isLoading {
ForEach(self.homeViewModel.posts, id: \.postId) { post in
VStack(alignment: .center) {
HeaderCell(post: post)
FooterCell(post: post)
}.background(Color.white).cornerRadius(10)
.padding(.leading, 10).padding(.trailing, 10)
}
}
}
This is my HomeViewModel:
import Foundation
import SwiftUI
import Firebase
class HomeViewModel: ObservableObject {
#Published var posts: [Post] = []
#Published var isLoading = false
var listener: ListenerRegistration!
// init() {
// loadTimeline()
// }
func loadTimeline() {
self.posts = []
isLoading = true
Api.Post.loadTimeline(onSuccess: { (posts) in
self.isLoading = false
if self.posts.isEmpty {
self.posts = posts
}
}, newPost: { (post) in
if !self.posts.isEmpty {
self.posts.insert(post, at: 0)
}
}) { (listener) in
self.listener = listener
}
}
}
Any help would be very much appreciated!
Without seeing your code, it's hard to say what exactly is the cause for the issues you're seeing. However, to answer some of your questions:
You can still use the old way the app is set up (using the AppDelegate and SceneDelegate. See my answer here for more details
You can safely ignore the warnings. If it bothers you a lot, check out this answer for a way to match the deployment target of your pods.
As for why your UI has disappeared, it would be useful if you could provide a couple of relevant code snippets and a few lines from your log output. Also, make sure to check if your Security Rules are set up correctly.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I'm a total beginner. I'm using Meteor for a school project and I'm trying to create a ranking. I want to rank users according to their score. I want to display their usernames with their scores.
enter image description here
the function I found to sort the users and the following one
Meteor.users.find({}, { sort: { score: -1 } });
I would like to include it in the following code
Template.classement.helpers({
users() {
Meteor.users.find().forEach(function(oneUser) {
const affichage = `nom : ${oneUser.username} score : ${oneUser.profile.score}`;
console.log(affichage);
console.log(oneUser.profile.score);
console.log(oneUser);
});
return Meteor.users.find();
},
});
on the html side, I have this to display but it dosen't work
<template name="classement">
<h1>Classement</h1>
{{#each users}}
{{user}}
{{/each}}
</template>
Could you please help me. (sorry for the grammar, English is not my first language).
Welcome to SO!
The issue is in the sort:
Meteor.users.find({}, { sort: { score: -1 } });
This attempts to sort documents by the top level field score. While you have score stored in a sub-document, under profile.
The syntax to sort by an attribute of a submodule in MongoDB is this:
Meteor.users.find({}, { sort: { 'profile.score': -1 } });
In "FullCalendar" I could add an event using "addEventSource" by array manually, however, I could not succeed adding the event through Google Calendar ID.
$('#calendar').fullCalendar("addEventSource",{
events: [
{
title : 'event1',
start : '2019-02-01'
}
]
});
THE BELOW SNIPPET NOT GETTING THROUGH. PLS ASSIST
$('#calendar').fullCalendar("addEventSource",{
events: {
googleCalendarId: 'abcd1234#group.calendar.google.com',
}
});
FYI by FUllcalendar: Source may be an Array/URL/Function just as in the events option. Events will be immediately fetched from this source and placed on the calendar.
Firstly please ensure you followed all the steps in the documentation (https://fullcalendar.io/docs/google-calendar) beforehand otherwise it won't work.
Secondly, your object structure is wrong. The events wrapper should not be there when specifying an event source. Perhaps you confused the events option in fullCalendar as being part of the structure required for an event source object, which is documented here: https://fullcalendar.io/docs/event-source-object
Specifically it documents the structure for a google calendar to be the source:
{
googleCalendarId: 'abcd1234#group.calendar.google.com',
color: 'yellow', // an option!
textColor: 'black' // an option!
}
So I suggest you change your code as follows, to match the documented object structure. Basically you just remove the erroneous events bit:
$('#calendar').fullCalendar("addEventSource", {
googleCalendarId: 'abcd1234#group.calendar.google.com',
});
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Is anyone succesfully adding adsense (loads with each pageview) or even better, with doubleclick (DFP)?
No matter what I try I cannot get them to show anywhere.
You can add Adsense as follows. This use the iron:router package.
<template name="MyAds">
<div class="leaderboard"></div>
</template>
Template.MyAds.rendered = function() {
$.getScript("//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js", function() {
var ads, adsbygoogle;
ads = '<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-72414***074839" data-ad-slot="4009***57" data-ad-format="auto"></ins>';
$('.leaderboard').html(ads);
return (adsbygoogle = window.adsbygoogle || []).push({});
});
};
Router.map( function () {
this.route('MyRoute', {
waitOn: function() {
return IRLibLoader.load("//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js");
}
});
});
See here for more info: https://gentlenode.com/journal/meteor-18-add-google-adsense-to-your-application/37
I am sure there is a simple solution, but after reading existing posts and the documentation, I haven't been able to locate it just yet. This is my first post here, so any help is much appreciated.
I am integrating the FullCalendar with ExpressionEngine and the Calendar module for EE, and I have events rendering in FancyBox.
My only remaining issue is that the background of each event is the same color. What I am wanting to accomplish is on any given day, make multiple events have a different background color to identify the event as unique. In the documentation, it explains how to change the background color, but it's an "all-or-nothing" solution.
I also attempted to tweak the styles, but this made every day cell have the background color, rather than the actual individual events.
The code that builds the calendar and populates events from EE is listed as follows:
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next',
center: 'title',
right: ''
},
editable: false,
events: [ {}
{exp:calendar:events event_id="{segment_3}" sort="asc" dynamic="off"}
{occurrences}
,{title: '{event_title}',
url: '{url_title_path="path_to/event/"}',
start: new Date({occurrence_start_date format="%Y,%n-1,%j"}),
end: new Date({occurrence_end_date format="%Y,%n-1,%j"}),
allDay: true,}
{/occurrences}
{/exp:calendar:events}
],
eventClick: function(event) {
if (event.url) {
$("a").fancybox(event.url);
return false;
}
}
}); });
This would be simple to do if the events were manually being populated, but the data is coming from ExpressionEngine, rather than being hard-coded.
Any thoughts on how to make each event on a per-day basis render with a different background color than any of the other events listed for that same day?
Thanks for reading!!!
The current version of fullCalendar has a property on an event object '.backgroundColor' which can be set to change the background colour of that event. Of course you'd have to write some code to set up the background colours to all be unique within a day.
You may consider using the css3 nth child selectors here. This will allow CSS to automagically change the colors for you. See: http://css-tricks.com/how-nth-child-works/
You would of course need to target the appropriate elements, but without seeing the full DOM it will be very difficult for us to help with that here.
You can use eventAfterAllRenderwhich is triggered after all events have finished rendering in the fullCalendar from both source.
eventAfterAllRender: function( view ) {
var allevents = $('#calendar').fullCalendar('clientEvents');
}
Now, with the allevents object, you can do whatever toy wish.
Here is the one I took for me:
eventAfterAllRender: function(view) {
var allevents = $('#calendar').fullCalendar('clientEvents');
var countevents = 0;
if( allevents.length ) {
countevents = countevents + allevents.length;
}
if(!countevents) {
// alert('event count is'+countevents);
console.log('event count is',countevents);
}
}
One of my friend was able to get the id of duplicate events and now I can delete the duplicate event within a loop as:
$('#calendar').fullCalendar('removeEvents', allevents[i].id);
Now it is up to you. Very sorry because I am running a busy schedule nowadays. I'm glad if someone would generate a proper solution for Mr. Lane from this(even by editing this answer).
Thank you.