今天做的项目中遇到了获取map中根据key进行排序的value数据,key中保存的内容是字符串类型。map的知识点好久没用有点生疏,不知道怎么去使用。看看之前同事写的map根据key排序的代码,发现他是先把key都取出来封装到一个List中,然后用Collections.sort方法对List排序,按照排..
分类:
编程语言 时间:
2015-07-09 14:56:57
收藏:
0 评论:
0 赞:
0 阅读:
243
大招list[list.index("haha")]="2222"创建列表sample_list=[‘a‘,1,(‘a‘,‘b‘)]Python列表操作sample_list=[‘a‘,‘b‘,0,1,3]得到列表中的某一个值value_start=sample_list[0]end_value=sample_list[-1]删除列表的第一个值delsample_list[0]在列表中插入一个值sample_list[0:0]=[‘s..
分类:
编程语言 时间:
2015-07-09 14:54:36
收藏:
0 评论:
0 赞:
0 阅读:
306
下面是个人感觉比较清晰易懂的spring实现RMI的网络帖子:使用Spring对RMI的支持,可以非常容易地构建你的分布式应用。在服务端,可以通过Spring的org.springframework.remoting.rmi.RmiServiceExporter可以暴露你的服务;在客户端,通过org.springframework.remoting.rmi.RmiPr..
分类:
编程语言 时间:
2015-07-09 14:54:17
收藏:
0 评论:
0 赞:
0 阅读:
170
publicclassServer{
Sockets=null;
publicServer(){
try{
ServerSocketss=newServerSocket(9999);
s=ss.accept();
}catch(Excetione){
e.printStackTace();
}
}
publicvoidread(){
BufferdReadbr=newBufferdRead(newInputStreamRead(s.getInputStream));
while(true){
Stringst..
分类:
编程语言 时间:
2015-07-09 14:45:46
收藏:
0 评论:
0 赞:
0 阅读:
516
题目:
Given an array S of n integers, are there elements a, b, c in S such that a + b + c =
0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in a tripl...
分类:
编程语言 时间:
2015-07-09 14:41:16
收藏:
0 评论:
0 赞:
0 阅读:
314
import Foundation
//1、字符
//用 Character 定义单个字符:
let money: Character = "¥"
var face: Character = "...
分类:
编程语言 时间:
2015-07-09 14:41:06
收藏:
0 评论:
0 赞:
0 阅读:
263
package com.aa.promotion.dao.generalize;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOExcep...
分类:
编程语言 时间:
2015-07-09 14:40:56
收藏:
0 评论:
0 赞:
0 阅读:
419
题目:
Implement the following operations of a stack using queues.
push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Re...
分类:
编程语言 时间:
2015-07-09 14:40:06
收藏:
0 评论:
0 赞:
0 阅读:
396
适配器模式(Adapter Pattern)是作为两个不兼容的接口之间的桥梁。这种类型的设计模式属于结构型模式,它结合了两个独立接口的功能。
意图:将一个类的接口转换成客户希望的另外一个接口。适配器模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。
主要解决:主要解决在软件系统中,常常要将一些"现存的对象"放到新的环境中,而新环境要求的接口是现对象不能满足的。
何时使用: 1...
分类:
编程语言 时间:
2015-07-09 14:39:56
收藏:
0 评论:
0 赞:
0 阅读:
265
题目:
Implement the following operations of a queue using stacks.
push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front eleme...
分类:
编程语言 时间:
2015-07-09 14:39:46
收藏:
0 评论:
0 赞:
0 阅读:
296
题目:
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume
that each input would h...
分类:
编程语言 时间:
2015-07-09 14:39:36
收藏:
0 评论:
0 赞:
0 阅读:
269
1. 特点 在python 解析html这篇文章中已经做了初步的介绍,接下来再坐进一步的说明。python抓取页面信息有以下两个特点:
依赖于HTML的架构。
微小的变化可能会导致抓取失败,这取决于你编码的技巧。
2. 抓取示例 首先看一下百度视频网页的源代码,大致浏览下,选定要抓取的网页元素。
假设我们要对div标签id为focusCarouselList里的相关...
分类:
编程语言 时间:
2015-07-09 14:39:16
收藏:
0 评论:
0 赞:
0 阅读:
290
使用 quit(), exit(), 或者Ctrl-D退出命令行
[root@CentOS-43 workspace]# python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "cr...
分类:
编程语言 时间:
2015-07-09 14:34:16
收藏:
0 评论:
0 赞:
0 阅读:
256
用CWnd类的函数MoveWindow()或SetWindowPos()可以改变控件的大小和位置。
void MoveWindow(int x,int y,int nWidth,int nHeight);
void MoveWindow(LPCRECT lpRect);
第一种用法需给出控件新的坐标和宽度、高度;
第二种用法给出存放位置的CRect对象;
例:
CWnd *pWnd...
分类:
编程语言 时间:
2015-07-09 14:30:15
收藏:
0 评论:
0 赞:
0 阅读:
202
半透明控件的实现原理:
创建一个临时DC,发消息给父控件告知其绘制其内容于临时DC上,然后将自己相对于父控件的那块区域的绘制COPY到自己的PaintDC上,此后再做其他绘制。
代码思路如下:
Child:
{
CPaintDC dc;
CMemDC mdc;
//创建临时DC
CBitmap bitmap;
CDC cdc;
::SendMessage(hParent, WM...
分类:
编程语言 时间:
2015-07-09 14:29:06
收藏:
0 评论:
0 赞:
0 阅读:
249
1. 定义排序class ComparatorDefault implements Comparator { public int compare(Object arg0, Object arg1) { OrderDetailReturn.BidsEntity b...
分类:
编程语言 时间:
2015-07-09 14:24:45
收藏:
0 评论:
0 赞:
0 阅读:
213
题目:
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
题意:
给定一个整数,将其转化为罗马数字。
题目给定的输入保证在1-3999之间。
算法分析:
参考了博客http://www.cnbl...
分类:
编程语言 时间:
2015-07-09 13:19:25
收藏:
0 评论:
0 赞:
0 阅读:
314
题目:It can be seen that the number, 125874, and its double, 251748, contains exactly the same digits, but in a different order. Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, ...
分类:
编程语言 时间:
2015-07-09 13:18:15
收藏:
0 评论:
0 赞:
0 阅读:
357
var button1 = UIButton(frame: CGRectMake(100, 200, 100, 40))
button1 .setTitle("first button", forState:UIControlState.Normal)
button1.addTarget(self, action: "fi...
分类:
编程语言 时间:
2015-07-09 13:15:05
收藏:
0 评论:
0 赞:
0 阅读:
323
题目:
Write a function to find the longest common prefix string amongst an array of strings.
题意:
写出一个函数,找到一组数组中的最长公共子串。
算法分析:
需要构建两重循环。第一层是最短子串的长度,另一层是遍历字符串数组中的每个成员。
brute force的想法,以第一个字符串为标准,对于...
分类:
编程语言 时间:
2015-07-09 13:14:47
收藏:
0 评论:
0 赞:
0 阅读:
163