TTPhotoViewController data reload - iphone

has anyone figured out how to reload data in TTPhotoViewController?
I have done several attempts but never worked out a suitable solution.
Your help is much appreciated.
Vlad

TTPhotoViewController ultimately derives from TTModelViewController so you should be able to call the reload method. From TTModelViewController.h:
/**
* Reloads data from the model.
*/
- (void)reload;
/**
* Reloads data from the model if it has become out of date.
*/
- (void)reloadIfNeeded;
/**
* Refreshes the model state and loads new data if necessary.
*/
- (void)refresh;

Related

Flutter on VS Code issue: StreamController.Sink.add() suddenly require argument PUSH

Good afternoon good people,
I'm suddenly experiencing a problem with VS Code:
in a couple of Flutter apps Streamcontroller.sink.add();
suddenly require the argument "push" (before it didn't).
without adding the push argument obviously it return the error
2 required argument(s) expected, but 1 found.dart(not_enough_required_arguments)
Does anyone know what might have happened?
thank you in advance for your help
Francesco
edit: via f12 the definition actually shows the argument push
part of dart.core;
/**
* A generic destination for data.
*
* Multiple data values can be put into a sink, and when no more data is
* available, the sink should be closed.
*
* This is a generic interface that other data receivers can implement.
*/
abstract class Sink<T> {
/**
* Adds [data] to the sink.
*
* Must not be called after a call to [close].
*/
void add(T data, Future push);
/**
* Closes the sink.
*
* The [add] method must not be called after this method.
*
* Calling this method more than once is allowed, but does nothing.
*/
void close();
}
but as pskink reminded the documentation doesn't show this requirement;
I don't have idea how this can have changed,
at this point the question is:
how do I restore it to normality?
TL;DR
what appeared to be bad code,
was instead corrupted dart code;
I followed the instruction provide by Gunter
and everything went back to normal.
Thanks again Gunter

What is difference between waitForAngularEnabled and browser.ignoreSynchronization in protractor?

What is browser.ignoreSynchronization?
/**
* If true, Protractor will not attempt to synchronize with the page before
* performing actions. This can be harmful because Protractor will not wait
* until $timeouts and $http calls have been processed, which can cause
* tests to become flaky. This should be used only when necessary, such as
* when a page continuously polls an API using $timeout.
*
* #type {boolean}
*/
&
waitForAngularEnabled
Both looks same. Is there any specific thing that can achieve by one and not by other?
They are the exact same, if you look at the source code ignoreSynchronization actually calls waitForAngularEnabled. The only thing to note is, ignoreSynchronization is being deprecated and eventually will no longer be available. They are switching to waitForAngularEnabled as the main property.
As far as what they do, that has been answered here in good detail.

Is it safe to use performance.now() to measure page load time in GWT?

I need to measure the time required for my GWT application to load.
I can't use GWT Lightweight Metrics because of external framework usage (I can't modify bootstrap html page).
Navigation Timing doesn't work for GWT because initialization of GWT widgets doesn't depend on window.load.
So, is it safe to use performance.now() method to get the time from PerformanceTiming.navigationStart event?
Specs says that:
The now() method must return a DOMHighResTimeStamp representing the time in milliseconds from the time origin to the occurrence of the call to the Performance.now method.
I can't understand time origin definition. Does it always return the time from the moment when the user requests a page with my application?
I haven't found answer to my original question. It seems like performance.now() isn't suitable for measuring page loading time.
I have used explicit approach described here.
The code is something like this.
public static long getTimeFromPageLoadStart() {
long navigationStart = (long) getNavigationStart();
return new Date().getTime() - navigationStart;
}
private static native double getNavigationStart()/*-{
return performance.timing.navigationStart;
}-*/;

GWT How discard changes on a Editor

I there a way of Editor discards changes made on its properties? This on client side. No persitence.
I have:
public class ClaseEditor extends PopupPanel implements Editor<ClaseProxy> {
#UiField ValidatedTextBox tema;
#UiField ValidatedTextBox catedratico;
}
I use this editor on a ListEditor as u know there are a list of editors in your
ListEditor<ClaseProxy, ClaseEditor>
If user create one, its okay, then if user edit it. i have a save or cancel options, i save ok, just hide the editor and changes made are ok.
But in user clicks Cancel and if there was some changes on the properties the editor flush(lazely) that changes to the proxy.
Yes i can store the start value on a string then restore with setValue() on the texboxes. But there is some other way (Editor API) that prevents this?
Thank you
If you are using a SimpleBeanEditorDriver, you can do a new call on the edit method, without calling flush first.
The SimpleBeanEditorDriver class reads from the bean into the editors on edit, and from the editors into the bean on flush.
If you don't want to revert all the editors, but only one of them, remember to call flush on every accepted editor change, in order to be able to restore to the last flush point. Note that a flush call is local and doesn't necessarily have to correspond to a call to the persisting layer.
Example code
private Bean currentObject;
/**
* Start editing the given object.
*/
public void edit(Bean object) {
this.currentObject = object;
this.driver.edit(object);
}
/**
* Call this every time an editor is in a consistent state.
* (e.g. onBlur event if validation succeeds)
*/
private void save() {
this.driver.flush(); // saves editors' state into currentObject
}
/**
* Call this to cancel changes on all editing editors.
* (e.g. onBlur event if validation fails)
*/
private void revert() {
this.driver.edit(currentObject); // reloads currentObject into editors
}
/**
* Stores all pending changes to the server.
* Remember to validate all editors.
*/
public void commit() {
Bean object = this.driver.flush();
Server.persist(object);
}
Yes. On the cancel button, do a fire() without building any request. What the editor does never effects the original proxy, it is immutable. The flush only gives you a copy (unless you are using the RequestFactoryEditorDriver then it returns the context you sent into it with the driver.edit(proxy,ctx) . The fire() without a request clears the edit proxy copy if the user wants to edit again it won't get an error that it is already being editted.

TTURLCache to cache my image and data

I used three20's photo gallery in my app and it worked really well and looked neat and pretty. And basically I don't need to worry about all the fetch-photos-from-the-server thing since three20 has fetched and managed and cached the data for me, all of which are done behind the scene.
That's when I started to notice this magic caching mechanism implemented in three20, called TTURLCache. In its header file I find the following interface methods:
/**
* Stores a data on disk.
*/
- (void)storeData:(NSData*)data forURL:(NSString*)URL; //method 1
- (void)storeData:(NSData*)data forKey:(NSString*)key;
/**
* Stores an image in the memory cache.
*/
- (void)storeImage:(UIImage*)image forURL:(NSString*)URL; //method 2
/**
* Stores an etag value in the etag cache.
*/
- (void)storeEtag:(NSString*)etag forKey:(NSString*)key; //method 3
My questions:
Method 1 and method 2 in the above code: are they only capable of storing data, or are they capable of both fetching and storing?
What is an etag in method 3?
Method 1 says it will store the data on disk, while method 2 says it will store the image in memory. If I use method 2 to store an image, will it get lost once I kill and restart my app?
Thanks a lot in advance.
Those are the storage methods. The retrieval methods are separate. (See below.)
Etags are a way to optimize network traffic. See Wikipedia for a good intro.
I think that Three20 both stores the image file on disk, and the decoded image itself in memory. Certainly, any in-memory caches would be cleared if the app re-started, but remember that under iOS 4, that probably happens less often that you think.
To get data out of the cache, try one of:
/**
* Gets the data for a URL from the cache if it exists and is newer than a minimum timestamp.
*
* #return nil if hthe URL is not cached or if the cache entry is older than the minimum.
*/
- (NSData*)dataForURL:(NSString*)URL expires:(NSTimeInterval)expirationAge
timestamp:(NSDate**)timestamp;
- (NSData*)dataForKey:(NSString*)key expires:(NSTimeInterval)expirationAge
timestamp:(NSDate**)timestamp;
/**
* Gets an image from the in-memory image cache.
*
* #return nil if the URL is not cached.
*/
- (id)imageForURL:(NSString*)URL;
- (id)imageForURL:(NSString*)URL fromDisk:(BOOL)fromDisk;
I would advise reading through the source, though. If memory serves, TTURLCache isn't all that big a class.