当前位置:  编程技术>综合
本页文章导读:
    ▪JCaptcha 简介       CAPTCHA 全称 Completely Automated Public Turing Test to Tell Computers and Humans Apart,最早作为卡内基梅隆大学的一个科研项目,用于生成一个人类容易通过而计算机难以通过的测试,目前广泛应用于网络应.........
    ▪交叉编译时报错:/usr/bin/ld: cannot find -lc      我用的是RHEL6.3的系统,在交叉编译时报错:/usr/bin/ld: cannot find -lc。网上搜了说要装glibc,但我的系统本身就带的,又装了一边,还是报这个错误。我仔细排查,发现当有gcc -static ×××时报错.........
    ▪Import a SharePoint Designer Reusable Workflow into Visual Studio in SharePoint 2013      Step by step import reuseable workflow in SharePoint 2013 by Visual Studio   This walkthrough demonstrates how to import a reusable workflow created in SharePoint Designer 2013 into a Visual Studio SharePoint workflow project. Workflows created in.........

[1]JCaptcha 简介
    来源: 互联网  发布时间: 2013-11-07

CAPTCHA 全称 Completely Automated Public Turing Test to Tell Computers and Humans Apart,最早作为卡内基梅隆大学的一个科研项目,用于生成一个人类容易通过而计算机难以通过的测试,目前广泛应用于网络应用,用于阻止机器人发布垃圾信息。JCaptcha 即为 Java 版本的 CAPTCHA 项目,其是一个开源项目,支持生成图形和声音版的验证码,在生成声音版的验证码时,需要使用到 FreeTTS。目前,JCaptcha 官方网站显示有 2.0 版本,但二进制版只有 1.0 版可供下载,本文亦是基于 1.0 版本展开。

回页首

一个简单的图形验证码

JCaptcha 提供了一定的可扩展能力,用于开发人员创建出复杂的图形验证码。下面,首先利用 JCaptcha 提供的 API 来快速开发一个简单示例。本文的示例为 Web 应用,可以运行在 Tomcat 和 WebSphere 上,除了准备 Web 服务器外,我们还需要准备好 JCaptcha 运行时所必须的 Jar 包。

准备所需的 Jar 包

JCaptcha 项目在实现中,还引用了 commons-collections 和 commons-logging 两个开源项目,再加上 JCaptcha 本身的实现,我们共需要三个包,具体信息如下:

  • jcaptcha-1.0-all.jar
  • commons-logging-1.1.1.jar
  • commons-collections-3.2.jar

创建生成图形验证码的 Servlet

在示例 1 中,我们采用 Servlet 生成验证码图片,并将这个图片写到 ServletOutputStream 中,同时将 Servlet 的 response 的类型设置为 image/jpeg。在前台页面中,我们使用 img 标签,并将 src 指向这个 Servlet,这样我们就可以在页面中显示这个生成的验证码图片。清单 1 是 Servlet 代码片段。


清单 1. 生成图形验证码代码片段
				
 // set content type as jpeg 
 httpServletResponse.setHeader("Cache-Control", "no-store"); 
 httpServletResponse.setHeader("Pragma", "no-cache"); 
 httpServletResponse.setDateHeader("Expires", 0); 
 httpServletResponse.setContentType("image/jpeg"); 

 // create the image using session ID 
 logger.fine("tring to get image captcha service"); 
 BufferedImage bufferedImage = service 
        .getImageChallengeForID(httpServletRequest.getSession(true) 
            .getId()); 

 ServletOutputStream servletOutputStream = httpServletResponse 
        .getOutputStream(); 

 // write the image to the servlet output stream 
 logger.fine("tring to output buffered image to servlet output stream"); 
 ImageIO.write(bufferedImage, "jpg", servletOutputStream); 
  
 try { 
  servletOutputStream.flush(); 
 } finally { 
  servletOutputStream.close(); 
 } 

清单 1 中的 service 对象,我们采用了一个 JCaptcha 的默认实现类 DefaultManageableImageCaptchaService,在代码中,我们需要通过获取 service 对象,根据 Session ID 来生成验证码图片。除了使用该默认实现类外,我们也可以通过实现 ImageCaptchaService 接口来生成更为复杂的验证码图片(参见示例 2)。清单 2 为获取 service 对象的示例代码,JCaptcha 建议使用单例来生成 service 对象。


清单 2. 生成 ImageCaptchaService 对象
				
 public class SampleImageCaptchaService  { 

 private static ImageCaptchaService instance; 

 /** 
 * Get default manageable image captcha service 
 * @return ImageCaptchaService 
 */ 
 public static ImageCaptchaService getInstance() { 
 if (instance == null) { 
    instance = new DefaultManageableImageCaptchaService(); 
  } 
    return instance; 
  } 
 } 

示例 1 提供了 2 个简单的页面,一个用于显示图形验证码,另一个则在验证成功后显示成功信息。清单 3 为用于显示图形验证码的页面代码片段。


清单 3. 显示图形验证码页面代码片段
				
 <form action="CaptchaValidationServlet" method="post"> 
 <table> 
  <tr> 
    <td colspan="2"><img src=/blog_article/"ImageCaptchaServlet"/index.html /></td> 
  </tr> 
  <tr> 
    <td> 请输入您所看到的字符 :</td> 
    <td><input type="text" name="captcha_input" value="" /> 
                <%=request.getAttribute("ERROR") == null ? "" :       
                request.getAttribute("ERROR")%></td> 
  </tr> 
  <tr> 
      
    <td><input type="submit" value="提交" /></td> 
  </tr> 
 </table> 
 </form> 

    
[2]交叉编译时报错:/usr/bin/ld: cannot find -lc
    来源: 互联网  发布时间: 2013-11-07
我用的是RHEL6.3的系统,在交叉编译时报错:/usr/bin/ld: cannot find -lc。网上搜了说要装glibc,但我的系统本身就带的,又装了一边,还是报这个错误。我仔细排查,发现当有gcc -static ×××时报错,无static时正常。找了下,原来RHEL的安装盘里根本没有glibc-static安装包。这个折腾了我好久啊,太坑了!!!
作者:Season_hangzhou 发表于2013-1-5 17:00:26 原文链接
阅读:34 评论:0 查看评论

    
[3]Import a SharePoint Designer Reusable Workflow into Visual Studio in SharePoint 2013
    来源: 互联网  发布时间: 2013-11-07
Step by step import reuseable workflow in SharePoint 2013 by Visual Studio

 

This walkthrough demonstrates how to import a reusable workflow created in SharePoint Designer 2013 into a Visual Studio SharePoint workflow project.

Workflows created in SharePoint Designer, or declarative workflows, consist of XML statements instead of code. SharePoint Designer 2013 introducesreusable workflows, which are portable, declarative workflows that can be used by different lists in SharePoint sites.

Workflows created in Visual Studio 2013, such as sequential and state machine workflows, are calledcode workflows. Code workflows consist of XML files and code modules in which users can customize the workflow's behavior.

Visual Studio allows you to import reusable workflows created in SharePoint Designer 2013 and convert them to code workflows for use in your SharePoint sites.

This walkthrough demonstrates the following tasks:

  • Creating a simple, reusable workflow in SharePoint Designer.

  • Exporting the SharePoint Designer reusable workflow to a .wsp file and into SharePoint.

  • Importing the .wsp file into Visual Studio by using the Import Reusable Workflow project.

  • Altering the workflow by adding code.

  • Using the imported workflow in a SharePoint site.

Create a SharePoint Designer Reusable Workflow

Because SharePoint does not include any reusable workflows that you can use for this example, you will create one.In this simple workflow, when a user enters a new task in the Task list that has a specific title, the task is assigned to that user.

Create Target SharePoint Subsites

First you create two new SharePoint subsites: one to host the reusable workflows from SharePoint Designer, another to host the converted workflows.

To create SharePoint subsites
  • In SharePoint Designer 2010, on the menu bar, chooseFile,New Blank Web Site

  • In theNew Blank Web Site dialog box, browse to a SharePoint site where you want to create the workflow, or use the value of http://SystemName/ and then choose theOK button.The Home page appears.

  • In the Subsites section, choose the New button.

  • In the New dialog box, choose SharePoint Templates from the list in the left pane, and chooseTeam Site from the list in the right pane.

  • In the Specify the location of the Web site box, replace the word subsite in the URL with SPD1, and then choose the OK button.

  • This opens the new subsite into SharePoint Designer.Close this instance of SharePoint Designer and go back to the first instance (the top-level site).

  • Repeat steps 3 - 5 to create the second subsite, this time replacing the wordsubsite in the URL with SPD2.

  •  

    To create a SharePoint Designer reusable workflow
  • In the Subsites section, choose theSPD1 site to modify it.

  • On the ribbon, choose the Reusable Workflow button.

    The Create Reusable Workflow wizard appears.

  • In the Name box, enter SPD Task Workflow.

  • In the Content Type list, chooseTask, and then choose theOK button.

    The workflow opens in the SharePoint Designer workflow designer.

  • In the workflow designer, choose Step 1, and then, on the ribbon, choose theCondition button.

  • In the list of conditions, choose If current item field equals value.

    This step adds a condition that’s named If field equals value.

  • In the If field equals value condition, choose thefield link.

  • In the list of values, choose Title.

  • In the If field equals value condition, choose thevalue link.

  • In the box, enter New task.

    The condition statement now reads If Current Item:Title equals New task.

  • Choose the line under the condition statement, and then, on the ribbon, choose theAction button.

  • In the list of actions, choose Set field in current item.

  • In the Set field to value action, choose thefield link, and then, in the list, chooseAssigned to.

  • In the Set field to value action, choose thevalue link, and then, in the list of existing users and groups, chooseUser who created the item.

  • Choose the Add button, and then choose theOK button.

    The action statement now reads Set Assigned To to Current Item:CreatedBy.

  • Save and Deploy the Reusable Workflow

    Because Visual Studio can import only .wsp files, you must save the reusable workflow as a .wsp file and deploy it to SharePoint before importing it into Visual Studio.

    Important
        
    最新技术文章:
    ▪error while loading shared libraries的解決方法    ▪版本控制的极佳实践    ▪安装多个jdk,多个tomcat版本的冲突问题
    ▪简单选择排序算法    ▪国外 Android资源大集合 和个人学习android收藏    ▪.NET MVC 给loading数据加 ajax 等待loading效果
    ▪http代理工作原理(3)    ▪关注细节-TWaver Android    ▪Spring怎样把Bean实例暴露出来?
    ▪java写入excel2007的操作    ▪http代理工作原理(1)    ▪浅谈三层架构
    ▪http代理工作原理(2)    ▪解析三层架构……如何分层?    ▪linux PS命令
    ▪secureMRT Linux命令汉字出现乱码    ▪把C++类成员方法直接作为线程回调函数    ▪weak-and算法原理演示(wand)
    ▪53个要点提高PHP编程效率    ▪linux僵尸进程    ▪java 序列化到mysql数据库中
    ▪利用ndk编译ffmpeg    ▪活用CSS巧妙解决超长文本内容显示问题    ▪通过DBMS_RANDOM得到随机
    ▪CodeSmith 使用教程(8): CodeTemplate对象    ▪android4.0 进程回收机制    ▪仿天猫首页-产品分类
    ▪从Samples中入门IOS开发(四)------ 基于socket的...    ▪工作趣事 之 重装服务器后的网站不能正常访...    ▪java序列化学习笔记
    ▪Office 2010下VBA Addressof的应用    ▪一起来学ASP.NET Ajax(二)之初识ASP.NET Ajax    ▪更改CentOS yum 源为163的源
    ▪ORACLE 常用表达式    ▪记录一下,AS3反射功能的实现方法    ▪u盘文件系统问题
    ▪java设计模式-观察者模式初探    ▪MANIFEST.MF格式总结    ▪Android 4.2 Wifi Display核心分析 (一)
    ▪Perl 正则表达式 记忆方法    ▪.NET MVC 给loading数据加 ajax 等待laoding效果    ▪java 类之访问权限
    ▪extjs在myeclipse提示    ▪xml不提示问题    ▪Android应用程序运行的性能设计
    ▪sharepoint 2010 自定义列表启用版本记录控制 如...    ▪解决UIScrollView截获touch事件的一个极其简单有...    ▪Chain of Responsibility -- 责任链模式
    ▪运行skyeye缺少libbfd-2.18.50.0.2.20071001.so问题    ▪sharepoint 2010 使用sharepoint脚本STSNavigate方法实...    ▪让javascript显原型!
    ▪kohana基本安装配置    ▪MVVM开发模式实例解析    ▪sharepoint 2010 设置pdf文件在浏览器中访问
    ▪spring+hibernate+事务    ▪MyEclipse中文乱码,编码格式设置,文件编码格...    ▪struts+spring+hibernate用jquery实现数据分页异步加...
    ▪windows平台c++开发"麻烦"总结    ▪Android Wifi几点    ▪Myeclipse中JDBC连接池的配置
    ▪优化后的冒泡排序算法    ▪elasticsearch RESTful搜索引擎-(java jest 使用[入门])...    ▪MyEclipse下安装SVN插件SubEclipse的方法
    ▪100个windows平台C++开发错误之七编程    ▪串口转以太网模块WIZ140SR/WIZ145SR 数据手册(版...    ▪初识XML(三)Schema
    ▪Deep Copy VS Shallow Copy    ▪iphone游戏开发之cocos2d (七) 自定义精灵类,实...    ▪100个windows平台C++开发错误之八编程
    ▪C++程序的内存布局    ▪将不确定变为确定系列~Linq的批量操作靠的住...    ▪DIV始终保持在浏览器中央,兼容各浏览器版本
    ▪Activity生命周期管理之三——Stopping或者Restarti...    ▪《C语言参悟之旅》-读书笔记(八)    ▪C++函数参数小结
    ▪android Content Provider详解九    ▪简单的图片无缝滚动效果    ▪required artifact is missing.
    ▪c++编程风格----读书笔记(1)    ▪codeforces round 160    ▪【Visual C++】游戏开发笔记四十 浅墨DirectX教程...
    ▪【D3D11游戏编程】学习笔记十八:模板缓冲区...    ▪codeforces 70D 动态凸包    ▪c++编程风格----读书笔记(2)
    ▪Android窗口管理服务WindowManagerService计算Activity...    ▪keytool 错误: java.io.FileNotFoundException: MyAndroidKey....    ▪《HTTP权威指南》读书笔记---缓存
    ▪markdown    ▪[设计模式]总结    ▪网站用户行为分析在用户市场领域的应用
     


    站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3