adsense

2011-10-27

[隨筆] TRIB


TRIB=被接數的實體資料位元/位元被接收所需時間

K: 每字元所代表的訊息位元
M: 字元的區段長度
R: 每秒鐘可傳送的字元量
C: 美區段非資訊的平均數量
P: 重傳的機率
T: 區段傳輸之時間間隔
ps: 全雙工時 T=0
-------------------------------------聽說我是分隔線---------------------------------------------
EX:

假設每秒傳輸9600Bits的半雙工網路,其每一字元為8位元,
每一通訊區段有600個字和10 個字的控制位元,
發生錯誤重傳的機率為每100個傳輸區段有1個需要重傳,
延遲時間由規格輸得知為25毫秒,則其流量的計算方法如下:


9600/8=1200

           8*(600-10)*(1-0.01)
IRIB= ----------------------------=8900 bit/s
           600/1200+0.025



K=每一字元為8位元
M=每一區段知600個字元
R=1200字元/秒(由9600位元/秒除以8位元/字元而得)
C=每一區段10個控制字元
P=0.01(每100個傳輸區段有1個需要重傳)
T=25毫秒反向傳輸時間

2011-10-26

[企業通訊概論] 2011/10/25 上課內容

yum install -y kernel-devel
yum install -y gcc

#include
#include
#include
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Robert");
MODULE_DESCRIPTION("Hello");
static int _init hello_2_init(void)
{
printk(KERN_ALERT "Hello",world 2\n");
reutrn 0;
}

static void_exit hello_2_exit(void)
{
printk(KERN_ALERT "Goodbye,world 2\n");
}



obj-m+=t1.o
all:
make -C /lib/modules/s(shell uname -r) /build M=S(PWD) modules
clean:
make -C /lib/modules/s(shell uname -r) /build M=S(PWD) clean


vim t1.c
vim st.c
make clean: make

tail -f /var /log /messages

insmod

insmod hw.ko


makefile insmod xxx.ko

rmmod xxx

中場休息

聽說下面是簡易版
這邊老師講太快了
來不及拍  改用錄影  
但剛好我的相機又沒電了  冏rz



linux cross reference

v2.6.18   尋找 skbuff

找到 filename search:skbuff
include/linux /skbuff.h/net /core/skbuff.c

ip.h
include/linux/ip.h

99 100行  手抖了一下 糊了 sorry


2011-10-25

讓我幫你google 你想要的那樣東西


先到 http://lmgtfy.com/
再輸入欄位輸入您想要的google 的東西
如:賈伯斯
將下方的連結給對方
他就會幫對方google 了
http://lmgtfy.com/?q=%E8%B3%88%E4%BC%AF%E6%96%AF




2011-10-24

[隨筆] 為什麼要學


alongalone:how old are you ?                                  
gmoz:I'm fine, thank you. and you?

這兩句 真的有蝦到

如果不想成為這種烏龍對話 
就要多學一點  恩恩

2011-10-20

[嵌入式] 往右抹去


/*
 *  Copyright (C) 2008 by National Chip Implementation Center
 *  Author: ycchang <yaochung@cic.org.tw>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "EX_LCD_V.h"
#include "image.h"
#include "image1.h"

#define DELAY_TIME 100000

unsigned int base = 0x10000000;
int LCDHSize  = 320, LCDVSize = 240, PixelSize = 3;
char *image;

void clean_screen();
void delay(unsigned int);
void move_right();
void move_rightdown();

int main()
{
    int i,j,k;
    int flag = 0;

    //uart_init ();

    /* turn on lcd */
    lcdc_init ();

    memset ((char *) base, 0xff, LCDHSize*LCDVSize*PixelSize);
    // clean screen
    clean_screen();

    // show images
    LCDC_FRAMEBASE = base;
    while (1) {
     flag ^= 1;
     image = (flag) ? imagebits : imagebits1;

for (i=0; i<LCDHSize; i++)
          for (j=0; j<LCDVSize; j++) {
             for (k=0; k<PixelSize; k++)
                 (*((char *)(base + j * LCDHSize * PixelSize + i * PixelSize + k))) =
                 image[j * LCDHSize * PixelSize + i * PixelSize + k];
        }
     // show onto LCD
LCDC_FRAMEBASE = base;
        delay(DELAY_TIME);
     }
exit (0);
//while (1);
}

// clean screen
void clean_screen()
{
    int i,j,k;
  
for (i=0; i<LCDVSize; i++)
        for (j=0; j<LCDHSize; j++) {
            for (k=0; k<PixelSize; k++)
                (*((char *)(base + i * LCDHSize * PixelSize + j * PixelSize + k))) = 0x00;
        }
    // show onto LCD
LCDC_FRAMEBASE = base;
}

// delay time
void delay(unsigned int count)
{
    for(;count>0;count--)
        ;
}

2011-10-17

[android] 切換視窗

最近很多人都在問 android 切換視窗 or 換頁的問題
第一個辦法就是
setContentView(R.layout.t2);

t2  是另一個xml的名稱

第二個辦法就是
用 Intent intent = new Intent();

intent.setClass(t1.this, t3.class);
startActivity(intent);
t1.this.finish();

ps: t1是我原本的java名稱  t3是換到那頁的名稱


我覺得使用 intent 大多數的人都忘記在 manifest 加上active
所以請在 manifest加上下面這一行   我習慣加在 之上



這樣才有辦法執行

package t1.c;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class t1 extends Activity implements OnClickListener {
private Button Button01,Button02;
    /** Called when the activity is first created. */
    @Override
    
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.t1);
        Button01 = (Button) findViewById(R.id.Button01);
        Button02 = (Button) findViewById(R.id.Button02);
        Button01.setOnClickListener(this);
        Button02.setOnClickListener(this);
    }
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (v == Button01)
dot2();
if (v == Button02)
showt3();
}
private void showt3() {
// TODO Auto-generated method stub
setContentView(R.layout.t2);
}
//請在 manifest加上下面這一行   我習慣加在 </application> 之上
//<activity android:name="t3"></activity>
 // </application>
//這樣才有辦法執行
private void dot2() {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(t1.this, t3.class);
startActivity(intent);
t1.this.finish();
}
}