The memory leak was only perceptible with large dataset... Each time the
calendar view is call there is a memory build up until saturation... So I
gues that it could happen when web2py is not restarted during a certain
periode and calendar view is call many many time with a smaller dataset...
You could use web2py feature to generate data and investigate if the leak
is still there, or you can check the date of the app build... If it before
january 2013, there surely still a memory leak...
I can provide a code sample for a json feed function, but you will need to
adapt to suit your need...
Here an example :
*# Controller*
def calendar():
a='' # empty view only to allow to create a callable view to initialize
the FullCalendar plugin
return dict(a=a)
def calendar_json_feed():
rows=db(db.your_table.id>0).select(db.your_table.id,
orderby=db.your_table.order_field_if_required, cache=(cache.ram, 86400)) #
1 day = 86400 sec
# Order issue solve by order in FullCalendar. There is a specific
order issue with chrome :
https://code.google.com/p/fullcalendar/issues/detail?id=379
# To workaround Chrome specific issue I could increment start time
of event of 1 sec
events = []
for i,row in enumerate(rows):
events.append({'title': id_represent[row.id],
'allDay': False,
'start': row.date.strftime('%Y-%m-%d 08:30:00'), # Leading zero
is important for Firefox, comment 2 in answer :
http://stackoverflow.com/questions/12771886/jquery-fullcalendar-plugin-events-are-limited-to-3-in-ie-and-firefox
'end': row.date.strftime('%Y-%m-%d 09:30:00'),
'url': URL(c='your_controller', f='your_function',
args=('your_table', row.id))})
from gluon.contrib import simplejson
return simplejson.dumps(events)
*# View*
{{response.files.append(URL(r=request,c='static',f='js/fullcalendar.min.js'))}}
{{response.files.append(URL(r=request,c='static',f='js/gcal.js'))}}
{{response.files.append(URL(r=request,c='static',f='css/fullcalendar.css'))}}
{{'''response.files.append(URL(r=request,c='static',f='css/fullcalendar.print.css'))'''}}
{{extend 'layout.html'}}
<h1>{{=T('Calendar')}}</h1>
<div id="calendar"></div>
<script type='text/javascript'>
jQuery(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
editable: false,
eventMouseover: function(calEvent, jsEvent, view) {
savBg = $(this).css("background-color");
savClr = $(this).css("color");
$(this).css( { color:'#fff',
backgroundColor:"#006" } );
}, // To set the underline onMouseOver to be white
// Ex. here :
https://code.google.com/p/fullcalendar/issues/attachmentText?id=1029&aid=10290002000&name=default-mouseover-test.html&token=zcAvPMm_D7u-QIxeSHJm7AiVZic%3A1370289225654
eventSources: [
// Ex.: Google calendar
//{url: '
https://www.google.com/calendar/feeds/ml.richard.vezina%40gmail.com/public/basic
',
// className: 'gcal-event',
// currentTimezone: 'America/Montreal'},
{url: '/your_app_name/your_controller/calendar_json_feed',
'color': 'rgb(84, 132, 237)', cache: true},
// you can insert here all the other json feed you want for
the stuff you want to display, you can change color to make those
differents groups of events distinctive
],
// feed by simplejson function
//[
// {
// title: "S-20120215-U219-2p",
// allDay: false,
// start: "2013-03-22 08:30:00", // Leading zero is
important for Firefox, comment 2 in answer :
http://stackoverflow.com/questions/12771886/jquery-fullcalendar-plugin-events-are-limited-to-3-in-ie-and-firefox
// end: "2013-03-22 09:30:00",
// url: '/sgddms/lotns/read/lotns_sample/623'
// }
// ],
header: {
left: 'today prevYear,nextYear prev,next',
center: 'title',
right: 'month,basicWeek,basicDay'
},
{{if T.accepted_language.split('-')[0] == 'fr':}}
timeFormat: 'H(:mm)', // uppercase H for 24-hour clock
{{pass}}
monthNames: ["{{=T('January')}}",
"{{=T('February')}}",
"{{=T('March')}}",
"{{=T('April')}}",
"{{=T('May')}}",
"{{=T('June')}}",
"{{=T('July')}}",
"{{=T('August')}}",
"{{=T('September')}}",
"{{=T('October')}}",
"{{=T('November')}}",
"{{=T('December')}}"],
dayNames: ["{{=T('Sunday')}}",
"{{=T('Monday')}}",
"{{=T('Tuesday')}}",
"{{=T('Wednesday')}}",
"{{=T('Thursday')}}",
"{{=T('Friday')}}",
"{{=T('Saturday')}}"],
dayNamesShort: ["{{=T('Sun')}}",
"{{=T('Mon')}}",
"{{=T('Tue')}}",
"{{=T('Wed')}}",
"{{=T('Thu')}}",
"{{=T('Fri')}}",
"{{=T('Sat')}}"],
buttonText: {
prev: ' ◄ ', // left triangle
next: ' ► ', // right triangle
prevYear: ' ◄◄ ', // <<
nextYear: ' ►► ', // >>
today: "{{=T('today')}}",
month: "{{=T('month')}}",
week: "{{=T('week')}}",
day: "{{=T('day')}}"
}
});
});
</script>
Since I save you a lot of time you can consider to update the
AppointmentManager app with this example to return to community :
https://github.com/mdipierro/web2py-appliances/tree/master/AppointmentManager
Richard
On Wed, Jun 26, 2013 at 1:31 PM, Tom Russell <[email protected]> wrote:
> Well I updated to the latest fullcalendar and it seems to work good, but
> do not know if the memory leak still exists. By any chance could you share
> what you did? Also, any chance you added views for week/day in it?
>
> You can see in the example here http://arshaw.com/fullcalendar/ that it
> has buttons for day and week also. I tried fiddling with some examples to
> get it to show but am not successful yet.
>
> Thanks.
>
>
> On Wed, Jun 26, 2013 at 1:22 PM, Richard Vézina <
> [email protected]> wrote:
>
>> Letting FullCalendar consume the json feed...
>>
>>
>> On Wed, Jun 26, 2013 at 1:21 PM, Richard Vézina <
>> [email protected]> wrote:
>>
>>> Take care, I don't know if it has been solve, but I found a memory leak
>>> in this app caused by the way FullCalendar is integrated... I solve the
>>> issue for my own need by using the json feed feature of FullCalendar doing
>>> a simple json feed function returning a well formatted json object with
>>> simplejson dump.
>>>
>>> Richard
>>>
>>>
>>> On Wed, Jun 26, 2013 at 12:55 PM, Tom Russell <[email protected]>wrote:
>>>
>>>> I am using the appointment manager from
>>>> https://github.com/mdipierro/web2py-appliances/tree/master/AppointmentManager
>>>> .
>>>>
>>>> I have tweaked it to my needs and works well so far but there is an
>>>> issue trying to use SQLFORM.grid.
>>>>
>>>> I get an error
>>>> <type 'exceptions.TypeError'> <lambda>() takes exactly 1 argument (2
>>>> given)
>>>>
>>>> by doing this:
>>>>
>>>> def appointment_select():
>>>> grid = SQLFORM.grid(db.t_appointment, deletable=True,
>>>> editable=True, create=False, maxtextlength=64, paginate=25)
>>>>
>>>> return dict(grid=grid)
>>>>
>>>> I cannot figure out why it is doing this.
>>>>
>>>> Any ideas?
>>>>
>>>> --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "web2py-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.