I am extending a previously asked question about caching images locally in windows phone 8.1 app
I am using ImageExtension from the Q42.WinRT framework as suggested in the accepted answer to cache images on the device, but I still have an additional requirement to set an expire time on the cached image, mainly to avoid using storage for images that won't be used anymore.
My current code is:
...
xmlns:q42Controls="using:Q42.WinRT.Controls"
...
<!-- Event Image
Source set to default image
Extension for using image cache-->
<Image Stretch="UniformToFill"
HorizontalAlignment="Center"
Source="/Assets/default_image.png"
q42Controls:ImageExtensions.CacheUri="{Binding Image.Url}"/>
Is there any way to indicate an expire time for the images being cached by the framework?
There was definitely no functionality to delete old images so I implemented the change and made a pull request to integrate it in the Q42.WinRT library.
Version 1.3.0.42 now available on Nuget has the change available.
On app initialization (App.xaml.cs in my case) I added the following line:
await WebDataCache.Clear(TimeSpan.FromDays(1));
This deletes all the files which haven't modified for the given time span.
Related
Two issues with mp4 videos hosted on Microsoft Azure in Google Chrome only:
Background video don't loops (implemented by vide.js)
Video don't seeks by vjs player.
I know, server should send video files with http status 206. But my file sends with 200 at the first time, and if it doesn't made full download, problem still remains. How to setup right sending video files on Azure?
The reason why you cannot seek within the video is caused by the storage version.
By default, the version is set to 2009-09-19. Unfortunately, this version does not support the Range Header which is required to seek within a video (see https://msdn.microsoft.com/en-us/library/azure/ee691967.aspx). Therefore, you have to change the default version to at least 2011-08-18.
There are several way to change the default version.
From .NET you can use CloudBlobClient.SetServiceProperties Method.
Another option is using the utility from https://github.com/Plasma/AzureBlobUtility to change the default service version.
Also you can use the Azure REST API to set the version as documented on https://msdn.microsoft.com/en-us/library/azure/hh452235.aspx.
However the Authentication part is a bit tricky.
We have a pretty large asp.net LOB web application. The problem is that every time the app pool is started (whether its the first time, or if the app pool is recycled) it's takes up to 10 seconds or more to spin up and hit the first page. This leaves you in a state of looking at a white page and a loading spinner until IIS is ready to serve up the page. This isnt the end of the world because it's only normally a one off thing and only the first person experiences this. I'm just wondering if there is an event that we can hook into to serve up a page and show the user some type of simple splash screen to give them some type of feedback instead of a loading state.
Has anybody got any ideas on how to hook this into IIS/asp.net?
You can use the application initialization module. If you run IIS 8.0 or higher it is built-in, if you run IIS 7.5 you can download and install it.
Hopefully you are running .NET 4.5. Set the application start mode to AlwaysRunning. Then enable preload.
And then here you will want to add this to your web.config in your system.WebServer section
<applicationInitialization remapManagedRequestsTo="Startup.htm" skipManagedModules="true" >
<add initializationPage="/default.aspx" />
</applicationInitialization>
The startup.htm is your default loading screen. If anyone tries to access it when they go to the web application it will be remapped to that. Just add a simple JavaScript refresh location script to it.
This link should give you everything you need. Again, I am assuming you are on a newer version of ASP.NET and IIS.
http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization
I'm creating an html5 banner using Google Web Designer. I've created the banner and published it. When I view the published version I noticed that it takes sometime to load.
Someone else on my team is also creating HTML5 banners. The banner that he creates loads instantly even though its a larger file size. We compared our files and other than the actual assets, the way the banner was created and published is the same.
Does anyone have any ideas why this might be happening?
GWD add this code at the end of the banner and animation show up immediately:
<script data-exports-type="dclk-quick-preview">studio.Enabler.setRushSimulatedLocalEvents(true);</script>
Which environment are you using?
When creating a new project in GWD you are able to select an environment. By default is DoubleClick.
This adds additional file (in the case of DoubleClick, the Enabler library).
If you open your Chrome console, while running the banner, you will see that the banner is not initialized until the enabler is available.
You will also see how much time it takes to load the enabler.
If your colleague is creating a banner without that library, or without correctly listening to the event Enabler.initialized, this may be the main reason for the discrepancy.
If you don't want to include this additional library (that is used to integrate your banner in DoubleClick Studio), just select Generic from the environments dropdown.
There is also another reason that may cause the delay, and is the PoliteLoader.
You can select to politeLoad the banner from the Publish menu.
If the PoliteLoader is selected this cause the banner to be initialized only after the page is fully loaded. This may cause delays compared to a non polite loaded ads.
This all seems not to be a bug, but a feature of enabler.js simulates a test environment, when not beeing uploaded to Adwords (guess it similar in Doubleclick). Uploading to Google Environments should change the situation
Look at the console and see:
There is a long delay in alle items loading after the enabler.js.
It is NOT because of a long loading time of enabler.js - thats all fine.
Looking at the Logs, the enabler waits a second and throws out:
[ 1.008s] [studio.sdk] Using default ad parameters in test environment. Simulating local events.
When uploading to Google Adwords (i assume that this all is similar to DC Studio) - the enabler throws out different logs and the delay disappears.
Hope this was helpful.
By chance, I found out a way to make the Enabler loading fast. Instead of using Publish, use Preview to generate the HTML.
For some reasons, Enabler.js in preview-generated HTML only takes 0.019s to load as compared to Enabler.js in publish-generated HTML taking 1.015s to load.
Studio Enabler SDK looks for "e" parameter in iframe URL containing Studio creative. It expects a number and uses that to set the creative environment.
Setting e=1 in your preview environment (query string parameter in the iframe url pointing at the index.html for your studio creative) will tell Enabler to use LIVE mode.
I assume there is a reason why Enabler has this functionality (avoid counting impressions or paying for impressions from test/qa environment)...so I wouldn't suggest using this as a permanent setting.
I'm currently working on a webapp with the polymer-framework.
However, the whole application depends on the geolocation of the device. I'm setting the location in the app-globals file to use it globally, but it takes some time (around 500ms).
My question now is, how can I say to polymer that it should get to work, after the geolocation is set?
Thanks!
I think it depends on the specific behavior you're looking for. A few cases:
Everything still loads when the page loads, including perhaps some app UI and you have a loading icon or similar to indicate that the app is still starting up while you're waiting for the location.
You don't want to show the app until you have the location. Perhaps you don't want the app resources to be loaded at this time either.
You don't even want Polymer to be loaded until you have the location.
There's a lot of options & they may depend on your app architecture a bit, but for a general structure:
show a loader icon on startup & just wait to populate any templates you have until location is set
perhaps keep the hidden attribute on your main app element until location is available &/or don't append the element to the DOM until this point (although with similar resource loading opportunity caveat as in 3 below).
you could wait to add polymer & related elements until location is available, but generally seems silly to do this since your app could be doing this work while the user is waiting for a location to be found.
If you've got a more specific need then more details are probably needed.
I'm working on a social game (actionscript) whenever I upload a build seems like for some users the new build isn't downloaded instead the older version (cached) is served to them. How can I detect the user is on an older version and perhaps throw a popup at them?
I think it is more about your web server configuration. Cache related headers to be more precise. But we at some point decided to solve this issue by publishing application####.swf upon each deployment, where #### is a build number. And updated the HTML wrapper accordingly.
A little trick you can use is to append some FlashVars to the end of the embed code, e.g.
<embed src="file.swf?version=1.01" .. />
All you need to do is update the value of version each time you update the SWF.