Wednesday, October 16, 2013

How to solve adb server is out of date issue

I was facing the adb issue yesterday after reboot my laptop.
>adb devices
adb server is out of date.  killing...
ADB server didn't ACK
* failed to start daemon *
error: unknown host service



Finally, here is the solution:
Step1: find if the adb port is occupied
> netstat -ano |grep 5037
 TCP    127.0.0.1:5037         127.0.0.1:65151        ESTABLISHED     6980


Step2: find the process name
>>tasklist /fi "pid eq 6980

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
tadb.exe                      6980 Console                    1      5,112 K

Step3: kill that process (tadb.exe for this case)

How to use tcpdump on Android devices


>adb push tcpdump /sdcard/tcpdump
>adb shell
>su
>cp /sdcard/tcpdump /data/local/tcpdump
>chmod 6755 /data/local/tcpdump
>cd /data/local
>/data/local/tcpdump -p -vv -s 0 -w /sdcard/capture.pcap
ctl+c
>adb pull /sdcard/capture.pcap c:\

Tuesday, July 24, 2012

How to connect to unknown android device using USB

>adb devices
List of devices attached
emulator-5554    device
????????????    no permissions

which means this device is unknown to adb yet.

try to find it is device id
>lsusb
Bus 001 Device 006: ID 19d2:0287 ONDA Communication S.p.A.

19d2 is the vendor id, 0287 is the product id.

>sudo /etc/udev/rules.d/51-android.rules
add a new entry at the end with vendor/product id above

>sudo restart udev

>adb kill-server
>adb start-server
>adb devices
List of devices attached
emulator-5554    device
04507242439fb497_MTPADB    device

Sunday, March 4, 2012

vim indent commands

>> Indent line by shiftwidth spaces
<< De-indent line by shiftwidth spaces
5>> Indent 5 lines
5== Re-indent 5 lines

>% Increase indent of a braced or bracketed block (place cursor on brace first)
=% Reindent a braced or bracketed block (cursor on brace)
<% Decrease indent of a braced or bracketed block (cursor on brace)
]p Paste text, aligning indentation with surroundings

=i{ Re-indent the 'inner block', i.e. the contents of the block
=a{ Re-indent 'a block', i.e. block and containing braces
=2a{ Re-indent '2 blocks', i.e. this block and containing block
>i{ Increase inner block indent

Monday, January 2, 2012

ptrace: Operation not permitted

I got above error when try to use Eclipse CDT to attach an running process for debugging.

It because of the ptrace protection since Ubuntu 10.10.

Here is the link to more detail explain
https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace%20Protection

To work around:
first need to enable root account
>sudo passwd root
>su
>echo 0 > /proc/sys/kernel/yama/ptrace_scope
>exit
re-disable root account for security reason
>sudo passwd -dl root

Now, it works

To permanently allow it edit /etc/sysctl.d/10-ptrace.conf and change the line to:
kernel.yama.ptrace_scope = 0

Monday, June 20, 2011

Git ---- denied: You cannot push changes not committed by you

If you get the PERMISSION DENIED error when try to push to a remote server, check the followings:
  • The author name and email should be the same as your git profile.
Expecially, the author name is FULL NAME of your profile on git server.

  • If you are using Linux, you also need to setup committer name and email to the same as git profile. otherwise, it will be youid@your_linux_host by default


To fix the permission problem:

>export GIT_COMMITTER_NAME="Your Fullname"
>export GIT_COMMITTER_EMAIL="Your Email"
>export GIT_AUTHOR_NAME="Your Fullname"
>export GIT_AUTHOR_EMAIL="Your Email"

//to back out the commit and index
>git reset HEAD^
//recommit and push again
>git commit
>git push

Tuesday, May 24, 2011

Forecast on Windows Phone market share and revenue in 2013

The global mobile phone market has changed, since the day Apple enters the market on January 9, 2007.



In Q4, 2007, Nokia has more than 50% of global market share on smart phone with SymbianOS.

By Q1 2011, Google's Android has more than 50% of global market share, and Apple's iOS has 25% share.


Furthermore, Android grows from zero to 50% market share in just two and half years. This kind of technology evolution and adoption never happened in such a short time before.

With Microsoft and Nokia works together later this year, what are market shares in 2013?




I think what happened to Symbian in the past two years, will also happen to RIM. Microsoft and Nokia will also get some market share from Android as well. Also, from operators point of view, they don't like that internet giant dominating the mobile echo system.

According to some forecast, there will be 800 million units smart phone shipped in 2013. In that case, it will be 200 million Windows Phone, plus $15 per unit, the revenue for Microsoft will be 3billon dollar.

However, in fiscal year 2010, Microsoft recorded $62.5 billion of revenue and $18.8 billion of net income. If my forecast is correct, the revenue from phone will only be less than 5% of 2010's annual revenue.

Seems Microsoft needs to do more to boost the revenue from smart-phone area. Buying smartphone segment from Nokia to create a counterpart with Apple's IPhone? It do make sense, since XBox is doing great. why not create a XPhone then?

Thursday, May 19, 2011

Script to install Apache, PHP and MySql on Ubuntu

Here is a shell script i wrote to download and install LAMP on Ubuntu.


#!/bin/bash

echo "current OS information:"
cat /etc/lsb-release

echo "install patches"
sudo apt-get install update

echo "install apache2 and php5..."
sudo apt-get install apache2 php5 libapache2-mod-php5


echo "create test.php at /var/www/test.php"
echo "" | sudo tee /var/www/test.php

echo "restart apache2"
sudo /etc/init.d/apache2 restart

echo "start firefox to check the test page"
firefox "http://localhost/test.php" &

echo "install mysql"
sudo apt-get install mysql-server mysql-client php5-mysql


echo "install PhpMyAdmin"
sudo apt-get install phpmyadmin

sudo echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
sudo /etc/init.d/apache2 restart

firefox "http://localhost/phpmyadmin" &

#need to set the default character to gb2312 to support chinese character
#mysql> set names 'gb2312'





Enjoy!

Sunday, December 14, 2008

Software Testing MindMap


Software Testing is not an easy topic, because of mass considerations.

So I just created a mindmap for software testing to cover most perspectives around testing.

Friday, November 7, 2008

Reasons for project failure



During the past 15 years, i have worked on various projects. I must say that some projects are not as successful as expected.

Here are most common reasons for project fail:

Project Initiation & Planning Issues
  • Unclear or unconvincing business case
  • Insufficient or non-existent approval process
  • Poor definition of project scope and objectives
  • Insufficient time or money given to project
  • Lack of business ownership and accountability
  • Insufficient and/or over-optimistic planning
  • Poor estimating
  • Long or unrealistic timescales; forcing project end dates despite best estimates
Lack of thoroughness and diligence in the project startup phases

Technical & Requirements Issues

  • Lack of user involvement (resulting in expectation issues)
Product owner unclear or consistently not available
Scope creep; lack of adequate change control
Poor or no requirements definition; incomplete or changing requirements
Wrong or inappropriate technology choices
Unfamiliar or changing technologies; lack of required technical skills
Integration problems during implementation
Poor or insufficient testing before go-live
Lack of QA for key deliverables
Long and unpredictable bug fixing phase at end of project

Stakeholder Management & Team Issues

* Insufficient attention to stakeholders and their needs; failure to manage expectations
* Lack of senior management/executive support; project sponsors not 100% committed to the objectives; lack understanding of the project and not actively involved
* Inadequate visibility of project status
* Denial adopted in preference to hard truths
* People not dedicated to project; trying to balance too many different priorities
* Project team members lack experience and do not have the required skills
* Team lacks authority or decision making ability
* Poor collaboration, communication and teamwork

Project Management Issues

* No project management best practices
* Weak ongoing management; inadequately trained or inexperienced project managers
* Inadequate tracking and reporting; not reviewing progress regularly or diligently enough
* Ineffective time and cost management
* Lack of leadership and/or communication skills

Agile Process can cure some of the problems, but not all

Saturday, September 27, 2008

big-endian UTF16 or little-endian UTF16?

I was working on generating configuration file for mobile device on PC today.
From the example, I can tell that it is using two bytes Unicode.
Thus I am using 'UTF-16' encoding for InputStreamReader and OutputStreamWriter.

However, it seems that the server running on mobile device doesn't like my configuration file.
By looking into the example and generated files, I notice that it was using little-endian UTF-16.
So I changed to use the following statement to write content in little-endian UTF16 encoding.

OutputStreamWriter out = new OutputStreamWriter(
new FileOutputStream(iniFile), "UTF-16LE");


Here are Unicode table for reference:























EncodingFile initial signatureJava encoding name
UTF 8FF BB BFUTF8
UTF 16 Big-EndianFE FFUTF16-BE
UTF 16 Little-EndianFF FE UTF16-LE

Tuesday, August 26, 2008

AntSys -- lightweight and powerful system test framwork

AntSys



Why write AntSys


I was looking for a well-know and easy to use open source tool for our system testing.
My requirements are:

  • Test Model, provides the concept of test suite, test case and test result

  • Test Method: launch command line application, check the outputs. which means should be easy to
    * configure parameters
    * setup environment variables
    * able to redirect stand input, output, and error
    * get back the process exit code

  • Test Assertions: should built-in with the following assertions:
    * check if output file is created as expect
    * check the content of output file against expected file.
    * check process exit code
    * check the content of system.ouput.
    * check the content of system.error.

  • Test Result:It should generate XML and HTML report

  • Test Language/API: the test language should provide rich API to help users write test case:
    such as create/delete directory, copy files, and even xml processing.

  • Extensibility: the test lanauge can be extended by end users.


  • Although the requirements are quite generic, I can't find a well-known OSS project. Most companies are
    using their own home-grow system test framework.
    Let's create a OSS tool to solve this problem then!

    What is AntSys


    AntSys is a lightweight and powerful system test framwork built on top of Ant.
    It is designed to be easy to work and user can create system/function test cases in xml file without writing single line of code.

    AntSys Tasks


    AntSys provides the following Ant tasks to write a system test:
  • tastsuite: is used to aggregate tests into groups of test cases that should be run together.

  • testcase: is a set of conditions under which a tester will determine if a requirement or use case upon an application is partially or fully satisfied.

  • assertfileexist: check if the output file is exist as expected.
  • assertfileequal: check the content of output file is the same as expected test result.
  • assertfilegrep: check the content of output file contains expected string defined in regular expression
  • assertpropertyequals: check the ant property against expected value. This is offened used after 'exec' task to check the process exit code.

  • Example test script


    Here is one example of test script to test echo command.

    <project name="antsys-systemtest" basedir="." default="systemtest">
    <target name="systemtest">
    <!-- this test suite is using AntSys to test echo shell commands -->
    <testsuite name="CommandTestSuite" failonerror="false" todir="./report" htmlreport="true">
    <!-- test echo command output -->
    <testcase name="echo_test">
    <!-- create working dir for testing -->
    <mkdir dir="work"/>
    <!-- use echo to create a test file -->
    <exec vmlauncher="false" executable="echo" output="work/test.dat">
    <arg value="testmessage"/>
    </exec>
    <!-- check the file exists or not -->
    <assertfileexist file="./work/test.dat" errormsg="should generate test.dat" />
    <assertfilegrep file="./work/test.dat" regexp="^test" errormsg="should start with test" />
    <assertfileequal expectedfile="./work/test.dat" actualfile="./work/test.dat"/>
    <delete dir="work"/>
    </testcase>
    </target>
    </project>

    Sunday, June 29, 2008

    Something big is right around the corner!






    The Symbian Foundation announcement this week will change the business strategy
    for mobile space in the following years.

    Android from Google is one big part of the reason for Nokia to pay 400M to buy Symbian and donate it to open source.
    Thinking about the Symbian/Nokia relation, this is the milestone in the use of open source by large tech companies like Nokia,

    Nine years ago, when i worked for Nokia, I found it is a company always ready to big change. I really respect to that.

    However, things are not clear to some related parties yet:

    • Employee
    In such big move to open source, Some teams in Symbian and Nokia will be cut (like what happened for UIQ).
    some time will shrink to fit the community driven mobel (How those managers find there position in community
    model?). As a symbianer, Do i want to wait for the special bonus?


    • Microsoft
    M$ will be the only company, who charge $ for mobile phone vendor. Let's see what will happen for them.

    • Apple
    Will iPhone be the most popular mobile device like iPod did for mp3? Can the company fight with foundation
    supported by major vendors and operators?

    Monday, June 23, 2008

    Symbian Fundation

    Big news again today.

    Nokia to acquire Symbian Limited to enable evolution of the leading open mobile platform
    June 24, 2008


    Visionary move embraces openness and accelerates innovation

    Sunday, February 17, 2008

    Config Idle Timeout for openSSH Fedora

    With some ssh servers, you can config the time out in /etc/ssh/sshd_config like

    IdleTimeOut=10m

    However, the openssh shipped with Fedora doesn't support this option.
    Two workarounds are:
    • Apply openssh watchdog patch
    http://www.sc.isc.tohoku.ac.jp/~hgot/sources/openssh-watchdog.html
    • use TMOUT for shell
    In /etc/profile
    #set the idle timeout for ssh to 10minutes
    TMOUT=600

    readonly TMOUT

    export TMOUT


    Notice here, need to set the TMOUT to readonly, otherwise users can override it.

    Thursday, January 31, 2008

    On The Road -- Google Map Mashup

    Just Created a google map mashup page to show those places i have visited.
    The page is hosted on google http://multiroute.googlepages.com/ajaxGoogleMapsMashup.html

    The draft version only show the list of places in the right side, and show marker and zoom in once you click the location.

    Plan to add more stuff when have time:
  • polish the site
  • show to pictures for each trip (Already in Picasa Web Albums)
  • Thursday, January 24, 2008

    SOA Trends

    SOA Trend on the web




    Trends compare between SOAP/REST




    Looks like people are more favorite REST than SOAP now. interesting...

    Tuesday, January 8, 2008

    localization360

    www.localization360.com

    A good portal site for localization industry. Keep me up to date with the industry news, blogs, hot topics, jobs and resources.

    Thursday, December 20, 2007

    Open Source "Best Practices"

    Check out the Best Practices for Open Source project from collab.net.

    Most of the "Best Practices" are also followed by in-house agile development team.
    Such as:

    1. Technical Communication

    2. Version Control, Document Management, and Distribution

    3. Build and Test Management

    4. Project Management

    5. Knowledge Management



    I can't agree more that open source products have achieved a remarkable degree of quality with very low cost because of the following reason.

    1. Developers are self-selected by their interest and knowledge of the application domain.

    2. Requirements are tacitly understood by developers who are themselves users of the software.

    3. Technical communications (including bug reports) are conducted in public. The public nature of open source helps developers take pride in their successes and think twice before releasing faulty code.