Tuesday, April 15, 2014

Device name code in AOSP building system

Sometimes it's confusing trying to map the device name code to the corresponding hardware. I put the code and device name map here to make it easier to keep track of the supported hardware by Android.

ModuleCode
Nexus 5"hammerhead"
Nexus 7 [2013] (Wi-Fi)"flo"
Nexus 7 [2013] (Mobile)"deb"
Nexus 10"manta"
Nexus 4"mako"
Nexus 7 (Wi-Fi)"grouper"
Nexus 7 (Mobile)"tilapia"
Galaxy Nexus (GSM/HSPA+)"maguro"
Galaxy Nexus (Verizon)"toro"
Nexus S"crespo"
Nexus S 4G"crespo4g"
Motorola Xoom (US Wi-Fi)"wingray"

Apache2 + Tomcat 8 to host website

Just a memo for the steps I took to host my website on Amazon EC2 using tomcat 8 + apache2.

Install and config tomcat 

Put your website code to TOMCAT/webapps

Domain setup in tomcat

Edit TOMCAT/conf/server.xml, add a new host entry:

    
 
        www.rungist.com

        
        


Config proxy port in server.xml

   

Then restart tomcat

Install and config apache2

Use apt-get install apache2 to install the http server.
Config ProxyPass entry on /etc/apache2/httpd.conf
 
ProxyPass         /  http://rungist.com:8080/
ProxyPassReverse  /  http://rungist.com:8080/

Then restart apache2 service: sudo service apache2 restart

Refer:

https://tomcat.apache.org/tomcat-7.0-doc/proxy-howto.html

Monday, April 14, 2014

Remove ec2-user default privilege


  1. useradd to add a new user account
  2. Create password for the new user, add it to the sudoer list
  3. Enable PasswordAuthentication in /etc/ssh/sshd_conifg
  4. Change root password
  5. Lock ec2-user: passwd -l ec2-user
  6. Delete /etc/sudoers.d/xx
  7. Now the ec2-user has no root permission

Reference:
http://blog.braini.ac/?p=73

Ruby, Rails, RVM and me!

Thanks to Radar's blog about using RVM to install ruby instead of installing ruby as a package.

Following is the debug info for android-marketplace-crawler.
  1. Errors found in the Utils.java file when loading permissions.
     
    java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
        at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
        at java.util.concurrent.FutureTask.get(FutureTask.java:111)
        at com.marketplace.Main.execute(Unknown Source)
        at com.marketplace.Main.resolveArgs(Unknown Source)
        at com.marketplace.Main.main(Unknown Source)
    Caused by: java.lang.ExceptionInInitializerError
        at com.marketplace.io.Sender$AppQuery.toString(Unknown Source)
        at com.marketplace.io.Sender.appExists(Unknown Source)
        at com.marketplace.io.Sender.addAppToCollection(Unknown Source)
        at com.marketplace.service.CategoryThread.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:679)
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
        at com.marketplace.Utils$Permission.<init>(Unknown Source)
        at com.marketplace.Utils.<clinit>(Unknown Source)
        ... 10 more
    
    This error is caused by the empty line at the end of the file "permission"
  2. This error came when create items in table
    undefined method 'class_inheritable_accessor'
    
    The error occurs because of the deprecated function in rails. Here is the solution to this problem: https://github.com/wvanbergen/request-log-analyzer/issues/103

My Linux Workstation Software List


Here is the list of OS that I have used and using:

  • Ubuntu 12.04
  • CentOS 5.6
  • Federo 14
This the list of software I use for daily work/study on these Linux system.

  1. Google Docs
  2. GIMP Image Editor
  3. Sublime Text http://www.sublimetext.com/2
  4. Vim Text Editor
Development Tool Kits:
  1. Eclipse Kepler + WTP + ADT
  2. GIT

Saturday, November 3, 2012

Install Cordova-2.1.0(Previously a.k.a PhoneGap) on CentOS 6.3

  1. Download Cordova source code cordova-2.1.0-incubating-src.zip
  2. Extract the zip file and change into .../android/framework/ directory.
    Update ant property file by issuing  
  3. android update project -p . -t android-16
    ant jar
    
    If your ant version is less than 1.8.0, there'll be an error when compile the cordova like this
    BUILD FAILED
    /opt/android-sdks/tools/ant/build.xml:377:
    The Android Ant-based build system requires Ant 1.8.0 or later. 
    Current version is 1.7.1
    
    So it's better you have the Apache-ant >1.8 in hand before installing cordova > 2.0
  4. Install apache-ant. (The step is optional just in case you failed in step 2.)
    Download the latest version of ant from http://ant.apache.org/bindownload.cg
    Extract the installation file to where you usually install non-system apps and update the environment variables 'ANT_HOME' and 'PATH'in ~/.bashrc
    Add the following lines to your .bashrc file
    ## Apache-Ant ##
    export ANT_HOME=/opt/apache-ant-1.8.4/
    export PATH=$PATH:$ANT_HOME/bin
    
    You can check the basic installation with opening a new shell and typing ant. You should get a message like this
    Buildfile: build.xml does not exist!
    Build failed
    Caution:The cordova-2.1.0 is supposed to use against android-16 API, API <= 16 won't be compiled successfully!
  5. You should see cordova-2.1.0.jar in framework directory.
  6. Now you can create eclipse project with cordova supports
    Type in ./create <project_folder_path> <package_name> <project_name> in .../android/bin/ directory. If everything is OK, eclipse project will be created in the project_folder_path.