真爱无限的知识驿站

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

[CodeSnippet]取datagrid选中的数据并转换为url查询

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);


linux下练习 c++ 栈中使用类模版例子

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;
}


.Net中自动生成Model字段修改日志内容

直接上代码,传入新旧两个Model类字段说明,要加display标签: 代码如下:    public static class EntityExtension     {         public static HashSet<Type> Primit

后端开发规范(微服务)【VME项目】

2.1、接口自测标准

接口自测能减少最常见的BUG,有问题也只是小问题,尽量减少联调过程的时间

附:微服务清单中,接口的返回数据格式(可以直接是自测时的Json结果)要加上,现在没有写的话要调通接口才能获取数据格式然后再调整前端数据绑定,太浪费双方时间

前端开发规范(WinForm)【VME项目】

1.1Form控件样式等规范

1.1.1、卸载无关的项目,窗口都写在VME工程中;

1.1.2、窗体命名统一以Frm开头,需要有继承关系;

[转载].Net mvc生成验证码

.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);


SQL Server 2008 R2 安装过程中出错的一种解决方法

可能是先装了vs2010,它会装部分与sql2008相关的东西,之后再装sql2008或sql2008r2版本,就可能会出错装不了。。


linux下练习 c++ 几种排序算法

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;
}


linux下练习 c++ 二分查找

code:

#include<iostream>
using namespace std;
class person
{
string name;
int age;
public:
person(const char* n,int a):name(n),age(a){}
friend bool operator <(const person& a,const person& b)//运算符重载-比较年龄大小
{
return a.age<b.age;
}
friend bool operator >(const person& a,const person& b)//运算符重载-比较年龄大小
{
return a.age>b.age;
}
friend bool operator ==(const person& a,const person& b)//运算符重载-等于号
{
return a.age==b.age;
}
friend ostream& operator<<(ostream& o,const person& a)//运算符重载-输出
{
o<<a.name<<":"<<a.age<<endl;
}
};
person* bsearch(person* a,int n,const int age)//二分查找
{
if(n<=0) return NULL;
int mid=n/2;
person p("",age);
if(a[mid]==p) return a+mid;
if(p<a[mid]) return bsearch(a,mid,age);
else return bsearch(a+mid+1,n-mid-1,age);
}
person* bsearch2(person* a,int n,const int age)//二分查找
{
int b=0,e=n-1;
person t("",age);
while(b<=e)
{
int mid=(b+e)/2;
if(a[mid]==t) return a+mid;
if(t<a[mid]) e=mid-1;
else b=mid+1;
}
return NULL;
}
int main()
{
person a[5]={person("a1",34),
person("a2",25),
person("a3",16),
person("a4",77),
person("a5",40)};
for(int i=0;i<5;i++)//排序
{
for(int j=i+1;j<5;j++)
if(a[j]<a[i]) swap(a[j],a[i]);
}
for(int i=0;i<5;i++)
cout<<a[i];
int fage;
cout<<"请输入要查找的年龄:";
cin>>fage;
person* p=bsearch2(a,5,fage);//查找
if(p!=NULL) cout<<*p;
else cout<<"未找到!
";
}


DEMO设计软件Axure RP初步使用


做软件设计工程师,自然少不了要设计DEMO,之前是单纯的开发根本没用到过,要想从头开始,包括做一些动态效果,真还要学习学习,不然都不知道怎么动手做。

我这里使用的英文版,如果用了中文汉化包的,可以翻译一下参考,功能都差不多的。

<< < 27 28 29 30 31 32 33 34 35 36 > >>

Powered By Z-BlogPHP 1.7.3

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