laravel 分页的一个 bug

先定基调,laravel 是一个好框架 然后,他提供了一个自动分页的,叫 Page,可以自动分页,同时在分页的 RESTful 响应报文中给出上一页下一页的 url,这很好,但是,这个实现是通过 url 的 parma 来达成的,也就是如果你的路径本来是 http://xxx.com/path/to/a/page… /path/to/a/page?page=1,但是,如果你的路径……

阅读全文

36 进制

看到同事桌上有一份面试题,有一个 36 进制运算的题目,手贱敲了一下,不调真的不好做啊 #include <stdio.h> #include <string> #include <algorithm> #include <math.h> int convert_36_10(std::string strNum) { std::reverse(strNum.begin(), strNum.end()); int n = 0; for ……

阅读全文

visual studio 配合 boost

visual studio 是写 c++ 最好的 IDE 这是宇宙真理没有什么好讨论了,加上 VAssistX 更是如虎添翼。哪怕是 linux 开发我都要搭一个 windows->linux 的文件自动实时同步环境,然后在 windows 上编码,上 linux 去 make。 但是,问题来了,如何让 visual studio 搭配 boost 呢。 找了一下资料,例如,http://blog.csdn.net/……

阅读全文

再谈对非阻塞的理解

一般来说,现在大家 epoll 都是搭配着非阻塞 IO 一起用的,要问为什么?大家都这么用的啊,而且异步嘛,非阻塞嘛,很自然嘛 但是,非阻塞 IO 具体是怎么对 send 和 recv 起作用的。一般理解,我们之所以要用非阻塞,是为了避免这种情况: 客户端跟我们 tcp 三次握手完了,我们 listen fd 上得到一个 IN 事件了,然后 ac……

阅读全文

getdatetimestr

下午写了这么一个函数 char* getdatetimestr() { static char datetimestr[32] = {0}; static time_t last_update_time = 0; struct timeval tv = {0}; gettimeofday(&tv, NULL); time_t nowtime = tv.tv_sec; if (nowtime != last_update_time) { last_update_time……

阅读全文