列表推导式(list
comprehension)是利用其他列表创建新列表(类似于数学术语中的集合推导式)的一种方法。它的工作方式类似于for循环,也很简单:In [39]:
[x*x for x in range(10)]Out[39]: [0, 1, 4, 9, 16, 25, 36, 49, ...
分类:
编程语言 时间:
2014-05-05 22:21:48
阅读次数:
422
第八章 用户界面(二)
在 WinForm 上使用控件
控件就是类,派生自 System.Windows.Forms.Control,由此类派生出的任何类都能显示在窗体上,只要将它添加到窗体对象的 Controls 集合中。
现在我们看一下用控件画树形的方法。WinForms 库定义了 TreeView 类,这是专门用于显示树形结构的;自然,我们就用这个控件来显示树。使...
分类:
其他好文 时间:
2014-05-04 00:08:55
阅读次数:
322
ping是基于ICMP(Internet Control Message Protocol)协议实现的,而ICMP协议是在IP层实现的。
ping实际上是发起者发送一个Echo Request(type = 8)的,远程主机回应一个Echo Reply(type = 0)的过程。
为什么用ping不能测试某一个端口
刚开始接触网络的时候,可能很多人都有疑问,怎么用ping来测试远程主机的某个...
分类:
其他好文 时间:
2014-05-04 00:04:34
阅读次数:
381
首先看下面这个例子
public static void main(String[] args) {
ArrayList al1 = new ArrayList();
al1.add(1);
ArrayList al2 = new ArrayList();
al2.add("hello");
//int型链表和string型链表,结果为true
System.out.p...
分类:
编程语言 时间:
2014-05-03 22:02:53
阅读次数:
376
Playback control of audio/video files and streams is managed as a state machine. The following diagram shows the life cycle and the states of a MediaPlayer object driven by the supported playback cont...
分类:
移动开发 时间:
2014-05-03 21:36:21
阅读次数:
568
[root@server254java]#vimOstrich.java//注意文件名必须是这个,因为下面代码中只有Ostrich是public修饰符。我们要明白public的含义classBird
{
publicvoidFly()
{
System.out.println("IambirdIcanfly");
}
}
publicclassOstrichextendsBird
{
publicvoidFly()
{
System.out.p..
分类:
编程语言 时间:
2014-05-03 20:47:18
阅读次数:
366
package ioTest.io2;
import java.io.IOException;
import java.io.InputStream;
/*
*键盘录入:如果录入的是一行数据打印,如果录入了over就结束录入
*System.in:标准输入流对象
*System.out:标准输出流对象
*/
public class ReadIn {
public static v...
分类:
编程语言 时间:
2014-05-03 17:07:53
阅读次数:
268
添加Expires和Cache-control头部
Expire和Cache-control实际上是HTTP中的缓存控制头部,它主要影响客户端的请求行为和服务器端的响应。
一.缓存的基本概念
这里的缓存,单指web的缓存。当web请求抵达缓存时,如果本地有缓存的副本且缓存未过期,那么就可以从本地读取数据或文档,这样便可以:
1. 减少冗余的数据传输,一定程度上减少服务器的流量...
分类:
Web程序 时间:
2014-05-03 15:51:40
阅读次数:
380
classPerson
{
publicStringname;//定义实例Feild
publicstaticinteyeNum;//定义类Feild
}
publicclassPersonTest
{
publicstaticvoidmain(String[]args)
{
System.out.println("Person的eyeNum的类Feild值是:"
+Person.eyeNum);
}
}运行:[root@server254java]#javaPersonTes..
分类:
编程语言 时间:
2014-05-03 15:02:27
阅读次数:
484
只是看看能不能成功使用python操作redis,redis具体的数据结构和使用会在以后学习。安装连接redis的包pipinstallredis本地已经在6379端口启动了redis服务。In[1]:importredis
In[2]:r=redis.StrictRedis(host=‘localhost‘,port=6379,db=0)
In[3]:r.set(‘foo‘,‘bar‘)
Out[3]:Tru..
分类:
编程语言 时间:
2014-05-03 14:38:32
阅读次数:
405