A.找不到Android.Support.V7的問題:
參考如下http://oldgrayduck.blogspot.tw/2013/10/android-support-library.html
2014年6月23日 星期一
2014年6月19日 星期四
Javascript 繪圖
A.統計繪圖:
來源:http://www.chartjs.org/
import: <script src="components/com_foxparsing/Chart.js-master/Chart.js"></script>
B.解決因數值過多,造成x軸labels過度擁擠無法顯示數值的問題.
來源:http://www.chartjs.org/
import: <script src="components/com_foxparsing/Chart.js-master/Chart.js"></script>
B.解決因數值過多,造成x軸labels過度擁擠無法顯示數值的問題.
ANS:找到Chart.js在大約938行的calculateXAxisSize函式.
將valueHop = Math.floor(xAxisLength/(data.labels.length-1)); 改成
valueHop = xAxisLength/(data.labels.length-1);
2014年6月11日 星期三
Linux 網路指令
A.繞回介面:
目的:有時繞回介面才能運作
指令: ifconfig lo 127.0.0.1
B.找網路介面:
dmesg | grep eth
C.查詢本機網路和外界網路連線的指令
netstat -nr
D.修改路由表:
route [add | del] [-net | -host] destination [if]
E.觀察網路介面組態
/sbin/ifconfig lo
F.測試整個TCP/IP協定模組是否能順利運作
ssh localhost
目的:有時繞回介面才能運作
指令: ifconfig lo 127.0.0.1
B.找網路介面:
dmesg | grep eth
C.查詢本機網路和外界網路連線的指令
netstat -nr
D.修改路由表:
route [add | del] [-net | -host] destination [if]
E.觀察網路介面組態
/sbin/ifconfig lo
F.測試整個TCP/IP協定模組是否能順利運作
ssh localhost
2014年6月10日 星期二
2014年6月9日 星期一
Android 4.3 的Thread應用:
package com.example.smartheartrate;
import java.util.Random;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class MainActivity extends Activity {
static int count = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container,
false);
System.out.println("start in");
final TextView wordToGuess = (TextView) rootView.findViewById(R.id.text);
final Handler hr;
hr = new Handler(){
public void handleMessage(Message msg) {
switch(msg.what){
case 1:
int newvalue = -1;
do{
newvalue = new Random().nextInt(120);
}while(newvalue < 88);
wordToGuess.setText("HR:"+ newvalue);
break;
}
super.handleMessage(msg);
}
};
new Thread(new Runnable(){
public void run(){
while(true){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Message m = new Message();
m.what = 1;
hr.sendMessage(m);
}
}
}).start();
return rootView;
}
}
}
package com.example.smartheartrate;
import java.util.Random;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class MainActivity extends Activity {
static int count = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container,
false);
System.out.println("start in");
final TextView wordToGuess = (TextView) rootView.findViewById(R.id.text);
final Handler hr;
hr = new Handler(){
public void handleMessage(Message msg) {
switch(msg.what){
case 1:
int newvalue = -1;
do{
newvalue = new Random().nextInt(120);
}while(newvalue < 88);
wordToGuess.setText("HR:"+ newvalue);
break;
}
super.handleMessage(msg);
}
};
new Thread(new Runnable(){
public void run(){
while(true){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Message m = new Message();
m.what = 1;
hr.sendMessage(m);
}
}
}).start();
return rootView;
}
}
}
Android Eclipse 錯誤處理
(1) R cannot be resolved to a variable
在Eclipse中某一個xml檔案沒有寫好,導致語法錯誤,會導致此問題
(2)
每當過一段時間,使用Android Eclipse會產生錯誤,因為android在遠端已經通知本地需要升級,但Eclipse並沒有被同步到
需要進行兩處的更新
A.進SDK Manager:勾選SDK Platform-tools進行更新
在Eclipse中某一個xml檔案沒有寫好,導致語法錯誤,會導致此問題
(2)
每當過一段時間,使用Android Eclipse會產生錯誤,因為android在遠端已經通知本地需要升級,但Eclipse並沒有被同步到
需要進行兩處的更新
A.進SDK Manager:勾選SDK Platform-tools進行更新
B.在Eclipse的Help-> Install New Software進入 https://dl-ssl.google.com/android/eclipse/ 做更新.
重新啟動Eclipse
訂閱:
文章 (Atom)