设置一个定时任务,每天更新汇率java代码如下

package com.thinkgem.jeesite.modules.huiLvApi.service;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Date;
import java.util.List; import org.activiti.engine.impl.util.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service; import com.thinkgem.jeesite.common.utils.GsonUtils;
import com.thinkgem.jeesite.modules.huiLvApi.entity.RetData;
import com.thinkgem.jeesite.modules.huiLvApi.entity.Root;
import com.thinkgem.jeesite.modules.sys.entity.Dict;
import com.thinkgem.jeesite.modules.sys.service.DictService; /**
* 调用百度汇率api
*
* @author Administrator
*
*/
@Service
@Scope
public class HuiLvService { @Autowired
DictService dictService; /**
* @param urlAll
* :请求接口
* @param httpArg
* :参数
* @return 返回结果
*/
public static String request(String httpUrl, String httpArg) {
BufferedReader reader = null;
String result = null;
StringBuffer sbf = new StringBuffer();
httpUrl = httpUrl + "?" + httpArg;
try {
URL url = new URL(httpUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
// 填入apikey到HTTP header
connection.setRequestProperty("apikey", "0d263364faa016e5f06075b69b799087");
connection.connect();
InputStream is = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String strRead = null;
while ((strRead = reader.readLine()) != null) {
sbf.append(strRead);
sbf.append("\r\n");
}
reader.close();
result = sbf.toString();
} catch (Exception e) {
e.printStackTrace();
}
return result;
} /**
* 定时任务每天执行调用百度汇率api
*
* @throws JSONException
*/
public void queryHuiLv() {
String httpUrl = "http://apis.baidu.com/apistore/currencyservice/currency";
String httpArg = null;
Dict dict = new Dict();
dict.setType("hui_lv");
List<Dict> dictList = dictService.findList(dict);// 查询出数据库表中所有的汇率
if (dictList != null && dictList.size() > 0) {
for (Dict dt : dictList) {
String value = dt.getValue();
httpArg = "fromCurrency=" + value + "&toCurrency=CNY&amount=1";
if (!"1".equals(value)) {// 表里面目前有个舍客勒 键值是1,所以调用百度接口时无法识别
String data = request(httpUrl, httpArg);
try {
if (data != null && !"".equals(data)) {
Root rt = GsonUtils.json2T(data, Root.class);
RetData retData = rt.getRetData();
dt.setValue(retData.getFromCurrency());// 汇率简称
dt.setLabel(retData.getCurrency());// 值
dt.setUpdateDate(new Date());
dictService.updateHuiLv(dt);
System.out.println(data);
System.out.println(retData);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
} /**
* 测试用
*
* @param httpUrl
* @param httpArg
* @return
*/
public static String newRequest(String httpUrl, String httpArg) {
BufferedReader reader = null;
String result = null;
StringBuffer sbf = new StringBuffer();
httpUrl = httpUrl + "?" + httpArg;
try {
URL url = new URL(httpUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
// 填入apikey到HTTP header
connection.setRequestProperty("apikey", "0d263364faa016e5f06075b69b799087");
connection.connect();
InputStream is = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String strRead = null;
while ((strRead = reader.readLine()) != null) {
sbf.append(strRead);
sbf.append("\r\n");
}
reader.close();
result = sbf.toString();
} catch (Exception e) {
e.printStackTrace();
}
return result;
} public static void main(String[] args) {
String httpUrl = "http://apis.baidu.com/apistore/currencyservice/currency";
String httpArg = "fromCurrency=USD&toCurrency=CNY&amount=1";
String jsonResult = newRequest(httpUrl, httpArg);
System.out.println(jsonResult);
}
}

定时任务配置配置文件名称是spring-tasks.xml  (spring-tasks.xml 里面有配置如何定时执行queryHuiLv)请留意看

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:c="http://www.springframework.org/schema/c" xmlns:cache="http://www.springframework.org/schema/cache" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xmlns:task="http://www.springframework.org/schema/task" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <!-- 定时清除手机短信redis缓存 -->
<task:scheduled-tasks scheduler="scheduler">
<!-- <task:scheduled ref="yuDengJiPushService" method="queryYuDengJiPush" cron="0 0/1 * * * ?"/> --> <task:scheduled fixed-delay="3600000" initial-delay="3000" ref="flightService" method="queryIndexFlight" />
<task:scheduled ref="systemService" method="clearSmsCache" cron="0 30 23 ? * * " />
<task:scheduled ref="exhiMainService" method="handleCuXiaoEnd" cron="0 0 8 * * ?" />
<task:scheduled ref="exhiMainService" method="outDateExhi" cron="0 30 0 ? * * " />
<task:scheduled ref="xuQiuService" method="setXuQiuCount" cron="* * 10,12,14,15,16,17 * * ? " />
<task:scheduled ref="columnService" method="cleanOutDateExhi" cron="0 30 0 ? * * " />
<task:scheduled ref="orderMainService" method="kaiZhanTiShi" cron="0 0 7 * * ?" />
<task:scheduled ref="yuDengJiPushService" method="queryYuDengJiPush" cron="0 30 8 * * ?"/>
<task:scheduled ref="searchRecordService" method="batchSave" cron="0 0/10 * * * ? "/>
<task:scheduled ref="fenXiaoRecordService" method="batchSave" cron="0 10 0 * * ? "/>
<task:scheduled ref="logService" method="batchSave" cron="0 0/2 * * * ? "/>
<task:scheduled ref="systemService" method="kaiFaRenYuanPush" cron="0 0 9 * * ?"/>
<!-- <task:scheduled ref="huiLvService" method="queryHuiLv" cron="0 0 21 * * ?"/> -->
<!-- <task:scheduled ref="huiLvService" method="queryHuiLv" cron="0 0/1 * * * ?"/> -->
</task:scheduled-tasks>
</beans>

spring-tasks.xml 配置在spring-context.xml里面

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"
default-lazy-init="true"> <description>Spring Configuration</description>
<!-- 加载配置属性文件 -->
<context:property-placeholder ignore-unresolvable="true" location="classpath:jeesite.properties" /> <task:scheduled-tasks scheduler="scheduler">
<task:scheduled ref="orderMainService" method="cuiKuan" cron="${allipay.cron.cuikuan}" />
</task:scheduled-tasks>
<!-- 加载应用属性实例,可通过 @Value("#{APP_PROP['jdbc.driver']}") String jdbcDriver 方式引用 -->
<util:properties id="APP_PROP" location="classpath:jeesite.properties" local-override="true"/> <!-- 使用Annotation自动注册Bean,解决事物失效问题:在主容器中不扫描@Controller注解,在SpringMvc中只扫描@Controller注解。 -->
<context:component-scan base-package="com.thinkgem.jeesite,com.allinpay"><!-- base-package 如果多个,用“,”分隔 -->
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan> <!-- MyBatis begin -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="typeAliasesPackage" value="com.thinkgem.jeesite"/>
<property name="typeAliasesSuperType" value="com.thinkgem.jeesite.common.persistence.BaseEntity"/>
<property name="mapperLocations" value="classpath:/mappings/**/*.xml"/>
<property name="configLocation" value="classpath:/mybatis-config.xml"></property>
</bean> <!-- 扫描basePackage下所有以@MyBatisDao注解的接口 -->
<bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
<property name="basePackage" value="com.thinkgem.jeesite"/>
<property name="annotationClass" value="com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao"/>
</bean> <!-- 定义事务 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean> <!-- 配置 Annotation 驱动,扫描@Transactional注解的类定义事务 -->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<!-- MyBatis end --> <!-- 配置 JSR303 Bean Validator 定义 -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /> <!-- 缓存配置 -->
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:${ehcache.configFile}" />
</bean> <!-- 计划任务配置,用 @Service @Lazy(false)标注类,用@Scheduled(cron = "0 0 2 * * ?")标注方法 -->
<task:executor id="executor" pool-size="10"/> <task:scheduler id="scheduler" pool-size="10"/>
<task:annotation-driven scheduler="scheduler" executor="executor" proxy-target-class="true"/> <!-- 数据源配置, 使用 BoneCP 数据库连接池 -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 数据源驱动类可不写,Druid默认会自动根据URL识别DriverClass -->
<property name="driverClassName" value="${jdbc.driver}" /> <!-- 基本属性 url、user、password -->
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" /> <!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="${jdbc.pool.init}" />
<property name="minIdle" value="${jdbc.pool.minIdle}" />
<property name="maxActive" value="${jdbc.pool.maxActive}" /> <!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="60000" /> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000" /> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000" /> <property name="validationQuery" value="${jdbc.testSql}" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" /> <!-- 打开PSCache,并且指定每个连接上PSCache的大小(Oracle使用)
<property name="poolPreparedStatements" value="true" />
<property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> --> <!-- 配置监控统计拦截的filters -->
<property name="filters" value="stat" />
</bean> <!-- 数据源配置, 使用应用服务器的数据库连接池
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/jeesite" />--> <!-- 数据源配置, 不使用连接池
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driver}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>-->
<bean id="startupListener" class="com.thinkgem.jeesite.modules.sys.listener.StartupListener"/>
<bean id="Scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" />
<import resource="spring-tasks.xml"/>
</beans>

spring-context.xml 配置在web.xml 里面

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"> <display-name>wanxiuAdmin</display-name> <!-- Context ConfigLocation -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/spring-context*.xml</param-value>
</context-param>
<listener>
<listener-class>com.thinkgem.jeesite.modules.sys.listener.WebContextListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- Apache Shiro -->
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- PageCache, cache .html suffix.
<filter>
<filter-name>PageCacheFilter</filter-name>
<filter-class>com.thinkgem.jeesite.common.filter.PageCachingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PageCacheFilter</filter-name>
<url-pattern>/</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>PageCacheFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>--> <!-- SiteMesh -->
<filter>
<filter-name>sitemeshFilter</filter-name>
<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemeshFilter</filter-name>
<url-pattern>/a/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemeshFilter</filter-name>
<url-pattern>/f/*</url-pattern>
</filter-mapping> <!-- MVC Servlet -->
<servlet>
<servlet-name>springServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/spring-mvc*.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping> <!-- Activiti -->
<servlet>
<servlet-name>RestletServlet</servlet-name>
<servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
<init-param>
<param-name>org.restlet.application</param-name>
<param-value>com.thinkgem.jeesite.modules.act.rest.ActRestApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>RestletServlet</servlet-name>
<url-pattern>/act/rest/service/*</url-pattern>
</servlet-mapping> <!-- DruidStatView -->
<servlet>
<servlet-name>DruidStatView</servlet-name>
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
<init-param>
<param-name>allow</param-name>
<param-value>127.0.0.1</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>DruidStatView</servlet-name>
<url-pattern>/druid/*</url-pattern>
</servlet-mapping> <!-- CKFinder -->
<servlet>
<servlet-name>CKFinderConnectorServlet</servlet-name>
<servlet-class>com.thinkgem.jeesite.common.web.CKFinderConnectorServlet</servlet-class>
<init-param>
<param-name>XMLConfig</param-name>
<param-value>/WEB-INF/ckfinder.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>configuration</param-name>
<param-value>com.thinkgem.jeesite.common.web.CKFinderConfig</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CKFinderConnectorServlet</servlet-name>
<url-pattern>/static/ckfinder/core/connector/java/connector.java</url-pattern>
</servlet-mapping>
<filter>
<filter-name>FileUploadFilter</filter-name>
<filter-class>com.ckfinder.connector.FileUploadFilter</filter-class>
<init-param>
<param-name>sessionCookieName</param-name>
<param-value>JSESSIONID</param-value>
</init-param>
<init-param>
<param-name>sessionParameterName</param-name>
<param-value>jsessionid</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>FileUploadFilter</filter-name>
<url-pattern>/static/ckfinder/core/connector/java/connector.java</url-pattern>
</filter-mapping> <!-- Userfiles download -->
<servlet>
<servlet-name>UserfilesDownloadServlet</servlet-name>
<servlet-class>com.thinkgem.jeesite.common.servlet.UserfilesDownloadServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UserfilesDownloadServlet</servlet-name>
<url-pattern>/userfiles/*</url-pattern>
</servlet-mapping> <!-- Validate code -->
<servlet>
<servlet-name>ValidateCodeServlet</servlet-name>
<servlet-class>com.thinkgem.jeesite.common.servlet.ValidateCodeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ValidateCodeServlet</servlet-name>
<url-pattern>/servlet/validateCodeServlet</url-pattern>
</servlet-mapping> <!-- FineReport
<servlet>
<servlet-name>ReportServer</servlet-name>
<servlet-class>com.fr.web.ReportServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ReportServer</servlet-name>
<url-pattern>/ReportServer</url-pattern>
</servlet-mapping>--> <!-- [INSERT FRAGMENT HERE] --> <!-- Session configure, to "jeesite.properties" file "session.sessionTimeout" parameter.
<session-config>
<session-timeout>30</session-timeout>
</session-config>--> <!-- Error page -->
<!-- <error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/WEB-INF/views/error/500.jsp</location>
</error-page> -->
<error-page>
<error-code>500</error-code>
<location>/WEB-INF/views/error/500.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/views/error/404.jsp</location>
</error-page> </web-app>

调用百度汇率api 获取各国的汇率值的更多相关文章

  1. HTML5调用百度地图API获取当前位置并直接导航目的地的方法

    <!DOCTYPE html> <html lang="zh-cmn-Hans">     <meta charset="UTF-8&quo ...

  2. HTML5页面直接调用百度地图API,获取当前位置,直接导航目的地

    <!DOCTYPE html> <html lang="zh-cmn-Hans"> <meta charset="UTF-8"&g ...

  3. 批量调用百度地图API获取地址经纬度坐标

    1 申请密匙 注册百度地图API:http://lbsyun.baidu.com/index.php?title=webapi 点击左侧 “获取密匙” ,经过填写个人信息.邮箱注册等,成功之后在开放平 ...

  4. H5调用百度地图API获取地理位置

    <script src="http://api.map.baidu.com/api?v=2.0&ak=填入申请的AK"></script> < ...

  5. Python调用百度地图API实现批量经纬度转换为实际省市地点(api调用,json解析,excel读取与写入)

    1.获取秘钥 调用百度地图API实现得申请百度账号或者登陆百度账号,然后申请自己的ak秘钥.链接如下:http://lbsyun.baidu.com/apiconsole/key?applicatio ...

  6. 原生js简单调用百度翻译API实现的翻译工具

    先来个在线demo: js翻译工具 或者百度搜索js简单调用百度翻译API工具(不过有个小小的界面显示bug,我想细心的人应该会发现) 或者直接前往该网址:js翻译工具 或者前往我的github:gi ...

  7. HTML5调用百度地图API进行地理定位实例

    自从HTML5的标准确定以后,越来越多的网站使用HTML5来进行开发.虽然对HTML5支持的浏览器不是很多,但是依然抵挡不了大伙对HTML5开发的热情.今天为大家带来的是使用HTML5调用百度地图AP ...

  8. Python 读取照片的信息:拍摄时间、拍摄设备、经纬度等,以及根据经纬度通过百度地图API获取位置

    通过第三方库exifread读取照片信息.exifread官网:https://pypi.org/project/ExifRead/ 一.安装exifreadpip install exifread ...

  9. 调用百度地图API的总结

    因为项目要用到百度地图,所以先摸索了一下,各种功能官方都有文档,点击可查看,文章的话我就直接写我用到的功能例子了,要用可以直接复制粘贴~ 一.主要涉及到的几个接口(先申请密钥): 1.技术一:坐标转换 ...

随机推荐

  1. 从游击队到正规军(三):基于Go的马蜂窝旅游网分布式IM系统技术实践

    本文由马蜂窝技术团队电商交易基础平台研发工程师"Anti Walker"原创分享. 一.引言 即时通讯(IM)功能对于电商平台来说非常重要,特别是旅游电商. 从商品复杂性来看,一个 ...

  2. mui 进度条 隐藏

    官方提供的 mui(contanier).progressbar().hide(); 并未起作用,DOM是js动态添加的,结果无法隐藏.(越使用,mui 的坑越多,陆续记录中...) 后使用下面的方法 ...

  3. Appium-测试失败后获取屏幕截图的方法

    最近一直在研究appium,偶尔的机会发现断言后获取屏幕截图.觉得这个方法不错,分享给大家 这样以后在遇到断言,想截图错误屏幕的时候,能够用的上. 1.首先需要2个类,一个是测试类(TestDropL ...

  4. Mysql主从复制,双主热备

    Mysql主从复制: 主从复制: 主机准备工作: 开启bin.Log 注意:server-id  是唯一的值 重启mysql:service mysql restart 查看是否开启成功: 查看当前状 ...

  5. Spring_第一个Spring入门案例IOC

    今天我们来写我们的第一个spring 第一步 建立一个java project 第二步 添加我们的五个jar文件 第三步 在项目中建立一个com.zk.spring包 第四步 建立我们的userser ...

  6. python学习之网路操作

    socket:服务器与客户端的常规操作,但默认创建的的sever.socket是阻塞式,不支持多个客户端的连接,要想连接多个客户端需要引入多线程.但对于IO类型来说大部分时间其实都在IO上与创建多个线 ...

  7. C语言:根据形参c中指定的英文字母,按顺序打印出若干后继相邻字母,-主函数中放入一个带头节点的链表结构中,h指向链表的头节点。fun函数找出学生的最高分-使用插入排序法对字符串中的字符进行升序排序。-从文件中找到指定学号的学生数据,读入次学生数据,

    //根据形参c中指定的英文字母,按顺序打印出若干后继相邻字母,输出字母的大小与形参c一致,数量由形参d指定.例如:输入c为Y,d为4,则输出ZABC. #include <stdio.h> ...

  8. Bugku - CTF加密篇之滴答~滴

    滴答~滴 答案格式KEY{xxxxxxxxx}

  9. POJ3268 Silver Cow Party (建反图跑两遍Dij)

    One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big co ...

  10. Java面向对象编程 -3

    this关键字 this可以算是Java里面比较复杂的关键字,因为this的使用形式约定了它的灵活性,在程序里面,使用this可以实现以下三类结构的描述: 当前类中的属性:this属性; 当前类中的方 ...