其实,关于网络编程有着特有的格式,两个程序,一个服务器端,一个客户端,运行时先运行服务器端,在运行客户端,首先看下面两个小例子:
import java.net.*;
import java.io.*;
public class TCPServer {
public static void main(String[] args) throws Exception {
ServerSocke...
分类:
其他好文 时间:
2015-01-30 16:06:54
阅读次数:
182
题目:Write a function to find the longest common prefix string amongst an array of strings.
找出所有字符串的最长公共前缀。这道题很简单,但需要注意减少比较字符的操作次数。
2个字符串的最长公共前缀,其长度肯定不会超过最短的字符串的长度,设最短的字符串长度为n,那么只要比较这2个字符串的前n个...
分类:
其他好文 时间:
2015-01-30 16:04:25
阅读次数:
122
从Python文档关于Naming and binding的说明可知,变量名是绑定到具体对象的,从这点来看,可以把它理解为C++中的引用。考虑下面两行语句:
a = 'test'
a = 'test_ext'第1行执行后,Python解释器会在内存中创建string类型的对象'test',这个对象一旦创建就不能再修改其值。赋值符号只是将变量名a绑定到这个对象上而已。
第2行执行后,同理,值为'...
分类:
编程语言 时间:
2015-01-30 15:58:20
阅读次数:
185
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.
If the fractional part is repeating, enclose the repeating part in parentheses....
分类:
其他好文 时间:
2015-01-30 15:55:05
阅读次数:
123
字符集
在VC2012中,字符集默认采用Unicode字符集(Use Unicode Charecter Set选项),其值还可以设置为多字节字符集(Use Multi-Byte Charecter Set)。
为什么要使用Unicode
可以很容易地在不同语言之间进行数据交换。使你能够分配支持所有语言的单个二进制.exe文件或DLL文件。提高应用程序的运行效率。
...
分类:
编程语言 时间:
2015-01-30 15:51:27
阅读次数:
205
string 'content' (length=7) 'c' => string 'index' (length=5) 'a' => string 'lists' (length=5) ...
分类:
Web程序 时间:
2015-01-30 15:43:56
阅读次数:
130
我们也可以用xml来定义一个信息更为丰富的UIMap.xml文件,比如,额外还添加控件所属的页,控件的类型,然后解析构建一个XMLParser类来读取相应的值。 1 2 3 6 7 10 相应的解析xml的代码: 1 public static String getLoc...
分类:
其他好文 时间:
2015-01-30 15:43:46
阅读次数:
154
专业解决:int转化为字符串、float转化为字符串及其反向转化正向:#includestringsteam stream;//新建一个流,它只是一个流,没有类型string result;float i=12.3;//或换成int i;stream>result;//将流送入resultcouts...
分类:
其他好文 时间:
2015-01-30 15:29:47
阅读次数:
138
目标:在主程序运行时打开子程序,并在主程序中根据一些逻辑来适时地隐藏和显示子程序的主窗体。 最初的想法是使用启动进程的方式,但是这样要用到Win32的一些个API,还要找窗体什么的,另外操作进程占用资源也会多,所以主动放弃这个想法。于是想到使用反射来完成这个过程。 string pa...
Question:I created a WCF service that exposed a method that has one paramater:public class Service1 : IService1{ public string GetData(int value) { re...
分类:
Web程序 时间:
2015-01-30 15:26:38
阅读次数:
168