07 2013 档案
摘要:DateTime dt=DateTime.Now;//当前时间DateTime startWeek=dt.AddDays(1-Convert.ToInt32(dt.DayOfWeek.ToString("d")));//本周周一DateTime endWeek=startWeek.AddDays(6);//本周周日DateTime startMonth=dt.AddDays(1-dt.Day);//本月月初DateTime endMonth=startMonth.AddMonths(1).AddDays(-1);//本月月末//DateTime endMonth = sta
阅读全文
摘要:Unknown | unknown0发生未知错误。CertificateCommonNameIsIncorrect | certificateCommonNameIsIncorrect1SSL 证书公用名与 Web 地址不匹配。CertificateExpired | certificateExpired2SSL 证书已过期。CertificateContainsErrors | certificateContainsErrors3SSL 证书包含错误。CertificateRevoked | certificateRevoked4SSL 证书已吊销。CertificateIsInvalid
阅读全文
摘要:http://stackoverflow.com/questions/12608734/body-joints-angle-using-kinect-checking-time-interval?rq=1http://stackoverflow.com/questions/15989322/calculate-kinect-skeleton-knee-and-elbow-angles-using-existing-joint-angleshttp://channel9.msdn.com/coding4fun/kinect/Kinect-Earth-Movehttp://social.msdn.
阅读全文
摘要:http://stackoverflow.com/questions/12499602/body-joints-angle-using-kinect?rq=1新浪微博跟update相关的api已经挂了很多天了一直没有恢复正常,返回错误:40070 Error limited application access api!,新浪开放平台的论坛里n多的人都在等这个恢复,新浪官方也相当的恶心出问题了连个公告都没有,既不说什么原因又不说什么时候能恢复,。还是有版主说是api正在升级礼拜1恢复正常今天都礼拜2了还是不行。基于这个原因我的android版的新浪微博客户端已经停工好几天了,刚好是跟updat
阅读全文
摘要:public static void RegisterGlobalFilters(GlobalFilterCollection filters){ filters.Add(new HandleErrorAttribute()); filters.Add(new System.Web.Mvc.AuthorizeAttribute());}ttribute in the ASP.NET Web API.Custom Authorize Attributein ASP.NET WEB API you can extend "AuthorizeAttribute" to imple
阅读全文
摘要:using System;using System.Security.Cryptography;using System.Collections.Generic;using System.Text;using System.Web;namespace OAuth { public class OAuthBase { /// /// Provides a predefined set of algorithms that are supported officially by the protocol /// public enum S...
阅读全文
摘要:using System;using System.Collections.Generic;using System.Security.Cryptography;using System.Configuration;using System.Text;using System.Web;using System.Net;using System.IO;namespace Twitter{ class Auth { const string REQUEST_TOKEN_URL = "https://twitter.com/oauth/request_token"; ...
阅读全文
摘要:Web API核查表:设计、测试、发布API时需思考的43件事当设计、测试或发布一个新的Web API时,你是在一个原有的复杂系统上构建新的系统。那么至少,你也要建立在HTTP上,而HTTP则是基于TCP/IP创建的、TCP/IP建立在一系列的管道上。当然,你也需要考虑Web服务器、应用程序框架或者是API框架。API从设计到测试以至最终的发布需要经历一个漫长的过程,本文将主要探讨Web API从设计到最终发布,开发者可能忽略或者应该注意的东西。HTTP篇HTTP 1.1规范RFC2616是一个非常大的文档,下面我们节选了一些可能会对API产生影响的内容分享给大家:1.Idempotent方法
阅读全文
摘要:OAuth 2.0 for MVC, Two Legged ImplementationtdupontFri, Mar 18 2011 9:30 AM13OAuth 1.0 was one complicated beast. The OAuth 2.0 spec greatly simplified things, but that also had the wonderful side effect of rending all of our old OAuth 1.0 code obsolete. They say that "the only thing a pioneer
阅读全文
摘要:在上篇文章中我研究了OpenId及DotNetOpenAuth的相关应用,这一篇继续研究OAuth2.https://github.com/DotNetOpenAuthhttp://www.cnblogs.com/ljzforever/archive/2013/04/01/2985456.html 一.什么是OAuth2 OAuth是一种开放认证协议,允许用户让第三方应用访问该用户在某一网站上存储的私密的资源(如照片,视频,联系人列表),而无需将用户名和密码提供给第三方应用.数字2表示现在使用第2代协议. 二.OAuth2中的角色 OAuth2有四种角色 resource owner资源所有者
阅读全文
摘要:ou can customize theJsonSerializerSettingsby using theFormatters.JsonFormatter.SerializerSettingsproperty in theHttpConfigurationobject.For example, you could do that in the Application_Start() method:protected void Application_Start(){ HttpConfiguration config = GlobalConfiguration.Configuration...
阅读全文
摘要:Dog-fooding our API - Authenticationhttp://blog.mirajavora.com/authenticate-web-api-using-access-tokens2013年2月4日With fabrik (my portfolio and blogging startup) only weeks away from launch I'm excited to start blogging about "how we did it".As we're dog-fooding our own API (or "
阅读全文
摘要:ASP.NET Web API integration testing with in-memory hostinghttp://www.strathweb.com/2012/06/asp-net-web-api-integration-testing-with-in-memory-hosting/http://zamd.net/2012/05/04/claim-based-security-for-asp-net-web-apis-using-dotnetopenauth/In-memory hosting is one of the hidden gems of ASP.NET Web A
阅读全文
摘要:public HttpWebResponse InitiliazeWebRequest() { string responseData =string.Empty;//string url = GetServerEndPoint();string loginInstance ="url + logincreds";HttpWebRequest request =(HttpWebRequest)WebRequest.Create(loginInstance); request.Method="POST"; requ...
阅读全文
摘要:Planning real world REST APIhttp://blog.developers.ba/post/2012/03/03/ASPNET-Web-API-Authorization-using-Tokens.aspxWhen you try to plan how to build real world REST API like other major players like Facebook or Foursquare have you will soon realize that all major players use OAuth 2.0 .ASP.NET Web
阅读全文
摘要://压缩整个目录下载var projectFolder = Request.Params["folder"] != null ? Request.Params["folder"] : string.Empty; if (!string.IsNullOrWhiteSpace(projectFolder)) { string path = Util.GetMapPath(string.Format("attarch/html/{0}", projectFolder)); Response.Cle...
阅读全文
摘要:http://blog.csdn.net/try530/article/details/7782704代码顺序为:OnAuthorization-->AuthorizeCore-->HandleUnauthorizedRequest如果AuthorizeCore返回false时,才会走HandleUnauthorizedRequest 方法,并且Request.StausCode会返回401,401错误又对应了Web.config中的 所有,AuthorizeCore==false 时,会跳转到 web.config 中定义的 loginUrl="~/"[csh
阅读全文
摘要:https://code.google.com/p/mybatisnet/source/checkouthttp://blog.csdn.net/arvinstudy/article/details/7841020(iBatis使用小例)http://www.114xueche.com/video///服务层publicabstractclassBaseService{#region//实现事物处理publicvirtualvoidBeginTransaction(){IBatisNet.DataMapper.Mapper.Instance().BeginTransaction();}publ
阅读全文
摘要:http://www.piotrwalat.net/basic-http-authentication-in-asp-net-web-api-using-message-handlers/
阅读全文
摘要:http://attributerouting.net/#asp-net-web-apihttps://github.com/johnpapa/CodeCamper/blob/master/CodeCamper.Web/App_Start/WebApiConfig.cs(方法二)http://aspnetwebstack.codeplex.com/wikipage?title=Attribute%20routing%20in%20Web%20APIhttps://github.com/ASP-NET-MVC/aspnetwebstack
阅读全文
摘要:ASP.NET MVC4中调用WEB API的四个方法2012年06月07日00:05it168网站原创 作者:廖煜嵘 编辑:景保玉我要评论(0) 【IT168技术】当今的软件开发中,设计软件的服务并将其通过网络对外发布,让各种客户端去使用服务已经是十分普遍的做法。就.NET而言,目前提供了Remoting,WebService和WCF服务,这都能开发出功能十分强大的服务。然而,越来越多的互联网应用,希望将服务只是通过HTTP发布出去,而不是使用复杂的SOAP协议。为了解决这个问题,ASP.NET WebAPI就出现了。 ASP.NET API简单来说就是对REST协议进行了充分的支持,可..
阅读全文
摘要:当一个web api抛出一个异常后此异常会被转化成一个HTTP响应错误代码为500的服务错误但是如果你不想让客户端看到500的错误码你也可以自定义错误码如下代码当用户输入的ID没有与之相关的数据则返回了错误码为404的错误(页面未找到)public Product GetProduct(int id) { Product item = repository.Get(id); if (item == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode....
阅读全文
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Web.Http;namespace iAttendance.Controllers{ public class UsersController : ApiController { // GET api/users public IEnumerable GetUserList() { using (iAttendanceDataCon...
阅读全文
摘要:调函数(callback Function),顾名思义,用于回调的函数。 回调函数只是一个功能片段,由用户按照回调函数调用约定来实现的一个函数。回调函数是一个工作流的一部分,由工作流来决定函数的调用(回调)时机。回调函数包含下面几个特性:1、 属于工作流的一个部分;2、 必须按照工作流指定的调用约定来申明(定义);3、 他的调用时机由工作流决定,回调函数的实现者不能直接调用回调函数来实现工作流的功能;当通常大家说的回调函数一般就是按照别人的定好的接口规范写的,等待别人调用的函数,在C语言中,回调函数通常通过函数指针来传递;在Java中,通常就是编写另外一个类或类库的人规定一个接口,然后你来实现
阅读全文
摘要:SELECT sum(a.buycount) buycount,(SELECT c.name from tb_product_type_info c -- 按年WHERE c.id=b.typeid) typename,year(a.createdate)as year from tb_order_detail a,tb_product_pk b where a.productname=b.oldproduct GROUP BY b.typeid,year(a.createdate);SELECT sum(a.buycount) buycount,(SELECT c.name from tb_
阅读全文
摘要:update tb_sdd_info a,tb_bnm_evian_info b set a.username=b.username where a.username=b.memberno and year(a.createtime) = 2012 and month(a.createtime)=11;
阅读全文
摘要:上面写了console的乱码问题,接下来写的是web中servlet中的问题,大楷我比较关心一点,因为遇到这个的情况多一些吧。直接开始吧。2. jsp和servlet中的乱码问题分析:a. 其实在java文件的编译的情况和(一)中的情况是一样的,不过这里是由WEB容器去调用JVM而已,那么我们得知道一些默认的东西比如特别重要的:(摘要)如果Servlet 在运行的过程中,需要接受从客户端传来的字符如:表单输入的值和URL中传入的值,此时如果程序中没有设定接受参数时采用的编码格式,则WEB 容器会默认采用ISO-8859-1 编码格式来接受传入的值并在JVM 中转化为UNICODE 格式的保存在
阅读全文
摘要:package org.operamasks.servlet;import java.io.IOException;import java.io.PrintWriter;import java.util.List;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import net.sf.json.JSONArr
阅读全文
摘要:基于eclipse的mybatis映射代码自动生成的插件分类:JAVA数据库工具相关2012-04-29 00:152157人阅读评论(9)收藏举报eclipsegeneratoribatishibernate数据库encoding基于各种原因,老大突然提出“以后的项目全部用mybatis代替hibernate”的要求。咱也没什么说的,谁让别人是老大的,那话就是圣旨了。于是,又开始了hello world……(只用过ibatis,还好变化不是很多)。尽管很方便,但是却让人很蛋疼!!那xml映射、mapper接口等,太繁琐了。。官方提供的generator又是基于命令行的,非常不方便。终于,某个
阅读全文
摘要:基于eclipse的mybatis映射代码自动生成的插件分类:JAVA数据库工具相关2012-04-29 00:152157人阅读评论(9)收藏举报eclipsegeneratoribatishibernate数据库encoding基于各种原因,老大突然提出“以后的项目全部用mybatis代替hibernate”的要求。咱也没什么说的,谁让别人是老大的,那话就是圣旨了。于是,又开始了hello world……(只用过ibatis,还好变化不是很多)。尽管很方便,但是却让人很蛋疼!!那xml映射、mapper接口等,太繁琐了。。官方提供的generator又是基于命令行的,非常不方便。终于,某个
阅读全文
摘要:使用Mybatis Generator自动生成Mybatis相关代码博客分类:open sourceMySQLiBATISJDBCDAOXML本文将简要介绍怎样利用Mybatis Generator自动生成Mybatis的相关代码:一、构建一个环境:1. 首先创建一个表:Sql代码CREATETABLEpet(nameVARCHAR(20),ownerVARCHAR(20),speciesVARCHAR(20),sexCHAR(1),birthDATE,deathDATE);2. 然后注入数据Sql代码insertintopetvalues('Fluffy','Haro
阅读全文
摘要:MyBatis中,可以使用Generator自动生成代码,包括DAO层、 MODEL层 、MAPPING SQL映射文件。第一步:配置好自动生成代码所需的XML配置文件,例如(generator.xml): 第二步:下载mybatis-generator-core-1.3.1.jar包。第三步:进入XML配置文件(generator.xml)所在的的目录并执行命令:java -jar F:\mybatis-generator-core-1.3.1\lib\mybatis-generator-core-1.3.1.jar -configfile ge...
阅读全文