Author Archives: frankdu

Android: record screen cast like a breeze

Record screen video can be super easy. First, put below lines in your .bash_profile file. Then type the command screenrecord demo_video_name. When you are done, press Ctrl + C to stop recording. Easy, huh! Please note: Android 4.4+ (KitKat or … Continue reading

Posted in android | Tagged | Leave a comment

Android: capture screenshot with one line of adb command

Just one-liner to capture android screenshot:

Posted in android | Leave a comment

Tutorial: Create android gradle project with dagger

It is tricky to set up multi-module projects with android & gradle, if you are new to it. It is even trickier to make it working with Dagger. A bit background knowledge: Dagger is an open-source dependency injection framework designed … Continue reading

Posted in android | Tagged , , | 12 Comments

Gradle & Dagger: Add dagger code generation to android library and app

Edit: A newer and simpler method, is published in this blog post. Recommend you use that method. Before gradle better support annotation processors, you need a workaround to make: 1). dagger code generation working with android project; 2). Make really … Continue reading

Posted in Uncategorized | 2 Comments

Technology Touched Over the Weekend

Haven’t dived into new technologies for a while. Did several interesting things: OAuth 2.0 Provider Implementation – Implement both authorization provider and resource provider on Tornado, using oauth2lib. Redis – Used to store/retrieve OAuth codes and tokens. Social login – … Continue reading

Posted in Uncategorized | Leave a comment

Speed up static resources with AWS CloudFront CDN

Nowadays CDN is easy to use. Even a startup or personal website shall consider use CDN to speed up static resources, such as photos, javascript/css files. Here are simple steps to use AWS CloudFront CDN and enable it in Tornado. … Continue reading

Posted in Internet, python, Server | Leave a comment

INSTALL_REFERRER broadcast helps to track android installation referrer

Many businesses ask you how you hear about them, when you first visit them. Because the data is important for growing their businesses. OK, you have an android app. Aren’t you interested in tracking how the users find you? For … Continue reading

Posted in android | Leave a comment

How to display FPS (frame per second) number in Android

Well, check out this blog: Window Backgrounds & UI Speed http://android-developers.blogspot.com/2009/03/window-backgrounds-ui-speed.html

Posted in Uncategorized | Leave a comment

Deploy OAuth provider with mod_wsgi

Recently I deploy an OAuth provider with apache/mod_wsgi. Everything works fine on django dev server locally, but is broken onto apache server. After analyzing the logs, it shows that the HTTP header ‘Authroization’ is dropped by default. To pass thru … Continue reading

Posted in Server | Tagged , , , | Leave a comment

Many profilers, and I need at least one

Performance improvement is an ongoing task, always. So a profiler is a good friend. For me, the very basic tool is timing and print functions, lol. Yes, they are. In one of language tool, it helps to identify the parsing … Continue reading

Posted in Engineering | Leave a comment

Another Way of Javascript Method Overloading

In John Resig post, he presented a subtle method to support method overloading. It’s very useful when you have method overloading and each method behaves differently. However, it adds overhead by wrap up existing methods inside a new function. For … Continue reading

Posted in javascript, Web | Tagged | Leave a comment

Mercurial: How to ignore everything in a folder?

I have been looking for this for a while. It’s pretty simple. Let’s say you have project A, and want to ignore 2 folders: bin and output. 1. In your project folder, edit the file ‘.hgignore’, or create it if … Continue reading

Posted in Engineering | Leave a comment

Implement Unsigned Right Shift (>>>) if the Operator is Unsupported

If you are Java/Javascript/AS3 developer, you know what the >>> operator does. It is called unsigned right shift, or logical right shift. Check the definition in wikipedia. However, C# and C++ don’t have such operator for signed integers, though it … Continue reading

Posted in Engineering | Leave a comment

Get the real client IP address, when you use a reverse proxy

Let’s say you are running ASP.NET, PHP, JSP, or Python web. If the code is visited via reverse proxy, then the client IP address is the proxy IP with regular detecting routue. To fix the issue, let’s first take a … Continue reading

Posted in Server, Web | Tagged , | Leave a comment

Base64 Encoding in Android 2.1 or Earlier

Base64 is common used. Now Google added a utility class android.util.Base64. Unfortunately it is only available in Android 2.2 and later. So, you need just a little bit work to use it with Android 2.1 or ealier. Yes, just copy … Continue reading

Posted in android, java, python | Tagged , , | 3 Comments