提问的智慧(How To Ask Questions The Smart Way)作者:Eric Steven Raymond在黑客的世界里,你所提技术问题的解答很大程度上取决于你提问的方式与解决此问题的难度,"提问的智慧"此文将教你如何提问才更有可能得到满意的答复。此文大受欢迎,转载于各大技术论坛的头版。英文版: http://www.catb.org/~esr/faqs/smart-questions.html 中文版: http://www.wapm.cn/smart-questions/smart-questions-zh.html ===MindMap===(so Read More
posted @ 2013-04-19 22:50 javawebsoa Views(341) Comments(0) Diggs(0)
php 版本 5.2.4现有一txt文件,格式如下:file.txt12345 要将其内容按行分割存入数据$array中执行代码:$fileContent = trim(file_get_contents('file.txt');$array = explode("\r\n", $fileContent); 并未达到预想的效果$array => array(0 => String(15) "12345")这就是问题!解决方法:$fileContent = trim(file_get_contents('file.txt Read More
posted @ 2013-04-19 22:45 javawebsoa Views(666) Comments(0) Diggs(0)
1,停止当前的mysqld服务2,再次开启服务,以不带权限验证的形式 3,利用客户端,连接mysql 我们的用户可以获得最高权限 root4,修改 mysql 数据库 中 user表的root用户相关的密码5,关闭这个不受验证的服务,重新开启服务 Read More
posted @ 2013-04-19 22:40 javawebsoa Views(121) Comments(0) Diggs(0)
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1573 求中国剩余定理解的个数 注意是非互质情况下的中国剩余定理 N===a1(mod r1) N===a2(mod r2) 以两个为例,则N=a1+r1*x=a2+r2*y,根据后两者就可以建立方程 r1*x-r2*y=a2-a1,扩展欧几里德可搞。 解出x之后 可知N=a1+r1*x,明显这是其中一组解,N+K*(r1*r2)/gcd都是解。 代码如下:#include <iostream>#include <cstdio>#include <cstdlib> Read More
posted @ 2013-04-19 22:35 javawebsoa Views(213) Comments(0) Diggs(0)
致歉由于视频出了点问题,所以暂时只有这点内容,后期再补上。笔记#记录和域#深入讨论awk#编辑#vi awkif.sh#改变权限[root@localhost 0418]# chmod 755 awkif.sh #分页查看文件more www.log#查看awkif.sh文件[root@localhost 0418]# cat awkif.sh #!/bin/bash#awkifecho "210-219网段的访问量:`awk `{if ($1"/^21[0-9]/) print $0}` www.log|wc -l`"echo "非210-219网段的 Read More
posted @ 2013-04-19 22:30 javawebsoa Views(256) Comments(0) Diggs(0)
/* 排座位要安排:3个A国人,3个B国人,3个C国人坐成一排。要求不能使连续的3个人是同一个国籍。求所有不同方案的总数? */public class T13 { static int sum = 0; // 不同方案总个数 // 检查是否有同一国人连续3个 public static boolean check(char[] c){ int count = 1; // 初始个数 for(int i=0;i<c.length-1;i++){ if(c[i]==c[i+1]){ count++; }else{ count = 1; // 初始个数 } if(co... Read More
posted @ 2013-04-19 22:24 javawebsoa Views(499) Comments(0) Diggs(0)
http://acm.hdu.edu.cn/showproblem.php?pid=2602#include<iostream>#include<string>#include<cstring>#include<algorithm>#include<cstdio>#include<cmath>#include<cctype>#include<iomanip>using namespace std;const int maxn=100000;int m[maxn];int v[maxn];int dp Read More
posted @ 2013-04-19 22:19 javawebsoa Views(178) Comments(0) Diggs(0)
this class is not key value coding-compliant for the key一般此问题 都是由interface build与代码中IBOutlet的连接所引起的。可能是在代码中对iboutlet的名称进行了修改,导致interface build中的连接实效。如果在该viewcontroller连接的xib文件中没发现错误,那就很可能是mainWindow.xib文件中存在问题,本人遇到的问题是在mainWindow.xib的tabbarcontroller的某个tab的viewcontroller设置了loadfrom"**.xib" Read More
posted @ 2013-04-19 22:14 javawebsoa Views(515) Comments(0) Diggs(0)
实验准备:我们使用VC++6.0进行实验,首先需要打开VC++6.0的RTTI选项(默认关闭)Project->settings->c/c++->category->c++language,将Enable Run-Time TypeInfomation(RTTI)选中 测试代码:#include <iostream>using namespace std;int main(){ int array[3] = {2, 4, 6}; typedef int (*ARRAY)[3]; int *p = array; ARRAY q = &array; // Read More
posted @ 2013-04-19 22:09 javawebsoa Views(286) Comments(0) Diggs(1)
笔记#Shell工具#日志文件#编辑#vi datelog.sh#查看文件内容[root@localhost 0418]# cat datelog.sh #!/bin/bash#datelog.sh#当前的日期current_date=`date "+%Y%m%d"`#今天的日志文件名todaylog="log/${current_date}.log}#如果日志文件不存在,创建一个if [ ! -f $todaylog ]then touch $todaylogfi#输出日志到日志文件log_time_format=`date "+%Y-%m-%d %T Read More
posted @ 2013-04-19 22:03 javawebsoa Views(188) Comments(0) Diggs(0)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2955因为被抓的概率是实数,而背包问题中,用于做下标的必须是整数,所以此处用所有银行的总金额做下标,将逃脱率(1-pj)作为dp的值初始化的时候,dp[0]=1(不抢的逃脱率为1);其它都为0,按照0/1背包来做即可。 AC代码: /*HDOJ2955作者:陈佳润2013-04-19*/#include<stdio.h>#include<string.h>#define max(a,b) (a>b?a:b)double pj[105];//每个银行的逃脱率int mj[ Read More
posted @ 2013-04-19 21:58 javawebsoa Views(162) Comments(0) Diggs(0)
只要是会java的都知道++和—操作符的用法,如int i = 1;int j = i++;int k = ++i;结果i为3,j为1,k为3。那如下代码:int j = 0;for (int i = 0; i < 100; i++) { j = j++;}System.out.println(j);输出结果又是多少呢?100?0? 正确答案是0。为什么呢?要想搞明白这个问题,那来看看这段代码生成的字节码: 0: iconst_0 1: istore_1 2: iconst_0 3: istore_2 4: goto 15 7: il... Read More
posted @ 2013-04-19 21:53 javawebsoa Views(366) Comments(0) Diggs(0)
f(n,k)=f(0,k-1)+f(1,k-1)+.......f(n,k-1)#include <iostream>#include <cstring>using namespace std;int main(){ int n,k,i,j,a[105][105],l; while(cin>>n>>k&&(n+k)) { memset(a,0,sizeof(a)); for(i=1;i<=k;i++) for(j=0;j<=n;j++) { if(i==1) a[j][i]=1; else for(l=0;l<= Read More
posted @ 2013-04-19 21:48 javawebsoa Views(178) Comments(0) Diggs(0)
capture.captureVideo开启视频录制应用程序,返回采集到的视频剪辑文件信息。 navigator.device.capture.captureVideo( CaptureCB captureSuccess, CaptureErrorCB captureError, [CaptureVideoOptions options]);该方法通过设备的视频录制应用程序开始一个异步操作以采集视频录制。该操作允许设备用户在一个会话中同时采集多个视频录制。 当用户退出视频录制应用程序,或系统到达CaptureVideoOptions的limit参数所定义的最大录制数时都会停止采集操... Read More
posted @ 2013-04-19 21:42 javawebsoa Views(468) Comments(0) Diggs(0)
题意:给出一些点与点的关系,有向边,无环。问最少需要多少个机器人可以遍历全图。一开始我直接打敲了最小路径覆盖,然后WA到死,后来看了DISCUSS里面说的传递闭包,然后去学习了下,给组数据就能很好的说明这个问题。1 -> 2 , 2 -> 3 , 4 -> 2 ,2 -> 5 .传递闭包其实就是一个floyd,如果1 -> 2 ,2 -> 3 那么1 -> 3,就将1与3 联通。#include <iostream>#include <cstdio>#include <algorithm>#include <s Read More
posted @ 2013-04-19 21:37 javawebsoa Views(213) Comments(0) Diggs(0)
最近写的光模块烧码的软件也许能给别人参考下呢 功能:按照8472协议往SFF,SFP模块对应的地址烧写96个字节,然后把数据在全部读取一变,检查是否烧正确 和电脑通信用的是USB转I2C淘宝上买的小板子(本来想用单片机自己做的,就是时间来不及) C#上直接引用上面的DLL文件就是效率不高 读和写也就200个字节差不多要4S的运行时间 大家啊能帮我看看哪边能提高下性能谢谢了 环境VS2010.NET4.0界面 导入并保存HEX文件 代码http://download.csdn.net/detail/yezhubenyue/5274236 Read More
posted @ 2013-04-19 21:32 javawebsoa Views(504) Comments(0) Diggs(0)
MIC优化特别奖,华中科技大学! BSDE期权优化是本次ASC13竞赛的特色应用之一,首次被拿来作为竞赛的比赛项目。华中科大在本次竞赛中以性能优化6万倍的惊人成绩摘取“MIC优化特别奖”。 清华大学和中山大学成绩也很优秀,都获得了数万倍的加速比。 ASC13:2013亚洲大学生超级计算机竞赛 Read More
posted @ 2013-04-19 21:27 javawebsoa Views(194) Comments(0) Diggs(0)
概述IDispatch接口:完成接口调度的接口,可以不使用头文件完成接口的函数调用IDispatch接口函数1>GetIDsOfNames-根据接口函数的名称获取接口函数的ID2>Invoke-根据接口函数ID,调用接口函数3>GetTypeInfo-获取指定的类型信息接口4>GetTypeInfoCount-获取指定类型信息接口的数量IDispatch项目创建项目:增加组件和接口时,要选择“dual”,增加IDispatch接口的支持项目变化文件的变化;接口的父接口,是IDispatch接口;当添加接口函数时,会自动添加接口函数的ID组件的实现类:父类增加了IDisp Read More
posted @ 2013-04-19 21:21 javawebsoa Views(1236) Comments(0) Diggs(0)
调用方式参数传递顺寻清理堆栈 支持变长参数使用对象函数名修饰(Name-decoration convention)其他__cdecl从右至左调用者支持C/C++默认调用方式函数名前加下划线如函数main修饰成_main生成的代码比stdcall大,因为其要求每个函数调用包含清理堆栈的代码__stdcall从右至左被调用者不支持Win32 API和dll中导出函数使用下划线开头,函数名,然后@符号,最后是参数的总byte数。如:int f(int a, double b ),名字为_f@12__fastcall先放入EDX和ECX中,在从右至左被调用者不支持以@开头,函数名,然后@符号最后是参 Read More
posted @ 2013-04-19 21:16 javawebsoa Views(154) Comments(0) Diggs(0)
When you turn on the tap, the water is coming. When the power switch you open the lamp, lamp will light. Although these will be not at all surprising, for you are already be accustomed to. But have you ever thought of, the moment you open the faucet, the water flow down is not just from the tap wat. Read More
posted @ 2013-04-19 21:11 javawebsoa Views(209) Comments(0) Diggs(0)