Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

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

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?

    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...

    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.


    Monday, December 10, 2007

    Google doc has everything except macro

    I have created a spreadsheet for my wife's portfolio today.
    The spreadsheet has three sections:
    1. US Stock
    It is dynamic table, since i can use googlefinance() cell function to retrieve real time quote for us stocks

    2. Mainland Fund
    Keep tracking the fund investment in china.
    However, the googlefinance function doesn't support get stock/fund price for hongkong or china market yet.

    3. Bank Investment.
    Bank money market account.

    I feel that google doc is really handy. It allows me to finish this complicated document for less than an hour. What is the most wanted feature for me then?
    Macro! Macro! Macro!



    Thursday, December 6, 2007

    cannot restore segment prot after reloc: Permission denied

    That is SELinux policy problem.

    System -> Administration -> Security Level and Firewall -> SELinux Tab. Change
    "Enforce" to "Permisive"



    Or we can config to only allow this policy
    System -> Administration -> Security Level and Firewall-> SELinux tab ->Modify SELinux Policy ->Compatibility -> Allow the use of shared libraries with Text Relocation

    Sunday, December 2, 2007

    PHP tempalte + CSS = new website in one day

    Just created a new website last night. How can i do that in one day? Here is the answer:


    • CSS:Separate the presentation with content by using CSS stylesheet

    • PHP template:Define website structure using PHP template --all the headers, footer, main menu, sidebar...etc are added by php include

    • Contents:the contents dir will only keep clean page content without any presentation, and site structure.

    Friday, November 16, 2007

    javascript include workaround

    While i am working on a server side javascript framework, i realize that javascript doesn't support include. that means, you can't directly include another javascript.

    If you are write web application, this can be done by

    document.write('<script language="javascript" src="' + baseHref
    + 'variables.js"></script>');


    However, i want to separate my javascripts into libraries, and called on the server side.
    In the end, i write a include function as work around.

    usage:


    ...
    var includes = "";
    ...
    include("another.js");
    eval(includes);
    includes = "";
    ...






    include function:


    function include(filename){

    length = filename.length;

    if (filename.indexOf(".js") < 0) {
    filename = filename + ".js";
    }
    reader = new java.io.BufferedReader(new java.io.FileReader(filename));
    while((chunkread = reader.readLine()) != null) {
    includes = includes + chunkread + "\n";
    }
    reader.close();
    }

    Wednesday, October 31, 2007

    How to solve the connection refuse error for php script on Linux

    I am trying to use Magpie RSS parser to parse RSS feed in my PHP scripts today. However, I always got 'unable to connect to www.google.com:80 (Permission denied)' error messages.

    In php.ini, the allow_url_fopen is set to on.
    Then it must has something to do with my Apache or network configurations.

    After fighting for one hour, I finally found the problem that it was disabled by my network policy.
    To fix this, Desktop > System > Administration > Security Level > SELinux > httpd > check the HTTPD scripts to connect to the network.

    Thursday, September 27, 2007

    Building auto-translator based on google translate API (3)

    Finished the ETranslator plugin

    Since machine translation is getting more mature year over year, it can be used for localization vendors to cut the translation cost.
    Even more, if we can mash-up related technologies together, we can create

    Interpreter Robot

    1. Speech-to-Text, to input English
    2. machine translation, to translate to Franch
    3. Text-to-Speech, to speak out in Franch

    Wednesday, August 8, 2007

    XML Transformer indent doesn't work with jdk5

    The below code works fine with jdk1.4, i can get nice formatted xml document.



    TransformerFactory transFactory = TransformerFactory.newInstance();
    Transformer transformer = transFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
    DOMSource source = new DOMSource(document);
    StreamResult stream = new StreamResult(os);
    transformer.transform(source, stream);



    However, found it doesn't work on jdk5.
    I need to change to the following work around code



    TransformerFactory transFactory = TransformerFactory.newInstance();
    transFactory.setAttribute("indent-number",
    new Integer(2));
    Transformer transformer = transFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
    transformer.transform(new DOMSource(document),
    new StreamResult(new OutputStreamWriter(os, "utf-8")));

    Tuesday, July 3, 2007

    Production GIS map system all based on open source components

    During the past weeks, I was designing a GIS map system similar to Google map for a company.
    On the server side, they want a spatial database, which support ESRI format Sharp files. Also needs a map server, which handle client request, query the database...etc.

    On the client side, they want a standalone client instead of AJAX based web app.

    I have some experience on the GIS stuff five years ago. We used a open source map server at that time, but it was quite slow.

    When looking into open source area for GIS system again after five years, i found that we can build PRODUCTION GIS system by integrating all the latest and best from open source community.

    Here is the solution in the end:
    Server side: Postgis + GeoServer + squid cache.
    No development work is needed .

    Client side:
    • Web-based client, can be built on top of OpenLayers
    • standalone client, can be built by extending from udig. udig is an eclipse RCP application!

    Tuesday, March 27, 2007

    my blog can't access again from china

    Since i am maintain this blog from china. looks like blogger has been blocked in china.

    I know google will be blocked some time, and it will last for one or two days in the worst case.
    But the blogger is down for a week.

    The temp solution is:
    add '72.14.219.190 johnsonsoultions.blogspot.com' to
    c:\windows\system32\drivers\etc\hosts file

    More detail about that:
    if you do nslookup for johnsonsolutins.blogspot.com,
    you will get the ipaddress from dns as
    72.14.207.191

    But if you tracert for that ip, you will find it has been locked at chinese operator before going to the outside world.

    We can't do anything here, just wait......

    How to add your website to google and other search engines


    After create a new website, our problem is how to list that site in google and other search engines.
    There are two steps here:
    • Submit you url to google
    http://www.google.com/addurl.html
    it will take severl days, or even one month for google to record your new website. to speed up the process, you need take more action.

    • add extenal links to you website
    For those website with high PR value, googlebot will visit it everyday.
    So you can add links to you website.
    The easy way to do it is put some posts in bbs, email list with link to you site. Then you new site have chance to showup in several days
    Links to other search engines:
    * yahoo
    https://login.yahoo.com/config/login_verify2?.src=siteex&.intl=us&.done=http%3A%2F%2Fsiteexplorer.search.yahoo.com%2Fsubmit

    *dmoz.org
    It is Open Directory Org. provider content to most search engine
    http://dmoz.org/add.html

    Thursday, March 22, 2007

    GUI guideline

    I always feel need to remind myself every couple of months about those basic GUI guideline:

    user in control, directness, consistency, forgiveness, feedback, aesthetics, and simplicity.

    Tuesday, February 27, 2007

    Disable Flash plugin on Firefox

    I don't like most flash from internet.
    Since the took at least 50% CPU from my computer.
    So i installed the flashblocker, that will not download
    flash content by default at all. You can click the empty picture to
    enable the flash when needed.

    FlashBlocker

    There is also a similar one called AdsBlock. one guy said it is event better than flashblocker

    Tuesday, January 9, 2007

    delete ^M in vi

    Need to delete ^M again in some schema files.
    Why it always happen, why can't those softwares handle it internally.

    Hope the M$ and Novel deal will help to eliminate those small and big difference between Unix and Windows world.

    Anyway, here is the step to delete ^M suing VI.
    %S/^V^M//g
    The ^V is CONTROL-V and ^M is CONTROL-M

    'ga' command in vi can show the hex value of current character.
    If you move cursor to ^M, and give 'ga' command. it will show:
    <^M> 13, Hex 0d, Octal 015

    This is actual value of ^M we dislike

    Friday, January 5, 2007

    Google Desktop Hack -- add two clocks for two different timezones


    Just hacked the Google Desktop to start two clocks for two different time zooms.
    I need this feature really hard, since some of my co-workers are located in Dublin office (8 hours from my time).
    Do not need to calculate the time difference by myself anymore!

    I will become an idiot one day since i am more and more depending on computers to do all stuff.
    Anyway, check out my current desktop screen shot.