Posts

Summary of my Android Apps

After checking the archive list of my blog I didn't see me sharing my android apps on here. So here it is, I currently have 4 active apps mostly created for myself that I published on google play. AppLauncher+ This app automatically organize your apps base on google play categories. Reason I built is cause I flash my firmware a lot at one time that reorganizing folders of my apps just takes too much time. I couldn't find one that is simple enough that would just work and I won't ever touch it again. It has now evolve to have features like: Manual Categorization (had to do it cause of too much demand) Floating launcher (for paid, you can open a folder/assign commands on what it does) Create Shortcut & Folder view on those shortcut (also paid only) Free version basically just gets an organized list with ads! :( Live Battery (Status Bar) This is a live wallpaper, you can select a static wallpaper then then it will have your borders as status bar. I did this...

JSONRPC Server & Client For Python on Google App Engine

Now that google cloud endpoints is around the corner it will and probably should be a standard way of creating web services for any types of clients for mobile, desktop or even your ajax requests. It's still experimental as the time of this writing and I will not really talk about how to use it since their documentation has some good example on it already. I will be sharing on how and what I've used to create my own web services for android clients I have created and for ajax calls. I have created my own jsonrpc client/server class for python. My own full implementation of jsonrpc standards . I have included this on my app-engine-starter code with some sample if you run it and click the JSONRPC Demo dropdown. Feel free to use it. It is still a nice simple library to use creating web services. I will give a quick sample code here on how it's used: import logging from google.appengine.ext import webapp, ndb import jsonrpc class Calculator(): def add(self, a,...

NDB Caching Queries Tips & Best Practice - Google App Engine

Update: Since keys only queries are now free, I would prefer to just cache the queries with only resulting to keys_only=True then retrieving the cached values of it with ndb.get_multi(keys). If you are creating a heavy read app engine app, that has a lot of listing/query entities it's a good idea to cache those queries so you don't get charged for reads. But you want it to also be up to date and not have to worry about invalidations. Here is some of the things I've done for caching queries. This can't be applied to all but should work on most and can be implemented on same manner with more complex queries. The idea is to have an updated field on the fields you are filtering from so you can use that as your cache key. Here is a sample code that that shows how to display user post with cached queries. from google.appengine.ext import ndb class User(ndb.Model): created = ndb.DateTimeProperty(auto_now_add=True, indexed=False) updated = ndb.DateTimeProper...

How to Build Live Wallpaper with Canvas on Android

This will be a very basic canvas live wallpaper with android. Just to get people started. Just read the comments on the code to understand how everything works. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.altlimit.samplelivewallpaper" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="15"/> <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name="MyActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> ...

Join Query on Google App Engine Datastore

App Engine Datastore is a no sql database. That means you cannot  do standard sql queries. But they do have the basic queries using GQL. It is a no SQL database which is very reliable, does not slow down even with terabytes of data, and has a nice indexing mechanism to fetch data. You can use Google Cloud SQL if you need a relational database, it's a manage mySQL database by google. By the time I'm writing this, they now support up to 100GB of mySQL database, but still limited to the limitations of a standard mySQL and it's coolness. So if you really can't avoid a de-normalize table like you want to show the name of a user in a list, I'll show you samples. This will all be using python 2.7 and ndb. from google.appengine.ext import ndb # just a sample model for how to efficiently join them class User(ndb.Model): name = ndb.StringProperty() photo = ndb.BlobKeyProperty() """ always create a text version of your blobkey and store ...

Web Scraping with Google App Engine

Here is a quick tutorial on how you can scrape google search results asynchronously with app engine and caching its result in memcache. You should not use this directly because you can get blocked by google, this is just a sample for you on scraping web pages, feeds, xml, etc. But if you do want to do something like this, I recommend adding delays, and act more like a human on your scrapes. But I believe that is against their TOS. I added the use of async here for people who don't know how to use them yet so they can learn in the process. The code below is a complete working google search scraper, read the code comments to understand everything. This is all done with python 2.7 with ndb app.yaml application: your-application-id version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /.* script: main.app libraries: - name: lxml version: latest main.py import urllib from urlparse import urlparse, parse_qs from google.appengine.ext import webapp,...

Subdomain module mapping with Zend Framework

Here is a very simple config to map a subdomain to a module with Zend Framework: Samples: Going abc.example.com/hello will route to example.com/abc/hello/index resources.router.routes.module.type = "Zend_Controller_Router_Route_Hostname" resources.router.routes.module.route = ":module.example.com" resources.router.routes.module.defaults.module = "www" resources.router.routes.module.chains.index.type = "Zend_Controller_Router_Route" resources.router.routes.module.chains.index.route = ":controller/:action/*" resources.router.routes.module.chains.index.defaults.controller = "index" resources.router.routes.module.chains.index.defaults.action = "index" Just add this to your application.ini