2014年7月23日 星期三

如何在 Google Blogger 貼程式碼

如何在 Blogger 貼程式碼


效果展示
#include <iostream>
using namespace std;
main()
{
    cout<<"Hello, world!";
}




在HTML模式下,利用這對標籤把程式碼括起來
<pre class="code prettyprint">  </pre>



範例

<pre class="code prettyprint">
#include <iostream>
using namespace std;
main()
{
    cout<<"Hello, world!";
}
</pre>



最後就得到了漂亮的格式輸出

#include <iostream>
using namespace std;
main()
{
    cout<<"Hello, world!";
}


引用 - 超哥記事 http://frank-tw.blogspot.tw/

如果用<pre class="code prettyprint linenums" > 取代 <pre class="code prettyprint>
將會幫您每5行標示出行數。 但若要每一行都標出「行數」,則需在HTML碼中加入
<style>
li.L0, li.L1, li.L2, li.L3,
li.L5, li.L6, li.L7, li.L8
{list-style-type: decimal }
</style>


結果就會出現
  1. #include <iostream>
  2. using namespace std;
  3. main()
  4. {
  5. cout<<"Hello, world!";
  6. }

2014年7月22日 星期二

點對點連線: https://www.youtube.com/watch?v=R5NvskjtKU8
即時更新線性圖  https://www.youtube.com/watch?v=s16nPo2dg2Y&index=13&list=WL

使用C# 接收Uart_Data

主要code來源:
youtobe
功能算是較不齊全,主要只是有功能
介紹如何設定omport連線 & 目前時間取得
https://www.youtube.com/watch?v=NkyLErxr3ZA
介紹設定Comport
http://www.dotblogs.com.tw/peterdotnet/archive/2010/09/13/17697.aspx

小小大學生:功能很齊全 值得學習
http://www.dotblogs.com.tw/peterdotnet/archive/2010/09/13/17697.aspx

修改自動畫面調整: http://msdn.microsoft.com/zh-tw/library/dd492148.aspx

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication6
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            if (!myserialPort.IsOpen)
            {
                myserialPort.Open();
                tbRX.Text = "port Open :)";
            }
            else
                tbRX.Text = "port busy :( ";
         
     
        }

        private string rxstring;
        private void myserialPort_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        {
            rxstring = myserialPort.ReadExisting();
            this.Invoke(new EventHandler(displayText));
        }
        private void displayText(object o, EventArgs e)
        {
            tbRX.AppendText(rxstring);
        }

        private void bSend_Click(object sender, EventArgs e)
        {
            myserialPort.Write(tbTX.Text);
        }

        private void bClean_Click(object sender, EventArgs e)
        {
            tbTX.Clear();
            tbRX.Clear();
        }

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            myserialPort.Close();
        }

        private void tbTX_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (myserialPort.IsOpen && checkBox1.Checked)
            {
                char[] ch = new char[1];
                ch[0] = e.KeyChar;
                myserialPort.Write(ch, 0, 1);
            }
        }



    }
}

數位電量監控系統 應用繪圖

http://www.ee.ncut.edu.tw/project/ResultFile/98141.pdf

國立勤益科技大學電子工程系學生實務專題成果報告
※※※※※※※※※※※※※※※※※※※※※※※

※ 數位電量監控系統 ※

※※※※※※※※※※※※※※※※※※※※※※※

2014年7月6日 星期日

Tutorial 3: Create a Matching Game_第三章: 創造翻牌相同遊戲

http://msdn.microsoft.com/zh-tw/library/dd553235.aspx

首頁:

您將學習如何:
  • 在 List 物件中儲存物件 (例如圖示)。
  • 使用 foreach 迴圈 (Visual C#) 或 For Each 迴圈 (Visual Basic) 逐一查看清單中的項目。
  • 使用參考變數追蹤表單的狀態。
  • 建置您可以搭配多個物件使用的事件處理常式來回應事件。
  • 讓計時器倒數計時,然後讓計時器於啟動後剛好引發一個事件。
當您完成此教學課程時,您的程式看起來類似下列圖片。
您在本教學課程中建立的遊戲

您在本教學課程中建立的遊戲
若要下載這個範例的完整版,請參閱完整的配對遊戲教學課程範例
=============================================================
以下為實際畫面:






















額外再增加部分有計數 以及 錯誤次數 (後續範例 音效 .....還沒實作 )

時間計數:  
時鐘2 主要設定


--------------------------------
        public Form1()
        {
            InitializeComponent();
            timer2.Start();          // 開始命令: 放置於初始化後面 (進入翻牌主程式前)
            AssignIconsToSquares();
        }
-------------------------------
       private void CheckForWinner()
        {
            .................
            .................
            // If the loop didn’t return, it didn't find
            // any unmatched icons
            // That means the user won. Show a message and close the form
            timer2.Stop();    // 當結束框跑出  則停止時鐘2

            MessageBox.Show("You matched all the icons!", "Congratulations");
            Close();

        }
--------------------------
        private void timer2_Tick_1(object sender, EventArgs e)
        {
            // Display the new time left
            // by updating the Time Left label.
            timeBase  = timeBase + 1;               //  10   ms Onetime
            timeRight = (timeBase / 1 ) % 10;       //  10   ms
            timemid   = (timeBase / 10) % 10;       //  100  ms
            timeLeft  = (timeBase / 100);           //  1000 ms  
            timeLabel2.Text = timeLeft + "." + timemid + timeRight + "seconds";   //  記得必須在外面創建同名Lab
        }
--------------------------




2014年6月22日 星期日

Tutorial 2: Create a Timed Math Quiz_四則運算

Tutorial 2: Create a Timed Math Quiz

在本教學課程中,您將會建置一項測驗,在測驗中,受測者必須在指定的時間內回答四個隨機的算術問題。 您將學習如何:
  • 使用 Random 類別產生隨機數字。
  • 使用 [Timer] 控制項觸發事件,使其在特定時間發生。
  • 使用 if else 陳述式控制程式流程。
  • 在程式碼中執行基本的算術運算。
完成時,您的測驗看起來會像下圖一樣,但數字不同。
=================================================================

您在本教學課程中建立的測驗

包含四個問題的數學測驗
若要下載測驗的完整版,請參閱完整的數學測驗教學課程範例
完成範例:
https://drive.google.com/file/d/0B0CNtUIYT3SqT3FreDZlUFpaTTg/edit?usp=sharing