zoukankan      html  css  js  c++  java
  • Windows Live Writer的几种代码插件比较

    1. Code Snippet to Format:

       1: HttpPost request = new HttpPost(url);  
       2: // 先封装一个 JSON 对象  
       3: JSONObject param = new JSONObject();  
       4: param.put("name", "rarnu");  
       5: param.put("password", "123456");  
       6: // 绑定到请求 Entry  
       7: StringEntity se = new StringEntity(param.toString());   
       8: request.setEntity(se);  
       9: // 发送请求  
      10: HttpResponse httpResponse = new DefaultHttpClient().execute(request);  
      11: // 得到应答的字符串,这也是一个 JSON 格式保存的数据  
      12: String retSrc = EntityUtils.toString(httpResponse.getEntity());  
      13: // 生成 JSON 对象  
      14: JSONObject result = new JSONObject( retSrc);  
      15: String token = result.get("token");  
    -------------------------------------------------------------------------------------------------------------------
    ---------------------------------------------------------------------------------------------------------------------
    2. Insert Code(支持少量语言):
    HttpPost request = new HttpPost(url);  
    // 先封装一个 JSON 对象  
    JSONObject param = new JSONObject();  
    param.put("name", "rarnu");  
    param.put("password", "123456");  
    // 绑定到请求 Entry  
    StringEntity se = new StringEntity(param.toString());   
    request.setEntity(se);  
    // 发送请求  
    HttpResponse httpResponse = new DefaultHttpClient().execute(request);  
    // 得到应答的字符串,这也是一个 JSON 格式保存的数据  
    String retSrc = EntityUtils.toString(httpResponse.getEntity());  
    // 生成 JSON 对象  
    JSONObject result = new JSONObject( retSrc);  
    String token = result.get("token");  
    -------------------------------------------------------------------------------------------------------------------
    ---------------------------------------------------------------------------------------------------------------------
    3. Source Code Format(不能复制):
    HttpPost request = new HttpPost(url);  
    
    // 先封装一个 JSON 对象  
    
    JSONObject param = new JSONObject();  
    
    param.put("name", "rarnu");  
    
    param.put("password", "123456");  
    
    // 绑定到请求 Entry  
    
    StringEntity se = new StringEntity(param.toString());   
    
    request.setEntity(se);  
    
    // 发送请求  
    
    HttpResponse httpResponse = new DefaultHttpClient().execute(request);  
    
    // 得到应答的字符串,这也是一个 JSON 格式保存的数据  
    
    String retSrc = EntityUtils.toString(httpResponse.getEntity());  
    
    // 生成 JSON 对象  
    
    JSONObject result = new JSONObject( retSrc);  
    

    String token = result.get("token");

    -------------------------------------------------------------------------------------------------------------------
    ---------------------------------------------------------------------------------------------------------------------
    4. Insert Source Code Plug-in:
    HttpPost request = new HttpPost(url);  
    // 先封装一个 JSON 对象  
    JSONObject param = new JSONObject();  
    param.put("name", "rarnu");  
    param.put("password", "123456");  
    // 绑定到请求 Entry  
    StringEntity se = new StringEntity(param.toString());   
    request.setEntity(se);  
    // 发送请求  
    HttpResponse httpResponse = new DefaultHttpClient().execute(request);  
    // 得到应答的字符串,这也是一个 JSON 格式保存的数据  
    String retSrc = EntityUtils.toString(httpResponse.getEntity());  
    // 生成 JSON 对象  
    JSONObject result = new JSONObject( retSrc);  
    String token = result.get("token");  
    -------------------------------------------------------------------------------------------------------------------
    ---------------------------------------------------------------------------------------------------------------------
    5. 插入代码块(可以定制多个BLOG)
    HttpPost request = new HttpPost(url);  
    // 先封装一个 JSON 对象  
    JSONObject param = new JSONObject();  
    param.put("name", "rarnu");  
    param.put("password", "123456");  
    // 绑定到请求 Entry  
    StringEntity se = new StringEntity(param.toString());   
    request.setEntity(se);  
    // 发送请求  
    HttpResponse httpResponse = new DefaultHttpClient().execute(request);  
    // 得到应答的字符串,这也是一个 JSON 格式保存的数据  
    String retSrc = EntityUtils.toString(httpResponse.getEntity());  
    // 生成 JSON 对象  
    JSONObject result = new JSONObject( retSrc);  
    String token = result.get("token");  

    -------------------------------------------------------------------------------------------------------------------
    ---------------------------------------------------------------------------------------------------------------------
    这是CSDN效果:
    http://blog.csdn.net/dadoneo/archive/2011/04/02/6299133.aspx
    这是51CTO效果:
    http://dadoneo.blog.51cto.com/2908573/534096(简直无语)
  • 相关阅读:
    Java集合框架--List 遍历
    Java集合框架--List 类
    Leetcode 239 Sliding Window Maximum (指定滑动窗最大值) (滑动窗口)
    Vim配置
    子字符串模板 (双指针, 滑动窗口)
    Leetcode 76 Minimum Window Substring. (最小窗口子字符串) (滑动窗口, 双指针)
    Leetcode 3 Longest Substring Without Repeating Characters. (最长无重复字符子串) (滑动窗口, 双指针)
    一切从赞美开始
    Leetcode 10 regular expression matching (正则表达式匹配) (动态规划)
    Leetcode 5 Longest Palindromic Substring (最长回文子字符串)(动态规划)
  • 原文地址:https://www.cnblogs.com/dartagnan/p/2003895.html
Copyright © 2011-2022 走看看