这是一个不是问题的问题。因为我的测试机不能设置固定IP,每次长时间不开电,下次DHCP获得的IP就和上次不一样,此时又不能连上显示器去看,如何能让linux启动后自动告诉我们它的IP信息呢?想到几个方法:一是通过共享文件的方式,传递信息;二是通过邮件发送信息;三就是自己开发一个守护进程,通过客户端请求获取当前IP信息。前两个方式应该比较简单,试了试没有问题,第三种方式应该也不难,但是APUE的知识 […]
分类: ECW
to record the skills, experience and some other interesting things about the Computer World
转载:ubuntu上利用exim4配置qq.smtp.com发邮件
原文(http://www.junerik.com/?p=237),博主写的已经比较详细了,此处只是用自己的信息配置一次,略有修改。 一、安装exim4 sudo apt-get install exim4 二、配置exim4 ---update-exim4.conf.conf
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
dc_eximconfig_configtype='smarthost' #此处修改为smarthost dc_other_hostnames='mowblog' dc_local_interfaces='127.0.0.1 ; ::1' dc_readhost='' dc_relay_domains='' dc_minimaldns='false' dc_relay_nets='' dc_smarthost='smtp.qq.com' #qq提供的smtp服务器地址 CFILEMODE='644' dc_use_split_config='false' dc_hide_mailname='false' dc_mailname_in_oh='true' dc_localdelivery='mail_spool' |
---passwd.client 2403055113 […]
win8.1 IE 无法用127.0.0.1访问本地web服务
这也是一个很奇葩的问题! 安装在本地的tomcat服务器,IE11里面只有用localhost可以访问,其余127.0.0.1和IPv4的地址都不行。查看tomcat绑定的端口,默认0.0.0.0和::1都是有的,但是通过localhost访问,查看建立的链接都是IPv6地址的,这就奇怪了,为什么明文指定的v4地址IE都不认呢?搞怪。后来google了一下,解决思路有三: 1.取消IE浏览器安全标 […]
一个关于动态库中静态调用MKL崩溃的问题
这两天遇到一个奇怪的问题,测试客户的使用场景,需要用intel的MKL库重新封装一个DLL文件,然后主叫程序中不断的对此DLL进行load/call/free循环,结果每运行到第542次的时候主叫程序就自动退出了,没有任何返回,google搜索相关的问题也没有发现可用信息,最后在intel的论坛上,发现有MKL这个项目,然后附上自己的测试代码,描述清楚问题,看看有没有人回复。我是下班前17点多发布 […]
php curl
看了一晚上的php基础,然后通过google的帮助用php curl成功调用了EMS的 Web Service接口,保存几个基本的function,或许以后还能用到:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# 截取字符串中两个指定标记之间的内容,如果截取的内容还有空格,可以使用ltrim()和rtrim()分别提出左右空格 function str_between($src, $mark1, $mark2) { $index1=strpos($src, $mark1); $index2=strpos($src, $mark2); if(!$index1 || !$index2) return "error"; else{ $index1 += strlen($mark1); return substr($src, $index1, $index2-$index1); } } # post数据,header根据自己的要post的网站要求填写,cookie设置也有好处;注释掉的内容是为了测试 function php_curl_post($url, $postdata) { $c_post=curl_init(); $header = array('Content-Type: text/plain; charset=UTF-8'); curl_setopt($c_post, CURLOPT_URL, $url); curl_setopt($c_post, CURLOPT_RETURNTRANSFER,true); curl_setopt($c_post, CURLOPT_POST,true); curl_setopt($c_post, CURLOPT_HTTPHEADER, $header); curl_setopt($c_post, CURLOPT_POSTFIELDS, $postdata); #curl_setopt($c_post, CURLOPT_BINARYTRANSFER, true); //set cookie curl_setopt($c_post, CURLOPT_COOKIEJAR, 'c:\www\cookie.txt'); curl_setopt($c_post, CURLOPT_COOKIEFILE, 'c:\www\cookie.txt'); // /* $std_out=fopen('c:\www\stdout.txt','a+'); $std_err=fopen('c:\www\stderr.txt','a+'); curl_setopt($c_post, CURLOPT_FILE, $std_out); curl_setopt($c_post, CURLOPT_STDERR, $std_err); curl_setopt($c_post, CURLOPT_VERBOSE,true); */ $result = curl_exec($c_post); curl_close($c_post); /* fclose($std_out); fclose($std_err); */ return $result; } # PUT数据,因为EMS特殊原因,将header和body分开保存到array中,便于提取header和body里面各自所需的内容 function php_curl_put($url, $putdata) { $c_put=curl_init(); $header = array('Content-Type: text/plain; charset=UTF-8'); curl_setopt($c_put, CURLOPT_URL, $url); curl_setopt($c_put, CURLOPT_RETURNTRANSFER,true); curl_setopt($c_put, CURLOPT_HTTPHEADER, $header); curl_setopt($c_put, CURLOPT_POSTFIELDS, $putdata); curl_setopt($c_put, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($c_put, CURLOPT_HEADER, true); //curl_setopt($c_put, CURLINFO_HEADER_OUT, true); //curl_setopt($c_put, CURLOPT_FOLLOWLOCATION, true); //set cookie curl_setopt($c_put, CURLOPT_COOKIEJAR, 'c:\www\cookie.txt'); curl_setopt($c_put, CURLOPT_COOKIEFILE, 'c:\www\cookie.txt'); // /* $std_out=fopen('c:\www\stdout.txt','a+'); $std_err=fopen('c:\www\stderr.txt','a+'); curl_setopt($c_put, CURLOPT_FILE, $std_out); curl_setopt($c_put, CURLOPT_STDERR, $std_err); curl_setopt($c_put, CURLOPT_VERBOSE,true); */ $result = curl_exec($c_put); $headerSize = curl_getinfo($c_put, CURLINFO_HEADER_SIZE); $header = substr($result, 0 , $headerSize); $body = substr($result, $headerSize); $ret = array('header'=>$header,'body'=>$body); curl_close($c_put); /* fclose($std_out); fclose($std_err); */ return $ret; } # GET数据,没有特殊的地方 function php_curl_get($url) { $c_get=curl_init(); $header = array('Content-Type: text/plain; charset=UTF-8'); curl_setopt($c_get, CURLOPT_URL, $url); #curl_setopt($c_get, CURLOPT_BINARYTRANSFER, true); curl_setopt($c_get, CURLOPT_RETURNTRANSFER,1); curl_setopt($c_get, CURLOPT_HTTPGET,true); //set cookie curl_setopt($c_get, CURLOPT_COOKIEJAR, 'c:\www\cookie.txt'); curl_setopt($c_get, CURLOPT_COOKIEFILE, 'c:\www\cookie.txt'); $result = curl_exec($c_get); curl_close($c_get); return $result; } |
这里没有delete的函数,根据资料,只需改动CURLOPT_CUSTOMREQUEST为"DELETE"一个地方就可以实现delete的功能,所以也没有再写下去 c […]
cpulimit
今天测试Pi下面CPU占用率不等的情况下P产品的运行耗时时,发现一款好用的软件--cpulimit,地址: https://github.com/opsengine/cpulimit 。通过它可以给运行程序指定一CPU利用率,很有用。虽然模拟的方式有些弱(测试P产品的运行耗时突变很大,不平滑),但是换一种方式操作,比如通过运行其他的程序占用指定的70%CPU资源(RaspBerryPi 2 Mod […]
RaspBerryPi 3代
2016.2 Raspberry Pi发布了最新的3代产品,升级了CPU并增加了无线和蓝牙功能,但是价格并没有提高多少(淘宝价250多),是越来越强大了: A 1.2GHz 64-bit quad-core ARMv8 CPU 802.11n Wireless LAN Bluetooth 4.1 Bluetooth Low Energy (BLE) 鉴于树莓派如此流行,WD专门为树莓派推出了一款名 […]
OpenStack安装2
水很深 前几天测试了一下devstack的安装,一切按照默认最简的方式进行,虽然最后也成功启动了,但是关键的Network一项竟然没有包含,这次重新来过,改用Ubuntu 14.04 Minimal CD安装系统,为了兼容公司和家里两个不同的网络环境,改用VirtualBox的Net Network模式来分配IP地址,如下配置VirtualBox的Net Network设置: 将Network C […]