-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable image caching #377
Comments
It's not the first time that someone asked for this. Your example describes why this is needed. |
You can clear the cache if you know the secret. Many parts of Shoes are in Ruby. The Maintain shoes screen (we called it the cobbler) has a button to clear cache and it written in ruby. deep inside Shoes.App/Contents/MacOs/lib/shoes/ is cobbler.rb and data.rb. image.rb is called from inside the the downloading code so you don't want to modify it but you may want to look at it. |
Got it. Thanks |
Well I thought I did. Something funky is going on. I was trying to confirm the key format but got caught up by my first issue. Images loaded from local disk do not show up in the cobbler 'select image to delete' list and don't seem to get deleted when I use delete all. However, something more broad might be going on. The Delete From Cache does not do what I would expect. Here's my test procedure: Load cobbler, click 'Splash' and also load the sample 'image' app, load the default dino image, click about in cobbler until the 'select image to delete' list refreshes and you see the dino URL, close the sample image app, DISCONNECT all internet access, Delete From Cache 'All' images (either with or without the 'Remove File? option), reopen the sample 'image' app, redownload the default dino image, WHAM - it shows back up despite no internet access. It does not show back up in the cobbler list. I'll keep looking through the code but any insight would be appreciated. |
Keep in mind there is a internal copy as well as the cache files. If you have two processes, and one deletes from the db - the other process won't know that. It's even more complicated in the C code: An image appears to have 3 or 4 states of cache that I need to suss out. If you are in a hurry, then you want to modify your app to delete the cached file (or the db) after you download an image. The 'db' is just sdbm gem. Before you load another image you need to insure the previous image is not in memory. How? Not Sure. Things are slightly different depending on whether the image was loaded from a file or downloaded from a url (you can two dino.jpg in the cache if they came from different sources. Speaking of that, how are you getting the images off the webcam? File reading or downloading? |
I've got a test script. The db cache persists across Shoes invocations. There is also the strange setup in ~/.shoes/+cache that the db hash points to that needs deleting (the actual image data files) otherwise Shoes may find it in some situations and not do the download. This does not remove I'm proposing add a style arg Shoes.app do
require 'shoes/data'
require 'shoes/image'
stack do
flow do
@el = edit_line "#{DIR}/static/shoes-icon-walkabout.png"
#@el = edit_line "https://shoes.mvmanila.com/public/images/dino.jpg"
@cb = check; para "Don't cache"
button "(Re)load" do
@img.clear
@img.append do
if @cb.checked?
image @el.text, cache: false
else
image @el.text
end
end
end
button "Show cache" do
@cview.clear
@cview.append do
eb = edit_box width: 400
DATABASE.each do |key, value|
eb.append "#{key} -> #{value}"
end
end
end
button "clear caches" do
DATABASE.each do |k, val|
v = val.split('|')
path = Shoes::image_cache_path v[1], File.extname(k)
File.delete path if File.exist? path
end
DATABASE.clear
end
end
@img = flow {}
@cview = flow {}
end
end
end |
File reading... The ruby opencv gem was not working nicely so I shell out to python to capture the image, perform face detection, cropping, and scaling. I confirm that your test script demonstrates the problem. I like addition of the cache: false args for 90% of the cases. But I suspect there is still a need for a image.clear_cache or clear_cache(url) for times when I didn't know up front that I would need to reload an image. BTW: thank you for being so responsive and helpful |
We are always happy to have new people in here. We do our best to improve Shoes and your feedback is valuable to us.
Sounds good. Would such cache enable/disable also apply to download? |
I would also like to suggest cache as a |
The image cache is a very ancient part of Shoes and has tendrils in unexpected places (pattern for example). At the moment I'm going attempt to not do the cache lookup and just proceed to load/download the file which will get cached but who cares if we never look at the cache.
I don't think the download method uses a cache - not appropriate for those 5gb iso files we played with a few months ago.
I did think about a global setting and it may be needed if my simple scheme doesn't work. |
@sjernigan I've got a beta for osx that should do what you want when loading images from files. Downloads can still get confused and stuck in the external cache so the task is incomplete. If you launch from the command line (cshoes) you'll get some progress/debugging messages. I also updated the test script above if you need it. |
* image <path/to/file.png>, cache: false * still have work to do with the external cache and downloads.
Very likely to happen. There are many C functions and Ruby methods that need to know not to cache - just finding them all has take a lot of gdb head scratching. In image.c we can save/restore global status if the |
Many thanks, I'll test today. For my case, a global flag will work wonderfully. |
I can confirm that the "cache: t/f" flag is working as described. Thanks for the quick turn-around |
* update manual * bug377.rb is needs deeper thought * would app.image_cache be a better name? Do I care?
@sjernigan - A question you don't have to answer but I'm curious about your Shoes application
I happen to have a logitech usb camera, rarely used. Your Shoes app intrigues me. Is it proprietary? Can you share it? I've got a raspberry pi 3 with Shoes and your project just screams for a raspberry introduction for Shoes in MagPi , for example. Collaboratively. Contact me at [email protected] if you want to discuss this privately. |
Just when I thought I had something useful, there is osx and nsurl.m - much rethinking required. Time to get rid of that goto in shoes/image.c and the hangover from curl? |
* rename shoes_queue_download to shoes_native_download * refactor to get rid of the goto. It was was more annoying than duplicating code. Separate code paths for cache, no-cache. * weird tmp bug with osx for http no cache - more to do * undo a lot of the last commit * clear cache in bugs/bug377.rb requests a restart. Yes, you do want that. * move extern shoes_cache_setting to app.h
Additionally, we could add some screenshots for Shoes website or something. I suggested in the past we have some kind of display of existing apps written in Shoes such as @dredknight wheel, Numinoes, etc. Perhaps something involving face detection and stuff would be cool as well. 😄 |
shoesrb.com is used by both shoes 3 and shoes 4 and needs some love from someone. I'm sure they wouldn't mind another page or two at the site for promotion, screenshots, links to to shoes apps. commercial or oss. Both projects need some promotion help - completely out of my wheelhouse. |
Btw I also think that Shoes needs some kind of page with screenshots of complete projects, examples and tutorials where people can also comment below and have some conversions between each other. There is a similar story going with our mod. At first we were just a few people. And although some people claimed this is very neat work we got very little fans. Not that we cared as we did it for ourselves. Newbie devs just start and try to play with something. They do not have the mentality "Hey I can get to a forum and chat with people about that thing so I can improve my skills". They are just like 2-year olds playing with a wooden cubes. The only real user counter of shoes users is the download rate of the shoes.exe. How much dls has it accumulated for the last month? year? Btw I do not mind maintaining Shoes FB page. It will give an easy point of access for many people plus it is some kind of advertisement. Of course I can be wrong for all that I said above but it does not hurt giving a try. |
Re: Image non-caching. I think I've got this working. I thinking of adding a |
Re: image non-caching. Betas available here As always, these have not been tested everywhere for everything. Yes, there is a freebsd.install. I'll merge this 'cache' branch to master based on feedback so test away! Please. |
Forums are easy enough to install in a Wordpress blog. Pain in the ass (PITA) to configure and maintain. Not something I'm going to do again. However,
I like this idea! I'm not Facebook savy - I just argue politics with 'family' I don't know very well. :-) That said, I am a member of a group which doesn't need a lot of moderation. This could work. Several of my favorite restaurants have 'sites' with comments and pictures and menu images. I don't know if those are free or not any more - I grabbed TheCecil when they gave them away many years ago. |
About 4 or 5 users per day click the packaging 'select architecture' button - now that its fixed again. I get 50+ downloads a day for some version of Shoes 3. One half to two thirds of them are bots and a few would be downloads to complete the packaging. A lot of noise from China, Russia, Ukraine. I'd guess 10 real people a day download Shoes 3 but that's only a guess. |
Good :). I will prepare something and will show it to you. I will make your FB account a second admin for the purpose of posting. |
I'm not a big fan of dividing up the already fragmented community but a Facebook page might be a good thing. For example, members could post their own screenshots and videos to share. @dredknight you can also add me as admin.
Can you provide stats on this? Might be worthwhile to investigate. Maybe we could have the manual translated or something. Chinese and Russian people are very good contributors, very skillful as well. |
I classify downloads awkwardly - too many edge cases and noise.From 2016-Feb-02 to yesterday hacker 129
shoes 1968
maybe 11298
iffy 1789 Those are unique IP's. 'shoes' means they used the packager (or wrote their crawler in Ruby) 'Maybe' means it could be a user download or it could be a webcrawler. I often see one IP download windows, osx and a linux or two in one day. Legitimate? Then there are the people who download 3.2.25 and the browsers that chunk the download in two or more transactions. 'iffy' people broke some rule that make me pretty sure they are not legitimate. It's all in a 10MB sqlite3 db if someones wants to play with it - 2.1MB tgz |
I checked shoesrb.com to make sure they didn't setup a FB group long ago because it would be embarrassing to not know and duplicate/split the audience. They haven't and there are several places in the shoesrb.com Jekyll generated pages to refer to a new Facebook group without compromising integrity or look and feel of shoesrb.com. I do like that site design, someone did a good job. IMO. Not a fan of Jekyll but credit is due. @dredknight, once you get the FB group setup, let me know and I or you can announce it on the mailing list and I can update the shoesrb pages (tastefully). |
1 similar comment
I checked shoesrb.com to make sure they didn't setup a FB group long ago because it would be embarrassing to not know and duplicate/split the audience. They haven't and there are several places in the shoesrb.com Jekyll generated pages to refer to a new Facebook group without compromising integrity or look and feel of shoesrb.com. I do like that site design, someone did a good job. IMO. Not a fan of Jekyll but credit is due. @dredknight, once you get the FB group setup, let me know and I or you can announce it on the mailing list and I can update the shoesrb pages (tastefully). |
Sounds very good. I also recommend to come up with a good name for the group url. The one that is gonna end up as |
Sure this is what I was thinking about as well :D. |
Unfortunately shoes was not available, nor shoes3 so I made it like this https://www.facebook.com/rubyshoes3/ |
It's just so so... but at least descriptive. I joined the page. |
Well I just made it so besides the avatar there is nothing. I need some time to find the correct visuals and see what else can be put in a more representative manner. |
No worries! Take your time! Your help is always appreciated. :) |
@dredknight , your invitation for me to be an admin got this when I clicked on the FB email.
I'm remembering why I don't use FB very much. |
@ccoupe @backorder admin invitations sent once again! |
@dredknight thanks, I added a link to https://shoesrb.com and liked the page Numinoes (made with Shoes). You can repost photos/videos from Numinoes on Shoes if you'd like and your own project. Perhaps you could create an issue here specific for Facebook where we can talk about it? We are totally off topic in here, e.g. disable image chache. |
@backorder, here you go -> #380 You can check how a developed fb page looks like. It is not a big deal but it took a while. -> https://www.facebook.com/mightandmagicheroes5.5/?ref=bookmarks |
shoes-3.3.4-osx-10.9.tgz tested, caching clearing working. Thanks again |
I've built an app that's main function is capture a frame from a web cam, associate it with some meta data, save and name the image based on an ID in the meta-data. Works great until I try to recapture an image. The image caching optimization prevents the new frame from being shown. I understand I could name the new picture something else but that is one of main jobs of this app. Is there a way to disable or clear the image caching?
The text was updated successfully, but these errors were encountered: