网上查了一下,说要删了重建,其实这个错误在提示中比较明显了,解决方法是在右键,连接属性,高级,设置位置,把路径名中的非法字符去掉就可以了,例如冒号改成下划线等等,那么,Windows 路径中的非法字符有哪些呢,看这里,https://msdn.microsoft.com/zh-…
The following reserved characters:
< (less than)…… 阅读全文
获取当前机器 IP
std::string GetLocalIP()
{
struct ifreq req;
int sock_fd;
char szLocalIP[16]= {0};
string strLocalIP="";
sock_fd = socket(AF_INET,SOCK_STREAM,0);
if(sock_fd < 0)
return strLocalIP;
snprint…… 阅读全文
清除旧日志脚本
bash 的语法真是反人类啊,反人类啊啊啊
#!/bin/bash
# created: 2015-10-10 13:24:15
size=204800
echo "loop delete oldest log file until directory size < "$size" KB"
while [ 1 ]; do
directory_size=$(du -s | cut -f1)
if [ "$size" -gt "$dire…… 阅读全文
unix domain socket dgram
大体上参考这里,http://philherlihy.com/unix-domain-sockets-datagram/
改动之后如下
服务端
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <…… 阅读全文
laravel 分页的一个 bug
先定基调,laravel 是一个好框架
然后,他提供了一个自动分页的,叫 Page,可以自动分页,同时在分页的 RESTful 响应报文中给出上一页下一页的 url,这很好,但是,这个实现是通过 url 的 parma 来达成的,也就是如果你的路径本来是 http://xxx.com/path/to/a/page… /path/to/a/page?page=1,但是,如果你的路径本…… 阅读全文
比较字符串形式的版本号
版本号是一个字符串,主要考虑以下三种用例,点分的个数一致还好,不一致需要注意
#include <boost/algorithm/string.hpp>
#include <algorithm>
#include <vector>
#include <string>
bool version_less_than(std::string str_version_a, std::string str_version_b)
{
std::vec…… 阅读全文
word 交叉引用同时显示标题编号和标题文字
找了一圈,没有看到 word 中有这个功能,本来想着这种问题百度应该有,百度了一圈也没有找到,最后还是 Google 到一个 2005 年的帖子,看这里,http://www.wordbanter.com/show…
Trying to insert a cross reference that includes both the heading number and
the heading text … like “3.2 Contrac…… 阅读全文
条件变量的用法和封装
对条件变量的用法的说明可以见这里,http://www.wuzesheng.com/?p=1668,写的不错,看一个裸写的无封装的用法如下:
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <queue&…… 阅读全文
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/…… 阅读全文