Start to use Git & Dropbox

November 29, 2012 Leave a comment

It’s really great to use Git to manage my source code. So that , I can develop my own application anywhere , manage my source code offline , and push it when I need to.  Here is a memo for the most simple way to implement it.

1. Install Git & Dropbox

Git :


2. Create a folder for placing the repository in Dropbox folder


3.  I have a project below want to add to Git


4. In the DataAnalysisWeb  folder , input the command below with Git Bash

git init

5. Clone one copy into the Repos under the Dropbox folder

git clone –bare . C:\Users\shenhengbin\Dropbox\Repos\DataAnalysisWeb.git

6. Create a remote repository named “origin” point at the above folder .Then , I can use push&pull from it.

git remote add origin C:\Users\shenhengbin\Dropbox\Repos\DataAnalysisWeb.git

7. OK , Then I can use push like

git push origin master

8. Finally , If  other one also want to checkout it , I can share the folder to him , and use
git clone C:\XXXXXXX\Dropbox\Repos\DataAnalysisWeb.git

to get the latest source code from Dropbox.

Categories: Article

Create css of resizing iframe content

November 22, 2012 Leave a comment

 var s = [];
 s.push("zoom: 0.2");
 s.push("-moz-transform: scale(0.2, 0.2)");
 s.push("-webkit-transform: scale(0.2, 0.2)");
 s.push("-o-transform: scale(0.2, 0.2)");
 s.push("-ms-transform: scale(0.2, 0.2)");
 s.push("transform: scale(0.2, 0.2)");
 s.push("-moz-transform-origin: top left");
 s.push("-webkit-transform-origin: top left");
 s.push("-o-transform-origin: top left");
 s.push("-ms-transform-origin: top left");
 s.push("transform-origin: top left");

 var css = s.join(";");

Categories: Article

JQuery get size of iframe content

November 22, 2012 Leave a comment

It does not works for the cross-domain, but works fine in same domain .

$('iframe').load(function () {
var doc = this.contentWindow.document;
var height = Math.max(
doc.body.scrollHeight || 0,
        doc.documentElement.scrollHeight || 0,
        doc.body.offsetHeight || 0,
        doc.documentElement.offsetHeight || 0,
        doc.body.clientHeight || 0,
        doc.documentElement.clientHeight || 0
    var width = Math.max(
        doc.body.scrollWidth || 0,
        doc.documentElement.scrollWidth || 0,
        doc.body.offsetWidth || 0,
        doc.documentElement.offsetWidth || 0,
        doc.body.clientWidth || 0,
        doc.documentElement.clientWidth || 0
Categories: Article

jQueryMobile excute javascript code twice

October 16, 2012 Leave a comment

I have came across a problem while I putting some JavaScript code inside the HTML body it was excuted twice .

 <script language="javascript">
 $(document).ready(function() {

And if I move the JavaScript code within <head> section, it will solve the issue.

Categories: JavaScript, jQueryMobile

Redundant div tag added just before the close body tag on Galaxy S3

September 7, 2012 Leave a comment

I found a problem that sometimes there is a “FALSE” character displayed at the end of our web page on Galaxy S3 Phone.

With further research , a div tag <div id = “recog_div”>False</div> be founded just before the close body tag.

It seems to be added by Galaxy itself ?

So , I have to remove it by redundant source code. 😦

Categories: Android

Using windows-batch to compare two tables

August 31, 2012 Leave a comment

Micorsoft has already provided EXCEPT keyword to compare the result of two queries.

So we can easily find the unmatched records .

This batch file just implemented to compare records one or multiple tables in two servers by EXCEPT query automatically.

■ Directory Structure

│ CompareMul.bat
│ CompareOne.bat
│ ExSetEnv.bat
│ ExSqlCmdFile.bat
│ Tables.txt list of table names

├─result Result Folder
└─sql Sql Folder
receipt_tbl.sql Sql File

  • ExSetEnv.bat

Set the global variables.

rem @echo off
set DB_NAME_L=DataBase1
set DB_NAME_R=DataBase2
set DB_USER=user
set DB_PWD=pwd

set OUTPUT_FOLDER=result
set SQL_FOLDER=sql
  • ExSqlCmdFile.bat

Just excute the sql query with SqlCmd.

Sqlcmd -U%DB_USER% -P%DB_PWD% -S%DB_SERVER% -d%DB_NAME_L% -h-1 -s"	" -W -i"%1" -o"%2"
  • CompareOne.bat

Call ExSqlCmdFile.bat with input sql file path and out result file path as parameters

rem @echo off
cd /d %~dp0
call ExSetEnv.bat
call ExSqlCmdFile.bat %SQL_FOLDER%\%TABLE_NAME%.sql %OUTPUT_FOLDER%\%1.txt
goto :EOF
  • CompareMul.bat

Loop through table names defined in Tables.txt and Call CompareOne.bat with table name as parameter Call CompareOne.bat with table name as parameter

rem @echo off
cd /d %~dp0
call ExSetEnv.bat
for /f %%p in (Tables.txt) do call :sub %%p
goto :EOF
call CompareOne.bat %1
goto :EOF
  • receipt_tbl.sql

SELECT  [columns for comparing]
SELECT  [columns for comparing]
ORDER BY [columns for comparing]

SELECT  [columns for comparing]
SELECT  [columns for comparing]
ORDER BY [columns for comparing]

How to Run

Then you just directly put



D:/>CompareOne.bat tablename

in command line.

Other commands for memo

Output all user tables into files named as server name.

bcp "SELECT  [name] As name FROM [%DB_NAME%].[sys].[tables] where type = 'U' queryout %DB_SERVER%.txt -c -t\t -S%DB_SERVER% -U%DB_USER% -P%DB_PWD%

Directly excute a query by SqlCmd

Sqlcmd -U%DB_USER% -P%DB_PWD% -S%DB_SERVER% -d%DB_NAME_L% -Q%1
Categories: Article

Android:Run native app via Browser

August 22, 2012 Leave a comment

Here is a memo in my recent project for how to run our native app from web app .

  • html

Create an action like bellow.

location.href = "myschemename://myhost/'1'&p2='2'";

(※ makes no sense)

  • manifest

Use an <intent-filter> with a <data> element.
then specify the scheme and host in it for our web app to invoke.

 <intent-filter >
 <action android:name="android.intent.action.VIEW" />
 <category android:name="android.intent.category.DEFAULT"/>
 <category android:name="android.intent.category.BROWSABLE"/>
 <data android:scheme="myscheme" android:host="myhost" />
  • java

You can use getIntent().getData()which returns a Uri object , then get the parameter from it.

if (Intent.ACTION_VIEW.equals(action)) {
Uri uri = getIntent().getData();
String p1 =  uri.getQueryParameter("p1");
String p2 =  uri.getQueryParameter("p2");


Categories: Android