Base64是一种将二进制转为可打印字符的编码方法,主要用于邮件传输.Base64将64个字符(A-Z,a-z,0-9,+,/)作为基本字符集,把所有符号转换为这个字符集中的字符. 编码: 编码每次将3字节转为4字节,若输入字节数不是3的倍数,则在末尾填充0字节使其长度为3的倍数.对于3字节,每次取出6位,并在前面添加2位0构成一个字节,以此字节为下标查找Base64码表(如下图)输出对应字符.每次将3字节转为4字节(3*8=4*6),直至得到整个输入串的编码结果.最后,若之前在输入中添加了1个…
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 21851 Accepted: 8984 Special Judge Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only t…
Pie Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 109 Accepted Submission(s): 52   Problem Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a…
一.Java Script 1.由于Solr本身可以返回Json格式的结果,而JavaScript对于处理Json数据具有天然的优势,因此使用JavaScript实现Solr客户端是一个很好的选择. 2.在之前,主要使用SolJS作为solr的客户端,目前主要使用ajax-solr,信息请见:https://github.com/evolvingweb/ajax-solr/wiki/Reuters-tutorial%3A-step-1. 3.以下示例未使用上述所述的客户端,而是使用了ajax的基…
DZY Loves Chessboard time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves chessboard, and he enjoys playing with it. He has a chessboard of n rows and m columns. Some cells of the ches…
Ultra-QuickSort Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 48111   Accepted: 17549 Description In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swappin…
Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 62016 Accepted: 23808 Description Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by wate…
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> #include <map> #include <vector> using namespace std; long long num[1000005]; long long fz[1000005]; long long xds[100…
#include <cstdio> #include <iostream> #include <cstring> #include<queue> #include<cmath> using namespace std; const int INF = 0x3fffffff; int g[1005][1005]; int pre[1005]; int m; int bfs(int s,int t) { queue<int>q; q.pu…
说明: (1)日期以年月形式显示:convert(varchar(7),字段名,120) , (2)加一列 (3)自编号: row_number() over(order by 字段名 desc) as RowID row_number() over(partition by 字段1 order by 字段2) as RowID (4)自编号的限制(不可直接在WHERE条件中加) 举例说明: 想要达到的效果:按月统计各工种的前5名(以件数为依据) 初始SQL语句: select sum(Sum_…
(1)Convert 函数 select Convert ( VARCHAR(7),ComeDate,120) as Date ,Count(In_code) as 单数,Sum(SumTrueNum) as 件数 from T_In_Top  where  ComeDate between '2013-01-01' and '2014-08-04' and In_top_State='已完成' and Case_ID=14  and Store_ID=41 group by Convert (…
对链表进行排序,要求时间复杂度为O(n log n) ,不使用额外的空间. 我一开始的想法是借助quicksort的思想,代码如下: # time O(nlog(n)) # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def sortList(self, head): if head is not No…
 调用系统相机和相册 (iPad,iPhone) 打开相机:(iPad,iPhone) //先设定sourceType为相机,然后判断相机是否可用(ipod)没相机,不可用将sourceType设定为相片库       UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;   //    if (![UIImagePickerController isSourceTypeAv…
第一部分:编码基础 为什么需要编码:用计算机看得懂的语言(二进制数)表示各种各样的字符. 一.基本概念 ASCII.Unicode.big5.GBK等为字符集,它们只定义了这个字符集内有哪些字符,以及分别用什么数字表示. 而UTF-8与UTF-16则定义了Unicode字符集如何使用计算机看得懂的语言进行传输和保存. 例如: Unicode 字符 U+00A9 = 1010 1001 (版权符号) 在 UTF-8 里的编码为:        11000010 10101001 = 0xC2 0x…
hadoop集群性能低下的常见原因 (一)硬件环境 1.CPU/内存不足,或未充分利用 2.网络原因 3.磁盘原因 (二)map任务原因 1.输入文件中小文件过多,导致多次启动和停止JVM进程.可以设置JVM重用. 2.数据倾斜:大文件且不可分割,导致处理这些文件的map需要很长时间. 3.数据本地化效果差. (三)reduce任务的原因 1.reduce任务数量过大或过小 2.数据倾斜:一部分key的记录数量太大,导致某些reduce执行过慢 3.缓慢的shuffle和排序 (四)hadoop…
原来的tf卡无故启动不起来,检查发现其文件系统分区使用率为0%. 数据全部丢失!!!!! 血的教训告诉我们备份文件系统的重要性,一切需要重头来.... 烧录系统 安装系统有两种方式, NOOBS工具安装方式 这时官方推荐的安装方式,安装方法是,下载NOOBS压缩包,解压到你的tf里,插入树莓派,接上键盘鼠标,开始根据安装向导一步一步安装.这种方式比较简单,但是占用tf卡空间较大,因为采用了非原生的分区方式,运行效率也许不是最高的,只适合刚入手需要反复折腾系统的人. TF卡直接烧录系统镜像方式 第…
1.下载rpm文件并安装 rpm -ivh jdk-7u51-linux-x64.rpm 2.修改/etc/profile文件,增加以下配置 export JAVA_HOME=/usr/java/jdk1.7.0_51 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin:$PATH 版权声明:本文为博主原创文章,未经博主允许不得转载.…
一.SolrJ基础 1.相关资料 API:http://lucene.apache.org/solr/4_9_0/solr-solrj/ apache_solr_ref_guide_4.9.pdf:Client APIs---Using SolrJ http://wiki.apache.org/solr/Solrj solr in action:Using the SolrJ client library to add documents from Java, Using SolrJ from…
一.关于Velocity的基本配置 在Solr中,可以以多种方式返回搜索结果,如单纯的文本回复(XML.JSON.CSV等),也可以返回velocity,js等格式.而VelocityResponseWriter就是用于将返回velocity类型文本,以便直接用于结果呈现. 在Solr提供的example,其中的一个RequestHandler--/browse,使用了VelocityResponseWriter.其配置如下: <requestHandler name="/browse&q…
1.RemoteSolrException: Expected mime type application/octet-stream but got text/html 现象: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.o…
一.Solr学习相关资料 1.官方材料 (1)快速入门:http://lucene.apache.org/solr/4_9_0/tutorial.html,以自带的example项目快速介绍发Solr的基础使用. (2)API:http://lucene.apache.org/solr/4_9_0/index.html (3)reference:PDF格式,apache-solr-ref-guide-4.9.pdf 2.书籍 (1)Solr in Action,基于4.7版本,极力推荐,此书适合…
详细代码请参见 https://github.com/lujinhong/dao 一.前期准备 1.创建数据库 create database filter_conf; 2.创建表并插入数据 create table T_CATEGORY(cid Int, title varchar(256), sequnce int, deleted int); insert into T_CATEGORY values(1,lujinhong,1,1); 3.准备pom.xml 我习惯使用maven作包管理…
1.关于默认搜索域 If you are using the Lucene query parser, queries that don't specify a field name will use the defaultSearchField. The DisMax and Extended DisMax query parsers do not use this value.  Use of the defaultSearchField element is deprecated in S…
Safecracker Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10165 Accepted Submission(s): 5213 Problem Description === Op tech briefing, 2002/11/02 06:42 CST === "The item is locked in a Klein saf…
Uncle Tom's Inherited Land* Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1869    Accepted Submission(s): 777 Special Judge Problem Description Your old uncle Tom inherited a piece of land fr…
全盘格式化,重装了Ubuntu和Windows,记录一下重新配置Ubuntu过程. //build-essential sudo apt-get install build-essential sudo apt-get install vim //input method sougou <span style="color:#33FF33;">sudo apt-get remove ibus</span> //去掉 sudo add-apt-repository…
一.什么是正则表达式 正则表达式,又称正规表示法,是对字符串操作的一种逻辑公式.正则表达式可以检测给定的字符串是否符合我们定义的逻辑,也可以从字符串中获取我们想要的特定部分.它可以迅速地用极简单的方式达到字符串的复杂控制. 二.正则表达式的语法 看一个过滤纯数字的例子 - (BOOL)validateNumber:(NSString *) textString { NSString* number=@"^[0-9]+$"; NSPredicate *numberPre = [NSPre…
也许你习惯了使用Eclipse编译和打包Android应用.不过,对于使用html5+js开发的phonegap应用,本文建议你抛弃Eclipse,改为使用命令行模式,绝对的快速和方便. 一直以来,Eclipse+ADT是广大Android应用开发者的必备工具,毋庸置疑,Ecplise在开发Android原生应用方面有着几乎不可替换的位置.Phonegap是一个已经不算是新鲜事物的东西了.PhoneGap是一个开源的开发框架,使用HTML,CSS和JavaScript来构建跨平台的的移动应用程序…
在平常项目中,我们会遇到这样的业务场景: 客户希望把自己的门店绘制在百度地图上,通过省.市.区的选择,然后加载不同区域下的店铺位置. 先看看效果图吧: 实现思路: 第一步:整理行政区域表: 要实现通过地区筛选来动态加载地图,首先要有一套中国行政区域表.哪里来呢?如果你做过淘宝API接入,应该会想到淘宝物流接口提供了一个官方的行政区域代码,这个比较靠谱. 第二步:收集行政区域的经纬度: 这个就有点麻烦了,虽然可以在百度坐标拾取系统一个一个的收集整理,但是3000多条记录,是个不小的体力活.于是经过…
以下代码使用平台是VS2012. 清楚明白声明与定义是一名合格的程序猿的基本要求. 本人认为,C++编码过程中谈及"声明"和"定义"是因为我们要使用一个变量.类型(类.结构体.枚举.共用体)或者函数,因此有申明和定义变量.类型和函数之说.C/C++中,使用一个变量.类型或者函数必须先在使用前申明它. 请记住: (1)"声明"与"定义"的本质区别是:声明可以出现多次,而定义只能出现一次. (2)把申明的东西放在头文件,把定义的东…