How do I *really* destroy an instance of jssor? - slideshow

I am allowing a user to dynamically create jssor slideshows each with their own image library. I also allow the user to delete slideshows along with their image libraries. This is a dynamic editor that avoids page reloading (an important point).
If I use .remove() to delete the slideshow container the user sees it disappear and while that appears to be the desired result there's a hidden problem.
Because the directory of images has also been deleted the browser's javascript console is generating a continuous stream of not found errors for the thumb images. In other words, though it appears to be completely removed the jssor code is still trying to retrieve images. I've read all the documentation and there doesn't appear to be any actual destructor for jssor. JavaScript delete() is not an answer.
Since this is a dynamic editor the user must be able to create and delete jssor objects at will without page reloading. Is there any way to really destroy the jssor object?

I've solve my own problem... it was simple enough. Simply put the slideshow in Pause before deleting it. This stops the image accessing and stops the bandwidth consumption.

Related

Dynamic Dashlet in Alfresco Share

As a user experience requirement, I need to create a dynamic dashlet.
According to what I need, a dynamic dashlet would be a special dashlet that can load inside "almost every content". I say almost every content because of course this kind of dashlet would have its own limits of course. At the same time, it would be nice that the dynamic dashlet has the ability of being maximized, what in fact would show the real content (for example, an Alfresco page).
Perhaps my question is ambiguous, but the intention to give the user the chance of check execute common functionality inside that special dashlet, this way the user doesn't have to leave the dashboard improving the user experience as a consequence.
Did anybody have had such requirement or similar before? Would that be possible to do?
I would like to know some tips and suggestions in order to find out the right approach.
Thanks in advance.
You could try re-using the webview Dashlet which can also show another page.
The only problem is that not every part which is visible in Share can be accessed via url. Sure the template gets build up by regions of *.ftl's but that doesn't mean you can 'just' view the *.ftl.
The only 'dynamic' thing I see is making a custom page template which shows one or couple of regions which are dynamically build by the url.
e.g. pointing to share/page/customPage?region1=documentlibrary should insert the documentlibrary template within that page and thus it can be shown within the iFrame of the webview Dashlet.
Actually the documentlibrary is a bad example, because there is already a portletMode available for Liferay. But hopefully you'll get my point.

wxSmith a good way to manage wxPanel

I have a project where I'd like to have many wxPanel which are displayed or hide, depending the selection of the user. All panel are on the same position, only one is displayed at a time.
On a code side, there is no problem at all. Where it gets tricky, is how to manage this with wxSmith and keep a clear view while having many wxpanel at the sample location?
One way which is really not proper is to user the wxNotebook, and then when you start the soft delete all tabs and then show the needed panel.
I have look around to try to have the panel on a "other" wxSmith window and then load it, like a class but haven't find anything good.
I'm sure, as wxSmith is really a great tool that it must have a way to do this.
Thanks for your help!
See ya
"One way which is really not proper is to user the wxNotebook, and then when you start the soft delete all tabs and then show the needed panel."
Why not? I use that technique for AtomWeaver, and it works fine. The plus side is that you can design each page normally on a RAD GUI builder.
I've created a class called GUI_NotebookPageData that holds a pointer to a single notebook page. Create an array of these, holding info about all notebook pages.
Then, by index, or by name, get the info of the page you want to show/hide, and use wxNotebook's RemovePage()/InsertPage() methods.
This method is specially good for having several pages shown at the same time.
Actually it's possible to use external ressources with wxSmith, then it's very simple to manage the frames.
It create a derived class from wxPanel (or other window) on a new wxSmith window, easy to manage then just required to include it on the project.

creating/displaying an image based on user input -- Django

In Django, I want to create an image using an R function (so via Rpy2) based on user input (POST) and then display that image back to the user.
My approach: Save the image to a file and display it in the template (the same template as the form).
1) Is this the right approach?
I then found that sometimes when I submit the form a few times with different parameters, I get the same image back when I shouldn't, so some kind of caching is going (in the browser?). I was also concerned with accidentally passing the image created by one user to another simultaneous user.
So when the form is submitted, I add a random number to the name of the image, getting a new image name (and new image) every time.
2) Is this a reasonable approach?
I have an intuition that I'm doing things the stupid way, but I'm not sure what I should be doing.
To get the browser cache, you can simply add a random query parameter of the url of the image, like this
<img src="assest/images/img1.png?randomstring/>
As for if it's a reasonable approach, it depends whether these image need to be re-generate every time the user visit the page. It this is the case, you'd better serve these images directly by a view, like this. Otherwise you will need to delete these images that will never be used again.
If somehow you do need to reuse these images, just remember there must be a mechanism that prevents your hard drive been used up.

Caching data (image, rss) with django

That's my first question in here, I've been looking through old questions, but nothing matched with my problem. Here it is.
I'm creating some site with one main functionality. We want this site to display content of other sites, but in a specific way. User chooses let's say two pages from five and want to see their content. He clicks button 'Display' and goes to next page where he finds let's say view from web cam, and here comes problem.
I want to cache image that is hidden behind the url from which image was downloaded, so after refresh image won't be downloaded again, but browser will get it from cache.
I've been looking through documentation of Django, but nothing seemed to be useful.
I know that I should:
1) create table which stores cache
2) add to settings.py some CACHE_BACKEND = ...
3) use #cache_page(300) before declaration of function which returns content which should be cached,
but... it doesn't seem to work.
I will be greateful if someone tells how to solve that problem, maybe with some sort of code showing the mechanism.
Cheers,
Chris.
I think that right way to do this will be to store image somewhere on your server and delete it later with cron or something similar.
Django cache framework wasn't created for the purpose you are trying to use it.

Use QItemDelegate to show image thumbnails

What's the best way to use QT4's QItemDelegate to show thumbnails for images in a view?
Specifically, how do you stop the item delegate from blocking when generating pixmaps from very large image files (> 500MB)?
Can anyone link to some example code that achieves this? Then again, perhaps this isn't the place to look for Qt-specific code.
You're doing it wrong if you are generating pixmaps inside any of the delegate methods (paint, draw...).
Try to generate the thumbnails only once (on worker thread or maybe not even at runtime, if possible) and have the delegate just display them for the appropriate role.
If you do it at runtime display a default picture until you have the thumbnail generated (like web browsers do with pictures that are not yet downloaded).