igame2000

igame2000 查看完整档案

深圳编辑  |  填写毕业院校  |  填写所在公司/组织 github.com 编辑
编辑

A babysitter.

个人动态

igame2000 发布了文章 · 2月17日

步进电机速度的实时控制

因SEGMENTFAULT对嵌入链接的处理错误,导致文章无法阅读,且未找到删除文章的方法,故此清除内容。

查看原文

赞 0 收藏 0 评论 0

igame2000 发布了文章 · 2月12日

LX COG 12864R1 LCD Sample Code

Introduction

Sample code for driving LX COG 12864R1 LCD.

NOTE

For arudino only.But it's very easy to apply on STM.
To run the code, you'd better to have a Arduino Mega 2560 which can print the log.

Code

// The .ino file.
// Define PINs
#define CS  2
#define RST 3
#define DC  4
#define SCL 21
#define SDA 20

#define setPin(pin, x) digitalWrite(pin, (x) ? HIGH : LOW)
#define cs(x) setPin(CS, (x))
#define reset(x) setPin(RST, (x))
#define dc(x) setPin(DC, (x))
#define scl(x) setPin(SCL, (x))
#define sda(x) setPin(SDA, (x))

void log(const char* str) {
  Serial.println(str);
}

void spi_delay(uint16_t x) {
  while(x > 0) {
    x--;
  }
}

void spi_send(uint8_t val) {
  for(int i = 0; i < 8; i++) {
    if (val & 0x80) {
      sda(1);
    } else {
      sda(0);
    }
    spi_delay(1);
    
    scl(1);
    scl(0);
    val <<= 1;
  }
}

void lcd_cmd(uint8_t val) {
  cs(0);
  dc(0);
  spi_send(val);
  cs(1);
  dc(1);
}

void lcd_data(uint8_t val) {
  cs(0);
  dc(1);
  spi_send(val);
  cs(1);
  dc(1);
}

void lcd_init() {
  log("Reset 1"); reset(1); delay(1000);
  log("Reset 2"); reset(0); delay(1000);
  log("Reset 3"); reset(1); delay(1000);

  log("Reset internal");
  lcd_cmd(0xe2); // Internal reset
  lcd_cmd(0xe3);  // reset signal
  // delay(3000);

  log("Display off"); lcd_cmd(0xae); // display off
  // delay(3000);

  log("ADC select");
  lcd_cmd(0xa0);  // ADC select
  lcd_cmd(0xc8);  // command output select
  lcd_cmd(0x2f);  // power control
  // delay(3000);

  // SET dir
  // log("Set direction");
  // log("Reversed"); lcd_cmd(0xa1); //0b10100001); // Reverse
  // log("Normal"); lcd_cmd(0xa0); // 0b10100000); // Normal
  // delay(3000);


  log("Inverse display");
  // Inverse display
  // log("Reversed"); lcd_cmd(0xa7); // 0b10100111); // Reverse
  // log("No"); lcd_cmd(0xa6); // 0b10100110); // Normal
  // delay(3000);

  log("All pixels on");
  // // All pixels on
  // lcd_cmd(0xa5); // 0b10100101); // All on
  // lcd_cmd(0xa4); // 0b10100100); // Normal
  // delay(3000);

  log("Set bias");
  // bias
  log("1/9 bias"); lcd_cmd(0xa2);  //(0xa2 1/9 bias,1/65 duty )
  // log("1/7 bias"); lcd_cmd(0xa3);  // 1/7
  // delay(3000);

  // log("Page blink");
  // // Page Blink Page
  // lcd_cmd(0xd5);
  // lcd_cmd(0x0); // Blink all page: 0xF 
  // delay(3000);
  
  // Ratio is a key parameter which haverily affects the invisibility.
  log("Select resistor ratio");
  // select resistor ratio Rb/Ra: 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27
  lcd_cmd(0x22);
  // delay(3000);

  log("Select volume");
  lcd_cmd(0x81);  // select volume
  // delay(3000);
  
  log("vop");
  lcd_cmd(0x29); // 0x15); //0x29);   // vop
  // delay(3000);
  
  lcd_cmd(0xf8);  // x4
  lcd_cmd(0x08);  // x4
  // delay(3000);

  log("Initial page");
  lcd_cmd(0xb0);//set page address
  lcd_cmd(0x10);//set column address
  lcd_cmd(0x00);

  for(int col=0; col < 128; col++) {
    lcd_data(0x00);
    // lcd_data(0b11110000);
  }
  // delay(3000);

  log("Display on"); lcd_cmd(0xaf);  //display on
  // delay(3000);
}

uint8_t img[] = {
  0xFF,0x01,0x01,0x01,0x01,0x01,0x09,0x09,0xFD,0xFD,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x1F,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x08,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x08,0x08,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x1F,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x10,0x1F,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x10,0x1F,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,0x08,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x08,0x08,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0xFC,
0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0xFC,0xFC,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x1F,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x10,0x1F,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x10,0x1F,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x1F,
0x1F,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x1F,0x1F,0x10,0x10,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x1F,0x1F,0x10,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x10,0x10,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x10,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0xF8,
0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0xF8,0xF8,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x10,0x10,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x10,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,
0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0xA0,0xA0,0xBF,0xBF,0xA0,0xA0,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0xA0,0xA0,0xBF,0xBF,0xA0,0xA0,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0xA0,0xA0,0xBF,0xBF,0xA0,0xA0,0x80,0x80,0x80,0x80,0x80,0x80,0xA0,0xA0,0xBF,
0xBF,0xA0,0xA0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xA0,0xA0,0xBF,0xBF,0xA0,0xA0,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xA0,0xA0,0xBF,0xBF,0xA0,0xA0,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0xA0,0xA0,0xBF,0xBF,0xA0,0xA0,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0xA0,0xA0,0xBF,0xBF,0xA0,0xA0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xA0,0xA0,
0xBF,0xBF,0xA0,0xA0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFF
};

void lcd_display() {
  uint8_t* ptr = img;

  for(int row = 0xb0; row < 0xb8; row++) {
    lcd_cmd(row);
    lcd_cmd(0x10);
    lcd_cmd(0x00);
    for(int col = 0; col < 128; col++) {
      lcd_data(*ptr++);
    }
  }

  delay(2000);
}

void lcd_clean(uint8_t color = 0x00) {
  for(int row = 0xb0; row < 0xb8; row++) {
    lcd_cmd(row);
    lcd_cmd(0x10);
    lcd_cmd(0x00);

    for(int col = 0; col < 128; col++) {
      // lcd_data(0x81);
      // lcd_data(0x81);
      lcd_data(color);
    }
  }

  // delay(1000);
}

void setup() {
  // put your setup code here, to run once:
  pinMode(CS, OUTPUT);
  pinMode(RST, OUTPUT);
  pinMode(DC, OUTPUT);
  pinMode(SCL, OUTPUT);
  pinMode(SDA, OUTPUT);

  pinMode(LED_BUILTIN, OUTPUT);

  Serial.begin(9600);
}

void loop() {

  // put your main code here, to run repeatedly:
  lcd_init();

  uint8_t color = 0x00;

  while(1) {
    // delay(1500);
    digitalWrite(LED_BUILTIN, HIGH);
    log("Clean"); lcd_clean(color++);
    // if (color == 0xFE) color = 0x00;
    log("Display"); lcd_display();
    // reset(0);
    delay(100);
    // lcd_display();
    digitalWrite(LED_BUILTIN, LOW);
    // reset(1);
    delay(100);
  }
}

Good Luck!

查看原文

赞 0 收藏 0 评论 0

igame2000 发布了文章 · 2月12日

Need For Speed: Nodejs Module In C++

Introduction

The reason can't be more simple: the need for speed.

According to a simple test between node-uuid and C++ uuid, the truth was told: C++ is faster.

The time consumptions of 1M generations of uuid is almost 3s(node-uuid) vs. 0.3s(C++ modules based on boost uuid).

So, the advices is: crucial module should be written in C++, if you have time for this.

node-uuid Module in C++

node-uuid.h

#ifndef NODE_UUID_H
#define NODE_UUID_H

using namespace v8;

#define NODE_UUID_CLS_NAME "nodeUuid"

namespace igame
{
  namespace uuid {
    void initialize(Handle<Object> exports);
  }
} // ns

#endif

node-uuid.cpp

#include "node_uuid.hpp"

// #include <boost/lexical_cast.hpp>

namespace igame
{
  namespace uuid {
    Persistent<Function> constructor;
    buid::random_generator uuid_generator;
    uint32_t uuid_count;

    Handle<Value> generate_uuid(const Arguments& args);
    Handle<Value> get_count(Local<String> property, const AccessorInfo& info);

    void initialize(Handle<Object> exports)
    {
      exports->Set(String::NewSymbol("next"), FunctionTemplate::New(generate_uuid)->GetFunction());
      exports->SetAccessor(String::NewSymbol("count"), get_count, NULL);
    }

    Handle<Value> generate_uuid(const Arguments& args)
    {
      HandleScope scope;

      buid::uuid uid = uuid_generator();
      uuid_count++;

      return scope.Close(String::New(buid::to_string(uid).c_str()));
    }

    Handle<Value> get_count(Local<String> property, const AccessorInfo& info)
    {
      HandleScope scope;

      return scope.Close(Integer::New(uuid_count));
    }
  } // ns
} // ns

Test

test.js

var uuid = require('./build/Release/node-uuid');

console.log('uuid:', uuid.next());
console.log('uuid.count + ' uuid(s) has/have been generated.');

Good luck!

查看原文

赞 1 收藏 0 评论 0

igame2000 发布了文章 · 2月12日

Promise In Node.js C++ Addon

Normally, when writing an Add-on, we could code like this:

// Somewhere
void doSomething(std::string& str) {
    str = "Hello, world";
}

/// The implementation of add-on
static void fork(const FunctionCallbackInfo<Value>& args) {
    Isolate* iso = args.GetIsolate();
    /// Do something
    doSomething(str);
    /// Callback
    Local<Value> val = args[3]; // Assuming the forth arguments is the callback function.
    if (val->IsFunction()) {
        Local<Function> func = Function::Cast(val);
        func->Call(iso->GetCurrentContext()->Global(), Integer::New(iso, 0x1234));
    }
} // end of fork

The above code works fine unless Promise involved. The notorious segment fault drives me mad. The reason is that the Promise.resolve will probably be called back from a different thread. Finally I found a way out:

/// Turn our processing into async
// Define the prototype of callback.
using callback = boost::function<void(int, const std::string&)>;
typedef struct {
    std::string value;
    callback cb;
} async_struc;

AsyncWorker<async_struc> async_worker;

void doSomething(std::string& arg, const callback& cb {
    async_struc* data = new async_struc();
    
    data.value = arg;
    data.cb = cb;
    
    async_worker.post(data, [&](async_struc* x) {
        // Do the work.
        x->value += "Hello, world!";
    }, [&](async_struc* x, bool canceled) {
        x->cb(canceled ? -1 : 0, x->value);
    });
}

When crossing thread boundary, JavaScript object should be wrapped with Persistent. Howover, V8 forbids us using explicit ctor of Persistent. An alternative is to use a structure to hold the Persistent wrapped object and pass a structure pointer to make lambda expression capture it.
The structure looks like :

typedef struct {
    std::string value; //<! The value came from arguments.
    Persistent<Function> cb;
} js_callback_info_t;

Also, according to V8 reference, we should get current Isolate object under different threads. A HandleScope is needed too.

Isolate* asyncIso = Isolate::GetCurrent();
HandleScope scope(asyncIso);

Now rewrite the js add-on method:

static void fork(const FunctionCallbackInfo<Value>& args) {
    Isolate* iso = args.GetIsolate();
    // Get string argument
    String::Utf8Value utf8str(args[0]);
    std::string str(*utf8str);

    /// Save the callback information
    Local<Value> val = args[3]; // Assuming the forth arguments is the callback function.
    js_callback_info_t* cb_info = new js_callback_info();
    
    cb_info->value = str;
    cb_info->cb.Reset(iso, Local<Function>::Cast(val);
    
    doSomething(str, [&, cb_info](int err, const std::string& res) mutable {
        Isolate* asyncIso = Isolate::GetCurrent();
        HandleScope scope(asyncIso);
        Local<Function> func = Local<Function>::New(asyncIso, cb_info->cb);
        Local<Value> params[] = { Integer::New(asyncIso, err), String::NewUtf8(asyncIso, res.c_str()) };
        func->Call(asyncIso->GetCurrentContext()->Global(), 2, params);
        // Dispose persistent object
        func->cb.Reset();
        // Release the memory allocated before
        delete cb_info;
    });
} // end of fork

Now the Add-on is Promise-ready.

Good luck!

查看原文

赞 0 收藏 0 评论 0

igame2000 发布了文章 · 2月12日

C++ Style IO Access For STM32

Introduction

For STM, the common ways to manipulate low hardware are HAL and memory/register access. For third-party hardwares, there are no HAL support and we have to do memory/register access. For example, for ili9341 TFT LCD, the driving code looks like the following:

// Define the memory model for IO/Register access.
typedef struct {
    __IO uint16_t reg;
    __IO uint16_t mem;
} LCD_TypeDef;

#define LCD_BASE ((uint32_t)(0x6C000000 | 0x000007FE))
#define LCD    ((LCD_TypeDef *)LCD_BASE)

// Write commands by assignment.
// NOTE: If people know some about FPGA will
// figure out that they are much similar.
INLINE void lcd_cmd(uint16_t cmd) {
    LCD->reg = cmd;
}

// Write data by assignment.
INLINE void lcd_data(uint16_t dat) {
    LCD->mem = dat;
}

INLINE void lcd_cmd_data(uint16_t cmd, uint16_t data) {
    LCD->reg = cmd;
    LCD->mem = data;
}

Personally, I prefer to C++. So the C++ style code will be:


#include <stm32f1xx.h>

namespace igame {

    template<typename T, const uint32_t ADDR>
    struct IOMemory {
            typedef IOMemory<T, ADDR> type;
            typedef T val_t;
            typedef const T const_val_t;
            __IO T* __mem = reinterpret_cast<val_t *>(ADDR);
    };
    
    // Input
    template<typename T, const uint32_t ADDR>
    void operator << (IOMemory<T, ADDR>& left, const uint16_t& right) {
        *left.__mem = right;
    }
    
    // Output
    template<typename T, const uint32_t ADDR>
    void operator << (const IOMemory<T, ADDR>& left, const int& right) {
        left << (const uint16_t&)right;
    }

    template<typename T, const uint32_t ADDR>
    void operator >> (const IOMemory<T, ADDR>& left, T& right) {
        right = *left.__mem;
    }
} // ns

The working code should be:


namespace igame {
    class TFT9341 {
    ...
    
    private:
        static const uint32_t LCD_BASE_ADDR = ((uint32_t) (0x6C000000 | 0x000007FE));
        const IOMemory<uint16_t, LCD_BASE_ADDR> m_reg;
        const IOMemory<uint16_t, LCD_BASE_ADDR + sizeof(uint16_t)> m_mem; 
            
    ...
    
    public:
        ...
        
        uint16_t getId() {
            uint16_t res = 0;
            m_reg >> res;

            if (res < 0xFF || res == 0xFFFF || res == 0x9300) {
                m_reg << 0xD3; // Write cmd.
                m_mem >> res; // Output: 0x00
                m_mem >> res; // Output: 0x00
                m_mem >> res; // Output: 0x93

                uint16_t temp = res << 8;

                m_mem >> res; // Output: 0x41
                res |= temp;
            }

            return res;
        } // fn getId()
        
        void setPos(uint16_t x, uint16_t y) {
            m_reg << 0x2A;
            m_mem << (x >> 8);
            m_mem << (x & 0xFF);
            m_reg << 0x2B;
            m_mem << (y >> 8);
            m_mem << (y & 0xFF);
        } // fn setPos
        
        ...
    }; // class
} // ns

Good luck.

查看原文

赞 0 收藏 0 评论 0

igame2000 关注了标签 · 2月12日

程序员

一种近几十年来出现的新物种,是工业革命的产物。英文(Programmer Monkey)是一种非常特殊的、可以从事程序开发、维护的动物。一般分为程序设计猿和程序编码猿,但两者的界限并不非常清楚,都可以进行开发、维护工作,特别是在中国,而且最重要的一点,二者都是一种非常悲剧的存在。

国外的程序员节

国外的程序员节,(英语:Programmer Day,俄语:День программи́ста)是一个俄罗斯官方节日,日期是每年的第 256(0x100) 天,也就是平年的 9 月 13 日和闰年的 9 月 12 日,选择 256 是因为它是 2 的 8 次方,比 365 少的 2 的最大幂。

1024程序员节,中国程序员节

1024是2的十次方,二进制计数的基本计量单位之一。程序员(英文Programmer)是从事程序开发、维护的专业人员。程序员就像是一个个1024,以最低调、踏实、核心的功能模块搭建起这个科技世界。1GB=1024M,而1GB与1级谐音,也有一级棒的意思。

从2012年,SegmentFault 创办开始我们就从网络上引导社区的开发者,发展成中国程序员的节日 :) 计划以后每年10月24日定义为程序员节。以一个节日的形式,向通过Coding 改变世界,也以实际行动在浮躁的世界里,固执地坚持自己对于知识、技术和创新追求的程序员们表示致敬。并于之后的最为临近的周末为程序员们举行了一个盛大的狂欢派对。

2015的10月24日,我们SegmentFault 也在5个城市同时举办黑客马拉松这个特殊的形式,聚集开发者开一个编程大爬梯。

特别推荐:

【SF 黑客马拉松】:http://segmentfault.com/hacka...
【1024程序员闯关秀】小游戏,欢迎来挑战 http://segmentfault.com/game/

  • SF 开发者交流群:206236214
  • 黑客马拉松交流群:280915731
  • 开源硬件交流群:372308136
  • Android 开发者交流群:207895295
  • iOS 开发者交流群:372279630
  • 前端开发者群:174851511

欢迎开发者加入~

交流群信息


程序员相关问题集锦:

  1. 《程序员如何选择自己的第二语言》
  2. 《如何成为一名专业的程序员?》
  3. 《如何用各种编程语言书写hello world》
  4. 《程序员们最常说的谎话是什么?》
  5. 《怎么加入一个开源项目?》
  6. 《是要精于单挑,还是要善于合作?》
  7. 《来秀一下你屎一般的代码...》
  8. 《如何区分 IT 青年的“普通/文艺/二逼”属性?》
  9. 程序员必读书籍有哪些?
  10. 你经常访问的技术社区或者技术博客(IT类)有哪些?
  11. 如何一行代码弄崩你的程序?我先来一发
  12. 编程基础指的是什么?
  13. 后端零起步:学哪一种比较好?
  14. 大家都用什么键盘写代码的?

爱因斯坦

程序猿崛起

关注 154961

igame2000 关注了标签 · 2月12日

javascript

JavaScript 是一门弱类型的动态脚本语言,支持多种编程范式,包括面向对象和函数式编程,被广泛用于 Web 开发。

一般来说,完整的JavaScript包括以下几个部分:

  • ECMAScript,描述了该语言的语法和基本对象
  • 文档对象模型(DOM),描述处理网页内容的方法和接口
  • 浏览器对象模型(BOM),描述与浏览器进行交互的方法和接口

它的基本特点如下:

  • 是一种解释性脚本语言(代码不进行预编译)。
  • 主要用来向HTML页面添加交互行为。
  • 可以直接嵌入HTML页面,但写成单独的js文件有利于结构和行为的分离。

JavaScript常用来完成以下任务:

  • 嵌入动态文本于HTML页面
  • 对浏览器事件作出响应
  • 读写HTML元素
  • 在数据被提交到服务器之前验证数据
  • 检测访客的浏览器信息

《 Javascript 优点在整个语言中占多大比例?

关注 176418

igame2000 关注了标签 · 2月12日

typescript

TypeScript 是微软开发的 JavaScript 的超集,TypeScript兼容JavaScript,可以载入JavaScript代码然后运行。TypeScript与JavaScript相比进步的地方。包括:加入注释,让编译器理解所支持的对象和函数,编译器会移除注释,不会增加开销;增加一个完整的类结构,使之更新是传统的面向对象语言。

关注 35275

igame2000 关注了标签 · 2月12日

linux

Linux是一种自由和开放源代码的类Unix计算机操作系统。目前存在着许多不同的Linux,但它们全都使用了Linux内核。Linux可安装在各种各样的计算机硬件设备,从手机、平板电脑、路由器和视频游戏控制台,到台式计算机,大型机和超级计算机。

Linux家族家谱图,很全很强大!! 图中可以清楚的看出各个Linux发行版的血缘关系。无水印原图:http://url.cn/5ONhQb

关注 79718

igame2000 关注了标签 · 2月12日

react.js

React (sometimes styled React.js or ReactJS) is an open-source JavaScript library for creating user interfaces that aims to address challenges encountered in developing single-page applications. It is maintained by Facebook, Instagram and a community of individual developers and corporations.

关注 69531

认证与成就

  • 获得 1 次点赞
  • 获得 2 枚徽章 获得 0 枚金徽章, 获得 0 枚银徽章, 获得 2 枚铜徽章

擅长技能
编辑

开源项目 & 著作
编辑

(゚∀゚ )
暂时没有

注册于 2019-10-10
个人主页被 933 人浏览