[linux]useradd与adduser的区别

2016-10-25 写技术

1. 在root权限下,useradd只是创建了一个用户名,如 (useradd  +用户名 ),它并没有在/home目录下创建同名文件夹,也没有创建密码,因此利用这个用户登录系统,是登录不了的,为了避免这样的情况出现,可以用 (useradd -m +用户名)的方式创建,它会在/home目录下创建同名文件夹,然后利用( passwd + 用户名)为指定的用户名设置密码。 2. 可以直接利用adduser创建新用户(adduser +用户名)这样在/home目录下会自动创建同名文件夹 3.  删除用户,只需使用一个简单的命令“userdel 用户名”即可。不过最好将它留...

阅读全文>>

标签: linux

评论(0) 浏览(1876)

[c]mosquitto编码实现websockets协议

2016-10-20 写技术

mosquitto虽然本身是支持websockets协议的,但却依懒libwebsockets库,而libwebsockets库是基于poll的,所以如果想把mosquitto改为epoll模式很容易,却不能兼容websockets了。 为了解决这个纠结的问题,这几天把websockets协议用C语言重新实现了一遍,然后将mosquitto中调用libwebsockets的部分用自己的代码取代,今天终于实现了websockets下的mqtt通讯功能。 首先一些websockets的结构放在websockets.h中: typedef struct _WebSo...

阅读全文>>

标签: C linux

评论(0) 浏览(2522)

[c]uthash

2016-10-14 写技术

An example about uthash #include "uthash.h" #include <stdlib.h> /* malloc */ #include <stdio.h> /* printf */ typedef struct _user_t { int id; char name[25]; UT_hash_handle hh; } USER_T,*PUSER_T; void main() { int i; PUSER_T user, users=NULL; ...

阅读全文>>

标签: C

评论(0) 浏览(2067)

[c]strtok_r,strtok_s, _strtok_s_l, wcstok_s, _wcstok_s_l, _mbstok_s, _mbstok_s_l

2016-10-11 写技术

On the first call to strtok_s the function skips leading delimiters and returns a pointer to the first token in strToken, terminating the token with a null character. More tokens can be broken out of the remainder of strToken by a series of calls to strtok_s. Each call to strtok_s modifies strToken ...

阅读全文>>

标签: C

评论(0) 浏览(2580)

[ubuntu]Debug a running process by gdb

2016-10-9 写技术

1.Find the pid; ps aux|grep xxxxx 2.Bind; gdb (gdb) attach 111111 3.Show stack (gdb) bt 4.Go next (gdb)next 5. (gdb) detach 6.Exit (gdb)q

阅读全文>>

标签: ubuntu

评论(0) 浏览(2540)

[ubuntu]Install and set subversion server

2016-10-8 写技术

1.Install sudo apt-get install subversion 2.Create root fold of svn mkdir /var/svn 3.Create project svnadmin create /var/svn/project 4.Edit config /var/svn/project/svnserve.conf [general]  anon-access = none auth-access = write password-db = /var/svn/conf/passwd authz-db = /...

阅读全文>>

标签: ubuntu

评论(0) 浏览(2290)

[JS]javascript solution for md5

2016-8-31 写技术

(function($){ var rotateLeft = function(lValue, iShiftBits) { return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)); } var addUnsigned = function(lX, lY) { var lX4, lY4, lX8, lY8, lResult; lX8 = (lX & 0x80000000); lY8 = (lY & 0x80000000); lX4 = (l...

阅读全文>>

标签: JS

评论(1) 浏览(2009)

[ubuntu]Set static ip address for ubuntu

2016-8-15 写技术

1.Edit file /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.52 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 222.246.129.80 114.114.114.114 2.Reboot the system.

阅读全文>>

标签: ubuntu

评论(0) 浏览(2217)

[linux]cmake:Could NOT find ZLIB

2016-8-10 写技术

$cmake .. -- CMAKE_TOOLCHAIN_FILE='' fatal: Not a git repository (or any of the parent directories): .git Git commit hash: nicholas@ubuntu- CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):   Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found ver...

阅读全文>>

标签: linux

评论(0) 浏览(7034)

[embedded]An application of qtopia in mini2440

2016-7-28 写技术

main.cpp #include <qapplication.h> #include <qlabel.h> int main(int argc, char *argv[]){ QApplication app(argc, argv); QLabel *label = new QLabel("Hehe", 0); label->show(); return app.exec(); } hello.pro CONFIG += qtopiaapp CONF...

阅读全文>>

标签: embedded

评论(0) 浏览(1864)

Powered by anycle 湘ICP备15001973号-1