2014年6月23日 星期一

Eclipse使用Android遇到的問題處理:

A.找不到Android.Support.V7的問題:
 參考如下http://oldgrayduck.blogspot.tw/2013/10/android-support-library.html

2014年6月19日 星期四

Javascript 繪圖

A.統計繪圖:

 來源: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

HTML 5 特性:


<canvas id='ss' ...  > </canvas>
最大的width:32750

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;
}
}

}

Android Eclipse 錯誤處理

(1) R cannot be resolved to a variable

 在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


   

2014年6月8日 星期日

Ubuntu 12.04 root登入

In Terminal:

sudo passwd root



sudo sh -c 'echo "greeter-show-manual-login=true" >> /etc/lightdm/lightdm.conf'


reboot!~

2014年6月6日 星期五

網路知識

DHCP:
  統一管理IP網路作業參數,動態發配IP位址給區域網路上的主機.

2014年6月5日 星期四

格鬥天王 13 招式

各角色招式表:

http://karasless.pixnet.net/blog/post/34286497-kof13%EF%BC%9A%E8%A7%92%E8%89%B2%E6%8B%9B%E5%BC%8F%E8%A1%A8%E7%B8%BD%E9%9B%86

火八神:
  八稚女+豺華
   我是kof xiii的玩家 ,請問八稚女 + 豺華 要怎麼用搖桿按出來呢?

1p位置:23663214a or c 在八稚女快結束時236x4+ac.成功時會在收尾爆炸時追加
是 八稚女最後要撞頭的瞬間 加 ac嗎?
事前需要bc 爆氣嗎?

不用爆氣 這算是招式追加 爆炸開始後過一點點都還來得及。 稍為練習一下就知道了
ok 謝謝 讚
另外單放豺華之後 可以取消 接 一般必殺技吧?

HTML 與 PHP

下載連結:
    <a href=upload/".$row['link']." download>

2014年6月3日 星期二

Javascript 與 PHP

A.javascript轉頁post呼叫php:

HTML:
 <form action='".$PHP_SELF."' method='post'>
 <input type='hidden' name='filelink' id='filelink' value='say it' >
 <input type='submit' name='parse' value='Parsing' >
</form>
PHP:
  echo("alert('".$_REQUEST["filelink"]."');");
      (一定要加上 ' 符號);

   變數宣告-  echo("var filelink = '".$_REQUEST["filelink"]."';");


B.PHP呼叫帶參數javascript function:
   echo ("<td><input type='button' name='delete' value='delete'            onclick=\"senddelete('".$row['id']."','".$row['link']."')\" > </td>");



C.上傳檔案名稱重複的重新命名:
      $splitname = explode(".", $_FILES['file']['name']);
      $name = $splitname[0];
      $extension = $splitname[1];

      $increment = 1; //start with no suffix
           
      while(file_exists("upload/".$name .'('.$increment . ').' . $extension)) {
         $increment++;
     
      }

      $newfilename = $name .'('.$increment . ').' . $extension;

D.onclick 呼叫 php

  <input id="do" class="button1" type="button" name="bu2"  size="3" onclick="callPHP()" value="getcon2" >


 function callPHP() {
      $.ajax({
           type: "POST",
           url: 'components/com_foxbmi/callurl.php',
           data:{action:'call_this'},
           success:function(html) {
             alert(html);
           }

      });
 }


E.使用PHP做post與get html source:

  <?php
$postdata = http_build_query(
    array(
        'id' => '0123456789',
        'mac' => '112233445566',
        'date' => '2014/10/10 11:11:11',
   
    )
);

$opts = array('http' =>
    array(
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => $postdata
    )
);

$context  = stream_context_create($opts);

$result = file_get_contents('http://120.126.40.58:8080/FoxLink/UpLoad/RRUpLoad', false, $context);

     echo $result;
   
     /*
    $url = 'http://120.126.40.58:8080/FoxLink/UpLoad/RRUpLoad';
    echo file_get_contents($url);
    */
   
?>

2014年6月2日 星期一

Ubuntu Mysql 用法

登入:mysql -u <username> -p

查詢DB:show databases;

使用DB:USE <dbname>;

顯示所有表格:show tables;

查詢Table型態:DESCRIBE test;

Create範例:CREATE TABLE HRFileRecord ( id INT PRIMARY KEY AUTO_INCREMENT,dateinfo TIMESTAMP DEFAULT CURRENT_TIMESTAMP, des VARCHAR(200) , link VARCHAR(200) )  CHARACTER SET = utf8 ;

Insert範例:insert into HRFileRecord (des , link) values ('hello','get this');