Thursday, March 10, 2011

** Test

- (NSString *)applicationSupportDirectory {

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
    NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : NSTemporaryDirectory();
    return [basePath stringByAppendingPathComponent:@"MyTime"];
}



import static com.google.appengine.api.datastore.FetchOptions.Builder.*

def common = Common.instance

/**
 * Listing of classified in the first page.
 * TODO: Paging
 */

def commone = Common.instance

int RESULT_LIMIT = 30
String cacheName = params.t? "listquery-${params.t?.trim()}" : "listquery"
def result = memcache[cacheName]

if (!result) {
    def query = new Query("classified")
    query.addSort("dateCreated", Query.SortDirection.DESCENDING)
    query.addFilter("active", Query.FilterOperator.EQUAL, true)

    if (params.t) {
        query.addFilter("tags", Query.FilterOperator.EQUAL, params.t)
    }

    PreparedQuery preparedQuery = datastore.prepare(query)
    result = preparedQuery.asList( withLimit(RESULT_LIMIT) )
    memcache[cacheName] = result
//    System.out.println(" [info]  Cached \"${cacheName}\"");

}
request.result = result
//System.out.println(result)

forward  '/list.gtpl'

No comments: