ThreadSafeClientConnManager的20个例子
Java Code Examples for org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager
The following are 20 Jave code examples that show how to use the org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager class. These examples are extracted from open source projects. You can click to vote up the examples you like. Your votes will be used in an intelligent system to get more and better code examples. Thanks!
Example 1
From project Android-OpenCNAM-Library,
under directory /android-opencnam-library/src/com/tomdignan/android/opencnam/library/ssl/,
in source file SSLHelper.java
public static HttpClient makeAdditionalSSLCertsHttpClient(Context context) throws Exception { final SchemeRegistry schemeRegistry=new SchemeRegistry(); schemeRegistry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); schemeRegistry.register(new Scheme("https",createAdditionalCertsSSLSocketFactory(context),443)); final HttpParams params=new BasicHttpParams(); final ThreadSafeClientConnManager connectionManager=new ThreadSafeClientConnManager(params,schemeRegistry); HttpClient client=new DefaultHttpClient(connectionManager,params); return client; }
Example 2
From project apps-for-android,
under directory /Photostream/src/com/google/android/photostream/,
in source file Flickr.java
private void Flickr(){ final HttpParams params=new BasicHttpParams(); HttpProtocolParams.setVersion(params,HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params,"UTF-8"); final SchemeRegistry registry=new SchemeRegistry(); registry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); final ThreadSafeClientConnManager manager=new ThreadSafeClientConnManager(params,registry); mClient=new DefaultHttpClient(manager,params); }
Example 3
From project agile-stock,
under directory /src/hk/reality/stock/service/fetcher/,
in source file BaseIndexesFetcher.java
public BaseIndexesFetcher(){ HttpParams params=new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params,TIMEOUT * 1000); HttpConnectionParams.setSoTimeout(params,TIMEOUT * 1000); HttpProtocolParams.setUserAgent(params,Constants.USER_AGENT); SchemeRegistry schemeRegistry=new SchemeRegistry(); schemeRegistry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); ClientConnectionManager cm=new ThreadSafeClientConnManager(params,schemeRegistry); this.client=new DefaultHttpClient(cm,params); }
Example 4
From project Airports,
under directory /src/com/nadmm/airports/utils/,
in source file NetworkUtils.java
public static HttpClient getHttpClient(){ SchemeRegistry registry=new SchemeRegistry(); registry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); HttpParams params=new BasicHttpParams(); ClientConnectionManager cm=new ThreadSafeClientConnManager(params,registry); HttpClient client=new DefaultHttpClient(cm,params); return client; }
Example 5
From project android-download-manager,
under directory /src/com/yyxu/download/http/,
in source file AndroidHttpClient.java
/** * Create a new HttpClient with reasonable defaults (which you can update). * @param userAgent to report in your HTTP requests * @param context to use for caching SSL sessions (may be null for no caching) * @return AndroidHttpClient for you to use for all your requests. */ public static AndroidHttpClient newInstance(String userAgent,Context context){ HttpParams params=new BasicHttpParams(); HttpConnectionParams.setStaleCheckingEnabled(params,false); HttpConnectionParams.setConnectionTimeout(params,SOCKET_OPERATION_TIMEOUT); HttpConnectionParams.setSoTimeout(params,SOCKET_OPERATION_TIMEOUT); HttpConnectionParams.setSocketBufferSize(params,8192); HttpClientParams.setRedirecting(params,false); HttpProtocolParams.setUserAgent(params,userAgent); SchemeRegistry schemeRegistry=new SchemeRegistry(); schemeRegistry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); ClientConnectionManager manager=new ThreadSafeClientConnManager(params,schemeRegistry); return new AndroidHttpClient(manager,params); }
Example 6
From project Android-OpenCNAM-Library,
under directory /android-opencnam-library/src/com/tomdignan/android/opencnam/library/ssl/,
in source file SSLHelper.java
/** * This is a last resort. I am starting to think SSL implementations are not very consistent across different android devices. insecure code taken from http://stackoverflow.com/questions/2642777/trusting -all-certificates-using-httpclient-over-https */ public static HttpClient makeInsecureHttpClient() throws Exception { KeyStore trustStore=KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(null,null); SSLSocketFactory socketFactory=new InsecureSSLSocketFactory(trustStore); socketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); HttpParams params=new BasicHttpParams(); HttpProtocolParams.setVersion(params,HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params,HTTP.UTF_8); SchemeRegistry registry=new SchemeRegistry(); registry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); registry.register(new Scheme("https",socketFactory,443)); ClientConnectionManager clientConnMgr=new ThreadSafeClientConnManager(params,registry); return new DefaultHttpClient(clientConnMgr,params); }
Example 7
From project androidquery,
under directory /src/com/androidquery/callback/,
in source file AbstractAjaxCallback.java
private static DefaultHttpClient getClient(){ if (client == null || !REUSE_CLIENT) { AQUtility.debug("creating http client"); HttpParams httpParams=new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams,NET_TIMEOUT); HttpConnectionParams.setSoTimeout(httpParams,NET_TIMEOUT); ConnManagerParams.setMaxConnectionsPerRoute(httpParams,new ConnPerRouteBean(25)); HttpConnectionParams.setSocketBufferSize(httpParams,8192); SchemeRegistry registry=new SchemeRegistry(); registry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); registry.register(new Scheme("https",ssf == null ? SSLSocketFactory.getSocketFactory() : ssf,443)); ThreadSafeClientConnManager cm=new ThreadSafeClientConnManager(httpParams,registry); client=new DefaultHttpClient(cm,httpParams); } return client; }
Example 8
From project android_4,
under directory /zxing-1.6/android/src/com/google/zxing/client/android/,
in source file AndroidHttpClient.java
/** * Create a new HttpClient with reasonable defaults (which you can update). * @param userAgent to report in your HTTP requests. * @return AndroidHttpClient for you to use for all your requests. */ public static AndroidHttpClient newInstance(String userAgent){ HttpParams params=new BasicHttpParams(); HttpConnectionParams.setStaleCheckingEnabled(params,false); HttpConnectionParams.setConnectionTimeout(params,20 * 1000); HttpConnectionParams.setSoTimeout(params,20 * 1000); HttpConnectionParams.setSocketBufferSize(params,8192); HttpClientParams.setRedirecting(params,false); HttpProtocolParams.setUserAgent(params,userAgent); SchemeRegistry schemeRegistry=new SchemeRegistry(); schemeRegistry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); schemeRegistry.register(new Scheme("https",SSLSocketFactory.getSocketFactory(),443)); ClientConnectionManager manager=new ThreadSafeClientConnManager(params,schemeRegistry); return new AndroidHttpClient(manager,params); }
Example 9
From project android_download_manager,
under directory /src/example/filedownload/pub/,
in source file AndroidHttpClient.java
/** * Create a new HttpClient with reasonable defaults (which you can update). * @param userAgent to report in your HTTP requests * @param context to use for caching SSL sessions (may be null for no caching) * @return AndroidHttpClient for you to use for all your requests. */ public static AndroidHttpClient newInstance(String userAgent,Context context){ HttpParams params=new BasicHttpParams(); HttpConnectionParams.setStaleCheckingEnabled(params,false); HttpConnectionParams.setConnectionTimeout(params,SOCKET_OPERATION_TIMEOUT); HttpConnectionParams.setSoTimeout(params,SOCKET_OPERATION_TIMEOUT); HttpConnectionParams.setSocketBufferSize(params,8192); HttpClientParams.setRedirecting(params,false); HttpProtocolParams.setUserAgent(params,userAgent); SchemeRegistry schemeRegistry=new SchemeRegistry(); schemeRegistry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); ClientConnectionManager manager=new ThreadSafeClientConnManager(params,schemeRegistry); return new AndroidHttpClient(manager,params); }
Example 10
From project archiva,
under directory /archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/,
in source file DefaultArchivaAdministration.java
protected void setupWagon(NetworkConfiguration networkConfiguration){ if (networkConfiguration == null) { HttpWagon.setUseClientManagerPooled(true); ThreadSafeClientConnManager threadSafeClientConnManager=new ThreadSafeClientConnManager(); threadSafeClientConnManager.setDefaultMaxPerRoute(30); threadSafeClientConnManager.setMaxTotal(30); HttpWagon.setConnectionManagerPooled(threadSafeClientConnManager); } else { HttpWagon.setUseClientManagerPooled(networkConfiguration.isUsePooling()); ThreadSafeClientConnManager threadSafeClientConnManager=new ThreadSafeClientConnManager(); threadSafeClientConnManager.setDefaultMaxPerRoute(networkConfiguration.getMaxTotalPerHost()); threadSafeClientConnManager.setMaxTotal(networkConfiguration.getMaxTotal()); HttpWagon.setConnectionManagerPooled(threadSafeClientConnManager); } }
Example 11
From project 4308Cirrus,
under directory /tendril-android-lib/src/main/java/edu/colorado/cs/cirrus/android/,
in source file HttpUtils.java
public static HttpClient getNewHttpClient(){ try { KeyStore trustStore=KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(null,null); SSLSocketFactory sf=new EasySSLSocketFactory(trustStore); sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); HttpParams params=new BasicHttpParams(); HttpProtocolParams.setVersion(params,HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params,HTTP.UTF_8); SchemeRegistry registry=new SchemeRegistry(); registry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); registry.register(new Scheme("https",sf,443)); ClientConnectionManager ccm=new ThreadSafeClientConnManager(params,registry); return new DefaultHttpClient(ccm,params); } catch ( Exception e) { return new DefaultHttpClient(); } }
Example 12
From project agile-stock,
under directory /src/hk/reality/stock/service/fetcher/,
in source file BaseQuoteFetcher.java
public BaseQuoteFetcher(){ HttpParams params=new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params,TIMEOUT * 1000); HttpConnectionParams.setSoTimeout(params,TIMEOUT * 1000); HttpProtocolParams.setUserAgent(params,Constants.USER_AGENT); SchemeRegistry schemeRegistry=new SchemeRegistry(); schemeRegistry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); ClientConnectionManager cm=new ThreadSafeClientConnManager(params,schemeRegistry); this.client=new DefaultHttpClient(cm,params); this.cleaner=new HtmlCleaner(); CleanerProperties prop=cleaner.getProperties(); prop.setOmitDoctypeDeclaration(true); prop.setOmitUnknownTags(true); prop.setOmitComments(true); prop.setIgnoreQuestAndExclam(true); prop.setOmitDeprecatedTags(true); prop.setOmitXmlDeclaration(true); prop.setAdvancedXmlEscape(false); prop.setRecognizeUnicodeChars(false); prop.setOmitHtmlEnvelope(false); prop.setUseCdataForScriptAndStyle(true); }
Example 13
From project android-bankdroid,
under directory /src/eu/nullbyte/android/urllib/,
in source file Urllib.java
public Urllib(boolean acceptInvalidCertificates,boolean allowCircularRedirects){ this.acceptInvalidCertificates=acceptInvalidCertificates; this.headers=new HashMap<String,String>(); HttpParams params=new BasicHttpParams(); HttpProtocolParams.setVersion(params,HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params,this.charset); params.setBooleanParameter("http.protocol.expect-continue",false); if (allowCircularRedirects) params.setBooleanParameter("http.protocol.allow-circular-redirects",true); if (acceptInvalidCertificates) { SchemeRegistry registry=new SchemeRegistry(); registry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); registry.register(new Scheme("https",new EasySSLSocketFactory(),443)); ClientConnectionManager manager=new ThreadSafeClientConnManager(params,registry); httpclient=new DefaultHttpClient(manager,params); } else { SchemeRegistry registry=new SchemeRegistry(); registry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); registry.register(new Scheme("https",SSLSocketFactory.getSocketFactory(),443)); ClientConnectionManager manager=new ThreadSafeClientConnManager(params,registry); httpclient=new DefaultHttpClient(manager,params); } context=new BasicHttpContext(); }
Example 14
From project android-rackspacecloud,
under directory /extensions/apachehc/src/main/java/org/jclouds/http/apachehc/config/,
in source file ApacheHCHttpCommandExecutorServiceModule.java
@Singleton @Provides ClientConnectionManager newClientConnectionManager(HttpParams params,X509HostnameVerifier verifier,Closer closer) throws NoSuchAlgorithmException, KeyManagementException { SchemeRegistry schemeRegistry=new SchemeRegistry(); Scheme http=new Scheme("http",PlainSocketFactory.getSocketFactory(),80); SSLContext context=SSLContext.getInstance("TLS"); context.init(null,null,null); SSLSocketFactory sf=new SSLSocketFactory(context); sf.setHostnameVerifier(verifier); Scheme https=new Scheme("https",sf,443); SchemeRegistry sr=new SchemeRegistry(); sr.register(http); sr.register(https); schemeRegistry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); schemeRegistry.register(new Scheme("https",SSLSocketFactory.getSocketFactory(),443)); final ClientConnectionManager cm=new ThreadSafeClientConnManager(params,schemeRegistry); closer.addToClose(new Closeable(){ @Override public void close() throws IOException { cm.shutdown(); } } ); return cm; }
Example 15
From project android-utils,
under directory /src/net/beshkenadze/android/hacks/,
in source file DisableSSLCheck.java
public static HttpClient getNewHttpClient(HttpParams httpParameters){ TrustManager[] trustAllCerts=getTrustCerts(); try { KeyStore trustStore=KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(null,null); SSLContext sc=SSLContext.getInstance("TLS"); sc.init(null,trustAllCerts,new java.security.SecureRandom()); SSLSocketFactory sf=new MySSLSocketFactory(trustStore); HttpParams params=new BasicHttpParams(); HttpProtocolParams.setVersion(params,HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params,HTTP.UTF_8); SchemeRegistry registry=new SchemeRegistry(); registry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); registry.register(new Scheme("https",sf,443)); ClientConnectionManager ccm=new ThreadSafeClientConnManager(params,registry); return new DefaultHttpClient(ccm,params); } catch ( Exception e) { e.printStackTrace(); } return new DefaultHttpClient(); }
Example 16
From project android_framework_base_1,
under directory /core/java/android/net/http/,
in source file AndroidHttpClient.java
/** * Create a new HttpClient with reasonable defaults (which you can update). * @param userAgent to report in your HTTP requests * @param context to use for caching SSL sessions (may be null for no caching) * @return AndroidHttpClient for you to use for all your requests. */ public static AndroidHttpClient newInstance(String userAgent,Context context){ HttpParams params=new BasicHttpParams(); HttpConnectionParams.setStaleCheckingEnabled(params,false); HttpConnectionParams.setConnectionTimeout(params,SOCKET_OPERATION_TIMEOUT); HttpConnectionParams.setSoTimeout(params,SOCKET_OPERATION_TIMEOUT); HttpConnectionParams.setSocketBufferSize(params,8192); HttpClientParams.setRedirecting(params,false); SSLSessionCache sessionCache=context == null ? null : new SSLSessionCache(context); HttpProtocolParams.setUserAgent(params,userAgent); SchemeRegistry schemeRegistry=new SchemeRegistry(); schemeRegistry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); schemeRegistry.register(new Scheme("https",SSLCertificateSocketFactory.getHttpSocketFactory(SOCKET_OPERATION_TIMEOUT,sessionCache),443)); ClientConnectionManager manager=new ThreadSafeClientConnManager(params,schemeRegistry); return new AndroidHttpClient(manager,params); }
Example 17
From project andstatus,
under directory /src/org/andstatus/app/net/,
in source file ConnectionOAuth.java
public ConnectionOAuth(MyAccount ma){ super(ma); mOauthBaseUrl=ma.getOauthBaseUrl(); HttpParams parameters=new BasicHttpParams(); HttpProtocolParams.setVersion(parameters,HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(parameters,HTTP.DEFAULT_CONTENT_CHARSET); HttpProtocolParams.setUseExpectContinue(parameters,false); HttpConnectionParams.setTcpNoDelay(parameters,true); HttpConnectionParams.setSocketBufferSize(parameters,8192); SchemeRegistry schReg=new SchemeRegistry(); schReg.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); ClientConnectionManager tsccm=new ThreadSafeClientConnManager(parameters,schReg); mClient=new DefaultHttpClient(tsccm,parameters); OAuthKeys oak=new OAuthKeys(ma.getOriginId()); mConsumer=new CommonsHttpOAuthConsumer(oak.getConsumerKey(),oak.getConsumerSecret()); mProvider=new CommonsHttpOAuthProvider(getApiUrl(apiEnum.OAUTH_REQUEST_TOKEN),getApiUrl(apiEnum.OAUTH_ACCESS_TOKEN),getApiUrl(apiEnum.OAUTH_AUTHORIZE)); mProvider.setOAuth10a(true); if (ma.dataContains(ConnectionOAuth.USER_TOKEN) && ma.dataContains(ConnectionOAuth.USER_SECRET)) { setAuthInformation(ma.getDataString(ConnectionOAuth.USER_TOKEN,null),ma.getDataString(ConnectionOAuth.USER_SECRET,null)); } }
Example 18
From project andtweet,
under directory /src/com/xorcode/andtweet/net/,
in source file ConnectionOAuth.java
public ConnectionOAuth(SharedPreferences sp){ super(sp); HttpParams parameters=new BasicHttpParams(); HttpProtocolParams.setVersion(parameters,HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(parameters,HTTP.DEFAULT_CONTENT_CHARSET); HttpProtocolParams.setUseExpectContinue(parameters,false); HttpConnectionParams.setTcpNoDelay(parameters,true); HttpConnectionParams.setSocketBufferSize(parameters,8192); SchemeRegistry schReg=new SchemeRegistry(); schReg.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80)); ClientConnectionManager tsccm=new ThreadSafeClientConnManager(parameters,schReg); mClient=new DefaultHttpClient(tsccm,parameters); mConsumer=new CommonsHttpOAuthConsumer(OAuthKeys.TWITTER_CONSUMER_KEY,OAuthKeys.TWITTER_CONSUMER_SECRET); loadSavedKeys(sp); }
Example 19
From project android_external_oauth,
under directory /core/src/main/java/net/oauth/client/httpclient4/,
in source file HttpClient4.java
SingleClient(){ HttpClient client=new DefaultHttpClient(); ClientConnectionManager mgr=client.getConnectionManager(); if (!(mgr instanceof ThreadSafeClientConnManager)) { HttpParams params=client.getParams(); client=new DefaultHttpClient(new ThreadSafeClientConnManager(params,mgr.getSchemeRegistry()),params); } this.client=client; }
Example 20
From project android_image_downloader,
under directory /src/com/cleverua/test/thumbs/,
in source file HttpClentFactory.java
public synchronized static DefaultHttpClient getThreadSafeClient(){ if (client != null) return client; client=new DefaultHttpClient(); ClientConnectionManager mgr=client.getConnectionManager(); HttpParams params=client.getParams(); client=new DefaultHttpClient(new ThreadSafeClientConnManager(params,mgr.getSchemeRegistry()),params); return client; }
ThreadSafeClientConnManager的20个例子的更多相关文章
- 关于定时执行任务:Crontab的20个例子
关于定时执行任务:Crontab的20个例子 LeeLom 关注 2016.09.28 19:53* 字数 713 阅读 9186评论 6喜欢 15 简介 Linux crontab和Windows ...
- 1028 人口普查 (20 分)C语言
题目描述 某城镇进行人口普查,得到了全体居民的生日.现请你写个程序,找出镇上最年长和最年轻的人. 这里确保每个输入的日期都是合法的,但不一定是合理的--假设已知镇上没有超过200岁的老人,而今天是20 ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)的真正原因
在博客Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...
- db2 import export load
DB2中所谓的数据移动,包括: 1. 数据的导入(Import) 2. 数据的导出(Export) 3. 数据的装入(Load) 导入和装入都是利用DB2的相关命令把某种格式的文件中的数据保存到数据库 ...
- DB2常用命令
DB2安装启动服务中启动不了,可用command启动并查看windows系统的日志.1.启动数据库 db2start2.停止数据库 db2stop3.连接数据库运行 db2命令之前要先运行db2c ...
- Scala HandBook
目录[-] 1. Scala有多cool 1.1. 速度! 1.2. 易用的数据结构 1.3. OOP+FP 1.4. 动态+静态 1.5. DSL 1.6 ...
- 大前端学习笔记整理【五】rem与px换算的计算方式
前言 这段时间的小项目中算是真正意义上使用了rem来进行移动端的页面布局,项目结束了我反思了一下之前的对于rem的使用...原来我以前对rem用法完全是在搞笑啊!!结合这次这个小项目,我觉得我也有必要 ...
- Java 并发工具包 java.util.concurrent 用户指南
1. java.util.concurrent - Java 并发工具包 Java 5 添加了一个新的包到 Java 平台,java.util.concurrent 包.这个包包含有一系列能够让 Ja ...
- Python2.4-原理之函数
此节来自于<Python学习手册第四版>第四部分 一.函数基础 函数的作用在每个编程语言中都是大同小异的,,这个表是函数的相关语句和表达式. 1.编写函数,a.def是可执行代码,pyth ...
随机推荐
- Filter和FilterChain具体的使用说明
一.Filter的介绍及使用 什么是过滤器? 与Servlet类似,过滤器是一些web应用程序组件,能够绑定到一个web应用程序中.可是与其它web应用程序组件不同的是,过滤器是"链&quo ...
- EXT2/EXT3文件系统(一)
整理自<鸟哥的Linux私房菜>,整理者:华科小涛http://www.cnblogs.com/hust-ghtao/ 1.文件系统概念引入 文件系统是一种存储和组织计算机数据的方法,它使 ...
- JSP的学习(5)——语法知识三之include指令
本篇继续来对JSP语法中的JSP指令进行学习,在<JSP的学习(3)——语法知识二之page指令>中,已经介绍了JSP指令的书写格式和page指令的详细信息,所以在这一篇中我们会对JSP指 ...
- TCP/IP协议的编写《转载》
基于HHARM9-EDU的TCP/IP(UDP)协议的实现 原文网址:http://blog.csdn.net/lhj0503/article/details/3323788 摘 要:嵌入式技术的发展 ...
- Swift - 浮点数转换成整数(四舍五入与直接截断)
1,直接截去小数部分转换成整数 使用强制转换会将浮点部分去除,把整数部分转换为整数. 1 var i = Int(23.50) //23 2,四舍五入转换成整数 lroundf是一个全局函数,作用是将 ...
- Substrings 第37届ACM/ICPC 杭州赛区现场赛C题(hdu 4455)
http://acm.hdu.edu.cn/showproblem.php?pid=4455 https://icpcarchive.ecs.baylor.edu/index.php?option=c ...
- ABP启动配置
ABP启动配置 返回ABP系列 ABP是“ASP.NET Boilerplate Project (ASP.NET样板项目)”的简称. ASP.NET Boilerplate是一个用最佳实践和流行 ...
- Lucene.Net 2.3.1开发介绍 —— 四、搜索(一)
原文:Lucene.Net 2.3.1开发介绍 -- 四.搜索(一) 既然是内容筛选,或者说是搜索引擎,有索引,必然要有搜索.搜索虽然与索引有关,那也只是与索引后的文件有关,和索引的程序是无关的,因此 ...
- 一起talk C栗子吧(第十二回:C语言实例--单链表一)
各位看官们,大家好.从今天開始,我们讲大型章回体科技小说 :C栗子.也就是C语言实例.闲话休提, 言归正转. 让我们一起talk C栗子吧! 看官们,上一回中咱们没有说详细的样例,并且是说了样例中的文 ...
- Struts2 Action接收表单参数
struts2 Action获取表单传值 1.通过属性驱动式 JSP: <form action="sys/login.action" method ...