真爱无限的知识驿站

学习积累技术经验,提升自身能力

html代码弹出固定大小的窗口


//js弹出固定大小窗口

<SCRIPT language=javascript> 
function openScript(url, width, height) {
        var Win = window.open(url,"openScript",'width=' + width + ',height=' + 
height + ',resizable=0,scrollbars=yes,menubar=no,status=n0' );
}
</SCRIPT>
<body>
 <a href='javascript:openScript("http://www.baidu.com",300,400)' >1234324</>
</body>


vs2010中使用Nunit测试c#代码结果的正确性

http://www.nunit.org/index.php?p=download

linux下练习 c++ 关联式容器multimap特性

multimap.cpp

/*
multimap特性
key可以重复
不支持下标访问
*/
#include<iostream>
#include<string>
#include "print.h"
#include<map>
using namespace std;
typedef pair<int,string>  pairmp;
typedef multimap<string,double> MS;
int main()
{
MS m;
m.insert(MS::value_type("t1",1000));
m.insert(MS::value_type("t1",1300));
m.insert(make_pair("t2",3000));
m.insert(MS::value_type("t1",1800));
m.insert(make_pair("t2",100000));
m.insert(MS::value_type("t1",1600));
print(m.begin(),m.end());
MS::iterator ib=m.begin(),ie;
MS m2;
while(ib!=m.end())
{
string name=ib->first;//first:K,second:V
ie=m.upper_bound(name);//同一个key的一个区别上界
double sum=0.0;
while(ib!=ie)
{
sum+=(ib++)->second;
}
m2.insert(make_pair(name,sum));//处理,并加入一个容量
}
print(m2.begin(),m2.end());
return 0;
}


linux下练习 c++ 关联式容器map特性

map.cpp

/*  
map.cpp  
map特性
不允许key重复
key/value对
key可以当下标访问value,key不存在则插入新的key/value对,以0初始化
*/
#include<iostream>
#include<string>
#include "print.h"
#include<map>
using namespace std;
typedef pair<int,string>  pairmp;
#include<map>
int main()
{
map<int,string> mp;
mp.insert(pair<int,string>(1,"aaa"));
mp.insert(make_pair(5,"bbb"));//自动匹配类型,构造pair
mp.insert(map<int,string>::value_type(4,"fff"));//内部类型,也能自动构造相应的pair
mp.insert(make_pair(2,"hhh"));
mp.insert(make_pair(2,"hhh"));
mp[2]="hhh1";//有则修改
mp[3]="ddd";//无则插入
print(mp.begin(),mp.end());
return 0;
}


linux下练习 c++ 关联式容器共性测试,使用

code:

/*
关联式容器共性:二叉查找树实现,自动根据关键字排序,自动平衡
  set<K>,multiset<K>,map<K,V>,multimap<K,V>
查找:.find(key) 失败返回.end()
统计:.count(key)
删除:.erase(key)
插入:.insert(element)
区间:.lower_bund(key) //取得关键字为key的第一个元素位置
 .upper_bound(key) //取得关键字为key的最后一个元素之后的位置
 .equal_range(key) 取得关键字为key的区间,返回pair
构造函数可用比较函数作为参数  bool func(K a,K b)
*/
#include<iostream>
#include<set>
#include<string>
using namespace std;
#include "print.h"
struct person
{
string name;
int age;
public:
person(const char* n,int a):name(n),age(a){}
};
bool operator<(const person& a,const person& b)
{
return a.age<b.age||(a.age==b.age&& a.name<b.name);//找的时候按这个找
}
ostream& operator<<(ostream& o,const person& x)
{
return o<<x.name<<':'<<x.age<<"  ";
}
int main()
{
multiset<person> mp;
mp.insert(person("ccc",16));
mp.insert(person("aaa",13));
mp.insert(person("aaa",13));
mp.insert(person("kkk",18));
mp.insert(person("fff",15));
mp.insert(person("eee",11));
mp.insert(person("jjj",16));
print(mp.begin(),mp.end());
multiset<person>::iterator it=mp.find(person("fff",15));
if(it==mp.end()) cout<<"not find!
";
else
{
 cout<<"find:"<<*it
         <<" "<<mp.count(*it)<<"个
";
}
person a("aaa",13);
cout<<a<<" "<<mp.count(a)<<"个
";
cout<<"lower/upper bound方法:
";
multiset<person>::iterator ibegin,iend;
ibegin=mp.lower_bound(a);
iend=mp.upper_bound(a);
print(ibegin,iend);
cout<<"pair方法:
";
typedef multiset<person>::iterator myiter;//给长类型起个别名
pair<myiter,myiter> p=mp.equal_range(a);
print(p.first,p.second);
cout<<"删除后输出:
";
mp.erase(person("kkk",18));//有多个就删除多个
print(mp.begin(),mp.end());
}


测试用c#操作mysql

 

原始数据:

今天学习使用mysql遇到的问题和解决办法

安装到最后出现问题,无响应,那么不要紧,前面的安装成功了,只是没配置。关闭之后,直接命令开启服务,再使用。

 

<< 1 >>

Powered By Z-BlogPHP 1.7.3

Copyright 2024-2027 pukuimin Rights Reserved.
粤ICP备17100155号