打包的意义:
可以使用嵌套层次结构来组织包
为了更好地规划代码,防止命名冲突和混乱
当把类组织起来放进一个包内时,也就给包中成员赋予了相互访问的权限
声明包:
package 包名,必须是源代码第一条语句
打包的意义:
可以使用嵌套层次结构来组织包
为了更好地规划代码,防止命名冲突和混乱
当把类组织起来放进一个包内时,也就给包中成员赋予了相互访问的权限
声明包:
package 包名,必须是源代码第一条语句
static关键字:
static修饰类变量时,变量称为静态变量(类变量),它不属于任何对象
static修饰类方法时,方法称为静态方法,静态方法中只能使用调用静态方法或静态变量
非静态方法可以调用静态方法或静态变量,静态方法不能调用非静态方法或非静态变量
jquery code:
var opt = {
'Name': $('#Name').val(),
'sort': 'ProviderId',
'order': 'desc',
};
var checkedItems = $('#tb_provider').datagrid('getChecked');
if (checkedItems && checkedItems.length > 0)
{
var ids = [];
$.each(checkedItems, function (index, item) {
ids.push(item.ProviderId);
});
opt.SelectedProviderIds = ids.join(",");
}
var url = '/User/User/ExportData?' + $.param(opt);code:
//栈中使用类模版例子
#include <iostream>
#include <typeinfo>
using namespace std;
//typedef char T;
template<typename T,int len=4>//可以有默认值,有默认值的参数靠右
//如果成员函数在类外写,那么每个函数前要加语句: template<typename T>
class Stack
{
T a[len];
int cur;
public:
Stack():cur(0){}
const char* stype()const//类型
{
return typeid(T).name();
}
int max_size()const//最大空间
{
return len;
}
void push(const T& d) throw(const char*)//入栈
{
if(full()) throw "满";
a[cur++]=d;
}
T pop() throw (const char*)//出栈
{
if(empty()) throw "空";
return a[--cur];
}
const T& top() const throw(const char*)//取顶元素
{
if(empty()) throw "空";
return a[cur-1];
}
bool empty()const//是否空
{
return cur==0;
}
bool full()const//是否满
{
return cur==len;
}
void clear()//清空
{
cur=0;
}
void travel()//遍历
{
while(!empty())
{
cout<<pop()<<' ';
}
cout<<endl;
}
int size()const{return cur;}//元素个数
};
int main()
{
Stack<char,10> s;
Stack<int> d;
s.push('+');s.push('-');s.push('*');s.push('/');
d.push(123);
d.push(42);
d.push(666);
cout<<s.stype()<<endl;
s.travel();
cout<<d.stype()<<endl;
d.travel();
return 0;
}直接上代码,传入新旧两个Model类字段说明,要加display标签: 代码如下: public static class EntityExtension { public static HashSet<Type> Primit
接口自测能减少最常见的BUG,有问题也只是小问题,尽量减少联调过程的时间
附:微服务清单中,接口的返回数据格式(可以直接是自测时的Json结果)要加上,现在没有写的话要调通接口才能获取数据格式然后再调整前端数据绑定,太浪费双方时间
1.1.1、卸载无关的项目,窗口都写在VME工程中;
1.1.2、窗体命名统一以Frm开头,需要有继承关系;
.net code:
public void ValidateCode()
{
// 在此处放置用户代码以初始化页面
string vnum;
vnum = GetByRndNum(6);
Response.ClearContent(); //需要输出图象信息 要修改HTTP头
Response.ContentType = "image/jpeg";
CreateValidateCode(vnum);
}
private void CreateValidateCode(string vnum)
{
Bitmap Img = null;
Graphics g = null;
Random random = new Random();
int gheight = vnum.Length * 15;
Img = new Bitmap(gheight, 24);
g = Graphics.FromImage(Img);可能是先装了vs2010,它会装部分与sql2008相关的东西,之后再装sql2008或sql2008r2版本,就可能会出错装不了。。
code:
#include <iostream>
#include<algorithm>
#include<ctime>
using namespace std;
void sort(int* a,int n)//普通冒泡排序
{
bool changed;
do
{
changed=false;
for(int i=1;i<n;i++)
{
if(a[i]<a[i-1])
{
swap(a[i],a[i-1]);
changed=true;
}
}
--n;
}
while(changed);
}
void sort1(int* a,int n)//插入排序
{
int j;
for(int i=1;i<n;i++)
{
int t=a[i];
for(j=i;j>0&&t<a[j-1];j--)
a[j]=a[j-1];
a[j]=t;
}
}
void sort2(int* a,int n)//高效冒泡排序
{
int j;
for(int i=0;i<n-1;i++)
{
int t=i;
for(j=i+1;j<n;j++)
if(a[j]<a[t]) t=j;
if(i!=t) swap(a[t],a[i]);
}
}
void sort3(int* a,int n)//快速(分组)排序
{
if(n<=1) return;
else if(n==2)
{
if(a[0]<=a[1]) return;
else swap(a[0],a[1]);
}
else
{
swap(a[n/2],a[0]);
int jie =a[0];
int* L=a+1;
int* R=a+n-1;
while(L<R)
{
while(L<R && *L<jie) ++L;
while(a<R && *R>=jie) --R;
if(L<R) swap(*L,*R);
}
if(*R <jie) swap(*R,a[0]);
sort(a,R-a);
sort(R+1,n-1-(R-a));
}
}
int main()
{
const int N=10240;
int a[N];
for(int i=0;i<N;i++)
{
a[i]=N-i;
}
clock_t t1=clock();
sort(a,N);
clock_t t2=clock();
cout<<"用时:"<<double(t2-t1)/CLOCKS_PER_SEC<<endl;
for(int i=21;i<31;i++)
{
cout<<a[i]<<' ';
}
cout<<endl;
//int b[5]={45,42,67,88,11};
for(int i=0;i<N;i++)//重新赋值
{
a[i]=N-i;
}
t1=clock();
sort1(a,N);
t2=clock();
cout<<"用时:"<<double(t2-t1)/CLOCKS_PER_SEC<<endl;
for(int i=21;i<31;i++)
{
cout<<a[i]<<' ';
}
cout<<endl;
for(int i=0;i<N;i++)//重新赋值
{
a[i]=N-i;
}
t1=clock();
sort2(a,N);
t2=clock();
cout<<"用时:"<<double(t2-t1)/CLOCKS_PER_SEC<<endl;
for(int i=21;i<31;i++)
{
cout<<a[i]<<' ';
}
cout<<endl;
for(int i=0;i<N;i++)//重新赋值
{
a[i]=N-i;
}
t1=clock();
sort3(a,N);
t2=clock();
cout<<"用时:"<<double(t2-t1)/CLOCKS_PER_SEC<<endl;
for(int i=21;i<31;i++)
{
cout<<a[i]<<' ';
}
cout<<endl;
}Powered By Z-BlogPHP 1.7.5
Copyright 2024-2029 pukuimin Rights Reserved.