`
standalone
  • 浏览: 595877 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表
>>> hex_string = "deadbeef" Convert it to a string (Python ≤ 2.6): >>> hex_data = hex_string.decode("hex") >>> hex_data "\xde\xad\xbe\xef" or since Python 2.7 and Python 3.0: >>> bytearray.fromhex(hex_data) bytearray(b'\xde\xad\xbe\x ...

size of array

    博客分类:
  • c
#define num(x) (sizeof (x) / sizeof (*x)) int main(){ int number[10] = {1,1,1,1,1,1}; char *teststr[20] = {"","","","","","","","",""}; printf("Size of number[10] is %d\n", (int)nu ...

std::map

    博客分类:
  • c++
std::map<char,int> mymap; std::map<char, set<string> > mmap; mmap['a'].insert("hello"); mmap['a'].insert("hello1"); map<char, set<string> >::iterator iter = mmap.begin(); for(;iter!=mmap.end();++iter){ cout << iter-> ...
http://stackoverflow.com/questions/12671406/bash-removing-part-of-a-string var="Memory Used: 19.54M" var=${var#*: } # Remove everything up to a colon and space var=${var%M} # Remove the M at the end
The main hint is in the docs, if it says 'Steals a reference' than the function basically takes ownership, if it says 'New Reference' than it did an INCREF for you, if nothing is said it probably does an INCREF and DECREF pair as needed. http://stackoverflow.com/questions/10863669/lost-on-py-decref- ...
Use chr() and ord(): >>> chr(97) 'a' >>> ord('a') 97
ruby-doc.org/core-2.1.2/String.html

typedef struct in c

    博客分类:
  • c
typedef struct atom {   int element;   struct atom *next; }; vs. typedef struct {   int element;   struct atom *next; } atom; http://stackoverflow.com/questions/18806392/typedef-struct-declarations
#include <iostream> #include <tr1/functional> using std::tr1::bind; using std::tr1::function; using std::tr1::placeholders::_1; using std::tr1::placeholders::_2; class CTest { public: int test( int a, int b , int c, int d) { ...
http://stackoverflow.com/questions/21558/in-c-what-is-a-virtual-base-class 主要是为了避免歧义。

ssl 与 java 实例

    博客分类:
  • java
http://www.iteye.com/topic/1125183

C中的宏 [Macro in C]

    博客分类:
  • c
最近在学习c,话说从java转向c真的蛮痛苦。Anyway,学习就是一份好经历。 看到如下一段code: #define APP_TOOL_OP_TYPES(f) \ f(SIMPLE, "simple", FALSE) \ f(JSON, "json", TRUE) \ f(PYTHON, "python", TRUE) \ typedef ...

Java NIO

    博客分类:
  • java
看了这个java nio的教程,明白了什么是Selector.wakeUp() http://ifeve.com/selectors/ wakeUp() 某个线程调用select()方法后阻塞了,即使没有通道已经就绪,也有办法让其从select()方法返回。只要让其它线程在第一个线程调用select()方法的那个对象上调用Selector.wakeup()方法即可。阻塞在select()方法上的线程会立马返回。 如果有其它线程调用了wakeup()方法,但当前没有线程阻塞在select()方法上,下个调用select()方法的线程会立即“醒来(wake up)”。
The bug and fix is at https://issues.apache.org/jira/browse/HADOOP-10110
http://www.cab.u-szeged.hu/WWW/java/tutorial/i18n/exception/subclass.html
Global site tag (gtag.js) - Google Analytics