adsense

2012-04-30

2012-04-27

2012-04-25

紅外線感測 走線


'InnobotLineTracker.inb: Innobot Follow The Black Line
#DEFINE R_NORMAL_SPEED 50     'Set Innobot Normal Speed
#DEFINE L_NORMAL_SPEED 40
#DEFINE ERROR_1     60 'Define Error for each Sensor Value
#DEFINE ERROR_2     30
#DEFINE ERROR_3     10
#DEFINE ERROR_4     0
#DEFINE ERROR_5   -10
#DEFINE ERROR_6   -30
#DEFINE ERROR_7   -60
Sub Main()
Dim I,Sensor As Byte
Dim R, L, Err As Integer    
Low 10: Low 11

DO
Sensor=(In(7)<<2)+(In(8)<<1)+In(9) 'Combine L,M,R Sensor State to Sensor Variable
Sensor=(~Sensor) AND &B00000111
Select Sensor 'Select Modified Parameter By Sensor
Case &B100
Err = ERROR_2
Case &B110
Err = ERROR_3
      Case &B010
Err = ERROR_4
        Case &B011
Err = ERROR_5
        Case &B001
Err = ERROR_6
        Case &B000
If Err<1 Then
    Err = ERROR_7
Elseif Err>1 Then
    Err = ERROR_1
End If
Case &B111
            Err = ERROR_4
Pause(2000) 'Wait 2 Sec.
            For I=1 To 10 'Go Forward
    Pulseout(10,300-L_NORMAL_SPEED)
    Pulseout(11,300+R_NORMAL_SPEED)
    PAUSE(16)
    Next I
         End Select
R = (300+R_NORMAL_SPEED) + Err 'Set Right Servo Parameter
        L = (300-L_NORMAL_SPEED) + Err 'Set Left Servo Parameter
    Pulseout(10,L): Pulseout(11,R): PAUSE(16) 'Output control Signal
Loop
End Sub

2012-04-24

checkedListBox


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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string list = "";
            for (int i = (checkedListBox1.Items.Count - 1); i >= 0; i--)
            {
                if (checkedListBox1.GetItemChecked(i))
                {
                    list = checkedListBox1.Items[i].ToString();
                    checkedListBox1.Items.Remove(checkedListBox1.Items[i]);
                    checkedListBox2.Items.Add(list);
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string list = "";
            for (int i = (checkedListBox2.Items.Count - 1); i >= 0; i--)
            {
                if (checkedListBox2.GetItemChecked(i))
                {
                    list = checkedListBox2.Items[i].ToString();
                    checkedListBox2.Items.Remove(checkedListBox2.Items[i]);
                    checkedListBox1.Items.Add(list);

                }
            }
        }

        private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            checkedListBox1.CheckOnClick = true;
        }

        private void checkedListBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            checkedListBox2.CheckOnClick = true;
        }

     
    }
}

關閉 joomla pdf


joomla 1.5.x 版本
如何關閉
方法一
控制台 ==> 選單管理 ==> 選單項目 ==> 參數 ==> 元件
將pdf 圖示選取;隱藏 然後儲存







請進入後來管理畫面於選單管理--選取mainmenu(主選單),然後點選 選單項目 Home, 進去畫面後應該在右邊可以看到參數--元件 元件內有個 pdf 圖示, 將pdf 圖示選取;隱藏 然後儲存 就可以了可以在其他的選單項目 做同樣的操作 也可以把列印的圖示關掉

但我的版本
沒有阿 找了三個小時過後
得知可以在以下三個地方修改

1. 文章管理(全域)
2. 選單項目(某些類型)
3. 個別文章。

決定最後顯示的是 3 > 2 > 1。

2012-04-18

嵌入式 超音波


'SonarATest.inb : SonarA Module Test Program
Const Frequency As Word = 1047
Peripheral MySonar As SonarA @ 3 'Set Module Name,Type, And ID
Dim Distance As Word
Sub main()
Do
MySonar.Ranging() '通知超音波模組開始量測
Pause(100)
MySonar.GetDistance(1,Distance) '讀取量測結果 1=回傳距離單位
Debug CLS,"Distance =", Distance,"cm",CR
If (Distance<15 And Distance>10) Then
Sound(12,200,Frequency):Pause (100)
Else If(Distance<10)Then
Sound(12,100,Frequency):Pause (20)
End If
End If
Loop
End Sub

2012-04-17

listbox 練習



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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string list="";
            for (int i = (listBox1.Items.Count - 1); i >= 0; i--)
            {
                if (listBox1.GetSelected(i))
                {
                    list = listBox1.Items[i].ToString();
                    listBox1.Items.Remove(listBox1.Items[i]);
                    listBox2.Items.Add(list);
                }
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            string list="";
            for (int i = (listBox2.Items.Count - 1); i >= 0; i--)
            {
                if (listBox2.GetSelected(i))
                {
                    list=listBox2.Items[i].ToString();
                    listBox2.Items.Remove(listBox2.Items[i]);
                    listBox1.Items.Add(list);
           
                }
            }

        }

    }
}


2012-04-13

mysql 錯誤訊息


如果 root 密碼是空的,可以登入。
如果 root 密碼改了以後,不是空的,無法登入,且有以下的訊息
#1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

解決步驟
打開cmd


C:\Documents and Settings\use>cd c:\appserv\mysql\bin

C:\AppServ\mysql\bin>mysql -u root -p
Enter password: *****  ((mysql 密碼
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35 to server version: 5.0.16-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET PASSWORD FOR root@localhost = OLD_PASSWORD('*****');  ((輸入跟上面一樣的密碼
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>