Sunday, November 20, 2011

Resolution Qualifier of Layout Drawable for Android

It's hard to differentiate 800x480 854x480 resolutions. 
Most mobile phones are of these two resolution and goes to qualifier "-normal-hdpi". Both are "-long"
There is resolution qualifier, thougth it's deprecated and recommended to not be used.
something like "-800x400"  "-854x480" (situee's blog)

Thursday, November 17, 2011

ThunderBird Shortcuts 雷鸟快捷键

Using shortcuts help save time. Save your time when dealing with EMAILs.

New message (default format) Command + N
Go to Next Unread Message N
Reply to Message (sender only)(default format) Command + R
Reply to All in Message (all recipients)(default format) Command + Shift + R
Send Message Now Command + Return

Wednesday, November 16, 2011

GalaxyTab, Motorola Xoom Screen Desity and Size

Galaxy Tab (7") is 170dpi, it is close to 160dpi, and should be mdpi . However, it is declared as "hdpi" and "large" by Samsung, because it's look better with a hdpi configuration. The new GalaxyTab 10.1 is the same size and resolution as Motorola Xoom, it should be mdpi and xlarge.(situee's blog)

-->
(situee's blog)

Density Screen Size Resolution
Samsung GalaxyTab 7 hdpi 7" large 1024 x 600
Motorola Xoom mdpi 10.1" xlarge 1280 x 800

Pre-scaling, Auto-Scaling and Screen Density

Designing android layout for multiple screens is really confusing.

Pre-scaling

Pre-scaling resource is an important concept.
If resources are not available in the correct density, the system loads the default resources and scales them up or down as needed to match the current screen's density.

Examples:
for an hdpi device, when there is only mdpi image 100x100, then the image will be pre-scaled to 150x150;
for an mdpi device, when there is only hdpi image 150x150, then the image will be pre-scaled to 100x100;

Sunday, November 06, 2011

ERROR: Unknown command 'crunch'

I upgraded the Android ADT to version 15. Everything seems fine until I tried to run an app.

ERROR: Unknown command 'crunch'

Now, use the new Android SDK Manager to upgrade the Android SDK Tools. Then we can forget about the "crunch" problem.

Tuesday, September 13, 2011

dex2jar Decompile APK file

When I find difficult to do something on Android, I will decompile the APK file and try to learn from the messy java code. But anyway, you may really find something useful that help you out.

Let's see how to decompile. We need some tools to decompile. That is dex2jar. You can find it here. And jd-gui to view the jar as java files.


  1. uncompress the apk. On Windows, use winrar to open the apk and extract.
  2. run command "dex2jar.bat classes.dex", "classes.dex.dex2jar.jar" is generated.
  3. use jd-gui.exe to open jar file and view the java code.

Friday, September 09, 2011

Enable/Renew Team Provisioning Profile:*

There is a Team Provisioning Profile:* in Current Provisioning Profiles in iDP portal.
It's a Wildcard AppID. You don't need to create a AppID and download specified provisioning profile for that AppID. You can use any bundle name and test your app on device with the Team Provisioning Profile:*

Check that whether your certificate is in the certificate list of the Team Provisioning Profile.
If there is not, don't worry. It is managed by Xcode. You can enable it in your Xcode.

Thursday, August 25, 2011

C2DM Implementation Checklist Step by Step

Android C2DM helps your app server push message to your app. It's a mechanism that the server ask the mobile app to fetch new data from server and update itself. C2DM is still in beta version, or Labs version. To use C2DM with your Android applications, you must first signup to request access.

The official doc has a lot of content.
To make it clear, I make the following checklist:


Tuesday, August 23, 2011

C2DM: Get ClientLogin Authentication Token

To send C2DM messages, you should create a new google account as an app-based sender ID and get the ClientLogin Authentication Token.
The most convenient way is using Curl:

curl https://www.google.com/accounts/ClientLogin -d Email=$1 -d Passwd=$2 -d accountType=GOOGLE -d source=companyName-applicationName-versionID -d service=ac2dm

Saturday, July 30, 2011

Android Push Notification Service and C2DM

Apple has support push notification since iOS 3.0
But what about Android??
Android can do this using a long-polling service or keep connected to server.
There are implementations of Android push notification.

1. Cloud to Device Messaging (C2DM) official service by Google
2. AndriodPN at http://sourceforge.net/projects/androidpn/files/
3. Urban Airship Service
4. IBM's MQTT

Thursday, July 21, 2011

_gzwrite _gzclose referenced from - symbol(s) not found

If you are suffering from this build error
just add framework "libz.dylib" to your iPhone project.

It's a "link" error.
For problems like "xxxx reference from ... symbol(s) not found", try to find the missing framework.

Search the link-error method, and "Jump to Definition", you would probably see what framework it is referencing from.

Sunday, July 10, 2011

Info.plist, Failed to launch simulated application: unknown error

I downloaded an opensource iphone project. Failed to build it.

The error message is

could not read data from '/xxxx/xxxx/xxxx/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file.

Wednesday, March 16, 2011

Sharp SH7218U Android folding mobile phone

Recently a new cellphone attracts my eyes.  Sharp SH7218U, really makes a difference. It's the first large-screen/ Android / folding mobile phone I have ever seen.

You can turn the lid clockwise 180 degrees.
Then it becomes a pure touch screen, cell phone. In this mode, here are four virtual Android phone buttons at the bottom of the screen.

Tuesday, March 15, 2011

ASIFormDataRequest Undefined symbols Error, frameworks required

ASIHTTPRequest is a very good open-source project, which help you with complicated http requests.

If you are using  ASIFormDataRequest for the first time. You may find the following error:
Undefined symbols: "_CFHTTPAuthenticationIsValid", referenced from: -[ASIHTTPRequest attemptToApplyProxyCredentialsAndResume] in ASIHTTPRequest.o -[ASIHTTPRequest attemptToApplyCredentialsAndResume] in ASIHTTPRequest.o
..........

How to Migrate SVN Repository to another Server

how to migrate / move a existing subversion (svn) repository to another server?

There are a few easy steps to dump the repository and import into a new server,

1. On your server machine where the repository is now, run
   svnadmin dump REPOS_PATH > mydumpfile

2. Put that file (mydumpfile) on another server.

TouchHTTPD http WebDAV server on iPhone

I have a post that summaries http web servers on iphone.
In this post, we will try TouchHTTPD.

TouchCode is open-source frameworks by  schwa
One of the TouchCode project is TouchHTTPD, which is "An iOS compatible Cocoa Web Server".

It has been moved from google-code to github. You can find it here now: https://github.com/TouchCode/TouchHTTPD
Now using submodules for TouchXML & TouchFoundation.  also projects in TouchCode.
(TouchXML is one of the best cocoa XML parser framework)




Sunday, March 13, 2011

cocoahttpserver HTTP Server File Upload on iPhone

Previous Post :
HTTP Web Server, File Upload on iphone

----- Update 20140729 -------

The original googlecode link is removed.

Please check this https://github.com/vodkhang/CocoaHTTPServer-Iphone
http://vodkhang.com/software-development/cocoa-http-server-bug-fix

---------------------------------------------
Let's try cocoahttpserver
we can get it from google code: code.google.com/p/cocoahttpserver/

we focus on iphone project, so just try the iphone sample code.
Get a local copy of the cocoahttpserver repository with this command:
hg clone https://cocoahttpserver.googlecode.com/hg/ cocoahttpserver

Try the iPhoneHTTPServer sample

Tuesday, March 08, 2011

HTTP Web Server, File Upload on iphone

I installed "PDF Reader Lite" on my iphone. There is very amazing function that I can upload files into the app through a http web server on the iphone. How can they do that?

I google and baidu, and get some clues about setting up a http server for a iphone app.

There are some projects about http server on iphone...

Sunday, March 06, 2011

What New Features iOS 4.3


Safari Performance

The Nitro JavaScript engine that Apple pioneered on the desktop is now built into iOS. Using just-in-time compilation, this powerful engine more than doubles the performance of JavaScript execution. Use this power to optimize your webpage or app web view for increased interactivity and responsiveness.

Wednesday, February 23, 2011

Oracle OTN Java Developer Guangzhou 2011

Jave SE7 SE8 New Features

Project Coin
- Generic Type Inference
- Multi-Catch
- Auto Resource Management (ARM) for streams
- Strings in Switch statement

Project Lambda
- Closure for Java (like Blocks in Mac OS)
- Lambda Expression


Wednesday, February 16, 2011

Unparsed aapt error, main.out.xml

click Run button in Eclipse when I am working in a resource file such as main.xml.
I got error running the project.
a blank xml file "main.out.xml" showed up in editor with message "The document is empty".
In console, "No embedded stylesheet instruction for file".


Wednesday, January 26, 2011

Not enough frames in stack, framework unavailable

Error Message: "mi_cmd_stack_list_frames: Not enough frames in stack"
when debugging on a lower-version iOS device.

To solve this problem, go to menu "Project"-> target info ->

Thursday, January 06, 2011

Create Android sample project, Invalid project description

I found that android sample codes are not Eclipse projects. You have to create Eclipse projects from the sample codes by choosing "Create project from existing sample."

DO NOT set the sample code directory as your workspace, otherwise an error dialog will popup saying something like "Invalid project description, NotePad overlaps the location of another project: 'NotePad'"

Let's build the sample codes and run as Android application.

Monday, January 03, 2011

NSDateFormatter setDateFormat YYYY return wrong year

On the first day of 2011, I found that the date formatter return a wrong year.
2011-01-01 is converted ot "2010年01月01日"
while 2011-01-02 ,2011-01-03 is converted correctly.

It's because the format string YYYY represent the "Year (of "Week of Year"), used in ISO year-week calendar. May differ from calendar year."