2015年12月13日 星期日

Google Go - Hello World

Ref: https://gobyexample.com/
1. Install go1.3.3.windows-amd64.msi
2. Reboot 設定path
3. Visual Studio Code
4. Run (Test 中文)
5. Build exe


2015年8月30日 星期日

Xamarin Android App 1

Ref: https://www.visualstudio.com/en-us/features/xamarin-vs.aspx
ASUS X450J / Windows 10 x64 Education
ASUS Zenfone 6
1. Download xamarin installation from vs 2015.
2. The installation was stopped during the slowly download rate.
3. Download XamarinStudio and XamarinVisualStudio manually.
4. Install XamarinStudio and XamarinVisualStudio.
5. Install Xamarin intsllation again.
6. VS2015 new Android project
7. Change to release mode




2015年8月21日 星期五

Android push Server test

Ref:https://developers.google.com/cloud-messaging/android/start?configured
1. First try
ASUS X450J Windows 10 + Android 1.2/1.3
Download Gradle for windows, fail to send message to GCM
2. Macbook Pro  OX 10.10.5 + Android 1.3
    ASUS zenfone 5 and 6
3. Both of zenfone 5 and 6
4. Download android examples
    https://github.com/googlesamples/google-services
5. Download google-Services.json


6. Copy to gcm/app folder
7. Replace API into Gcmsender.java
8. Install Quickstart sample into zenfone 5 and 6
9. ./gradlew run -Pargs="<message>"
  Automatically download and install package



10. ./graglew run -Pargs="推播中文Zenfone 5 and 6"
11. Response
12. Windows 


2015年8月18日 星期二

主控台程式,中英文模式切換

1. ASUS X450J/ Windows 10 Education version
2. Add Ref : https://inputsimulator.codeplex.com/

namespace ConsoleApplication1
{
    using WindowsInput;
    using WindowsInput.Native;
    class Program
    {
        static void Main(string[] args)
        {
            InputSimulator im = new InputSimulator();
            System.Threading.Thread.Sleep(1000);
            im.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.SPACE);
            Console.Write("輸入英文:");
            Console.ReadLine();
            System.Threading.Thread.Sleep(1000);
            im.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.SPACE);
            Console.Write("輸入中文:");
            Console.ReadLine();
        }
    }
}

2015年8月6日 星期四

簽署時發生錯誤: 找不到 SignTool.exe

Ref: http://stackoverflow.com/questions/22946399/signtool-error-no-certificates-were-found-that-met-all-given-criteria-with-a-wi
1. Windows 10 Education version
2. VS 2015 Dreamspark
3.  Download KTOI source code(https://ktoi.codeplex.com/)
4. Test run error : 簽署時發生錯誤: 找不到 SignTool.exe
5. Go to property of project
6. De-select 簽署簽證清單...

2015年7月5日 星期日

Android Studio 使用 Samsung 手機

Ref: http://stackoverflow.com/questions/28056544/samsung-galaxy-phone-is-not-recognized-on-android-studio
1. System: Windows 10 + Android Studio 1.2
2. Mobile : Samsung Galaxy Grand 2

Samsung 手機需使用專用 USB 驅動程式,否則Android Studio無法偵測到手機,就無法上傳app,需要由檔案總管,將*.apk複製到手機安裝。
Samsung USB 驅動程式 下載後,請勿連接手機安裝,俟完成後,再連接Samsung手機,Android Studio 可以找到手機,直接上載apk程式進行測試。

2015年6月15日 星期一

android:layout_below

Force the control located below another control as follows:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    
                xmlns:tools="http://schemas.android.com/tools"    
                android:layout_width="fill_parent"    
                android:layout_height="fill_parent"    
                android:orientation="vertical" >
    <Button android:id="@+id/button1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/button1" />
    <Button android:id="@+id/button2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
           android:layout_below="@id/button1"
           android:text="@string/button2" />
    <TextView android:id="@+id/textView1"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
             android:layout_below="@id/button2"/>

</RelativeLayout>

android studio rendering problems

Ref; http://stackoverflow.com/questions/18195807/android-studio-rendering-problems
The default version is API 22 (5.1.1)
Change to API 19 (4.4.1)
OK。


2015年5月16日 星期六

Android 按按按

Ref :
1. http://android-er.blogspot.tw/2014/02/android-sercerclient-example-client.html
2. Msdn: tcpListener

硬體:
筆電:ASUS X450J
手機:Zenfone 6
Wifi 連線,伺服器IP: 192.168.1.111  port 13000
Server/Client端程式如後:
使用 Android 手機(Zenfone 6)
Android 端程式
伺服器 ASUS X450J
PC 伺服器端程式


2015年3月26日 星期四

USBeacon Sample by Android Studio

Ref: USBeacon Demo Sample

Import non-Android studio project and make a copy into work space.
匯入Android Studio Project,須依據Android studio架構處理,在Java目錄下的Layout非有效目錄,請在res目錄下調整。



2015年3月25日 星期三

錯誤1907。Error 1907. Could not register font. Verify that you have sufficient permissions to install font.

Ref:http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/error-1907-could-not-register-font-verify-that-you/57f3a671-feec-4dc7-873c-bb2a7de9521f

1. ASUS X450J Windows 10 Preview
2. 2015-3-26 更新後開啟 Access 2010 發生錯誤 1907。
3. 參考ref,sfc /scannow  by administrator 失敗。
4. Office2010安裝光碟(iso檔)解壓縮ProPsWW/ProPsWW2 @ xH:\x86\ProPlus.WW
5. Copy *.TTF into C:\Windows\Fonts

2015年3月22日 星期日

Android Bluetooth Le Gatt - Show RSSI

1. Add RSSI Textview @ listitem_device.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="wrap_content">
    <TextView android:id="@+id/device_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="24dp"/>
    <TextView android:id="@+id/device_address"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="12dp"/>
    <TextView android:id="@+id/device_RSSI"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="12dp"/>
</LinearLayout>
2. Add java code in DeviceScanActivity.java
2-1 Add RSSIV as a global variable.
2-2 Add set RSSIV as global var and show it.
3. Result:




Android Bluetooth Le Gatt Testing

Ref:
1. Android Studio example Bluetooth Le Gatt
2. Hardware:
    ASUS X450J (Windows 10 Preview, Android Studio 1.0)
    ASUS Zenfone 6
Test procedure
1. Import sample

2. Check the main_activity

3. Run the example

4. Show the results on Zenfone 6.



2015年3月1日 星期日

Lego C#

Ref: http://legoev3.codeplex.com/documentation#References
1. Hardware:
    ASUS X450J (Windows 10 Preview)
    Lego EV3 (PortA : Left wheel, PortB: Right wheel

2. MainWindow.xaml
<Window x:Class="WPFLego1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" Closing="Window_Closing">
    <Grid Margin="0,0,340,237">
        <Button Name="前進" MouseEnter="前進_MouseEnter" MouseLeave="前進_MouseLeave" Content="前進" Margin="172,10,-172,-10" />
        <Button x:Name="後退" MouseEnter="後退_MouseEnter" MouseLeave="後退_MouseLeave" Content="後退" Margin="172,158,-172,-158" />
        <Button x:Name="左轉" MouseEnter="左轉_MouseEnter" MouseLeave="左轉_MouseLeave" Content="左轉" Margin="-10,85,10,-85" />
        <Button x:Name="右轉" MouseEnter="右轉_MouseEnter" MouseLeave="右轉_MouseLeave" Content="右轉" Margin="354,85,-354,-85" />
    </Grid>
</Window>

3. MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Lego.Ev3.Core;
using Lego.Ev3.Desktop;
using System.Threading.Tasks;

namespace WPFLego1
{
    /// <summary>
    /// MainWindow.xaml 的互動邏輯
    /// </summary>
   
   
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            // Settings
            EV3B = new Brick(new BluetoothCommunication("COM7"));
            EV3B.BrickChanged += EV3B_BrickChanged;
            EV3B.ConnectAsync();
        }

        void EV3B_BrickChanged(object sender, BrickChangedEventArgs e)
        {
            for (int i = 0; i < e.Ports.Count; i++)
            {
                //this.Title += e.Ports[InputPort.A].SIValue.ToString();
            }
        }

        Brick EV3B;
        private void 前進_MouseEnter(object sender, MouseEventArgs e)
        {
            this.Title = "前進";
            EV3B.DirectCommand.TurnMotorAtPowerAsync(OutputPort.All, 50);

        }

        private void 前進_MouseLeave(object sender, MouseEventArgs e)
        {
            this.Title = "停止前進";
            EV3B.DirectCommand.TurnMotorAtPowerAsync(OutputPort.All, 0);
        }

        private void 後退_MouseEnter(object sender, MouseEventArgs e)
        {
            this.Title = "後退";
            EV3B.DirectCommand.TurnMotorAtPowerAsync(OutputPort.All, -50);

        }

        private void 後退_MouseLeave(object sender, MouseEventArgs e)
        {
            this.Title = "停止後退";
            EV3B.DirectCommand.TurnMotorAtPowerAsync(OutputPort.All, 0);
        }

        private void 左轉_MouseEnter(object sender, MouseEventArgs e)
        {
            this.Title = "左轉";
            EV3B.DirectCommand.TurnMotorAtPowerAsync(OutputPort.A, 50);
            EV3B.DirectCommand.TurnMotorAtPowerAsync(OutputPort.B, -50);

        }

        private void 左轉_MouseLeave(object sender, MouseEventArgs e)
        {
            this.Title = "停止左轉";
            EV3B.DirectCommand.TurnMotorAtPowerAsync(OutputPort.All, 0);
        }
        private void 右轉_MouseEnter(object sender, MouseEventArgs e)
        {
            this.Title = "右轉";
            EV3B.DirectCommand.TurnMotorAtPowerAsync(OutputPort.A, -50);
            EV3B.DirectCommand.TurnMotorAtPowerAsync(OutputPort.B, 50);

        }

        private void 右轉_MouseLeave(object sender, MouseEventArgs e)
        {
            this.Title = "停止右轉";
            EV3B.DirectCommand.TurnMotorAtPowerAsync(OutputPort.All, 0);
        }
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            EV3B.DirectCommand.StopMotorAsync(OutputPort.All, true);
            EV3B.Disconnect();

        }
    }
}

2015年2月18日 星期三

Python play a video file

Ref:http://www.thecodingforums.com/threads/python-help-sending-a-play-command-to-quicktime-or-playing-amovie-in-python.702701/

1.
import subprocess
subprocess.Popen(["open", "path/to/the/movie.file"])

2. Quicktimeplayer can not auto play
refhttp://www.defaults-write.com/quicktime-player-x-enable-auto-play-feature/#.VOWJ6bCUf6Y

defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 1

Disable autoplay

defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 0


Android tcp client (Send data from client and get server response) - II

This example show the interactive action between server and client.
1. tcpserver : Add print c.recv(1024) before send response in server side as follows
#!/usr/bin/python           # This is server.py file

import socket               # Import socket module

s = socket.socket()         # Create a socket object
host = socket.gethostname() # Get local machine name
port = 12345                # Reserve a port for your service.
s.bind((host, port))        # Bind to the port

s.listen(5)                 # Now wait for client connection.
while True:
   c, addr = s.accept()     # Establish connection with client.
   print 'Got connection from', addr
   print c.recv(1024)
   c.send('Thank you for connecting')
   c.close()                # Close the connection  

2. tcpclient: Add send data before get response from server side.
Socket socket = null;

            try {
                socket = new Socket(dstAddress, dstPort);

                ByteArrayOutputStream byteArrayOutputStream =
                        new ByteArrayOutputStream(1024);
                byte[] buffer = new byte[1024];

                int bytesRead;
                DataOutputStream DOS = new DataOutputStream(socket.getOutputStream());
                DOS.writeUTF("手機送出訊息");
                InputStream inputStream = socket.getInputStream();

    /*
     * notice:
     * inputStream.read() will block if no data return
     */
                while ((bytesRead = inputStream.read(buffer)) != -1){
                    byteArrayOutputStream.write(buffer, 0, bytesRead);
                    response += byteArrayOutputStream.toString("UTF-8");
                }

            } catch (UnknownHostException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                response = "UnknownHostException: " + e.toString();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                response = "IOException: " + e.toString();
            }finally{
                if(socket != null){
                    try {
                        socket.close();
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            }

Android tcp client

Ref:http://android-er.blogspot.tw/2014/02/android-sercerclient-example-client.html
1. Macbook pro/Android Studio
2. Server :
   http://csjoublog.blogspot.tw/2015/02/python-test-for-sever-and-client.html
3. Android client building procedure
3-1 Create a new project
3-2 Copy xml block and paste into the RealativeLayout tag of activivty_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:orientation="vertical"
        tools:context=".MainActivity" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:autoLink="web"
            android:text="http://android-er.blogspot.com/"
            android:textStyle="bold" />
        <EditText
            android:id="@+id/address"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="dstAddress" />
        <EditText
            android:id="@+id/port"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="dstPort" />
        <Button
            android:id="@+id/connect"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Connect..."/>
        <Button
            android:id="@+id/clear"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Clear"/>
        <TextView
            android:id="@+id/response"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

    </LinearLayout>

</RelativeLayout>
3-3 Copy java code into Mainactivity.java
package com.example.csjou.androidclient2;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;


import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import java.net.UnknownHostException;

import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {

    TextView textResponse;
    EditText editTextAddress, editTextPort;
    Button buttonConnect, buttonClear;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        editTextAddress = (EditText)findViewById(R.id.address);
        editTextPort = (EditText)findViewById(R.id.port);
        buttonConnect = (Button)findViewById(R.id.connect);
        buttonClear = (Button)findViewById(R.id.clear);
        textResponse = (TextView)findViewById(R.id.response);

        buttonConnect.setOnClickListener(buttonConnectOnClickListener);

        buttonClear.setOnClickListener(new OnClickListener(){

            @Override
            public void onClick(View v) {
                textResponse.setText("");
            }});
    }

    OnClickListener buttonConnectOnClickListener =
            new OnClickListener(){

                @Override
                public void onClick(View arg0) {
                    MyClientTask myClientTask = new MyClientTask(
                            editTextAddress.getText().toString(),
                            Integer.parseInt(editTextPort.getText().toString()));
                    myClientTask.execute();
                }};

    public class MyClientTask extends AsyncTask<Void, Void, Void> {

        String dstAddress;
        int dstPort;
        String response = "";

        MyClientTask(String addr, int port){
            dstAddress = addr;
            dstPort = port;
        }

        @Override
        protected Void doInBackground(Void... arg0) {

            Socket socket = null;

            try {
                socket = new Socket(dstAddress, dstPort);

                ByteArrayOutputStream byteArrayOutputStream =
                        new ByteArrayOutputStream(1024);
                byte[] buffer = new byte[1024];

                int bytesRead;
                InputStream inputStream = socket.getInputStream();

    /*
     * notice:
     * inputStream.read() will block if no data return
     */
                while ((bytesRead = inputStream.read(buffer)) != -1){
                    byteArrayOutputStream.write(buffer, 0, bytesRead);
                    response += byteArrayOutputStream.toString("UTF-8");
                }

            } catch (UnknownHostException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                response = "UnknownHostException: " + e.toString();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                response = "IOException: " + e.toString();
            }finally{
                if(socket != null){
                    try {
                        socket.close();
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            textResponse.setText(response);
            super.onPostExecute(result);
        }

    }

}
3-4 Add internet permission into AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.csjou.androidclient2" >
<uses-permission android:name="android.permission.INTERNET"/>
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
4. Run server
5. Run emulator OK.

6. Run Zenfone 6 OK.

2015年2月16日 星期一

Python test for sever and client

Ref:http://www.tutorialspoint.com/python/python_networking.htm

1. Macbook Pro (2014 mid, iOS 10.9.5)
2. Edit: Sublime
3. server.py
#!/usr/bin/python           # This is server.py file

import socket               # Import socket module

s = socket.socket()         # Create a socket object
host = socket.gethostname() # Get local machine name
port = 12345                # Reserve a port for your service.
s.bind((host, port))        # Bind to the port

s.listen(5)                 # Now wait for client connection.
while True:
   c, addr = s.accept()     # Establish connection with client.
   print 'Got connection from', addr
   c.send('Thank you for connecting')
   c.close()                # Close the connection
4. Client.py
#!/usr/bin/python           # This is client.py file

import socket               # Import socket module

s = socket.socket()         # Create a socket object
host = socket.gethostname() # Get local machine name
port = 12345                # Reserve a port for your service.

s.connect((host, port))
print s.recv(1024)
s.close                     # Close the socket when done
Test 2:
ASUS X450J (Windows 10 Preview)
Python26
2-1. Server:
#!/usr/bin/python           # This is server.py file

import socket               # Import socket module

s = socket.socket()         # Create a socket object
host = socket.gethostname() # Get local machine name
port = 12345                # Reserve a port for your service.
s.bind((host, port))        # Bind to the port

s.listen(5)                 # Now wait for client connection.
while True:
   c, addr = s.accept()     # Establish connection with client.
   print 'Got connection from', addr
   print c.recv(1024)
   c.send('Thank you for connecting')
   c.close()                # Close the connection   
2-2 Client:
#!/usr/bin/python           # This is client.py file

import socket               # Import socket module

s = socket.socket()         # Create a socket object
host = socket.gethostname() # Get local machine name
port = 12345                # Reserve a port for your service.

s.connect((host, port))
s.send('Hello Server.')
print s.recv(1024)
s.close                     # Close the socket when done




Mac 檢視 Android Studio SDK Sample code

Ref : https://helpx.adobe.com/x-productkb/global/access-hidden-user-library-files.html
In the Finder, choose Go > Go To Folder.
2. In the Go To Folder dialog, type ~/Library

3. Click Go
4. Change to Android/SDK/Samples

Zenfone 5 USB Files Tra

Ref:  http://www.sogi.com.tw/mobile/articles/6228312-ASUS+PCLink+%26+iTools+v2_0_34+%E7%AE%A1%E7%90%86%E8%BB%9F%E9%AB%94
1.ZenFon 5 A500CG如果找不到USB偵錯 ,請至 設定 > 關於 > 軟體資訊 > "版本號碼" 點擊(三次)多下 ,就會出現 "開發人員選項".
2. The physical device shows in android studio 

3.



2015年2月15日 星期日

http://www.asus.com/tw/support/FAQ/1007851/

Ref: http://www.asus.com/tw/support/FAQ/1007851/
1安裝Android檔案傳輸程式(支援Mac OS X10.5或更高版本)
2. 可透過它在Mac和Android裝置間瀏覽及傳輸文件(支援Android3.0或更高版本)
3. 



2015年2月8日 星期日

Android Studio -Tutorial (Copy file into the sdcard of emulator)

Ref: 
1. https://diptimayapatra.wordpress.com/2013/07/04/copying-a-file-to-sd-card-image-using-adb-exe-for-android-emulator/
2. http://stackoverflow.com/questions/2083709/android-emulator-sdcard-push-error-read-only-file-system


1. Start Emulator.
2. Run command mode by administrator privileges
3. Change platform-tools directory (user as csjou)
C:\WINDOWS\system32>cd C:\Users\csjou\AppData\Local\Android\sdk\platform-tools
4. Follow Ref1 step fails to push file into sdcard.
C:\Users\csjou\AppData\Local\Android\sdk\platform-tools>adb push "C:\Users\csjou
\Pictures\HWUIC.jpg" /sdcard/
failed to copy 'C:\Users\csjou\Pictures\HWUIC.jpg' to '/sdcard//HWUIC.jpg': Read
-only file system
5. Change sdcard read-only status (Follow the command as red characters)
C:\Users\csjou\AppData\Local\Android\sdk\platform-tools>adb shell
root@generic_x86:/ # cd sdcard
cd sdcard
root@generic_x86:/sdcard # ls
ls
root@generic_x86:/sdcard # su
su
root@generic_x86:/storage/sdcard # mount -o rw,remount rootfs /
mount -o rw,remount rootfs /
root@generic_x86:/storage/sdcard # chmod 777 /mnt/sdcard
chmod 777 /mnt/sdcard
root@generic_x86:/storage/sdcard # exit
exit
root@generic_x86:/sdcard # exit
exit
6. 
C:\Users\csjou\AppData\Local\Android\sdk\platform-tools>adb push "C:\Users\csjou
\Pictures\HWUIC.jpg" /sdcard/
1388 KB/s (31311 bytes in 0.022s)

2015年2月6日 星期五

Mac Set $JAVA_HOME

Ref:http://liberalsprouts.blogspot.tw/2012/12/how-to-install-jdk-7-and-set-up.html
1. 確認設定
echo $PATH
echo $JAVA_HOME
2. vim .profile (原沒有此檔案,新建)
CSdeMacBook-Pro:~ csjou$ vim .profile
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/contents/Home;
export JAVA_HOME;
PATH=$PATH:$JAVA_HOME;
export PATH;
3. 重新載入

 su -l <user>
輸入密碼
4. echo $JAVA_HOME   OK!                                                          

2015年1月26日 星期一

Creator III - 1

1. Download  ReplicatorG0040 from http://replicat.org/download
2. Without python and related tools installed, there may be error as follows

3. Install
    Python-2.6.6
4. Install
    Psyco-1.6.win32-py25
    Fail due to missing mscvr71.dll (@ Win8.1 x64)
    4.1 Solved by download mscvr71.dll from http://www.addictivetips.com/windows-tips/fix-msvcp71-dll-and-msvcr71-dll-missing-error-in-windows-7/
    4.2 Copy msvcr71.dll into c:\Winodws\SysWow64
    4.3 Error due to the Chinese Simple name

    4.4 Copy file to a regular folder and then execute OK.
5. Test OK


2015年1月10日 星期六

Phonegap Helloworld for Android

Ref: http://www.moke.tw/wordpress/computer/advanced/438
        http://inspire.twgg.org/programming/html-css/item/389-html5-started-teaching.html
Ref1: Phonegap, Ref2: HTML5
1. Prepare HTML5 File (index.html,  the name of file has to be lower case letters)
<!DOCTYPE html>
<html>
      <head>
              <meta charset="UTF-8">
              <title>Example document</title>
       </head>
     <body>
              <header>
                    <h1><a href="#">Welcome to my page</a></h1>
               </header>
           <nav>
                       <ul>
                                <li><a href="#">Home</a></li>
                             <li><a href="#">About</a></li>
                            <li><a href="#">Contact</a></li>
                  </ul>
               </nav>
              <section>
                   <article>
                           <header>
                                    <h3><a href="#">Article 1</a></h3>
                                </header>
                           <section>
                                   <p>Lorem ipsum...</p>
                         </section>
                  </article>
                  <article>
                           <header>
                                    <h3><a href="#">Article 2</a></h3>
                                </header>
                           <section>
                                   <p>Lorem ipsum...</p>
                         </section>
                  </article>
          </section>
          <aside>
                     <h1><a href="#">Aside content</a></h1>
                    Lorem ipsum dolor sit amet..
              </aside>
            <footer>
                    <address>
                           Contact us at:<br />
                                <a href="http://itc.hwu.edu.tw/">itc.hwu.edu.tw</a>
                   </address>
          </footer>
   </body>
</html>
2. Prepare Config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns   = "http://www.w3.org/ns/widgets"
xmlns:gap   = "http://phonegap.com/ns/1.0"
id    = "tw.moke.testing"
versionCode = "10"
version     = "0.2.0" >

<name>HelloWorld</name>

<description>
專案描述
</description>

<author href="http://itc.hwu.edu.tw" email="092012@mail.hwu.edu.tw">
csjou
</author>

<!-- current version of PhoneGap -->
<preference name="phonegap-version" value="3.5.0" />
<!-- 設定畫面固定為水平(landscape)、垂直(portrait) -->
<preference name="orientation" value="landscape" />
<!-- 加入其它plugin設定 -->
</widget>
3. Zip both of them into a file say Helloworld.zip
4. Upload into Phonegap Builder
5. Select App platform.
6. Scan QR code (Download apk and install)